@well-played.gg/react-sdk 1.17.0 → 1.18.0

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.
@@ -491,4 +491,4 @@ img.ProseMirror-separator {
491
491
  data
492
492
  id
493
493
  }
494
- `,data:{__typename:Zm.cacheExtensionsCollectionTypename,id:e,data:[]}}),this.entityTypeMap.readEntityById(n)||(this._hasPendingCollectionUpdates||setTimeout(()=>this._updatePendingCollections(),0),this.pendingCollectionUpdates[r]||(this.pendingCollectionUpdates[r]={}),this.pendingCollectionUpdates[r][n]||(this.pendingCollectionUpdates[r][n]=(0,ls.makeReference)(n)))}_expire(e=!1){const{entitiesById:n}=this.entityTypeMap.extract(),r=[];return Object.keys(n).forEach(i=>{const s=n[i],{storeFieldNames:o,dataId:a,fieldName:l,typename:u}=s;(0,si.isQuery)(a)&&o?Object.keys(o.entries).forEach(d=>{this.invalidationPolicyManager.runReadPolicy({typename:u,dataId:a,fieldName:l,storeFieldName:d,reportOnly:e})&&r.push((0,si.makeEntityId)(a,d))}):this.invalidationPolicyManager.runReadPolicy({typename:u,dataId:a,fieldName:l,reportOnly:e})&&r.push((0,si.makeEntityId)(a))}),r.length>0&&this.broadcastWatches(),r}expire(){return this._expire(!1)}expiredEntities(){return this._expire(!0)}activatePolicyEvents(...e){e.length>0?this.invalidationPolicyManager.activatePolicies(...e):this.invalidationPolicyManager.activatePolicies(Nn.InvalidationPolicyEvent.Read,Nn.InvalidationPolicyEvent.Write,Nn.InvalidationPolicyEvent.Evict)}deactivatePolicyEvents(...e){e.length>0?this.invalidationPolicyManager.deactivatePolicies(...e):this.invalidationPolicyManager.deactivatePolicies(Nn.InvalidationPolicyEvent.Read,Nn.InvalidationPolicyEvent.Write,Nn.InvalidationPolicyEvent.Evict)}activePolicyEvents(){return[Nn.InvalidationPolicyEvent.Read,Nn.InvalidationPolicyEvent.Write,Nn.InvalidationPolicyEvent.Evict].filter(e=>this.invalidationPolicyManager.isPolicyEventActive(e))}read(e){const n=super.read(e);if(!this.invalidationPolicyManager.isPolicyEventActive(Nn.InvalidationPolicyEvent.Read))return n;const r=(0,si.maybeDeepClone)(n),i=this.cacheResultProcessor.processReadResult(r,e);return i===Ml.ReadResultStatus.Complete?n:(this.broadcastWatches(),i===Ml.ReadResultStatus.Evicted?null:r)}diff(e){const n=super.diff(e);if(!this.invalidationPolicyManager.isPolicyEventActive(Nn.InvalidationPolicyEvent.Read)||this.isBroadcasting)return n;const{result:r}=n,i=(0,si.maybeDeepClone)(r),s=this.cacheResultProcessor.processReadResult(i,e);return s===Ml.ReadResultStatus.Complete||(this.broadcastWatches(),n.complete=!1,n.result=s===Ml.ReadResultStatus.Evicted?void 0:i),n}extract(e=!1,n=!0){this._hasPendingCollectionUpdates&&this._updatePendingCollections();const r=super.extract(e);return n&&(r.invalidation=(0,Gse.default)(this.entityTypeMap.extract(),"entitiesById")),r}readFragmentWhere(e){const{fragment:n,filter:r,limit:i,orderBy:s}=e,o=Xm(e,["fragment","filter","limit","orderBy"]),l=n.definitions[0].typeCondition.name.value,d=this.readReferenceWhere({__typename:l,filter:r,limit:i,orderBy:s}).map(h=>this.readFragment(Object.assign(Object.assign({},o),{fragment:n,id:h.__ref})));return(0,zse.default)(d)}readReferenceWhere(e){const{__typename:n,filter:r,limit:i,orderBy:s}=e,o=(0,Zm.collectionEntityIdForType)(n);this.pendingCollectionUpdates[o]&&this._updatePendingCollection(o);let a=this.readField("data",(0,ls.makeReference)(o));if(!a)return[];const l=this.readField.bind(this);if(r&&(a=a.filter(u=>{if((0,Jse.default)(r))return r(u,l);const d=Object.keys(r).map(h=>{const p=r[h],g=this.readField(h,u);return p===g});return(0,Qse.default)(d,Boolean)})),s){const{field:u,descending:d}=s;a=(0,Yse.default)(a,h=>l(u,h),[d?"desc":"asc"])}return(0,Kse.default)(i)?a:(0,Hse.default)(a,i)}writeFragmentWhere(e){const{update:n}=e,r=Xm(e,["update"]);this.readFragmentWhere(r).forEach(i=>{this.writeFragment({id:this.identify(i),fragment:e.fragment,data:n(i),broadcast:!1})}),this.broadcastWatches()}}yh.default=eoe;(function(t){var e=Re&&Re.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(t,"__esModule",{value:!0}),t.InvalidationPolicyCache=t.makeCachedVar=void 0;var n=Lb;Object.defineProperty(t,"makeCachedVar",{enumerable:!0,get:function(){return n.makeCachedVar}});var r=yh;Object.defineProperty(t,"InvalidationPolicyCache",{enumerable:!0,get:function(){return e(r).default}})})(dx);var Jx={},l0={},$s={};const toe=Ha(xB);Object.defineProperty($s,"__esModule",{value:!0});$s.buildWatchFragmentWhereQuery=$s.buildWatchFragmentQuery=void 0;const cs=toe,noe=Gc;function Yx({fieldName:t,fragmentDefinition:e}){return{kind:cs.Kind.DOCUMENT,definitions:[{directives:[],variableDefinitions:[],kind:cs.Kind.OPERATION_DEFINITION,operation:cs.OperationTypeNode.QUERY,selectionSet:{kind:cs.Kind.SELECTION_SET,selections:[{arguments:[],kind:cs.Kind.FIELD,name:{kind:cs.Kind.NAME,value:t},directives:[{arguments:[],kind:cs.Kind.DIRECTIVE,name:{kind:cs.Kind.NAME,value:"client"}}],selectionSet:e.selectionSet}]}}]}}function roe(t){const{fragment:e,id:n,policies:r,fieldName:i}=t,s=e.definitions[0],o=Yx({fragmentDefinition:s,fieldName:i});return r.getFieldPolicy("Query",i)||r.addTypePolicies({Query:{fields:{[i]:{read(a){return(0,noe.makeReference)(n)}}}}}),o}$s.buildWatchFragmentQuery=roe;function ioe(t){const{fragment:e,filterVar:n,limitVar:r,orderByVar:i,policies:s,cache:o,fieldName:a}=t,l=e.definitions[0],u=l.typeCondition.name.value,d=Yx({fragmentDefinition:l,fieldName:a});return s.getFieldPolicy("Query",a)||s.addTypePolicies({Query:{fields:{[a]:{read(h){return o.readReferenceWhere({__typename:u,filter:n(),limit:r(),orderBy:i()})}}}}}),d}$s.buildWatchFragmentWhereQuery=ioe;Object.defineProperty(l0,"__esModule",{value:!0});const ff=Gc,zO=$s,QO=zs;class soe extends ff.ApolloClient{constructor(e){super(e),this.policies=this.cache.policies}watchQueryForField(e,n){const r=this.watchQuery({fetchPolicy:"cache-only",query:e}),i=r.subscribe.bind(r);return r.subscribe=(s,...o)=>{typeof s!="object"&&(s={next:s,error:o[0],complete:o[1]});const a=s.next;s.next=d=>{var h;a&&a((h=d==null?void 0:d.data)===null||h===void 0?void 0:h[n])};const l=i(s),u=l.unsubscribe.bind(l);return l.unsubscribe=()=>{delete this.cache.policies.typePolicies.Query.fields[n],u()},l},r}watchFragment(e){const n=(0,QO.generateFragmentFieldName)(),r=(0,zO.buildWatchFragmentQuery)(Object.assign(Object.assign({},e),{fieldName:n,policies:this.policies}));return this.watchQueryForField(r,n)}watchFragmentWhere(e){const n=(0,QO.generateFragmentFieldName)(),r=(0,ff.makeVar)(e.filter),i=(0,ff.makeVar)(e.limit),s=(0,ff.makeVar)(e.orderBy),o=(0,zO.buildWatchFragmentWhereQuery)(Object.assign(Object.assign({},e),{fieldName:n,filterVar:r,limitVar:i,orderByVar:s,cache:this.cache,policies:this.policies}));return this.watchQueryForField(o,n)}}l0.default=soe;(function(t){var e=Re&&Re.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(t,"__esModule",{value:!0}),t.ApolloExtensionsClient=void 0;var n=l0;Object.defineProperty(t,"ApolloExtensionsClient",{enumerable:!0,get:function(){return e(n).default}})})(Jx);var Xx={},c0={},Mo={},ooe=Re&&Re.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Mo,"__esModule",{value:!0});Mo.usePrevious=Mo.useOnce=void 0;const Td=ae,aoe=ooe(_h);function loe(t){const e=(0,Td.useRef)(),n=(0,Td.useRef)(!1);return n.current||((0,aoe.default)(t)?e.current=t():e.current=t,n.current=!0),e.current}Mo.useOnce=loe;const coe=t=>{const e=(0,Td.useRef)(null);return(0,Td.useEffect)(()=>{e.current=t}),e.current};Mo.usePrevious=coe;var Xc={};Object.defineProperty(Xc,"__esModule",{value:!0});Xc.useFragmentTypePolicyFieldName=void 0;const uoe=Xa,GO=ae,foe=zs,doe=Mo,hoe=({fragmentName:t}={})=>{const e=(0,GO.useMemo)(()=>(0,foe.generateFragmentFieldName)({fragmentName:t}),[t]),n=(0,doe.usePrevious)(e),r=(0,uoe.useApolloClient)();return(0,GO.useEffect)(()=>()=>{delete r.cache.policies.typePolicies.Query.fields[n]},[e,n]),e};Xc.useFragmentTypePolicyFieldName=hoe;var Zc={};Object.defineProperty(Zc,"__esModule",{value:!0});Zc.useGetQueryDataByFieldName=void 0;const poe=Xa,moe=(t,e,n)=>{var r,i;const s=(0,poe.useQuery)(t,{fetchPolicy:"cache-only",returnPartialData:n==null?void 0:n.returnPartialData});return{data:(i=(r=s==null?void 0:s.data)===null||r===void 0?void 0:r[e])!==null&&i!==void 0?i:null}};Zc.useGetQueryDataByFieldName=moe;Object.defineProperty(c0,"__esModule",{value:!0});const goe=Xa,yoe=ae,voe=Mo,boe=$s,_oe=Xc,Eoe=Zc;function woe(t,e){const r=(0,yoe.useContext)((0,goe.getApolloContext)()).client,i=r==null?void 0:r.cache,s=(0,_oe.useFragmentTypePolicyFieldName)(),o=(0,voe.useOnce)(()=>(0,boe.buildWatchFragmentQuery)({fragment:t,fieldName:s,id:e.id,policies:i.policies}));return(0,Eoe.useGetQueryDataByFieldName)(o,s,e)}c0.default=woe;var u0={};const Toe=Ha(xU);Object.defineProperty(u0,"__esModule",{value:!0});const Soe=Xa,Ri=ae,Ooe=$s,koe=Xc,Noe=Zc,eg=Xa,HO=Toe;function Aoe(t,e){var n;const r=e==null?void 0:e.filter,s=(0,Ri.useRef)((0,eg.makeVar)(r)).current,o=e==null?void 0:e.limit,l=(0,Ri.useRef)((0,eg.makeVar)(o)).current,u=e==null?void 0:e.orderBy,h=(0,Ri.useRef)((0,eg.makeVar)(u)).current,g=(0,Ri.useContext)((0,Soe.getApolloContext)()).client,y=g==null?void 0:g.cache,b=(0,koe.useFragmentTypePolicyFieldName)({fragmentName:e==null?void 0:e.fragmentName}),_=(0,Ri.useRef)([]);(0,Ri.useEffect)(()=>{(typeof r=="function"&&r!==s()||!(0,HO.equal)(r,s()))&&s(r)},[r]),(0,Ri.useEffect)(()=>{o!==l()&&l(o)},[o]),(0,Ri.useEffect)(()=>{(typeof u=="function"&&u!==h()||!(0,HO.equal)(u,h()))&&h(u)},[u]);const w=(0,Ri.useMemo)(()=>(0,Ooe.buildWatchFragmentWhereQuery)({filter:r,filterVar:s,limitVar:l,orderByVar:h,fragment:t,fieldName:b,cache:y,policies:y.policies}),[b]),O=(0,Noe.useGetQueryDataByFieldName)(w,b,e);return Object.assign(Object.assign({},O),{data:(n=O.data)!==null&&n!==void 0?n:_.current})}u0.default=Aoe;(function(t){var e=Re&&Re.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(t,"__esModule",{value:!0}),t.useFragmentWhere=t.useFragment=void 0;var n=c0;Object.defineProperty(t,"useFragment",{enumerable:!0,get:function(){return e(n).default}});var r=u0;Object.defineProperty(t,"useFragmentWhere",{enumerable:!0,get:function(){return e(r).default}})})(Xx);var Zx={},f0={},eu={},Ioe=Re&&Re.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(eu,"__esModule",{value:!0});eu.AuditType=void 0;const xoe=Ioe(Ih);var ec;(function(t){t.Read="Read",t.Write="Write",t.Evict="Evict"})(ec||(eu.AuditType=ec={}));class Coe extends xoe.default{constructor(e){super(e),this.auditLog=e.auditLog}runReadPolicy({typename:e,dataId:n,fieldName:r,storeFieldName:i,reportOnly:s=!1}){return this.auditLog.log("Running read policy",ec.Read,"InvalidationPolicyManager",{storeFieldName:i,typename:e,dataId:n,fieldName:r}),super.runReadPolicy({typename:e,dataId:n,fieldName:r,storeFieldName:i,reportOnly:s})}runWritePolicy(e,n){return this.auditLog.log("Running write policy",ec.Write,"InvalidationPolicyManager",Object.assign({typeName:e},n)),super.runWritePolicy(e,n)}runEvictPolicy(e,n){return this.auditLog.log("Running evict policy",ec.Write,"InvalidationPolicyManager",Object.assign({typeName:e},n)),super.runEvictPolicy(e,n)}}eu.default=Coe;var d0={},Doe=Re&&Re.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(d0,"__esModule",{value:!0});const Roe=Doe(Dh);var Sd;(function(t){t.Write="Write",t.Evict="Evict"})(Sd||(Sd={}));class Moe extends Roe.default{constructor(e){super(),this.auditLog=e.auditLog}write(e,n,r,i){return this.auditLog.log("Writing to type map",Sd.Write,"EntityTypeMap",{typename:e,dataId:n,storeFieldName:r,variables:i}),super.write(e,n,r,i)}evict(e,n){return this.auditLog.log("Evicting from type map",Sd.Evict,"EntityTypeMap",{dataId:e,storeFieldName:n}),super.evict(e,n)}}d0.default=Moe;var h0={},Poe=Wb;function Foe(t,e){var n=[];return Poe(t,function(r,i,s){e(r,i,s)&&n.push(r)}),n}var $oe=Foe,Loe=Sx,Voe=$oe,joe=Zb,Boe=$n;function Uoe(t,e){var n=Boe(t)?Loe:Voe;return n(t,joe(e))}var qoe=Uoe,Woe=Re&&Re.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(h0,"__esModule",{value:!0});const zoe=Woe(qoe);class Qoe{constructor(){this._log=[]}log(e,n,r,i){const s={time:Date.now(),type:n,event:e,meta:i,group:r};this._log.push(s)}getLog(e){return(0,zoe.default)(this._log,e)}printLog(e){this.getLog(e).forEach(this.printLogEntry)}printLogEntry(e){var n;console.log(`%c event: ${e.event}`,"color: green"),console.group(),console.log(`type: ${e.type}`),console.log(`time: ${e.time}`),console.log(`meta: ${JSON.stringify((n=e.meta)!==null&&n!==void 0?n:{})}`),console.groupEnd()}}h0.default=Qoe;var Rh=Re&&Re.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(f0,"__esModule",{value:!0});const Goe=Rh(yh),Hoe=Ro,Koe=Rh(eu),Joe=Rh(d0),Yoe=Rh(h0),Xoe=s0;class Zoe extends Goe.default{constructor(e){super(e),this.auditLog=new Yoe.default;const{invalidationPolicies:n={}}=e;this.entityTypeMap=new Joe.default({auditLog:this.auditLog}),new Xoe.EntityStoreWatcher({entityStore:this.entityStoreRoot,entityTypeMap:this.entityTypeMap,policies:this.policies,reactiveVarsCache:this.reactiveVarsCache,updateCollectionField:this.updateCollectionField.bind(this)}),this.invalidationPolicyManager=new Koe.default({auditLog:this.auditLog,policies:n,entityTypeMap:this.entityTypeMap,cacheOperations:{evict:this.evict.bind(this),modify:this.modify.bind(this),readField:this.readField.bind(this)}}),this.cacheResultProcessor=new Hoe.CacheResultProcessor({invalidationPolicyManager:this.invalidationPolicyManager,entityTypeMap:this.entityTypeMap,cache:this})}}f0.default=Zoe;(function(t){var e=Re&&Re.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(t,"__esModule",{value:!0}),t.InvalidationPolicyCacheAuditor=void 0;var n=f0;Object.defineProperty(t,"InvalidationPolicyCacheAuditor",{enumerable:!0,get:function(){return e(n).default}})})(Zx);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.RenewalPolicy=t.InvalidationPolicyEvent=t.InvalidationPolicyCacheAuditor=t.useFragmentWhere=t.useFragment=t.ApolloExtensionsClient=t.makeCachedVar=t.InvalidationPolicyCache=void 0;var e=dx;Object.defineProperty(t,"InvalidationPolicyCache",{enumerable:!0,get:function(){return e.InvalidationPolicyCache}}),Object.defineProperty(t,"makeCachedVar",{enumerable:!0,get:function(){return e.makeCachedVar}});var n=Jx;Object.defineProperty(t,"ApolloExtensionsClient",{enumerable:!0,get:function(){return n.ApolloExtensionsClient}});var r=Xx;Object.defineProperty(t,"useFragment",{enumerable:!0,get:function(){return r.useFragment}}),Object.defineProperty(t,"useFragmentWhere",{enumerable:!0,get:function(){return r.useFragmentWhere}});var i=Zx;Object.defineProperty(t,"InvalidationPolicyCacheAuditor",{enumerable:!0,get:function(){return i.InvalidationPolicyCacheAuditor}});var s=Rr;Object.defineProperty(t,"InvalidationPolicyEvent",{enumerable:!0,get:function(){return s.InvalidationPolicyEvent}}),Object.defineProperty(t,"RenewalPolicy",{enumerable:!0,get:function(){return s.RenewalPolicy}})})(my);var tg=function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))},eae=function(){function t(e){var n=e.debug,r=n===void 0?!1:n;this.debug=r,this.lines=[]}return t.prototype.emit=function(e,n){if(e in console){var r=t.prefix;console[e].apply(console,tg([r],n,!1))}},t.prototype.tailLogs=function(){var e=this;this.lines.forEach(function(n){var r=n[0],i=n[1];return e.emit(r,i)})},t.prototype.getLogs=function(){return this.lines},t.prototype.write=function(e,n){var r=t.buffer;this.lines=tg(tg([],this.lines.slice(1-r),!0),[[e,n]],!1),(this.debug||e!=="log")&&this.emit(e,n)},t.prototype.info=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.write("log",e)},t.prototype.warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.write("warn",e)},t.prototype.error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.write("error",e)},t.buffer=30,t.prefix="[apollo-cache-persist]",t}(),tae=function(){function t(e){var n=e.cache,r=e.serialize,i=r===void 0?!0:r;this.cache=n,this.serialize=i}return t.prototype.extract=function(){var e=this.cache.extract();return this.serialize&&(e=JSON.stringify(e)),e},t.prototype.restore=function(e){this.serialize&&typeof e=="string"&&(e=JSON.parse(e)),e!=null&&this.cache.restore(e)},t}(),df=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(d){try{u(r.next(d))}catch(h){o(h)}}function l(d){try{u(r.throw(d))}catch(h){o(h)}}function u(d){d.done?s(d.value):i(d.value).then(a,l)}u((r=r.apply(t,e||[])).next())})},hf=function(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(d){return l([u,d])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(n=0)),n;)try{if(r=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){n.label=u[1];break}if(u[0]===6&&n.label<s[1]){n.label=s[1],s=u;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(u);break}s[2]&&n.ops.pop(),n.trys.pop();continue}u=e.call(t,n)}catch(d){u=[6,d],i=0}finally{r=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},eC=function(){function t(e){var n=e.storage,r=e.key,i=r===void 0?"apollo-cache-persist":r;this.storage=n,this.key=i}return t.prototype.read=function(){return df(this,void 0,void 0,function(){return hf(this,function(e){return[2,this.storage.getItem(this.key)]})})},t.prototype.write=function(e){return df(this,void 0,void 0,function(){return hf(this,function(n){switch(n.label){case 0:return[4,this.storage.setItem(this.key,e)];case 1:return n.sent(),[2]}})})},t.prototype.purge=function(){return df(this,void 0,void 0,function(){return hf(this,function(e){switch(e.label){case 0:return[4,this.storage.removeItem(this.key)];case 1:return e.sent(),[2]}})})},t.prototype.getSize=function(){return df(this,void 0,void 0,function(){var e;return hf(this,function(n){switch(n.label){case 0:return[4,this.storage.getItem(this.key)];case 1:return e=n.sent(),e==null?[2,0]:[2,typeof e=="string"?e.length:null]}})})},t}(),ng=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(d){try{u(r.next(d))}catch(h){o(h)}}function l(d){try{u(r.throw(d))}catch(h){o(h)}}function u(d){d.done?s(d.value):i(d.value).then(a,l)}u((r=r.apply(t,e||[])).next())})},rg=function(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(d){return l([u,d])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(n=0)),n;)try{if(r=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){n.label=u[1];break}if(u[0]===6&&n.label<s[1]){n.label=s[1],s=u;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(u);break}s[2]&&n.ops.pop(),n.trys.pop();continue}u=e.call(t,n)}catch(d){u=[6,d],i=0}finally{r=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},tC=function(){function t(e,n){var r=e.log,i=e.cache,s=e.storage,o=n.maxSize,a=o===void 0?1024*1024:o,l=n.persistenceMapper;this.log=r,this.cache=i,this.storage=s,this.paused=!1,l&&(this.persistenceMapper=l),a&&(this.maxSize=a)}return t.prototype.persist=function(){return ng(this,void 0,void 0,function(){var e,n;return rg(this,function(r){switch(r.label){case 0:return r.trys.push([0,6,,7]),e=this.cache.extract(),!this.paused&&this.persistenceMapper?[4,this.persistenceMapper(e)]:[3,2];case 1:e=r.sent(),r.label=2;case 2:return this.maxSize!=null&&typeof e=="string"&&e.length>this.maxSize&&!this.paused?[4,this.purge()]:[3,4];case 3:return r.sent(),this.paused=!0,[2];case 4:return this.paused?[2]:[4,this.storage.write(e)];case 5:return r.sent(),this.log.info(typeof e=="string"?"Persisted cache of size ".concat(e.length," characters"):"Persisted cache"),[3,7];case 6:throw n=r.sent(),this.log.error("Error persisting cache",n),n;case 7:return[2]}})})},t.prototype.restore=function(){return ng(this,void 0,void 0,function(){var e,n;return rg(this,function(r){switch(r.label){case 0:return r.trys.push([0,5,,6]),[4,this.storage.read()];case 1:return e=r.sent(),e==null?[3,3]:[4,this.cache.restore(e)];case 2:return r.sent(),this.log.info(typeof e=="string"?"Restored cache of size ".concat(e.length," characters"):"Restored cache"),[3,4];case 3:this.log.info("No stored cache to restore"),r.label=4;case 4:return[3,6];case 5:throw n=r.sent(),this.log.error("Error restoring cache",n),n;case 6:return[2]}})})},t.prototype.purge=function(){return ng(this,void 0,void 0,function(){var e;return rg(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.storage.purge()];case 1:return n.sent(),this.log.info("Purged cache storage"),[3,3];case 2:throw e=n.sent(),this.log.error("Error purging cache storage",e),e;case 3:return[2]}})})},t}();const nC=function(t){var e=t.cache;return function(n){var r=e.write,i=e.evict,s=e.modify,o=e.gc;return e.write=function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var u=r.apply(e,a);return n(),u},e.evict=function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var u=i.apply(e,a);return n(),u},e.modify=function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var u=s.apply(e,a);return n(),u},e.gc=function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var u=o.apply(e,a);return n(),u},function(){e.write=r,e.evict=i,e.modify=s,e.gc=o}}},nae=function(t){var e=t.log,n=t.cache;return function(r){return e.warn("Trigger option `background` not available on web; using `write` trigger"),nC({cache:n})(r)}};var rae=function(){function t(e,n){var r=e.log,i=e.persistor,s=this;this.fire=function(){if(!s.debounce){s.persist();return}s.timeout!=null&&clearTimeout(s.timeout),s.timeout=setTimeout(s.persist,s.debounce)},this.persist=function(){s.paused||s.persistor.persist()};var o=t.defaultDebounce,a=n.cache,l=n.debounce,u=n.trigger,d=u===void 0?"write":u;if(d)switch(this.debounce=l??o,this.persistor=i,this.paused=!1,d){case"write":this.uninstall=nC({cache:a})(this.fire);break;case"background":l&&r.warn("Debounce is not recommended with `background` trigger"),this.debounce=l,this.uninstall=nae({cache:a,log:r})(this.fire);break;default:if(typeof d=="function")this.uninstall=d(this.fire);else throw Error("Unrecognized trigger option: ".concat(d))}}return t.prototype.pause=function(){this.paused=!0},t.prototype.resume=function(){this.paused=!1},t.prototype.remove=function(){this.uninstall&&(this.uninstall(),this.uninstall=null,this.paused=!0)},t.defaultDebounce=1e3,t}(),iae=function(){function t(e){if(!e.cache)throw new Error("In order to persist your Apollo Cache, you need to pass in a cache. Please see https://www.apollographql.com/docs/react/basics/caching.html for our default InMemoryCache.");if(!e.storage)throw new Error("In order to persist your Apollo Cache, you need to pass in an underlying storage provider. Please see https://github.com/apollographql/apollo-cache-persist#storage-providers");var n=new eae(e),r=new tae(e),i=new eC(e),s=new tC({log:n,cache:r,storage:i},e),o=new rae({log:n,persistor:s},e);this.log=n,this.cache=r,this.storage=i,this.persistor=s,this.trigger=o}return t.prototype.persist=function(){return this.persistor.persist()},t.prototype.restore=function(){return this.persistor.restore()},t.prototype.purge=function(){return this.persistor.purge()},t.prototype.pause=function(){this.trigger.pause()},t.prototype.resume=function(){this.trigger.resume()},t.prototype.remove=function(){this.trigger.remove()},t.prototype.getLogs=function(e){if(e===void 0&&(e=!1),e)this.log.tailLogs();else return this.log.getLogs()},t.prototype.getSize=function(){return this.storage.getSize()},t}(),p0=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),sae=function(t){var e=new oae(t);e.restoreSync()},oae=function(t){p0(e,t);function e(n){var r=t.call(this,n)||this;return r.storage=new lae(n),r.persistor=new aae({log:r.log,cache:r.cache,storage:r.storage},n),r}return e.prototype.restoreSync=function(){this.persistor.restoreSync()},e}(iae),aae=function(t){p0(e,t);function e(n,r){var i=n.log,s=n.cache,o=n.storage;return t.call(this,{log:i,cache:s,storage:o},r)||this}return e.prototype.restoreSync=function(){this.cache.restore(this.storage.readSync())},e}(tC),lae=function(t){p0(e,t);function e(n){return t.call(this,n)||this}return e.prototype.readSync=function(){return this.storage.getItem(this.key)},e}(eC),cae=function(){function t(e){this.storage=e}return t.prototype.getItem=function(e){return this.storage.getItem(e)},t.prototype.removeItem=function(e){return this.storage.removeItem(e)},t.prototype.setItem=function(e,n){return n!==null?this.storage.setItem(e,n):this.removeItem(e)},t}();function qn(t){return t===null?"null":Array.isArray(t)?"array":typeof t}function so(t){return qn(t)==="object"}function uae(t){return Array.isArray(t)&&t.length>0&&t.every(e=>"message"in e)}function KO(t,e){return t.length<124?t:e}const fae="graphql-transport-ws";var sr;(function(t){t[t.InternalServerError=4500]="InternalServerError",t[t.InternalClientError=4005]="InternalClientError",t[t.BadRequest=4400]="BadRequest",t[t.BadResponse=4004]="BadResponse",t[t.Unauthorized=4401]="Unauthorized",t[t.Forbidden=4403]="Forbidden",t[t.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",t[t.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",t[t.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",t[t.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",t[t.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(sr||(sr={}));var Dt;(function(t){t.ConnectionInit="connection_init",t.ConnectionAck="connection_ack",t.Ping="ping",t.Pong="pong",t.Subscribe="subscribe",t.Next="next",t.Error="error",t.Complete="complete"})(Dt||(Dt={}));function rC(t){if(!so(t))throw new Error(`Message is expected to be an object, but got ${qn(t)}`);if(!t.type)throw new Error("Message is missing the 'type' property");if(typeof t.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${qn(t.type)}`);switch(t.type){case Dt.ConnectionInit:case Dt.ConnectionAck:case Dt.Ping:case Dt.Pong:{if(t.payload!=null&&!so(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${t.payload}"`);break}case Dt.Subscribe:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${qn(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!so(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${qn(t.payload)}`);if(typeof t.payload.query!="string")throw new Error(`"${t.type}" message payload expects the 'query' property to be a string, but got ${qn(t.payload.query)}`);if(t.payload.variables!=null&&!so(t.payload.variables))throw new Error(`"${t.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${qn(t.payload.variables)}`);if(t.payload.operationName!=null&&qn(t.payload.operationName)!=="string")throw new Error(`"${t.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${qn(t.payload.operationName)}`);if(t.payload.extensions!=null&&!so(t.payload.extensions))throw new Error(`"${t.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${qn(t.payload.extensions)}`);break}case Dt.Next:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${qn(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!so(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${qn(t.payload)}`);break}case Dt.Error:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${qn(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!uae(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(t.payload)}`);break}case Dt.Complete:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${qn(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${t.type}"`)}return t}function dae(t,e){return rC(typeof t=="string"?JSON.parse(t,e):t)}function Pl(t,e){return rC(t),JSON.stringify(t,e)}var Oa=function(t){return this instanceof Oa?(this.v=t,this):new Oa(t)},hae=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){r[p]&&(i[p]=function(g){return new Promise(function(y,b){s.push([p,g,y,b])>1||a(p,g)})})}function a(p,g){try{l(r[p](g))}catch(y){h(s[0][3],y)}}function l(p){p.value instanceof Oa?Promise.resolve(p.value.v).then(u,d):h(s[0][2],p)}function u(p){a("next",p)}function d(p){a("throw",p)}function h(p,g){p(g),s.shift(),s.length&&a(s[0][0],s[0][1])}};function pae(t){const{url:e,connectionParams:n,lazy:r=!0,onNonLazyError:i=console.error,lazyCloseTimeout:s=0,keepAlive:o=0,disablePong:a,connectionAckWaitTimeout:l=0,retryAttempts:u=5,retryWait:d=async function(Ae){let fe=1e3;for(let Ee=0;Ee<Ae;Ee++)fe*=2;await new Promise(Ee=>setTimeout(Ee,fe+Math.floor(Math.random()*2700+300)))},shouldRetry:h=ig,isFatalConnectionProblem:p,on:g,webSocketImpl:y,generateID:b=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,Ae=>{const fe=Math.random()*16|0;return(Ae=="x"?fe:fe&3|8).toString(16)})},jsonMessageReplacer:_,jsonMessageReviver:w}=t;let O;if(y){if(!gae(y))throw new Error("Invalid WebSocket implementation provided");O=y}else typeof WebSocket<"u"?O=WebSocket:typeof global<"u"?O=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(O=window.WebSocket||window.MozWebSocket);if(!O)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");const N=O,I=(()=>{const te=(()=>{const fe={};return{on(Ee,ge){return fe[Ee]=ge,()=>{delete fe[Ee]}},emit(Ee){var ge;"id"in Ee&&((ge=fe[Ee.id])===null||ge===void 0||ge.call(fe,Ee))}}})(),Ae={connecting:g!=null&&g.connecting?[g.connecting]:[],opened:g!=null&&g.opened?[g.opened]:[],connected:g!=null&&g.connected?[g.connected]:[],ping:g!=null&&g.ping?[g.ping]:[],pong:g!=null&&g.pong?[g.pong]:[],message:g!=null&&g.message?[te.emit,g.message]:[te.emit],closed:g!=null&&g.closed?[g.closed]:[],error:g!=null&&g.error?[g.error]:[]};return{onMessage:te.on,on(fe,Ee){const ge=Ae[fe];return ge.push(Ee),()=>{ge.splice(ge.indexOf(Ee),1)}},emit(fe,...Ee){for(const ge of[...Ae[fe]])ge(...Ee)}}})();function P(te){const Ae=[I.on("error",fe=>{Ae.forEach(Ee=>Ee()),te(fe)}),I.on("closed",fe=>{Ae.forEach(Ee=>Ee()),te(fe)})]}let M,B=0,Q,x=!1,U=0,be=!1;async function Oe(){clearTimeout(Q);const[te,Ae]=await(M??(M=new Promise((ge,ct)=>(async()=>{if(x){if(await d(U),!B)return M=void 0,ct({code:1e3,reason:"All Subscriptions Gone"});U++}I.emit("connecting",x);const ve=new N(typeof e=="function"?await e():e,fae);let L,Z;function Y(){isFinite(o)&&o>0&&(clearTimeout(Z),Z=setTimeout(()=>{ve.readyState===N.OPEN&&(ve.send(Pl({type:Dt.Ping})),I.emit("ping",!1,void 0))},o))}P(we=>{M=void 0,clearTimeout(L),clearTimeout(Z),ct(we),we instanceof JO&&(ve.close(4499,"Terminated"),ve.onerror=null,ve.onclose=null)}),ve.onerror=we=>I.emit("error",we),ve.onclose=we=>I.emit("closed",we),ve.onopen=async()=>{try{I.emit("opened",ve);const we=typeof n=="function"?await n():n;if(ve.readyState!==N.OPEN)return;ve.send(Pl(we?{type:Dt.ConnectionInit,payload:we}:{type:Dt.ConnectionInit},_)),isFinite(l)&&l>0&&(L=setTimeout(()=>{ve.close(sr.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},l)),Y()}catch(we){I.emit("error",we),ve.close(sr.InternalClientError,KO(we instanceof Error?we.message:new Error(we).message,"Internal client error"))}};let ee=!1;ve.onmessage=({data:we})=>{try{const Me=dae(we,w);if(I.emit("message",Me),Me.type==="ping"||Me.type==="pong"){I.emit(Me.type,!0,Me.payload),Me.type==="pong"?Y():a||(ve.send(Pl(Me.payload?{type:Dt.Pong,payload:Me.payload}:{type:Dt.Pong})),I.emit("pong",!1,Me.payload));return}if(ee)return;if(Me.type!==Dt.ConnectionAck)throw new Error(`First message cannot be of type ${Me.type}`);clearTimeout(L),ee=!0,I.emit("connected",ve,Me.payload,x),x=!1,U=0,ge([ve,new Promise((Ye,Zt)=>P(Zt))])}catch(Me){ve.onmessage=null,I.emit("error",Me),ve.close(sr.BadResponse,KO(Me instanceof Error?Me.message:new Error(Me).message,"Bad response"))}}})())));te.readyState===N.CLOSING&&await Ae;let fe=()=>{};const Ee=new Promise(ge=>fe=ge);return[te,fe,Promise.race([Ee.then(()=>{if(!B){const ge=()=>te.close(1e3,"Normal Closure");isFinite(s)&&s>0?Q=setTimeout(()=>{te.readyState===N.OPEN&&ge()},s):ge()}}),Ae])]}function ke(te){if(ig(te)&&(mae(te.code)||[sr.InternalServerError,sr.InternalClientError,sr.BadRequest,sr.BadResponse,sr.Unauthorized,sr.SubprotocolNotAcceptable,sr.SubscriberAlreadyExists,sr.TooManyInitialisationRequests].includes(te.code)))throw te;if(be)return!1;if(ig(te)&&te.code===1e3)return B>0;if(!u||U>=u||!h(te)||p!=null&&p(te))throw te;return x=!0}r||(async()=>{for(B++;;)try{const[,,te]=await Oe();await te}catch(te){try{if(!ke(te))return}catch(Ae){return i==null?void 0:i(Ae)}}})();function Le(te,Ae){const fe=b(te);let Ee=!1,ge=!1,ct=()=>{B--,Ee=!0};return(async()=>{for(B++;;)try{const[ve,L,Z]=await Oe();if(Ee)return L();const Y=I.onMessage(fe,ee=>{switch(ee.type){case Dt.Next:{Ae.next(ee.payload);return}case Dt.Error:{ge=!0,Ee=!0,Ae.error(ee.payload),ct();return}case Dt.Complete:{Ee=!0,ct();return}}});ve.send(Pl({id:fe,type:Dt.Subscribe,payload:te},_)),ct=()=>{!Ee&&ve.readyState===N.OPEN&&ve.send(Pl({id:fe,type:Dt.Complete},_)),B--,Ee=!0,L()},await Z.finally(Y);return}catch(ve){if(!ke(ve))return}})().then(()=>{ge||Ae.complete()}).catch(ve=>{Ae.error(ve)}),()=>{Ee||ct()}}return{on:I.on,subscribe:Le,iterate(te){const Ae=[],fe={done:!1,error:null,resolve:()=>{}},Ee=Le(te,{next(ct){Ae.push(ct),fe.resolve()},error(ct){fe.done=!0,fe.error=ct,fe.resolve()},complete(){fe.done=!0,fe.resolve()}}),ge=function(){return hae(this,arguments,function*(){for(;;){for(Ae.length||(yield Oa(new Promise(L=>fe.resolve=L)));Ae.length;)yield yield Oa(Ae.shift());if(fe.error)throw fe.error;if(fe.done)return yield Oa(void 0)}})}();return ge.throw=async ct=>(fe.done||(fe.done=!0,fe.error=ct,fe.resolve()),{done:!0,value:void 0}),ge.return=async()=>(Ee(),{done:!0,value:void 0}),ge},async dispose(){if(be=!0,M){const[te]=await M;te.close(1e3,"Normal Closure")}},terminate(){M&&I.emit("closed",new JO)}}}class JO extends Error{constructor(){super(...arguments),this.name="TerminatedCloseEvent",this.message="4499: Terminated",this.code=4499,this.reason="Terminated",this.wasClean=!1}}function ig(t){return so(t)&&"code"in t&&"reason"in t}function mae(t){return[1e3,1001,1006,1005,1012,1013,1014].includes(t)?!1:t>=1e3&&t<=1999}function gae(t){return typeof t=="function"&&"constructor"in t&&"CLOSED"in t&&"CLOSING"in t&&"CONNECTING"in t&&"OPEN"in t}const yae=({apiUrl:t,organizationId:e,listeners:n,lazy:r=!1,token:i})=>{const s=pae({url:`wss://${t}`,lazy:r,connectionParams:vc.omitBy({"organization-id":e,authorization:i?`Bearer ${i}`:void 0},vc.isNil),keepAlive:1e4});return n&&(n.onConnected&&s.on("connected",n.onConnected),n.onClosed&&s.on("closed",n.onClosed),n.onError&&s.on("error",n.onError)),s},vae=({token:t,organizationId:e,invalidationPolicies:n,handlers:r,fetchPolicy:i,websocket:s,apiBaseUrl:o})=>{const a=new my.InvalidationPolicyCache({invalidationPolicies:{...n,timeToLive:(n==null?void 0:n.timeToLive)??12e4,renewalPolicy:(n==null?void 0:n.renewalPolicy)??my.RenewalPolicy.None}});sae({cache:a,storage:new cae(window.localStorage)});const l=`api.warrior.${o??"well-played.gg"}/graphql`,u=Pv(({query:d})=>{const h=Vo(d);return h.kind==="OperationDefinition"&&h.operation==="subscription"},new Z6(yae({apiUrl:l,listeners:r==null?void 0:r.webSocket,organizationId:e,lazy:s==null?void 0:s.lazy,token:t})),Mv([J6(async()=>({headers:vc.omitBy({"organization-id":e,authorization:t?`Bearer ${t}`:void 0},vc.isNil)})),...r!=null&&r.onError?[fx(r==null?void 0:r.onError)]:[],new Kd({uri:`https://${l}`})]));return new Zd({cache:a,link:u,defaultOptions:{watchQuery:{fetchPolicy:i??"network-only",errorPolicy:"ignore"},query:{fetchPolicy:i??"network-only",errorPolicy:"all"},mutate:{errorPolicy:"all"}}})},iC=ae.createContext({}),bae=()=>{const t=ae.useContext(iC);if(!t)throw new Error("useWellPlayed must be used within a WellPlayedProvider");return t},_ae=({children:t,clientConfig:e,organizationId:n})=>{const r=cz(),i=ae.useMemo(()=>(console.log("accessToken",r==null?void 0:r.accessToken),vae({token:(r==null?void 0:r.accessToken)??void 0,organizationId:n,...e})),[r==null?void 0:r.accessToken,n,e]);return he.jsx(GN,{client:i,children:he.jsx(iC.Provider,{value:{organizationId:n,apiClient:i},children:t})})},Eae=({children:t,oidcConfig:e,wpAppConfig:n,...r})=>he.jsx(sz,{...e,configuration:{...n,...e==null?void 0:e.configuration,authority:`https://oauth.warrior.${r.apiBaseUrl??"well-played.gg"}`},children:he.jsx(_ae,{...r,children:t})});exports.RichTextEditorContent=K6;exports.WellPlayedProvider=Eae;exports.graphql=Ja;exports.readFragment=vz;exports.useConnectedPlayer=Ez;exports.usePaginatedLoadAll=ub;exports.usePaginatedQuery=Kq;exports.usePlayers=wA;exports.useTournamentStep=Oz;exports.useTournamentTeams=TA;exports.useWellPlayed=bae;
494
+ `,data:{__typename:Zm.cacheExtensionsCollectionTypename,id:e,data:[]}}),this.entityTypeMap.readEntityById(n)||(this._hasPendingCollectionUpdates||setTimeout(()=>this._updatePendingCollections(),0),this.pendingCollectionUpdates[r]||(this.pendingCollectionUpdates[r]={}),this.pendingCollectionUpdates[r][n]||(this.pendingCollectionUpdates[r][n]=(0,ls.makeReference)(n)))}_expire(e=!1){const{entitiesById:n}=this.entityTypeMap.extract(),r=[];return Object.keys(n).forEach(i=>{const s=n[i],{storeFieldNames:o,dataId:a,fieldName:l,typename:u}=s;(0,si.isQuery)(a)&&o?Object.keys(o.entries).forEach(d=>{this.invalidationPolicyManager.runReadPolicy({typename:u,dataId:a,fieldName:l,storeFieldName:d,reportOnly:e})&&r.push((0,si.makeEntityId)(a,d))}):this.invalidationPolicyManager.runReadPolicy({typename:u,dataId:a,fieldName:l,reportOnly:e})&&r.push((0,si.makeEntityId)(a))}),r.length>0&&this.broadcastWatches(),r}expire(){return this._expire(!1)}expiredEntities(){return this._expire(!0)}activatePolicyEvents(...e){e.length>0?this.invalidationPolicyManager.activatePolicies(...e):this.invalidationPolicyManager.activatePolicies(Nn.InvalidationPolicyEvent.Read,Nn.InvalidationPolicyEvent.Write,Nn.InvalidationPolicyEvent.Evict)}deactivatePolicyEvents(...e){e.length>0?this.invalidationPolicyManager.deactivatePolicies(...e):this.invalidationPolicyManager.deactivatePolicies(Nn.InvalidationPolicyEvent.Read,Nn.InvalidationPolicyEvent.Write,Nn.InvalidationPolicyEvent.Evict)}activePolicyEvents(){return[Nn.InvalidationPolicyEvent.Read,Nn.InvalidationPolicyEvent.Write,Nn.InvalidationPolicyEvent.Evict].filter(e=>this.invalidationPolicyManager.isPolicyEventActive(e))}read(e){const n=super.read(e);if(!this.invalidationPolicyManager.isPolicyEventActive(Nn.InvalidationPolicyEvent.Read))return n;const r=(0,si.maybeDeepClone)(n),i=this.cacheResultProcessor.processReadResult(r,e);return i===Ml.ReadResultStatus.Complete?n:(this.broadcastWatches(),i===Ml.ReadResultStatus.Evicted?null:r)}diff(e){const n=super.diff(e);if(!this.invalidationPolicyManager.isPolicyEventActive(Nn.InvalidationPolicyEvent.Read)||this.isBroadcasting)return n;const{result:r}=n,i=(0,si.maybeDeepClone)(r),s=this.cacheResultProcessor.processReadResult(i,e);return s===Ml.ReadResultStatus.Complete||(this.broadcastWatches(),n.complete=!1,n.result=s===Ml.ReadResultStatus.Evicted?void 0:i),n}extract(e=!1,n=!0){this._hasPendingCollectionUpdates&&this._updatePendingCollections();const r=super.extract(e);return n&&(r.invalidation=(0,Gse.default)(this.entityTypeMap.extract(),"entitiesById")),r}readFragmentWhere(e){const{fragment:n,filter:r,limit:i,orderBy:s}=e,o=Xm(e,["fragment","filter","limit","orderBy"]),l=n.definitions[0].typeCondition.name.value,d=this.readReferenceWhere({__typename:l,filter:r,limit:i,orderBy:s}).map(h=>this.readFragment(Object.assign(Object.assign({},o),{fragment:n,id:h.__ref})));return(0,zse.default)(d)}readReferenceWhere(e){const{__typename:n,filter:r,limit:i,orderBy:s}=e,o=(0,Zm.collectionEntityIdForType)(n);this.pendingCollectionUpdates[o]&&this._updatePendingCollection(o);let a=this.readField("data",(0,ls.makeReference)(o));if(!a)return[];const l=this.readField.bind(this);if(r&&(a=a.filter(u=>{if((0,Jse.default)(r))return r(u,l);const d=Object.keys(r).map(h=>{const p=r[h],g=this.readField(h,u);return p===g});return(0,Qse.default)(d,Boolean)})),s){const{field:u,descending:d}=s;a=(0,Yse.default)(a,h=>l(u,h),[d?"desc":"asc"])}return(0,Kse.default)(i)?a:(0,Hse.default)(a,i)}writeFragmentWhere(e){const{update:n}=e,r=Xm(e,["update"]);this.readFragmentWhere(r).forEach(i=>{this.writeFragment({id:this.identify(i),fragment:e.fragment,data:n(i),broadcast:!1})}),this.broadcastWatches()}}yh.default=eoe;(function(t){var e=Re&&Re.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(t,"__esModule",{value:!0}),t.InvalidationPolicyCache=t.makeCachedVar=void 0;var n=Lb;Object.defineProperty(t,"makeCachedVar",{enumerable:!0,get:function(){return n.makeCachedVar}});var r=yh;Object.defineProperty(t,"InvalidationPolicyCache",{enumerable:!0,get:function(){return e(r).default}})})(dx);var Jx={},l0={},$s={};const toe=Ha(xB);Object.defineProperty($s,"__esModule",{value:!0});$s.buildWatchFragmentWhereQuery=$s.buildWatchFragmentQuery=void 0;const cs=toe,noe=Gc;function Yx({fieldName:t,fragmentDefinition:e}){return{kind:cs.Kind.DOCUMENT,definitions:[{directives:[],variableDefinitions:[],kind:cs.Kind.OPERATION_DEFINITION,operation:cs.OperationTypeNode.QUERY,selectionSet:{kind:cs.Kind.SELECTION_SET,selections:[{arguments:[],kind:cs.Kind.FIELD,name:{kind:cs.Kind.NAME,value:t},directives:[{arguments:[],kind:cs.Kind.DIRECTIVE,name:{kind:cs.Kind.NAME,value:"client"}}],selectionSet:e.selectionSet}]}}]}}function roe(t){const{fragment:e,id:n,policies:r,fieldName:i}=t,s=e.definitions[0],o=Yx({fragmentDefinition:s,fieldName:i});return r.getFieldPolicy("Query",i)||r.addTypePolicies({Query:{fields:{[i]:{read(a){return(0,noe.makeReference)(n)}}}}}),o}$s.buildWatchFragmentQuery=roe;function ioe(t){const{fragment:e,filterVar:n,limitVar:r,orderByVar:i,policies:s,cache:o,fieldName:a}=t,l=e.definitions[0],u=l.typeCondition.name.value,d=Yx({fragmentDefinition:l,fieldName:a});return s.getFieldPolicy("Query",a)||s.addTypePolicies({Query:{fields:{[a]:{read(h){return o.readReferenceWhere({__typename:u,filter:n(),limit:r(),orderBy:i()})}}}}}),d}$s.buildWatchFragmentWhereQuery=ioe;Object.defineProperty(l0,"__esModule",{value:!0});const ff=Gc,zO=$s,QO=zs;class soe extends ff.ApolloClient{constructor(e){super(e),this.policies=this.cache.policies}watchQueryForField(e,n){const r=this.watchQuery({fetchPolicy:"cache-only",query:e}),i=r.subscribe.bind(r);return r.subscribe=(s,...o)=>{typeof s!="object"&&(s={next:s,error:o[0],complete:o[1]});const a=s.next;s.next=d=>{var h;a&&a((h=d==null?void 0:d.data)===null||h===void 0?void 0:h[n])};const l=i(s),u=l.unsubscribe.bind(l);return l.unsubscribe=()=>{delete this.cache.policies.typePolicies.Query.fields[n],u()},l},r}watchFragment(e){const n=(0,QO.generateFragmentFieldName)(),r=(0,zO.buildWatchFragmentQuery)(Object.assign(Object.assign({},e),{fieldName:n,policies:this.policies}));return this.watchQueryForField(r,n)}watchFragmentWhere(e){const n=(0,QO.generateFragmentFieldName)(),r=(0,ff.makeVar)(e.filter),i=(0,ff.makeVar)(e.limit),s=(0,ff.makeVar)(e.orderBy),o=(0,zO.buildWatchFragmentWhereQuery)(Object.assign(Object.assign({},e),{fieldName:n,filterVar:r,limitVar:i,orderByVar:s,cache:this.cache,policies:this.policies}));return this.watchQueryForField(o,n)}}l0.default=soe;(function(t){var e=Re&&Re.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(t,"__esModule",{value:!0}),t.ApolloExtensionsClient=void 0;var n=l0;Object.defineProperty(t,"ApolloExtensionsClient",{enumerable:!0,get:function(){return e(n).default}})})(Jx);var Xx={},c0={},Mo={},ooe=Re&&Re.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Mo,"__esModule",{value:!0});Mo.usePrevious=Mo.useOnce=void 0;const Td=ae,aoe=ooe(_h);function loe(t){const e=(0,Td.useRef)(),n=(0,Td.useRef)(!1);return n.current||((0,aoe.default)(t)?e.current=t():e.current=t,n.current=!0),e.current}Mo.useOnce=loe;const coe=t=>{const e=(0,Td.useRef)(null);return(0,Td.useEffect)(()=>{e.current=t}),e.current};Mo.usePrevious=coe;var Xc={};Object.defineProperty(Xc,"__esModule",{value:!0});Xc.useFragmentTypePolicyFieldName=void 0;const uoe=Xa,GO=ae,foe=zs,doe=Mo,hoe=({fragmentName:t}={})=>{const e=(0,GO.useMemo)(()=>(0,foe.generateFragmentFieldName)({fragmentName:t}),[t]),n=(0,doe.usePrevious)(e),r=(0,uoe.useApolloClient)();return(0,GO.useEffect)(()=>()=>{delete r.cache.policies.typePolicies.Query.fields[n]},[e,n]),e};Xc.useFragmentTypePolicyFieldName=hoe;var Zc={};Object.defineProperty(Zc,"__esModule",{value:!0});Zc.useGetQueryDataByFieldName=void 0;const poe=Xa,moe=(t,e,n)=>{var r,i;const s=(0,poe.useQuery)(t,{fetchPolicy:"cache-only",returnPartialData:n==null?void 0:n.returnPartialData});return{data:(i=(r=s==null?void 0:s.data)===null||r===void 0?void 0:r[e])!==null&&i!==void 0?i:null}};Zc.useGetQueryDataByFieldName=moe;Object.defineProperty(c0,"__esModule",{value:!0});const goe=Xa,yoe=ae,voe=Mo,boe=$s,_oe=Xc,Eoe=Zc;function woe(t,e){const r=(0,yoe.useContext)((0,goe.getApolloContext)()).client,i=r==null?void 0:r.cache,s=(0,_oe.useFragmentTypePolicyFieldName)(),o=(0,voe.useOnce)(()=>(0,boe.buildWatchFragmentQuery)({fragment:t,fieldName:s,id:e.id,policies:i.policies}));return(0,Eoe.useGetQueryDataByFieldName)(o,s,e)}c0.default=woe;var u0={};const Toe=Ha(xU);Object.defineProperty(u0,"__esModule",{value:!0});const Soe=Xa,Ri=ae,Ooe=$s,koe=Xc,Noe=Zc,eg=Xa,HO=Toe;function Aoe(t,e){var n;const r=e==null?void 0:e.filter,s=(0,Ri.useRef)((0,eg.makeVar)(r)).current,o=e==null?void 0:e.limit,l=(0,Ri.useRef)((0,eg.makeVar)(o)).current,u=e==null?void 0:e.orderBy,h=(0,Ri.useRef)((0,eg.makeVar)(u)).current,g=(0,Ri.useContext)((0,Soe.getApolloContext)()).client,y=g==null?void 0:g.cache,b=(0,koe.useFragmentTypePolicyFieldName)({fragmentName:e==null?void 0:e.fragmentName}),_=(0,Ri.useRef)([]);(0,Ri.useEffect)(()=>{(typeof r=="function"&&r!==s()||!(0,HO.equal)(r,s()))&&s(r)},[r]),(0,Ri.useEffect)(()=>{o!==l()&&l(o)},[o]),(0,Ri.useEffect)(()=>{(typeof u=="function"&&u!==h()||!(0,HO.equal)(u,h()))&&h(u)},[u]);const w=(0,Ri.useMemo)(()=>(0,Ooe.buildWatchFragmentWhereQuery)({filter:r,filterVar:s,limitVar:l,orderByVar:h,fragment:t,fieldName:b,cache:y,policies:y.policies}),[b]),O=(0,Noe.useGetQueryDataByFieldName)(w,b,e);return Object.assign(Object.assign({},O),{data:(n=O.data)!==null&&n!==void 0?n:_.current})}u0.default=Aoe;(function(t){var e=Re&&Re.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(t,"__esModule",{value:!0}),t.useFragmentWhere=t.useFragment=void 0;var n=c0;Object.defineProperty(t,"useFragment",{enumerable:!0,get:function(){return e(n).default}});var r=u0;Object.defineProperty(t,"useFragmentWhere",{enumerable:!0,get:function(){return e(r).default}})})(Xx);var Zx={},f0={},eu={},Ioe=Re&&Re.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(eu,"__esModule",{value:!0});eu.AuditType=void 0;const xoe=Ioe(Ih);var ec;(function(t){t.Read="Read",t.Write="Write",t.Evict="Evict"})(ec||(eu.AuditType=ec={}));class Coe extends xoe.default{constructor(e){super(e),this.auditLog=e.auditLog}runReadPolicy({typename:e,dataId:n,fieldName:r,storeFieldName:i,reportOnly:s=!1}){return this.auditLog.log("Running read policy",ec.Read,"InvalidationPolicyManager",{storeFieldName:i,typename:e,dataId:n,fieldName:r}),super.runReadPolicy({typename:e,dataId:n,fieldName:r,storeFieldName:i,reportOnly:s})}runWritePolicy(e,n){return this.auditLog.log("Running write policy",ec.Write,"InvalidationPolicyManager",Object.assign({typeName:e},n)),super.runWritePolicy(e,n)}runEvictPolicy(e,n){return this.auditLog.log("Running evict policy",ec.Write,"InvalidationPolicyManager",Object.assign({typeName:e},n)),super.runEvictPolicy(e,n)}}eu.default=Coe;var d0={},Doe=Re&&Re.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(d0,"__esModule",{value:!0});const Roe=Doe(Dh);var Sd;(function(t){t.Write="Write",t.Evict="Evict"})(Sd||(Sd={}));class Moe extends Roe.default{constructor(e){super(),this.auditLog=e.auditLog}write(e,n,r,i){return this.auditLog.log("Writing to type map",Sd.Write,"EntityTypeMap",{typename:e,dataId:n,storeFieldName:r,variables:i}),super.write(e,n,r,i)}evict(e,n){return this.auditLog.log("Evicting from type map",Sd.Evict,"EntityTypeMap",{dataId:e,storeFieldName:n}),super.evict(e,n)}}d0.default=Moe;var h0={},Poe=Wb;function Foe(t,e){var n=[];return Poe(t,function(r,i,s){e(r,i,s)&&n.push(r)}),n}var $oe=Foe,Loe=Sx,Voe=$oe,joe=Zb,Boe=$n;function Uoe(t,e){var n=Boe(t)?Loe:Voe;return n(t,joe(e))}var qoe=Uoe,Woe=Re&&Re.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(h0,"__esModule",{value:!0});const zoe=Woe(qoe);class Qoe{constructor(){this._log=[]}log(e,n,r,i){const s={time:Date.now(),type:n,event:e,meta:i,group:r};this._log.push(s)}getLog(e){return(0,zoe.default)(this._log,e)}printLog(e){this.getLog(e).forEach(this.printLogEntry)}printLogEntry(e){var n;console.log(`%c event: ${e.event}`,"color: green"),console.group(),console.log(`type: ${e.type}`),console.log(`time: ${e.time}`),console.log(`meta: ${JSON.stringify((n=e.meta)!==null&&n!==void 0?n:{})}`),console.groupEnd()}}h0.default=Qoe;var Rh=Re&&Re.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(f0,"__esModule",{value:!0});const Goe=Rh(yh),Hoe=Ro,Koe=Rh(eu),Joe=Rh(d0),Yoe=Rh(h0),Xoe=s0;class Zoe extends Goe.default{constructor(e){super(e),this.auditLog=new Yoe.default;const{invalidationPolicies:n={}}=e;this.entityTypeMap=new Joe.default({auditLog:this.auditLog}),new Xoe.EntityStoreWatcher({entityStore:this.entityStoreRoot,entityTypeMap:this.entityTypeMap,policies:this.policies,reactiveVarsCache:this.reactiveVarsCache,updateCollectionField:this.updateCollectionField.bind(this)}),this.invalidationPolicyManager=new Koe.default({auditLog:this.auditLog,policies:n,entityTypeMap:this.entityTypeMap,cacheOperations:{evict:this.evict.bind(this),modify:this.modify.bind(this),readField:this.readField.bind(this)}}),this.cacheResultProcessor=new Hoe.CacheResultProcessor({invalidationPolicyManager:this.invalidationPolicyManager,entityTypeMap:this.entityTypeMap,cache:this})}}f0.default=Zoe;(function(t){var e=Re&&Re.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(t,"__esModule",{value:!0}),t.InvalidationPolicyCacheAuditor=void 0;var n=f0;Object.defineProperty(t,"InvalidationPolicyCacheAuditor",{enumerable:!0,get:function(){return e(n).default}})})(Zx);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.RenewalPolicy=t.InvalidationPolicyEvent=t.InvalidationPolicyCacheAuditor=t.useFragmentWhere=t.useFragment=t.ApolloExtensionsClient=t.makeCachedVar=t.InvalidationPolicyCache=void 0;var e=dx;Object.defineProperty(t,"InvalidationPolicyCache",{enumerable:!0,get:function(){return e.InvalidationPolicyCache}}),Object.defineProperty(t,"makeCachedVar",{enumerable:!0,get:function(){return e.makeCachedVar}});var n=Jx;Object.defineProperty(t,"ApolloExtensionsClient",{enumerable:!0,get:function(){return n.ApolloExtensionsClient}});var r=Xx;Object.defineProperty(t,"useFragment",{enumerable:!0,get:function(){return r.useFragment}}),Object.defineProperty(t,"useFragmentWhere",{enumerable:!0,get:function(){return r.useFragmentWhere}});var i=Zx;Object.defineProperty(t,"InvalidationPolicyCacheAuditor",{enumerable:!0,get:function(){return i.InvalidationPolicyCacheAuditor}});var s=Rr;Object.defineProperty(t,"InvalidationPolicyEvent",{enumerable:!0,get:function(){return s.InvalidationPolicyEvent}}),Object.defineProperty(t,"RenewalPolicy",{enumerable:!0,get:function(){return s.RenewalPolicy}})})(my);var tg=function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))},eae=function(){function t(e){var n=e.debug,r=n===void 0?!1:n;this.debug=r,this.lines=[]}return t.prototype.emit=function(e,n){if(e in console){var r=t.prefix;console[e].apply(console,tg([r],n,!1))}},t.prototype.tailLogs=function(){var e=this;this.lines.forEach(function(n){var r=n[0],i=n[1];return e.emit(r,i)})},t.prototype.getLogs=function(){return this.lines},t.prototype.write=function(e,n){var r=t.buffer;this.lines=tg(tg([],this.lines.slice(1-r),!0),[[e,n]],!1),(this.debug||e!=="log")&&this.emit(e,n)},t.prototype.info=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.write("log",e)},t.prototype.warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.write("warn",e)},t.prototype.error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.write("error",e)},t.buffer=30,t.prefix="[apollo-cache-persist]",t}(),tae=function(){function t(e){var n=e.cache,r=e.serialize,i=r===void 0?!0:r;this.cache=n,this.serialize=i}return t.prototype.extract=function(){var e=this.cache.extract();return this.serialize&&(e=JSON.stringify(e)),e},t.prototype.restore=function(e){this.serialize&&typeof e=="string"&&(e=JSON.parse(e)),e!=null&&this.cache.restore(e)},t}(),df=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(d){try{u(r.next(d))}catch(h){o(h)}}function l(d){try{u(r.throw(d))}catch(h){o(h)}}function u(d){d.done?s(d.value):i(d.value).then(a,l)}u((r=r.apply(t,e||[])).next())})},hf=function(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(d){return l([u,d])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(n=0)),n;)try{if(r=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){n.label=u[1];break}if(u[0]===6&&n.label<s[1]){n.label=s[1],s=u;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(u);break}s[2]&&n.ops.pop(),n.trys.pop();continue}u=e.call(t,n)}catch(d){u=[6,d],i=0}finally{r=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},eC=function(){function t(e){var n=e.storage,r=e.key,i=r===void 0?"apollo-cache-persist":r;this.storage=n,this.key=i}return t.prototype.read=function(){return df(this,void 0,void 0,function(){return hf(this,function(e){return[2,this.storage.getItem(this.key)]})})},t.prototype.write=function(e){return df(this,void 0,void 0,function(){return hf(this,function(n){switch(n.label){case 0:return[4,this.storage.setItem(this.key,e)];case 1:return n.sent(),[2]}})})},t.prototype.purge=function(){return df(this,void 0,void 0,function(){return hf(this,function(e){switch(e.label){case 0:return[4,this.storage.removeItem(this.key)];case 1:return e.sent(),[2]}})})},t.prototype.getSize=function(){return df(this,void 0,void 0,function(){var e;return hf(this,function(n){switch(n.label){case 0:return[4,this.storage.getItem(this.key)];case 1:return e=n.sent(),e==null?[2,0]:[2,typeof e=="string"?e.length:null]}})})},t}(),ng=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(d){try{u(r.next(d))}catch(h){o(h)}}function l(d){try{u(r.throw(d))}catch(h){o(h)}}function u(d){d.done?s(d.value):i(d.value).then(a,l)}u((r=r.apply(t,e||[])).next())})},rg=function(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(d){return l([u,d])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(n=0)),n;)try{if(r=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){n.label=u[1];break}if(u[0]===6&&n.label<s[1]){n.label=s[1],s=u;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(u);break}s[2]&&n.ops.pop(),n.trys.pop();continue}u=e.call(t,n)}catch(d){u=[6,d],i=0}finally{r=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},tC=function(){function t(e,n){var r=e.log,i=e.cache,s=e.storage,o=n.maxSize,a=o===void 0?1024*1024:o,l=n.persistenceMapper;this.log=r,this.cache=i,this.storage=s,this.paused=!1,l&&(this.persistenceMapper=l),a&&(this.maxSize=a)}return t.prototype.persist=function(){return ng(this,void 0,void 0,function(){var e,n;return rg(this,function(r){switch(r.label){case 0:return r.trys.push([0,6,,7]),e=this.cache.extract(),!this.paused&&this.persistenceMapper?[4,this.persistenceMapper(e)]:[3,2];case 1:e=r.sent(),r.label=2;case 2:return this.maxSize!=null&&typeof e=="string"&&e.length>this.maxSize&&!this.paused?[4,this.purge()]:[3,4];case 3:return r.sent(),this.paused=!0,[2];case 4:return this.paused?[2]:[4,this.storage.write(e)];case 5:return r.sent(),this.log.info(typeof e=="string"?"Persisted cache of size ".concat(e.length," characters"):"Persisted cache"),[3,7];case 6:throw n=r.sent(),this.log.error("Error persisting cache",n),n;case 7:return[2]}})})},t.prototype.restore=function(){return ng(this,void 0,void 0,function(){var e,n;return rg(this,function(r){switch(r.label){case 0:return r.trys.push([0,5,,6]),[4,this.storage.read()];case 1:return e=r.sent(),e==null?[3,3]:[4,this.cache.restore(e)];case 2:return r.sent(),this.log.info(typeof e=="string"?"Restored cache of size ".concat(e.length," characters"):"Restored cache"),[3,4];case 3:this.log.info("No stored cache to restore"),r.label=4;case 4:return[3,6];case 5:throw n=r.sent(),this.log.error("Error restoring cache",n),n;case 6:return[2]}})})},t.prototype.purge=function(){return ng(this,void 0,void 0,function(){var e;return rg(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.storage.purge()];case 1:return n.sent(),this.log.info("Purged cache storage"),[3,3];case 2:throw e=n.sent(),this.log.error("Error purging cache storage",e),e;case 3:return[2]}})})},t}();const nC=function(t){var e=t.cache;return function(n){var r=e.write,i=e.evict,s=e.modify,o=e.gc;return e.write=function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var u=r.apply(e,a);return n(),u},e.evict=function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var u=i.apply(e,a);return n(),u},e.modify=function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var u=s.apply(e,a);return n(),u},e.gc=function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var u=o.apply(e,a);return n(),u},function(){e.write=r,e.evict=i,e.modify=s,e.gc=o}}},nae=function(t){var e=t.log,n=t.cache;return function(r){return e.warn("Trigger option `background` not available on web; using `write` trigger"),nC({cache:n})(r)}};var rae=function(){function t(e,n){var r=e.log,i=e.persistor,s=this;this.fire=function(){if(!s.debounce){s.persist();return}s.timeout!=null&&clearTimeout(s.timeout),s.timeout=setTimeout(s.persist,s.debounce)},this.persist=function(){s.paused||s.persistor.persist()};var o=t.defaultDebounce,a=n.cache,l=n.debounce,u=n.trigger,d=u===void 0?"write":u;if(d)switch(this.debounce=l??o,this.persistor=i,this.paused=!1,d){case"write":this.uninstall=nC({cache:a})(this.fire);break;case"background":l&&r.warn("Debounce is not recommended with `background` trigger"),this.debounce=l,this.uninstall=nae({cache:a,log:r})(this.fire);break;default:if(typeof d=="function")this.uninstall=d(this.fire);else throw Error("Unrecognized trigger option: ".concat(d))}}return t.prototype.pause=function(){this.paused=!0},t.prototype.resume=function(){this.paused=!1},t.prototype.remove=function(){this.uninstall&&(this.uninstall(),this.uninstall=null,this.paused=!0)},t.defaultDebounce=1e3,t}(),iae=function(){function t(e){if(!e.cache)throw new Error("In order to persist your Apollo Cache, you need to pass in a cache. Please see https://www.apollographql.com/docs/react/basics/caching.html for our default InMemoryCache.");if(!e.storage)throw new Error("In order to persist your Apollo Cache, you need to pass in an underlying storage provider. Please see https://github.com/apollographql/apollo-cache-persist#storage-providers");var n=new eae(e),r=new tae(e),i=new eC(e),s=new tC({log:n,cache:r,storage:i},e),o=new rae({log:n,persistor:s},e);this.log=n,this.cache=r,this.storage=i,this.persistor=s,this.trigger=o}return t.prototype.persist=function(){return this.persistor.persist()},t.prototype.restore=function(){return this.persistor.restore()},t.prototype.purge=function(){return this.persistor.purge()},t.prototype.pause=function(){this.trigger.pause()},t.prototype.resume=function(){this.trigger.resume()},t.prototype.remove=function(){this.trigger.remove()},t.prototype.getLogs=function(e){if(e===void 0&&(e=!1),e)this.log.tailLogs();else return this.log.getLogs()},t.prototype.getSize=function(){return this.storage.getSize()},t}(),p0=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),sae=function(t){var e=new oae(t);e.restoreSync()},oae=function(t){p0(e,t);function e(n){var r=t.call(this,n)||this;return r.storage=new lae(n),r.persistor=new aae({log:r.log,cache:r.cache,storage:r.storage},n),r}return e.prototype.restoreSync=function(){this.persistor.restoreSync()},e}(iae),aae=function(t){p0(e,t);function e(n,r){var i=n.log,s=n.cache,o=n.storage;return t.call(this,{log:i,cache:s,storage:o},r)||this}return e.prototype.restoreSync=function(){this.cache.restore(this.storage.readSync())},e}(tC),lae=function(t){p0(e,t);function e(n){return t.call(this,n)||this}return e.prototype.readSync=function(){return this.storage.getItem(this.key)},e}(eC),cae=function(){function t(e){this.storage=e}return t.prototype.getItem=function(e){return this.storage.getItem(e)},t.prototype.removeItem=function(e){return this.storage.removeItem(e)},t.prototype.setItem=function(e,n){return n!==null?this.storage.setItem(e,n):this.removeItem(e)},t}();function qn(t){return t===null?"null":Array.isArray(t)?"array":typeof t}function so(t){return qn(t)==="object"}function uae(t){return Array.isArray(t)&&t.length>0&&t.every(e=>"message"in e)}function KO(t,e){return t.length<124?t:e}const fae="graphql-transport-ws";var sr;(function(t){t[t.InternalServerError=4500]="InternalServerError",t[t.InternalClientError=4005]="InternalClientError",t[t.BadRequest=4400]="BadRequest",t[t.BadResponse=4004]="BadResponse",t[t.Unauthorized=4401]="Unauthorized",t[t.Forbidden=4403]="Forbidden",t[t.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",t[t.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",t[t.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",t[t.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",t[t.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(sr||(sr={}));var Dt;(function(t){t.ConnectionInit="connection_init",t.ConnectionAck="connection_ack",t.Ping="ping",t.Pong="pong",t.Subscribe="subscribe",t.Next="next",t.Error="error",t.Complete="complete"})(Dt||(Dt={}));function rC(t){if(!so(t))throw new Error(`Message is expected to be an object, but got ${qn(t)}`);if(!t.type)throw new Error("Message is missing the 'type' property");if(typeof t.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${qn(t.type)}`);switch(t.type){case Dt.ConnectionInit:case Dt.ConnectionAck:case Dt.Ping:case Dt.Pong:{if(t.payload!=null&&!so(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${t.payload}"`);break}case Dt.Subscribe:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${qn(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!so(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${qn(t.payload)}`);if(typeof t.payload.query!="string")throw new Error(`"${t.type}" message payload expects the 'query' property to be a string, but got ${qn(t.payload.query)}`);if(t.payload.variables!=null&&!so(t.payload.variables))throw new Error(`"${t.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${qn(t.payload.variables)}`);if(t.payload.operationName!=null&&qn(t.payload.operationName)!=="string")throw new Error(`"${t.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${qn(t.payload.operationName)}`);if(t.payload.extensions!=null&&!so(t.payload.extensions))throw new Error(`"${t.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${qn(t.payload.extensions)}`);break}case Dt.Next:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${qn(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!so(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${qn(t.payload)}`);break}case Dt.Error:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${qn(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!uae(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(t.payload)}`);break}case Dt.Complete:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${qn(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${t.type}"`)}return t}function dae(t,e){return rC(typeof t=="string"?JSON.parse(t,e):t)}function Pl(t,e){return rC(t),JSON.stringify(t,e)}var Oa=function(t){return this instanceof Oa?(this.v=t,this):new Oa(t)},hae=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){r[p]&&(i[p]=function(g){return new Promise(function(y,b){s.push([p,g,y,b])>1||a(p,g)})})}function a(p,g){try{l(r[p](g))}catch(y){h(s[0][3],y)}}function l(p){p.value instanceof Oa?Promise.resolve(p.value.v).then(u,d):h(s[0][2],p)}function u(p){a("next",p)}function d(p){a("throw",p)}function h(p,g){p(g),s.shift(),s.length&&a(s[0][0],s[0][1])}};function pae(t){const{url:e,connectionParams:n,lazy:r=!0,onNonLazyError:i=console.error,lazyCloseTimeout:s=0,keepAlive:o=0,disablePong:a,connectionAckWaitTimeout:l=0,retryAttempts:u=5,retryWait:d=async function(Ae){let fe=1e3;for(let Ee=0;Ee<Ae;Ee++)fe*=2;await new Promise(Ee=>setTimeout(Ee,fe+Math.floor(Math.random()*2700+300)))},shouldRetry:h=ig,isFatalConnectionProblem:p,on:g,webSocketImpl:y,generateID:b=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,Ae=>{const fe=Math.random()*16|0;return(Ae=="x"?fe:fe&3|8).toString(16)})},jsonMessageReplacer:_,jsonMessageReviver:w}=t;let O;if(y){if(!gae(y))throw new Error("Invalid WebSocket implementation provided");O=y}else typeof WebSocket<"u"?O=WebSocket:typeof global<"u"?O=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(O=window.WebSocket||window.MozWebSocket);if(!O)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");const N=O,I=(()=>{const te=(()=>{const fe={};return{on(Ee,ge){return fe[Ee]=ge,()=>{delete fe[Ee]}},emit(Ee){var ge;"id"in Ee&&((ge=fe[Ee.id])===null||ge===void 0||ge.call(fe,Ee))}}})(),Ae={connecting:g!=null&&g.connecting?[g.connecting]:[],opened:g!=null&&g.opened?[g.opened]:[],connected:g!=null&&g.connected?[g.connected]:[],ping:g!=null&&g.ping?[g.ping]:[],pong:g!=null&&g.pong?[g.pong]:[],message:g!=null&&g.message?[te.emit,g.message]:[te.emit],closed:g!=null&&g.closed?[g.closed]:[],error:g!=null&&g.error?[g.error]:[]};return{onMessage:te.on,on(fe,Ee){const ge=Ae[fe];return ge.push(Ee),()=>{ge.splice(ge.indexOf(Ee),1)}},emit(fe,...Ee){for(const ge of[...Ae[fe]])ge(...Ee)}}})();function P(te){const Ae=[I.on("error",fe=>{Ae.forEach(Ee=>Ee()),te(fe)}),I.on("closed",fe=>{Ae.forEach(Ee=>Ee()),te(fe)})]}let M,B=0,Q,x=!1,U=0,be=!1;async function Oe(){clearTimeout(Q);const[te,Ae]=await(M??(M=new Promise((ge,ct)=>(async()=>{if(x){if(await d(U),!B)return M=void 0,ct({code:1e3,reason:"All Subscriptions Gone"});U++}I.emit("connecting",x);const ve=new N(typeof e=="function"?await e():e,fae);let L,Z;function Y(){isFinite(o)&&o>0&&(clearTimeout(Z),Z=setTimeout(()=>{ve.readyState===N.OPEN&&(ve.send(Pl({type:Dt.Ping})),I.emit("ping",!1,void 0))},o))}P(we=>{M=void 0,clearTimeout(L),clearTimeout(Z),ct(we),we instanceof JO&&(ve.close(4499,"Terminated"),ve.onerror=null,ve.onclose=null)}),ve.onerror=we=>I.emit("error",we),ve.onclose=we=>I.emit("closed",we),ve.onopen=async()=>{try{I.emit("opened",ve);const we=typeof n=="function"?await n():n;if(ve.readyState!==N.OPEN)return;ve.send(Pl(we?{type:Dt.ConnectionInit,payload:we}:{type:Dt.ConnectionInit},_)),isFinite(l)&&l>0&&(L=setTimeout(()=>{ve.close(sr.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},l)),Y()}catch(we){I.emit("error",we),ve.close(sr.InternalClientError,KO(we instanceof Error?we.message:new Error(we).message,"Internal client error"))}};let ee=!1;ve.onmessage=({data:we})=>{try{const Me=dae(we,w);if(I.emit("message",Me),Me.type==="ping"||Me.type==="pong"){I.emit(Me.type,!0,Me.payload),Me.type==="pong"?Y():a||(ve.send(Pl(Me.payload?{type:Dt.Pong,payload:Me.payload}:{type:Dt.Pong})),I.emit("pong",!1,Me.payload));return}if(ee)return;if(Me.type!==Dt.ConnectionAck)throw new Error(`First message cannot be of type ${Me.type}`);clearTimeout(L),ee=!0,I.emit("connected",ve,Me.payload,x),x=!1,U=0,ge([ve,new Promise((Ye,Zt)=>P(Zt))])}catch(Me){ve.onmessage=null,I.emit("error",Me),ve.close(sr.BadResponse,KO(Me instanceof Error?Me.message:new Error(Me).message,"Bad response"))}}})())));te.readyState===N.CLOSING&&await Ae;let fe=()=>{};const Ee=new Promise(ge=>fe=ge);return[te,fe,Promise.race([Ee.then(()=>{if(!B){const ge=()=>te.close(1e3,"Normal Closure");isFinite(s)&&s>0?Q=setTimeout(()=>{te.readyState===N.OPEN&&ge()},s):ge()}}),Ae])]}function ke(te){if(ig(te)&&(mae(te.code)||[sr.InternalServerError,sr.InternalClientError,sr.BadRequest,sr.BadResponse,sr.Unauthorized,sr.SubprotocolNotAcceptable,sr.SubscriberAlreadyExists,sr.TooManyInitialisationRequests].includes(te.code)))throw te;if(be)return!1;if(ig(te)&&te.code===1e3)return B>0;if(!u||U>=u||!h(te)||p!=null&&p(te))throw te;return x=!0}r||(async()=>{for(B++;;)try{const[,,te]=await Oe();await te}catch(te){try{if(!ke(te))return}catch(Ae){return i==null?void 0:i(Ae)}}})();function Le(te,Ae){const fe=b(te);let Ee=!1,ge=!1,ct=()=>{B--,Ee=!0};return(async()=>{for(B++;;)try{const[ve,L,Z]=await Oe();if(Ee)return L();const Y=I.onMessage(fe,ee=>{switch(ee.type){case Dt.Next:{Ae.next(ee.payload);return}case Dt.Error:{ge=!0,Ee=!0,Ae.error(ee.payload),ct();return}case Dt.Complete:{Ee=!0,ct();return}}});ve.send(Pl({id:fe,type:Dt.Subscribe,payload:te},_)),ct=()=>{!Ee&&ve.readyState===N.OPEN&&ve.send(Pl({id:fe,type:Dt.Complete},_)),B--,Ee=!0,L()},await Z.finally(Y);return}catch(ve){if(!ke(ve))return}})().then(()=>{ge||Ae.complete()}).catch(ve=>{Ae.error(ve)}),()=>{Ee||ct()}}return{on:I.on,subscribe:Le,iterate(te){const Ae=[],fe={done:!1,error:null,resolve:()=>{}},Ee=Le(te,{next(ct){Ae.push(ct),fe.resolve()},error(ct){fe.done=!0,fe.error=ct,fe.resolve()},complete(){fe.done=!0,fe.resolve()}}),ge=function(){return hae(this,arguments,function*(){for(;;){for(Ae.length||(yield Oa(new Promise(L=>fe.resolve=L)));Ae.length;)yield yield Oa(Ae.shift());if(fe.error)throw fe.error;if(fe.done)return yield Oa(void 0)}})}();return ge.throw=async ct=>(fe.done||(fe.done=!0,fe.error=ct,fe.resolve()),{done:!0,value:void 0}),ge.return=async()=>(Ee(),{done:!0,value:void 0}),ge},async dispose(){if(be=!0,M){const[te]=await M;te.close(1e3,"Normal Closure")}},terminate(){M&&I.emit("closed",new JO)}}}class JO extends Error{constructor(){super(...arguments),this.name="TerminatedCloseEvent",this.message="4499: Terminated",this.code=4499,this.reason="Terminated",this.wasClean=!1}}function ig(t){return so(t)&&"code"in t&&"reason"in t}function mae(t){return[1e3,1001,1006,1005,1012,1013,1014].includes(t)?!1:t>=1e3&&t<=1999}function gae(t){return typeof t=="function"&&"constructor"in t&&"CLOSED"in t&&"CLOSING"in t&&"CONNECTING"in t&&"OPEN"in t}const yae=({apiUrl:t,organizationId:e,listeners:n,lazy:r=!1,token:i})=>{const s=pae({url:`wss://${t}`,lazy:r,connectionParams:vc.omitBy({"organization-id":e,authorization:i?`Bearer ${i}`:void 0},vc.isNil),keepAlive:1e4});return n&&(n.onConnected&&s.on("connected",n.onConnected),n.onClosed&&s.on("closed",n.onClosed),n.onError&&s.on("error",n.onError)),s},vae=({token:t,organizationId:e,invalidationPolicies:n,handlers:r,fetchPolicy:i,websocket:s,apiBaseUrl:o})=>{const a=new my.InvalidationPolicyCache({invalidationPolicies:{...n,timeToLive:(n==null?void 0:n.timeToLive)??12e4,renewalPolicy:(n==null?void 0:n.renewalPolicy)??my.RenewalPolicy.None}});sae({cache:a,storage:new cae(window.localStorage)});const l=`api.warrior.${o??"well-played.gg"}/graphql`,u=Pv(({query:d})=>{const h=Vo(d);return h.kind==="OperationDefinition"&&h.operation==="subscription"},new Z6(yae({apiUrl:l,listeners:r==null?void 0:r.webSocket,organizationId:e,lazy:s==null?void 0:s.lazy,token:t})),Mv([J6(async()=>({headers:vc.omitBy({"organization-id":e,authorization:t?`Bearer ${t}`:void 0},vc.isNil)})),...r!=null&&r.onError?[fx(r==null?void 0:r.onError)]:[],new Kd({uri:`https://${l}`})]));return new Zd({cache:a,link:u,defaultOptions:{watchQuery:{fetchPolicy:i??"network-only",errorPolicy:"ignore"},query:{fetchPolicy:i??"network-only",errorPolicy:"all"},mutate:{errorPolicy:"all"}}})},iC=ae.createContext({}),bae=()=>{const t=ae.useContext(iC);if(!t)throw new Error("useWellPlayed must be used within a WellPlayedProvider");return t},_ae=({children:t,clientConfig:e,organizationId:n,apiBaseUrl:r})=>{const i=cz(),s=ae.useMemo(()=>vae({token:(i==null?void 0:i.accessToken)??void 0,organizationId:n,...e,apiBaseUrl:r}),[i==null?void 0:i.accessToken,n,e,r]);return he.jsx(GN,{client:s,children:he.jsx(iC.Provider,{value:{organizationId:n,apiClient:s},children:t})})},Eae=({children:t,oidcConfig:e,wpAppConfig:n,...r})=>he.jsx(sz,{...e,configuration:{...n,...e==null?void 0:e.configuration,authority:`https://oauth.warrior.${r.apiBaseUrl??"well-played.gg"}`},children:he.jsx(_ae,{...r,children:t})});exports.RichTextEditorContent=K6;exports.WellPlayedProvider=Eae;exports.graphql=Ja;exports.readFragment=vz;exports.useConnectedPlayer=Ez;exports.usePaginatedLoadAll=ub;exports.usePaginatedQuery=Kq;exports.usePlayers=wA;exports.useTournamentStep=Oz;exports.useTournamentTeams=TA;exports.useWellPlayed=bae;
@@ -42731,19 +42731,21 @@ const _ae = ({
42731
42731
  }, wae = ({
42732
42732
  children: t,
42733
42733
  clientConfig: e,
42734
- organizationId: n
42734
+ organizationId: n,
42735
+ apiBaseUrl: r
42735
42736
  }) => {
42736
- const r = pz(), i = qL(() => (console.log("accessToken", r == null ? void 0 : r.accessToken), Eae({
42737
- token: (r == null ? void 0 : r.accessToken) ?? void 0,
42737
+ const i = pz(), s = qL(() => Eae({
42738
+ token: (i == null ? void 0 : i.accessToken) ?? void 0,
42738
42739
  organizationId: n,
42739
- ...e
42740
- })), [r == null ? void 0 : r.accessToken, n, e]);
42741
- return /* @__PURE__ */ de.jsx(JN, { client: i, children: /* @__PURE__ */ de.jsx(
42740
+ ...e,
42741
+ apiBaseUrl: r
42742
+ }), [i == null ? void 0 : i.accessToken, n, e, r]);
42743
+ return /* @__PURE__ */ de.jsx(JN, { client: s, children: /* @__PURE__ */ de.jsx(
42742
42744
  oC.Provider,
42743
42745
  {
42744
42746
  value: {
42745
42747
  organizationId: n,
42746
- apiClient: i
42748
+ apiClient: s
42747
42749
  },
42748
42750
  children: t
42749
42751
  }
@@ -491,4 +491,4 @@ img.ProseMirror-separator {
491
491
  data
492
492
  id
493
493
  }
494
- `,data:{__typename:jv.cacheExtensionsCollectionTypename,id:e,data:[]}}),this.entityTypeMap.readEntityById(n)||(this._hasPendingCollectionUpdates||setTimeout(()=>this._updatePendingCollections(),0),this.pendingCollectionUpdates[r]||(this.pendingCollectionUpdates[r]={}),this.pendingCollectionUpdates[r][n]||(this.pendingCollectionUpdates[r][n]=(0,Ms.makeReference)(n)))}_expire(e=!1){const{entitiesById:n}=this.entityTypeMap.extract(),r=[];return Object.keys(n).forEach(i=>{const s=n[i],{storeFieldNames:o,dataId:a,fieldName:l,typename:u}=s;(0,mi.isQuery)(a)&&o?Object.keys(o.entries).forEach(d=>{this.invalidationPolicyManager.runReadPolicy({typename:u,dataId:a,fieldName:l,storeFieldName:d,reportOnly:e})&&r.push((0,mi.makeEntityId)(a,d))}):this.invalidationPolicyManager.runReadPolicy({typename:u,dataId:a,fieldName:l,reportOnly:e})&&r.push((0,mi.makeEntityId)(a))}),r.length>0&&this.broadcastWatches(),r}expire(){return this._expire(!1)}expiredEntities(){return this._expire(!0)}activatePolicyEvents(...e){e.length>0?this.invalidationPolicyManager.activatePolicies(...e):this.invalidationPolicyManager.activatePolicies(Rn.InvalidationPolicyEvent.Read,Rn.InvalidationPolicyEvent.Write,Rn.InvalidationPolicyEvent.Evict)}deactivatePolicyEvents(...e){e.length>0?this.invalidationPolicyManager.deactivatePolicies(...e):this.invalidationPolicyManager.deactivatePolicies(Rn.InvalidationPolicyEvent.Read,Rn.InvalidationPolicyEvent.Write,Rn.InvalidationPolicyEvent.Evict)}activePolicyEvents(){return[Rn.InvalidationPolicyEvent.Read,Rn.InvalidationPolicyEvent.Write,Rn.InvalidationPolicyEvent.Evict].filter(e=>this.invalidationPolicyManager.isPolicyEventActive(e))}read(e){const n=super.read(e);if(!this.invalidationPolicyManager.isPolicyEventActive(Rn.InvalidationPolicyEvent.Read))return n;const r=(0,mi.maybeDeepClone)(n),i=this.cacheResultProcessor.processReadResult(r,e);return i===Mc.ReadResultStatus.Complete?n:(this.broadcastWatches(),i===Mc.ReadResultStatus.Evicted?null:r)}diff(e){const n=super.diff(e);if(!this.invalidationPolicyManager.isPolicyEventActive(Rn.InvalidationPolicyEvent.Read)||this.isBroadcasting)return n;const{result:r}=n,i=(0,mi.maybeDeepClone)(r),s=this.cacheResultProcessor.processReadResult(i,e);return s===Mc.ReadResultStatus.Complete||(this.broadcastWatches(),n.complete=!1,n.result=s===Mc.ReadResultStatus.Evicted?void 0:i),n}extract(e=!1,n=!0){this._hasPendingCollectionUpdates&&this._updatePendingCollections();const r=super.extract(e);return n&&(r.invalidation=(0,tX.default)(this.entityTypeMap.extract(),"entitiesById")),r}readFragmentWhere(e){const{fragment:n,filter:r,limit:i,orderBy:s}=e,o=Vv(e,["fragment","filter","limit","orderBy"]),l=n.definitions[0].typeCondition.name.value,d=this.readReferenceWhere({__typename:l,filter:r,limit:i,orderBy:s}).map(h=>this.readFragment(Object.assign(Object.assign({},o),{fragment:n,id:h.__ref})));return(0,Z7.default)(d)}readReferenceWhere(e){const{__typename:n,filter:r,limit:i,orderBy:s}=e,o=(0,jv.collectionEntityIdForType)(n);this.pendingCollectionUpdates[o]&&this._updatePendingCollection(o);let a=this.readField("data",(0,Ms.makeReference)(o));if(!a)return[];const l=this.readField.bind(this);if(r&&(a=a.filter(u=>{if((0,iX.default)(r))return r(u,l);const d=Object.keys(r).map(h=>{const p=r[h],g=this.readField(h,u);return p===g});return(0,eX.default)(d,Boolean)})),s){const{field:u,descending:d}=s;a=(0,sX.default)(a,h=>l(u,h),[d?"desc":"asc"])}return(0,rX.default)(i)?a:(0,nX.default)(a,i)}writeFragmentWhere(e){const{update:n}=e,r=Vv(e,["update"]);this.readFragmentWhere(r).forEach(i=>{this.writeFragment({id:this.identify(i),fragment:e.fragment,data:n(i),broadcast:!1})}),this.broadcastWatches()}}yd.default=lX,function(t){var e=De&&De.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(t,"__esModule",{value:!0}),t.InvalidationPolicyCache=t.makeCachedVar=void 0;var n=tv;Object.defineProperty(t,"makeCachedVar",{enumerable:!0,get:function(){return n.makeCachedVar}});var r=yd;Object.defineProperty(t,"InvalidationPolicyCache",{enumerable:!0,get:function(){return e(r).default}})}(T1);var fA={},Bv={},Rs={};const cX=ma(YM);Object.defineProperty(Rs,"__esModule",{value:!0}),Rs.buildWatchFragmentWhereQuery=Rs.buildWatchFragmentQuery=void 0;const Ps=cX,uX=kc;function dA({fieldName:t,fragmentDefinition:e}){return{kind:Ps.Kind.DOCUMENT,definitions:[{directives:[],variableDefinitions:[],kind:Ps.Kind.OPERATION_DEFINITION,operation:Ps.OperationTypeNode.QUERY,selectionSet:{kind:Ps.Kind.SELECTION_SET,selections:[{arguments:[],kind:Ps.Kind.FIELD,name:{kind:Ps.Kind.NAME,value:t},directives:[{arguments:[],kind:Ps.Kind.DIRECTIVE,name:{kind:Ps.Kind.NAME,value:"client"}}],selectionSet:e.selectionSet}]}}]}}function fX(t){const{fragment:e,id:n,policies:r,fieldName:i}=t,s=e.definitions[0],o=dA({fragmentDefinition:s,fieldName:i});return r.getFieldPolicy("Query",i)||r.addTypePolicies({Query:{fields:{[i]:{read(a){return(0,uX.makeReference)(n)}}}}}),o}Rs.buildWatchFragmentQuery=fX;function dX(t){const{fragment:e,filterVar:n,limitVar:r,orderByVar:i,policies:s,cache:o,fieldName:a}=t,l=e.definitions[0],u=l.typeCondition.name.value,d=dA({fragmentDefinition:l,fieldName:a});return s.getFieldPolicy("Query",a)||s.addTypePolicies({Query:{fields:{[a]:{read(h){return o.readReferenceWhere({__typename:u,filter:n(),limit:r(),orderBy:i()})}}}}}),d}Rs.buildWatchFragmentWhereQuery=dX,Object.defineProperty(Bv,"__esModule",{value:!0});const jd=kc,hA=Rs,pA=xs;class hX extends jd.ApolloClient{constructor(e){super(e),this.policies=this.cache.policies}watchQueryForField(e,n){const r=this.watchQuery({fetchPolicy:"cache-only",query:e}),i=r.subscribe.bind(r);return r.subscribe=(s,...o)=>{typeof s!="object"&&(s={next:s,error:o[0],complete:o[1]});const a=s.next;s.next=d=>{var h;a&&a((h=d==null?void 0:d.data)===null||h===void 0?void 0:h[n])};const l=i(s),u=l.unsubscribe.bind(l);return l.unsubscribe=()=>{delete this.cache.policies.typePolicies.Query.fields[n],u()},l},r}watchFragment(e){const n=(0,pA.generateFragmentFieldName)(),r=(0,hA.buildWatchFragmentQuery)(Object.assign(Object.assign({},e),{fieldName:n,policies:this.policies}));return this.watchQueryForField(r,n)}watchFragmentWhere(e){const n=(0,pA.generateFragmentFieldName)(),r=(0,jd.makeVar)(e.filter),i=(0,jd.makeVar)(e.limit),s=(0,jd.makeVar)(e.orderBy),o=(0,hA.buildWatchFragmentWhereQuery)(Object.assign(Object.assign({},e),{fieldName:n,filterVar:r,limitVar:i,orderByVar:s,cache:this.cache,policies:this.policies}));return this.watchQueryForField(o,n)}}Bv.default=hX,function(t){var e=De&&De.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(t,"__esModule",{value:!0}),t.ApolloExtensionsClient=void 0;var n=Bv;Object.defineProperty(t,"ApolloExtensionsClient",{enumerable:!0,get:function(){return e(n).default}})}(fA);var mA={},Uv={},Po={},pX=De&&De.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Po,"__esModule",{value:!0}),Po.usePrevious=Po.useOnce=void 0;const Bd=ie,mX=pX(wd);function gX(t){const e=(0,Bd.useRef)(),n=(0,Bd.useRef)(!1);return n.current||((0,mX.default)(t)?e.current=t():e.current=t,n.current=!0),e.current}Po.useOnce=gX;const yX=t=>{const e=(0,Bd.useRef)(null);return(0,Bd.useEffect)(()=>{e.current=t}),e.current};Po.usePrevious=yX;var Rc={};Object.defineProperty(Rc,"__esModule",{value:!0}),Rc.useFragmentTypePolicyFieldName=void 0;const vX=La,gA=ie,bX=xs,_X=Po,EX=({fragmentName:t}={})=>{const e=(0,gA.useMemo)(()=>(0,bX.generateFragmentFieldName)({fragmentName:t}),[t]),n=(0,_X.usePrevious)(e),r=(0,vX.useApolloClient)();return(0,gA.useEffect)(()=>()=>{delete r.cache.policies.typePolicies.Query.fields[n]},[e,n]),e};Rc.useFragmentTypePolicyFieldName=EX;var Pc={};Object.defineProperty(Pc,"__esModule",{value:!0}),Pc.useGetQueryDataByFieldName=void 0;const wX=La,TX=(t,e,n)=>{var r,i;const s=(0,wX.useQuery)(t,{fetchPolicy:"cache-only",returnPartialData:n==null?void 0:n.returnPartialData});return{data:(i=(r=s==null?void 0:s.data)===null||r===void 0?void 0:r[e])!==null&&i!==void 0?i:null}};Pc.useGetQueryDataByFieldName=TX,Object.defineProperty(Uv,"__esModule",{value:!0});const SX=La,OX=ie,kX=Po,NX=Rs,AX=Rc,IX=Pc;function xX(t,e){const r=(0,OX.useContext)((0,SX.getApolloContext)()).client,i=r==null?void 0:r.cache,s=(0,AX.useFragmentTypePolicyFieldName)(),o=(0,kX.useOnce)(()=>(0,NX.buildWatchFragmentQuery)({fragment:t,fieldName:s,id:e.id,policies:i.policies}));return(0,IX.useGetQueryDataByFieldName)(o,s,e)}Uv.default=xX;var qv={};const CX=ma(JP);Object.defineProperty(qv,"__esModule",{value:!0});const DX=La,Li=ie,MX=Rs,RX=Rc,PX=Pc,Wv=La,yA=CX;function FX(t,e){var n;const r=e==null?void 0:e.filter,s=(0,Li.useRef)((0,Wv.makeVar)(r)).current,o=e==null?void 0:e.limit,l=(0,Li.useRef)((0,Wv.makeVar)(o)).current,u=e==null?void 0:e.orderBy,h=(0,Li.useRef)((0,Wv.makeVar)(u)).current,g=(0,Li.useContext)((0,DX.getApolloContext)()).client,y=g==null?void 0:g.cache,b=(0,RX.useFragmentTypePolicyFieldName)({fragmentName:e==null?void 0:e.fragmentName}),_=(0,Li.useRef)([]);(0,Li.useEffect)(()=>{(typeof r=="function"&&r!==s()||!(0,yA.equal)(r,s()))&&s(r)},[r]),(0,Li.useEffect)(()=>{o!==l()&&l(o)},[o]),(0,Li.useEffect)(()=>{(typeof u=="function"&&u!==h()||!(0,yA.equal)(u,h()))&&h(u)},[u]);const w=(0,Li.useMemo)(()=>(0,MX.buildWatchFragmentWhereQuery)({filter:r,filterVar:s,limitVar:l,orderByVar:h,fragment:t,fieldName:b,cache:y,policies:y.policies}),[b]),O=(0,PX.useGetQueryDataByFieldName)(w,b,e);return Object.assign(Object.assign({},O),{data:(n=O.data)!==null&&n!==void 0?n:_.current})}qv.default=FX,function(t){var e=De&&De.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(t,"__esModule",{value:!0}),t.useFragmentWhere=t.useFragment=void 0;var n=Uv;Object.defineProperty(t,"useFragment",{enumerable:!0,get:function(){return e(n).default}});var r=qv;Object.defineProperty(t,"useFragmentWhere",{enumerable:!0,get:function(){return e(r).default}})}(mA);var vA={},zv={},Fc={},LX=De&&De.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Fc,"__esModule",{value:!0}),Fc.AuditType=void 0;const $X=LX(Md);var Lc;(function(t){t.Read="Read",t.Write="Write",t.Evict="Evict"})(Lc||(Fc.AuditType=Lc={}));class VX extends $X.default{constructor(e){super(e),this.auditLog=e.auditLog}runReadPolicy({typename:e,dataId:n,fieldName:r,storeFieldName:i,reportOnly:s=!1}){return this.auditLog.log("Running read policy",Lc.Read,"InvalidationPolicyManager",{storeFieldName:i,typename:e,dataId:n,fieldName:r}),super.runReadPolicy({typename:e,dataId:n,fieldName:r,storeFieldName:i,reportOnly:s})}runWritePolicy(e,n){return this.auditLog.log("Running write policy",Lc.Write,"InvalidationPolicyManager",Object.assign({typeName:e},n)),super.runWritePolicy(e,n)}runEvictPolicy(e,n){return this.auditLog.log("Running evict policy",Lc.Write,"InvalidationPolicyManager",Object.assign({typeName:e},n)),super.runEvictPolicy(e,n)}}Fc.default=VX;var Qv={},jX=De&&De.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Qv,"__esModule",{value:!0});const BX=jX(Vd);var Ud;(function(t){t.Write="Write",t.Evict="Evict"})(Ud||(Ud={}));class UX extends BX.default{constructor(e){super(),this.auditLog=e.auditLog}write(e,n,r,i){return this.auditLog.log("Writing to type map",Ud.Write,"EntityTypeMap",{typename:e,dataId:n,storeFieldName:r,variables:i}),super.write(e,n,r,i)}evict(e,n){return this.auditLog.log("Evicting from type map",Ud.Evict,"EntityTypeMap",{dataId:e,storeFieldName:n}),super.evict(e,n)}}Qv.default=UX;var Gv={},qX=av;function WX(t,e){var n=[];return qX(t,function(r,i,s){e(r,i,s)&&n.push(r)}),n}var zX=WX,QX=G1,GX=zX,HX=Sv,KX=Mn;function JX(t,e){var n=KX(t)?QX:GX;return n(t,HX(e))}var YX=JX,XX=De&&De.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Gv,"__esModule",{value:!0});const ZX=XX(YX);class eZ{constructor(){this._log=[]}log(e,n,r,i){const s={time:Date.now(),type:n,event:e,meta:i,group:r};this._log.push(s)}getLog(e){return(0,ZX.default)(this._log,e)}printLog(e){this.getLog(e).forEach(this.printLogEntry)}printLogEntry(e){var n;console.log(`%c event: ${e.event}`,"color: green"),console.group(),console.log(`type: ${e.type}`),console.log(`time: ${e.time}`),console.log(`meta: ${JSON.stringify((n=e.meta)!==null&&n!==void 0?n:{})}`),console.groupEnd()}}Gv.default=eZ;var qd=De&&De.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(zv,"__esModule",{value:!0});const tZ=qd(yd),nZ=Ro,rZ=qd(Fc),iZ=qd(Qv),sZ=qd(Gv),oZ=Pv;class aZ extends tZ.default{constructor(e){super(e),this.auditLog=new sZ.default;const{invalidationPolicies:n={}}=e;this.entityTypeMap=new iZ.default({auditLog:this.auditLog}),new oZ.EntityStoreWatcher({entityStore:this.entityStoreRoot,entityTypeMap:this.entityTypeMap,policies:this.policies,reactiveVarsCache:this.reactiveVarsCache,updateCollectionField:this.updateCollectionField.bind(this)}),this.invalidationPolicyManager=new rZ.default({auditLog:this.auditLog,policies:n,entityTypeMap:this.entityTypeMap,cacheOperations:{evict:this.evict.bind(this),modify:this.modify.bind(this),readField:this.readField.bind(this)}}),this.cacheResultProcessor=new nZ.CacheResultProcessor({invalidationPolicyManager:this.invalidationPolicyManager,entityTypeMap:this.entityTypeMap,cache:this})}}zv.default=aZ,function(t){var e=De&&De.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(t,"__esModule",{value:!0}),t.InvalidationPolicyCacheAuditor=void 0;var n=zv;Object.defineProperty(t,"InvalidationPolicyCacheAuditor",{enumerable:!0,get:function(){return e(n).default}})}(vA),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.RenewalPolicy=t.InvalidationPolicyEvent=t.InvalidationPolicyCacheAuditor=t.useFragmentWhere=t.useFragment=t.ApolloExtensionsClient=t.makeCachedVar=t.InvalidationPolicyCache=void 0;var e=T1;Object.defineProperty(t,"InvalidationPolicyCache",{enumerable:!0,get:function(){return e.InvalidationPolicyCache}}),Object.defineProperty(t,"makeCachedVar",{enumerable:!0,get:function(){return e.makeCachedVar}});var n=fA;Object.defineProperty(t,"ApolloExtensionsClient",{enumerable:!0,get:function(){return n.ApolloExtensionsClient}});var r=mA;Object.defineProperty(t,"useFragment",{enumerable:!0,get:function(){return r.useFragment}}),Object.defineProperty(t,"useFragmentWhere",{enumerable:!0,get:function(){return r.useFragmentWhere}});var i=vA;Object.defineProperty(t,"InvalidationPolicyCacheAuditor",{enumerable:!0,get:function(){return i.InvalidationPolicyCacheAuditor}});var s=Ir;Object.defineProperty(t,"InvalidationPolicyEvent",{enumerable:!0,get:function(){return s.InvalidationPolicyEvent}}),Object.defineProperty(t,"RenewalPolicy",{enumerable:!0,get:function(){return s.RenewalPolicy}})}(ev);var Hv=function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))},lZ=function(){function t(e){var n=e.debug,r=n===void 0?!1:n;this.debug=r,this.lines=[]}return t.prototype.emit=function(e,n){if(e in console){var r=t.prefix;console[e].apply(console,Hv([r],n,!1))}},t.prototype.tailLogs=function(){var e=this;this.lines.forEach(function(n){var r=n[0],i=n[1];return e.emit(r,i)})},t.prototype.getLogs=function(){return this.lines},t.prototype.write=function(e,n){var r=t.buffer;this.lines=Hv(Hv([],this.lines.slice(1-r),!0),[[e,n]],!1),(this.debug||e!=="log")&&this.emit(e,n)},t.prototype.info=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.write("log",e)},t.prototype.warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.write("warn",e)},t.prototype.error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.write("error",e)},t.buffer=30,t.prefix="[apollo-cache-persist]",t}(),cZ=function(){function t(e){var n=e.cache,r=e.serialize,i=r===void 0?!0:r;this.cache=n,this.serialize=i}return t.prototype.extract=function(){var e=this.cache.extract();return this.serialize&&(e=JSON.stringify(e)),e},t.prototype.restore=function(e){this.serialize&&typeof e=="string"&&(e=JSON.parse(e)),e!=null&&this.cache.restore(e)},t}(),Wd=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(d){try{u(r.next(d))}catch(h){o(h)}}function l(d){try{u(r.throw(d))}catch(h){o(h)}}function u(d){d.done?s(d.value):i(d.value).then(a,l)}u((r=r.apply(t,e||[])).next())})},zd=function(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(d){return l([u,d])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(n=0)),n;)try{if(r=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){n.label=u[1];break}if(u[0]===6&&n.label<s[1]){n.label=s[1],s=u;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(u);break}s[2]&&n.ops.pop(),n.trys.pop();continue}u=e.call(t,n)}catch(d){u=[6,d],i=0}finally{r=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},bA=function(){function t(e){var n=e.storage,r=e.key,i=r===void 0?"apollo-cache-persist":r;this.storage=n,this.key=i}return t.prototype.read=function(){return Wd(this,void 0,void 0,function(){return zd(this,function(e){return[2,this.storage.getItem(this.key)]})})},t.prototype.write=function(e){return Wd(this,void 0,void 0,function(){return zd(this,function(n){switch(n.label){case 0:return[4,this.storage.setItem(this.key,e)];case 1:return n.sent(),[2]}})})},t.prototype.purge=function(){return Wd(this,void 0,void 0,function(){return zd(this,function(e){switch(e.label){case 0:return[4,this.storage.removeItem(this.key)];case 1:return e.sent(),[2]}})})},t.prototype.getSize=function(){return Wd(this,void 0,void 0,function(){var e;return zd(this,function(n){switch(n.label){case 0:return[4,this.storage.getItem(this.key)];case 1:return e=n.sent(),e==null?[2,0]:[2,typeof e=="string"?e.length:null]}})})},t}(),Kv=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(d){try{u(r.next(d))}catch(h){o(h)}}function l(d){try{u(r.throw(d))}catch(h){o(h)}}function u(d){d.done?s(d.value):i(d.value).then(a,l)}u((r=r.apply(t,e||[])).next())})},Jv=function(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(d){return l([u,d])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(n=0)),n;)try{if(r=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){n.label=u[1];break}if(u[0]===6&&n.label<s[1]){n.label=s[1],s=u;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(u);break}s[2]&&n.ops.pop(),n.trys.pop();continue}u=e.call(t,n)}catch(d){u=[6,d],i=0}finally{r=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},_A=function(){function t(e,n){var r=e.log,i=e.cache,s=e.storage,o=n.maxSize,a=o===void 0?1024*1024:o,l=n.persistenceMapper;this.log=r,this.cache=i,this.storage=s,this.paused=!1,l&&(this.persistenceMapper=l),a&&(this.maxSize=a)}return t.prototype.persist=function(){return Kv(this,void 0,void 0,function(){var e,n;return Jv(this,function(r){switch(r.label){case 0:return r.trys.push([0,6,,7]),e=this.cache.extract(),!this.paused&&this.persistenceMapper?[4,this.persistenceMapper(e)]:[3,2];case 1:e=r.sent(),r.label=2;case 2:return this.maxSize!=null&&typeof e=="string"&&e.length>this.maxSize&&!this.paused?[4,this.purge()]:[3,4];case 3:return r.sent(),this.paused=!0,[2];case 4:return this.paused?[2]:[4,this.storage.write(e)];case 5:return r.sent(),this.log.info(typeof e=="string"?"Persisted cache of size ".concat(e.length," characters"):"Persisted cache"),[3,7];case 6:throw n=r.sent(),this.log.error("Error persisting cache",n),n;case 7:return[2]}})})},t.prototype.restore=function(){return Kv(this,void 0,void 0,function(){var e,n;return Jv(this,function(r){switch(r.label){case 0:return r.trys.push([0,5,,6]),[4,this.storage.read()];case 1:return e=r.sent(),e==null?[3,3]:[4,this.cache.restore(e)];case 2:return r.sent(),this.log.info(typeof e=="string"?"Restored cache of size ".concat(e.length," characters"):"Restored cache"),[3,4];case 3:this.log.info("No stored cache to restore"),r.label=4;case 4:return[3,6];case 5:throw n=r.sent(),this.log.error("Error restoring cache",n),n;case 6:return[2]}})})},t.prototype.purge=function(){return Kv(this,void 0,void 0,function(){var e;return Jv(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.storage.purge()];case 1:return n.sent(),this.log.info("Purged cache storage"),[3,3];case 2:throw e=n.sent(),this.log.error("Error purging cache storage",e),e;case 3:return[2]}})})},t}();const EA=function(t){var e=t.cache;return function(n){var r=e.write,i=e.evict,s=e.modify,o=e.gc;return e.write=function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var u=r.apply(e,a);return n(),u},e.evict=function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var u=i.apply(e,a);return n(),u},e.modify=function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var u=s.apply(e,a);return n(),u},e.gc=function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var u=o.apply(e,a);return n(),u},function(){e.write=r,e.evict=i,e.modify=s,e.gc=o}}},uZ=function(t){var e=t.log,n=t.cache;return function(r){return e.warn("Trigger option `background` not available on web; using `write` trigger"),EA({cache:n})(r)}};var fZ=function(){function t(e,n){var r=e.log,i=e.persistor,s=this;this.fire=function(){if(!s.debounce){s.persist();return}s.timeout!=null&&clearTimeout(s.timeout),s.timeout=setTimeout(s.persist,s.debounce)},this.persist=function(){s.paused||s.persistor.persist()};var o=t.defaultDebounce,a=n.cache,l=n.debounce,u=n.trigger,d=u===void 0?"write":u;if(d)switch(this.debounce=l??o,this.persistor=i,this.paused=!1,d){case"write":this.uninstall=EA({cache:a})(this.fire);break;case"background":l&&r.warn("Debounce is not recommended with `background` trigger"),this.debounce=l,this.uninstall=uZ({cache:a,log:r})(this.fire);break;default:if(typeof d=="function")this.uninstall=d(this.fire);else throw Error("Unrecognized trigger option: ".concat(d))}}return t.prototype.pause=function(){this.paused=!0},t.prototype.resume=function(){this.paused=!1},t.prototype.remove=function(){this.uninstall&&(this.uninstall(),this.uninstall=null,this.paused=!0)},t.defaultDebounce=1e3,t}(),dZ=function(){function t(e){if(!e.cache)throw new Error("In order to persist your Apollo Cache, you need to pass in a cache. Please see https://www.apollographql.com/docs/react/basics/caching.html for our default InMemoryCache.");if(!e.storage)throw new Error("In order to persist your Apollo Cache, you need to pass in an underlying storage provider. Please see https://github.com/apollographql/apollo-cache-persist#storage-providers");var n=new lZ(e),r=new cZ(e),i=new bA(e),s=new _A({log:n,cache:r,storage:i},e),o=new fZ({log:n,persistor:s},e);this.log=n,this.cache=r,this.storage=i,this.persistor=s,this.trigger=o}return t.prototype.persist=function(){return this.persistor.persist()},t.prototype.restore=function(){return this.persistor.restore()},t.prototype.purge=function(){return this.persistor.purge()},t.prototype.pause=function(){this.trigger.pause()},t.prototype.resume=function(){this.trigger.resume()},t.prototype.remove=function(){this.trigger.remove()},t.prototype.getLogs=function(e){if(e===void 0&&(e=!1),e)this.log.tailLogs();else return this.log.getLogs()},t.prototype.getSize=function(){return this.storage.getSize()},t}(),Yv=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),hZ=function(t){var e=new pZ(t);e.restoreSync()},pZ=function(t){Yv(e,t);function e(n){var r=t.call(this,n)||this;return r.storage=new gZ(n),r.persistor=new mZ({log:r.log,cache:r.cache,storage:r.storage},n),r}return e.prototype.restoreSync=function(){this.persistor.restoreSync()},e}(dZ),mZ=function(t){Yv(e,t);function e(n,r){var i=n.log,s=n.cache,o=n.storage;return t.call(this,{log:i,cache:s,storage:o},r)||this}return e.prototype.restoreSync=function(){this.cache.restore(this.storage.readSync())},e}(_A),gZ=function(t){Yv(e,t);function e(n){return t.call(this,n)||this}return e.prototype.readSync=function(){return this.storage.getItem(this.key)},e}(bA),yZ=function(){function t(e){this.storage=e}return t.prototype.getItem=function(e){return this.storage.getItem(e)},t.prototype.removeItem=function(e){return this.storage.removeItem(e)},t.prototype.setItem=function(e,n){return n!==null?this.storage.setItem(e,n):this.removeItem(e)},t}();function Hn(t){return t===null?"null":Array.isArray(t)?"array":typeof t}function Fo(t){return Hn(t)==="object"}function vZ(t){return Array.isArray(t)&&t.length>0&&t.every(e=>"message"in e)}function wA(t,e){return t.length<124?t:e}const bZ="graphql-transport-ws";var or;(function(t){t[t.InternalServerError=4500]="InternalServerError",t[t.InternalClientError=4005]="InternalClientError",t[t.BadRequest=4400]="BadRequest",t[t.BadResponse=4004]="BadResponse",t[t.Unauthorized=4401]="Unauthorized",t[t.Forbidden=4403]="Forbidden",t[t.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",t[t.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",t[t.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",t[t.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",t[t.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(or||(or={}));var Dt;(function(t){t.ConnectionInit="connection_init",t.ConnectionAck="connection_ack",t.Ping="ping",t.Pong="pong",t.Subscribe="subscribe",t.Next="next",t.Error="error",t.Complete="complete"})(Dt||(Dt={}));function TA(t){if(!Fo(t))throw new Error(`Message is expected to be an object, but got ${Hn(t)}`);if(!t.type)throw new Error("Message is missing the 'type' property");if(typeof t.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${Hn(t.type)}`);switch(t.type){case Dt.ConnectionInit:case Dt.ConnectionAck:case Dt.Ping:case Dt.Pong:{if(t.payload!=null&&!Fo(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${t.payload}"`);break}case Dt.Subscribe:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${Hn(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!Fo(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${Hn(t.payload)}`);if(typeof t.payload.query!="string")throw new Error(`"${t.type}" message payload expects the 'query' property to be a string, but got ${Hn(t.payload.query)}`);if(t.payload.variables!=null&&!Fo(t.payload.variables))throw new Error(`"${t.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${Hn(t.payload.variables)}`);if(t.payload.operationName!=null&&Hn(t.payload.operationName)!=="string")throw new Error(`"${t.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${Hn(t.payload.operationName)}`);if(t.payload.extensions!=null&&!Fo(t.payload.extensions))throw new Error(`"${t.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${Hn(t.payload.extensions)}`);break}case Dt.Next:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${Hn(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!Fo(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${Hn(t.payload)}`);break}case Dt.Error:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${Hn(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!vZ(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(t.payload)}`);break}case Dt.Complete:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${Hn(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${t.type}"`)}return t}function _Z(t,e){return TA(typeof t=="string"?JSON.parse(t,e):t)}function $c(t,e){return TA(t),JSON.stringify(t,e)}var za=function(t){return this instanceof za?(this.v=t,this):new za(t)},EZ=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){r[p]&&(i[p]=function(g){return new Promise(function(y,b){s.push([p,g,y,b])>1||a(p,g)})})}function a(p,g){try{l(r[p](g))}catch(y){h(s[0][3],y)}}function l(p){p.value instanceof za?Promise.resolve(p.value.v).then(u,d):h(s[0][2],p)}function u(p){a("next",p)}function d(p){a("throw",p)}function h(p,g){p(g),s.shift(),s.length&&a(s[0][0],s[0][1])}};function wZ(t){const{url:e,connectionParams:n,lazy:r=!0,onNonLazyError:i=console.error,lazyCloseTimeout:s=0,keepAlive:o=0,disablePong:a,connectionAckWaitTimeout:l=0,retryAttempts:u=5,retryWait:d=async function(xe){let fe=1e3;for(let Ee=0;Ee<xe;Ee++)fe*=2;await new Promise(Ee=>setTimeout(Ee,fe+Math.floor(Math.random()*2700+300)))},shouldRetry:h=Xv,isFatalConnectionProblem:p,on:g,webSocketImpl:y,generateID:b=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,xe=>{const fe=Math.random()*16|0;return(xe=="x"?fe:fe&3|8).toString(16)})},jsonMessageReplacer:_,jsonMessageReviver:w}=t;let O;if(y){if(!SZ(y))throw new Error("Invalid WebSocket implementation provided");O=y}else typeof WebSocket<"u"?O=WebSocket:typeof global<"u"?O=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(O=window.WebSocket||window.MozWebSocket);if(!O)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");const N=O,I=(()=>{const te=(()=>{const fe={};return{on(Ee,ye){return fe[Ee]=ye,()=>{delete fe[Ee]}},emit(Ee){var ye;"id"in Ee&&((ye=fe[Ee.id])===null||ye===void 0||ye.call(fe,Ee))}}})(),xe={connecting:g!=null&&g.connecting?[g.connecting]:[],opened:g!=null&&g.opened?[g.opened]:[],connected:g!=null&&g.connected?[g.connected]:[],ping:g!=null&&g.ping?[g.ping]:[],pong:g!=null&&g.pong?[g.pong]:[],message:g!=null&&g.message?[te.emit,g.message]:[te.emit],closed:g!=null&&g.closed?[g.closed]:[],error:g!=null&&g.error?[g.error]:[]};return{onMessage:te.on,on(fe,Ee){const ye=xe[fe];return ye.push(Ee),()=>{ye.splice(ye.indexOf(Ee),1)}},emit(fe,...Ee){for(const ye of[...xe[fe]])ye(...Ee)}}})();function P(te){const xe=[I.on("error",fe=>{xe.forEach(Ee=>Ee()),te(fe)}),I.on("closed",fe=>{xe.forEach(Ee=>Ee()),te(fe)})]}let R,B=0,Q,x=!1,U=0,be=!1;async function Oe(){clearTimeout(Q);const[te,xe]=await(R??(R=new Promise((ye,ut)=>(async()=>{if(x){if(await d(U),!B)return R=void 0,ut({code:1e3,reason:"All Subscriptions Gone"});U++}I.emit("connecting",x);const ve=new N(typeof e=="function"?await e():e,bZ);let $,Z;function Y(){isFinite(o)&&o>0&&(clearTimeout(Z),Z=setTimeout(()=>{ve.readyState===N.OPEN&&(ve.send($c({type:Dt.Ping})),I.emit("ping",!1,void 0))},o))}P(we=>{R=void 0,clearTimeout($),clearTimeout(Z),ut(we),we instanceof SA&&(ve.close(4499,"Terminated"),ve.onerror=null,ve.onclose=null)}),ve.onerror=we=>I.emit("error",we),ve.onclose=we=>I.emit("closed",we),ve.onopen=async()=>{try{I.emit("opened",ve);const we=typeof n=="function"?await n():n;if(ve.readyState!==N.OPEN)return;ve.send($c(we?{type:Dt.ConnectionInit,payload:we}:{type:Dt.ConnectionInit},_)),isFinite(l)&&l>0&&($=setTimeout(()=>{ve.close(or.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},l)),Y()}catch(we){I.emit("error",we),ve.close(or.InternalClientError,wA(we instanceof Error?we.message:new Error(we).message,"Internal client error"))}};let ee=!1;ve.onmessage=({data:we})=>{try{const Pe=_Z(we,w);if(I.emit("message",Pe),Pe.type==="ping"||Pe.type==="pong"){I.emit(Pe.type,!0,Pe.payload),Pe.type==="pong"?Y():a||(ve.send($c(Pe.payload?{type:Dt.Pong,payload:Pe.payload}:{type:Dt.Pong})),I.emit("pong",!1,Pe.payload));return}if(ee)return;if(Pe.type!==Dt.ConnectionAck)throw new Error(`First message cannot be of type ${Pe.type}`);clearTimeout($),ee=!0,I.emit("connected",ve,Pe.payload,x),x=!1,U=0,ye([ve,new Promise((Ze,ln)=>P(ln))])}catch(Pe){ve.onmessage=null,I.emit("error",Pe),ve.close(or.BadResponse,wA(Pe instanceof Error?Pe.message:new Error(Pe).message,"Bad response"))}}})())));te.readyState===N.CLOSING&&await xe;let fe=()=>{};const Ee=new Promise(ye=>fe=ye);return[te,fe,Promise.race([Ee.then(()=>{if(!B){const ye=()=>te.close(1e3,"Normal Closure");isFinite(s)&&s>0?Q=setTimeout(()=>{te.readyState===N.OPEN&&ye()},s):ye()}}),xe])]}function ke(te){if(Xv(te)&&(TZ(te.code)||[or.InternalServerError,or.InternalClientError,or.BadRequest,or.BadResponse,or.Unauthorized,or.SubprotocolNotAcceptable,or.SubscriberAlreadyExists,or.TooManyInitialisationRequests].includes(te.code)))throw te;if(be)return!1;if(Xv(te)&&te.code===1e3)return B>0;if(!u||U>=u||!h(te)||p!=null&&p(te))throw te;return x=!0}r||(async()=>{for(B++;;)try{const[,,te]=await Oe();await te}catch(te){try{if(!ke(te))return}catch(xe){return i==null?void 0:i(xe)}}})();function je(te,xe){const fe=b(te);let Ee=!1,ye=!1,ut=()=>{B--,Ee=!0};return(async()=>{for(B++;;)try{const[ve,$,Z]=await Oe();if(Ee)return $();const Y=I.onMessage(fe,ee=>{switch(ee.type){case Dt.Next:{xe.next(ee.payload);return}case Dt.Error:{ye=!0,Ee=!0,xe.error(ee.payload),ut();return}case Dt.Complete:{Ee=!0,ut();return}}});ve.send($c({id:fe,type:Dt.Subscribe,payload:te},_)),ut=()=>{!Ee&&ve.readyState===N.OPEN&&ve.send($c({id:fe,type:Dt.Complete},_)),B--,Ee=!0,$()},await Z.finally(Y);return}catch(ve){if(!ke(ve))return}})().then(()=>{ye||xe.complete()}).catch(ve=>{xe.error(ve)}),()=>{Ee||ut()}}return{on:I.on,subscribe:je,iterate(te){const xe=[],fe={done:!1,error:null,resolve:()=>{}},Ee=je(te,{next(ut){xe.push(ut),fe.resolve()},error(ut){fe.done=!0,fe.error=ut,fe.resolve()},complete(){fe.done=!0,fe.resolve()}}),ye=function(){return EZ(this,arguments,function*(){for(;;){for(xe.length||(yield za(new Promise($=>fe.resolve=$)));xe.length;)yield yield za(xe.shift());if(fe.error)throw fe.error;if(fe.done)return yield za(void 0)}})}();return ye.throw=async ut=>(fe.done||(fe.done=!0,fe.error=ut,fe.resolve()),{done:!0,value:void 0}),ye.return=async()=>(Ee(),{done:!0,value:void 0}),ye},async dispose(){if(be=!0,R){const[te]=await R;te.close(1e3,"Normal Closure")}},terminate(){R&&I.emit("closed",new SA)}}}class SA extends Error{constructor(){super(...arguments),this.name="TerminatedCloseEvent",this.message="4499: Terminated",this.code=4499,this.reason="Terminated",this.wasClean=!1}}function Xv(t){return Fo(t)&&"code"in t&&"reason"in t}function TZ(t){return[1e3,1001,1006,1005,1012,1013,1014].includes(t)?!1:t>=1e3&&t<=1999}function SZ(t){return typeof t=="function"&&"constructor"in t&&"CLOSED"in t&&"CLOSING"in t&&"CONNECTING"in t&&"OPEN"in t}const OZ=({apiUrl:t,organizationId:e,listeners:n,lazy:r=!1,token:i})=>{const s=wZ({url:`wss://${t}`,lazy:r,connectionParams:oc.omitBy({"organization-id":e,authorization:i?`Bearer ${i}`:void 0},oc.isNil),keepAlive:1e4});return n&&(n.onConnected&&s.on("connected",n.onConnected),n.onClosed&&s.on("closed",n.onClosed),n.onError&&s.on("error",n.onError)),s},kZ=({token:t,organizationId:e,invalidationPolicies:n,handlers:r,fetchPolicy:i,websocket:s,apiBaseUrl:o})=>{const a=new ev.InvalidationPolicyCache({invalidationPolicies:{...n,timeToLive:(n==null?void 0:n.timeToLive)??12e4,renewalPolicy:(n==null?void 0:n.renewalPolicy)??ev.RenewalPolicy.None}});hZ({cache:a,storage:new yZ(window.localStorage)});const l=`api.warrior.${o??"well-played.gg"}/graphql`,u=Nm(({query:d})=>{const h=so(d);return h.kind==="OperationDefinition"&&h.operation==="subscription"},new lW(OZ({apiUrl:l,listeners:r==null?void 0:r.webSocket,organizationId:e,lazy:s==null?void 0:s.lazy,token:t})),km([sW(async()=>({headers:oc.omitBy({"organization-id":e,authorization:t?`Bearer ${t}`:void 0},oc.isNil)})),...r!=null&&r.onError?[w1(r==null?void 0:r.onError)]:[],new rf({uri:`https://${l}`})]));return new df({cache:a,link:u,defaultOptions:{watchQuery:{fetchPolicy:i??"network-only",errorPolicy:"ignore"},query:{fetchPolicy:i??"network-only",errorPolicy:"all"},mutate:{errorPolicy:"all"}}})},OA=ie.createContext({}),NZ=()=>{const t=ie.useContext(OA);if(!t)throw new Error("useWellPlayed must be used within a WellPlayedProvider");return t},AZ=({children:t,clientConfig:e,organizationId:n})=>{const r=A$(),i=ie.useMemo(()=>(console.log("accessToken",r==null?void 0:r.accessToken),kZ({token:(r==null?void 0:r.accessToken)??void 0,organizationId:n,...e})),[r==null?void 0:r.accessToken,n,e]);return he.jsx(AT,{client:i,children:he.jsx(OA.Provider,{value:{organizationId:n,apiClient:i},children:t})})},IZ=({children:t,oidcConfig:e,wpAppConfig:n,...r})=>he.jsx(S$,{...e,configuration:{...n,...e==null?void 0:e.configuration,authority:`https://oauth.warrior.${r.apiBaseUrl??"well-played.gg"}`},children:he.jsx(AZ,{...r,children:t})});Gt.RichTextEditorContent=iW,Gt.WellPlayedProvider=IZ,Gt.graphql=wa,Gt.readFragment=L$,Gt.useConnectedPlayer=j$,Gt.usePaginatedLoadAll=wg,Gt.usePaginatedQuery=pL,Gt.usePlayers=vS,Gt.useTournamentStep=W$,Gt.useTournamentTeams=bS,Gt.useWellPlayed=NZ,Object.defineProperty(Gt,Symbol.toStringTag,{value:"Module"})});
494
+ `,data:{__typename:jv.cacheExtensionsCollectionTypename,id:e,data:[]}}),this.entityTypeMap.readEntityById(n)||(this._hasPendingCollectionUpdates||setTimeout(()=>this._updatePendingCollections(),0),this.pendingCollectionUpdates[r]||(this.pendingCollectionUpdates[r]={}),this.pendingCollectionUpdates[r][n]||(this.pendingCollectionUpdates[r][n]=(0,Ms.makeReference)(n)))}_expire(e=!1){const{entitiesById:n}=this.entityTypeMap.extract(),r=[];return Object.keys(n).forEach(i=>{const s=n[i],{storeFieldNames:o,dataId:a,fieldName:l,typename:u}=s;(0,mi.isQuery)(a)&&o?Object.keys(o.entries).forEach(d=>{this.invalidationPolicyManager.runReadPolicy({typename:u,dataId:a,fieldName:l,storeFieldName:d,reportOnly:e})&&r.push((0,mi.makeEntityId)(a,d))}):this.invalidationPolicyManager.runReadPolicy({typename:u,dataId:a,fieldName:l,reportOnly:e})&&r.push((0,mi.makeEntityId)(a))}),r.length>0&&this.broadcastWatches(),r}expire(){return this._expire(!1)}expiredEntities(){return this._expire(!0)}activatePolicyEvents(...e){e.length>0?this.invalidationPolicyManager.activatePolicies(...e):this.invalidationPolicyManager.activatePolicies(Rn.InvalidationPolicyEvent.Read,Rn.InvalidationPolicyEvent.Write,Rn.InvalidationPolicyEvent.Evict)}deactivatePolicyEvents(...e){e.length>0?this.invalidationPolicyManager.deactivatePolicies(...e):this.invalidationPolicyManager.deactivatePolicies(Rn.InvalidationPolicyEvent.Read,Rn.InvalidationPolicyEvent.Write,Rn.InvalidationPolicyEvent.Evict)}activePolicyEvents(){return[Rn.InvalidationPolicyEvent.Read,Rn.InvalidationPolicyEvent.Write,Rn.InvalidationPolicyEvent.Evict].filter(e=>this.invalidationPolicyManager.isPolicyEventActive(e))}read(e){const n=super.read(e);if(!this.invalidationPolicyManager.isPolicyEventActive(Rn.InvalidationPolicyEvent.Read))return n;const r=(0,mi.maybeDeepClone)(n),i=this.cacheResultProcessor.processReadResult(r,e);return i===Mc.ReadResultStatus.Complete?n:(this.broadcastWatches(),i===Mc.ReadResultStatus.Evicted?null:r)}diff(e){const n=super.diff(e);if(!this.invalidationPolicyManager.isPolicyEventActive(Rn.InvalidationPolicyEvent.Read)||this.isBroadcasting)return n;const{result:r}=n,i=(0,mi.maybeDeepClone)(r),s=this.cacheResultProcessor.processReadResult(i,e);return s===Mc.ReadResultStatus.Complete||(this.broadcastWatches(),n.complete=!1,n.result=s===Mc.ReadResultStatus.Evicted?void 0:i),n}extract(e=!1,n=!0){this._hasPendingCollectionUpdates&&this._updatePendingCollections();const r=super.extract(e);return n&&(r.invalidation=(0,tX.default)(this.entityTypeMap.extract(),"entitiesById")),r}readFragmentWhere(e){const{fragment:n,filter:r,limit:i,orderBy:s}=e,o=Vv(e,["fragment","filter","limit","orderBy"]),l=n.definitions[0].typeCondition.name.value,d=this.readReferenceWhere({__typename:l,filter:r,limit:i,orderBy:s}).map(h=>this.readFragment(Object.assign(Object.assign({},o),{fragment:n,id:h.__ref})));return(0,Z7.default)(d)}readReferenceWhere(e){const{__typename:n,filter:r,limit:i,orderBy:s}=e,o=(0,jv.collectionEntityIdForType)(n);this.pendingCollectionUpdates[o]&&this._updatePendingCollection(o);let a=this.readField("data",(0,Ms.makeReference)(o));if(!a)return[];const l=this.readField.bind(this);if(r&&(a=a.filter(u=>{if((0,iX.default)(r))return r(u,l);const d=Object.keys(r).map(h=>{const p=r[h],g=this.readField(h,u);return p===g});return(0,eX.default)(d,Boolean)})),s){const{field:u,descending:d}=s;a=(0,sX.default)(a,h=>l(u,h),[d?"desc":"asc"])}return(0,rX.default)(i)?a:(0,nX.default)(a,i)}writeFragmentWhere(e){const{update:n}=e,r=Vv(e,["update"]);this.readFragmentWhere(r).forEach(i=>{this.writeFragment({id:this.identify(i),fragment:e.fragment,data:n(i),broadcast:!1})}),this.broadcastWatches()}}yd.default=lX,function(t){var e=De&&De.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(t,"__esModule",{value:!0}),t.InvalidationPolicyCache=t.makeCachedVar=void 0;var n=tv;Object.defineProperty(t,"makeCachedVar",{enumerable:!0,get:function(){return n.makeCachedVar}});var r=yd;Object.defineProperty(t,"InvalidationPolicyCache",{enumerable:!0,get:function(){return e(r).default}})}(T1);var fA={},Bv={},Rs={};const cX=ma(YM);Object.defineProperty(Rs,"__esModule",{value:!0}),Rs.buildWatchFragmentWhereQuery=Rs.buildWatchFragmentQuery=void 0;const Ps=cX,uX=kc;function dA({fieldName:t,fragmentDefinition:e}){return{kind:Ps.Kind.DOCUMENT,definitions:[{directives:[],variableDefinitions:[],kind:Ps.Kind.OPERATION_DEFINITION,operation:Ps.OperationTypeNode.QUERY,selectionSet:{kind:Ps.Kind.SELECTION_SET,selections:[{arguments:[],kind:Ps.Kind.FIELD,name:{kind:Ps.Kind.NAME,value:t},directives:[{arguments:[],kind:Ps.Kind.DIRECTIVE,name:{kind:Ps.Kind.NAME,value:"client"}}],selectionSet:e.selectionSet}]}}]}}function fX(t){const{fragment:e,id:n,policies:r,fieldName:i}=t,s=e.definitions[0],o=dA({fragmentDefinition:s,fieldName:i});return r.getFieldPolicy("Query",i)||r.addTypePolicies({Query:{fields:{[i]:{read(a){return(0,uX.makeReference)(n)}}}}}),o}Rs.buildWatchFragmentQuery=fX;function dX(t){const{fragment:e,filterVar:n,limitVar:r,orderByVar:i,policies:s,cache:o,fieldName:a}=t,l=e.definitions[0],u=l.typeCondition.name.value,d=dA({fragmentDefinition:l,fieldName:a});return s.getFieldPolicy("Query",a)||s.addTypePolicies({Query:{fields:{[a]:{read(h){return o.readReferenceWhere({__typename:u,filter:n(),limit:r(),orderBy:i()})}}}}}),d}Rs.buildWatchFragmentWhereQuery=dX,Object.defineProperty(Bv,"__esModule",{value:!0});const jd=kc,hA=Rs,pA=xs;class hX extends jd.ApolloClient{constructor(e){super(e),this.policies=this.cache.policies}watchQueryForField(e,n){const r=this.watchQuery({fetchPolicy:"cache-only",query:e}),i=r.subscribe.bind(r);return r.subscribe=(s,...o)=>{typeof s!="object"&&(s={next:s,error:o[0],complete:o[1]});const a=s.next;s.next=d=>{var h;a&&a((h=d==null?void 0:d.data)===null||h===void 0?void 0:h[n])};const l=i(s),u=l.unsubscribe.bind(l);return l.unsubscribe=()=>{delete this.cache.policies.typePolicies.Query.fields[n],u()},l},r}watchFragment(e){const n=(0,pA.generateFragmentFieldName)(),r=(0,hA.buildWatchFragmentQuery)(Object.assign(Object.assign({},e),{fieldName:n,policies:this.policies}));return this.watchQueryForField(r,n)}watchFragmentWhere(e){const n=(0,pA.generateFragmentFieldName)(),r=(0,jd.makeVar)(e.filter),i=(0,jd.makeVar)(e.limit),s=(0,jd.makeVar)(e.orderBy),o=(0,hA.buildWatchFragmentWhereQuery)(Object.assign(Object.assign({},e),{fieldName:n,filterVar:r,limitVar:i,orderByVar:s,cache:this.cache,policies:this.policies}));return this.watchQueryForField(o,n)}}Bv.default=hX,function(t){var e=De&&De.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(t,"__esModule",{value:!0}),t.ApolloExtensionsClient=void 0;var n=Bv;Object.defineProperty(t,"ApolloExtensionsClient",{enumerable:!0,get:function(){return e(n).default}})}(fA);var mA={},Uv={},Po={},pX=De&&De.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Po,"__esModule",{value:!0}),Po.usePrevious=Po.useOnce=void 0;const Bd=ie,mX=pX(wd);function gX(t){const e=(0,Bd.useRef)(),n=(0,Bd.useRef)(!1);return n.current||((0,mX.default)(t)?e.current=t():e.current=t,n.current=!0),e.current}Po.useOnce=gX;const yX=t=>{const e=(0,Bd.useRef)(null);return(0,Bd.useEffect)(()=>{e.current=t}),e.current};Po.usePrevious=yX;var Rc={};Object.defineProperty(Rc,"__esModule",{value:!0}),Rc.useFragmentTypePolicyFieldName=void 0;const vX=La,gA=ie,bX=xs,_X=Po,EX=({fragmentName:t}={})=>{const e=(0,gA.useMemo)(()=>(0,bX.generateFragmentFieldName)({fragmentName:t}),[t]),n=(0,_X.usePrevious)(e),r=(0,vX.useApolloClient)();return(0,gA.useEffect)(()=>()=>{delete r.cache.policies.typePolicies.Query.fields[n]},[e,n]),e};Rc.useFragmentTypePolicyFieldName=EX;var Pc={};Object.defineProperty(Pc,"__esModule",{value:!0}),Pc.useGetQueryDataByFieldName=void 0;const wX=La,TX=(t,e,n)=>{var r,i;const s=(0,wX.useQuery)(t,{fetchPolicy:"cache-only",returnPartialData:n==null?void 0:n.returnPartialData});return{data:(i=(r=s==null?void 0:s.data)===null||r===void 0?void 0:r[e])!==null&&i!==void 0?i:null}};Pc.useGetQueryDataByFieldName=TX,Object.defineProperty(Uv,"__esModule",{value:!0});const SX=La,OX=ie,kX=Po,NX=Rs,AX=Rc,IX=Pc;function xX(t,e){const r=(0,OX.useContext)((0,SX.getApolloContext)()).client,i=r==null?void 0:r.cache,s=(0,AX.useFragmentTypePolicyFieldName)(),o=(0,kX.useOnce)(()=>(0,NX.buildWatchFragmentQuery)({fragment:t,fieldName:s,id:e.id,policies:i.policies}));return(0,IX.useGetQueryDataByFieldName)(o,s,e)}Uv.default=xX;var qv={};const CX=ma(JP);Object.defineProperty(qv,"__esModule",{value:!0});const DX=La,Li=ie,MX=Rs,RX=Rc,PX=Pc,Wv=La,yA=CX;function FX(t,e){var n;const r=e==null?void 0:e.filter,s=(0,Li.useRef)((0,Wv.makeVar)(r)).current,o=e==null?void 0:e.limit,l=(0,Li.useRef)((0,Wv.makeVar)(o)).current,u=e==null?void 0:e.orderBy,h=(0,Li.useRef)((0,Wv.makeVar)(u)).current,g=(0,Li.useContext)((0,DX.getApolloContext)()).client,y=g==null?void 0:g.cache,b=(0,RX.useFragmentTypePolicyFieldName)({fragmentName:e==null?void 0:e.fragmentName}),_=(0,Li.useRef)([]);(0,Li.useEffect)(()=>{(typeof r=="function"&&r!==s()||!(0,yA.equal)(r,s()))&&s(r)},[r]),(0,Li.useEffect)(()=>{o!==l()&&l(o)},[o]),(0,Li.useEffect)(()=>{(typeof u=="function"&&u!==h()||!(0,yA.equal)(u,h()))&&h(u)},[u]);const w=(0,Li.useMemo)(()=>(0,MX.buildWatchFragmentWhereQuery)({filter:r,filterVar:s,limitVar:l,orderByVar:h,fragment:t,fieldName:b,cache:y,policies:y.policies}),[b]),O=(0,PX.useGetQueryDataByFieldName)(w,b,e);return Object.assign(Object.assign({},O),{data:(n=O.data)!==null&&n!==void 0?n:_.current})}qv.default=FX,function(t){var e=De&&De.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(t,"__esModule",{value:!0}),t.useFragmentWhere=t.useFragment=void 0;var n=Uv;Object.defineProperty(t,"useFragment",{enumerable:!0,get:function(){return e(n).default}});var r=qv;Object.defineProperty(t,"useFragmentWhere",{enumerable:!0,get:function(){return e(r).default}})}(mA);var vA={},zv={},Fc={},LX=De&&De.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Fc,"__esModule",{value:!0}),Fc.AuditType=void 0;const $X=LX(Md);var Lc;(function(t){t.Read="Read",t.Write="Write",t.Evict="Evict"})(Lc||(Fc.AuditType=Lc={}));class VX extends $X.default{constructor(e){super(e),this.auditLog=e.auditLog}runReadPolicy({typename:e,dataId:n,fieldName:r,storeFieldName:i,reportOnly:s=!1}){return this.auditLog.log("Running read policy",Lc.Read,"InvalidationPolicyManager",{storeFieldName:i,typename:e,dataId:n,fieldName:r}),super.runReadPolicy({typename:e,dataId:n,fieldName:r,storeFieldName:i,reportOnly:s})}runWritePolicy(e,n){return this.auditLog.log("Running write policy",Lc.Write,"InvalidationPolicyManager",Object.assign({typeName:e},n)),super.runWritePolicy(e,n)}runEvictPolicy(e,n){return this.auditLog.log("Running evict policy",Lc.Write,"InvalidationPolicyManager",Object.assign({typeName:e},n)),super.runEvictPolicy(e,n)}}Fc.default=VX;var Qv={},jX=De&&De.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Qv,"__esModule",{value:!0});const BX=jX(Vd);var Ud;(function(t){t.Write="Write",t.Evict="Evict"})(Ud||(Ud={}));class UX extends BX.default{constructor(e){super(),this.auditLog=e.auditLog}write(e,n,r,i){return this.auditLog.log("Writing to type map",Ud.Write,"EntityTypeMap",{typename:e,dataId:n,storeFieldName:r,variables:i}),super.write(e,n,r,i)}evict(e,n){return this.auditLog.log("Evicting from type map",Ud.Evict,"EntityTypeMap",{dataId:e,storeFieldName:n}),super.evict(e,n)}}Qv.default=UX;var Gv={},qX=av;function WX(t,e){var n=[];return qX(t,function(r,i,s){e(r,i,s)&&n.push(r)}),n}var zX=WX,QX=G1,GX=zX,HX=Sv,KX=Mn;function JX(t,e){var n=KX(t)?QX:GX;return n(t,HX(e))}var YX=JX,XX=De&&De.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Gv,"__esModule",{value:!0});const ZX=XX(YX);class eZ{constructor(){this._log=[]}log(e,n,r,i){const s={time:Date.now(),type:n,event:e,meta:i,group:r};this._log.push(s)}getLog(e){return(0,ZX.default)(this._log,e)}printLog(e){this.getLog(e).forEach(this.printLogEntry)}printLogEntry(e){var n;console.log(`%c event: ${e.event}`,"color: green"),console.group(),console.log(`type: ${e.type}`),console.log(`time: ${e.time}`),console.log(`meta: ${JSON.stringify((n=e.meta)!==null&&n!==void 0?n:{})}`),console.groupEnd()}}Gv.default=eZ;var qd=De&&De.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(zv,"__esModule",{value:!0});const tZ=qd(yd),nZ=Ro,rZ=qd(Fc),iZ=qd(Qv),sZ=qd(Gv),oZ=Pv;class aZ extends tZ.default{constructor(e){super(e),this.auditLog=new sZ.default;const{invalidationPolicies:n={}}=e;this.entityTypeMap=new iZ.default({auditLog:this.auditLog}),new oZ.EntityStoreWatcher({entityStore:this.entityStoreRoot,entityTypeMap:this.entityTypeMap,policies:this.policies,reactiveVarsCache:this.reactiveVarsCache,updateCollectionField:this.updateCollectionField.bind(this)}),this.invalidationPolicyManager=new rZ.default({auditLog:this.auditLog,policies:n,entityTypeMap:this.entityTypeMap,cacheOperations:{evict:this.evict.bind(this),modify:this.modify.bind(this),readField:this.readField.bind(this)}}),this.cacheResultProcessor=new nZ.CacheResultProcessor({invalidationPolicyManager:this.invalidationPolicyManager,entityTypeMap:this.entityTypeMap,cache:this})}}zv.default=aZ,function(t){var e=De&&De.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(t,"__esModule",{value:!0}),t.InvalidationPolicyCacheAuditor=void 0;var n=zv;Object.defineProperty(t,"InvalidationPolicyCacheAuditor",{enumerable:!0,get:function(){return e(n).default}})}(vA),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.RenewalPolicy=t.InvalidationPolicyEvent=t.InvalidationPolicyCacheAuditor=t.useFragmentWhere=t.useFragment=t.ApolloExtensionsClient=t.makeCachedVar=t.InvalidationPolicyCache=void 0;var e=T1;Object.defineProperty(t,"InvalidationPolicyCache",{enumerable:!0,get:function(){return e.InvalidationPolicyCache}}),Object.defineProperty(t,"makeCachedVar",{enumerable:!0,get:function(){return e.makeCachedVar}});var n=fA;Object.defineProperty(t,"ApolloExtensionsClient",{enumerable:!0,get:function(){return n.ApolloExtensionsClient}});var r=mA;Object.defineProperty(t,"useFragment",{enumerable:!0,get:function(){return r.useFragment}}),Object.defineProperty(t,"useFragmentWhere",{enumerable:!0,get:function(){return r.useFragmentWhere}});var i=vA;Object.defineProperty(t,"InvalidationPolicyCacheAuditor",{enumerable:!0,get:function(){return i.InvalidationPolicyCacheAuditor}});var s=Ir;Object.defineProperty(t,"InvalidationPolicyEvent",{enumerable:!0,get:function(){return s.InvalidationPolicyEvent}}),Object.defineProperty(t,"RenewalPolicy",{enumerable:!0,get:function(){return s.RenewalPolicy}})}(ev);var Hv=function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))},lZ=function(){function t(e){var n=e.debug,r=n===void 0?!1:n;this.debug=r,this.lines=[]}return t.prototype.emit=function(e,n){if(e in console){var r=t.prefix;console[e].apply(console,Hv([r],n,!1))}},t.prototype.tailLogs=function(){var e=this;this.lines.forEach(function(n){var r=n[0],i=n[1];return e.emit(r,i)})},t.prototype.getLogs=function(){return this.lines},t.prototype.write=function(e,n){var r=t.buffer;this.lines=Hv(Hv([],this.lines.slice(1-r),!0),[[e,n]],!1),(this.debug||e!=="log")&&this.emit(e,n)},t.prototype.info=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.write("log",e)},t.prototype.warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.write("warn",e)},t.prototype.error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.write("error",e)},t.buffer=30,t.prefix="[apollo-cache-persist]",t}(),cZ=function(){function t(e){var n=e.cache,r=e.serialize,i=r===void 0?!0:r;this.cache=n,this.serialize=i}return t.prototype.extract=function(){var e=this.cache.extract();return this.serialize&&(e=JSON.stringify(e)),e},t.prototype.restore=function(e){this.serialize&&typeof e=="string"&&(e=JSON.parse(e)),e!=null&&this.cache.restore(e)},t}(),Wd=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(d){try{u(r.next(d))}catch(h){o(h)}}function l(d){try{u(r.throw(d))}catch(h){o(h)}}function u(d){d.done?s(d.value):i(d.value).then(a,l)}u((r=r.apply(t,e||[])).next())})},zd=function(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(d){return l([u,d])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(n=0)),n;)try{if(r=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){n.label=u[1];break}if(u[0]===6&&n.label<s[1]){n.label=s[1],s=u;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(u);break}s[2]&&n.ops.pop(),n.trys.pop();continue}u=e.call(t,n)}catch(d){u=[6,d],i=0}finally{r=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},bA=function(){function t(e){var n=e.storage,r=e.key,i=r===void 0?"apollo-cache-persist":r;this.storage=n,this.key=i}return t.prototype.read=function(){return Wd(this,void 0,void 0,function(){return zd(this,function(e){return[2,this.storage.getItem(this.key)]})})},t.prototype.write=function(e){return Wd(this,void 0,void 0,function(){return zd(this,function(n){switch(n.label){case 0:return[4,this.storage.setItem(this.key,e)];case 1:return n.sent(),[2]}})})},t.prototype.purge=function(){return Wd(this,void 0,void 0,function(){return zd(this,function(e){switch(e.label){case 0:return[4,this.storage.removeItem(this.key)];case 1:return e.sent(),[2]}})})},t.prototype.getSize=function(){return Wd(this,void 0,void 0,function(){var e;return zd(this,function(n){switch(n.label){case 0:return[4,this.storage.getItem(this.key)];case 1:return e=n.sent(),e==null?[2,0]:[2,typeof e=="string"?e.length:null]}})})},t}(),Kv=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(d){try{u(r.next(d))}catch(h){o(h)}}function l(d){try{u(r.throw(d))}catch(h){o(h)}}function u(d){d.done?s(d.value):i(d.value).then(a,l)}u((r=r.apply(t,e||[])).next())})},Jv=function(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(d){return l([u,d])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(n=0)),n;)try{if(r=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){n.label=u[1];break}if(u[0]===6&&n.label<s[1]){n.label=s[1],s=u;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(u);break}s[2]&&n.ops.pop(),n.trys.pop();continue}u=e.call(t,n)}catch(d){u=[6,d],i=0}finally{r=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},_A=function(){function t(e,n){var r=e.log,i=e.cache,s=e.storage,o=n.maxSize,a=o===void 0?1024*1024:o,l=n.persistenceMapper;this.log=r,this.cache=i,this.storage=s,this.paused=!1,l&&(this.persistenceMapper=l),a&&(this.maxSize=a)}return t.prototype.persist=function(){return Kv(this,void 0,void 0,function(){var e,n;return Jv(this,function(r){switch(r.label){case 0:return r.trys.push([0,6,,7]),e=this.cache.extract(),!this.paused&&this.persistenceMapper?[4,this.persistenceMapper(e)]:[3,2];case 1:e=r.sent(),r.label=2;case 2:return this.maxSize!=null&&typeof e=="string"&&e.length>this.maxSize&&!this.paused?[4,this.purge()]:[3,4];case 3:return r.sent(),this.paused=!0,[2];case 4:return this.paused?[2]:[4,this.storage.write(e)];case 5:return r.sent(),this.log.info(typeof e=="string"?"Persisted cache of size ".concat(e.length," characters"):"Persisted cache"),[3,7];case 6:throw n=r.sent(),this.log.error("Error persisting cache",n),n;case 7:return[2]}})})},t.prototype.restore=function(){return Kv(this,void 0,void 0,function(){var e,n;return Jv(this,function(r){switch(r.label){case 0:return r.trys.push([0,5,,6]),[4,this.storage.read()];case 1:return e=r.sent(),e==null?[3,3]:[4,this.cache.restore(e)];case 2:return r.sent(),this.log.info(typeof e=="string"?"Restored cache of size ".concat(e.length," characters"):"Restored cache"),[3,4];case 3:this.log.info("No stored cache to restore"),r.label=4;case 4:return[3,6];case 5:throw n=r.sent(),this.log.error("Error restoring cache",n),n;case 6:return[2]}})})},t.prototype.purge=function(){return Kv(this,void 0,void 0,function(){var e;return Jv(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.storage.purge()];case 1:return n.sent(),this.log.info("Purged cache storage"),[3,3];case 2:throw e=n.sent(),this.log.error("Error purging cache storage",e),e;case 3:return[2]}})})},t}();const EA=function(t){var e=t.cache;return function(n){var r=e.write,i=e.evict,s=e.modify,o=e.gc;return e.write=function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var u=r.apply(e,a);return n(),u},e.evict=function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var u=i.apply(e,a);return n(),u},e.modify=function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var u=s.apply(e,a);return n(),u},e.gc=function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var u=o.apply(e,a);return n(),u},function(){e.write=r,e.evict=i,e.modify=s,e.gc=o}}},uZ=function(t){var e=t.log,n=t.cache;return function(r){return e.warn("Trigger option `background` not available on web; using `write` trigger"),EA({cache:n})(r)}};var fZ=function(){function t(e,n){var r=e.log,i=e.persistor,s=this;this.fire=function(){if(!s.debounce){s.persist();return}s.timeout!=null&&clearTimeout(s.timeout),s.timeout=setTimeout(s.persist,s.debounce)},this.persist=function(){s.paused||s.persistor.persist()};var o=t.defaultDebounce,a=n.cache,l=n.debounce,u=n.trigger,d=u===void 0?"write":u;if(d)switch(this.debounce=l??o,this.persistor=i,this.paused=!1,d){case"write":this.uninstall=EA({cache:a})(this.fire);break;case"background":l&&r.warn("Debounce is not recommended with `background` trigger"),this.debounce=l,this.uninstall=uZ({cache:a,log:r})(this.fire);break;default:if(typeof d=="function")this.uninstall=d(this.fire);else throw Error("Unrecognized trigger option: ".concat(d))}}return t.prototype.pause=function(){this.paused=!0},t.prototype.resume=function(){this.paused=!1},t.prototype.remove=function(){this.uninstall&&(this.uninstall(),this.uninstall=null,this.paused=!0)},t.defaultDebounce=1e3,t}(),dZ=function(){function t(e){if(!e.cache)throw new Error("In order to persist your Apollo Cache, you need to pass in a cache. Please see https://www.apollographql.com/docs/react/basics/caching.html for our default InMemoryCache.");if(!e.storage)throw new Error("In order to persist your Apollo Cache, you need to pass in an underlying storage provider. Please see https://github.com/apollographql/apollo-cache-persist#storage-providers");var n=new lZ(e),r=new cZ(e),i=new bA(e),s=new _A({log:n,cache:r,storage:i},e),o=new fZ({log:n,persistor:s},e);this.log=n,this.cache=r,this.storage=i,this.persistor=s,this.trigger=o}return t.prototype.persist=function(){return this.persistor.persist()},t.prototype.restore=function(){return this.persistor.restore()},t.prototype.purge=function(){return this.persistor.purge()},t.prototype.pause=function(){this.trigger.pause()},t.prototype.resume=function(){this.trigger.resume()},t.prototype.remove=function(){this.trigger.remove()},t.prototype.getLogs=function(e){if(e===void 0&&(e=!1),e)this.log.tailLogs();else return this.log.getLogs()},t.prototype.getSize=function(){return this.storage.getSize()},t}(),Yv=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),hZ=function(t){var e=new pZ(t);e.restoreSync()},pZ=function(t){Yv(e,t);function e(n){var r=t.call(this,n)||this;return r.storage=new gZ(n),r.persistor=new mZ({log:r.log,cache:r.cache,storage:r.storage},n),r}return e.prototype.restoreSync=function(){this.persistor.restoreSync()},e}(dZ),mZ=function(t){Yv(e,t);function e(n,r){var i=n.log,s=n.cache,o=n.storage;return t.call(this,{log:i,cache:s,storage:o},r)||this}return e.prototype.restoreSync=function(){this.cache.restore(this.storage.readSync())},e}(_A),gZ=function(t){Yv(e,t);function e(n){return t.call(this,n)||this}return e.prototype.readSync=function(){return this.storage.getItem(this.key)},e}(bA),yZ=function(){function t(e){this.storage=e}return t.prototype.getItem=function(e){return this.storage.getItem(e)},t.prototype.removeItem=function(e){return this.storage.removeItem(e)},t.prototype.setItem=function(e,n){return n!==null?this.storage.setItem(e,n):this.removeItem(e)},t}();function Hn(t){return t===null?"null":Array.isArray(t)?"array":typeof t}function Fo(t){return Hn(t)==="object"}function vZ(t){return Array.isArray(t)&&t.length>0&&t.every(e=>"message"in e)}function wA(t,e){return t.length<124?t:e}const bZ="graphql-transport-ws";var or;(function(t){t[t.InternalServerError=4500]="InternalServerError",t[t.InternalClientError=4005]="InternalClientError",t[t.BadRequest=4400]="BadRequest",t[t.BadResponse=4004]="BadResponse",t[t.Unauthorized=4401]="Unauthorized",t[t.Forbidden=4403]="Forbidden",t[t.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",t[t.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",t[t.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",t[t.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",t[t.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(or||(or={}));var Dt;(function(t){t.ConnectionInit="connection_init",t.ConnectionAck="connection_ack",t.Ping="ping",t.Pong="pong",t.Subscribe="subscribe",t.Next="next",t.Error="error",t.Complete="complete"})(Dt||(Dt={}));function TA(t){if(!Fo(t))throw new Error(`Message is expected to be an object, but got ${Hn(t)}`);if(!t.type)throw new Error("Message is missing the 'type' property");if(typeof t.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${Hn(t.type)}`);switch(t.type){case Dt.ConnectionInit:case Dt.ConnectionAck:case Dt.Ping:case Dt.Pong:{if(t.payload!=null&&!Fo(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${t.payload}"`);break}case Dt.Subscribe:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${Hn(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!Fo(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${Hn(t.payload)}`);if(typeof t.payload.query!="string")throw new Error(`"${t.type}" message payload expects the 'query' property to be a string, but got ${Hn(t.payload.query)}`);if(t.payload.variables!=null&&!Fo(t.payload.variables))throw new Error(`"${t.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${Hn(t.payload.variables)}`);if(t.payload.operationName!=null&&Hn(t.payload.operationName)!=="string")throw new Error(`"${t.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${Hn(t.payload.operationName)}`);if(t.payload.extensions!=null&&!Fo(t.payload.extensions))throw new Error(`"${t.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${Hn(t.payload.extensions)}`);break}case Dt.Next:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${Hn(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!Fo(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${Hn(t.payload)}`);break}case Dt.Error:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${Hn(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!vZ(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(t.payload)}`);break}case Dt.Complete:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${Hn(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${t.type}"`)}return t}function _Z(t,e){return TA(typeof t=="string"?JSON.parse(t,e):t)}function $c(t,e){return TA(t),JSON.stringify(t,e)}var za=function(t){return this instanceof za?(this.v=t,this):new za(t)},EZ=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){r[p]&&(i[p]=function(g){return new Promise(function(y,b){s.push([p,g,y,b])>1||a(p,g)})})}function a(p,g){try{l(r[p](g))}catch(y){h(s[0][3],y)}}function l(p){p.value instanceof za?Promise.resolve(p.value.v).then(u,d):h(s[0][2],p)}function u(p){a("next",p)}function d(p){a("throw",p)}function h(p,g){p(g),s.shift(),s.length&&a(s[0][0],s[0][1])}};function wZ(t){const{url:e,connectionParams:n,lazy:r=!0,onNonLazyError:i=console.error,lazyCloseTimeout:s=0,keepAlive:o=0,disablePong:a,connectionAckWaitTimeout:l=0,retryAttempts:u=5,retryWait:d=async function(xe){let fe=1e3;for(let Ee=0;Ee<xe;Ee++)fe*=2;await new Promise(Ee=>setTimeout(Ee,fe+Math.floor(Math.random()*2700+300)))},shouldRetry:h=Xv,isFatalConnectionProblem:p,on:g,webSocketImpl:y,generateID:b=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,xe=>{const fe=Math.random()*16|0;return(xe=="x"?fe:fe&3|8).toString(16)})},jsonMessageReplacer:_,jsonMessageReviver:w}=t;let O;if(y){if(!SZ(y))throw new Error("Invalid WebSocket implementation provided");O=y}else typeof WebSocket<"u"?O=WebSocket:typeof global<"u"?O=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(O=window.WebSocket||window.MozWebSocket);if(!O)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");const N=O,I=(()=>{const te=(()=>{const fe={};return{on(Ee,ye){return fe[Ee]=ye,()=>{delete fe[Ee]}},emit(Ee){var ye;"id"in Ee&&((ye=fe[Ee.id])===null||ye===void 0||ye.call(fe,Ee))}}})(),xe={connecting:g!=null&&g.connecting?[g.connecting]:[],opened:g!=null&&g.opened?[g.opened]:[],connected:g!=null&&g.connected?[g.connected]:[],ping:g!=null&&g.ping?[g.ping]:[],pong:g!=null&&g.pong?[g.pong]:[],message:g!=null&&g.message?[te.emit,g.message]:[te.emit],closed:g!=null&&g.closed?[g.closed]:[],error:g!=null&&g.error?[g.error]:[]};return{onMessage:te.on,on(fe,Ee){const ye=xe[fe];return ye.push(Ee),()=>{ye.splice(ye.indexOf(Ee),1)}},emit(fe,...Ee){for(const ye of[...xe[fe]])ye(...Ee)}}})();function P(te){const xe=[I.on("error",fe=>{xe.forEach(Ee=>Ee()),te(fe)}),I.on("closed",fe=>{xe.forEach(Ee=>Ee()),te(fe)})]}let R,B=0,Q,x=!1,U=0,be=!1;async function Oe(){clearTimeout(Q);const[te,xe]=await(R??(R=new Promise((ye,ut)=>(async()=>{if(x){if(await d(U),!B)return R=void 0,ut({code:1e3,reason:"All Subscriptions Gone"});U++}I.emit("connecting",x);const ve=new N(typeof e=="function"?await e():e,bZ);let $,Z;function Y(){isFinite(o)&&o>0&&(clearTimeout(Z),Z=setTimeout(()=>{ve.readyState===N.OPEN&&(ve.send($c({type:Dt.Ping})),I.emit("ping",!1,void 0))},o))}P(we=>{R=void 0,clearTimeout($),clearTimeout(Z),ut(we),we instanceof SA&&(ve.close(4499,"Terminated"),ve.onerror=null,ve.onclose=null)}),ve.onerror=we=>I.emit("error",we),ve.onclose=we=>I.emit("closed",we),ve.onopen=async()=>{try{I.emit("opened",ve);const we=typeof n=="function"?await n():n;if(ve.readyState!==N.OPEN)return;ve.send($c(we?{type:Dt.ConnectionInit,payload:we}:{type:Dt.ConnectionInit},_)),isFinite(l)&&l>0&&($=setTimeout(()=>{ve.close(or.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},l)),Y()}catch(we){I.emit("error",we),ve.close(or.InternalClientError,wA(we instanceof Error?we.message:new Error(we).message,"Internal client error"))}};let ee=!1;ve.onmessage=({data:we})=>{try{const Pe=_Z(we,w);if(I.emit("message",Pe),Pe.type==="ping"||Pe.type==="pong"){I.emit(Pe.type,!0,Pe.payload),Pe.type==="pong"?Y():a||(ve.send($c(Pe.payload?{type:Dt.Pong,payload:Pe.payload}:{type:Dt.Pong})),I.emit("pong",!1,Pe.payload));return}if(ee)return;if(Pe.type!==Dt.ConnectionAck)throw new Error(`First message cannot be of type ${Pe.type}`);clearTimeout($),ee=!0,I.emit("connected",ve,Pe.payload,x),x=!1,U=0,ye([ve,new Promise((Ze,ln)=>P(ln))])}catch(Pe){ve.onmessage=null,I.emit("error",Pe),ve.close(or.BadResponse,wA(Pe instanceof Error?Pe.message:new Error(Pe).message,"Bad response"))}}})())));te.readyState===N.CLOSING&&await xe;let fe=()=>{};const Ee=new Promise(ye=>fe=ye);return[te,fe,Promise.race([Ee.then(()=>{if(!B){const ye=()=>te.close(1e3,"Normal Closure");isFinite(s)&&s>0?Q=setTimeout(()=>{te.readyState===N.OPEN&&ye()},s):ye()}}),xe])]}function ke(te){if(Xv(te)&&(TZ(te.code)||[or.InternalServerError,or.InternalClientError,or.BadRequest,or.BadResponse,or.Unauthorized,or.SubprotocolNotAcceptable,or.SubscriberAlreadyExists,or.TooManyInitialisationRequests].includes(te.code)))throw te;if(be)return!1;if(Xv(te)&&te.code===1e3)return B>0;if(!u||U>=u||!h(te)||p!=null&&p(te))throw te;return x=!0}r||(async()=>{for(B++;;)try{const[,,te]=await Oe();await te}catch(te){try{if(!ke(te))return}catch(xe){return i==null?void 0:i(xe)}}})();function je(te,xe){const fe=b(te);let Ee=!1,ye=!1,ut=()=>{B--,Ee=!0};return(async()=>{for(B++;;)try{const[ve,$,Z]=await Oe();if(Ee)return $();const Y=I.onMessage(fe,ee=>{switch(ee.type){case Dt.Next:{xe.next(ee.payload);return}case Dt.Error:{ye=!0,Ee=!0,xe.error(ee.payload),ut();return}case Dt.Complete:{Ee=!0,ut();return}}});ve.send($c({id:fe,type:Dt.Subscribe,payload:te},_)),ut=()=>{!Ee&&ve.readyState===N.OPEN&&ve.send($c({id:fe,type:Dt.Complete},_)),B--,Ee=!0,$()},await Z.finally(Y);return}catch(ve){if(!ke(ve))return}})().then(()=>{ye||xe.complete()}).catch(ve=>{xe.error(ve)}),()=>{Ee||ut()}}return{on:I.on,subscribe:je,iterate(te){const xe=[],fe={done:!1,error:null,resolve:()=>{}},Ee=je(te,{next(ut){xe.push(ut),fe.resolve()},error(ut){fe.done=!0,fe.error=ut,fe.resolve()},complete(){fe.done=!0,fe.resolve()}}),ye=function(){return EZ(this,arguments,function*(){for(;;){for(xe.length||(yield za(new Promise($=>fe.resolve=$)));xe.length;)yield yield za(xe.shift());if(fe.error)throw fe.error;if(fe.done)return yield za(void 0)}})}();return ye.throw=async ut=>(fe.done||(fe.done=!0,fe.error=ut,fe.resolve()),{done:!0,value:void 0}),ye.return=async()=>(Ee(),{done:!0,value:void 0}),ye},async dispose(){if(be=!0,R){const[te]=await R;te.close(1e3,"Normal Closure")}},terminate(){R&&I.emit("closed",new SA)}}}class SA extends Error{constructor(){super(...arguments),this.name="TerminatedCloseEvent",this.message="4499: Terminated",this.code=4499,this.reason="Terminated",this.wasClean=!1}}function Xv(t){return Fo(t)&&"code"in t&&"reason"in t}function TZ(t){return[1e3,1001,1006,1005,1012,1013,1014].includes(t)?!1:t>=1e3&&t<=1999}function SZ(t){return typeof t=="function"&&"constructor"in t&&"CLOSED"in t&&"CLOSING"in t&&"CONNECTING"in t&&"OPEN"in t}const OZ=({apiUrl:t,organizationId:e,listeners:n,lazy:r=!1,token:i})=>{const s=wZ({url:`wss://${t}`,lazy:r,connectionParams:oc.omitBy({"organization-id":e,authorization:i?`Bearer ${i}`:void 0},oc.isNil),keepAlive:1e4});return n&&(n.onConnected&&s.on("connected",n.onConnected),n.onClosed&&s.on("closed",n.onClosed),n.onError&&s.on("error",n.onError)),s},kZ=({token:t,organizationId:e,invalidationPolicies:n,handlers:r,fetchPolicy:i,websocket:s,apiBaseUrl:o})=>{const a=new ev.InvalidationPolicyCache({invalidationPolicies:{...n,timeToLive:(n==null?void 0:n.timeToLive)??12e4,renewalPolicy:(n==null?void 0:n.renewalPolicy)??ev.RenewalPolicy.None}});hZ({cache:a,storage:new yZ(window.localStorage)});const l=`api.warrior.${o??"well-played.gg"}/graphql`,u=Nm(({query:d})=>{const h=so(d);return h.kind==="OperationDefinition"&&h.operation==="subscription"},new lW(OZ({apiUrl:l,listeners:r==null?void 0:r.webSocket,organizationId:e,lazy:s==null?void 0:s.lazy,token:t})),km([sW(async()=>({headers:oc.omitBy({"organization-id":e,authorization:t?`Bearer ${t}`:void 0},oc.isNil)})),...r!=null&&r.onError?[w1(r==null?void 0:r.onError)]:[],new rf({uri:`https://${l}`})]));return new df({cache:a,link:u,defaultOptions:{watchQuery:{fetchPolicy:i??"network-only",errorPolicy:"ignore"},query:{fetchPolicy:i??"network-only",errorPolicy:"all"},mutate:{errorPolicy:"all"}}})},OA=ie.createContext({}),NZ=()=>{const t=ie.useContext(OA);if(!t)throw new Error("useWellPlayed must be used within a WellPlayedProvider");return t},AZ=({children:t,clientConfig:e,organizationId:n,apiBaseUrl:r})=>{const i=A$(),s=ie.useMemo(()=>kZ({token:(i==null?void 0:i.accessToken)??void 0,organizationId:n,...e,apiBaseUrl:r}),[i==null?void 0:i.accessToken,n,e,r]);return he.jsx(AT,{client:s,children:he.jsx(OA.Provider,{value:{organizationId:n,apiClient:s},children:t})})},IZ=({children:t,oidcConfig:e,wpAppConfig:n,...r})=>he.jsx(S$,{...e,configuration:{...n,...e==null?void 0:e.configuration,authority:`https://oauth.warrior.${r.apiBaseUrl??"well-played.gg"}`},children:he.jsx(AZ,{...r,children:t})});Gt.RichTextEditorContent=iW,Gt.WellPlayedProvider=IZ,Gt.graphql=wa,Gt.readFragment=L$,Gt.useConnectedPlayer=j$,Gt.usePaginatedLoadAll=wg,Gt.usePaginatedQuery=pL,Gt.usePlayers=vS,Gt.useTournamentStep=W$,Gt.useTournamentTeams=bS,Gt.useWellPlayed=NZ,Object.defineProperty(Gt,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@well-played.gg/react-sdk",
3
- "version": "1.17.0",
3
+ "version": "1.18.0",
4
4
  "license": "MIT",
5
5
  "main": "dist/wp-react-sdk.cjs.js",
6
6
  "module": "dist/wp-react-sdk.es.js",