@spikonado/sprocket 0.0.0-canary.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/LICENSE +192 -0
  2. package/README.md +113 -0
  3. package/bin/sprocket.js +5 -0
  4. package/lib/launcher.js +77 -0
  5. package/package.json +37 -0
  6. package/web/_app/immutable/assets/0.MjIP0V6k.css +2 -0
  7. package/web/_app/immutable/assets/dm-sans-latin-400-normal.BwCSEQnW.woff +0 -0
  8. package/web/_app/immutable/assets/dm-sans-latin-400-normal.CW0RaeGs.woff2 +0 -0
  9. package/web/_app/immutable/assets/dm-sans-latin-ext-400-normal.BjWJ59Pq.woff +0 -0
  10. package/web/_app/immutable/assets/dm-sans-latin-ext-400-normal.BtiwyxMk.woff2 +0 -0
  11. package/web/_app/immutable/assets/ibm-plex-sans-cyrillic-ext-wght-normal.d45eAU9y.woff2 +0 -0
  12. package/web/_app/immutable/assets/ibm-plex-sans-cyrillic-wght-normal.BAAhND-U.woff2 +0 -0
  13. package/web/_app/immutable/assets/ibm-plex-sans-greek-wght-normal.CmyJS8uq.woff2 +0 -0
  14. package/web/_app/immutable/assets/ibm-plex-sans-latin-ext-wght-normal.CIII54If.woff2 +0 -0
  15. package/web/_app/immutable/assets/ibm-plex-sans-latin-wght-normal.IvpUvPa2.woff2 +0 -0
  16. package/web/_app/immutable/assets/ibm-plex-sans-vietnamese-wght-normal.Dg1JeJN0.woff2 +0 -0
  17. package/web/_app/immutable/chunks/B4Yz9Vq2.js +1 -0
  18. package/web/_app/immutable/chunks/BKoJaiW1.js +1 -0
  19. package/web/_app/immutable/chunks/BiY-aars.js +1 -0
  20. package/web/_app/immutable/chunks/Bjy-W4x2.js +81 -0
  21. package/web/_app/immutable/chunks/ByDH6pMF.js +6 -0
  22. package/web/_app/immutable/chunks/Ci7cM3I3.js +3 -0
  23. package/web/_app/immutable/chunks/D5Hn5yYF.js +1 -0
  24. package/web/_app/immutable/chunks/D5i3nqbJ.js +2 -0
  25. package/web/_app/immutable/chunks/NRo3CtPD.js +1 -0
  26. package/web/_app/immutable/chunks/xihTtKlq.js +1 -0
  27. package/web/_app/immutable/entry/app.CvlJsqsu.js +2 -0
  28. package/web/_app/immutable/entry/start.DfPHbTSK.js +1 -0
  29. package/web/_app/immutable/nodes/0.D0tq1llq.js +1 -0
  30. package/web/_app/immutable/nodes/1.swTsK2nI.js +1 -0
  31. package/web/_app/immutable/nodes/2.CDb1NwCd.js +71 -0
  32. package/web/_app/immutable/nodes/3.BNDSP7Fl.js +1 -0
  33. package/web/_app/immutable/nodes/4.Ctp3kMog.js +1 -0
  34. package/web/_app/version.json +1 -0
  35. package/web/callback.html +43 -0
  36. package/web/favicon.png +0 -0
  37. package/web/index.html +40 -0
  38. package/web/logo.png +0 -0
  39. package/web/pair.html +44 -0
@@ -0,0 +1,2 @@
1
+ import{B as e,I as t,N as n,Q as r,Y as i,Z as a,lt as o,ot as s,q as c,rt as l}from"./Ci7cM3I3.js";import{h as u}from"./ByDH6pMF.js";for(var d=`1.42.1`,f=[],p=[],m=Uint8Array,h=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,g=0,_=h.length;g<_;++g)f[g]=h[g],p[h.charCodeAt(g)]=g;p[45]=62,p[95]=63;function v(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function ee(e,t,n){return(t+n)*3/4-n}function y(e){var t,n=v(e),r=n[0],i=n[1],a=new m(ee(e,r,i)),o=0,s=i>0?r-4:r,c;for(c=0;c<s;c+=4)t=p[e.charCodeAt(c)]<<18|p[e.charCodeAt(c+1)]<<12|p[e.charCodeAt(c+2)]<<6|p[e.charCodeAt(c+3)],a[o++]=t>>16&255,a[o++]=t>>8&255,a[o++]=t&255;return i===2&&(t=p[e.charCodeAt(c)]<<2|p[e.charCodeAt(c+1)]>>4,a[o++]=t&255),i===1&&(t=p[e.charCodeAt(c)]<<10|p[e.charCodeAt(c+1)]<<4|p[e.charCodeAt(c+2)]>>2,a[o++]=t>>8&255,a[o++]=t&255),a}function b(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[e&63]}function te(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(b(r));return i.join(``)}function x(e){for(var t,n=e.length,r=n%3,i=[],a=16383,o=0,s=n-r;o<s;o+=a)i.push(te(e,o,o+a>s?s:o+a));return r===1?(t=e[n-1],i.push(f[t>>2]+f[t<<4&63]+`==`)):r===2&&(t=(e[n-2]<<8)+e[n-1],i.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+`=`)),i.join(``)}function S(e){if(e===void 0)return{};if(!re(e))throw Error(`The arguments to a Convex function must be an object. Received: ${e}`);return e}function ne(e){if(e===void 0)throw Error(`Client created with undefined deployment address. If you used an environment variable, check that it's set.`);if(typeof e!=`string`)throw Error(`Invalid deployment address: found ${e}".`);if(!(e.startsWith(`http:`)||e.startsWith(`https:`)))throw Error(`Invalid deployment address: Must start with "https://" or "http://". Found "${e}".`);try{new URL(e)}catch{throw Error(`Invalid deployment address: "${e}" is not a valid URL. If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}if(e.endsWith(`.convex.site`))throw Error(`Invalid deployment address: "${e}" ends with .convex.site, which is used for HTTP Actions. Convex deployment URLs typically end with .convex.cloud? If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}function re(e){let t=typeof e==`object`,n=Object.getPrototypeOf(e),r=n===null||n===Object.prototype||n?.constructor?.name===`Object`;return t&&r}var ie=!0,C=BigInt(`-9223372036854775808`),ae=BigInt(`9223372036854775807`),oe=BigInt(`0`),se=BigInt(`8`),ce=BigInt(`256`);function le(e){return Number.isNaN(e)||!Number.isFinite(e)||Object.is(e,-0)}function ue(e){e<oe&&(e-=C+C);let t=e.toString(16);t.length%2==1&&(t=`0`+t);let n=new Uint8Array(new ArrayBuffer(8)),r=0;for(let i of t.match(/.{2}/g).reverse())n.set([parseInt(i,16)],r++),e>>=se;return x(n)}function de(e){let t=y(e);if(t.byteLength!==8)throw Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);let n=oe,r=oe;for(let e of t)n+=BigInt(e)*ce**r,r++;return n>ae&&(n+=C+C),n}function fe(e){if(e<C||ae<e)throw Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);let t=new ArrayBuffer(8);return new DataView(t).setBigInt64(0,e,!0),x(new Uint8Array(t))}function pe(e){let t=y(e);if(t.byteLength!==8)throw Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);return new DataView(t.buffer).getBigInt64(0,!0)}var me=DataView.prototype.setBigInt64?fe:ue,he=DataView.prototype.getBigInt64?pe:de,ge=1024;function w(e){if(e.length>ge)throw Error(`Field name ${e} exceeds maximum field name length ${ge}.`);if(e.startsWith(`$`))throw Error(`Field name ${e} starts with a '$', which is reserved.`);for(let t=0;t<e.length;t+=1){let n=e.charCodeAt(t);if(n<32||n>=127)throw Error(`Field name ${e} has invalid character '${e[t]}': Field names can only contain non-control ASCII characters`)}}function T(e){if(e===null||typeof e==`boolean`||typeof e==`number`||typeof e==`string`)return e;if(Array.isArray(e))return e.map(e=>T(e));if(typeof e!=`object`)throw Error(`Unexpected type of ${e}`);let t=Object.entries(e);if(t.length===1){let n=t[0][0];if(n===`$bytes`){if(typeof e.$bytes!=`string`)throw Error(`Malformed $bytes field on ${e}`);return y(e.$bytes).buffer}if(n===`$integer`){if(typeof e.$integer!=`string`)throw Error(`Malformed $integer field on ${e}`);return he(e.$integer)}if(n===`$float`){if(typeof e.$float!=`string`)throw Error(`Malformed $float field on ${e}`);let t=y(e.$float);if(t.byteLength!==8)throw Error(`Received ${t.byteLength} bytes, expected 8 for $float`);let n=new DataView(t.buffer).getFloat64(0,ie);if(!le(n))throw Error(`Float ${n} should be encoded as a number`);return n}if(n===`$set`)throw Error(`Received a Set which is no longer supported as a Convex type.`);if(n===`$map`)throw Error(`Received a Map which is no longer supported as a Convex type.`)}let n={};for(let[t,r]of Object.entries(e))w(t),n[t]=T(r);return n}var _e=16384;function E(e){let t=JSON.stringify(e,(e,t)=>t===void 0?`undefined`:typeof t==`bigint`?`${t.toString()}n`:t);if(t.length>_e){let e=_e-14,n=t.codePointAt(e-1);return n!==void 0&&n>65535&&--e,t.substring(0,e)+`[...truncated]`}return t}function D(e,t,n,r){if(e===void 0){let e=n&&` (present at path ${n} in original object ${E(t)})`;throw Error(`undefined is not a valid Convex value${e}. To learn about Convex's supported types, see https://docs.convex.dev/using/types.`)}if(e===null)return e;if(typeof e==`bigint`){if(e<C||ae<e)throw Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);return{$integer:me(e)}}if(typeof e==`number`)if(le(e)){let t=new ArrayBuffer(8);return new DataView(t).setFloat64(0,e,ie),{$float:x(new Uint8Array(t))}}else return e;if(typeof e==`boolean`||typeof e==`string`)return e;if(e instanceof ArrayBuffer)return{$bytes:x(new Uint8Array(e))};if(Array.isArray(e))return e.map((e,r)=>D(e,t,n+`[${r}]`,!1));if(e instanceof Set)throw Error(O(n,`Set`,[...e],t));if(e instanceof Map)throw Error(O(n,`Map`,[...e],t));if(!re(e)){let r=e?.constructor?.name,i=r?`${r} `:``;throw Error(O(n,i,e,t))}let i={},a=Object.entries(e);a.sort(([e,t],[n,r])=>e===n?0:e<n?-1:1);for(let[e,o]of a)o===void 0?r&&(w(e),i[e]=ve(o,t,n+`.${e}`)):(w(e),i[e]=D(o,t,n+`.${e}`,!1));return i}function O(e,t,n,r){return e?`${t}${E(n)} is not a supported Convex type (present at path ${e} in original object ${E(r)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`:`${t}${E(n)} is not a supported Convex type.`}function ve(e,t,n){if(e===void 0)return{$undefined:null};if(t===void 0)throw Error(`Programming error. Current value is ${E(e)} but original value is undefined`);return D(e,t,n,!1)}function k(e){return D(e,e,``,!1)}function ye(e){return ve(e,e,``)}function be(e){return D(e,e,``,!0)}var xe=Object.defineProperty,Se=(e,t,n)=>t in e?xe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,A=(e,t,n)=>Se(e,typeof t==`symbol`?t:t+``,n),Ce,we,Te=Symbol.for(`ConvexError`),j=class extends (we=Error,Ce=Te,we){constructor(e){super(typeof e==`string`?e:E(e)),A(this,`name`,`ConvexError`),A(this,`data`),A(this,Ce,!0),this.data=e}},Ee=Object.defineProperty,De=(e,t,n)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Oe=(e,t,n)=>De(e,typeof t==`symbol`?t:t+``,n),ke=`color:rgb(0, 145, 255)`;function Ae(e){switch(e){case`query`:return`Q`;case`mutation`:return`M`;case`action`:return`A`;case`any`:return`?`}}var je=class{constructor(e){Oe(this,`_onLogLineFuncs`),Oe(this,`_verbose`),this._onLogLineFuncs={},this._verbose=e.verbose}addLogLineListener(e){let t=Math.random().toString(36).substring(2,15);for(let e=0;e<10&&this._onLogLineFuncs[t]!==void 0;e++)t=Math.random().toString(36).substring(2,15);return this._onLogLineFuncs[t]=e,()=>{delete this._onLogLineFuncs[t]}}logVerbose(...e){if(this._verbose)for(let t of Object.values(this._onLogLineFuncs))t(`debug`,`${new Date().toISOString()}`,...e)}log(...e){for(let t of Object.values(this._onLogLineFuncs))t(`info`,...e)}warn(...e){for(let t of Object.values(this._onLogLineFuncs))t(`warn`,...e)}error(...e){for(let t of Object.values(this._onLogLineFuncs))t(`error`,...e)}};function Me(e){let t=new je(e);return t.addLogLineListener((e,...t)=>{switch(e){case`debug`:console.debug(...t);break;case`info`:console.log(...t);break;case`warn`:console.warn(...t);break;case`error`:console.error(...t);break;default:console.log(...t)}}),t}function Ne(e){return new je(e)}function M(e,t,n,r,i){let a=Ae(n);if(typeof i==`object`&&(i=`ConvexError ${JSON.stringify(i.errorData,null,2)}`),t===`info`){let t=i.match(/^\[.*?\] /);if(t===null){e.error(`[CONVEX ${a}(${r})] Could not parse console.log`);return}let n=i.slice(1,t[0].length-2),o=i.slice(t[0].length);e.log(`%c[CONVEX ${a}(${r})] [${n}]`,ke,o)}else e.error(`[CONVEX ${a}(${r})] ${i}`)}function Pe(e,t){let n=`[CONVEX FATAL ERROR] ${t}`;return e.error(n),Error(n)}function N(e,t,n){return`[CONVEX ${Ae(e)}(${t})] ${n.errorMessage}
2
+ Called by client`}function P(e,t){return t.data=e.errorData,t}function F(e){let t=e.split(`:`),n,r;return t.length===1?(n=t[0],r=`default`):(n=t.slice(0,t.length-1).join(`:`),r=t[t.length-1]),n.endsWith(`.js`)&&(n=n.slice(0,-3)),`${n}:${r}`}function I(e,t){return JSON.stringify({udfPath:F(e),args:k(t)})}function Fe(e,t,n){let{initialNumItems:r,id:i}=n;return JSON.stringify({type:`paginated`,udfPath:F(e),args:k(t),options:k({initialNumItems:r,id:i})})}function Ie(e){return JSON.parse(e).type===`paginated`}var Le=Object.defineProperty,Re=(e,t,n)=>t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,L=(e,t,n)=>Re(e,typeof t==`symbol`?t:t+``,n),ze=class{constructor(){L(this,`nextQueryId`),L(this,`querySetVersion`),L(this,`querySet`),L(this,`queryIdToToken`),L(this,`identityVersion`),L(this,`auth`),L(this,`outstandingQueriesOlderThanRestart`),L(this,`outstandingAuthOlderThanRestart`),L(this,`paused`),L(this,`pendingQuerySetModifications`),this.nextQueryId=0,this.querySetVersion=0,this.identityVersion=0,this.querySet=new Map,this.queryIdToToken=new Map,this.outstandingQueriesOlderThanRestart=new Set,this.outstandingAuthOlderThanRestart=!1,this.paused=!1,this.pendingQuerySetModifications=new Map}hasSyncedPastLastReconnect(){return this.outstandingQueriesOlderThanRestart.size===0&&!this.outstandingAuthOlderThanRestart}markAuthCompletion(){this.outstandingAuthOlderThanRestart=!1}subscribe(e,t,n,r){let i=F(e),a=I(i,t),o=this.querySet.get(a);if(o!==void 0)return o.numSubscribers+=1,{queryToken:a,modification:null,unsubscribe:()=>this.removeSubscriber(a)};{let e=this.nextQueryId++,o={id:e,canonicalizedUdfPath:i,args:t,numSubscribers:1,journal:n,componentPath:r};this.querySet.set(a,o),this.queryIdToToken.set(e,a);let s=this.querySetVersion,c=this.querySetVersion+1,l={type:`Add`,queryId:e,udfPath:i,args:[k(t)],journal:n,componentPath:r};return this.paused?this.pendingQuerySetModifications.set(e,l):this.querySetVersion=c,{queryToken:a,modification:{type:`ModifyQuerySet`,baseVersion:s,newVersion:c,modifications:[l]},unsubscribe:()=>this.removeSubscriber(a)}}}transition(e){for(let t of e.modifications)switch(t.type){case`QueryUpdated`:case`QueryFailed`:{this.outstandingQueriesOlderThanRestart.delete(t.queryId);let e=t.journal;if(e!==void 0){let n=this.queryIdToToken.get(t.queryId);n!==void 0&&(this.querySet.get(n).journal=e)}break}case`QueryRemoved`:this.outstandingQueriesOlderThanRestart.delete(t.queryId);break;default:throw Error(`Invalid modification ${t.type}`)}}queryId(e,t){let n=I(F(e),t),r=this.querySet.get(n);return r===void 0?null:r.id}isCurrentOrNewerAuthVersion(e){return e>=this.identityVersion}getAuth(){return this.auth}setAuth(e){this.auth={tokenType:`User`,value:e};let t=this.identityVersion;return this.paused||(this.identityVersion=t+1),{type:`Authenticate`,baseVersion:t,...this.auth}}setAdminAuth(e,t){let n={tokenType:`Admin`,value:e,impersonating:t};this.auth=n;let r=this.identityVersion;return this.paused||(this.identityVersion=r+1),{type:`Authenticate`,baseVersion:r,...n}}clearAuth(){this.auth=void 0,this.markAuthCompletion();let e=this.identityVersion;return this.paused||(this.identityVersion=e+1),{type:`Authenticate`,tokenType:`None`,baseVersion:e}}hasAuth(){return!!this.auth}isNewAuth(e){return this.auth?.value!==e}queryPath(e){let t=this.queryIdToToken.get(e);return t?this.querySet.get(t).canonicalizedUdfPath:null}queryArgs(e){let t=this.queryIdToToken.get(e);return t?this.querySet.get(t).args:null}queryToken(e){return this.queryIdToToken.get(e)??null}queryJournal(e){return this.querySet.get(e)?.journal}restart(){this.unpause(),this.outstandingQueriesOlderThanRestart.clear();let e=[];for(let t of this.querySet.values()){let n={type:`Add`,queryId:t.id,udfPath:t.canonicalizedUdfPath,args:[k(t.args)],journal:t.journal,componentPath:t.componentPath};e.push(n),this.outstandingQueriesOlderThanRestart.add(t.id)}this.querySetVersion=1;let t={type:`ModifyQuerySet`,baseVersion:0,newVersion:1,modifications:e};if(!this.auth)return this.identityVersion=0,[t,void 0];this.outstandingAuthOlderThanRestart=!0;let n={type:`Authenticate`,baseVersion:0,...this.auth};return this.identityVersion=1,[t,n]}pause(){this.paused=!0}resume(){let e=this.pendingQuerySetModifications.size>0?{type:`ModifyQuerySet`,baseVersion:this.querySetVersion,newVersion:++this.querySetVersion,modifications:Array.from(this.pendingQuerySetModifications.values())}:void 0,t=this.auth===void 0?void 0:{type:`Authenticate`,baseVersion:this.identityVersion++,...this.auth};return this.unpause(),[e,t]}unpause(){this.paused=!1,this.pendingQuerySetModifications.clear()}removeSubscriber(e){let t=this.querySet.get(e);if(t.numSubscribers>1)return--t.numSubscribers,null;{this.querySet.delete(e),this.queryIdToToken.delete(t.id),this.outstandingQueriesOlderThanRestart.delete(t.id);let n=this.querySetVersion,r=this.querySetVersion+1,i={type:`Remove`,queryId:t.id};return this.paused?this.pendingQuerySetModifications.has(t.id)?this.pendingQuerySetModifications.delete(t.id):this.pendingQuerySetModifications.set(t.id,i):this.querySetVersion=r,{type:`ModifyQuerySet`,baseVersion:n,newVersion:r,modifications:[i]}}}},Be=Object.defineProperty,Ve=(e,t,n)=>t in e?Be(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,R=(e,t,n)=>Ve(e,typeof t==`symbol`?t:t+``,n),He=class{constructor(e,t){this.logger=e,this.markConnectionStateDirty=t,R(this,`inflightRequests`),R(this,`requestsOlderThanRestart`),R(this,`inflightMutationsCount`,0),R(this,`inflightActionsCount`,0),this.inflightRequests=new Map,this.requestsOlderThanRestart=new Set}request(e,t){let n=new Promise(n=>{let r=t?`Requested`:`NotSent`;this.inflightRequests.set(e.requestId,{message:e,status:{status:r,requestedAt:new Date,onResult:n}}),e.type===`Mutation`?this.inflightMutationsCount++:e.type===`Action`&&this.inflightActionsCount++});return this.markConnectionStateDirty(),n}onResponse(e){let t=this.inflightRequests.get(e.requestId);if(t===void 0||t.status.status===`Completed`)return null;let n=t.message.type===`Mutation`?`mutation`:`action`,r=t.message.udfPath;for(let t of e.logLines)M(this.logger,`info`,n,r,t);let i=t.status,a,o;if(e.success)a={success:!0,logLines:e.logLines,value:T(e.result)},o=()=>i.onResult(a);else{let t=e.result,{errorData:s}=e;M(this.logger,`error`,n,r,t),a={success:!1,errorMessage:t,errorData:s===void 0?void 0:T(s),logLines:e.logLines},o=()=>i.onResult(a)}return e.type===`ActionResponse`||!e.success?(o(),this.inflightRequests.delete(e.requestId),this.requestsOlderThanRestart.delete(e.requestId),t.message.type===`Action`?this.inflightActionsCount--:t.message.type===`Mutation`&&this.inflightMutationsCount--,this.markConnectionStateDirty(),{requestId:e.requestId,result:a}):(t.status={status:`Completed`,result:a,ts:e.ts,onResolve:o},null)}removeCompleted(e){let t=new Map;for(let[n,r]of this.inflightRequests.entries()){let i=r.status;i.status===`Completed`&&i.ts.lessThanOrEqual(e)&&(i.onResolve(),t.set(n,i.result),r.message.type===`Mutation`?this.inflightMutationsCount--:r.message.type===`Action`&&this.inflightActionsCount--,this.inflightRequests.delete(n),this.requestsOlderThanRestart.delete(n))}return t.size>0&&this.markConnectionStateDirty(),t}restart(){this.requestsOlderThanRestart=new Set(this.inflightRequests.keys());let e=[];for(let[t,n]of this.inflightRequests){if(n.status.status===`NotSent`){n.status.status=`Requested`,e.push(n.message);continue}if(n.message.type===`Mutation`)e.push(n.message);else if(n.message.type===`Action`){if(this.inflightRequests.delete(t),this.requestsOlderThanRestart.delete(t),this.inflightActionsCount--,n.status.status===`Completed`)throw Error(`Action should never be in 'Completed' state`);n.status.onResult({success:!1,errorMessage:`Connection lost while action was in flight`,logLines:[]})}}return this.markConnectionStateDirty(),e}resume(){let e=[];for(let[,t]of this.inflightRequests)if(t.status.status===`NotSent`){t.status.status=`Requested`,e.push(t.message);continue}return e}hasIncompleteRequests(){for(let e of this.inflightRequests.values())if(e.status.status===`Requested`)return!0;return!1}hasInflightRequests(){return this.inflightRequests.size>0}hasSyncedPastLastReconnect(){return this.requestsOlderThanRestart.size===0}timeOfOldestInflightRequest(){if(this.inflightRequests.size===0)return null;let e=Date.now();for(let t of this.inflightRequests.values())t.status.status!==`Completed`&&t.status.requestedAt.getTime()<e&&(e=t.status.requestedAt.getTime());return new Date(e)}inflightMutations(){return this.inflightMutationsCount}inflightActions(){return this.inflightActionsCount}},Ue=Object.defineProperty,We=(e,t,n)=>t in e?Ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,z=(e,t,n)=>We(e,typeof t==`symbol`?t:t+``,n),Ge=class e{constructor(e){z(this,`queryResults`),z(this,`modifiedQueries`),this.queryResults=e,this.modifiedQueries=[]}getQuery(t,...n){let r=S(n[0]),i=u(t),a=this.queryResults.get(I(i,r));if(a!==void 0)return e.queryValue(a.result)}getAllQueries(t){let n=[],r=u(t);for(let t of this.queryResults.values())t.udfPath===F(r)&&n.push({args:t.args,value:e.queryValue(t.result)});return n}setQuery(e,t,n){let r=S(t),i=u(e),a=I(i,r),o;o=n===void 0?void 0:{success:!0,value:n,logLines:[]};let s={udfPath:i,args:r,result:o};this.queryResults.set(a,s),this.modifiedQueries.push(a)}static queryValue(e){if(e!==void 0&&e.success)return e.value}},Ke=class{constructor(){z(this,`queryResults`),z(this,`optimisticUpdates`),this.queryResults=new Map,this.optimisticUpdates=[]}ingestQueryResultsFromServer(e,t){this.optimisticUpdates=this.optimisticUpdates.filter(e=>!t.has(e.mutationId));let n=this.queryResults;this.queryResults=new Map(e);let r=new Ge(this.queryResults);for(let e of this.optimisticUpdates)e.update(r);let i=[];for(let[e,t]of this.queryResults){let r=n.get(e);(r===void 0||r.result!==t.result)&&i.push(e)}return i}applyOptimisticUpdate(e,t){this.optimisticUpdates.push({update:e,mutationId:t});let n=new Ge(this.queryResults);return e(n),n.modifiedQueries}rawQueryResult(e){let t=this.queryResults.get(e);if(t!==void 0)return t.result}queryResult(e){let t=this.queryResults.get(e);if(t===void 0)return;let n=t.result;if(n!==void 0){if(n.success)return n.value;throw n.errorData===void 0?Error(N(`query`,t.udfPath,n)):P(n,new j(N(`query`,t.udfPath,n)))}}hasQueryResult(e){return this.queryResults.get(e)!==void 0}queryLogs(e){return this.queryResults.get(e)?.result?.logLines}},qe=Object.defineProperty,Je=(e,t,n)=>t in e?qe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ye=(e,t,n)=>Je(e,typeof t==`symbol`?t:t+``,n),B=class e{constructor(e,t){Ye(this,`low`),Ye(this,`high`),Ye(this,`__isUnsignedLong__`),this.low=e|0,this.high=t|0,this.__isUnsignedLong__=!0}static isLong(e){return(e&&e.__isUnsignedLong__)===!0}static fromBytesLE(t){return new e(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24)}toBytesLE(){let e=this.high,t=this.low;return[t&255,t>>>8&255,t>>>16&255,t>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]}static fromNumber(t){return isNaN(t)||t<0?Xe:t>=Qe?$e:new e(t%V|0,t/V|0)}toString(){return(BigInt(this.high)*BigInt(V)+BigInt(this.low)).toString()}equals(t){return e.isLong(t)||(t=e.fromValue(t)),this.high>>>31==1&&t.high>>>31==1?!1:this.high===t.high&&this.low===t.low}notEquals(e){return!this.equals(e)}comp(t){return e.isLong(t)||(t=e.fromValue(t)),this.equals(t)?0:t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1}lessThanOrEqual(e){return this.comp(e)<=0}static fromValue(t){return typeof t==`number`?e.fromNumber(t):new e(t.low,t.high)}},Xe=new B(0,0),Ze=65536,V=Ze*Ze,Qe=V*V,$e=new B(-1,-1),et=Object.defineProperty,tt=(e,t,n)=>t in e?et(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,H=(e,t,n)=>tt(e,typeof t==`symbol`?t:t+``,n),nt=class{constructor(e,t){H(this,`version`),H(this,`remoteQuerySet`),H(this,`queryPath`),H(this,`logger`),this.version={querySet:0,ts:B.fromNumber(0),identity:0},this.remoteQuerySet=new Map,this.queryPath=e,this.logger=t}transition(e){let t=e.startVersion;if(this.version.querySet!==t.querySet||this.version.ts.notEquals(t.ts)||this.version.identity!==t.identity)throw Error(`Invalid start version: ${t.ts.toString()}:${t.querySet}:${t.identity}, transitioning from ${this.version.ts.toString()}:${this.version.querySet}:${this.version.identity}`);for(let t of e.modifications)switch(t.type){case`QueryUpdated`:{let e=this.queryPath(t.queryId);if(e)for(let n of t.logLines)M(this.logger,`info`,`query`,e,n);let n=T(t.value??null);this.remoteQuerySet.set(t.queryId,{success:!0,value:n,logLines:t.logLines});break}case`QueryFailed`:{let e=this.queryPath(t.queryId);if(e)for(let n of t.logLines)M(this.logger,`info`,`query`,e,n);let{errorData:n}=t;this.remoteQuerySet.set(t.queryId,{success:!1,errorMessage:t.errorMessage,errorData:n===void 0?void 0:T(n),logLines:t.logLines});break}case`QueryRemoved`:this.remoteQuerySet.delete(t.queryId);break;default:throw Error(`Invalid modification ${t.type}`)}this.version=e.endVersion}remoteQueryResults(){return this.remoteQuerySet}timestamp(){return this.version.ts}};function rt(e){let t=y(e);return B.fromBytesLE(Array.from(t))}function it(e){return x(new Uint8Array(e.toBytesLE()))}function at(e){switch(e.type){case`FatalError`:case`AuthError`:case`ActionResponse`:case`TransitionChunk`:case`Ping`:return{...e};case`MutationResponse`:return e.success?{...e,ts:rt(e.ts)}:{...e};case`Transition`:return{...e,startVersion:{...e.startVersion,ts:rt(e.startVersion.ts)},endVersion:{...e.endVersion,ts:rt(e.endVersion.ts)}};default:}}function ot(e){switch(e.type){case`Authenticate`:case`ModifyQuerySet`:case`Mutation`:case`Action`:case`Event`:return{...e};case`Connect`:return e.maxObservedTimestamp===void 0?{...e,maxObservedTimestamp:void 0}:{...e,maxObservedTimestamp:it(e.maxObservedTimestamp)};default:}}var st=Object.defineProperty,ct=(e,t,n)=>t in e?st(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,U=(e,t,n)=>ct(e,typeof t==`symbol`?t:t+``,n),lt=1e3,ut=1001,dt=1005,ft=4040,W;function G(){return W===void 0&&(W=Date.now()),typeof performance>`u`||!performance.now?Date.now():Math.round(W+performance.now())}function pt(){return`t=${Math.round((G()-W)/100)/10}s`}var mt={InternalServerError:{timeout:1e3},SubscriptionsWorkerFullError:{timeout:3e3},TooManyConcurrentRequests:{timeout:3e3},CommitterFullError:{timeout:3e3},AwsTooManyRequestsException:{timeout:3e3},ExecuteFullError:{timeout:3e3},SystemTimeoutError:{timeout:3e3},ExpiredInQueue:{timeout:3e3},VectorIndexesUnavailable:{timeout:1e3},SearchIndexesUnavailable:{timeout:1e3},TableSummariesUnavailable:{timeout:1e3},VectorIndexTooLarge:{timeout:3e3},SearchIndexTooLarge:{timeout:3e3},TooManyWritesInTimePeriod:{timeout:3e3}};function ht(e){if(e===void 0)return`Unknown`;for(let t of Object.keys(mt))if(e.startsWith(t))return t;return`Unknown`}var gt=class{constructor(e,t,n,r,i,a){this.markConnectionStateDirty=i,this.debug=a,U(this,`socket`),U(this,`connectionCount`),U(this,`_hasEverConnected`,!1),U(this,`lastCloseReason`),U(this,`transitionChunkBuffer`,null),U(this,`defaultInitialBackoff`),U(this,`maxBackoff`),U(this,`retries`),U(this,`serverInactivityThreshold`),U(this,`reconnectDueToServerInactivityTimeout`),U(this,`scheduledReconnect`,null),U(this,`networkOnlineHandler`,null),U(this,`pendingNetworkRecoveryInfo`,null),U(this,`uri`),U(this,`onOpen`),U(this,`onResume`),U(this,`onMessage`),U(this,`webSocketConstructor`),U(this,`logger`),U(this,`onServerDisconnectError`),this.webSocketConstructor=n,this.socket={state:`disconnected`},this.connectionCount=0,this.lastCloseReason=`InitialConnect`,this.defaultInitialBackoff=1e3,this.maxBackoff=16e3,this.retries=0,this.serverInactivityThreshold=6e4,this.reconnectDueToServerInactivityTimeout=null,this.uri=e,this.onOpen=t.onOpen,this.onResume=t.onResume,this.onMessage=t.onMessage,this.onServerDisconnectError=t.onServerDisconnectError,this.logger=r,this.setupNetworkListener(),this.connect()}setSocketState(e){this.socket=e,this._logVerbose(`socket state changed: ${this.socket.state}, paused: ${`paused`in this.socket?this.socket.paused:void 0}`),this.markConnectionStateDirty()}setupNetworkListener(){typeof window>`u`||typeof window.addEventListener!=`function`||this.networkOnlineHandler===null&&(this.networkOnlineHandler=()=>{this._logVerbose(`network online event detected`),this.tryReconnectImmediately()},window.addEventListener(`online`,this.networkOnlineHandler),this._logVerbose(`network online event listener registered`))}cleanupNetworkListener(){this.networkOnlineHandler&&typeof window<`u`&&typeof window.removeEventListener==`function`&&(window.removeEventListener(`online`,this.networkOnlineHandler),this.networkOnlineHandler=null,this._logVerbose(`network online event listener removed`))}assembleTransition(e){if(e.partNumber<0||e.partNumber>=e.totalParts||e.totalParts===0||this.transitionChunkBuffer&&(this.transitionChunkBuffer.totalParts!==e.totalParts||this.transitionChunkBuffer.transitionId!==e.transitionId))throw this.transitionChunkBuffer=null,Error(`Invalid TransitionChunk`);if(this.transitionChunkBuffer===null&&(this.transitionChunkBuffer={chunks:[],totalParts:e.totalParts,transitionId:e.transitionId}),e.partNumber!==this.transitionChunkBuffer.chunks.length){let t=this.transitionChunkBuffer.chunks.length;throw this.transitionChunkBuffer=null,Error(`TransitionChunk received out of order: expected part ${t}, got ${e.partNumber}`)}if(this.transitionChunkBuffer.chunks.push(e.chunk),this.transitionChunkBuffer.chunks.length===e.totalParts){let e=this.transitionChunkBuffer.chunks.join(``);this.transitionChunkBuffer=null;let t=at(JSON.parse(e));if(t.type!==`Transition`)throw Error(`Expected Transition, got ${t.type} after assembling chunks`);return t}return null}connect(){if(this.socket.state===`terminated`)return;if(this.socket.state!==`disconnected`&&this.socket.state!==`stopped`)throw Error(`Didn't start connection from disconnected state: `+this.socket.state);let e=new this.webSocketConstructor(this.uri);this._logVerbose(`constructed WebSocket`),this.setSocketState({state:`connecting`,ws:e,paused:`no`}),this.resetServerInactivityTimeout(),e.onopen=()=>{if(this.logger.logVerbose(`begin ws.onopen`),this.socket.state!==`connecting`)throw Error(`onopen called with socket not in connecting state`);if(this.setSocketState({state:`ready`,ws:e,paused:this.socket.paused===`yes`?`uninitialized`:`no`}),this.resetServerInactivityTimeout(),this.socket.paused===`no`&&(this._hasEverConnected=!0,this.onOpen({connectionCount:this.connectionCount,lastCloseReason:this.lastCloseReason,clientTs:G()})),this.lastCloseReason!==`InitialConnect`&&(this.lastCloseReason?this.logger.log(`WebSocket reconnected at`,pt(),`after disconnect due to`,this.lastCloseReason):this.logger.log(`WebSocket reconnected at`,pt())),this.connectionCount+=1,this.lastCloseReason=null,this.pendingNetworkRecoveryInfo!==null){let{timeSavedMs:e}=this.pendingNetworkRecoveryInfo;this.pendingNetworkRecoveryInfo=null,this.sendMessage({type:`Event`,eventType:`NetworkRecoveryReconnect`,event:{timeSavedMs:e}}),this.logger.log(`Network recovery reconnect saved ~${Math.round(e/1e3)}s of waiting`)}},e.onerror=e=>{this.transitionChunkBuffer=null;let t=e.message;t&&this.logger.log(`WebSocket error message: ${t}`)},e.onmessage=e=>{this.resetServerInactivityTimeout();let t=e.data.length,n=at(JSON.parse(e.data));if(this._logVerbose(`received ws message with type ${n.type}`),n.type!==`Ping`){if(n.type===`TransitionChunk`){let e=this.assembleTransition(n);if(!e)return;n=e,this._logVerbose(`assembled full ws message of type ${n.type}`)}this.transitionChunkBuffer!==null&&(this.transitionChunkBuffer=null,this.logger.log(`Received unexpected ${n.type} while buffering TransitionChunks`)),n.type===`Transition`&&this.reportLargeTransition({messageLength:t,transition:n}),this.onMessage(n).hasSyncedPastLastReconnect&&(this.retries=0,this.markConnectionStateDirty())}},e.onclose=e=>{if(this._logVerbose(`begin ws.onclose`),this.transitionChunkBuffer=null,this.lastCloseReason===null&&(this.lastCloseReason=e.reason||`closed with code ${e.code}`),e.code!==lt&&e.code!==ut&&e.code!==dt&&e.code!==ft){let t=`WebSocket closed with code ${e.code}`;e.reason&&(t+=`: ${e.reason}`),this.logger.log(t),this.onServerDisconnectError&&e.reason&&this.onServerDisconnectError(t)}let t=ht(e.reason);this.scheduleReconnect(t)}}socketState(){return this.socket.state}sendMessage(e){let t={type:e.type,...e.type===`Authenticate`&&e.tokenType===`User`?{value:`...${e.value.slice(-7)}`}:{}};if(this.socket.state===`ready`&&this.socket.paused===`no`){let n=ot(e),r=JSON.stringify(n),i=!1;try{this.socket.ws.send(r),i=!0}catch(e){this.logger.log(`Failed to send message on WebSocket, reconnecting: ${e}`),this.closeAndReconnect(`FailedToSendMessage`)}return this._logVerbose(`${i?`sent`:`failed to send`} message with type ${e.type}: ${JSON.stringify(t)}`),!0}return this._logVerbose(`message not sent (socket state: ${this.socket.state}, paused: ${`paused`in this.socket?this.socket.paused:void 0}): ${JSON.stringify(t)}`),!1}resetServerInactivityTimeout(){this.socket.state!==`terminated`&&(this.reconnectDueToServerInactivityTimeout!==null&&(clearTimeout(this.reconnectDueToServerInactivityTimeout),this.reconnectDueToServerInactivityTimeout=null),this.reconnectDueToServerInactivityTimeout=setTimeout(()=>{this.closeAndReconnect(`InactiveServer`)},this.serverInactivityThreshold))}scheduleReconnect(e){this.scheduledReconnect&&=(clearTimeout(this.scheduledReconnect.timeout),null),this.socket={state:`disconnected`};let t=this.nextBackoff(e);this.markConnectionStateDirty(),this.logger.log(`Attempting reconnect in ${Math.round(t)}ms`);let n=G(),r=setTimeout(()=>{this.scheduledReconnect?.timeout===r&&(this.scheduledReconnect=null,this.connect())},t);this.scheduledReconnect={timeout:r,scheduledAt:n,backoffMs:t}}closeAndReconnect(e){switch(this._logVerbose(`begin closeAndReconnect with reason ${e}`),this.socket.state){case`disconnected`:case`terminated`:case`stopped`:return;case`connecting`:case`ready`:this.lastCloseReason=e,this.close(),this.scheduleReconnect(`client`);return;default:this.socket}}close(){switch(this.transitionChunkBuffer=null,this.socket.state){case`disconnected`:case`terminated`:case`stopped`:return Promise.resolve();case`connecting`:{let e=this.socket.ws;return e.onmessage=e=>{this._logVerbose(`Ignoring message received after close`)},new Promise(t=>{e.onclose=()=>{this._logVerbose(`Closed after connecting`),t()},e.onopen=()=>{this._logVerbose(`Opened after connecting`),e.close()}})}case`ready`:{this._logVerbose(`ws.close called`);let e=this.socket.ws;e.onmessage=e=>{this._logVerbose(`Ignoring message received after close`)};let t=new Promise(t=>{e.onclose=()=>{t()}});return e.close(),t}default:return this.socket,Promise.resolve()}}terminate(){switch(this.reconnectDueToServerInactivityTimeout&&clearTimeout(this.reconnectDueToServerInactivityTimeout),this.scheduledReconnect&&=(clearTimeout(this.scheduledReconnect.timeout),null),this.cleanupNetworkListener(),this.socket.state){case`terminated`:case`stopped`:case`disconnected`:case`connecting`:case`ready`:{let e=this.close();return this.setSocketState({state:`terminated`}),e}default:throw this.socket,Error(`Invalid websocket state: ${this.socket.state}`)}}stop(){switch(this.socket.state){case`terminated`:return Promise.resolve();case`connecting`:case`stopped`:case`disconnected`:case`ready`:{this.cleanupNetworkListener();let e=this.close();return this.socket={state:`stopped`},e}default:return this.socket,Promise.resolve()}}tryRestart(){switch(this.socket.state){case`stopped`:break;case`terminated`:case`connecting`:case`ready`:case`disconnected`:this.logger.logVerbose(`Restart called without stopping first`);return;default:this.socket}this.setupNetworkListener(),this.connect()}pause(){switch(this.socket.state){case`disconnected`:case`stopped`:case`terminated`:return;case`connecting`:case`ready`:this.socket={...this.socket,paused:`yes`};return;default:this.socket;return}}tryReconnectImmediately(){if(this._logVerbose(`tryReconnectImmediately called`),this.socket.state!==`disconnected`){this._logVerbose(`tryReconnectImmediately called but socket state is ${this.socket.state}, no action taken`);return}let e=null;if(this.scheduledReconnect){let t=G()-this.scheduledReconnect.scheduledAt;e=Math.max(0,this.scheduledReconnect.backoffMs-t),this._logVerbose(`would have waited ${Math.round(e)}ms more (backoff was ${Math.round(this.scheduledReconnect.backoffMs)}ms, elapsed ${Math.round(t)}ms)`),clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null,this._logVerbose(`canceled scheduled reconnect`)}this.logger.log(`Network recovery detected, reconnecting immediately`),this.pendingNetworkRecoveryInfo=e===null?null:{timeSavedMs:e},this.connect()}resume(){switch(this.socket.state){case`connecting`:this.socket={...this.socket,paused:`no`};return;case`ready`:this.socket.paused===`uninitialized`?(this.socket={...this.socket,paused:`no`},this._hasEverConnected=!0,this.onOpen({connectionCount:this.connectionCount,lastCloseReason:this.lastCloseReason,clientTs:G()})):this.socket.paused===`yes`&&(this.socket={...this.socket,paused:`no`},this.onResume());return;case`terminated`:case`stopped`:case`disconnected`:return;default:this.socket}this.connect()}connectionState(){return{isConnected:this.socket.state===`ready`,hasEverConnected:this._hasEverConnected,connectionCount:this.connectionCount,connectionRetries:this.retries}}_logVerbose(e){this.logger.logVerbose(e)}nextBackoff(e){let t=(e===`client`?100:e===`Unknown`?this.defaultInitialBackoff:mt[e].timeout)*2**this.retries;this.retries+=1;let n=Math.min(t,this.maxBackoff);return n+n*(Math.random()-.5)}reportLargeTransition({transition:e,messageLength:t}){if(e.clientClockSkew===void 0||e.serverTs===void 0)return;let n=G()-e.clientClockSkew-e.serverTs/1e6,r=`${Math.round(n)}ms`,i=`${Math.round(t/1e4)/100}MB`,a=t/(n/1e3),o=`${Math.round(a/1e4)/100}MB per second`;this._logVerbose(`received ${i} transition in ${r} at ${o}`),t>2e7?this.logger.log(`received query results totaling more that 20MB (${i}) which will take a long time to download on slower connections`):n>2e4&&this.logger.log(`received query results totaling ${i} which took more than 20s to arrive (${r})`),this.debug&&this.sendMessage({type:`Event`,eventType:`ClientReceivedTransition`,event:{transitionTransitTime:n,messageLength:t}})}};function _t(){return vt()}function vt(){return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}var K=class extends Error{};K.prototype.name=`InvalidTokenError`;function yt(e){return decodeURIComponent(atob(e).replace(/(.)/g,(e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n=`0`+n),`%`+n}))}function bt(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`);switch(t.length%4){case 0:break;case 2:t+=`==`;break;case 3:t+=`=`;break;default:throw Error(`base64 string is not of the correct length`)}try{return yt(t)}catch{return atob(t)}}function xt(e,t){if(typeof e!=`string`)throw new K(`Invalid token specified: must be a string`);t||={};let n=t.header===!0?0:1,r=e.split(`.`)[n];if(typeof r!=`string`)throw new K(`Invalid token specified: missing part #${n+1}`);let i;try{i=bt(r)}catch(e){throw new K(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(i)}catch(e){throw new K(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}var St=Object.defineProperty,Ct=(e,t,n)=>t in e?St(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,q=(e,t,n)=>Ct(e,typeof t==`symbol`?t:t+``,n),wt=480*60*60*1e3,Tt=2,Et=class{constructor(e,t,n){q(this,`authState`,{state:`noAuth`}),q(this,`configVersion`,0),q(this,`syncState`),q(this,`authenticate`),q(this,`stopSocket`),q(this,`tryRestartSocket`),q(this,`pauseSocket`),q(this,`resumeSocket`),q(this,`clearAuth`),q(this,`logger`),q(this,`refreshTokenLeewaySeconds`),q(this,`initialAuthTokenReuse`),q(this,`lastRefreshChange`),q(this,`tokenConfirmationAttempts`,0),this.syncState=e,this.authenticate=t.authenticate,this.stopSocket=t.stopSocket,this.tryRestartSocket=t.tryRestartSocket,this.pauseSocket=t.pauseSocket,this.resumeSocket=t.resumeSocket,this.clearAuth=t.clearAuth,this.logger=n.logger,this.refreshTokenLeewaySeconds=n.refreshTokenLeewaySeconds,this.initialAuthTokenReuse=n.initialAuthTokenReuse,this.lastRefreshChange=!1}notifyRefreshChange(e){this.authState.state!==`noAuth`&&this.authState.state!==`initialRefetch`&&this.authState.config.onRefreshChange&&this.lastRefreshChange!==e&&(this.lastRefreshChange=e,this.authState.config.onRefreshChange(e))}async setConfig(e,t,n){this.resetAuthState(),this._logVerbose(`pausing WS for auth token fetch`),this.pauseSocket();let r=await this.fetchTokenAndGuardAgainstRace(e,{forceRefreshToken:!1});if(r.isFromOutdatedConfig)return;let i={fetchToken:e,onAuthChange:t,onRefreshChange:n};r.value?(this.setAuthState({state:`waitingForServerConfirmationOfCachedToken`,config:i,hasRetried:!1}),this.authenticate(r.value)):(this.setAuthState({state:`initialRefetch`,config:i}),await this.refetchToken()),this._logVerbose(`resuming WS after auth token fetch`),this.resumeSocket()}onTransition(e){if(this.syncState.isCurrentOrNewerAuthVersion(e.endVersion.identity)&&!(e.endVersion.identity<=e.startVersion.identity)){if(this._logVerbose(`auth state is ${this.authState.state} when handling transition`),this.syncState.markAuthCompletion(),this.authState.state===`waitingForServerConfirmationOfCachedToken`){this._logVerbose(`server confirmed auth token is valid`);let t=this.syncState.getAuth()?.value;this.initialAuthTokenReuse&&t?this.scheduleTokenRefetch(t,e.clientClockSkew):this.refetchToken(),this.authState.config.onAuthChange(!0);return}this.authState.state===`waitingForServerConfirmationOfFreshToken`&&(this._logVerbose(`server confirmed new auth token is valid`),this.notifyRefreshChange(!1),this.scheduleTokenRefetch(this.authState.token),this.tokenConfirmationAttempts=0,this.authState.hadAuth||this.authState.config.onAuthChange(!0))}}onAuthError(e){if(e.authUpdateAttempted===!1&&(this.authState.state===`waitingForServerConfirmationOfFreshToken`||this.authState.state===`waitingForServerConfirmationOfCachedToken`)){this._logVerbose(`ignoring non-auth token expired error`);return}let{baseVersion:t}=e;if(!this.syncState.isCurrentOrNewerAuthVersion(t+1)){this._logVerbose(`ignoring auth error for previous auth attempt`);return}this.tryToReauthenticate(e)}async tryToReauthenticate(e){if(this._logVerbose(`attempting to reauthenticate: ${e.error}`),this.authState.state===`noAuth`||this.authState.state===`waitingForServerConfirmationOfFreshToken`&&this.tokenConfirmationAttempts>=Tt){this.logger.error(`Failed to authenticate: "${e.error}", check your server auth config`),this.syncState.hasAuth()&&this.syncState.clearAuth(),this.authState.state!==`noAuth`&&this.setAndReportAuthFailed(this.authState.config.onAuthChange);return}if(this.authState.state===`waitingForServerConfirmationOfFreshToken`&&(this.tokenConfirmationAttempts++,this._logVerbose(`retrying reauthentication, ${Tt-this.tokenConfirmationAttempts} attempts remaining`)),this.notifyRefreshChange(!0),await this.stopSocket(),this.authState.state===`noAuth`)return;let t=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});t.isFromOutdatedConfig||(t.value&&this.syncState.isNewAuth(t.value)?(this.authenticate(t.value),this.setAuthState({state:`waitingForServerConfirmationOfFreshToken`,config:this.authState.config,token:t.value,hadAuth:this.authState.state===`notRefetching`||this.authState.state===`waitingForScheduledRefetch`})):(this._logVerbose(`reauthentication failed, could not fetch a new token`),this.syncState.hasAuth()&&this.syncState.clearAuth(),this.setAndReportAuthFailed(this.authState.config.onAuthChange)),this.tryRestartSocket())}async refetchToken(){if(this.authState.state===`noAuth`)return;this._logVerbose(`refetching auth token`);let e=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});e.isFromOutdatedConfig||(e.value?this.syncState.isNewAuth(e.value)?(this.setAuthState({state:`waitingForServerConfirmationOfFreshToken`,hadAuth:this.syncState.hasAuth(),token:e.value,config:this.authState.config}),this.authenticate(e.value)):this.setAuthState({state:`notRefetching`,config:this.authState.config}):(this._logVerbose(`refetching token failed`),this.syncState.hasAuth()&&this.clearAuth(),this.setAndReportAuthFailed(this.authState.config.onAuthChange)),this._logVerbose(`restarting WS after auth token fetch (if currently stopped)`),this.tryRestartSocket())}scheduleTokenRefetch(e,t){if(this.authState.state===`noAuth`)return;let n=this.decodeToken(e);if(!n){this.logger.error(`Auth token is not a valid JWT, cannot refetch the token`);return}let{iat:r,exp:i}=n;if(!r||!i){this.logger.error(`Auth token does not have required fields, cannot refetch the token`);return}let a=i-r;if(a<=2){this.logger.error(`Auth token does not live long enough, cannot refetch the token`);return}let o;t===void 0?o=a:(o=i-(Date.now()-t)/1e3,o<=0&&(o=0));let s=Math.min(wt,(o-this.refreshTokenLeewaySeconds)*1e3);s<=0&&(this.logger.warn(`Refetching auth token immediately, configured leeway ${this.refreshTokenLeewaySeconds}s is larger than the token's lifetime ${o}s`),s=0);let c=setTimeout(()=>{this._logVerbose(`running scheduled token refetch`),this.refetchToken()},s);this.setAuthState({state:`waitingForScheduledRefetch`,refetchTokenTimeoutId:c,config:this.authState.config}),this._logVerbose(`scheduled preemptive auth token refetching in ${s}ms`)}async fetchTokenAndGuardAgainstRace(e,t){let n=++this.configVersion;this._logVerbose(`fetching token with config version ${n}`);let r=await e(t);return this.configVersion===n?{isFromOutdatedConfig:!1,value:r}:(this._logVerbose(`stale config version, expected ${n}, got ${this.configVersion}`),{isFromOutdatedConfig:!0})}stop(){this.resetAuthState(),this.configVersion++,this._logVerbose(`config version bumped to ${this.configVersion}`)}setAndReportAuthFailed(e){e(!1),this.resetAuthState()}resetAuthState(){this.notifyRefreshChange(!1),this.setAuthState({state:`noAuth`})}setAuthState(e){let t=e.state===`waitingForServerConfirmationOfFreshToken`?{hadAuth:e.hadAuth,state:e.state,token:`...${e.token.slice(-7)}`}:{state:e.state};switch(this._logVerbose(`setting auth state to ${JSON.stringify(t)}`),e.state){case`waitingForScheduledRefetch`:case`notRefetching`:case`noAuth`:this.tokenConfirmationAttempts=0;break;case`waitingForServerConfirmationOfFreshToken`:case`waitingForServerConfirmationOfCachedToken`:case`initialRefetch`:break;default:}this.authState.state===`waitingForScheduledRefetch`&&clearTimeout(this.authState.refetchTokenTimeoutId),this.authState=e}decodeToken(e){try{return xt(e)}catch(e){return this._logVerbose(`Error decoding token: ${e instanceof Error?e.message:`Unknown error`}`),null}}_logVerbose(e){this.logger.logVerbose(`${e} [v${this.configVersion}]`)}},Dt=[`convexClientConstructed`,`convexWebSocketOpen`,`convexFirstMessageReceived`];function Ot(e,t){let n={sessionId:t};typeof performance>`u`||!performance.mark||performance.mark(e,{detail:n})}function kt(e){let t=e.name.slice(6);return t=t.charAt(0).toLowerCase()+t.slice(1),{name:t,startTime:e.startTime}}function At(e){if(typeof performance>`u`||!performance.getEntriesByName)return[];let t=[];for(let n of Dt){let r=performance.getEntriesByName(n).filter(e=>e.entryType===`mark`).filter(t=>t.detail.sessionId===e);t.push(...r)}return t.map(kt)}var jt=Object.defineProperty,Mt=(e,t,n)=>t in e?jt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,J=(e,t,n)=>Mt(e,typeof t==`symbol`?t:t+``,n),Nt=class{constructor(e,t,n){if(J(this,`address`),J(this,`state`),J(this,`requestManager`),J(this,`webSocketManager`),J(this,`authenticationManager`),J(this,`remoteQuerySet`),J(this,`optimisticQueryResults`),J(this,`_transitionHandlerCounter`,0),J(this,`_nextRequestId`),J(this,`_onTransitionFns`,new Map),J(this,`_sessionId`),J(this,`firstMessageReceived`,!1),J(this,`debug`),J(this,`logger`),J(this,`maxObservedTimestamp`),J(this,`connectionStateSubscribers`,new Map),J(this,`nextConnectionStateSubscriberId`,0),J(this,`_lastPublishedConnectionState`),J(this,`markConnectionStateDirty`,()=>{Promise.resolve().then(()=>{let e=this.connectionState();if(JSON.stringify(e)!==JSON.stringify(this._lastPublishedConnectionState)){this._lastPublishedConnectionState=e;for(let t of this.connectionStateSubscribers.values())t(e)}})}),J(this,`mark`,e=>{this.debug&&Ot(e,this.sessionId)}),typeof e==`object`)throw Error(`Passing a ClientConfig object is no longer supported. Pass the URL of the Convex deployment as a string directly.`);n?.skipConvexDeploymentUrlCheck!==!0&&ne(e),n={...n};let r=n.authRefreshTokenLeewaySeconds??10,i=n.webSocketConstructor;if(!i&&typeof WebSocket>`u`)throw Error(`No WebSocket global variable defined! To use Convex in an environment without WebSocket try the HTTP client: https://docs.convex.dev/api/classes/browser.ConvexHttpClient`);i||=WebSocket,this.debug=n.reportDebugInfoToConvex??!1,this.address=e,this.logger=n.logger===!1?Ne({verbose:n.verbose??!1}):n.logger!==!0&&n.logger?n.logger:Me({verbose:n.verbose??!1});let a=e.search(`://`);if(a===-1)throw Error(`Provided address was not an absolute URL.`);let o=e.substring(a+3),s=e.substring(0,a),c;if(s===`http`)c=`ws`;else if(s===`https`)c=`wss`;else throw Error(`Unknown parent protocol ${s}`);let l=`${c}://${o}/api/${d}/sync`;this.state=new ze,this.remoteQuerySet=new nt(e=>this.state.queryPath(e),this.logger),this.requestManager=new He(this.logger,this.markConnectionStateDirty);let u=()=>{this.webSocketManager.pause(),this.state.pause()};this.authenticationManager=new Et(this.state,{authenticate:e=>{let t=this.state.setAuth(e);return this.webSocketManager.sendMessage(t),t.baseVersion},stopSocket:()=>this.webSocketManager.stop(),tryRestartSocket:()=>this.webSocketManager.tryRestart(),pauseSocket:u,resumeSocket:()=>this.webSocketManager.resume(),clearAuth:()=>{this.clearAuth()}},{logger:this.logger,refreshTokenLeewaySeconds:r,initialAuthTokenReuse:n.initialAuthTokenReuse??!1}),this.optimisticQueryResults=new Ke,this.addOnTransitionHandler(e=>{t(e.queries.map(e=>e.token))}),this._nextRequestId=0,this._sessionId=_t();let{unsavedChangesWarning:f}=n;if(typeof window>`u`||window.addEventListener===void 0){if(f===!0)throw Error(`unsavedChangesWarning requested, but window.addEventListener not found! Remove {unsavedChangesWarning: true} from Convex client options.`)}else f!==!1&&window.addEventListener(`beforeunload`,e=>{if(this.requestManager.hasIncompleteRequests()){e.preventDefault();let t=`Are you sure you want to leave? Your changes may not be saved.`;return(e||window.event).returnValue=t,t}});this.webSocketManager=new gt(l,{onOpen:e=>{this.mark(`convexWebSocketOpen`),this.webSocketManager.sendMessage({...e,type:`Connect`,sessionId:this._sessionId,maxObservedTimestamp:this.maxObservedTimestamp}),this.remoteQuerySet=new nt(e=>this.state.queryPath(e),this.logger);let[t,n]=this.state.restart();n&&this.webSocketManager.sendMessage(n),this.webSocketManager.sendMessage(t);for(let e of this.requestManager.restart())this.webSocketManager.sendMessage(e)},onResume:()=>{let[e,t]=this.state.resume();t&&this.webSocketManager.sendMessage(t),e&&this.webSocketManager.sendMessage(e);for(let e of this.requestManager.resume())this.webSocketManager.sendMessage(e)},onMessage:e=>{switch(this.firstMessageReceived||(this.firstMessageReceived=!0,this.mark(`convexFirstMessageReceived`),this.reportMarks()),e.type){case`Transition`:{this.observedTimestamp(e.endVersion.ts),this.authenticationManager.onTransition(e),this.remoteQuerySet.transition(e),this.state.transition(e);let t=this.requestManager.removeCompleted(this.remoteQuerySet.timestamp());this.notifyOnQueryResultChanges(t);break}case`MutationResponse`:{e.success&&this.observedTimestamp(e.ts);let t=this.requestManager.onResponse(e);t!==null&&this.notifyOnQueryResultChanges(new Map([[t.requestId,t.result]]));break}case`ActionResponse`:this.requestManager.onResponse(e);break;case`AuthError`:this.authenticationManager.onAuthError(e);break;case`FatalError`:{let t=Pe(this.logger,e.error);throw this.webSocketManager.terminate(),t}default:}return{hasSyncedPastLastReconnect:this.hasSyncedPastLastReconnect()}},onServerDisconnectError:n.onServerDisconnectError},i,this.logger,this.markConnectionStateDirty,this.debug),this.mark(`convexClientConstructed`),n.expectAuth&&u()}hasSyncedPastLastReconnect(){return this.requestManager.hasSyncedPastLastReconnect()&&this.state.hasSyncedPastLastReconnect()}observedTimestamp(e){(this.maxObservedTimestamp===void 0||this.maxObservedTimestamp.lessThanOrEqual(e))&&(this.maxObservedTimestamp=e)}getMaxObservedTimestamp(){return this.maxObservedTimestamp}notifyOnQueryResultChanges(e){let t=this.remoteQuerySet.remoteQueryResults(),n=new Map;for(let[e,r]of t){let t=this.state.queryToken(e);if(t!==null){let i={result:r,udfPath:this.state.queryPath(e),args:this.state.queryArgs(e)};n.set(t,i)}}let r=this.optimisticQueryResults.ingestQueryResultsFromServer(n,new Set(e.keys()));this.handleTransition({queries:r.map(e=>({token:e,modification:{kind:`Updated`,result:this.optimisticQueryResults.rawQueryResult(e)}})),reflectedMutations:Array.from(e).map(([e,t])=>({requestId:e,result:t})),timestamp:this.remoteQuerySet.timestamp()})}handleTransition(e){for(let t of this._onTransitionFns.values())t(e)}addOnTransitionHandler(e){let t=this._transitionHandlerCounter++;return this._onTransitionFns.set(t,e),()=>this._onTransitionFns.delete(t)}getCurrentAuthClaims(){let e=this.state.getAuth(),t={};if(e&&e.tokenType===`User`)try{t=e?xt(e.value):{}}catch{t={}}else return;return{token:e.value,decoded:t}}setAuth(e,t,n){this.authenticationManager.setConfig(e,t,n)}hasAuth(){return this.state.hasAuth()}setAdminAuth(e,t){let n=this.state.setAdminAuth(e,t);this.webSocketManager.sendMessage(n)}clearAuth(){let e=this.state.clearAuth();this.webSocketManager.sendMessage(e)}subscribe(e,t,n){let r=S(t),{modification:i,queryToken:a,unsubscribe:o}=this.state.subscribe(e,r,n?.journal,n?.componentPath);return i!==null&&this.webSocketManager.sendMessage(i),{queryToken:a,unsubscribe:()=>{let e=o();e&&this.webSocketManager.sendMessage(e)}}}localQueryResult(e,t){let n=I(e,S(t));return this.optimisticQueryResults.queryResult(n)}localQueryResultByToken(e){return this.optimisticQueryResults.queryResult(e)}hasLocalQueryResultByToken(e){return this.optimisticQueryResults.hasQueryResult(e)}localQueryLogs(e,t){let n=I(e,S(t));return this.optimisticQueryResults.queryLogs(n)}queryJournal(e,t){let n=I(e,S(t));return this.state.queryJournal(n)}connectionState(){let e=this.webSocketManager.connectionState();return{hasInflightRequests:this.requestManager.hasInflightRequests(),isWebSocketConnected:e.isConnected,hasEverConnected:e.hasEverConnected,connectionCount:e.connectionCount,connectionRetries:e.connectionRetries,timeOfOldestInflightRequest:this.requestManager.timeOfOldestInflightRequest(),inflightMutations:this.requestManager.inflightMutations(),inflightActions:this.requestManager.inflightActions()}}subscribeToConnectionState(e){let t=this.nextConnectionStateSubscriberId++;return this.connectionStateSubscribers.set(t,e),()=>{this.connectionStateSubscribers.delete(t)}}async mutation(e,t,n){let r=await this.mutationInternal(e,t,n);if(!r.success)throw r.errorData===void 0?Error(N(`mutation`,e,r)):P(r,new j(N(`mutation`,e,r)));return r.value}async mutationInternal(e,t,n,r){let{mutationPromise:i}=this.enqueueMutation(e,t,n,r);return i}enqueueMutation(e,t,n,r){let i=S(t);this.tryReportLongDisconnect();let a=this.nextRequestId;if(this._nextRequestId++,n!==void 0){let e=n.optimisticUpdate;if(e!==void 0){let t=this.optimisticQueryResults.applyOptimisticUpdate(t=>{e(t,i)instanceof Promise&&this.logger.warn(`Optimistic update handler returned a Promise. Optimistic updates should be synchronous.`)},a).map(e=>{let t=this.localQueryResultByToken(e);return{token:e,modification:{kind:`Updated`,result:t===void 0?void 0:{success:!0,value:t,logLines:[]}}}});this.handleTransition({queries:t,reflectedMutations:[],timestamp:this.remoteQuerySet.timestamp()})}}let o={type:`Mutation`,requestId:a,udfPath:e,componentPath:r,args:[k(i)]},s=this.webSocketManager.sendMessage(o);return{requestId:a,mutationPromise:this.requestManager.request(o,s)}}async action(e,t){let n=await this.actionInternal(e,t);if(!n.success)throw n.errorData===void 0?Error(N(`action`,e,n)):P(n,new j(N(`action`,e,n)));return n.value}async actionInternal(e,t,n){let r=S(t),i=this.nextRequestId;this._nextRequestId++,this.tryReportLongDisconnect();let a={type:`Action`,requestId:i,udfPath:e,componentPath:n,args:[k(r)]},o=this.webSocketManager.sendMessage(a);return this.requestManager.request(a,o)}async close(){return this.authenticationManager.stop(),this.webSocketManager.terminate()}get url(){return this.address}get nextRequestId(){return this._nextRequestId}get sessionId(){return this._sessionId}reportMarks(){if(this.debug){let e=At(this.sessionId);this.webSocketManager.sendMessage({type:`Event`,eventType:`ClientConnect`,event:e})}}tryReportLongDisconnect(){if(!this.debug)return;let e=this.connectionState().timeOfOldestInflightRequest;if(e===null||Date.now()-e.getTime()<=60*1e3)return;let t=`${this.address}/api/debug_event`;fetch(t,{method:`POST`,headers:{"Content-Type":`application/json`,"Convex-Client":`npm-${d}`},body:JSON.stringify({event:`LongWebsocketDisconnect`})}).then(e=>{e.ok||this.logger.warn(`Analytics request failed with response:`,e.body)}).catch(e=>{this.logger.warn(`Analytics response failed with error:`,e)})}};function Pt(e){if(typeof e!=`object`||!e||!Array.isArray(e.page)||typeof e.isDone!=`boolean`||typeof e.continueCursor!=`string`)throw Error(`Not a valid paginated query result: ${e?.toString()}`);return e}var Ft=Object.defineProperty,It=(e,t,n)=>t in e?Ft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Lt=(e,t,n)=>It(e,typeof t==`symbol`?t:t+``,n),Rt=class{constructor(e,t){this.client=e,this.onTransition=t,Lt(this,`paginatedQuerySet`,new Map),Lt(this,`lastTransitionTs`),this.lastTransitionTs=B.fromNumber(0),this.client.addOnTransitionHandler(e=>this.onBaseTransition(e))}subscribe(e,t,n){let r=F(e),i=Fe(r,t,n),a=()=>this.removePaginatedQuerySubscriber(i),o=this.paginatedQuerySet.get(i);return o?(o.numSubscribers+=1,{paginatedQueryToken:i,unsubscribe:a}):(this.paginatedQuerySet.set(i,{token:i,canonicalizedUdfPath:r,args:t,numSubscribers:1,options:{initialNumItems:n.initialNumItems},nextPageKey:0,pageKeys:[],pageKeyToQuery:new Map,ongoingSplits:new Map,skip:!1,id:n.id}),this.addPageToPaginatedQuery(i,null,n.initialNumItems),{paginatedQueryToken:i,unsubscribe:a})}localQueryResult(e,t,n){let r=Fe(F(e),t,n);return this.localQueryResultByToken(r)}localQueryResultByToken(e){let t=this.paginatedQuerySet.get(e);if(!t)return;let n=this.activePageQueryTokens(t);if(n.length===0)return{results:[],status:`LoadingFirstPage`,loadMore:t=>this.loadMoreOfPaginatedQuery(e,t)};let r=[],i=!1,a=!1;for(let e of n){let t=this.client.localQueryResultByToken(e);if(t===void 0){i=!0,a=!1;continue}let n=Pt(t);r=r.concat(n.page),a=!!n.isDone}let o;return o=i?r.length===0?`LoadingFirstPage`:`LoadingMore`:a?`Exhausted`:`CanLoadMore`,{results:r,status:o,loadMore:t=>this.loadMoreOfPaginatedQuery(e,t)}}onBaseTransition(e){let t=e.queries.map(e=>e.token),n=this.queriesContainingTokens(t),r=[];n.length>0&&(this.processPaginatedQuerySplits(n,e=>this.client.localQueryResultByToken(e)),r=n.map(e=>({token:e,modification:{kind:`Updated`,result:this.localQueryResultByToken(e)}})));let i={...e,paginatedQueries:r};this.onTransition(i)}loadMoreOfPaginatedQuery(e,t){this.mustGetPaginatedQuery(e);let n=this.queryTokenForLastPageOfPaginatedQuery(e),r=this.client.localQueryResultByToken(n);if(!r)return!1;let i=Pt(r);if(i.isDone)return!1;this.addPageToPaginatedQuery(e,i.continueCursor,t);let a={timestamp:this.lastTransitionTs,reflectedMutations:[],queries:[],paginatedQueries:[{token:e,modification:{kind:`Updated`,result:this.localQueryResultByToken(e)}}]};return this.onTransition(a),!0}queriesContainingTokens(e){if(e.length===0)return[];let t=[],n=new Set(e);for(let[e,r]of this.paginatedQuerySet)for(let i of this.allQueryTokens(r))if(n.has(i)){t.push(e);break}return t}processPaginatedQuerySplits(e,t){for(let n of e){let e=this.mustGetPaginatedQuery(n),{ongoingSplits:r,pageKeyToQuery:i,pageKeys:a}=e;for(let[n,[a,o]]of r)t(i.get(a).queryToken)!==void 0&&t(i.get(o).queryToken)!==void 0&&this.completePaginatedQuerySplit(e,n,a,o);for(let n of a){if(r.has(n))continue;let a=i.get(n).queryToken,o=t(a);if(!o)continue;let s=Pt(o);s.splitCursor&&(s.pageStatus===`SplitRecommended`||s.pageStatus===`SplitRequired`||s.page.length>e.options.initialNumItems*2)&&this.splitPaginatedQueryPage(e,n,s.splitCursor,s.continueCursor)}}}splitPaginatedQueryPage(e,t,n,r){let i=e.nextPageKey++,a=e.nextPageKey++,o={cursor:r,numItems:e.options.initialNumItems,id:e.id},s=this.client.subscribe(e.canonicalizedUdfPath,{...e.args,paginationOpts:{...o,cursor:null,endCursor:n}});e.pageKeyToQuery.set(i,s);let c=this.client.subscribe(e.canonicalizedUdfPath,{...e.args,paginationOpts:{...o,cursor:n,endCursor:r}});e.pageKeyToQuery.set(a,c),e.ongoingSplits.set(t,[i,a])}addPageToPaginatedQuery(e,t,n){let r=this.mustGetPaginatedQuery(e),i=r.nextPageKey++,a={cursor:t,numItems:n,id:r.id},o={...r.args,paginationOpts:a},s=this.client.subscribe(r.canonicalizedUdfPath,o);return r.pageKeys.push(i),r.pageKeyToQuery.set(i,s),s}removePaginatedQuerySubscriber(e){let t=this.paginatedQuerySet.get(e);if(t&&(--t.numSubscribers,!(t.numSubscribers>0))){for(let e of t.pageKeyToQuery.values())e.unsubscribe();this.paginatedQuerySet.delete(e)}}completePaginatedQuerySplit(e,t,n,r){let i=e.pageKeyToQuery.get(t);e.pageKeyToQuery.delete(t);let a=e.pageKeys.indexOf(t);e.pageKeys.splice(a,1,n,r),e.ongoingSplits.delete(t),i.unsubscribe()}activePageQueryTokens(e){return e.pageKeys.map(t=>e.pageKeyToQuery.get(t).queryToken)}allQueryTokens(e){return Array.from(e.pageKeyToQuery.values()).map(e=>e.queryToken)}queryTokenForLastPageOfPaginatedQuery(e){let t=this.mustGetPaginatedQuery(e),n=t.pageKeys[t.pageKeys.length-1];if(n===void 0)throw Error(`No pages for paginated query ${e}`);return t.pageKeyToQuery.get(n).queryToken}mustGetPaginatedQuery(e){let t=this.paginatedQuerySet.get(e);if(!t)throw Error(`paginated query no longer exists for token `+e);return t}},zt=Object.defineProperty,Bt=(e,t,n)=>t in e?zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Y=(e,t,n)=>Bt(e,typeof t==`symbol`?t:t+``,n),Vt,Ht=class{constructor(e,t={}){Y(this,`listeners`),Y(this,`_client`),Y(this,`_paginatedClient`),Y(this,`callNewListenersWithCurrentValuesTimer`),Y(this,`_closed`),Y(this,`_disabled`),t.skipConvexDeploymentUrlCheck!==!0&&ne(e);let{disabled:n,...r}=t;this._closed=!1,this._disabled=!!n,Vt&&!(`webSocketConstructor`in r)&&typeof WebSocket>`u`&&(r.webSocketConstructor=Vt),typeof window>`u`&&!(`unsavedChangesWarning`in r)&&(r.unsavedChangesWarning=!1),this.disabled||(this._client=new Nt(e,()=>{},r),this._paginatedClient=new Rt(this._client,e=>this._transition(e))),this.listeners=new Set}get closed(){return this._closed}get client(){if(this._client)return this._client;throw Error(`ConvexClient is disabled`)}get paginatedClient(){if(this._paginatedClient)return this._paginatedClient;throw Error(`ConvexClient is disabled`)}get disabled(){return this._disabled}onUpdate(e,t,n,r){if(this.disabled)return this.createDisabledUnsubscribe();let{queryToken:i,unsubscribe:a}=this.client.subscribe(u(e),t),o={queryToken:i,callback:n,onError:r,unsubscribe:a,hasEverRun:!1,query:e,args:t,paginationOptions:void 0};this.listeners.add(o),this.queryResultReady(i)&&this.callNewListenersWithCurrentValuesTimer===void 0&&(this.callNewListenersWithCurrentValuesTimer=setTimeout(()=>this.callNewListenersWithCurrentValues(),0));let s={unsubscribe:()=>{this.closed||(this.listeners.delete(o),a())},getCurrentValue:()=>this.client.localQueryResultByToken(i),getQueryLogs:()=>this.client.localQueryLogs(i)},c=s.unsubscribe;return Object.assign(c,s),c}onPaginatedUpdate_experimental(e,t,n,r,i){if(this.disabled)return this.createDisabledUnsubscribe();let a={initialNumItems:n.initialNumItems,id:-1},{paginatedQueryToken:o,unsubscribe:s}=this.paginatedClient.subscribe(u(e),t,a),c={queryToken:o,callback:r,onError:i,unsubscribe:s,hasEverRun:!1,query:e,args:t,paginationOptions:a};this.listeners.add(c),this.paginatedClient.localQueryResultByToken(o)&&this.callNewListenersWithCurrentValuesTimer===void 0&&(this.callNewListenersWithCurrentValuesTimer=setTimeout(()=>this.callNewListenersWithCurrentValues(),0));let l={unsubscribe:()=>{this.closed||(this.listeners.delete(c),s())},getCurrentValue:()=>this.paginatedClient.localQueryResult(u(e),t,a),getQueryLogs:()=>[]},d=l.unsubscribe;return Object.assign(d,l),d}callNewListenersWithCurrentValues(){this.callNewListenersWithCurrentValuesTimer=void 0,this._transition({queries:[],paginatedQueries:[]},!0)}queryResultReady(e){return this.client.hasLocalQueryResultByToken(e)}createDisabledUnsubscribe(){let e=(()=>{});return Object.assign(e,{unsubscribe:e,getCurrentValue:()=>void 0,getQueryLogs:()=>void 0}),e}async close(){if(!this.disabled)return this.listeners.clear(),this._closed=!0,this._paginatedClient&&=void 0,this.client.close()}getAuth(){if(!this.disabled)return this.client.getCurrentAuthClaims()}setAuth(e,t){this.disabled||this.client.setAuth(e,t??(()=>{}))}setAdminAuth(e,t){if(this.closed)throw Error(`ConvexClient has already been closed.`);this.disabled||this.client.setAdminAuth(e,t)}_transition({queries:e,paginatedQueries:t},n=!1){let r=[...e.map(e=>e.token),...t.map(e=>e.token)];for(let e of this.listeners){let{callback:t,queryToken:i,onError:a,hasEverRun:o}=e,s=Ie(i),c=s?!!this.paginatedClient.localQueryResultByToken(i):this.client.hasLocalQueryResultByToken(i);if(r.includes(i)||n&&!o&&c){e.hasEverRun=!0;let n;try{n=s?this.paginatedClient.localQueryResultByToken(i):this.client.localQueryResultByToken(i)}catch(e){if(!(e instanceof Error))throw e;a?a(e,`Second argument to onUpdate onError is reserved for later use`):Promise.reject(e);continue}t(n,`Second argument to onUpdate callback is reserved for later use`)}}}async mutation(e,t,n){if(this.disabled)throw Error(`ConvexClient is disabled`);return await this.client.mutation(u(e),t,n)}async action(e,t){if(this.disabled)throw Error(`ConvexClient is disabled`);return await this.client.action(u(e),t)}async query(e,t){if(this.disabled)throw Error(`ConvexClient is disabled`);let n=this.client.localQueryResult(u(e),t);return n===void 0?new Promise((n,r)=>{let{unsubscribe:i}=this.onUpdate(e,t,e=>{i(),n(e)},e=>{i(),r(e)})}):Promise.resolve(n)}connectionState(){if(this.disabled)throw Error(`ConvexClient is disabled`);return this.client.connectionState()}subscribeToConnectionState(e){return this.disabled?()=>{}:this.client.subscribeToConnectionState(e)}},X=Symbol(`convex.useQuery.skip`);function Ut(e){return typeof e==`function`&&(e=e()),e===`skip`?{skip:!0,args:void 0}:{skip:!1,args:e}}function Wt(e,t){return JSON.stringify(k(e))===JSON.stringify(k(t))}function Gt(e,t){return e===X&&t===X?!0:e===X||t===X?!1:Wt(e,t)}function Z(e){let{skip:t,args:n}=Ut(e);return t?X:o(n)}var Q=null,Kt=null,qt=[];function Jt(){if(qt===null)return;let e=qt;qt=null;for(let t of e)t()}function Yt(){return Q?.closed?(Q=null,Kt=null,null):Q}function Xt(){return Kt}function Zt(e,t){Kt=e,Q=t}function Qt(){let e=Yt();if(!e)throw Error(`Convex client not initialized. Call setupConvex() or initConvex() first.`);return e}function $t(e){return!e.disabled&&!e.closed}var en=`$$_convexClient`,tn=`$$_convexAuth`,nn=()=>{let e=l(en);if(!e)throw Error(`No ConvexClient was found in Svelte context. Did you forget to call setupConvex() in a parent component?`);return e},rn=e=>s(en,e),an=(e,t={})=>{if(!e||typeof e!=`string`)throw Error(`Expected string url property for setupConvex`);let n=Yt();if(n&&Xt()!==e)throw Error(`setupConvex() was called with ${e}, but the Convex client is already initialized for ${Xt()}. Only one deployment per app is supported. Call closeConvex() first to switch deployments.`);let r=n??new Ht(e,{disabled:!1,...t});return n||Zt(e,r),rn(r),queueMicrotask(()=>Jt()),r};function on(i,a={},s={}){let l=nn();if(typeof i==`string`)throw Error(`Query must be a functionReference object, not a string`);let d=c({result:$(s).initialData,lastResult:void 0,argsForLastResult:void 0,haveArgsEverChanged:!1});e(()=>{let e=Z(a);if(e===X){d.result=void 0,d.argsForLastResult=X;return}if($t(l))return l.onUpdate(i,e,t=>{let n=structuredClone(t);d.result=n,d.argsForLastResult=e,d.lastResult=n},t=>{d.result=t,d.argsForLastResult=e;let n=structuredClone(t);d.lastResult=n})});let f=r(()=>Z(a)),p=Z(a),m=r(()=>d.argsForLastResult!==void 0&&n(f)!==X&&d.argsForLastResult!==X&&Wt(d.argsForLastResult,n(f))),h=r(()=>!!($(s).keepPreviousData&&d.lastResult)),g=r(()=>n(f)===X);e(()=>{if(!t(()=>d.haveArgsEverChanged)){let e=Z(a);if(!Gt(p,e)){d.haveArgsEverChanged=!0;let e=$(s);e.initialData!==void 0&&(d.argsForLastResult=p===X?X:o(p),d.lastResult=e.initialData)}}});let _=r(()=>{if(n(g))return;if($(s).initialData&&!d.haveArgsEverChanged)return d.result;let e;try{e=$t(l)?l.client.localQueryResult(u(i),n(f)):void 0}catch(t){if(!(t instanceof Error))throw console.error(`threw non-Error instance`,t),t;e=t}return d.result,e}),v=r(()=>n(_)===void 0?n(h)?d.lastResult:void 0:n(_)),ee=r(()=>!n(g)&&n(_)===void 0&&n(h)&&!n(m)&&n(v)!==void 0),y=r(()=>{if(!(n(v)instanceof Error))return n(v)}),b=r(()=>{if(n(v)instanceof Error)return n(v)});return{get data(){return n(y)},get isLoading(){return!n(g)&&n(b)===void 0&&n(y)===void 0},get error(){return n(b)},get isStale(){return!n(g)&&n(ee)}}}function $(e){return typeof e==`function`&&(e=e()),o(e)}function sn(r,o){let l=nn(),u=o?.initialState!==void 0,d=a(c(u?!!o.initialState.isAuthenticated:null)),f=!1,p,m=!1;if(u&&o.initialState?.isAuthenticated){let{fetchAccessToken:e}=r();m=!0,l.setAuth(e,e=>{i(d,e,!0)})}Jt(),e(()=>{let{isLoading:e,isAuthenticated:a,fetchAccessToken:o}=r();e||(f=!0);let s=t(()=>n(d));if(p=a,m)return a?(m=!1,()=>{l.setAuth(async()=>null,()=>{})}):void 0;if(e&&s!==null&&f&&i(d,null),!e&&!a&&s!==!1&&i(d,!1),a){s===!1&&i(d,null);let e=!0;return l.setAuth(o,t=>{e&&i(d,t,!0)}),()=>{e=!1,l.setAuth(async()=>null,()=>{})}}}),s(tn,{get isLoading(){return n(d)===null||n(d)===!1&&p!==void 0&&t(()=>r().isAuthenticated)!==p},get isAuthenticated(){let e=n(d);return!f&&u?e===!0:e===!0||t(()=>r().isAuthenticated)&&(e??!1)}})}function cn(){let e=l(tn);if(!e)throw Error(`useAuth() requires setupAuth() to be called in a parent component. If you are using an auth adapter (e.g. convex-better-auth-svelte), make sure its setup function is called before useAuth().`);return{get isLoading(){return e.isLoading},get isAuthenticated(){return e.isAuthenticated}}}function ln(e){return(t,n)=>Qt().mutation(e,t,n)}export{on as a,k as c,S as d,d as f,ln as i,T as l,an as n,j as o,cn as r,ye as s,sn as t,be as u};
@@ -0,0 +1 @@
1
+ function e(){return typeof window<`u`?window.location.origin:null}function t(e){if(typeof window>`u`)return null;let t=window.location.hash.startsWith(`#`)?window.location.hash.slice(1):window.location.hash;return new URLSearchParams(t).get(e)}function n(){return t(`token`)}function r(){return t(`workspace`)}function i(e){return`#${new URLSearchParams({workspace:e}).toString()}`}function a(){if(typeof window>`u`)return;let e=new URL(window.location.href);e.hash=``,window.history.replaceState(null,``,`${e.pathname}${e.search}`)}async function o(e,t){let n=await fetch(`${e}/api/auth/bootstrap`,{method:`POST`,headers:{"content-type":`application/json`},credentials:`include`,body:JSON.stringify({credential:t})});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error??`Failed to authenticate with the Sprocket server.`)}}async function s(e){let t=await fetch(`${e}/api/auth/session`,{credentials:`include`});return t.ok?!!(await t.json()).authenticated:!1}async function c(e,t){if(await s(e))return;let r=n();if(r){await o(e,r),a();return}if(t?.pairingCredential){await o(e,t.pairingCredential);return}let i=await l(e);if(i?.pairingCredential){await o(e,i.pairingCredential);return}throw Error(`Pair with your Sprocket server to continue.`)}async function l(e){try{let t=await fetch(`${e}/api/auth/desktop-bootstrap`);return t.ok?await t.json():null}catch{return null}}async function u(e){return typeof window<`u`&&window.sprocketDesktopBridge?.getLocalBootstrap?await window.sprocketDesktopBridge.getLocalBootstrap():await l(e)}async function d(t){let n=t.headers.get(`content-type`)??``,r=await t.text();if(!n.includes(`application/json`)){let t=r.trim().slice(0,120);if(t.startsWith(`<!`)){let t=e();throw Error(t?`The Sprocket API at ${t} returned a web page instead of JSON. Make sure the server is running correctly.`:`The Sprocket API returned a web page instead of JSON. Make sure the server is running correctly.`)}throw Error(t.length>0?`Local API returned an unexpected response: ${t}`:`Local API returned an empty response.`)}return JSON.parse(r)}function f(e){async function t(t,n){let r=await fetch(`${e}${t}`,{...n,credentials:`include`,headers:{"content-type":`application/json`,...n?.headers??{}}});if(!r.ok)try{let e=await d(r);throw Error(e.error??`Local request failed (${r.status}).`)}catch(e){throw e instanceof Error&&e.message!==`Local request failed (${r.status}).`?e:Error(`Local request failed (${r.status}).`,{cause:e})}if(r.status!==204)return await d(r)}return{browseFilesystem:e=>t(`/api/workspace/browse`,{method:`POST`,body:JSON.stringify({partialPath:e.partialPath,...e.cwd?{cwd:e.cwd}:{}})}),resolveWorkspacePath:e=>t(`/api/workspace/resolve`,{method:`POST`,body:JSON.stringify({workspacePath:e.workspacePath,...e.createIfMissing?{createIfMissing:!0}:{}})}),listWorkspaceSessions:()=>t(`/api/workspace/sessions`),attachWorkspaceSession:e=>t(`/api/workspace/sessions`,{method:`POST`,body:JSON.stringify(e)}),runAgent:e=>t(`/api/agent/run`,{method:`POST`,body:JSON.stringify(e)}),waitForAgentAuthRefresh:e=>t(`/api/agent/auth/${encodeURIComponent(e)}`),refreshAgentAuth:async(e,n)=>{await t(`/api/agent/auth/${encodeURIComponent(e)}`,{method:`PUT`,body:JSON.stringify({authToken:n})})}}}async function p(){let t=e();if(!t)throw Error(`Unable to resolve the Sprocket server URL.`);return await c(t,await u(t)),f(t)}export{r as a,i as c,n as i,a as n,p as o,l as r,e as s,o as t};
@@ -0,0 +1 @@
1
+ typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.D0tq1llq.js","../chunks/Ci7cM3I3.js","../chunks/xihTtKlq.js","../chunks/ByDH6pMF.js","../chunks/D5Hn5yYF.js","../chunks/D5i3nqbJ.js","../assets/0.MjIP0V6k.css","../nodes/1.swTsK2nI.js","../chunks/B4Yz9Vq2.js","../nodes/2.CDb1NwCd.js","../chunks/BiY-aars.js","../chunks/NRo3CtPD.js","../nodes/3.BNDSP7Fl.js","../chunks/BKoJaiW1.js","../nodes/4.Ctp3kMog.js"])))=>i.map(i=>d[i]);
2
+ import{B as e,C as t,D as n,E as r,F as i,G as a,K as o,N as s,Q as c,T as l,V as u,W as d,Y as f,Z as p,at as m,dt as h,i as g,it as _,k as v,n as y,r as b,s as x,v as S,w as C,z as w}from"../chunks/Ci7cM3I3.js";import"../chunks/xihTtKlq.js";var T=`modulepreload`,E=function(e,t){return new URL(e,t).href},D={},O=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=E(t,n),t=s(t),t in D)return;D[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:T,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},k={},A=n(`<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"><!></div>`),j=n(`<!> <!>`,1);function M(n,b){m(b,!0);let T=g(b,`components`,23,()=>[]),E=g(b,`data_0`,3,null),D=g(b,`data_1`,3,null);u(()=>b.stores.page.set(b.page)),e(()=>{b.stores,b.page,b.constructors,T(),b.form,E(),D(),b.stores.page.notify()});let O=p(!1),k=p(!1),M=p(null);y(()=>{let e=b.stores.page.subscribe(()=>{s(O)&&(f(k,!0),i().then(()=>{f(M,document.title||`untitled page`,!0)}))});return f(O,!0),e});let N=c(()=>b.constructors[1]);var P=j(),F=a(P),I=e=>{let t=c(()=>b.constructors[0]);var n=r();S(a(n),()=>s(t),(e,t)=>{x(t(e,{get data(){return E()},get form(){return b.form},get params(){return b.page.params},children:(e,t)=>{var n=r();S(a(n),()=>s(N),(e,t)=>{x(t(e,{get data(){return D()},get form(){return b.form},get params(){return b.page.params}}),e=>T()[1]=e,()=>T()?.[1])}),l(e,n)},$$slots:{default:!0}}),e=>T()[0]=e,()=>T()?.[0])}),l(e,n)},L=e=>{let t=c(()=>b.constructors[0]);var n=r();S(a(n),()=>s(t),(e,t)=>{x(t(e,{get data(){return E()},get form(){return b.form},get params(){return b.page.params}}),e=>T()[0]=e,()=>T()?.[0])}),l(e,n)};t(F,e=>{b.constructors[1]?e(I):e(L,-1)});var R=o(F,2),z=e=>{var n=A(),r=d(n),i=e=>{var t=v();w(()=>C(t,s(M))),l(e,t)};t(r,e=>{s(k)&&e(i)}),h(n),l(e,n)};t(R,e=>{s(O)&&e(z)}),l(n,P),_()}var N=b(M),P=[()=>O(()=>import(`../nodes/0.D0tq1llq.js`),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url),()=>O(()=>import(`../nodes/1.swTsK2nI.js`),__vite__mapDeps([7,1,8,4,2]),import.meta.url),()=>O(()=>import(`../nodes/2.CDb1NwCd.js`),__vite__mapDeps([9,1,8,4,2,3,5,10,11]),import.meta.url),()=>O(()=>import(`../nodes/3.BNDSP7Fl.js`),__vite__mapDeps([12,1,8,4,2,3,10,13]),import.meta.url),()=>O(()=>import(`../nodes/4.Ctp3kMog.js`),__vite__mapDeps([14,1,8,4,2,10,11,13]),import.meta.url)],F=[],I={"/":[2],"/callback":[3],"/pair":[4]},L={handleError:(({error:e})=>{console.error(e)}),reroute:(()=>{}),transport:{}},R=Object.fromEntries(Object.entries(L.transport).map(([e,t])=>[e,t.decode])),z=Object.fromEntries(Object.entries(L.transport).map(([e,t])=>[e,t.encode])),B=!1,V=(e,t)=>R[e](t),H=()=>O(()=>import(`../chunks/Bjy-W4x2.js`).then(e=>e.default),[],import.meta.url);export{V as decode,R as decoders,I as dictionary,z as encoders,H as get_error_template,B as hash,L as hooks,k as matchers,P as nodes,N as root,F as server_loads};
@@ -0,0 +1 @@
1
+ import{n as e,s as t}from"../chunks/B4Yz9Vq2.js";export{t as load_css,e as start};
@@ -0,0 +1 @@
1
+ import{$ as e,B as t,E as n,G as r,T as i,at as a,et as o,it as s,mt as c,y as l}from"../chunks/Ci7cM3I3.js";import"../chunks/xihTtKlq.js";import{c as u,n as d,o as f,s as p}from"../chunks/ByDH6pMF.js";import{n as m,t as h}from"../chunks/D5i3nqbJ.js";var g=c({load:()=>_,prerender:()=>!0,ssr:()=>!1});async function _({fetch:e}){let t=await e(`/api/config`);if(!t.ok)throw Error(`Failed to load Sprocket runtime config.`);return await t.json()}function v(c,g){a(g,!0);let _=()=>o(f,`$convexAuthRetryVersion`,y),v=()=>o(d,`$authState`,y),[y,b]=e(),x=()=>g.data.env.PUBLIC_CONVEX_URL,S=m(x()||`https://invalid.invalid`,{disabled:!x(),unsavedChangesWarning:!1});h(()=>(_(),{isLoading:!v().isReady||v().isLoading,isAuthenticated:!!v().user,fetchAccessToken:p})),t(()=>{x()&&u(S)});var C=n();l(r(C),()=>g.children),i(c,C),s(),b()}export{v as component,g as universal};
@@ -0,0 +1 @@
1
+ import{D as e,G as t,K as n,T as r,W as i,at as a,dt as o,it as s,w as c,z as l}from"../chunks/Ci7cM3I3.js";import{a as u,r as d}from"../chunks/B4Yz9Vq2.js";import"../chunks/xihTtKlq.js";var f={get data(){return u.data},get error(){return u.error},get form(){return u.form},get params(){return u.params},get route(){return u.route},get state(){return u.state},get status(){return u.status},get url(){return u.url}};d.updated.check;var p=f,m=e(`<h1> </h1> <p> </p>`,1);function h(e,u){a(u,!0);var d=m(),f=t(d),h=i(f,!0);o(f);var g=n(f,2),_=i(g,!0);o(g),l(()=>{c(h,p.status),c(_,p.error?.message)}),r(e,d),s()}export{h as component};