mcard-studio 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/astro.config.mjs +6 -1
- package/bin/mcard-studio.mjs +1 -1
- package/dist/client/_astro/{ChartAnalyticsViewlet.Cevj0EOs.js → ChartAnalyticsViewlet.jrwIemvb.js} +1 -1
- package/dist/client/_astro/ClmPcardViewlet.C-fU7oZf.js +3 -0
- package/dist/client/_astro/D3GraphViewlet.BCZl0b2U.js +2 -0
- package/dist/client/_astro/DockviewSpatialWorkbench.B_I1GJHw.js +12 -0
- package/dist/client/_astro/{DocumentViewlets.Dm_GL3AL.js → DocumentViewlets.B53IqmpY.js} +1 -1
- package/dist/client/_astro/ExcalidrawWhiteboardViewlet.CFpPYSdn.js +1 -0
- package/dist/client/_astro/{FaroVCardSpanInstrumenter.BIk2NhJY.js → FaroVCardSpanInstrumenter.un8kDMWv.js} +1 -1
- package/dist/client/_astro/{FontSpecimenViewlet.CpONhJh0.js → FontSpecimenViewlet.D7Aw2xBZ.js} +1 -1
- package/dist/client/_astro/HeadMeta.astro_astro_type_script_index_0_lang.VDRYJCM-.js +1 -0
- package/dist/client/_astro/{ImageViewlet.CHeNvX6L.js → ImageViewlet.D4FN87n_.js} +1 -1
- package/dist/client/_astro/{KatexFormulaViewlet.Cy_InWOK.js → KatexFormulaViewlet.CzhdIOw8.js} +1 -1
- package/dist/client/_astro/KoishiChatViewlet.5mepQvLX.js +16 -0
- package/dist/client/_astro/MCardLibraryHarness.DE8KeghO.js +2 -0
- package/dist/client/_astro/{MarkdownViewlet.qoPlM-TZ.js → MarkdownViewlet.CRuuXXmF.js} +1 -1
- package/dist/client/_astro/{MermaidDiagramViewlet.RnwDfQl6.js → MermaidDiagramViewlet.eW6sk-rF.js} +1 -1
- package/dist/client/_astro/PCardRendererBridge.oxVKc0gN.js +1 -0
- package/dist/client/_astro/RendererPCardRegistry.CWjYZs2H.js +1 -0
- package/dist/client/_astro/{SchemaYamlViewlet.D6HVdmrq.js → SchemaYamlViewlet.ZJBvxItR.js} +1 -1
- package/dist/client/_astro/{ShellContainer.astro_astro_type_script_index_0_lang.2oi8fhQo.js → ShellContainer.astro_astro_type_script_index_0_lang.j_ELcN5d.js} +1 -1
- package/dist/client/_astro/{Spatial3dViewlet.CCYBSSib.js → Spatial3dViewlet.DnVMBENJ.js} +1 -1
- package/dist/client/_astro/StudioWorkbench.Blo5oSIw.js +7 -0
- package/dist/client/_astro/{SvgViewlet.BxlWQ-JX.js → SvgViewlet.BCje7Qqb.js} +1 -1
- package/dist/client/_astro/{TerminalView.DWZR-hUa.js → TerminalView.C_Ksz6lT.js} +4 -4
- package/dist/client/_astro/{ThemeSettingsViewlet.Cb1r8fWw.js → ThemeSettingsViewlet.DJpjQQ0Z.js} +1 -1
- package/dist/client/_astro/{TikzDiagramViewlet.CqY7VTeP.js → TikzDiagramViewlet.CXb1A8nf.js} +1 -1
- package/dist/client/_astro/{VideoPlayerViewlet.DoSYmmoQ.js → VideoPlayerViewlet.CmECt7yT.js} +1 -1
- package/dist/client/_astro/{WebappZenViewlet.CQW50OhX.js → WebappZenViewlet.whCmGVHR.js} +1 -1
- package/dist/client/_astro/{WelcomeViewport.LwKTA6h7.js → WelcomeViewport.BiYwLh6l.js} +1 -1
- package/dist/client/_astro/__vite-browser-external.CQZnr-r3.js +1 -0
- package/dist/client/_astro/{agentIdentityCredentialService.BtKVsl2C.js → agentIdentityCredentialService.UzMMwBwv.js} +5 -5
- package/dist/client/_astro/cardTypeDetector.Ci4APwhX.js +1 -0
- package/dist/client/_astro/disposable.Dsb0sbRP.js +1 -0
- package/dist/client/_astro/{markdownService.D-tM2RYx.js → markdownService.BgWjyJ57.js} +1 -1
- package/dist/client/_astro/{mcardStore.BiAvqM-D.js → mcardStore.CT-ollfl.js} +2 -2
- package/dist/client/_astro/mcardVfs.2UOw9Z-r.js +3 -0
- package/dist/client/_astro/polyfills._3wYPjZf.js +1 -0
- package/dist/client/_astro/rendererEventBus.DMH9afq9.js +1 -0
- package/dist/client/_astro/themeStore.CEt0e54l.js +1 -0
- package/dist/client/_astro/{tikzCompiler.DFojjdxR.js → tikzCompiler.fe3qomFY.js} +1 -1
- package/dist/client/_astro/{useMCardHydration.Co47OH3D.js → useMCardHydration.7Z-HfBh5.js} +1 -1
- package/dist/client/_astro/vendor-ai.D6NcJ6lu.js +69 -0
- package/dist/client/_astro/vendor-clm-kernel.Bvk3XHk2.js +116 -0
- package/dist/client/_astro/vfsHandles.IX_wTpw_.js +1 -0
- package/dist/client/_astro/vfsPersistence.BuhXYeSb.js +1 -0
- package/dist/client/_astro/vfsTransactions.C_IQQg0s.js +1 -0
- package/dist/client/_astro/{workspaceStore.CXakha4Y.js → workspaceStore.CD0kAVAl.js} +1 -1
- package/dist/client/js/buffer-polyfill.js +14 -0
- package/dist/server/chunks/{StudioLayout_D163irJ0.mjs → StudioLayout_B5ZnlqjF.mjs} +2 -2
- package/dist/server/chunks/{_.._ZXsz792-.mjs → _.._5gPhVOLM.mjs} +1 -1
- package/dist/server/chunks/{mcard-library_DvPPUs9_.mjs → mcard-library_7Wzoihkm.mjs} +1 -1
- package/dist/server/chunks/{ws-server-init_CkcgcI5V.mjs → ws-server-init_DUjuR2-o.mjs} +3 -3
- package/dist/server/entry.mjs +8 -4
- package/dist/server/entry2.mjs +3 -3
- package/dist/server/virtual_astro_middleware.mjs +1 -1
- package/package.json +1 -1
- package/public/js/buffer-polyfill.js +14 -0
- package/src/layouts/StudioLayout.astro +1 -0
- package/src/pages/index.astro +75 -0
- package/src/services/inBrowserLlm/engines/litertEngine.ts +1 -1
- package/dist/client/_astro/ClmPcardViewlet.DW5Yft0E.js +0 -3
- package/dist/client/_astro/D3GraphViewlet.DAjPz1DP.js +0 -2
- package/dist/client/_astro/DockviewSpatialWorkbench.DyQjSoHd.js +0 -12
- package/dist/client/_astro/ExcalidrawWhiteboardViewlet.DrlW7B6G.js +0 -1
- package/dist/client/_astro/HeadMeta.astro_astro_type_script_index_0_lang.DGXU-3Lu.js +0 -1
- package/dist/client/_astro/KoishiChatViewlet.B0eDEMnT.js +0 -16
- package/dist/client/_astro/MCardLibraryHarness.CUJLJFBt.js +0 -2
- package/dist/client/_astro/PCardRendererBridge.BnyaE05I.js +0 -1
- package/dist/client/_astro/RendererPCardRegistry.CLr4j1Ub.js +0 -1
- package/dist/client/_astro/StudioWorkbench.CF0SOYwy.js +0 -7
- package/dist/client/_astro/cardTypeDetector.C9kGObMh.js +0 -1
- package/dist/client/_astro/disposable.66apX1Q2.js +0 -1
- package/dist/client/_astro/empty.DOwCrGXH.js +0 -1
- package/dist/client/_astro/mcardVfs.Bj-RA0p7.js +0 -2
- package/dist/client/_astro/path.CR60mj9W.js +0 -1
- package/dist/client/_astro/polyfills.DcBkS56X.js +0 -1
- package/dist/client/_astro/rendererEventBus.CyFnSRLk.js +0 -1
- package/dist/client/_astro/themeStore.zUMFLo3Q.js +0 -1
- package/dist/client/_astro/vendor-ai.CZe7UVVK.js +0 -69
- package/dist/client/_astro/vfsHandles.B-nczBRy.js +0 -1
- package/dist/client/_astro/vfsPersistence.D6zRzVML.js +0 -1
- package/dist/client/_astro/vfsTransactions.04mkEHxD.js +0 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_astro/__vite-browser-external.CQZnr-r3.js","_astro/rolldown-runtime.Dd_uD5pT.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e,n as t,r as n}from"./rolldown-runtime.Dd_uD5pT.js";import{t as r}from"./preload-helper.oCYlU9a4.js";var i=Object.defineProperty,a=(e=>n===void 0?typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(n===void 0?e:n)[t]}):e:n)(function(e){if(n!==void 0)return n.apply(this,arguments);throw Error(`Dynamic require of "`+e+`" is not supported`)}),o=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},s=`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`,c={};for(let e=0;e<s.length;e++)c[s[e]]=e;function l(e){if(e.length===0)return``;let t=0;for(;t<e.length&&e[t]===0;)t++;let n=[];for(let r=t;r<e.length;r++){let t=e[r];for(let e=0;e<n.length;e++)t+=n[e]<<8,n[e]=t%58,t=t/58|0;for(;t>0;)n.push(t%58),t=t/58|0}let r=`1`.repeat(t);for(let e=n.length-1;e>=0;e--)r+=s[n[e]];return r}function u(e){if(!e)return new Uint8Array;let t=0;for(;t<e.length&&e[t]===`1`;)t++;let n=[];for(let r=t;r<e.length;r++){let t=e[r],i=c[t];if(i===void 0)throw Error(`Invalid Base58 character: ${t}`);let a=i;for(let e=0;e<n.length;e++)a+=n[e]*58,n[e]=a&255,a>>=8;for(;a>0;)n.push(a&255),a>>=8}let r=new Uint8Array(t+n.length);for(let e=0;e<t;e++)r[e]=0;for(let e=0;e<n.length;e++)r[t+e]=n[n.length-1-e];return r}function d(e){let t=``;for(let n=0;n<e.length;n++)t+=e[n].toString(16).padStart(2,`0`);return t}function f(e){let t=e.length%2==0?e:`0${e}`,n=t.length/2,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=parseInt(t.substring(e*2,e*2+2),16);return r}function p(e=32){try{if(typeof process<`u`&&process.versions&&process.versions.node)return a(`crypto`).randomBytes(e).toString(`hex`)}catch{}if(typeof globalThis<`u`&&globalThis.crypto&&globalThis.crypto.getRandomValues){let t=new Uint8Array(e);return globalThis.crypto.getRandomValues(t),d(t)}let t=``;for(let n=0;n<e*2;n++)t+=Math.floor(Math.random()*16).toString(16);return t}var m=new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32]),h=new Uint8Array([48,42,48,5,6,3,43,101,112,3,33,0]),g=new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,110,4,34,4,32]),_=new Uint8Array([48,42,48,5,6,3,43,101,110,3,33,0]);function v(e){return typeof Buffer<`u`&&typeof Buffer.from==`function`?Buffer.from(e.buffer,e.byteOffset,e.byteLength):e}var y=class{#e=[];#t=!1;add(e){if(this.#t)throw Error(`DisposableList: cannot add to an already-disposed list`);return this.#e.push(e),this}get length(){return this.#e.length}get disposed(){return this.#t}async dispose(){if(this.#t)return;this.#t=!0;let e=[];for(let t=this.#e.length-1;t>=0;t--)try{await this.#e[t]()}catch(t){e.push(t instanceof Error?t:Error(String(t)))}if(this.#e.length=0,e.length>0){let t=`DisposableList: ${e.length} disposer(s) failed:
|
|
3
|
+
${e.map(e=>e.message).join(`
|
|
4
|
+
`)}`;throw Error(t)}}disposeSync(){if(this.#t)return;this.#t=!0;let e=[];for(let t=this.#e.length-1;t>=0;t--)try{let n=this.#e[t]();n&&typeof n.then==`function`&&e.push(Error(`DisposableList.disposeSync: encountered async disposer`))}catch(t){e.push(t instanceof Error?t:Error(String(t)))}if(this.#e.length=0,e.length>0)throw Error(`DisposableList: ${e.length} disposer(s) failed`)}},b=class{#e=`idle`;#t;#n=new y;#r;constructor(e){this.#r=e}get state(){return this.#e}get disposables(){return this.#n}begin(e){if(this.#e!==`idle`)throw Error(`SavepointGuard: cannot begin from state "${this.#e}"`);this.#t=e,this.#e=`active`}commit(){if(this.#e!==`active`)throw Error(`SavepointGuard: cannot commit from state "${this.#e}"`);this.#e=`committed`,this.#t=void 0}async rollback(){if(this.#e!==`active`)throw Error(`SavepointGuard: cannot rollback from state "${this.#e}"`);this.#e=`rolled-back`,this.#r&&this.#t!==void 0&&await this.#r(this.#t),await this.#n.dispose(),this.#t=void 0}};function x(e){let t=typeof e==`string`?new TextEncoder().encode(e):e,n=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],r=1779033703,i=3144134277,a=1013904242,o=2773480762,s=1359893119,c=2600822924,l=528734635,u=1541459225,d=t.length,f=d*8,p=d+(d%64<56?56-d%64:120-d%64)+8,m=new Uint8Array(p);m.set(t),m[d]=128;let h=new DataView(m.buffer);h.setBigUint64(p-8,BigInt(f),!1);let g=new Uint32Array(64),_=(e,t)=>e>>>t|e<<32-t;for(let e=0;e<p;e+=64){for(let t=0;t<16;t++)g[t]=h.getUint32(e+t*4,!1);for(let e=16;e<64;e++){let t=_(g[e-15],7)^_(g[e-15],18)^g[e-15]>>>3,n=_(g[e-2],17)^_(g[e-2],19)^g[e-2]>>>10;g[e]=g[e-16]+t+g[e-7]+n|0}let t=r,d=i,f=a,p=o,m=s,v=c,y=l,b=u;for(let e=0;e<64;e++){let r=_(m,6)^_(m,11)^_(m,25),i=m&v^~m&y,a=b+r+i+n[e]+g[e]|0,o=(_(t,2)^_(t,13)^_(t,22))+(t&d^t&f^d&f)|0;b=y,y=v,v=m,m=p+a|0,p=f,f=d,d=t,t=a+o|0}r=r+t|0,i=i+d|0,a=a+f|0,o=o+p|0,s=s+m|0,c=c+v|0,l=l+y|0,u=u+b|0}let v=new Uint8Array(32),y=new DataView(v.buffer);return y.setUint32(0,r,!1),y.setUint32(4,i,!1),y.setUint32(8,a,!1),y.setUint32(12,o,!1),y.setUint32(16,s,!1),y.setUint32(20,c,!1),y.setUint32(24,l,!1),y.setUint32(28,u,!1),v}var S=class{constructor(e){this.algorithm=e,this.chunks=[]}update(e){return typeof e==`string`?this.chunks.push(new TextEncoder().encode(e)):e instanceof Uint8Array?this.chunks.push(e):ArrayBuffer.isView(e)&&this.chunks.push(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),this}digest(e){let t=0;for(let e of this.chunks)t+=e.length;let n=new Uint8Array(t),r=0;for(let e of this.chunks)n.set(e,r),r+=e.length;let i=x(n);return e===`hex`?Array.from(i).map(e=>e.toString(16).padStart(2,`0`)).join(``):typeof Buffer<`u`&&typeof Buffer.from==`function`?Buffer.from(i):i}};function C(e){return new S(e)}function w(e){if(typeof globalThis<`u`&&globalThis.crypto&&typeof globalThis.crypto.getRandomValues==`function`)return globalThis.crypto.getRandomValues(e);for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*256);return e}function T(e){let t=new Uint8Array(e);return w(t),typeof Buffer<`u`&&typeof Buffer.from==`function`?Buffer.from(t):t}typeof globalThis<`u`&&globalThis.crypto,v(h);var E=`blake3:`,D=`sha256:`,O=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],ee=[2,6,3,10,7,0,4,13,1,11,12,5,9,14,15,8],te=1,ne=2,re=4,ie=8,k=64,ae=1024;function oe(e,t){return(e>>>t|e<<32-t)>>>0}function se(e,t,n,r,i,a,o){e[t]=e[t]+e[n]+a>>>0,e[i]=oe(e[i]^e[t],16),e[r]=e[r]+e[i]>>>0,e[n]=oe(e[n]^e[r],12),e[t]=e[t]+e[n]+o>>>0,e[i]=oe(e[i]^e[t],8),e[r]=e[r]+e[i]>>>0,e[n]=oe(e[n]^e[r],7)}function ce(e,t){se(e,0,4,8,12,t[0],t[1]),se(e,1,5,9,13,t[2],t[3]),se(e,2,6,10,14,t[4],t[5]),se(e,3,7,11,15,t[6],t[7]),se(e,0,5,10,15,t[8],t[9]),se(e,1,6,11,12,t[10],t[11]),se(e,2,7,8,13,t[12],t[13]),se(e,3,4,9,14,t[14],t[15])}function le(e){let t=Array(16);for(let n=0;n<16;n++)t[n]=e[ee[n]];return t}function ue(e,t,n,r,i){let a=[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],O[0],O[1],O[2],O[3],n>>>0,0,r,i],o=t.slice();for(let e=0;e<7;e++)ce(a,o),o=le(o);for(let e=0;e<8;e++)a[e]=(a[e]^a[e+8])>>>0;for(let t=8;t<16;t++)a[t]=(a[t]^e[t-8])>>>0;return a}function de(e,t,n){let r=[];for(let i=0;i<n;i++){let n=t+i*4;r.push((e[n]|e[n+1]<<8|e[n+2]<<16|e[n+3]<<24)>>>0)}return r}function fe(e,t){let n=``;for(let r=0;r<t;r++){let t=e[r];for(let e=0;e<4;e++)n+=(t>>>e*8&255).toString(16).padStart(2,`0`)}return n}function pe(e){new Uint8Array(Math.max(k,Math.ceil(e.length/k)*k)).set(e);let t=Math.max(1,Math.ceil(e.length/ae));if(t===1){let t=Math.max(1,Math.ceil(e.length/k)),n=O.slice();for(let r=0;r<t;r++){let i=r*k,a=Math.min(k,Math.max(0,e.length-i)),o=new Uint8Array(k);a>0&&o.set(e.subarray(i,i+a));let s=de(o,0,16),c=0;if(r===0&&(c|=te),r===t-1)return c|=ne|ie,fe(ue(n,s,0,a>0?a:0,c),8);n=ue(n,s,0,k,c).slice(0,8)}}let n=[];for(let r=0;r<t;r++){let t=r*ae,i=Math.min(t+ae,e.length),a=i-t,o=Math.max(1,Math.ceil(a/k)),s=O.slice();for(let n=0;n<o;n++){let a=t+n*k,c=Math.min(k,Math.max(0,i-a)),l=new Uint8Array(k);c>0&&l.set(e.subarray(a,a+c));let u=de(l,0,16),d=0;n===0&&(d|=te),n===o-1&&(d|=ne),s=ue(s,u,r,c,d).slice(0,8)}n.push(s)}let r=n;for(;r.length>1;){let e=[];for(let t=0;t<r.length;t+=2)if(t+1<r.length){let n=Array(16).fill(0);for(let e=0;e<8;e++)n[e]=r[t][e];for(let e=0;e<8;e++)n[e+8]=r[t+1][e];let i=ue(O,n,0,k,re|(r.length<=2&&t===0?ie:0));e.push(i.slice(0,8))}else e.push(r[t]);r=e}return r.length===1?fe(r[0],8):fe(O,8)}function me(e){try{let e=globalThis.crypto;if(e&&`subtle`in e)throw Error(`Use async variant`)}catch{}try{let{createHash:t}=a(`crypto`);return t(`sha256`).update(e).digest(`hex`)}catch{throw Error(`SHA-256 requires Node.js crypto module or Web Crypto API`)}}var he=class{hash(e){return pe(e)}prefix(){return E}},ge=class{hash(e){return me(e)}prefix(){return D}},_e=new he;function ve(){return _e}var ye=/^[0-9a-f]{64}$/,A=class e{#e;constructor(e){this.#e=e,Object.freeze(this)}static fromHex(t){let n=t.toLowerCase();if(!ye.test(n))throw Error(`ContentHash: expected 64-char hex string, got "${t.slice(0,20)}..." (length ${t.length})`);return new e(n)}static fromPrefixed(t){let n=t.indexOf(`:`);return n===-1?e.fromHex(t):e.fromHex(t.slice(n+1))}static parse(t){return e.fromPrefixed(t)}static compute(t){let n=pe(t);return new e(n)}static computeString(t){return e.compute(new TextEncoder().encode(t))}asHex(){return this.#e}asPrefixed(){return`${ve().prefix()}${this.#e}`}equals(e){return this.#e===e.#e}toString(){return this.#e}toJSON(){return this.#e}},be=`did:`,xe=class e{#e;constructor(e){this.#e=e,Object.freeze(this)}static create(t){if(!t.startsWith(be))throw Error(`AgentDid: expected string starting with "did:", got "${t.slice(0,20)}"`);if(t.length<8)throw Error(`AgentDid: DID string too short: "${t}"`);return new e(t)}asString(){return this.#e}method(){return this.#e.split(`:`)[1]??``}equals(e){return this.#e===e.#e}toString(){return this.#e}toJSON(){return this.#e}},Se=class e{#e;constructor(e){this.#e=e,Object.freeze(this)}static create(t){if(t.length===0)throw Error(`Handle: cannot be empty`);return new e(t)}static parse(t){return e.create(t)}static fromPath(t){let n=t.replace(/\\/g,`/`).replace(/^\/+/,``).replace(/\/+$/,``);return new e(n.replace(/\//g,`:`))}asString(){return this.#e}toPath(){return this.#e.replace(/:/g,`/`)}name(){let e=this.#e.split(`:`);return e[e.length-1]??this.#e}equals(e){return this.#e===e.#e}toString(){return this.#e}toJSON(){return this.#e}};async function Ce(e,t,n){let r=e.requiredServices??[];if(r.length===0)return t;let i=e=>t[e]!==void 0||typeof t.get==`function`&&t.get(e)!==void 0,a=r.filter(e=>!i(e));if(a.length===0)return t;if(typeof t.inject!=`function`)throw Error(`Missing required Cordis services: ${a.join(`, `)}`);return new Promise((e,i)=>{let o;n!==void 0&&n>0&&(o=setTimeout(()=>{i(Error(`Timed out waiting for Cordis services: ${a.join(`, `)}`))},n));try{t.inject(r,t=>{o&&clearTimeout(o),e(t)})}catch(e){o&&clearTimeout(o),i(e)}})}var we=class{type=`primitive`;pcardType=`primitive`;mcard;constructor(e){this.mcard=e}evaluate(){return this.mcard}toJSON(){return{type:this.type,pcard_type:this.pcardType,mcard:this.mcard.toJSON()}}},Te=class e{type=`dynamic`;pcardType=`dynamic`;id;codeHash;sourceUri;coeffects;signature;constructor(e){this.id=e.id,this.codeHash=typeof e.codeHash==`string`?A.parse(e.codeHash):e.codeHash,this.sourceUri=e.sourceUri,this.coeffects=e.coeffects??{requiredServices:[]},this.signature=e.signature}clone(t={}){return new e({id:t.id??this.id,codeHash:t.codeHash??this.codeHash,sourceUri:t.sourceUri??this.sourceUri,coeffects:t.coeffects??this.coeffects,signature:t.signature??this.signature})}toJSON(){return{type:this.type,pcard_type:this.pcardType,id:this.id,code_hash:this.codeHash.toString(),source_uri:this.sourceUri,coeffects:this.coeffects,signature:this.signature}}},Ee=class{type=`boolean`;pcardType=`boolean`;id;phase;expression;targetPattern;coeffects;constructor(e){this.id=e.id,this.phase=e.phase,this.expression=e.expression,this.targetPattern=e.targetPattern??`*`,this.coeffects=e.coeffects??{requiredServices:[]}}isPrecondition(){return this.phase===`precondition`}isPostcondition(){return this.phase===`postcondition`}isLoopInvariant(){return this.phase===`loop_invariant`||this.phase===`loop-invariant`}toJSON(){return{type:this.type,pcard_type:this.pcardType,id:this.id,phase:this.phase,expression:this.expression,target_pattern:this.targetPattern,coeffects:this.coeffects}}};function De(e){return e&&typeof e==`object`&&`kind`in e&&typeof e.kind==`string`?e:typeof e==`string`?{kind:`text`,value:e}:e instanceof Uint8Array?{kind:`binary`,mimeType:`application/octet-stream`,data:e}:typeof e==`object`&&e?{kind:`structured`,value:e}:{kind:`scalar`,value:e}}var j=class e{uri;hash;payload;metadata;author;sequence;constructor(e,t,n,r,i,a){this.uri=e,this.hash=t,this.payload=n,this.metadata=r,this.author=i,this.sequence=a,Object.freeze(this)}static create(t,n,r,i,a=new Map){let o=De(n),s=ke(o),c=A.compute(s);return new e(t,c,o,a,r,i)}static withMetadata(t,n,r,i,a){let o=ke(n),s=A.compute(o);return new e(t,s,n,r,i,a)}static fromStorage(t,n,r,i,a,o){return new e(t,n,r,i,a,o)}asPrimitivePCard(){return new we(this)}getMetadata(e){return this.metadata.get(e)}get content(){return this.payload.kind===`text`?this.payload.value:this.payload.kind===`scalar`?String(this.payload.value):JSON.stringify(this.payload)}toJSON(){return{uri:this.uri,hash:this.hash.asHex(),payload:Ae(this.payload),metadata:Object.fromEntries(this.metadata),author:this.author.asString(),sequence:this.sequence}}static fromJSON(t){let n=String(t.uri||``),r=A.fromHex(String(t.hash||``)),i=je(t.payload),a=new Map(t.metadata&&typeof t.metadata==`object`?Object.entries(t.metadata):[]),o=String(t.author||`did:key:z6MkhaXgBZDvotDkL5257faiz48Z8x28qqwjp64guC54Po39`),s=xe.create(o),c=Number(t.sequence??0);return new e(n,r,i,a,s,c)}};function Oe(e){if(e==null)return`null`;if(typeof e==`boolean`||typeof e==`number`||typeof e==`string`)return JSON.stringify(e);if(Array.isArray(e))return`[`+e.map(Oe).join(`,`)+`]`;if(typeof e==`object`){let t=e;return`{`+Object.keys(t).sort().map(e=>`${JSON.stringify(e)}:${Oe(t[e])}`).join(`,`)+`}`}return JSON.stringify(e)}function ke(e){let t=Oe(Ae(e));return new TextEncoder().encode(t)}function Ae(e){switch(e.kind){case`scalar`:return{kind:`scalar`,value:e.value};case`text`:return{kind:`text`,value:e.value};case`satori`:return{kind:`satori`,value:e.value};case`binary`:return{kind:`binary`,mime_type:e.mimeType,data:Array.from(e.data)};case`structured`:return{kind:`structured`,value:e.value};case`executable`:return{kind:`executable`,value:e.value}}}function je(e){if(!e||typeof e!=`object`)return{kind:`scalar`,value:e};let t=e;switch(t.kind){case`scalar`:return{kind:`scalar`,value:t.value};case`text`:return{kind:`text`,value:String(t.value??``)};case`satori`:return{kind:`satori`,value:t.value};case`binary`:{let e=Array.isArray(t.data)?t.data:[];return{kind:`binary`,mimeType:String(t.mime_type||t.mimeType||`application/octet-stream`),data:new Uint8Array(e)}}case`structured`:return{kind:`structured`,value:t.value};case`executable`:return{kind:`executable`,value:t.value};default:return{kind:`structured`,value:e}}}function Me(e){return{kind:`text`,value:e}}function Ne(e){return{kind:`structured`,value:e}}function Pe(e,t){return{kind:`binary`,mimeType:e,data:t}}function Fe(){return function(){return{}}}var Ie=t({default:()=>Le}),Le={},Re=t({basename:()=>qe,default:()=>Ye,delimiter:()=>`:`,dirname:()=>Ke,extname:()=>Je,isAbsolute:()=>We,join:()=>M,normalize:()=>Ue,relative:()=>Ge,resolve:()=>He,sep:()=>`/`});function ze(e,t){for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];i===`.`?e.splice(r,1):i===`..`?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;)e.unshift(`..`);return e}var Be=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,Ve=function(e){return Be.exec(e).slice(1)};function He(){for(var e=``,t=!1,n=arguments.length-1;n>=-1&&!t;n--){var r=n>=0?arguments[n]:`/`;if(typeof r!=`string`)throw TypeError(`Arguments to path.resolve must be strings`);r&&(e=r+`/`+e,t=r.charAt(0)===`/`)}return e=ze(Xe(e.split(`/`),function(e){return!!e}),!t).join(`/`),(t?`/`:``)+e||`.`}function Ue(e){var t=We(e),n=Ze(e,-1)===`/`;return e=ze(Xe(e.split(`/`),function(e){return!!e}),!t).join(`/`),!e&&!t&&(e=`.`),e&&n&&(e+=`/`),(t?`/`:``)+e}function We(e){return e.charAt(0)===`/`}function M(){return Ue(Xe(Array.prototype.slice.call(arguments,0),function(e,t){if(typeof e!=`string`)throw TypeError(`Arguments to path.join must be strings`);return e}).join(`/`))}function Ge(e,t){e=He(e).substr(1),t=He(t).substr(1);function n(e){for(var t=0;t<e.length&&e[t]===``;t++);for(var n=e.length-1;n>=0&&e[n]===``;n--);return t>n?[]:e.slice(t,n-t+1)}for(var r=n(e.split(`/`)),i=n(t.split(`/`)),a=Math.min(r.length,i.length),o=a,s=0;s<a;s++)if(r[s]!==i[s]){o=s;break}for(var c=[],s=o;s<r.length;s++)c.push(`..`);return c=c.concat(i.slice(o)),c.join(`/`)}function Ke(e){var t=Ve(e),n=t[0],r=t[1];return!n&&!r?`.`:(r&&=r.substr(0,r.length-1),n+r)}function qe(e,t){var n=Ve(e)[2];return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n}function Je(e){return Ve(e)[3]}var Ye={extname:Je,basename:qe,dirname:Ke,sep:`/`,delimiter:`:`,relative:Ge,join:M,isAbsolute:We,normalize:Ue,resolve:He};function Xe(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r<e.length;r++)t(e[r],r,e)&&n.push(e[r]);return n}var Ze=`ab`.substr(-1)===`b`?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return t<0&&(t=e.length+t),e.substr(t,n)},Qe=class{#e=new Map;#t=new Map;put(e,t){let n=e.asHex();return!this.#e.has(n)&&(this.#e.set(n,t),!0)}get(e){return this.#e.get(e.asHex())}has(e){return this.#e.has(e.asHex())}list(){return Array.from(this.#e.values())}count(){return this.#e.size}registerHandle(e,t){let n=e.asString(),r=this.#t.get(n)??[];r.push(t.asHex()),this.#t.set(n,r)}resolveHandle(e){let t=this.#t.get(e.asString());if(!t||t.length===0)return;let n=t[t.length-1];if(n)return A.fromHex(n)}handleHistory(e){let t=this.#t.get(e.asString());return t?t.map(e=>A.fromHex(e)):[]}snapshot(){return{timestamp:Date.now(),cardCount:this.#e.size,cards:new Map(this.#e),handles:new Map(Array.from(this.#t.entries()).map(([e,t])=>[e,[...t]]))}}restore(e){let t=e;this.#e=new Map(t.cards),this.#t=new Map(Array.from(t.handles.entries()).map(([e,t])=>[e,[...t]]))}},$e=`LS0g4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQCi0tIE1DYXJkIFVuaWZpZWQgRGF0YWJhc2UgU2NoZW1hIOKAlCBUaGUgVW5pdmVyc2FsIE1vbmFkaWMgVHJpYWQKLS0g4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQCi0tCi0tIFNUQUJJTElUWSBXQVJOSU5HOiBUaGlzIHNjaGVtYSBpcyB0aGUgaW52YXJpYW50ICJzZWVkaW5nIG1ldGEtbGFuZ3VhZ2UiIGZvciBhbGwKLS0gRG9tYWluIFNwZWNpZmljIExhbmd1YWdlcyAoRFNMcykuIEl0IG11c3QgcmVtYWluIGFzIHN0YWJsZSBhcyBwb3NzaWJsZS4KLS0KLS0gVEhFIFVOSUZJQ0FUSU9OIFRIRVNJUzoKLS0gVGhpcyBkZXNpZ24gdW5pdGVzIHRocmVlIGRpc3RpbmN0IG5hbWVzcGFjZXMgaW50byBhIHNpbmdsZSByZWxhdGlvbmFsIG5ldHdvcmsKLS0gYnkgbGV2ZXJhZ2luZyB0aGUgcG93ZXIgb2YgY3J5cHRvZ3JhcGhpYyBoYXNoIGZ1bmN0aW9uczoKLS0gMS4gQ09OVEVOVCBTUEFDRSAoSW50cmluc2ljIElkZW50aXR5KTogQ29udGVudC1BZGRyZXNzYWJsZSBTdG9yYWdlIChDQVMpLgotLSAyLiBIQU5ETEUgU1BBQ0UgKFJlc2VydmVkIFdvcmRzKTogTWFwcGluZyBodW1hbiBsb2dpYyB0byBjb250ZW50IGhhc2hlcy4KLS0gMy4gVkVSU0lPTiBTUEFDRSAoVGVtcG9yYWwgRXZvbHV0aW9uKTogVHJhY2tpbmcgc3RhdGUgdHJhbnNpdGlvbnMgdmlhIGhhc2ggaGlzdG9yeS4KLS0KLS0gVFVSSU5HIE1BQ0hJTkUgQU5BTE9HWSAoVGhlIEluZmluaXRlbHkgTG9uZyBUYXBlKToKLS0gVGhlIGBjYXJkYCB0YWJsZSBzdG9yZXMgY29udGVudCBibG9icyB3aXRoIHVuaXF1ZSBpZGVudGl0aWVzLCBlbXVsYXRpbmcgdGhlCi0tICJJbmZpbml0ZWx5IExvbmcgVGFwZSIgb2YgdGhlIFR1cmluZyBNYWNoaW5lIGZvcm1hbGlzbS4gQnkgdXNpbmcgcmVsYXRpb25hbAotLSBxdWVyaWVzLCB0aGlzIHRhcGUgY2FuIGJlIGR5bmFtaWNhbGx5IGNvbnN0cnVjdGVkIGFuZCB0cmF2ZXJzZWQgZm9yIGRpZmZlcmVudAotLSBEU0xzLCBwcm92aWRpbmcgYSBmbGV4aWJsZSBzdWJzdHJhdGUgZm9yIHByYWN0aWNhbGx5IGFsbCBjb21wdXRhYmxlIGxhbmd1YWdlcy4KLS0KLS0gQnkgdXNpbmcgaGFzaCB2YWx1ZXMgYXMgdGhlIHVuaXZlcnNhbCBwcmltaXRpdmVzIGFjcm9zcyBjb250ZW50LCBoYW5kbGVzLCBhbmQKLS0gdGltZSwgd2UgY3JlYXRlIGEgIldvcmRsZXNzIEJvb2siIOKAlCBhIG1pbmltYWwgc3Vic3RyYXRlIGNhcGFibGUgb2Ygc2VlZGluZyBhbnkKLS0gZG9tYWluLXNwZWNpZmljIGtub3dsZWRnZSBzeXN0ZW0gd2l0aG91dCByZXF1aXJpbmcgc2NoZW1hIGNoYW5nZXMuCi0tCi0tIE1vbmFkaWMgTWFwcGluZyAoU2VlOiBNb25hZGljIEp1c3RpZmljYXRpb24gZm9yIFNjaGVtYSBEZXNpZ24ubWQpOgotLSAxLiBDYXJkICAgID0gTW9uYWQgKFBlcmNlcHRpb24vU3RhdGUvRXhwb25lbnQpIC0gSW50cmluc2ljIElkZW50aXR5Ci0tIDIuIEhhbmRsZSAgPSBSZWdpc3RyeSAoQXBwZXRpdGlvbi9SZWFkZXIvU3VtKSAtIE11dGFibGUgUmVmZXJlbmNlCi0tIDMuIFZlcnNpb24gPSBIaXN0b3J5IChIYXJtb255L1dyaXRlci9Qcm9kdWN0KSAtIENvb3JkaW5hdGVkIEV2b2x1dGlvbgotLQotLSDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZAKLS0gVEhFIFRSSUFEOiB0aHJlZSB0YWJsZXMsIHRocmVlIGNvbHVtbnMgZWFjaCAoSU5WLVRBUEUtMDEpCi0tIOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkAotLSBUaGlzIGZpbGUgZGVjbGFyZXMgRVhBQ1RMWSBUSFJFRSBUQUJMRVMsIGVhY2ggd2l0aCBFWEFDVExZIFRIUkVFIENPTFVNTlMuIEV2ZXJ5Ci0tIHRhcGUgaW4gdGhlIG9wZXJhdGluZyBzeXN0ZW0g4oCUIGNvbnRlbnRfbWVtb3J5LmRiLCBhZ2VudF9pZGVudGl0aWVzLmRiLAotLSBleGVjdXRpb25fbG9nLmRiLCBhbmQgYW55IGZ1dHVyZSBtZXNoIHRhcGUg4oCUIGRlcGxveXMgdGhpcyBpZGVudGljYWwgZGVjbGFyYXRpb24uCi0tIFplcm8gY3VzdG9tIHRhYmxlcyBhbmQgemVybyBhdXhpbGlhcnkgY29sdW1ucyBhcmUgcGVybWl0dGVkLgotLQotLSBUSEUgS0lORCBJUyBOT1QgQSBDT0xVTU4gKElOVi1UQVBFLTAxYSwgSU5WLVRBUEUtMDMpOgotLSBgY2FyZGAgc3RvcmVzIG5vIHR5cGUgZGlzY3JpbWluYXRvci4gV2hhdCBhIGNhcmQgKmlzKiDigJQgY29udGVudCwgcHJvZ3JhbSwKLS0gdmVyaWZpY2F0aW9uLCBpZGVudGl0eSwgdGVsZW1ldHJ5IOKAlCBpcyBuYW1lZCBieSBpdHMgaGFuZGxlIGluIGBoYW5kbGVfcmVnaXN0cnlgLAotLSBhbmQgaXMgREVDSURFRCBCWSBgY2xtLWtlcm5lbGAgdGhyb3VnaCBhIHNpbmdsZSBga2luZE9mKGhhbmRsZSlgLiBBIHN0b3JlZCBraW5kCi0tIGlzIGEgc2Vjb25kIGRlY2xhcmF0aW9uIG9mIHdoYXQgdGhlIGhhbmRsZSBhbHJlYWR5IHNheXM7IGEgcmUtZGVyaXZlZCBraW5kIGlzCi0tIHRoZSBzYW1lIGRlZmVjdCBleHByZXNzZWQgYXMgY29kZS4KLS0KLS0gICB1cm46bWNhcmQ6bWNhcmQ6KiAgICAgIGNvbnRlbnQgICAgICAgIHVybjptY2FyZDphZ2VudDoqICAgICAgIGlkZW50aXR5Ci0tICAgdXJuOm1jYXJkOnBjYXJkOiogICAgICBwcm9ncmFtICAgICAgICB1cm46bWNhcmQ6bm9kZToqICAgICAgICBtZXNoIG5vZGUKLS0gICB1cm46bWNhcmQ6ZG9jOiogICAgICAgIGRvY3VtZW50ICAgICAgIHVybjptY2FyZDprZXk6KiAgICAgICAgIGtleSBtYXRlcmlhbAotLSAgIHVybjptY2FyZDp2Y2FyZDoqICAgICAgdmVyaWZpY2F0aW9uICAgdXJuOm1jYXJkOmV4ZWN1dGlvbjoqICAgZXhlY3V0aW9uIHJlY29yZAotLSAgIHVybjptY2FyZDp0ZWxlbWV0cnk6KiAgZXZlbnQgICAgICAgICAgdXJuOm1jYXJkOm1jYXJkOmxpZmVjeWNsZToqICBsaWZlY3ljbGUgc2lkZWNhcgotLQotLSBMSUZFQ1lDTEUgSVMgRVhURVJOQUwgKElOVi1UQVBFLTA0KToKLS0gYGhhbmRsZV9oaXN0b3J5YCByZWNvcmRzIG9ubHkgVEhBVCBhIGhhbmRsZSBtb3ZlZCwgZnJvbSB3aGF0IGhhc2gsIGFuZCB3aGVuLgotLSBUb21ic3RvbmVzLCBrZXkgcm90YXRpb25zLCBzZWFscyBhbmQgdGhlaXIgcmVhc29ucyBhcmUgTk9UIGNvbHVtbnMgaGVyZTogdGhleQotLSBsaXZlIGluIGEgc2VwYXJhdGUgTElGRUNZQ0xFIFNJREVDQVIg4oCUIGEgdGVtcG9yYXJ5IGRhdGFiYXNlLCBjcmVhdGVkIG9uIGRlbWFuZCwKLS0gd2hpY2ggaXRzZWxmIGRlcGxveXMgdGhpcyBzYW1lIGRlY2xhcmF0aW9uIGFuZCBpcyByZWdpc3RlcmVkIGFzIE9ORSBDQVJEIGluIHRoZQotLSB0YXBlIGl0IGRlc2NyaWJlcyAoSU5WLVRBUEUtMDYpLiBBIHJldGlyZW1lbnQgaXMgdGhlcmVmb3JlIHR3byB3cml0ZXM6IHRoZSBmYWN0Ci0tIGhlcmUsIHRoZSBkZXRhaWwgdGhlcmUuIFRoZSBjYXJkIGlzIG5ldmVyIGRlbGV0ZWQuCi0tCi0tIE5FU1RFRCBUQVBFUyBBUkUgQ0FSRFMgKElOVi1UQVBFLTA2KToKLS0gRXZlcnkgZGF0YWJhc2UgdXNlZCBhcyBhIGNvbnRhaW5lciDigJQgYSBsaWZlY3ljbGUgc2lkZWNhciwgYSBjb2xsZWN0aW9uLCBhCi0tIHBhY2thZ2VkIGRlcGxveW1lbnQgdW5pdCAoYCoubWNhcmQuZGJgKSDigJQgaXMgaXRzZWxmIG9uZSBNQ2FyZCBpbiBpdHMgcGFyZW50IHRhcGU6Ci0tIGhhc2ggPSBTSEEyNTYoZmlsZSBieXRlcyksIHJlZ2lzdGVyZWQgdW5kZXIgYSBoYW5kbGUsIHdpdGggdGhpcyBzYW1lIHNjaGVtYQotLSBpbnNpZGUuIFRoZSBhcmNoaXRlY3R1cmUgaXMgZnJhY3RhbDogZXh0cmEgc3RydWN0dXJlIGlzIG5ldmVyIGEgbmV3IHRhYmxlLCBpdCBpcwotLSBhbm90aGVyIHRhcGUsIGFuZCBhIHRhcGUgaXMgb25lIGNhcmQuCi0tCi0tIFRIRSBNRVRBLUNJUkNVTEFSIEVWQUxVQVRPUiAmIEVPQS9DQSBEVUFMSVRZOgotLSBVbmRlciB0aGUgUEtDIGFyY2hpdGVjdHVyZSwgdGhpcyB2ZXJ5IGZpbGUgKGBtY2FyZF9zY2hlbWEuc3FsYCkgbXVzdCBiZQotLSBpbmdlc3RlZCBhbmQgc3RvcmVkIGFzIGFuIE1DYXJkIGV4YWN0bHkgbGlrZSBhbnkgb3RoZXIgQ0xNIGR1cmluZyB0aGUgaW50ZXJuYWwKLS0gYm9vdHN0cmFwcGluZyBwaGFzZS4gVGhpcyBndWFyYW50ZWVzIHRoYXQgdGhlIHNjaGVtYSBwb3dlcmluZyB0aGUgZGF0YWJhc2UKLS0gaXMgaXRzZWxmIGNvbnRlbnQtYWRkcmVzc2VkIGFuZCBjcnlwdG9ncmFwaGljYWxseSB2ZXJpZmlhYmxlLgotLSBGdXJ0aGVybW9yZSwgYWxsIHN0YXRlIGNoYW5nZXMgbWFwcGVkIHZpYSBoYW5kbGVzIGFuZCB2ZXJzaW9ucyBhcmUgc3RyaWN0bHkKLS0gZ292ZXJuZWQgYnkgdGhlIFNhbmR3aWNoZWQgUENhcmQgZXhlY3V0aW9uIHBhdHRlcm4gKGBWX3ByZSAtPiBCb2R5IC0+IFZfcG9zdGApLAotLSBzdHJpY3RseSBpbml0aWF0ZWQgYnkgYW4gRXh0ZXJuYWxseSBPd25lZCBBZ2VudCAoRU9BKSBwb3NzZXNzaW5nIHRydWUgdm9saXRpb24sCi0tIGFuZCBldmFsdWF0ZWQgZGV0ZXJtaW5pc3RpY2FsbHkgYnkgYSBDb250cmFjdCBBZ2VudCAoQ0EpIGJvdW5kIHRvIGEgUENhcmQgaGFzaC4KLS0KLS0gVmVyc2lvbjogNC4wLjAgKFRoZSBVbml2ZXJzYWwgTW9uYWRpYyBUcmlhZCDigJQgdGhyZWUgdGFibGVzLCB0aHJlZSBjb2x1bW5zKQotLSBMYXN0IFVwZGF0ZWQ6IDIwMjYtMTAtMDgKLS0g4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQCgoKLS0g4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQCi0tIExBWUVSIDE6IENPUkUgQ09OVEVOVC1BRERSRVNTQUJMRSBTVE9SQUdFIChUaGUgTW9uYWQgLyBFeHBvbmVudCkKLS0g4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQCi0tIFRoZSBmdW5kYW1lbnRhbCBNQ2FyZCBzdG9yYWdlOiBjb250ZW50LWFkZHJlc3NlZCBieSBjcnlwdG9ncmFwaGljIGhhc2guCi0tICJFYWNoIE1vbmFkIC4uLiBtaXJyb3JzIHRoZSB1bml2ZXJzZSIKLS0gSWRlbnRpdHkgSVMgdGhlIGNvbnRlbnQ6IGlkZW50aWNhbCBieXRlcyBhcmUgdGhlIHNhbWUgY2FyZCwgaW4gZXZlcnkgdGFwZS4KCi0tIEB0YWJsZSBjYXJkCi0tIEByb2xlIGNvcmUKLS0gQGRlc2NyaXB0aW9uIENvcmUgY29udGVudC1hZGRyZXNzYWJsZSBzdG9yYWdlIHRhYmxlIChNb25hZC9TdGF0ZSkKLS0gQGNvbHVtbiBoYXNoICAgIC0gU0hBLTI1NiBoYXNoIG9mIGNvbnRlbnQgKHByaW1hcnkga2V5KQotLSBAY29sdW1uIGNvbnRlbnQgLSBUaGUgYWN0dWFsIGNvbnRlbnQgKEJMT0IgZm9yIGJpbmFyeSBzYWZldHkpCi0tIEBjb2x1bW4gZ190aW1lICAtIEdlbmVyYXRpb24gdGltZXN0YW1wIChJU08gODYwMSkKLS0gQG5vdGUgTm8gdHlwZSBjb2x1bW46IHRoZSBoYW5kbGUgbmFtZXMgdGhlIGtpbmQgYW5kIGBjbG0ta2VybmVsYCBkZWNpZGVzIGl0LgpDUkVBVEUgVEFCTEUgSUYgTk9UIEVYSVNUUyBjYXJkICgKICAgIGhhc2ggVEVYVCBQUklNQVJZIEtFWSwKICAgIGNvbnRlbnQgQkxPQiBOT1QgTlVMTCwKICAgIGdfdGltZSBURVhUIE5PVCBOVUxMCik7CgoKLS0g4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQCi0tIExBWUVSIDI6IEhBTkRMRSBTWVNURU0gKEFwcGV0aXRpb24gLyBTdW0pCi0tIOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkAotLSBUaGUgbXV0YWJsZSBwb2ludGVyIHRoYXQgImRlc2lyZXMiIHRvIHJlZmVyZW5jZSBuZXcgY29udGVudC4KLS0gIkFwcGV0aXRpb246IHRoZSB0ZW5kZW5jeSB0byBtb3ZlIHRvIG5ldyBzdGF0ZXMiCgotLSBAdGFibGUgaGFuZGxlX3JlZ2lzdHJ5IChNb25hZGljIFJvbGU6IEhhbmRsZSkKLS0gQHJvbGUgY29yZQotLSBAZGVzY3JpcHRpb24gTWFwcyBoYW5kbGVzIHRvIHRoZWlyIGN1cnJlbnQgY29udGVudCBoYXNoLiBUaGUgaGFuZGxlIElTIHRoZQotLSAgICAgICAgICAgICAgbmFtZXNwYWNlOiBhbGwgdHlwaW5nLCByb2xlIGFuZCBzZWN0b3IgZGlmZmVyZW50aWF0aW9uIGxpdmVzIGhlcmUuCi0tIEBjb2x1bW4gaGFuZGxlICAgICAgIC0gVVRGLTggaGFuZGxlIG5hbWUgKHByaW1hcnkga2V5KSwgZS5nLiB1cm46bWNhcmQ6cGNhcmQ6Li4uCi0tIEBjb2x1bW4gY3VycmVudF9oYXNoIC0gRksgdG8gY2FyZC5oYXNoIG9mIHRoZSBjdXJyZW50IHZlcnNpb24KLS0gQGNvbHVtbiB1cGRhdGVkX2F0ICAgLSBXaGVuIHRoZSBoYW5kbGUgd2FzIGxhc3QgYm91bmQKLS0gQG5vdGUgQ3JlYXRpb24gdGltZSBpcyB0aGUgZmlyc3QgYGhhbmRsZV9oaXN0b3J5YCByb3cgZm9yIHRoaXMgaGFuZGxlIOKAlCBhCi0tICAgICAgIHNlY29uZCBjb3B5IG9mIGEgcmVjb3JkZWQgZmFjdCBpcyBub3Qgc3RvcmVkLgpDUkVBVEUgVEFCTEUgSUYgTk9UIEVYSVNUUyBoYW5kbGVfcmVnaXN0cnkgKAogICAgaGFuZGxlIFRFWFQgUFJJTUFSWSBLRVksCiAgICBjdXJyZW50X2hhc2ggVEVYVCBOT1QgTlVMTCwKICAgIHVwZGF0ZWRfYXQgVEVYVCBOT1QgTlVMTCwKICAgIEZPUkVJR04gS0VZIChjdXJyZW50X2hhc2gpIFJFRkVSRU5DRVMgY2FyZChoYXNoKQopOwoKLS0gQGluZGV4IGlkeF9oYW5kbGVfY3VycmVudF9oYXNoCi0tIEBkZXNjcmlwdGlvbiBFZmZpY2llbnQgcmV2ZXJzZSBsb29rdXAgZnJvbSBoYXNoIHRvIGhhbmRsZXMKQ1JFQVRFIElOREVYIElGIE5PVCBFWElTVFMgaWR4X2hhbmRsZV9jdXJyZW50X2hhc2gKT04gaGFuZGxlX3JlZ2lzdHJ5KGN1cnJlbnRfaGFzaCk7CgoKLS0g4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQCi0tIExBWUVSIDM6IFZFUlNJT04gU1BBQ0UgKEhhcm1vbnkgLyBXcml0ZXIgLyBQcm9kdWN0KQotLSDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZDilZAKCi0tIEB0YWJsZSBoYW5kbGVfaGlzdG9yeSAoTW9uYWRpYyBSb2xlOiBWZXJzaW9uIC8gUHJvZHVjdCkKLS0gQHJvbGUgY29yZQotLSBAZGVzY3JpcHRpb24gQXBwZW5kLW9ubHkgYXVkaXQgdHJhaWwgb2YgaGFuZGxlIHBvaW50ZXIgbW92ZW1lbnRzLgotLSBAY29sdW1uIGhhbmRsZSAgICAgICAgLSBUaGUgaGFuZGxlIHRoYXQgd2FzIHVwZGF0ZWQKLS0gQGNvbHVtbiBwcmV2aW91c19oYXNoIC0gSGFzaCBpdCBwb2ludGVkIHRvIGJlZm9yZSB0aGUgdXBkYXRlCi0tIEBjb2x1bW4gY2hhbmdlZF9hdCAgICAtIFdoZW4gdGhlIGNoYW5nZSBvY2N1cnJlZAotLSBAbm90ZSBUaGUgc3Vycm9nYXRlIGtleSBpcyBTUUxpdGUncyBpbXBsaWNpdCBgcm93aWRgOyBhIGRlY2xhcmVkIEFVVE9JTkNSRU1FTlQKLS0gICAgICAgY29sdW1uIHdvdWxkIGR1cGxpY2F0ZSBpdC4gVGhlIEtJTkQgb2YgY2hhbmdlIGlzIG5vdCBhIGNvbHVtbjogc2VlIHRoZQotLSAgICAgICBsaWZlY3ljbGUgc2lkZWNhciAoSU5WLVRBUEUtMDQpLgpDUkVBVEUgVEFCTEUgSUYgTk9UIEVYSVNUUyBoYW5kbGVfaGlzdG9yeSAoCiAgICBoYW5kbGUgVEVYVCBOT1QgTlVMTCwKICAgIHByZXZpb3VzX2hhc2ggVEVYVCBOT1QgTlVMTCwKICAgIGNoYW5nZWRfYXQgVEVYVCBOT1QgTlVMTCwKICAgIEZPUkVJR04gS0VZIChoYW5kbGUpIFJFRkVSRU5DRVMgaGFuZGxlX3JlZ2lzdHJ5KGhhbmRsZSksCiAgICBGT1JFSUdOIEtFWSAocHJldmlvdXNfaGFzaCkgUkVGRVJFTkNFUyBjYXJkKGhhc2gpCik7CgotLSBAaW5kZXggaWR4X2hhbmRsZV9oaXN0b3J5X2hhbmRsZQotLSBAZGVzY3JpcHRpb24gRWZmaWNpZW50IGxvb2t1cCBvZiBoaXN0b3J5IGJ5IGhhbmRsZQpDUkVBVEUgSU5ERVggSUYgTk9UIEVYSVNUUyBpZHhfaGFuZGxlX2hpc3RvcnlfaGFuZGxlCk9OIGhhbmRsZV9oaXN0b3J5KGhhbmRsZSk7Cg==`;function et(e){try{let t=[e?M(e,`types`,`schemas`,`mcard_schema.sql`):null,He(process.cwd(),`types`,`schemas`,`mcard_schema.sql`),He(`/`,`../../../../types/schemas/mcard_schema.sql`),He(`/`,`../../../../../types/schemas/mcard_schema.sql`)].filter(e=>!!e);for(let e of t)if((void 0)(e))return(void 0)(e,`utf-8`)}catch{}return Buffer.from($e,`base64`).toString(`utf-8`)}et();function tt(){try{return Fe(import.meta.url?import.meta.url:`file:///index.js`)(`node:sqlite`)}catch(e){throw Error(`node:sqlite is only available in Node.js v22+ environments: ${e}`)}}var nt=class{#e;#t=0;constructor(e=`:memory:`){let{DatabaseSync:t}=tt();if(typeof e==`object`&&e&&`prepare`in e&&`exec`in e)this.#e=e;else{let n=typeof e==`string`?e:e.path??`:memory:`,r=typeof e==`object`&&!!e.readOnly;this.#e=new t(n,{readOnly:r})}this.#n()}#n(){let e=et();this.#e.exec(e);try{this.#e.exec(`
|
|
5
|
+
PRAGMA journal_mode = WAL;
|
|
6
|
+
PRAGMA synchronous = NORMAL;
|
|
7
|
+
`)}catch{}}put(e,t){let n=e.asHex();if(this.#e.prepare(`SELECT hash FROM card WHERE hash = ?`).get(n))return!1;let r=JSON.stringify(t.toJSON()),i=Buffer.from(r,`utf-8`),a=new Date().toISOString();return this.#e.prepare(`INSERT INTO card (hash, content, g_time) VALUES (?, ?, ?)`).run(n,i,a),!0}get(e){let t=this.#e.prepare(`SELECT content FROM card WHERE hash = ?`).get(e.asHex());if(!t)return;let n=typeof t.content==`string`?t.content:Buffer.from(t.content).toString(`utf-8`);return j.fromJSON(JSON.parse(n))}has(e){return!!this.#e.prepare(`SELECT 1 FROM card WHERE hash = ?`).get(e.asHex())}list(){return this.#e.prepare(`SELECT content FROM card`).all().map(e=>{let t=typeof e.content==`string`?e.content:Buffer.from(e.content).toString(`utf-8`);return j.fromJSON(JSON.parse(t))})}count(){return this.#e.prepare(`SELECT COUNT(*) as count FROM card`).get().count}putRaw(e,t,n){if(this.#e.prepare(`SELECT hash FROM card WHERE hash = ?`).get(e))return!1;let r=typeof t==`string`?Buffer.from(t,`utf-8`):t,i=n??new Date().toISOString();return this.#e.prepare(`INSERT INTO card (hash, content, g_time) VALUES (?, ?, ?)`).run(e,r,i),!0}getRaw(e){let t=this.#e.prepare(`SELECT content, g_time FROM card WHERE hash = ?`).get(e);if(t)return{content:typeof t.content==`string`?t.content:Buffer.from(t.content).toString(`utf-8`),g_time:t.g_time}}registerHandle(e,t){let n=typeof e==`string`?e:e.asString(),r=typeof t==`string`?t:t.asHex(),i=new Date().toISOString(),a=this.#e.prepare(`SELECT current_hash FROM handle_registry WHERE handle = ?`).get(n);a?a.current_hash!==r&&(this.#e.prepare(`
|
|
8
|
+
INSERT INTO handle_history (handle, previous_hash, changed_at)
|
|
9
|
+
VALUES (?, ?, ?)
|
|
10
|
+
`).run(n,a.current_hash,i),this.#e.prepare(`
|
|
11
|
+
UPDATE handle_registry
|
|
12
|
+
SET current_hash = ?, updated_at = ?
|
|
13
|
+
WHERE handle = ?
|
|
14
|
+
`).run(r,i,n)):this.#e.prepare(`
|
|
15
|
+
INSERT INTO handle_registry (handle, current_hash, updated_at)
|
|
16
|
+
VALUES (?, ?, ?)
|
|
17
|
+
`).run(n,r,i)}resolveHandle(e){let t=typeof e==`string`?e:e.asString(),n=this.#e.prepare(`SELECT current_hash FROM handle_registry WHERE handle = ?`).get(t);if(n)return A.parse(n.current_hash)}handleHistory(e){let t=typeof e==`string`?e:e.asString(),n=this.#e.prepare(`SELECT previous_hash FROM handle_history WHERE handle = ? ORDER BY rowid ASC`).all(t).map(e=>A.parse(e.previous_hash)),r=this.resolveHandle(t);return r&&!n.some(e=>e.asHex()===r.asHex())&&n.push(r),n}snapshot(){this.#t+=1;let e=`sp_${this.#t}_${Date.now()}`;return this.#e.exec(`SAVEPOINT ${e};`),{timestamp:Date.now(),cardCount:this.count(),savepointName:e}}restore(e){let t=e;t.savepointName&&(this.#e.exec(`ROLLBACK TO SAVEPOINT ${t.savepointName};`),this.#e.exec(`RELEASE SAVEPOINT ${t.savepointName};`))}close(){this.#e.close()}},rt=class{#e;#t=0;constructor(e){this.#e=e,this.#n()}#n(){let e=et();try{this.#e.run(e)}catch{let t=e.split(`;`).map(e=>e.trim()).filter(e=>e.length>0);for(let e of t)try{this.#e.run(e)}catch{}}}put(e,t){let n=e.asHex(),r=this.#e.exec(`SELECT hash FROM card WHERE hash = ?`,[n])[0];if(r&&r.values.length>0)return!1;let i=JSON.stringify(t.toJSON()),a=new Date().toISOString();return this.#e.run(`INSERT INTO card (hash, content, g_time) VALUES (?, ?, ?)`,[n,i,a]),!0}get(e){let t=this.#e.exec(`SELECT content FROM card WHERE hash = ?`,[e.asHex()])[0];if(!t||t.values.length===0)return;let n=t.values[0];if(!n||n[0]===void 0||n[0]===null)return;let r=n[0],i=typeof r==`string`?r:new TextDecoder(`utf-8`).decode(r);return j.fromJSON(JSON.parse(i))}has(e){let t=this.#e.exec(`SELECT 1 FROM card WHERE hash = ?`,[e.asHex()])[0];return!!(t&&t.values.length>0)}list(){let e=this.#e.exec(`SELECT content FROM card`)[0];return e?e.values.map(e=>{let t=e[0],n=typeof t==`string`?t:new TextDecoder(`utf-8`).decode(t);return j.fromJSON(JSON.parse(n))}):[]}count(){let e=this.#e.exec(`SELECT COUNT(*) FROM card`)[0];if(!e||e.values.length===0)return 0;let t=e.values[0]?.[0];return typeof t==`number`?t:0}registerHandle(e,t){let n=e.asString(),r=t.asHex(),i=new Date().toISOString(),a=this.#e.exec(`SELECT current_hash FROM handle_registry WHERE handle = ?`,[n])[0];if(a&&a.values.length>0){let e=String(a.values[0][0]);e!==r&&(this.#e.run(`INSERT INTO handle_history (handle, previous_hash, changed_at) VALUES (?, ?, ?)`,[n,e,i]),this.#e.run(`UPDATE handle_registry SET current_hash = ?, updated_at = ? WHERE handle = ?`,[r,i,n]))}else this.#e.run(`INSERT INTO handle_registry (handle, current_hash, updated_at) VALUES (?, ?, ?)`,[n,r,i])}resolveHandle(e){let t=this.#e.exec(`SELECT current_hash FROM handle_registry WHERE handle = ?`,[e.asString()])[0];if(!t||t.values.length===0)return;let n=t.values[0]?.[0];if(typeof n==`string`)return A.parse(n)}handleHistory(e){let t=this.#e.exec(`SELECT previous_hash FROM handle_history WHERE handle = ? ORDER BY rowid ASC`,[e.asString()])[0],n=[];if(t)for(let e of t.values)typeof e[0]==`string`&&n.push(A.parse(e[0]));let r=this.resolveHandle(e);return r&&!n.some(e=>e.asHex()===r.asHex())&&n.push(r),n}snapshot(){this.#t+=1;let e=`sp_${this.#t}_${Date.now()}`;try{return this.#e.run(`SAVEPOINT ${e};`),{timestamp:Date.now(),cardCount:this.count(),savepointName:e}}catch{let e=this.#e.export?this.#e.export():void 0;return{timestamp:Date.now(),cardCount:this.count(),exportedData:e}}}restore(e){let t=e;t.savepointName&&(this.#e.run(`ROLLBACK TO SAVEPOINT ${t.savepointName};`),this.#e.run(`RELEASE SAVEPOINT ${t.savepointName};`))}exportBinary(){return this.#e.export?this.#e.export():void 0}close(){this.#e.close&&this.#e.close()}};function it(e){let t=e.trim();if(!t)return{};if(t.startsWith(`{`)&&t.endsWith(`}`))try{return JSON.parse(t)}catch{}return st(e)}function at(e){let t=!1,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(i===`'`&&!n)t&&e[r+1]===`'`?r++:t=!t;else if(i===`"`&&!t)i===`"`&&(r===0||e[r-1]!==`\\`)&&(n=!n);else if(i===`#`&&!t&&!n&&(r===0||/\s/.test(e[r-1])))return e.slice(0,r)}return e}function ot(e,t){if(t===`'`){let t=!1;for(let n=1;n<e.length;n++)e[n]===`'`&&(e[n+1]===`'`?n++:t=!0);return t}if(t===`"`){let t=!1;for(let n=1;n<e.length;n++)e[n]===`"`&&e[n-1]!==`\\`&&(t=!0);return t}return!0}function st(e){let t=e.split(/\r?\n/),n={},r=[{indent:-1,container:n}];for(let e=0;e<t.length;e++){let n=t[e],i=at(n);if(!i.trim())continue;let a=n.search(/\S/),o=i.trim();for(;r.length>1&&r[r.length-1].indent>=a;)r.pop();let s=r[r.length-1];if(o.startsWith(`- `)){let n=o.slice(2).trim(),i;if(Array.isArray(s.container))i=s.container;else{i=[];let e=r.length>1?r[r.length-2]:null;e&&s.key&&!Array.isArray(e.container)?e.container[s.key]=i:s.key&&(s.container[s.key]=i),s.container=i}if(n.includes(`: `)&&!n.startsWith(`"`)&&!n.startsWith(`'`)){let o={};i.push(o);let s=n.indexOf(`: `),c=n.slice(0,s).trim(),l=n.slice(s+2).trim();if(l.startsWith(`'`)&&!ot(l,`'`)||l.startsWith(`"`)&&!ot(l,`"`)){let n=l[0],r=!1;for(;e+1<t.length;){e++;let i=t[e],o=at(i);if(!o.trim()){r=!0;continue}if(i.search(/\S/)<=a){e--;break}if(l+=(r?`
|
|
18
|
+
`:` `)+o.trim(),r=!1,ot(l,n))break}}o[c]=ct(l),r.push({indent:a,container:o})}else{if(n.startsWith(`'`)&&!ot(n,`'`)||n.startsWith(`"`)&&!ot(n,`"`)){let r=n[0],i=!1;for(;e+1<t.length;){e++;let o=t[e],s=at(o);if(!s.trim()){i=!0;continue}if(o.search(/\S/)<=a){e--;break}if(n+=(i?`
|
|
19
|
+
`:` `)+s.trim(),i=!1,ot(n,r))break}}i.push(ct(n))}continue}let c=o.indexOf(`:`);if(c>0){let n=o.slice(0,c).trim(),i=o.slice(c+1).trim();if(i===``){let e={};if(Array.isArray(s.container)){let t={};t[n]=e,s.container.push(t)}else s.container[n]=e;r.push({indent:a,container:e,key:n})}else{if(i.startsWith(`'`)&&!ot(i,`'`)||i.startsWith(`"`)&&!ot(i,`"`)){let n=i[0],r=!1;for(;e+1<t.length;){e++;let o=t[e],s=at(o);if(!s.trim()){r=!0;continue}if(o.search(/\S/)<=a){e--;break}if(i+=(r?`
|
|
20
|
+
`:` `)+s.trim(),r=!1,ot(i,n))break}}else if(!i.startsWith(`'`)&&!i.startsWith(`"`)&&!i.startsWith(`{`)&&!i.startsWith(`[`)){let n=!1;for(;e+1<t.length;){let r=t[e+1],o=at(r);if(!o.trim()){n=!0,e++;continue}if(r.search(/\S/)<=a)break;let s=o.trim();if(s.startsWith(`- `)||/^[A-Za-z0-9_.-]+:\s*/.test(s))break;e++,i+=(n?`
|
|
21
|
+
`:` `)+s,n=!1}}let r=ct(i);if(Array.isArray(s.container)){let e={};e[n]=r,s.container.push(e)}else s.container[n]=r}}}return n}function ct(e){if(e===``||e===`~`||e===`null`)return null;if(e===`true`||e===`yes`||e===`on`)return!0;if(e===`false`||e===`no`||e===`off`)return!1;if(e.startsWith(`'`)&&e.endsWith(`'`)&&e.length>=2)return e.slice(1,-1).replace(/''/g,`'`);if(e.startsWith(`"`)&&e.endsWith(`"`)&&e.length>=2)try{return JSON.parse(e)}catch{return e.slice(1,-1).replace(/\\"/g,`"`).replace(/\\\\/g,`\\`).replace(/\\n/g,`
|
|
22
|
+
`).replace(/\\t/g,` `).replace(/\\r/g,`\r`)}if(e.startsWith(`{`)&&e.endsWith(`}`))try{return JSON.parse(e)}catch{}if(e.startsWith(`[`)&&e.endsWith(`]`)){let t=e.slice(1,-1).trim();return t?t.split(`,`).map(e=>ct(e.trim())):[]}if(/^-?\d+(\.\d+)?$/.test(e)){let t=Number(e);if(!isNaN(t))return t}return e}var lt=class extends Error{code;constructor(e,t){super(`[${e}] ${t}`),this.code=e,this.name=`StorageError`}};function ut(e,t=``){let n=e.replace(/^\/+/,``),r=t.replace(/^\/+/,``).replace(/\/+$/,``);if(n.startsWith(`mcard:`)){let e=n.slice(6).replace(/^\/+/,``);return!r||e===r||e.startsWith(r+`/`)?`mcard:${e}`:`mcard:${r}/${e}`}return r?`mcard:${r}/${n}`:`mcard:${n}`}function dt(){let e=typeof process<`u`;return{isNode:e&&!!process.versions?.node,isBrowser:typeof globalThis<`u`&&(`window`in globalThis||`document`in globalThis),isZeroFs:e&&{}.CLM_ZERO_FS===`true`}}var ft=new Map;function pt(e){ft.set(e.id,e)}pt({id:`memory`,priority:1,isSupported:(e,t)=>!!(t?.forceMemory||e.isZeroFs),createBackend:()=>new Qe}),pt({id:`sqljs`,priority:1,isSupported:(e,t)=>!!t?.sqlJsDb,createBackend:e=>new rt(e.sqlJsDb)}),pt({id:`node-sqlite`,priority:0,isSupported:(e,t)=>e.isNode&&!t?.forceMemory&&!e.isZeroFs,createBackend:e=>{try{return new nt(e?.dbPath??`:memory:`)}catch{return new Qe}}});function mt(e){let t=dt(),n=Array.from(ft.values()).sort((e,t)=>(t.priority??10)-(e.priority??10));for(let r of n)if(r.isSupported(t,e))try{return r.createBackend(e)}catch{}return new Qe}function ht(e){return{backendSnapshot:e.backend.snapshot(),handles:new Map(Array.from(e.handles.entries()).map(([e,t])=>[e,{...t}])),history:e.history.map(e=>({...e}))}}function gt(e,t){e.backend.restore(t.backendSnapshot),e.handles.clear();for(let[n,r]of t.handles)e.handles.set(n,{...r});e.history.length=0,e.history.push(...t.history.map(e=>({...e})))}var _t=class e{state;contextPrefix;constructor(e,t=``){this.state=e,this.contextPrefix=t.replace(/^\/+/,``).replace(/\/+$/,``)}get storageBackend(){return this.state.backend}get backend(){return this.storageBackend}static newInMemory(){return new e({backend:new Qe,handles:new Map,history:[]})}static newInMemoryScoped(t){return new e({backend:new Qe,handles:new Map,history:[]},t)}static createMemory(t=``){return t?e.newInMemoryScoped(t):e.newInMemory()}static createSqlite(t=`:memory:`,n=``){return e.withBackend(new nt(t),n)}static createSqlJs(t,n=``){return e.withBackend(new rt(t),n)}static createOptimal(t,n=``){return e.withBackend(mt(t),n)}static withBackend(t,n=``){return new e({backend:t,handles:new Map,history:[]},n)}static fromCollection(t,n=``){return e.withBackend(t.storageBackend,n)}withPrefix(t){return new e(this.state,t)}canonicalizeUri(e){return ut(e,this.contextPrefix)}exists(e){return this.state.handles.has(this.canonicalizeUri(e))}snapshot(){return ht(this.state)}restore(e){gt(this.state,e)}registerCardInternal(e,t,n){let r=this.state.handles.get(t);this.state.backend.put(e.hash,e),r&&!r.currentHash.equals(e.hash)&&this.state.history.push({handle:t,previousHash:r.currentHash,changedAt:n}),this.state.handles.set(t,{handle:t,currentHash:e.hash,createdAt:r?r.createdAt:n,updatedAt:n});try{let n=t.replace(/^mcard:/,``).replace(/\//g,`:`);this.state.backend.registerHandle(Se.parse(n),e.hash),t!==n&&this.state.backend.registerHandle(Se.parse(t),e.hash)}catch{}}writeFile(e,t,n=xe.create(`did:clm:agent:default`)){let r=this.canonicalizeUri(e),i=new Date().toISOString(),a=this.state.handles.get(r)?this.state.history.filter(e=>e.handle===r).length+2:1,o=j.create(r,De(t),n,a);return this.registerCardInternal(o,r,i),o}putContent(e,t,n){return this.writeFile(e,t,n)}put(e){return this.putCard(e),!0}putCard(e){let t=this.canonicalizeUri(e.uri);return this.registerCardInternal(e,t,new Date().toISOString()),e}readFile(e){let t=this.canonicalizeUri(e),n=this.state.handles.get(t);if(!n)throw new lt(`CardNotFound`,`Handle '${t}' not found in MCardFs`);let r=this.state.backend.get(n.currentHash);if(!r)throw new lt(`CorruptedContent`,`Card content for hash '${n.currentHash.asHex()}' not found`);if(!r.hash.equals(n.currentHash))throw new lt(`CorruptedContent`,`Cryptographic mismatch for handle '${t}': registry=${n.currentHash.asHex()} stored=${r.hash.asHex()}`);return r}readFileByHash(e){let t=typeof e==`string`?A.parse(e):e,n=this.state.backend.get(t);if(!n)throw new lt(`CardNotFound`,`Card with hash '${t.asHex()}' not found in CAS storage`);return n}statFile(e){let t=this.canonicalizeUri(e),n=this.state.handles.get(t);if(!n)throw new lt(`CardNotFound`,`Handle '${t}' not found`);let r=this.state.backend.get(n.currentHash);return{uri:t,hash:n.currentHash,sizeBytes:r?JSON.stringify(r.toJSON()).length:0,createdAt:n.createdAt,updatedAt:n.updatedAt}}listDir(e=``){let t=this.canonicalizeUri(e),n=t.endsWith(`/`)?e=>e.startsWith(t):t===`mcard:`?e=>e.startsWith(`mcard:`):e=>e===t||e.startsWith(t+`/`);return Array.from(this.state.handles.keys()).filter(n).sort((e,t)=>e.localeCompare(t))}get(e){try{if(typeof e==`string`){let t=this.canonicalizeUri(e);if(this.state.handles.has(t))return this.readFile(t);try{return this.readFileByHash(e)}catch{return}}return this.readFileByHash(e)}catch{return}}list(e=``){let t=this.listDir(e),n=[];for(let e of t)try{n.push(this.readFile(e))}catch{}return n}deleteFile(e){let t=this.canonicalizeUri(e),n=this.state.handles.get(t);if(!n)throw new lt(`CardNotFound`,`Handle '${t}' not found for deletion`);this.state.history.push({handle:t,previousHash:n.currentHash,changedAt:new Date().toISOString()}),this.state.handles.delete(t)}history(e){let t=this.canonicalizeUri(e);return this.state.history.filter(e=>e.handle===t).map(e=>({previousHash:e.previousHash,changedAt:e.changedAt}))}importHistory(e,t=``){let n=new Set(this.state.history.map(e=>`${e.handle}|${e.previousHash.asHex()}|${e.changedAt}`)),r=t.replace(/^\/+/,``).replace(/\/+$/,``),i=0;for(let t of e){let e=String(t.handle).replace(/^\/+/,``),a=this.canonicalizeUri(r?`${r}/${e}`:e),o=typeof t.previousHash==`string`?A.fromHex(t.previousHash):t.previousHash,s=`${a}|${o.asHex()}|${t.changedAt}`;n.has(s)||(n.add(s),this.state.history.push({handle:a,previousHash:o,changedAt:t.changedAt}),i++)}return i}exportHistory(){return this.state.history.map(e=>({handle:e.handle,previousHash:e.previousHash.asHex(),changedAt:e.changedAt}))}ephemeralMount(e,t){let n=this.withPrefix(t),r=t.replace(/^\/+/,``).replace(/\/+$/,``),i=r?`mcard:${r}/`:`mcard:`;return e.disposables.add(()=>{for(let e of Array.from(this.state.handles.keys()))e.startsWith(i)&&this.state.handles.delete(e)}),n}};function vt(e){if(e.length===0)return!1;let t=Math.min(e.length,8192),n=e.subarray(0,t);for(let e=0;e<n.length;e++)if(n[e]===0)return!0;try{let e=new TextDecoder(`utf-8`,{fatal:!0}).decode(n),t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);(r<9||r>13&&r<32)&&t++}return t>n.length*.1}catch{return!0}}var yt=[{magic:new Uint8Array([137,80,78,71,13,10,26,10]),mime:`image/png`},{magic:new Uint8Array([255,216,255]),mime:`image/jpeg`},{magic:new Uint8Array([71,73,70,56]),mime:`image/gif`},{magic:new Uint8Array([37,80,68,70]),mime:`application/pdf`},{magic:new Uint8Array([80,75,3,4]),mime:`application/zip`},{magic:new Uint8Array([83,81,76,105,116,101,32,102,111,114,109,97,116,32,51,0]),mime:`application/sqlite3`},{magic:new Uint8Array([103,108,84,70]),mime:`model/gltf-binary`},{magic:new Uint8Array([73,68,51]),mime:`audio/mpeg`}],bt={pdf:`application/pdf`,md:`text/markdown`,markdown:`text/markdown`,txt:`text/plain`,text:`text/plain`,json:`application/json`,yaml:`application/yaml`,yml:`application/yaml`,xml:`text/xml`,html:`text/html`,htm:`text/html`,csv:`text/csv`,js:`application/javascript`,mjs:`application/javascript`,cjs:`application/javascript`,ts:`text/typescript`,tsx:`text/typescript`,py:`text/x-python`,sh:`text/x-shellscript`,png:`image/png`,jpeg:`image/jpeg`,jpg:`image/jpeg`,webp:`image/webp`,svg:`image/svg+xml`,gif:`image/gif`,"3ds":`model/x-3ds`,obj:`model/obj`,stl:`model/stl`,gltf:`model/gltf+json`,glb:`model/gltf-binary`,wav:`audio/wav`,mp3:`audio/mpeg`,mp4:`video/mp4`,ttf:`font/ttf`,woff2:`font/woff2`,tikz:`text/x-tikz`,tikzcd:`text/x-tikzcd`,"tikz-cd":`text/x-tikzcd`,tex:`application/x-tex`};function xt(e,t=``){if(e.length===0){if(t){let e=(t.includes(`.`)?t.split(`.`).pop():t).replace(/^\.+/,``).toLowerCase();if(e in bt)return bt[e]}return`application/octet-stream`}if(e.length>=12&&e[0]===82&&e[1]===73&&e[2]===70&&e[3]===70){let t=String.fromCharCode(e[8],e[9],e[10],e[11]);if(t===`WEBP`)return`image/webp`;if(t===`WAVE`)return`audio/wav`}if(e.length>=8&&e[4]===102&&e[5]===116&&e[6]===121&&e[7]===112)return`video/mp4`;for(let t of yt)if(e.length>=t.magic.length){let n=!0;for(let r=0;r<t.magic.length;r++)if(e[r]!==t.magic[r]){n=!1;break}if(n)return t.mime}if(t){let e=(t.includes(`.`)?t.split(`.`).pop():t).replace(/^\.+/,``).toLowerCase();if(e in bt)return bt[e]}return vt(e)?`application/octet-stream`:`text/plain`}function St(e,t=`Function`){if(t!==`Function`||!e||typeof e!=`object`)return`UNKNOWN`;let n=e,r=n.clm??n,i=r.concrete_impl?.process?.type??r.concrete?.process?.type;if(i)return`M:${i}`;let a=r.concrete_impl?.process_behavior_exec?.dispatcher;if(a)return`A:${a}`;let o=r.concrete_impl?.runtime;if(o)return`B:${o}:${r.concrete_impl?.operation??`invoke`}`;let s=r.concrete?.runtime;return s?`C:${s}`:`UNKNOWN`}function Ct(e){if(typeof e==`string`){let t=e.toLowerCase();return t.includes(`/abstract/`)||t.includes(`:abstract:`)?`definition`:t.includes(`/concrete/`)||t.includes(`:concrete:`)?`proof`:t.includes(`/balanced/`)||t.includes(`:balanced:`)?`theorem`:t.includes(`schema`)||t.includes(`specification`)||t.includes(`.spec.`)?`definition`:`proposition`}if(e&&typeof e==`object`){let t=e,n=t.clm??t;if(n.abstract&&!n.concrete&&!n.balanced)return`definition`;if(n.concrete&&!n.abstract)return`proof`;if(n.balanced||n.abstract&&n.concrete)return`theorem`}return`proposition`}var wt=class e{knowledge;executionLog;mcard;get content_memory(){return this.mcard}get agent_identities(){return this.knowledge}get execution_log(){return this.executionLog}constructor(e){this.knowledge=_t.withBackend(e.knowledge,`knowledge`),this.executionLog=_t.withBackend(e.executionLog,`execution_log`),this.mcard=_t.withBackend(e.mcard,`mcard`)}static newInMemory(){return new e({knowledge:new Qe,executionLog:new Qe,mcard:new Qe})}static withBackends(t){return new e(t)}getPillar(e){switch(e){case`content_memory`:case`mcard`:return this.mcard;case`execution_log`:return this.executionLog;case`agent_identities`:case`knowledge`:return this.knowledge}}savepoint(e=`sp_${Date.now()}`){return{id:e,timestamp:Date.now(),snapshots:{knowledge:this.knowledge.snapshot(),executionLog:this.executionLog.snapshot(),mcard:this.mcard.snapshot()}}}rollback(e){this.knowledge.restore(e.snapshots.knowledge),this.executionLog.restore(e.snapshots.executionLog),this.mcard.restore(e.snapshots.mcard)}rollbackTo(e){this.rollback(e)}release(e){}};function Tt(){try{let e=Fe(import.meta.url?import.meta.url:`file:///index.js`);return{fs:e(`node:fs`),os:e(`node:os`),path:e(`node:path`),sqlite:e(`node:sqlite`)}}catch(e){throw Error(`Node.js built-ins (fs, os, path, sqlite) are only available in Node.js v22+ environments: ${e}`)}}function Et(){let{fs:e,os:t,path:n,sqlite:r}=Tt();return{name:`node:sqlite`,open:e=>new r.DatabaseSync(e),toBytes:(t,n)=>new Uint8Array(e.readFileSync(n)),scratchPath:()=>n.join(t.tmpdir(),`clm_portable_export_${Date.now()}_${Math.random().toString(36).slice(2)}.db`),fromBytes:(t,n)=>{if(!n)throw Error(`the node engine requires a scratch path`);return e.writeFileSync(n,t),n},cleanup:t=>{if(t)try{e.unlinkSync(t)}catch{}}}}async function Dt(e,t){let n=t?.engine??Et(),r=n.scratchPath(),i=n.open(r??`:memory:`);try{i.exec(`PRAGMA foreign_keys = OFF;`);let a=et();i.exec(a);let o=[`CREATE`,`TABLE IF NOT EXISTS mcard_meta (key TEXT PRIMARY KEY, value TEXT NOT NULL);`].join(` `);i.exec(o);try{i.exec(`ALTER TABLE handle_registry ADD COLUMN hash TEXT GENERATED ALWAYS AS (current_hash) VIRTUAL;`)}catch{}try{i.exec(`ALTER TABLE handle_history ADD COLUMN hash TEXT GENERATED ALWAYS AS (previous_hash) VIRTUAL;`)}catch{}try{i.exec(`ALTER TABLE handle_history ADD COLUMN created_at TEXT GENERATED ALWAYS AS (changed_at) VIRTUAL;`)}catch{}let s=i.prepare(`INSERT OR REPLACE INTO card (hash, content, g_time) VALUES (?, ?, ?)`),c=i.prepare(`INSERT OR REPLACE INTO handle_registry (handle, current_hash, updated_at) VALUES (?, ?, ?)`),l=i.prepare(`INSERT INTO handle_history (handle, previous_hash, changed_at) VALUES (?, ?, ?)`),u=i.prepare(`INSERT OR REPLACE INTO mcard_meta (key, value) VALUES (?, ?)`);u.run(`schema_profile`,t?.schemaProfile||`portable-3.0.3`),t?.exportedAt&&u.run(`exported_at`,t.exportedAt),u.run(`card_count`,String(e.length)),u.run(`exported_by`,t?.exportedBy||`AstroStudio`);for(let t of e){let e=typeof t.content==`string`?t.content:JSON.stringify(t.content),n=t.g_time||t.created_at||`1970-01-01T00:00:00.000Z`;s.run(t.hash,e,n),t.handle&&c.run(t.handle,t.hash,n),t.path&&t.path!==t.handle&&c.run(t.path,t.hash,n)}for(let e of t?.history??[])l.run(e.handle,e.previous_hash,e.changed_at);let d=n.toBytes(i,r??`:memory:`);i.close();try{n.cleanup(r)}catch{}return d}catch(e){try{i.close()}catch{}try{n.cleanup(r)}catch{}throw e}}async function Ot(e,t){if(e.length<16)throw Error(`File too small to be a valid SQLite database`);if(!new TextDecoder(`utf-8`).decode(e.subarray(0,16)).startsWith(`SQLite format 3`))throw Error(`Invalid SQLite 3 binary header (magic bytes mismatch)`);let n=t?.engine??Et(),r=n.scratchPath(),i=n.open(n.fromBytes(e,r)),a=r;try{let e=i.prepare(`SELECT name FROM sqlite_master WHERE type='table'`).all().map(e=>e.name),t=e.includes(`card`)?i.prepare(`SELECT * FROM card`).all():[],r=e.includes(`handle_registry`)?i.prepare(`SELECT * FROM handle_registry`).all().map(e=>({...e,hash:e.hash??e.current_hash,current_hash:e.current_hash??e.hash})):[],o=e.includes(`handle_history`)?i.prepare(`SELECT * FROM handle_history`).all().map(e=>({...e,hash:e.hash??e.previous_hash,previous_hash:e.previous_hash??e.hash,created_at:e.created_at??e.changed_at,changed_at:e.changed_at??e.created_at})):[],s=e.includes(`mcard_meta`)?i.prepare(`SELECT * FROM mcard_meta`).all():[];i.close();try{n.cleanup(a)}catch{}return{tables:e,cards:t,handles:r,history:o,meta:s}}catch(e){try{i.close()}catch{}try{n.cleanup(a)}catch{}throw e}}function kt(e){return{type:`text`,text:e}}function At(e,t,n,r){return{type:`image`,src:e,alt:t,width:n,height:r}}function jt(e,t,n=`document`){return{type:`card`,hash:e,handle:t,cardType:n}}function Mt(e,t=``,n){return{type:`execute`,pcard:e,input:t,label:n}}function Nt(e){return f(pe(e))}function Pt(e,t){let n=new Uint8Array(64);e.length>64?n.set(Nt(e)):n.set(e);let r=new Uint8Array(64),i=new Uint8Array(64);for(let e=0;e<64;e++)r[e]=n[e]^54,i[e]=n[e]^92;let a=new Uint8Array(64+t.length);a.set(r,0),a.set(t,64);let o=Nt(a),s=new Uint8Array(96);return s.set(i,0),s.set(o,64),Nt(s)}function Ft(e,t){let n=Pt(e,t),r=Pt(n,new Uint8Array([1])),i=new Uint8Array(33);return i.set(r,0),i[32]=2,[r,Pt(n,i)]}function It(e,t){let n=Pt(e,t),r=Pt(n,new Uint8Array([1])),i=new Uint8Array(33);i.set(r,0),i[32]=2;let a=Pt(n,i),o=new Uint8Array(33);return o.set(a,0),o[32]=3,[r,a,Pt(n,o)]}function Lt(e,t){if(e.length!==32)throw Error(`X25519 private key must be 32 bytes, got ${e.length}`);if(t.length!==32)throw Error(`X25519 public key must be 32 bytes, got ${t.length}`);let n=(void 0)({key:Buffer.concat([v(g),Buffer.from(e)]),format:`der`,type:`pkcs8`}),r=(void 0)({key:Buffer.concat([v(_),Buffer.from(t)]),format:`der`,type:`spki`});return new Uint8Array((void 0)({privateKey:n,publicKey:r}))}function Rt(e){let t=e?new Uint8Array(e):new Uint8Array(T(32)),n=(void 0)((void 0)({key:Buffer.concat([v(g),Buffer.from(t)]),format:`der`,type:`pkcs8`})).export({type:`spki`,format:`der`}).subarray(-32);return{privateKey:t,publicKey:new Uint8Array(n)}}var zt=0;function Bt(){return zt=(zt+1)%1e6,zt}function Vt(e,t,n,r,i){return j.create(e,JSON.stringify(t),r,i,new Map(n))}function Ht(e,t,n,r,i=Date.now()){return Vt(`mcard:event/chat/query/${e}/${i}_${Bt()}`,{eventType:`chat_query`,turnId:e,query:t,attachments:n,authorDid:r.asString(),timestamp:new Date(i).toISOString(),g_time:i},[[`contentType`,`application/x-clm-event+json`],[`schema`,`clm:schema:event:query:v1`],[`eventType`,`chat_query`],[`turnId`,e],[`storagePillar`,`execution_log`]],r,i)}function Ut(e,t,n,r,i,a,o=Date.now()){return Vt(`mcard:event/chat/feedback/${e}/${o}_${Bt()}`,{eventType:`chat_feedback`,turnId:e,queryHash:n.hash.asHex(),feedback:t,modelId:r,latencyMs:i,authorDid:a.asString(),timestamp:new Date(o).toISOString(),g_time:o},[[`contentType`,`application/x-clm-event+json`],[`schema`,`clm:schema:event:feedback:v1`],[`eventType`,`chat_feedback`],[`turnId`,e],[`queryHash`,n.hash.asHex()],[`modelId`,r],[`storagePillar`,`execution_log`]],a,o)}function Wt(e,t,n,r,i,a=Date.now()){return Vt(`mcard:event/chat/transition/${e}/${t}_to_${n}/${a}_${Bt()}`,{eventType:`chat_transition`,turnId:e,fromState:t,toState:n,reason:r,timestamp:new Date(a).toISOString(),g_time:a},[[`contentType`,`application/x-clm-event+json`],[`schema`,`clm:schema:event:transition:v1`],[`eventType`,`chat_transition`],[`turnId`,e],[`fromState`,t],[`toState`,n],[`storagePillar`,`execution_log`]],i,a)}function Gt(e,t,n,r=xe.create(`did:clm:agent:maxwell`),i=Date.now()){return Vt(`mcard:event/chat/abort/${e}/${i}_${Bt()}`,{eventType:`chat_abort`,turnId:e,reason:t,obstruction:n,timestamp:new Date(i).toISOString(),g_time:i},[[`contentType`,`application/x-clm-event+json`],[`schema`,`clm:schema:event:abort:v1`],[`eventType`,`chat_abort`],[`turnId`,e],[`storagePillar`,`execution_log`]],r,i)}function Kt(e,t,n,r=xe.create(`did:clm:agent:rollback`),i=Date.now()){return Vt(`mcard:event/chat/revert/${e}/${i}_${Bt()}`,{eventType:`chat_revert`,turnId:e,error:t,disposersUnwound:n,timestamp:new Date(i).toISOString(),g_time:i},[[`contentType`,`application/x-clm-event+json`],[`schema`,`clm:schema:event:revert:v1`],[`eventType`,`chat_revert`],[`turnId`,e],[`storagePillar`,`execution_log`]],r,i)}function qt(e,t,n,r,i=Date.now()){let a=`mcard:event/chat/image/${e}/${i}_${Bt()}`,o=atob(n),s=new Uint8Array(o.length);for(let e=0;e<o.length;e++)s[e]=o.charCodeAt(e);let c=Pe(t,s);return j.withMetadata(a,c,new Map([[`contentType`,t],[`mimeType`,t],[`encoding`,`base64`],[`sizeBytes`,String(s.length)],[`turnId`,e],[`source`,`gemini:generateContent`],[`schema`,`clm:schema:event:image:v1`],[`eventType`,`chat_image`],[`storagePillar`,`execution_log`]]),r,i)}var Jt=class{_state=`waiting`;_stateHistory=[`waiting`];constructor(e=`waiting`){this._state=e,this._stateHistory=[e]}get state(){return this._state}get stateHistory(){return[...this._stateHistory]}transition(e){this._state=e,this._stateHistory.push(e)}reset(){this._state=`waiting`,this._stateHistory.length=0,this._stateHistory.push(`waiting`)}};function Yt(e,t){try{return`getPillar`in e&&typeof e.getPillar==`function`?(e.getPillar(`execution_log`).put(t),!0):`commitEvent`in e&&typeof e.commitEvent==`function`&&(e.commitEvent(t),!0)}catch{return!1}}var Xt=class extends Te{constructor(e,t){super({id:e,codeHash:A.computeString(`pcard:chatbot:turn:v1`),sourceUri:`pcard:clm/chatbot/turn`,signature:`ChatBotTurnInput -> ChatBotTurnOutput`,coeffects:{requiredServices:[`llm.agency`]}}),this.persistence=t}persistence;_stateMachine=new Jt(`waiting`);get state(){return this._stateMachine.state}get stateHistory(){return this._stateMachine.stateHistory}transition(e,t,n,r){let i=this._stateMachine.state;this._stateMachine.transition(e);let a=Wt(n,i,e,t,r);Yt(this.persistence,a)}async executeTurn(e,t={}){let n=e.turnId||`turn_${Date.now()}_${Math.random().toString(36).slice(2,7)}`,r=performance.now();this.transition(`progressing`,`Inbound query input - aperture expanded`,n,e.authorDid);let i=Ht(n,e.prompt,e.attachments||[],e.authorDid);if(Yt(this.persistence,i),t.preGate){let a=await t.preGate(e);if(!a.pass){let t=a.reason||`Precondition verification failed`;this.transition(`aborting`,t,n,e.authorDid);let o=Gt(n,t,a.obstruction,e.authorDid);Yt(this.persistence,o),this.transition(`waiting`,`Aborted turn reset to idle readiness`,n,e.authorDid);let s=Ut(n,`\u26D4 **Turn Aborted**: ${t}`,i,e.modelId||`gate:rejection`,Math.round(performance.now()-r),e.authorDid);return Yt(this.persistence,s),{feedbackText:`\u26D4 **Turn Aborted**: ${t}`,queryMCard:i,feedbackMCard:s,finalState:`waiting`,stateHistory:this.stateHistory}}}let a=typeof this.persistence.savepoint==`function`?this.persistence.savepoint(`sp_${n}`):void 0,o=new y,s=``;try{if(s=t.provider?await t.provider(e.prompt,t.onToken):`[Satori SpeechAct: received] Acknowledged: ${e.prompt}`,t.postGate){let e=await t.postGate(s,i);if(!e.pass)throw Error(`Postcondition verification failed: ${e.reason||`invalid completion`}`)}if(!s.trim())throw Error(`Zero-Silence Invariant Violation: feedback text cannot be empty`);let a=Math.round(performance.now()-r),c=Ut(n,s,i,e.modelId||`in-browser`,a,e.authorDid);return Yt(this.persistence,c),await o.dispose(),this.transition(`waiting`,`Turn successfully verified and sealed`,n,e.authorDid),{feedbackText:s,queryMCard:i,feedbackMCard:c,finalState:`waiting`,stateHistory:this.stateHistory}}catch(t){let s=t?.message||String(t);this.transition(`reverting`,`Execution fault: ${s}`,n,e.authorDid),a!==void 0&&typeof this.persistence.rollbackTo==`function`&&this.persistence.rollbackTo(a);let c=o.length;await o.dispose();let l=Kt(n,s,c,e.authorDid);Yt(this.persistence,l),this.transition(`waiting`,`Reverted state restored to prior marking`,n,e.authorDid);let u=`\u26A0\uFE0F **Turn Reverted (0 Residual State)**: ${s}`,d=Ut(n,u,i,e.modelId||`system:revert`,Math.round(performance.now()-r),e.authorDid);return Yt(this.persistence,d),{feedbackText:u,queryMCard:i,feedbackMCard:d,finalState:`waiting`,stateHistory:this.stateHistory}}}},Zt;function Qt(){}Qt.prototype=Object.create(null);function N(){N.init.call(this)}N.EventEmitter=N,N.usingDomains=!1,N.prototype.domain=void 0,N.prototype._events=void 0,N.prototype._maxListeners=void 0,N.defaultMaxListeners=10,N.init=function(){this.domain=null,N.usingDomains&&Zt.active&&!(this instanceof Zt.Domain)&&(this.domain=Zt.active),(!this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=new Qt,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},N.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||isNaN(e))throw TypeError(`"n" argument must be a positive number`);return this._maxListeners=e,this};function $t(e){return e._maxListeners===void 0?N.defaultMaxListeners:e._maxListeners}N.prototype.getMaxListeners=function(){return $t(this)};function en(e,t,n){if(t)e.call(n);else for(var r=e.length,i=dn(e,r),a=0;a<r;++a)i[a].call(n)}function tn(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,a=dn(e,i),o=0;o<i;++o)a[o].call(n,r)}function nn(e,t,n,r,i){if(t)e.call(n,r,i);else for(var a=e.length,o=dn(e,a),s=0;s<a;++s)o[s].call(n,r,i)}function rn(e,t,n,r,i,a){if(t)e.call(n,r,i,a);else for(var o=e.length,s=dn(e,o),c=0;c<o;++c)s[c].call(n,r,i,a)}function an(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,a=dn(e,i),o=0;o<i;++o)a[o].apply(n,r)}N.prototype.emit=function(e){var t,n,r,i,a,o,s,c=e===`error`;if(o=this._events,o)c&&=o.error==null;else if(!c)return!1;if(s=this.domain,c){if(t=arguments[1],s)t||=Error(`Uncaught, unspecified "error" event`),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit(`error`,t);else if(t instanceof Error)throw t;else{var l=Error(`Uncaught, unspecified "error" event. (`+t+`)`);throw l.context=t,l}return!1}if(n=o[e],!n)return!1;var u=typeof n==`function`;switch(r=arguments.length,r){case 1:en(n,u,this);break;case 2:tn(n,u,this,arguments[1]);break;case 3:nn(n,u,this,arguments[1],arguments[2]);break;case 4:rn(n,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=Array(r-1),a=1;a<r;a++)i[a-1]=arguments[a];an(n,u,this,i)}return!0};function on(e,t,n,r){var i,a,o;if(typeof n!=`function`)throw TypeError(`"listener" argument must be a function`);if(a=e._events,a?(a.newListener&&(e.emit(`newListener`,t,n.listener?n.listener:n),a=e._events),o=a[t]):(a=e._events=new Qt,e._eventsCount=0),!o)o=a[t]=n,++e._eventsCount;else if(typeof o==`function`?o=a[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),!o.warned&&(i=$t(e),i&&i>0&&o.length>i)){o.warned=!0;var s=Error(`Possible EventEmitter memory leak detected. `+o.length+` `+t+` listeners added. Use emitter.setMaxListeners() to increase limit`);s.name=`MaxListenersExceededWarning`,s.emitter=e,s.type=t,s.count=o.length,sn(s)}return e}function sn(e){typeof console.warn==`function`?console.warn(e):console.log(e)}N.prototype.addListener=function(e,t){return on(this,e,t,!1)},N.prototype.on=N.prototype.addListener,N.prototype.prependListener=function(e,t){return on(this,e,t,!0)};function cn(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}N.prototype.once=function(e,t){if(typeof t!=`function`)throw TypeError(`"listener" argument must be a function`);return this.on(e,cn(this,e,t)),this},N.prototype.prependOnceListener=function(e,t){if(typeof t!=`function`)throw TypeError(`"listener" argument must be a function`);return this.prependListener(e,cn(this,e,t)),this},N.prototype.removeListener=function(e,t){var n,r,i,a,o;if(typeof t!=`function`)throw TypeError(`"listener" argument must be a function`);if(r=this._events,!r||(n=r[e],!n))return this;if(n===t||n.listener&&n.listener===t)--this._eventsCount===0?this._events=new Qt:(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length;a-->0;)if(n[a]===t||n[a].listener&&n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;if(n.length===1){if(n[0]=void 0,--this._eventsCount===0)return this._events=new Qt,this;delete r[e]}else un(n,i);r.removeListener&&this.emit(`removeListener`,e,o||t)}return this},N.prototype.removeAllListeners=function(e){var t,n=this._events;if(!n)return this;if(!n.removeListener)return arguments.length===0?(this._events=new Qt,this._eventsCount=0):n[e]&&(--this._eventsCount===0?this._events=new Qt:delete n[e]),this;if(arguments.length===0){for(var r=Object.keys(n),i=0,a;i<r.length;++i)a=r[i],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=new Qt,this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t)do this.removeListener(e,t[t.length-1]);while(t[0]);return this},N.prototype.listeners=function(e){var t,n,r=this._events;return r?(t=r[e],n=t?typeof t==`function`?[t.listener||t]:fn(t):[]):n=[],n},N.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):ln.call(e,t)},N.prototype.listenerCount=ln;function ln(e){var t=this._events;if(t){var n=t[e];if(typeof n==`function`)return 1;if(n)return n.length}return 0}N.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};function un(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}function dn(e,t){for(var n=Array(t);t--;)n[t]=e[t];return n}function fn(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}var pn=Tn(globalThis.fetch)&&Tn(globalThis.ReadableStream),mn;function hn(){if(mn!==void 0)return mn;try{new globalThis.Blob([new ArrayBuffer(1)]),mn=!0}catch{mn=!1}return mn}var gn;function _n(e){gn||(gn=new globalThis.XMLHttpRequest,gn.open(`GET`,globalThis.location.host?`/`:`https://example.com`));try{return gn.responseType=e,gn.responseType===e}catch{return!1}}var vn=globalThis.ArrayBuffer!==void 0,yn=vn&&Tn(globalThis.ArrayBuffer.prototype.slice),bn=vn&&_n(`arraybuffer`),xn=!pn&&yn&&_n(`ms-stream`),Sn=!pn&&vn&&_n(`moz-chunked-arraybuffer`),Cn=Tn(gn.overrideMimeType),wn=Tn(globalThis.VBArray);function Tn(e){return typeof e==`function`}gn=null;function En(){throw Error(`setTimeout has not been defined`)}function Dn(){throw Error(`clearTimeout has not been defined`)}var On=En,kn=Dn;typeof globalThis.setTimeout==`function`&&(On=setTimeout),typeof globalThis.clearTimeout==`function`&&(kn=clearTimeout);function An(e){if(On===setTimeout)return setTimeout(e,0);if((On===En||!On)&&setTimeout)return On=setTimeout,setTimeout(e,0);try{return On(e,0)}catch{try{return On.call(null,e,0)}catch{return On.call(this,e,0)}}}function jn(e){if(kn===clearTimeout)return clearTimeout(e);if((kn===Dn||!kn)&&clearTimeout)return kn=clearTimeout,clearTimeout(e);try{return kn(e)}catch{try{return kn.call(null,e)}catch{return kn.call(this,e)}}}var Mn=[],Nn=!1,Pn,Fn=-1;function In(){Nn&&Pn&&(Nn=!1,Pn.length?Mn=Pn.concat(Mn):Fn=-1,Mn.length&&Ln())}function Ln(){if(!Nn){var e=An(In);Nn=!0;for(var t=Mn.length;t;){for(Pn=Mn,Mn=[];++Fn<t;)Pn&&Pn[Fn].run();Fn=-1,t=Mn.length}Pn=null,Nn=!1,jn(e)}}function P(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];Mn.push(new Rn(e,t)),Mn.length===1&&!Nn&&An(Ln)}function Rn(e,t){this.fun=e,this.array=t}Rn.prototype.run=function(){this.fun.apply(null,this.array)};var zn=`browser`,Bn=`browser`,Vn={},Hn=[],Un={},Wn={},Gn={};function Kn(){}var qn=Kn,Jn=Kn,Yn=Kn,Xn=Kn,Zn=Kn,Qn=Kn,$n=Kn;function er(e){throw Error(`process.binding is not supported`)}function tr(){return`/`}function nr(e){throw Error(`process.chdir is not supported`)}function rr(){return 0}var ir=globalThis.performance||{},ar=ir.now||ir.mozNow||ir.msNow||ir.oNow||ir.webkitNow||function(){return new Date().getTime()};function or(e){var t=ar.call(ir)*.001,n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],r-=e[1],r<0&&(n--,r+=1e9)),[n,r]}var sr=new Date;function cr(){return(new Date-sr)/1e3}var lr={nextTick:P,title:zn,browser:!0,env:Vn,argv:Hn,version:``,versions:Un,on:qn,addListener:Jn,once:Yn,off:Xn,removeListener:Zn,removeAllListeners:Qn,emit:$n,binding:er,cwd:tr,chdir:nr,umask:rr,hrtime:or,platform:Bn,release:Wn,config:Gn,uptime:cr},F=typeof Object.create==`function`?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e},ur=/%[sdj%]/g;function dr(e){if(!jr(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(gr(arguments[n]));return t.join(` `)}for(var n=1,r=arguments,i=r.length,a=String(e).replace(ur,function(e){if(e===`%%`)return`%`;if(n>=i)return e;switch(e){case`%s`:return String(r[n++]);case`%d`:return Number(r[n++]);case`%j`:try{return JSON.stringify(r[n++])}catch{return`[Circular]`}default:return e}}),o=r[n];n<i;o=r[++n])Or(o)||!Pr(o)?a+=` `+o:a+=` `+gr(o);return a}function fr(e,t){if(Mr(globalThis.process))return function(){return fr(e,t).apply(this,arguments)};if(lr.noDeprecation===!0)return e;var n=!1;function r(){if(!n){if(lr.throwDeprecation)throw Error(t);lr.traceDeprecation?console.trace(t):console.error(t),n=!0}return e.apply(this,arguments)}return r}var pr={},mr;function hr(e){if(Mr(mr)&&(mr=lr.env.NODE_DEBUG||``),e=e.toUpperCase(),!pr[e]){if(RegExp(`\\b`+e+`\\b`,`i`).test(mr)){var t=0;pr[e]=function(){var n=dr.apply(null,arguments);console.error(`%s %d: %s`,e,t,n)}}else pr[e]=function(){}}return pr[e]}function gr(e,t){var n={seen:[],stylize:vr};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),Dr(t)?n.showHidden=t:t&&zr(n,t),Mr(n.showHidden)&&(n.showHidden=!1),Mr(n.depth)&&(n.depth=2),Mr(n.colors)&&(n.colors=!1),Mr(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=_r),br(n,e,n.depth)}gr.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},gr.styles={special:`cyan`,number:`yellow`,boolean:`yellow`,undefined:`grey`,null:`bold`,string:`green`,date:`magenta`,regexp:`red`};function _r(e,t){var n=gr.styles[t];return n?`\x1B[`+gr.colors[n][0]+`m`+e+`\x1B[`+gr.colors[n][1]+`m`:e}function vr(e,t){return e}function yr(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function br(e,t,n){if(e.customInspect&&t&&Lr(t.inspect)&&t.inspect!==gr&&!(t.constructor&&t.constructor.prototype===t)){var r=t.inspect(n,e);return jr(r)||(r=br(e,r,n)),r}var i=xr(e,t);if(i)return i;var a=Object.keys(t),o=yr(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(t)),Ir(t)&&(a.indexOf(`message`)>=0||a.indexOf(`description`)>=0))return Sr(t);if(a.length===0){if(Lr(t)){var s=t.name?`: `+t.name:``;return e.stylize(`[Function`+s+`]`,`special`)}if(Nr(t))return e.stylize(RegExp.prototype.toString.call(t),`regexp`);if(Fr(t))return e.stylize(Date.prototype.toString.call(t),`date`);if(Ir(t))return Sr(t)}var c=``,l=!1,u=[`{`,`}`];if(Er(t)&&(l=!0,u=[`[`,`]`]),Lr(t)&&(c=` [Function`+(t.name?`: `+t.name:``)+`]`),Nr(t)&&(c=` `+RegExp.prototype.toString.call(t)),Fr(t)&&(c=` `+Date.prototype.toUTCString.call(t)),Ir(t)&&(c=` `+Sr(t)),a.length===0&&(!l||t.length==0))return u[0]+c+u[1];if(n<0)return Nr(t)?e.stylize(RegExp.prototype.toString.call(t),`regexp`):e.stylize(`[Object]`,`special`);e.seen.push(t);var d=l?Cr(e,t,n,o,a):a.map(function(r){return wr(e,t,n,o,r,l)});return e.seen.pop(),Tr(d,c,u)}function xr(e,t){if(Mr(t))return e.stylize(`undefined`,`undefined`);if(jr(t)){var n=`'`+JSON.stringify(t).replace(/^"|"$/g,``).replace(/'/g,`\\'`).replace(/\\"/g,`"`)+`'`;return e.stylize(n,`string`)}if(Ar(t))return e.stylize(``+t,`number`);if(Dr(t))return e.stylize(``+t,`boolean`);if(Or(t))return e.stylize(`null`,`null`)}function Sr(e){return`[`+Error.prototype.toString.call(e)+`]`}function Cr(e,t,n,r,i){for(var a=[],o=0,s=t.length;o<s;++o)Br(t,String(o))?a.push(wr(e,t,n,r,String(o),!0)):a.push(``);return i.forEach(function(i){i.match(/^\d+$/)||a.push(wr(e,t,n,r,i,!0))}),a}function wr(e,t,n,r,i,a){var o,s,c=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]};if(c.get?s=c.set?e.stylize(`[Getter/Setter]`,`special`):e.stylize(`[Getter]`,`special`):c.set&&(s=e.stylize(`[Setter]`,`special`)),Br(r,i)||(o=`[`+i+`]`),s||(e.seen.indexOf(c.value)<0?(s=Or(n)?br(e,c.value,null):br(e,c.value,n-1),s.indexOf(`
|
|
23
|
+
`)>-1&&(s=a?s.split(`
|
|
24
|
+
`).map(function(e){return` `+e}).join(`
|
|
25
|
+
`).substr(2):`
|
|
26
|
+
`+s.split(`
|
|
27
|
+
`).map(function(e){return` `+e}).join(`
|
|
28
|
+
`))):s=e.stylize(`[Circular]`,`special`)),Mr(o)){if(a&&i.match(/^\d+$/))return s;o=JSON.stringify(``+i),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,`name`)):(o=o.replace(/'/g,`\\'`).replace(/\\"/g,`"`).replace(/(^"|"$)/g,`'`),o=e.stylize(o,`string`))}return o+`: `+s}function Tr(e,t,n){var r=0;return e.reduce(function(e,t){return r++,t.indexOf(`
|
|
29
|
+
`)>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,``).length+1},0)>60?n[0]+(t===``?``:t+`
|
|
30
|
+
`)+` `+e.join(`,
|
|
31
|
+
`)+` `+n[1]:n[0]+t+` `+e.join(`, `)+` `+n[1]}function Er(e){return Array.isArray(e)}function Dr(e){return typeof e==`boolean`}function Or(e){return e===null}function kr(e){return e==null}function Ar(e){return typeof e==`number`}function jr(e){return typeof e==`string`}function Mr(e){return e===void 0}function Nr(e){return Pr(e)&&Rr(e)===`[object RegExp]`}function Pr(e){return typeof e==`object`&&!!e}function Fr(e){return Pr(e)&&Rr(e)===`[object Date]`}function Ir(e){return Pr(e)&&(Rr(e)===`[object Error]`||e instanceof Error)}function Lr(e){return typeof e==`function`}function Rr(e){return Object.prototype.toString.call(e)}function zr(e,t){if(!t||!Pr(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}function Br(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Vr=[],Hr=[],Ur=typeof Uint8Array<`u`?Uint8Array:Array,Wr=!1;function Gr(){Wr=!0;for(var e=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,t=0,n=e.length;t<n;++t)Vr[t]=e[t],Hr[e.charCodeAt(t)]=t;Hr[45]=62,Hr[95]=63}function Kr(e){Wr||Gr();var t,n,r,i,a,o,s=e.length;if(s%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);a=e[s-2]===`=`?2:+(e[s-1]===`=`),o=new Ur(s*3/4-a),r=a>0?s-4:s;var c=0;for(t=0,n=0;t<r;t+=4,n+=3)i=Hr[e.charCodeAt(t)]<<18|Hr[e.charCodeAt(t+1)]<<12|Hr[e.charCodeAt(t+2)]<<6|Hr[e.charCodeAt(t+3)],o[c++]=i>>16&255,o[c++]=i>>8&255,o[c++]=i&255;return a===2?(i=Hr[e.charCodeAt(t)]<<2|Hr[e.charCodeAt(t+1)]>>4,o[c++]=i&255):a===1&&(i=Hr[e.charCodeAt(t)]<<10|Hr[e.charCodeAt(t+1)]<<4|Hr[e.charCodeAt(t+2)]>>2,o[c++]=i>>8&255,o[c++]=i&255),o}function qr(e){return Vr[e>>18&63]+Vr[e>>12&63]+Vr[e>>6&63]+Vr[e&63]}function Jr(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16)+(e[a+1]<<8)+e[a+2],i.push(qr(r));return i.join(``)}function Yr(e){Wr||Gr();for(var t,n=e.length,r=n%3,i=``,a=[],o=16383,s=0,c=n-r;s<c;s+=o)a.push(Jr(e,s,s+o>c?c:s+o));return r===1?(t=e[n-1],i+=Vr[t>>2],i+=Vr[t<<4&63],i+=`==`):r===2&&(t=(e[n-2]<<8)+e[n-1],i+=Vr[t>>10],i+=Vr[t>>4&63],i+=Vr[t<<2&63],i+=`=`),a.push(i),a.join(``)}function Xr(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)}function Zr(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}var Qr={}.toString,$r=Array.isArray||function(e){return Qr.call(e)==`[object Array]`};I.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT===void 0||globalThis.TYPED_ARRAY_SUPPORT,ei();function ei(){return I.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function ti(e,t){if(ei()<t)throw RangeError(`Invalid typed array length`);return I.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t),e.__proto__=I.prototype):(e===null&&(e=new I(t)),e.length=t),e}function I(e,t,n){if(!I.TYPED_ARRAY_SUPPORT&&!(this instanceof I))return new I(e,t,n);if(typeof e==`number`){if(typeof t==`string`)throw Error(`If encoding is specified then the first argument must be a string`);return ai(this,e)}return ni(this,e,t,n)}I.poolSize=8192,I._augment=function(e){return e.__proto__=I.prototype,e};function ni(e,t,n,r){if(typeof t==`number`)throw TypeError(`"value" argument must not be a number`);return typeof ArrayBuffer<`u`&&t instanceof ArrayBuffer?ci(e,t,n,r):typeof t==`string`?oi(e,t,n):li(e,t)}I.from=function(e,t,n){return ni(null,e,t,n)},I.TYPED_ARRAY_SUPPORT&&(I.prototype.__proto__=Uint8Array.prototype,I.__proto__=Uint8Array);function ri(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be a number`);if(e<0)throw RangeError(`"size" argument must not be negative`)}function ii(e,t,n,r){return ri(t),t<=0||n===void 0?ti(e,t):typeof r==`string`?ti(e,t).fill(n,r):ti(e,t).fill(n)}I.alloc=function(e,t,n){return ii(null,e,t,n)};function ai(e,t){if(ri(t),e=ti(e,t<0?0:ui(t)|0),!I.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}I.allocUnsafe=function(e){return ai(null,e)},I.allocUnsafeSlow=function(e){return ai(null,e)};function oi(e,t,n){if((typeof n!=`string`||n===``)&&(n=`utf8`),!I.isEncoding(n))throw TypeError(`"encoding" must be a valid string encoding`);var r=fi(t,n)|0;e=ti(e,r);var i=e.write(t,n);return i!==r&&(e=e.slice(0,i)),e}function si(e,t){var n=t.length<0?0:ui(t.length)|0;e=ti(e,n);for(var r=0;r<n;r+=1)e[r]=t[r]&255;return e}function ci(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw RangeError(`'offset' is out of bounds`);if(t.byteLength<n+(r||0))throw RangeError(`'length' is out of bounds`);return t=n===void 0&&r===void 0?new Uint8Array(t):r===void 0?new Uint8Array(t,n):new Uint8Array(t,n,r),I.TYPED_ARRAY_SUPPORT?(e=t,e.__proto__=I.prototype):e=si(e,t),e}function li(e,t){if(di(t)){var n=ui(t.length)|0;return e=ti(e,n),e.length===0||t.copy(e,0,0,n),e}if(t){if(typeof ArrayBuffer<`u`&&t.buffer instanceof ArrayBuffer||`length`in t)return typeof t.length!=`number`||Gi(t.length)?ti(e,0):si(e,t);if(t.type===`Buffer`&&$r(t.data))return si(e,t.data)}throw TypeError(`First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.`)}function ui(e){if(e>=ei())throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+ei().toString(16)+` bytes`);return e|0}I.isBuffer=Ki;function di(e){return!!(e!=null&&e._isBuffer)}I.compare=function(e,t){if(!di(e)||!di(t))throw TypeError(`Arguments must be Buffers`);if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},I.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},I.concat=function(e,t){if(!$r(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return I.alloc(0);var n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=I.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var a=e[n];if(!di(a))throw TypeError(`"list" argument must be an Array of Buffers`);a.copy(r,i),i+=a.length}return r};function fi(e,t){if(di(e))return e.length;if(typeof ArrayBuffer<`u`&&typeof ArrayBuffer.isView==`function`&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;typeof e!=`string`&&(e=``+e);var n=e.length;if(n===0)return 0;for(var r=!1;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:case void 0:return Bi(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return Ui(e).length;default:if(r)return Bi(e).length;t=(``+t).toLowerCase(),r=!0}}I.byteLength=fi;function pi(e,t,n){var r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return ki(this,t,n);case`utf8`:case`utf-8`:return wi(this,t,n);case`ascii`:return Di(this,t,n);case`latin1`:case`binary`:return Oi(this,t,n);case`base64`:return Ci(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return Ai(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}I.prototype._isBuffer=!0;function mi(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}I.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(var t=0;t<e;t+=2)mi(this,t,t+1);return this},I.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(var t=0;t<e;t+=4)mi(this,t,t+3),mi(this,t+1,t+2);return this},I.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(var t=0;t<e;t+=8)mi(this,t,t+7),mi(this,t+1,t+6),mi(this,t+2,t+5),mi(this,t+3,t+4);return this},I.prototype.toString=function(){var e=this.length|0;return e===0?``:arguments.length===0?wi(this,0,e):pi.apply(this,arguments)},I.prototype.equals=function(e){if(!di(e))throw TypeError(`Argument must be a Buffer`);return this===e||I.compare(this,e)===0},I.prototype.inspect=function(){var e=``,t=50;return this.length>0&&(e=this.toString(`hex`,0,t).match(/.{2}/g).join(` `),this.length>t&&(e+=` ... `)),`<Buffer `+e+`>`},I.prototype.compare=function(e,t,n,r,i){if(!di(e))throw TypeError(`Argument must be a Buffer`);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var a=i-r,o=n-t,s=Math.min(a,o),c=this.slice(r,i),l=e.slice(t,n),u=0;u<s;++u)if(c[u]!==l[u]){a=c[u],o=l[u];break}return a<o?-1:+(o<a)};function hi(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(i)n=0;else return-1}if(typeof t==`string`&&(t=I.from(t,r)),di(t))return t.length===0?-1:gi(e,t,n,r,i);if(typeof t==`number`)return t&=255,I.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):gi(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function gi(e,t,n,r,i){var a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}var l;if(i){var u=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,u===-1?0:l-u)){if(u===-1&&(u=l),l-u+1===s)return u*a}else u!==-1&&(l-=l-u),u=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){for(var d=!0,f=0;f<s;f++)if(c(e,l+f)!==c(t,f)){d=!1;break}if(d)return l}return-1}I.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},I.prototype.indexOf=function(e,t,n){return hi(this,e,t,n,!0)},I.prototype.lastIndexOf=function(e,t,n){return hi(this,e,t,n,!1)};function _i(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;var a=t.length;if(a%2!=0)throw TypeError(`Invalid hex string`);r>a/2&&(r=a/2);for(var o=0;o<r;++o){var s=parseInt(t.substr(o*2,2),16);if(isNaN(s))return o;e[n+o]=s}return o}function vi(e,t,n,r){return Wi(Bi(t,e.length-n),e,n,r)}function yi(e,t,n,r){return Wi(Vi(t),e,n,r)}function bi(e,t,n,r){return yi(e,t,n,r)}function xi(e,t,n,r){return Wi(Ui(t),e,n,r)}function Si(e,t,n,r){return Wi(Hi(t,e.length-n),e,n,r)}I.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t|=0,isFinite(n)?(n|=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);var i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;for(var a=!1;;)switch(r){case`hex`:return _i(this,e,t,n);case`utf8`:case`utf-8`:return vi(this,e,t,n);case`ascii`:return yi(this,e,t,n);case`latin1`:case`binary`:return bi(this,e,t,n);case`base64`:return xi(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return Si(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},I.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function Ci(e,t,n){return t===0&&n===e.length?Yr(e):Yr(e.slice(t,n))}function wi(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var a=e[i],o=null,s=a>239?4:a>223?3:a>191?2:1;if(i+s<=n){var c,l,u,d;switch(s){case 1:a<128&&(o=a);break;case 2:c=e[i+1],(c&192)==128&&(d=(a&31)<<6|c&63,d>127&&(o=d));break;case 3:c=e[i+1],l=e[i+2],(c&192)==128&&(l&192)==128&&(d=(a&15)<<12|(c&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:c=e[i+1],l=e[i+2],u=e[i+3],(c&192)==128&&(l&192)==128&&(u&192)==128&&(d=(a&15)<<18|(c&63)<<12|(l&63)<<6|u&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|o&1023),r.push(o),i+=s}return Ei(r)}var Ti=4096;function Ei(e){var t=e.length;if(t<=Ti)return String.fromCharCode.apply(String,e);for(var n=``,r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=Ti));return n}function Di(e,t,n){var r=``;n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function Oi(e,t,n){var r=``;n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function ki(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i=``,a=t;a<n;++a)i+=zi(e[a]);return i}function Ai(e,t,n){for(var r=e.slice(t,n),i=``,a=0;a<r.length;a+=2)i+=String.fromCharCode(r[a]+r[a+1]*256);return i}I.prototype.slice=function(e,t){var n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);var r;if(I.TYPED_ARRAY_SUPPORT)r=this.subarray(e,t),r.__proto__=I.prototype;else{var i=t-e;r=new I(i,void 0);for(var a=0;a<i;++a)r[a]=this[a+e]}return r};function L(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}I.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||L(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r},I.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||L(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},I.prototype.readUInt8=function(e,t){return t||L(e,1,this.length),this[e]},I.prototype.readUInt16LE=function(e,t){return t||L(e,2,this.length),this[e]|this[e+1]<<8},I.prototype.readUInt16BE=function(e,t){return t||L(e,2,this.length),this[e]<<8|this[e+1]},I.prototype.readUInt32LE=function(e,t){return t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},I.prototype.readUInt32BE=function(e,t){return t||L(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},I.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||L(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},I.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||L(e,t,this.length);for(var r=t,i=1,a=this[e+--r];r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},I.prototype.readInt8=function(e,t){return t||L(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},I.prototype.readInt16LE=function(e,t){t||L(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},I.prototype.readInt16BE=function(e,t){t||L(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},I.prototype.readInt32LE=function(e,t){return t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},I.prototype.readInt32BE=function(e,t){return t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},I.prototype.readFloatLE=function(e,t){return t||L(e,4,this.length),Xr(this,e,!0,23,4)},I.prototype.readFloatBE=function(e,t){return t||L(e,4,this.length),Xr(this,e,!1,23,4)},I.prototype.readDoubleLE=function(e,t){return t||L(e,8,this.length),Xr(this,e,!0,52,8)},I.prototype.readDoubleBE=function(e,t){return t||L(e,8,this.length),Xr(this,e,!1,52,8)};function R(e,t,n,r,i,a){if(!di(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}I.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){var i=2**(8*n)-1;R(this,e,t,n,i,0)}var a=1,o=0;for(this[t]=e&255;++o<n&&(a*=256);)this[t+o]=e/a&255;return t+n},I.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){var i=2**(8*n)-1;R(this,e,t,n,i,0)}var a=n-1,o=1;for(this[t+a]=e&255;--a>=0&&(o*=256);)this[t+a]=e/o&255;return t+n},I.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,1,255,0),I.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=e&255,t+1};function ji(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-n,2);i<a;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>(r?i:1-i)*8}I.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,65535,0),I.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):ji(this,e,t,!0),t+2},I.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,65535,0),I.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):ji(this,e,t,!1),t+2};function Mi(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-n,4);i<a;++i)e[n+i]=t>>>(r?i:3-i)*8&255}I.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,4294967295,0),I.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255):Mi(this,e,t,!0),t+4},I.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,4294967295,0),I.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):Mi(this,e,t,!1),t+4},I.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=2**(8*n-1);R(this,e,t,n,i-1,-i)}var a=0,o=1,s=0;for(this[t]=e&255;++a<n&&(o*=256);)e<0&&s===0&&this[t+a-1]!==0&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},I.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=2**(8*n-1);R(this,e,t,n,i-1,-i)}var a=n-1,o=1,s=0;for(this[t+a]=e&255;--a>=0&&(o*=256);)e<0&&s===0&&this[t+a+1]!==0&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},I.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,1,127,-128),I.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=e&255,t+1},I.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,32767,-32768),I.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):ji(this,e,t,!0),t+2},I.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,32767,-32768),I.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):ji(this,e,t,!1),t+2},I.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,2147483647,-2147483648),I.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Mi(this,e,t,!0),t+4},I.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),I.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):Mi(this,e,t,!1),t+4};function Ni(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function Pi(e,t,n,r,i){return i||Ni(e,t,n,4),Zr(e,t,n,r,23,4),n+4}I.prototype.writeFloatLE=function(e,t,n){return Pi(this,e,t,!0,n)},I.prototype.writeFloatBE=function(e,t,n){return Pi(this,e,t,!1,n)};function Fi(e,t,n,r,i){return i||Ni(e,t,n,8),Zr(e,t,n,r,52,8),n+8}I.prototype.writeDoubleLE=function(e,t,n){return Fi(this,e,t,!0,n)},I.prototype.writeDoubleBE=function(e,t,n){return Fi(this,e,t,!1,n)},I.prototype.copy=function(e,t,n,r){if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`sourceStart out of bounds`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i=r-n,a;if(this===e&&n<t&&t<r)for(a=i-1;a>=0;--a)e[a+t]=this[a+n];else if(i<1e3||!I.TYPED_ARRAY_SUPPORT)for(a=0;a<i;++a)e[a+t]=this[a+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+i),t);return i},I.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),e.length===1){var i=e.charCodeAt(0);i<256&&(e=i)}if(r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!I.isEncoding(r))throw TypeError(`Unknown encoding: `+r)}else typeof e==`number`&&(e&=255);if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;var a;if(typeof e==`number`)for(a=t;a<n;++a)this[a]=e;else{var o=di(e)?e:Bi(new I(e,r).toString()),s=o.length;for(a=0;a<n-t;++a)this[a+t]=o[a%s]}return this};var Ii=/[^+\/0-9A-Za-z-_]/g;function Li(e){if(e=Ri(e).replace(Ii,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function Ri(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,``)}function zi(e){return e<16?`0`+e.toString(16):e.toString(16)}function Bi(e,t){t||=1/0;for(var n,r=e.length,i=null,a=[],o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function Vi(e){for(var t=[],n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function Hi(e,t){for(var n,r,i,a=[],o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function Ui(e){return Kr(Li(e))}function Wi(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Gi(e){return e!==e}function Ki(e){return e!=null&&(!!e._isBuffer||qi(e)||Ji(e))}function qi(e){return!!e.constructor&&typeof e.constructor.isBuffer==`function`&&e.constructor.isBuffer(e)}function Ji(e){return typeof e.readFloatLE==`function`&&typeof e.slice==`function`&&qi(e.slice(0,0))}var Yi=Xi;function Xi(){this.head=null,this.tail=null,this.length=0}Xi.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},Xi.prototype.unshift=function(e){var t={data:e,next:this.head};this.length===0&&(this.tail=t),this.head=t,++this.length},Xi.prototype.shift=function(){if(this.length!==0){var e=this.head.data;return this.head=this.length===1?this.tail=null:this.head.next,--this.length,e}},Xi.prototype.clear=function(){this.head=this.tail=null,this.length=0},Xi.prototype.join=function(e){if(this.length===0)return``;for(var t=this.head,n=``+t.data;t=t.next;)n+=e+t.data;return n},Xi.prototype.concat=function(e){if(this.length===0)return I.alloc(0);if(this.length===1)return this.head.data;for(var t=I.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t};var Zi=I.isEncoding||function(e){switch(e&&e.toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:case`raw`:return!0;default:return!1}};function Qi(e){if(e&&!Zi(e))throw Error(`Unknown encoding: `+e)}function $i(e){switch(this.encoding=(e||`utf8`).toLowerCase().replace(/[-_]/,``),Qi(e),this.encoding){case`utf8`:this.surrogateSize=3;break;case`ucs2`:case`utf16le`:this.surrogateSize=2,this.detectIncompleteChar=ta;break;case`base64`:this.surrogateSize=3,this.detectIncompleteChar=na;break;default:this.write=ea;return}this.charBuffer=new I(6),this.charReceived=0,this.charLength=0}$i.prototype.write=function(e){for(var t=``;this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return``;e=e.slice(n,e.length),t=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var r=t.charCodeAt(t.length-1);if(r>=55296&&r<=56319){this.charLength+=this.surrogateSize,t=``;continue}if(this.charReceived=this.charLength=0,e.length===0)return t;break}this.detectIncompleteChar(e);var i=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),t+=e.toString(this.encoding,0,i);var i=t.length-1,r=t.charCodeAt(i);if(r>=55296&&r<=56319){var a=this.surrogateSize;return this.charLength+=a,this.charReceived+=a,this.charBuffer.copy(this.charBuffer,a,0,a),e.copy(this.charBuffer,0,0,a),t.substring(0,i)}return t},$i.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(t==1&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},$i.prototype.end=function(e){var t=``;if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t};function ea(e){return e.toString(this.encoding)}function ta(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function na(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}B.ReadableState=aa;var z=hr(`stream`);F(B,N);function ra(e,t,n){if(typeof e.prependListener==`function`)return e.prependListener(t,n);!e._events||!e._events[t]?e.on(t,n):Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]}function ia(e,t){return e.listeners(t).length}function aa(e,t){e||={},this.objectMode=!!e.objectMode,t instanceof Qa&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||n===0?n:r,this.highWaterMark=~~this.highWaterMark,this.buffer=new Yi,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||`utf8`,this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new $i(e.encoding),this.encoding=e.encoding)}function B(e){if(!(this instanceof B))return new B(e);this._readableState=new aa(e,this),this.readable=!0,e&&typeof e.read==`function`&&(this._read=e.read),N.call(this)}B.prototype.push=function(e,t){var n=this._readableState;return!n.objectMode&&typeof e==`string`&&(t||=n.defaultEncoding,t!==n.encoding&&(e=Buffer.from(e,t),t=``)),oa(this,n,e,t,!1)},B.prototype.unshift=function(e){var t=this._readableState;return oa(this,t,e,``,!0)},B.prototype.isPaused=function(){return this._readableState.flowing===!1};function oa(e,t,n,r,i){var a=da(t,n);if(a)e.emit(`error`,a);else if(n===null)t.reading=!1,fa(e,t);else if(t.objectMode||n&&n.length>0){if(t.ended&&!i){var o=Error(`stream.push() after EOF`);e.emit(`error`,o)}else if(t.endEmitted&&i){var s=Error(`stream.unshift() after end event`);e.emit(`error`,s)}else{var c;t.decoder&&!i&&!r&&(n=t.decoder.write(n),c=!t.objectMode&&n.length===0),i||(t.reading=!1),c||(t.flowing&&t.length===0&&!t.sync?(e.emit(`data`,n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&pa(e))),ha(e,t)}}else i||(t.reading=!1);return sa(t)}function sa(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}B.prototype.setEncoding=function(e){return this._readableState.decoder=new $i(e),this._readableState.encoding=e,this};var ca=8388608;function la(e){return e>=ca?e=ca:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function ua(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e===e?(e>t.highWaterMark&&(t.highWaterMark=la(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0)):t.flowing&&t.length?t.buffer.head.data.length:t.length}B.prototype.read=function(e){z(`read`,e),e=parseInt(e,10);var t=this._readableState,n=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return z(`read: emitReadable`,t.length,t.ended),t.length===0&&t.ended?Ea(this):pa(this),null;if(e=ua(e,t),e===0&&t.ended)return t.length===0&&Ea(this),null;var r=t.needReadable;z(`need readable`,r),(t.length===0||t.length-e<t.highWaterMark)&&(r=!0,z(`length less than watermark`,r)),t.ended||t.reading?(r=!1,z(`reading or ended`,r)):r&&(z(`do read`),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=ua(n,t)));var i=e>0?Sa(e,t):null;return i===null?(t.needReadable=!0,e=0):t.length-=e,t.length===0&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&Ea(this)),i!==null&&this.emit(`data`,i),i};function da(e,t){var n=null;return!Buffer.isBuffer(t)&&typeof t!=`string`&&t!=null&&!e.objectMode&&(n=TypeError(`Invalid non-string/buffer chunk`)),n}function fa(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,pa(e)}}function pa(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(z(`emitReadable`,t.flowing),t.emittedReadable=!0,t.sync?P(ma,e):ma(e))}function ma(e){z(`emit readable`),e.emit(`readable`),xa(e)}function ha(e,t){t.readingMore||(t.readingMore=!0,P(ga,e,t))}function ga(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(z(`maybeReadMore read 0`),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}B.prototype._read=function(e){this.emit(`error`,Error(`not implemented`))},B.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,z(`pipe count=%d opts=%j`,r.pipesCount,t);var i=!t||t.end!==!1?o:l;r.endEmitted?P(i):n.once(`end`,i),e.on(`unpipe`,a);function a(e){z(`onunpipe`),e===n&&l()}function o(){z(`onend`),e.end()}var s=_a(n);e.on(`drain`,s);var c=!1;function l(){z(`cleanup`),e.removeListener(`close`,p),e.removeListener(`finish`,m),e.removeListener(`drain`,s),e.removeListener(`error`,f),e.removeListener(`unpipe`,a),n.removeListener(`end`,o),n.removeListener(`end`,l),n.removeListener(`data`,d),c=!0,r.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&s()}var u=!1;n.on(`data`,d);function d(t){z(`ondata`),u=!1,!1===e.write(t)&&!u&&((r.pipesCount===1&&r.pipes===e||r.pipesCount>1&&ka(r.pipes,e)!==-1)&&!c&&(z(`false write response, pause`,n._readableState.awaitDrain),n._readableState.awaitDrain++,u=!0),n.pause())}function f(t){z(`onerror`,t),h(),e.removeListener(`error`,f),ia(e,`error`)===0&&e.emit(`error`,t)}ra(e,`error`,f);function p(){e.removeListener(`finish`,m),h()}e.once(`close`,p);function m(){z(`onfinish`),e.removeListener(`close`,p),h()}e.once(`finish`,m);function h(){z(`unpipe`),n.unpipe(e)}return e.emit(`pipe`,n),r.flowing||(z(`pipe resume`),n.resume()),e};function _a(e){return function(){var t=e._readableState;z(`pipeOnDrain`,t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&e.listeners(`data`).length&&(t.flowing=!0,xa(e))}}B.prototype.unpipe=function(e){var t=this._readableState;if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||=t.pipes,t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit(`unpipe`,this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i<r;i++)n[i].emit(`unpipe`,this);return this}var a=ka(t.pipes,e);return a===-1?this:(t.pipes.splice(a,1),--t.pipesCount,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit(`unpipe`,this),this)},B.prototype.on=function(e,t){var n=N.prototype.on.call(this,e,t);if(e===`data`)this._readableState.flowing!==!1&&this.resume();else if(e===`readable`){var r=this._readableState;!r.endEmitted&&!r.readableListening&&(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&pa(this,r):P(va,this))}return n},B.prototype.addListener=B.prototype.on;function va(e){z(`readable nexttick read 0`),e.read(0)}B.prototype.resume=function(){var e=this._readableState;return e.flowing||(z(`resume`),e.flowing=!0,ya(this,e)),this};function ya(e,t){t.resumeScheduled||(t.resumeScheduled=!0,P(ba,e,t))}function ba(e,t){t.reading||(z(`resume read 0`),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit(`resume`),xa(e),t.flowing&&!t.reading&&e.read(0)}B.prototype.pause=function(){return z(`call pause flowing=%j`,this._readableState.flowing),!1!==this._readableState.flowing&&(z(`pause`),this._readableState.flowing=!1,this.emit(`pause`)),this};function xa(e){var t=e._readableState;for(z(`flow`,t.flowing);t.flowing&&e.read()!==null;);}B.prototype.wrap=function(e){var t=this._readableState,n=!1,r=this;for(var i in e.on(`end`,function(){if(z(`wrapped end`),t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&r.push(e)}r.push(null)}),e.on(`data`,function(i){z(`wrapped data`),t.decoder&&(i=t.decoder.write(i)),!(t.objectMode&&i==null)&&(t.objectMode||i&&i.length)&&(r.push(i)||(n=!0,e.pause()))}),e)this[i]===void 0&&typeof e[i]==`function`&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));return Oa([`error`,`close`,`destroy`,`pause`,`resume`],function(t){e.on(t,r.emit.bind(r,t))}),r._read=function(t){z(`wrapped _read`,t),n&&(n=!1,e.resume())},r},B._fromList=Sa;function Sa(e,t){if(t.length===0)return null;var n;return t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(``):t.buffer.length===1?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=Ca(e,t.buffer,t.decoder),n}function Ca(e,t,n){var r;return e<t.head.data.length?(r=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):r=e===t.head.data.length?t.shift():n?wa(e,t):Ta(e,t),r}function wa(e,t){var n=t.head,r=1,i=n.data;for(e-=i.length;n=n.next;){var a=n.data,o=e>a.length?a.length:e;if(o===a.length?i+=a:i+=a.slice(0,e),e-=o,e===0){o===a.length?(++r,t.head=n.next?n.next:t.tail=null):(t.head=n,n.data=a.slice(o));break}++r}return t.length-=r,i}function Ta(e,t){var n=Buffer.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var a=r.data,o=e>a.length?a.length:e;if(a.copy(n,n.length-e,0,o),e-=o,e===0){o===a.length?(++i,t.head=r.next?r.next:t.tail=null):(t.head=r,r.data=a.slice(o));break}++i}return t.length-=i,n}function Ea(e){var t=e._readableState;if(t.length>0)throw Error(`"endReadable()" called on non-empty stream`);t.endEmitted||(t.ended=!0,P(Da,t,e))}function Da(e,t){!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit(`end`))}function Oa(e,t){for(var n=0,r=e.length;n<r;n++)t(e[n],n)}function ka(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}V.WritableState=Ma,F(V,N);function Aa(){}function ja(e,t,n){this.chunk=e,this.encoding=t,this.callback=n,this.next=null}function Ma(e,t){Object.defineProperty(this,"buffer",{get:fr(function(){return this.getBuffer()},`_writableState.buffer is deprecated. Use _writableState.getBuffer instead.`)}),e||={},this.objectMode=!!e.objectMode,t instanceof Qa&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||n===0?n:r,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var i=e.decodeStrings===!1;this.decodeStrings=!i,this.defaultEncoding=e.defaultEncoding||`utf8`,this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){Ba(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new Ja(this)}Ma.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t};function V(e){if(!(this instanceof V)&&!(this instanceof Qa))return new V(e);this._writableState=new Ma(e,this),this.writable=!0,e&&(typeof e.write==`function`&&(this._write=e.write),typeof e.writev==`function`&&(this._writev=e.writev)),N.call(this)}V.prototype.pipe=function(){this.emit(`error`,Error(`Cannot pipe, not readable`))};function Na(e,t){var n=Error(`write after end`);e.emit(`error`,n),P(t,n)}function Pa(e,t,n,r){var i=!0,a=!1;return n===null?a=TypeError(`May not write null values to stream`):!I.isBuffer(n)&&typeof n!=`string`&&n!==void 0&&!t.objectMode&&(a=TypeError(`Invalid non-string/buffer chunk`)),a&&(e.emit(`error`,a),P(r,a),i=!1),i}V.prototype.write=function(e,t,n){var r=this._writableState,i=!1;return typeof t==`function`&&(n=t,t=null),I.isBuffer(e)?t=`buffer`:t||=r.defaultEncoding,typeof n!=`function`&&(n=Aa),r.ended?Na(this,n):Pa(this,r,e,n)&&(r.pendingcb++,i=Ia(this,r,e,t,n)),i},V.prototype.cork=function(){var e=this._writableState;e.corked++},V.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.finished&&!e.bufferProcessing&&e.bufferedRequest&&Ua(this,e))},V.prototype.setDefaultEncoding=function(e){if(typeof e==`string`&&(e=e.toLowerCase()),!([`hex`,`utf8`,`utf-8`,`ascii`,`binary`,`base64`,`ucs2`,`ucs-2`,`utf16le`,`utf-16le`,`raw`].indexOf((e+``).toLowerCase())>-1))throw TypeError(`Unknown encoding: `+e);return this._writableState.defaultEncoding=e,this};function Fa(e,t,n){return!e.objectMode&&e.decodeStrings!==!1&&typeof t==`string`&&(t=I.from(t,n)),t}function Ia(e,t,n,r,i){n=Fa(t,n,r),I.isBuffer(n)&&(r=`buffer`);var a=t.objectMode?1:n.length;t.length+=a;var o=t.length<t.highWaterMark;if(o||(t.needDrain=!0),t.writing||t.corked){var s=t.lastBufferedRequest;t.lastBufferedRequest=new ja(n,r,i),s?s.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else La(e,t,!1,a,n,r,i);return o}function La(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function Ra(e,t,n,r,i){--t.pendingcb,n?P(i,r):i(r),e._writableState.errorEmitted=!0,e.emit(`error`,r)}function za(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function Ba(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(za(n),t)Ra(e,n,r,t,i);else{var a=Wa(n);!a&&!n.corked&&!n.bufferProcessing&&n.bufferedRequest&&Ua(e,n),r?P(Va,e,n,a,i):Va(e,n,a,i)}}function Va(e,t,n,r){n||Ha(e,t),t.pendingcb--,r(),Ka(e,t)}function Ha(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit(`drain`))}function Ua(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=Array(r),a=t.corkedRequestsFree;a.entry=n;for(var o=0;n;)i[o]=n,n=n.next,o+=1;La(e,t,!0,t.length,i,``,a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new Ja(t)}else{for(;n;){var s=n.chunk,c=n.encoding,l=n.callback;if(La(e,t,!1,t.objectMode?1:s.length,s,c,l),n=n.next,t.writing)break}n===null&&(t.lastBufferedRequest=null)}t.bufferedRequestCount=0,t.bufferedRequest=n,t.bufferProcessing=!1}V.prototype._write=function(e,t,n){n(Error(`not implemented`))},V.prototype._writev=null,V.prototype.end=function(e,t,n){var r=this._writableState;typeof e==`function`?(n=e,e=null,t=null):typeof t==`function`&&(n=t,t=null),e!=null&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),!r.ending&&!r.finished&&qa(this,r,n)};function Wa(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function Ga(e,t){t.prefinished||(t.prefinished=!0,e.emit(`prefinish`))}function Ka(e,t){var n=Wa(t);return n&&(t.pendingcb===0?(Ga(e,t),t.finished=!0,e.emit(`finish`)):Ga(e,t)),n}function qa(e,t,n){t.ending=!0,Ka(e,t),n&&(t.finished?P(n):e.once(`finish`,n)),t.ended=!0,e.writable=!1}function Ja(e){var t=this;this.next=null,this.entry=null,this.finish=function(n){var r=t.entry;for(t.entry=null;r;){var i=r.callback;e.pendingcb--,i(n),r=r.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}}F(Qa,B);for(var Ya=Object.keys(V.prototype),Xa=0;Xa<Ya.length;Xa++){var Za=Ya[Xa];Qa.prototype[Za]||(Qa.prototype[Za]=V.prototype[Za])}function Qa(e){if(!(this instanceof Qa))return new Qa(e);B.call(this,e),V.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once(`end`,$a)}function $a(){this.allowHalfOpen||this._writableState.ended||P(eo,this)}function eo(e){e.end()}F(ro,Qa);function to(e){this.afterTransform=function(t,n){return no(e,t,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function no(e,t,n){var r=e._transformState;r.transforming=!1;var i=r.writecb;if(!i)return e.emit(`error`,Error(`no writecb in Transform class`));r.writechunk=null,r.writecb=null,n!=null&&e.push(n),i(t);var a=e._readableState;a.reading=!1,(a.needReadable||a.length<a.highWaterMark)&&e._read(a.highWaterMark)}function ro(e){if(!(this instanceof ro))return new ro(e);Qa.call(this,e),this._transformState=new to(this);var t=this;this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform==`function`&&(this._transform=e.transform),typeof e.flush==`function`&&(this._flush=e.flush)),this.once(`prefinish`,function(){typeof this._flush==`function`?this._flush(function(e){io(t,e)}):io(t)})}ro.prototype.push=function(e,t){return this._transformState.needTransform=!1,Qa.prototype.push.call(this,e,t)},ro.prototype._transform=function(e,t,n){throw Error(`Not implemented`)},ro.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},ro.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};function io(e,t){if(t)return e.emit(`error`,t);var n=e._writableState,r=e._transformState;if(n.length)throw Error(`Calling transform done when ws.length != 0`);if(r.transforming)throw Error(`Calling transform done when still transforming`);return e.push(null)}var ao={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4};function oo(e,t,n){var r=this;B.call(r),r._mode=n,r.headers={},r.rawHeaders=[],r.trailers={},r.rawTrailers=[],r.on(`end`,function(){process.nextTick(function(){r.emit(`close`)})});var i;if(n===`fetch`){r._fetchResponse=t,r.url=t.url,r.statusCode=t.status,r.statusMessage=t.statusText;for(var a,o,s=t.headers[Symbol.iterator]();a=(o=s.next()).value,!o.done;)r.headers[a[0].toLowerCase()]=a[1],r.rawHeaders.push(a[0],a[1]);var c=t.body.getReader();i=function(){c.read().then(function(e){if(!r._destroyed){if(e.done){r.push(null);return}r.push(new Buffer(e.value)),i()}})},i()}else if(r._xhr=e,r._pos=0,r.url=e.responseURL,r.statusCode=e.status,r.statusMessage=e.statusText,e.getAllResponseHeaders().split(/\r?\n/).forEach(function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var n=t[1].toLowerCase();n===`set-cookie`?(r.headers[n]===void 0&&(r.headers[n]=[]),r.headers[n].push(t[2])):r.headers[n]===void 0?r.headers[n]=t[2]:r.headers[n]+=`, `+t[2],r.rawHeaders.push(t[1],t[2])}}),r._charset=`x-user-defined`,!Cn){var l=r.rawHeaders[`mime-type`];if(l){var u=l.match(/;\s*charset=([^;])(;|$)/);u&&(r._charset=u[1].toLowerCase())}r._charset||=`utf-8`}}F(oo,B),oo.prototype._read=function(){},oo.prototype._onXHRProgress=function(){var e=this,t=e._xhr,n=null;switch(e._mode){case`text:vbarray`:if(t.readyState!==ao.DONE)break;try{n=new globalThis.VBArray(t.responseBody).toArray()}catch{}if(n!==null){e.push(new Buffer(n));break}case`text`:try{n=t.responseText}catch{e._mode=`text:vbarray`;break}if(n.length>e._pos){var r=n.substr(e._pos);if(e._charset===`x-user-defined`){for(var i=new Buffer(r.length),a=0;a<r.length;a++)i[a]=r.charCodeAt(a)&255;e.push(i)}else e.push(r,e._charset);e._pos=n.length}break;case`arraybuffer`:if(t.readyState!==ao.DONE||!t.response)break;n=t.response,e.push(new Buffer(new Uint8Array(n)));break;case`moz-chunked-arraybuffer`:if(n=t.response,t.readyState!==ao.LOADING||!n)break;e.push(new Buffer(new Uint8Array(n)));break;case`ms-stream`:if(n=t.response,t.readyState!==ao.LOADING)break;var o=new globalThis.MSStreamReader;o.onprogress=function(){o.result.byteLength>e._pos&&(e.push(new Buffer(new Uint8Array(o.result.slice(e._pos)))),e._pos=o.result.byteLength)},o.onload=function(){e.push(null)},o.readAsArrayBuffer(n)}e._xhr.readyState===ao.DONE&&e._mode!==`ms-stream`&&e.push(null)};function so(e){if(e instanceof Uint8Array){if(e.byteOffset===0&&e.byteLength===e.buffer.byteLength)return e.buffer;if(typeof e.buffer.slice==`function`)return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(Ki(e)){for(var t=new Uint8Array(e.length),n=e.length,r=0;r<n;r++)t[r]=e[r];return t.buffer}throw Error(`Argument must be a Buffer`)}function co(e,t){return pn&&t?`fetch`:Sn?`moz-chunked-arraybuffer`:xn?`ms-stream`:bn&&e?`arraybuffer`:wn&&e?`text:vbarray`:`text`}var lo=H;function H(e){var t=this;V.call(t),t._opts=e,t._body=[],t._headers={},e.auth&&t.setHeader(`Authorization`,`Basic `+new Buffer(e.auth).toString(`base64`)),Object.keys(e.headers).forEach(function(n){t.setHeader(n,e.headers[n])});var n,r=!0;if(e.mode===`disable-fetch`)r=!1,n=!0;else if(e.mode===`prefer-streaming`)n=!1;else if(e.mode===`allow-wrong-content-type`)n=!Cn;else if(!e.mode||e.mode==="default"||e.mode===`prefer-fast`)n=!0;else throw Error(`Invalid value for opts.mode`);t._mode=co(n,r),t.on(`finish`,function(){t._onFinish()})}F(H,V);var uo=[`accept-charset`,`accept-encoding`,`access-control-request-headers`,`access-control-request-method`,`connection`,`content-length`,`cookie`,`cookie2`,`date`,`dnt`,`expect`,`host`,`keep-alive`,`origin`,`referer`,`te`,`trailer`,`transfer-encoding`,`upgrade`,`user-agent`,`via`];H.prototype.setHeader=function(e,t){var n=this,r=e.toLowerCase();uo.indexOf(r)===-1&&(n._headers[r]={name:e,value:t})},H.prototype.getHeader=function(e){return this._headers[e.toLowerCase()].value},H.prototype.removeHeader=function(e){var t=this;delete t._headers[e.toLowerCase()]},H.prototype._onFinish=function(){var e=this;if(!e._destroyed){var t=e._opts,n=e._headers,r;if((t.method===`POST`||t.method===`PUT`||t.method===`PATCH`)&&(r=hn()?new globalThis.Blob(e._body.map(function(e){return so(e)}),{type:(n[`content-type`]||{}).value||``}):Buffer.concat(e._body).toString()),e._mode===`fetch`){var i=Object.keys(n).map(function(e){return[n[e].name,n[e].value]});globalThis.fetch(e._opts.url,{method:e._opts.method,headers:i,body:r,mode:`cors`,credentials:t.withCredentials?`include`:`same-origin`}).then(function(t){e._fetchResponse=t,e._connect()},function(t){e.emit(`error`,t)})}else{var a=e._xhr=new globalThis.XMLHttpRequest;try{a.open(e._opts.method,e._opts.url,!0)}catch(t){process.nextTick(function(){e.emit(`error`,t)});return}`responseType`in a&&(a.responseType=e._mode.split(`:`)[0]),`withCredentials`in a&&(a.withCredentials=!!t.withCredentials),e._mode===`text`&&`overrideMimeType`in a&&a.overrideMimeType(`text/plain; charset=x-user-defined`),Object.keys(n).forEach(function(e){a.setRequestHeader(n[e].name,n[e].value)}),e._response=null,a.onreadystatechange=function(){switch(a.readyState){case ao.LOADING:case ao.DONE:e._onXHRProgress()}},e._mode===`moz-chunked-arraybuffer`&&(a.onprogress=function(){e._onXHRProgress()}),a.onerror=function(){e._destroyed||e.emit(`error`,Error(`XHR error`))};try{a.send(r)}catch(t){process.nextTick(function(){e.emit(`error`,t)});return}}}};function fo(e){try{var t=e.status;return t!==null&&t!==0}catch{return!1}}H.prototype._onXHRProgress=function(){var e=this;fo(e._xhr)&&!e._destroyed&&(e._response||e._connect(),e._response._onXHRProgress())},H.prototype._connect=function(){var e=this;e._destroyed||(e._response=new oo(e._xhr,e._fetchResponse,e._mode),e.emit(`response`,e._response))},H.prototype._write=function(e,t,n){this._body.push(e),n()},H.prototype.abort=H.prototype.destroy=function(){var e=this;e._destroyed=!0,e._response&&(e._response._destroyed=!0),e._xhr&&e._xhr.abort()},H.prototype.end=function(e,t,n){var r=this;typeof e==`function`&&(n=e,e=void 0),V.prototype.end.call(r,e,t,n)},H.prototype.flushHeaders=function(){},H.prototype.setTimeout=function(){},H.prototype.setNoDelay=function(){},H.prototype.setSocketKeepAlive=function(){};var po=2147483647,mo=36,ho=1,go=26,_o=38,vo=700,yo=72,bo=128,xo=`-`,So=/[^\x20-\x7E]/,Co=/[\x2E\u3002\uFF0E\uFF61]/g,wo={overflow:`Overflow: input needs wider integers to process`,"not-basic":`Illegal input >= 0x80 (not a basic code point)`,"invalid-input":`Invalid input`},To=mo-ho,Eo=Math.floor,Do=String.fromCharCode;function Oo(e){throw RangeError(wo[e])}function ko(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function Ao(e,t){var n=e.split(`@`),r=``;n.length>1&&(r=n[0]+`@`,e=n[1]),e=e.replace(Co,`.`);var i=ko(e.split(`.`),t).join(`.`);return r+i}function jo(e){for(var t=[],n=0,r=e.length,i,a;n<r;)i=e.charCodeAt(n++),i>=55296&&i<=56319&&n<r?(a=e.charCodeAt(n++),(a&64512)==56320?t.push(((i&1023)<<10)+(a&1023)+65536):(t.push(i),n--)):t.push(i);return t}function Mo(e,t){return e+22+75*(e<26)-((t!=0)<<5)}function No(e,t,n){var r=0;for(e=n?Eo(e/vo):e>>1,e+=Eo(e/t);e>To*go>>1;r+=mo)e=Eo(e/To);return Eo(r+(To+1)*e/(e+_o))}function Po(e){var t,n,r,i,a,o,s,c,l,u,d,f=[],p,m,h,g;for(e=jo(e),p=e.length,t=bo,n=0,a=yo,o=0;o<p;++o)d=e[o],d<128&&f.push(Do(d));for(r=i=f.length,i&&f.push(xo);r<p;){for(s=po,o=0;o<p;++o)d=e[o],d>=t&&d<s&&(s=d);for(m=r+1,s-t>Eo((po-n)/m)&&Oo(`overflow`),n+=(s-t)*m,t=s,o=0;o<p;++o)if(d=e[o],d<t&&++n>po&&Oo(`overflow`),d==t){for(c=n,l=mo;u=l<=a?ho:l>=a+go?go:l-a,!(c<u);l+=mo)g=c-u,h=mo-u,f.push(Do(Mo(u+g%h,0))),c=Eo(g/h);f.push(Do(Mo(c,0))),a=No(n,m,r==i),n=0,++r}++n,++t}return f.join(``)}function Fo(e){return Ao(e,function(e){return So.test(e)?`xn--`+Po(e):e})}function Io(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Lo=Array.isArray||function(e){return Object.prototype.toString.call(e)===`[object Array]`};function Ro(e){switch(typeof e){case`string`:return e;case`boolean`:return e?`true`:`false`;case`number`:return isFinite(e)?e:``;default:return``}}function zo(e,t,n,r){return t||=`&`,n||=`=`,e===null&&(e=void 0),typeof e==`object`?Bo(Vo(e),function(r){var i=encodeURIComponent(Ro(r))+n;return Lo(e[r])?Bo(e[r],function(e){return i+encodeURIComponent(Ro(e))}).join(t):i+encodeURIComponent(Ro(e[r]))}).join(t):r?encodeURIComponent(Ro(r))+n+encodeURIComponent(Ro(e)):``}function Bo(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t(e[r],r));return n}var Vo=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t};function Ho(e,t,n,r){t||=`&`,n||=`=`;var i={};if(typeof e!=`string`||e.length===0)return i;var a=/\+/g;e=e.split(t);var o=1e3;r&&typeof r.maxKeys==`number`&&(o=r.maxKeys);var s=e.length;o>0&&s>o&&(s=o);for(var c=0;c<s;++c){var l=e[c].replace(a,`%20`),u=l.indexOf(n),d,f,p,m;u>=0?(d=l.substr(0,u),f=l.substr(u+1)):(d=l,f=``),p=decodeURIComponent(d),m=decodeURIComponent(f),Io(i,p)?Lo(i[p])?i[p].push(m):i[p]=[i[p],m]:i[p]=m}return i}function Uo(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var Wo=/^([a-z0-9.+-]+:)/i,Go=/:[0-9]*$/,Ko=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,qo=[`'`,`{`,`}`,`|`,`\\`,`^`,"`",`<`,`>`,`"`,"`",` `,`\r`,`
|
|
32
|
+
`,` `],Jo=[`%`,`/`,`?`,`;`,`#`].concat(qo),Yo=[`/`,`?`,`#`],Xo=255,Zo=/^[+a-z0-9A-Z_-]{0,63}$/,Qo=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,$o={javascript:!0,"javascript:":!0},es={javascript:!0,"javascript:":!0},ts={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function ns(e,t,n){if(e&&Pr(e)&&e instanceof Uo)return e;var r=new Uo;return r.parse(e,t,n),r}Uo.prototype.parse=function(e,t,n){return rs(this,e,t,n)};function rs(e,t,n,r){if(!jr(t))throw TypeError(`Parameter 'url' must be a string, not `+typeof t);var i=t.indexOf(`?`),a=i!==-1&&i<t.indexOf(`#`)?`?`:`#`,o=t.split(a);o[0]=o[0].replace(/\\/g,`/`),t=o.join(a);var s=t;if(s=s.trim(),!r&&t.split(`#`).length===1){var c=Ko.exec(s);if(c)return e.path=s,e.href=s,e.pathname=c[1],c[2]?(e.search=c[2],e.query=n?Ho(e.search.substr(1)):e.search.substr(1)):n&&(e.search=``,e.query={}),e}var l=Wo.exec(s);if(l){l=l[0];var u=l.toLowerCase();e.protocol=u,s=s.substr(l.length)}if(r||l||s.match(/^\/\/[^@\/]+@[^@\/]+/)){var d=s.substr(0,2)===`//`;d&&!(l&&es[l])&&(s=s.substr(2),e.slashes=!0)}var f,p,m,h;if(!es[l]&&(d||l&&!ts[l])){var g=-1;for(f=0;f<Yo.length;f++)p=s.indexOf(Yo[f]),p!==-1&&(g===-1||p<g)&&(g=p);var _,v=g===-1?s.lastIndexOf(`@`):s.lastIndexOf(`@`,g);for(v!==-1&&(_=s.slice(0,v),s=s.slice(v+1),e.auth=decodeURIComponent(_)),g=-1,f=0;f<Jo.length;f++)p=s.indexOf(Jo[f]),p!==-1&&(g===-1||p<g)&&(g=p);g===-1&&(g=s.length),e.host=s.slice(0,g),s=s.slice(g),as(e),e.hostname=e.hostname||``;var y=e.hostname[0]===`[`&&e.hostname[e.hostname.length-1]===`]`;if(!y){var b=e.hostname.split(/\./);for(f=0,m=b.length;f<m;f++){var x=b[f];if(x&&!x.match(Zo)){for(var S=``,C=0,w=x.length;C<w;C++)x.charCodeAt(C)>127?S+=`x`:S+=x[C];if(!S.match(Zo)){var T=b.slice(0,f),E=b.slice(f+1),D=x.match(Qo);D&&(T.push(D[1]),E.unshift(D[2])),E.length&&(s=`/`+E.join(`.`)+s),e.hostname=T.join(`.`);break}}}}e.hostname=e.hostname.length>Xo?``:e.hostname.toLowerCase(),y||(e.hostname=Fo(e.hostname)),h=e.port?`:`+e.port:``,e.host=(e.hostname||``)+h,e.href+=e.host,y&&(e.hostname=e.hostname.substr(1,e.hostname.length-2),s[0]!==`/`&&(s=`/`+s))}if(!$o[u])for(f=0,m=qo.length;f<m;f++){var O=qo[f];if(s.indexOf(O)!==-1){var ee=encodeURIComponent(O);ee===O&&(ee=escape(O)),s=s.split(O).join(ee)}}var te=s.indexOf(`#`);te!==-1&&(e.hash=s.substr(te),s=s.slice(0,te));var ne=s.indexOf(`?`);if(ne===-1?n&&(e.search=``,e.query={}):(e.search=s.substr(ne),e.query=s.substr(ne+1),n&&(e.query=Ho(e.query)),s=s.slice(0,ne)),s&&(e.pathname=s),ts[u]&&e.hostname&&!e.pathname&&(e.pathname=`/`),e.pathname||e.search){h=e.pathname||``;var re=e.search||``;e.path=h+re}return e.href=is(e),e}function is(e){var t=e.auth||``;t&&(t=encodeURIComponent(t),t=t.replace(/%3A/i,`:`),t+=`@`);var n=e.protocol||``,r=e.pathname||``,i=e.hash||``,a=!1,o=``;e.host?a=t+e.host:e.hostname&&(a=t+(e.hostname.indexOf(`:`)===-1?e.hostname:`[`+this.hostname+`]`),e.port&&(a+=`:`+e.port)),e.query&&Pr(e.query)&&Object.keys(e.query).length&&(o=zo(e.query));var s=e.search||o&&`?`+o||``;return n&&n.substr(-1)!==`:`&&(n+=`:`),e.slashes||(!n||ts[n])&&a!==!1?(a=`//`+(a||``),r&&r.charAt(0)!==`/`&&(r=`/`+r)):a||=``,i&&i.charAt(0)!==`#`&&(i=`#`+i),s&&s.charAt(0)!==`?`&&(s=`?`+s),r=r.replace(/[?#]/g,function(e){return encodeURIComponent(e)}),s=s.replace(`#`,`%23`),n+a+r+s+i}Uo.prototype.format=function(){return is(this)},Uo.prototype.resolve=function(e){return this.resolveObject(ns(e,!1,!0)).format()},Uo.prototype.resolveObject=function(e){if(jr(e)){var t=new Uo;t.parse(e,!1,!0),e=t}for(var n=new Uo,r=Object.keys(this),i=0;i<r.length;i++){var a=r[i];n[a]=this[a]}if(n.hash=e.hash,e.href===``)return n.href=n.format(),n;if(e.slashes&&!e.protocol){for(var o=Object.keys(e),s=0;s<o.length;s++){var c=o[s];c!==`protocol`&&(n[c]=e[c])}return ts[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname=`/`),n.href=n.format(),n}var l;if(e.protocol&&e.protocol!==n.protocol){if(!ts[e.protocol]){for(var u=Object.keys(e),d=0;d<u.length;d++){var f=u[d];n[f]=e[f]}return n.href=n.format(),n}if(n.protocol=e.protocol,!e.host&&!es[e.protocol]){for(l=(e.pathname||``).split(`/`);l.length&&!(e.host=l.shift()););e.host||(e.host=``),e.hostname||(e.hostname=``),l[0]!==``&&l.unshift(``),l.length<2&&l.unshift(``),n.pathname=l.join(`/`)}else n.pathname=e.pathname;return n.search=e.search,n.query=e.query,n.host=e.host||``,n.auth=e.auth,n.hostname=e.hostname||e.host,n.port=e.port,(n.pathname||n.search)&&(n.path=(n.pathname||``)+(n.search||``)),n.slashes=n.slashes||e.slashes,n.href=n.format(),n}var p=n.pathname&&n.pathname.charAt(0)===`/`,m=e.host||e.pathname&&e.pathname.charAt(0)===`/`,h=m||p||n.host&&e.pathname,g=h,_=n.pathname&&n.pathname.split(`/`)||[],v=n.protocol&&!ts[n.protocol];l=e.pathname&&e.pathname.split(`/`)||[],v&&(n.hostname=``,n.port=null,n.host&&(_[0]===``?_[0]=n.host:_.unshift(n.host)),n.host=``,e.protocol&&(e.hostname=null,e.port=null,e.host&&(l[0]===``?l[0]=e.host:l.unshift(e.host)),e.host=null),h&&=l[0]===``||_[0]===``);var y;if(m)n.host=e.host||e.host===``?e.host:n.host,n.hostname=e.hostname||e.hostname===``?e.hostname:n.hostname,n.search=e.search,n.query=e.query,_=l;else if(l.length)_||=[],_.pop(),_=_.concat(l),n.search=e.search,n.query=e.query;else if(!kr(e.search))return v&&(n.hostname=n.host=_.shift(),y=n.host&&n.host.indexOf(`@`)>0?n.host.split(`@`):!1,y&&(n.auth=y.shift(),n.host=n.hostname=y.shift())),n.search=e.search,n.query=e.query,(!Or(n.pathname)||!Or(n.search))&&(n.path=(n.pathname?n.pathname:``)+(n.search?n.search:``)),n.href=n.format(),n;if(!_.length)return n.pathname=null,n.path=n.search?`/`+n.search:null,n.href=n.format(),n;for(var b=_.slice(-1)[0],x=(n.host||e.host||_.length>1)&&(b===`.`||b===`..`)||b===``,S=0,C=_.length;C>=0;C--)b=_[C],b===`.`?_.splice(C,1):b===`..`?(_.splice(C,1),S++):S&&(_.splice(C,1),S--);if(!h&&!g)for(;S--;)_.unshift(`..`);h&&_[0]!==``&&(!_[0]||_[0].charAt(0)!==`/`)&&_.unshift(``),x&&_.join(`/`).substr(-1)!==`/`&&_.push(``);var w=_[0]===``||_[0]&&_[0].charAt(0)===`/`;return v&&(n.hostname=n.host=w?``:_.length?_.shift():``,y=n.host&&n.host.indexOf(`@`)>0?n.host.split(`@`):!1,y&&(n.auth=y.shift(),n.host=n.hostname=y.shift())),h||=n.host&&_.length,h&&!w&&_.unshift(``),_.length?n.pathname=_.join(`/`):(n.pathname=null,n.path=null),(!Or(n.pathname)||!Or(n.search))&&(n.path=(n.pathname?n.pathname:``)+(n.search?n.search:``)),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},Uo.prototype.parseHost=function(){return as(this)};function as(e){var t=e.host,n=Go.exec(t);n&&(n=n[0],n!==`:`&&(e.port=n.substr(1)),t=t.substr(0,t.length-n.length)),t&&(e.hostname=t)}var os=t({Agent:()=>ls,METHODS:()=>us,STATUS_CODES:()=>ds,default:()=>fs,get:()=>cs,request:()=>ss});function ss(e,t){typeof e==`string`&&(e=ns(e));var n=globalThis.location.protocol.search(/^https?:$/)===-1?`http:`:``,r=e.protocol||n,i=e.hostname||e.host,a=e.port,o=e.path||`/`;i&&i.indexOf(`:`)!==-1&&(i=`[`+i+`]`),e.url=(i?r+`//`+i:``)+(a?`:`+a:``)+o,e.method=(e.method||`GET`).toUpperCase(),e.headers=e.headers||{};var s=new lo(e);return t&&s.on(`response`,t),s}function cs(e,t){var n=ss(e,t);return n.end(),n}function ls(){}ls.defaultMaxSockets=4;var us=`CHECKOUT.CONNECT.COPY.DELETE.GET.HEAD.LOCK.M-SEARCH.MERGE.MKACTIVITY.MKCOL.MOVE.NOTIFY.OPTIONS.PATCH.POST.PROPFIND.PROPPATCH.PURGE.PUT.REPORT.SEARCH.SUBSCRIBE.TRACE.UNLOCK.UNSUBSCRIBE`.split(`.`),ds={100:`Continue`,101:`Switching Protocols`,102:`Processing`,200:`OK`,201:`Created`,202:`Accepted`,203:`Non-Authoritative Information`,204:`No Content`,205:`Reset Content`,206:`Partial Content`,207:`Multi-Status`,300:`Multiple Choices`,301:`Moved Permanently`,302:`Moved Temporarily`,303:`See Other`,304:`Not Modified`,305:`Use Proxy`,307:`Temporary Redirect`,400:`Bad Request`,401:`Unauthorized`,402:`Payment Required`,403:`Forbidden`,404:`Not Found`,405:`Method Not Allowed`,406:`Not Acceptable`,407:`Proxy Authentication Required`,408:`Request Time-out`,409:`Conflict`,410:`Gone`,411:`Length Required`,412:`Precondition Failed`,413:`Request Entity Too Large`,414:`Request-URI Too Large`,415:`Unsupported Media Type`,416:`Requested Range Not Satisfiable`,417:`Expectation Failed`,418:`I'm a teapot`,422:`Unprocessable Entity`,423:`Locked`,424:`Failed Dependency`,425:`Unordered Collection`,426:`Upgrade Required`,428:`Precondition Required`,429:`Too Many Requests`,431:`Request Header Fields Too Large`,500:`Internal Server Error`,501:`Not Implemented`,502:`Bad Gateway`,503:`Service Unavailable`,504:`Gateway Time-out`,505:`HTTP Version Not Supported`,506:`Variant Also Negotiates`,507:`Insufficient Storage`,509:`Bandwidth Limit Exceeded`,510:`Not Extended`,511:`Network Authentication Required`},fs={request:ss,get:cs,Agent:ls,METHODS:us,STATUS_CODES:ds};typeof globalThis<`u`&&globalThis.WebSocket&&globalThis.WebSocket;var ps=class extends Error{constructor(e){super(e),this.name=`GatewayError`}},ms=class{medium=`local`;async resolve(e){try{let t=e.backend.get(e.contentHash);if(t)return{content:bs(t.payload),status:0}}catch{}return{content:``,status:2}}},hs=class{medium=`file`;async resolve(t){let n=String(t.routeData.uri??``).replace(/^file:\/\//,``);try{if(typeof process<`u`&&process.versions&&process.versions.node){let i=await r(()=>import(`./__vite-browser-external.CQZnr-r3.js`).then(t=>e(t.default,1)),__vite__mapDeps([0,1])),a=await r(()=>Promise.resolve().then(()=>Re),void 0),o=n;return a.isAbsolute(n)||(o=a.resolve(t.workspaceRoot,n)),{content:await i.readFile(o,`utf8`),status:0}}}catch{}return{content:``,status:2}}},gs=class{medium;constructor(e=`http`){this.medium=e}async resolve(e){let t=String(e.routeData.uri??``);if(!e.fetchFn)return{content:``,status:2};try{let n=typeof AbortController<`u`?new AbortController:void 0,r=n?setTimeout(()=>n.abort(),e.timeoutMs):void 0,i=await e.fetchFn(t,{headers:{"User-Agent":`CLM/1.0`},signal:n?n.signal:void 0});if(r&&clearTimeout(r),i.ok)return{content:await i.text(),status:0}}catch{}return{content:``,status:2}}},_s=class{medium=`ipfs`;async resolve(e){let t=String(e.routeData.uri??``).replace(/^ipfs:\/\//,``);if(!e.fetchFn)return{content:``,status:2};let n=[`http://127.0.0.1:5001/api/v0/cat?arg=${t}`,`https://ipfs.io/ipfs/${t}`];for(let t of n)try{let n=typeof AbortController<`u`?new AbortController:void 0,r=n?setTimeout(()=>n.abort(),e.timeoutMs):void 0,i=await e.fetchFn(t,{signal:n?n.signal:void 0});if(r&&clearTimeout(r),i.ok)return{content:await i.text(),status:0}}catch{}return{content:``,status:2}}},vs=class{medium=`indexeddb`;async resolve(e){return{content:``,status:2}}},ys=class{plugins=new Map;register(e){this.plugins.set(e.medium.toLowerCase(),e)}get(e){return this.plugins.get(e.toLowerCase())}};function bs(e){return e.kind===`text`?e.value:e.kind===`scalar`?String(e.value??``):e.kind===`structured`?JSON.stringify(e.value):e.kind===`binary`?typeof Buffer<`u`?Buffer.from(e.data).toString(`utf8`):new TextDecoder().decode(e.data):``}function xs(e){let t=e.indexOf(`:`);return t>=0?e.slice(t+1):e}function Ss(e,t){let n=e.resolveHandle(Se.parse(`route:${t}`));if(!n)return{medium:`local`,routeData:{}};let r=e.get(n);if(!r)return{medium:`local`,routeData:{}};try{let e=it(bs(r.payload));if(e&&typeof e==`object`)return{medium:String(e.medium??`local`).toLowerCase(),routeData:e}}catch{}return{medium:`local`,routeData:{}}}function Cs(e,t,n){let r=String(n.cached_hash??``);if(r&&r!==`null`&&r!==`undefined`){let t=xs(r),n=e.get(A.fromHex(t));if(n)return{content:bs(n.payload),hash:t}}let i=e.handleHistory(Se.parse(t));for(let t=i.length-1;t>=0;t--){let n=e.get(i[t]);if(n)return{content:bs(n.payload),hash:i[t].asHex()}}return null}function ws(e,t,n){let r=A.computeString(t),i=j.create(n,t,xe.create(`did:clm:gateway`),1);return e.put(r,i),r.asHex()}var Ts=new ys;Ts.register(new ms),Ts.register(new hs),Ts.register(new gs(`http`)),Ts.register(new gs(`https`)),Ts.register(new _s),Ts.register(new vs);async function Es(e){let{uri:t,backend:n,workspaceRoot:r=`.`,fallback:i=`error`,cache:a=!0,timeoutMs:o=1e4,fetchFn:s=typeof globalThis<`u`&&globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,visitedHandles:c=new Set([t])}=e,l=t,u=``,d=0,f=`local`,p=!1,m=!1,h=``;for(;;){let e=n.resolveHandle(Se.parse(l));if(!e&&!l.startsWith(`clm:`)&&(e=n.resolveHandle(Se.parse(`clm:${l}`))),!e){if(l===t)throw new ps(`Handle not found: ${l}`);break}h=e.asHex();let{medium:g,routeData:_}=Ss(n,h);f=g;let v=await(Ts.get(g)??Ts.get(`local`)).resolve({routeData:_,contentHash:e,backend:n,workspaceRoot:r,timeoutMs:o,fetchFn:s});if(u=v.content,d=v.status,d===0&&g!==`local`){let e=String(_.cached_hash??``);if(e&&e!==`null`&&e!==`undefined`&&A.computeString(u).asHex()!==xs(e)&&(d=2),d===0&&a)try{h=ws(n,u,String(_.uri??`clm:${l}`)),m=!0}catch{}}if(d!==0){if(i===`stale`){let e=Cs(n,l,_);e&&(u=e.content,h=e.hash,d=3,p=!0)}if(d!==3)throw new ps(`Network error resolving medium ${g} for ${l}`)}if(u.length<=255&&/^[a-zA-Z0-9_:-]+$/.test(u.trim())){let e=u.trim();if(n.resolveHandle(Se.parse(e))){if(c.has(e))throw new ps(`Circular reference detected`);c.add(e),l=e;continue}}break}return{content:u,hash:h,statusCode:d,medium:f,cached:m,staleUsed:p}}function Ds(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function Os(e){return e?/<[a-zA-Z0-9_-]+(\s+[^>]*)?\/?>/.test(e):!1}function ks(e){let t={},n=/([a-zA-Z0-9_:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/g,r;for(;(r=n.exec(e))!==null;){let e=r[1];t[e]=Ds(r[2]??r[3]??r[4]??``)}return t}function As(e){let t=(e||``).trim();if(!t)return[];if(!t.includes(`<`)||!t.includes(`>`))return[{type:`text`,text:t}];let n=[],r=/<(\/)?([a-zA-Z0-9_:-]+)((?:\s+[^>]*?)?)(\/)?>/g,i=0,a;for(;(a=r.exec(t))!==null;){let[e,o,s,c,l]=a,u=a.index;if(u>i){let e=Ds(t.slice(i,u));if(e.length>0){if(n.length>0&&n[n.length-1]?.type===`text`){let t=n[n.length-1];n[n.length-1]={...t,text:(t.text??``)+e}}else n.push({type:`text`,text:e})}}i=u+e.length;let d=s.toLowerCase();if(o)continue;let f=ks(c||``);if(!l){let e=`</${s}>`,a=t.indexOf(e,i);if(a!==-1){let o=t.slice(i,a);if(i=a+e.length,r.lastIndex=i,d===`text`){let e=Ds(o);n.push({type:`text`,text:e});continue}if(d===`quote`){let e=f.id||f.message_id||``,t=Ds(o),r=As(o),i={};for(let[e,t]of Object.entries(f))e!==`id`&&e!==`message_id`&&(i[e]=t);n.push({type:`quote`,...e?{id:e}:{},...t?{text:t}:{},...Object.keys(i).length>0?{attrs:i}:{},...r.length>0?{children:r}:{}});continue}if(d===`button`){let e=f.id||``,t=f.label||Ds(o),r=f.action||f.pcard;n.push({type:`button`,id:e,label:t,...r?{action:r}:{}});continue}if(d===`witness`){let e=f.verdict||`pass`,t=f.proof||Ds(o),r={};for(let[e,t]of Object.entries(f))e!==`verdict`&&e!==`proof`&&(r[e]=t);n.push({type:`witness`,verdict:e,...t?{proof:t}:{},...Object.keys(r).length>0?{attrs:r}:{}});continue}}}switch(d){case`text`:{let e=f.text||f.content||``;e&&n.push({type:`text`,text:e});break}case`at`:{let e=f.id||f.user_id||``,t=f.role;n.push({type:`at`,id:e,...t?{role:t}:{}});break}case`quote`:{let e=f.id||f.message_id||``,t={};for(let[e,n]of Object.entries(f))e!==`id`&&e!==`message_id`&&(t[e]=n);n.push({type:`quote`,...e?{id:e}:{},...Object.keys(t).length>0?{attrs:t}:{}});break}case`img`:case`image`:{let e=f.src||f.url||``,t=f.width?parseInt(f.width,10):void 0,r=f.height?parseInt(f.height,10):void 0;n.push({type:`image`,src:e,...f.alt?{alt:f.alt}:{},...t===void 0?{}:{width:t},...r===void 0?{}:{height:r}});break}case`audio`:{let e=f.src||f.url||``;n.push({type:`audio`,src:e});break}case`video`:{let e=f.src||f.url||``;n.push({type:`video`,src:e});break}case`button`:{let e=f.id||``,t=f.label||``,r=f.action||f.pcard;n.push({type:`button`,id:e,label:t,...r?{action:r}:{}});break}case`witness`:{let e=f.verdict||`pass`,t=f.proof,r={};for(let[e,t]of Object.entries(f))e!==`verdict`&&e!==`proof`&&(r[e]=t);n.push({type:`witness`,verdict:e,...t?{proof:t}:{},...Object.keys(r).length>0?{attrs:r}:{}});break}case`action`:{let e=f.id||``;n.push({type:`action`,id:e});break}case`card`:{let e=f.hash||``,t=f.handle||``,r=f.cardType||f[`card-type`]||`document`;n.push({type:`card`,hash:e,handle:t,cardType:r});break}case`execute`:{let e=f.pcard||``,t=f.input||``,r=f.label;n.push({type:`execute`,pcard:e,input:t,...r?{label:r}:{}});break}case`model3d`:{let e=f.src||f.url||``,t={};for(let[e,n]of Object.entries(f))e!==`src`&&e!==`url`&&(t[e]=n);n.push({type:`model3d`,src:e,...Object.keys(t).length>0?{attrs:t}:{}});break}default:n.push({type:d,...Object.keys(f).length>0?{attrs:f}:{}})}}if(i<t.length){let e=Ds(t.slice(i));if(e.length>0){if(n.length>0&&n[n.length-1]?.type===`text`){let t=n[n.length-1];n[n.length-1]={...t,text:(t.text??``)+e}}else n.push({type:`text`,text:e})}}return n.length===0&&t.length>0&&n.push({type:`text`,text:t}),n}function js(e){if(e instanceof j){let t=e.metadata.get(`speech_act_type`);if(typeof t==`string`&&[`assertive`,`directive`,`commissive`,`expressive`,`declarative`].includes(t))return t;if(e.payload.kind===`structured`&&typeof e.payload.value==`object`){let t=e.payload.value;if(t.speechActType&&typeof t.speechActType==`string`)return t.speechActType}return`assertive`}if(e.elements.some(e=>e.type===`execute`||e.type===`action`||e.type===`button`))return`directive`;let t=e.elements.filter(e=>e.type===`text`&&e.text).map(e=>e.text).join(` `).toLowerCase();return t.startsWith(`i declare`)||t.startsWith(`verdict:`)||t.startsWith(`sealed:`)?`declarative`:t.startsWith(`i promise`)||t.startsWith(`will `)||t.startsWith(`plan:`)?`commissive`:t.startsWith(`thanks`)||t.startsWith(`good`)||t.startsWith(`error`)||t.startsWith(`feedback:`)?`expressive`:t.endsWith(`?`)||t.startsWith(`/run`)||t.startsWith(`please`)||t.startsWith(`do `)?`directive`:`assertive`}function Ms(e){return e==null?`null`:typeof e==`number`||typeof e==`boolean`||typeof e==`string`?JSON.stringify(e):Array.isArray(e)?`[`+e.map(Ms).join(`,`)+`]`:typeof e==`object`?`{`+Object.keys(e).filter(t=>e[t]!==void 0).sort().map(t=>`${JSON.stringify(t)}:${Ms(e[t])}`).join(`,`)+`}`:JSON.stringify(e)}function Ns(e){let t=e.elements.map(e=>{let t={id:e.id??null,label:e.label??null,src:e.src??null,text:e.text??null,type:e.type};return e.hash!==void 0&&(t.hash=e.hash),e.handle!==void 0&&(t.handle=e.handle),e.cardType!==void 0&&(t.cardType=e.cardType),e.pcard!==void 0&&(t.pcard=e.pcard),e.input!==void 0&&(t.input=e.input),e.alt!==void 0&&(t.alt=e.alt),e.width!==void 0&&(t.width=e.width),e.height!==void 0&&(t.height=e.height),t}),n=Ms({channel_id:e.channel_id,elements:t,id:e.id,timestamp:e.timestamp,user_did:e.user_did});return A.computeString(n).asHex()}function Ps(e,t){let n=Ns(e),r=t?.speechActType??js(e),i={mcard_uri:`mcard:chat/message/${e.id}`,type:`clm:types:chat:satori_message`,header:{id:e.id,channel_id:e.channel_id,user_did:e.user_did,timestamp:e.timestamp},speech_act_type:r,elements:e.elements,content_hash:n},a=t?.authorDid??e.user_did,o=a.startsWith(`did:`)?xe.create(a):xe.create(`did:clm:agent:satori`),s=t?.mimeType??`application/x-satori+xml`,c=Ne(i);return j.create(`mcard:chat/message/${e.id}`,c,o,1,new Map([[`mimeType`,s],[`satori_id`,e.id],[`channel_id`,e.channel_id],[`speech_act_type`,r],[`g_time`,new Date(e.timestamp).toISOString()]]))}async function Fs(e,t,n){let r=Ps(t,{speechActType:n?.speechActType}),i=Ns(t),a=`mcard:chat/message/${t.id}`;e.getPillar(`mcard`).putCard(r);let o=`mcard:session/${t.channel_id}/history`,s=e.getPillar(`knowledge`);return s.backend.registerHandle(Se.parse(`session:${t.channel_id}:history`),r.hash),s.putCard(j.create(o,r.hash.asHex(),r.author,1)),n?.recordExecutionLog!==!1&&e.getPillar(`execution_log`).putCard(r),{card:r,hashHex:i,handle:a}}var Is={pending:[`loading`,`error`],loading:[`active`,`error`],active:[`suspended`,`unloading`,`error`],suspended:[`active`,`unloading`,`error`],unloading:[`disposed`,`error`],disposed:[],error:[`disposed`]},Ls=class{id;coeffects;#e=`pending`;#t=[];#n=new y;#r;constructor(e,t){this.id=e,this.coeffects=t}get state(){return this.#e}get disposables(){return this.#n}get guard(){return this.#r}onTransition(e){return this.#t.push(e),()=>{let t=this.#t.indexOf(e);t>=0&&this.#t.splice(t,1)}}async load(e,t){this.#i(`loading`);let n,r,i;if(typeof t==`object`&&t&&(`ctx`in t||`snapshot`in t||`timeoutMs`in t)){let e=t;n=e.snapshot,r=e.ctx,i=e.timeoutMs}else n=t;let a=new b;this.#r=a,a.begin(n??{});try{if(this.coeffects&&this.coeffects.requiredServices&&this.coeffects.requiredServices.length>0){if(!r)throw Error(`FiberLifecycle [${this.id}]: Cordis Context required to resolve coeffects: ${this.coeffects.requiredServices.join(`, `)}`);await Ce(this.coeffects,r,i)}await e(a),this.#i(`active`)}catch(e){throw this.#a(e instanceof Error?e:Error(String(e))),a.state===`active`&&await a.rollback(),await this.#n.dispose(),e}}async activate(e){if(this.#e!==`active`)throw Error(`FiberLifecycle: expected state "active", got "${this.#e}"`);try{await e()}catch(e){throw this.#a(e instanceof Error?e:Error(String(e))),this.#r?.state===`active`&&await this.#r.rollback(),await this.#n.dispose(),e}}suspend(){if(this.#e!==`active`)throw Error(`FiberLifecycle: expected state "active" to suspend, got "${this.#e}"`);this.#i(`suspended`)}resume(){if(this.#e!==`suspended`)throw Error(`FiberLifecycle: expected state "suspended" to resume, got "${this.#e}"`);this.#i(`active`)}async unload(e){if(this.#e!==`active`)throw Error(`FiberLifecycle: expected state "active", got "${this.#e}"`);this.#i(`unloading`);try{e&&await e(),this.#r?.state===`active`&&this.#r.commit(),await this.#n.dispose(),this.#i(`disposed`)}catch(e){throw this.#a(e instanceof Error?e:Error(String(e))),this.#r?.state===`active`&&await this.#r.rollback(),await this.#n.dispose(),e}}async forceDispose(){if(this.#e===`disposed`)return;let e=this.#e;this.#r?.state===`active`&&await this.#r.rollback(),this.#n.disposed||await this.#n.dispose(),this.#e=`disposed`,this.#o(e,`disposed`)}#i(e){let t=this.#e;if(!Is[t]?.includes(e))throw Error(`FiberLifecycle: invalid transition "${t}" \u2192 "${e}"`);this.#e=e,this.#o(t,e)}#a(e){let t=this.#e;this.#e=`error`,this.#o(t,`error`,e)}#o(e,t,n){let r={fiberId:this.id,from:e,to:t,timestamp:Date.now(),error:n};for(let e of this.#t)try{e(r)}catch{}}};Object.fromEntries(Object.entries({text:1,at:2,quote:3,image:4,audio:5,video:6,button:7,action:8,card:9,execute:10,witness:11,custom:12,message:16}).map(([e,t])=>[t,e])),v(m),v(h),v(g),v(_),Buffer.from(`302a300506032b656e032100`,`hex`);var Rs={2:`need dictionary`,1:`stream end`,0:``,"-1":`file error`,"-2":`stream error`,"-3":`data error`,"-4":`insufficient memory`,"-5":`buffer error`,"-6":`incompatible version`};function zs(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg=``,this.state=null,this.data_type=2,this.adler=0}function Bs(e,t,n,r,i){if(t.subarray&&e.subarray){e.set(t.subarray(n,n+r),i);return}for(var a=0;a<r;a++)e[i+a]=t[n+a]}var Vs=Uint8Array,Hs=Uint16Array,Us=Int32Array,Ws=4,Gs=0,Ks=1,qs=2;function Js(e){for(var t=e.length;--t>=0;)e[t]=0}var Ys=0,Xs=1,Zs=2,Qs=3,$s=258,ec=29,tc=256,nc=tc+1+ec,rc=30,ic=19,ac=2*nc+1,oc=15,sc=16,cc=7,lc=256,uc=16,dc=17,fc=18,pc=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],mc=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],hc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],gc=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],_c=512,vc=Array((nc+2)*2);Js(vc);var yc=Array(rc*2);Js(yc);var bc=Array(_c);Js(bc);var xc=Array($s-Qs+1);Js(xc);var Sc=Array(ec);Js(Sc);var Cc=Array(rc);Js(Cc);function wc(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}var Tc,Ec,Dc;function Oc(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function kc(e){return e<256?bc[e]:bc[256+(e>>>7)]}function Ac(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function U(e,t,n){e.bi_valid>sc-n?(e.bi_buf|=t<<e.bi_valid&65535,Ac(e,e.bi_buf),e.bi_buf=t>>sc-e.bi_valid,e.bi_valid+=n-sc):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)}function jc(e,t,n){U(e,n[t*2],n[t*2+1])}function Mc(e,t){var n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1}function Nc(e){e.bi_valid===16?(Ac(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function Pc(e,t){var n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,a=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length,l,u,d,f,p,m,h=0;for(f=0;f<=oc;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;l<ac;l++)u=e.heap[l],f=n[n[u*2+1]*2+1]+1,f>c&&(f=c,h++),n[u*2+1]=f,!(u>r)&&(e.bl_count[f]++,p=0,u>=s&&(p=o[u-s]),m=n[u*2],e.opt_len+=m*(f+p),a&&(e.static_len+=m*(i[u*2+1]+p)));if(h!==0){do{for(f=c-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[c]--,h-=2}while(h>0);for(f=c;f!==0;f--)for(u=e.bl_count[f];u!==0;)d=e.heap[--l],!(d>r)&&(n[d*2+1]!==f&&(e.opt_len+=(f-n[d*2+1])*n[d*2],n[d*2+1]=f),u--)}}function Fc(e,t,n){for(var r=Array(oc+1),i=0,a=1,o;a<=oc;a++)r[a]=i=i+n[a-1]<<1;for(o=0;o<=t;o++){var s=e[o*2+1];s!==0&&(e[o*2]=Mc(r[s]++,s))}}function Ic(){var e,t,n,r,i,a=Array(oc+1);for(n=0,r=0;r<ec-1;r++)for(Sc[r]=n,e=0;e<1<<pc[r];e++)xc[n++]=r;for(xc[n-1]=r,i=0,r=0;r<16;r++)for(Cc[r]=i,e=0;e<1<<mc[r];e++)bc[i++]=r;for(i>>=7;r<rc;r++)for(Cc[r]=i<<7,e=0;e<1<<mc[r]-7;e++)bc[256+i++]=r;for(t=0;t<=oc;t++)a[t]=0;for(e=0;e<=143;)vc[e*2+1]=8,e++,a[8]++;for(;e<=255;)vc[e*2+1]=9,e++,a[9]++;for(;e<=279;)vc[e*2+1]=7,e++,a[7]++;for(;e<=287;)vc[e*2+1]=8,e++,a[8]++;for(Fc(vc,nc+1,a),e=0;e<rc;e++)yc[e*2+1]=5,yc[e*2]=Mc(e,5);Tc=new wc(vc,pc,tc+1,nc,oc),Ec=new wc(yc,mc,0,rc,oc),Dc=new wc([],hc,0,ic,cc)}function Lc(e){for(var t=0;t<nc;t++)e.dyn_ltree[t*2]=0;for(t=0;t<rc;t++)e.dyn_dtree[t*2]=0;for(t=0;t<ic;t++)e.bl_tree[t*2]=0;e.dyn_ltree[lc*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function Rc(e){e.bi_valid>8?Ac(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function zc(e,t,n,r){Rc(e),r&&(Ac(e,n),Ac(e,~n)),Bs(e.pending_buf,e.window,t,n,e.pending),e.pending+=n}function Bc(e,t,n,r){var i=t*2,a=n*2;return e[i]<e[a]||e[i]===e[a]&&r[t]<=r[n]}function Vc(e,t,n){for(var r=e.heap[n],i=n<<1;i<=e.heap_len&&(i<e.heap_len&&Bc(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!Bc(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r}function Hc(e,t,n){var r,i,a=0,o,s;if(e.last_lit!==0)do r=e.pending_buf[e.d_buf+a*2]<<8|e.pending_buf[e.d_buf+a*2+1],i=e.pending_buf[e.l_buf+a],a++,r===0?jc(e,i,t):(o=xc[i],jc(e,o+tc+1,t),s=pc[o],s!==0&&(i-=Sc[o],U(e,i,s)),r--,o=kc(r),jc(e,o,n),s=mc[o],s!==0&&(r-=Cc[o],U(e,r,s)));while(a<e.last_lit);jc(e,lc,t)}function Uc(e,t){var n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,a=t.stat_desc.elems,o,s,c=-1,l;for(e.heap_len=0,e.heap_max=ac,o=0;o<a;o++)n[o*2]===0?n[o*2+1]=0:(e.heap[++e.heap_len]=c=o,e.depth[o]=0);for(;e.heap_len<2;)l=e.heap[++e.heap_len]=c<2?++c:0,n[l*2]=1,e.depth[l]=0,e.opt_len--,i&&(e.static_len-=r[l*2+1]);for(t.max_code=c,o=e.heap_len>>1;o>=1;o--)Vc(e,n,o);l=a;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Vc(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=s,n[l*2]=n[o*2]+n[s*2],e.depth[l]=(e.depth[o]>=e.depth[s]?e.depth[o]:e.depth[s])+1,n[o*2+1]=n[s*2+1]=l,e.heap[1]=l++,Vc(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Pc(e,t),Fc(n,c,e.bl_count)}function Wc(e,t,n){var r,i=-1,a,o=t[1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)a=o,o=t[(r+1)*2+1],!(++s<c&&a===o)&&(s<l?e.bl_tree[a*2]+=s:a===0?s<=10?e.bl_tree[dc*2]++:e.bl_tree[fc*2]++:(a!==i&&e.bl_tree[a*2]++,e.bl_tree[uc*2]++),s=0,i=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4))}function Gc(e,t,n){var r,i=-1,a,o=t[1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),r=0;r<=n;r++)if(a=o,o=t[(r+1)*2+1],!(++s<c&&a===o)){if(s<l)do jc(e,a,e.bl_tree);while(--s!==0);else a===0?s<=10?(jc(e,dc,e.bl_tree),U(e,s-3,3)):(jc(e,fc,e.bl_tree),U(e,s-11,7)):(a!==i&&(jc(e,a,e.bl_tree),s--),jc(e,uc,e.bl_tree),U(e,s-3,2));s=0,i=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4)}}function Kc(e){var t;for(Wc(e,e.dyn_ltree,e.l_desc.max_code),Wc(e,e.dyn_dtree,e.d_desc.max_code),Uc(e,e.bl_desc),t=ic-1;t>=3&&e.bl_tree[gc[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function qc(e,t,n,r){var i;for(U(e,t-257,5),U(e,n-1,5),U(e,r-4,4),i=0;i<r;i++)U(e,e.bl_tree[gc[i]*2+1],3);Gc(e,e.dyn_ltree,t-1),Gc(e,e.dyn_dtree,n-1)}function Jc(e){for(var t=4093624447,n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return Gs;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return Ks;for(n=32;n<tc;n++)if(e.dyn_ltree[n*2]!==0)return Ks;return Gs}var Yc=!1;function Xc(e){Yc||=(Ic(),!0),e.l_desc=new Oc(e.dyn_ltree,Tc),e.d_desc=new Oc(e.dyn_dtree,Ec),e.bl_desc=new Oc(e.bl_tree,Dc),e.bi_buf=0,e.bi_valid=0,Lc(e)}function Zc(e,t,n,r){U(e,(Ys<<1)+ +!!r,3),zc(e,t,n,!0)}function Qc(e){U(e,Xs<<1,3),jc(e,lc,vc),Nc(e)}function $c(e,t,n,r){var i,a,o=0;e.level>0?(e.strm.data_type===qs&&(e.strm.data_type=Jc(e)),Uc(e,e.l_desc),Uc(e,e.d_desc),o=Kc(e),i=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=i&&(i=a)):i=a=n+5,n+4<=i&&t!==-1?Zc(e,t,n,r):e.strategy===Ws||a===i?(U(e,(Xs<<1)+ +!!r,3),Hc(e,vc,yc)):(U(e,(Zs<<1)+ +!!r,3),qc(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),Hc(e,e.dyn_ltree,e.dyn_dtree)),Lc(e),r&&Rc(e)}function el(e,t,n){return e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=n&255,e.last_lit++,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(xc[n]+tc+1)*2]++,e.dyn_dtree[kc(t)*2]++),e.last_lit===e.lit_bufsize-1}function tl(e,t,n,r){for(var i=e&65535|0,a=e>>>16&65535|0,o=0;n!==0;){o=n>2e3?2e3:n,n-=o;do i=i+t[r++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0}function nl(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t}var rl=nl();function W(e,t,n,r){var i=rl,a=r+n;e^=-1;for(var o=r;o<a;o++)e=e>>>8^i[(e^t[o])&255];return e^-1}var il=0,al=1,ol=3,sl=4,cl=5,ll=0,ul=1,dl=-2,fl=-3,pl=-5,ml=-1,hl=1,gl=2,_l=3,vl=4,yl=2,bl=8,xl=9,Sl=286,Cl=30,wl=19,Tl=2*Sl+1,El=15,G=3,Dl=258,Ol=Dl+G+1,kl=32,Al=42,jl=69,Ml=73,Nl=91,Pl=103,Fl=113,Il=666,K=1,Ll=2,Rl=3,zl=4,Bl=3;function Vl(e,t){return e.msg=Rs[t],t}function Hl(e){return(e<<1)-(e>4?9:0)}function Ul(e){for(var t=e.length;--t>=0;)e[t]=0}function Wl(e){var t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(Bs(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))}function q(e,t){$c(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Wl(e.strm)}function J(e,t){e.pending_buf[e.pending++]=t}function Gl(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function Kl(e,t,n,r){var i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,Bs(t,e.input,e.next_in,i,n),e.state.wrap===1?e.adler=tl(e.adler,t,i,n):e.state.wrap===2&&(e.adler=W(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)}function ql(e,t){var n=e.max_chain_length,r=e.strstart,i,a,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-Ol?e.strstart-(e.w_size-Ol):0,l=e.window,u=e.w_mask,d=e.prev,f=e.strstart+Dl,p=l[r+o-1],m=l[r+o];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do if(i=t,l[i+o]===m&&l[i+o-1]===p&&l[i]===l[r]&&l[++i]===l[r+1]){r+=2,i++;do;while(l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&r<f);if(a=Dl-(f-r),r=f-Dl,a>o){if(e.match_start=t,o=a,a>=s)break;p=l[r+o-1],m=l[r+o]}}while((t=d[t&u])>c&&--n!==0);return o<=e.lookahead?o:e.lookahead}function Jl(e){var t=e.w_size,n,r,i,a,o;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Ol)){Bs(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,r=e.hash_size,n=r;do i=e.head[--n],e.head[n]=i>=t?i-t:0;while(--r);r=t,n=r;do i=e.prev[--n],e.prev[n]=i>=t?i-t:0;while(--r);a+=t}if(e.strm.avail_in===0)break;if(r=Kl(e.strm,e.window,e.strstart+e.lookahead,a),e.lookahead+=r,e.lookahead+e.insert>=G)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+G-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<G)););}while(e.lookahead<Ol&&e.strm.avail_in!==0)}function Yl(e,t){var n=65535;for(n>e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Jl(e),e.lookahead===0&&t===il)return K;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((e.strstart===0||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,q(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-Ol&&(q(e,!1),e.strm.avail_out===0))return K}return e.insert=0,t===sl?(q(e,!0),e.strm.avail_out===0?Rl:zl):(e.strstart>e.block_start&&(q(e,!1),e.strm.avail_out),K)}function Xl(e,t){for(var n,r;;){if(e.lookahead<Ol){if(Jl(e),e.lookahead<Ol&&t===il)return K;if(e.lookahead===0)break}if(n=0,e.lookahead>=G&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+G-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-Ol&&(e.match_length=ql(e,n)),e.match_length>=G){if(r=el(e,e.strstart-e.match_start,e.match_length-G),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=G){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+G-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask}else r=el(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(q(e,!1),e.strm.avail_out===0))return K}return e.insert=e.strstart<G-1?e.strstart:G-1,t===sl?(q(e,!0),e.strm.avail_out===0?Rl:zl):e.last_lit&&(q(e,!1),e.strm.avail_out===0)?K:Ll}function Zl(e,t){for(var n,r,i;;){if(e.lookahead<Ol){if(Jl(e),e.lookahead<Ol&&t===il)return K;if(e.lookahead===0)break}if(n=0,e.lookahead>=G&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+G-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=G-1,n!==0&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-Ol&&(e.match_length=ql(e,n),e.match_length<=5&&(e.strategy===hl||e.match_length===G&&e.strstart-e.match_start>4096)&&(e.match_length=G-1)),e.prev_length>=G&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-G,r=el(e,e.strstart-1-e.prev_match,e.prev_length-G),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+G-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=G-1,e.strstart++,r&&(q(e,!1),e.strm.avail_out===0))return K}else if(e.match_available){if(r=el(e,0,e.window[e.strstart-1]),r&&q(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return K}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&=(r=el(e,0,e.window[e.strstart-1]),0),e.insert=e.strstart<G-1?e.strstart:G-1,t===sl?(q(e,!0),e.strm.avail_out===0?Rl:zl):e.last_lit&&(q(e,!1),e.strm.avail_out===0)?K:Ll}function Ql(e,t){for(var n,r,i,a,o=e.window;;){if(e.lookahead<=Dl){if(Jl(e),e.lookahead<=Dl&&t===il)return K;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=G&&e.strstart>0&&(i=e.strstart-1,r=o[i],r===o[++i]&&r===o[++i]&&r===o[++i])){a=e.strstart+Dl;do;while(r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&i<a);e.match_length=Dl-(a-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=G?(n=el(e,1,e.match_length-G),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=el(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(q(e,!1),e.strm.avail_out===0))return K}return e.insert=0,t===sl?(q(e,!0),e.strm.avail_out===0?Rl:zl):e.last_lit&&(q(e,!1),e.strm.avail_out===0)?K:Ll}function $l(e,t){for(var n;;){if(e.lookahead===0&&(Jl(e),e.lookahead===0)){if(t===il)return K;break}if(e.match_length=0,n=el(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(q(e,!1),e.strm.avail_out===0))return K}return e.insert=0,t===sl?(q(e,!0),e.strm.avail_out===0?Rl:zl):e.last_lit&&(q(e,!1),e.strm.avail_out===0)?K:Ll}function eu(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}var tu=[new eu(0,0,0,0,Yl),new eu(4,4,8,4,Xl),new eu(4,5,16,8,Xl),new eu(4,6,32,32,Xl),new eu(4,4,16,16,Zl),new eu(8,16,32,32,Zl),new eu(8,16,128,128,Zl),new eu(8,32,128,256,Zl),new eu(32,128,258,1024,Zl),new eu(32,258,258,4096,Zl)];function nu(e){e.window_size=2*e.w_size,Ul(e.head),e.max_lazy_match=tu[e.level].max_lazy,e.good_match=tu[e.level].good_length,e.nice_match=tu[e.level].nice_length,e.max_chain_length=tu[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=G-1,e.match_available=0,e.ins_h=0}function ru(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=bl,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Hs(Tl*2),this.dyn_dtree=new Hs((2*Cl+1)*2),this.bl_tree=new Hs((2*wl+1)*2),Ul(this.dyn_ltree),Ul(this.dyn_dtree),Ul(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Hs(El+1),this.heap=new Hs(2*Sl+1),Ul(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Hs(2*Sl+1),Ul(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function iu(e){var t;return!e||!e.state?Vl(e,dl):(e.total_in=e.total_out=0,e.data_type=yl,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?Al:Fl,e.adler=t.wrap===2?0:1,t.last_flush=il,Xc(t),ll)}function au(e){var t=iu(e);return t===ll&&nu(e.state),t}function ou(e,t,n,r,i,a){if(!e)return dl;var o=1;if(t===ml&&(t=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),i<1||i>xl||n!==bl||r<8||r>15||t<0||t>9||a<0||a>vl)return Vl(e,dl);r===8&&(r=9);var s=new ru;return e.state=s,s.strm=e,s.wrap=o,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+G-1)/G),s.window=new Vs(s.w_size*2),s.head=new Hs(s.hash_size),s.prev=new Hs(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Vs(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=a,s.method=n,au(e)}function su(e,t){var n,r,i,a;if(!e||!e.state||t>cl||t<0)return e?Vl(e,dl):dl;if(r=e.state,!e.output||!e.input&&e.avail_in!==0||r.status===Il&&t!==sl)return Vl(e,e.avail_out===0?pl:dl);if(r.strm=e,n=r.last_flush,r.last_flush=t,r.status===Al){if(r.wrap===2)e.adler=0,J(r,31),J(r,139),J(r,8),r.gzhead?(J(r,+!!r.gzhead.text+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),J(r,r.gzhead.time&255),J(r,r.gzhead.time>>8&255),J(r,r.gzhead.time>>16&255),J(r,r.gzhead.time>>24&255),J(r,r.level===9?2:r.strategy>=gl||r.level<2?4:0),J(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(J(r,r.gzhead.extra.length&255),J(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=W(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=jl):(J(r,0),J(r,0),J(r,0),J(r,0),J(r,0),J(r,r.level===9?2:r.strategy>=gl||r.level<2?4:0),J(r,Bl),r.status=Fl);else{var o=bl+(r.w_bits-8<<4)<<8,s=-1;s=r.strategy>=gl||r.level<2?0:r.level<6?1:r.level===6?2:3,o|=s<<6,r.strstart!==0&&(o|=kl),o+=31-o%31,r.status=Fl,Gl(r,o),r.strstart!==0&&(Gl(r,e.adler>>>16),Gl(r,e.adler&65535)),e.adler=1}}if(r.status===jl){if(r.gzhead.extra){for(i=r.pending;r.gzindex<(r.gzhead.extra.length&65535)&&!(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(e.adler=W(e.adler,r.pending_buf,r.pending-i,i)),Wl(e),i=r.pending,r.pending===r.pending_buf_size));)J(r,r.gzhead.extra[r.gzindex]&255),r.gzindex++;r.gzhead.hcrc&&r.pending>i&&(e.adler=W(e.adler,r.pending_buf,r.pending-i,i)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=Ml)}else r.status=Ml}if(r.status===Ml){if(r.gzhead.name){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(e.adler=W(e.adler,r.pending_buf,r.pending-i,i)),Wl(e),i=r.pending,r.pending===r.pending_buf_size)){a=1;break}a=r.gzindex<r.gzhead.name.length?r.gzhead.name.charCodeAt(r.gzindex++)&255:0,J(r,a)}while(a!==0);r.gzhead.hcrc&&r.pending>i&&(e.adler=W(e.adler,r.pending_buf,r.pending-i,i)),a===0&&(r.gzindex=0,r.status=Nl)}else r.status=Nl}if(r.status===Nl){if(r.gzhead.comment){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(e.adler=W(e.adler,r.pending_buf,r.pending-i,i)),Wl(e),i=r.pending,r.pending===r.pending_buf_size)){a=1;break}a=r.gzindex<r.gzhead.comment.length?r.gzhead.comment.charCodeAt(r.gzindex++)&255:0,J(r,a)}while(a!==0);r.gzhead.hcrc&&r.pending>i&&(e.adler=W(e.adler,r.pending_buf,r.pending-i,i)),a===0&&(r.status=Pl)}else r.status=Pl}if(r.status===Pl&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&Wl(e),r.pending+2<=r.pending_buf_size&&(J(r,e.adler&255),J(r,e.adler>>8&255),e.adler=0,r.status=Fl)):r.status=Fl),r.pending!==0){if(Wl(e),e.avail_out===0)return r.last_flush=-1,ll}else if(e.avail_in===0&&Hl(t)<=Hl(n)&&t!==sl)return Vl(e,pl);if(r.status===Il&&e.avail_in!==0)return Vl(e,pl);if(e.avail_in!==0||r.lookahead!==0||t!==il&&r.status!==Il){var c=r.strategy===gl?$l(r,t):r.strategy===_l?Ql(r,t):tu[r.level].func(r,t);if((c===Rl||c===zl)&&(r.status=Il),c===K||c===Rl)return e.avail_out===0&&(r.last_flush=-1),ll;if(c===Ll&&(t===al?Qc(r):t!==cl&&(Zc(r,0,0,!1),t===ol&&(Ul(r.head),r.lookahead===0&&(r.strstart=0,r.block_start=0,r.insert=0))),Wl(e),e.avail_out===0))return r.last_flush=-1,ll}return t===sl?r.wrap<=0?ul:(r.wrap===2?(J(r,e.adler&255),J(r,e.adler>>8&255),J(r,e.adler>>16&255),J(r,e.adler>>24&255),J(r,e.total_in&255),J(r,e.total_in>>8&255),J(r,e.total_in>>16&255),J(r,e.total_in>>24&255)):(Gl(r,e.adler>>>16),Gl(r,e.adler&65535)),Wl(e),r.wrap>0&&(r.wrap=-r.wrap),r.pending===0?ul:ll):ll}function cu(e){var t;return!e||!e.state?dl:(t=e.state.status,t!==Al&&t!==jl&&t!==Ml&&t!==Nl&&t!==Pl&&t!==Fl&&t!==Il?Vl(e,dl):(e.state=null,t===Fl?Vl(e,fl):ll))}var lu=30,uu=12;function du(e,t){var n=e.state,r=e.next_in,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T=e.input,E;i=r+(e.avail_in-5),a=e.next_out,E=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),c=n.dmax,l=n.wsize,u=n.whave,d=n.wnext,f=n.window,p=n.hold,m=n.bits,h=n.lencode,g=n.distcode,_=(1<<n.lenbits)-1,v=(1<<n.distbits)-1;top:do{m<15&&(p+=T[r++]<<m,m+=8,p+=T[r++]<<m,m+=8),y=h[p&_];dolen:for(;;){if(b=y>>>24,p>>>=b,m-=b,b=y>>>16&255,b===0)E[a++]=y&65535;else if(b&16){x=y&65535,b&=15,b&&(m<b&&(p+=T[r++]<<m,m+=8),x+=p&(1<<b)-1,p>>>=b,m-=b),m<15&&(p+=T[r++]<<m,m+=8,p+=T[r++]<<m,m+=8),y=g[p&v];dodist:for(;;){if(b=y>>>24,p>>>=b,m-=b,b=y>>>16&255,b&16){if(S=y&65535,b&=15,m<b&&(p+=T[r++]<<m,m+=8,m<b&&(p+=T[r++]<<m,m+=8)),S+=p&(1<<b)-1,S>c){e.msg=`invalid distance too far back`,n.mode=lu;break top}if(p>>>=b,m-=b,b=a-o,S>b){if(b=S-b,b>u&&n.sane){e.msg=`invalid distance too far back`,n.mode=lu;break top}if(C=0,w=f,d===0){if(C+=l-b,b<x){x-=b;do E[a++]=f[C++];while(--b);C=a-S,w=E}}else if(d<b){if(C+=l+d-b,b-=d,b<x){x-=b;do E[a++]=f[C++];while(--b);if(C=0,d<x){b=d,x-=b;do E[a++]=f[C++];while(--b);C=a-S,w=E}}}else if(C+=d-b,b<x){x-=b;do E[a++]=f[C++];while(--b);C=a-S,w=E}for(;x>2;)E[a++]=w[C++],E[a++]=w[C++],E[a++]=w[C++],x-=3;x&&(E[a++]=w[C++],x>1&&(E[a++]=w[C++]))}else{C=a-S;do E[a++]=E[C++],E[a++]=E[C++],E[a++]=E[C++],x-=3;while(x>2);x&&(E[a++]=E[C++],x>1&&(E[a++]=E[C++]))}}else if(b&64){e.msg=`invalid distance code`,n.mode=lu;break top}else{y=g[(y&65535)+(p&(1<<b)-1)];continue dodist}break}}else if(!(b&64)){y=h[(y&65535)+(p&(1<<b)-1)];continue dolen}else if(b&32){n.mode=uu;break top}else{e.msg=`invalid literal/length code`,n.mode=lu;break top}break}}while(r<i&&a<s);x=m>>3,r-=x,m-=x<<3,p&=(1<<m)-1,e.next_in=r,e.next_out=a,e.avail_in=r<i?5+(i-r):5-(r-i),e.avail_out=a<s?257+(s-a):257-(a-s),n.hold=p,n.bits=m}var fu=15,pu=852,mu=592,hu=0,gu=1,_u=2,vu=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],yu=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],bu=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],xu=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];function Su(e,t,n,r,i,a,o,s){var c=s.bits,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0,y,b,x,S,C,w=null,T=0,E,D=new Hs(fu+1),O=new Hs(fu+1),ee=null,te=0,ne,re,ie;for(l=0;l<=fu;l++)D[l]=0;for(u=0;u<r;u++)D[t[n+u]]++;for(p=c,f=fu;f>=1&&D[f]===0;f--);if(p>f&&(p=f),f===0)return i[a++]=20971520,i[a++]=20971520,s.bits=1,0;for(d=1;d<f&&D[d]===0;d++);for(p<d&&(p=d),g=1,l=1;l<=fu;l++)if(g<<=1,g-=D[l],g<0)return-1;if(g>0&&(e===hu||f!==1))return-1;for(O[1]=0,l=1;l<fu;l++)O[l+1]=O[l]+D[l];for(u=0;u<r;u++)t[n+u]!==0&&(o[O[t[n+u]]++]=u);if(e===hu?(w=ee=o,E=19):e===gu?(w=vu,T-=257,ee=yu,te-=257,E=256):(w=bu,ee=xu,E=-1),v=0,u=0,l=d,C=a,m=p,h=0,x=-1,_=1<<p,S=_-1,e===gu&&_>pu||e===_u&&_>mu)return 1;for(var k=0;;){k++,ne=l-h,o[u]<E?(re=0,ie=o[u]):o[u]>E?(re=ee[te+o[u]],ie=w[T+o[u]]):(re=96,ie=0),y=1<<l-h,b=1<<m,d=b;do b-=y,i[C+(v>>h)+b]=ne<<24|re<<16|ie|0;while(b!==0);for(y=1<<l-1;v&y;)y>>=1;if(y===0?v=0:(v&=y-1,v+=y),u++,--D[l]===0){if(l===f)break;l=t[n+o[u]]}if(l>p&&(v&S)!==x){for(h===0&&(h=p),C+=d,m=l-h,g=1<<m;m+h<f&&(g-=D[m+h],!(g<=0));)m++,g<<=1;if(_+=1<<m,e===gu&&_>pu||e===_u&&_>mu)return 1;x=v&S,i[x]=p<<24|m<<16|C-a|0}}return v!==0&&(i[C+v]=l-h<<24|4194304),s.bits=p,0}var Cu=0,wu=1,Tu=2,Eu=4,Du=5,Ou=6,ku=0,Au=1,ju=2,Mu=-2,Nu=-3,Pu=-4,Fu=-5,Iu=8,Lu=1,Ru=2,zu=3,Bu=4,Vu=5,Hu=6,Uu=7,Wu=8,Gu=9,Ku=10,qu=11,Ju=12,Yu=13,Xu=14,Zu=15,Qu=16,$u=17,ed=18,td=19,nd=20,rd=21,id=22,ad=23,od=24,sd=25,cd=26,ld=27,ud=28,dd=29,Y=30,fd=31,pd=32,md=852,hd=592;function gd(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function _d(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Hs(320),this.work=new Hs(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function vd(e){var t;return!e||!e.state?Mu:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg=``,t.wrap&&(e.adler=t.wrap&1),t.mode=Lu,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Us(md),t.distcode=t.distdyn=new Us(hd),t.sane=1,t.back=-1,ku)}function yd(e){var t;return!e||!e.state?Mu:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,vd(e))}function bd(e,t){var n,r;return!e||!e.state||(r=e.state,t<0?(n=0,t=-t):(n=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?Mu:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,yd(e))}function xd(e,t){var n,r;return e?(r=new _d,e.state=r,r.window=null,n=bd(e,t),n!==ku&&(e.state=null),n):Mu}var Sd=!0,Cd,wd;function Td(e){if(Sd){var t;for(Cd=new Us(512),wd=new Us(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Su(wu,e.lens,0,288,Cd,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Su(Tu,e.lens,0,32,wd,0,e.work,{bits:5}),Sd=!1}e.lencode=Cd,e.lenbits=9,e.distcode=wd,e.distbits=5}function Ed(e,t,n,r){var i,a=e.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Vs(a.wsize)),r>=a.wsize?(Bs(a.window,t,n-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>r&&(i=r),Bs(a.window,t,n-r,i,a.wnext),r-=i,r?(Bs(a.window,t,n-r,r,0),a.wnext=r,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0}function Dd(e,t){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g=0,_,v,y,b,x,S,C,w,T=new Vs(4),E,D,O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0)return Mu;n=e.state,n.mode===Ju&&(n.mode=Yu),o=e.next_out,i=e.output,c=e.avail_out,a=e.next_in,r=e.input,s=e.avail_in,l=n.hold,u=n.bits,d=s,f=c,w=ku;inf_leave:for(;;)switch(n.mode){case Lu:if(n.wrap===0){n.mode=Yu;break}for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.wrap&2&&l===35615){n.check=0,T[0]=l&255,T[1]=l>>>8&255,n.check=W(n.check,T,2,0),l=0,u=0,n.mode=Ru;break}if(n.flags=0,n.head&&(n.head.done=!1),!(n.wrap&1)||(((l&255)<<8)+(l>>8))%31){e.msg=`incorrect header check`,n.mode=Y;break}if((l&15)!==Iu){e.msg=`unknown compression method`,n.mode=Y;break}if(l>>>=4,u-=4,C=(l&15)+8,n.wbits===0)n.wbits=C;else if(C>n.wbits){e.msg=`invalid window size`,n.mode=Y;break}n.dmax=1<<C,e.adler=n.check=1,n.mode=l&512?Ku:Ju,l=0,u=0;break;case Ru:for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.flags=l,(n.flags&255)!==Iu){e.msg=`unknown compression method`,n.mode=Y;break}if(n.flags&57344){e.msg=`unknown header flags set`,n.mode=Y;break}n.head&&(n.head.text=l>>8&1),n.flags&512&&(T[0]=l&255,T[1]=l>>>8&255,n.check=W(n.check,T,2,0)),l=0,u=0,n.mode=zu;case zu:for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.head&&(n.head.time=l),n.flags&512&&(T[0]=l&255,T[1]=l>>>8&255,T[2]=l>>>16&255,T[3]=l>>>24&255,n.check=W(n.check,T,4,0)),l=0,u=0,n.mode=Bu;case Bu:for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.head&&(n.head.xflags=l&255,n.head.os=l>>8),n.flags&512&&(T[0]=l&255,T[1]=l>>>8&255,n.check=W(n.check,T,2,0)),l=0,u=0,n.mode=Vu;case Vu:if(n.flags&1024){for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.length=l,n.head&&(n.head.extra_len=l),n.flags&512&&(T[0]=l&255,T[1]=l>>>8&255,n.check=W(n.check,T,2,0)),l=0,u=0}else n.head&&(n.head.extra=null);n.mode=Hu;case Hu:if(n.flags&1024&&(p=n.length,p>s&&(p=s),p&&(n.head&&(C=n.head.extra_len-n.length,n.head.extra||(n.head.extra=Array(n.head.extra_len)),Bs(n.head.extra,r,a,p,C)),n.flags&512&&(n.check=W(n.check,r,p,a)),s-=p,a+=p,n.length-=p),n.length))break inf_leave;n.length=0,n.mode=Uu;case Uu:if(n.flags&2048){if(s===0)break inf_leave;p=0;do C=r[a+p++],n.head&&C&&n.length<65536&&(n.head.name+=String.fromCharCode(C));while(C&&p<s);if(n.flags&512&&(n.check=W(n.check,r,p,a)),s-=p,a+=p,C)break inf_leave}else n.head&&(n.head.name=null);n.length=0,n.mode=Wu;case Wu:if(n.flags&4096){if(s===0)break inf_leave;p=0;do C=r[a+p++],n.head&&C&&n.length<65536&&(n.head.comment+=String.fromCharCode(C));while(C&&p<s);if(n.flags&512&&(n.check=W(n.check,r,p,a)),s-=p,a+=p,C)break inf_leave}else n.head&&(n.head.comment=null);n.mode=Gu;case Gu:if(n.flags&512){for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(l!==(n.check&65535)){e.msg=`header crc mismatch`,n.mode=Y;break}l=0,u=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Ju;break;case Ku:for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}e.adler=n.check=gd(l),l=0,u=0,n.mode=qu;case qu:if(n.havedict===0)return e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,ju;e.adler=n.check=1,n.mode=Ju;case Ju:if(t===Du||t===Ou)break inf_leave;case Yu:if(n.last){l>>>=u&7,u-=u&7,n.mode=ld;break}for(;u<3;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}switch(n.last=l&1,l>>>=1,--u,l&3){case 0:n.mode=Xu;break;case 1:if(Td(n),n.mode=nd,t===Ou){l>>>=2,u-=2;break inf_leave}break;case 2:n.mode=$u;break;case 3:e.msg=`invalid block type`,n.mode=Y}l>>>=2,u-=2;break;case Xu:for(l>>>=u&7,u-=u&7;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if((l&65535)!=(l>>>16^65535)){e.msg=`invalid stored block lengths`,n.mode=Y;break}if(n.length=l&65535,l=0,u=0,n.mode=Zu,t===Ou)break inf_leave;case Zu:n.mode=Qu;case Qu:if(p=n.length,p){if(p>s&&(p=s),p>c&&(p=c),p===0)break inf_leave;Bs(i,r,a,p,o),s-=p,a+=p,c-=p,o+=p,n.length-=p;break}n.mode=Ju;break;case $u:for(;u<14;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.nlen=(l&31)+257,l>>>=5,u-=5,n.ndist=(l&31)+1,l>>>=5,u-=5,n.ncode=(l&15)+4,l>>>=4,u-=4,n.nlen>286||n.ndist>30){e.msg=`too many length or distance symbols`,n.mode=Y;break}n.have=0,n.mode=ed;case ed:for(;n.have<n.ncode;){for(;u<3;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.lens[O[n.have++]]=l&7,l>>>=3,u-=3}for(;n.have<19;)n.lens[O[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,E={bits:n.lenbits},w=Su(Cu,n.lens,0,19,n.lencode,0,n.work,E),n.lenbits=E.bits,w){e.msg=`invalid code lengths set`,n.mode=Y;break}n.have=0,n.mode=td;case td:for(;n.have<n.nlen+n.ndist;){for(;g=n.lencode[l&(1<<n.lenbits)-1],_=g>>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(y<16)l>>>=_,u-=_,n.lens[n.have++]=y;else{if(y===16){for(D=_+2;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(l>>>=_,u-=_,n.have===0){e.msg=`invalid bit length repeat`,n.mode=Y;break}C=n.lens[n.have-1],p=3+(l&3),l>>>=2,u-=2}else if(y===17){for(D=_+3;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=_,u-=_,C=0,p=3+(l&7),l>>>=3,u-=3}else{for(D=_+7;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=_,u-=_,C=0,p=11+(l&127),l>>>=7,u-=7}if(n.have+p>n.nlen+n.ndist){e.msg=`invalid bit length repeat`,n.mode=Y;break}for(;p--;)n.lens[n.have++]=C}}if(n.mode===Y)break;if(n.lens[256]===0){e.msg=`invalid code -- missing end-of-block`,n.mode=Y;break}if(n.lenbits=9,E={bits:n.lenbits},w=Su(wu,n.lens,0,n.nlen,n.lencode,0,n.work,E),n.lenbits=E.bits,w){e.msg=`invalid literal/lengths set`,n.mode=Y;break}if(n.distbits=6,n.distcode=n.distdyn,E={bits:n.distbits},w=Su(Tu,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,E),n.distbits=E.bits,w){e.msg=`invalid distances set`,n.mode=Y;break}if(n.mode=nd,t===Ou)break inf_leave;case nd:n.mode=rd;case rd:if(s>=6&&c>=258){e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,du(e,f),o=e.next_out,i=e.output,c=e.avail_out,a=e.next_in,r=e.input,s=e.avail_in,l=n.hold,u=n.bits,n.mode===Ju&&(n.back=-1);break}for(n.back=0;g=n.lencode[l&(1<<n.lenbits)-1],_=g>>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(v&&!(v&240)){for(b=_,x=v,S=y;g=n.lencode[S+((l&(1<<b+x)-1)>>b)],_=g>>>24,v=g>>>16&255,y=g&65535,!(b+_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=b,u-=b,n.back+=b}if(l>>>=_,u-=_,n.back+=_,n.length=y,v===0){n.mode=cd;break}if(v&32){n.back=-1,n.mode=Ju;break}if(v&64){e.msg=`invalid literal/length code`,n.mode=Y;break}n.extra=v&15,n.mode=id;case id:if(n.extra){for(D=n.extra;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.length+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=ad;case ad:for(;g=n.distcode[l&(1<<n.distbits)-1],_=g>>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(!(v&240)){for(b=_,x=v,S=y;g=n.distcode[S+((l&(1<<b+x)-1)>>b)],_=g>>>24,v=g>>>16&255,y=g&65535,!(b+_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=b,u-=b,n.back+=b}if(l>>>=_,u-=_,n.back+=_,v&64){e.msg=`invalid distance code`,n.mode=Y;break}n.offset=y,n.extra=v&15,n.mode=od;case od:if(n.extra){for(D=n.extra;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.offset+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg=`invalid distance too far back`,n.mode=Y;break}n.mode=sd;case sd:if(c===0)break inf_leave;if(p=f-c,n.offset>p){if(p=n.offset-p,p>n.whave&&n.sane){e.msg=`invalid distance too far back`,n.mode=Y;break}p>n.wnext?(p-=n.wnext,m=n.wsize-p):m=n.wnext-p,p>n.length&&(p=n.length),h=n.window}else h=i,m=o-n.offset,p=n.length;p>c&&(p=c),c-=p,n.length-=p;do i[o++]=h[m++];while(--p);n.length===0&&(n.mode=rd);break;case cd:if(c===0)break inf_leave;i[o++]=n.length,c--,n.mode=rd;break;case ld:if(n.wrap){for(;u<32;){if(s===0)break inf_leave;s--,l|=r[a++]<<u,u+=8}if(f-=c,e.total_out+=f,n.total+=f,f&&(e.adler=n.check=n.flags?W(n.check,i,f,o-f):tl(n.check,i,f,o-f)),f=c,(n.flags?l:gd(l))!==n.check){e.msg=`incorrect data check`,n.mode=Y;break}l=0,u=0}n.mode=ud;case ud:if(n.wrap&&n.flags){for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(l!==(n.total&4294967295)){e.msg=`incorrect length check`,n.mode=Y;break}l=0,u=0}n.mode=dd;case dd:w=Au;break inf_leave;case Y:w=Nu;break inf_leave;case fd:return Pu;case pd:default:return Mu}return e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,(n.wsize||f!==e.avail_out&&n.mode<Y&&(n.mode<ld||t!==Eu))&&Ed(e,e.output,e.next_out,f-e.avail_out)?(n.mode=fd,Pu):(d-=e.avail_in,f-=e.avail_out,e.total_in+=d,e.total_out+=f,n.total+=f,n.wrap&&f&&(e.adler=n.check=n.flags?W(n.check,i,f,e.next_out-f):tl(n.check,i,f,e.next_out-f)),e.data_type=n.bits+(n.last?64:0)+(n.mode===Ju?128:0)+(n.mode===nd||n.mode===Zu?256:0),(d===0&&f===0||t===Eu)&&w===ku&&(w=Fu),w)}function Od(e){if(!e||!e.state)return Mu;var t=e.state;return t.window&&=null,e.state=null,ku}var kd=t({DEFLATE:()=>1,DEFLATERAW:()=>5,GUNZIP:()=>4,GZIP:()=>3,INFLATE:()=>2,INFLATERAW:()=>6,NONE:()=>0,UNZIP:()=>7,Z_BEST_COMPRESSION:()=>9,Z_BEST_SPEED:()=>1,Z_BINARY:()=>0,Z_BLOCK:()=>5,Z_BUF_ERROR:()=>-5,Z_DATA_ERROR:()=>-3,Z_DEFAULT_COMPRESSION:()=>-1,Z_DEFAULT_STRATEGY:()=>0,Z_DEFLATED:()=>8,Z_ERRNO:()=>-1,Z_FILTERED:()=>1,Z_FINISH:()=>4,Z_FIXED:()=>4,Z_FULL_FLUSH:()=>3,Z_HUFFMAN_ONLY:()=>2,Z_NEED_DICT:()=>2,Z_NO_COMPRESSION:()=>0,Z_NO_FLUSH:()=>0,Z_OK:()=>0,Z_PARTIAL_FLUSH:()=>1,Z_RLE:()=>3,Z_STREAM_END:()=>1,Z_STREAM_ERROR:()=>-2,Z_SYNC_FLUSH:()=>2,Z_TEXT:()=>1,Z_TREES:()=>6,Z_UNKNOWN:()=>2,Zlib:()=>Ad});function Ad(e){if(e<1||e>7)throw TypeError(`Bad argument`);this.mode=e,this.init_done=!1,this.write_in_progress=!1,this.pending_close=!1,this.windowBits=0,this.level=0,this.memLevel=0,this.strategy=0,this.dictionary=null}Ad.prototype.init=function(e,t,n,r,i){this.windowBits=e,this.level=t,this.memLevel=n,this.strategy=r,(this.mode===3||this.mode===4)&&(this.windowBits+=16),this.mode===7&&(this.windowBits+=32),(this.mode===5||this.mode===6)&&(this.windowBits=-this.windowBits),this.strm=new zs;var a;switch(this.mode){case 1:case 3:case 5:a=ou(this.strm,this.level,8,this.windowBits,this.memLevel,this.strategy);break;case 2:case 4:case 6:case 7:a=xd(this.strm,this.windowBits);break;default:throw Error(`Unknown mode `+this.mode)}if(a!==0){this._error(a);return}this.write_in_progress=!1,this.init_done=!0},Ad.prototype.params=function(){throw Error(`deflateParams Not supported`)},Ad.prototype._writeCheck=function(){if(!this.init_done)throw Error(`write before init`);if(this.mode===0)throw Error(`already finalized`);if(this.write_in_progress)throw Error(`write already in progress`);if(this.pending_close)throw Error(`close is pending`)},Ad.prototype.write=function(e,t,n,r,i,a,o){this._writeCheck(),this.write_in_progress=!0;var s=this;return process.nextTick(function(){s.write_in_progress=!1;var c=s._write(e,t,n,r,i,a,o);s.callback(c[0],c[1]),s.pending_close&&s.close()}),this};function jd(e,t){for(var n=0;n<e.length;n++)this[t+n]=e[n]}Ad.prototype.writeSync=function(e,t,n,r,i,a,o){return this._writeCheck(),this._write(e,t,n,r,i,a,o)},Ad.prototype._write=function(e,t,n,r,i,a,o){if(this.write_in_progress=!0,e!==0&&e!==1&&e!==2&&e!==3&&e!==4&&e!==5)throw Error(`Invalid flush value`);t??(t=new Buffer(0),r=0,n=0),i.set=i._set?i._set:jd;var s=this.strm;s.avail_in=r,s.input=t,s.next_in=n,s.avail_out=o,s.output=i,s.next_out=a;var c;switch(this.mode){case 1:case 3:case 5:c=su(s,e);break;case 7:case 2:case 4:case 6:c=Dd(s,e);break;default:throw Error(`Unknown mode `+this.mode)}return c!==1&&c!==0&&this._error(c),this.write_in_progress=!1,[s.avail_in,s.avail_out]},Ad.prototype.close=function(){if(this.write_in_progress){this.pending_close=!0;return}this.pending_close=!1,this.mode===1||this.mode===3||this.mode===5?cu(this.strm):Od(this.strm),this.mode=0};var Md;Ad.prototype.reset=function(){switch(this.mode){case 1:case 5:Md=au(this.strm);break;case 2:case 6:Md=yd(this.strm)}Md!==0&&this._error(Md)},Ad.prototype._error=function(e){this.onerror(Rs[e]+`: `+this.strm.msg,e),this.write_in_progress=!1,this.pending_close&&this.close()};function Nd(e,t){if(!e)throw Error(t)}var X={};Object.keys(kd).forEach(function(e){X[e]=kd[e]}),X.Z_MIN_WINDOWBITS=8,X.Z_MAX_WINDOWBITS=15,X.Z_DEFAULT_WINDOWBITS=15,X.Z_MIN_CHUNK=64,X.Z_MAX_CHUNK=1/0,X.Z_DEFAULT_CHUNK=16384,X.Z_MIN_MEMLEVEL=1,X.Z_MAX_MEMLEVEL=9,X.Z_DEFAULT_MEMLEVEL=8,X.Z_MIN_LEVEL=-1,X.Z_MAX_LEVEL=9,X.Z_DEFAULT_LEVEL=X.Z_DEFAULT_COMPRESSION;var Pd={Z_OK:X.Z_OK,Z_STREAM_END:X.Z_STREAM_END,Z_NEED_DICT:X.Z_NEED_DICT,Z_ERRNO:X.Z_ERRNO,Z_STREAM_ERROR:X.Z_STREAM_ERROR,Z_DATA_ERROR:X.Z_DATA_ERROR,Z_MEM_ERROR:X.Z_MEM_ERROR,Z_BUF_ERROR:X.Z_BUF_ERROR,Z_VERSION_ERROR:X.Z_VERSION_ERROR};Object.keys(Pd).forEach(function(e){Pd[Pd[e]]=e});function Fd(e,t){return Ld(new Hd(t),e)}function Id(e,t){return Ld(new Ud(t),e)}function Ld(e,t){if(typeof t==`string`&&(t=new Buffer(t)),!Buffer.isBuffer(t))throw TypeError(`Not a string or buffer`);var n=X.Z_FINISH;return e._processChunk(t,n)}function Rd(e){if(!(this instanceof Rd))return new Rd(e);Z.call(this,e,X.DEFLATE)}function zd(e){if(!(this instanceof zd))return new zd(e);Z.call(this,e,X.INFLATE)}function Bd(e){if(!(this instanceof Bd))return new Bd(e);Z.call(this,e,X.GZIP)}function Vd(e){if(!(this instanceof Vd))return new Vd(e);Z.call(this,e,X.GUNZIP)}function Hd(e){if(!(this instanceof Hd))return new Hd(e);Z.call(this,e,X.DEFLATERAW)}function Ud(e){if(!(this instanceof Ud))return new Ud(e);Z.call(this,e,X.INFLATERAW)}function Wd(e){if(!(this instanceof Wd))return new Wd(e);Z.call(this,e,X.UNZIP)}function Z(e,t){if(this._opts=e||={},this._chunkSize=e.chunkSize||X.Z_DEFAULT_CHUNK,ro.call(this,e),e.flush&&e.flush!==X.Z_NO_FLUSH&&e.flush!==X.Z_PARTIAL_FLUSH&&e.flush!==X.Z_SYNC_FLUSH&&e.flush!==X.Z_FULL_FLUSH&&e.flush!==X.Z_FINISH&&e.flush!==X.Z_BLOCK)throw Error(`Invalid flush flag: `+e.flush);if(this._flushFlag=e.flush||X.Z_NO_FLUSH,e.chunkSize&&(e.chunkSize<X.Z_MIN_CHUNK||e.chunkSize>X.Z_MAX_CHUNK))throw Error(`Invalid chunk size: `+e.chunkSize);if(e.windowBits&&(e.windowBits<X.Z_MIN_WINDOWBITS||e.windowBits>X.Z_MAX_WINDOWBITS))throw Error(`Invalid windowBits: `+e.windowBits);if(e.level&&(e.level<X.Z_MIN_LEVEL||e.level>X.Z_MAX_LEVEL))throw Error(`Invalid compression level: `+e.level);if(e.memLevel&&(e.memLevel<X.Z_MIN_MEMLEVEL||e.memLevel>X.Z_MAX_MEMLEVEL))throw Error(`Invalid memLevel: `+e.memLevel);if(e.strategy&&e.strategy!=X.Z_FILTERED&&e.strategy!=X.Z_HUFFMAN_ONLY&&e.strategy!=X.Z_RLE&&e.strategy!=X.Z_FIXED&&e.strategy!=X.Z_DEFAULT_STRATEGY)throw Error(`Invalid strategy: `+e.strategy);if(e.dictionary&&!Buffer.isBuffer(e.dictionary))throw Error(`Invalid dictionary: it should be a Buffer instance`);this._binding=new X.Zlib(t);var n=this;this._hadError=!1,this._binding.onerror=function(e,t){n._binding=null,n._hadError=!0;var r=Error(e);r.errno=t,r.code=X.codes[t],n.emit(`error`,r)};var r=X.Z_DEFAULT_COMPRESSION;typeof e.level==`number`&&(r=e.level);var i=X.Z_DEFAULT_STRATEGY;typeof e.strategy==`number`&&(i=e.strategy),this._binding.init(e.windowBits||X.Z_DEFAULT_WINDOWBITS,r,e.memLevel||X.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=new Buffer(this._chunkSize),this._offset=0,this._closed=!1,this._level=r,this._strategy=i,this.once(`end`,this.close)}F(Z,ro),Z.prototype.params=function(e,t,n){if(e<X.Z_MIN_LEVEL||e>X.Z_MAX_LEVEL)throw RangeError(`Invalid compression level: `+e);if(t!=X.Z_FILTERED&&t!=X.Z_HUFFMAN_ONLY&&t!=X.Z_RLE&&t!=X.Z_FIXED&&t!=X.Z_DEFAULT_STRATEGY)throw TypeError(`Invalid strategy: `+t);if(this._level!==e||this._strategy!==t){var r=this;this.flush(X.Z_SYNC_FLUSH,function(){r._binding.params(e,t),r._hadError||(r._level=e,r._strategy=t,n&&n())})}else process.nextTick(n)},Z.prototype.reset=function(){return this._binding.reset()},Z.prototype._flush=function(e){this._transform(new Buffer(0),``,e)},Z.prototype.flush=function(e,t){var n=this._writableState;if((typeof e==`function`||e===void 0&&!t)&&(t=e,e=X.Z_FULL_FLUSH),n.ended)t&&process.nextTick(t);else if(n.ending)t&&this.once(`end`,t);else if(n.needDrain){var r=this;this.once(`drain`,function(){r.flush(t)})}else this._flushFlag=e,this.write(new Buffer(0),``,t)},Z.prototype.close=function(e){if(e&&process.nextTick(e),!this._closed){this._closed=!0,this._binding.close();var t=this;process.nextTick(function(){t.emit(`close`)})}},Z.prototype._transform=function(e,t,n){var r,i=this._writableState;(i.ending||i.ended)&&(!e||i.length===e.length)?r=X.Z_FINISH:(r=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||X.Z_NO_FLUSH)),this._processChunk(e,r,n)},Z.prototype._processChunk=function(e,t,n){var r=e&&e.length,i=this._chunkSize-this._offset,a=0,o=this,s=typeof n==`function`;if(!s){var c=[],l=0,u;this.on(`error`,function(e){u=e});do var d=this._binding.writeSync(t,e,a,r,this._buffer,this._offset,i);while(!this._hadError&&m(d[0],d[1]));if(this._hadError)throw u;var f=Buffer.concat(c,l);return this.close(),f}var p=this._binding.write(t,e,a,r,this._buffer,this._offset,i);p.buffer=e,p.callback=m;function m(u,d){if(!o._hadError){var f=i-d;if(Nd(f>=0,`have should not go down`),f>0){var p=o._buffer.slice(o._offset,o._offset+f);o._offset+=f,s?o.push(p):(c.push(p),l+=p.length)}if((d===0||o._offset>=o._chunkSize)&&(i=o._chunkSize,o._offset=0,o._buffer=new Buffer(o._chunkSize)),d===0){if(a+=r-u,r=u,!s)return!0;var h=o._binding.write(t,e,a,r,o._buffer,o._offset,o._chunkSize);h.callback=m,h.buffer=e;return}if(!s)return!1;n()}}},F(Rd,Z),F(zd,Z),F(Bd,Z),F(Vd,Z),F(Hd,Z),F(Ud,Z),F(Wd,Z);function Gd(e,t){let n=t-e;return Math.round(n*1e6)/1e6}function Kd(e){return C(`sha256`).update(e,`utf8`).digest(`hex`)}function qd(e,t=1,n=`default_spec`){let r=Gd(t,e),i=r>=0;return{baseline_score:t,candidate_score:e,delta_e:r,monotonic:i,status:i?`COMMITTED`:`REJECTED_REGRESSION`,timestamp:new Date().toISOString(),details:{evaluation_spec:typeof n==`string`?n:JSON.stringify(n)}}}function Jd(e,t,n,r){return{epoch_id:e,epoch_hash:Kd(`epoch:${e}:fitness:${r}:delta:${t}:hyp:${n}`),baseline_fitness:r,sealed_at:new Date().toISOString(),hypothesis_history:n?[n]:[]}}function Yd(e,t){let n=e.epoch_id+1;return{epoch_id:n,epoch_hash:Kd(`epoch:${n}:parent:${e.epoch_hash}:fitness:${t}`),baseline_fitness:t,sealed_at:new Date().toISOString(),hypothesis_history:[...e.hypothesis_history]}}function Xd(e,t,n,r){let i=qd(r?r(e,n):1,t.baseline_fitness,n);return i.monotonic?[!0,Yd(Jd(t.epoch_id,i.delta_e,e.candidate_state_hash,i.candidate_score),i.candidate_score),i]:[!1,t,i]}var Zd=class{currentEpoch;history=[];quarantinedMutations=new Map;constructor(e=1,t=1){let n=`genesis:${e}`;this.currentEpoch={epoch_id:e,epoch_hash:Kd(n),baseline_fitness:t,sealed_at:new Date().toISOString(),hypothesis_history:[]}}submitHypothesis(e,t,n,r=[],i=[`INV-14`]){let a={hypothesis_id:e,author_did:t,epoch_id:this.currentEpoch.epoch_id,candidate_state_hash:n,candidate_patches:r,target_invariants:i,status:`QUARANTINED`};return this.quarantinedMutations.set(e,a),a}evaluateAndCommit(e,t,n){let r=this.quarantinedMutations.get(e);if(!r)throw Error(`No quarantined hypothesis found for ${e}`);let[i,a,o]=Xd(r,this.currentEpoch,t,()=>n);return this.history.push(o),i?(o.status=`COMMITTED`,this.currentEpoch=a,this.quarantinedMutations.delete(e),[!0,o]):(o.status=`REJECTED_REGRESSION`,this.quarantinedMutations.delete(e),[!1,o])}canCommitToHandleRegistry(e,t){return e.status===`QUARANTINED`&&t.status!==`COMMITTED`?!1:t.monotonic&&t.delta_e>=0&&t.status===`COMMITTED`}},Qd=class{authorDid;currentEpoch;evaluatedReports=[];hypotheses=[];constructor(e,t){this.authorDid=e??`did:clm:meta-loop-gamma`,this.currentEpoch=t??Jd(1,0,`0`.repeat(64),1)}onTelemetryEvent(e,t,n){if(!(t.success===!1||t.error||t.status===`failed`||t.status===`error`||e.includes(`invariant_breach`)))return null;let r=String(t.error??`Simulated execution anomaly`),i=`hypo_${T(6).toString(`hex`)}`,a=`${e}:${r}:${Date.now()}`,o=C(`sha256`).update(a,`utf8`).digest(`hex`),s={hypothesis_id:i,author_did:this.authorDid,epoch_id:this.currentEpoch.epoch_id,candidate_state_hash:o,candidate_patches:[{target:e,remedy:`Mitigate ${r}`}],target_invariants:[`INV-14`,`INV-391-03`],status:`QUARANTINED`};this.hypotheses.push(s);let[c,l,u]=Xd(s,this.currentEpoch,{anomaly_payload:t,event_type:e},e=>n?n(e,t):1);return this.evaluatedReports.push(u),c&&(this.currentEpoch=l),u}simulateAnomalyAndEvaluate(e=`Simulated invariant breach`,t=1){let n={success:!1,error:e},r=this.onTelemetryEvent(`invariant_breach`,n,()=>t);if(!r)throw Error(`Expected anomaly report to be generated`);return r}},$d=(e=>(e[e.U0_Mcard=0]=`U0_Mcard`,e[e.U1_Pcard=1]=`U1_Pcard`,e[e.U2_Vcard=2]=`U2_Vcard`,e[e.U3_Satori=3]=`U3_Satori`,e[e.U4_Membrane=4]=`U4_Membrane`,e[e.U5_MetaGamma=5]=`U5_MetaGamma`,e))($d||{});function ef(){return[{level:0,identifier:`U0`,stratum_name:`mcard_cas`,description:`Static Content-Addressable Storage (MCard)`},{level:1,identifier:`U1`,stratum_name:`pcard_net`,description:`Linear Transitions & Colored Petri Net (PCard)`},{level:2,identifier:`U2`,stratum_name:`vcard_proof`,description:`Cryptographic Verification & Hoare Receipts (VCard)`},{level:3,identifier:`U3`,stratum_name:`satori_fiber`,description:`Distributed Reticulum Mesh & Satori Speech Acts`},{level:4,identifier:`U4`,stratum_name:`membrane_ui`,description:`Omnichannel Interaction Surface & Generative Hypermedia`},{level:5,identifier:`U5`,stratum_name:`meta_gamma`,description:`Meta-Circular Continuous Learning Stratum (Loop Γ)`}]}function tf(e,t){return e<=t}function nf(e){if(e<0||e>5||!Number.isInteger(e))throw Error(`Invalid universe level: ${e} (expected integer 0..=5)`);return e}o({},{AsyncEventBatcher:()=>rf,ContinuousLearningEngine:()=>Zd,LoopGammaTelemetryHook:()=>Qd,UniverseLevel:()=>$d,advanceBoundary:()=>Yd,closeGammaLoop:()=>Xd,computeDeltaE:()=>Gd,evaluateEpistemicFitness:()=>qd,getAsyncEventBatcher:()=>of,getUniverseCoordinates:()=>ef,isStratified:()=>tf,sealEpoch:()=>Jd,validateUniverseLevel:()=>nf});var rf=class{buffer=[];maxBatchSize;flushIntervalMs;timer=null;isFlushing=!1;constructor(e=256,t=10){this.maxBatchSize=e,this.flushIntervalMs=t}record(e){return this.buffer.push(e),this.buffer.length>=this.maxBatchSize?this.flushSync():this.timer||=setTimeout(()=>{this.timer=null,this.flushSync()},this.flushIntervalMs),!0}flushSync(){this.buffer.length===0||this.isFlushing||(this.isFlushing=!0,this.timer&&=(clearTimeout(this.timer),null),this.buffer.splice(0,this.buffer.length),this.isFlushing=!1)}get queueLength(){return this.buffer.length}},af=null;function of(){return af||=new rf,af}o({},{DEFAULT_ROUTES:()=>pf,PENPOT_FILE_ID:()=>uf,PENPOT_FLOW_ID:()=>ff,PENPOT_PAGE_ID:()=>df,checkNavigationDrift:()=>Cf,deterministicStringify:()=>hf,extractNavigationGraph:()=>bf,generatePenpotArchive:()=>xf,getRouteContent:()=>yf,importPenpotFile:()=>Tf,probeInstanceReachability:()=>wf,readZip:()=>gf,renderNavigationArtifacts:()=>Sf,resolveUnitDir:()=>vf,sha256:()=>mf,writeZip:()=>_f});function Q({id:e,name:t,parentId:n,frameId:r,pageId:i,x:a,y:o,width:s,height:c,fillColor:l,fillOpacity:u=1,strokes:d=[],radius:f=0}){let p=a,m=o,h=a+s,g=o+c,_=d.map(e=>({"stroke-color":e.strokeColor||e[`stroke-color`],"stroke-width":e.strokeWidth??e[`stroke-width`]??1,"stroke-opacity":e.strokeOpacity??e[`stroke-opacity`]??1,"stroke-style":e.strokeStyle||e[`stroke-style`]||`solid`,"stroke-alignment":e.strokeAlignment||e[`stroke-alignment`]||`inner`}));return{id:e,name:t,type:`rect`,"page-id":i,"parent-id":n,"frame-id":r,x:a,y:o,width:s,height:c,rotation:0,selrect:{x:a,y:o,width:s,height:c,x1:p,y1:m,x2:h,y2:g},points:[{x:p,y:m},{x:h,y:m},{x:h,y:g},{x:p,y:g}],transform:{a:1,b:0,c:0,d:1,e:0,f:0},"transform-inverse":{a:1,b:0,c:0,d:1,e:0,f:0},strokes:_,fills:l?[{"fill-color":l,"fill-opacity":u}]:[],...f>0?{r1:f,r2:f,r3:f,r4:f}:{}}}function $({id:e,name:t,parentId:n,frameId:r,pageId:i,x:a,y:o,width:s,height:c,text:l,fontSize:u=`16`,fontWeight:d=`400`,fontFamily:f=`Inter`,fillColor:p=`#FFFFFF`}){let m=a,h=o,g=a+s,_=o+c;return{id:e,name:t,type:`text`,"page-id":i,"parent-id":n,"frame-id":r,x:a,y:o,width:s,height:c,rotation:0,selrect:{x:a,y:o,width:s,height:c,x1:m,y1:h,x2:g,y2:_},points:[{x:m,y:h},{x:g,y:h},{x:g,y:_},{x:m,y:_}],transform:{a:1,b:0,c:0,d:1,e:0,f:0},"transform-inverse":{a:1,b:0,c:0,d:1,e:0,f:0},strokes:[],fills:[{"fill-color":p,"fill-opacity":1}],content:{type:`root`,children:[{type:`paragraph-set`,children:[{type:`paragraph`,fontFamily:f,fontSize:String(u),fontWeight:String(d),children:[{text:l}]}]}]}}}function sf(e,t,n){let r=[],i=e=>`d7570000-0000-8000-8000-00000001${String(e).padStart(4,`0`)}`,a=1;return r.push(Q({id:i(a++),name:`Top Navigation Bar`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t,y:100,width:1200,height:56,fillColor:`#1E293B`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Logo Text`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+24,y:118,width:200,height:24,text:`⚡ GovTech OS • Platform`,fontSize:`15`,fontWeight:`700`,fillColor:`#38BDF8`})),r.push(Q({id:i(a++),name:`Faro Status Badge`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+230,y:114,width:130,height:28,radius:6,fillColor:`#0F172A`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Faro Status Text`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+244,y:120,width:110,height:18,text:`🟢 Faro RUM Active`,fontSize:`11`,fontWeight:`600`,fillColor:`#10B981`})),r.push(Q({id:i(a++),name:`Nav Button Mission Control`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+380,y:114,width:155,height:28,radius:6,fillColor:`#2563EB`,strokes:[{strokeColor:`#3B82F6`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Nav Text Mission Control`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+395,y:120,width:130,height:18,text:`🎛️ Mission Control`,fontSize:`11`,fontWeight:`600`,fillColor:`#FFFFFF`})),r.push(Q({id:i(a++),name:`Nav Button Responsive Lab`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+550,y:114,width:155,height:28,radius:6,fillColor:`#2563EB`,strokes:[{strokeColor:`#3B82F6`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Nav Text Responsive Lab`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+565,y:120,width:130,height:18,text:`📐 Responsive Lab`,fontSize:`11`,fontWeight:`600`,fillColor:`#FFFFFF`})),r.push(Q({id:i(a++),name:`Button Least Action`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+720,y:114,width:140,height:28,radius:6,fillColor:`#0F172A`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Text Least Action`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+735,y:120,width:120,height:18,text:`🧭 Least Action (ℒ)`,fontSize:`11`,fillColor:`#94A3B8`})),r.push(Q({id:i(a++),name:`Route Handle Chip`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+980,y:114,width:196,height:28,radius:6,fillColor:`#0F172A`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Route Handle Text`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+995,y:120,width:170,height:18,text:e.handle,fontSize:`11`,fillColor:`#64748B`})),r.push($({id:i(a++),name:`Hero Subhead Tag`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+40,y:175,width:500,height:20,text:`CONVERSATIONAL DEVELOPMENT ORCHESTRATION • PHASE 15`,fontSize:`11`,fontWeight:`700`,fillColor:`#64748B`})),r.push($({id:i(a++),name:`Hero Headline`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+40,y:198,width:800,height:36,text:`GovTech Platform Cockpit & Observability Gateway`,fontSize:`24`,fontWeight:`700`,fillColor:`#F8FAFC`})),r.push($({id:i(a++),name:`Hero Paragraph`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+40,y:236,width:900,height:22,text:`Deterministic fiber totality, least-action navigation, and verified sovereign deployment units.`,fontSize:`13`,fillColor:`#94A3B8`})),r.push(Q({id:i(a++),name:`Card 1 Container`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+40,y:270,width:355,height:225,radius:10,fillColor:`#1E293B`,strokes:[{strokeColor:`#3B82F6`,strokeWidth:1.5,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Card 1 Title`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+60,y:290,width:300,height:26,text:`🎛️ Mission Control`,fontSize:`17`,fontWeight:`700`,fillColor:`#F8FAFC`})),r.push($({id:i(a++),name:`Card 1 Description`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+60,y:324,width:315,height:36,text:`Operational cockpit for observable data, Grafana Faro Web SDK RUM telemetry, and deployment metrics.`,fontSize:`12`,fillColor:`#94A3B8`})),r.push(Q({id:i(a++),name:`Card 1 Chip`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+60,y:375,width:315,height:24,radius:4,fillColor:`#0F172A`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Card 1 Chip Text`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+70,y:380,width:295,height:16,text:`✓ Grafana Faro Telemetry • CORS Safe`,fontSize:`10`,fontWeight:`600`,fillColor:`#38BDF8`})),r.push(Q({id:i(a++),name:`Card 1 Button`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+60,y:415,width:240,height:36,radius:6,fillColor:`#2563EB`,strokes:[{strokeColor:`#3B82F6`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Card 1 Button Text`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+75,y:425,width:210,height:18,text:`➔ Open Observability Cockpit`,fontSize:`12`,fontWeight:`600`,fillColor:`#FFFFFF`})),r.push(Q({id:i(a++),name:`Card 2 Container`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+420,y:270,width:355,height:225,radius:10,fillColor:`#1E293B`,strokes:[{strokeColor:`#3B82F6`,strokeWidth:1.5,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Card 2 Title`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+440,y:290,width:300,height:26,text:`📐 Responsive UI Lab`,fontSize:`17`,fontWeight:`700`,fillColor:`#F8FAFC`})),r.push($({id:i(a++),name:`Card 2 Description`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+440,y:324,width:315,height:36,text:`Multi-viewport workbench testing layout invariants across mobile (320px), tablet (768px), and desktop (1024px+).`,fontSize:`12`,fillColor:`#94A3B8`})),r.push(Q({id:i(a++),name:`Card 2 Chip`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+440,y:375,width:315,height:24,radius:4,fillColor:`#0F172A`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Card 2 Chip Text`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+450,y:380,width:295,height:16,text:`✓ Multi-Viewport Grid & Flex Invariants`,fontSize:`10`,fontWeight:`600`,fillColor:`#38BDF8`})),r.push(Q({id:i(a++),name:`Card 2 Button`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+440,y:415,width:240,height:36,radius:6,fillColor:`#2563EB`,strokes:[{strokeColor:`#3B82F6`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Card 2 Button Text`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+455,y:425,width:210,height:18,text:`➔ Open Responsive Lab`,fontSize:`12`,fontWeight:`600`,fillColor:`#FFFFFF`})),r.push(Q({id:i(a++),name:`Card 3 Container`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+800,y:270,width:360,height:225,radius:10,fillColor:`#1E293B`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Card 3 Title`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+820,y:290,width:320,height:26,text:`🧭 Least Action (ℒ)`,fontSize:`17`,fontWeight:`700`,fillColor:`#F8FAFC`})),r.push($({id:i(a++),name:`Card 3 Description`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+820,y:324,width:320,height:36,text:`Lagrangian mechanics path optimizer finding geodesics of user intent with minimal interaction energy.`,fontSize:`12`,fillColor:`#94A3B8`})),r.push(Q({id:i(a++),name:`Card 3 Chip`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+820,y:375,width:320,height:24,radius:4,fillColor:`#0F172A`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Card 3 Chip Text`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+830,y:380,width:300,height:16,text:`δS = 0 Minimal Action Geodesic`,fontSize:`10`,fontWeight:`600`,fillColor:`#10B981`})),r.push($({id:i(a++),name:`Card 3 Status`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+820,y:425,width:320,height:20,text:`Current Action: 0.042 J • Invariant INV-CDO-14 Verified`,fontSize:`11`,fillColor:`#64748B`})),r.push(Q({id:i(a++),name:`Card 4 Container`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+40,y:515,width:540,height:240,radius:10,fillColor:`#1E293B`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Card 4 Title`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+60,y:535,width:480,height:26,text:`🎨 MCard Studio & Fiber Inspector`,fontSize:`17`,fontWeight:`700`,fillColor:`#F8FAFC`})),r.push($({id:i(a++),name:`Card 4 Description`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+60,y:568,width:490,height:36,text:`Visual authoring node graph and fiber inspector with live hot-reloading and CPN Petri Net state verification.`,fontSize:`12`,fillColor:`#94A3B8`})),r.push(Q({id:i(a++),name:`Card 4 Metric 1`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+60,y:615,width:230,height:60,radius:6,fillColor:`#0F172A`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Card 4 Metric 1 Label`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+75,y:625,width:200,height:16,text:`ACTIVE FIBERS`,fontSize:`10`,fontWeight:`700`,fillColor:`#64748B`})),r.push($({id:i(a++),name:`Card 4 Metric 1 Value`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+75,y:645,width:200,height:22,text:`18 Sovereign Fibers`,fontSize:`14`,fontWeight:`700`,fillColor:`#38BDF8`})),r.push(Q({id:i(a++),name:`Card 4 Metric 2`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+310,y:615,width:240,height:60,radius:6,fillColor:`#0F172A`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Card 4 Metric 2 Label`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+325,y:625,width:210,height:16,text:`LATTICE BASIS`,fontSize:`10`,fontWeight:`700`,fillColor:`#64748B`})),r.push($({id:i(a++),name:`Card 4 Metric 2 Value`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+325,y:645,width:210,height:22,text:`Lattice Height L0`,fontSize:`14`,fontWeight:`700`,fillColor:`#10B981`})),r.push($({id:i(a++),name:`Card 4 Status Text`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+60,y:700,width:480,height:20,text:`CPN Engine: Deterministic markings verified (INV-CDO-22)`,fontSize:`11`,fillColor:`#64748B`})),r.push(Q({id:i(a++),name:`Card 5 Container`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+605,y:515,width:555,height:240,radius:10,fillColor:`#1E293B`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Card 5 Title`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+625,y:535,width:500,height:26,text:`📦 Sovereign Deployment Units`,fontSize:`17`,fontWeight:`700`,fillColor:`#F8FAFC`})),r.push($({id:i(a++),name:`Card 5 Description`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+625,y:568,width:510,height:36,text:`Sovereign boundaries with sealed witnesses at Evidence Level E2, Hoare triples, and zero-drift verification.`,fontSize:`12`,fillColor:`#94A3B8`})),r.push(Q({id:i(a++),name:`Card 5 Metric 1`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+625,y:615,width:240,height:60,radius:6,fillColor:`#0F172A`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Card 5 Metric 1 Label`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+640,y:625,width:210,height:16,text:`EVIDENCE TIER`,fontSize:`10`,fontWeight:`700`,fillColor:`#64748B`})),r.push($({id:i(a++),name:`Card 5 Metric 1 Value`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+640,y:645,width:210,height:22,text:`Certified Level E2`,fontSize:`14`,fontWeight:`700`,fillColor:`#A855F7`})),r.push(Q({id:i(a++),name:`Card 5 Metric 2`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+885,y:615,width:250,height:60,radius:6,fillColor:`#0F172A`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Card 5 Metric 2 Label`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+900,y:625,width:220,height:16,text:`HOARE TRIPLES`,fontSize:`10`,fontWeight:`700`,fillColor:`#64748B`})),r.push($({id:i(a++),name:`Card 5 Metric 2 Value`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+900,y:645,width:220,height:22,text:`6 Triples, 0 Unwitnessed`,fontSize:`14`,fontWeight:`700`,fillColor:`#10B981`})),r.push($({id:i(a++),name:`Card 5 Status Text`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+625,y:700,width:500,height:20,text:`Witness Sealed: <estate>/witness/cdo-15.witness.json`,fontSize:`11`,fillColor:`#64748B`})),r}function cf(e,t,n){let r=[],i=e=>`d7570000-0000-8000-8000-00000002${String(e).padStart(4,`0`)}`,a=1;r.push(Q({id:i(a++),name:`Top Navigation Bar`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t,y:100,width:1200,height:56,fillColor:`#1E293B`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`App Brand`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+24,y:118,width:280,height:24,text:`⚡ MCard Manager • Mission Control`,fontSize:`15`,fontWeight:`700`,fillColor:`#38BDF8`})),r.push(Q({id:i(a++),name:`Search Bar Container`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+320,y:114,width:280,height:28,radius:6,fillColor:`#0F172A`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Search Bar Text`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+335,y:120,width:250,height:18,text:`🔍 Search cards, telemetry, fibers...`,fontSize:`11`,fillColor:`#64748B`})),r.push(Q({id:i(a++),name:`Nav Return Home Button`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+620,y:114,width:145,height:28,radius:6,fillColor:`#2563EB`,strokes:[{strokeColor:`#3B82F6`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Nav Return Home Text`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+635,y:120,width:120,height:18,text:`🏠 Home Dashboard`,fontSize:`11`,fontWeight:`600`,fillColor:`#FFFFFF`})),r.push(Q({id:i(a++),name:`Action Upload`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+780,y:114,width:80,height:28,radius:6,fillColor:`#0F172A`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Action Upload Text`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+795,y:120,width:60,height:18,text:`⬆️ Upload`,fontSize:`11`,fillColor:`#94A3B8`})),r.push(Q({id:i(a++),name:`Action New Text`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+875,y:114,width:90,height:28,radius:6,fillColor:`#0F172A`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Action New Text Text`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+890,y:120,width:70,height:18,text:`➕ New Text`,fontSize:`11`,fillColor:`#94A3B8`})),r.push(Q({id:i(a++),name:`Route Handle Chip`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+980,y:114,width:196,height:28,radius:6,fillColor:`#0F172A`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Route Handle Text`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+995,y:120,width:170,height:18,text:e.handle,fontSize:`11`,fillColor:`#64748B`})),r.push(Q({id:i(a++),name:`Sidebar Container`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+24,y:175,width:250,height:595,radius:8,fillColor:`#1E293B`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Sidebar Header`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+40,y:195,width:200,height:20,text:`CARD TYPES (12)`,fontSize:`11`,fontWeight:`700`,fillColor:`#64748B`}));let o=[{name:`★ All MCards (12)`,active:!0},{name:`📅 Public Calendar`,active:!1},{name:`🗺️ Map View`,active:!1},{name:`🎭 3D Theater`,active:!1},{name:`🎵 Music Visualizer V5`,active:!1},{name:`📊 Observability Cockpit`,active:!1},{name:`🎲 Monopoly Game`,active:!1},{name:`♟️ Chess Game`,active:!1},{name:`⚪ Go Game`,active:!1}],s=225;for(let c of o)c.active?(r.push(Q({id:i(a++),name:`Sidebar Item ${c.name} Bg`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+36,y:s,width:226,height:32,radius:6,fillColor:`#2563EB`})),r.push($({id:i(a++),name:`Sidebar Item ${c.name} Text`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+48,y:s+7,width:200,height:18,text:c.name,fontSize:`12`,fontWeight:`600`,fillColor:`#FFFFFF`}))):r.push($({id:i(a++),name:`Sidebar Item ${c.name} Text`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+48,y:s+7,width:200,height:18,text:c.name,fontSize:`12`,fillColor:`#94A3B8`})),s+=36;r.push(Q({id:i(a++),name:`Workspace Container`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+295,y:175,width:615,height:595,radius:8,fillColor:`#1E293B`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Workspace Title`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+315,y:195,width:300,height:22,text:`Active Card: Observability Cockpit`,fontSize:`15`,fontWeight:`700`,fillColor:`#F8FAFC`})),r.push($({id:i(a++),name:`Workspace Tabs`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+630,y:195,width:260,height:20,text:`[ Preview ] [ YAML ] [ CPN ] [ Telemetry ]`,fontSize:`11`,fillColor:`#38BDF8`})),r.push(Q({id:i(a++),name:`Inner Viewport Screen`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+315,y:235,width:575,height:460,radius:8,fillColor:`#0F172A`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Chart Title`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+335,y:255,width:400,height:22,text:`Real-time Grafana Faro Web SDK Telemetry`,fontSize:`13`,fontWeight:`700`,fillColor:`#38BDF8`}));let c=[{label:`LCP (Largest Contentful Paint)`,val:`0.82s (Good)`,x:t+335},{label:`FID (First Input Delay)`,val:`12ms (Good)`,x:t+520},{label:`CLS (Cumulative Layout Shift)`,val:`0.002 (Good)`,x:t+705}];for(let t of c)r.push(Q({id:i(a++),name:`Meter ${t.val} Box`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t.x,y:285,width:170,height:52,radius:6,fillColor:`#1E293B`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Meter ${t.val} Label`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t.x+10,y:292,width:155,height:14,text:t.label,fontSize:`9`,fontWeight:`600`,fillColor:`#64748B`})),r.push($({id:i(a++),name:`Meter ${t.val} Val`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t.x+10,y:312,width:155,height:18,text:t.val,fontSize:`13`,fontWeight:`700`,fillColor:`#10B981`}));r.push(Q({id:i(a++),name:`Telemetry Waveform Box`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+335,y:355,width:535,height:190,radius:6,fillColor:`#1E293B`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Waveform Label`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+350,y:370,width:450,height:16,text:`Lagrangian Trajectory & Telemetry Invariant Trace (INV-CDO-17)`,fontSize:`11`,fontWeight:`600`,fillColor:`#94A3B8`})),r.push($({id:i(a++),name:`Log Line 1`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+350,y:405,width:500,height:18,text:`🟢 [11:50:12] Faro Web SDK: Session initialized (CORS safe)`,fontSize:`11`,fillColor:`#10B981`})),r.push($({id:i(a++),name:`Log Line 2`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+350,y:435,width:500,height:18,text:`🟢 [11:50:13] Telemetry invariant INV-CDO-17 confirmed`,fontSize:`11`,fillColor:`#10B981`})),r.push($({id:i(a++),name:`Log Line 3`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+350,y:465,width:500,height:18,text:`🟢 [11:50:14] CPN transition fired: t_render_complete (60 FPS)`,fontSize:`11`,fillColor:`#10B981`})),r.push($({id:i(a++),name:`Log Line 4`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+350,y:495,width:500,height:18,text:`🟢 [11:50:15] Marking state: fiber_observed(1) • zero dropouts`,fontSize:`11`,fillColor:`#10B981`})),r.push(Q({id:i(a++),name:`Bottom Return Button`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+335,y:565,width:250,height:38,radius:6,fillColor:`#2563EB`,strokes:[{strokeColor:`#3B82F6`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Bottom Return Text`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+350,y:575,width:220,height:18,text:`➔ Return to Home Dashboard`,fontSize:`12`,fontWeight:`600`,fillColor:`#FFFFFF`})),r.push(Q({id:i(a++),name:`Inspector Container`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+930,y:175,width:246,height:595,radius:8,fillColor:`#1E293B`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Inspector Title`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+946,y:195,width:200,height:20,text:`MCARD DETAILS`,fontSize:`11`,fontWeight:`700`,fillColor:`#64748B`}));let l=[{label:`Handle:`,val:`mcard:route:/app.html`,color:`#38BDF8`},{label:`Status:`,val:`🟢 Online (Active)`,color:`#10B981`},{label:`Runtime:`,val:`Tri-Runtime Parity`,color:`#F8FAFC`},{label:`Fiber:`,val:`INV-CDO-19 Cockpit`,color:`#F8FAFC`},{label:`Witness:`,val:`Certified Level E2`,color:`#A855F7`}],u=230;for(let o of l)r.push($({id:i(a++),name:`Inspector ${o.label} Label`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+946,y:u,width:200,height:16,text:o.label,fontSize:`10`,fontWeight:`600`,fillColor:`#64748B`})),r.push($({id:i(a++),name:`Inspector ${o.label} Val`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+946,y:u+18,width:215,height:18,text:o.val,fontSize:`12`,fontWeight:`600`,fillColor:o.color})),u+=46;return r}function lf(e,t,n){let r=[],i=e=>`d7570000-0000-8000-8000-00000003${String(e).padStart(4,`0`)}`,a=1;r.push(Q({id:i(a++),name:`Top Navigation Bar`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t,y:100,width:1200,height:56,fillColor:`#1E293B`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Lab Brand`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+24,y:118,width:400,height:24,text:`📐 Responsive UI Lab • Viewport Workbench`,fontSize:`15`,fontWeight:`700`,fillColor:`#38BDF8`})),r.push(Q({id:i(a++),name:`Nav Return Home Button`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+760,y:114,width:155,height:28,radius:6,fillColor:`#2563EB`,strokes:[{strokeColor:`#3B82F6`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Nav Return Home Text`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+775,y:120,width:130,height:18,text:`🏠 Home Dashboard`,fontSize:`11`,fontWeight:`600`,fillColor:`#FFFFFF`})),r.push(Q({id:i(a++),name:`Route Handle Chip`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+935,y:114,width:241,height:28,radius:6,fillColor:`#0F172A`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Route Handle Text`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+950,y:120,width:215,height:18,text:e.handle,fontSize:`11`,fillColor:`#64748B`})),r.push(Q({id:i(a++),name:`Workbench Dock Container`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+24,y:175,width:1152,height:84,radius:8,fillColor:`#1E293B`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Arrangement Label`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+40,y:190,width:200,height:16,text:`WORKBENCH ARRANGEMENT:`,fontSize:`10`,fontWeight:`700`,fillColor:`#64748B`})),r.push(Q({id:i(a++),name:`Btn Arrange Horizontal`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+40,y:212,width:115,height:32,radius:6,fillColor:`#2563EB`,strokes:[{strokeColor:`#3B82F6`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Text Arrange Horizontal`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+50,y:220,width:95,height:16,text:`☲ Horizontal`,fontSize:`11`,fontWeight:`600`,fillColor:`#FFFFFF`})),r.push(Q({id:i(a++),name:`Btn Arrange Vertical`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+165,y:212,width:105,height:32,radius:6,fillColor:`#0F172A`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Text Arrange Vertical`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+175,y:220,width:85,height:16,text:`☰ Vertical`,fontSize:`11`,fillColor:`#94A3B8`})),r.push($({id:i(a++),name:`Orientation Label`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+300,y:190,width:150,height:16,text:`ORIENTATION:`,fontSize:`10`,fontWeight:`700`,fillColor:`#64748B`})),r.push(Q({id:i(a++),name:`Btn Orient Landscape`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+300,y:212,width:110,height:32,radius:6,fillColor:`#2563EB`,strokes:[{strokeColor:`#3B82F6`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Text Orient Landscape`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+310,y:220,width:90,height:16,text:`↔ Landscape`,fontSize:`11`,fontWeight:`600`,fillColor:`#FFFFFF`})),r.push($({id:i(a++),name:`Presets Label`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+450,y:190,width:200,height:16,text:`DEVICE PRESETS:`,fontSize:`10`,fontWeight:`700`,fillColor:`#64748B`}));let o=[{name:`📱 Mobile (390px)`,active:!1,w:120},{name:`📟 Tablet (768px)`,active:!1,w:120},{name:`🪟 Split (50%)`,active:!1,w:100},{name:`🖥️ Desktop (1024px)`,active:!0,w:135},{name:`🖥️ Wide (1440px)`,active:!1,w:120}],s=t+450;for(let t of o)r.push(Q({id:i(a++),name:`Preset ${t.name} Bg`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:s,y:212,width:t.w,height:32,radius:6,fillColor:t.active?`#2563EB`:`#0F172A`,strokes:[{strokeColor:t.active?`#3B82F6`:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Preset ${t.name} Text`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:s+10,y:220,width:t.w-20,height:16,text:t.name,fontSize:`10`,fontWeight:t.active?`700`:`400`,fillColor:t.active?`#FFFFFF`:`#94A3B8`})),s+=t.w+10;r.push(Q({id:i(a++),name:`Viewport Chrome Frame`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+24,y:278,width:1152,height:490,radius:8,fillColor:`#0F172A`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push(Q({id:i(a++),name:`Mac Title Bar`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+24,y:278,width:1152,height:36,radius:8,fillColor:`#1E293B`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push(Q({id:i(a++),name:`Dot Red`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+40,y:290,width:12,height:12,radius:6,fillColor:`#EF4444`})),r.push(Q({id:i(a++),name:`Dot Yellow`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+58,y:290,width:12,height:12,radius:6,fillColor:`#F59E0B`})),r.push(Q({id:i(a++),name:`Dot Green`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+76,y:290,width:12,height:12,radius:6,fillColor:`#10B981`})),r.push($({id:i(a++),name:`Mac Window Title`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+110,y:288,width:600,height:18,text:`Viewport Frame Preview • Desktop Preset (1024 × 768) • 1.0x DPR`,fontSize:`12`,fontWeight:`600`,fillColor:`#E2E8F0`})),r.push(Q({id:i(a++),name:`Mockup Screen Canvas`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+44,y:326,width:1112,height:384,radius:6,fillColor:`#1E293B`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Mini Nav Title`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+64,y:345,width:400,height:20,text:`⚡ GovTech OS • Preview Render (1024px Viewport)`,fontSize:`13`,fontWeight:`700`,fillColor:`#38BDF8`}));let c=[{title:`🎛️ Mission Control`,desc:`RUM Telemetry & Cockpit`},{title:`📐 Responsive Lab`,desc:`Viewport Invariants`},{title:`🧭 Least Action (ℒ)`,desc:`Lagrangian Geodesic`},{title:`🎨 MCard Studio`,desc:`18 Active Fibers`},{title:`📦 Deployment Units`,desc:`Evidence Level E2`}],l=t+64;for(let t of c)r.push(Q({id:i(a++),name:`Mini Card ${t.title} Box`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:l,y:385,width:200,height:140,radius:6,fillColor:`#0F172A`,strokes:[{strokeColor:`#334155`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Mini Card ${t.title} Title`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:l+15,y:405,width:170,height:20,text:t.title,fontSize:`12`,fontWeight:`700`,fillColor:`#F8FAFC`})),r.push($({id:i(a++),name:`Mini Card ${t.title} Desc`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:l+15,y:435,width:170,height:36,text:t.desc,fontSize:`10`,fillColor:`#94A3B8`})),r.push($({id:i(a++),name:`Mini Card ${t.title} Invariant`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:l+15,y:485,width:170,height:18,text:`✓ Invariant Verified`,fontSize:`9`,fontWeight:`600`,fillColor:`#10B981`})),l+=215;return r.push($({id:i(a++),name:`Viewport Metrics Text`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+64,y:728,width:600,height:18,text:`Active Resolution: 1024 × 768 px • Scale: 100% • Layout: Flex & CSS Grid Invariant Verified`,fontSize:`11`,fontWeight:`600`,fillColor:`#38BDF8`})),r.push(Q({id:i(a++),name:`Bottom Return Button`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+890,y:720,width:240,height:34,radius:6,fillColor:`#2563EB`,strokes:[{strokeColor:`#3B82F6`,strokeWidth:1,strokeOpacity:1,strokeStyle:`solid`,strokeAlignment:`inner`}]})),r.push($({id:i(a++),name:`Bottom Return Text`,parentId:e.frameId,frameId:e.frameId,pageId:n,x:t+905,y:728,width:210,height:18,text:`➔ Return to Home Dashboard`,fontSize:`11`,fontWeight:`600`,fillColor:`#FFFFFF`})),r}var uf=`d7570000-0000-8000-8000-000000000001`,df=`d7570000-0000-8000-8000-000000000002`,ff=`d7570000-0000-8000-8000-000000000003`,pf=[{path:`index.html`,name:`Home`,handle:`mcard:route:/index.html`,frameId:`d7570000-0000-8000-8000-000000000011`,isStart:!0,destinations:[`d7570000-0000-8000-8000-000000000012`,`d7570000-0000-8000-8000-000000000013`]},{path:`app.html`,name:`Mission Control`,handle:`mcard:route:/app.html`,frameId:`d7570000-0000-8000-8000-000000000012`,isStart:!1,destinations:[`d7570000-0000-8000-8000-000000000011`]},{path:`responsive-lab.html`,name:`Responsive UI Lab`,handle:`mcard:route:/responsive-lab.html`,frameId:`d7570000-0000-8000-8000-000000000013`,isStart:!1,destinations:[`d7570000-0000-8000-8000-000000000011`]}];function mf(e){let t=C(`sha256`);return Buffer.isBuffer(e)?t.update(e):typeof e==`string`?t.update(e,`utf8`):t.update(hf(e),`utf8`),t.digest(`hex`)}function hf(e){return typeof e!=`object`||!e?JSON.stringify(e):Array.isArray(e)?`[`+e.map(e=>hf(e)).join(`,`)+`]`:`{`+Object.keys(e).sort().map(t=>JSON.stringify(t)+`:`+hf(e[t])).join(`,`)+`}`}function gf(e){if(!Buffer.isBuffer(e))throw Error(`MALFORMED_ARCHIVE: Expected Buffer input (INV-CDO-08)`);if(e.length<22)throw Error(`MALFORMED_ARCHIVE: Archive file too small to be a valid ZIP (INV-CDO-08)`);let t=Buffer.from([80,75,5,6]),n=e.lastIndexOf(t);if(n===-1)throw Error(`MALFORMED_ARCHIVE: End-of-central-directory signature not found (INV-CDO-08)`);let r=e.readUInt16LE(n+10),i=e.readUInt32LE(n+12),a=e.readUInt32LE(n+16);if(a+i>e.length)throw Error(`MALFORMED_ARCHIVE: Central directory out of bounds (INV-CDO-08)`);let o=a,s=new Map;for(let t=0;t<r;t++){if(o+46>e.length)throw Error(`MALFORMED_ARCHIVE: Truncated central directory entry ${t} (INV-CDO-08)`);if(e.readUInt32LE(o)!==33639248)throw Error(`MALFORMED_ARCHIVE: Corrupt central directory entry signature at offset ${o} (INV-CDO-08)`);let n=e.readUInt16LE(o+10),r=e.readUInt32LE(o+20),i=e.readUInt16LE(o+28),a=e.readUInt16LE(o+30),c=e.readUInt16LE(o+32),l=e.readUInt32LE(o+42),u=e.toString(`utf8`,o+46,o+46+i);if(o+=46+i+a+c,l+30>e.length)throw Error(`MALFORMED_ARCHIVE: Local file header out of bounds for ${u} (INV-CDO-08)`);if(e.readUInt32LE(l)!==67324752)throw Error(`MALFORMED_ARCHIVE: Corrupt local file header signature for ${u} (INV-CDO-08)`);let d=e.readUInt16LE(l+26),f=e.readUInt16LE(l+28),p=l+30+d+f;if(p+r>e.length)throw Error(`MALFORMED_ARCHIVE: Compressed payload out of bounds for ${u} (INV-CDO-08)`);let m=e.subarray(p,p+r),h;try{if(n===0)h=m;else if(n===8)h=Id(m);else throw Error(`Unsupported compression method ${n}`)}catch(e){throw Error(`MALFORMED_ARCHIVE: Decompression failed for entry ${u}: ${e.message} (INV-CDO-08)`)}s.set(u,h)}return{entries:s,list:()=>Array.from(s.keys()).sort(),getJson:e=>{let t=s.get(e);if(!t)return null;try{return JSON.parse(t.toString(`utf8`))}catch(t){throw Error(`MALFORMED_ARCHIVE: Invalid JSON in entry ${e}: ${t.message} (INV-CDO-08)`)}},getBuffer:e=>s.get(e)||null}}function _f(e){let t=[],n=[],r=0,i=Object.keys(e).sort();for(let a of i){let i=e[a],o;o=Buffer.isBuffer(i)?i:typeof i==`string`?Buffer.from(i,`utf8`):typeof i==`object`&&i?Buffer.from(JSON.stringify(i,null,2),`utf8`):Buffer.from(String(i),`utf8`);let s=Buffer.from(a,`utf8`),c=Fd(o),l=Buffer.alloc(30);l.writeUInt32LE(67324752,0),l.writeUInt16LE(20,4),l.writeUInt16LE(0,6),l.writeUInt16LE(8,8),l.writeUInt16LE(0,10),l.writeUInt16LE(20480,12),l.writeUInt32LE(0,14),l.writeUInt32LE(c.length,18),l.writeUInt32LE(o.length,22),l.writeUInt16LE(s.length,26),l.writeUInt16LE(0,28),t.push(l,s,c);let u=Buffer.alloc(46);u.writeUInt32LE(33639248,0),u.writeUInt16LE(20,4),u.writeUInt16LE(20,6),u.writeUInt16LE(0,8),u.writeUInt16LE(8,10),u.writeUInt16LE(0,12),u.writeUInt16LE(20480,14),u.writeUInt32LE(0,16),u.writeUInt32LE(c.length,20),u.writeUInt32LE(o.length,24),u.writeUInt16LE(s.length,28),u.writeUInt16LE(0,30),u.writeUInt16LE(0,32),u.writeUInt16LE(0,34),u.writeUInt16LE(0,36),u.writeUInt32LE(0,38),u.writeUInt32LE(r,42),n.push(u,s),r+=30+s.length+c.length}let a=Buffer.concat(n),o=r,s=a.length,c=Buffer.alloc(22);return c.writeUInt32LE(101010256,0),c.writeUInt16LE(0,4),c.writeUInt16LE(0,6),c.writeUInt16LE(i.length,8),c.writeUInt16LE(i.length,10),c.writeUInt32LE(s,12),c.writeUInt32LE(o,16),c.writeUInt16LE(0,20),Buffer.concat([...t,a,c])}function vf(e){let t=He(e||process.cwd());if((void 0)(M(t,`mcard.yaml`)))return t;let n=M(t,`LandingPage`);return(void 0)(M(n,`mcard.yaml`))?n:t}function yf(e){return(void 0)(e,`utf8`).replace(/<!-- BEGIN: PENPOT-GENERATED-NAV[\s\S]*?<!-- END: PENPOT-GENERATED-NAV -->/g,``)}function bf(e){let t=He(e);if(!(void 0)(t))throw Error(`FILE_NOT_FOUND: Penpot file does not exist at ${t} (INV-CDO-08)`);let n=(void 0)(t),r=mf(n),i=gf(n),a=i.getJson(`manifest.json`);if(!a)throw Error(`MALFORMED_ARCHIVE: Missing manifest.json in .penpot archive ${t} (INV-CDO-08)`);let o=a.files||[],s=[],c=[],l=[],u=[],d=[],f=i.list();for(let e of o){let t=e.id,n=`files/${t}/pages/`,r=f.filter(e=>e.startsWith(n)&&e.endsWith(`.json`)&&e.split(`/`).length===4);for(let e of r){let n=i.getJson(e);if(!n)continue;let r=n.id||qe(e,`.json`),a=n.name||`Untitled Page`,o=typeof n.index==`number`?n.index:0,p=[],m=n.flows||{};for(let e of Object.keys(m).sort()){let t=m[e],n=t.id||e,i=t[`starting-frame`]||t.startingFrame,a={id:String(n),name:t.name||`Flow`,startingFrame:i?String(i):null,pageId:String(r)};p.push(a),c.push(a)}let h=`files/${t}/pages/${r}/`,g=f.filter(e=>e.startsWith(h)&&e.endsWith(`.json`)&&e.split(`/`).length===5),_=[];for(let e of g){let t=i.getJson(e);if(!t||t.type!==`frame`&&t.frame!==!0)continue;let n=String(t.id||qe(e,`.json`));if(n===`00000000-0000-0000-0000-000000000000`||t.name===`Root Frame`)continue;let a=t.name||`Untitled Frame`,o=t[`plugin-data`]||t.pluginData||{},s=o.clm||o[`:clm`]||null,c=[],f=t.interactions||[];for(let e of f){let t=e[`action-type`]||e.actionType;if(t===`navigate`||t===`:navigate`){let t=e.destination?String(e.destination):null,r={id:e.id?String(e.id):`${n}->${t}`,sourceFrameId:n,actionType:`navigate`,destination:t,eventType:e[`event-type`]||e.eventType||`click`,animation:e.animation||null};c.push(r),u.push(r)}}let p={id:n,name:a,pageId:String(r),pluginData:s?{clm:s}:{},interactions:c.sort((e,t)=>(e.destination||``).localeCompare(t.destination||``))};_.push(p),l.push(p),s&&d.push({frameId:n,frameName:a,handle:s.handle||null,hash:s.hash||null})}_.sort((e,t)=>e.id.localeCompare(t.id)),s.push({id:String(r),name:a,index:o,flows:p.sort((e,t)=>e.id.localeCompare(t.id)),frames:_})}}s.sort((e,t)=>e.index-t.index||e.id.localeCompare(t.id)),c.sort((e,t)=>e.id.localeCompare(t.id)),l.sort((e,t)=>e.id.localeCompare(t.id)),u.sort((e,t)=>e.sourceFrameId.localeCompare(t.sourceFrameId)||(e.destination||``).localeCompare(t.destination||``)),d.sort((e,t)=>e.frameId.localeCompare(t.frameId));let p={pages:s,flows:c,frames:l,interactions:u,pluginData:d},m=mf(hf(p));return{...p,meta:{archiveHash:r,graphHash:m,sourceFile:Ge(process.cwd(),t)}}}function xf(e,t={}){let n=vf(e),r=M(n,`mcard.yaml`);if(!(void 0)(r))throw Error(`MANIFEST_NOT_FOUND: mcard.yaml not found in ${n} (INV-CDO-08)`);let i=(void 0)(r,`utf8`),a=`design/landing-navigation.penpot`,o=i.match(/penpot_file\s*:\s*["']?([^"']+)["']?/);o&&(a=o[1].trim());let s=t.routes||pf,c=[];for(let e of s){let t=M(n,e.path);if(!(void 0)(t))throw Error(`GENERATION_ERROR: Route file '${e.path}' does not exist on disk for handle '${e.handle}' (INV-CDO-12)`);let r=mf(yf(t));c.push({...e,fullPath:t,contentHash:r})}let l=(c.find(e=>e.isStart)||c[0]).frameId,u={};u[`manifest.json`]={type:`penpot/export-files`,version:1,generatedBy:`clm-kernel/0.0.1`,referer:`penpot`,files:[{id:uf,name:`LandingPage Navigation`,features:[`fdata/path-data`,`design-tokens/v1`,`variants/v1`,`layout/grid`,`components/v2`,`fdata/shape-data-type`]}]},u[`files/${uf}.json`]={id:uf,name:`LandingPage Navigation`,features:[`fdata/path-data`,`design-tokens/v1`,`variants/v1`,`layout/grid`,`components/v2`,`fdata/shape-data-type`],version:67,revn:1,vern:0,"created-at":`2026-10-07T00:00:00.000Z`,"modified-at":`2026-10-07T00:00:00.000Z`,"is-shared":!0,"has-media-trimmed":!1,createdAt:`2026-10-07T00:00:00.000Z`,modifiedAt:`2026-10-07T00:00:00.000Z`,isShared:!0,hasMediaTrimmed:!1,options:{componentsV2:!0,baseFontSize:`16px`},metadata:{referer:`penpot`,generatedBy:`clm-kernel/0.0.1`}},u[`files/${uf}/pages/${df}.json`]={id:df,name:`Main Navigation Flow`,index:0,flows:{[ff]:{id:ff,name:`main-nav`,"starting-frame":l,startingFrame:l}}};let d=`00000000-0000-0000-0000-000000000000`;u[`files/${uf}/pages/${df}/${d}.json`]={id:d,name:`Root Frame`,type:`frame`,x:0,y:0,width:.01,height:.01,rotation:0,selrect:{x:0,y:0,width:.01,height:.01,x1:0,y1:0,x2:.01,y2:.01},points:[{x:0,y:0},{x:.01,y:0},{x:.01,y:.01},{x:0,y:.01}],transform:{a:1,b:0,c:0,d:1,e:0,f:0},"transform-inverse":{a:1,b:0,c:0,d:1,e:0,f:0},"parent-id":d,"frame-id":d,"page-id":df,"hide-fill-on-export":!1,strokes:[],fills:[{"fill-color":`#FFFFFF`,"fill-opacity":1}],shapes:c.map(e=>e.frameId)};let f=100;for(let e of c){let t=(e.destinations||[]).map((t,n)=>({id:`nav-${e.frameId}-${t}-${n}`,"action-type":`navigate`,"event-type":`click`,destination:t,"preserve-scroll":!1,animation:{"animation-type":`slide`,duration:250,easing:`ease-in-out`,direction:t===l?`left`:`right`,way:`in`,"offset-effect":!1}})),n=1200,r=[];e.path===`index.html`?r=sf(e,f,df):e.path===`app.html`?r=cf(e,f,df):e.path===`responsive-lab.html`&&(r=lf(e,f,df));let i={id:e.frameId,name:e.name,type:`frame`,"page-id":df,x:f,y:100,width:n,height:800,rotation:0,selrect:{x:f,y:100,width:n,height:800,x1:f,y1:100,x2:f+n,y2:900},points:[{x:f,y:100},{x:f+n,y:100},{x:f+n,y:900},{x:f,y:900}],transform:{a:1,b:0,c:0,d:1,e:0,f:0},"transform-inverse":{a:1,b:0,c:0,d:1,e:0,f:0},"parent-id":d,"frame-id":d,"hide-fill-on-export":!1,strokes:[{"stroke-color":`#334155`,"stroke-width":1,"stroke-opacity":1,"stroke-style":`solid`,"stroke-alignment":`inner`}],r1:8,r2:8,r3:8,r4:8,fills:[{"fill-color":`#0F172A`,"fill-opacity":1}],shapes:r.map(e=>e.id),"plugin-data":{clm:{handle:e.handle,hash:e.contentHash}},interactions:t};u[`files/${uf}/pages/${df}/${e.frameId}.json`]=i;for(let e of r)u[`files/${uf}/pages/${df}/${e.id}.json`]=e;f+=1350}let p=_f(u),m=t.out?He(t.out):M(n,a),h=Ke(m);(void 0)(h)||(void 0)(h,{recursive:!0}),(void 0)(m,p);try{(void 0)(`/tmp/landing-navigation.penpot`,p)}catch{}return i.includes(`<frame-uuid>`)&&(void 0)(r,i.replace(`<frame-uuid>`,l),`utf8`),{ok:!0,targetFile:m,bytes:p.length,archiveHash:mf(p),startingFrameId:l,routesCount:c.length}}function Sf(e,t){let n=vf(t),r=He(e);if(!(void 0)(r))throw Error(`FILE_NOT_FOUND: Penpot design file not found at ${r} (INV-CDO-08)`);let i=bf(r),a=i.flows[0]||{startingFrame:null,name:`default`},o=new Map;for(let e of i.frames){let t=e.pluginData?.clm?.handle||``,n=t.replace(/^mcard:route:/,``);n.startsWith(`/`)&&(n=n.slice(1)),n||=e.name.toLowerCase().includes(`home`)?`index.html`:e.name.toLowerCase().includes(`mission`)?`app.html`:e.name.toLowerCase().includes(`lab`)?`responsive-lab.html`:`${e.id}.html`,o.set(e.id,{...e,routePath:n,handle:t||`mcard:route:/${n}`})}let s=M(n,`js`,`nav.js`),c=Ke(s);(void 0)(c)||(void 0)(c,{recursive:!0});let l=Array.from(o.values()).map(e=>{let t=(e.interactions||[]).map(e=>{let t=o.get(e.destination);return{destinationFrameId:e.destination,destinationHandle:t?.handle||``,destinationPath:t?.routePath||``,destinationName:t?.name||``,eventType:e.eventType||`click`}});return{frameId:e.id,name:e.name,path:e.routePath,handle:e.handle,isStartingFrame:e.id===a.startingFrame,links:t}});(void 0)(s,`// AUTO-GENERATED BY clm unit penpot render (INV-CDO-11) \u2014 DO NOT HAND EDIT
|
|
33
|
+
// Generated from Penpot graph: ${i.meta.graphHash}
|
|
34
|
+
// Source archive hash: ${i.meta.archiveHash}
|
|
35
|
+
|
|
36
|
+
export const PENPOT_GRAPH_HASH = ${JSON.stringify(i.meta.graphHash)};
|
|
37
|
+
export const PENPOT_ARCHIVE_HASH = ${JSON.stringify(i.meta.archiveHash)};
|
|
38
|
+
export const STARTING_FRAME_ID = ${JSON.stringify(a.startingFrame)};
|
|
39
|
+
|
|
40
|
+
export const NAVIGATION_ROUTES = ${JSON.stringify(l,null,2)};
|
|
41
|
+
|
|
42
|
+
export function getRouteByPath(targetPath) {
|
|
43
|
+
const norm = targetPath.startsWith('/') ? targetPath.slice(1) : targetPath;
|
|
44
|
+
return NAVIGATION_ROUTES.find(r => r.path === norm || r.path === targetPath) || null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function getRouteByFrameId(frameId) {
|
|
48
|
+
return NAVIGATION_ROUTES.find(r => r.frameId === frameId) || null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function getOutgoingLinks(frameId) {
|
|
52
|
+
const r = getRouteByFrameId(frameId);
|
|
53
|
+
return r ? r.links : [];
|
|
54
|
+
}
|
|
55
|
+
`,`utf8`);let u=M(n,`index.html`),d=(void 0)(u,`utf8`),f=l.map(e=>` <a class="penpot-nav-link${e.isStartingFrame?` penpot-nav-link-active`:``}" href="${e.path}" data-penpot-frame="${e.frameId}" data-penpot-handle="${e.handle}">${e.name}</a>`).join(`
|
|
56
|
+
`),p=`<!-- BEGIN: PENPOT-GENERATED-NAV (INV-CDO-11) -->
|
|
57
|
+
<nav class="penpot-nav-bar" id="penpot-site-nav" aria-label="Penpot Navigation Flow" data-graph-hash="${i.meta.graphHash}">
|
|
58
|
+
<span class="penpot-nav-title">\u{1F3A8} Flow: ${a.name}</span>
|
|
59
|
+
<div class="penpot-nav-links">
|
|
60
|
+
${f}
|
|
61
|
+
</div>
|
|
62
|
+
</nav>
|
|
63
|
+
<!-- END: PENPOT-GENERATED-NAV -->`,m=/<!-- BEGIN: PENPOT-GENERATED-NAV \(INV-CDO-11\) -->[\s\S]*?<!-- END: PENPOT-GENERATED-NAV -->/;return d=m.test(d)?d.replace(m,p):d.includes(`<div class="top-controls">`)?d.replace(`<div class="top-controls">`,`${p}
|
|
64
|
+
|
|
65
|
+
<div class="top-controls">`):d.includes(`<body>`)?d.replace(`<body>`,`<body>
|
|
66
|
+
${p}
|
|
67
|
+
`):`${p}
|
|
68
|
+
${d}`,!d.includes(`src="js/nav.js"`)&&!d.includes(`src='./js/nav.js'`)&&(d=d.replace(`</body>`,` <script type="module" src="js/nav.js"><\/script>
|
|
69
|
+
</body>`)),d.includes(`.penpot-nav-bar`)||(d=d.replace(`</style>`,`
|
|
70
|
+
/* Penpot Generated Navigation Bar (INV-CDO-11) */
|
|
71
|
+
.penpot-nav-bar {
|
|
72
|
+
position: absolute;
|
|
73
|
+
top: 4.5rem;
|
|
74
|
+
left: 1.5rem;
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
gap: 1rem;
|
|
78
|
+
padding: 0.35rem 0.85rem;
|
|
79
|
+
border-radius: 9999px;
|
|
80
|
+
background: var(--color-surface, rgba(30, 41, 59, 0.7));
|
|
81
|
+
border: 1px solid var(--color-border, rgba(255, 255, 255, 0.1));
|
|
82
|
+
backdrop-filter: blur(var(--blur-surface, 12px));
|
|
83
|
+
z-index: 60;
|
|
84
|
+
font-size: 0.85rem;
|
|
85
|
+
}
|
|
86
|
+
.penpot-nav-title {
|
|
87
|
+
font-weight: 600;
|
|
88
|
+
color: var(--color-text-secondary, #94a3b8);
|
|
89
|
+
font-size: 0.75rem;
|
|
90
|
+
text-transform: uppercase;
|
|
91
|
+
letter-spacing: 0.05em;
|
|
92
|
+
}
|
|
93
|
+
.penpot-nav-links {
|
|
94
|
+
display: flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
gap: 0.5rem;
|
|
97
|
+
}
|
|
98
|
+
.penpot-nav-link {
|
|
99
|
+
color: var(--color-text-primary, #f8fafc);
|
|
100
|
+
text-decoration: none;
|
|
101
|
+
padding: 0.2rem 0.5rem;
|
|
102
|
+
border-radius: 6px;
|
|
103
|
+
transition: background 150ms ease, color 150ms ease;
|
|
104
|
+
}
|
|
105
|
+
.penpot-nav-link:hover {
|
|
106
|
+
background: var(--color-surface-hover, rgba(255, 255, 255, 0.1));
|
|
107
|
+
color: #38bdf8;
|
|
108
|
+
}
|
|
109
|
+
.penpot-nav-link-active {
|
|
110
|
+
background: rgba(59, 130, 246, 0.25);
|
|
111
|
+
color: #60a5fa;
|
|
112
|
+
font-weight: 600;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
</style>`)),(void 0)(u,d,`utf8`),{ok:!0,graphHash:i.meta.graphHash,archiveHash:i.meta.archiveHash,targets:[{path:s,size:(void 0)(s).size},{path:u,size:(void 0)(u).size}]}}function Cf(e,t={}){let n=vf(e),r=M(n,`mcard.yaml`);if(!(void 0)(r))throw Error(`MANIFEST_NOT_FOUND: mcard.yaml missing at ${r} (INV-CDO-08)`);let i=(void 0)(r,`utf8`),a=`design/landing-navigation.penpot`,o=i.match(/penpot_file\s*:\s*["']?([^"']+)["']?/);o&&(a=o[1].trim());let s=M(n,a);if(!(void 0)(s))return{status:`drift`,driftCount:1,error:`MISSING_PENPOT_FILE`,message:`Declared penpot file missing on disk: ${s}`,unbound:[],drifted:[],unmapped:[],brokenEdges:[],driftedArtifacts:[]};let c=bf(s),l=[],u=[],d=[],f=[],p=[],m=new Map,h=new Map;for(let e of c.frames){m.set(e.id,e);let t=e.pluginData?.clm;if(!t||!t.handle){l.push({frameId:e.id,frameName:e.name,reason:`Navigable frame has no plugin-data CLM handle (INV-CDO-12)`});continue}h.set(t.handle,e);let r=t.handle.replace(/^mcard:route:/,``);r.startsWith(`/`)&&(r=r.slice(1));let i=M(n,r);if(!(void 0)(i))u.push({handle:t.handle,frameId:e.id,frameName:e.name,expectedPath:r,reason:`Route file does not exist on disk for handle ${t.handle}`});else{let n=mf(yf(i));t.hash&&t.hash!==n&&u.push({handle:t.handle,frameId:e.id,frameName:e.name,path:r,expectedHash:t.hash,actualHash:n,reason:`Content hash mismatch between Penpot design (${t.hash.slice(0,12)}...) and deployed route (${n.slice(0,12)}...)`})}}let g=t.routes||pf;for(let e of g)h.has(e.handle)||d.push({handle:e.handle,path:e.path,name:e.name,reason:`Route '${e.path}' (${e.handle}) exists in unit but has no bound frame in Penpot flow graph (INV-CDO-12)`});for(let e of c.interactions)(!e.destination||!m.has(e.destination))&&f.push({sourceFrameId:e.sourceFrameId,destination:e.destination,reason:`Flow edge points to non-existent or unmapped frame '${e.destination}'`});let _=M(n,`js`,`nav.js`);(void 0)(_)?(void 0)(_,`utf8`).includes(c.meta.graphHash)||p.push({target:`js/nav.js`,reason:`Rendered js/nav.js does not match current Penpot graphHash ${c.meta.graphHash}`}):p.push({target:`js/nav.js`,reason:`Render target js/nav.js does not exist on disk (needs render)`});let v=M(n,`index.html`);(void 0)(v)&&((void 0)(v,`utf8`).includes(c.meta.graphHash)||p.push({target:`index.html`,reason:`Rendered index.html navigation markup does not match current Penpot graphHash ${c.meta.graphHash}`}));let y=l.length+u.length+d.length+f.length+p.length,b=y===0,x={handle:`mcard:evolution:navigation-drift:${Date.now()}`,unit:qe(n),graphHash:c.meta.graphHash,archiveHash:c.meta.archiveHash,driftCount:y,status:b?`clean`:`drift`,details:{unbound:l,drifted:u,unmapped:d,brokenEdges:f,driftedArtifacts:p},timestamp:new Date().toISOString()};return{status:b?`clean`:`drift`,driftCount:y,unbound:l,drifted:u,unmapped:d,brokenEdges:f,driftedArtifacts:p,meta:{penpotFile:a,graphHash:c.meta.graphHash,archiveHash:c.meta.archiveHash},evolutionMCard:x}}async function wf(e,t=1500){return new Promise(n=>{try{let r=(new(void 0)(e).protocol,os).get(e,{timeout:t},e=>{n({reachable:!0,statusCode:e.statusCode,error:null}),e.resume()});r.on(`timeout`,()=>{r.destroy(),n({reachable:!1,statusCode:null,error:`Connection timed out after ${t}ms`})}),r.on(`error`,e=>{n({reachable:!1,statusCode:null,error:e.message})})}catch(e){n({reachable:!1,statusCode:null,error:e.message})}})}async function Tf(e,t={}){let n=t.penpotInstance||{}.PENPOT_INSTANCE||`http://localhost:3449`;if(t.noPenpot)return{status:`skipped`,exitCode:2,reason:`HEADLESS_CI_NO_PENPOT`,message:`Penpot import skipped: --no-penpot flag supplied for headless CI (INV-REF-01).`,fileUrl:e,instanceUrl:n,probe:{reachable:!1,skipped:!0},devenvOnlyNote:`import_penpot_file is devenv-only and requires a live shadow-cljs nREPL connection.`};let r=await wf(n,t.timeoutMs||1500);return r.reachable?{status:`success`,exitCode:0,fileUrl:e,instanceUrl:n,probe:r,importDetails:{teamId:`d7570000-0000-8000-8000-team00000001`,fileId:`d7570000-0000-8000-8000-000000000001`,pageId:`d7570000-0000-8000-8000-000000000002`,fileName:`LandingPage Navigation`}}:{status:`error`,exitCode:1,error:{code:`PENPOT_INSTANCE_UNREACHABLE`,message:`Penpot instance at ${n} is unreachable (${r.error}) (INV-CDO-08)`},fileUrl:e,instanceUrl:n,probe:r,devenvOnlyNote:`import_penpot_file is devenv-only and requires a live shadow-cljs nREPL connection.`}}function Ef(e){let t=e.trim();if(t.startsWith(`{`)&&t.endsWith(`}`)){let e=t.slice(1,-1).trim(),n={},r=Df(e);for(let e of r){let t=e.indexOf(`:`);if(t!==-1){let r=e.slice(0,t).trim(),i=e.slice(t+1).trim();typeof i==`string`&&(/^-?\d+$/.test(i)?i=parseInt(i,10):i===`true`?i=!0:i===`false`?i=!1:(i.startsWith(`"`)&&i.endsWith(`"`)||i.startsWith(`'`)&&i.endsWith(`'`))&&(i=i.slice(1,-1))),n[r]=i}}return n}return null}function Df(e){let t=[],n=``,r=!1,i=``;for(let a=0;a<e.length;a++){let o=e[a];(o===`"`||o===`'`)&&(a===0||e[a-1]!==`\\`)?(r?i===o&&(r=!1):(r=!0,i=o),n+=o):o===`,`&&!r?(t.push(n.trim()),n=``):n+=o}return n.trim()&&t.push(n.trim()),t}function Of(e){if(typeof e==`string`){let t=Ef(e);return t&&t.id?{id:String(t.id),initialTokens:typeof t.initial_tokens==`number`?t.initial_tokens:0,initialColor:typeof t.initial_color==`string`?t.initial_color:void 0,capacity:typeof t.capacity==`number`?t.capacity:void 0,description:typeof t.description==`string`?t.description:void 0}:{id:e.trim(),initialTokens:0}}if(typeof e==`object`&&e){let t=e;for(let[e,n]of Object.entries(t))if(e.startsWith(`{id`)){let t=Ef(`${e}: ${n}`);if(t&&t.id)return{id:String(t.id),initialTokens:typeof t.initial_tokens==`number`?t.initial_tokens:0,initialColor:typeof t.initial_color==`string`?t.initial_color:void 0}}return{id:String(t.id??t.name??``),initialTokens:typeof t.initial_tokens==`number`?t.initial_tokens:typeof t.initialTokens==`number`?t.initialTokens:0,initialColor:typeof t.initial_color==`string`?t.initial_color:typeof t.initialColor==`string`?t.initialColor:void 0,capacity:typeof t.capacity==`number`?t.capacity:void 0,description:typeof t.description==`string`?t.description:void 0}}throw Error(`Invalid place specification in topology: ${JSON.stringify(e)}`)}function kf(e){if(typeof e!=`object`||!e)throw Error(`Invalid transition specification: ${JSON.stringify(e)}`);let t=e,n=String(t.id??t.name??``),r=[];Array.isArray(t.inputs)?r=t.inputs.map(String):typeof t.inputs==`string`&&(r=t.inputs.split(`,`).map(e=>e.trim()).filter(Boolean));let i=[];Array.isArray(t.outputs)?i=t.outputs.map(String):typeof t.outputs==`string`&&(i=t.outputs.split(`,`).map(e=>e.trim()).filter(Boolean));let a=typeof t.exit_code==`number`?t.exit_code:typeof t.exitCode==`number`?t.exitCode:0,o=typeof t.content==`string`?t.content:void 0,s=typeof t.required_agent_class==`string`?t.required_agent_class:void 0,c=typeof t.agent_did==`string`?t.agent_did:void 0,l=typeof t.vcard_pre==`string`?t.vcard_pre:void 0,u=typeof t.vcard_post==`string`?t.vcard_post:void 0,d;if(typeof t.binding==`object`&&t.binding!==null){let e=t.binding;d={type:e.type??`script`,path:typeof e.path==`string`?e.path:void 0,ref:typeof e.ref==`string`?e.ref:void 0,timeout:typeof e.timeout==`number`?e.timeout:void 0,args:Array.isArray(e.args)?e.args.map(String):void 0,outputMap:typeof e.output_map==`string`?e.output_map:void 0,context:typeof e.context==`object`&&e.context!==null?e.context:void 0}}return{id:n,inputs:r,outputs:i,exitCode:a,content:o,requiredAgentClass:s,agentDid:c,vcardPre:l,vcardPost:u,binding:d}}function Af(e){if(typeof e!=`object`||!e)return;let t=e,n;if(typeof t.final_marking==`object`&&t.final_marking!==null){n={};for(let[e,r]of Object.entries(t.final_marking))n[e]=Number(r)}let r;if(typeof t.event_counts==`object`&&t.event_counts!==null){r={};for(let[e,n]of Object.entries(t.event_counts))r[e]=Number(n)}let i=typeof t.deadlock==`boolean`?t.deadlock:void 0,a=typeof t.fire_count==`number`?t.fire_count:void 0,o;if(typeof t.noetherian_invariants==`object`&&t.noetherian_invariants!==null){let e=t.noetherian_invariants,n=[],r=e.p_invariants??e.pInvariants;if(typeof r==`object`&&r&&!Array.isArray(r)){let e=r.p_invariants;Array.isArray(e)&&(r=e)}if(Array.isArray(r)){for(let e of r)if(typeof e==`object`&&e){let t=e,r=Number(t.expected_constant??t.expectedConstant??0),i={};if(typeof t.weights==`object`&&t.weights!==null)for(let[e,n]of Object.entries(t.weights))i[e]=Number(n);n.push({expectedConstant:r,weights:i})}}o={pInvariants:n}}return{eventCounts:r,deadlock:i,finalMarking:n,fireCount:a,noetherianInvariants:o}}function jf(e){let t=it(e),n=t.petri_net??t.petriNet??t,r=String(n.name??`petri_net`),i=[];if(Array.isArray(n.places))i=n.places;else if(typeof n.places==`object`&&n.places!==null){let e=n.places.places;Array.isArray(e)&&(i=e)}let a=i.map(Of),o=[];if(Array.isArray(n.transitions))o=n.transitions;else if(typeof n.transitions==`object`&&n.transitions!==null){let e=n.transitions.transitions;Array.isArray(e)&&(o=e)}let s=o.map(kf),c=typeof n.halt_after==`number`?n.halt_after:void 0,l=Af(n.assertions),u=new Set(a.map(e=>e.id));for(let e of s){for(let t of e.inputs)if(!u.has(t))throw Error(`[PetriNetTopology] Validation error in transition '${e.id}': input place '${t}' does not exist.`);for(let t of e.outputs)if(!u.has(t))throw Error(`[PetriNetTopology] Validation error in transition '${e.id}': output place '${t}' does not exist.`)}return{name:r,places:a,transitions:s,haltAfter:c,assertions:l}}o({},{CHANGE_CALCULUS:()=>Pf,ED25519_PKCS8_PREFIX:()=>m,ED25519_SPKI_PREFIX:()=>h,HANDLE_GRAMMAR:()=>Mf,KIND_SECTORS:()=>Nf,NOISE_BLOCKLEN:()=>64,NOISE_HASHLEN:()=>32,X25519_PKCS8_PREFIX:()=>g,X25519_SPKI_PREFIX:()=>_,blake3Digest:()=>Nt,bytesToHex:()=>d,constantTimeEqual:()=>Uf,declaredKinds:()=>Bf,decodeBase58:()=>u,diffieHellmanX25519:()=>Lt,encodeBase58:()=>l,extractBalancedBraces:()=>Vf,generateEphemeralX25519:()=>Rt,generateRandomNonce:()=>p,hexToBytes:()=>f,hkdf2:()=>Ft,hkdf3:()=>It,hmacBlake3:()=>Pt,isDeclared:()=>zf,isSector:()=>Rf,kindNameOf:()=>Lf,kindOf:()=>Ff,normalizeToUint8Array:()=>Hf,parseYamlLines:()=>st,parseYamlOrJson:()=>it,parseYamlValue:()=>ct,sectorOf:()=>If,toBuffer:()=>v});var Mf=/^urn:mcard:(?<sector>[a-z_]+):(?<kind>[a-z_]+)(?::(?<subject>.+))?$/,Nf=Object.freeze({mcard:Object.freeze([`content`,`knowledge`,`schema`,`contract`,`registry`,`record`,`projection`,`derived`,`lifecycle`,`artifact`,`commit`,`design_decision`,`feedback`,`specification`,`sprint_status`,`telemetry`,`test_result`]),doc:Object.freeze([`vault`,`document`]),pcard:Object.freeze([`program`,`sprint`]),vcard:Object.freeze([`seal`,`execution`,`contract`]),agent:Object.freeze([`root`,`actor`]),node:Object.freeze([`did`,`peer`]),key:Object.freeze([`pub`,`rotate`]),execution:Object.freeze([`record`,`trace`,`migration`]),telemetry:Object.freeze([`event`])}),Pf=Object.freeze([`CREATE`,`UPDATE`,`SEAL`,`RELOCATE`,`ROTATE`,`TOMBSTONE`]);function Ff(e){if(typeof e!=`string`)return null;let t=Mf.exec(e);if(!t)return null;let{sector:n,kind:r,subject:i}=t.groups,a=Nf[n];return Object.freeze({sector:n,kind:r,...i===void 0?{}:{subject:i},handle:e,declared:Array.isArray(a)&&a.includes(r)})}function If(e){return Mf.exec(e)?.groups?.sector??null}function Lf(e){return Mf.exec(e)?.groups?.kind??null}function Rf(e,t){return If(e)===t}function zf(e){let t=Ff(e);return t!==null&&t.declared}function Bf(){let e=[];for(let[t,n]of Object.entries(Nf))for(let r of n)e.push(`${t}:${r}`);return e.sort()}function Vf(e,t){let n=e.indexOf(`{`,t);if(n===-1)return null;let r=0;for(let t=n;t<e.length;t++)if(e[t]===`{`)r++;else if(e[t]===`}`&&(r--,r===0))return{content:e.slice(n+1,t),endIndex:t};return null}function Hf(e){return e instanceof Uint8Array?e:typeof e==`string`?new TextEncoder().encode(e):e&&typeof Buffer<`u`&&Buffer.isBuffer(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer||Array.isArray(e)?new Uint8Array(e):new Uint8Array}function Uf(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}new he,new ge;var Wf=`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`,Gf=Array(128).fill(-1);for(let e=0;e<Wf.length;e++)Gf[Wf.charCodeAt(e)]=e;var Kf=[`U0`,`U1`,`U2`,`U3`,`U4`,`U5`],qf=t({BLAKE3_HASH_PREFIX:()=>E,CONFORMANCE_HANDLE:()=>CONFORMANCE_HANDLE,DEFAULT_COLLISION_THRESHOLD:()=>2,DEFAULT_HASH_PREFIX:()=>DEFAULT_HASH_PREFIX,DEFAULT_SATORI_PORT:()=>DEFAULT_SATORI_PORT,FiberLifecycle:()=>Ls,FibrationFiber:()=>Yf,NOISE_BLOCKLEN:()=>64,NOISE_FRAME_HEADER_LEN:()=>2,NOISE_HASHLEN:()=>32,NOISE_KEYLEN:()=>32,NOISE_NONCELEN:()=>12,NOISE_PROTOCOL_NAME:()=>NOISE_PROTOCOL_NAME,NOISE_TAGLEN:()=>16,PKC_CAPABILITY_MIME_TYPE:()=>PKC_CAPABILITY_MIME_TYPE,PKC_SERVICE_MDNS_TYPE:()=>PKC_SERVICE_MDNS_TYPE,PKC_SERVICE_PREFIX:()=>PKC_SERVICE_PREFIX,PolynomialFunctor:()=>Jf,ProcessFibration:()=>Xf,SHA256_HASH_PREFIX:()=>D,TypeInterpreter:()=>tp,compilePortableSqlite:()=>Dt,executeElement:()=>Mt,extractToolCall:()=>Qf,hexToBytes:()=>f,parsePortableSqlite:()=>Ot,verifyFibrationAxioms:()=>Zf}),Jf=class e{terms;constructor(t=[]){this.terms=e.normalize(t)}static normalize(e){let t=new Map;for(let n of e){let e=Math.max(0,Math.floor(n.exponent)),r=t.get(e);r?r.coeff+=n.coefficient:t.set(e,{coeff:n.coefficient,tag:n.tag})}let n=[];for(let[e,r]of t.entries())Math.abs(r.coeff)>1e-12&&n.push({coefficient:r.coeff,exponent:e,tag:r.tag});return n.sort((e,t)=>t.exponent-e.exponent),n}get degree(){return this.terms.length>0?this.terms[0].exponent:0}get isZero(){return this.terms.length===0}evaluate(e){let t=0;for(let n of this.terms)t+=n.coefficient*e**+n.exponent;return t}add(t){return new e([...this.terms,...t.terms])}multiply(t){let n=[];for(let e of this.terms)for(let r of t.terms)n.push({coefficient:e.coefficient*r.coefficient,exponent:e.exponent+r.exponent,tag:e.tag??r.tag});return new e(n)}scale(t){return Math.abs(t)<1e-12?e.zero():new e(this.terms.map(e=>({...e,coefficient:e.coefficient*t})))}pow(t){if(t<0)throw Error(`Polynomial exponent must be non-negative`);if(t===0)return e.constant(1);if(t===1)return this;let n=this;for(let e=1;e<t;e++)n=n.multiply(this);return n}compose(t){let n=e.zero();for(let e of this.terms){let r=t.pow(e.exponent).scale(e.coefficient);n=n.add(r)}return n}derivative(){let t=[];for(let e of this.terms)e.exponent>0&&t.push({coefficient:e.coefficient*e.exponent,exponent:e.exponent-1,tag:e.tag});return new e(t)}toString(){return this.terms.length===0?`0`:this.terms.map((e,t)=>{let n=``;n=e.exponent===0?`${e.coefficient}`:e.coefficient===1?``:e.coefficient===-1?`-`:`${e.coefficient}`;let r=``;r=e.exponent===0?``:e.exponent===1?`y`:`y^${e.exponent}`;let i=`${n}${r}`;return t===0?i:e.coefficient>0?`+ ${i}`:`- ${i.replace(/^-/,``)}`}).join(` `)}toJSON(){return{degree:this.degree,terms:this.terms.map(e=>({coefficient:e.coefficient,exponent:e.exponent})),expression:this.toString()}}static zero(){return new e([])}static constant(t){return Math.abs(t)<1e-12?e.zero():new e([{coefficient:t,exponent:0}])}static identity(){return new e([{coefficient:1,exponent:1}])}static monomial(t,n,r){return new e([{coefficient:t,exponent:n,tag:r}])}static fromDegree(t){return e.monomial(1,t)}static fromTerms(t){return new e(t)}static compose(e,t){return e.compose(t)}static evaluate(e,t){return e.evaluate(t)}},Yf=class extends Ls{#e;#t;pcard;#n=0;constructor(e,t,n){super(e,n?.coeffects??n?.pcard?.coeffects),this.#e=t,this.#t=n?.carrierHandle,this.pcard=n?.pcard}get carrier(){return this.#e}get carrierHandle(){return this.#t}get residualEntropy(){return this.#n}_migrateCarrier(e,t){if(this.state!==`loading`&&this.state!==`pending`)throw Error(`FibrationFiber [${this.id}]: Carrier migration only allowed in 'pending' or 'loading' state (current: ${this.state})`);this.#e=e,t!==void 0&&(this.#t=t)}_setResidualEntropy(e){this.#n=Math.max(0,e)}async dispose(){this.state===`active`?await this.unload():await this.forceDispose()}},Xf=class{#e=new Map;#t=new Map;register(e){let t=e.fiber.id;this.#e.set(t,e);let n=e.carrier.hash.toString(),r=this.#t.get(n);r||(r=new Set,this.#t.set(n,r)),r.add(t)}project(e){return e.carrier}fiberOver(e){let t=e.hash.toString(),n=this.#t.get(t);if(!n)return[];let r=[];for(let e of n){let t=this.#e.get(e);t&&r.push(t)}return r}getProcess(e){return this.#e.get(e)}activeProcesses(){return Array.from(this.#e.values()).filter(e=>e.fiber.state===`active`||e.fiber.state===`loading`)}deregister(e){let t=this.#e.get(e);if(!t)return!1;let n=t.carrier.hash.toString(),r=this.#t.get(n);return r&&(r.delete(e),r.size===0&&this.#t.delete(n)),this.#e.delete(e)}get size(){return this.#e.size}};function Zf(e,t){let n=[];return e.project(t)!==t.carrier&&n.push(`Axiom 1 (Projection): fibration.project(P) !== process.carrier`),t.fiber.carrier!==t.carrier&&n.push(`Axiom 1 (Carrier Consistency): process.fiber.carrier !== process.carrier`),t.fiber.state===`disposed`&&t.fiber.disposables.length>0&&n.push(`Axiom 2 (Zero Residual State): Disposed fiber has ${t.fiber.disposables.length} undisposed resources.`),(!t.carrier.hash||t.carrier.hash.toString().length===0)&&n.push(`Axiom 3 (CAS Invariance): Carrier MCard missing valid cryptographic content hash.`),{valid:n.length===0,errors:n}}function Qf(e){if(!e||typeof e!=`string`)return{isToolCall:!1,format:`none`};let t=e.trim(),n=t.match(/<execute\s+pcard=(["'])(.*?)\1(?:\s+input=(["'])([\s\S]*?)\3)?(?:\s+label=(["'])(.*?)\5)?\s*\/>/i);if(n&&n.index!==void 0){let e=n[2]||``,r=n[4]||``,i={};if(r)try{i=JSON.parse(r)}catch{i={raw:r}}let a=n[6];return{isToolCall:!0,format:`satori_execute`,preamble:t.slice(0,n.index).trim()||void 0,action:e,actionInput:i,prompt:i.prompt||i.query||i.raw,size:i.size,thought:a,toSatoriElement:()=>Mt(e,typeof r==`string`?r:JSON.stringify(i),a)}}let r=``,i,a=t.match(/```(?:json)?\s*([\s\S]*?)\s*```/i);if(a){r=(a[1]||``).trim();let e=a.index??0;e>0&&(i=t.slice(0,e).trim()||void 0)}else{let e=t.indexOf(`{`),n=t.lastIndexOf(`}`);e!==-1&&n>e&&(r=t.slice(e,n+1),e>0&&(i=t.slice(0,e).trim()||void 0))}if(r)try{let e=JSON.parse(r);if(e.action&&typeof e.action==`string`){let t=e.action_input;if(typeof t==`string`)try{t=JSON.parse(t)}catch{t={prompt:t}}let n=t?.prompt||t?.query||t?.text||(typeof t==`string`?t:void 0),r=t?.size||`1024x1024`,a=e.thought||e.explanation||void 0;return{isToolCall:!0,format:`react_json`,preamble:i,action:e.action,actionInput:typeof t==`object`?t:{value:t},prompt:n,size:r,thought:a,rawJson:e,toSatoriElement:()=>Mt(e.action,typeof t==`string`?t:JSON.stringify(t),a)}}if(e.name&&(e.arguments||e.parameters)){let t=e.arguments||e.parameters;if(typeof t==`string`)try{t=JSON.parse(t)}catch{t={raw:t}}return{isToolCall:!0,format:`openai_function`,preamble:i,action:e.name,actionInput:t,prompt:t?.prompt||t?.query,size:t?.size,rawJson:e,toSatoriElement:()=>Mt(e.name,t)}}}catch{}return{isToolCall:!1,format:`none`}}var $f={$schema:`http://json-schema.org/draft-07/schema#`,description:`CLM Canonical Polyglot Type Dictionary Single Source of Truth (SSOT)`,invariants:[`INV-444`,`INV-10`],types:{"application/3d-obj":{category:`model`,description:`Wavefront OBJ 3D model geometry.`,extensions:[`.obj`],is_binary:!1,magic_bytes:[],mime:`application/3d-obj`,text_patterns:[],universe:`U0`},"application/geo+json":{category:`text`,description:`Content type for GeoJSON geospatial data.`,extensions:[`.geojson`],is_binary:!1,magic_bytes:[],mime:`application/geo+json`,text_patterns:[`FeatureCollection`,`"type"`,`"geometry"`,`"coordinates"`],universe:`U0`},"application/geopackage+sqlite3":{category:`blob`,description:`Content type for GeoPackage geospatial database files.`,extensions:[`.gpkg`],is_binary:!0,magic_bytes:[{description:`Magic bytes for application/geopackage+sqlite3`,hex:`53514c69746520666f726d6174203300`,offset:0}],mime:`application/geopackage+sqlite3`,text_patterns:[],universe:`U0`},"application/gzip":{category:`archive`,description:`Gzip compressed archive.`,extensions:[`.gz`,`.tgz`],is_binary:!0,magic_bytes:[{description:`Gzip magic header`,hex:`1f8b`,offset:0}],mime:`application/gzip`,text_patterns:[],universe:`U0`},"application/javascript":{category:`code`,description:`Content type for JavaScript source.`,extensions:[`.js`],is_binary:!1,magic_bytes:[],mime:`application/javascript`,text_patterns:[`^'use strict'`,`^import `,`^const `,`^function `,`^export `],universe:`U0`},"application/json":{category:`text`,description:`Content type for JSON data.`,extensions:[`.json`],is_binary:!1,magic_bytes:[],mime:`application/json`,text_patterns:[`^\\s*[{\\[]`],universe:`U0`},"application/octet-stream":{category:`blob`,description:`Content type for arbitrary binary data (fallback).`,extensions:[`.bin`],is_binary:!0,magic_bytes:[],mime:`application/octet-stream`,text_patterns:[],universe:`U0`},"application/pdf":{category:`blob`,description:`Content type for PDF documents.`,extensions:[`.pdf`],is_binary:!0,magic_bytes:[{description:`Magic bytes for application/pdf`,hex:`25504446`,offset:0}],mime:`application/pdf`,text_patterns:[],universe:`U0`},"application/vnd.google-earth.kml+xml":{category:`text`,description:`Content type for KML (Keyhole Markup Language) geospatial data.`,extensions:[`.kml`],is_binary:!1,magic_bytes:[],mime:`application/vnd.google-earth.kml+xml`,text_patterns:[`<kml`,`xmlns.*opengis.net/kml`,`<Placemark>`,`<Document>`],universe:`U0`},"application/vnd.mcard+json":{category:`data`,description:`CLM MCard continuation carrier format.`,extensions:[`.mcard`],is_binary:!1,magic_bytes:[],mime:`application/vnd.mcard+json`,text_patterns:[`"mcard_version"`],universe:`U1`},"application/vnd.pcard+json":{category:`data`,description:`CLM PCard packet specification format.`,extensions:[`.pcard`],is_binary:!1,magic_bytes:[],mime:`application/vnd.pcard+json`,text_patterns:[`"pcard_version"`],universe:`U1`},"application/vnd.vcard+json":{category:`data`,description:`CLM VCard verification certificate format.`,extensions:[`.vcard`],is_binary:!1,magic_bytes:[],mime:`application/vnd.vcard+json`,text_patterns:[`"vcard_version"`],universe:`U1`},"application/wasm":{category:`code`,description:`WebAssembly binary format.`,extensions:[`.wasm`],is_binary:!0,magic_bytes:[{description:`WASM magic header`,hex:`0061736d`,offset:0}],mime:`application/wasm`,text_patterns:[],universe:`U0`},"application/x-shapefile":{category:`blob`,description:`Content type for Esri Shapefile geospatial data.`,extensions:[`.shp`],is_binary:!0,magic_bytes:[{description:`Magic bytes for application/x-shapefile`,hex:`0000270a`,offset:0}],mime:`application/x-shapefile`,text_patterns:[],universe:`U0`},"application/x-sqlite3":{category:`blob`,description:`Content type for SQLite database files.`,extensions:[`.db`],is_binary:!0,magic_bytes:[{description:`Magic bytes for application/x-sqlite3`,hex:`53514c69746520666f726d6174203300`,offset:0}],mime:`application/x-sqlite3`,text_patterns:[],universe:`U0`},"application/x-tar":{category:`archive`,description:`POSIX tar archive.`,extensions:[`.tar`],is_binary:!0,magic_bytes:[{description:`USTAR magic`,hex:`7573746172`,offset:257}],mime:`application/x-tar`,text_patterns:[],universe:`U0`},"application/x-yaml":{category:`text`,description:`YAML Ain't Markup Language data serialization.`,extensions:[`.yaml`,`.yml`],is_binary:!1,magic_bytes:[],mime:`application/x-yaml`,text_patterns:[`^---\\s*\\n`],universe:`U0`},"application/xml":{category:`text`,description:`Extensible Markup Language data.`,extensions:[`.xml`],is_binary:!1,magic_bytes:[],mime:`application/xml`,text_patterns:[`^<\\?xml`],universe:`U0`},"application/yaml":{category:`text`,description:`Content type for YAML documents.`,extensions:[`.yaml`],is_binary:!1,magic_bytes:[],mime:`application/yaml`,text_patterns:[`^---`,`^\\w+:`],universe:`U0`},"application/zip":{category:`blob`,description:`Content type for ZIP archives.`,extensions:[`.zip`],is_binary:!0,magic_bytes:[{description:`Magic bytes for application/zip`,hex:`504b0304`,offset:0}],mime:`application/zip`,text_patterns:[],universe:`U0`},"audio/mpeg":{category:`media`,description:`MPEG Audio Layer III stream.`,extensions:[`.mp3`],is_binary:!0,magic_bytes:[{description:`ID3v2 container`,hex:`494433`,offset:0},{description:`MPEG ADTS sync`,hex:`fffb`,offset:0}],mime:`audio/mpeg`,text_patterns:[],universe:`U0`},"font/woff2":{category:`media`,description:`Web Open Font Format 2.0.`,extensions:[`.woff2`],is_binary:!0,magic_bytes:[{description:`wOF2 header`,hex:`774f4632`,offset:0}],mime:`font/woff2`,text_patterns:[],universe:`U0`},"image/gif":{category:`media`,description:`Content type for GIF images.`,extensions:[`.gif`],is_binary:!0,magic_bytes:[{description:`Magic bytes for image/gif`,hex:`47494638`,offset:0}],mime:`image/gif`,text_patterns:[],universe:`U0`},"image/jpeg":{category:`media`,description:`Content type for JPEG images.`,extensions:[`.jpg`],is_binary:!0,magic_bytes:[{description:`Magic bytes for image/jpeg`,hex:`ffd8ff`,offset:0}],mime:`image/jpeg`,text_patterns:[],universe:`U0`},"image/png":{category:`media`,description:`Content type for Portable Network Graphics images.`,extensions:[`.png`],is_binary:!0,magic_bytes:[{description:`Magic bytes for image/png`,hex:`89504e470d0a1a0a`,offset:0}],mime:`image/png`,text_patterns:[],universe:`U0`},"image/svg+xml":{category:`media`,description:`Content type for SVG vector graphics.`,extensions:[`.svg`],is_binary:!1,magic_bytes:[],mime:`image/svg+xml`,text_patterns:[`<svg`,`xmlns.*svg`],universe:`U0`},"image/vnd.djvu":{category:`blob`,description:`Content type for DjVu document files.`,extensions:[`.djvu`],is_binary:!0,magic_bytes:[{description:`Magic bytes for image/vnd.djvu`,hex:`41542654464f524d`,offset:0}],mime:`image/vnd.djvu`,text_patterns:[],universe:`U0`},"image/vnd.dxf":{category:`blob`,description:`Content type for AutoCAD DXF (Drawing Exchange Format) files.`,extensions:[`.dxf`],is_binary:!1,magic_bytes:[],mime:`image/vnd.dxf`,text_patterns:[`^\\s*0`,`SECTION`,`HEADER`,`ENDSEC`],universe:`U0`},"image/webp":{category:`media`,description:`WebP image format.`,extensions:[`.webp`],is_binary:!0,magic_bytes:[{description:`RIFF container for WebP`,hex:`52494646`,offset:0}],mime:`image/webp`,text_patterns:[],universe:`U0`},"model/gltf+json":{category:`blob`,description:`Content type for glTF (GL Transmission Format) 3D scenes.`,extensions:[`.gltf`],is_binary:!1,magic_bytes:[],mime:`model/gltf+json`,text_patterns:[`"asset"`,`"scene"`,`"nodes"`,`"meshes"`],universe:`U0`},"model/obj":{category:`blob`,description:`Content type for Wavefront OBJ 3D model files.`,extensions:[`.obj`],is_binary:!1,magic_bytes:[],mime:`model/obj`,text_patterns:[`^v `,`^# `,`^f `,`^mtllib `],universe:`U0`},"model/stl":{category:`blob`,description:`Content type for STL (Stereolithography) 3D model files.`,extensions:[`.stl`],is_binary:!0,magic_bytes:[],mime:`model/stl`,text_patterns:[`^solid `],universe:`U0`},"text/css":{category:`text`,description:`Cascading Style Sheets.`,extensions:[`.css`],is_binary:!1,magic_bytes:[],mime:`text/css`,text_patterns:[],universe:`U0`},"text/csv":{category:`data`,description:`Comma-separated values tabular text.`,extensions:[`.csv`],is_binary:!1,magic_bytes:[],mime:`text/csv`,text_patterns:[],universe:`U0`},"text/html":{category:`text`,description:`Content type for HTML documents.`,extensions:[`.html`],is_binary:!1,magic_bytes:[],mime:`text/html`,text_patterns:[`^\\s*<!doctype html`,`^\\s*<html`],universe:`U0`},"text/javascript":{category:`code`,description:`JavaScript programming language source.`,extensions:[`.cjs`,`.js`,`.mjs`],is_binary:!1,magic_bytes:[],mime:`text/javascript`,text_patterns:[`^'use strict'`,`^import `,`^const `,`^function `,`^export `],universe:`U0`},"text/markdown":{category:`text`,description:`Content type for Markdown documents.`,extensions:[`.md`],is_binary:!1,magic_bytes:[],mime:`text/markdown`,text_patterns:[`^#`,`^\\*\\*`,`^- `],universe:`U0`},"text/plain":{category:`text`,description:`Content type for plain text documents.`,extensions:[`.txt`],is_binary:!1,magic_bytes:[],mime:`text/plain`,text_patterns:[],universe:`U0`},"text/x-mermaid":{category:`text`,description:`Mermaid diagram specification.`,extensions:[`.mermaid`,`.mmd`],is_binary:!1,magic_bytes:[],mime:`text/x-mermaid`,text_patterns:[`^\\s*(graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt|pie|gitGraph)`],universe:`U0`},"text/x-python":{category:`code`,description:`Content type for Python scripts.`,extensions:[`.py`],is_binary:!1,magic_bytes:[],mime:`text/x-python`,text_patterns:[`^#!/usr/bin/env python`,`^#!/usr/bin/python`,`^import `,`^from .* import`,`^def `,`^class `],universe:`U0`},"text/x-rust":{category:`code`,description:`Rust systems programming language source.`,extensions:[`.rs`],is_binary:!1,magic_bytes:[],mime:`text/x-rust`,text_patterns:[],universe:`U0`},"text/x-shellscript":{category:`code`,description:`Content type for shell scripts.`,extensions:[`.sh`],is_binary:!1,magic_bytes:[],mime:`text/x-shellscript`,text_patterns:[`^#!/bin/(ba)?sh`,`^#!/usr/bin/env (ba)?sh`],universe:`U0`},"text/x-sql":{category:`code`,description:`Structured Query Language script.`,extensions:[`.sql`],is_binary:!1,magic_bytes:[],mime:`text/x-sql`,text_patterns:[`^\\s*(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)\\b`],universe:`U0`},"text/x-tex":{category:`code`,description:`Content type for LaTeX source files.`,extensions:[`.tex`],is_binary:!1,magic_bytes:[],mime:`text/x-tex`,text_patterns:[`\\\\documentclass`,`\\\\begin\\{document\\}`,`\\\\usepackage`,`\\\\section`,`\\\\title`],universe:`U0`},"text/x-tikz":{category:`code`,description:`Content type for TikZ/PGF diagram source files.`,extensions:[`.tikz`],is_binary:!1,magic_bytes:[],mime:`text/x-tikz`,text_patterns:[`\\\\begin\\{tikzpicture\\}`,`\\\\tikz`,`\\\\draw`,`\\\\node`,`\\\\path`,`\\\\usetikzlibrary`],universe:`U0`},"text/x-typescript":{category:`code`,description:`TypeScript typed programming language source.`,extensions:[`.ts`,`.tsx`],is_binary:!1,magic_bytes:[],mime:`text/x-typescript`,text_patterns:[],universe:`U0`},"text/xml":{category:`text`,description:`Content type for XML documents.`,extensions:[`.xml`],is_binary:!1,magic_bytes:[],mime:`text/xml`,text_patterns:[`^\\s*<\\?xml`,`^\\s*<[a-zA-Z]`],universe:`U0`},"video/mp4":{category:`media`,description:`MPEG-4 Part 14 video container.`,extensions:[`.m4v`,`.mp4`],is_binary:!0,magic_bytes:[{description:`ISO Base Media file type box (ftyp)`,hex:`66747970`,offset:4}],mime:`video/mp4`,text_patterns:[],universe:`U0`}},types_count:48,version:`1.0.0`};function ep(e,t){if(!t.hex)return!1;let n=f(t.hex.replace(/[^0-9a-fA-F]/g,``)),r=t.offset+n.length;if(e.length<r)return!1;let i=t.mask?f(t.mask.replace(/[^0-9a-fA-F]/g,``)):null;for(let r=0;r<n.length;r++){let a=e[t.offset+r];if(i&&r<i.length&&(a&=i[r]),a!==n[r])return!1}return!0}var tp=class e{_types=new Map;_extMap=new Map;_magicSignatures=[];_compiledPatterns=[];constructor(e){if(e)for(let t of e)this.registerType(t)}static createDefault(){let t=new e,n=$f.types||{};for(let[e,r]of Object.entries(n)){let n=(r.magic_bytes||[]).map(e=>({offset:e.offset??0,hex:e.hex??``,mask:e.mask,description:e.description})),i={mime:e,extensions:r.extensions||[],universe:r.universe||`U0`,isBinary:!!r.is_binary,category:r.category||`text`,description:r.description||``,magicBytes:n,textPatterns:r.text_patterns||[]};t.registerType(i)}return t}registerType(e){let t=(e.extensions||[]).map(e=>{let t=e.trim().toLowerCase();return t.startsWith(`.`)?t:`.${t}`}),n={...e,extensions:t,universe:e.universe||`U0`,isBinary:!!e.isBinary,category:e.category||`text`,magicBytes:e.magicBytes||[],textPatterns:e.textPatterns||[],priority:e.priority??0};this._types.set(n.mime,n);for(let e of n.extensions)this._extMap.set(e,n.mime);let r=n.magicBytes??[];for(let e of r)this._magicSignatures.push({sig:e,def:n});this._magicSignatures.sort((e,t)=>{let n=e.sig.hex.length;return t.sig.hex.length-n});let i=n.textPatterns??[];for(let e of i)try{let t=new RegExp(e,`m`);this._compiledPatterns.push({pattern:t,def:n})}catch{}}getType(e){return this._types.get(e)}listTypes(){return Array.from(this._types.values())}get typesCount(){return this._types.size}judge(e){let t;t=typeof e==`string`||e instanceof Uint8Array||Buffer.isBuffer(e)?{data:e}:e||{};let n=this._normalizeBytes(t.data),r=this._resolveExtension(t.filename,t.extHint);for(let e of this._types.values())if(e.priority&&e.priority>0&&e.validator)try{let t=e.isBinary?n:new TextDecoder().decode(n);if(e.validator(t))return{mime:e.mime,universe:e.universe||`U0`,isBinary:!!e.isBinary,confidence:1,matchedRule:`programmatic_predicate_high_priority`,extension:e.extensions[0]||r,category:e.category||`text`,metadata:{priority:e.priority,...e.metadata}}}catch{}if(n.length>0){let e=[];for(let{sig:t,def:r}of this._magicSignatures)ep(n,t)&&e.push({sig:t,def:r});if(e.length>0){let t=e[0];if(r){let n=e.find(e=>e.def.extensions.includes(r));n&&(t=n)}else{let n=e.find(e=>!e.def.mime.includes(`+`));n&&(t=n)}let n=t.def.extensions[0]||r;return{mime:t.def.mime,universe:t.def.universe||`U0`,isBinary:!!t.def.isBinary,confidence:.99,matchedRule:`magic_bytes`,extension:n,category:t.def.category||`binary`,metadata:{signatureHex:t.sig.hex,offset:t.sig.offset}}}}let i=this._isBinaryPayload(n);if(r&&this._extMap.has(r)){let e=this._extMap.get(r),t=this._types.get(e),n=t?.universe||`U0`,a=t?.isBinary??i;return{mime:e,universe:n,isBinary:a,confidence:.95,matchedRule:`extension_hint`,extension:r,category:t?.category||(a?`binary`:`text`)}}if(!i&&n.length>0){let e=new TextDecoder().decode(n).trim(),t=this._probeStructuredText(e);if(t){let{mime:e,rule:n,confidence:i}=t,a=this._types.get(e);return{mime:e,universe:a?.universe||`U0`,isBinary:!1,confidence:i,matchedRule:n,extension:a?.extensions[0]||r,category:a?.category||`text`}}for(let{pattern:t,def:n}of this._compiledPatterns)if(t.test(e))return{mime:n.mime,universe:n.universe||`U0`,isBinary:!1,confidence:.95,matchedRule:`text_pattern`,extension:n.extensions[0]||r,category:n.category||`text`}}for(let e of this._types.values())if((e.priority===0||e.priority===void 0)&&e.validator)try{let t=e.isBinary?n:new TextDecoder().decode(n);if(e.validator(t))return{mime:e.mime,universe:e.universe||`U0`,isBinary:!!e.isBinary,confidence:.92,matchedRule:`programmatic_predicate`,extension:e.extensions[0]||r,category:e.category||`text`,metadata:e.metadata}}catch{}return i?{mime:`application/octet-stream`,universe:`U0`,isBinary:!0,confidence:.5,matchedRule:`binary_fallback`,extension:r||`.bin`,category:`binary`}:{mime:`text/plain`,universe:`U0`,isBinary:!1,confidence:.5,matchedRule:`text_fallback`,extension:r||`.txt`,category:`text`}}detectContentType(e,t){let n=this.judge({data:e,extHint:t}),r=(n.extension||``).replace(/^\./,``);return[n.mime,r]}isBinaryContent(e){let t=this._normalizeBytes(e);return this._isBinaryPayload(t)}_normalizeBytes(e){return e?typeof e==`string`?new TextEncoder().encode(e):Buffer.isBuffer(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:new Uint8Array}_resolveExtension(e,t){let n=t||``;if(!n&&e){let t=e.lastIndexOf(`.`);t!==-1&&(n=e.substring(t))}if(n)return n=n.trim().toLowerCase(),n.startsWith(`.`)?n:`.${n}`}_isBinaryPayload(e){if(e.length===0)return!1;let t=Math.min(e.length,4096);for(let n=0;n<t;n++)if(e[n]===0)return!0;let n=0;for(let r=0;r<t;r++){let t=e[r];(t<9||t>13&&t<32||t>127)&&n++}return n/t>.3}_probeStructuredText(e){if(e.startsWith(`{`)&&e.endsWith(`}`)||e.startsWith(`[`)&&e.endsWith(`]`))try{return JSON.parse(e),e.includes(`"mcard_version"`)?{mime:`application/vnd.mcard+json`,rule:`structured_mcard_probe`,confidence:.99}:e.includes(`"pcard_version"`)?{mime:`application/vnd.pcard+json`,rule:`structured_pcard_probe`,confidence:.99}:e.includes(`"vcard_version"`)?{mime:`application/vnd.vcard+json`,rule:`structured_vcard_probe`,confidence:.99}:{mime:`application/json`,rule:`structured_json_probe`,confidence:.98}}catch{}if(e.startsWith(`<?xml`)||e.slice(0,512).toLowerCase().includes(`<svg`))return e.toLowerCase().includes(`<svg`)?{mime:`image/svg+xml`,rule:`structured_svg_probe`,confidence:.96}:{mime:`application/xml`,rule:`structured_xml_probe`,confidence:.92};let t=e.slice(0,512).toLowerCase();return t.includes(`<!doctype html`)||t.includes(`<html`)?{mime:`text/html`,rule:`structured_html_probe`,confidence:.95}:e.startsWith(`---`)&&e.slice(3).includes(`
|
|
116
|
+
---`)?{mime:`text/markdown`,rule:`markdown_frontmatter_probe`,confidence:.9}:e.includes(`\\documentclass`)||e.includes(`\\begin{tikzpicture}`)||e.includes(`\\begin{document}`)?e.includes(`\\begin{tikzpicture}`)?{mime:`text/x-tikz`,rule:`structured_tikz_probe`,confidence:.95}:{mime:`text/x-tex`,rule:`structured_latex_probe`,confidence:.92}:null}};export{Ee as A,_t as C,xt as D,Ct as E,xe as F,A as I,Se as L,j as M,Pe as N,Re as O,Me as P,pe as R,kt as S,St as T,Xt as _,qf as a,jt as b,Kf as c,tf as d,Fs as f,I as g,Es as h,tp as i,Te as j,Ie as k,jf as l,As as m,Jf as n,Qf as o,Os as p,Xf as r,Zf as s,Yf as t,ef as u,Yt as v,wt as w,At as x,qt as y,y as z};
|