From 688804f5aa741444316bfde7ce21bc0e7670eeb7 Mon Sep 17 00:00:00 2001 From: Kojib Date: Mon, 22 Dec 2025 20:42:06 -0500 Subject: [PATCH 01/10] v30.0.5 --- dist/assets/EternalKlock-CHwy1bt-.js | 1 - dist/assets/EternalKlock-D-hEMVRl.js | 1 + ...k-DJuhZsZB.js => EternalKlock-DTPPu1Hz.js} | 2 +- ...8I-f.js => HomePriceChartCard-CG0g_aGu.js} | 2 +- ...alms-DsvdKMyp.js => KaiRealms-CxldGmng.js} | 4 +- ...hApp-cvlNRmVv.js => KaiVohApp-BMb9vr72.js} | 2 +- ...al-DRgYu3Ad.js => KaiVohModal-Bbtn2GfV.js} | 4 +- ...{PShort-CHrK750U.js => PShort-Bmqr2bV5.js} | 2 +- ...7F0w9ki.js => SealMomentModal-BotOOPRg.js} | 2 +- ...ha3aI1.js => SigilAuthContext-CZfkVeGy.js} | 2 +- ...S4o9t.js => SigilAuthProvider-Crre0ykb.js} | 2 +- ...-Be22x_Dh.js => SigilExplorer-YG_XvkA-.js} | 2 +- ...-CYooRvDo.js => SigilFeedPage-DGJJwxYi.js} | 2 +- ...dal-Dtnhs3XF.js => SigilModal-B4XBfcke.js} | 2 +- dist/assets/SigilModal-BvJNBKka.js | 1 + dist/assets/SigilModal-Bw4sFNR6.js | 1 - ...Page-ECNAzu9S.js => SigilPage-DF86EQ7y.js} | 6 +- dist/assets/SigilStreamRoot-BUh8LwJG.js | 1 + dist/assets/SigilStreamRoot-CHI2vpVS.js | 1 - ...WOSVrBM.js => SigilStreamRoot-D0R_paBX.js} | 2 +- ...-CwEJNPi9.js => VerifierFrame-Dr7oGdbu.js} | 2 +- ...age-Qyj4E4nU.js => VerifyPage-B34sC8R1.js} | 2 +- .../__vite-browser-external-BPnTbBa4.js | 1 - .../__vite-browser-external-CUSLmM9D.js | 1 + ...undler-DKFgLeD8.js => bundler-H_464dRi.js} | 2 +- dist/assets/html2canvas-2MVuntwP.js | 1 + ...as-wYdasO3I.js => html2canvas-CgVfYVZf.js} | 2 +- dist/assets/html2canvas-Dw4vJfGn.js | 1 - .../{index-BGzUQCv_.js => index-CcPm2yTY.js} | 8 +- dist/assets/jszip.min-BlBKh1bQ.js | 1 + dist/assets/jszip.min-DiUCJUtt.js | 1 - ...pes-CQvzhoSE.js => prop-types-CQ3MXKCa.js} | 2 +- ...-DVCHqg2o.js => sigilRegistry-NyXrDYsE.js} | 2 +- ...ilUrl-Bbrnoz50.js => sigilUrl-w0EYDFh2.js} | 2 +- ...ils-CQzAWmTd.js => sigilUtils-BWqerTXt.js} | 2 +- ...vgMeta-Drisw1CT.js => svgMeta-ADMUtfmL.js} | 2 +- ...vgMeta-B547igV7.js => svgMeta-BqZogknt.js} | 2 +- ...s-Cbh2am8D.js => useFastPress-BuTJ0eyZ.js} | 2 +- ...N.js => usernameClaimRegistry-_VlzEwdK.js} | 2 +- dist/assets/{x-B04jFFwi.js => x-B0A9hqeh.js} | 2 +- dist/index.html | 2 +- dist/sw.js | 2 +- node_modules/@types/babel__core/README.md | 30 +- .../@types/babel__generator/README.md | 30 +- node_modules/@types/babel__template/README.md | 30 +- node_modules/@types/babel__traverse/README.md | 30 +- node_modules/@types/estree/README.md | 30 +- node_modules/@types/history/README.md | 32 +- node_modules/@types/json-schema/README.md | 30 +- node_modules/@types/node/README.md | 30 +- node_modules/@types/pako/README.md | 30 +- .../@types/qrcode-generator/README.md | 32 +- node_modules/@types/qrcode/README.md | 30 +- node_modules/@types/react-dom/README.md | 32 +- .../@types/react-router-dom/README.md | 32 +- node_modules/@types/react-router/README.md | 32 +- node_modules/@types/react/README.md | 30 +- node_modules/color-name/LICENSE | 14 +- node_modules/color-name/README.md | 22 +- node_modules/color-name/index.js | 304 +- node_modules/color-name/package.json | 56 +- node_modules/decimal.js/LICENCE.md | 46 +- node_modules/decimal.js/README.md | 492 +- node_modules/decimal.js/decimal.d.ts | 602 +- node_modules/decimal.js/decimal.js | 9902 ++++++++--------- node_modules/decimal.js/decimal.mjs | 9828 ++++++++-------- node_modules/decimal.js/package.json | 110 +- .../eslint-plugin-react-hooks.development.js | 356 +- .../eslint-plugin-react-hooks.production.js | 356 +- node_modules/hash-wasm/dist/index.esm.js | 60 +- node_modules/hash-wasm/dist/index.umd.js | 60 +- node_modules/hash-wasm/src/blake2b.c | 596 +- .../qrcode/lib/core/error-correction-code.js | 270 +- node_modules/typescript/LICENSE.txt | 110 +- node_modules/typescript/README.md | 100 +- .../typescript/ThirdPartyNoticeText.txt | 386 +- public/sw.js | 2 +- src/version.ts | 2 +- 78 files changed, 12110 insertions(+), 12110 deletions(-) delete mode 100644 dist/assets/EternalKlock-CHwy1bt-.js create mode 100644 dist/assets/EternalKlock-D-hEMVRl.js rename dist/assets/{EternalKlock-DJuhZsZB.js => EternalKlock-DTPPu1Hz.js} (99%) rename dist/assets/{HomePriceChartCard-CMBb8I-f.js => HomePriceChartCard-CG0g_aGu.js} (99%) rename dist/assets/{KaiRealms-DsvdKMyp.js => KaiRealms-CxldGmng.js} (99%) rename dist/assets/{KaiVohApp-cvlNRmVv.js => KaiVohApp-BMb9vr72.js} (99%) rename dist/assets/{KaiVohModal-DRgYu3Ad.js => KaiVohModal-Bbtn2GfV.js} (91%) rename dist/assets/{PShort-CHrK750U.js => PShort-Bmqr2bV5.js} (94%) rename dist/assets/{SealMomentModal-S7F0w9ki.js => SealMomentModal-BotOOPRg.js} (99%) rename dist/assets/{SigilAuthContext-Bpha3aI1.js => SigilAuthContext-CZfkVeGy.js} (73%) rename dist/assets/{SigilAuthProvider-Bf4S4o9t.js => SigilAuthProvider-Crre0ykb.js} (91%) rename dist/assets/{SigilExplorer-Be22x_Dh.js => SigilExplorer-YG_XvkA-.js} (99%) rename dist/assets/{SigilFeedPage-CYooRvDo.js => SigilFeedPage-DGJJwxYi.js} (93%) rename dist/assets/{SigilModal-Dtnhs3XF.js => SigilModal-B4XBfcke.js} (99%) create mode 100644 dist/assets/SigilModal-BvJNBKka.js delete mode 100644 dist/assets/SigilModal-Bw4sFNR6.js rename dist/assets/{SigilPage-ECNAzu9S.js => SigilPage-DF86EQ7y.js} (99%) create mode 100644 dist/assets/SigilStreamRoot-BUh8LwJG.js delete mode 100644 dist/assets/SigilStreamRoot-CHI2vpVS.js rename dist/assets/{SigilStreamRoot-lWOSVrBM.js => SigilStreamRoot-D0R_paBX.js} (99%) rename dist/assets/{VerifierFrame-CwEJNPi9.js => VerifierFrame-Dr7oGdbu.js} (99%) rename dist/assets/{VerifyPage-Qyj4E4nU.js => VerifyPage-B34sC8R1.js} (97%) delete mode 100644 dist/assets/__vite-browser-external-BPnTbBa4.js create mode 100644 dist/assets/__vite-browser-external-CUSLmM9D.js rename dist/assets/{bundler-DKFgLeD8.js => bundler-H_464dRi.js} (99%) create mode 100644 dist/assets/html2canvas-2MVuntwP.js rename dist/assets/{html2canvas-wYdasO3I.js => html2canvas-CgVfYVZf.js} (99%) delete mode 100644 dist/assets/html2canvas-Dw4vJfGn.js rename dist/assets/{index-BGzUQCv_.js => index-CcPm2yTY.js} (99%) create mode 100644 dist/assets/jszip.min-BlBKh1bQ.js delete mode 100644 dist/assets/jszip.min-DiUCJUtt.js rename dist/assets/{prop-types-CQvzhoSE.js => prop-types-CQ3MXKCa.js} (92%) rename dist/assets/{sigilRegistry-DVCHqg2o.js => sigilRegistry-NyXrDYsE.js} (99%) rename dist/assets/{sigilUrl-Bbrnoz50.js => sigilUrl-w0EYDFh2.js} (75%) rename dist/assets/{sigilUtils-CQzAWmTd.js => sigilUtils-BWqerTXt.js} (89%) rename dist/assets/{svgMeta-Drisw1CT.js => svgMeta-ADMUtfmL.js} (79%) rename dist/assets/{svgMeta-B547igV7.js => svgMeta-BqZogknt.js} (98%) rename dist/assets/{useFastPress-Cbh2am8D.js => useFastPress-BuTJ0eyZ.js} (80%) rename dist/assets/{usernameClaimRegistry-BEUaCJlN.js => usernameClaimRegistry-_VlzEwdK.js} (98%) rename dist/assets/{x-B04jFFwi.js => x-B0A9hqeh.js} (55%) diff --git a/dist/assets/EternalKlock-CHwy1bt-.js b/dist/assets/EternalKlock-CHwy1bt-.js deleted file mode 100644 index 999bb288..00000000 --- a/dist/assets/EternalKlock-CHwy1bt-.js +++ /dev/null @@ -1 +0,0 @@ -import"./html2canvas-wYdasO3I.js";import{n as e,t}from"./EternalKlock-DJuhZsZB.js";import"./SigilModal-Dtnhs3XF.js";import"./SealMomentModal-S7F0w9ki.js";export{t as EternalKlock,e as default}; \ No newline at end of file diff --git a/dist/assets/EternalKlock-D-hEMVRl.js b/dist/assets/EternalKlock-D-hEMVRl.js new file mode 100644 index 00000000..4fe9e917 --- /dev/null +++ b/dist/assets/EternalKlock-D-hEMVRl.js @@ -0,0 +1 @@ +import"./html2canvas-CgVfYVZf.js";import{n as e,t}from"./EternalKlock-DTPPu1Hz.js";import"./SigilModal-B4XBfcke.js";import"./SealMomentModal-BotOOPRg.js";export{t as EternalKlock,e as default}; \ No newline at end of file diff --git a/dist/assets/EternalKlock-DJuhZsZB.js b/dist/assets/EternalKlock-DTPPu1Hz.js similarity index 99% rename from dist/assets/EternalKlock-DJuhZsZB.js rename to dist/assets/EternalKlock-DTPPu1Hz.js index 442ad5c2..ac93a071 100644 --- a/dist/assets/EternalKlock-DJuhZsZB.js +++ b/dist/assets/EternalKlock-DTPPu1Hz.js @@ -1,4 +1,4 @@ -import{C as e,Dn as t,On as n,Tn as r,_ as i,a,an as o,c as s,g as c,h as l,i as u,jn as d,kn as f,l as p,ln as m,mn as h,o as g,p as _,pn as v,tn as y,u as b,v as x,w as S,wn as C,x as w,y as T}from"./index-BGzUQCv_.js";import{t as E}from"./SigilModal-Dtnhs3XF.js";const D=17491.270421,O=[`Ignition Ark`,`Integration Ark`,`Harmonization Ark`,`Reflektion Ark`,`Purifikation Ark`,`Dream Ark`],k={"Ignition Ark":`#ff1559`,"Integration Ark":`#ff6d00`,"Harmonization Ark":`#ffd900`,"Reflektion Ark":`#00ff66`,"Purifikation Ark":`#05e6ff`,"Dream Ark":`#c300ff`},A={"Ignition Ark":`Ignite`,"Integration Ark":`Integrate`,"Harmonization Ark":`Harmony`,"Reflektion Ark":`Reflekt`,"Purifikation Ark":`Purify`,"Dream Ark":`Dream`},j=D/36,ee=j/44,te=3+Math.sqrt(5);Math.round(te*1e3),1/te;var M=d(r(),1),N=d(y(),1),P=120,F=P/2,I=22,L=4.5,ne=2,R=F-.5,re=F-ne,z=36,B=-3,V=3,ie=re-2,ae=(I+L+R)/2-4,oe=e=>e*Math.PI/180,se=e=>e.toLowerCase().replace(/\s+/g,`-`);function ce(e,t,n){let r=parseInt(e.slice(1),16),i=parseInt(t.slice(1),16),a=r>>16,o=r>>8&255,s=r&255,c=i>>16,l=i>>8&255,u=i&255;return`rgb(${Math.round(a+(c-a)*n)},${Math.round(o+(l-o)*n)},${Math.round(s+(u-s)*n)})`}var le=(e,t,n)=>Math.max(t,Math.min(n,e)),H=e=>{if(!e)return;let t=e.match(/(\d{2})$/);if(!t)return;let n=parseInt(t[1],10);if(Number.isFinite(n))return le(n,0,43)},U=({hue:e,pulse:t,kaiPulseEternal:n,harmonicDayPercent:r,microCyclePercent:i,dayLabel:a,monthLabel:o,monthDay:s,glowPulse:c=!0,pulseIntervalSec:l=te,rimFlash:u=!1,rotationOverride:d,solarSpiralStepString:f,solarSpiralStep:p,eternalBeatIndex:m,eternalStepIndex:h})=>{(0,M.useEffect)(()=>{typeof document<`u`&&document.documentElement.style.setProperty(`--cycle`,`${l}s`)},[l]);let g=`${l}s`,_=(n%D+D)%D,v=Number.isFinite(t)?t:_,y=v/D,b=Number.isFinite(r)?r:y*100,x=(v-Math.floor(v/j)*j)%ee/ee,S=Number.isFinite(i)?i:x*100,C=(v%D+D)%D,w=C/D,T=Math.floor(w*36)%36,E=(T+.5)/36*360,ne=typeof d==`number`?d:E,U=360/O.length,W=Math.floor(ne/U)%O.length,ue=(W+1)%O.length,de=(ne-W*U+360)%360,fe=Math.min(1,de/U),pe=k[O[W]],me=k[O[ue]],he=ce(pe,me,fe),ge=2*Math.PI*re,_e=ge*(1-b/100),ve=-(S/100)*l,ye=v,be=[`Aethon`,`Virelai`,`Solari`,`Amarin`,`Kaelus`,`Umbriel`,`Noctura`,`Liora`].indexOf(o)+1,xe=be>0?be:1,Se=F-14,Ce=F,we=F+14,Te=F+28,Ee=Math.floor(_/j)%36,De=Number.isFinite(m)?le(m,0,35):Ee,Oe=_-De*j,ke=Oe/j,Ae=Math.floor(Oe/ee)%44,je=Number.isFinite(h)?le(h,0,43):Ae,Me=je.toString().padStart(2,`0`),Ne=(De+.5)/36*360,Pe=`hsl(${T/36*360}, 100%, 50%)`,Fe=`#ebfdff`,Ie=1.6,Le=R-(I+L)+.5,Re=F-(I+L),ze=Le*ke,Be=Re-ze,Ve=.82,He=F-(I+L)-Le*Ve,Ue=F,We=He+6,Ge=(0,M.useId)().replace(/[^a-zA-Z0-9_-]/g,``)||`klock`,Ke=Me,qe=De.toString().padStart(2,`0`),Je=Math.floor(_),Ye=Oe-je*ee,Xe=Math.max(0,Math.min(1,Ye/ee))*100,Ze=`#00faff`,Qe=`#ff6d00`,$e=((C-T*j)%j+j)%j,et=Math.floor($e/ee)%44,tt=Number.isFinite(p?.stepIndex)?le(p.stepIndex,0,43):void 0,nt=H(f),rt=(tt??nt??et).toString().padStart(2,`0`),it=F-(I+L)-Le*Ve,at=F;return(0,N.jsx)(`div`,{className:`kai-klock-shell`,style:{"--hue":e,"--arc":pe,"--cycle":g,width:`100%`,aspectRatio:`1 / 1`,overflow:`hidden`},children:(0,N.jsxs)(`svg`,{className:`kai-svg`,viewBox:`0 0 ${P} ${P}`,width:`100%`,height:`100%`,preserveAspectRatio:`xMidYMid meet`,role:`img`,children:[(0,N.jsx)(`circle`,{cx:F,cy:F,r:R,className:`rim-ring ${u?`rim-flash`:``}`}),(0,N.jsx)(`circle`,{cx:F,cy:F,r:re,className:`day-progress`,strokeDasharray:ge,strokeDashoffset:_e}),Array.from({length:36}).map((e,t)=>{let n=oe(t*(360/z)-90),r=(t+B+z)%z/z;return(0,N.jsx)(`text`,{x:F+ie*Math.cos(n),y:F+ie*Math.sin(n)+V/2,className:`beat-number`,textAnchor:`middle`,fontSize:V,style:{fill:`hsl(${r*360},100%,50%)`},children:t},t)}),(0,N.jsx)(`circle`,{cx:F,cy:F,r:I+L,className:`inner-halo`}),(0,N.jsx)(`g`,{className:`orb-spin`,style:{animationDelay:`${ve}s`},children:(0,N.jsx)(`circle`,{cx:F,cy:F-(I+L),r:3.6,className:`micro-orb orb-glow`})}),(0,N.jsxs)(`g`,{style:{transform:`rotate(${ne}deg)`,transformOrigin:`${F}px ${F}px`,transition:`transform 1s ease-out`},children:[(0,N.jsx)(`rect`,{x:F-1,y:F-(I+L)-(R-(I+L)),width:2,height:R-(I+L),rx:1,className:`needle`,style:{fill:he}}),(0,N.jsxs)(`g`,{className:`solar-hand-label-wrap`,style:{transform:`rotate(${-ne}deg)`,transformOrigin:`${at}px ${it}px`},children:[(0,N.jsx)(`text`,{x:at,y:it-3.6,textAnchor:`middle`,dominantBaseline:`central`,fontSize:3,fontWeight:900,style:{fill:Qe,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.65)`,strokeWidth:.8,filter:`drop-shadow(0 0 2px ${Qe})`},children:`☀`}),(0,N.jsx)(`text`,{x:at-2.2,y:it,textAnchor:`middle`,dominantBaseline:`central`,className:`solar-hand-label-digit`,fontSize:4.4,fontWeight:900,style:{fill:Qe,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.65)`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px ${Qe}) drop-shadow(0 0 5px ${Qe})`},children:rt[0]}),(0,N.jsx)(`text`,{x:at+2.2,y:it,textAnchor:`middle`,dominantBaseline:`central`,className:`solar-hand-label-digit`,fontSize:4.4,fontWeight:900,style:{fill:Qe,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.65)`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px ${Qe}) drop-shadow(0 0 5px ${Qe})`},children:rt[1]})]})]}),(0,N.jsxs)(`g`,{className:`eternal-hand-group`,style:{transform:`rotate(${Ne}deg)`,transformOrigin:`${F}px ${F}px`,transition:`transform 0.6s cubic-bezier(.22,.61,.36,1)`},children:[(0,N.jsx)(`rect`,{x:F-Ie/2,y:F-(I+L)-Le,width:Ie,height:Le,rx:Ie/1.5,className:`eternal-hand`,style:{fill:`transparent`,stroke:`#bff7ff`,strokeWidth:.7,filter:`drop-shadow(0 0 2px #eaffff) drop-shadow(0 0 6px #d9fbff)`,mixBlendMode:`screen`}}),(0,N.jsx)(`defs`,{children:(0,N.jsxs)(`linearGradient`,{id:`eternalFill-${Ge}`,x1:`0`,y1:`1`,x2:`0`,y2:`0`,children:[(0,N.jsx)(`stop`,{offset:`0%`,stopColor:Fe,stopOpacity:.15}),(0,N.jsx)(`stop`,{offset:`100%`,stopColor:Fe,stopOpacity:.95})]})}),(0,N.jsx)(`rect`,{x:F-Ie/2,y:Be,width:Ie,height:Math.max(0,ze),rx:Ie/2,className:`eternal-hand-fill`,style:{fill:`url(#eternalFill-${Ge})`,filter:`drop-shadow(0 0 3px #eaffff) drop-shadow(0 0 6px #eaffff)`,mixBlendMode:`screen`}}),(0,N.jsx)(`circle`,{cx:F,cy:F-(I+L)-Le-.8,r:1.35,className:`eternal-hand-tip`,style:{fill:`#ffffff`,filter:`drop-shadow(0 0 4px #eaffff) drop-shadow(0 0 8px #eaffff)`,mixBlendMode:`screen`}}),(0,N.jsxs)(`g`,{className:`eternal-hand-label-wrap`,style:{transform:`rotate(${-Ne}deg)`,transformOrigin:`${Ue}px ${He}px`},children:[(0,N.jsx)(`text`,{x:Ue-2.2,y:He,textAnchor:`middle`,dominantBaseline:`central`,className:`eternal-hand-label-digit`,fontSize:4.4,fontWeight:900,style:{fill:`#e8feff`,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.45)`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px #eaffff) drop-shadow(0 0 5px #c8fbff)`},children:Me[0]}),(0,N.jsx)(`text`,{x:Ue+2.2,y:He,textAnchor:`middle`,dominantBaseline:`central`,className:`eternal-hand-label-digit`,fontSize:4.4,fontWeight:900,style:{fill:`#e8feff`,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.45)`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px #eaffff) drop-shadow(0 0 5px #c8fbff)`},children:Me[1]})]}),(0,N.jsx)(`g`,{transform:`rotate(${-Ne} ${Ue} ${We})`,children:(0,N.jsx)(`text`,{x:Ue,y:We,textAnchor:`middle`,dominantBaseline:`central`,className:`eternal-hand-percent`,fontSize:3.2,fontWeight:800,style:{fill:`#dafeff`,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.4)`,strokeWidth:.7,letterSpacing:`0.25px`,filter:`drop-shadow(0 0 2px #eaffff)`}})})]}),(0,N.jsx)(`text`,{x:F,y:F-15,className:`center-sub`,textAnchor:`middle`,fontSize:6,fontWeight:800,style:{fill:Ze,paintOrder:`stroke`,stroke:`#000`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px ${Ze}) drop-shadow(0 0 6px ${Ze})`},children:Je}),(0,N.jsxs)(`text`,{x:F,y:F-3,className:`center-pulse ${c?`pulse-flash`:``}`,textAnchor:`middle`,children:[qe,`:`,Ke]},`et-${ye}`),(0,N.jsx)(`text`,{x:F,y:F+8,className:`center-day day-${se(a)}`,textAnchor:`middle`,children:a}),(0,N.jsx)(`text`,{x:F,y:F+18,className:`center-month month-${se(o)}`,textAnchor:`middle`,children:o}),(0,N.jsx)(`text`,{x:F,y:Te+8,className:`eternal-pulse`,textAnchor:`middle`,children:n}),(0,N.jsx)(`text`,{x:Se,y:Te,className:`step-percent`,textAnchor:`middle`,fontSize:5.5,fill:Pe,fontWeight:800,style:{filter:`drop-shadow(0 0 2px ${Pe}) drop-shadow(0 0 5px #00faff)`,letterSpacing:`0.25px`},children:`${Xe.toFixed(1)}%`}),(0,N.jsx)(`text`,{x:Ce,y:Te,className:`day-of-month day-${se(a)}`,textAnchor:`middle`,children:s}),(0,N.jsx)(`text`,{x:we,y:Te,className:`day-of-month month-${se(o)}`,textAnchor:`middle`,children:xe}),O.map((e,t)=>{let n=oe(t*(360/O.length)-90),r=F+ae*Math.cos(n),i=F+ae*Math.sin(n)+(t===3?7:3);return(0,N.jsxs)(M.Fragment,{children:[(0,N.jsx)(`text`,{x:r,y:i,className:`arc-label arc-${se(e.split(` `)[0])} ${t===W?`active`:``}`,textAnchor:`middle`,children:A[e]}),e===`Ignition Ark`&&f&&(0,N.jsx)(`text`,{x:r,y:i+8,textAnchor:`middle`,dominantBaseline:`hanging`,fontSize:10,fill:`#00faff`,fontWeight:900,style:{filter:`drop-shadow(0 0 2px #00faff) drop-shadow(0 0 4px #00faff) drop-shadow(0 0 8px #00faff)`,paintOrder:`stroke`,stroke:`#000`,strokeWidth:1,vectorEffect:`non-scaling-stroke`,letterSpacing:`0.5px`},children:f})]},e)})]})})},W=Date.UTC(2024,4,10,6,45,41,888),ue=3+Math.sqrt(5),de=ue*1e3,fe=1000000n,pe=17491270421n,me=11000000n,he=(pe+18n)/36n,ge=[`Solhara`,`Aquaris`,`Flamora`,`Verdari`,`Sonari`,`Kaelith`],_e={Solhara:`Root`,Aquaris:`Sacral`,Flamora:`Solar Plexus`,Verdari:`Heart`,Sonari:`Throat`,Kaelith:`Crown`},ve=(e,t)=>(e%t+t)%t;function ye(e,t){let n=e/t,r=e%t;return r!==0n&&r>0n!=t>0n?n-1n:n}function be(e){if(!Number.isFinite(e))return 0n;let t=e<0?-1:1,n=Math.abs(e),r=Math.trunc(n),i=n-r;return i<.5?BigInt(t*r):i>.5?BigInt(t*(r+1)):BigInt(t*(r%2==0?r:r+1))}function xe(e){return be((e.getTime()-W)/1e3/ue*1e6)}function Se(e){let t=xe(e),n=ve(t,pe),r=ye(t,pe),i=Number(ye(n,he)),a=n-BigInt(i)*he,o=a-a/me*me,s=Number(o)/Number(me);return{pulse:Number(ye(t,fe)),beat:i,stepPct:s,chakraDay:_e[ge[Number(ve(r,6n))]]}}var Ce=()=>performance.timeOrigin+performance.now(),we=e=>{let t=e-W;return W+Math.ceil(t/de)*de},Te=()=>{let[e,t]=(0,M.useState)(0),[n,r]=(0,M.useState)(0),[i,a]=(0,M.useState)(0),[o,s]=(0,M.useState)(`Root`),[c,l]=(0,M.useState)(!1),[u]=(0,M.useState)(()=>`btn-${Math.random().toString(36).slice(2)}`),d=c?`sigil-open`:`sigil-closed`,f=(0,M.useRef)(null),p=(0,M.useRef)(null),m=(0,M.useRef)(0),h=(0,M.useCallback)(()=>{let{pulse:e,beat:n,stepPct:i,chakraDay:o}=Se(new Date);t(e),r(n),a(i),s(o)},[]),g=()=>{p.current!==null&&(clearTimeout(p.current),p.current=null)},_=(0,M.useCallback)(()=>{g();let e=Ce();m.current=we(e);let t=()=>{let e=Ce(),n=Math.floor((e-m.current)/de),r=Math.max(0,n)+1;for(let e=0;e(h(),_(),()=>g()),[h,_]),(0,M.useEffect)(()=>{let e=()=>{document.visibilityState===`visible`&&_()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[_]),(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`button`,{className:`sigil-button`,title:`View & save this sigil`,onClick:()=>l(!0),"data-chakra":o,"aria-label":`Open Kairos Sigil`,children:(0,N.jsxs)(`span`,{className:`sigil-thumb`,"aria-hidden":`true`,inert:!0,children:[(0,N.jsx)(S,{ref:f,pulse:e,beat:n,stepPct:i,chakraDay:o,size:40,hashMode:`deterministic`,origin:u,onReady:n=>{n&&typeof n.pulse==`number`&&n.pulse!==e&&t(n.pulse)}},d),(0,N.jsx)(`span`,{className:`sigil-shield`,"aria-hidden":`true`})]})}),c&&(0,N.jsx)(E,{initialPulse:e,onClose:()=>l(!1)})]})},Ee=(0,M.createContext)({});function De(e){let t=(0,M.useRef)(null);return t.current===null&&(t.current=e()),t.current}var Oe=typeof window<`u`,ke=Oe?M.useLayoutEffect:M.useEffect,Ae=(0,M.createContext)(null);function je(e,t){e.indexOf(t)===-1&&e.push(t)}function Me(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var Ne=(e,t,n)=>n>t?t:n/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Ie(e){return typeof e==`object`&&!!e}var Le=e=>/^0[^.\s]+$/u.test(e);function Re(e){let t;return()=>(t===void 0&&(t=e()),t)}var ze=e=>e,Be=(e,t)=>n=>t(e(n)),Ve=(...e)=>e.reduce(Be),He=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},Ue=class{constructor(){this.subscriptions=[]}add(e){return je(this.subscriptions,e),()=>Me(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;ie*1e3,Ge=e=>e/1e3;function Ke(e,t){return t?e*(1e3/t):0}var qe=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Je=1e-7,Ye=12;function Xe(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=qe(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>Je&&++sXe(t,0,1,e,n);return e=>e===0||e===1?e:qe(i(e),t,r)}var Qe=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,$e=e=>t=>1-e(1-t),et=Ze(.33,1.53,.69,.99),tt=$e(et),nt=Qe(tt),rt=e=>(e*=2)<1?.5*tt(e):.5*(2-2**(-10*(e-1))),it=e=>1-Math.sin(Math.acos(e)),at=$e(it),ot=Qe(it),st=Ze(.42,0,1,1),ct=Ze(0,0,.58,1),lt=Ze(.42,0,.58,1),ut=e=>Array.isArray(e)&&typeof e[0]!=`number`,dt=e=>Array.isArray(e)&&typeof e[0]==`number`,ft={linear:ze,easeIn:st,easeInOut:lt,easeOut:ct,circIn:it,circInOut:ot,circOut:at,backIn:tt,backInOut:nt,backOut:et,anticipate:rt},pt=e=>typeof e==`string`,mt=e=>{if(dt(e)){e.length;let[t,n,r,i]=e;return Ze(t,n,r,i)}else if(pt(e))return ft[e],`${e}`,ft[e];return e},ht=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],gt={value:null,addProjectionMetrics:null};function _t(e,t){let n=new Set,r=new Set,i=!1,a=!1,o=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1},c=0;function l(t){o.has(t)&&(u.schedule(t),e()),c++,t(s)}let u={schedule:(e,t=!1,a=!1)=>{let s=a&&i?n:r;return t&&o.add(e),s.has(e)||s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(s=e,i){a=!0;return}i=!0,[n,r]=[r,n],n.forEach(l),t&>.value&>.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var vt=40;function yt(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=ht.reduce((e,n)=>(e[n]=_t(a,t?n:void 0),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=Pe.useManualTiming?i.timestamp:performance.now();n=!1,Pe.useManualTiming||(i.delta=r?1e3/60:Math.max(Math.min(a-i.timestamp,vt),1)),i.timestamp=a,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:ht.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t(St===void 0&&wt.set(K.isProcessing||Pe.useManualTiming?K.timestamp:performance.now()),St),set:e=>{St=e,queueMicrotask(Ct)}},Tt={layout:0,mainThread:0,waapi:0},Et=e=>t=>typeof t==`string`&&t.startsWith(e),Dt=Et(`--`),Ot=Et(`var(--`),kt=e=>Ot(e)?At.test(e.split(`/*`)[0].trim()):!1,At=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,jt={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},Mt={...jt,transform:e=>Ne(0,1,e)},Nt={...jt,default:1},Pt=e=>Math.round(e*1e5)/1e5,Ft=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function It(e){return e==null}var Lt=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Rt=(e,t)=>n=>!!(typeof n==`string`&&Lt.test(n)&&n.startsWith(e)||t&&!It(n)&&Object.prototype.hasOwnProperty.call(n,t)),zt=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(Ft);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},Bt=e=>Ne(0,255,e),Vt={...jt,transform:e=>Math.round(Bt(e))},Ht={test:Rt(`rgb`,`red`),parse:zt(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+Vt.transform(e)+`, `+Vt.transform(t)+`, `+Vt.transform(n)+`, `+Pt(Mt.transform(r))+`)`};function Ut(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var Wt={test:Rt(`#`),parse:Ut,transform:Ht.transform},Gt=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Kt=Gt(`deg`),qt=Gt(`%`),q=Gt(`px`),Jt=Gt(`vh`),Yt=Gt(`vw`),Xt=(()=>({...qt,parse:e=>qt.parse(e)/100,transform:e=>qt.transform(e*100)}))(),Zt={test:Rt(`hsl`,`hue`),parse:zt(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+qt.transform(Pt(t))+`, `+qt.transform(Pt(n))+`, `+Pt(Mt.transform(r))+`)`},J={test:e=>Ht.test(e)||Wt.test(e)||Zt.test(e),parse:e=>Ht.test(e)?Ht.parse(e):Zt.test(e)?Zt.parse(e):Wt.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?Ht.transform(e):Zt.transform(e),getAnimatableNone:e=>{let t=J.parse(e);return t.alpha=0,J.transform(t)}},Qt=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function $t(e){return isNaN(e)&&typeof e==`string`&&(e.match(Ft)?.length||0)+(e.match(Qt)?.length||0)>0}var en=`number`,tn=`color`,nn=`var`,rn=`var(`,an="${}",on=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function sn(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(on,e=>(J.test(e)?(r.color.push(a),i.push(tn),n.push(J.parse(e))):e.startsWith(rn)?(r.var.push(a),i.push(nn),n.push(e)):(r.number.push(a),i.push(en),n.push(parseFloat(e))),++a,an)).split(an),indexes:r,types:i}}function cn(e){return sn(e).values}function ln(e){let{split:t,types:n}=sn(e),r=t.length;return e=>{let i=``;for(let a=0;atypeof e==`number`?0:J.test(e)?J.getAnimatableNone(e):e;function dn(e){let t=cn(e);return ln(e)(t.map(un))}var fn={test:$t,parse:cn,createTransformer:ln,getAnimatableNone:dn};function pn(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function mn({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=pn(s,r,e+1/3),a=pn(s,r,e),o=pn(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function hn(e,t){return n=>n>0?t:e}var Y=(e,t,n)=>e+(t-e)*n,gn=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},_n=[Wt,Ht,Zt],vn=e=>_n.find(t=>t.test(e));function yn(e){let t=vn(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===Zt&&(n=mn(n)),n}var bn=(e,t)=>{let n=yn(e),r=yn(t);if(!n||!r)return hn(e,t);let i={...n};return e=>(i.red=gn(n.red,r.red,e),i.green=gn(n.green,r.green,e),i.blue=gn(n.blue,r.blue,e),i.alpha=Y(n.alpha,r.alpha,e),Ht.transform(i))},xn=new Set([`none`,`hidden`]);function Sn(e,t){return xn.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Cn(e,t){return n=>Y(e,t,n)}function wn(e){return typeof e==`number`?Cn:typeof e==`string`?kt(e)?hn:J.test(e)?bn:On:Array.isArray(e)?Tn:typeof e==`object`?J.test(e)?bn:En:hn}function Tn(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>wn(e)(e,t[n]));return e=>{for(let t=0;t{for(let t in r)n[t]=r[t](e);return n}}function Dn(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i{let n=fn.createTransformer(t),r=sn(e),i=sn(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?xn.has(e)&&!i.values.length||xn.has(t)&&!r.values.length?Sn(e,t):Ve(Tn(Dn(r,i),i.values),n):(`${e}${t}`,hn(e,t))};function kn(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?Y(e,t,n):wn(e)(e,t)}var An=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>G.update(t,e),stop:()=>bt(t),now:()=>K.isProcessing?K.timestamp:wt.now()}},jn=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t=2e4?1/0:t}function Pn(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(Nn(r),Mn);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:Ge(i)}}var Fn=5;function In(e,t,n){let r=Math.max(t-Fn,0);return Ke(n-e(r),t-r)}var X={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Ln=.001;function Rn({duration:e=X.duration,bounce:t=X.bounce,velocity:n=X.velocity,mass:r=X.mass}){let i,a;X.maxDuration;let o=1-t;o=Ne(X.minDamping,X.maxDamping,o),e=Ne(X.minDuration,X.maxDuration,Ge(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=Vn(t,o),c=Math.exp(-i);return Ln-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=Vn(t**2,o);return(-i(t)+Ln>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-Ln+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=Bn(i,a,s);if(e=We(e),isNaN(c))return{stiffness:X.stiffness,damping:X.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var zn=12;function Bn(e,t,n){let r=n;for(let n=1;ne[t]!==void 0)}function Gn(e){let t={velocity:X.velocity,stiffness:X.stiffness,damping:X.damping,mass:X.mass,isResolvedFromDuration:!1,...e};if(!Wn(e,Un)&&Wn(e,Hn))if(e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*Ne(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:X.mass,stiffness:i,damping:a}}else{let n=Rn(e);t={...t,...n,mass:X.mass},t.isResolvedFromDuration=!0}return t}function Kn(e=X.visualDuration,t=X.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=Gn({...n,velocity:-Ge(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=Ge(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?X.restSpeed.granular:X.restSpeed.default,i||=v?X.restDelta.granular:X.restDelta.default;let y;if(h<1){let e=Vn(_,h);y=t=>o-Math.exp(-h*_*t)*((m+h*_*g)/e*Math.sin(e*t)+g*Math.cos(e*t))}else if(h===1)y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e}}let b={calculatedDuration:p&&d||null,next:e=>{let t=y(e);if(p)s.done=e>=d;else{let n=e===0?m:0;h<1&&(n=e===0?We(m):In(y,e,t));let a=Math.abs(n)<=r,c=Math.abs(o-t)<=i;s.done=a&&c}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(Nn(b),Mn),t=jn(t=>b.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return b}Kn.applyToOptions=e=>{let t=Pn(e,100,Kn);return e.ease=t.ease,e.duration=We(t.duration),e.type=`keyframes`,e};function qn({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&ec,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=Kn({keyframes:[f.value,m(f.value)],velocity:In(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function Jn(e,t,n){let r=[],i=n||Pe.mix||kn,a=e.length-1;for(let n=0;nt[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=Jn(t,r,i),c=s.length,l=n=>{if(o&&n1)for(;rl(Ne(e[0],e[a-1],t)):l}function Xn(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=He(0,t,r);e.push(Y(n,1,i))}}function Zn(e){let t=[0];return Xn(t,e.length-1),t}function Qn(e,t){return e.map(e=>e*t)}function $n(e,t){return e.map(()=>t||lt).splice(0,e.length-1)}function er({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=ut(r)?r.map(mt):mt(r),a={done:!1,value:t[0]},o=Yn(Qn(n&&n.length===t.length?n:Zn(t),e),t,{ease:Array.isArray(i)?i:$n(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var tr=e=>e!==null;function nr(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(tr),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var rr={decay:qn,inertia:qn,tween:er,keyframes:er,spring:Kn};function ir(e){typeof e.type==`string`&&(e.type=rr[e.type])}var ar=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},or=e=>e/100,sr=class extends ar{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==wt.now()&&this.tick(wt.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},Tt.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;ir(e);let{type:t=er,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||er;s!==er&&typeof o[0]!=`number`&&(this.mixKeyframes=Ve(or,kn(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=Nn(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=Ne(0,1,n)*o}let b=_?{done:!1,value:l[0]}:y.next(v);i&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==qn&&(b.value=nr(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return Ge(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Ge(e)}get time(){return Ge(this.currentTime)}set time(e){e=We(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(wt.now());let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=Ge(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=An,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(wt.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null,Tt.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function cr(e){for(let t=1;te*180/Math.PI,ur=e=>fr(lr(Math.atan2(e[1],e[0]))),dr={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:ur,rotateZ:ur,skewX:e=>lr(Math.atan(e[1])),skewY:e=>lr(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},fr=e=>(e%=360,e<0&&(e+=360),e),pr=ur,mr=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),hr=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),gr={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:mr,scaleY:hr,scale:e=>(mr(e)+hr(e))/2,rotateX:e=>fr(lr(Math.atan2(e[6],e[5]))),rotateY:e=>fr(lr(Math.atan2(-e[2],e[0]))),rotateZ:pr,rotate:pr,skewX:e=>lr(Math.atan(e[4])),skewY:e=>lr(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function _r(e){return e.includes(`scale`)?1:0}function vr(e,t){if(!e||e===`none`)return _r(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=gr,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=dr,i=t}if(!i)return _r(t);let a=r[t],o=i[1].split(`,`).map(br);return typeof a==`function`?a(o):o[a]}var yr=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return vr(n,t)};function br(e){return parseFloat(e.trim())}var xr=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],Sr=(()=>new Set(xr))(),Cr=e=>e===jt||e===q,wr=new Set([`x`,`y`,`z`]),Tr=xr.filter(e=>!wr.has(e));function Er(e){let t=[];return Tr.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith(`scale`)?1:0))}),t}var Dr={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>vr(t,`x`),y:(e,{transform:t})=>vr(t,`y`)};Dr.translateX=Dr.x,Dr.translateY=Dr.y;var Or=new Set,kr=!1,Ar=!1,jr=!1;function Mr(){if(Ar){let e=Array.from(Or).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=Er(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}Ar=!1,kr=!1,Or.forEach(e=>e.complete(jr)),Or.clear()}function Nr(){Or.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Ar=!0)})}function Pr(){jr=!0,Nr(),Mr(),jr=!1}var Fr=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(Or.add(this),kr||(kr=!0,G.read(Nr),G.resolveKeyframes(Mr))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}cr(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Or.delete(this)}cancel(){this.state===`scheduled`&&(Or.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},Ir=e=>e.startsWith(`--`);function Lr(e,t,n){Ir(t)?e.style.setProperty(t,n):e.style[t]=n}var Rr=Re(()=>window.ScrollTimeline!==void 0),zr={};function Br(e,t){let n=Re(e);return()=>zr[t]??n()}var Vr=Br(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),Hr=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Ur={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:Hr([0,.65,.55,1]),circOut:Hr([.55,0,1,.45]),backIn:Hr([.31,.01,.66,-.59]),backOut:Hr([.33,1.53,.69,.99])};function Wr(e,t){if(e)return typeof e==`function`?Vr()?jn(e,t):`ease-out`:dt(e)?Hr(e):Array.isArray(e)?e.map(e=>Wr(e,t)||Ur.easeOut):Ur[e]}function Gr(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=Wr(s,i);Array.isArray(d)&&(u.easing=d),gt.value&&Tt.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return gt.value&&p.finished.finally(()=>{Tt.waapi--}),p}function Kr(e){return typeof e==`function`&&`applyToOptions`in e}function qr({type:e,...t}){return Kr(e)&&Vr()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var Jr=class extends ar{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=qr(e);this.animation=Gr(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=nr(r,this.options,o,this.speed);this.updateMotionValue?this.updateMotionValue(e):Lr(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return Ge(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Ge(e)}get time(){return Ge(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=We(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&Rr()?(this.animation.timeline=e,ze):t(this)}},Yr={anticipate:rt,backInOut:nt,circInOut:ot};function Xr(e){return e in Yr}function Zr(e){typeof e.ease==`string`&&Xr(e.ease)&&(e.ease=Yr[e.ease])}var Qr=10,$r=class extends Jr{constructor(e){Zr(e),ir(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new sr({...a,autoplay:!1}),s=We(this.finishedTime??this.time);t.setWithVelocity(o.sample(s-Qr).value,o.sample(s).value,Qr),o.stop()}},ei=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(fn.test(e)||e===`0`)&&!e.startsWith(`url(`));function ti(e){let t=e[0];if(e.length===1)return!0;for(let n=0;nObject.hasOwnProperty.call(Element.prototype,`animate`));function oi(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:s,transformTemplate:c}=t.owner.getProps();return ai()&&n&&ii.has(n)&&(n!==`transform`||!c)&&!s&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var si=40,ci=class extends ar{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=wt.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u};this.keyframeResolver=new(l?.KeyframeResolver||Fr)(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=wt.now(),ni(e,i,a,o)||((Pe.instantAnimations||!s)&&l?.(nr(e,n,t)),e[0]=e[e.length-1],ri(n),n.repeat=0);let u={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>si?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},d=!c&&oi(u)?new $r({...u,element:u.motionValue.owner.current}):new sr(u);d.finished.then(()=>this.notifyFinished()).catch(ze),this.pendingTimeline&&=(this.stopTimeline=d.attachTimeline(this.pendingTimeline),void 0),this._animation=d}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Pr()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}},li=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function ui(e){let t=li.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function di(e,t,n=1){`${e}`;let[r,i]=ui(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return Fe(e)?parseFloat(e):e}return kt(i)?di(i,t,n+1):i}function fi(e,t){return e?.[t]??e?.default??e}var pi=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...xr]),mi={test:e=>e===`auto`,parse:e=>e},hi=e=>t=>t.test(e),gi=[jt,q,qt,Kt,Yt,Jt,mi],_i=e=>gi.find(hi(e));function vi(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||Le(e)}var yi=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function bi(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(Ft)||[];if(!r)return e;let i=n.replace(r,``),a=yi.has(t)?1:0;return r!==n&&(a*=100),t+`(`+a+i+`)`}var xi=/\b([a-z-]*)\(.*?\)/gu,Si={...fn,getAnimatableNone:e=>{let t=e.match(xi);return t?t.map(bi).join(` `):e}},Ci={...jt,transform:Math.round},wi={borderWidth:q,borderTopWidth:q,borderRightWidth:q,borderBottomWidth:q,borderLeftWidth:q,borderRadius:q,radius:q,borderTopLeftRadius:q,borderTopRightRadius:q,borderBottomRightRadius:q,borderBottomLeftRadius:q,width:q,maxWidth:q,height:q,maxHeight:q,top:q,right:q,bottom:q,left:q,padding:q,paddingTop:q,paddingRight:q,paddingBottom:q,paddingLeft:q,margin:q,marginTop:q,marginRight:q,marginBottom:q,marginLeft:q,backgroundPositionX:q,backgroundPositionY:q,rotate:Kt,rotateX:Kt,rotateY:Kt,rotateZ:Kt,scale:Nt,scaleX:Nt,scaleY:Nt,scaleZ:Nt,skew:Kt,skewX:Kt,skewY:Kt,distance:q,translateX:q,translateY:q,translateZ:q,x:q,y:q,z:q,perspective:q,transformPerspective:q,opacity:Mt,originX:Xt,originY:Xt,originZ:q,zIndex:Ci,fillOpacity:Mt,strokeOpacity:Mt,numOctaves:Ci},Ti={...wi,color:J,backgroundColor:J,outlineColor:J,fill:J,stroke:J,borderColor:J,borderTopColor:J,borderRightColor:J,borderBottomColor:J,borderLeftColor:J,filter:Si,WebkitFilter:Si},Ei=e=>Ti[e];function Di(e,t){let n=Ei(e);return n!==Si&&(n=fn),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var Oi=new Set([`auto`,`none`,`0`]);function ki(e,t,n){let r=0,i;for(;r{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}};function ji(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}var Mi=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function Ni(e){return Ie(e)&&`offsetHeight`in e}var Pi=30,Fi=e=>!isNaN(parseFloat(e)),Ii={current:void 0},Li=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=wt.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=wt.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Fi(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new Ue);let n=this.events[e].add(t);return e===`change`?()=>{n(),G.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return Ii.current&&Ii.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=wt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Pi)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,Pi);return Ke(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Ri(e,t){return new Li(e,t)}var{schedule:zi,cancel:Bi}=yt(queueMicrotask,!1),Vi={x:!1,y:!1};function Hi(){return Vi.x||Vi.y}function Ui(e){return e===`x`||e===`y`?Vi[e]?null:(Vi[e]=!0,()=>{Vi[e]=!1}):Vi.x||Vi.y?null:(Vi.x=Vi.y=!0,()=>{Vi.x=Vi.y=!1})}function Wi(e,t){let n=ji(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function Gi(e){return!(e.pointerType===`touch`||Hi())}function Ki(e,t,n={}){let[r,i,a]=Wi(e,n),o=e=>{if(!Gi(e))return;let{target:n}=e,r=t(n,e);if(typeof r!=`function`||!n)return;let a=e=>{Gi(e)&&(r(e),n.removeEventListener(`pointerleave`,a))};n.addEventListener(`pointerleave`,a,i)};return r.forEach(e=>{e.addEventListener(`pointerenter`,o,i)}),a}var qi=(e,t)=>t?e===t?!0:qi(e,t.parentElement):!1,Ji=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,Yi=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function Xi(e){return Yi.has(e.tagName)||e.tabIndex!==-1}var Zi=new WeakSet;function Qi(e){return t=>{t.key===`Enter`&&e(t)}}function $i(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var ea=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=Qi(()=>{if(Zi.has(n))return;$i(n,`down`);let e=Qi(()=>{$i(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>$i(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function ta(e){return Ji(e)&&!Hi()}function na(e,t,n={}){let[r,i,a]=Wi(e,n),o=e=>{let r=e.currentTarget;if(!ta(e))return;Zi.add(r);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),Zi.has(r)&&Zi.delete(r),ta(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||qi(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),Ni(e)&&(e.addEventListener(`focus`,e=>ea(e,i)),!Xi(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function ra(e){return Ie(e)&&`ownerSVGElement`in e}function ia(e){return ra(e)&&e.tagName===`svg`}var aa=e=>!!(e&&e.getVelocity),oa=[...gi,J,fn],sa=e=>oa.find(hi(e)),ca=(0,M.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function la(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function ua(...e){return t=>{let n=!1,r=e.map(e=>{let r=la(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t{let{width:e,height:c,top:l,left:u,right:d}=o.current;if(t||!a.current||!e||!c)return;let f=n===`left`?`left: ${u}`:`right: ${d}`;a.current.dataset.motionPopId=i;let p=document.createElement(`style`);s&&(p.nonce=s);let m=r??document.head;return m.appendChild(p),p.sheet&&p.sheet.insertRule(` +import{C as e,Dn as t,On as n,Tn as r,_ as i,a,an as o,c as s,g as c,h as l,i as u,jn as d,kn as f,l as p,ln as m,mn as h,o as g,p as _,pn as v,tn as y,u as b,v as x,w as S,wn as C,x as w,y as T}from"./index-CcPm2yTY.js";import{t as E}from"./SigilModal-B4XBfcke.js";const D=17491.270421,O=[`Ignition Ark`,`Integration Ark`,`Harmonization Ark`,`Reflektion Ark`,`Purifikation Ark`,`Dream Ark`],k={"Ignition Ark":`#ff1559`,"Integration Ark":`#ff6d00`,"Harmonization Ark":`#ffd900`,"Reflektion Ark":`#00ff66`,"Purifikation Ark":`#05e6ff`,"Dream Ark":`#c300ff`},A={"Ignition Ark":`Ignite`,"Integration Ark":`Integrate`,"Harmonization Ark":`Harmony`,"Reflektion Ark":`Reflekt`,"Purifikation Ark":`Purify`,"Dream Ark":`Dream`},j=D/36,ee=j/44,te=3+Math.sqrt(5);Math.round(te*1e3),1/te;var M=d(r(),1),N=d(y(),1),P=120,F=P/2,I=22,L=4.5,ne=2,R=F-.5,re=F-ne,z=36,B=-3,V=3,ie=re-2,ae=(I+L+R)/2-4,oe=e=>e*Math.PI/180,se=e=>e.toLowerCase().replace(/\s+/g,`-`);function ce(e,t,n){let r=parseInt(e.slice(1),16),i=parseInt(t.slice(1),16),a=r>>16,o=r>>8&255,s=r&255,c=i>>16,l=i>>8&255,u=i&255;return`rgb(${Math.round(a+(c-a)*n)},${Math.round(o+(l-o)*n)},${Math.round(s+(u-s)*n)})`}var le=(e,t,n)=>Math.max(t,Math.min(n,e)),H=e=>{if(!e)return;let t=e.match(/(\d{2})$/);if(!t)return;let n=parseInt(t[1],10);if(Number.isFinite(n))return le(n,0,43)},U=({hue:e,pulse:t,kaiPulseEternal:n,harmonicDayPercent:r,microCyclePercent:i,dayLabel:a,monthLabel:o,monthDay:s,glowPulse:c=!0,pulseIntervalSec:l=te,rimFlash:u=!1,rotationOverride:d,solarSpiralStepString:f,solarSpiralStep:p,eternalBeatIndex:m,eternalStepIndex:h})=>{(0,M.useEffect)(()=>{typeof document<`u`&&document.documentElement.style.setProperty(`--cycle`,`${l}s`)},[l]);let g=`${l}s`,_=(n%D+D)%D,v=Number.isFinite(t)?t:_,y=v/D,b=Number.isFinite(r)?r:y*100,x=(v-Math.floor(v/j)*j)%ee/ee,S=Number.isFinite(i)?i:x*100,C=(v%D+D)%D,w=C/D,T=Math.floor(w*36)%36,E=(T+.5)/36*360,ne=typeof d==`number`?d:E,U=360/O.length,W=Math.floor(ne/U)%O.length,ue=(W+1)%O.length,de=(ne-W*U+360)%360,fe=Math.min(1,de/U),pe=k[O[W]],me=k[O[ue]],he=ce(pe,me,fe),ge=2*Math.PI*re,_e=ge*(1-b/100),ve=-(S/100)*l,ye=v,be=[`Aethon`,`Virelai`,`Solari`,`Amarin`,`Kaelus`,`Umbriel`,`Noctura`,`Liora`].indexOf(o)+1,xe=be>0?be:1,Se=F-14,Ce=F,we=F+14,Te=F+28,Ee=Math.floor(_/j)%36,De=Number.isFinite(m)?le(m,0,35):Ee,Oe=_-De*j,ke=Oe/j,Ae=Math.floor(Oe/ee)%44,je=Number.isFinite(h)?le(h,0,43):Ae,Me=je.toString().padStart(2,`0`),Ne=(De+.5)/36*360,Pe=`hsl(${T/36*360}, 100%, 50%)`,Fe=`#ebfdff`,Ie=1.6,Le=R-(I+L)+.5,Re=F-(I+L),ze=Le*ke,Be=Re-ze,Ve=.82,He=F-(I+L)-Le*Ve,Ue=F,We=He+6,Ge=(0,M.useId)().replace(/[^a-zA-Z0-9_-]/g,``)||`klock`,Ke=Me,qe=De.toString().padStart(2,`0`),Je=Math.floor(_),Ye=Oe-je*ee,Xe=Math.max(0,Math.min(1,Ye/ee))*100,Ze=`#00faff`,Qe=`#ff6d00`,$e=((C-T*j)%j+j)%j,et=Math.floor($e/ee)%44,tt=Number.isFinite(p?.stepIndex)?le(p.stepIndex,0,43):void 0,nt=H(f),rt=(tt??nt??et).toString().padStart(2,`0`),it=F-(I+L)-Le*Ve,at=F;return(0,N.jsx)(`div`,{className:`kai-klock-shell`,style:{"--hue":e,"--arc":pe,"--cycle":g,width:`100%`,aspectRatio:`1 / 1`,overflow:`hidden`},children:(0,N.jsxs)(`svg`,{className:`kai-svg`,viewBox:`0 0 ${P} ${P}`,width:`100%`,height:`100%`,preserveAspectRatio:`xMidYMid meet`,role:`img`,children:[(0,N.jsx)(`circle`,{cx:F,cy:F,r:R,className:`rim-ring ${u?`rim-flash`:``}`}),(0,N.jsx)(`circle`,{cx:F,cy:F,r:re,className:`day-progress`,strokeDasharray:ge,strokeDashoffset:_e}),Array.from({length:36}).map((e,t)=>{let n=oe(t*(360/z)-90),r=(t+B+z)%z/z;return(0,N.jsx)(`text`,{x:F+ie*Math.cos(n),y:F+ie*Math.sin(n)+V/2,className:`beat-number`,textAnchor:`middle`,fontSize:V,style:{fill:`hsl(${r*360},100%,50%)`},children:t},t)}),(0,N.jsx)(`circle`,{cx:F,cy:F,r:I+L,className:`inner-halo`}),(0,N.jsx)(`g`,{className:`orb-spin`,style:{animationDelay:`${ve}s`},children:(0,N.jsx)(`circle`,{cx:F,cy:F-(I+L),r:3.6,className:`micro-orb orb-glow`})}),(0,N.jsxs)(`g`,{style:{transform:`rotate(${ne}deg)`,transformOrigin:`${F}px ${F}px`,transition:`transform 1s ease-out`},children:[(0,N.jsx)(`rect`,{x:F-1,y:F-(I+L)-(R-(I+L)),width:2,height:R-(I+L),rx:1,className:`needle`,style:{fill:he}}),(0,N.jsxs)(`g`,{className:`solar-hand-label-wrap`,style:{transform:`rotate(${-ne}deg)`,transformOrigin:`${at}px ${it}px`},children:[(0,N.jsx)(`text`,{x:at,y:it-3.6,textAnchor:`middle`,dominantBaseline:`central`,fontSize:3,fontWeight:900,style:{fill:Qe,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.65)`,strokeWidth:.8,filter:`drop-shadow(0 0 2px ${Qe})`},children:`☀`}),(0,N.jsx)(`text`,{x:at-2.2,y:it,textAnchor:`middle`,dominantBaseline:`central`,className:`solar-hand-label-digit`,fontSize:4.4,fontWeight:900,style:{fill:Qe,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.65)`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px ${Qe}) drop-shadow(0 0 5px ${Qe})`},children:rt[0]}),(0,N.jsx)(`text`,{x:at+2.2,y:it,textAnchor:`middle`,dominantBaseline:`central`,className:`solar-hand-label-digit`,fontSize:4.4,fontWeight:900,style:{fill:Qe,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.65)`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px ${Qe}) drop-shadow(0 0 5px ${Qe})`},children:rt[1]})]})]}),(0,N.jsxs)(`g`,{className:`eternal-hand-group`,style:{transform:`rotate(${Ne}deg)`,transformOrigin:`${F}px ${F}px`,transition:`transform 0.6s cubic-bezier(.22,.61,.36,1)`},children:[(0,N.jsx)(`rect`,{x:F-Ie/2,y:F-(I+L)-Le,width:Ie,height:Le,rx:Ie/1.5,className:`eternal-hand`,style:{fill:`transparent`,stroke:`#bff7ff`,strokeWidth:.7,filter:`drop-shadow(0 0 2px #eaffff) drop-shadow(0 0 6px #d9fbff)`,mixBlendMode:`screen`}}),(0,N.jsx)(`defs`,{children:(0,N.jsxs)(`linearGradient`,{id:`eternalFill-${Ge}`,x1:`0`,y1:`1`,x2:`0`,y2:`0`,children:[(0,N.jsx)(`stop`,{offset:`0%`,stopColor:Fe,stopOpacity:.15}),(0,N.jsx)(`stop`,{offset:`100%`,stopColor:Fe,stopOpacity:.95})]})}),(0,N.jsx)(`rect`,{x:F-Ie/2,y:Be,width:Ie,height:Math.max(0,ze),rx:Ie/2,className:`eternal-hand-fill`,style:{fill:`url(#eternalFill-${Ge})`,filter:`drop-shadow(0 0 3px #eaffff) drop-shadow(0 0 6px #eaffff)`,mixBlendMode:`screen`}}),(0,N.jsx)(`circle`,{cx:F,cy:F-(I+L)-Le-.8,r:1.35,className:`eternal-hand-tip`,style:{fill:`#ffffff`,filter:`drop-shadow(0 0 4px #eaffff) drop-shadow(0 0 8px #eaffff)`,mixBlendMode:`screen`}}),(0,N.jsxs)(`g`,{className:`eternal-hand-label-wrap`,style:{transform:`rotate(${-Ne}deg)`,transformOrigin:`${Ue}px ${He}px`},children:[(0,N.jsx)(`text`,{x:Ue-2.2,y:He,textAnchor:`middle`,dominantBaseline:`central`,className:`eternal-hand-label-digit`,fontSize:4.4,fontWeight:900,style:{fill:`#e8feff`,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.45)`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px #eaffff) drop-shadow(0 0 5px #c8fbff)`},children:Me[0]}),(0,N.jsx)(`text`,{x:Ue+2.2,y:He,textAnchor:`middle`,dominantBaseline:`central`,className:`eternal-hand-label-digit`,fontSize:4.4,fontWeight:900,style:{fill:`#e8feff`,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.45)`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px #eaffff) drop-shadow(0 0 5px #c8fbff)`},children:Me[1]})]}),(0,N.jsx)(`g`,{transform:`rotate(${-Ne} ${Ue} ${We})`,children:(0,N.jsx)(`text`,{x:Ue,y:We,textAnchor:`middle`,dominantBaseline:`central`,className:`eternal-hand-percent`,fontSize:3.2,fontWeight:800,style:{fill:`#dafeff`,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.4)`,strokeWidth:.7,letterSpacing:`0.25px`,filter:`drop-shadow(0 0 2px #eaffff)`}})})]}),(0,N.jsx)(`text`,{x:F,y:F-15,className:`center-sub`,textAnchor:`middle`,fontSize:6,fontWeight:800,style:{fill:Ze,paintOrder:`stroke`,stroke:`#000`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px ${Ze}) drop-shadow(0 0 6px ${Ze})`},children:Je}),(0,N.jsxs)(`text`,{x:F,y:F-3,className:`center-pulse ${c?`pulse-flash`:``}`,textAnchor:`middle`,children:[qe,`:`,Ke]},`et-${ye}`),(0,N.jsx)(`text`,{x:F,y:F+8,className:`center-day day-${se(a)}`,textAnchor:`middle`,children:a}),(0,N.jsx)(`text`,{x:F,y:F+18,className:`center-month month-${se(o)}`,textAnchor:`middle`,children:o}),(0,N.jsx)(`text`,{x:F,y:Te+8,className:`eternal-pulse`,textAnchor:`middle`,children:n}),(0,N.jsx)(`text`,{x:Se,y:Te,className:`step-percent`,textAnchor:`middle`,fontSize:5.5,fill:Pe,fontWeight:800,style:{filter:`drop-shadow(0 0 2px ${Pe}) drop-shadow(0 0 5px #00faff)`,letterSpacing:`0.25px`},children:`${Xe.toFixed(1)}%`}),(0,N.jsx)(`text`,{x:Ce,y:Te,className:`day-of-month day-${se(a)}`,textAnchor:`middle`,children:s}),(0,N.jsx)(`text`,{x:we,y:Te,className:`day-of-month month-${se(o)}`,textAnchor:`middle`,children:xe}),O.map((e,t)=>{let n=oe(t*(360/O.length)-90),r=F+ae*Math.cos(n),i=F+ae*Math.sin(n)+(t===3?7:3);return(0,N.jsxs)(M.Fragment,{children:[(0,N.jsx)(`text`,{x:r,y:i,className:`arc-label arc-${se(e.split(` `)[0])} ${t===W?`active`:``}`,textAnchor:`middle`,children:A[e]}),e===`Ignition Ark`&&f&&(0,N.jsx)(`text`,{x:r,y:i+8,textAnchor:`middle`,dominantBaseline:`hanging`,fontSize:10,fill:`#00faff`,fontWeight:900,style:{filter:`drop-shadow(0 0 2px #00faff) drop-shadow(0 0 4px #00faff) drop-shadow(0 0 8px #00faff)`,paintOrder:`stroke`,stroke:`#000`,strokeWidth:1,vectorEffect:`non-scaling-stroke`,letterSpacing:`0.5px`},children:f})]},e)})]})})},W=Date.UTC(2024,4,10,6,45,41,888),ue=3+Math.sqrt(5),de=ue*1e3,fe=1000000n,pe=17491270421n,me=11000000n,he=(pe+18n)/36n,ge=[`Solhara`,`Aquaris`,`Flamora`,`Verdari`,`Sonari`,`Kaelith`],_e={Solhara:`Root`,Aquaris:`Sacral`,Flamora:`Solar Plexus`,Verdari:`Heart`,Sonari:`Throat`,Kaelith:`Crown`},ve=(e,t)=>(e%t+t)%t;function ye(e,t){let n=e/t,r=e%t;return r!==0n&&r>0n!=t>0n?n-1n:n}function be(e){if(!Number.isFinite(e))return 0n;let t=e<0?-1:1,n=Math.abs(e),r=Math.trunc(n),i=n-r;return i<.5?BigInt(t*r):i>.5?BigInt(t*(r+1)):BigInt(t*(r%2==0?r:r+1))}function xe(e){return be((e.getTime()-W)/1e3/ue*1e6)}function Se(e){let t=xe(e),n=ve(t,pe),r=ye(t,pe),i=Number(ye(n,he)),a=n-BigInt(i)*he,o=a-a/me*me,s=Number(o)/Number(me);return{pulse:Number(ye(t,fe)),beat:i,stepPct:s,chakraDay:_e[ge[Number(ve(r,6n))]]}}var Ce=()=>performance.timeOrigin+performance.now(),we=e=>{let t=e-W;return W+Math.ceil(t/de)*de},Te=()=>{let[e,t]=(0,M.useState)(0),[n,r]=(0,M.useState)(0),[i,a]=(0,M.useState)(0),[o,s]=(0,M.useState)(`Root`),[c,l]=(0,M.useState)(!1),[u]=(0,M.useState)(()=>`btn-${Math.random().toString(36).slice(2)}`),d=c?`sigil-open`:`sigil-closed`,f=(0,M.useRef)(null),p=(0,M.useRef)(null),m=(0,M.useRef)(0),h=(0,M.useCallback)(()=>{let{pulse:e,beat:n,stepPct:i,chakraDay:o}=Se(new Date);t(e),r(n),a(i),s(o)},[]),g=()=>{p.current!==null&&(clearTimeout(p.current),p.current=null)},_=(0,M.useCallback)(()=>{g();let e=Ce();m.current=we(e);let t=()=>{let e=Ce(),n=Math.floor((e-m.current)/de),r=Math.max(0,n)+1;for(let e=0;e(h(),_(),()=>g()),[h,_]),(0,M.useEffect)(()=>{let e=()=>{document.visibilityState===`visible`&&_()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[_]),(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`button`,{className:`sigil-button`,title:`View & save this sigil`,onClick:()=>l(!0),"data-chakra":o,"aria-label":`Open Kairos Sigil`,children:(0,N.jsxs)(`span`,{className:`sigil-thumb`,"aria-hidden":`true`,inert:!0,children:[(0,N.jsx)(S,{ref:f,pulse:e,beat:n,stepPct:i,chakraDay:o,size:40,hashMode:`deterministic`,origin:u,onReady:n=>{n&&typeof n.pulse==`number`&&n.pulse!==e&&t(n.pulse)}},d),(0,N.jsx)(`span`,{className:`sigil-shield`,"aria-hidden":`true`})]})}),c&&(0,N.jsx)(E,{initialPulse:e,onClose:()=>l(!1)})]})},Ee=(0,M.createContext)({});function De(e){let t=(0,M.useRef)(null);return t.current===null&&(t.current=e()),t.current}var Oe=typeof window<`u`,ke=Oe?M.useLayoutEffect:M.useEffect,Ae=(0,M.createContext)(null);function je(e,t){e.indexOf(t)===-1&&e.push(t)}function Me(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var Ne=(e,t,n)=>n>t?t:n/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Ie(e){return typeof e==`object`&&!!e}var Le=e=>/^0[^.\s]+$/u.test(e);function Re(e){let t;return()=>(t===void 0&&(t=e()),t)}var ze=e=>e,Be=(e,t)=>n=>t(e(n)),Ve=(...e)=>e.reduce(Be),He=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},Ue=class{constructor(){this.subscriptions=[]}add(e){return je(this.subscriptions,e),()=>Me(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;ie*1e3,Ge=e=>e/1e3;function Ke(e,t){return t?e*(1e3/t):0}var qe=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Je=1e-7,Ye=12;function Xe(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=qe(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>Je&&++sXe(t,0,1,e,n);return e=>e===0||e===1?e:qe(i(e),t,r)}var Qe=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,$e=e=>t=>1-e(1-t),et=Ze(.33,1.53,.69,.99),tt=$e(et),nt=Qe(tt),rt=e=>(e*=2)<1?.5*tt(e):.5*(2-2**(-10*(e-1))),it=e=>1-Math.sin(Math.acos(e)),at=$e(it),ot=Qe(it),st=Ze(.42,0,1,1),ct=Ze(0,0,.58,1),lt=Ze(.42,0,.58,1),ut=e=>Array.isArray(e)&&typeof e[0]!=`number`,dt=e=>Array.isArray(e)&&typeof e[0]==`number`,ft={linear:ze,easeIn:st,easeInOut:lt,easeOut:ct,circIn:it,circInOut:ot,circOut:at,backIn:tt,backInOut:nt,backOut:et,anticipate:rt},pt=e=>typeof e==`string`,mt=e=>{if(dt(e)){e.length;let[t,n,r,i]=e;return Ze(t,n,r,i)}else if(pt(e))return ft[e],`${e}`,ft[e];return e},ht=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],gt={value:null,addProjectionMetrics:null};function _t(e,t){let n=new Set,r=new Set,i=!1,a=!1,o=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1},c=0;function l(t){o.has(t)&&(u.schedule(t),e()),c++,t(s)}let u={schedule:(e,t=!1,a=!1)=>{let s=a&&i?n:r;return t&&o.add(e),s.has(e)||s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(s=e,i){a=!0;return}i=!0,[n,r]=[r,n],n.forEach(l),t&>.value&>.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var vt=40;function yt(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=ht.reduce((e,n)=>(e[n]=_t(a,t?n:void 0),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=Pe.useManualTiming?i.timestamp:performance.now();n=!1,Pe.useManualTiming||(i.delta=r?1e3/60:Math.max(Math.min(a-i.timestamp,vt),1)),i.timestamp=a,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:ht.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t(St===void 0&&wt.set(K.isProcessing||Pe.useManualTiming?K.timestamp:performance.now()),St),set:e=>{St=e,queueMicrotask(Ct)}},Tt={layout:0,mainThread:0,waapi:0},Et=e=>t=>typeof t==`string`&&t.startsWith(e),Dt=Et(`--`),Ot=Et(`var(--`),kt=e=>Ot(e)?At.test(e.split(`/*`)[0].trim()):!1,At=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,jt={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},Mt={...jt,transform:e=>Ne(0,1,e)},Nt={...jt,default:1},Pt=e=>Math.round(e*1e5)/1e5,Ft=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function It(e){return e==null}var Lt=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Rt=(e,t)=>n=>!!(typeof n==`string`&&Lt.test(n)&&n.startsWith(e)||t&&!It(n)&&Object.prototype.hasOwnProperty.call(n,t)),zt=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(Ft);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},Bt=e=>Ne(0,255,e),Vt={...jt,transform:e=>Math.round(Bt(e))},Ht={test:Rt(`rgb`,`red`),parse:zt(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+Vt.transform(e)+`, `+Vt.transform(t)+`, `+Vt.transform(n)+`, `+Pt(Mt.transform(r))+`)`};function Ut(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var Wt={test:Rt(`#`),parse:Ut,transform:Ht.transform},Gt=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Kt=Gt(`deg`),qt=Gt(`%`),q=Gt(`px`),Jt=Gt(`vh`),Yt=Gt(`vw`),Xt=(()=>({...qt,parse:e=>qt.parse(e)/100,transform:e=>qt.transform(e*100)}))(),Zt={test:Rt(`hsl`,`hue`),parse:zt(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+qt.transform(Pt(t))+`, `+qt.transform(Pt(n))+`, `+Pt(Mt.transform(r))+`)`},J={test:e=>Ht.test(e)||Wt.test(e)||Zt.test(e),parse:e=>Ht.test(e)?Ht.parse(e):Zt.test(e)?Zt.parse(e):Wt.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?Ht.transform(e):Zt.transform(e),getAnimatableNone:e=>{let t=J.parse(e);return t.alpha=0,J.transform(t)}},Qt=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function $t(e){return isNaN(e)&&typeof e==`string`&&(e.match(Ft)?.length||0)+(e.match(Qt)?.length||0)>0}var en=`number`,tn=`color`,nn=`var`,rn=`var(`,an="${}",on=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function sn(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(on,e=>(J.test(e)?(r.color.push(a),i.push(tn),n.push(J.parse(e))):e.startsWith(rn)?(r.var.push(a),i.push(nn),n.push(e)):(r.number.push(a),i.push(en),n.push(parseFloat(e))),++a,an)).split(an),indexes:r,types:i}}function cn(e){return sn(e).values}function ln(e){let{split:t,types:n}=sn(e),r=t.length;return e=>{let i=``;for(let a=0;atypeof e==`number`?0:J.test(e)?J.getAnimatableNone(e):e;function dn(e){let t=cn(e);return ln(e)(t.map(un))}var fn={test:$t,parse:cn,createTransformer:ln,getAnimatableNone:dn};function pn(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function mn({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=pn(s,r,e+1/3),a=pn(s,r,e),o=pn(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function hn(e,t){return n=>n>0?t:e}var Y=(e,t,n)=>e+(t-e)*n,gn=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},_n=[Wt,Ht,Zt],vn=e=>_n.find(t=>t.test(e));function yn(e){let t=vn(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===Zt&&(n=mn(n)),n}var bn=(e,t)=>{let n=yn(e),r=yn(t);if(!n||!r)return hn(e,t);let i={...n};return e=>(i.red=gn(n.red,r.red,e),i.green=gn(n.green,r.green,e),i.blue=gn(n.blue,r.blue,e),i.alpha=Y(n.alpha,r.alpha,e),Ht.transform(i))},xn=new Set([`none`,`hidden`]);function Sn(e,t){return xn.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Cn(e,t){return n=>Y(e,t,n)}function wn(e){return typeof e==`number`?Cn:typeof e==`string`?kt(e)?hn:J.test(e)?bn:On:Array.isArray(e)?Tn:typeof e==`object`?J.test(e)?bn:En:hn}function Tn(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>wn(e)(e,t[n]));return e=>{for(let t=0;t{for(let t in r)n[t]=r[t](e);return n}}function Dn(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i{let n=fn.createTransformer(t),r=sn(e),i=sn(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?xn.has(e)&&!i.values.length||xn.has(t)&&!r.values.length?Sn(e,t):Ve(Tn(Dn(r,i),i.values),n):(`${e}${t}`,hn(e,t))};function kn(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?Y(e,t,n):wn(e)(e,t)}var An=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>G.update(t,e),stop:()=>bt(t),now:()=>K.isProcessing?K.timestamp:wt.now()}},jn=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t=2e4?1/0:t}function Pn(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(Nn(r),Mn);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:Ge(i)}}var Fn=5;function In(e,t,n){let r=Math.max(t-Fn,0);return Ke(n-e(r),t-r)}var X={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Ln=.001;function Rn({duration:e=X.duration,bounce:t=X.bounce,velocity:n=X.velocity,mass:r=X.mass}){let i,a;X.maxDuration;let o=1-t;o=Ne(X.minDamping,X.maxDamping,o),e=Ne(X.minDuration,X.maxDuration,Ge(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=Vn(t,o),c=Math.exp(-i);return Ln-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=Vn(t**2,o);return(-i(t)+Ln>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-Ln+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=Bn(i,a,s);if(e=We(e),isNaN(c))return{stiffness:X.stiffness,damping:X.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var zn=12;function Bn(e,t,n){let r=n;for(let n=1;ne[t]!==void 0)}function Gn(e){let t={velocity:X.velocity,stiffness:X.stiffness,damping:X.damping,mass:X.mass,isResolvedFromDuration:!1,...e};if(!Wn(e,Un)&&Wn(e,Hn))if(e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*Ne(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:X.mass,stiffness:i,damping:a}}else{let n=Rn(e);t={...t,...n,mass:X.mass},t.isResolvedFromDuration=!0}return t}function Kn(e=X.visualDuration,t=X.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=Gn({...n,velocity:-Ge(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=Ge(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?X.restSpeed.granular:X.restSpeed.default,i||=v?X.restDelta.granular:X.restDelta.default;let y;if(h<1){let e=Vn(_,h);y=t=>o-Math.exp(-h*_*t)*((m+h*_*g)/e*Math.sin(e*t)+g*Math.cos(e*t))}else if(h===1)y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e}}let b={calculatedDuration:p&&d||null,next:e=>{let t=y(e);if(p)s.done=e>=d;else{let n=e===0?m:0;h<1&&(n=e===0?We(m):In(y,e,t));let a=Math.abs(n)<=r,c=Math.abs(o-t)<=i;s.done=a&&c}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(Nn(b),Mn),t=jn(t=>b.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return b}Kn.applyToOptions=e=>{let t=Pn(e,100,Kn);return e.ease=t.ease,e.duration=We(t.duration),e.type=`keyframes`,e};function qn({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&ec,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=Kn({keyframes:[f.value,m(f.value)],velocity:In(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function Jn(e,t,n){let r=[],i=n||Pe.mix||kn,a=e.length-1;for(let n=0;nt[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=Jn(t,r,i),c=s.length,l=n=>{if(o&&n1)for(;rl(Ne(e[0],e[a-1],t)):l}function Xn(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=He(0,t,r);e.push(Y(n,1,i))}}function Zn(e){let t=[0];return Xn(t,e.length-1),t}function Qn(e,t){return e.map(e=>e*t)}function $n(e,t){return e.map(()=>t||lt).splice(0,e.length-1)}function er({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=ut(r)?r.map(mt):mt(r),a={done:!1,value:t[0]},o=Yn(Qn(n&&n.length===t.length?n:Zn(t),e),t,{ease:Array.isArray(i)?i:$n(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var tr=e=>e!==null;function nr(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(tr),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var rr={decay:qn,inertia:qn,tween:er,keyframes:er,spring:Kn};function ir(e){typeof e.type==`string`&&(e.type=rr[e.type])}var ar=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},or=e=>e/100,sr=class extends ar{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==wt.now()&&this.tick(wt.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},Tt.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;ir(e);let{type:t=er,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||er;s!==er&&typeof o[0]!=`number`&&(this.mixKeyframes=Ve(or,kn(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=Nn(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=Ne(0,1,n)*o}let b=_?{done:!1,value:l[0]}:y.next(v);i&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==qn&&(b.value=nr(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return Ge(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Ge(e)}get time(){return Ge(this.currentTime)}set time(e){e=We(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(wt.now());let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=Ge(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=An,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(wt.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null,Tt.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function cr(e){for(let t=1;te*180/Math.PI,ur=e=>fr(lr(Math.atan2(e[1],e[0]))),dr={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:ur,rotateZ:ur,skewX:e=>lr(Math.atan(e[1])),skewY:e=>lr(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},fr=e=>(e%=360,e<0&&(e+=360),e),pr=ur,mr=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),hr=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),gr={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:mr,scaleY:hr,scale:e=>(mr(e)+hr(e))/2,rotateX:e=>fr(lr(Math.atan2(e[6],e[5]))),rotateY:e=>fr(lr(Math.atan2(-e[2],e[0]))),rotateZ:pr,rotate:pr,skewX:e=>lr(Math.atan(e[4])),skewY:e=>lr(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function _r(e){return e.includes(`scale`)?1:0}function vr(e,t){if(!e||e===`none`)return _r(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=gr,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=dr,i=t}if(!i)return _r(t);let a=r[t],o=i[1].split(`,`).map(br);return typeof a==`function`?a(o):o[a]}var yr=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return vr(n,t)};function br(e){return parseFloat(e.trim())}var xr=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],Sr=(()=>new Set(xr))(),Cr=e=>e===jt||e===q,wr=new Set([`x`,`y`,`z`]),Tr=xr.filter(e=>!wr.has(e));function Er(e){let t=[];return Tr.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith(`scale`)?1:0))}),t}var Dr={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>vr(t,`x`),y:(e,{transform:t})=>vr(t,`y`)};Dr.translateX=Dr.x,Dr.translateY=Dr.y;var Or=new Set,kr=!1,Ar=!1,jr=!1;function Mr(){if(Ar){let e=Array.from(Or).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=Er(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}Ar=!1,kr=!1,Or.forEach(e=>e.complete(jr)),Or.clear()}function Nr(){Or.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Ar=!0)})}function Pr(){jr=!0,Nr(),Mr(),jr=!1}var Fr=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(Or.add(this),kr||(kr=!0,G.read(Nr),G.resolveKeyframes(Mr))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}cr(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Or.delete(this)}cancel(){this.state===`scheduled`&&(Or.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},Ir=e=>e.startsWith(`--`);function Lr(e,t,n){Ir(t)?e.style.setProperty(t,n):e.style[t]=n}var Rr=Re(()=>window.ScrollTimeline!==void 0),zr={};function Br(e,t){let n=Re(e);return()=>zr[t]??n()}var Vr=Br(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),Hr=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Ur={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:Hr([0,.65,.55,1]),circOut:Hr([.55,0,1,.45]),backIn:Hr([.31,.01,.66,-.59]),backOut:Hr([.33,1.53,.69,.99])};function Wr(e,t){if(e)return typeof e==`function`?Vr()?jn(e,t):`ease-out`:dt(e)?Hr(e):Array.isArray(e)?e.map(e=>Wr(e,t)||Ur.easeOut):Ur[e]}function Gr(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=Wr(s,i);Array.isArray(d)&&(u.easing=d),gt.value&&Tt.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return gt.value&&p.finished.finally(()=>{Tt.waapi--}),p}function Kr(e){return typeof e==`function`&&`applyToOptions`in e}function qr({type:e,...t}){return Kr(e)&&Vr()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var Jr=class extends ar{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=qr(e);this.animation=Gr(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=nr(r,this.options,o,this.speed);this.updateMotionValue?this.updateMotionValue(e):Lr(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return Ge(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Ge(e)}get time(){return Ge(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=We(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&Rr()?(this.animation.timeline=e,ze):t(this)}},Yr={anticipate:rt,backInOut:nt,circInOut:ot};function Xr(e){return e in Yr}function Zr(e){typeof e.ease==`string`&&Xr(e.ease)&&(e.ease=Yr[e.ease])}var Qr=10,$r=class extends Jr{constructor(e){Zr(e),ir(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new sr({...a,autoplay:!1}),s=We(this.finishedTime??this.time);t.setWithVelocity(o.sample(s-Qr).value,o.sample(s).value,Qr),o.stop()}},ei=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(fn.test(e)||e===`0`)&&!e.startsWith(`url(`));function ti(e){let t=e[0];if(e.length===1)return!0;for(let n=0;nObject.hasOwnProperty.call(Element.prototype,`animate`));function oi(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:s,transformTemplate:c}=t.owner.getProps();return ai()&&n&&ii.has(n)&&(n!==`transform`||!c)&&!s&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var si=40,ci=class extends ar{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=wt.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u};this.keyframeResolver=new(l?.KeyframeResolver||Fr)(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=wt.now(),ni(e,i,a,o)||((Pe.instantAnimations||!s)&&l?.(nr(e,n,t)),e[0]=e[e.length-1],ri(n),n.repeat=0);let u={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>si?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},d=!c&&oi(u)?new $r({...u,element:u.motionValue.owner.current}):new sr(u);d.finished.then(()=>this.notifyFinished()).catch(ze),this.pendingTimeline&&=(this.stopTimeline=d.attachTimeline(this.pendingTimeline),void 0),this._animation=d}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Pr()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}},li=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function ui(e){let t=li.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function di(e,t,n=1){`${e}`;let[r,i]=ui(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return Fe(e)?parseFloat(e):e}return kt(i)?di(i,t,n+1):i}function fi(e,t){return e?.[t]??e?.default??e}var pi=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...xr]),mi={test:e=>e===`auto`,parse:e=>e},hi=e=>t=>t.test(e),gi=[jt,q,qt,Kt,Yt,Jt,mi],_i=e=>gi.find(hi(e));function vi(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||Le(e)}var yi=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function bi(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(Ft)||[];if(!r)return e;let i=n.replace(r,``),a=yi.has(t)?1:0;return r!==n&&(a*=100),t+`(`+a+i+`)`}var xi=/\b([a-z-]*)\(.*?\)/gu,Si={...fn,getAnimatableNone:e=>{let t=e.match(xi);return t?t.map(bi).join(` `):e}},Ci={...jt,transform:Math.round},wi={borderWidth:q,borderTopWidth:q,borderRightWidth:q,borderBottomWidth:q,borderLeftWidth:q,borderRadius:q,radius:q,borderTopLeftRadius:q,borderTopRightRadius:q,borderBottomRightRadius:q,borderBottomLeftRadius:q,width:q,maxWidth:q,height:q,maxHeight:q,top:q,right:q,bottom:q,left:q,padding:q,paddingTop:q,paddingRight:q,paddingBottom:q,paddingLeft:q,margin:q,marginTop:q,marginRight:q,marginBottom:q,marginLeft:q,backgroundPositionX:q,backgroundPositionY:q,rotate:Kt,rotateX:Kt,rotateY:Kt,rotateZ:Kt,scale:Nt,scaleX:Nt,scaleY:Nt,scaleZ:Nt,skew:Kt,skewX:Kt,skewY:Kt,distance:q,translateX:q,translateY:q,translateZ:q,x:q,y:q,z:q,perspective:q,transformPerspective:q,opacity:Mt,originX:Xt,originY:Xt,originZ:q,zIndex:Ci,fillOpacity:Mt,strokeOpacity:Mt,numOctaves:Ci},Ti={...wi,color:J,backgroundColor:J,outlineColor:J,fill:J,stroke:J,borderColor:J,borderTopColor:J,borderRightColor:J,borderBottomColor:J,borderLeftColor:J,filter:Si,WebkitFilter:Si},Ei=e=>Ti[e];function Di(e,t){let n=Ei(e);return n!==Si&&(n=fn),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var Oi=new Set([`auto`,`none`,`0`]);function ki(e,t,n){let r=0,i;for(;r{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}};function ji(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}var Mi=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function Ni(e){return Ie(e)&&`offsetHeight`in e}var Pi=30,Fi=e=>!isNaN(parseFloat(e)),Ii={current:void 0},Li=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=wt.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=wt.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Fi(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new Ue);let n=this.events[e].add(t);return e===`change`?()=>{n(),G.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return Ii.current&&Ii.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=wt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Pi)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,Pi);return Ke(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Ri(e,t){return new Li(e,t)}var{schedule:zi,cancel:Bi}=yt(queueMicrotask,!1),Vi={x:!1,y:!1};function Hi(){return Vi.x||Vi.y}function Ui(e){return e===`x`||e===`y`?Vi[e]?null:(Vi[e]=!0,()=>{Vi[e]=!1}):Vi.x||Vi.y?null:(Vi.x=Vi.y=!0,()=>{Vi.x=Vi.y=!1})}function Wi(e,t){let n=ji(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function Gi(e){return!(e.pointerType===`touch`||Hi())}function Ki(e,t,n={}){let[r,i,a]=Wi(e,n),o=e=>{if(!Gi(e))return;let{target:n}=e,r=t(n,e);if(typeof r!=`function`||!n)return;let a=e=>{Gi(e)&&(r(e),n.removeEventListener(`pointerleave`,a))};n.addEventListener(`pointerleave`,a,i)};return r.forEach(e=>{e.addEventListener(`pointerenter`,o,i)}),a}var qi=(e,t)=>t?e===t?!0:qi(e,t.parentElement):!1,Ji=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,Yi=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function Xi(e){return Yi.has(e.tagName)||e.tabIndex!==-1}var Zi=new WeakSet;function Qi(e){return t=>{t.key===`Enter`&&e(t)}}function $i(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var ea=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=Qi(()=>{if(Zi.has(n))return;$i(n,`down`);let e=Qi(()=>{$i(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>$i(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function ta(e){return Ji(e)&&!Hi()}function na(e,t,n={}){let[r,i,a]=Wi(e,n),o=e=>{let r=e.currentTarget;if(!ta(e))return;Zi.add(r);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),Zi.has(r)&&Zi.delete(r),ta(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||qi(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),Ni(e)&&(e.addEventListener(`focus`,e=>ea(e,i)),!Xi(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function ra(e){return Ie(e)&&`ownerSVGElement`in e}function ia(e){return ra(e)&&e.tagName===`svg`}var aa=e=>!!(e&&e.getVelocity),oa=[...gi,J,fn],sa=e=>oa.find(hi(e)),ca=(0,M.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function la(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function ua(...e){return t=>{let n=!1,r=e.map(e=>{let r=la(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t{let{width:e,height:c,top:l,left:u,right:d}=o.current;if(t||!a.current||!e||!c)return;let f=n===`left`?`left: ${u}`:`right: ${d}`;a.current.dataset.motionPopId=i;let p=document.createElement(`style`);s&&(p.nonce=s);let m=r??document.head;return m.appendChild(p),p.sheet&&p.sheet.insertRule(` [data-motion-pop-id="${i}"] { position: absolute !important; width: ${e}px !important; diff --git a/dist/assets/HomePriceChartCard-CMBb8I-f.js b/dist/assets/HomePriceChartCard-CG0g_aGu.js similarity index 99% rename from dist/assets/HomePriceChartCard-CMBb8I-f.js rename to dist/assets/HomePriceChartCard-CG0g_aGu.js index 9e3b834e..7edda898 100644 --- a/dist/assets/HomePriceChartCard-CMBb8I-f.js +++ b/dist/assets/HomePriceChartCard-CG0g_aGu.js @@ -1,4 +1,4 @@ -import{Tn as e,an as t,bt as n,jn as r,ln as i,tn as a,yt as o}from"./index-BGzUQCv_.js";import{t as s}from"./prop-types-CQvzhoSE.js";var c=r(e(),1),l=`clover`,u=function(e){return e===3?`v3`:e},d=`https://js.stripe.com`,f=`${d}/${l}/stripe.js`,p=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,ee=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/,m=`loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used`,h=function(e){return p.test(e)||ee.test(e)},g=function(){for(var e=document.querySelectorAll(`script[src^="${d}"]`),t=0;t element.`);return r.appendChild(n),n},te=function(e,t){!e||!e._registerWrapper||e._registerWrapper({name:`stripe-js`,version:`8.6.0`,startTime:t})},v=null,y=null,b=null,x=function(e){return function(t){e(Error(`Failed to load Stripe.js`,{cause:t}))}},S=function(e,t){return function(){window.Stripe?e(window.Stripe):t(Error(`Stripe.js not available`))}},C=function(e){return v===null?(v=new Promise(function(t,n){if(typeof window>`u`||typeof document>`u`){t(null);return}if(window.Stripe&&e&&console.warn(m),window.Stripe){t(window.Stripe);return}try{var r=g();if(r&&e)console.warn(m);else if(!r)r=_(e);else if(r&&b!==null&&y!==null){var i;r.removeEventListener(`load`,b),r.removeEventListener(`error`,y),(i=r.parentNode)==null||i.removeChild(r),r=_(e)}b=S(t,n),y=x(n),r.addEventListener(`load`,b),r.addEventListener(`error`,y)}catch(e){n(e);return}}),v.catch(function(e){return v=null,Promise.reject(e)})):v},w=function(e,t,n){if(e===null)return null;var r=t[0].match(/^pk_test/),i=u(e.version),a=l;r&&i!==a&&console.warn(`Stripe.js@${i} was loaded on the page, but @stripe/stripe-js@8.6.0 expected Stripe.js@${a}. This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning`);var o=e.apply(void 0,t);return te(o,n),o},T,E=!1,D=function(){return T||(T=C(null).catch(function(e){return T=null,Promise.reject(e)}),T)};Promise.resolve().then(function(){return D()}).catch(function(e){E||console.warn(e)});var O=function(){var e=[...arguments];E=!0;var t=Date.now();return D().then(function(n){return w(n,e,t)})},k=r(s(),1);function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function j(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function re(e,t){if(e==null)return{};var n=ne(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ie(e,t){return P(e)||ae(e,t)||F(e,t)||oe()}function P(e){if(Array.isArray(e))return e}function ae(e,t){var n=e&&(typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`]);if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function F(e,t){if(e){if(typeof e==`string`)return I(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return I(e,t)}}function I(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n element.`);return r.appendChild(n),n},te=function(e,t){!e||!e._registerWrapper||e._registerWrapper({name:`stripe-js`,version:`8.6.0`,startTime:t})},v=null,y=null,b=null,x=function(e){return function(t){e(Error(`Failed to load Stripe.js`,{cause:t}))}},S=function(e,t){return function(){window.Stripe?e(window.Stripe):t(Error(`Stripe.js not available`))}},C=function(e){return v===null?(v=new Promise(function(t,n){if(typeof window>`u`||typeof document>`u`){t(null);return}if(window.Stripe&&e&&console.warn(m),window.Stripe){t(window.Stripe);return}try{var r=g();if(r&&e)console.warn(m);else if(!r)r=_(e);else if(r&&b!==null&&y!==null){var i;r.removeEventListener(`load`,b),r.removeEventListener(`error`,y),(i=r.parentNode)==null||i.removeChild(r),r=_(e)}b=S(t,n),y=x(n),r.addEventListener(`load`,b),r.addEventListener(`error`,y)}catch(e){n(e);return}}),v.catch(function(e){return v=null,Promise.reject(e)})):v},w=function(e,t,n){if(e===null)return null;var r=t[0].match(/^pk_test/),i=u(e.version),a=l;r&&i!==a&&console.warn(`Stripe.js@${i} was loaded on the page, but @stripe/stripe-js@8.6.0 expected Stripe.js@${a}. This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning`);var o=e.apply(void 0,t);return te(o,n),o},T,E=!1,D=function(){return T||(T=C(null).catch(function(e){return T=null,Promise.reject(e)}),T)};Promise.resolve().then(function(){return D()}).catch(function(e){E||console.warn(e)});var O=function(){var e=[...arguments];E=!0;var t=Date.now();return D().then(function(n){return w(n,e,t)})},k=r(s(),1);function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function j(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function re(e,t){if(e==null)return{};var n=ne(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ie(e,t){return P(e)||ae(e,t)||F(e,t)||oe()}function P(e){if(Array.isArray(e))return e}function ae(e,t){var n=e&&(typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`]);if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function F(e,t){if(e){if(typeof e==`string`)return I(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return I(e,t)}}function I(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n1&&arguments[1]!==void 0?arguments[1]:ue;if(e===null||V(e))return e;throw Error(t)},U=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ue;if(B(e))return{tag:`async`,stripePromise:Promise.resolve(e).then(function(e){return H(e,t)})};var n=H(e,t);return n===null?{tag:`empty`}:{tag:`sync`,stripe:n}},W=function(e){!e||!e._registerWrapper||!e.registerAppInfo||(e._registerWrapper({name:`react-stripe-js`,version:`5.4.1`}),e.registerAppInfo({name:`react-stripe-js`,version:`5.4.1`,url:`https://stripe.com/docs/stripe-js/react`}))},G=c.createContext(null);G.displayName=`ElementsContext`;var de=function(e,t){if(!e)throw Error(`Could not find Elements context; You need to wrap the part of your app that ${t} in an provider.`);return e},K=function(e){var t=e.stripe,n=e.options,r=e.children,i=c.useMemo(function(){return U(t)},[t]),a=ie(c.useState(function(){return{stripe:i.tag===`sync`?i.stripe:null,elements:i.tag===`sync`?i.stripe.elements(n):null}}),2),o=a[0],s=a[1];c.useEffect(function(){var e=!0,t=function(e){s(function(t){return t.stripe?t:{stripe:e,elements:e.elements(n)}})};return i.tag===`async`&&!o.stripe?i.stripePromise.then(function(n){n&&e&&t(n)}):i.tag===`sync`&&!o.stripe&&t(i.stripe),function(){e=!1}},[i,o,n]);var l=R(t);c.useEffect(function(){l!==null&&l!==t&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")},[l,t]);var u=R(n);return c.useEffect(function(){if(o.elements){var e=le(n,u,[`clientSecret`,`fonts`]);e&&o.elements.update(e)}},[n,u,o.elements]),c.useEffect(function(){W(o.stripe)},[o.stripe]),c.createElement(G.Provider,{value:o},r)};K.propTypes={stripe:k.default.any,options:k.default.object};var fe=function(e){return de(c.useContext(G),e)},pe=function(){return fe(`calls useElements()`).elements},me=function(e){var t=e.children;return t(fe(`mounts `))};me.propTypes={children:k.default.func.isRequired};var q=c.createContext(null);q.displayName=`CheckoutContext`,k.default.any,k.default.shape({clientSecret:k.default.oneOfType([k.default.string,k.default.instanceOf(Promise)]).isRequired,elementsOptions:k.default.object}).isRequired;var J=function(e){var t=c.useContext(q),n=c.useContext(G);if(t){if(n)throw Error(`You cannot wrap the part of your app that ${e} in both and providers.`);return t}else return de(n,e)},Y=[`mode`],he=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},X=function(e,t){var n=`${he(e)}Element`,r=t?function(e){J(`mounts <${n}>`);var t=e.id,r=e.className;return c.createElement(`div`,{id:t,className:r})}:function(t){var r=t.id,i=t.className,a=t.options,o=a===void 0?{}:a,s=t.onBlur,l=t.onFocus,u=t.onReady,d=t.onChange,f=t.onEscape,p=t.onClick,ee=t.onLoadError,m=t.onLoaderStart,h=t.onNetworksChange,g=t.onConfirm,_=t.onCancel,te=t.onShippingAddressChange,v=t.onShippingRateChange,y=t.onSavedPaymentMethodRemove,b=t.onSavedPaymentMethodUpdate,x=J(`mounts <${n}>`),S=`elements`in x?x.elements:null,C=`checkoutState`in x?x.checkoutState:null,w=C?.type===`success`||C?.type===`loading`?C.sdk:null,T=ie(c.useState(null),2),E=T[0],D=T[1],O=c.useRef(null),k=c.useRef(null);L(E,`blur`,s),L(E,`focus`,l),L(E,`escape`,f),L(E,`click`,p),L(E,`loaderror`,ee),L(E,`loaderstart`,m),L(E,`networkschange`,h),L(E,`confirm`,g),L(E,`cancel`,_),L(E,`shippingaddresschange`,te),L(E,`shippingratechange`,v),L(E,`savedpaymentmethodremove`,y),L(E,`savedpaymentmethodupdate`,b),L(E,`change`,d);var A;u&&(A=e===`expressCheckout`?u:function(){u(E)}),L(E,`ready`,A),c.useLayoutEffect(function(){if(O.current===null&&k.current!==null&&(S||w)){var t=null;if(w)switch(e){case`paymentForm`:t=w.createPaymentFormElement();break;case`payment`:t=w.createPaymentElement(o);break;case`address`:if(`mode`in o){var r=o.mode,i=re(o,Y);if(r===`shipping`)t=w.createShippingAddressElement(i);else if(r===`billing`)t=w.createBillingAddressElement(i);else throw Error(`Invalid options.mode. mode must be 'billing' or 'shipping'.`)}else throw Error(`You must supply options.mode. mode must be 'billing' or 'shipping'.`);break;case`expressCheckout`:t=w.createExpressCheckoutElement(o);break;case`currencySelector`:t=w.createCurrencySelectorElement();break;case`taxId`:t=w.createTaxIdElement(o);break;default:throw Error(`Invalid Element type ${n}. You must use either the , , , or .`)}else S&&(t=S.create(e,o));O.current=t,D(t),t&&t.mount(k.current)}},[S,w,o]);var j=R(o);return c.useEffect(function(){if(O.current){var e=le(o,j,[`paymentRequest`]);e&&`update`in O.current&&O.current.update(e)}},[o,j]),c.useLayoutEffect(function(){return function(){if(O.current&&typeof O.current.destroy==`function`)try{O.current.destroy(),O.current=null}catch{}}},[]),c.createElement(`div`,{id:r,className:i,ref:k})};return r.propTypes={id:k.default.string,className:k.default.string,onChange:k.default.func,onBlur:k.default.func,onFocus:k.default.func,onReady:k.default.func,onEscape:k.default.func,onClick:k.default.func,onLoadError:k.default.func,onLoaderStart:k.default.func,onNetworksChange:k.default.func,onConfirm:k.default.func,onCancel:k.default.func,onShippingAddressChange:k.default.func,onShippingRateChange:k.default.func,onSavedPaymentMethodRemove:k.default.func,onSavedPaymentMethodUpdate:k.default.func,options:k.default.object},r.displayName=n,r.__elementType=e,r},Z=typeof window>`u`,ge=c.createContext(null);ge.displayName=`EmbeddedCheckoutProviderContext`;var _e=function(){return J(`calls useStripe()`).stripe};X(`auBankAccount`,Z),X(`card`,Z),X(`cardNumber`,Z),X(`cardExpiry`,Z),X(`cardCvc`,Z),X(`iban`,Z);var ve=X(`payment`,Z);X(`expressCheckout`,Z),X(`paymentRequestButton`,Z),X(`linkAuthentication`,Z),X(`address`,Z),X(`shippingAddress`,Z),X(`paymentMethodMessaging`,Z),X(`taxId`,Z);var Q=r(a(),1),ye=i,$=e=>globalThis[e],be=()=>{let e=$(`kaiPulseNowBridge`)??$(`kaiPulseNow`);return typeof e==`function`?e():(performance.timeOrigin+performance.now()-t)/i},xe=(e,t,n)=>Math.max(t,Math.min(n,e)),Se=e=>Math.round(e*100)/100,Ce=e=>e.toLocaleString(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2}),we=(e,t)=>{let n=(1+Math.sqrt(5))/2,r=Math.sin(2*Math.PI*e/44)*.85,i=Math.sin(2*Math.PI*n*e)*.42,a=Math.sin(2*Math.PI*(n-1)*e)*.28,o=Math.sin(e*.1618)*.35;return Se(t+r+i+a+o)},Te=e=>xe(.35+.65*Math.abs(Math.sin(2*Math.PI*e/11)),0,1),Ee=Object.freeze([]),De=Object.freeze([]),Oe=` .kai-price-wrap { font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Apple Color Emoji","Segoe UI Emoji"; color: #e7fbf7; } .kai-price-chart { display:block; width:100%; height:auto; } diff --git a/dist/assets/KaiRealms-DsvdKMyp.js b/dist/assets/KaiRealms-CxldGmng.js similarity index 99% rename from dist/assets/KaiRealms-DsvdKMyp.js rename to dist/assets/KaiRealms-CxldGmng.js index 2c87a259..6909593b 100644 --- a/dist/assets/KaiRealms-DsvdKMyp.js +++ b/dist/assets/KaiRealms-CxldGmng.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/bundler-DKFgLeD8.js","assets/index-BGzUQCv_.js","assets/index-BmaJNTKf.css"])))=>i.map(i=>d[i]); -import{t as e}from"./x-B04jFFwi.js";import{Bt as t,Ht as n,Sn as r,Tn as i,an as a,jn as o,ln as s,mn as c,t as l,tn as u}from"./index-BGzUQCv_.js";var d=o(i(),1);function f(e){return typeof e==`string`?e.toLowerCase():``}function p(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function m(e){return typeof e==`string`&&e.length>0}function h(e){return typeof e==`number`&&Number.isFinite(e)}function g(e){if(typeof e!=`object`||!e)throw Error(`Malformed sigil metadata.`);let t=e;for(let e of[`pulse`,`beat`,`stepIndex`,`chakraDay`])if(!p(t,e))throw Error(`Missing Kai field: ${e}`);if(!p(t,`kaiSignature`))throw Error(`Invalid Kai Signature — tampered or unsigned sigil.`);if(!h(t.pulse))throw Error(`Invalid field: pulse`);if(!h(t.beat))throw Error(`Invalid field: beat`);if(!h(t.stepIndex))throw Error(`Invalid field: stepIndex`);if(!m(t.chakraDay))throw Error(`Invalid field: chakraDay`);if(!m(t.kaiSignature))throw Error(`Invalid field: kaiSignature`)}function _(e){try{let t=new DOMParser().parseFromString(e,`image/svg+xml`),n=Array.from(t.getElementsByTagName(`metadata`)),r=[`valuation`,`ledger`,`dht`,`source`];for(let e of n){let t=e.getAttribute(`id`)??``;if(r.some(e=>t.includes(e)))continue;let n=(e.textContent??``).trim();if(!n)continue;let i=n.replace(/^$/,``);try{let e=JSON.parse(i);if(typeof e==`object`&&e&&p(e,`pulse`)&&p(e,`beat`)&&p(e,`stepIndex`)&&p(e,`chakraDay`)&&p(e,`kaiSignature`))return e}catch{}}return null}catch{return null}}async function v(e){let r=await e.text(),{meta:i,contextOk:a,typeOk:o}=await l(e),s=i&&p(i,`kaiSignature`)&&p(i,`pulse`)?i:_(r);if(!s||!a||!o)throw Error(`Invalid glyph or missing metadata.`);g(s);let c=s,u=await t(c);if(!u||f(u)!==f(c.kaiSignature))throw Error(`Invalid Kai Signature — tampered or unsigned sigil.`);let d=await n(c.kaiSignature);if(typeof c.userPhiKey==`string`){if(f(c.userPhiKey)!==f(d))throw Error(`Φ-Key mismatch — identity invalid.`)}else c.userPhiKey=d;return{svgText:r,meta:c,phiKey:d}}var y=o(u(),1),b=`.svg,image/svg+xml`,x=({onEnter:e})=>{let t=(0,d.useRef)(null),[n,r]=(0,d.useState)(!1),[i,a]=(0,d.useState)(!1),[o,s]=(0,d.useState)(``),[c,l]=(0,d.useState)(null),u=(0,d.useId)(),f=(0,d.useId)(),p=(0,d.useId)(),m=()=>{t.current&&(t.current.value=``)},h=(0,d.useCallback)(async t=>{l(null),s(t.name),a(!0);try{if(!(t.type===`image/svg+xml`||t.name.toLowerCase().endsWith(`.svg`)))throw Error(`Please upload a valid Kai Sigil (.svg).`);e(await v(t))}catch(e){l(e instanceof Error?e.message:`Invalid glyph or missing metadata.`)}finally{a(!1),m()}},[e]),g=(0,d.useCallback)(async e=>{let t=e.target.files?.[0];t&&await h(t)},[h]),_=(0,d.useCallback)(async e=>{e.preventDefault(),e.stopPropagation(),r(!1);let t=e.dataTransfer.files?.[0];t&&await h(t)},[h]),x=e=>{e.preventDefault(),e.dataTransfer.dropEffect=`copy`,n||r(!0)},S=e=>{e.currentTarget.contains(e.relatedTarget)||r(!1)},C=()=>t.current?.click(),w=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),C())};return(0,y.jsxs)(`section`,{className:`portal-card glass-omni`,"aria-labelledby":u,"aria-describedby":f,children:[(0,y.jsx)(`div`,{className:`breath-ring breath-ring--outer`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`breath-ring breath-ring--inner`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`phi-grid`,"aria-hidden":!0}),(0,y.jsx)(`h1`,{id:u,className:`sr-only`,children:`Drop your Kai Sigil`}),(0,y.jsxs)(`div`,{className:`portal-body`,children:[(0,y.jsxs)(`div`,{className:`dropzone ${n?`dropzone--active`:``} ${i?`dropzone--busy`:``}`,role:`button`,tabIndex:0,onKeyDown:w,onClick:C,onDrop:_,onDragOver:x,onDragLeave:S,"aria-busy":i,"aria-describedby":`${f}${c?` ${p}`:``}`,children:[(0,y.jsxs)(`div`,{className:`dropzone-ornament`,"aria-hidden":!0,children:[(0,y.jsx)(`div`,{className:`ornament-ring ornament-ring--outer`}),(0,y.jsx)(`div`,{className:`ornament-ring ornament-ring--inner`}),(0,y.jsx)(`div`,{className:`ornament-core`})]}),(0,y.jsx)(`div`,{className:`dropzone-icon`,"aria-hidden":!0,children:(0,y.jsxs)(`svg`,{width:`44`,height:`44`,viewBox:`0 0 44 44`,children:[(0,y.jsx)(`defs`,{children:(0,y.jsxs)(`linearGradient`,{id:`dzG`,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,y.jsx)(`stop`,{offset:`0%`,stopColor:`#00ffd0`}),(0,y.jsx)(`stop`,{offset:`100%`,stopColor:`#8a2be2`})]})}),(0,y.jsx)(`circle`,{cx:`22`,cy:`22`,r:`20`,fill:`none`,stroke:`url(#dzG)`,strokeWidth:`1.5`}),(0,y.jsx)(`path`,{d:`M22 12 L22 30 M14 20 L22 12 L30 20`,stroke:`url(#dzG)`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`})]})}),(0,y.jsxs)(`div`,{className:`dropzone-text`,children:[(0,y.jsx)(`div`,{className:`dz-title`,children:`Inhale your Kai Sigil`}),(0,y.jsxs)(`div`,{id:f,className:`dz-hint`,children:[`Breath-minted `,(0,y.jsx)(`strong`,{children:`Φkey`}),` only. Drag & drop.`]}),o&&!i&&!c?(0,y.jsxs)(`div`,{className:`dz-file`,children:[`Selected: `,o]}):null,i?(0,y.jsxs)(`div`,{className:`dz-progress`,children:[(0,y.jsx)(`div`,{className:`dz-spinner`}),(0,y.jsx)(`span`,{children:`Verifying…`})]}):null]}),(0,y.jsx)(`input`,{ref:t,type:`file`,accept:b,onChange:g,tabIndex:-1,"aria-hidden":!0,className:`dz-input`})]}),c?(0,y.jsx)(`div`,{id:p,className:`portal-error`,role:`alert`,"aria-live":`polite`,children:c}):null,(0,y.jsx)(`p`,{className:`portal-note`,children:`Your sigil is verified by breath. No drift. Only truth.`})]}),(0,y.jsx)(`span`,{className:`sr-only`,children:`Kai Realms sigil gate ready.`})]})},S=typeof window<`u`,C=11n,w=44n,T=36n;function E(e){let t=BigInt(a),n=BigInt(s),r=(e>t?e-t:0n)/n,i=r/C%w,o=r/(C*w)%T;return{pulseIndex:Number(r),stepIndex:Number(i),beatIndex:Number(o)}}function D(e){let t=BigInt(a),n=BigInt(s);return t+((e>t?e-t:0n)/n+1n)*n}function ee(e){let t=(0,d.useRef)(null),n=(0,d.useRef)(e);n.current=e,(0,d.useEffect)(()=>{if(!S)return;let e=null,r=!1,i=()=>{if(r)return;let a=c(),{pulseIndex:o,stepIndex:s,beatIndex:l}=E(a);o!==t.current&&(n.current.onPulse?.(o),o%Number(C)===0&&n.current.onStep?.(s),o%Number(C*w)===0&&n.current.onBeat?.(l),t.current=o);let u=D(a),d=u>a?u-a:0n,f=Number(d);e=window.setTimeout(i,f)};return i(),()=>{r=!0,e!==null&&window.clearTimeout(e)}},[])}var O={Root:`#FF0033`,Sacral:`#FF8000`,Solar:`#FFD700`,Heart:`#00FF99`,Throat:`#33CCFF`,ThirdEye:`#9933FF`,Crown:`#AA00FF`};function k(e,t,n,r,i){e.save(),e.translate(n,r);let{chakraDay:a,pulse:o}=t.meta,s=O[a]??`#00FFFF`;e.beginPath(),e.arc(0,0,i+4,0,Math.PI*2),e.fillStyle=s,e.shadowColor=s,e.shadowBlur=15,e.fill(),e.beginPath(),e.arc(0,0,i,0,Math.PI*2),e.fillStyle=`#000012`,e.fill();let c=i+o%11*1.5;e.beginPath(),e.arc(0,0,c,0,Math.PI*2),e.strokeStyle=`${s}AA`,e.lineWidth=1.5,e.stroke(),e.restore()}function A(e){return typeof e==`object`&&!!e}function j(e){if(typeof e==`bigint`)return e;if(typeof e==`number`&&Number.isFinite(e)&&Number.isSafeInteger(e))return BigInt(e);if(typeof e==`string`)try{return BigInt(e)}catch{return null}return null}var M=`kai:game:focus`,N=typeof window<`u`;function P(){if(!N||typeof BroadcastChannel>`u`)return null;try{return new BroadcastChannel(`kai-realms-game-focus`)}catch{return null}}function te(e){let t={id:e,ts:c()};if(N)try{window.dispatchEvent(new CustomEvent(M,{detail:t}))}catch{}let n=P();if(n)try{n.postMessage({type:M,detail:{id:t.id,ts:t.ts.toString()}})}catch{}finally{try{n.close()}catch{}}}function F(e){if(!A(e))return null;let t=e.id,n=j(e.ts);return typeof t!=`string`||n===null?null:{id:t,ts:n}}function ne(e){let t=t=>{let n=F(t?.detail);n&&e(n)};N&&window.addEventListener(M,t);let n=P(),r=t=>{let n=t?.data;if(!A(n)||n.type!==M)return;let r=F(n.detail);r&&e(r)};if(n)try{n.addEventListener(`message`,r)}catch{}return()=>{if(N&&window.removeEventListener(M,t),n)try{n.removeEventListener(`message`,r)}catch{}finally{try{n.close()}catch{}}}}function re(e){let[t,n]=(0,d.useState)(!1),r=(0,d.useRef)(0n);return(0,d.useEffect)(()=>ne(t=>{n(t.id!==e),r.current=t.ts}),[e]),{paused:t,takeFocus:(0,d.useCallback)(()=>{te(e),n(!1)},[e])}}var I=5236,L=.085,R=1,ie=60,ae=6.1,oe=5.6,se=.1,ce=1.6,le=10,ue=50,de=150,fe=10,pe=Math.floor(I*1.25),me=.145,he=2.618,ge=I,z=I,_e=1e3,ve=.12,B=44,ye=.618,be=.35,xe=3,Se=`600 12px ui-sans-serif,system-ui,-apple-system`,V={up:{x:0,y:-1},down:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0},none:{x:0,y:0}},H={up:`down`,down:`up`,left:`right`,right:`left`,none:`none`};function Ce(e,t,n){return e+(t-e)*n}function U(e,t){return(e-t+I)%I/I}function we(e){let t=Math.sin(Math.PI*e);return .78+.44*(t*t)}function Te(e){let t=e.toLowerCase();return t===`arrowup`||t===`w`?`up`:t===`arrowdown`||t===`s`?`down`:t===`arrowleft`||t===`a`?`left`:t===`arrowright`||t===`d`?`right`:`none`}function W(e,t,n){let r=Math.round(n),i=Math.round(t);return r<0||r>=e.length||i<0||i>=e[0].length?!1:e[r][i]!==1}function G(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function K(e,t){let n=e.x-t.x,r=e.y-t.y;return n*n+r*r}function Ee(){let e=Array.from({length:23},()=>Array(27).fill(1));((t,n,r,i)=>{for(let a=n;a0&&a<22&&n>0&&n<26&&(e[a][n]=0)})(1,1,25,21);for(let t=2;t<25;t++)e[5][t]=1,e[17][t]=1;for(let t=2;t<21;t++)e[t][4]=1,e[t][22]=1;for(let t=6;t<21;t++)e[11][t]=0;for(let t=4;t<19;t++)e[t][13]=0;for(let t=1;t<22;t++)for(let n=1;n<26;n++)e[t][n]===0&&(e[t][n]=2);for(let t of[{x:6,y:6},{x:20,y:6},{x:6,y:16},{x:20,y:16}])e[t.y][t.x]=3;for(let t of[{x:2,y:2},{x:24,y:2},{x:2,y:20},{x:24,y:20}])e[t.y]?.[t.x]!==1&&(e[t.y][t.x]=4);return e}function De(e){return{pos:{x:e.x,y:e.y},dir:`left`,next:`left`,speed:ae}}function q(e,t,n){return{pos:{x:e.x,y:e.y},dir:`left`,speed:oe,scatterTarget:n,mode:`chase`,frightUntil:0,color:t}}function Oe(e){let t=0;for(let n=0;n=.1||i>=.1)return!1;let a=0;return[`up`,`down`,`left`,`right`].forEach(t=>{W(e,n.x+V[t].x,n.y+V[t].y)&&a++}),a>=3}function Me(e,t){if(t.next===`none`||t.next===t.dir)return;if(t.next===H[t.dir]){t.dir=t.next;return}let n=G(t.pos),r=Math.abs(t.pos.x-n.x),i=Math.abs(t.pos.y-n.y);r>=.12||i>=.12||W(e,n.x+V[t.next].x,n.y+V[t.next].y)&&(t.pos.x=n.x,t.pos.y=n.y,t.dir=t.next)}function Ne(e,t,n,r,i){if(n===`none`)return;let a=V[n],o=t.x+a.x*r*i,s=t.y+a.y*r*i,c=e[0].length;if(o<-1){t.x=c+1;return}if(o>c+1){t.x=-1;return}if(W(e,Math.round(o),Math.round(s)))t.x=o,t.y=s;else{let e=G(t);t.x=e.x,t.y=e.y}}function Pe(e,t,n,r){let i=[`up`,`left`,`down`,`right`],a=n,o=1/0;for(let s of i){if(s===H[n])continue;let i=Math.round(t.x)+V[s].x,c=Math.round(t.y)+V[s].y;if(!W(e,i,c))continue;let l=K({x:i,y:c},r);l{let r=(0,d.useRef)(null),i=(0,d.useRef)(null),{paused:a,takeFocus:o}=re(`KaiMaze`),[s,c]=(0,d.useState)({w:0,h:0});(0,d.useEffect)(()=>{let e=r.current;if(!e)return;let t=new ResizeObserver(e=>{for(let t of e){let e=t.contentRect;c({w:e.width,h:e.height})}});return t.observe(e),()=>t.disconnect()},[]);let[l,u]=(0,d.useState)(e);(0,d.useEffect)(()=>u(e),[e]);let[f,p]=(0,d.useState)(()=>ke(1,performance.now())),m=(0,d.useRef)(performance.now()),[h,g]=(0,d.useState)(()=>{if(typeof window>`u`)return!1;let e=window.matchMedia?.(`(pointer: coarse)`)?.matches??!1,t=window.matchMedia?.(`(max-width: 900px)`)?.matches??!1;return e||t});(0,d.useEffect)(()=>{if(typeof window>`u`)return;let e=window.matchMedia(`(pointer: coarse)`),t=window.matchMedia(`(max-width: 900px)`),n=()=>g(e.matches||t.matches);return e.addEventListener?.(`change`,n),t.addEventListener?.(`change`,n),()=>{e.removeEventListener?.(`change`,n),t.removeEventListener?.(`change`,n)}},[]);let _=(0,d.useMemo)(()=>e=>Math.floor(_e*(1+ve*(e-1))),[]),v=(0,d.useMemo)(()=>h&&!f.over,[h,f.over]),b=(0,d.useMemo)(()=>(h?`Tap/Swipe or D-pad`:`←↑→↓ / WASD`)+` · B/Space to Channel on ⟐ · Esc to exit`,[h]);(0,d.useEffect)(()=>{if(R>0&&l>=R){let e=l-R;u(e),t(e),o()}},[]);let x=()=>{p(e=>e.channelingUntil?{...e,channelingUntil:0}:e)};(0,d.useEffect)(()=>{let e=e=>{let t=e.key.toLowerCase(),r=Te(t);r!==`none`&&(x(),e.preventDefault(),o(),p(e=>({...e,player:{...e.player,next:r}}))),(t===`b`||t===` `)&&f.onAltar&&f.channelingUntil===0&&(o(),p(e=>({...e,channelingUntil:performance.now()+z}))),t===`escape`&&n&&n(),t===`r`&&f.over&&(o(),p(ke(1,performance.now())),m.current=performance.now())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,f.over,f.onAltar,f.channelingUntil]);let S=e=>{x(),o(),p(t=>({...t,player:{...t.player,next:e}}))},C=()=>{f.onAltar&&f.channelingUntil===0&&(o(),p(e=>({...e,channelingUntil:performance.now()+z})))};(0,d.useEffect)(()=>{let e=0,n=performance.now(),r=(e,n)=>{if(n.channelingUntil===0||!n.onAltar||e0){let e=Math.floor(a*r),i=Math.max(0,n.bankable-e),o=l+a;return u(o),t(o),{...n,scorePhi:n.scorePhi+a,bankable:i,points:i,kaiCharge:Math.max(0,Math.floor(n.kaiCharge*.5)),channelingUntil:0}}return{...n,channelingUntil:0}},i=()=>{e=requestAnimationFrame(i);let o=performance.now(),s=Math.min(1/ie,(o-n)/1e3);n=o,!a&&p(e=>{if(e.over)return e;let n=structuredClone(e);if(o>=n.cycle.nextSwitchAt){let e=n.cycle.phase===`chase`?`scatter`:`chase`;n.cycle={phase:e,nextSwitchAt:o+Ae(n.level,e)};for(let t of n.ghosts)t.mode!==`fright`&&(t.mode=e)}let i=U(o,m.current),a=we(i),c=Math.min(1+n.streak*se,ce),d=Math.min(1+n.streak*me,he),f=n.channelingUntil>0?0:n.player.speed*a*c;Me(n.grid,n.player),Ne(n.grid,n.player.pos,n.player.dir,f,s);let p=G(n.player.pos);n.onAltar=n.grid[p.y]?.[p.x]===4;let h=n.grid[p.y]?.[p.x]??1;if((h===2||h===3)&&n.channelingUntil===0){let e=Math.abs(i-.5)<=L,t=h===2?le:ue;if(e&&(t+=fe,n.kaiCharge=Math.min(B,n.kaiCharge+1)),t=Math.floor(t*d),n.points+=t,n.bankable=n.points,n.streak+=1,n.streak>n.bestStreak&&(n.bestStreak=n.streak),n.comboUntil=o+pe,n.grid[p.y][p.x]=0,n.pellets=Math.max(0,n.pellets-1),h===3){m.current=o;let e=Math.max(ge*Math.max(.55,1-(n.level-1)*.08),I*.5);for(let t of n.ghosts)t.mode=`fright`,t.frightUntil=o+e}}n.comboUntil>0&&o>n.comboUntil&&(n.streak=Math.max(0,Math.floor(n.streak*.5)),n.comboUntil=0);for(let e of n.ghosts){e.mode===`fright`&&o>=e.frightUntil&&(e.mode=n.cycle.phase);let t=G(n.player.pos);if(je(n.grid,e.pos))if(e.mode===`scatter`)e.dir=Pe(n.grid,e.pos,e.dir,e.scatterTarget);else if(e.mode===`fright`){let r=G(e.pos),i=[`up`,`down`,`left`,`right`],a=e.dir,o=-1/0;for(let s of i){if(s===H[e.dir])continue;let i=r.x+V[s].x,c=r.y+V[s].y;if(!W(n.grid,i,c))continue;let l=K({x:i,y:c},t);l>o&&(o=l,a=s)}e.dir=a}else{let r={x:t.x+V[n.player.dir].x*2,y:t.y+V[n.player.dir].y*2};e.dir=Pe(n.grid,e.pos,e.dir,r)}let r=e.mode===`fright`?Ce(.6,.8,Math.sin(i*Math.PI)):a,c=e.speed*r;if(c*=1.06**(n.level-1),Ne(n.grid,e.pos,e.dir,c,s),K(n.player.pos,e.pos)<.4)if(e.mode===`fright`&&n.channelingUntil===0){let t=Math.floor(de*d);n.points+=t,n.bankable=n.points,n.streak+=1,n.streak>n.bestStreak&&(n.bestStreak=n.streak),n.comboUntil=o+pe,e.pos={...e.scatterTarget},e.dir=`left`,e.mode=`scatter`,e.frightUntil=0}else if(--n.lives,n.streak=0,n.comboUntil=0,n.points=Math.max(0,Math.floor(n.points*(1-be))),n.bankable=n.points,n.channelingUntil=0,n.lives<=0)n.alive=!1,n.over=!0;else{let e={x:Math.floor(n.grid[0].length/2),y:n.grid.length-4};n.player.pos={...e},n.player.dir=`left`,n.player.next=`left`;for(let e of n.ghosts)e.mode=`scatter`;m.current=o}}if(n.pellets<=0&&!n.over){let e=_(n.level),r=Math.floor(n.bankable*.2/e);if(r>0){let i=r*e,a=Math.max(0,n.bankable-i),o=l+r;u(o),t(o),n.scorePhi+=r,n.bankable=a,n.points=a}let i=ke(n.level+1,o);i.scorePhi=n.scorePhi,i.lives=Math.max(1,n.lives),i.bestStreak=Math.max(n.bestStreak,n.streak),i.player.speed=n.player.speed*1.06;for(let e of i.ghosts)e.speed*=1.06;return m.current=o,i}return n=r(o,n),n})};return e=requestAnimationFrame(i),()=>cancelAnimationFrame(e)},[t,l,a,_]),(0,d.useEffect)(()=>{let e=0,t=()=>{e=requestAnimationFrame(t);let n=i.current,o=r.current;if(!n||!o)return;let c=n.getContext(`2d`);if(!c)return;let u=Math.max(0,s.w),d=Math.max(0,s.h);if(u===0||d===0)return;let p=Math.min(2,window.devicePixelRatio||1);(n.width!==Math.floor(u*p)||n.height!==Math.floor(d*p))&&(n.width=Math.floor(u*p),n.height=Math.floor(d*p),n.style.width=`${u}px`,n.style.height=`${d}px`),c.setTransform(p,0,0,p,0,0);let h=f.grid.length,g=f.grid[0].length,_=Math.floor(Math.min(u/g,d/h)),v=_*g,y=_*h,b=Math.floor((u-v)/2),x=Math.floor((d-y)/2),S=c.createLinearGradient(0,0,0,d);S.addColorStop(0,`#07071a`),S.addColorStop(1,`#0c1231`),c.fillStyle=S,c.fillRect(0,0,u,d),Be(c,u,d);for(let e=0;e0&&f.onAltar){let e=1-Math.max(0,f.channelingUntil-w)/z,t=u/2;c.strokeStyle=`rgba(0,255,208,0.9)`,c.lineWidth=4,c.globalAlpha=.9,c.beginPath(),c.arc(t,34,16,-Math.PI/2,-Math.PI/2+e*Math.PI*2),c.stroke(),c.globalAlpha=1,c.font=`700 12px ui-sans-serif,system-ui,-apple-system`,c.fillText(`Channeling…`,t+16+8,38)}if(a&&!f.over){c.fillStyle=`rgba(0,0,0,0.35)`,c.fillRect(0,0,u,d),c.fillStyle=`#fff`,c.font=`700 16px ui-sans-serif,system-ui,-apple-system`;let e=`Paused — another Realm is active`;c.fillText(e,(u-c.measureText(e).width)/2,d/2)}if(f.over){c.fillStyle=`rgba(0,0,0,0.55)`,c.fillRect(0,0,u,d),c.fillStyle=`#fff`,c.font=`700 20px ui-sans-serif,system-ui,-apple-system`;let e=`Game Over — Press R to restart`;c.fillText(e,(u-c.measureText(e).width)/2,d/2)}};return e=requestAnimationFrame(t),()=>cancelAnimationFrame(e)},[f,l,s,a]);let w=f.onAltar&&f.channelingUntil===0;return(0,y.jsxs)(`div`,{className:`km-wrap`,role:`group`,"aria-label":`Kai-Maze`,onPointerDown:()=>o(),onTouchStart:()=>o(),onMouseDown:()=>o(),children:[(0,y.jsxs)(`div`,{className:`km-header`,children:[(0,y.jsx)(`div`,{className:`km-title`,children:`🌀 Kai-Maze`}),(0,y.jsx)(`div`,{className:`km-sub`,children:`Score on pulse, risk your points, then ⟐ channel to mint Φ.`})]}),(0,y.jsxs)(`div`,{className:`km-stage`,ref:r,children:[(0,y.jsx)(`canvas`,{ref:i,className:`km-canvas`}),v&&(0,y.jsxs)(`div`,{className:`km-dpad`,style:{position:`absolute`,left:12,bottom:12,width:132,height:132,display:`grid`,gridTemplateColumns:`repeat(3, 1fr)`,gridTemplateRows:`repeat(3, 1fr)`,gap:6,touchAction:`none`,userSelect:`none`,zIndex:4},"aria-label":`Directional pad`,children:[(0,y.jsx)(`div`,{}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:J,"aria-label":`Move up`,onPointerDown:e=>{e.preventDefault(),S(`up`)},children:`▲`}),(0,y.jsx)(`div`,{}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:J,"aria-label":`Move left`,onPointerDown:e=>{e.preventDefault(),S(`left`)},children:`◀`}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:{...J,opacity:.9},"aria-label":`Hold to Channel (if on altar)`,onPointerDown:e=>{e.preventDefault(),C()},title:`Channel one breath to convert points → Φ`,children:`⟐`}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:J,"aria-label":`Move right`,onPointerDown:e=>{e.preventDefault(),S(`right`)},children:`▶`}),(0,y.jsx)(`div`,{}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:J,"aria-label":`Move down`,onPointerDown:e=>{e.preventDefault(),S(`down`)},children:`▼`}),(0,y.jsx)(`div`,{})]}),w&&(0,y.jsx)(`button`,{className:`km-chan-btn`,onClick:()=>{o(),p(e=>e.channelingUntil?e:{...e,channelingUntil:performance.now()+z})},"aria-label":`Channel points into Phi`,title:`Channel one breath to convert points → Φ`,children:`⟐ CHANNEL`}),f.channelingUntil>0&&(0,y.jsx)(`button`,{className:`km-chan-cancel`,onClick:()=>{o(),p(e=>({...e,channelingUntil:0}))},"aria-label":`Cancel channeling`,title:`Cancel`,children:`Cancel`})]}),(0,y.jsxs)(`div`,{className:`km-footer`,children:[(0,y.jsx)(`button`,{className:`km-btn`,onClick:n,title:`Back`,children:`Back`}),(0,y.jsx)(`div`,{className:`km-hint`,children:b})]})]})};function Ie(e,t,n,r,i){e.save(),e.fillStyle=i,e.beginPath(),e.arc(t,n,r,0,Math.PI*2),e.fill(),e.strokeStyle=`rgba(255,255,255,0.35)`,e.lineWidth=1.25,e.stroke(),e.restore()}function Le(e,t,n,r,i){e.save(),e.fillStyle=i,e.beginPath(),e.arc(t,n,r,Math.PI,0),e.lineTo(t+r,n+r*.85),e.lineTo(t-r,n+r*.85),e.closePath(),e.fill(),e.fillStyle=`#fff`,e.beginPath(),e.arc(t-r*.35,n-r*.15,r*.16,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(t+r*.35,n-r*.15,r*.16,0,Math.PI*2),e.fill(),e.fillStyle=`rgba(0,0,0,0.7)`,e.beginPath(),e.arc(t-r*.3,n-r*.15,r*.08,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(t+r*.3,n-r*.15,r*.08,0,Math.PI*2),e.fill(),e.restore()}function Re(e,t,n){let r=Math.min(460,Math.max(220,t*.5)),i=t/2,a=r/2;e.save(),e.globalAlpha=.35,e.strokeStyle=`rgba(0,255,208,.6)`,e.lineWidth=2,e.beginPath(),e.moveTo(i-a,20),e.lineTo(i+a,20),e.stroke();let o=ze(r*L*2);e.globalAlpha=.2,e.fillStyle=`#ffd36e`,e.fillRect(i-o,17,o*2,6),e.globalAlpha=.9,e.fillStyle=`#00ffd0`;let s=i-a+n*r;e.beginPath(),e.arc(s,20,4,0,Math.PI*2),e.fill(),e.restore()}function ze(e){return e/2}function Be(e,t,n){e.save(),e.globalAlpha=.08,e.strokeStyle=`rgba(255,255,255,0.15)`,e.lineWidth=1;let r=t/2,i=n/2,a=(1+Math.sqrt(5))/2,o=4;for(let s=0;s<8;s++){let s=Math.min(t,n)/o;e.beginPath(),e.arc(r,i,s,-Math.PI/2,Math.PI),e.stroke(),o*=a}e.restore()}var J={background:`linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04))`,border:`1px solid rgba(255,255,255,0.25)`,borderRadius:10,color:`rgba(255,255,255,0.9)`,fontSize:18,lineHeight:1,padding:0,display:`flex`,alignItems:`center`,justifyContent:`center`,minWidth:36,minHeight:36,touchAction:`none`};(()=>{let e=Array.from({length:31},()=>Array.from({length:28},()=>2));for(let t=0;t<28;t++)e[0][t]=1,e[30][t]=1;for(let t=0;t<31;t++)e[t][0]=1,e[t][27]=1;for(let t=4;t<24;t+=6)for(let n=4;n<27;n+=6)e[n][t]=1,e[n][t+1]=1,e[n+1][t]=1,e[n+1][t+1]=1;for(let t=2;t<26;t++)e[15][t]=0;e[1][1]=3,e[1][26]=3,e[29][1]=3,e[29][26]=3;for(let t=2;t<29;t++)e[t][14]=0;for(let t=2;t<26;t++)e[11][t]=0;return e})();var Ve=5236,Y=3,He=Y*2,Ue=2,We=.15,Ge=220,Ke=60,qe=20;function Je(e){return(Math.imul(e^2654435769,2654435761)>>>0)%1e5/1e5}function Ye(e,t){let n=Math.abs(e-t)%360;return n>180&&(n=360-n),n}var Xe=({currentPhi:e,onPhiChange:t})=>{let[n,r]=(0,d.useState)(`forge`),[i,a]=(0,d.useState)(null),[o,s]=(0,d.useState)(performance.now()),[c,l]=(0,d.useState)(0),[u,f]=(0,d.useState)(!1),[p,m]=(0,d.useState)(null),[h,g]=(0,d.useState)(0);ee({onPulse:e=>{a(e),s(performance.now()),m(e=>e&&{...e,delta:e.delta})}}),(0,d.useEffect)(()=>{if(n!==`forge`)return;let e=0,t=!0,r=()=>{if(!t)return;let n=performance.now();l(Math.max(0,n-o)%Ve/Ve*360%360),e=requestAnimationFrame(r)};return e=requestAnimationFrame(r),()=>{t=!1,cancelAnimationFrame(e)}},[o,n]);let _=(0,d.useMemo)(()=>{let e=i??0,t=Math.floor(Je(e)*360),n=Ke+(e%2==0?qe:0)-Math.min(20,Math.floor(h*6));return{centerDeg:t,halfWidthDeg:Math.max(10,n/2)}},[i,h]),v=(0,d.useMemo)(()=>n===`forge`&&!u&&e>=Y&&i!==null,[n,u,e,i]),b=(0,d.useCallback)(e=>{let t=He,n=1+h*We,r=e?Ue:1;return Math.floor(t*n*r)},[h]),x=(0,d.useCallback)(()=>{if(!v)return;let n=e-Y;t(n),f(!0),m(null);let r=Ye(c,_.centerDeg),i=Math.max(4,_.halfWidthDeg*.25),a=r<=_.halfWidthDeg,o=a&&r<=i;window.setTimeout(()=>{if(a){let e=b(o);t(n+e),g(e=>e+1),m({kind:o?`crit`:`hit`,delta:e})}else g(0),m({kind:`miss`,delta:-Y});f(!1)},650)},[v,e,t,c,_.centerDeg,_.halfWidthDeg,b]);return(0,d.useEffect)(()=>{if(n!==`forge`)return;let e=e=>{let t=e.key.toLowerCase();(t===` `||t===`enter`)&&(e.preventDefault(),x())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,x]),(0,y.jsx)(`div`,{className:`pf-wrap`,role:`group`,"aria-label":`Pulse Forge`,children:n===`forge`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`pf-header`,children:[(0,y.jsx)(`div`,{className:`pf-title`,children:`⚒️ Pulse Forge`}),(0,y.jsx)(`div`,{className:`pf-sub`,children:`Time your lock to the target arc. Breathe, focus, forge.`}),(0,y.jsx)(`div`,{style:{marginLeft:`auto`,display:`flex`,gap:8},children:(0,y.jsx)(`button`,{type:`button`,className:`pf-lock-btn`,onClick:()=>r(`maze`),title:`Switch to Kai-Maze`,children:`Play Kai-Maze`})})]}),(0,y.jsxs)(`div`,{className:`pf-board`,children:[(0,y.jsxs)(`div`,{className:`pf-dial`,style:{width:Ge,height:Ge},children:[(0,y.jsx)(`div`,{className:`pf-arc`,style:{"--arc-center":`${_.centerDeg}deg`,"--arc-half":`${_.halfWidthDeg}deg`},"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`pf-marker ${u?`pf-marker--lock`:``}`,style:{transform:`rotate(${c}deg)`},"aria-hidden":!0,children:(0,y.jsx)(`div`,{className:`pf-marker-head`})}),(0,y.jsx)(`div`,{className:`pf-rim`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`pf-ticks`,"aria-hidden":!0,children:Array.from({length:12}).map((e,t)=>(0,y.jsx)(`span`,{style:{transform:`rotate(${t*30}deg)`}},t))})]}),(0,y.jsxs)(`div`,{className:`pf-hud`,children:[(0,y.jsxs)(`div`,{className:`pf-chip`,title:`Your Φ`,children:[(0,y.jsx)(`span`,{className:`pf-chip__label`,children:`Φ`}),(0,y.jsx)(`span`,{className:`pf-chip__val`,children:e})]}),(0,y.jsxs)(`div`,{className:`pf-chip`,title:`Streak`,children:[(0,y.jsx)(`span`,{className:`pf-chip__label`,children:`Streak`}),(0,y.jsx)(`span`,{className:`pf-chip__val`,children:h})]}),(0,y.jsxs)(`div`,{className:`pf-chip`,title:`Pulse`,children:[(0,y.jsx)(`span`,{className:`pf-chip__label`,children:`Pulse`}),(0,y.jsx)(`span`,{className:`pf-chip__val`,children:i??`—`})]})]})]}),(0,y.jsxs)(`div`,{className:`pf-cta`,children:[(0,y.jsx)(`button`,{className:`pf-lock-btn`,onClick:x,disabled:!v,"aria-disabled":!v,title:v?`Press Space/Enter to Lock`:`Insufficient Φ or syncing…`,children:u?`Locking…`:`Lock (−${Y} Φ)`}),(0,y.jsxs)(`div`,{className:`pf-hint`,children:[`Press `,(0,y.jsx)(`kbd`,{children:`Space`}),` or `,(0,y.jsx)(`kbd`,{children:`Enter`}),` at the right moment. Even pulses widen the target.`]})]}),p&&(0,y.jsxs)(`div`,{className:`pf-result pf-result--${p.kind}`,role:`status`,"aria-live":`polite`,children:[p.kind===`hit`&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:`pf-result__emoji`,children:`✅`}),(0,y.jsxs)(`span`,{className:`pf-result__text`,children:[`Resonant lock! +`,p.delta,` Φ`]})]}),p.kind===`crit`&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:`pf-result__emoji`,children:`💥`}),(0,y.jsxs)(`span`,{className:`pf-result__text`,children:[`Perfect lock! +`,p.delta,` Φ`]})]}),p.kind===`miss`&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:`pf-result__emoji`,children:`❌`}),(0,y.jsx)(`span`,{className:`pf-result__text`,children:`Miss — breathe again.`})]})]})]}):(0,y.jsx)(Fe,{currentPhi:e,onPhiChange:t,onExit:()=>r(`forge`)})})};function Ze(){return`kai-${Math.random().toString(36).slice(2,8)}`}function Qe(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.x==`number`&&typeof t.pulseIndex==`number`&&typeof t.chakraDay==`string`&&typeof t.glyph==`object`&&t.glyph!==null}var $e=null;async function et(){return $e||($e=(await r(()=>import(`./bundler-DKFgLeD8.js`),__vite__mapDeps([0,1,2]))).default,$e)}function tt(e){let[t]=(0,d.useState)(()=>e??Ze()),[n,r]=(0,d.useState)([]),[i,a]=(0,d.useState)([]),o=(0,d.useRef)(null),s=(0,d.useRef)({}),c=(0,d.useCallback)((e,t)=>{if(!Qe(t))return;let n={...t,id:e,glyph:t.glyph};a(t=>{let r=t.findIndex(t=>t.id===e);if(r>=0){let e=[...t];return e[r]=n,e}return[...t,n]})},[]),l=(0,d.useCallback)((e,t)=>{Qe(e)&&c(t,e)},[c]);return(0,d.useEffect)(()=>{let e=!1;return(async()=>{let n=await et();if(e)return;let i=new n(t);o.current=i,i.on(`open`,()=>{r(e=>e)}),i.on(`connection`,e=>{s.current[e.peer]=e,r(t=>Array.from(new Set([...t,e.peer]))),e.on(`data`,t=>{l(t,e.peer)}),e.on(`close`,()=>{delete s.current[e.peer],r(t=>t.filter(t=>t!==e.peer)),a(t=>t.filter(t=>t.id!==e.peer))})})})().catch(e=>{console.error(`[KaiRealms] Peer init failed:`,e)}),()=>{e=!0;try{o.current?.destroy()}catch(e){console.warn(`[KaiRealms] Peer destroy failed:`,e)}o.current=null,s.current={},r([]),a([])}},[t,l]),{sessionId:t,peers:n,sendState:(0,d.useCallback)(e=>{let t=Object.values(s.current);for(let n of t)n.open&&n.send(e)},[]),remoteStates:i}}var nt=800,rt=500,it=nt/rt,X=28,Z=10,at=360,ot=10,Q=5236,st=.08,ct=22,lt=90,ut=80,dt=2,ft=4,pt=10,mt=3,ht=1,gt=3,_t=1,vt=1,$=(e,t,n)=>en?n:e,yt=({glyphData:e,onExit:t})=>{let n=(0,d.useRef)(null),r=(0,d.useRef)(null),i=(0,d.useRef)(null),[a,o]=(0,d.useState)({w:nt,h:rt}),s=(0,d.useRef)(a);(0,d.useEffect)(()=>{s.current=a},[a]);let[c,l]=(0,d.useState)(0),[u,f]=(0,d.useState)(0),[p,m]=(0,d.useState)(!1),[h,g]=(0,d.useState)(mt),[_,v]=(0,d.useState)(0),[b,x]=(0,d.useState)(0),[S,C]=(0,d.useState)(!1),w=(0,d.useRef)(performance.now()),{sendState:T,remoteStates:E}=tt(),D=(0,d.useRef)([]);(0,d.useEffect)(()=>{D.current=E??[]},[E]);let O=(0,d.useRef)(nt/2),k=(0,d.useRef)([]),A=(0,d.useRef)({}),j=(0,d.useRef)(null),M=(0,d.useRef)(null),N=(0,d.useRef)(null),P=(0,d.useRef)(0),te=(0,d.useRef)(0),F=(0,d.useRef)(null);(0,d.useEffect)(()=>{let e=n.current;if(!e)return;let t=new ResizeObserver(e=>{let t=e[0].contentRect,n=Math.max(320,Math.min(960,t.width));o({w:n,h:Math.round(n/it)})});return t.observe(e),()=>t.disconnect()},[]),(0,d.useEffect)(()=>{let e=r.current;if(!e)return;let t=e.getContext(`2d`);if(!t)return;let n=Math.min(2,window.devicePixelRatio||1);e.style.width=`${a.w}px`,e.style.height=`${a.h}px`,e.width=Math.floor(a.w*n),e.height=Math.floor(a.h*n),t.setTransform(n,0,0,n,0,0),i.current=t,O.current=$(O.current,X,a.w-X)},[a]),(0,d.useEffect)(()=>{let e=e=>{A.current[e.key]=!0,e.key.toLowerCase()===`p`&&m(e=>!e),e.key.toLowerCase()===`r`&&S&&R()},t=e=>{A.current[e.key]=!1};return window.addEventListener(`keydown`,e),window.addEventListener(`keyup`,t),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`keyup`,t)}},[S]),(0,d.useEffect)(()=>{let e=r.current;if(!e)return;let t=t=>{let n=e.getBoundingClientRect();return $((t-n.left)/n.width*s.current.w,X,s.current.w-X)},n=!1,i=e=>{n=!0,O.current=t(e.clientX)},a=e=>{n&&(O.current=t(e.clientX))},o=()=>{n=!1};return e.addEventListener(`pointerdown`,i),e.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o),()=>{e.removeEventListener(`pointerdown`,i),e.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o)}},[]);let ne=e=>Math.max(0,e-w.current)%Q/Q,re=e=>{let t=Math.sin(Math.PI*e);return .65+.7*(t*t)},I=e=>{let{w:t}=s.current,n=performance.now(),r=Math.random()*(t-2*Z)+Z,i=-Z*2,a=(Math.random()-.5)*40,o=(e===`gold`?ut:lt)+_*(pt*.2),c={id:`${e}-${n}-${Math.floor(Math.random()*1e6)}`,x:r,y:i,vx:a,baseVy:o,kind:e,bornAt:n},l=k.current.slice(-(ct-1));l.push(c),k.current=l};ee({onPulse:e=>{f(e),w.current=performance.now(),te.current+=1;for(let e=0;e{let n=N.current,r=O.current,i=u;if(!n||Math.abs(n.x-r)>=1||n.pulseIndex!==i||t-P.current>1e3/ot){N.current={x:r,pulseIndex:i},P.current=t;try{T({id:`you`,x:r,pulseIndex:i,chakraDay:e.meta.chakraDay,glyph:e})}catch{}}};(0,d.useEffect)(()=>{let t=r.current,n=i.current;if(!t||!n)return;let a=!0,o=t=>{if(!a)return;j.current=requestAnimationFrame(o);let r=M.current??t,i=Math.min(.05,(t-r)/1e3);M.current=t;let{w:c,h:u}=s.current,d=u-X-10;if(!p&&!S){let e=A.current,n=!!(e.ArrowLeft||e.a||e.A),r=!!(e.ArrowRight||e.d||e.D);n&&(O.current=$(O.current-at*i,X,c-X)),r&&(O.current=$(O.current+at*i,X,c-X));let a=O.current,o=performance.now(),s=ne(o),f=re(s),p=[],m=0,h=0,y=0;for(let e=0;ec-Z&&(t.x=c-Z,t.vx=-Math.abs(t.vx)*.9);let r=t.x-a,l=t.y-d;if(Math.hypot(r,l)u+Z){y+=1;continue}p.push(t)}if(m>0||h>0){let e=m+h;l(t=>t+e),v(e=>{let t=e+1;return x(e=>t>e?t:e),t})}y>0&&(l(e=>Math.max(0,e-ht*y)),v(0),g(e=>{let t=Math.max(0,e-y);return t===0&&C(!0),t})),k.current=p,L(t)}bt(n,e,O.current,d,p||S,k.current,D.current,s.current,w.current,F.current)};return j.current=requestAnimationFrame(o),()=>{a=!1,j.current!==null&&cancelAnimationFrame(j.current),j.current=null,M.current=null}},[e,p,S,a.w,a.h]);let R=()=>{k.current=[],g(mt),v(0),x(e=>e),C(!1)},ie=(0,d.useMemo)(()=>({pulse:u,chakraDay:e?.meta?.chakraDay??`—`}),[u,e?.meta?.chakraDay]);return(0,y.jsxs)(`div`,{className:`realm-wrap`,ref:n,children:[(0,y.jsxs)(`div`,{className:`realm-hud`,children:[(0,y.jsxs)(`div`,{className:`hud-chip hud-chip--score`,title:`Banked Φ`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Φ`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:c})]}),(0,y.jsxs)(`div`,{className:`hud-chip`,title:`Streak`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Streak`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:_})]}),(0,y.jsxs)(`div`,{className:`hud-chip`,title:`Lives`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Lives`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:h})]}),(0,y.jsxs)(`div`,{className:`hud-chip`,title:`Current Pulse`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Pulse`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:ie.pulse})]}),(0,y.jsxs)(`div`,{className:`hud-chip`,title:`Chakra Day`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Day`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:ie.chakraDay})]}),(0,y.jsx)(`button`,{className:`hud-button`,onClick:()=>m(e=>!e),"aria-pressed":p,title:`Pause (P)`,children:p?`Resume`:`Pause`})]}),(0,y.jsxs)(`div`,{className:`realm-canvas-wrap`,children:[(0,y.jsx)(`canvas`,{ref:r,className:`realm-canvas`,"aria-label":`Kai Realms Canvas`}),(p||S)&&(0,y.jsx)(`div`,{className:`realm-pause-overlay`,"aria-hidden":!0,children:(0,y.jsxs)(`div`,{className:`pause-card`,children:[(0,y.jsx)(`div`,{className:`pause-title`,children:S?`Game Over`:`Paused`}),(0,y.jsx)(`div`,{className:`pause-sub`,children:S?(0,y.jsxs)(y.Fragment,{children:[`Best Streak: `,(0,y.jsx)(`strong`,{children:b}),` — Press `,(0,y.jsx)(`kbd`,{children:`R`}),` to Restart`]}):(0,y.jsxs)(y.Fragment,{children:[`Press `,(0,y.jsx)(`kbd`,{children:`P`}),` or click Resume`]})}),S&&(0,y.jsx)(`button`,{className:`hud-button`,onClick:R,style:{marginTop:12},children:`Restart`})]})})]}),(0,y.jsx)(Xe,{currentPhi:c,onPhiChange:e=>l(e)}),(0,y.jsx)(`button`,{className:`exit-button`,onClick:t,children:`Exit Realm`})]})};function bt(e,t,n,r,i,a,o,s,c,l){let{w:u,h:d}=s,f=e.createLinearGradient(0,0,0,d);f.addColorStop(0,`#020211`),f.addColorStop(1,`#0b0f2a`),e.fillStyle=f,e.fillRect(0,0,u,d),e.save(),e.globalAlpha=.12;for(let t=0;t<40;t++){let n=t*197%u+t%3,r=t*127%d+t*11%7;e.fillStyle=`white`,e.fillRect(n,r,2,2)}e.restore(),xt(e,u,Math.max(36,Math.round(d*.06)),c);for(let t=0;t{let[n,r]=(0,d.useState)(null),i=(0,d.useRef)(null),a=(0,d.useRef)(null),o=(0,d.useCallback)(e=>r(e),[]),s=(0,d.useCallback)(()=>{r(null),t?.()},[t]);(0,d.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t?.()};return document.addEventListener(`keydown`,e),a.current?.focus(),()=>document.removeEventListener(`keydown`,e)},[t]),(0,d.useEffect)(()=>{let e=i.current;if(!e)return;let t=e=>e.stopPropagation();return e.addEventListener(`wheel`,t,{passive:!0}),()=>e.removeEventListener(`wheel`,t)},[]);let c=()=>t?.(),l=e=>e.stopPropagation();return(0,y.jsxs)(`div`,{className:`realms-backdrop realms-veil`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`kai-realms-title`,onMouseDown:c,children:[(0,y.jsx)(`div`,{className:`realms-stars`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`realms-halo realms-halo--1`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`realms-halo realms-halo--2`,"aria-hidden":!0}),(0,y.jsxs)(`div`,{ref:i,className:`realms-container glass-omni`,onMouseDown:l,role:`document`,children:[(0,y.jsx)(`div`,{className:`breath-ring breath-ring--outer`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`breath-ring breath-ring--inner`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`phi-grid`,"aria-hidden":!0}),(0,y.jsxs)(`header`,{className:`realms-header`,children:[(0,y.jsx)(`button`,{ref:a,type:`button`,className:`realms-close auric-btn`,"aria-label":`Close Kai Realms`,onClick:e=>{e.stopPropagation(),t?.()},onMouseDown:e=>e.stopPropagation(),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),t?.())},children:(0,y.jsx)(e,{size:20,"aria-hidden":!0})}),(0,y.jsx)(`div`,{className:`header-seals`,"aria-hidden":!0,children:(0,y.jsxs)(`div`,{className:`seal-emblem`,children:[(0,y.jsx)(`div`,{className:`seal-ring`}),(0,y.jsx)(`div`,{className:`seal-ring seal-ring--inner`}),(0,y.jsx)(`div`,{className:`seal-core`})]})}),(0,y.jsx)(`h2`,{id:`kai-realms-title`,className:`sr-only`,children:`Kai Realms — Sigil Gate`})]}),(0,y.jsx)(`main`,{className:`realms-body`,children:n?(0,y.jsx)(`div`,{className:`realm-stage`,children:(0,y.jsx)(yt,{glyphData:n,onExit:s})}):(0,y.jsx)(`div`,{className:`portal-stage`,children:(0,y.jsx)(x,{onEnter:o})})}),(0,y.jsx)(`footer`,{className:`realms-footer`,"aria-hidden":!0,children:(0,y.jsx)(`div`,{className:`footer-center`,style:{margin:`0 auto`},children:(0,y.jsx)(wt,{})})})]})]})};function wt(){return(0,y.jsxs)(`svg`,{className:`seal-coin`,width:`56`,height:`56`,viewBox:`0 0 56 56`,"aria-hidden":!0,children:[(0,y.jsxs)(`defs`,{children:[(0,y.jsxs)(`radialGradient`,{id:`coinGlowRealms`,cx:`50%`,cy:`50%`,r:`50%`,children:[(0,y.jsx)(`stop`,{offset:`0%`,stopColor:`#ffffff`,stopOpacity:`0.9`}),(0,y.jsx)(`stop`,{offset:`40%`,stopColor:`#ffd86b`,stopOpacity:`0.75`}),(0,y.jsx)(`stop`,{offset:`100%`,stopColor:`#ffd86b`,stopOpacity:`0.15`})]}),(0,y.jsxs)(`linearGradient`,{id:`coinEdgeRealms`,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,y.jsx)(`stop`,{offset:`0%`,stopColor:`#00ffd0`,stopOpacity:`0.8`}),(0,y.jsx)(`stop`,{offset:`100%`,stopColor:`#8a2be2`,stopOpacity:`0.8`})]})]}),(0,y.jsx)(`circle`,{cx:`28`,cy:`28`,r:`26`,fill:`url(#coinGlowRealms)`,stroke:`url(#coinEdgeRealms)`,strokeWidth:`1.5`}),(0,y.jsxs)(`g`,{className:`seal-coin__rotor`,children:[(0,y.jsx)(`circle`,{cx:`28`,cy:`28`,r:`18`,fill:`none`,stroke:`url(#coinEdgeRealms)`,strokeWidth:`1.25`}),(0,y.jsxs)(`g`,{stroke:`rgba(255,255,255,0.35)`,strokeWidth:`0.6`,children:[(0,y.jsx)(`line`,{x1:`28`,y1:`10`,x2:`28`,y2:`46`}),(0,y.jsx)(`line`,{x1:`10`,y1:`28`,x2:`46`,y2:`28`}),(0,y.jsx)(`line`,{x1:`15`,y1:`15`,x2:`41`,y2:`41`}),(0,y.jsx)(`line`,{x1:`41`,y1:`15`,x2:`15`,y2:`41`})]})]}),(0,y.jsx)(`circle`,{className:`seal-coin__core`,cx:`28`,cy:`28`,r:`6.5`})]})}export{Ct as default}; \ No newline at end of file +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/bundler-H_464dRi.js","assets/index-CcPm2yTY.js","assets/index-BmaJNTKf.css"])))=>i.map(i=>d[i]); +import{t as e}from"./x-B0A9hqeh.js";import{Bt as t,Ht as n,Sn as r,Tn as i,an as a,jn as o,ln as s,mn as c,t as l,tn as u}from"./index-CcPm2yTY.js";var d=o(i(),1);function f(e){return typeof e==`string`?e.toLowerCase():``}function p(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function m(e){return typeof e==`string`&&e.length>0}function h(e){return typeof e==`number`&&Number.isFinite(e)}function g(e){if(typeof e!=`object`||!e)throw Error(`Malformed sigil metadata.`);let t=e;for(let e of[`pulse`,`beat`,`stepIndex`,`chakraDay`])if(!p(t,e))throw Error(`Missing Kai field: ${e}`);if(!p(t,`kaiSignature`))throw Error(`Invalid Kai Signature — tampered or unsigned sigil.`);if(!h(t.pulse))throw Error(`Invalid field: pulse`);if(!h(t.beat))throw Error(`Invalid field: beat`);if(!h(t.stepIndex))throw Error(`Invalid field: stepIndex`);if(!m(t.chakraDay))throw Error(`Invalid field: chakraDay`);if(!m(t.kaiSignature))throw Error(`Invalid field: kaiSignature`)}function _(e){try{let t=new DOMParser().parseFromString(e,`image/svg+xml`),n=Array.from(t.getElementsByTagName(`metadata`)),r=[`valuation`,`ledger`,`dht`,`source`];for(let e of n){let t=e.getAttribute(`id`)??``;if(r.some(e=>t.includes(e)))continue;let n=(e.textContent??``).trim();if(!n)continue;let i=n.replace(/^$/,``);try{let e=JSON.parse(i);if(typeof e==`object`&&e&&p(e,`pulse`)&&p(e,`beat`)&&p(e,`stepIndex`)&&p(e,`chakraDay`)&&p(e,`kaiSignature`))return e}catch{}}return null}catch{return null}}async function v(e){let r=await e.text(),{meta:i,contextOk:a,typeOk:o}=await l(e),s=i&&p(i,`kaiSignature`)&&p(i,`pulse`)?i:_(r);if(!s||!a||!o)throw Error(`Invalid glyph or missing metadata.`);g(s);let c=s,u=await t(c);if(!u||f(u)!==f(c.kaiSignature))throw Error(`Invalid Kai Signature — tampered or unsigned sigil.`);let d=await n(c.kaiSignature);if(typeof c.userPhiKey==`string`){if(f(c.userPhiKey)!==f(d))throw Error(`Φ-Key mismatch — identity invalid.`)}else c.userPhiKey=d;return{svgText:r,meta:c,phiKey:d}}var y=o(u(),1),b=`.svg,image/svg+xml`,x=({onEnter:e})=>{let t=(0,d.useRef)(null),[n,r]=(0,d.useState)(!1),[i,a]=(0,d.useState)(!1),[o,s]=(0,d.useState)(``),[c,l]=(0,d.useState)(null),u=(0,d.useId)(),f=(0,d.useId)(),p=(0,d.useId)(),m=()=>{t.current&&(t.current.value=``)},h=(0,d.useCallback)(async t=>{l(null),s(t.name),a(!0);try{if(!(t.type===`image/svg+xml`||t.name.toLowerCase().endsWith(`.svg`)))throw Error(`Please upload a valid Kai Sigil (.svg).`);e(await v(t))}catch(e){l(e instanceof Error?e.message:`Invalid glyph or missing metadata.`)}finally{a(!1),m()}},[e]),g=(0,d.useCallback)(async e=>{let t=e.target.files?.[0];t&&await h(t)},[h]),_=(0,d.useCallback)(async e=>{e.preventDefault(),e.stopPropagation(),r(!1);let t=e.dataTransfer.files?.[0];t&&await h(t)},[h]),x=e=>{e.preventDefault(),e.dataTransfer.dropEffect=`copy`,n||r(!0)},S=e=>{e.currentTarget.contains(e.relatedTarget)||r(!1)},C=()=>t.current?.click(),w=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),C())};return(0,y.jsxs)(`section`,{className:`portal-card glass-omni`,"aria-labelledby":u,"aria-describedby":f,children:[(0,y.jsx)(`div`,{className:`breath-ring breath-ring--outer`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`breath-ring breath-ring--inner`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`phi-grid`,"aria-hidden":!0}),(0,y.jsx)(`h1`,{id:u,className:`sr-only`,children:`Drop your Kai Sigil`}),(0,y.jsxs)(`div`,{className:`portal-body`,children:[(0,y.jsxs)(`div`,{className:`dropzone ${n?`dropzone--active`:``} ${i?`dropzone--busy`:``}`,role:`button`,tabIndex:0,onKeyDown:w,onClick:C,onDrop:_,onDragOver:x,onDragLeave:S,"aria-busy":i,"aria-describedby":`${f}${c?` ${p}`:``}`,children:[(0,y.jsxs)(`div`,{className:`dropzone-ornament`,"aria-hidden":!0,children:[(0,y.jsx)(`div`,{className:`ornament-ring ornament-ring--outer`}),(0,y.jsx)(`div`,{className:`ornament-ring ornament-ring--inner`}),(0,y.jsx)(`div`,{className:`ornament-core`})]}),(0,y.jsx)(`div`,{className:`dropzone-icon`,"aria-hidden":!0,children:(0,y.jsxs)(`svg`,{width:`44`,height:`44`,viewBox:`0 0 44 44`,children:[(0,y.jsx)(`defs`,{children:(0,y.jsxs)(`linearGradient`,{id:`dzG`,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,y.jsx)(`stop`,{offset:`0%`,stopColor:`#00ffd0`}),(0,y.jsx)(`stop`,{offset:`100%`,stopColor:`#8a2be2`})]})}),(0,y.jsx)(`circle`,{cx:`22`,cy:`22`,r:`20`,fill:`none`,stroke:`url(#dzG)`,strokeWidth:`1.5`}),(0,y.jsx)(`path`,{d:`M22 12 L22 30 M14 20 L22 12 L30 20`,stroke:`url(#dzG)`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`})]})}),(0,y.jsxs)(`div`,{className:`dropzone-text`,children:[(0,y.jsx)(`div`,{className:`dz-title`,children:`Inhale your Kai Sigil`}),(0,y.jsxs)(`div`,{id:f,className:`dz-hint`,children:[`Breath-minted `,(0,y.jsx)(`strong`,{children:`Φkey`}),` only. Drag & drop.`]}),o&&!i&&!c?(0,y.jsxs)(`div`,{className:`dz-file`,children:[`Selected: `,o]}):null,i?(0,y.jsxs)(`div`,{className:`dz-progress`,children:[(0,y.jsx)(`div`,{className:`dz-spinner`}),(0,y.jsx)(`span`,{children:`Verifying…`})]}):null]}),(0,y.jsx)(`input`,{ref:t,type:`file`,accept:b,onChange:g,tabIndex:-1,"aria-hidden":!0,className:`dz-input`})]}),c?(0,y.jsx)(`div`,{id:p,className:`portal-error`,role:`alert`,"aria-live":`polite`,children:c}):null,(0,y.jsx)(`p`,{className:`portal-note`,children:`Your sigil is verified by breath. No drift. Only truth.`})]}),(0,y.jsx)(`span`,{className:`sr-only`,children:`Kai Realms sigil gate ready.`})]})},S=typeof window<`u`,C=11n,w=44n,T=36n;function E(e){let t=BigInt(a),n=BigInt(s),r=(e>t?e-t:0n)/n,i=r/C%w,o=r/(C*w)%T;return{pulseIndex:Number(r),stepIndex:Number(i),beatIndex:Number(o)}}function D(e){let t=BigInt(a),n=BigInt(s);return t+((e>t?e-t:0n)/n+1n)*n}function ee(e){let t=(0,d.useRef)(null),n=(0,d.useRef)(e);n.current=e,(0,d.useEffect)(()=>{if(!S)return;let e=null,r=!1,i=()=>{if(r)return;let a=c(),{pulseIndex:o,stepIndex:s,beatIndex:l}=E(a);o!==t.current&&(n.current.onPulse?.(o),o%Number(C)===0&&n.current.onStep?.(s),o%Number(C*w)===0&&n.current.onBeat?.(l),t.current=o);let u=D(a),d=u>a?u-a:0n,f=Number(d);e=window.setTimeout(i,f)};return i(),()=>{r=!0,e!==null&&window.clearTimeout(e)}},[])}var O={Root:`#FF0033`,Sacral:`#FF8000`,Solar:`#FFD700`,Heart:`#00FF99`,Throat:`#33CCFF`,ThirdEye:`#9933FF`,Crown:`#AA00FF`};function k(e,t,n,r,i){e.save(),e.translate(n,r);let{chakraDay:a,pulse:o}=t.meta,s=O[a]??`#00FFFF`;e.beginPath(),e.arc(0,0,i+4,0,Math.PI*2),e.fillStyle=s,e.shadowColor=s,e.shadowBlur=15,e.fill(),e.beginPath(),e.arc(0,0,i,0,Math.PI*2),e.fillStyle=`#000012`,e.fill();let c=i+o%11*1.5;e.beginPath(),e.arc(0,0,c,0,Math.PI*2),e.strokeStyle=`${s}AA`,e.lineWidth=1.5,e.stroke(),e.restore()}function A(e){return typeof e==`object`&&!!e}function j(e){if(typeof e==`bigint`)return e;if(typeof e==`number`&&Number.isFinite(e)&&Number.isSafeInteger(e))return BigInt(e);if(typeof e==`string`)try{return BigInt(e)}catch{return null}return null}var M=`kai:game:focus`,N=typeof window<`u`;function P(){if(!N||typeof BroadcastChannel>`u`)return null;try{return new BroadcastChannel(`kai-realms-game-focus`)}catch{return null}}function te(e){let t={id:e,ts:c()};if(N)try{window.dispatchEvent(new CustomEvent(M,{detail:t}))}catch{}let n=P();if(n)try{n.postMessage({type:M,detail:{id:t.id,ts:t.ts.toString()}})}catch{}finally{try{n.close()}catch{}}}function F(e){if(!A(e))return null;let t=e.id,n=j(e.ts);return typeof t!=`string`||n===null?null:{id:t,ts:n}}function ne(e){let t=t=>{let n=F(t?.detail);n&&e(n)};N&&window.addEventListener(M,t);let n=P(),r=t=>{let n=t?.data;if(!A(n)||n.type!==M)return;let r=F(n.detail);r&&e(r)};if(n)try{n.addEventListener(`message`,r)}catch{}return()=>{if(N&&window.removeEventListener(M,t),n)try{n.removeEventListener(`message`,r)}catch{}finally{try{n.close()}catch{}}}}function re(e){let[t,n]=(0,d.useState)(!1),r=(0,d.useRef)(0n);return(0,d.useEffect)(()=>ne(t=>{n(t.id!==e),r.current=t.ts}),[e]),{paused:t,takeFocus:(0,d.useCallback)(()=>{te(e),n(!1)},[e])}}var I=5236,L=.085,R=1,ie=60,ae=6.1,oe=5.6,se=.1,ce=1.6,le=10,ue=50,de=150,fe=10,pe=Math.floor(I*1.25),me=.145,he=2.618,ge=I,z=I,_e=1e3,ve=.12,B=44,ye=.618,be=.35,xe=3,Se=`600 12px ui-sans-serif,system-ui,-apple-system`,V={up:{x:0,y:-1},down:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0},none:{x:0,y:0}},H={up:`down`,down:`up`,left:`right`,right:`left`,none:`none`};function Ce(e,t,n){return e+(t-e)*n}function U(e,t){return(e-t+I)%I/I}function we(e){let t=Math.sin(Math.PI*e);return .78+.44*(t*t)}function Te(e){let t=e.toLowerCase();return t===`arrowup`||t===`w`?`up`:t===`arrowdown`||t===`s`?`down`:t===`arrowleft`||t===`a`?`left`:t===`arrowright`||t===`d`?`right`:`none`}function W(e,t,n){let r=Math.round(n),i=Math.round(t);return r<0||r>=e.length||i<0||i>=e[0].length?!1:e[r][i]!==1}function G(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function K(e,t){let n=e.x-t.x,r=e.y-t.y;return n*n+r*r}function Ee(){let e=Array.from({length:23},()=>Array(27).fill(1));((t,n,r,i)=>{for(let a=n;a0&&a<22&&n>0&&n<26&&(e[a][n]=0)})(1,1,25,21);for(let t=2;t<25;t++)e[5][t]=1,e[17][t]=1;for(let t=2;t<21;t++)e[t][4]=1,e[t][22]=1;for(let t=6;t<21;t++)e[11][t]=0;for(let t=4;t<19;t++)e[t][13]=0;for(let t=1;t<22;t++)for(let n=1;n<26;n++)e[t][n]===0&&(e[t][n]=2);for(let t of[{x:6,y:6},{x:20,y:6},{x:6,y:16},{x:20,y:16}])e[t.y][t.x]=3;for(let t of[{x:2,y:2},{x:24,y:2},{x:2,y:20},{x:24,y:20}])e[t.y]?.[t.x]!==1&&(e[t.y][t.x]=4);return e}function De(e){return{pos:{x:e.x,y:e.y},dir:`left`,next:`left`,speed:ae}}function q(e,t,n){return{pos:{x:e.x,y:e.y},dir:`left`,speed:oe,scatterTarget:n,mode:`chase`,frightUntil:0,color:t}}function Oe(e){let t=0;for(let n=0;n=.1||i>=.1)return!1;let a=0;return[`up`,`down`,`left`,`right`].forEach(t=>{W(e,n.x+V[t].x,n.y+V[t].y)&&a++}),a>=3}function Me(e,t){if(t.next===`none`||t.next===t.dir)return;if(t.next===H[t.dir]){t.dir=t.next;return}let n=G(t.pos),r=Math.abs(t.pos.x-n.x),i=Math.abs(t.pos.y-n.y);r>=.12||i>=.12||W(e,n.x+V[t.next].x,n.y+V[t.next].y)&&(t.pos.x=n.x,t.pos.y=n.y,t.dir=t.next)}function Ne(e,t,n,r,i){if(n===`none`)return;let a=V[n],o=t.x+a.x*r*i,s=t.y+a.y*r*i,c=e[0].length;if(o<-1){t.x=c+1;return}if(o>c+1){t.x=-1;return}if(W(e,Math.round(o),Math.round(s)))t.x=o,t.y=s;else{let e=G(t);t.x=e.x,t.y=e.y}}function Pe(e,t,n,r){let i=[`up`,`left`,`down`,`right`],a=n,o=1/0;for(let s of i){if(s===H[n])continue;let i=Math.round(t.x)+V[s].x,c=Math.round(t.y)+V[s].y;if(!W(e,i,c))continue;let l=K({x:i,y:c},r);l{let r=(0,d.useRef)(null),i=(0,d.useRef)(null),{paused:a,takeFocus:o}=re(`KaiMaze`),[s,c]=(0,d.useState)({w:0,h:0});(0,d.useEffect)(()=>{let e=r.current;if(!e)return;let t=new ResizeObserver(e=>{for(let t of e){let e=t.contentRect;c({w:e.width,h:e.height})}});return t.observe(e),()=>t.disconnect()},[]);let[l,u]=(0,d.useState)(e);(0,d.useEffect)(()=>u(e),[e]);let[f,p]=(0,d.useState)(()=>ke(1,performance.now())),m=(0,d.useRef)(performance.now()),[h,g]=(0,d.useState)(()=>{if(typeof window>`u`)return!1;let e=window.matchMedia?.(`(pointer: coarse)`)?.matches??!1,t=window.matchMedia?.(`(max-width: 900px)`)?.matches??!1;return e||t});(0,d.useEffect)(()=>{if(typeof window>`u`)return;let e=window.matchMedia(`(pointer: coarse)`),t=window.matchMedia(`(max-width: 900px)`),n=()=>g(e.matches||t.matches);return e.addEventListener?.(`change`,n),t.addEventListener?.(`change`,n),()=>{e.removeEventListener?.(`change`,n),t.removeEventListener?.(`change`,n)}},[]);let _=(0,d.useMemo)(()=>e=>Math.floor(_e*(1+ve*(e-1))),[]),v=(0,d.useMemo)(()=>h&&!f.over,[h,f.over]),b=(0,d.useMemo)(()=>(h?`Tap/Swipe or D-pad`:`←↑→↓ / WASD`)+` · B/Space to Channel on ⟐ · Esc to exit`,[h]);(0,d.useEffect)(()=>{if(R>0&&l>=R){let e=l-R;u(e),t(e),o()}},[]);let x=()=>{p(e=>e.channelingUntil?{...e,channelingUntil:0}:e)};(0,d.useEffect)(()=>{let e=e=>{let t=e.key.toLowerCase(),r=Te(t);r!==`none`&&(x(),e.preventDefault(),o(),p(e=>({...e,player:{...e.player,next:r}}))),(t===`b`||t===` `)&&f.onAltar&&f.channelingUntil===0&&(o(),p(e=>({...e,channelingUntil:performance.now()+z}))),t===`escape`&&n&&n(),t===`r`&&f.over&&(o(),p(ke(1,performance.now())),m.current=performance.now())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,f.over,f.onAltar,f.channelingUntil]);let S=e=>{x(),o(),p(t=>({...t,player:{...t.player,next:e}}))},C=()=>{f.onAltar&&f.channelingUntil===0&&(o(),p(e=>({...e,channelingUntil:performance.now()+z})))};(0,d.useEffect)(()=>{let e=0,n=performance.now(),r=(e,n)=>{if(n.channelingUntil===0||!n.onAltar||e0){let e=Math.floor(a*r),i=Math.max(0,n.bankable-e),o=l+a;return u(o),t(o),{...n,scorePhi:n.scorePhi+a,bankable:i,points:i,kaiCharge:Math.max(0,Math.floor(n.kaiCharge*.5)),channelingUntil:0}}return{...n,channelingUntil:0}},i=()=>{e=requestAnimationFrame(i);let o=performance.now(),s=Math.min(1/ie,(o-n)/1e3);n=o,!a&&p(e=>{if(e.over)return e;let n=structuredClone(e);if(o>=n.cycle.nextSwitchAt){let e=n.cycle.phase===`chase`?`scatter`:`chase`;n.cycle={phase:e,nextSwitchAt:o+Ae(n.level,e)};for(let t of n.ghosts)t.mode!==`fright`&&(t.mode=e)}let i=U(o,m.current),a=we(i),c=Math.min(1+n.streak*se,ce),d=Math.min(1+n.streak*me,he),f=n.channelingUntil>0?0:n.player.speed*a*c;Me(n.grid,n.player),Ne(n.grid,n.player.pos,n.player.dir,f,s);let p=G(n.player.pos);n.onAltar=n.grid[p.y]?.[p.x]===4;let h=n.grid[p.y]?.[p.x]??1;if((h===2||h===3)&&n.channelingUntil===0){let e=Math.abs(i-.5)<=L,t=h===2?le:ue;if(e&&(t+=fe,n.kaiCharge=Math.min(B,n.kaiCharge+1)),t=Math.floor(t*d),n.points+=t,n.bankable=n.points,n.streak+=1,n.streak>n.bestStreak&&(n.bestStreak=n.streak),n.comboUntil=o+pe,n.grid[p.y][p.x]=0,n.pellets=Math.max(0,n.pellets-1),h===3){m.current=o;let e=Math.max(ge*Math.max(.55,1-(n.level-1)*.08),I*.5);for(let t of n.ghosts)t.mode=`fright`,t.frightUntil=o+e}}n.comboUntil>0&&o>n.comboUntil&&(n.streak=Math.max(0,Math.floor(n.streak*.5)),n.comboUntil=0);for(let e of n.ghosts){e.mode===`fright`&&o>=e.frightUntil&&(e.mode=n.cycle.phase);let t=G(n.player.pos);if(je(n.grid,e.pos))if(e.mode===`scatter`)e.dir=Pe(n.grid,e.pos,e.dir,e.scatterTarget);else if(e.mode===`fright`){let r=G(e.pos),i=[`up`,`down`,`left`,`right`],a=e.dir,o=-1/0;for(let s of i){if(s===H[e.dir])continue;let i=r.x+V[s].x,c=r.y+V[s].y;if(!W(n.grid,i,c))continue;let l=K({x:i,y:c},t);l>o&&(o=l,a=s)}e.dir=a}else{let r={x:t.x+V[n.player.dir].x*2,y:t.y+V[n.player.dir].y*2};e.dir=Pe(n.grid,e.pos,e.dir,r)}let r=e.mode===`fright`?Ce(.6,.8,Math.sin(i*Math.PI)):a,c=e.speed*r;if(c*=1.06**(n.level-1),Ne(n.grid,e.pos,e.dir,c,s),K(n.player.pos,e.pos)<.4)if(e.mode===`fright`&&n.channelingUntil===0){let t=Math.floor(de*d);n.points+=t,n.bankable=n.points,n.streak+=1,n.streak>n.bestStreak&&(n.bestStreak=n.streak),n.comboUntil=o+pe,e.pos={...e.scatterTarget},e.dir=`left`,e.mode=`scatter`,e.frightUntil=0}else if(--n.lives,n.streak=0,n.comboUntil=0,n.points=Math.max(0,Math.floor(n.points*(1-be))),n.bankable=n.points,n.channelingUntil=0,n.lives<=0)n.alive=!1,n.over=!0;else{let e={x:Math.floor(n.grid[0].length/2),y:n.grid.length-4};n.player.pos={...e},n.player.dir=`left`,n.player.next=`left`;for(let e of n.ghosts)e.mode=`scatter`;m.current=o}}if(n.pellets<=0&&!n.over){let e=_(n.level),r=Math.floor(n.bankable*.2/e);if(r>0){let i=r*e,a=Math.max(0,n.bankable-i),o=l+r;u(o),t(o),n.scorePhi+=r,n.bankable=a,n.points=a}let i=ke(n.level+1,o);i.scorePhi=n.scorePhi,i.lives=Math.max(1,n.lives),i.bestStreak=Math.max(n.bestStreak,n.streak),i.player.speed=n.player.speed*1.06;for(let e of i.ghosts)e.speed*=1.06;return m.current=o,i}return n=r(o,n),n})};return e=requestAnimationFrame(i),()=>cancelAnimationFrame(e)},[t,l,a,_]),(0,d.useEffect)(()=>{let e=0,t=()=>{e=requestAnimationFrame(t);let n=i.current,o=r.current;if(!n||!o)return;let c=n.getContext(`2d`);if(!c)return;let u=Math.max(0,s.w),d=Math.max(0,s.h);if(u===0||d===0)return;let p=Math.min(2,window.devicePixelRatio||1);(n.width!==Math.floor(u*p)||n.height!==Math.floor(d*p))&&(n.width=Math.floor(u*p),n.height=Math.floor(d*p),n.style.width=`${u}px`,n.style.height=`${d}px`),c.setTransform(p,0,0,p,0,0);let h=f.grid.length,g=f.grid[0].length,_=Math.floor(Math.min(u/g,d/h)),v=_*g,y=_*h,b=Math.floor((u-v)/2),x=Math.floor((d-y)/2),S=c.createLinearGradient(0,0,0,d);S.addColorStop(0,`#07071a`),S.addColorStop(1,`#0c1231`),c.fillStyle=S,c.fillRect(0,0,u,d),Be(c,u,d);for(let e=0;e0&&f.onAltar){let e=1-Math.max(0,f.channelingUntil-w)/z,t=u/2;c.strokeStyle=`rgba(0,255,208,0.9)`,c.lineWidth=4,c.globalAlpha=.9,c.beginPath(),c.arc(t,34,16,-Math.PI/2,-Math.PI/2+e*Math.PI*2),c.stroke(),c.globalAlpha=1,c.font=`700 12px ui-sans-serif,system-ui,-apple-system`,c.fillText(`Channeling…`,t+16+8,38)}if(a&&!f.over){c.fillStyle=`rgba(0,0,0,0.35)`,c.fillRect(0,0,u,d),c.fillStyle=`#fff`,c.font=`700 16px ui-sans-serif,system-ui,-apple-system`;let e=`Paused — another Realm is active`;c.fillText(e,(u-c.measureText(e).width)/2,d/2)}if(f.over){c.fillStyle=`rgba(0,0,0,0.55)`,c.fillRect(0,0,u,d),c.fillStyle=`#fff`,c.font=`700 20px ui-sans-serif,system-ui,-apple-system`;let e=`Game Over — Press R to restart`;c.fillText(e,(u-c.measureText(e).width)/2,d/2)}};return e=requestAnimationFrame(t),()=>cancelAnimationFrame(e)},[f,l,s,a]);let w=f.onAltar&&f.channelingUntil===0;return(0,y.jsxs)(`div`,{className:`km-wrap`,role:`group`,"aria-label":`Kai-Maze`,onPointerDown:()=>o(),onTouchStart:()=>o(),onMouseDown:()=>o(),children:[(0,y.jsxs)(`div`,{className:`km-header`,children:[(0,y.jsx)(`div`,{className:`km-title`,children:`🌀 Kai-Maze`}),(0,y.jsx)(`div`,{className:`km-sub`,children:`Score on pulse, risk your points, then ⟐ channel to mint Φ.`})]}),(0,y.jsxs)(`div`,{className:`km-stage`,ref:r,children:[(0,y.jsx)(`canvas`,{ref:i,className:`km-canvas`}),v&&(0,y.jsxs)(`div`,{className:`km-dpad`,style:{position:`absolute`,left:12,bottom:12,width:132,height:132,display:`grid`,gridTemplateColumns:`repeat(3, 1fr)`,gridTemplateRows:`repeat(3, 1fr)`,gap:6,touchAction:`none`,userSelect:`none`,zIndex:4},"aria-label":`Directional pad`,children:[(0,y.jsx)(`div`,{}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:J,"aria-label":`Move up`,onPointerDown:e=>{e.preventDefault(),S(`up`)},children:`▲`}),(0,y.jsx)(`div`,{}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:J,"aria-label":`Move left`,onPointerDown:e=>{e.preventDefault(),S(`left`)},children:`◀`}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:{...J,opacity:.9},"aria-label":`Hold to Channel (if on altar)`,onPointerDown:e=>{e.preventDefault(),C()},title:`Channel one breath to convert points → Φ`,children:`⟐`}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:J,"aria-label":`Move right`,onPointerDown:e=>{e.preventDefault(),S(`right`)},children:`▶`}),(0,y.jsx)(`div`,{}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:J,"aria-label":`Move down`,onPointerDown:e=>{e.preventDefault(),S(`down`)},children:`▼`}),(0,y.jsx)(`div`,{})]}),w&&(0,y.jsx)(`button`,{className:`km-chan-btn`,onClick:()=>{o(),p(e=>e.channelingUntil?e:{...e,channelingUntil:performance.now()+z})},"aria-label":`Channel points into Phi`,title:`Channel one breath to convert points → Φ`,children:`⟐ CHANNEL`}),f.channelingUntil>0&&(0,y.jsx)(`button`,{className:`km-chan-cancel`,onClick:()=>{o(),p(e=>({...e,channelingUntil:0}))},"aria-label":`Cancel channeling`,title:`Cancel`,children:`Cancel`})]}),(0,y.jsxs)(`div`,{className:`km-footer`,children:[(0,y.jsx)(`button`,{className:`km-btn`,onClick:n,title:`Back`,children:`Back`}),(0,y.jsx)(`div`,{className:`km-hint`,children:b})]})]})};function Ie(e,t,n,r,i){e.save(),e.fillStyle=i,e.beginPath(),e.arc(t,n,r,0,Math.PI*2),e.fill(),e.strokeStyle=`rgba(255,255,255,0.35)`,e.lineWidth=1.25,e.stroke(),e.restore()}function Le(e,t,n,r,i){e.save(),e.fillStyle=i,e.beginPath(),e.arc(t,n,r,Math.PI,0),e.lineTo(t+r,n+r*.85),e.lineTo(t-r,n+r*.85),e.closePath(),e.fill(),e.fillStyle=`#fff`,e.beginPath(),e.arc(t-r*.35,n-r*.15,r*.16,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(t+r*.35,n-r*.15,r*.16,0,Math.PI*2),e.fill(),e.fillStyle=`rgba(0,0,0,0.7)`,e.beginPath(),e.arc(t-r*.3,n-r*.15,r*.08,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(t+r*.3,n-r*.15,r*.08,0,Math.PI*2),e.fill(),e.restore()}function Re(e,t,n){let r=Math.min(460,Math.max(220,t*.5)),i=t/2,a=r/2;e.save(),e.globalAlpha=.35,e.strokeStyle=`rgba(0,255,208,.6)`,e.lineWidth=2,e.beginPath(),e.moveTo(i-a,20),e.lineTo(i+a,20),e.stroke();let o=ze(r*L*2);e.globalAlpha=.2,e.fillStyle=`#ffd36e`,e.fillRect(i-o,17,o*2,6),e.globalAlpha=.9,e.fillStyle=`#00ffd0`;let s=i-a+n*r;e.beginPath(),e.arc(s,20,4,0,Math.PI*2),e.fill(),e.restore()}function ze(e){return e/2}function Be(e,t,n){e.save(),e.globalAlpha=.08,e.strokeStyle=`rgba(255,255,255,0.15)`,e.lineWidth=1;let r=t/2,i=n/2,a=(1+Math.sqrt(5))/2,o=4;for(let s=0;s<8;s++){let s=Math.min(t,n)/o;e.beginPath(),e.arc(r,i,s,-Math.PI/2,Math.PI),e.stroke(),o*=a}e.restore()}var J={background:`linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04))`,border:`1px solid rgba(255,255,255,0.25)`,borderRadius:10,color:`rgba(255,255,255,0.9)`,fontSize:18,lineHeight:1,padding:0,display:`flex`,alignItems:`center`,justifyContent:`center`,minWidth:36,minHeight:36,touchAction:`none`};(()=>{let e=Array.from({length:31},()=>Array.from({length:28},()=>2));for(let t=0;t<28;t++)e[0][t]=1,e[30][t]=1;for(let t=0;t<31;t++)e[t][0]=1,e[t][27]=1;for(let t=4;t<24;t+=6)for(let n=4;n<27;n+=6)e[n][t]=1,e[n][t+1]=1,e[n+1][t]=1,e[n+1][t+1]=1;for(let t=2;t<26;t++)e[15][t]=0;e[1][1]=3,e[1][26]=3,e[29][1]=3,e[29][26]=3;for(let t=2;t<29;t++)e[t][14]=0;for(let t=2;t<26;t++)e[11][t]=0;return e})();var Ve=5236,Y=3,He=Y*2,Ue=2,We=.15,Ge=220,Ke=60,qe=20;function Je(e){return(Math.imul(e^2654435769,2654435761)>>>0)%1e5/1e5}function Ye(e,t){let n=Math.abs(e-t)%360;return n>180&&(n=360-n),n}var Xe=({currentPhi:e,onPhiChange:t})=>{let[n,r]=(0,d.useState)(`forge`),[i,a]=(0,d.useState)(null),[o,s]=(0,d.useState)(performance.now()),[c,l]=(0,d.useState)(0),[u,f]=(0,d.useState)(!1),[p,m]=(0,d.useState)(null),[h,g]=(0,d.useState)(0);ee({onPulse:e=>{a(e),s(performance.now()),m(e=>e&&{...e,delta:e.delta})}}),(0,d.useEffect)(()=>{if(n!==`forge`)return;let e=0,t=!0,r=()=>{if(!t)return;let n=performance.now();l(Math.max(0,n-o)%Ve/Ve*360%360),e=requestAnimationFrame(r)};return e=requestAnimationFrame(r),()=>{t=!1,cancelAnimationFrame(e)}},[o,n]);let _=(0,d.useMemo)(()=>{let e=i??0,t=Math.floor(Je(e)*360),n=Ke+(e%2==0?qe:0)-Math.min(20,Math.floor(h*6));return{centerDeg:t,halfWidthDeg:Math.max(10,n/2)}},[i,h]),v=(0,d.useMemo)(()=>n===`forge`&&!u&&e>=Y&&i!==null,[n,u,e,i]),b=(0,d.useCallback)(e=>{let t=He,n=1+h*We,r=e?Ue:1;return Math.floor(t*n*r)},[h]),x=(0,d.useCallback)(()=>{if(!v)return;let n=e-Y;t(n),f(!0),m(null);let r=Ye(c,_.centerDeg),i=Math.max(4,_.halfWidthDeg*.25),a=r<=_.halfWidthDeg,o=a&&r<=i;window.setTimeout(()=>{if(a){let e=b(o);t(n+e),g(e=>e+1),m({kind:o?`crit`:`hit`,delta:e})}else g(0),m({kind:`miss`,delta:-Y});f(!1)},650)},[v,e,t,c,_.centerDeg,_.halfWidthDeg,b]);return(0,d.useEffect)(()=>{if(n!==`forge`)return;let e=e=>{let t=e.key.toLowerCase();(t===` `||t===`enter`)&&(e.preventDefault(),x())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,x]),(0,y.jsx)(`div`,{className:`pf-wrap`,role:`group`,"aria-label":`Pulse Forge`,children:n===`forge`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`pf-header`,children:[(0,y.jsx)(`div`,{className:`pf-title`,children:`⚒️ Pulse Forge`}),(0,y.jsx)(`div`,{className:`pf-sub`,children:`Time your lock to the target arc. Breathe, focus, forge.`}),(0,y.jsx)(`div`,{style:{marginLeft:`auto`,display:`flex`,gap:8},children:(0,y.jsx)(`button`,{type:`button`,className:`pf-lock-btn`,onClick:()=>r(`maze`),title:`Switch to Kai-Maze`,children:`Play Kai-Maze`})})]}),(0,y.jsxs)(`div`,{className:`pf-board`,children:[(0,y.jsxs)(`div`,{className:`pf-dial`,style:{width:Ge,height:Ge},children:[(0,y.jsx)(`div`,{className:`pf-arc`,style:{"--arc-center":`${_.centerDeg}deg`,"--arc-half":`${_.halfWidthDeg}deg`},"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`pf-marker ${u?`pf-marker--lock`:``}`,style:{transform:`rotate(${c}deg)`},"aria-hidden":!0,children:(0,y.jsx)(`div`,{className:`pf-marker-head`})}),(0,y.jsx)(`div`,{className:`pf-rim`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`pf-ticks`,"aria-hidden":!0,children:Array.from({length:12}).map((e,t)=>(0,y.jsx)(`span`,{style:{transform:`rotate(${t*30}deg)`}},t))})]}),(0,y.jsxs)(`div`,{className:`pf-hud`,children:[(0,y.jsxs)(`div`,{className:`pf-chip`,title:`Your Φ`,children:[(0,y.jsx)(`span`,{className:`pf-chip__label`,children:`Φ`}),(0,y.jsx)(`span`,{className:`pf-chip__val`,children:e})]}),(0,y.jsxs)(`div`,{className:`pf-chip`,title:`Streak`,children:[(0,y.jsx)(`span`,{className:`pf-chip__label`,children:`Streak`}),(0,y.jsx)(`span`,{className:`pf-chip__val`,children:h})]}),(0,y.jsxs)(`div`,{className:`pf-chip`,title:`Pulse`,children:[(0,y.jsx)(`span`,{className:`pf-chip__label`,children:`Pulse`}),(0,y.jsx)(`span`,{className:`pf-chip__val`,children:i??`—`})]})]})]}),(0,y.jsxs)(`div`,{className:`pf-cta`,children:[(0,y.jsx)(`button`,{className:`pf-lock-btn`,onClick:x,disabled:!v,"aria-disabled":!v,title:v?`Press Space/Enter to Lock`:`Insufficient Φ or syncing…`,children:u?`Locking…`:`Lock (−${Y} Φ)`}),(0,y.jsxs)(`div`,{className:`pf-hint`,children:[`Press `,(0,y.jsx)(`kbd`,{children:`Space`}),` or `,(0,y.jsx)(`kbd`,{children:`Enter`}),` at the right moment. Even pulses widen the target.`]})]}),p&&(0,y.jsxs)(`div`,{className:`pf-result pf-result--${p.kind}`,role:`status`,"aria-live":`polite`,children:[p.kind===`hit`&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:`pf-result__emoji`,children:`✅`}),(0,y.jsxs)(`span`,{className:`pf-result__text`,children:[`Resonant lock! +`,p.delta,` Φ`]})]}),p.kind===`crit`&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:`pf-result__emoji`,children:`💥`}),(0,y.jsxs)(`span`,{className:`pf-result__text`,children:[`Perfect lock! +`,p.delta,` Φ`]})]}),p.kind===`miss`&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:`pf-result__emoji`,children:`❌`}),(0,y.jsx)(`span`,{className:`pf-result__text`,children:`Miss — breathe again.`})]})]})]}):(0,y.jsx)(Fe,{currentPhi:e,onPhiChange:t,onExit:()=>r(`forge`)})})};function Ze(){return`kai-${Math.random().toString(36).slice(2,8)}`}function Qe(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.x==`number`&&typeof t.pulseIndex==`number`&&typeof t.chakraDay==`string`&&typeof t.glyph==`object`&&t.glyph!==null}var $e=null;async function et(){return $e||($e=(await r(()=>import(`./bundler-H_464dRi.js`),__vite__mapDeps([0,1,2]))).default,$e)}function tt(e){let[t]=(0,d.useState)(()=>e??Ze()),[n,r]=(0,d.useState)([]),[i,a]=(0,d.useState)([]),o=(0,d.useRef)(null),s=(0,d.useRef)({}),c=(0,d.useCallback)((e,t)=>{if(!Qe(t))return;let n={...t,id:e,glyph:t.glyph};a(t=>{let r=t.findIndex(t=>t.id===e);if(r>=0){let e=[...t];return e[r]=n,e}return[...t,n]})},[]),l=(0,d.useCallback)((e,t)=>{Qe(e)&&c(t,e)},[c]);return(0,d.useEffect)(()=>{let e=!1;return(async()=>{let n=await et();if(e)return;let i=new n(t);o.current=i,i.on(`open`,()=>{r(e=>e)}),i.on(`connection`,e=>{s.current[e.peer]=e,r(t=>Array.from(new Set([...t,e.peer]))),e.on(`data`,t=>{l(t,e.peer)}),e.on(`close`,()=>{delete s.current[e.peer],r(t=>t.filter(t=>t!==e.peer)),a(t=>t.filter(t=>t.id!==e.peer))})})})().catch(e=>{console.error(`[KaiRealms] Peer init failed:`,e)}),()=>{e=!0;try{o.current?.destroy()}catch(e){console.warn(`[KaiRealms] Peer destroy failed:`,e)}o.current=null,s.current={},r([]),a([])}},[t,l]),{sessionId:t,peers:n,sendState:(0,d.useCallback)(e=>{let t=Object.values(s.current);for(let n of t)n.open&&n.send(e)},[]),remoteStates:i}}var nt=800,rt=500,it=nt/rt,X=28,Z=10,at=360,ot=10,Q=5236,st=.08,ct=22,lt=90,ut=80,dt=2,ft=4,pt=10,mt=3,ht=1,gt=3,_t=1,vt=1,$=(e,t,n)=>en?n:e,yt=({glyphData:e,onExit:t})=>{let n=(0,d.useRef)(null),r=(0,d.useRef)(null),i=(0,d.useRef)(null),[a,o]=(0,d.useState)({w:nt,h:rt}),s=(0,d.useRef)(a);(0,d.useEffect)(()=>{s.current=a},[a]);let[c,l]=(0,d.useState)(0),[u,f]=(0,d.useState)(0),[p,m]=(0,d.useState)(!1),[h,g]=(0,d.useState)(mt),[_,v]=(0,d.useState)(0),[b,x]=(0,d.useState)(0),[S,C]=(0,d.useState)(!1),w=(0,d.useRef)(performance.now()),{sendState:T,remoteStates:E}=tt(),D=(0,d.useRef)([]);(0,d.useEffect)(()=>{D.current=E??[]},[E]);let O=(0,d.useRef)(nt/2),k=(0,d.useRef)([]),A=(0,d.useRef)({}),j=(0,d.useRef)(null),M=(0,d.useRef)(null),N=(0,d.useRef)(null),P=(0,d.useRef)(0),te=(0,d.useRef)(0),F=(0,d.useRef)(null);(0,d.useEffect)(()=>{let e=n.current;if(!e)return;let t=new ResizeObserver(e=>{let t=e[0].contentRect,n=Math.max(320,Math.min(960,t.width));o({w:n,h:Math.round(n/it)})});return t.observe(e),()=>t.disconnect()},[]),(0,d.useEffect)(()=>{let e=r.current;if(!e)return;let t=e.getContext(`2d`);if(!t)return;let n=Math.min(2,window.devicePixelRatio||1);e.style.width=`${a.w}px`,e.style.height=`${a.h}px`,e.width=Math.floor(a.w*n),e.height=Math.floor(a.h*n),t.setTransform(n,0,0,n,0,0),i.current=t,O.current=$(O.current,X,a.w-X)},[a]),(0,d.useEffect)(()=>{let e=e=>{A.current[e.key]=!0,e.key.toLowerCase()===`p`&&m(e=>!e),e.key.toLowerCase()===`r`&&S&&R()},t=e=>{A.current[e.key]=!1};return window.addEventListener(`keydown`,e),window.addEventListener(`keyup`,t),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`keyup`,t)}},[S]),(0,d.useEffect)(()=>{let e=r.current;if(!e)return;let t=t=>{let n=e.getBoundingClientRect();return $((t-n.left)/n.width*s.current.w,X,s.current.w-X)},n=!1,i=e=>{n=!0,O.current=t(e.clientX)},a=e=>{n&&(O.current=t(e.clientX))},o=()=>{n=!1};return e.addEventListener(`pointerdown`,i),e.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o),()=>{e.removeEventListener(`pointerdown`,i),e.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o)}},[]);let ne=e=>Math.max(0,e-w.current)%Q/Q,re=e=>{let t=Math.sin(Math.PI*e);return .65+.7*(t*t)},I=e=>{let{w:t}=s.current,n=performance.now(),r=Math.random()*(t-2*Z)+Z,i=-Z*2,a=(Math.random()-.5)*40,o=(e===`gold`?ut:lt)+_*(pt*.2),c={id:`${e}-${n}-${Math.floor(Math.random()*1e6)}`,x:r,y:i,vx:a,baseVy:o,kind:e,bornAt:n},l=k.current.slice(-(ct-1));l.push(c),k.current=l};ee({onPulse:e=>{f(e),w.current=performance.now(),te.current+=1;for(let e=0;e{let n=N.current,r=O.current,i=u;if(!n||Math.abs(n.x-r)>=1||n.pulseIndex!==i||t-P.current>1e3/ot){N.current={x:r,pulseIndex:i},P.current=t;try{T({id:`you`,x:r,pulseIndex:i,chakraDay:e.meta.chakraDay,glyph:e})}catch{}}};(0,d.useEffect)(()=>{let t=r.current,n=i.current;if(!t||!n)return;let a=!0,o=t=>{if(!a)return;j.current=requestAnimationFrame(o);let r=M.current??t,i=Math.min(.05,(t-r)/1e3);M.current=t;let{w:c,h:u}=s.current,d=u-X-10;if(!p&&!S){let e=A.current,n=!!(e.ArrowLeft||e.a||e.A),r=!!(e.ArrowRight||e.d||e.D);n&&(O.current=$(O.current-at*i,X,c-X)),r&&(O.current=$(O.current+at*i,X,c-X));let a=O.current,o=performance.now(),s=ne(o),f=re(s),p=[],m=0,h=0,y=0;for(let e=0;ec-Z&&(t.x=c-Z,t.vx=-Math.abs(t.vx)*.9);let r=t.x-a,l=t.y-d;if(Math.hypot(r,l)u+Z){y+=1;continue}p.push(t)}if(m>0||h>0){let e=m+h;l(t=>t+e),v(e=>{let t=e+1;return x(e=>t>e?t:e),t})}y>0&&(l(e=>Math.max(0,e-ht*y)),v(0),g(e=>{let t=Math.max(0,e-y);return t===0&&C(!0),t})),k.current=p,L(t)}bt(n,e,O.current,d,p||S,k.current,D.current,s.current,w.current,F.current)};return j.current=requestAnimationFrame(o),()=>{a=!1,j.current!==null&&cancelAnimationFrame(j.current),j.current=null,M.current=null}},[e,p,S,a.w,a.h]);let R=()=>{k.current=[],g(mt),v(0),x(e=>e),C(!1)},ie=(0,d.useMemo)(()=>({pulse:u,chakraDay:e?.meta?.chakraDay??`—`}),[u,e?.meta?.chakraDay]);return(0,y.jsxs)(`div`,{className:`realm-wrap`,ref:n,children:[(0,y.jsxs)(`div`,{className:`realm-hud`,children:[(0,y.jsxs)(`div`,{className:`hud-chip hud-chip--score`,title:`Banked Φ`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Φ`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:c})]}),(0,y.jsxs)(`div`,{className:`hud-chip`,title:`Streak`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Streak`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:_})]}),(0,y.jsxs)(`div`,{className:`hud-chip`,title:`Lives`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Lives`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:h})]}),(0,y.jsxs)(`div`,{className:`hud-chip`,title:`Current Pulse`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Pulse`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:ie.pulse})]}),(0,y.jsxs)(`div`,{className:`hud-chip`,title:`Chakra Day`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Day`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:ie.chakraDay})]}),(0,y.jsx)(`button`,{className:`hud-button`,onClick:()=>m(e=>!e),"aria-pressed":p,title:`Pause (P)`,children:p?`Resume`:`Pause`})]}),(0,y.jsxs)(`div`,{className:`realm-canvas-wrap`,children:[(0,y.jsx)(`canvas`,{ref:r,className:`realm-canvas`,"aria-label":`Kai Realms Canvas`}),(p||S)&&(0,y.jsx)(`div`,{className:`realm-pause-overlay`,"aria-hidden":!0,children:(0,y.jsxs)(`div`,{className:`pause-card`,children:[(0,y.jsx)(`div`,{className:`pause-title`,children:S?`Game Over`:`Paused`}),(0,y.jsx)(`div`,{className:`pause-sub`,children:S?(0,y.jsxs)(y.Fragment,{children:[`Best Streak: `,(0,y.jsx)(`strong`,{children:b}),` — Press `,(0,y.jsx)(`kbd`,{children:`R`}),` to Restart`]}):(0,y.jsxs)(y.Fragment,{children:[`Press `,(0,y.jsx)(`kbd`,{children:`P`}),` or click Resume`]})}),S&&(0,y.jsx)(`button`,{className:`hud-button`,onClick:R,style:{marginTop:12},children:`Restart`})]})})]}),(0,y.jsx)(Xe,{currentPhi:c,onPhiChange:e=>l(e)}),(0,y.jsx)(`button`,{className:`exit-button`,onClick:t,children:`Exit Realm`})]})};function bt(e,t,n,r,i,a,o,s,c,l){let{w:u,h:d}=s,f=e.createLinearGradient(0,0,0,d);f.addColorStop(0,`#020211`),f.addColorStop(1,`#0b0f2a`),e.fillStyle=f,e.fillRect(0,0,u,d),e.save(),e.globalAlpha=.12;for(let t=0;t<40;t++){let n=t*197%u+t%3,r=t*127%d+t*11%7;e.fillStyle=`white`,e.fillRect(n,r,2,2)}e.restore(),xt(e,u,Math.max(36,Math.round(d*.06)),c);for(let t=0;t{let[n,r]=(0,d.useState)(null),i=(0,d.useRef)(null),a=(0,d.useRef)(null),o=(0,d.useCallback)(e=>r(e),[]),s=(0,d.useCallback)(()=>{r(null),t?.()},[t]);(0,d.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t?.()};return document.addEventListener(`keydown`,e),a.current?.focus(),()=>document.removeEventListener(`keydown`,e)},[t]),(0,d.useEffect)(()=>{let e=i.current;if(!e)return;let t=e=>e.stopPropagation();return e.addEventListener(`wheel`,t,{passive:!0}),()=>e.removeEventListener(`wheel`,t)},[]);let c=()=>t?.(),l=e=>e.stopPropagation();return(0,y.jsxs)(`div`,{className:`realms-backdrop realms-veil`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`kai-realms-title`,onMouseDown:c,children:[(0,y.jsx)(`div`,{className:`realms-stars`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`realms-halo realms-halo--1`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`realms-halo realms-halo--2`,"aria-hidden":!0}),(0,y.jsxs)(`div`,{ref:i,className:`realms-container glass-omni`,onMouseDown:l,role:`document`,children:[(0,y.jsx)(`div`,{className:`breath-ring breath-ring--outer`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`breath-ring breath-ring--inner`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`phi-grid`,"aria-hidden":!0}),(0,y.jsxs)(`header`,{className:`realms-header`,children:[(0,y.jsx)(`button`,{ref:a,type:`button`,className:`realms-close auric-btn`,"aria-label":`Close Kai Realms`,onClick:e=>{e.stopPropagation(),t?.()},onMouseDown:e=>e.stopPropagation(),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),t?.())},children:(0,y.jsx)(e,{size:20,"aria-hidden":!0})}),(0,y.jsx)(`div`,{className:`header-seals`,"aria-hidden":!0,children:(0,y.jsxs)(`div`,{className:`seal-emblem`,children:[(0,y.jsx)(`div`,{className:`seal-ring`}),(0,y.jsx)(`div`,{className:`seal-ring seal-ring--inner`}),(0,y.jsx)(`div`,{className:`seal-core`})]})}),(0,y.jsx)(`h2`,{id:`kai-realms-title`,className:`sr-only`,children:`Kai Realms — Sigil Gate`})]}),(0,y.jsx)(`main`,{className:`realms-body`,children:n?(0,y.jsx)(`div`,{className:`realm-stage`,children:(0,y.jsx)(yt,{glyphData:n,onExit:s})}):(0,y.jsx)(`div`,{className:`portal-stage`,children:(0,y.jsx)(x,{onEnter:o})})}),(0,y.jsx)(`footer`,{className:`realms-footer`,"aria-hidden":!0,children:(0,y.jsx)(`div`,{className:`footer-center`,style:{margin:`0 auto`},children:(0,y.jsx)(wt,{})})})]})]})};function wt(){return(0,y.jsxs)(`svg`,{className:`seal-coin`,width:`56`,height:`56`,viewBox:`0 0 56 56`,"aria-hidden":!0,children:[(0,y.jsxs)(`defs`,{children:[(0,y.jsxs)(`radialGradient`,{id:`coinGlowRealms`,cx:`50%`,cy:`50%`,r:`50%`,children:[(0,y.jsx)(`stop`,{offset:`0%`,stopColor:`#ffffff`,stopOpacity:`0.9`}),(0,y.jsx)(`stop`,{offset:`40%`,stopColor:`#ffd86b`,stopOpacity:`0.75`}),(0,y.jsx)(`stop`,{offset:`100%`,stopColor:`#ffd86b`,stopOpacity:`0.15`})]}),(0,y.jsxs)(`linearGradient`,{id:`coinEdgeRealms`,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,y.jsx)(`stop`,{offset:`0%`,stopColor:`#00ffd0`,stopOpacity:`0.8`}),(0,y.jsx)(`stop`,{offset:`100%`,stopColor:`#8a2be2`,stopOpacity:`0.8`})]})]}),(0,y.jsx)(`circle`,{cx:`28`,cy:`28`,r:`26`,fill:`url(#coinGlowRealms)`,stroke:`url(#coinEdgeRealms)`,strokeWidth:`1.5`}),(0,y.jsxs)(`g`,{className:`seal-coin__rotor`,children:[(0,y.jsx)(`circle`,{cx:`28`,cy:`28`,r:`18`,fill:`none`,stroke:`url(#coinEdgeRealms)`,strokeWidth:`1.25`}),(0,y.jsxs)(`g`,{stroke:`rgba(255,255,255,0.35)`,strokeWidth:`0.6`,children:[(0,y.jsx)(`line`,{x1:`28`,y1:`10`,x2:`28`,y2:`46`}),(0,y.jsx)(`line`,{x1:`10`,y1:`28`,x2:`46`,y2:`28`}),(0,y.jsx)(`line`,{x1:`15`,y1:`15`,x2:`41`,y2:`41`}),(0,y.jsx)(`line`,{x1:`41`,y1:`15`,x2:`15`,y2:`41`})]})]}),(0,y.jsx)(`circle`,{className:`seal-coin__core`,cx:`28`,cy:`28`,r:`6.5`})]})}export{Ct as default}; \ No newline at end of file diff --git a/dist/assets/KaiVohApp-cvlNRmVv.js b/dist/assets/KaiVohApp-BMb9vr72.js similarity index 99% rename from dist/assets/KaiVohApp-cvlNRmVv.js rename to dist/assets/KaiVohApp-BMb9vr72.js index 807335c9..c737c533 100644 --- a/dist/assets/KaiVohApp-cvlNRmVv.js +++ b/dist/assets/KaiVohApp-BMb9vr72.js @@ -1,4 +1,4 @@ -import{$ as e,$t as t,A as n,D as r,E as i,En as a,F as o,Ht as s,K as c,M as l,N as u,O as d,P as f,Q as p,T as m,Tn as h,Z as g,_n as _,at as v,ct as y,dt as b,en as x,fn as ee,ft as S,gn as C,ht as w,j as T,jn as E,k as D,ln as O,lt as te,mn as k,nt as ne,ot as re,pn as A,pt as j,st as ie,tn as M,un as ae,ut as oe}from"./index-BGzUQCv_.js";import"./prop-types-CQvzhoSE.js";import{n as se}from"./SigilAuthContext-Bpha3aI1.js";import{n as N,t as P}from"./sigilRegistry-DVCHqg2o.js";import{i as ce,r as le}from"./postSeal-ClZBwRbf.js";import{a as F,i as I,n as L,r as R,t as z}from"./VerifierFrame-CwEJNPi9.js";var B=E(h(),1);const ue=(0,B.createContext)(void 0);var V=E(M(),1);function de({children:e}){let[t,n]=(0,B.useState)(null),r=(0,B.useMemo)(()=>({session:t,setSession:e=>n(e),clearSession:()=>n(null)}),[t]);return(0,V.jsx)(ue.Provider,{value:r,children:e})}function H(){let e=(0,B.useContext)(ue);if(!e)throw Error(`useSession must be used within a SessionProvider`);return e}var U=[`video/webm;codecs=vp9,opus`,`video/webm;codecs=vp8,opus`,`video/webm`,`video/mp4;codecs=h264,aac`,`video/mp4`],fe=typeof window<`u`&&`MediaRecorder`in window;async function pe(e){let t=await crypto.subtle.digest(`SHA-256`,e),n=new Uint8Array(t),r=``;for(let e=0;eW(),[]);function ne(){let e=typeof performance<`u`?performance:null,t=(e&&typeof e.timeOrigin==`number`?e.timeOrigin:NaN)+(e?e.now():NaN);return Number.isFinite(t)?Math.floor(t):Date.now()}(0,B.useEffect)(()=>{if(t)return(async()=>{s(null),l(!0);try{await re()}catch(e){s(e instanceof Error?e.message:`Failed to access camera.`)}finally{l(!1)}})(),()=>{A()}},[t,u,f]),(0,B.useEffect)(()=>{t&&j().catch(()=>_(!1))},[t,u]);async function re(){A();let e={audio:{echoCancellation:!0,noiseSuppression:!0},video:{facingMode:u,width:{ideal:1080},height:{ideal:1920},frameRate:{ideal:30,max:60}}},t=await navigator.mediaDevices.getUserMedia(e);C.current=t,w.current&&(w.current.srcObject=t,w.current.muted=!0,await w.current.play().catch(()=>{})),await ie(m&&g)}function A(){if(P(!0),w.current&&(w.current.pause(),w.current.srcObject=null),C.current)for(let e of C.current.getTracks())e.stop();C.current=null,h(!1),y(!1),x(0),S(0),O.current!==null&&(cancelAnimationFrame(O.current),O.current=null)}async function j(){let e=C.current;if(!e){_(!1);return}let[t]=e.getVideoTracks();if(!t){_(!1);return}let n=t.getCapabilities?.()??{};_(!!(typeof n.torch==`boolean`&&n.torch)&&u===`environment`)}async function ie(e){let t=C.current;if(!t)return;let[n]=t.getVideoTracks();if(!(!n||!n.applyConstraints))try{g&&u===`environment`&&await n.applyConstraints({advanced:[{torch:e}]})}catch{}}function M(){d(e=>e===`user`?`environment`:`user`)}function ae(){p(e=>!e)}async function oe(){if(!g)return;let e=!m;h(e),await ie(e)}function se(){if(!v)return;let e=performance.now()-D.current;if(S(e),x(Math.min(1,e/i)),e>=i){P(!1);return}O.current=requestAnimationFrame(se)}function N(){if(!fe){s(`MediaRecorder is not supported on this browser.`);return}if(v)return;s(null);let e=C.current;if(!e){s(`No camera stream.`);return}for(let t of e.getAudioTracks())t.enabled=!f;let t=te??``,n;try{n=t?new MediaRecorder(e,{mimeType:t,videoBitsPerSecond:35e5}):new MediaRecorder(e)}catch{n=new MediaRecorder(e)}T.current=n,E.current=[],n.ondataavailable=e=>{e.data&&e.data.size>0&&E.current.push(e.data)},n.onstop=()=>{ce()},n.start(250),y(!0),D.current=performance.now(),O.current=requestAnimationFrame(se)}function P(e){if(!v)return;let t=T.current;if(t){try{t.state!==`inactive`&&t.stop()}catch{}y(!1),O.current!==null&&(cancelAnimationFrame(O.current),O.current=null),e&&(E.current=[],x(0),S(0))}}async function ce(){let e=E.current;if(E.current=[],!e.length)return;let t=Math.max(0,Math.min(i,performance.now()-D.current)),n=T.current?.mimeType||te||`video/webm`,a=new Blob(e,{type:n}),o=ne(),s=k(BigInt(o)),{width:c,height:l,thumbnailDataUrl:u}=await le(a),d=await pe(await a.arrayBuffer()),f=`story_${s.toString()}.${n.includes(`mp4`)?`mp4`:`webm`}`;r({blob:a,file:new File([a],f,{type:n,lastModified:o}),mimeType:n,durationMs:t,width:c,height:l,thumbnailDataUrl:u,sha256:d,createdAt:o})}async function le(e){let t=URL.createObjectURL(e);try{let e=document.createElement(`video`);e.src=t,e.muted=!0,await e.play().catch(()=>void 0),await new Promise(t=>{let n=()=>{e.pause(),e.currentTime=0},r=()=>{n(),t()};e.onloadeddata=r,setTimeout(r,250)});let n=e.videoWidth||1080,r=e.videoHeight||1920,i=document.createElement(`canvas`);i.width=n,i.height=r;let a=i.getContext(`2d`);return a&&a.drawImage(e,0,0,n,r),{width:n,height:r,thumbnailDataUrl:i.toDataURL(`image/png`,.9)}}finally{URL.revokeObjectURL(t)}}function F(){v||N()}function I(){v&&P(!1)}function L(){v?P(!1):N()}return t?(0,V.jsxs)(`div`,{className:`story-rec-overlay`,role:`dialog`,"aria-modal":`true`,"aria-label":`Story recorder`,children:[(0,V.jsx)(`div`,{className:`story-rec-video-wrap`,children:(0,V.jsx)(`video`,{ref:w,className:`story-rec-video ${u===`user`?`mirror`:``}`,playsInline:!0})}),(0,V.jsxs)(`div`,{className:`story-rec-topbar`,children:[(0,V.jsx)(`button`,{type:`button`,className:`story-btn top left`,"aria-label":`Close`,onClick:()=>{A(),n()},children:`✕`}),(0,V.jsx)(`div`,{className:`story-top-center`,children:(0,V.jsxs)(`div`,{className:`story-timer mono`,children:[he(ee),` / `,he(i)]})}),(0,V.jsxs)(`div`,{className:`story-top-actions`,children:[(0,V.jsx)(`button`,{type:`button`,className:`story-btn ${f?`active`:``}`,"aria-pressed":f,"aria-label":f?`Unmute microphone`:`Mute microphone`,onClick:ae,title:f?`Unmute mic`:`Mute mic`,children:f?`🔇`:`🎙️`}),(0,V.jsx)(`button`,{type:`button`,className:`story-btn ${u===`environment`&&g?``:`disabled`}`,disabled:!(u===`environment`&&g),onClick:()=>void oe(),"aria-label":`Toggle torch`,title:g?m?`Torch on`:`Torch off`:`Torch not supported`,children:m?`🔦`:`💡`}),(0,V.jsx)(`button`,{type:`button`,className:`story-btn`,"aria-label":`Flip camera`,onClick:M,title:`Flip camera`,children:`🔁`})]})]}),(0,V.jsxs)(`div`,{className:`story-rec-bottombar`,children:[(0,V.jsx)(`div`,{className:`record-wrap`,children:(0,V.jsxs)(`button`,{type:`button`,className:`record-btn ${v?`recording`:``}`,"aria-pressed":v,"aria-label":v?`Stop recording`:`Start recording`,onClick:L,onPointerDown:F,onPointerUp:I,onPointerLeave:I,children:[(0,V.jsx)(`span`,{className:`progress-ring`,style:{background:`conic-gradient(currentColor ${b*360}deg, transparent 0)`}}),(0,V.jsx)(`span`,{className:`dot`})]})}),o&&(0,V.jsx)(`div`,{className:`story-rec-error`,children:o}),c&&(0,V.jsx)(`div`,{className:`story-rec-hint`,children:`Initializing camera…`})]})]}):null}function he(e){let t=Math.floor(e/1e3);return`${Math.floor(t/60).toString().padStart(2,`0`)}:${(t%60).toString().padStart(2,`0`)}`}var G={phiKey:[`userPhiKey`,`phiKey`,`phikey`,`ΦKey`,`walletPhiKey`],kaiSig:[`kaiSignature`,`kaiSig`,`ksig`,`ΣSig`,`sig`,`signature`],sigilId:[`sigilId`,`sigilID`,`glyphId`,`glyphID`,`sigil_id`,`glyph_id`],url:[`sigilActionUrl`,`sigilUrl`,`actionUrl`,`url`,`claimedUrl`,`loginUrl`,`sourceUrl`,`originUrl`,`link`,`href`]};function ge(e){if(typeof e!=`string`||!e.trim())return!1;try{let t=new URL(e,globalThis.location?.origin??`https://example.org`);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}}function K(e,t){if(typeof e!=`object`||!e)return;let n=e;for(let e of t){let t=n[e];if(typeof t==`string`&&t.trim())return t.trim()}let r=n.meta;if(typeof r==`object`&&r){let e=r;for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim())return t.trim()}}}function _e(e){return e.replace(/^$/,``).trim()}function ve(e){let t=e.trim();if(!t)return;try{let e=JSON.parse(t);if(typeof e==`object`&&e)return e}catch{}let n=t.match(/\{[\s\S]*\}/);if(n)try{let e=JSON.parse(n[0]);if(typeof e==`object`&&e)return e}catch{}}function ye(e,t){let n=RegExp(`${t}"?\\s*[:=]\\s*"?([^"\\n\\r<>{}]+)"?`,`i`),r=e.match(n);if(r)return(r[1]??``).trim()||void 0}function be(e){let t={};for(let n of G.phiKey){let r=ye(e,n);if(r){t.userPhiKey=r;break}}for(let n of G.kaiSig){let r=ye(e,n);if(r){t.kaiSignature=r;break}}for(let n of G.sigilId){let r=ye(e,n);if(r){t.sigilId=r;break}}for(let n of G.url){let r=ye(e,n);if(r&&ge(r))return t.actionUrl=r,t}let n=e.match(/https?:\/\/[^\s"'<>)#]+/i);return n&&ge(n[0])&&(t.actionUrl=n[0]),t}function xe(e,t){return{userPhiKey:e.userPhiKey??t.userPhiKey,kaiSignature:e.kaiSignature??t.kaiSignature,sigilId:e.sigilId??t.sigilId,actionUrl:e.actionUrl??t.actionUrl,meta:e.meta??t.meta}}function Se(e){let t=(e??``).trim();if(!t)return{};try{let e=new DOMParser().parseFromString(t,`image/svg+xml`),n=e.getElementsByTagName(`parsererror`);if(n&&n.length>0)return be(t);let r=e.documentElement,i={};if(r&&r.attributes)for(let e of Array.from(r.attributes))i[e.name]=e.value;let a={userPhiKey:K(i,G.phiKey),kaiSignature:K(i,G.kaiSig),sigilId:K(i,G.sigilId),actionUrl:(()=>{let e=K(i,G.url);return e&&ge(e)?e:void 0})(),meta:void 0},o=Array.from(e.getElementsByTagName(`metadata`));for(let e of o){let t=_e((e.textContent??``).trim());if(!t)continue;let n=ve(t);if(n){let e={userPhiKey:K(n,G.phiKey),kaiSignature:K(n,G.kaiSig),sigilId:K(n,G.sigilId),actionUrl:(()=>{let e=K(n,G.url);return e&&ge(e)?e:void 0})(),meta:n};if(a=xe(a,e),a.userPhiKey&&a.kaiSignature)return a}else a=xe(a,be(t))}for(let t of Array.from(e.getElementsByTagName(`desc`))){let e=_e((t.textContent??``).trim());if(!e)continue;let n=ve(e);if(n){let e={userPhiKey:K(n,G.phiKey),kaiSignature:K(n,G.kaiSig),sigilId:K(n,G.sigilId),actionUrl:(()=>{let e=K(n,G.url);return e&&ge(e)?e:void 0})(),meta:n};a=xe(a,e)}else a=xe(a,be(e));if(a.userPhiKey&&a.kaiSignature)return a}for(let t of Array.from(e.getElementsByTagName(`a`))){let e=t.getAttribute(`href`)||t.getAttribute(`xlink:href`);if(e&&ge(e)){a.actionUrl=a.actionUrl??e;break}}return(!a.userPhiKey||!a.kaiSignature)&&(a=xe(a,be(t))),a}catch{return be(t)}}var Ce=new TextEncoder;function q(){if(typeof crypto>`u`||!crypto.subtle)throw Error(`WebCrypto subtle unavailable`);return crypto.subtle}function we(e){if(e.buffer instanceof ArrayBuffer)return e;let t=new Uint8Array(e.byteLength);return t.set(e),t}function J(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`).trim();if(!/^[A-Za-z0-9+/]*={0,2}$/.test(t))throw Error(`Invalid base64/base64url`);let n=(4-t.length%4)%4,r=t+`=`.repeat(n),i=new Int16Array(128).fill(-1);for(let e=0;e<64;e++)i[`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.charCodeAt(e)]=e;let a=Math.floor(r.length*3/4)-(r.endsWith(`==`)?2:r.endsWith(`=`)?1:0),o=new Uint8Array(a),s=0;for(let e=0;e>>16&255),s>>8&255),s>>18&63]+t[r>>>12&63]+t[r>>>6&63]+t[r&63])}let a=r-i;if(a===1){let r=e[i]<<16;n.push(t[r>>>18&63]+t[r>>>12&63]+`==`)}else if(a===2){let r=e[i]<<16|e[i+1]<<8;n.push(t[r>>>18&63]+t[r>>>12&63]+t[r>>>6&63]+`=`)}return n.join(``).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function Ee(e){let t=e.trim().toLowerCase();if(!/^[0-9a-f]+$/.test(t)||t.length%2!=0)throw Error(`Invalid hex`);let n=new Uint8Array(t.length/2);for(let e=0;e=32&&t.length%2==0&&/^[0-9a-fA-F]+$/.test(t)}function Y(e){let t=e.trim();return t.length>=16&&/^[A-Za-z0-9\-_]+$/.test(t)}function Oe(e){let t=e.trim();if(!t)throw Error(`Empty kaiSignature`);if(De(t))return Ee(t);if(Y(t))try{return J(t)}catch{}return we(Ce.encode(t))}async function ke(e){let t=q(),n=await t.importKey(`raw`,e.ikm,{name:`HKDF`},!1,[`deriveBits`]),r=await t.deriveBits({name:`HKDF`,hash:`SHA-256`,salt:e.salt,info:e.info},n,e.bits);return new Uint8Array(r)}async function Ae(e){let t=we(Oe(e.baseKaiSignature)),n=we(J(e.salt_b64url)),r=(e.context??`KaiVoh.deriveKaiSignature.v1`).trim();return await ke({ikm:t,salt:n,info:we(Ce.encode(r)),bits:256})}async function je(e){return Te(await Ae(e))}function Me(){return(0,V.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`ico`,"aria-hidden":`true`,focusable:`false`,children:[(0,V.jsx)(`rect`,{x:`3`,y:`6`,width:`14`,height:`12`,rx:`3`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,V.jsx)(`circle`,{cx:`10`,cy:`12`,r:`3`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,V.jsx)(`path`,{d:`M17 9l4-2v10l-4-2z`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,V.jsx)(`circle`,{cx:`18.5`,cy:`5.5`,r:`2.5`,fill:`currentColor`})]})}function Ne(){return(0,V.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`ico`,"aria-hidden":`true`,focusable:`false`,children:[(0,V.jsx)(`path`,{d:`M3 6h18M9 6V4h6v2M7 6l1 14h8l1-14`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,V.jsx)(`path`,{d:`M10 10v6M14 10v6`,stroke:`currentColor`,strokeWidth:`2`})]})}var Pe=6e3,Fe=1024,Ie=1024*Fe,Le=e=>e>=Ie?`${(e/Ie).toFixed(2)} MB`:e>=Fe?`${(e/Fe).toFixed(2)} KB`:`${e} B`,Re=(e,t=8,n=6)=>e.length<=t+n?e:`${e.slice(0,t)}…${e.slice(-n)}`,ze=e=>{if(typeof e!=`string`||!e)return!1;try{let t=new URL(e,globalThis.location?.origin??`https://example.org`);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}};function Be(e){try{let t=new URL(e,globalThis.location?.origin??`https://example.org`),n=new URLSearchParams(t.hash.replace(/^#/,``)).has(`t`),r=new URLSearchParams(t.search).has(`p`),i=t.pathname,a=/^\/(?:stream|feed)\/p\/[^/]+$/.test(i),o=/^\/p~[^/?#]+$/.test(i);return n||r||a||o}catch{return!1}}function Ve(e){let t=new Uint8Array(e),n=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,r=[],i=t.length,a=0;for(;a+2>>18&63]+n[e>>>12&63]+n[e>>>6&63]+n[e&63])}let o=i-a;if(o===1){let e=t[a]<<16;r.push(n[e>>>18&63]+n[e>>>12&63]+`==`)}else if(o===2){let e=t[a]<<16|t[a+1]<<8;r.push(n[e>>>18&63]+n[e>>>12&63]+n[e>>>6&63]+`=`)}return r.join(``).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function X(e,t){if(typeof e!=`object`||!e)return;let n=e,r=n[t];if(typeof r==`string`)return r;let i=n.meta;if(typeof i==`object`&&i){let e=i[t];if(typeof e==`string`)return e}}function He(e,t){if(typeof e!=`object`||!e)return;let n=e,r=n[t];if(typeof r==`number`&&Number.isFinite(r))return r;let i=n.meta;if(typeof i==`object`&&i){let e=i[t];if(typeof e==`number`&&Number.isFinite(e))return e}}function Ue(e,t){if(!e)return;let n=[`sigilActionUrl`,`sigilUrl`,`actionUrl`,`url`,`claimedUrl`,`loginUrl`,`sourceUrl`,`originUrl`,`link`,`href`];if(t)for(let e of n){let n=t[e];if(ze(n))return n}try{let t=new DOMParser().parseFromString(e,`image/svg+xml`);for(let e of Array.from(t.getElementsByTagName(`metadata`))){let t=(e.textContent??``).trim();if(!t)continue;let r=t.replace(/^$/,``);try{let e=JSON.parse(r);if(typeof e==`object`&&e)for(let t of n){let n=e[t];if(ze(n))return n}}catch{let e=r.match(/https?:\/\/[^\s"'<>)#]+/i);if(e&&ze(e[0]))return e[0]}}for(let e of Array.from(t.getElementsByTagName(`a`))){let t=e.getAttribute(`href`)||e.getAttribute(`xlink:href`);if(ze(t))return t}}catch{}}async function We(e,t,n={}){let r=n.cacheName??`sigil-attachments-v1`,i=(n.pathPrefix??`/att/`).replace(/\/+$/,``)+`/`;try{if(!(`caches`in globalThis)||typeof caches.open!=`function`)return;let n=await caches.open(r),a=`${i}${e}`;return await n.put(new Request(a,{method:`GET`}),new Response(t,{headers:{"Content-Type":t.type||`application/octet-stream`}})),a}catch{return}}function Ge(e){let t=Math.floor(e/1e3);return`${Math.floor(t/60).toString().padStart(2,`0`)}:${(t%60).toString().padStart(2,`0`)}`}function Ke(e){let t=e.indexOf(` +import{$ as e,$t as t,A as n,D as r,E as i,En as a,F as o,Ht as s,K as c,M as l,N as u,O as d,P as f,Q as p,T as m,Tn as h,Z as g,_n as _,at as v,ct as y,dt as b,en as x,fn as ee,ft as S,gn as C,ht as w,j as T,jn as E,k as D,ln as O,lt as te,mn as k,nt as ne,ot as re,pn as A,pt as j,st as ie,tn as M,un as ae,ut as oe}from"./index-CcPm2yTY.js";import"./prop-types-CQ3MXKCa.js";import{n as se}from"./SigilAuthContext-CZfkVeGy.js";import{n as N,t as P}from"./sigilRegistry-NyXrDYsE.js";import{i as ce,r as le}from"./postSeal-ClZBwRbf.js";import{a as F,i as I,n as L,r as R,t as z}from"./VerifierFrame-Dr7oGdbu.js";var B=E(h(),1);const ue=(0,B.createContext)(void 0);var V=E(M(),1);function de({children:e}){let[t,n]=(0,B.useState)(null),r=(0,B.useMemo)(()=>({session:t,setSession:e=>n(e),clearSession:()=>n(null)}),[t]);return(0,V.jsx)(ue.Provider,{value:r,children:e})}function H(){let e=(0,B.useContext)(ue);if(!e)throw Error(`useSession must be used within a SessionProvider`);return e}var U=[`video/webm;codecs=vp9,opus`,`video/webm;codecs=vp8,opus`,`video/webm`,`video/mp4;codecs=h264,aac`,`video/mp4`],fe=typeof window<`u`&&`MediaRecorder`in window;async function pe(e){let t=await crypto.subtle.digest(`SHA-256`,e),n=new Uint8Array(t),r=``;for(let e=0;eW(),[]);function ne(){let e=typeof performance<`u`?performance:null,t=(e&&typeof e.timeOrigin==`number`?e.timeOrigin:NaN)+(e?e.now():NaN);return Number.isFinite(t)?Math.floor(t):Date.now()}(0,B.useEffect)(()=>{if(t)return(async()=>{s(null),l(!0);try{await re()}catch(e){s(e instanceof Error?e.message:`Failed to access camera.`)}finally{l(!1)}})(),()=>{A()}},[t,u,f]),(0,B.useEffect)(()=>{t&&j().catch(()=>_(!1))},[t,u]);async function re(){A();let e={audio:{echoCancellation:!0,noiseSuppression:!0},video:{facingMode:u,width:{ideal:1080},height:{ideal:1920},frameRate:{ideal:30,max:60}}},t=await navigator.mediaDevices.getUserMedia(e);C.current=t,w.current&&(w.current.srcObject=t,w.current.muted=!0,await w.current.play().catch(()=>{})),await ie(m&&g)}function A(){if(P(!0),w.current&&(w.current.pause(),w.current.srcObject=null),C.current)for(let e of C.current.getTracks())e.stop();C.current=null,h(!1),y(!1),x(0),S(0),O.current!==null&&(cancelAnimationFrame(O.current),O.current=null)}async function j(){let e=C.current;if(!e){_(!1);return}let[t]=e.getVideoTracks();if(!t){_(!1);return}let n=t.getCapabilities?.()??{};_(!!(typeof n.torch==`boolean`&&n.torch)&&u===`environment`)}async function ie(e){let t=C.current;if(!t)return;let[n]=t.getVideoTracks();if(!(!n||!n.applyConstraints))try{g&&u===`environment`&&await n.applyConstraints({advanced:[{torch:e}]})}catch{}}function M(){d(e=>e===`user`?`environment`:`user`)}function ae(){p(e=>!e)}async function oe(){if(!g)return;let e=!m;h(e),await ie(e)}function se(){if(!v)return;let e=performance.now()-D.current;if(S(e),x(Math.min(1,e/i)),e>=i){P(!1);return}O.current=requestAnimationFrame(se)}function N(){if(!fe){s(`MediaRecorder is not supported on this browser.`);return}if(v)return;s(null);let e=C.current;if(!e){s(`No camera stream.`);return}for(let t of e.getAudioTracks())t.enabled=!f;let t=te??``,n;try{n=t?new MediaRecorder(e,{mimeType:t,videoBitsPerSecond:35e5}):new MediaRecorder(e)}catch{n=new MediaRecorder(e)}T.current=n,E.current=[],n.ondataavailable=e=>{e.data&&e.data.size>0&&E.current.push(e.data)},n.onstop=()=>{ce()},n.start(250),y(!0),D.current=performance.now(),O.current=requestAnimationFrame(se)}function P(e){if(!v)return;let t=T.current;if(t){try{t.state!==`inactive`&&t.stop()}catch{}y(!1),O.current!==null&&(cancelAnimationFrame(O.current),O.current=null),e&&(E.current=[],x(0),S(0))}}async function ce(){let e=E.current;if(E.current=[],!e.length)return;let t=Math.max(0,Math.min(i,performance.now()-D.current)),n=T.current?.mimeType||te||`video/webm`,a=new Blob(e,{type:n}),o=ne(),s=k(BigInt(o)),{width:c,height:l,thumbnailDataUrl:u}=await le(a),d=await pe(await a.arrayBuffer()),f=`story_${s.toString()}.${n.includes(`mp4`)?`mp4`:`webm`}`;r({blob:a,file:new File([a],f,{type:n,lastModified:o}),mimeType:n,durationMs:t,width:c,height:l,thumbnailDataUrl:u,sha256:d,createdAt:o})}async function le(e){let t=URL.createObjectURL(e);try{let e=document.createElement(`video`);e.src=t,e.muted=!0,await e.play().catch(()=>void 0),await new Promise(t=>{let n=()=>{e.pause(),e.currentTime=0},r=()=>{n(),t()};e.onloadeddata=r,setTimeout(r,250)});let n=e.videoWidth||1080,r=e.videoHeight||1920,i=document.createElement(`canvas`);i.width=n,i.height=r;let a=i.getContext(`2d`);return a&&a.drawImage(e,0,0,n,r),{width:n,height:r,thumbnailDataUrl:i.toDataURL(`image/png`,.9)}}finally{URL.revokeObjectURL(t)}}function F(){v||N()}function I(){v&&P(!1)}function L(){v?P(!1):N()}return t?(0,V.jsxs)(`div`,{className:`story-rec-overlay`,role:`dialog`,"aria-modal":`true`,"aria-label":`Story recorder`,children:[(0,V.jsx)(`div`,{className:`story-rec-video-wrap`,children:(0,V.jsx)(`video`,{ref:w,className:`story-rec-video ${u===`user`?`mirror`:``}`,playsInline:!0})}),(0,V.jsxs)(`div`,{className:`story-rec-topbar`,children:[(0,V.jsx)(`button`,{type:`button`,className:`story-btn top left`,"aria-label":`Close`,onClick:()=>{A(),n()},children:`✕`}),(0,V.jsx)(`div`,{className:`story-top-center`,children:(0,V.jsxs)(`div`,{className:`story-timer mono`,children:[he(ee),` / `,he(i)]})}),(0,V.jsxs)(`div`,{className:`story-top-actions`,children:[(0,V.jsx)(`button`,{type:`button`,className:`story-btn ${f?`active`:``}`,"aria-pressed":f,"aria-label":f?`Unmute microphone`:`Mute microphone`,onClick:ae,title:f?`Unmute mic`:`Mute mic`,children:f?`🔇`:`🎙️`}),(0,V.jsx)(`button`,{type:`button`,className:`story-btn ${u===`environment`&&g?``:`disabled`}`,disabled:!(u===`environment`&&g),onClick:()=>void oe(),"aria-label":`Toggle torch`,title:g?m?`Torch on`:`Torch off`:`Torch not supported`,children:m?`🔦`:`💡`}),(0,V.jsx)(`button`,{type:`button`,className:`story-btn`,"aria-label":`Flip camera`,onClick:M,title:`Flip camera`,children:`🔁`})]})]}),(0,V.jsxs)(`div`,{className:`story-rec-bottombar`,children:[(0,V.jsx)(`div`,{className:`record-wrap`,children:(0,V.jsxs)(`button`,{type:`button`,className:`record-btn ${v?`recording`:``}`,"aria-pressed":v,"aria-label":v?`Stop recording`:`Start recording`,onClick:L,onPointerDown:F,onPointerUp:I,onPointerLeave:I,children:[(0,V.jsx)(`span`,{className:`progress-ring`,style:{background:`conic-gradient(currentColor ${b*360}deg, transparent 0)`}}),(0,V.jsx)(`span`,{className:`dot`})]})}),o&&(0,V.jsx)(`div`,{className:`story-rec-error`,children:o}),c&&(0,V.jsx)(`div`,{className:`story-rec-hint`,children:`Initializing camera…`})]})]}):null}function he(e){let t=Math.floor(e/1e3);return`${Math.floor(t/60).toString().padStart(2,`0`)}:${(t%60).toString().padStart(2,`0`)}`}var G={phiKey:[`userPhiKey`,`phiKey`,`phikey`,`ΦKey`,`walletPhiKey`],kaiSig:[`kaiSignature`,`kaiSig`,`ksig`,`ΣSig`,`sig`,`signature`],sigilId:[`sigilId`,`sigilID`,`glyphId`,`glyphID`,`sigil_id`,`glyph_id`],url:[`sigilActionUrl`,`sigilUrl`,`actionUrl`,`url`,`claimedUrl`,`loginUrl`,`sourceUrl`,`originUrl`,`link`,`href`]};function ge(e){if(typeof e!=`string`||!e.trim())return!1;try{let t=new URL(e,globalThis.location?.origin??`https://example.org`);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}}function K(e,t){if(typeof e!=`object`||!e)return;let n=e;for(let e of t){let t=n[e];if(typeof t==`string`&&t.trim())return t.trim()}let r=n.meta;if(typeof r==`object`&&r){let e=r;for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim())return t.trim()}}}function _e(e){return e.replace(/^$/,``).trim()}function ve(e){let t=e.trim();if(!t)return;try{let e=JSON.parse(t);if(typeof e==`object`&&e)return e}catch{}let n=t.match(/\{[\s\S]*\}/);if(n)try{let e=JSON.parse(n[0]);if(typeof e==`object`&&e)return e}catch{}}function ye(e,t){let n=RegExp(`${t}"?\\s*[:=]\\s*"?([^"\\n\\r<>{}]+)"?`,`i`),r=e.match(n);if(r)return(r[1]??``).trim()||void 0}function be(e){let t={};for(let n of G.phiKey){let r=ye(e,n);if(r){t.userPhiKey=r;break}}for(let n of G.kaiSig){let r=ye(e,n);if(r){t.kaiSignature=r;break}}for(let n of G.sigilId){let r=ye(e,n);if(r){t.sigilId=r;break}}for(let n of G.url){let r=ye(e,n);if(r&&ge(r))return t.actionUrl=r,t}let n=e.match(/https?:\/\/[^\s"'<>)#]+/i);return n&&ge(n[0])&&(t.actionUrl=n[0]),t}function xe(e,t){return{userPhiKey:e.userPhiKey??t.userPhiKey,kaiSignature:e.kaiSignature??t.kaiSignature,sigilId:e.sigilId??t.sigilId,actionUrl:e.actionUrl??t.actionUrl,meta:e.meta??t.meta}}function Se(e){let t=(e??``).trim();if(!t)return{};try{let e=new DOMParser().parseFromString(t,`image/svg+xml`),n=e.getElementsByTagName(`parsererror`);if(n&&n.length>0)return be(t);let r=e.documentElement,i={};if(r&&r.attributes)for(let e of Array.from(r.attributes))i[e.name]=e.value;let a={userPhiKey:K(i,G.phiKey),kaiSignature:K(i,G.kaiSig),sigilId:K(i,G.sigilId),actionUrl:(()=>{let e=K(i,G.url);return e&&ge(e)?e:void 0})(),meta:void 0},o=Array.from(e.getElementsByTagName(`metadata`));for(let e of o){let t=_e((e.textContent??``).trim());if(!t)continue;let n=ve(t);if(n){let e={userPhiKey:K(n,G.phiKey),kaiSignature:K(n,G.kaiSig),sigilId:K(n,G.sigilId),actionUrl:(()=>{let e=K(n,G.url);return e&&ge(e)?e:void 0})(),meta:n};if(a=xe(a,e),a.userPhiKey&&a.kaiSignature)return a}else a=xe(a,be(t))}for(let t of Array.from(e.getElementsByTagName(`desc`))){let e=_e((t.textContent??``).trim());if(!e)continue;let n=ve(e);if(n){let e={userPhiKey:K(n,G.phiKey),kaiSignature:K(n,G.kaiSig),sigilId:K(n,G.sigilId),actionUrl:(()=>{let e=K(n,G.url);return e&&ge(e)?e:void 0})(),meta:n};a=xe(a,e)}else a=xe(a,be(e));if(a.userPhiKey&&a.kaiSignature)return a}for(let t of Array.from(e.getElementsByTagName(`a`))){let e=t.getAttribute(`href`)||t.getAttribute(`xlink:href`);if(e&&ge(e)){a.actionUrl=a.actionUrl??e;break}}return(!a.userPhiKey||!a.kaiSignature)&&(a=xe(a,be(t))),a}catch{return be(t)}}var Ce=new TextEncoder;function q(){if(typeof crypto>`u`||!crypto.subtle)throw Error(`WebCrypto subtle unavailable`);return crypto.subtle}function we(e){if(e.buffer instanceof ArrayBuffer)return e;let t=new Uint8Array(e.byteLength);return t.set(e),t}function J(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`).trim();if(!/^[A-Za-z0-9+/]*={0,2}$/.test(t))throw Error(`Invalid base64/base64url`);let n=(4-t.length%4)%4,r=t+`=`.repeat(n),i=new Int16Array(128).fill(-1);for(let e=0;e<64;e++)i[`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.charCodeAt(e)]=e;let a=Math.floor(r.length*3/4)-(r.endsWith(`==`)?2:r.endsWith(`=`)?1:0),o=new Uint8Array(a),s=0;for(let e=0;e>>16&255),s>>8&255),s>>18&63]+t[r>>>12&63]+t[r>>>6&63]+t[r&63])}let a=r-i;if(a===1){let r=e[i]<<16;n.push(t[r>>>18&63]+t[r>>>12&63]+`==`)}else if(a===2){let r=e[i]<<16|e[i+1]<<8;n.push(t[r>>>18&63]+t[r>>>12&63]+t[r>>>6&63]+`=`)}return n.join(``).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function Ee(e){let t=e.trim().toLowerCase();if(!/^[0-9a-f]+$/.test(t)||t.length%2!=0)throw Error(`Invalid hex`);let n=new Uint8Array(t.length/2);for(let e=0;e=32&&t.length%2==0&&/^[0-9a-fA-F]+$/.test(t)}function Y(e){let t=e.trim();return t.length>=16&&/^[A-Za-z0-9\-_]+$/.test(t)}function Oe(e){let t=e.trim();if(!t)throw Error(`Empty kaiSignature`);if(De(t))return Ee(t);if(Y(t))try{return J(t)}catch{}return we(Ce.encode(t))}async function ke(e){let t=q(),n=await t.importKey(`raw`,e.ikm,{name:`HKDF`},!1,[`deriveBits`]),r=await t.deriveBits({name:`HKDF`,hash:`SHA-256`,salt:e.salt,info:e.info},n,e.bits);return new Uint8Array(r)}async function Ae(e){let t=we(Oe(e.baseKaiSignature)),n=we(J(e.salt_b64url)),r=(e.context??`KaiVoh.deriveKaiSignature.v1`).trim();return await ke({ikm:t,salt:n,info:we(Ce.encode(r)),bits:256})}async function je(e){return Te(await Ae(e))}function Me(){return(0,V.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`ico`,"aria-hidden":`true`,focusable:`false`,children:[(0,V.jsx)(`rect`,{x:`3`,y:`6`,width:`14`,height:`12`,rx:`3`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,V.jsx)(`circle`,{cx:`10`,cy:`12`,r:`3`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,V.jsx)(`path`,{d:`M17 9l4-2v10l-4-2z`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,V.jsx)(`circle`,{cx:`18.5`,cy:`5.5`,r:`2.5`,fill:`currentColor`})]})}function Ne(){return(0,V.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`ico`,"aria-hidden":`true`,focusable:`false`,children:[(0,V.jsx)(`path`,{d:`M3 6h18M9 6V4h6v2M7 6l1 14h8l1-14`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,V.jsx)(`path`,{d:`M10 10v6M14 10v6`,stroke:`currentColor`,strokeWidth:`2`})]})}var Pe=6e3,Fe=1024,Ie=1024*Fe,Le=e=>e>=Ie?`${(e/Ie).toFixed(2)} MB`:e>=Fe?`${(e/Fe).toFixed(2)} KB`:`${e} B`,Re=(e,t=8,n=6)=>e.length<=t+n?e:`${e.slice(0,t)}…${e.slice(-n)}`,ze=e=>{if(typeof e!=`string`||!e)return!1;try{let t=new URL(e,globalThis.location?.origin??`https://example.org`);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}};function Be(e){try{let t=new URL(e,globalThis.location?.origin??`https://example.org`),n=new URLSearchParams(t.hash.replace(/^#/,``)).has(`t`),r=new URLSearchParams(t.search).has(`p`),i=t.pathname,a=/^\/(?:stream|feed)\/p\/[^/]+$/.test(i),o=/^\/p~[^/?#]+$/.test(i);return n||r||a||o}catch{return!1}}function Ve(e){let t=new Uint8Array(e),n=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,r=[],i=t.length,a=0;for(;a+2>>18&63]+n[e>>>12&63]+n[e>>>6&63]+n[e&63])}let o=i-a;if(o===1){let e=t[a]<<16;r.push(n[e>>>18&63]+n[e>>>12&63]+`==`)}else if(o===2){let e=t[a]<<16|t[a+1]<<8;r.push(n[e>>>18&63]+n[e>>>12&63]+n[e>>>6&63]+`=`)}return r.join(``).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function X(e,t){if(typeof e!=`object`||!e)return;let n=e,r=n[t];if(typeof r==`string`)return r;let i=n.meta;if(typeof i==`object`&&i){let e=i[t];if(typeof e==`string`)return e}}function He(e,t){if(typeof e!=`object`||!e)return;let n=e,r=n[t];if(typeof r==`number`&&Number.isFinite(r))return r;let i=n.meta;if(typeof i==`object`&&i){let e=i[t];if(typeof e==`number`&&Number.isFinite(e))return e}}function Ue(e,t){if(!e)return;let n=[`sigilActionUrl`,`sigilUrl`,`actionUrl`,`url`,`claimedUrl`,`loginUrl`,`sourceUrl`,`originUrl`,`link`,`href`];if(t)for(let e of n){let n=t[e];if(ze(n))return n}try{let t=new DOMParser().parseFromString(e,`image/svg+xml`);for(let e of Array.from(t.getElementsByTagName(`metadata`))){let t=(e.textContent??``).trim();if(!t)continue;let r=t.replace(/^$/,``);try{let e=JSON.parse(r);if(typeof e==`object`&&e)for(let t of n){let n=e[t];if(ze(n))return n}}catch{let e=r.match(/https?:\/\/[^\s"'<>)#]+/i);if(e&&ze(e[0]))return e[0]}}for(let e of Array.from(t.getElementsByTagName(`a`))){let t=e.getAttribute(`href`)||e.getAttribute(`xlink:href`);if(ze(t))return t}}catch{}}async function We(e,t,n={}){let r=n.cacheName??`sigil-attachments-v1`,i=(n.pathPrefix??`/att/`).replace(/\/+$/,``)+`/`;try{if(!(`caches`in globalThis)||typeof caches.open!=`function`)return;let n=await caches.open(r),a=`${i}${e}`;return await n.put(new Request(a,{method:`GET`}),new Response(t,{headers:{"Content-Type":t.type||`application/octet-stream`}})),a}catch{return}}function Ge(e){let t=Math.floor(e/1e3);return`${Math.floor(t/60).toString().padStart(2,`0`)}:${(t%60).toString().padStart(2,`0`)}`}function Ke(e){let t=e.indexOf(` `);return t>=0?e.slice(0,t):e}function qe(e,t){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}var Je=()=>{let e=Number(k());if(!Number.isSafeInteger(e))throw Error(`kairosEpochNow out of safe integer range`);return e},Z=()=>typeof performance<`u`&&typeof performance.now==`function`?performance.now():Je(),Ye=async()=>{await new Promise(e=>requestAnimationFrame(()=>e()))},Xe=async(e,t,n)=>{let r=null,i=new Promise((e,i)=>{r=window.setTimeout(()=>i(Error(`${n} timed out`)),t)});try{return await Promise.race([e,i])}finally{r!==null&&window.clearTimeout(r)}},Ze=()=>{let e=typeof crypto<`u`?crypto:void 0;return e&&`randomUUID`in e&&typeof e.randomUUID==`function`?e.randomUUID():`${Math.floor(Z()).toString(36)}-${Math.random().toString(36).slice(2)}`},Q=null,$=new Map;function Qe(){if(Q)return Q;if(typeof window>`u`)throw Error(`encode worker unavailable (no window)`);if(typeof Worker>`u`)throw Error(`encode worker unavailable (Worker not supported)`);let e=new URL(`data:video/mp2t;base64,Ly8vIDxyZWZlcmVuY2UgbGliPSJ3ZWJ3b3JrZXIiIC8+CgppbXBvcnQgewogIGVuY29kZVRva2VuV2l0aEJ1ZGdldHMsCiAgdHlwZSBGZWVkUG9zdFBheWxvYWQsCn0gZnJvbSAiLi4vLi4vdXRpbHMvZmVlZFBheWxvYWQiOwoKdHlwZSBFbmNvZGVXb3JrZXJSZXF1ZXN0ID0gewogIGlkOiBzdHJpbmc7CiAgcGF5bG9hZDogRmVlZFBvc3RQYXlsb2FkOwp9OwoKdHlwZSBFbmNvZGVXb3JrZXJSZXNwb25zZSA9CiAgfCB7IGlkOiBzdHJpbmc7IG9rOiB0cnVlOyB0b2tlbjogc3RyaW5nOyB3aXRoaW5IYXJkOiBib29sZWFuOyBtczogbnVtYmVyIH0KICB8IHsgaWQ6IHN0cmluZzsgb2s6IGZhbHNlOyBlcnJvcjogc3RyaW5nOyBtczogbnVtYmVyIH07Cgpjb25zdCBub3cgPSAoKTogbnVtYmVyID0+CiAgc2VsZi5wZXJmb3JtYW5jZSAmJiB0eXBlb2Ygc2VsZi5wZXJmb3JtYW5jZS5ub3cgPT09ICJmdW5jdGlvbiIKICAgID8gc2VsZi5wZXJmb3JtYW5jZS5ub3coKQogICAgOiAwOwoKc2VsZi5vbm1lc3NhZ2UgPSAoZXY6IE1lc3NhZ2VFdmVudDxFbmNvZGVXb3JrZXJSZXF1ZXN0PikgPT4gewogIGNvbnN0IHQwID0gbm93KCk7CiAgY29uc3QgZGF0YSA9IGV2LmRhdGE7CgogIHRyeSB7CiAgICBjb25zdCBvdXQgPSBlbmNvZGVUb2tlbldpdGhCdWRnZXRzKGRhdGEucGF5bG9hZCk7CiAgICBjb25zdCBtc2c6IEVuY29kZVdvcmtlclJlc3BvbnNlID0gewogICAgICBpZDogZGF0YS5pZCwKICAgICAgb2s6IHRydWUsCiAgICAgIHRva2VuOiBvdXQudG9rZW4sCiAgICAgIHdpdGhpbkhhcmQ6IG91dC53aXRoaW5IYXJkLAogICAgICBtczogbm93KCkgLSB0MCwKICAgIH07CiAgICBzZWxmLnBvc3RNZXNzYWdlKG1zZyk7CiAgfSBjYXRjaCAoZSkgewogICAgY29uc3QgbXNnOiBFbmNvZGVXb3JrZXJSZXNwb25zZSA9IHsKICAgICAgaWQ6IGRhdGEuaWQsCiAgICAgIG9rOiBmYWxzZSwKICAgICAgZXJyb3I6IGUgaW5zdGFuY2VvZiBFcnJvciA/IGUubWVzc2FnZSA6IFN0cmluZyhlKSwKICAgICAgbXM6IG5vdygpIC0gdDAsCiAgICB9OwogICAgc2VsZi5wb3N0TWVzc2FnZShtc2cpOwogIH0KfTsK`,``+import.meta.url);return Q=new Worker(e,{type:`module`,name:`kaiVohEncodeWorker`}),Q.onmessage=e=>{let t=e.data,n=$.get(t.id);n&&($.delete(t.id),n(t))},Q.onerror=()=>{for(let[e,t]of $)t({id:e,ok:!1,error:`encode worker crashed`,ms:0});$.clear();try{Q?.terminate()}catch{}Q=null},Q}async function $e(e){let t=Qe(),n=Ze();return new Promise(r=>{$.set(n,r);let i={id:n,payload:e};t.postMessage(i)})}async function et(e){let t=Z(),n=()=>{try{let n=ne(e);return{id:Ze(),ok:!0,token:n.token,withinHard:n.withinHard,ms:Z()-t}}catch(e){return{id:Ze(),ok:!1,error:e instanceof Error?e.message:String(e),ms:Z()-t}}};try{let t=await $e(e);if(!t.ok){let e=n();return e.ok?e:t}return t}catch{return n()}}function tt({initialCaption:e=``,initialAuthor:t=``,onExhale:n}){let{auth:r}=se(),i=r.meta,[a,o]=(0,B.useState)(e),[s,l]=(0,B.useState)(t),[u,d]=(0,B.useState)(`text`),[f,m]=(0,B.useState)(`tsx`),[h,g]=(0,B.useState)(`code`),[x,ee]=(0,B.useState)(``),[C,T]=(0,B.useState)(``),[E,D]=(0,B.useState)(``),[O,k]=(0,B.useState)([]),[ne,A]=(0,B.useState)([]),[M,ae]=(0,B.useState)({version:1,totalBytes:0,inlinedBytes:0,items:[]}),N=(0,B.useRef)(M),[F,I]=(0,B.useState)(!1),[L,R]=(0,B.useState)(null),[z,ue]=(0,B.useState)(!1),[de,H]=(0,B.useState)(``),[U,fe]=(0,B.useState)(null),[pe,W]=(0,B.useState)(null),[he,G]=(0,B.useState)(null),[ge,K]=(0,B.useState)(!1),[_e,ve]=(0,B.useState)(``),[ye,be]=(0,B.useState)(0),[xe,Ce]=(0,B.useState)(`path`),[q,we]=(0,B.useState)(!1),[J,Te]=(0,B.useState)(`derived`),[Ee,De]=(0,B.useState)(``),[Y,Oe]=(0,B.useState)(()=>le(18)),[ke,Ae]=(0,B.useState)([]),[Fe,Ie]=(0,B.useState)(!1),Ze=(0,B.useRef)(null),Q=!!i;(0,B.useEffect)(()=>o(e),[e]),(0,B.useEffect)(()=>l(t),[t]),(0,B.useEffect)(()=>{N.current=M},[M]),(0,B.useEffect)(()=>()=>{L&&URL.revokeObjectURL(L.url)},[]);let $=(0,B.useMemo)(()=>X(i,`sigilActionUrl`)||X(i,`sigilUrl`)||X(i,`actionUrl`)||X(i,`url`)||X(i,`claimedUrl`)||X(i,`loginUrl`)||X(i,`sourceUrl`)||X(i,`originUrl`)||X(i,`link`)||X(i,`href`)||Ue(r.svgText,i??{})||(globalThis.location?.origin??`https://kaiklok.com`),[i,r.svgText]);(0,B.useEffect)(()=>{i&&(ee(X(i,`userPhiKey`)??``),T(X(i,`kaiSignature`)??``))},[i]),(0,B.useEffect)(()=>{q&&(Y.trim()||Oe(le(18)))},[q,Y]);let Qe=()=>{let e=E.trim();if(!ze(e)){G(`Invalid URL. Enter a full http(s) link.`);return}k(t=>[...t,j({url:e})]),D(``),G(null)},$e=e=>{k(t=>t.filter((t,n)=>n!==e))};function tt(e){let t=e,n=typeof t.webkitRelativePath==`string`?t.webkitRelativePath:``;return n.trim()?n:e.name}async function nt(e){let t=await e.arrayBuffer(),n=await crypto.subtle.digest(`SHA-256`,t),r=new Uint8Array(n),i=``;for(let e=0;e{let t=N.current.items.slice(),n=[];for(let r of e){let e=tt(r);if(q&&r.size>Pe){n.push(e);continue}if(r.size<=Pe){let n=await r.arrayBuffer();t.push(oe({name:e,type:r.type||`application/octet-stream`,size:r.size,data_b64url:Ve(n)}))}else{let n=await nt(r),i=await We(n,r,{cacheName:`sigil-attachments-v1`,pathPrefix:`/att/`});t.push(y({sha256:n,name:e,type:r.type||`application/octet-stream`,size:r.size,url:i}))}}return n.length>0&&G(`Private (Sealed) mode cannot include cache-backed large files. Skipped: ${n.slice(0,3).join(`, `)}${n.length>3?` (+${n.length-3} more)`:``}. Attach as a URL instead (Drive/S3/IPFS/etc), or keep files ≤ ${Le(Pe)}.`),v(t)},it=async e=>{if(!e.target.files)return;let t=Array.from(e.target.files);A(e=>[...e,...t]),ae(await rt(t))},at=async e=>{if(e.preventDefault(),e.stopPropagation(),!e.dataTransfer?.files?.length)return;let t=Array.from(e.dataTransfer.files);A(e=>[...e,...t]),ae(await rt(t))},ot=e=>{e.preventDefault(),e.stopPropagation()},st=()=>{A([]);let e={version:1,totalBytes:0,inlinedBytes:0,items:[]};ae(e),N.current=e};function ct(e){let[,t]=e.split(`,`,2);return t?Math.ceil(t.length*3/4):0}async function lt(e){if(q){G(`Private (Sealed) mode cannot include recorded stories (cache-backed video refs). Upload as a URL instead.`),I(!1);return}let t=await We(e.sha256,e.file,{cacheName:`sigil-attachments-v1`,pathPrefix:`/att/`}),n=y({sha256:e.sha256,name:e.file.name,type:e.mimeType||e.file.type||`video/webm`,size:e.file.size,url:t}),r=(e.thumbnailDataUrl.split(`,`,2)[1]??``).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``),i=oe({name:e.file.name.replace(/\.(webm|mp4)$/i,``)+`_thumb.png`,type:`image/png`,size:ct(e.thumbnailDataUrl),data_b64url:r});ae(v([...N.current.items,n,i])),L&&URL.revokeObjectURL(L.url),R({url:URL.createObjectURL(e.file),durationMs:e.durationMs}),I(!1)}let ut=a.trim(),dt=(0,B.useMemo)(()=>ut?u===`text`?S(ut):u===`md`?b(ut):u===`html`?te(ut,h):ie(ut,f.trim()||void 0):void 0,[ut,u,f,h]),ft=(0,B.useMemo)(()=>{if(!ut)return;let e=Ke(ut).trim();if(e){if(u===`code`){let t=f.trim();return qe(`${t?`code:${t}`:`code`} — ${e}`,220)}return qe(u===`md`?`md — ${e}`:u===`html`?`html — ${e}`:e,220)}},[ut,u,f]),pt=(0,B.useMemo)(()=>N.current.items.some(e=>e.kind===`file-ref`),[M]),mt=(0,B.useMemo)(()=>{if(!q)return ft;let e=Ee.trim();return e?qe(e,220):`Sealed Memory`},[q,ft,Ee]),ht=q&&J===`derived`&&Q&&!!C.trim(),gt=q&&J===`glyph`&&ke.length>0,_t=(0,B.useMemo)(()=>q?Q?J===`derived`?C.trim()?Y.trim()?(0,V.jsxs)(`div`,{className:`composer-hint`,children:[`Mode: `,(0,V.jsx)(`strong`,{children:`Derived Glyph Access`}),` • Any derivative glyph exported from this issuer glyph can unlock • Salt length`,` `,(0,V.jsx)(`strong`,{children:Y.trim().length})]}):(0,V.jsx)(`div`,{className:`composer-hint warn`,children:`Derivation salt missing — rotate to generate.`}):(0,V.jsx)(`div`,{className:`composer-hint warn`,children:`Derived access requires ΣSig (kaiSignature) present in your verified glyph.`}):ke.length===0?(0,V.jsx)(`div`,{className:`composer-hint warn`,children:`Mode: Specific Glyph Access requires at least one allowed glyph SVG uploaded.`}):(0,V.jsxs)(`div`,{className:`composer-hint`,children:[`Mode: `,(0,V.jsx)(`strong`,{children:`Specific Glyph Access`}),` • Allowed glyphs `,(0,V.jsx)(`strong`,{children:ke.length})]}):(0,V.jsx)(`div`,{className:`composer-hint warn`,children:`Private (Sealed) requires a verified glyph session.`}):null,[q,Q,J,C,Y,ke.length]),vt=async e=>{if(e.length===0)return;let t=[],n=[];for(let r of e)try{let e=Se(await r.text()),i=(e.userPhiKey??``).trim(),a=(e.kaiSignature??``).trim();if(!i||!a){n.push(r.name);continue}t.push({label:r.name,phiKey:i,kaiSignature:a,sigilId:(e.sigilId??``).trim()?(e.sigilId??``).trim():void 0})}catch{n.push(r.name)}t.length>0&&(Ae(e=>{let n=e.slice(),r=new Set(e.map(e=>`${e.phiKey}:${e.kaiSignature}`));for(let e of t){let t=`${e.phiKey}:${e.kaiSignature}`;r.has(t)||(r.add(t),n.push(e))}return n}),G(null)),n.length>0&&G(`Some glyph SVGs were missing ΦKey/ΣSig metadata and were not added: ${n.slice(0,3).join(`, `)}${n.length>3?` (+${n.length-3} more)`:``}.`)},yt=e=>{Ae(t=>t.filter((t,n)=>n!==e))},bt=async()=>{if(z)return;W(null),G(null),K(!1),ve(``),be(0),Ce(`path`),fe(null);let e=($||``).trim(),t=Be(e);if(t||G(`Proof of Breath™ URL not detected; using fallback. Link generation will still work.`),q){if([...N.current.items,...O].some(e=>e.kind===`file-ref`)){W(`Private (Sealed) mode cannot include cache-backed file refs. Keep files ≤ ${Le(Pe)} (inline) or attach public URLs.`);return}if(J===`derived`&&!ht){W(`Private (Sealed) → Derived mode requires a verified glyph with ΣSig (kaiSignature) present.`);return}if(J===`glyph`&&!gt){W(`Private (Sealed) → Specific Glyph mode requires at least one allowed glyph SVG uploaded.`);return}}let r,a;try{a=Je(),r=_(new Date(a)).pulse}catch{W(`Failed to compute Kai pulse.`);return}let o=Z();try{ue(!0),H(`paint`),await Ye(),await Ye(),H(`assemble`);let l=[...N.current.items,...O],u=l.length>0?v(l):void 0,d=t?e:void 0,f=d?c(d)??d:void 0,m=X(i,`sigilId`)||X(i,`sigilID`)||X(i,`glyphId`)||void 0,h=re({url:e,pulse:r,caption:mt,body:dt,author:s.trim()?s.trim():void 0,source:`manual`,sigilId:m,phiKey:Q&&x?x:void 0,kaiSignature:Q&&C?C:void 0,ts:a,attachments:u,parentUrl:d,originUrl:f});H(`prepare`);let g=Z(),_=await Xe(w(h,{cacheName:`sigil-attachments-v1`,pathPrefix:`/att/`}),2e4,`preparePayloadForLink`),y=Z()-g,b=_;if(q){let e={body:_.body??null,attachments:_.attachments??null},t;if(J===`derived`){let n=Y.trim()?Y.trim():le(18);n!==Y&&Oe(n),t=await ce({inner:e,teaser:mt??void 0,derived:{issuerKaiSignature:C,issuerPhiKey:x||void 0,salt_b64url:n}})}else{let n=ke.map(e=>({phiKey:e.phiKey,kaiSignature:e.kaiSignature,sigilId:e.sigilId}));t=await ce({inner:e,teaser:mt??void 0,allowGlyphs:n})}b={..._,body:void 0,attachments:void 0,seal:t}}H(`encode(worker)`);let ee=Z(),S=await Xe(et(b),3e4,`encodeTokenWithBudgets(worker)`),T=Z()-ee;if(!S.ok){fe({stage:`encode(worker)`,totalMs:Z()-o,prepareMs:y,encodeMs:S.ms,items:l.length,inlinedBytes:u?.inlinedBytes,totalBytes:u?.totalBytes,note:S.error}),W(`Token encode failed: ${S.error}. If you have a strict CSP, allow module workers from 'self' (worker-src 'self'). This build uses a real worker file (no blob workers).`);return}let{token:E,withinHard:D}=S;be(E.length);let te=globalThis.location?.origin??`https://kaiklok.com`,k=D?`${te}/stream/p/${encodeURIComponent(E)}`:`${te}/stream#t=${E}`;Ce(D?`path`:`hash`),E.length>3500?G(`Token exceeds hard path limit (${E.length.toLocaleString()} > ${p.toLocaleString()}). Using hash URL to avoid request-line limits.`):E.length>1800&&G(`Token is large (${E.length.toLocaleString()} chars). Prefer trimming inlined files or relying on external URLs.`),H(`register`),P(k),H(`clipboard`);try{await navigator.clipboard.writeText(k),K(!0)}catch{K(!1)}ve(k),fe({stage:`done`,totalMs:Z()-o,prepareMs:y,encodeMs:T,tokenLen:E.length,items:l.length,inlinedBytes:u?.inlinedBytes,totalBytes:u?.totalBytes}),n&&n({shareUrl:k,token:E,payload:b})}catch(e){let t=e instanceof Error?e.message:typeof e==`string`?e:`Failed to generate link.`;W(t),fe({stage:de||`unknown`,totalMs:Z()-o,note:t})}finally{H(``),ue(!1)}},xt=()=>{o(e||``),l(t||``),d(`text`),m(`tsx`),g(`code`),D(``),k([]),st(),W(null),G(null),K(!1),ve(``),be(0),Ce(`path`),H(``),fe(null),De(``),Ie(!1),L&&(URL.revokeObjectURL(L.url),R(null))},St=e=>t=>e(t.target.value),Ct=(0,B.useMemo)(()=>{if(!Q)return null;let e=He(i,`pulse`);return(0,V.jsxs)(`div`,{className:`id-banner`,role:`status`,"aria-live":`polite`,children:[(0,V.jsx)(`span`,{className:`id-dot`}),(0,V.jsxs)(`span`,{className:`id-text`,children:[`Verified by Sigil — ΦKey `,(0,V.jsx)(`strong`,{children:Re(x)}),` • `,`Last verified pulse `,(0,V.jsx)(`strong`,{children:e??`—`})]}),(0,V.jsxs)(`span`,{className:`id-sub mono`,children:[`ΣSig `,Re(C)]})]})},[Q,x,C,i]),wt=(0,B.useMemo)(()=>$?(0,V.jsxs)(`div`,{className:`composer`,children:[(0,V.jsx)(`label`,{className:`composer-label`,children:`Proof Of Breath™ URL`}),(0,V.jsxs)(`div`,{className:`composer-input-row`,children:[(0,V.jsx)(`input`,{className:`composer-input locked`,type:`url`,value:$,readOnly:!0}),(0,V.jsx)(`button`,{type:`button`,className:`composer-aux`,onClick:async()=>{try{await navigator.clipboard.writeText($),K(!0),window.setTimeout(()=>K(!1),1200)}catch{}},title:`Remember Proof Of Breath™ URL`,children:ge?`Remembered ✓`:`Remember`})]}),!Be($)&&(0,V.jsx)(`div`,{className:`composer-hint warn`,children:`No canonical stream token detected in the URL. Fallback will still produce a valid post.`})]}):null,[$,ge]),Tt=(0,V.jsxs)(`div`,{className:`composer`,children:[(0,V.jsx)(`label`,{className:`composer-label`,children:`Privacy Seal`}),(0,V.jsxs)(`div`,{className:`story-actions`,style:{alignItems:`center`,gap:10},children:[(0,V.jsx)(`button`,{type:`button`,className:`pill ${q?`prim`:`subtle`}`,onClick:()=>{we(e=>!e),W(null),G(null)},title:`Toggle Private (Sealed)`,children:q?`Private: ON`:`Private: OFF`}),q&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`button`,{type:`button`,className:`pill ${J===`derived`?`prim`:`subtle`}`,onClick:()=>Te(`derived`),title:`Derived glyph access`,children:`Derived`}),(0,V.jsx)(`button`,{type:`button`,className:`pill ${J===`glyph`?`prim`:`subtle`}`,onClick:()=>Te(`glyph`),title:`Specific glyph allowlist`,children:`Specific Glyph`}),(0,V.jsx)(`button`,{type:`button`,className:`pill ${Fe?`prim`:`subtle`}`,onClick:()=>Ie(e=>!e),title:`Show advanced sealing details`,children:`Advanced`})]})]}),q&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`composer-hint`,children:[`Private (Sealed) encrypts `,(0,V.jsx)(`span`,{className:`mono`,children:`body + seals`}),` inside the token. The outer post remains verifiable (ΦKey/ΣSig) but does not contain plaintext content.`]}),(0,V.jsxs)(`div`,{className:`composer`,style:{padding:0,marginTop:10},children:[(0,V.jsx)(`label`,{className:`composer-label`,children:`Public teaser (optional)`}),(0,V.jsx)(`input`,{className:`composer-input`,type:`text`,value:Ee,onChange:St(De),placeholder:`What should be visible without unlocking?`,maxLength:240}),(0,V.jsxs)(`div`,{className:`composer-hint`,children:[`If empty, the public message becomes `,(0,V.jsx)(`span`,{className:`mono`,children:`Sealed Memory`}),`.`]})]}),J===`derived`&&(0,V.jsxs)(`div`,{className:`composer`,style:{padding:0,marginTop:10},children:[(0,V.jsx)(`label`,{className:`composer-label`,children:`Derivation salt (for verifier export)`}),(0,V.jsxs)(`div`,{className:`composer-input-row`,children:[(0,V.jsx)(`input`,{className:`composer-input mono`,type:`text`,readOnly:!0,value:Y}),(0,V.jsx)(`button`,{type:`button`,className:`composer-aux`,onClick:()=>Oe(le(18)),title:`Rotate derivation salt`,children:`Rotate`}),(0,V.jsx)(`button`,{type:`button`,className:`composer-aux`,onClick:async()=>{try{await navigator.clipboard.writeText(Y),K(!0),window.setTimeout(()=>K(!1),900)}catch{}},title:`remember salt`,children:`Remember`})]}),Fe&&(0,V.jsx)(`div`,{className:`composer-hint mono`,style:{marginTop:8},children:Q&&C.trim()?(0,V.jsxs)(V.Fragment,{children:[`Derived ΣSig (b64url, post-scoped): `,(0,V.jsx)(`button`,{type:`button`,className:`pill subtle`,onClick:async()=>{try{let e=await je({baseKaiSignature:C,salt_b64url:Y});await navigator.clipboard.writeText(e),K(!0),window.setTimeout(()=>K(!1),900)}catch{}},title:`Copy derived signature`,children:`Remember derived ΣSig`}),(0,V.jsx)(`span`,{className:`dim`,style:{marginLeft:8},children:`(secret-equivalent; only for issuer export workflows)`})]}):`Derived preview unavailable (missing verified ΣSig).`})]}),J===`glyph`&&(0,V.jsxs)(`div`,{className:`composer`,style:{padding:0,marginTop:10},children:[(0,V.jsx)(`label`,{className:`composer-label`,children:`Allowed glyphs (upload SVG)`}),(0,V.jsxs)(`div`,{className:`story-actions`,style:{alignItems:`center`},children:[(0,V.jsxs)(`label`,{className:`pill`,children:[(0,V.jsx)(`input`,{type:`file`,accept:`.svg,image/svg+xml`,multiple:!0,className:`visually-hidden`,onChange:async e=>{let t=e.target.files?Array.from(e.target.files):[];e.currentTarget.value=``,t.length!==0&&await vt(t)}}),`Seal allowed glyphs…`]}),ke.length>0&&(0,V.jsx)(`button`,{type:`button`,className:`pill subtle`,onClick:()=>Ae([]),title:`Clear allowlist`,children:`Clear`})]}),ke.length>0&&(0,V.jsx)(`ul`,{className:`url-list`,style:{marginTop:10},children:ke.map((e,t)=>(0,V.jsxs)(`li`,{className:`url-item`,style:{alignItems:`center`},children:[(0,V.jsx)(`span`,{className:`badge`,children:`glyph`}),(0,V.jsx)(`span`,{className:`mono`,children:qe(e.label,36)}),(0,V.jsxs)(`span`,{className:`dim`,style:{marginLeft:10},children:[`ΦKey `,Re(e.phiKey,10,8)]}),(0,V.jsx)(`button`,{type:`button`,className:`pill danger`,onClick:()=>yt(t),title:`Remove glyph`,children:`✕`})]},`${e.phiKey}:${e.kaiSignature}:${t}`))}),(0,V.jsxs)(`div`,{className:`composer-hint`,style:{marginTop:8},children:[`This is `,(0,V.jsx)(`strong`,{children:`not`}),` pulse-locked — if a user possesses an allowed glyph (its ΣSig), they can unlock sealed posts across pulses.`]})]}),(0,V.jsxs)(`div`,{className:`composer-hint warn`,style:{marginTop:10},children:[`Private (Sealed) hard-guard: no cache-backed `,(0,V.jsx)(`span`,{className:`mono`,children:`file-ref`}),` attachments. Use URLs or keep files ≤`,` `,(0,V.jsx)(`strong`,{children:Le(Pe)}),`.`]}),_t]})]}),Et=(0,V.jsxs)(`div`,{className:`attachments`,children:[(0,V.jsx)(`h3`,{className:`attachments-title`,children:`Seals`}),(0,V.jsxs)(`div`,{className:`composer`,children:[(0,V.jsx)(`label`,{className:`composer-label`,children:`Seal a memory`}),(0,V.jsxs)(`div`,{className:`story-actions`,children:[(0,V.jsx)(`button`,{type:`button`,className:`pill prim icon-only${q?` disabled`:``}`,"aria-label":`Open Memory Recorder`,title:q?`Private mode: story capture is disabled (cache-backed)`:`Record story`,onClick:()=>{if(q){G(`Private (Sealed) mode disables story recording (cache-backed file refs). Add as URL instead.`);return}I(!0)},disabled:q,children:(0,V.jsx)(Me,{})}),L&&(0,V.jsxs)(`div`,{className:`story-preview`,children:[(0,V.jsx)(`video`,{src:L.url,playsInline:!0,controls:!0,className:`story-preview-video`}),(0,V.jsx)(`div`,{className:`story-preview-meta mono`,children:Ge(L.durationMs)}),(0,V.jsx)(`button`,{type:`button`,className:`pill danger icon-only`,onClick:()=>{URL.revokeObjectURL(L.url),R(null)},"aria-label":`Remove recorded preview`,title:`Remove preview`,children:(0,V.jsx)(Ne,{})})]})]})]}),(0,V.jsxs)(`div`,{className:`composer`,children:[(0,V.jsx)(`label`,{className:`composer-label`,children:`Seal any URL`}),(0,V.jsxs)(`div`,{className:`composer-input-row`,children:[(0,V.jsx)(`input`,{className:`composer-input`,type:`url`,placeholder:`https://example.com/docs/your-file.pdf`,value:E,onChange:St(D),autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1}),(0,V.jsx)(`button`,{type:`button`,className:`composer-aux`,onClick:Qe,title:`Add URL`,children:`Seal`})]}),O.length>0&&(0,V.jsx)(`ul`,{className:`url-list`,children:O.map((e,t)=>(0,V.jsxs)(`li`,{className:`url-item`,children:[(0,V.jsx)(`span`,{className:`mono`,children:Re(e.url,28,16)}),(0,V.jsx)(`button`,{type:`button`,className:`pill danger`,onClick:()=>$e(t),title:`Remove URL`,children:`✕`})]},`${e.url}-${t}`))})]}),(0,V.jsx)(`div`,{ref:Ze,className:`dropzone`,onDragOver:ot,onDrop:at,"aria-label":`Drop files or folders here`,children:(0,V.jsxs)(`div`,{className:`dropzone-inner`,children:[(0,V.jsx)(`div`,{className:`dz-title`,children:`Seal files or folders`}),(0,V.jsxs)(`div`,{className:`dz-sub`,children:[`Tiny files get inlined; large files become cache-backed refs.`,q?(0,V.jsxs)(V.Fragment,{children:[` `,(0,V.jsx)(`strong`,{children:`(Private mode skips large files.)`})]}):null]}),(0,V.jsxs)(`div`,{className:`dz-actions`,children:[(0,V.jsxs)(`label`,{className:`pill`,children:[(0,V.jsx)(`input`,{type:`file`,multiple:!0,onChange:it,className:`visually-hidden`}),`Inhale files…`]}),(0,V.jsxs)(`label`,{className:`pill`,children:[(0,V.jsx)(`input`,{type:`file`,multiple:!0,webkitdirectory:``,onChange:it,className:`visually-hidden`}),`Inhale folder…`]}),ne.length>0&&(0,V.jsx)(`button`,{type:`button`,className:`pill subtle`,onClick:st,children:`Reset`})]})]})}),M.items.length>0&&(0,V.jsxs)(`div`,{className:`file-summary`,children:[(0,V.jsxs)(`div`,{className:`composer-hint`,children:[`Items: `,(0,V.jsx)(`strong`,{children:M.items.length}),` • Files total: `,(0,V.jsx)(`strong`,{children:Le(M.totalBytes??0)}),` • Inlined:`,` `,(0,V.jsx)(`strong`,{children:Le(M.inlinedBytes??0)}),` (≤ `,Le(Pe),` each)`]}),(0,V.jsx)(`ul`,{className:`file-list`,children:M.items.map((e,t)=>{if(e.kind===`url`)return(0,V.jsx)(`li`,{className:`file-item`,children:(0,V.jsxs)(`div`,{className:`file-row`,children:[(0,V.jsx)(`span`,{className:`badge`,children:`url`}),(0,V.jsx)(`span`,{className:`mono`,children:Re(e.url,34,18)})]})},`url-${t}`);let n=e.name??`file-${t}`,r=e.kind===`file-inline`,i=`type`in e&&typeof e.type==`string`?e.type:`application/octet-stream`,a=`size`in e&&typeof e.size==`number`?e.size:0;return(0,V.jsx)(`li`,{className:`file-item`,children:(0,V.jsxs)(`div`,{className:`file-row`,children:[(0,V.jsx)(`span`,{className:`badge`,children:r?`inline`:`file`}),(0,V.jsx)(`span`,{className:`mono`,children:n}),(0,V.jsxs)(`span`,{className:`dim`,children:[i,` • `,Le(a)]})]})},`${n}-${t}`)})}),M.items.some(e=>e.kind===`file-ref`)&&(0,V.jsxs)(`div`,{className:`composer-hint ${q?`warn`:``}`,children:[`Large files are cached and referenced by SHA-256.`,q?` Private (Sealed) will refuse these — attach public URLs instead.`:` You can also host publicly and attach the public URL above.`]})]})]}),Dt=u===`code`?10:3,Ot=u===`code`?`Paste your code…`:u===`md`?`Write markdown…`:u===`html`?`Write HTML… (default renders as escaped code unless sanitized by the stream UI)`:`What Resonants About This Moment…`,kt=z||q&&J===`derived`&&!ht||q&&J===`glyph`&&!gt||q&&pt;return(0,V.jsxs)(`div`,{className:`social-connector-container`,children:[(0,V.jsx)(`h2`,{className:`social-connector-title`,children:`KaiVoh`}),(0,V.jsxs)(`p`,{className:`social-connector-sub`,children:[`Exhale a sealed `,(0,V.jsx)(`strong`,{children:`Memory Stream`}),`.`]}),Ct,wt,Tt,(0,V.jsxs)(`div`,{className:`composer`,children:[(0,V.jsx)(`label`,{className:`composer-label`,children:`Body Format`}),(0,V.jsxs)(`div`,{className:`story-actions`,children:[(0,V.jsx)(`button`,{type:`button`,className:`pill ${u===`text`?`prim`:`subtle`}`,onClick:()=>d(`text`),title:`Text`,children:`Text`}),(0,V.jsx)(`button`,{type:`button`,className:`pill ${u===`code`?`prim`:`subtle`}`,onClick:()=>d(`code`),title:`Code`,children:`Code`}),(0,V.jsx)(`button`,{type:`button`,className:`pill ${u===`md`?`prim`:`subtle`}`,onClick:()=>d(`md`),title:`Markdown`,children:`MD`}),(0,V.jsx)(`button`,{type:`button`,className:`pill ${u===`html`?`prim`:`subtle`}`,onClick:()=>d(`html`),title:`HTML`,children:`HTML`}),u===`code`&&(0,V.jsx)(`input`,{className:`composer-input`,style:{maxWidth:160},value:f,onChange:St(m),placeholder:`lang (tsx)`,"aria-label":`Code language`,autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1}),u===`html`&&(0,V.jsxs)(`button`,{type:`button`,className:`pill ${h===`code`?`prim`:`subtle`}`,onClick:()=>g(e=>e===`code`?`sanitized`:`code`),title:`HTML mode (stream decides how to render)`,children:[`mode:`,h]})]}),(0,V.jsxs)(`div`,{className:`composer-hint`,children:[`v2 posts include `,(0,V.jsx)(`span`,{className:`mono`,children:`body.kind`}),` so the stream can render code as code (escaped) instead of treating everything as plain text.`,q?(0,V.jsx)(V.Fragment,{children:` In Private mode, the body is sealed and not visible until unlocked.`}):null]})]}),(0,V.jsxs)(`div`,{className:`composer two`,children:[(0,V.jsxs)(`div`,{className:`field`,children:[(0,V.jsxs)(`label`,{htmlFor:`caption`,className:`composer-label`,children:[`Memory `,(0,V.jsx)(`span`,{className:`muted`,children:`(Body)`})]}),(0,V.jsx)(`textarea`,{id:`caption`,className:`composer-textarea${u===`code`?` mono`:``}`,rows:Dt,placeholder:Ot,value:a,onChange:St(o),spellCheck:u!==`code`})]}),(0,V.jsxs)(`div`,{className:`field`,children:[(0,V.jsxs)(`label`,{htmlFor:`author`,className:`composer-label`,children:[`Author Handle `,(0,V.jsx)(`span`,{className:`muted`,children:`(optional, e.g., @KaiRexKlok)`})]}),(0,V.jsx)(`input`,{id:`author`,className:`composer-input`,type:`text`,placeholder:`@handle`,value:s,onChange:St(l),autoCorrect:`off`,autoCapitalize:`none`})]})]}),Et,pe&&(0,V.jsx)(`div`,{className:`composer-error`,children:pe}),he&&!pe&&(0,V.jsx)(`div`,{className:`composer-warn`,children:he}),(z||U)&&(0,V.jsxs)(`div`,{className:`composer-hint mono`,"aria-live":`polite`,children:[z&&de?`stage: ${de}`:null,U?(0,V.jsxs)(V.Fragment,{children:[z&&de?` • `:null,`total ${Math.round(U.totalMs)}ms`,typeof U.prepareMs==`number`?` • prepare ${Math.round(U.prepareMs)}ms`:``,typeof U.encodeMs==`number`?` • encode ${Math.round(U.encodeMs)}ms`:``,typeof U.tokenLen==`number`?` • token ${U.tokenLen.toLocaleString()}`:``,typeof U.items==`number`?` • items ${U.items}`:``,typeof U.inlinedBytes==`number`?` • inlined ${Le(U.inlinedBytes)}`:``,typeof U.totalBytes==`number`?` • bytes ${Le(U.totalBytes)}`:``,U.note?` • note: ${U.note}`:``]}):null]}),(0,V.jsxs)(`div`,{className:`composer-actions`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:bt,className:`composer-submit`,disabled:kt,title:kt?`Fix sealing requirements / attachments to proceed`:`Exhale Stream`,children:z?`Exhaling…${de?` (${de})`:``}`:q?`Exhale Sealed Stream`:`Exhale Stream`}),(0,V.jsx)(`button`,{type:`button`,className:`composer-reset`,onClick:xt,children:`Reset`})]}),_e&&(0,V.jsxs)(`div`,{className:`composer-result`,children:[(0,V.jsx)(`label`,{htmlFor:`gen-url`,className:`composer-label`,children:`Your shareable link`}),(0,V.jsx)(`input`,{id:`gen-url`,className:`composer-input`,type:`text`,readOnly:!0,value:_e,onFocus:e=>e.currentTarget.select()}),(0,V.jsxs)(`div`,{className:`composer-actions`,children:[(0,V.jsx)(`button`,{type:`button`,className:`composer-copy`,onClick:async()=>{try{await navigator.clipboard.writeText(_e),K(!0)}catch{K(!1)}},children:ge?`Remembered ✓`:`Remember`}),(0,V.jsx)(`a`,{className:`composer-open`,href:_e,target:`_blank`,rel:`noopener noreferrer`,children:`Open in new tab →`})]}),(0,V.jsxs)(`p`,{className:`composer-hint`,children:[`Token length: `,(0,V.jsx)(`strong`,{children:ye.toLocaleString()}),` chars • URL mode:`,` `,(0,V.jsx)(`strong`,{children:xe===`path`?`path`:`hash`}),` • soft `,1800 .toLocaleString(),` • hard`,` `,3500 .toLocaleString(),q?(0,V.jsxs)(V.Fragment,{children:[` `,`• `,(0,V.jsx)(`strong`,{children:`sealed`})]}):null]})]}),(0,V.jsx)(me,{isOpen:F,onClose:()=>I(!1),onCaptured:lt,maxDurationMs:15e3,preferredFacingMode:`user`})]})}var nt=50*1024*1024,rt=10;function it(e){if(e===0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=1024,r=Math.floor(Math.log(e)/Math.log(n)),i=e/n**+r;return`${i.toFixed(i>=10?0:1)} ${t[r]}`}function at(e){let{type:t,name:n}=e,r=n.toLowerCase();return t.startsWith(`image/`)?`image`:t.startsWith(`video/`)?`video`:t.startsWith(`audio/`)?`audio`:t===`application/pdf`||t.startsWith(`text/`)||t.includes(`word`)||t.includes(`officedocument`)||t.includes(`spreadsheet`)||t.includes(`presentation`)?`document`:r.endsWith(`.zip`)||r.endsWith(`.rar`)||r.endsWith(`.7z`)||r.endsWith(`.tar`)||r.endsWith(`.gz`)?`archive`:`other`}var ot={image:`Image`,video:`Video`,audio:`Audio`,document:`Document`,archive:`Archive`,other:`File`};function st(e){return[e.name,e.size,e.lastModified,k(),Math.random().toString(36).slice(2,8)].join(`-`)}function ct(e){return e.length===0?null:(e.find(e=>e.kind===`image`||e.kind===`video`)??e[0])?.id??null}function lt(e){return`${e.name}:${e.size}:${e.lastModified}`}function ut({onReady:e}){let t=(0,B.useRef)(null),n=(0,B.useRef)(null),r=(0,B.useRef)(null),[i,a]=(0,B.useState)([]),[o,s]=(0,B.useState)(null),[c,l]=(0,B.useState)(null),[u,d]=(0,B.useState)(`file`),[f,p]=(0,B.useState)(``),[m,h]=(0,B.useState)(``),[g,_]=(0,B.useState)(`general`),[v,y]=(0,B.useState)(``),[b,x]=(0,B.useState)(``),[ee,S]=(0,B.useState)(``),[C,w]=(0,B.useState)(``),[T,E]=(0,B.useState)(``),[D,O]=(0,B.useState)(``),[te,k]=(0,B.useState)(!1),[ne,re]=(0,B.useState)(!1),[A,j]=(0,B.useState)(null),[ie,M]=(0,B.useState)(!1),[ae,oe]=(0,B.useState)(!1),se=1e3,N=i.length>0,P=g===`legal-contract`,ce=(0,B.useMemo)(()=>i.reduce((e,t)=>e+t.file.size,0),[i]),le=(0,B.useMemo)(()=>N?it(ce):`0 B`,[N,ce]),F=(0,B.useMemo)(()=>P?v.trim().length>0&&b.trim().length>0:!0,[P,v,b]),I=(0,B.useMemo)(()=>N?F?3:2:1,[N,F]),L=(0,B.useMemo)(()=>I===1?P?`Attach your agreement, annexes, and evidence`:`Attach the media or files you want to seal`:I===2?P?`Describe the agreement and parties`:`Add context: caption, link, and tags`:P?`Review and seal as a legal record`:`Review and seal to the KaiVoh stream`,[I,P]),R=(0,B.useCallback)(()=>{n.current&&=(URL.revokeObjectURL(n.current),null),r.current=null},[]);(0,B.useEffect)(()=>()=>{R()},[R]);let z=(0,B.useCallback)((e,t)=>{let i=t!==null&&e.some(e=>e.id===t)?t:ct(e);if(s(i),!i){c&&(R(),l(null)),u!==`file`&&d(`file`);return}let a=e.find(e=>e.id===i)??null;if(!a){c&&(R(),l(null)),u!==`file`&&d(`file`);return}if(a.kind===`image`||a.kind===`video`){let e=a.kind;u!==e&&d(e);let t=lt(a.file);if(!(i===o&&r.current===t&&typeof c==`string`&&c.length>0)){R();let e=URL.createObjectURL(a.file);n.current=e,r.current=t,l(e)}return}u!==`file`&&d(`file`),c&&(R(),l(null))},[R,o,u,c,s,d,l]),ue=(0,B.useCallback)(()=>{a([]),s(null),R(),l(null),d(`file`),p(``),h(``),_(`general`),y(``),x(``),S(``),w(``),E(``),O(``),k(!1),re(!1),j(null),oe(!1),t.current&&(t.current.value=``)},[R]),de=(0,B.useCallback)(e=>{let t=Array.isArray(e)?e:Array.from(e);if(t.length===0)return;let n=!1,r=!1,s=[...i];for(let e of t){if(s.length>=rt){r=!0;break}if(e.size>nt){n=!0;continue}if(s.some(t=>t.file.name===e.name&&t.file.size===e.size&&t.file.lastModified===e.lastModified))continue;let t=at(e),i={id:st(e),file:e,kind:t};s=[...s,i]}s.length===i.length&&!n?r||j(`No new files were added (duplicates or all invalid).`):j(null),n?j(`Some files were too large. Max individual file size is ${it(nt)}.`):r&&j(`You can attach up to ${rt} files per sealed post. Remove one to add another.`),a(s),z(s,o)},[i,o,z]),H=e=>{let t=e.target.files;!t||t.length===0||de(t)},U=e=>{e.preventDefault(),e.stopPropagation(),M(!1);let t=e.dataTransfer.files;!t||t.length===0||de(t)},fe=e=>{e.preventDefault(),e.stopPropagation()},pe=e=>{e.preventDefault(),e.stopPropagation(),M(!0)},W=e=>{e.preventDefault(),e.stopPropagation(),e.currentTarget===e.target&&M(!1)},me=()=>{t.current?.click()},he=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),me())},G=e=>{let t=i.filter(t=>t.id!==e);a(t),z(t,o===e?null:o)},ge=e=>{s(e),z(i,e)},K=()=>{if(!N){j(`Attach at least one file to seal.`);return}if(P&&!F){j(`Fill in the agreement title and counterparty to seal legally.`);return}let t=m.trim();if(t.length>0)try{new URL(t)}catch{j(`The link URL looks invalid. Please check it.`);return}let n=(o?i.find(e=>e.id===o):null)??i[0]??null;if(!n){j(`Something went wrong selecting the primary attachment.`);return}let r=f.trim(),a=P?{agreementTitle:v.trim()||void 0,counterpartyName:b.trim()||void 0,counterpartyEmail:ee.trim()||void 0,jurisdiction:C.trim()||void 0,effectiveDateIso:T||void 0,referenceCode:D.trim()||void 0,isConfidential:te,includesPersonalData:ne}:void 0;oe(!0),e({mediaType:n.kind===`image`||n.kind===`video`?n.kind:`file`,file:n.file,caption:r.length>0?r:void 0,attachments:i,mainAttachmentId:n.id,postKind:g,legalMeta:a,linkUrl:t.length>0?t:void 0})},_e=(0,B.useMemo)(()=>{if(!N)return null;let e=i.length;return`${e===1?`1 attached file`:`${e} attached files total`} • ${le}`},[i,N,le]);return(0,V.jsxs)(`div`,{className:`kv-post-composer flex flex-col items-center gap-4 p-6 w-full`,children:[(0,V.jsxs)(`div`,{className:`kv-post-header w-full max-w-xl flex flex-col gap-2`,children:[(0,V.jsxs)(`div`,{className:`kv-post-step-row flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`kv-post-step-badge`,children:[(0,V.jsx)(`span`,{className:`kv-post-step-number`,children:I}),(0,V.jsx)(`span`,{className:`kv-post-step-label`,children:L})]}),N&&(0,V.jsx)(`button`,{type:`button`,className:`kv-post-reset-btn`,onClick:ue,children:`Reset`})]}),(0,V.jsx)(`p`,{className:`kv-post-subtitle`,children:`Attach images, videos, PDFs, DOCX, ZIPs—anything you want sealed to your Kai-Signature. For contracts, add parties and jurisdiction so this becomes a usable, timestamped record.`}),(0,V.jsxs)(`div`,{className:`kv-post-kind-row flex flex-wrap items-center gap-3 mt-1`,children:[(0,V.jsx)(`label`,{className:`kv-post-kind-label`,htmlFor:`kv-post-kind`,children:`Intent`}),(0,V.jsxs)(`select`,{id:`kv-post-kind`,className:`kv-post-kind-select`,value:g,onChange:e=>_(e.target.value),children:[(0,V.jsx)(`option`,{value:`general`,children:`General post / media`}),(0,V.jsx)(`option`,{value:`legal-contract`,children:`Legal contract / agreement`}),(0,V.jsx)(`option`,{value:`evidence`,children:`Evidence / proof bundle`}),(0,V.jsx)(`option`,{value:`announcement`,children:`Public announcement / notice`}),(0,V.jsx)(`option`,{value:`private-note`,children:`Private note / internal record`})]})]})]}),A&&(0,V.jsx)(`div`,{className:`kv-post-error w-full max-w-xl`,role:`alert`,children:A}),(0,V.jsx)(`div`,{className:`w-full max-w-xl`,children:(0,V.jsx)(`div`,{className:[`kv-post-dropzone`,ie?`kv-post-dropzone--dragging`:``,N?`kv-post-dropzone--has-media`:``].join(` `).trim(),tabIndex:0,role:`button`,"aria-label":`Choose or drop files to attach`,onClick:me,onKeyDown:he,onDragOver:fe,onDragEnter:pe,onDragLeave:W,onDrop:U,children:(0,V.jsxs)(`div`,{className:`kv-post-dropzone-inner`,children:[(0,V.jsx)(`div`,{className:`kv-post-dropzone-icon`,children:N?`🔄`:ie?`🌀`:`📁`}),(0,V.jsxs)(`div`,{className:`kv-post-dropzone-text`,children:[(0,V.jsx)(`div`,{className:`kv-post-dropzone-title`,children:N?`Add or replace attached files`:`Tap or drop files to start`}),(0,V.jsx)(`div`,{className:`kv-post-dropzone-hint`,children:`Images, videos, PDFs, DOCX, ZIPs, audio, and more • Drag & drop or tap to choose`}),(0,V.jsxs)(`div`,{className:`kv-post-dropzone-meta`,children:[`Max `,rt,` files • `,it(nt),` per file`]})]})]})})}),N&&(0,V.jsxs)(`div`,{className:`kv-post-body w-full max-w-xl mt-2`,children:[c&&(0,V.jsxs)(`div`,{className:`kv-post-preview`,children:[u===`image`&&(0,V.jsx)(`img`,{src:c,alt:`Primary attachment preview`,className:`kv-post-preview-media`}),u===`video`&&(0,V.jsx)(`video`,{src:c,controls:!0,className:`kv-post-preview-media`})]}),(0,V.jsxs)(`div`,{className:`kv-post-attachments`,children:[(0,V.jsxs)(`div`,{className:`kv-post-attachments-header flex justify-between items-center`,children:[(0,V.jsx)(`div`,{className:`kv-post-attachments-title`,children:`Attachments`}),_e&&(0,V.jsx)(`div`,{className:`kv-post-attachments-summary`,children:_e})]}),(0,V.jsx)(`ul`,{className:`kv-post-attachments-list`,children:i.map(e=>{let t=e.id===o;return(0,V.jsxs)(`li`,{className:[`kv-post-attachment-item`,t?`kv-post-attachment-item--primary`:``].join(` `).trim(),children:[(0,V.jsxs)(`div`,{className:`kv-post-attachment-main`,children:[(0,V.jsx)(`div`,{className:`kv-post-attachment-name`,children:e.file.name}),(0,V.jsxs)(`div`,{className:`kv-post-attachment-meta`,children:[(0,V.jsxs)(`span`,{children:[ot[e.kind],` • `,it(e.file.size)]}),t&&(0,V.jsx)(`span`,{className:`kv-post-attachment-pill`,children:`Primary`})]})]}),(0,V.jsxs)(`div`,{className:`kv-post-attachment-actions`,children:[!t&&(0,V.jsx)(`button`,{type:`button`,className:`kv-post-attachment-btn`,onClick:()=>ge(e.id),children:`Set as primary`}),(0,V.jsx)(`button`,{type:`button`,className:`kv-post-attachment-btn kv-post-attachment-btn--danger`,onClick:()=>G(e.id),children:`Remove`})]})]},e.id)})})]}),(0,V.jsxs)(`div`,{className:`kv-post-caption-block mt-4`,children:[(0,V.jsx)(`label`,{htmlFor:`kv-post-caption`,className:`kv-post-caption-label`,children:`Caption / description (optional)`}),(0,V.jsx)(`textarea`,{id:`kv-post-caption`,placeholder:P?`Summarize what this agreement covers, key obligations, or why you are sealing it now…`:`Describe the moment, the pulse, or what this bundle of files represents…`,className:`kv-post-caption-textarea`,rows:3,maxLength:se,value:f,onChange:e=>p(e.target.value)}),(0,V.jsx)(`div`,{className:`kv-post-caption-footer`,children:(0,V.jsxs)(`span`,{className:`kv-post-caption-count`,children:[f.length,`/`,se]})})]}),(0,V.jsxs)(`div`,{className:`kv-post-link-block mt-4`,children:[(0,V.jsx)(`label`,{htmlFor:`kv-post-link`,className:`kv-post-link-label`,children:`Canonical URL (optional)`}),(0,V.jsx)(`input`,{id:`kv-post-link`,type:`url`,inputMode:`url`,placeholder:`https://… (DMS link, IPFS URL, external system reference)`,className:`kv-post-link-input`,value:m,onChange:e=>h(e.target.value)}),(0,V.jsx)(`p`,{className:`kv-post-link-hint`,children:`This can point to the master copy of the contract, folder, or evidence bundle. It will be sealed alongside the files.`})]}),g===`legal-contract`&&(0,V.jsxs)(`div`,{className:`kv-post-legal-block mt-6`,children:[(0,V.jsx)(`div`,{className:`kv-post-legal-header`,children:`Legal details for this agreement`}),(0,V.jsxs)(`div`,{className:`kv-post-legal-grid`,children:[(0,V.jsxs)(`div`,{className:`kv-post-legal-field`,children:[(0,V.jsxs)(`label`,{htmlFor:`kv-legal-title`,className:`kv-post-legal-label`,children:[`Agreement title `,(0,V.jsx)(`span`,{className:`kv-post-legal-required`,children:`*`})]}),(0,V.jsx)(`input`,{id:`kv-legal-title`,type:`text`,className:`kv-post-legal-input`,placeholder:`e.g. Master Services Agreement, NDA, Licensing Deal…`,value:v,onChange:e=>y(e.target.value)})]}),(0,V.jsxs)(`div`,{className:`kv-post-legal-field`,children:[(0,V.jsxs)(`label`,{htmlFor:`kv-legal-counterparty`,className:`kv-post-legal-label`,children:[`Counterparty name `,(0,V.jsx)(`span`,{className:`kv-post-legal-required`,children:`*`})]}),(0,V.jsx)(`input`,{id:`kv-legal-counterparty`,type:`text`,className:`kv-post-legal-input`,placeholder:`Person or organization`,value:b,onChange:e=>x(e.target.value)})]}),(0,V.jsxs)(`div`,{className:`kv-post-legal-field`,children:[(0,V.jsx)(`label`,{htmlFor:`kv-legal-email`,className:`kv-post-legal-label`,children:`Counterparty contact (optional)`}),(0,V.jsx)(`input`,{id:`kv-legal-email`,type:`email`,className:`kv-post-legal-input`,placeholder:`Email or contact handle`,value:ee,onChange:e=>S(e.target.value)})]}),(0,V.jsxs)(`div`,{className:`kv-post-legal-field`,children:[(0,V.jsx)(`label`,{htmlFor:`kv-legal-jurisdiction`,className:`kv-post-legal-label`,children:`Jurisdiction (optional)`}),(0,V.jsx)(`input`,{id:`kv-legal-jurisdiction`,type:`text`,className:`kv-post-legal-input`,placeholder:`e.g. Ontario, Canada • Delaware, USA • EU-wide…`,value:C,onChange:e=>w(e.target.value)})]}),(0,V.jsxs)(`div`,{className:`kv-post-legal-field`,children:[(0,V.jsx)(`label`,{htmlFor:`kv-legal-effective`,className:`kv-post-legal-label`,children:`Effective date (optional)`}),(0,V.jsx)(`input`,{id:`kv-legal-effective`,type:`date`,className:`kv-post-legal-input`,value:T,onChange:e=>E(e.target.value)})]}),(0,V.jsxs)(`div`,{className:`kv-post-legal-field`,children:[(0,V.jsx)(`label`,{htmlFor:`kv-legal-ref`,className:`kv-post-legal-label`,children:`Reference code (optional)`}),(0,V.jsx)(`input`,{id:`kv-legal-ref`,type:`text`,className:`kv-post-legal-input`,placeholder:`Internal ID, contract number, matter code…`,value:D,onChange:e=>O(e.target.value)})]})]}),(0,V.jsxs)(`div`,{className:`kv-post-legal-flags mt-3`,children:[(0,V.jsxs)(`label`,{className:`kv-post-legal-flag`,children:[(0,V.jsx)(`input`,{type:`checkbox`,checked:te,onChange:e=>k(e.target.checked)}),(0,V.jsx)(`span`,{children:`This agreement is confidential`})]}),(0,V.jsxs)(`label`,{className:`kv-post-legal-flag`,children:[(0,V.jsx)(`input`,{type:`checkbox`,checked:ne,onChange:e=>re(e.target.checked)}),(0,V.jsx)(`span`,{children:`This bundle includes personal data (names, addresses, IDs, etc.)`})]})]}),(0,V.jsx)(`p`,{className:`kv-post-legal-hint mt-2`,children:`These details are sealed as metadata with the files and time pulse, creating a clear, timestamped record of what was agreed and with whom. This does not replace legal advice—use it as a hardened, auditable trail around your contracts.`})]})]}),(0,V.jsx)(`div`,{className:`kv-post-actions w-full max-w-xl mt-4 flex justify-end`,children:(0,V.jsx)(`button`,{type:`button`,className:`kv-post-submit-btn`,onClick:K,disabled:!N||ae,children:ae?`Sealing…`:`Seal with Breath`})}),(0,V.jsx)(`input`,{id:`kv-post-file-input`,type:`file`,multiple:!0,accept:`*/*`,ref:t,onChange:H,className:`kv-post-file-input`})]})}var dt=a(((e,t)=>{var n=`Input must be an string, Buffer or Uint8Array`;function r(e){let t;if(e instanceof Uint8Array)t=e;else if(typeof e==`string`)t=new TextEncoder().encode(e);else throw Error(n);return t}function i(e){return Array.prototype.map.call(e,function(e){return(e<16?`0`:``)+e.toString(16)}).join(``)}function a(e){return(4294967296+e).toString(16).substring(1)}function o(e,t,n){let r=` `+e+` = `;for(let i=0;i{var n=dt();function r(e,t,n){let r=e[t]+e[n],i=e[t+1]+e[n+1];r>=4294967296&&i++,e[t]=r,e[t+1]=i}function i(e,t,n,r){let i=e[t]+n;n<0&&(i+=4294967296);let a=e[t+1]+r;i>=4294967296&&a++,e[t]=i,e[t+1]=a}function a(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function o(e,t,n,a,o,s){let c=u[o],d=u[o+1],f=u[s],p=u[s+1];r(l,e,t),i(l,e,c,d);let m=l[a]^l[e],h=l[a+1]^l[e+1];l[a]=h,l[a+1]=m,r(l,n,a),m=l[t]^l[n],h=l[t+1]^l[n+1],l[t]=m>>>24^h<<8,l[t+1]=h>>>24^m<<8,r(l,e,t),i(l,e,f,p),m=l[a]^l[e],h=l[a+1]^l[e+1],l[a]=m>>>16^h<<16,l[a+1]=h>>>16^m<<16,r(l,n,a),m=l[t]^l[n],h=l[t+1]^l[n+1],l[t]=h>>>31^m<<1,l[t+1]=m>>>31^h<<1}var s=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),c=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map(function(e){return e*2})),l=new Uint32Array(32),u=new Uint32Array(32);function d(e,t){let n=0;for(n=0;n<16;n++)l[n]=e.h[n],l[n+16]=s[n];for(l[24]^=e.t,l[25]^=e.t/4294967296,t&&(l[28]=~l[28],l[29]=~l[29]),n=0;n<32;n++)u[n]=a(e.b,4*n);for(n=0;n<12;n++)o(0,8,16,24,c[n*16+0],c[n*16+1]),o(2,10,18,26,c[n*16+2],c[n*16+3]),o(4,12,20,28,c[n*16+4],c[n*16+5]),o(6,14,22,30,c[n*16+6],c[n*16+7]),o(0,10,20,30,c[n*16+8],c[n*16+9]),o(2,12,22,24,c[n*16+10],c[n*16+11]),o(4,14,16,26,c[n*16+12],c[n*16+13]),o(6,8,18,28,c[n*16+14],c[n*16+15]);for(n=0;n<16;n++)e.h[n]=e.h[n]^l[n]^l[n+16]}var f=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function p(e,t,n,r){if(e===0||e>64)throw Error(`Illegal output length, expected 0 < length <= 64`);if(t&&t.length>64)throw Error(`Illegal key, expected Uint8Array with 0 < length <= 64`);if(n&&n.length!==16)throw Error(`Illegal salt, expected Uint8Array with length is 16`);if(r&&r.length!==16)throw Error(`Illegal personal, expected Uint8Array with length is 16`);let i={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:e};f.fill(0),f[0]=e,t&&(f[1]=t.length),f[2]=1,f[3]=1,n&&f.set(n,32),r&&f.set(r,48);for(let e=0;e<16;e++)i.h[e]=s[e]^a(f,e*4);return t&&(m(i,t),i.c=128),i}function m(e,t){for(let n=0;n>2]>>8*(n&3);return t}function g(e,t,r,i,a){r||=64,e=n.normalizeInput(e),i&&=n.normalizeInput(i),a&&=n.normalizeInput(a);let o=p(r,t,i,a);return m(o,e),h(o)}function _(e,t,r,i,a){let o=g(e,t,r,i,a);return n.toHex(o)}t.exports={blake2b:g,blake2bHex:_,blake2bInit:p,blake2bUpdate:m,blake2bFinal:h}})),pt=a(((e,t)=>{var n=dt();function r(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function i(e,t,n,r,i,o){c[e]=c[e]+c[t]+i,c[r]=a(c[r]^c[e],16),c[n]=c[n]+c[r],c[t]=a(c[t]^c[n],12),c[e]=c[e]+c[t]+o,c[r]=a(c[r]^c[e],8),c[n]=c[n]+c[r],c[t]=a(c[t]^c[n],7)}function a(e,t){return e>>>t^e<<32-t}var o=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),s=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),c=new Uint32Array(16),l=new Uint32Array(16);function u(e,t){let n=0;for(n=0;n<8;n++)c[n]=e.h[n],c[n+8]=o[n];for(c[12]^=e.t,c[13]^=e.t/4294967296,t&&(c[14]=~c[14]),n=0;n<16;n++)l[n]=r(e.b,4*n);for(n=0;n<10;n++)i(0,4,8,12,l[s[n*16+0]],l[s[n*16+1]]),i(1,5,9,13,l[s[n*16+2]],l[s[n*16+3]]),i(2,6,10,14,l[s[n*16+4]],l[s[n*16+5]]),i(3,7,11,15,l[s[n*16+6]],l[s[n*16+7]]),i(0,5,10,15,l[s[n*16+8]],l[s[n*16+9]]),i(1,6,11,12,l[s[n*16+10]],l[s[n*16+11]]),i(2,7,8,13,l[s[n*16+12]],l[s[n*16+13]]),i(3,4,9,14,l[s[n*16+14]],l[s[n*16+15]]);for(n=0;n<8;n++)e.h[n]^=c[n]^c[n+8]}function d(e,t){if(!(e>0&&e<=32))throw Error(`Incorrect output length, should be in [1, 32]`);let n=t?t.length:0;if(t&&!(n>0&&n<=32))throw Error(`Incorrect key length, should be in [1, 32]`);let r={h:new Uint32Array(o),b:new Uint8Array(64),c:0,t:0,outlen:e};return r.h[0]^=16842752^n<<8^e,n>0&&(f(r,t),r.c=64),r}function f(e,t){for(let n=0;n>2]>>8*(n&3)&255;return t}function m(e,t,r){r||=32,e=n.normalizeInput(e);let i=d(r,t);return f(i,e),p(i)}function h(e,t,r){let i=m(e,t,r);return n.toHex(i)}t.exports={blake2s:m,blake2sHex:h,blake2sInit:d,blake2sUpdate:f,blake2sFinal:p}})),mt=E(a(((e,t)=>{var n=ft(),r=pt();t.exports={blake2b:n.blake2b,blake2bHex:n.blake2bHex,blake2bInit:n.blake2bInit,blake2bUpdate:n.blake2bUpdate,blake2bFinal:n.blake2bFinal,blake2s:r.blake2s,blake2sHex:r.blake2sHex,blake2sInit:r.blake2sInit,blake2sUpdate:r.blake2sUpdate,blake2sFinal:r.blake2sFinal}}))(),1),ht=5236,gt=50;function _t(e){return e===`root`||e===`sacral`||e===`solar`||e===`heart`||e===`throat`||e===`thirdEye`||e===`crown`||e===`krown`}function vt({post:e,identityKaiSignature:t,userPhiKey:n,onSealComplete:r}){let[i,a]=(0,B.useState)(`idle`),[o,s]=(0,B.useState)(0),[c,l]=(0,B.useState)(null),u=(0,B.useRef)(null),d=(0,B.useRef)(!1),f=(0,B.useRef)(0),p=(0,B.useRef)(!0),m=(0,B.useMemo)(()=>ht*2,[]);(0,B.useEffect)(()=>(p.current=!0,()=>{p.current=!1,u.current!=null&&window.clearInterval(u.current)}),[]);let h=()=>{u.current!=null&&(window.clearInterval(u.current),u.current=null)},g=()=>{if(!d.current){if(!t.trim()){l(`Missing identityKaiSignature (session signature). Please re-login.`),a(`idle`),s(0);return}h(),l(null),a(`inhale`),s(0),d.current=!1,f.current=0,u.current=window.setInterval(()=>{f.current+=gt;let e=f.current;if(e{if(!d.current){d.current=!0;try{let i=t.trim();if(!i)throw Error(`Missing identityKaiSignature (session signature).`);let o=await ee(),s=Number(o.pulse??0),c=_t(o.chakraDay)?o.chakraDay:null,l=e.file?.name??`unknown`,u=mt.default.blake2bHex(`${l}-${s}`,void 0,16);if(r({pulse:s,kaiSignature:i,chakraDay:c,post:e,userPhiKey:n??null,kksNonce:u}),!p.current)return;a(`sealed`)}catch(e){d.current=!1;let t=e instanceof Error?e.message:`Failed to seal with live Kai pulse. Please try again.`;if(!p.current)return;l(t),a(`idle`),s(0)}}},v=(()=>{if(c)return`Error`;switch(i){case`idle`:return`Ready to Breathe`;case`inhale`:return`Inhale`;case`exhale`:return`Exhale`;case`sealed`:return`Sealed in Kairos`;default:return`Breath`}})(),y=Math.round(Math.min(o,.5)*200),b=Math.round(Math.max(o-.5,0)*200),x=(()=>{if(c)return c;switch(i){case`idle`:return`Tap begin, inhale as the orb expands, exhale as it returns to stillness. We’ll seal at the end of your exhale.`;case`inhale`:return`Inhale slowly… ${y}%`;case`exhale`:return`Exhale and let go… ${50+b}% — sealing this breath into KaiOS.`;case`sealed`:return`Sealed on a live Kai pulse. Advancing to embed…`;default:return``}})(),S=(()=>{if(c)return`⚠️`;switch(i){case`idle`:return`🌬`;case`inhale`:return`🫁`;case`exhale`:return`🌀`;case`sealed`:return`✨`;default:return`🌬`}})(),C=e.file?.name&&e.file.name.length>40?`${e.file.name.slice(0,22)}…${e.file.name.slice(-12)}`:e.file?.name??`Unnamed glyph`;return(0,V.jsxs)(`div`,{className:`kv-breath-root`,"data-phase":i,"aria-live":`polite`,children:[(0,V.jsxs)(`div`,{className:`kv-breath-meta`,children:[(0,V.jsxs)(`div`,{className:`kv-breath-meta-left`,children:[(0,V.jsx)(`span`,{className:`kv-breath-pill`,children:`Breath Seal • φ 5.236s`}),(0,V.jsx)(`span`,{className:`kv-breath-file`,title:e.file?.name,children:C})]}),(0,V.jsx)(`div`,{className:`kv-breath-meta-right`,children:(0,V.jsx)(`span`,{className:`kv-breath-tag`,children:`Live Kai Pulse`})})]}),(0,V.jsxs)(`div`,{className:`kv-breath-orb-row`,children:[(0,V.jsxs)(`div`,{className:`kv-breath-orb`,"aria-label":`Breath phase: ${v}`,children:[(0,V.jsx)(`div`,{className:`kv-breath-orb-inner`,children:(0,V.jsx)(`span`,{className:`kv-breath-orb-emoji`,children:S})}),(0,V.jsx)(`div`,{className:`kv-breath-orb-ring`,style:{"--kv-breath-progress":o}})]}),(0,V.jsxs)(`div`,{className:`kv-breath-status`,children:[(0,V.jsxs)(`div`,{className:`kv-breath-status-row`,children:[(0,V.jsx)(`span`,{className:`kv-breath-status-label`,children:v}),(0,V.jsxs)(`span`,{className:`kv-breath-status-percent`,children:[Math.round(o*100),`%`]})]}),(0,V.jsx)(`p`,{className:`kv-breath-status-text`,children:x}),(0,V.jsxs)(`div`,{className:`kv-breath-bars`,children:[(0,V.jsxs)(`div`,{className:`kv-breath-bar`,children:[(0,V.jsx)(`span`,{className:`kv-breath-bar-label`,children:`Inhale`}),(0,V.jsx)(`div`,{className:`kv-breath-bar-track`,"aria-hidden":`true`,children:(0,V.jsx)(`div`,{className:`kv-breath-bar-fill kv-breath-bar-fill--inhale`,style:{width:`${y}%`}})})]}),(0,V.jsxs)(`div`,{className:`kv-breath-bar`,children:[(0,V.jsx)(`span`,{className:`kv-breath-bar-label`,children:`Exhale`}),(0,V.jsx)(`div`,{className:`kv-breath-bar-track`,"aria-hidden":`true`,children:(0,V.jsx)(`div`,{className:`kv-breath-bar-fill kv-breath-bar-fill--exhale`,style:{width:`${b}%`}})})]})]})]})]}),(0,V.jsxs)(`div`,{className:`kv-breath-actions`,children:[i===`idle`&&!d.current&&!c&&(0,V.jsx)(`button`,{type:`button`,onClick:g,className:`kv-breath-btn kv-breath-btn-primary`,children:`Begin Breath`}),c&&i===`idle`&&(0,V.jsx)(`button`,{type:`button`,onClick:g,className:`kv-breath-btn kv-breath-btn-warning`,children:`Retry Breath Seal`}),i!==`idle`&&i!==`sealed`&&!c&&(0,V.jsx)(`button`,{type:`button`,className:`kv-breath-btn kv-breath-btn-ghost`,disabled:!0,children:`Sealing on this exhale…`}),i===`sealed`&&(0,V.jsx)(`div`,{className:`kv-breath-sealed-note`,children:`Sealed. The stream will remember this breath forever.`})]})]})}function yt(e){let t=e.trim();return(t.startsWith(`0x`)||t.startsWith(`0X`))&&(t=t.slice(2)),/^[0-9a-fA-F]+$/.test(t)&&(t=t.toLowerCase()),t}var bt=`http://www.w3.org/2000/svg`;async function xt(e){let t=typeof e==`string`?e:JSON.stringify(e),n=new TextEncoder().encode(t),r=await crypto.subtle.digest(`SHA-256`,n),i=new Uint8Array(r),a=``;for(let e=0;e0?s=o.item(0):(s=t.createElementNS(bt,`metadata`),a.appendChild(s)),s.textContent=JSON.stringify(i,null,2);let c=new XMLSerializer().serializeToString(t);return{type:`image`,content:new Blob([c],{type:`image/svg+xml`}),filename:`sigil-${r}.svg`,metadata:i}}return n.mediaType===`image`?{type:`image`,content:n.file,filename:n.file.name,metadata:i}:{type:`video`,content:n.file,filename:n.file.name,metadata:i}}function Tt(e){let{baseCaption:t,phiKey:n,kaiSignature:r,pulse:i,chakraDay:a,verifierUrl:o}=e,s=[];return t&&t.trim().length>0&&s.push(t.trim(),``),s.push(`—`),s.push(`Kai-Sigil Proof of Origin`),n&&s.push(`Φ-Key: ${n}`),r&&s.push(`Kai Signature: ${r}`),typeof i==`number`&&s.push(`Pulse: ${i}`),a&&s.push(`Chakra Day: ${a}`),o&&(s.push(``),s.push(`Verify this post: ${o}`)),s.join(` diff --git a/dist/assets/KaiVohModal-DRgYu3Ad.js b/dist/assets/KaiVohModal-Bbtn2GfV.js similarity index 91% rename from dist/assets/KaiVohModal-DRgYu3Ad.js rename to dist/assets/KaiVohModal-Bbtn2GfV.js index 32fff3bd..d4f009aa 100644 --- a/dist/assets/KaiVohModal-DRgYu3Ad.js +++ b/dist/assets/KaiVohModal-Bbtn2GfV.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KaiVohApp-cvlNRmVv.js","assets/index-BGzUQCv_.js","assets/index-BmaJNTKf.css","assets/prop-types-CQvzhoSE.js","assets/VerifierFrame-CwEJNPi9.js","assets/VerifierFrame-D0e_dB-R.css","assets/SigilAuthContext-Bpha3aI1.js","assets/sigilRegistry-DVCHqg2o.js","assets/sigilRegistry-Cw7cMZ5l.css","assets/postSeal-ClZBwRbf.js","assets/KaiVohApp-Brroi08x.css","assets/KaiRealms-DsvdKMyp.js","assets/x-B04jFFwi.js","assets/KaiRealms-BZJvSAmB.css"])))=>i.map(i=>d[i]); -import{t as e}from"./x-B04jFFwi.js";import{Sn as t,Tn as n,jn as r,tn as i,wn as a}from"./index-BGzUQCv_.js";import{t as o}from"./SigilAuthContext-Bpha3aI1.js";import{t as s}from"./SigilAuthProvider-Bf4S4o9t.js";var c=r(a(),1),l=r(n(),1),u=r(i(),1),d=class extends l.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[KaiVoh] render error:`,e,t)}render(){return this.state.error?(0,u.jsxs)(`div`,{style:{padding:`1rem`,textAlign:`center`},children:[(0,u.jsx)(`h2`,{style:{fontSize:18,fontWeight:600},children:`KaiVoh failed to load`}),(0,u.jsx)(`p`,{style:{opacity:.8,marginTop:8},children:this.state.error.message}),(0,u.jsxs)(`details`,{style:{opacity:.65,marginTop:12,textAlign:`left`},children:[(0,u.jsx)(`summary`,{children:`Details`}),(0,u.jsx)(`pre`,{style:{whiteSpace:`pre-wrap`},children:String(this.state.error.stack??``)})]})]}):this.props.children}};function f(){let e=(0,l.useContext)(o);if(!e)throw Error(`useSigilAuth must be used inside `);return e}var p=(0,l.lazy)(()=>t(()=>import(`./KaiVohApp-cvlNRmVv.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]))),m=(0,l.lazy)(()=>t(()=>import(`./KaiRealms-DsvdKMyp.js`),__vite__mapDeps([11,1,2,12,13]))),h=(1+Math.sqrt(5))/2,g=5.236,_=610,v=377;function y({className:e}){let t=(0,l.useId)();return(0,u.jsxs)(`svg`,{className:e,width:_,height:v,viewBox:`0 0 ${_} ${v}`,"aria-hidden":`true`,children:[(0,u.jsx)(`defs`,{children:(0,u.jsxs)(`linearGradient`,{id:t,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,u.jsx)(`stop`,{offset:`0%`,stopColor:`currentColor`,stopOpacity:`0.0`}),(0,u.jsx)(`stop`,{offset:`40%`,stopColor:`currentColor`,stopOpacity:`0.5`}),(0,u.jsx)(`stop`,{offset:`100%`,stopColor:`currentColor`,stopOpacity:`0.0`})]})}),(0,u.jsxs)(`g`,{fill:`none`,stroke:`url(#${t})`,strokeWidth:`2`,children:[(0,u.jsx)(`path`,{d:`M377 0 A377 377 0 0 1 0 377`}),(0,u.jsx)(`path`,{d:`M233 0 A233 233 0 0 1 0 233`}),(0,u.jsx)(`path`,{d:`M144 0 A144 144 0 0 1 0 144`}),(0,u.jsx)(`path`,{d:`M89 0 A89 89 0 0 1 0 89`}),(0,u.jsx)(`path`,{d:`M55 0 A55 55 0 0 1 0 55`}),(0,u.jsx)(`path`,{d:`M34 0 A34 34 0 0 1 0 34`}),(0,u.jsx)(`path`,{d:`M21 0 A21 21 0 0 1 0 21`})]})]})}function b({className:e}){return(0,u.jsxs)(`div`,{className:`seal-emblem ${e??``}`,"aria-hidden":`true`,children:[(0,u.jsx)(`div`,{className:`seal-ring seal-ring--outer`}),(0,u.jsx)(`div`,{className:`seal-ring seal-ring--inner`}),(0,u.jsx)(`div`,{className:`seal-core`})]})}function x({className:e}){let{auth:t}=f(),n=t.meta;if(!n)return null;let r=[`Pulse: ${n.pulse}`,`Beat: ${n.beat}`,`Step: ${n.stepIndex}`,`Day: ${n.chakraDay}`];return n.sigilId&&r.push(`Sigil: ${n.sigilId}`),n.userPhiKey&&r.push(`PhiKey: ${n.userPhiKey}`),(0,u.jsxs)(`div`,{className:`sigil-auth-pill ${e??``}`,role:`status`,"aria-live":`polite`,title:r.join(` • `),style:{maxWidth:`100%`,overflowX:`auto`,whiteSpace:`nowrap`},children:[(0,u.jsx)(`span`,{className:`sigil-auth-pill__dot`,"aria-hidden":`true`}),(0,u.jsxs)(`span`,{className:`sigil-auth-pill__text mono`,children:[`Sealed • `,n.pulse,` • `,n.chakraDay,n.sigilId?` • ${n.sigilId}`:``]})]})}function S({open:t,onClose:n}){let r=(0,l.useRef)(null),i=(0,l.useRef)(null),a=(0,l.useRef)(0),[o,f]=(0,l.useState)(`voh`),[_,v]=(0,l.useState)(!1),S=(0,l.useCallback)(e=>{e===`realms`&&!_&&v(!0),f(e)},[_]);(0,l.useEffect)(()=>{if(!t)return;let e=document.body.style.overflow,n=document.documentElement.style.getPropertyValue(`overscroll-behavior`),o=document.body.style.getPropertyValue(`overscroll-behavior`),s=document.documentElement.style.overflow,c=document.body.style.height,l=document.documentElement.style.height,u=document.documentElement.style.touchAction,d=document.documentElement.style.getPropertyValue(`--kai-breath`),f=document.documentElement.style.getPropertyValue(`--kai-phi`);document.body.style.overflow=`hidden`,document.body.style.height=`100%`,document.documentElement.style.overflow=`hidden`,document.documentElement.style.height=`100%`,document.documentElement.style.setProperty(`overscroll-behavior`,`contain`),document.body.style.setProperty(`overscroll-behavior`,`contain`),document.documentElement.style.touchAction=`manipulation`,document.documentElement.style.setProperty(`--kai-breath`,`${g}s`),document.documentElement.style.setProperty(`--kai-phi`,`${h}`),r.current?.focus();let p=e=>{a.current=e.touches[0]?.clientY??0},m=e=>{if(e.touches.length!==1)return;let t=i.current;if(!t)return;let n=e.target;if(!(n&&t.contains(n))){e.preventDefault();return}let r=(e.touches[0]?.clientY??a.current)-a.current,o=t.scrollTop<=0,s=t.scrollTop+t.clientHeight>=t.scrollHeight;(o&&r>0||s&&r<0)&&e.preventDefault()};return window.addEventListener(`touchstart`,p,{passive:!0}),window.addEventListener(`touchmove`,m,{passive:!1}),()=>{window.removeEventListener(`touchstart`,p),window.removeEventListener(`touchmove`,m),document.body.style.overflow=e,document.body.style.height=c,n?document.documentElement.style.setProperty(`overscroll-behavior`,n):document.documentElement.style.removeProperty(`overscroll-behavior`),o?document.body.style.setProperty(`overscroll-behavior`,o):document.body.style.removeProperty(`overscroll-behavior`),document.documentElement.style.overflow=s,document.documentElement.style.height=l,document.documentElement.style.touchAction=u,d?document.documentElement.style.setProperty(`--kai-breath`,d):document.documentElement.style.removeProperty(`--kai-breath`),f?document.documentElement.style.setProperty(`--kai-phi`,f):document.documentElement.style.removeProperty(`--kai-phi`)}},[t,n]);let C=(0,l.useCallback)(e=>{e.stopPropagation(),n()},[n]),w=(0,l.useCallback)(e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),n())},[n]);return t?(0,c.createPortal)((0,u.jsxs)(`div`,{className:`kai-voh-modal-backdrop atlantean-veil`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`kaivoh-title`,"data-view":o,children:[(0,u.jsx)(`div`,{className:`atlantean-stars`,"aria-hidden":`true`}),(0,u.jsx)(`div`,{className:`atlantean-halo atlantean-halo--1`,"aria-hidden":`true`}),(0,u.jsx)(`div`,{className:`atlantean-halo atlantean-halo--2`,"aria-hidden":`true`}),(0,u.jsxs)(`div`,{className:`kai-voh-container kai-pulse-border glass-omni`,role:`document`,children:[(0,u.jsx)(`div`,{className:`breath-ring breath-ring--outer`,"aria-hidden":`true`}),(0,u.jsx)(`div`,{className:`breath-ring breath-ring--inner`,"aria-hidden":`true`}),(0,u.jsx)(`div`,{className:`phi-grid`,"aria-hidden":`true`}),(0,u.jsx)(y,{className:`phi-spiral phi-spiral--tl`}),(0,u.jsx)(y,{className:`phi-spiral phi-spiral--br`}),(0,u.jsxs)(s,{children:[o!==`realms`&&(0,u.jsx)(`button`,{ref:r,type:`button`,className:`kai-voh-close auric-btn`,"aria-label":`Close portal`,onPointerDown:C,onKeyDown:w,children:(0,u.jsx)(e,{size:22,"aria-hidden":`true`})}),o!==`realms`&&(0,u.jsx)(`div`,{className:`voh-top-orb`,"aria-hidden":`true`,children:(0,u.jsx)(b,{})}),(0,u.jsxs)(`div`,{className:`kai-voh-tabbar`,role:`tablist`,"aria-label":`Kai portal views`,children:[(0,u.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":o===`voh`,className:`kai-voh-tab auric-tab ${o===`voh`?`active`:``}`,onClick:()=>S(`voh`),children:[(0,u.jsx)(`span`,{className:`tab-glyph`,"aria-hidden":`true`,children:`🜂`}),` `,`Voh`]}),(0,u.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":o===`realms`,className:`kai-voh-tab auric-tab ${o===`realms`?`active`:``}`,onClick:()=>S(`realms`),children:[(0,u.jsx)(`span`,{className:`tab-glyph`,"aria-hidden":`true`,children:`⚚`}),` `,`Realms`]}),(0,u.jsx)(`div`,{className:`breath-meter`,"aria-hidden":`true`,children:(0,u.jsx)(`div`,{className:`breath-meter__dot`})}),(0,u.jsx)(x,{className:`sigil-auth-pill--tabbar`})]}),(0,u.jsxs)(`div`,{className:`kai-voh-body`,ref:i,children:[(0,u.jsx)(`h2`,{id:`kaivoh-title`,className:`sr-only`,children:`Kai Portal`}),(0,u.jsxs)(d,{children:[(0,u.jsx)(`section`,{className:`portal-pane`,style:{display:o===`voh`?`block`:`none`},"aria-hidden":o!==`voh`,children:(0,u.jsx)(l.Suspense,{fallback:(0,u.jsxs)(`div`,{className:`kai-voh-center`,children:[(0,u.jsx)(`div`,{className:`kai-voh-spinner`}),(0,u.jsx)(`div`,{children:`Summoning Voh…`})]}),children:(0,u.jsx)(p,{})})}),(0,u.jsx)(`section`,{className:`portal-pane`,style:{display:o===`realms`?`block`:`none`},"aria-hidden":o!==`realms`,children:_?(0,u.jsx)(l.Suspense,{fallback:(0,u.jsxs)(`div`,{className:`kai-voh-center`,children:[(0,u.jsx)(`div`,{className:`kai-voh-spinner`}),(0,u.jsx)(`div`,{children:`Opening Kai Realms…`})]}),children:(0,u.jsx)(m,{onClose:()=>S(`voh`)})}):null})]})]})]})]})]}),document.body):null}export{S as default}; \ No newline at end of file +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KaiVohApp-BMb9vr72.js","assets/index-CcPm2yTY.js","assets/index-BmaJNTKf.css","assets/prop-types-CQ3MXKCa.js","assets/VerifierFrame-Dr7oGdbu.js","assets/VerifierFrame-D0e_dB-R.css","assets/SigilAuthContext-CZfkVeGy.js","assets/sigilRegistry-NyXrDYsE.js","assets/sigilRegistry-Cw7cMZ5l.css","assets/postSeal-ClZBwRbf.js","assets/KaiVohApp-Brroi08x.css","assets/KaiRealms-CxldGmng.js","assets/x-B0A9hqeh.js","assets/KaiRealms-BZJvSAmB.css"])))=>i.map(i=>d[i]); +import{t as e}from"./x-B0A9hqeh.js";import{Sn as t,Tn as n,jn as r,tn as i,wn as a}from"./index-CcPm2yTY.js";import{t as o}from"./SigilAuthContext-CZfkVeGy.js";import{t as s}from"./SigilAuthProvider-Crre0ykb.js";var c=r(a(),1),l=r(n(),1),u=r(i(),1),d=class extends l.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[KaiVoh] render error:`,e,t)}render(){return this.state.error?(0,u.jsxs)(`div`,{style:{padding:`1rem`,textAlign:`center`},children:[(0,u.jsx)(`h2`,{style:{fontSize:18,fontWeight:600},children:`KaiVoh failed to load`}),(0,u.jsx)(`p`,{style:{opacity:.8,marginTop:8},children:this.state.error.message}),(0,u.jsxs)(`details`,{style:{opacity:.65,marginTop:12,textAlign:`left`},children:[(0,u.jsx)(`summary`,{children:`Details`}),(0,u.jsx)(`pre`,{style:{whiteSpace:`pre-wrap`},children:String(this.state.error.stack??``)})]})]}):this.props.children}};function f(){let e=(0,l.useContext)(o);if(!e)throw Error(`useSigilAuth must be used inside `);return e}var p=(0,l.lazy)(()=>t(()=>import(`./KaiVohApp-BMb9vr72.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]))),m=(0,l.lazy)(()=>t(()=>import(`./KaiRealms-CxldGmng.js`),__vite__mapDeps([11,1,2,12,13]))),h=(1+Math.sqrt(5))/2,g=5.236,_=610,v=377;function y({className:e}){let t=(0,l.useId)();return(0,u.jsxs)(`svg`,{className:e,width:_,height:v,viewBox:`0 0 ${_} ${v}`,"aria-hidden":`true`,children:[(0,u.jsx)(`defs`,{children:(0,u.jsxs)(`linearGradient`,{id:t,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,u.jsx)(`stop`,{offset:`0%`,stopColor:`currentColor`,stopOpacity:`0.0`}),(0,u.jsx)(`stop`,{offset:`40%`,stopColor:`currentColor`,stopOpacity:`0.5`}),(0,u.jsx)(`stop`,{offset:`100%`,stopColor:`currentColor`,stopOpacity:`0.0`})]})}),(0,u.jsxs)(`g`,{fill:`none`,stroke:`url(#${t})`,strokeWidth:`2`,children:[(0,u.jsx)(`path`,{d:`M377 0 A377 377 0 0 1 0 377`}),(0,u.jsx)(`path`,{d:`M233 0 A233 233 0 0 1 0 233`}),(0,u.jsx)(`path`,{d:`M144 0 A144 144 0 0 1 0 144`}),(0,u.jsx)(`path`,{d:`M89 0 A89 89 0 0 1 0 89`}),(0,u.jsx)(`path`,{d:`M55 0 A55 55 0 0 1 0 55`}),(0,u.jsx)(`path`,{d:`M34 0 A34 34 0 0 1 0 34`}),(0,u.jsx)(`path`,{d:`M21 0 A21 21 0 0 1 0 21`})]})]})}function b({className:e}){return(0,u.jsxs)(`div`,{className:`seal-emblem ${e??``}`,"aria-hidden":`true`,children:[(0,u.jsx)(`div`,{className:`seal-ring seal-ring--outer`}),(0,u.jsx)(`div`,{className:`seal-ring seal-ring--inner`}),(0,u.jsx)(`div`,{className:`seal-core`})]})}function x({className:e}){let{auth:t}=f(),n=t.meta;if(!n)return null;let r=[`Pulse: ${n.pulse}`,`Beat: ${n.beat}`,`Step: ${n.stepIndex}`,`Day: ${n.chakraDay}`];return n.sigilId&&r.push(`Sigil: ${n.sigilId}`),n.userPhiKey&&r.push(`PhiKey: ${n.userPhiKey}`),(0,u.jsxs)(`div`,{className:`sigil-auth-pill ${e??``}`,role:`status`,"aria-live":`polite`,title:r.join(` • `),style:{maxWidth:`100%`,overflowX:`auto`,whiteSpace:`nowrap`},children:[(0,u.jsx)(`span`,{className:`sigil-auth-pill__dot`,"aria-hidden":`true`}),(0,u.jsxs)(`span`,{className:`sigil-auth-pill__text mono`,children:[`Sealed • `,n.pulse,` • `,n.chakraDay,n.sigilId?` • ${n.sigilId}`:``]})]})}function S({open:t,onClose:n}){let r=(0,l.useRef)(null),i=(0,l.useRef)(null),a=(0,l.useRef)(0),[o,f]=(0,l.useState)(`voh`),[_,v]=(0,l.useState)(!1),S=(0,l.useCallback)(e=>{e===`realms`&&!_&&v(!0),f(e)},[_]);(0,l.useEffect)(()=>{if(!t)return;let e=document.body.style.overflow,n=document.documentElement.style.getPropertyValue(`overscroll-behavior`),o=document.body.style.getPropertyValue(`overscroll-behavior`),s=document.documentElement.style.overflow,c=document.body.style.height,l=document.documentElement.style.height,u=document.documentElement.style.touchAction,d=document.documentElement.style.getPropertyValue(`--kai-breath`),f=document.documentElement.style.getPropertyValue(`--kai-phi`);document.body.style.overflow=`hidden`,document.body.style.height=`100%`,document.documentElement.style.overflow=`hidden`,document.documentElement.style.height=`100%`,document.documentElement.style.setProperty(`overscroll-behavior`,`contain`),document.body.style.setProperty(`overscroll-behavior`,`contain`),document.documentElement.style.touchAction=`manipulation`,document.documentElement.style.setProperty(`--kai-breath`,`${g}s`),document.documentElement.style.setProperty(`--kai-phi`,`${h}`),r.current?.focus();let p=e=>{a.current=e.touches[0]?.clientY??0},m=e=>{if(e.touches.length!==1)return;let t=i.current;if(!t)return;let n=e.target;if(!(n&&t.contains(n))){e.preventDefault();return}let r=(e.touches[0]?.clientY??a.current)-a.current,o=t.scrollTop<=0,s=t.scrollTop+t.clientHeight>=t.scrollHeight;(o&&r>0||s&&r<0)&&e.preventDefault()};return window.addEventListener(`touchstart`,p,{passive:!0}),window.addEventListener(`touchmove`,m,{passive:!1}),()=>{window.removeEventListener(`touchstart`,p),window.removeEventListener(`touchmove`,m),document.body.style.overflow=e,document.body.style.height=c,n?document.documentElement.style.setProperty(`overscroll-behavior`,n):document.documentElement.style.removeProperty(`overscroll-behavior`),o?document.body.style.setProperty(`overscroll-behavior`,o):document.body.style.removeProperty(`overscroll-behavior`),document.documentElement.style.overflow=s,document.documentElement.style.height=l,document.documentElement.style.touchAction=u,d?document.documentElement.style.setProperty(`--kai-breath`,d):document.documentElement.style.removeProperty(`--kai-breath`),f?document.documentElement.style.setProperty(`--kai-phi`,f):document.documentElement.style.removeProperty(`--kai-phi`)}},[t,n]);let C=(0,l.useCallback)(e=>{e.stopPropagation(),n()},[n]),w=(0,l.useCallback)(e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),n())},[n]);return t?(0,c.createPortal)((0,u.jsxs)(`div`,{className:`kai-voh-modal-backdrop atlantean-veil`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`kaivoh-title`,"data-view":o,children:[(0,u.jsx)(`div`,{className:`atlantean-stars`,"aria-hidden":`true`}),(0,u.jsx)(`div`,{className:`atlantean-halo atlantean-halo--1`,"aria-hidden":`true`}),(0,u.jsx)(`div`,{className:`atlantean-halo atlantean-halo--2`,"aria-hidden":`true`}),(0,u.jsxs)(`div`,{className:`kai-voh-container kai-pulse-border glass-omni`,role:`document`,children:[(0,u.jsx)(`div`,{className:`breath-ring breath-ring--outer`,"aria-hidden":`true`}),(0,u.jsx)(`div`,{className:`breath-ring breath-ring--inner`,"aria-hidden":`true`}),(0,u.jsx)(`div`,{className:`phi-grid`,"aria-hidden":`true`}),(0,u.jsx)(y,{className:`phi-spiral phi-spiral--tl`}),(0,u.jsx)(y,{className:`phi-spiral phi-spiral--br`}),(0,u.jsxs)(s,{children:[o!==`realms`&&(0,u.jsx)(`button`,{ref:r,type:`button`,className:`kai-voh-close auric-btn`,"aria-label":`Close portal`,onPointerDown:C,onKeyDown:w,children:(0,u.jsx)(e,{size:22,"aria-hidden":`true`})}),o!==`realms`&&(0,u.jsx)(`div`,{className:`voh-top-orb`,"aria-hidden":`true`,children:(0,u.jsx)(b,{})}),(0,u.jsxs)(`div`,{className:`kai-voh-tabbar`,role:`tablist`,"aria-label":`Kai portal views`,children:[(0,u.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":o===`voh`,className:`kai-voh-tab auric-tab ${o===`voh`?`active`:``}`,onClick:()=>S(`voh`),children:[(0,u.jsx)(`span`,{className:`tab-glyph`,"aria-hidden":`true`,children:`🜂`}),` `,`Voh`]}),(0,u.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":o===`realms`,className:`kai-voh-tab auric-tab ${o===`realms`?`active`:``}`,onClick:()=>S(`realms`),children:[(0,u.jsx)(`span`,{className:`tab-glyph`,"aria-hidden":`true`,children:`⚚`}),` `,`Realms`]}),(0,u.jsx)(`div`,{className:`breath-meter`,"aria-hidden":`true`,children:(0,u.jsx)(`div`,{className:`breath-meter__dot`})}),(0,u.jsx)(x,{className:`sigil-auth-pill--tabbar`})]}),(0,u.jsxs)(`div`,{className:`kai-voh-body`,ref:i,children:[(0,u.jsx)(`h2`,{id:`kaivoh-title`,className:`sr-only`,children:`Kai Portal`}),(0,u.jsxs)(d,{children:[(0,u.jsx)(`section`,{className:`portal-pane`,style:{display:o===`voh`?`block`:`none`},"aria-hidden":o!==`voh`,children:(0,u.jsx)(l.Suspense,{fallback:(0,u.jsxs)(`div`,{className:`kai-voh-center`,children:[(0,u.jsx)(`div`,{className:`kai-voh-spinner`}),(0,u.jsx)(`div`,{children:`Summoning Voh…`})]}),children:(0,u.jsx)(p,{})})}),(0,u.jsx)(`section`,{className:`portal-pane`,style:{display:o===`realms`?`block`:`none`},"aria-hidden":o!==`realms`,children:_?(0,u.jsx)(l.Suspense,{fallback:(0,u.jsxs)(`div`,{className:`kai-voh-center`,children:[(0,u.jsx)(`div`,{className:`kai-voh-spinner`}),(0,u.jsx)(`div`,{children:`Opening Kai Realms…`})]}),children:(0,u.jsx)(m,{onClose:()=>S(`voh`)})}):null})]})]})]})]})]}),document.body):null}export{S as default}; \ No newline at end of file diff --git a/dist/assets/PShort-CHrK750U.js b/dist/assets/PShort-Bmqr2bV5.js similarity index 94% rename from dist/assets/PShort-CHrK750U.js rename to dist/assets/PShort-Bmqr2bV5.js index 0db87011..c93ecc4a 100644 --- a/dist/assets/PShort-CHrK750U.js +++ b/dist/assets/PShort-Bmqr2bV5.js @@ -1 +1 @@ -import{Tn as e,bn as t,jn as n,tn as r,xn as i,yn as a}from"./index-BGzUQCv_.js";var o=n(e(),1),s=n(r(),1);function c(e){let t=e.trim();return t=t.replace(/[)\].,;:!?]+$/g,``),t=t.replace(/^[([{"'`]+/g,``),t.trim()}function l(e){let t=c(e);if(/%[0-9A-Fa-f]{2}/.test(t))try{t=decodeURIComponent(t)}catch{}return t.includes(` `)&&(t=t.replaceAll(` `,`+`)),t=t.replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/g,``),c(t)}function u(){let e=t(),n=a(),r=i();return(0,o.useEffect)(()=>{let t=typeof r.token==`string`?r.token:``,i=typeof r[`*`]==`string`?r[`*`]:``,a=t&&i?`${t}/${i}`:t||i,o=new URLSearchParams(n.search),s=new URLSearchParams(n.hash.startsWith(`#`)?n.hash.slice(1):n.hash),c=o.get(`t`)||o.get(`p`)||o.get(`token`)||s.get(`t`)||s.get(`p`)||s.get(`token`)||``,u=a||c;u&&e(`/p~${l(u)}`,{replace:!0})},[e,n.search,n.hash,r]),(0,s.jsxs)(`div`,{className:`notfound`,role:`region`,"aria-label":`Redirecting`,children:[(0,s.jsx)(`div`,{className:`notfound__title`,children:`Redirecting…`}),(0,s.jsx)(`div`,{className:`notfound__hint`,children:`Normalizing payload token.`})]})}export{u as default}; \ No newline at end of file +import{Tn as e,bn as t,jn as n,tn as r,xn as i,yn as a}from"./index-CcPm2yTY.js";var o=n(e(),1),s=n(r(),1);function c(e){let t=e.trim();return t=t.replace(/[)\].,;:!?]+$/g,``),t=t.replace(/^[([{"'`]+/g,``),t.trim()}function l(e){let t=c(e);if(/%[0-9A-Fa-f]{2}/.test(t))try{t=decodeURIComponent(t)}catch{}return t.includes(` `)&&(t=t.replaceAll(` `,`+`)),t=t.replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/g,``),c(t)}function u(){let e=t(),n=a(),r=i();return(0,o.useEffect)(()=>{let t=typeof r.token==`string`?r.token:``,i=typeof r[`*`]==`string`?r[`*`]:``,a=t&&i?`${t}/${i}`:t||i,o=new URLSearchParams(n.search),s=new URLSearchParams(n.hash.startsWith(`#`)?n.hash.slice(1):n.hash),c=o.get(`t`)||o.get(`p`)||o.get(`token`)||s.get(`t`)||s.get(`p`)||s.get(`token`)||``,u=a||c;u&&e(`/p~${l(u)}`,{replace:!0})},[e,n.search,n.hash,r]),(0,s.jsxs)(`div`,{className:`notfound`,role:`region`,"aria-label":`Redirecting`,children:[(0,s.jsx)(`div`,{className:`notfound__title`,children:`Redirecting…`}),(0,s.jsx)(`div`,{className:`notfound__hint`,children:`Normalizing payload token.`})]})}export{u as default}; \ No newline at end of file diff --git a/dist/assets/SealMomentModal-S7F0w9ki.js b/dist/assets/SealMomentModal-BotOOPRg.js similarity index 99% rename from dist/assets/SealMomentModal-S7F0w9ki.js rename to dist/assets/SealMomentModal-BotOOPRg.js index 66af06f3..a40ef13f 100644 --- a/dist/assets/SealMomentModal-S7F0w9ki.js +++ b/dist/assets/SealMomentModal-BotOOPRg.js @@ -1 +1 @@ -import{Tn as e,jn as t,tn as n,wn as r}from"./index-BGzUQCv_.js";var i=t(e(),1),a=t(r(),1),o=t(n(),1),s=`sigil:urls`;function c(e){if(!(typeof window>`u`))try{let t=window.localStorage.getItem(s),n=t?JSON.parse(t):[];n.includes(e)||(n.push(e),window.localStorage.setItem(s,JSON.stringify(n))),window.dispatchEvent(new CustomEvent(`sigil:url-registered`,{detail:{url:e}}))}catch{}}var l=({open:e,url:t,hash:n,onClose:r})=>{let s=(0,i.useRef)(null),l=(0,i.useRef)(null),m=(0,i.useRef)(null),[h,g]=(0,i.useState)(``),_=(0,i.useRef)(null);(0,i.useEffect)(()=>{if(!(!e||!t)&&_.current!==t){if(_.current=t,typeof window<`u`&&typeof window.__SIGIL__?.registerSigilUrl==`function`)try{window.__SIGIL__.registerSigilUrl(t)}catch{c(t)}else c(t);if(typeof window<`u`&&typeof window.__SIGIL__?.registerSend==`function`)try{window.__SIGIL__.registerSend({type:`sigil:mint`,url:t,hash:n})}catch{}}},[e,t,n]);let v=(0,i.useMemo)(()=>{if(typeof navigator>`u`)return!1;let e=navigator;return typeof e.share==`function`?t&&typeof e.canShare==`function`?e.canShare({url:t}):!0:!1},[t]),y=(0,i.useCallback)(e=>{let t=s.current;if(!t)return;let n=t.querySelectorAll([`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex='-1'])`].join(`,`));if(n.length===0)return;let r=n[0],i=n[n.length-1];!e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus())},[]);(0,i.useEffect)(()=>{if(!e)return;m.current=document.activeElement??null;let t=document.body.style.overflow;document.body.style.overflow=`hidden`;let n=window.setTimeout(()=>l.current?.focus({preventScroll:!0}),0),r=e=>{e.key===`Tab`&&y(e)};return document.addEventListener(`keydown`,r,!0),()=>{document.body.style.overflow=t,document.removeEventListener(`keydown`,r,!0),window.clearTimeout(n),m.current?.focus?.()}},[e,y]);let b=e=>{g(e),window.setTimeout(()=>g(``),900)},x=async(e,t)=>{try{if(typeof navigator>`u`)throw Error(`no navigator`);if(!navigator.clipboard?.writeText)throw Error(`no clipboard`);await navigator.clipboard.writeText(e),b(`${t} copied to clipboard`)}catch{b(`Could not copy ${t}`)}},S=async()=>{try{v&&typeof navigator<`u`?(await navigator.share?.({title:`Kairos Sigil-Glyph`,text:`Sealed Kairos Moment`,url:t}),b(`Share sheet opened`)):await x(t,`Link`)}catch{}},C=(0,i.useMemo)(()=>n?n.slice(0,16):`—`,[n]),w=e=>{e.preventDefault(),e.stopPropagation(),r?.()},T=e=>{e.target===e.currentTarget&&e.preventDefault()};return e?(0,a.createPortal)((0,o.jsxs)(`div`,{className:`seal-overlay`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`seal-title`,"aria-describedby":`seal-desc`,"data-state":`open`,onClick:e=>e.stopPropagation(),onPointerDown:T,children:[(0,o.jsx)(`div`,{className:`seal-veil`,"aria-hidden":`true`}),(0,o.jsxs)(`div`,{ref:s,className:`seal-card`,role:`document`,onClick:e=>e.stopPropagation(),children:[(0,o.jsx)(`div`,{className:`seal-ornament seal-ornament--tl`,"aria-hidden":`true`}),(0,o.jsx)(`div`,{className:`seal-ornament seal-ornament--tr`,"aria-hidden":`true`}),(0,o.jsx)(`div`,{className:`seal-ornament seal-ornament--bl`,"aria-hidden":`true`}),(0,o.jsx)(`div`,{className:`seal-ornament seal-ornament--br`,"aria-hidden":`true`}),(0,o.jsx)(`button`,{ref:l,className:`seal-close`,"aria-label":`Close`,onClick:w,type:`button`,children:(0,o.jsx)(u,{})}),(0,o.jsxs)(`header`,{className:`seal-header`,children:[(0,o.jsx)(`h3`,{id:`seal-title`,className:`seal-title`,children:`Moment Sealed`}),(0,o.jsx)(`p`,{id:`seal-desc`,className:`seal-subtitle`,children:`Your Kairos imprint is preserved. Proceed to the URL below to Inhale Claimed Ownership.`})]}),(0,o.jsxs)(`label`,{className:`field`,children:[(0,o.jsx)(`span`,{className:`field-label`,children:`Hash`}),(0,o.jsxs)(`div`,{className:`row`,children:[(0,o.jsx)(`code`,{className:`hash`,title:n||`—`,children:n?C:`—`}),(0,o.jsx)(`button`,{className:`icon-btn`,onClick:()=>x(n,`Hash`),disabled:!n,"aria-label":`Copy hash`,title:`Copy hash`,type:`button`,children:(0,o.jsx)(f,{})})]}),n&&(0,o.jsxs)(`p`,{className:`micro`,children:[`Full: `,(0,o.jsx)(`span`,{className:`mono`,children:n})]})]}),(0,o.jsxs)(`label`,{className:`field`,children:[(0,o.jsx)(`span`,{className:`field-label`,children:`URL`}),(0,o.jsxs)(`div`,{className:`row`,children:[(0,o.jsx)(`input`,{className:`url-input`,value:t,readOnly:!0,"aria-readonly":`true`,spellCheck:!1}),(0,o.jsx)(`button`,{className:`icon-btn`,onClick:()=>x(t,`Link`),disabled:!t,"aria-label":`Copy link`,title:`Copy link`,type:`button`,children:(0,o.jsx)(f,{})}),t&&(0,o.jsx)(`a`,{className:`open-link`,href:t,target:`_blank`,rel:`noopener`,"aria-label":`Open link in new tab`,title:`Open link`,children:(0,o.jsx)(p,{})})]})]}),(0,o.jsx)(`div`,{className:`cta-row`,children:(0,o.jsxs)(`button`,{className:`secondary cta`,onClick:S,type:`button`,children:[(0,o.jsx)(d,{}),(0,o.jsx)(`span`,{children:v?`Share`:`Remember Link`})]})}),(0,o.jsx)(`p`,{className:`fine`,children:`This moment is now sealed in time. Use the link above within the next 11 breaths to claim ownership & gain permanent access to this Kairos moment.`}),(0,o.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:h})]})]}),document.body):null},u=()=>(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`seal-close-ico`,children:[(0,o.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,opacity:`.35`}),(0,o.jsx)(`path`,{d:`M7 7l10 10M17 7L7 17`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`})]}),d=()=>(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,o.jsx)(`path`,{d:`M15 8a3 3 0 100-6 3 3 0 000 6zM6 14a3 3 0 100-6 3 3 0 000 6zm9 12a3 3 0 100-6 3 3 0 000 6z`,fill:`currentColor`}),(0,o.jsx)(`path`,{d:`M8.6 9.7l6.8-3.4M8.6 12.3l6.8 3.4`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`})]}),f=()=>(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,o.jsx)(`rect`,{x:`9`,y:`9`,width:`10`,height:`10`,rx:`2`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,o.jsx)(`rect`,{x:`5`,y:`5`,width:`10`,height:`10`,rx:`2`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`,opacity:`.5`})]}),p=()=>(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,o.jsx)(`path`,{d:`M10 14a5 5 0 007.07 0l1.41-1.41a5 5 0 00-7.07-7.07L10 6`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,o.jsx)(`path`,{d:`M14 10a5 5 0 00-7.07 0L5.5 11.43a5 5 0 007.07 7.07L14 18`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`})]}),m=l;export{m as t}; \ No newline at end of file +import{Tn as e,jn as t,tn as n,wn as r}from"./index-CcPm2yTY.js";var i=t(e(),1),a=t(r(),1),o=t(n(),1),s=`sigil:urls`;function c(e){if(!(typeof window>`u`))try{let t=window.localStorage.getItem(s),n=t?JSON.parse(t):[];n.includes(e)||(n.push(e),window.localStorage.setItem(s,JSON.stringify(n))),window.dispatchEvent(new CustomEvent(`sigil:url-registered`,{detail:{url:e}}))}catch{}}var l=({open:e,url:t,hash:n,onClose:r})=>{let s=(0,i.useRef)(null),l=(0,i.useRef)(null),m=(0,i.useRef)(null),[h,g]=(0,i.useState)(``),_=(0,i.useRef)(null);(0,i.useEffect)(()=>{if(!(!e||!t)&&_.current!==t){if(_.current=t,typeof window<`u`&&typeof window.__SIGIL__?.registerSigilUrl==`function`)try{window.__SIGIL__.registerSigilUrl(t)}catch{c(t)}else c(t);if(typeof window<`u`&&typeof window.__SIGIL__?.registerSend==`function`)try{window.__SIGIL__.registerSend({type:`sigil:mint`,url:t,hash:n})}catch{}}},[e,t,n]);let v=(0,i.useMemo)(()=>{if(typeof navigator>`u`)return!1;let e=navigator;return typeof e.share==`function`?t&&typeof e.canShare==`function`?e.canShare({url:t}):!0:!1},[t]),y=(0,i.useCallback)(e=>{let t=s.current;if(!t)return;let n=t.querySelectorAll([`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex='-1'])`].join(`,`));if(n.length===0)return;let r=n[0],i=n[n.length-1];!e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus())},[]);(0,i.useEffect)(()=>{if(!e)return;m.current=document.activeElement??null;let t=document.body.style.overflow;document.body.style.overflow=`hidden`;let n=window.setTimeout(()=>l.current?.focus({preventScroll:!0}),0),r=e=>{e.key===`Tab`&&y(e)};return document.addEventListener(`keydown`,r,!0),()=>{document.body.style.overflow=t,document.removeEventListener(`keydown`,r,!0),window.clearTimeout(n),m.current?.focus?.()}},[e,y]);let b=e=>{g(e),window.setTimeout(()=>g(``),900)},x=async(e,t)=>{try{if(typeof navigator>`u`)throw Error(`no navigator`);if(!navigator.clipboard?.writeText)throw Error(`no clipboard`);await navigator.clipboard.writeText(e),b(`${t} copied to clipboard`)}catch{b(`Could not copy ${t}`)}},S=async()=>{try{v&&typeof navigator<`u`?(await navigator.share?.({title:`Kairos Sigil-Glyph`,text:`Sealed Kairos Moment`,url:t}),b(`Share sheet opened`)):await x(t,`Link`)}catch{}},C=(0,i.useMemo)(()=>n?n.slice(0,16):`—`,[n]),w=e=>{e.preventDefault(),e.stopPropagation(),r?.()},T=e=>{e.target===e.currentTarget&&e.preventDefault()};return e?(0,a.createPortal)((0,o.jsxs)(`div`,{className:`seal-overlay`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`seal-title`,"aria-describedby":`seal-desc`,"data-state":`open`,onClick:e=>e.stopPropagation(),onPointerDown:T,children:[(0,o.jsx)(`div`,{className:`seal-veil`,"aria-hidden":`true`}),(0,o.jsxs)(`div`,{ref:s,className:`seal-card`,role:`document`,onClick:e=>e.stopPropagation(),children:[(0,o.jsx)(`div`,{className:`seal-ornament seal-ornament--tl`,"aria-hidden":`true`}),(0,o.jsx)(`div`,{className:`seal-ornament seal-ornament--tr`,"aria-hidden":`true`}),(0,o.jsx)(`div`,{className:`seal-ornament seal-ornament--bl`,"aria-hidden":`true`}),(0,o.jsx)(`div`,{className:`seal-ornament seal-ornament--br`,"aria-hidden":`true`}),(0,o.jsx)(`button`,{ref:l,className:`seal-close`,"aria-label":`Close`,onClick:w,type:`button`,children:(0,o.jsx)(u,{})}),(0,o.jsxs)(`header`,{className:`seal-header`,children:[(0,o.jsx)(`h3`,{id:`seal-title`,className:`seal-title`,children:`Moment Sealed`}),(0,o.jsx)(`p`,{id:`seal-desc`,className:`seal-subtitle`,children:`Your Kairos imprint is preserved. Proceed to the URL below to Inhale Claimed Ownership.`})]}),(0,o.jsxs)(`label`,{className:`field`,children:[(0,o.jsx)(`span`,{className:`field-label`,children:`Hash`}),(0,o.jsxs)(`div`,{className:`row`,children:[(0,o.jsx)(`code`,{className:`hash`,title:n||`—`,children:n?C:`—`}),(0,o.jsx)(`button`,{className:`icon-btn`,onClick:()=>x(n,`Hash`),disabled:!n,"aria-label":`Copy hash`,title:`Copy hash`,type:`button`,children:(0,o.jsx)(f,{})})]}),n&&(0,o.jsxs)(`p`,{className:`micro`,children:[`Full: `,(0,o.jsx)(`span`,{className:`mono`,children:n})]})]}),(0,o.jsxs)(`label`,{className:`field`,children:[(0,o.jsx)(`span`,{className:`field-label`,children:`URL`}),(0,o.jsxs)(`div`,{className:`row`,children:[(0,o.jsx)(`input`,{className:`url-input`,value:t,readOnly:!0,"aria-readonly":`true`,spellCheck:!1}),(0,o.jsx)(`button`,{className:`icon-btn`,onClick:()=>x(t,`Link`),disabled:!t,"aria-label":`Copy link`,title:`Copy link`,type:`button`,children:(0,o.jsx)(f,{})}),t&&(0,o.jsx)(`a`,{className:`open-link`,href:t,target:`_blank`,rel:`noopener`,"aria-label":`Open link in new tab`,title:`Open link`,children:(0,o.jsx)(p,{})})]})]}),(0,o.jsx)(`div`,{className:`cta-row`,children:(0,o.jsxs)(`button`,{className:`secondary cta`,onClick:S,type:`button`,children:[(0,o.jsx)(d,{}),(0,o.jsx)(`span`,{children:v?`Share`:`Remember Link`})]})}),(0,o.jsx)(`p`,{className:`fine`,children:`This moment is now sealed in time. Use the link above within the next 11 breaths to claim ownership & gain permanent access to this Kairos moment.`}),(0,o.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:h})]})]}),document.body):null},u=()=>(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`seal-close-ico`,children:[(0,o.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,opacity:`.35`}),(0,o.jsx)(`path`,{d:`M7 7l10 10M17 7L7 17`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`})]}),d=()=>(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,o.jsx)(`path`,{d:`M15 8a3 3 0 100-6 3 3 0 000 6zM6 14a3 3 0 100-6 3 3 0 000 6zm9 12a3 3 0 100-6 3 3 0 000 6z`,fill:`currentColor`}),(0,o.jsx)(`path`,{d:`M8.6 9.7l6.8-3.4M8.6 12.3l6.8 3.4`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`})]}),f=()=>(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,o.jsx)(`rect`,{x:`9`,y:`9`,width:`10`,height:`10`,rx:`2`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,o.jsx)(`rect`,{x:`5`,y:`5`,width:`10`,height:`10`,rx:`2`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`,opacity:`.5`})]}),p=()=>(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,o.jsx)(`path`,{d:`M10 14a5 5 0 007.07 0l1.41-1.41a5 5 0 00-7.07-7.07L10 6`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,o.jsx)(`path`,{d:`M14 10a5 5 0 00-7.07 0L5.5 11.43a5 5 0 007.07 7.07L14 18`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`})]}),m=l;export{m as t}; \ No newline at end of file diff --git a/dist/assets/SigilAuthContext-Bpha3aI1.js b/dist/assets/SigilAuthContext-CZfkVeGy.js similarity index 73% rename from dist/assets/SigilAuthContext-Bpha3aI1.js rename to dist/assets/SigilAuthContext-CZfkVeGy.js index 8855475b..22e669d7 100644 --- a/dist/assets/SigilAuthContext-Bpha3aI1.js +++ b/dist/assets/SigilAuthContext-CZfkVeGy.js @@ -1 +1 @@ -import{Tn as e,jn as t}from"./index-BGzUQCv_.js";var n=t(e(),1);const r=(0,n.createContext)(null);function i(){let e=(0,n.useContext)(r);if(!e)throw Error(`useSigilAuth must be used within .`);return e}export{i as n,r as t}; \ No newline at end of file +import{Tn as e,jn as t}from"./index-CcPm2yTY.js";var n=t(e(),1);const r=(0,n.createContext)(null);function i(){let e=(0,n.useContext)(r);if(!e)throw Error(`useSigilAuth must be used within .`);return e}export{i as n,r as t}; \ No newline at end of file diff --git a/dist/assets/SigilAuthProvider-Bf4S4o9t.js b/dist/assets/SigilAuthProvider-Crre0ykb.js similarity index 91% rename from dist/assets/SigilAuthProvider-Bf4S4o9t.js rename to dist/assets/SigilAuthProvider-Crre0ykb.js index 1a27e603..bbcac5cf 100644 --- a/dist/assets/SigilAuthProvider-Bf4S4o9t.js +++ b/dist/assets/SigilAuthProvider-Crre0ykb.js @@ -1 +1 @@ -import{Tn as e,jn as t,tn as n}from"./index-BGzUQCv_.js";import{t as r}from"./SigilAuthContext-Bpha3aI1.js";var i=t(e(),1),a=t(n(),1),o=`kai.sigilAuth.v1`,s={svgText:null,meta:null};function c(e){if(typeof e!=`object`||!e)return!1;let t=e;if(!(typeof t.pulse==`number`&&Number.isFinite(t.pulse)&&typeof t.beat==`number`&&Number.isFinite(t.beat)&&typeof t.stepIndex==`number`&&Number.isFinite(t.stepIndex)&&typeof t.chakraDay==`string`&&typeof t.kaiSignature==`string`))return!1;let n=e=>e===void 0||typeof e==`string`;return n(t.userPhiKey)&&n(t.sigilId)&&n(t.sigilActionUrl)}function l(e){if(typeof e!=`object`||!e)return!1;let t=e,n=t.svgText===null||typeof t.svgText==`string`,r=t.meta===null||typeof t.meta==`object`&&t.meta!==null&&c(t.meta);return n&&r}function u(){if(typeof window>`u`)return s;try{let e=window.localStorage.getItem(o);if(!e)return s;let t=JSON.parse(e);return l(t)?t:s}catch{return s}}function d(e){try{window.localStorage.setItem(o,JSON.stringify(e))}catch{}}function f(){try{window.localStorage.removeItem(o)}catch{}}function p({children:e}){let[t,n]=(0,i.useState)(()=>u()),c=(0,i.useCallback)((e,t)=>{let r={svgText:e,meta:t};n(r),typeof window<`u`&&d(r)},[]),l=(0,i.useCallback)(()=>{n(s),typeof window<`u`&&f()},[]);(0,i.useEffect)(()=>{let e=e=>{e.key===o&&n(u())};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]);let p=(0,i.useMemo)(()=>({auth:t,setAuth:c,clearAuth:l}),[t,c,l]);return(0,a.jsx)(r.Provider,{value:p,children:e})}export{p as t}; \ No newline at end of file +import{Tn as e,jn as t,tn as n}from"./index-CcPm2yTY.js";import{t as r}from"./SigilAuthContext-CZfkVeGy.js";var i=t(e(),1),a=t(n(),1),o=`kai.sigilAuth.v1`,s={svgText:null,meta:null};function c(e){if(typeof e!=`object`||!e)return!1;let t=e;if(!(typeof t.pulse==`number`&&Number.isFinite(t.pulse)&&typeof t.beat==`number`&&Number.isFinite(t.beat)&&typeof t.stepIndex==`number`&&Number.isFinite(t.stepIndex)&&typeof t.chakraDay==`string`&&typeof t.kaiSignature==`string`))return!1;let n=e=>e===void 0||typeof e==`string`;return n(t.userPhiKey)&&n(t.sigilId)&&n(t.sigilActionUrl)}function l(e){if(typeof e!=`object`||!e)return!1;let t=e,n=t.svgText===null||typeof t.svgText==`string`,r=t.meta===null||typeof t.meta==`object`&&t.meta!==null&&c(t.meta);return n&&r}function u(){if(typeof window>`u`)return s;try{let e=window.localStorage.getItem(o);if(!e)return s;let t=JSON.parse(e);return l(t)?t:s}catch{return s}}function d(e){try{window.localStorage.setItem(o,JSON.stringify(e))}catch{}}function f(){try{window.localStorage.removeItem(o)}catch{}}function p({children:e}){let[t,n]=(0,i.useState)(()=>u()),c=(0,i.useCallback)((e,t)=>{let r={svgText:e,meta:t};n(r),typeof window<`u`&&d(r)},[]),l=(0,i.useCallback)(()=>{n(s),typeof window<`u`&&f()},[]);(0,i.useEffect)(()=>{let e=e=>{e.key===o&&n(u())};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]);let p=(0,i.useMemo)(()=>({auth:t,setAuth:c,clearAuth:l}),[t,c,l]);return(0,a.jsx)(r.Provider,{value:p,children:e})}export{p as t}; \ No newline at end of file diff --git a/dist/assets/SigilExplorer-Be22x_Dh.js b/dist/assets/SigilExplorer-YG_XvkA-.js similarity index 99% rename from dist/assets/SigilExplorer-Be22x_Dh.js rename to dist/assets/SigilExplorer-YG_XvkA-.js index 53661cc8..46000f82 100644 --- a/dist/assets/SigilExplorer-Be22x_Dh.js +++ b/dist/assets/SigilExplorer-YG_XvkA-.js @@ -1,4 +1,4 @@ -import{K as e,Tn as t,W as n,X as r,gt as i,hn as a,jn as o,mn as s,nn as c,tn as l}from"./index-BGzUQCv_.js";import{a as u,n as d,o as f,r as p,t as m}from"./usernameClaimRegistry-BEUaCJlN.js";var h=o(t(),1),g=o(l(),1),_=`https://align.kaiklok.com`,v=`http://m.kai`,y={root:`#ff3b3b`,sacral:`#ff8a3d`,solar:`#ffd54a`,heart:`#3dff9a`,throat:`#46d3ff`,thirdEye:`#6b6cff`,crown:`#c18bff`};function b(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();return t?t.includes(`root`)?`root`:t.includes(`sacral`)?`sacral`:t.includes(`solar`)||t.includes(`plexus`)||t.includes(`sun`)?`solar`:t.includes(`heart`)?`heart`:t.includes(`throat`)?`throat`:t.includes(`third`)||t.includes(`eye`)||t.includes(`indigo`)?`thirdEye`:t.includes(`crown`)||t.includes(`krown`)||t.includes(`violet`)?`crown`:t===`1`?`root`:t===`2`?`sacral`:t===`3`?`solar`:t===`4`?`heart`:t===`5`?`throat`:t===`6`?`thirdEye`:t===`7`?`crown`:null:null}function ee(e){let t=b(e),n=t?y[t]:`var(--sx-accent)`;return{"--sx-chakra":n}}var te=`kai:sigils:v1`,ne=`sigil:urls`,re=`kai-sigil-registry`,x=512,S=`/phi.svg`,C=typeof window<`u`,w=C&&window.localStorage!==void 0,T=1000000n,E=8,ie=2e4;function ae(){let e=s(),t=a(e),n=(t/T+1n)*T-t,r=a(e+1n)-t,i=r>0n?r:191n,o=(n+i-1n)/i,c=Number(o);return Math.min(ie,Math.max(E,c))}var D=5e3,oe=24,se=200,O=180,ce=1200,le=12e3,k=`kai:inhaleQueue:v1`,A=`kai:urlHealth:v1`,ue=18,de=2200,fe=`sigil-explorer-prefetch-v1`,pe=4200,me=`https://phi.network`,he=520,ge=900,_e=80;function j(){let e=s(),t=BigInt(2**53-1),n=e<0n?0n:e>t?t:e;return Number(n)}function ve(e){if(!C)return e;let t=window;return typeof t.CSS?.escape==`function`?t.CSS.escape(e):e.replace(/[^a-zA-Z0-9_-]/gu,e=>`\\${e}`)}var M=_,N=v,ye=`/sigils/seal`,be=`/sigils/urls`,xe=`/sigils/inhale`,Se=`kai:lahmahtorBase:v1`,Ce=`kai:lahmahtorBackupDeadUntil:v1`,we=120*1e3,P=0;function Te(){if(!w)return;let e=localStorage.getItem(Ce);if(!e)return;let t=Number(e);Number.isFinite(t)&&t>0&&(P=t)}function Ee(){if(w)try{localStorage.setItem(Ce,String(P))}catch{}}function De(){return j()e!==N):e;let t=window.location.protocol===`https:`?e.filter(e=>e.startsWith(`https://`)):e;return De()?t.filter(e=>e!==N):t}function Ne(e){return e===0||e===404||e===408||e===429||e>=500}async function Pe(e,t){let n=Me(),r=null;for(let i of n){let n=e(i);try{let e=await fetch(n,t);if(r=e,e.ok||e.status===304)return i===N&&Oe(),F=i,je(),e;if(i===N&&Ne(e.status)&&ke(),!Ne(e.status))return e}catch{i===N&&ke();continue}}return r}async function Fe(e,t){let n=await Pe(e,t);if(!n)return{ok:!1,status:0};if(!n.ok)return{ok:!1,status:n.status};try{return{ok:!0,value:await n.json(),status:n.status}}catch{return{ok:!1,status:0}}}function I(){return C?window.location.origin:me}function L(e){try{let t=I(),n=new URL(e,t);return new URL(`${n.pathname}${n.search}${n.hash}`,t).toString()}catch{return e}}function Ie(e){try{let t=new URL(e,I()).pathname.match(/\/s\/([^/]+)/u);return t?.[1]?decodeURIComponent(t[1]):void 0}catch{return}}function R(e){try{return new URL(e,I()).pathname.toLowerCase().startsWith(`/p~`)}catch{return e.toLowerCase().includes(`/p~`)}}function Le(e){try{return decodeURIComponent(e)}catch{return e}}function Re(e){let t=e.trim();return t.length<16?!1:/^[A-Za-z0-9_-]+$/u.test(t)}function ze(e){let t=I();return new URL(`/stream/p/${e}`,t).toString()}function Be(e){let t=I(),n=new URL(`/stream`,t),r=new URLSearchParams;return r.set(`p`,e),n.hash=`#${r.toString()}`,n.toString()}function Ve(e){try{let t=I(),n=new URL(e,t),r=n.pathname.match(/\/stream\/p\/([^/]+)/u);if(!r?.[1])return e;let i=decodeURIComponent(r[1]),a=new URL(`/stream`,t);a.search=n.search;let o=n.hash.startsWith(`#`)?n.hash.slice(1):``,s=new URLSearchParams(o);return s.set(`p`,i),a.hash=`#${s.toString()}`,a.toString()}catch{return e}}function z(e){try{let t=new URL(e,I()),n=t.pathname,r=n.match(/\/stream\/p\/([^/]+)/u);if(r?.[1])return decodeURIComponent(r[1]);let i=n.match(/^\/p~([^/]+)/u);if(i?.[1])return decodeURIComponent(i[1]);let a=t.searchParams.get(`p`);if(a)return a;let o=t.hash.startsWith(`#`)?t.hash.slice(1):``;return new URLSearchParams(o).get(`p`)||void 0}catch{let t=e.toLowerCase().match(/\/p~([^/?#]+)/u);return t?.[1]?Le(t[1]):void 0}}function B(e){let t=L(e);if(R(t)){let e=z(t);return e?L(Be(e)):t}let n=Ve(t);return n===t?t:L(n)}function He(e){if(!C)return B(e);let t=B(e),n=window.location.origin;try{let e=new URL(t,n);return`${n}${e.pathname}${e.search}${e.hash}`}catch{let e=t.match(/^(?:https?:\/\/[^/]+)?(\/.*)$/i);return`${n}${(e?.[1]??t).startsWith(`/`)?e?.[1]??t:`/${e?.[1]??t}`}`}}function Ue(e,t=10){return e?e.length<=t*2+3?e:`${e.slice(0,t)}…${e.slice(-t)}`:`—`}function V(e,t){return(e.pulse??0)===(t.pulse??0)?(e.beat??0)===(t.beat??0)?(e.stepIndex??0)-(t.stepIndex??0):(e.beat??0)-(t.beat??0):(e.pulse??0)-(t.pulse??0)}function We(e){return e.toFixed(6).replace(/0+$/u,``).replace(/\.$/u,``)}function H(){return C?typeof navigator>`u`?!0:navigator.onLine:!1}function Ge(){return C&&typeof window.crypto?.randomUUID==`function`?window.crypto.randomUUID():Math.random().toString(16).slice(2)}function U(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ke(e,t){if(!U(e))return;let n=e[t];return typeof n==`string`&&n.trim()||void 0}async function qe(e){if(!C||!H())return;let t=new AbortController,n=window.setTimeout(()=>t.abort(),pe);try{let n=await fetch(e,{method:`GET`,cache:`force-cache`,signal:t.signal});if(n&&n.ok&&`caches`in window&&typeof caches.open==`function`)try{await(await caches.open(fe)).put(new Request(e),n.clone())}catch{}}catch{}finally{window.clearTimeout(n)}}var W=new Map;function Je(){if(!w)return;let e=localStorage.getItem(A);if(e)try{let t=JSON.parse(e);if(!U(t))return;W.clear();for(let[e,n]of Object.entries(t))(n===1||n===-1)&&W.set(L(e),n)}catch{}}function Ye(){if(!w)return;let e={};for(let[t,n]of W)e[t]=n;try{localStorage.setItem(A,JSON.stringify(e))}catch{}}function Xe(e,t){let n=L(e);return W.get(n)===t?!1:(W.set(n,t),Ye(),!0)}function Ze(e){let t=new URL(_).host,n=new URL(v).host,r=new URL(I()).host,i=new URL(me).host;return e===t||e===n||e===r||e===i}async function Qe(e){if(!C)return`unknown`;let t=B(e),n;try{if(n=new URL(t,I()),!Ze(n.host))return`unknown`;if(n.pathname.toLowerCase()===`/stream`)return`ok`}catch{return`unknown`}try{let e=new AbortController,t=window.setTimeout(()=>e.abort(),de),r=t=>fetch(n.toString(),{method:t,cache:`no-store`,signal:e.signal,redirect:`follow`,mode:`cors`}),i;try{i=await r(`HEAD`)}catch{i=await r(`GET`)}finally{window.clearTimeout(t)}return i.ok?`ok`:`bad`}catch{return`unknown`}}function $e(e){try{let t=new URL(e,I()),n=t.pathname.toLowerCase();if(n.includes(`/s/`))return`postS`;if(n.startsWith(`/p~`))return`streamP`;if(!n.includes(`/stream`))return`other`;if(n.includes(`/stream/p/`))return`streamP`;let r=t.searchParams.get(`t`);if(r&&r.trim())return`streamT`;let i=t.hash.startsWith(`#`)?t.hash.slice(1):``,a=new URLSearchParams(i),o=a.get(`t`);if(o&&o.trim()||n.includes(`/stream/t`))return`streamT`;let s=t.searchParams.get(`p`);if(s&&s.trim())return`streamQ`;let c=a.get(`p`);return c&&c.trim()?`streamQ`:`stream`}catch{let t=e.toLowerCase();return t.includes(`/s/`)?`postS`:t.includes(`/p~`)||t.includes(`/stream/p/`)?`streamP`:t.includes(`/stream/t`)||/[?&#]t=/.test(t)?`streamT`:t.includes(`/stream`)&&/[?&#]p=/.test(t)?`streamQ`:t.includes(`/stream`)?`stream`:`other`}}function et(e){let t=$e(e);return t===`postS`?`post`:t.startsWith(`stream`)?`stream`:`other`}function tt(e){let t=e;return typeof t.userPhiKey==`string`&&t.userPhiKey||typeof t.phiKey==`string`&&t.phiKey||typeof t.phikey==`string`&&t.phikey||``}function nt(e,t){let n=tt(t),r=Number.isFinite(t.pulse??NaN)?t.pulse:null;if(n&&r!=null)return`k:${n}|${r}`;let i=typeof t.kaiSignature==`string`?t.kaiSignature.trim():``;if(i)return`sig:${i}`;let a=z(e);if(a&&a.trim())return`tok:${a.trim()}`;let o=Ie(e)??``;return o?`h:${o}`:`u:${L(e)}`}function rt(e,t){let n=et(e),r=Ie(e)??``;if(n===`post`&&r)return`post:${r}`;let i=tt(t),a=Number.isFinite(t.pulse??NaN)?t.pulse:null;if(n===`stream`&&i&&a!=null)return`stream:${i}|${a}`;let o=typeof t.kaiSignature==`string`?t.kaiSignature.trim():``;if(o)return`${n}:sig:${o}`;let s=z(e);return s&&s.trim()?`${n}:tok:${s.trim()}`:`${n}:u:${L(e)}`}var it=e=>{let t=e.toLowerCase();if(!t.includes(`/stream`))return!1;let n=t.includes(`root=`)||t.includes(`&seg=`)||t.includes(`&add=`),r=t.includes(`/stream#`)||t.includes(`#v=`);return n&&r};function G(e,t){if(R(e))return-1e9;let n=e.toLowerCase(),r=$e(e),i=0;it(n)&&(i-=1e4),t===`post`?r===`postS`?i+=220:i-=25:t===`stream`?r===`streamT`?i+=220:r===`streamP`?i+=190:r===`streamQ`?i+=175:r===`stream`?i+=160:r===`postS`?i+=80:i-=25:(r===`postS`&&(i+=120),r===`streamT`&&(i+=125),r===`streamP`&&(i+=105),(r===`streamQ`||r===`stream`)&&(i+=95));let a=I().toLowerCase();n.startsWith(a)&&(i+=12),n.startsWith(_.toLowerCase())&&(i+=10),n.startsWith(v.toLowerCase())&&(i+=10);let o=W.get(L(e));return o===1&&(i+=200),o===-1&&(i-=200),i+=Math.max(0,20-Math.floor(e.length/40)),i}function at(e,t){let n=e.filter(e=>!R(e)),r=n.length>0?n:e;if(n.length===0&&e.length>0){let t=z(e[0]??``);if(t)return L(Be(t))}let i=r[0]??``,a=-1e9;for(let e of r){let n=G(e,t);(n>a||n===a&&e.length=1e-12)return e}}}function ut(){if(!w)return;let e=Array.from(K.keys());try{localStorage.setItem(te,JSON.stringify(e))}catch{}}function J(e,t){let n=L(e);dt(n,t);let r=K.get(n);if(!r)return K.set(n,t),!0;let i=r.parentUrl??``,a=r.originUrl??``,o=t.parentUrl??``,s=t.originUrl??``,c=i!==o||a!==s,l=Object.keys(r).length,u=Object.keys(t).length!==l,d=V(r,t)!==0;return c||u||d?(K.set(n,t),!0):!1}function dt(e,t){let n=t.feed;if(!n)return;let r=n.usernameClaim,i=r?f(r.payload?.normalized||r.payload?.username||``):``,a=f(n.author??``),o=i||a;if(!o||!r)return;let s=u(r.hash??``),c=r.url?.trim()||e;if(!s||!c)return;let l=r.payload;if(!l||l.kind!==`username_claim`)return;let p=f(l.normalized||l.username||``)||o;if(p!==o)return;let m=r.ownerHint??l.ownerHint??null;d({hash:s,url:L(c),payload:{...l,normalized:p},ownerHint:m})}function ft(e){let t=L(e),r=n(t);return r?J(t,ct(r,st(t))):!1}function pt(e,t){if(e.length===0)return!1;let n=L(e[0]),r=!1;r=ft(n)||r;{let e=K.get(n);if(e){let t={...e};t.originUrl||=n,r=J(n,t)||r}}for(let t=1;t{X=null,Q()},O))}function vt(e,t){let n=L(e),r={url:n,...t};Y.set(n,r),Z(),C&&(X!=null&&window.clearTimeout(X),X=window.setTimeout(()=>{X=null,Q()},O))}function yt(){for(let[e,t]of K){let n=L(e),r=t;Y.set(n,{url:n,...r})}Z()}async function Q(){if(C&&H()&&!mt&&Y.size!==0){mt=!0;try{let e=[],t=[];for(let[n,r]of Y)if(e.push(r),t.push(n),e.length>=se)break;let n=JSON.stringify(e),r=new Blob([n],{type:`application/json`}),i=new FormData;i.append(`file`,r,`sigils_${Ge()}.json`);let a=await Pe(e=>{let t=new URL(xe,e);return t.searchParams.set(`include_state`,`false`),t.searchParams.set(`include_urls`,`false`),t.toString()},{method:`POST`,body:i});if(!a||!a.ok)throw Error(`inhale failed: ${a?.status??0}`);try{await a.json()}catch{}for(let e of t)Y.delete(e);Z(),ht=0,Y.size>0&&(X=window.setTimeout(()=>{X=null,Q()},10))}catch{ht=Math.min(ht?ht*2:ce,le),X=window.setTimeout(()=>{X=null,Q()},ht)}finally{mt=!1}}}function $(e,t){let i=L(e),a=n(i);if(!a)return!1;let o=t?.includeAncestry??!0,s=t?.broadcast??!0,c=t?.persist??!0,l=t?.source??`local`,u=t?.enqueueToApi??l===`local`,d=!1,f=st(i);if(d=J(i,ct(a,f))||d,o&&f.chain.length>0){for(let e of f.chain)d=ft(e)||d;d=pt(f.chain,i)||d}if(o){let e=r(i);for(let t of e){let e=L(t),r=n(e);r&&(d=J(e,ct(r,st(e)))||d)}}if(d&&(c&&ut(),q&&s&&q.postMessage({type:`sigil:add`,url:i}),u)){let e=K.get(i);e&&vt(i,e)}return d}function bt(e){let t=[],n=[],r=e=>{let n=L(e);t.includes(n)||t.push(n)};if(Array.isArray(e)){for(let i of e){if(typeof i==`string`){i.trim()&&r(i.trim());continue}if(U(i)){let e=i.url;if(typeof e==`string`&&e.trim()){let r=L(e.trim());t.includes(r)||t.push(r),n.push({...i,url:r})}}}return{urls:t,rawKrystals:n}}if(U(e)){let i=e.urls;if(Array.isArray(i))for(let e of i)typeof e==`string`&&e.trim()&&r(e.trim());let a=e.url;if(typeof a==`string`&&a.trim()){let r=L(a.trim());t.includes(r)||t.push(r),n.push({...e,url:r})}return{urls:t,rawKrystals:n}}return{urls:t,rawKrystals:n}}function xt(e){for(let t of e){let e=L(t),r=K.get(e)??n(e);r&&vt(e,ct(r,st(e)))}Q()}function St(){if(!w)return!1;let e=e=>{if(!e)return!1;try{let t=JSON.parse(e);if(!Array.isArray(t))return!1;let n=!1;for(let e of t)typeof e==`string`&&$(e,{includeAncestry:!0,broadcast:!1,persist:!1,source:`hydrate`,enqueueToApi:!1})&&(n=!0);return n}catch{return!1}},t=e(localStorage.getItem(te)),n=e(localStorage.getItem(ne));return(t||n)&&ut(),t||n}async function Ct(e){let t=0,n,r;for(let i=0;i{let t=new URL(be,e);return t.searchParams.set(`offset`,String(a)),t.searchParams.set(`limit`,String(D)),t.toString()},{method:`GET`,signal:e,cache:`no-store`});if(!o.ok)break;n=o.value.state_seal,r=o.value.total;let s=o.value.urls;if(!Array.isArray(s)||s.length===0)break;for(let e of s){if(typeof e!=`string`)continue;let n=L(e);K.has(n)||$(n,{includeAncestry:!0,broadcast:!1,persist:!1,source:`remote`,enqueueToApi:!1})&&(t+=1)}if(s.length=r)break}return t>0&&ut(),{imported:t,remoteSeal:n,remoteTotal:r}}function wt(t){let n=new Map,r=new Map;for(let[e,i]of t){let t=L(e),a=et(t),o=rt(t,i),s=nt(t,i);n.set(t,o);let c=r.get(o);if(!c){r.set(o,{payload:i,urls:new Set([t]),kind:a,momentKey:s});continue}V(i,c.payload)>0&&(c.payload=i),c.urls.add(t);let l=c.momentKey,u=s;l.startsWith(`u:`)&&!u.startsWith(`u:`)&&(c.momentKey=u),l.startsWith(`h:`)&&(u.startsWith(`k:`)||u.startsWith(`sig:`)||u.startsWith(`tok:`))&&(c.momentKey=u)}let i=new Map;for(let[e,t]of r){let n=at(Array.from(t.urls),t.kind);i.set(e,{id:e,payload:t.payload,urls:t.urls,primaryUrl:n,kind:t.kind,momentKey:t.momentKey})}let a=new Map;for(let e of i.values()){let t=e.momentKey;a.has(t)||a.set(t,[]),a.get(t).push(e.id)}let o=new Map,s=new Map,c=new Map;for(let[e,t]of a){let n=t.map(e=>i.get(e)).filter(Boolean),r=n.filter(e=>e.kind===`post`),a;a=r.length>0?r.slice().sort((e,t)=>G(t.primaryUrl,`post`)-G(e.primaryUrl,`post`))[0]:n.slice().sort((e,t)=>G(t.primaryUrl,t.kind)-G(e.primaryUrl,e.kind))[0];let l=a?.id??t[0];o.set(e,l);for(let e of t)s.set(e,l);for(let e of t){let t=i.get(e);if(t)for(let e of t.urls)c.set(e,l)}}let l=new Map;for(let t of i.values()){let r=s.get(t.id)??t.id;if(t.id!==r)continue;let i=Ke(t.payload,`originUrl`),a=i?L(i):e(t.primaryUrl)??t.primaryUrl,o=n.get(a),u=c.get(a)??(o?s.get(o):void 0);l.set(r,u??r)}let u=new Map;for(let e of i.values()){let t=s.get(e.id)??e.id,r=l.get(t)??t,i;if(e.id!==t)i=t;else{let t=Ke(e.payload,`parentUrl`);if(t){let r=L(t),a=n.get(r),o=c.get(r)??(a?s.get(a):void 0);o&&o!==e.id&&(i=o)}}u.set(e.id,{id:e.id,payload:e.payload,urls:e.urls,primaryUrl:e.primaryUrl,kind:e.kind,momentKey:e.momentKey,parentId:i,originId:r,momentParentId:t})}return u}function Tt(e,t){let n=[];for(let[r,i]of t)i.parentId===e&&n.push(r);return n.sort((e,n)=>V(t.get(n).payload,t.get(e).payload)),n}function Et(e,t,n=new Set){let r=t.get(e);if(!r)return null;if(n.has(e))return{id:r.id,url:r.primaryUrl,urls:Array.from(r.urls),payload:r.payload,children:[]};n.add(e);let i=Tt(e,t).map(e=>Et(e,t,n)).filter(Boolean);return{id:r.id,url:r.primaryUrl,urls:Array.from(r.urls),payload:r.payload,children:i}}function Dt(e){let t=0,n=e.payload,r=e=>{t+=1,V(e.payload,n)>0&&(n=e.payload),e.children.forEach(r)};return r(e),{nodeCount:t,latest:n}}function Ot(e){let t=wt(e),n=new Map;for(let[e,r]of t){let t=r.originId;n.has(t)||n.set(t,[]),n.get(t).push(e)}let r=[];for(let e of n.keys()){let n=Et(e,t);if(!n)continue;let i=Dt(n);r.push({root:n,nodeCount:i.nodeCount,latest:i.latest})}return r.sort((e,t)=>{let n=V(t.latest,e.latest);return n===0?t.nodeCount===e.nodeCount?V(t.root.payload,e.root.payload):t.nodeCount-e.nodeCount:n}),r.map(e=>e.root)}function kt(e,t){let n=e.payload,r=[],i=new Set,a=lt(e.payload);a!==void 0&&r.push({label:`This glyph Φ`,value:`${We(a)} Φ`});let o=n.feed,s=typeof o?.author==`string`?o.author:typeof n.author==`string`?n.author:void 0,c=o?o.usernameClaim:void 0,l=c?f(c.payload?.normalized||c.payload?.username||``):``,u=f(s??``),d=l||u;if(d){let e=t[d],n=typeof s==`string`&&s.trim().length>0?s.trim():`@${d}`;e?(r.push({label:`Username (claimed)`,value:`${n} → glyph ${Ue(e.claimHash,10)}`}),r.push({label:`Claim glyph`,value:B(e.claimUrl)})):r.push({label:`Username`,value:n})}let p=(e,t)=>{let a=n[e];typeof a==`string`&&a.trim().length>0&&!i.has(e)&&(r.push({label:t,value:a.trim()}),i.add(e))};p(`userPhiKey`,`PhiKey`),p(`phiKey`,`PhiKey`),p(`phikey`,`PhiKey`),p(`kaiSignature`,`Kai Signature`);let m=n.parentUrl;typeof m==`string`&&m.length>0&&(r.push({label:`Parent URL`,value:B(m)}),i.add(`parentUrl`));let h=n.originUrl;typeof h==`string`&&h.length>0&&(r.push({label:`Origin URL`,value:B(h)}),i.add(`originUrl`));let g=n.label??n.title??n.type??n.note??n.description;typeof g==`string`&&g.trim().length>0&&r.push({label:`Label / Type`,value:g.trim()});for(let e of[`memoryUrl`,`memory_url`,`streamUrl`,`stream_url`,`feedUrl`,`feed_url`,`stream`]){let t=n[e];typeof t==`string`&&t.trim().length>0&&!i.has(e)&&(r.push({label:e,value:B(t.trim())}),i.add(e))}for(let[e,t]of Object.entries(n)){if(r.length>=12)break;if(i.has(e)||t==null)continue;let n=e.toLowerCase();if(!(n.includes(`stream`)||n.includes(`memory`)||n.includes(`feed`))||typeof t==`string`&&t.trim().length===0)continue;let a=typeof t==`string`?B(t.trim()):JSON.stringify(t);r.push({label:e,value:a})}r.push({label:`Primary URL`,value:B(e.url)});let _=e.urls.filter(e=>!R(e)).map(e=>B(e));return e.urls.length>1&&r.push({label:`URL variants`,value:_.length===0?`${e.urls.length} urls (kept in data; hidden from browser view)`:_.length<=3?_.join(` | `):`${e.urls.length} urls (kept in data; rendered once)`}),r}async function At(e){if(C){try{if(navigator.clipboard&&typeof navigator.clipboard.writeText==`function`){await navigator.clipboard.writeText(e);return}}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,`true`),t.style.position=`fixed`,t.style.left=`-9999px`,t.style.top=`-9999px`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t)}catch{}}}var jt=()=>(0,g.jsx)(`style`,{children:` +import{K as e,Tn as t,W as n,X as r,gt as i,hn as a,jn as o,mn as s,nn as c,tn as l}from"./index-CcPm2yTY.js";import{a as u,n as d,o as f,r as p,t as m}from"./usernameClaimRegistry-_VlzEwdK.js";var h=o(t(),1),g=o(l(),1),_=`https://align.kaiklok.com`,v=`http://m.kai`,y={root:`#ff3b3b`,sacral:`#ff8a3d`,solar:`#ffd54a`,heart:`#3dff9a`,throat:`#46d3ff`,thirdEye:`#6b6cff`,crown:`#c18bff`};function b(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();return t?t.includes(`root`)?`root`:t.includes(`sacral`)?`sacral`:t.includes(`solar`)||t.includes(`plexus`)||t.includes(`sun`)?`solar`:t.includes(`heart`)?`heart`:t.includes(`throat`)?`throat`:t.includes(`third`)||t.includes(`eye`)||t.includes(`indigo`)?`thirdEye`:t.includes(`crown`)||t.includes(`krown`)||t.includes(`violet`)?`crown`:t===`1`?`root`:t===`2`?`sacral`:t===`3`?`solar`:t===`4`?`heart`:t===`5`?`throat`:t===`6`?`thirdEye`:t===`7`?`crown`:null:null}function ee(e){let t=b(e),n=t?y[t]:`var(--sx-accent)`;return{"--sx-chakra":n}}var te=`kai:sigils:v1`,ne=`sigil:urls`,re=`kai-sigil-registry`,x=512,S=`/phi.svg`,C=typeof window<`u`,w=C&&window.localStorage!==void 0,T=1000000n,E=8,ie=2e4;function ae(){let e=s(),t=a(e),n=(t/T+1n)*T-t,r=a(e+1n)-t,i=r>0n?r:191n,o=(n+i-1n)/i,c=Number(o);return Math.min(ie,Math.max(E,c))}var D=5e3,oe=24,se=200,O=180,ce=1200,le=12e3,k=`kai:inhaleQueue:v1`,A=`kai:urlHealth:v1`,ue=18,de=2200,fe=`sigil-explorer-prefetch-v1`,pe=4200,me=`https://phi.network`,he=520,ge=900,_e=80;function j(){let e=s(),t=BigInt(2**53-1),n=e<0n?0n:e>t?t:e;return Number(n)}function ve(e){if(!C)return e;let t=window;return typeof t.CSS?.escape==`function`?t.CSS.escape(e):e.replace(/[^a-zA-Z0-9_-]/gu,e=>`\\${e}`)}var M=_,N=v,ye=`/sigils/seal`,be=`/sigils/urls`,xe=`/sigils/inhale`,Se=`kai:lahmahtorBase:v1`,Ce=`kai:lahmahtorBackupDeadUntil:v1`,we=120*1e3,P=0;function Te(){if(!w)return;let e=localStorage.getItem(Ce);if(!e)return;let t=Number(e);Number.isFinite(t)&&t>0&&(P=t)}function Ee(){if(w)try{localStorage.setItem(Ce,String(P))}catch{}}function De(){return j()e!==N):e;let t=window.location.protocol===`https:`?e.filter(e=>e.startsWith(`https://`)):e;return De()?t.filter(e=>e!==N):t}function Ne(e){return e===0||e===404||e===408||e===429||e>=500}async function Pe(e,t){let n=Me(),r=null;for(let i of n){let n=e(i);try{let e=await fetch(n,t);if(r=e,e.ok||e.status===304)return i===N&&Oe(),F=i,je(),e;if(i===N&&Ne(e.status)&&ke(),!Ne(e.status))return e}catch{i===N&&ke();continue}}return r}async function Fe(e,t){let n=await Pe(e,t);if(!n)return{ok:!1,status:0};if(!n.ok)return{ok:!1,status:n.status};try{return{ok:!0,value:await n.json(),status:n.status}}catch{return{ok:!1,status:0}}}function I(){return C?window.location.origin:me}function L(e){try{let t=I(),n=new URL(e,t);return new URL(`${n.pathname}${n.search}${n.hash}`,t).toString()}catch{return e}}function Ie(e){try{let t=new URL(e,I()).pathname.match(/\/s\/([^/]+)/u);return t?.[1]?decodeURIComponent(t[1]):void 0}catch{return}}function R(e){try{return new URL(e,I()).pathname.toLowerCase().startsWith(`/p~`)}catch{return e.toLowerCase().includes(`/p~`)}}function Le(e){try{return decodeURIComponent(e)}catch{return e}}function Re(e){let t=e.trim();return t.length<16?!1:/^[A-Za-z0-9_-]+$/u.test(t)}function ze(e){let t=I();return new URL(`/stream/p/${e}`,t).toString()}function Be(e){let t=I(),n=new URL(`/stream`,t),r=new URLSearchParams;return r.set(`p`,e),n.hash=`#${r.toString()}`,n.toString()}function Ve(e){try{let t=I(),n=new URL(e,t),r=n.pathname.match(/\/stream\/p\/([^/]+)/u);if(!r?.[1])return e;let i=decodeURIComponent(r[1]),a=new URL(`/stream`,t);a.search=n.search;let o=n.hash.startsWith(`#`)?n.hash.slice(1):``,s=new URLSearchParams(o);return s.set(`p`,i),a.hash=`#${s.toString()}`,a.toString()}catch{return e}}function z(e){try{let t=new URL(e,I()),n=t.pathname,r=n.match(/\/stream\/p\/([^/]+)/u);if(r?.[1])return decodeURIComponent(r[1]);let i=n.match(/^\/p~([^/]+)/u);if(i?.[1])return decodeURIComponent(i[1]);let a=t.searchParams.get(`p`);if(a)return a;let o=t.hash.startsWith(`#`)?t.hash.slice(1):``;return new URLSearchParams(o).get(`p`)||void 0}catch{let t=e.toLowerCase().match(/\/p~([^/?#]+)/u);return t?.[1]?Le(t[1]):void 0}}function B(e){let t=L(e);if(R(t)){let e=z(t);return e?L(Be(e)):t}let n=Ve(t);return n===t?t:L(n)}function He(e){if(!C)return B(e);let t=B(e),n=window.location.origin;try{let e=new URL(t,n);return`${n}${e.pathname}${e.search}${e.hash}`}catch{let e=t.match(/^(?:https?:\/\/[^/]+)?(\/.*)$/i);return`${n}${(e?.[1]??t).startsWith(`/`)?e?.[1]??t:`/${e?.[1]??t}`}`}}function Ue(e,t=10){return e?e.length<=t*2+3?e:`${e.slice(0,t)}…${e.slice(-t)}`:`—`}function V(e,t){return(e.pulse??0)===(t.pulse??0)?(e.beat??0)===(t.beat??0)?(e.stepIndex??0)-(t.stepIndex??0):(e.beat??0)-(t.beat??0):(e.pulse??0)-(t.pulse??0)}function We(e){return e.toFixed(6).replace(/0+$/u,``).replace(/\.$/u,``)}function H(){return C?typeof navigator>`u`?!0:navigator.onLine:!1}function Ge(){return C&&typeof window.crypto?.randomUUID==`function`?window.crypto.randomUUID():Math.random().toString(16).slice(2)}function U(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ke(e,t){if(!U(e))return;let n=e[t];return typeof n==`string`&&n.trim()||void 0}async function qe(e){if(!C||!H())return;let t=new AbortController,n=window.setTimeout(()=>t.abort(),pe);try{let n=await fetch(e,{method:`GET`,cache:`force-cache`,signal:t.signal});if(n&&n.ok&&`caches`in window&&typeof caches.open==`function`)try{await(await caches.open(fe)).put(new Request(e),n.clone())}catch{}}catch{}finally{window.clearTimeout(n)}}var W=new Map;function Je(){if(!w)return;let e=localStorage.getItem(A);if(e)try{let t=JSON.parse(e);if(!U(t))return;W.clear();for(let[e,n]of Object.entries(t))(n===1||n===-1)&&W.set(L(e),n)}catch{}}function Ye(){if(!w)return;let e={};for(let[t,n]of W)e[t]=n;try{localStorage.setItem(A,JSON.stringify(e))}catch{}}function Xe(e,t){let n=L(e);return W.get(n)===t?!1:(W.set(n,t),Ye(),!0)}function Ze(e){let t=new URL(_).host,n=new URL(v).host,r=new URL(I()).host,i=new URL(me).host;return e===t||e===n||e===r||e===i}async function Qe(e){if(!C)return`unknown`;let t=B(e),n;try{if(n=new URL(t,I()),!Ze(n.host))return`unknown`;if(n.pathname.toLowerCase()===`/stream`)return`ok`}catch{return`unknown`}try{let e=new AbortController,t=window.setTimeout(()=>e.abort(),de),r=t=>fetch(n.toString(),{method:t,cache:`no-store`,signal:e.signal,redirect:`follow`,mode:`cors`}),i;try{i=await r(`HEAD`)}catch{i=await r(`GET`)}finally{window.clearTimeout(t)}return i.ok?`ok`:`bad`}catch{return`unknown`}}function $e(e){try{let t=new URL(e,I()),n=t.pathname.toLowerCase();if(n.includes(`/s/`))return`postS`;if(n.startsWith(`/p~`))return`streamP`;if(!n.includes(`/stream`))return`other`;if(n.includes(`/stream/p/`))return`streamP`;let r=t.searchParams.get(`t`);if(r&&r.trim())return`streamT`;let i=t.hash.startsWith(`#`)?t.hash.slice(1):``,a=new URLSearchParams(i),o=a.get(`t`);if(o&&o.trim()||n.includes(`/stream/t`))return`streamT`;let s=t.searchParams.get(`p`);if(s&&s.trim())return`streamQ`;let c=a.get(`p`);return c&&c.trim()?`streamQ`:`stream`}catch{let t=e.toLowerCase();return t.includes(`/s/`)?`postS`:t.includes(`/p~`)||t.includes(`/stream/p/`)?`streamP`:t.includes(`/stream/t`)||/[?&#]t=/.test(t)?`streamT`:t.includes(`/stream`)&&/[?&#]p=/.test(t)?`streamQ`:t.includes(`/stream`)?`stream`:`other`}}function et(e){let t=$e(e);return t===`postS`?`post`:t.startsWith(`stream`)?`stream`:`other`}function tt(e){let t=e;return typeof t.userPhiKey==`string`&&t.userPhiKey||typeof t.phiKey==`string`&&t.phiKey||typeof t.phikey==`string`&&t.phikey||``}function nt(e,t){let n=tt(t),r=Number.isFinite(t.pulse??NaN)?t.pulse:null;if(n&&r!=null)return`k:${n}|${r}`;let i=typeof t.kaiSignature==`string`?t.kaiSignature.trim():``;if(i)return`sig:${i}`;let a=z(e);if(a&&a.trim())return`tok:${a.trim()}`;let o=Ie(e)??``;return o?`h:${o}`:`u:${L(e)}`}function rt(e,t){let n=et(e),r=Ie(e)??``;if(n===`post`&&r)return`post:${r}`;let i=tt(t),a=Number.isFinite(t.pulse??NaN)?t.pulse:null;if(n===`stream`&&i&&a!=null)return`stream:${i}|${a}`;let o=typeof t.kaiSignature==`string`?t.kaiSignature.trim():``;if(o)return`${n}:sig:${o}`;let s=z(e);return s&&s.trim()?`${n}:tok:${s.trim()}`:`${n}:u:${L(e)}`}var it=e=>{let t=e.toLowerCase();if(!t.includes(`/stream`))return!1;let n=t.includes(`root=`)||t.includes(`&seg=`)||t.includes(`&add=`),r=t.includes(`/stream#`)||t.includes(`#v=`);return n&&r};function G(e,t){if(R(e))return-1e9;let n=e.toLowerCase(),r=$e(e),i=0;it(n)&&(i-=1e4),t===`post`?r===`postS`?i+=220:i-=25:t===`stream`?r===`streamT`?i+=220:r===`streamP`?i+=190:r===`streamQ`?i+=175:r===`stream`?i+=160:r===`postS`?i+=80:i-=25:(r===`postS`&&(i+=120),r===`streamT`&&(i+=125),r===`streamP`&&(i+=105),(r===`streamQ`||r===`stream`)&&(i+=95));let a=I().toLowerCase();n.startsWith(a)&&(i+=12),n.startsWith(_.toLowerCase())&&(i+=10),n.startsWith(v.toLowerCase())&&(i+=10);let o=W.get(L(e));return o===1&&(i+=200),o===-1&&(i-=200),i+=Math.max(0,20-Math.floor(e.length/40)),i}function at(e,t){let n=e.filter(e=>!R(e)),r=n.length>0?n:e;if(n.length===0&&e.length>0){let t=z(e[0]??``);if(t)return L(Be(t))}let i=r[0]??``,a=-1e9;for(let e of r){let n=G(e,t);(n>a||n===a&&e.length=1e-12)return e}}}function ut(){if(!w)return;let e=Array.from(K.keys());try{localStorage.setItem(te,JSON.stringify(e))}catch{}}function J(e,t){let n=L(e);dt(n,t);let r=K.get(n);if(!r)return K.set(n,t),!0;let i=r.parentUrl??``,a=r.originUrl??``,o=t.parentUrl??``,s=t.originUrl??``,c=i!==o||a!==s,l=Object.keys(r).length,u=Object.keys(t).length!==l,d=V(r,t)!==0;return c||u||d?(K.set(n,t),!0):!1}function dt(e,t){let n=t.feed;if(!n)return;let r=n.usernameClaim,i=r?f(r.payload?.normalized||r.payload?.username||``):``,a=f(n.author??``),o=i||a;if(!o||!r)return;let s=u(r.hash??``),c=r.url?.trim()||e;if(!s||!c)return;let l=r.payload;if(!l||l.kind!==`username_claim`)return;let p=f(l.normalized||l.username||``)||o;if(p!==o)return;let m=r.ownerHint??l.ownerHint??null;d({hash:s,url:L(c),payload:{...l,normalized:p},ownerHint:m})}function ft(e){let t=L(e),r=n(t);return r?J(t,ct(r,st(t))):!1}function pt(e,t){if(e.length===0)return!1;let n=L(e[0]),r=!1;r=ft(n)||r;{let e=K.get(n);if(e){let t={...e};t.originUrl||=n,r=J(n,t)||r}}for(let t=1;t{X=null,Q()},O))}function vt(e,t){let n=L(e),r={url:n,...t};Y.set(n,r),Z(),C&&(X!=null&&window.clearTimeout(X),X=window.setTimeout(()=>{X=null,Q()},O))}function yt(){for(let[e,t]of K){let n=L(e),r=t;Y.set(n,{url:n,...r})}Z()}async function Q(){if(C&&H()&&!mt&&Y.size!==0){mt=!0;try{let e=[],t=[];for(let[n,r]of Y)if(e.push(r),t.push(n),e.length>=se)break;let n=JSON.stringify(e),r=new Blob([n],{type:`application/json`}),i=new FormData;i.append(`file`,r,`sigils_${Ge()}.json`);let a=await Pe(e=>{let t=new URL(xe,e);return t.searchParams.set(`include_state`,`false`),t.searchParams.set(`include_urls`,`false`),t.toString()},{method:`POST`,body:i});if(!a||!a.ok)throw Error(`inhale failed: ${a?.status??0}`);try{await a.json()}catch{}for(let e of t)Y.delete(e);Z(),ht=0,Y.size>0&&(X=window.setTimeout(()=>{X=null,Q()},10))}catch{ht=Math.min(ht?ht*2:ce,le),X=window.setTimeout(()=>{X=null,Q()},ht)}finally{mt=!1}}}function $(e,t){let i=L(e),a=n(i);if(!a)return!1;let o=t?.includeAncestry??!0,s=t?.broadcast??!0,c=t?.persist??!0,l=t?.source??`local`,u=t?.enqueueToApi??l===`local`,d=!1,f=st(i);if(d=J(i,ct(a,f))||d,o&&f.chain.length>0){for(let e of f.chain)d=ft(e)||d;d=pt(f.chain,i)||d}if(o){let e=r(i);for(let t of e){let e=L(t),r=n(e);r&&(d=J(e,ct(r,st(e)))||d)}}if(d&&(c&&ut(),q&&s&&q.postMessage({type:`sigil:add`,url:i}),u)){let e=K.get(i);e&&vt(i,e)}return d}function bt(e){let t=[],n=[],r=e=>{let n=L(e);t.includes(n)||t.push(n)};if(Array.isArray(e)){for(let i of e){if(typeof i==`string`){i.trim()&&r(i.trim());continue}if(U(i)){let e=i.url;if(typeof e==`string`&&e.trim()){let r=L(e.trim());t.includes(r)||t.push(r),n.push({...i,url:r})}}}return{urls:t,rawKrystals:n}}if(U(e)){let i=e.urls;if(Array.isArray(i))for(let e of i)typeof e==`string`&&e.trim()&&r(e.trim());let a=e.url;if(typeof a==`string`&&a.trim()){let r=L(a.trim());t.includes(r)||t.push(r),n.push({...e,url:r})}return{urls:t,rawKrystals:n}}return{urls:t,rawKrystals:n}}function xt(e){for(let t of e){let e=L(t),r=K.get(e)??n(e);r&&vt(e,ct(r,st(e)))}Q()}function St(){if(!w)return!1;let e=e=>{if(!e)return!1;try{let t=JSON.parse(e);if(!Array.isArray(t))return!1;let n=!1;for(let e of t)typeof e==`string`&&$(e,{includeAncestry:!0,broadcast:!1,persist:!1,source:`hydrate`,enqueueToApi:!1})&&(n=!0);return n}catch{return!1}},t=e(localStorage.getItem(te)),n=e(localStorage.getItem(ne));return(t||n)&&ut(),t||n}async function Ct(e){let t=0,n,r;for(let i=0;i{let t=new URL(be,e);return t.searchParams.set(`offset`,String(a)),t.searchParams.set(`limit`,String(D)),t.toString()},{method:`GET`,signal:e,cache:`no-store`});if(!o.ok)break;n=o.value.state_seal,r=o.value.total;let s=o.value.urls;if(!Array.isArray(s)||s.length===0)break;for(let e of s){if(typeof e!=`string`)continue;let n=L(e);K.has(n)||$(n,{includeAncestry:!0,broadcast:!1,persist:!1,source:`remote`,enqueueToApi:!1})&&(t+=1)}if(s.length=r)break}return t>0&&ut(),{imported:t,remoteSeal:n,remoteTotal:r}}function wt(t){let n=new Map,r=new Map;for(let[e,i]of t){let t=L(e),a=et(t),o=rt(t,i),s=nt(t,i);n.set(t,o);let c=r.get(o);if(!c){r.set(o,{payload:i,urls:new Set([t]),kind:a,momentKey:s});continue}V(i,c.payload)>0&&(c.payload=i),c.urls.add(t);let l=c.momentKey,u=s;l.startsWith(`u:`)&&!u.startsWith(`u:`)&&(c.momentKey=u),l.startsWith(`h:`)&&(u.startsWith(`k:`)||u.startsWith(`sig:`)||u.startsWith(`tok:`))&&(c.momentKey=u)}let i=new Map;for(let[e,t]of r){let n=at(Array.from(t.urls),t.kind);i.set(e,{id:e,payload:t.payload,urls:t.urls,primaryUrl:n,kind:t.kind,momentKey:t.momentKey})}let a=new Map;for(let e of i.values()){let t=e.momentKey;a.has(t)||a.set(t,[]),a.get(t).push(e.id)}let o=new Map,s=new Map,c=new Map;for(let[e,t]of a){let n=t.map(e=>i.get(e)).filter(Boolean),r=n.filter(e=>e.kind===`post`),a;a=r.length>0?r.slice().sort((e,t)=>G(t.primaryUrl,`post`)-G(e.primaryUrl,`post`))[0]:n.slice().sort((e,t)=>G(t.primaryUrl,t.kind)-G(e.primaryUrl,e.kind))[0];let l=a?.id??t[0];o.set(e,l);for(let e of t)s.set(e,l);for(let e of t){let t=i.get(e);if(t)for(let e of t.urls)c.set(e,l)}}let l=new Map;for(let t of i.values()){let r=s.get(t.id)??t.id;if(t.id!==r)continue;let i=Ke(t.payload,`originUrl`),a=i?L(i):e(t.primaryUrl)??t.primaryUrl,o=n.get(a),u=c.get(a)??(o?s.get(o):void 0);l.set(r,u??r)}let u=new Map;for(let e of i.values()){let t=s.get(e.id)??e.id,r=l.get(t)??t,i;if(e.id!==t)i=t;else{let t=Ke(e.payload,`parentUrl`);if(t){let r=L(t),a=n.get(r),o=c.get(r)??(a?s.get(a):void 0);o&&o!==e.id&&(i=o)}}u.set(e.id,{id:e.id,payload:e.payload,urls:e.urls,primaryUrl:e.primaryUrl,kind:e.kind,momentKey:e.momentKey,parentId:i,originId:r,momentParentId:t})}return u}function Tt(e,t){let n=[];for(let[r,i]of t)i.parentId===e&&n.push(r);return n.sort((e,n)=>V(t.get(n).payload,t.get(e).payload)),n}function Et(e,t,n=new Set){let r=t.get(e);if(!r)return null;if(n.has(e))return{id:r.id,url:r.primaryUrl,urls:Array.from(r.urls),payload:r.payload,children:[]};n.add(e);let i=Tt(e,t).map(e=>Et(e,t,n)).filter(Boolean);return{id:r.id,url:r.primaryUrl,urls:Array.from(r.urls),payload:r.payload,children:i}}function Dt(e){let t=0,n=e.payload,r=e=>{t+=1,V(e.payload,n)>0&&(n=e.payload),e.children.forEach(r)};return r(e),{nodeCount:t,latest:n}}function Ot(e){let t=wt(e),n=new Map;for(let[e,r]of t){let t=r.originId;n.has(t)||n.set(t,[]),n.get(t).push(e)}let r=[];for(let e of n.keys()){let n=Et(e,t);if(!n)continue;let i=Dt(n);r.push({root:n,nodeCount:i.nodeCount,latest:i.latest})}return r.sort((e,t)=>{let n=V(t.latest,e.latest);return n===0?t.nodeCount===e.nodeCount?V(t.root.payload,e.root.payload):t.nodeCount-e.nodeCount:n}),r.map(e=>e.root)}function kt(e,t){let n=e.payload,r=[],i=new Set,a=lt(e.payload);a!==void 0&&r.push({label:`This glyph Φ`,value:`${We(a)} Φ`});let o=n.feed,s=typeof o?.author==`string`?o.author:typeof n.author==`string`?n.author:void 0,c=o?o.usernameClaim:void 0,l=c?f(c.payload?.normalized||c.payload?.username||``):``,u=f(s??``),d=l||u;if(d){let e=t[d],n=typeof s==`string`&&s.trim().length>0?s.trim():`@${d}`;e?(r.push({label:`Username (claimed)`,value:`${n} → glyph ${Ue(e.claimHash,10)}`}),r.push({label:`Claim glyph`,value:B(e.claimUrl)})):r.push({label:`Username`,value:n})}let p=(e,t)=>{let a=n[e];typeof a==`string`&&a.trim().length>0&&!i.has(e)&&(r.push({label:t,value:a.trim()}),i.add(e))};p(`userPhiKey`,`PhiKey`),p(`phiKey`,`PhiKey`),p(`phikey`,`PhiKey`),p(`kaiSignature`,`Kai Signature`);let m=n.parentUrl;typeof m==`string`&&m.length>0&&(r.push({label:`Parent URL`,value:B(m)}),i.add(`parentUrl`));let h=n.originUrl;typeof h==`string`&&h.length>0&&(r.push({label:`Origin URL`,value:B(h)}),i.add(`originUrl`));let g=n.label??n.title??n.type??n.note??n.description;typeof g==`string`&&g.trim().length>0&&r.push({label:`Label / Type`,value:g.trim()});for(let e of[`memoryUrl`,`memory_url`,`streamUrl`,`stream_url`,`feedUrl`,`feed_url`,`stream`]){let t=n[e];typeof t==`string`&&t.trim().length>0&&!i.has(e)&&(r.push({label:e,value:B(t.trim())}),i.add(e))}for(let[e,t]of Object.entries(n)){if(r.length>=12)break;if(i.has(e)||t==null)continue;let n=e.toLowerCase();if(!(n.includes(`stream`)||n.includes(`memory`)||n.includes(`feed`))||typeof t==`string`&&t.trim().length===0)continue;let a=typeof t==`string`?B(t.trim()):JSON.stringify(t);r.push({label:e,value:a})}r.push({label:`Primary URL`,value:B(e.url)});let _=e.urls.filter(e=>!R(e)).map(e=>B(e));return e.urls.length>1&&r.push({label:`URL variants`,value:_.length===0?`${e.urls.length} urls (kept in data; hidden from browser view)`:_.length<=3?_.join(` | `):`${e.urls.length} urls (kept in data; rendered once)`}),r}async function At(e){if(C){try{if(navigator.clipboard&&typeof navigator.clipboard.writeText==`function`){await navigator.clipboard.writeText(e);return}}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,`true`),t.style.position=`fixed`,t.style.left=`-9999px`,t.style.top=`-9999px`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t)}catch{}}}var jt=()=>(0,g.jsx)(`style`,{children:` /* glyph mark */ .kx-glyph{ display:flex; diff --git a/dist/assets/SigilFeedPage-CYooRvDo.js b/dist/assets/SigilFeedPage-DGJJwxYi.js similarity index 93% rename from dist/assets/SigilFeedPage-CYooRvDo.js rename to dist/assets/SigilFeedPage-DGJJwxYi.js index 7d104851..3fc26c69 100644 --- a/dist/assets/SigilFeedPage-CYooRvDo.js +++ b/dist/assets/SigilFeedPage-DGJJwxYi.js @@ -1 +1 @@ -import{Tn as e,jn as t,mn as n,tn as r}from"./index-BGzUQCv_.js";import"./html2canvas-wYdasO3I.js";import"./EternalKlock-DJuhZsZB.js";import"./SigilModal-Dtnhs3XF.js";import"./SealMomentModal-S7F0w9ki.js";import"./SigilAuthContext-Bpha3aI1.js";import"./sigilRegistry-DVCHqg2o.js";import"./SigilAuthProvider-Bf4S4o9t.js";import"./usernameClaimRegistry-BEUaCJlN.js";import{t as i}from"./SigilStreamRoot-lWOSVrBM.js";import"./useFastPress-Cbh2am8D.js";e();var a=null,o=0n;function s(){if(typeof window>`u`)return null;let e=window;return e.AudioContext??e.webkitAudioContext??null}function c(){let e=s();return e?a||(a=new e,a):null}function l(){let e=c();e&&e.state!==`running`&&e.resume().catch(()=>{})}function u(){typeof navigator<`u`&&`vibrate`in navigator&&navigator.vibrate([8,13,21,34,55,89,55,34,21,13,8])}function d(e,t,n){let r=e.sampleRate,i=Math.max(1,Math.floor(r*t)),a=e.createBuffer(2,i,r);for(let e=0;e<2;e++){let t=a.getChannelData(e);for(let e=0;e{u(),y()},0))}function x(e){if(!e||!(e instanceof Element))return!1;let t=e.closest(`button.sf-btn, a.sf-btn`);return t?(t.textContent??``).trim().toLowerCase()===`remember`:!1}function S(){let e=()=>{l(),document.removeEventListener(`pointerdown`,e,!0),document.removeEventListener(`keydown`,e,!0),document.removeEventListener(`touchstart`,e,!0)};document.addEventListener(`pointerdown`,e,{capture:!0,passive:!0}),document.addEventListener(`keydown`,e,{capture:!0}),document.addEventListener(`touchstart`,e,{capture:!0,passive:!0})}function C(){typeof document>`u`||(S(),document.addEventListener(`click`,e=>{x(e.target)&&b()}))}typeof window<`u`&&(window.__kopy_feedback_installed__||(window.__kopy_feedback_installed__=!0,C()));var w=t(r(),1);function T(){return(0,w.jsx)(i,{})}export{T as default}; \ No newline at end of file +import{Tn as e,jn as t,mn as n,tn as r}from"./index-CcPm2yTY.js";import"./html2canvas-CgVfYVZf.js";import"./EternalKlock-DTPPu1Hz.js";import"./SigilModal-B4XBfcke.js";import"./SealMomentModal-BotOOPRg.js";import"./SigilAuthContext-CZfkVeGy.js";import"./sigilRegistry-NyXrDYsE.js";import"./SigilAuthProvider-Crre0ykb.js";import"./usernameClaimRegistry-_VlzEwdK.js";import{t as i}from"./SigilStreamRoot-D0R_paBX.js";import"./useFastPress-BuTJ0eyZ.js";e();var a=null,o=0n;function s(){if(typeof window>`u`)return null;let e=window;return e.AudioContext??e.webkitAudioContext??null}function c(){let e=s();return e?a||(a=new e,a):null}function l(){let e=c();e&&e.state!==`running`&&e.resume().catch(()=>{})}function u(){typeof navigator<`u`&&`vibrate`in navigator&&navigator.vibrate([8,13,21,34,55,89,55,34,21,13,8])}function d(e,t,n){let r=e.sampleRate,i=Math.max(1,Math.floor(r*t)),a=e.createBuffer(2,i,r);for(let e=0;e<2;e++){let t=a.getChannelData(e);for(let e=0;e{u(),y()},0))}function x(e){if(!e||!(e instanceof Element))return!1;let t=e.closest(`button.sf-btn, a.sf-btn`);return t?(t.textContent??``).trim().toLowerCase()===`remember`:!1}function S(){let e=()=>{l(),document.removeEventListener(`pointerdown`,e,!0),document.removeEventListener(`keydown`,e,!0),document.removeEventListener(`touchstart`,e,!0)};document.addEventListener(`pointerdown`,e,{capture:!0,passive:!0}),document.addEventListener(`keydown`,e,{capture:!0}),document.addEventListener(`touchstart`,e,{capture:!0,passive:!0})}function C(){typeof document>`u`||(S(),document.addEventListener(`click`,e=>{x(e.target)&&b()}))}typeof window<`u`&&(window.__kopy_feedback_installed__||(window.__kopy_feedback_installed__=!0,C()));var w=t(r(),1);function T(){return(0,w.jsx)(i,{})}export{T as default}; \ No newline at end of file diff --git a/dist/assets/SigilModal-Dtnhs3XF.js b/dist/assets/SigilModal-B4XBfcke.js similarity index 99% rename from dist/assets/SigilModal-Dtnhs3XF.js rename to dist/assets/SigilModal-B4XBfcke.js index 9febd9fc..fd9bd916 100644 --- a/dist/assets/SigilModal-Dtnhs3XF.js +++ b/dist/assets/SigilModal-B4XBfcke.js @@ -1,4 +1,4 @@ -import{J as e,Tn as t,_t as n,an as r,jn as i,ln as a,mn as o,tn as s,w as c,wn as l}from"./index-BGzUQCv_.js";import{t as u}from"./html2canvas-wYdasO3I.js";import{t as d}from"./SealMomentModal-S7F0w9ki.js";var f=i(t(),1),p=i(s(),1),m=e=>Math.max(0,Math.min(100,e));function h(e,t){let n=(e??``).toLowerCase().trim();return/(reflekt|reflect|reflektion|reflection)/i.test(n)?`#22c55e`:/(purify|purification|purifikation)/i.test(n)?`#3b82f6`:/dream/i.test(n)?`#7c3aed`:/(ignite|ignition)/i.test(n)?`#ff3b30`:/(integrate|integration)/i.test(n)?`#ff8a00`:/(solar\s*plexus)/i.test(n)?`#ffd600`:t}var g=({dateISO:e,onDateChange:t,secondsLeft:n,eternalPercent:r,eternalColor:i=`#8beaff`,eternalArkLabel:a=`Eternal Ark`})=>{let o=(0,f.useMemo)(()=>m(r),[r]),s=(0,f.useMemo)(()=>h(a,i),[a,i]),c={"--eternal-bar":s,"--pulse":`var(--kai-pulse, var(--pulse-dur, 5236ms))`},l=(0,f.useMemo)(()=>({"--fill":(o/100).toFixed(6)}),[o]),u=(0,f.useRef)(null),d=(0,f.useRef)(void 0),g=(0,f.useRef)(null),_=(0,f.useRef)(null);return(0,f.useEffect)(()=>()=>{g.current!==null&&window.clearTimeout(g.current),_.current!==null&&window.cancelAnimationFrame(_.current),u.current&&u.current.classList.remove(`is-boom`),g.current=null,_.current=null},[]),(0,f.useEffect)(()=>{let e=typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(typeof n!=`number`||e){d.current=n;return}let t=u.current,r=d.current;t&&typeof r==`number`&&n-r>1.2&&(t.classList.remove(`is-boom`),_.current!==null&&window.cancelAnimationFrame(_.current),_.current=window.requestAnimationFrame(()=>{t.classList.add(`is-boom`)}),g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{t.classList.remove(`is-boom`),g.current=null},420)),d.current=n},[n]),(0,p.jsxs)(`div`,{className:`sigil-scope`,style:c,children:[(0,p.jsx)(`h3`,{className:`sigil-title`,children:`Kairos Sigil-Glyph Inhaler`}),(0,p.jsx)(`div`,{className:`sigil-ribbon`,"aria-hidden":`true`}),(0,p.jsx)(`div`,{className:`input-row sigil-row`,children:(0,p.jsxs)(`label`,{className:`sigil-label`,children:[(0,p.jsx)(`span`,{className:`sigil-label__text`,children:`Select moment:`}),`\xA0`,(0,p.jsx)(`input`,{className:`sigil-input`,type:`datetime-local`,value:e,onChange:t})]})}),(0,p.jsx)(`div`,{className:`sigil-bars`,role:`group`,"aria-label":`Day progress`,children:(0,p.jsxs)(`div`,{className:`sigil-bar`,children:[(0,p.jsxs)(`div`,{className:`sigil-bar__head`,children:[(0,p.jsxs)(`span`,{className:`sigil-bar__label`,children:[`Unfoldment`,a?` — ${a}`:``]}),(0,p.jsxs)(`span`,{className:`sigil-bar__pct`,"aria-hidden":`true`,children:[o.toFixed(2),`%`]})]}),(0,p.jsx)(`div`,{className:`sigil-bar__track`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":+o.toFixed(2),role:`progressbar`,"aria-label":`Eternal day ${a||``}`,children:(0,p.jsx)(`div`,{ref:u,className:`sigil-bar__fill sigil-bar__fill--eternal`,style:l})})]})}),(0,p.jsx)(`style`,{children:` +import{J as e,Tn as t,_t as n,an as r,jn as i,ln as a,mn as o,tn as s,w as c,wn as l}from"./index-CcPm2yTY.js";import{t as u}from"./html2canvas-CgVfYVZf.js";import{t as d}from"./SealMomentModal-BotOOPRg.js";var f=i(t(),1),p=i(s(),1),m=e=>Math.max(0,Math.min(100,e));function h(e,t){let n=(e??``).toLowerCase().trim();return/(reflekt|reflect|reflektion|reflection)/i.test(n)?`#22c55e`:/(purify|purification|purifikation)/i.test(n)?`#3b82f6`:/dream/i.test(n)?`#7c3aed`:/(ignite|ignition)/i.test(n)?`#ff3b30`:/(integrate|integration)/i.test(n)?`#ff8a00`:/(solar\s*plexus)/i.test(n)?`#ffd600`:t}var g=({dateISO:e,onDateChange:t,secondsLeft:n,eternalPercent:r,eternalColor:i=`#8beaff`,eternalArkLabel:a=`Eternal Ark`})=>{let o=(0,f.useMemo)(()=>m(r),[r]),s=(0,f.useMemo)(()=>h(a,i),[a,i]),c={"--eternal-bar":s,"--pulse":`var(--kai-pulse, var(--pulse-dur, 5236ms))`},l=(0,f.useMemo)(()=>({"--fill":(o/100).toFixed(6)}),[o]),u=(0,f.useRef)(null),d=(0,f.useRef)(void 0),g=(0,f.useRef)(null),_=(0,f.useRef)(null);return(0,f.useEffect)(()=>()=>{g.current!==null&&window.clearTimeout(g.current),_.current!==null&&window.cancelAnimationFrame(_.current),u.current&&u.current.classList.remove(`is-boom`),g.current=null,_.current=null},[]),(0,f.useEffect)(()=>{let e=typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(typeof n!=`number`||e){d.current=n;return}let t=u.current,r=d.current;t&&typeof r==`number`&&n-r>1.2&&(t.classList.remove(`is-boom`),_.current!==null&&window.cancelAnimationFrame(_.current),_.current=window.requestAnimationFrame(()=>{t.classList.add(`is-boom`)}),g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{t.classList.remove(`is-boom`),g.current=null},420)),d.current=n},[n]),(0,p.jsxs)(`div`,{className:`sigil-scope`,style:c,children:[(0,p.jsx)(`h3`,{className:`sigil-title`,children:`Kairos Sigil-Glyph Inhaler`}),(0,p.jsx)(`div`,{className:`sigil-ribbon`,"aria-hidden":`true`}),(0,p.jsx)(`div`,{className:`input-row sigil-row`,children:(0,p.jsxs)(`label`,{className:`sigil-label`,children:[(0,p.jsx)(`span`,{className:`sigil-label__text`,children:`Select moment:`}),`\xA0`,(0,p.jsx)(`input`,{className:`sigil-input`,type:`datetime-local`,value:e,onChange:t})]})}),(0,p.jsx)(`div`,{className:`sigil-bars`,role:`group`,"aria-label":`Day progress`,children:(0,p.jsxs)(`div`,{className:`sigil-bar`,children:[(0,p.jsxs)(`div`,{className:`sigil-bar__head`,children:[(0,p.jsxs)(`span`,{className:`sigil-bar__label`,children:[`Unfoldment`,a?` — ${a}`:``]}),(0,p.jsxs)(`span`,{className:`sigil-bar__pct`,"aria-hidden":`true`,children:[o.toFixed(2),`%`]})]}),(0,p.jsx)(`div`,{className:`sigil-bar__track`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":+o.toFixed(2),role:`progressbar`,"aria-label":`Eternal day ${a||``}`,children:(0,p.jsx)(`div`,{ref:u,className:`sigil-bar__fill sigil-bar__fill--eternal`,style:l})})]})}),(0,p.jsx)(`style`,{children:` .sigil-ribbon { height: 1px; margin: .35rem 0 .85rem 0; diff --git a/dist/assets/SigilModal-BvJNBKka.js b/dist/assets/SigilModal-BvJNBKka.js new file mode 100644 index 00000000..5ce485ae --- /dev/null +++ b/dist/assets/SigilModal-BvJNBKka.js @@ -0,0 +1 @@ +import"./html2canvas-CgVfYVZf.js";import{t as e}from"./SigilModal-B4XBfcke.js";import"./SealMomentModal-BotOOPRg.js";export{e as default}; \ No newline at end of file diff --git a/dist/assets/SigilModal-Bw4sFNR6.js b/dist/assets/SigilModal-Bw4sFNR6.js deleted file mode 100644 index a81d487c..00000000 --- a/dist/assets/SigilModal-Bw4sFNR6.js +++ /dev/null @@ -1 +0,0 @@ -import"./html2canvas-wYdasO3I.js";import{t as e}from"./SigilModal-Dtnhs3XF.js";import"./SealMomentModal-S7F0w9ki.js";export{e as default}; \ No newline at end of file diff --git a/dist/assets/SigilPage-ECNAzu9S.js b/dist/assets/SigilPage-DF86EQ7y.js similarity index 99% rename from dist/assets/SigilPage-ECNAzu9S.js rename to dist/assets/SigilPage-DF86EQ7y.js index c188068a..67ffd3d7 100644 --- a/dist/assets/SigilPage-ECNAzu9S.js +++ b/dist/assets/SigilPage-DF86EQ7y.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/html2canvas-Dw4vJfGn.js","assets/html2canvas-wYdasO3I.js","assets/index-BGzUQCv_.js","assets/index-BmaJNTKf.css","assets/svgMeta-Drisw1CT.js","assets/svgMeta-B547igV7.js"])))=>i.map(i=>d[i]); -import{An as e,At as t,B as n,Cn as r,Dt as i,En as a,Et as o,J as s,Mt as c,Nt as l,On as u,Ot as d,Pt as f,S as p,Sn as m,St as h,Tn as g,Tt as _,V as v,_ as y,_t as b,an as x,b as S,bn as C,bt as w,d as T,f as E,h as D,i as O,jn as k,jt as A,kt as j,m as M,mn as N,n as P,o as F,q as I,r as ee,s as L,tn as R,un as te,vn as z,w as ne,wn as re,wt as B,xn as ie,xt as ae,yn as oe,yt as se}from"./index-BGzUQCv_.js";import{t as ce}from"./html2canvas-wYdasO3I.js";import{t as V}from"./SealMomentModal-S7F0w9ki.js";import{t as le}from"./useFastPress-Cbh2am8D.js";import{a as H,d as ue,f as U,i as de,n as W,p as fe,r as G,s as pe,t as me,u as he}from"./svgMeta-B547igV7.js";var ge=k(ce(),1),_e=k(re(),1),K=k(g(),1),q=k(R(),1);function ve(e){(0,K.useEffect)(()=>{let e=`sigilheader-authbadgefx-v3`;if(document.getElementById(e))return;let t=document.createElement(`style`);t.id=e,t.textContent=` +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/html2canvas-2MVuntwP.js","assets/html2canvas-CgVfYVZf.js","assets/index-CcPm2yTY.js","assets/index-BmaJNTKf.css","assets/svgMeta-ADMUtfmL.js","assets/svgMeta-BqZogknt.js"])))=>i.map(i=>d[i]); +import{An as e,At as t,B as n,Cn as r,Dt as i,En as a,Et as o,J as s,Mt as c,Nt as l,On as u,Ot as d,Pt as f,S as p,Sn as m,St as h,Tn as g,Tt as _,V as v,_ as y,_t as b,an as x,b as S,bn as C,bt as w,d as T,f as E,h as D,i as O,jn as k,jt as A,kt as j,m as M,mn as N,n as P,o as F,q as I,r as ee,s as L,tn as R,un as te,vn as z,w as ne,wn as re,wt as B,xn as ie,xt as ae,yn as oe,yt as se}from"./index-CcPm2yTY.js";import{t as ce}from"./html2canvas-CgVfYVZf.js";import{t as V}from"./SealMomentModal-BotOOPRg.js";import{t as le}from"./useFastPress-BuTJ0eyZ.js";import{a as H,d as ue,f as U,i as de,n as W,p as fe,r as G,s as pe,t as me,u as he}from"./svgMeta-BqZogknt.js";var ge=k(ce(),1),_e=k(re(),1),K=k(g(),1),q=k(R(),1);function ve(e){(0,K.useEffect)(()=>{let e=`sigilheader-authbadgefx-v3`;if(document.getElementById(e))return;let t=document.createElement(`style`);t.id=e,t.textContent=` /* Shared tokens; Chakra accent flows from page */ .sp-header .auth-badge, .sp-header .link-badge { @@ -4724,7 +4724,7 @@ Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.expo The chosen QR Code version cannot contain this amount of data. Minimum version required to store current data is: `+c+`. `);let l=b(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),Yw=a((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||={};let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e=c&&n>=c&&e{var t=Yw();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o===void 0&&(!i||!i.getContext)&&(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i===void 0&&(!n||!n.getContext)&&(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),Zw=a((e=>{var t=Yw();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1`:``,d=``,f=`viewBox="0 0 `+l+` `+l+`"`,p=``+u+d+` -`;return typeof a==`function`&&a(null,p),p}})),Qw=k(a((e=>{var t=Tw(),n=Jw(),r=Xw(),i=Zw();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))(),1);const $w=1024,eT=2048,tT=1200;function nT(e,t){let n=e.querySelector(`defs`);n||(n=e.ownerDocument.createElementNS(me.SVG_NS,`defs`),e.insertBefore(n,e.firstChild));let r=`ep-neon-glow`;if(!e.querySelector(`#${r}`)){let t=e.ownerDocument.createElementNS(me.SVG_NS,`filter`);t.setAttribute(`id`,r),t.setAttribute(`x`,`-50%`),t.setAttribute(`y`,`-50%`),t.setAttribute(`width`,`200%`),t.setAttribute(`height`,`200%`);let i=e.ownerDocument.createElementNS(me.SVG_NS,`feGaussianBlur`);i.setAttribute(`stdDeviation`,`3`),i.setAttribute(`result`,`b1`);let a=e.ownerDocument.createElementNS(me.SVG_NS,`feGaussianBlur`);a.setAttribute(`in`,`SourceGraphic`),a.setAttribute(`stdDeviation`,`1.2`),a.setAttribute(`result`,`b2`);let o=e.ownerDocument.createElementNS(me.SVG_NS,`feMerge`),s=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);s.setAttribute(`in`,`b1`);let c=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);c.setAttribute(`in`,`b2`);let l=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);l.setAttribute(`in`,`SourceGraphic`),o.appendChild(s),o.appendChild(c),o.appendChild(l),t.appendChild(i),t.appendChild(a),t.appendChild(o),n.appendChild(t)}let i=`ep-gloss-gradient`;if(!e.querySelector(`#${i}`)){let t=e.ownerDocument.createElementNS(me.SVG_NS,`linearGradient`);t.setAttribute(`id`,i),t.setAttribute(`x1`,`0`),t.setAttribute(`y1`,`0`),t.setAttribute(`x2`,`0`),t.setAttribute(`y2`,`1`);let r=e.ownerDocument.createElementNS(me.SVG_NS,`stop`);r.setAttribute(`offset`,`0%`),r.setAttribute(`stop-color`,`rgba(255,255,255,0.15)`);let a=e.ownerDocument.createElementNS(me.SVG_NS,`stop`);a.setAttribute(`offset`,`100%`),a.setAttribute(`stop-color`,`rgba(255,255,255,0.05)`),t.appendChild(r),t.appendChild(a),n.appendChild(t)}let a=`ep-bar-outer-glow`;if(!e.querySelector(`#${a}`)){let r=e.ownerDocument.createElementNS(me.SVG_NS,`filter`);r.setAttribute(`id`,a),r.setAttribute(`x`,`-50%`),r.setAttribute(`y`,`-50%`),r.setAttribute(`width`,`200%`),r.setAttribute(`height`,`200%`);let i=e.ownerDocument.createElementNS(me.SVG_NS,`feFlood`);i.setAttribute(`flood-color`,t),i.setAttribute(`flood-opacity`,`0.5`),i.setAttribute(`result`,`c`);let o=e.ownerDocument.createElementNS(me.SVG_NS,`feComposite`);o.setAttribute(`in`,`c`),o.setAttribute(`in2`,`SourceAlpha`),o.setAttribute(`operator`,`in`),o.setAttribute(`result`,`glow`);let s=e.ownerDocument.createElementNS(me.SVG_NS,`feGaussianBlur`);s.setAttribute(`in`,`glow`),s.setAttribute(`stdDeviation`,`4`),s.setAttribute(`result`,`blurGlow`);let c=e.ownerDocument.createElementNS(me.SVG_NS,`feMerge`),l=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);l.setAttribute(`in`,`blurGlow`);let u=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);u.setAttribute(`in`,`SourceGraphic`),c.appendChild(l),c.appendChild(u),r.appendChild(i),r.appendChild(o),r.appendChild(s),r.appendChild(c),n.appendChild(r)}return{neonId:`ep-neon-glow`,glossId:`ep-gloss-gradient`,barGlowId:`ep-bar-outer-glow`}}async function rT(e,t){let{accent:n,qrUrl:r}=t,i=(e.getAttribute(`viewBox`)||`0 0 ${e.getAttribute(`width`)||1024} ${e.getAttribute(`height`)||1024}`).trim().split(/\s+/).map(Number),a=i[0]||0,o=i[1]||0,s=i[2]||1024,c=i[3]||1024,l=e.ownerDocument.createElementNS(me.SVG_NS,`g`);l.setAttribute(`data-export-qr`,`1`);let u=Math.min(s,c),d=Math.max(u*.035,18),f=Math.max(u*.1,96),p=await Qw.toDataURL(r,{margin:0,color:{dark:n,light:`#00000000`},scale:8}),m=e.ownerDocument.createElementNS(me.SVG_NS,`image`);m.setAttributeNS(me.XLINK_NS,`xlink:href`,p),m.setAttribute(`href`,p),m.setAttribute(`x`,String(a+d)),m.setAttribute(`y`,String(o+c-f-d)),m.setAttribute(`width`,String(f)),m.setAttribute(`height`,String(f)),m.setAttribute(`preserveAspectRatio`,`xMidYMid meet`),l.appendChild(m),e.appendChild(l)}async function iT(e,t=$w,n){let r=e.cloneNode(!0);if(de(r,t),H(r),G(r,n?.title||`Kairos Sigil-Glyph — Sealed Kairos Moment`,n?.desc||`Deterministic sigil-glyph with sovereign metadata.`),n?.metaOverride){let e=W(r);e.textContent=JSON.stringify(n.metaOverride)}if(r.querySelectorAll(`[data-export-qr="1"],[data-export-pulsebar="1"]`).forEach(e=>e.parentNode?.removeChild(e)),n?.addQR&&await rT(r,n.addQR),n?.addPulseBar){let{accent:e,pulseNumber:i}=n.addPulseBar,{barGlowId:a,neonId:o,glossId:s}=nT(r,e),c=(r.getAttribute(`viewBox`)||`0 0 ${t} ${t}`).split(/\s+/).map(Number),[l,u,d,f]=[c[0]||0,c[1]||0,c[2]||t,c[3]||t],p=r.ownerDocument.createElementNS(me.SVG_NS,`g`);p.setAttribute(`data-export-pulsebar`,`1`);let m=Math.min(d,f),h=Math.max(m*.035,18),g=Math.max(m*.34,320),_=Math.max(m*.085,96),v=Math.max(_*.22,18),y=l+d-g-h,b=u+f-_-h,x=r.ownerDocument.createElementNS(me.SVG_NS,`rect`);x.setAttribute(`x`,String(y)),x.setAttribute(`y`,String(b)),x.setAttribute(`rx`,String(v)),x.setAttribute(`ry`,String(v)),x.setAttribute(`width`,String(g)),x.setAttribute(`height`,String(_)),x.setAttribute(`fill`,`url(#${s})`),x.setAttribute(`stroke`,`rgba(255,255,255,0.16)`),x.setAttribute(`stroke-width`,String(Math.max(1.5,m*.0018))),x.setAttribute(`filter`,`url(#${a})`),p.appendChild(x);let S=r.ownerDocument.createElementNS(me.SVG_NS,`text`);S.setAttribute(`x`,String(y+g/2)),S.setAttribute(`y`,String(b+_/2+Math.max(6,_*.06))),S.setAttribute(`text-anchor`,`middle`),S.setAttribute(`dominant-baseline`,`middle`),S.setAttribute(`fill`,e),S.setAttribute(`filter`,`url(#${o})`),S.setAttribute(`font-weight`,`900`),S.setAttribute(`font-family`,`Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto, Helvetica Neue, Arial`),S.setAttribute(`font-size`,String(Math.floor(_*.46))),S.textContent=i.toLocaleString(),p.appendChild(S),r.appendChild(p)}let i=new XMLSerializer().serializeToString(r),a=i.startsWith(`\n${i}`;return new Blob([a],{type:`image/svg+xml;charset=utf-8`})}async function aT(e,t=$w){let n=URL.createObjectURL(e);try{let e=new Image;await new Promise((t,r)=>{e.onload=()=>t(),e.onerror=r,e.src=n});let r=document.createElement(`canvas`);r.width=t,r.height=t;let i=r.getContext(`2d`);if(!i)throw Error(`Canvas unsupported`);return i.drawImage(e,0,0,t,t),await new Promise((e,t)=>r.toBlob(n=>n?e(n):t(Error(`PNG encode failed`)),`image/png`))}finally{URL.revokeObjectURL(n)}}var oT=()=>{let e=N();return e<=0n?0:e>BigInt(2**53-1)?2**53-1:Number(e)};const sT=`sigil-debits-v1`,cT=(e,t)=>t?`sigil:debits:${e}:t:${t}`:`sigil:debits:${e}`,lT=(e,t)=>e===cT(t)||e.startsWith(`${cT(t)}:t:`),uT=(e,t)=>{let n=`sigil:debits:${t}`;if(e===n)return null;let r=`${n}:t:`;return e.startsWith(r)?e.slice(r.length):void 0};function dT(e){let t=new TextEncoder().encode(e),n=``;for(let e=0;e0&&typeof t.recipientPhiKey==`string`&&t.recipientPhiKey.length>0&&typeof t.amount==`number`&&Number.isFinite(t.amount)&&t.amount>0&&typeof t.timestamp==`number`&&Number.isFinite(t.timestamp)}function hT(e){if(!e)return null;try{let t=JSON.parse(fT(e));if(typeof t!=`object`||!t)return null;let n={},r=t;if(typeof r.originalAmount==`number`&&Number.isFinite(r.originalAmount)&&(n.originalAmount=r.originalAmount),Array.isArray(r.debits)){let e=[];for(let t of r.debits)mT(t)&&e.push(t);e.length&&(n.debits=e)}return n}catch{return null}}function gT(e,t){try{let n=new URL(window.location.href),r=typeof e.originalAmount==`number`&&Number.isFinite(e.originalAmount),i=Array.isArray(e.debits)&&e.debits.length>0;!r&&!i?n.searchParams.delete(`d`):n.searchParams.set(`d`,pT(e));let a=`${n.pathname}${n.search}${n.hash}`;t?.navigate?window.location.replace(a):window.history.replaceState(null,``,a)}catch{}}function _T(e,t){let n=(e||``).toLowerCase();if(!n)return null;try{let e=t?localStorage.getItem(cT(n,t)):null;if(e)return hT(e);let r=localStorage.getItem(cT(n));return r?hT(r):null}catch{return null}}function vT(e,t,n){let r=(e||``).toLowerCase();if(r)try{localStorage.setItem(cT(r,n??null),pT(t))}catch{}}function yT(e){let t=new Set,n=[];for(let r of e)!r||typeof r.nonce!=`string`||t.has(r.nonce)||(t.add(r.nonce),n.push(r));return n.sort((e,t)=>(e.timestamp||0)-(t.timestamp||0))}function bT(e,t){let n={},r=typeof e?.originalAmount==`number`?e.originalAmount:void 0,i=typeof t?.originalAmount==`number`?t.originalAmount:void 0;n.originalAmount=typeof r==`number`?r:typeof i==`number`?i:void 0;let a=Array.isArray(e?.debits)?e.debits:[],o=Array.isArray(t?.debits)?t.debits:[],s=yT([...a,...o]);return s.length&&(n.debits=s),n}function xT(e,t){let n=typeof e?.originalAmount==`number`&&Number.isFinite(e.originalAmount)?Number(e.originalAmount):NaN,r=typeof t?.originalAmount==`number`&&Number.isFinite(t.originalAmount)?Number(t.originalAmount):NaN,i=Number.isNaN(n)&&Number.isNaN(r)||Math.abs(n-r)<1e-12,a=new Set((Array.isArray(e?.debits)?e.debits:[]).map(e=>e?.nonce)),o=new Set((Array.isArray(t?.debits)?t.debits:[]).map(e=>e?.nonce));if(!i||a.size!==o.size)return!1;for(let e of a)if(!o.has(e))return!1;return!0}function ST(e,t,n,r){gT(e,{navigate:!!r?.navigate});let i=(t||``).toLowerCase();if(i&&(vT(i,e,n??null),r?.broadcast!==!1))try{let t=new BroadcastChannel(sT),r={type:`debits`,canonical:i,qs:pT(e),stamp:oT(),token:n??null};t.postMessage(r),t.close()}catch{}}function CT(e,t,n){let r=hT(t.get(`d`)),i=bT(n?_T(e,n):_T(e,null),r);return{merged:i,urlIsStale:!xT(i,r)}}function wT(e){try{let t=new URL(e,window.location.origin).pathname.match(/\/s\/([0-9a-fA-F]+)/);return t?t[1].toLowerCase():null}catch{return null}}function TT(e){if(typeof e==`string`)switch(e.trim().toLowerCase().replace(/\s+/g,` `)){case`root`:return`Root`;case`sacral`:return`Sacral`;case`solar plexus`:case`solarplexus`:return`Solar Plexus`;case`heart`:return`Heart`;case`throat`:return`Throat`;case`third eye`:case`thirdeye`:return`Third Eye`;case`crown`:return`Crown`;default:return}}function ET(e){return e===`breaths`||e===`steps`?e:void 0}var DT=e=>!!e&&typeof e==`object`,OT=e=>{if(!DT(e))return!1;let t=`u`in e&&`b`in e,n=`d`in e;return t||n},kT=e=>typeof e==`number`&&Number.isFinite(e)?e:void 0,AT=e=>typeof e==`string`&&e.trim()?e:void 0;function jT(e){if(!e)return{};try{let t=String(e).trim(),n=!1;/^c:/i.test(t)&&(t=t.slice(2),n=!0);let r=JSON.parse(fT(t));if(n||OT(r)){let e=r,t={},n=kT(e.u),i=kT(e.b),a=kT(e.d),o=kT(e.s),s=TT(e.c);return n!==void 0&&(t.pulse=n),i!==void 0&&(t.beat=i),a!==void 0&&(t.stepsPerBeat=a),o!==void 0&&(t.stepIndex=o),s!==void 0&&(t.chakraDay=s),t}if(DT(r)){let e=r,t={},n=kT(e.pulse),i=kT(e.beat),a=kT(e.stepsPerBeat),o=kT(e.stepIndex),s=TT(e.chakraDay),c=AT(e.canonicalHash),l=AT(e.kaiSignature),u=AT(e.userPhiKey),d=AT(e.transferNonce),f=kT(e.expiresAtPulse),p=ET(e.claimExtendUnit),m=kT(e.claimExtendAmount);return n!==void 0&&(t.pulse=n),i!==void 0&&(t.beat=i),a!==void 0&&(t.stepsPerBeat=a),o!==void 0&&(t.stepIndex=o),s!==void 0&&(t.chakraDay=s),c!==void 0&&(t.canonicalHash=c.toLowerCase()),l!==void 0&&(t.kaiSignature=l),u!==void 0&&(t.userPhiKey=u),d!==void 0&&(t.transferNonce=d),f!==void 0&&(t.expiresAtPulse=f),p!==void 0&&(t.claimExtendUnit=p),m!==void 0&&(t.claimExtendAmount=m),Array.isArray(e.lineage)&&(t.lineage=e.lineage),t}return{}}catch{return{}}}function MT(e,t){let n={...e};typeof t.expiresAtPulse==`number`&&(n.expiresAtPulse=t.expiresAtPulse),t.claimExtendUnit!=null&&(n.claimExtendUnit=t.claimExtendUnit),typeof t.claimExtendAmount==`number`&&(n.claimExtendAmount=t.claimExtendAmount),typeof t.pulse==`number`&&(n.pulse=t.pulse),typeof t.beat==`number`&&(n.beat=t.beat),typeof t.stepsPerBeat==`number`&&(n.stepsPerBeat=t.stepsPerBeat),t.chakraDay!==void 0&&(n.chakraDay=t.chakraDay),t.canonicalHash&&(n.canonicalHash=String(t.canonicalHash).toLowerCase()),t.kaiSignature&&(n.kaiSignature=t.kaiSignature),t.userPhiKey&&(n.userPhiKey=t.userPhiKey),t.transferNonce&&(n.transferNonce=t.transferNonce),Array.isArray(t.lineage)&&(n.lineage=t.lineage);let r=typeof n.stepsPerBeat==`number`&&Number.isFinite(n.stepsPerBeat)?n.stepsPerBeat:44,i=kT(t?.stepIndex),a=kT(n.stepIndex);return i===void 0?a===void 0?typeof n.pulse==`number`&&Number.isFinite(n.pulse)&&(n.stepIndex=p(n.pulse,r)):n.stepIndex=a:n.stepIndex=i,n}function NT(e,t){try{let n=new URL(e,window.location.origin),r=MT(jT(n.searchParams.get(`p`)),t);return r.canonicalHash&&=String(r.canonicalHash).toLowerCase(),n.searchParams.set(`p`,dT(JSON.stringify(r))),n.toString()}catch{return e}}function PT(e,t,n){let r=[e?.canonicalHash,t,n?.matchedHash];for(let e of r)if(typeof e==`string`&&e.trim())return e.toLowerCase();return null}function FT(e,t){return typeof e==`string`&&e.trim()?e:typeof t?.transferNonce==`string`&&t.transferNonce.trim()?t.transferNonce:null}async function IT(t){let{stageEl:n,payload:r,localHash:i,routeHash:a,qr:o,onToast:s}=t;if(!n)return s(`No stage found`);try{let t=(await m(async()=>{let{default:t}=await import(`./html2canvas-Dw4vJfGn.js`).then(e(1));return{default:t}},__vite__mapDeps([0,1,2,3]))).default,l=await t(n,{backgroundColor:null}),u=document.createElement(`canvas`);u.width=eT,u.height=eT;let d=u.getContext(`2d`);if(!d)throw Error(`No canvas context`);d.clearRect(0,0,u.width,u.height);let f=Math.floor(eT*.06),p=eT-f*2,h=eT-f*2,g=l.width,_=l.height,v=Math.min(p/g,h/_),y=Math.floor(g*v),b=Math.floor(_*v),x=Math.floor((eT-y)/2),S=Math.floor((eT-b)/2);d.drawImage(l,x,S,y,b);let C=r?.chakraDay??`Throat`,w=dC[C]?.accent||`#00FFD0`,T=kC(C,typeof r?.stepPct==`number`?r.stepPct:r?r.pulse%11/11:0,i||void 0),E=Math.max(eT*.33,720),D=Math.max(eT*.08,160),O=Math.max(D*.24,30),k=eT-E-f,A=eT-D-f;d.save(),d.shadowColor=w,d.shadowBlur=Math.max(18,Math.floor(eT*.012));let j=d.createLinearGradient(0,A,0,A+D);j.addColorStop(0,`rgba(255,255,255,0.16)`),j.addColorStop(1,`rgba(255,255,255,0.05)`),c(d,k,A,E,D,O),d.fillStyle=j,d.fill(),d.shadowBlur=0,d.lineWidth=Math.max(2,Math.floor(eT*.0016)),d.strokeStyle=`rgba(255,255,255,0.18)`,d.stroke();let M=(r?.pulse??0).toLocaleString();d.textBaseline=`alphabetic`,d.fillStyle=T,d.font=`900 ${Math.floor(D*.48)}px Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto, Helvetica Neue, Arial`,d.shadowColor=T,d.shadowBlur=Math.max(16,Math.floor(eT*.008));let N=d.measureText(M).width,P=Math.floor(k+E/2-N/2),F=Math.floor(A+D/2+D*.18);d.fillText(M,P,F),d.restore();let I=Math.floor(eT*.32),ee=Math.floor((eT-I)/2),L=Math.floor((eT-I)/2),R=LT({provided:o.url,payload:r,localHash:i,routeHash:a}),te=(0,ZC.renderToStaticMarkup)((0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 1000 1000`,children:(0,q.jsx)(ww,{uid:o.uid,url:R,size:800,phaseHue:o.hue,phaseColor:o.accent,animate:!1,pulseMs:5236})})),z=new Blob([te],{type:`image/svg+xml;charset=utf-8`}),ne=URL.createObjectURL(z);await new Promise((e,t)=>{let n=new Image;n.onload=()=>{try{d.drawImage(n,ee,L,I,I)}finally{URL.revokeObjectURL(ne),e()}},n.onerror=e=>{URL.revokeObjectURL(ne),t(e)},n.src=ne});let re=u.toDataURL(`image/png`),B=document.createElement(`a`);B.href=re,B.download=`sigil_poster_${(i||a||`mint`).slice(0,16)}.png`,document.body.appendChild(B),B.click(),B.remove(),s(`Public key PNG saved`)}catch(e){console.error(e),s(`Poster export failed`)}function c(e,t,n,r,i,a){e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath()}}function LT(e){let{provided:t,payload:n,localHash:r,routeHash:i}=e,a=t&&RT(t)?t:(typeof window<`u`?window.location.href:``)||``;if(!n)return a;try{let e=(n.canonicalHash||r||i||``).toLowerCase();if(!e)return a;let t=new URL(a,typeof window<`u`?window.location.origin:`https://local.test`);t.pathname=`/s/${e}`;let o=n.transferNonce||t.searchParams.get(`t`);o&&t.searchParams.set(`t`,o);let s=`${t.pathname}${t.search}${t.hash}`;return NT(s,n)||s}catch{return a}}function RT(e){try{let t=new URL(e,typeof window<`u`?window.location.origin:`https://local.test`);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function zT(e){let t=JSON.stringify(e);return btoa(unescape(encodeURIComponent(t))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function BT(e,t,n){let r=new URL(e,typeof window<`u`?window.location.origin:`http://localhost`);return r.searchParams.set(`p`,zT(t)),n&&r.searchParams.set(`t`,n),r.toString()}function VT(e){switch(String(e??``).trim().toLowerCase()){case`root`:return`Root`;case`sacral`:return`Sacral`;case`solar plexus`:case`solar_plexus`:case`solar-plexus`:return`Solar Plexus`;case`heart`:return`Heart`;case`throat`:return`Throat`;case`third eye`:case`third_eye`:case`third-eye`:return`Third Eye`;case`crown`:return`Crown`;default:return`Root`}}function HT(e,t){let n={pulse:e.pulse,beat:e.beat,chakraDay:VT(e.chakraDay),stepsPerBeat:e.stepsPerBeat??void 0,stepIndex:t,userPhiKey:e.userPhiKey??void 0,kaiSignature:e.kaiSignature??void 0,canonicalHash:e.canonicalHash??void 0,transferNonce:e.transferNonce??void 0,expiresAtPulse:e.expiresAtPulse??void 0,claimExtendUnit:e.claimExtendUnit??void 0,claimExtendAmount:e.claimExtendAmount??void 0,attachment:e.attachment??void 0,provenance:e.provenance??void 0};return Object.keys(n).forEach(e=>{n[e]===void 0&&delete n[e]}),n}function UT(e){return{pulse:e.pulse,beat:e.beat,stepIndex:e.stepIndex,chakraDay:VT(e.chakraDay),stepsPerBeat:e.stepsPerBeat??void 0,userPhiKey:e.userPhiKey??void 0,kaiSignature:e.kaiSignature??void 0}}function WT(e,t){e.setAttribute(`data-share-url`,t),e.querySelectorAll(`a`).forEach(e=>{e.setAttribute(`href`,t);try{e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,t)}catch{}});let n=/\bu=([^·\n\r]+?)(?=\s*·|$)/;e.querySelectorAll(`text`).forEach(e=>{let r=e.textContent||``;n.test(r)&&(e.textContent=r.replace(n,`u=${t}`))})}async function GT(e){let{expired:t,exporting:n,setExporting:r,svgEl:i,payload:a,isFutureSealed:o,linkStatus:c,setToast:l,expiryUnit:u,expiryAmount:d,localHash:f,routeHash:p,transferToken:h,getKaiPulseEternalInt:g,stepIndexFromPulse:_,STEPS_PER_BEAT:v}=e;if(t)return SC(l,`Seal window closed`);if(!n){if(!i)return SC(l,`No SVG found`);if(!a)return SC(l,`No payload`);if(o)return SC(l,`Opens after the moment—claim unlocks then`);if(c!==`active`)return SC(l,`Archived link — cannot claim from here`);try{r(!0);let e=`sigil_${(f||p||`mint`).slice(0,16)}`,t=a.stepsPerBeat??v,n=_(a.pulse,t),o=g(new Date),c=_(o,t),y=HT(a,n),b={...iC(a.userPhiKey||``,a.kaiSignature??void 0,y,`claim`,a.attachment?.name??void 0,o),stepIndex:n,atStepIndex:c},x={...a,exportedAtPulse:o,stepIndex:n,stepsPerBeat:t,provenance:[...a.provenance??[],b],claimExtendUnit:a.claimExtendUnit??u,claimExtendAmount:a.claimExtendAmount??d,canonicalHash:(f||a.canonicalHash||p||null)?.toString()??null},S=await FC(zC(x.pulse,x.beat,n,String(x.chakraDay??``),BC(HT(x,n)))),C=await RC(S),w={...x,kaiSignature:S,userPhiKey:x.userPhiKey||C},T=(f||p||``).toLowerCase(),E=UT({pulse:w.pulse,beat:w.beat,stepIndex:n,chakraDay:w.chakraDay??null,stepsPerBeat:t,userPhiKey:w.userPhiKey??null,kaiSignature:w.kaiSignature??null}),D=BT(s(T,E),E,w.transferNonce??h??void 0),{putMetadata:O}=await m(async()=>{let{putMetadata:e}=await import(`./svgMeta-Drisw1CT.js`);return{putMetadata:e}},__vite__mapDeps([4,5,2,3])),k={...w,stepsPerBeat:t,shareUrl:D,fullUrl:D};O(i,k);try{i.setAttribute(`data-step-index`,String(n));let e=i.querySelector(`metadata#sigil-display`);e||(e=document.createElementNS(`http://www.w3.org/2000/svg`,`metadata`),e.setAttribute(`id`,`sigil-display`),e.setAttribute(`data-noncanonical`,`1`),i.appendChild(e)),e.textContent=JSON.stringify({stepIndex:n,stepsPerBeat:t})}catch{console.debug(`Display metadata write failed`)}KC(i,w.pulse,w.beat,n),UC(i),WT(i,D);let A=null,j=null;try{let e=new URL(D);A=e.searchParams.get(`p`),j=e.searchParams.get(`t`)}catch{console.debug(`URL parse failed`)}let M=await iT(i,$w,{metaOverride:k,addQR:!1,addPulseBar:!1,title:`Kairos Sigil-Glyph — Sealed KairosMoment`,desc:`Deterministic sigil-glyph with sovereign metadata. Exported as archived key.`}),N=await aT(M,$w),P=new(await(CC()));P.file(`${e}.svg`,M),P.file(`${e}.png`,N);let F={hash:f||p||``,canonicalHash:w.canonicalHash??null,pulse:w.pulse,beat:w.beat,stepIndex:n,atStepIndex:c,chakraDay:w.chakraDay??null,userPhiKey:w.userPhiKey??null,kaiSignature:w.kaiSignature??null,transferNonce:w.transferNonce??null,expiresAtPulse:w.expiresAtPulse??null,exportedAtPulse:w.exportedAtPulse??null,claimedAtPulse:o,overlays:{qr:!1,eternalPulseBar:!1},claimExtendUnit:w.claimExtendUnit??null,claimExtendAmount:w.claimExtendAmount??null,fullUrl:D,p:A,urlQuery:{p:A,t:j}};P.file(`${e}.manifest.json`,JSON.stringify(F,null,2));let I=await P.generateAsync({type:`blob`}),ee=URL.createObjectURL(I),L=document.createElement(`a`);L.href=ee,L.download=`${e}.zip`,document.body.appendChild(L),L.click(),L.remove(),requestAnimationFrame(()=>URL.revokeObjectURL(ee)),SC(l,`Access key generated`)}catch(e){console.error(e),SC(l,`Claim failed`)}finally{r(!1)}}}function KT(){return(0,K.useMemo)(()=>async e=>{let t=new TextEncoder().encode(e),n=await crypto.subtle.digest(`SHA-256`,t);return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,`0`)).join(``)},[])}function qT({payload:e,urlSearchParams:n,currentPulse:r}){let[a,s]=(0,K.useState)(null),[u,p]=(0,K.useState)(null),[m,g]=(0,K.useState)(null),v=(0,K.useRef)(null),y=(0,K.useRef)(null),b=KT(),x=n?.get(`vpol`)??``;(0,K.useEffect)(()=>{let t=!0;return(async()=>{if(!e||!Number.isFinite(r??NaN)){if(!t)return;s(e=>e===null?e:null),p(e=>e===null?e:null),g(e=>e===null?e:null),v.current=null,y.current=null;return}let{seal:n}=await ae({pulse:e.pulse,kaiPulse:e.pulse,beat:e.beat,stepIndex:e.stepIndex,stepsPerBeat:e.stepsPerBeat,seriesSize:e.seriesSize,quality:e.quality,creatorVerified:e.creatorVerified,creatorRep:e.creatorRep,frequencyHz:e.frequencyHz,chakraDay:e.chakraDay,chakraGate:e.chakraGate,transfers:e.transfers,cumulativeTransfers:e.cumulativeTransfers,segments:e.segments,segmentsMerkleRoot:e.segmentsMerkleRoot,transfersWindowRoot:e.transfersWindowRoot,ip:e.ip,kaiSignature:e.kaiSignature,userPhiKey:e.userPhiKey,valuationPolicyId:x||void 0},r,b);if(!t)return;y.current!==n.stamp&&(s(e=>e&&e.stamp===n.stamp?e:n),y.current=n.stamp);let i=n.valuePhi,a=v.current;a!==i&&(p(e=>e===i?e:i),a!=null&&Math.abs(i-a)>1e-9?g(e=>e===`up`&&i>a?e:i>a?`up`:`down`):g(e=>e===null?e:null),v.current=i)})(),()=>{t=!1}},[e,r,x,b]);let S=(0,K.useMemo)(()=>e?.pulse,[e]),C=(0,K.useMemo)(()=>Number.isFinite(S??NaN)?{score:j(S),lines:i(S)}:{score:null,lines:[]},[S]),w=(0,K.useMemo)(()=>{if(!Number.isFinite(S??NaN)||!Number.isFinite(r??NaN))return null;let t=a?.inputs?.pulsesPerBeat?Math.max(1,Math.round(a.inputs.pulsesPerBeat/11)):e?.stepsPerBeat??44,n=a?.inputs?.cadenceRegularity??1,i=a?.inputs?.resonancePhi??.5,s=e?.stepIndex;return o(S,r,{stepsPerBeat:t,cadenceRegularity:n,resonancePhi:i,stepIndexClaimOverride:s})},[S,r,a,e]),T=(0,K.useMemo)(()=>{let t=e?.transfers;return!t||!t.length?[`No closed transfers yet — lineage still forming.`]:_(t,{stepsPerBeat:e?.stepsPerBeat??44})},[e]);return{valSeal:a,livePrice:u,priceFlash:m,rarity:C,oscillation:w,lineageNarrative:T,trust:(0,K.useMemo)(()=>a?B(a.inputs):null,[a]),marketTier:(0,K.useMemo)(()=>Number.isFinite(S??NaN)?h(S,a??void 0):null,[S,a]),kairos:(0,K.useMemo)(()=>Number.isFinite(r??NaN)?{window:l(r,144,1,{stepsPerBeat:e?.stepsPerBeat??44})}:{window:[]},[r,e]),visuals:(0,K.useMemo)(()=>{if(!a||!Number.isFinite(S??NaN))return{spiralSVG:null,scrollSVG:null,scrollText:null,scrollHTML:null};let e=t(S),{scrollSVG:n,scrollText:r}=f(a,{title:`Kai-Sigil Valuation Scroll`});return{spiralSVG:e,scrollSVG:n,scrollText:r,scrollHTML:A(a,{title:`Kai-Sigil Valuation Scroll`})}},[a,S]),audio:(0,K.useMemo)(()=>{if(!Number.isFinite(S??NaN))return{dataURI:null,renderWav:void 0};let{dataURI:e}=c(S,2,44100,{stereo:!0});return{dataURI:e,renderWav:(e=2,t=44100,n)=>c(S,e,t,n)}},[S]),motifSimilarityWith:(0,K.useMemo)(()=>e=>!Number.isFinite(e??NaN)||!Number.isFinite(S??NaN)?null:d(S,e),[S]),helpers:(0,K.useMemo)(()=>({explainRarity:()=>C.lines,explainLineage:()=>T,scanKairos:(t,n,r=1,i)=>l(t,n,r,{stepsPerBeat:i??e?.stepsPerBeat??44}),makeScroll:e=>a?f(a,{title:e??`Kai-Sigil Valuation Scroll`}):null,makeScrollHTML:e=>a?A(a,{title:e}):null,makeSpiral:e=>Number.isFinite(e??S)?t(e??S):null}),[C.lines,T,e,a,S])}}function JT(e){let{stageId:t,payload:n,localHash:r,setOgImgUrl:i,setMeta:a,seoTitle:o,seoDesc:s}=e,c=!1,l=null,u=async()=>{let e=document.getElementById(t);if(!e||!n){i(null),a(`property`,`og:image`,``),a(`property`,`og:image:alt`,``),a(`property`,`og:image:width`,``),a(`property`,`og:image:height`,``),a(`name`,`twitter:image`,``);return}try{let t=n.chakraDay??`Throat`,l=dC[t]?.accent||`#00FFD0`,u=n.pulse||0,f=n.stepsPerBeat??44,p=Math.floor(n.pulse%(f*11)/11),m=kC(t,typeof n.stepPct==`number`?n.stepPct:n.pulse%11/11,r||void 0),h=`Pulse ${u.toLocaleString()} • Beat ${n.beat}/36 • Step ${p+1}/${f} • ${t}`,g=await(0,ge.default)(e),_=document.createElement(`canvas`);_.width=tT,_.height=630;let v=_.getContext(`2d`);if(!v)throw Error(`Canvas unsupported`);let y=v.createLinearGradient(0,0,tT,630);y.addColorStop(0,`rgba(0,0,0,0.92)`),y.addColorStop(1,`rgba(0,0,0,0.70)`),v.fillStyle=y,v.fillRect(0,0,tT,630),v.save(),v.globalCompositeOperation=`lighter`;let b=v.createRadialGradient(tT*.8,630*.2,20,tT*.8,630*.2,600);b.addColorStop(0,`${l}CC`),b.addColorStop(1,`rgba(0,0,0,0)`),v.fillStyle=b,v.beginPath(),v.arc(tT*.8,630*.2,600,0,Math.PI*2),v.fill(),v.restore();let x=Math.floor(tT*.52),S=Math.min(x/g.width,558/g.height),C=Math.floor(g.width*S),w=Math.floor(g.height*S),T=36+Math.floor((x-C)/2),E=36+Math.floor((558-w)/2);v.drawImage(g,T,E,C,w);let D=36+x+32,O=tT-D-36;v.fillStyle=`#EAFBFF`,v.font=`700 38px Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto`,v.fillText(`Kairos Sigil-Glyph — Sealed Kairos Moment`,D,94),v.fillStyle=`rgba(255,255,255,0.82)`,v.font=`400 24px Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto`,d(v,`“${o}” — ${s}`,D,136,O,30);let k=`${u.toLocaleString()}`;v.textBaseline=`alphabetic`,v.font=`900 120px Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto`,v.shadowColor=m,v.shadowBlur=20,v.fillStyle=m;let A=v.measureText(k).width,j=D+Math.floor((O-A)/2);v.fillText(k,j,554),v.shadowBlur=0;let M=_.toDataURL(`image/png`);if(c)return;i(M),a(`property`,`og:image`,M),a(`property`,`og:image:alt`,h),a(`property`,`og:image:type`,`image/png`),a(`property`,`og:image:width`,`1200`),a(`property`,`og:image:height`,`630`),a(`name`,`twitter:image`,M)}catch{if(c)return;i(null)}};return l=wC(()=>{c||u()}),()=>{c=!0,l!=null&&TC(l)};function d(e,t,n,r,i,a){let o=t.split(` `),s=``;for(let t=0;ti&&t>0?(e.fillText(s,n,r),s=o[t]+` `,r+=a):s=c}e.fillText(s.trim(),n,r)}}function YT(e){switch(String(e??``).trim().toLowerCase()){case`root`:case`earth`:case`earth gate`:return`Root`;case`sacral`:return`Sacral`;case`solar plexus`:case`solar_plexus`:case`solar-plexus`:return`Solar Plexus`;case`heart`:return`Heart`;case`throat`:return`Throat`;case`third eye`:case`third_eye`:case`third-eye`:return`Third Eye`;case`crown`:return`Crown`;default:return`Root`}}function XT(){return crypto.getRandomValues(new Uint32Array(4)).join(``)}function ZT(e){let{meta:t,stepIndex:n,stepsPerBeat:r}=e;return{pulse:t.pulse,beat:t.beat,stepIndex:n,chakraDay:YT(t.chakraDay),stepsPerBeat:r,userPhiKey:t.userPhiKey??void 0,kaiSignature:t.kaiSignature??void 0}}function QT(e,t,n){let r=e.stepIndex;return typeof r==`number`&&Number.isFinite(r)&&r>=0&&rNumber(N()/1000n),rE=e=>JSON.stringify({canonicalHash:e.canonicalHash,token:e.token,expiresAtPulse:e.expiresAtPulse,issuedAt:e.issuedAt,version:e.version},tE),iE=e=>btoa(String.fromCharCode(...e)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``);const aE=e=>iE(new TextEncoder().encode(rE(e)));async function oE(e){try{let t=await fetch(`/api/sign-claim`,{method:`POST`,headers:{"content-type":`text/plain;charset=UTF-8`},body:rE(e)});if(!t.ok)return null;let n=await t.json();return!n||!n.s||!n.kid?null:{r:n.r??aE(e),s:n.s,kid:n.kid}}catch{return null}}function sE(e,t,n,r){e.searchParams.set(`r`,t),e.searchParams.set(`s`,n),e.searchParams.set(`kid`,r)}function cE(e,t,n,r){pe(e,{registryClaim:aE(t),registrySig:n,registryKid:r})}function lE(e,t,n){return{canonicalHash:t.toLowerCase(),token:n,expiresAtPulse:e.expiresAtPulse??null,issuedAt:nE(),version:1}}function uE(){if(typeof window>`u`||typeof document>`u`){let e=()=>{},t=()=>{};return{openModal:t,closeModal:t,disable:e,teardown:e,destroy:e}}let e=document,t=e.body,n=[`.sp-breathproof__backdrop`,`.stargate-overlay`,`.valuechart-backdrop`,`.sp-modal`,`.ownership-overlay`],r={".sp-breathproof__backdrop":`.sp-breathproof`,".valuechart-backdrop":`.valuechart`,".ownership-overlay":`.ownership-panel`,".stargate-overlay":`.stargate-content, .stargate-frame, .stargate__content`,".sp-modal":`.sp-modal__content, .sp-modal__card, .sp-card`},i={capture:!0,passive:!1},a={capture:!0},o=0,s=0,c=0,l=``,u=``,d=``,f=``,p=``,m=()=>{o===0&&(s=window.scrollY||e.documentElement.scrollTop||0,c=window.scrollX||e.documentElement.scrollLeft||0,l=t.style.top,u=t.style.left,d=t.style.width,f=t.style.position,p=t.style.overflow,t.style.position=`fixed`,t.style.top=`-${s}px`,t.style.left=`-${c}px`,t.style.width=`100%`,t.style.overflow=`hidden`,t.classList.add(`modal-open`,`bp-open`)),o++},h=()=>{o=Math.max(0,o-1),!(o>0)&&(t.style.position=f,t.style.top=l,t.style.left=u,t.style.width=d,t.style.overflow=p,requestAnimationFrame(()=>{window.scrollTo(c,s)}),t.classList.remove(`modal-open`),t.classList.remove(`bp-open`))},g=e=>{if(!e)return!1;let t=window.getComputedStyle(e);return!(t.display===`none`||t.visibility===`hidden`||e.hasAttribute(`hidden`))},_=()=>{let t=[];return n.forEach(n=>{e.querySelectorAll(n).forEach(e=>{g(e)&&t.push(e)})}),t},v=t=>{if(!t)return null;let r=t;for(;r&&r!==e.documentElement;){for(let e of n)if(r.matches(e))return r;r=r.parentElement}return null},y=(e,t)=>{if(!e||!t)return!1;let i=n.find(t=>e.matches(t))||``,a=i?r[i]:``;return a&&e.querySelector(a)?!t.closest(a):t===e},b=()=>{_().length>0?m():h()},x=e=>{e&&(e.classList.add(`is-open`),e.removeAttribute(`hidden`),b())},S=e=>{e&&(e.classList.remove(`is-open`),e.setAttribute(`hidden`,``),b())},C=e=>{let t=e.target;if(!t)return;let n=t.closest(`.sp-breathproof__close, .stargate-exit, .sp-modal__close, .sealmoment__close, [data-modal-close], [data-dismiss="modal"], button[aria-label="Close"], button[aria-label="close"]`);if(n){let t=v(n);t&&(S(t),e.preventDefault(),e.stopPropagation());return}let r=v(t);if(r&&y(r,t)&&r.getAttribute(`data-backdrop-dismiss`)!==`false`){S(r),e.preventDefault(),e.stopPropagation();return}},w=e=>{if(_().length===0)return;let t=e.target;if(!t)return;let n=t.closest(`[data-scroll], .sp-breathproof, .valuechart, .ownership-panel, .sp-modal__content, .sp-card, .stargate-content`);if(!n){e.preventDefault(),e.stopPropagation();return}if(!(n.scrollHeight>n.clientHeight)){e.preventDefault(),e.stopPropagation();return}},T=e=>{if(e.key!==`Escape`)return;let t=_();if(t.length===0)return;let n=t[t.length-1];n.getAttribute(`data-escape-dismiss`)!==`false`&&(S(n),e.preventDefault(),e.stopPropagation())};e.addEventListener(`click`,C,i),e.addEventListener(`pointerup`,C,i),e.addEventListener(`touchend`,C,i),e.addEventListener(`touchmove`,w,i),e.addEventListener(`keydown`,T,i),b();let E=()=>{e.removeEventListener(`click`,C,a),e.removeEventListener(`pointerup`,C,a),e.removeEventListener(`touchend`,C,a),e.removeEventListener(`touchmove`,w,a),e.removeEventListener(`keydown`,T,a);try{o=1,h()}catch{}};return{openModal:x,closeModal:S,disable:E,teardown:E,destroy:E}}var dE=k(ce(),1),fE=1e-9,pE=`sigil-sendlock-v1`,mE=(e,t)=>`sigil:sendlock:${e}:t:${t}`,hE=3,gE={"--phi-url":`url(/assets/phi.svg)`},_E=e=>{try{return new URL(e,window.location.origin).toString()}catch{return e}},vE=(e,t,n)=>{let r=crypto.getRandomValues(new Uint32Array(4)).join(``);if(!e||!t)return{ok:!1,id:r};let i=mE(e.toLowerCase(),t);try{let a=localStorage.getItem(i),o=a?JSON.parse(a):null,s=!o||!Number.isFinite(o.atPulse)||n-o.atPulse>hE;if(!o||s){localStorage.setItem(i,JSON.stringify({id:r,atPulse:n}));try{let i=new BroadcastChannel(pE),a={type:`lock`,canonical:e.toLowerCase(),token:t,id:r,atPulse:n};i.postMessage(a),i.close()}catch{}return{ok:!0,id:r}}}catch{}return{ok:!1,id:r}},yE=(e,t,n,r)=>{if(!e||!t)return;let i=mE(e.toLowerCase(),t);try{let a=localStorage.getItem(i),o=a?JSON.parse(a):null;if(!o||o.id===n){localStorage.removeItem(i);try{let i=new BroadcastChannel(pE),a={type:`unlock`,canonical:e.toLowerCase(),token:t,id:n,atPulse:r};i.postMessage(a),i.close()}catch{}}}catch{}},bE=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.amount==`number`&&Number.isFinite(t.amount)&&t.amount>0&&typeof t.nonce==`string`&&t.nonce.length>0&&typeof t.timestamp==`number`&&Number.isFinite(t.timestamp)&&(typeof t.recipientPhiKey==`string`||t.recipientPhiKey===void 0)},xE=e=>{if(!Array.isArray(e))return 0;let t=0;for(let n of e)bE(n)&&(t+=n.amount);return t},SE=e=>[...e].sort((e,t)=>{let n=(e.timestamp||0)-(t.timestamp||0);return n===0?e.nonce.localeCompare(t.nonce):n}),CE=e=>{let t=new Set,n=[];for(let r of e)bE(r)&&(t.has(r.nonce)||(t.add(r.nonce),n.push(r)));return n},wE=e=>{let t=typeof e.originalAmount==`number`&&Number.isFinite(e.originalAmount)?e.originalAmount:NaN,n=SE(Array.isArray(e.debits)?CE(e.debits):[]);if(!Number.isFinite(t))return{originalAmount:e.originalAmount,debits:n.length?n:void 0};let r=[],i=0;for(let e of n)bE(e)&&i+e.amount<=t+fE&&(r.push(e),i+=e.amount);return{originalAmount:t,debits:r.length?r:void 0}},TE=1000000n,EE=91536000n,DE=17491270421n,OE=e=>e<0n?-e:e,kE=(e,t)=>{let n=e/t,r=e%t*2n;return rt?n+1n:n%2n==0n?n:n+1n},AE=(e,t)=>{if(t<=0n)throw Error(`divRoundTiesToEven: den must be > 0`);return e===0n?0n:(e<0n?-1n:1n)*kE(OE(e),t)},jE=e=>AE(e*EE,DE),ME=e=>{let t=jE(e);return BigInt(x)+t},NE=e=>AE((e-BigInt(x))*DE,EE),PE=()=>{let e=N();return Number(e/TE)},FE=()=>{let e=ME(N());return Number(e)},IE=e=>{let t=NE(BigInt(e.getTime()));return Number(t/TE)};function LE(){let[e,t]=(0,K.useState)(()=>PE()),[n,r]=(0,K.useState)(0);return(0,K.useEffect)(()=>{let e=!0,n=null,i=()=>{if(!e)return;let a=N(),o=Number(a/TE),s=a%TE,c=jE(s===0n?TE:TE-s),l=Number(c);t(o),r(l);let u=Math.max(1,Math.min(6e4,l));n=window.setTimeout(i,u)};return i(),()=>{e=!1,n!=null&&window.clearTimeout(n)}},[]),{pulse:e,msToNextPulse:n}}var RE=e=>e===`breaths`||e===`steps`,zE=`sigil-lineage-v1`,BE=(e,t)=>t?`sigil:desc:${e}:t:${t}`:`sigil:desc:${e}`,VE=`sigil-xfer-v1`,HE=e=>`sigil:rotated:${e}`,UE=(e,t)=>{Array.from(new Set(e.map(e=>e.toLowerCase()).filter(Boolean))).forEach(e=>{try{localStorage.setItem(HE(e),`${t}@${FE()}`)}catch{}try{let n=new BroadcastChannel(VE);n.postMessage({type:`rotated`,canonical:e,token:t}),n.close()}catch{}try{window.dispatchEvent(new CustomEvent(`sigil:transfer-rotated`,{detail:{canonical:e,token:t}}))}catch{}})};function WE(e,t){let n=(e||``).toLowerCase();if(!n||!t)return[];try{let e=localStorage.getItem(BE(n,t));if(!e)return[];let r=JSON.parse(e);return Array.isArray(r)?r:[]}catch{return[]}}function GE(e,t,n){let r=(e||``).toLowerCase();if(!(!r||!t))try{localStorage.setItem(BE(r,t),JSON.stringify(n||[]))}catch{}}function KE(e,t,n){try{let r=new BroadcastChannel(zE),i={type:`descendants`,canonical:e.toLowerCase(),token:t,list:n,stamp:FE()};r.postMessage(i),r.close()}catch{}}function qE(){let{hash:e}=ie(),t=oe(),r=C(),i=(e??``).toLowerCase(),a=(0,K.useMemo)(()=>new URLSearchParams(t.search),[t.search]),o=a.get(`t`),[s,c]=(0,K.useState)(`checking`),[l,u]=(0,K.useState)(`checking`),[d,f]=(0,K.useState)(!1),[m,h]=(0,K.useState)(`Awaiting Proof Of Breath™`),[g,_]=(0,K.useState)(``),[v,y]=(0,K.useState)(320),b=(0,K.useRef)(null),{payload:x,setPayload:E,loading:D,setLoading:O}=yC(t.search),k=x,{pulse:A,msToNextPulse:j}=LE(),[M,N]=(0,K.useState)(null),[P,F]=(0,K.useState)(null),[I,L]=(0,K.useState)(!1),[R,te]=(0,K.useState)(``),[z,re]=(0,K.useState)(``),[B,ae]=(0,K.useState)(`breaths`),[ce,H]=(0,K.useState)(44),[U,de]=(0,K.useState)(``),[W,G]=(0,K.useState)(!1),me=(0,K.useRef)(``),ge=(0,K.useMemo)(()=>i?`sigil:legacy-upgraded:${i}`:``,[i]),[be,xe]=(0,K.useState)(!1),[Se,Ce]=(0,K.useState)(!1);(0,K.useEffect)(()=>{if(ge)try{Ce(localStorage.getItem(ge)===`1`)}catch{}},[ge]);let we=(0,K.useCallback)(()=>{if(ge){try{localStorage.setItem(ge,`1`)}catch{}Ce(!0),SC(_,`Upgraded — legacy link locked`)}},[ge]),[Te,Ee]=(0,K.useState)(!1),[De,Oe]=(0,K.useState)(``),[ke,Ae]=(0,K.useState)(``),[je,Me]=(0,K.useState)(`checking`),[Ne,Pe]=(0,K.useState)(null);(0,K.useEffect)(()=>{let e=Array.from(new Set([k?.canonicalHash,i,U].filter(Boolean).map(e=>e.toLowerCase())));if(e.length===0)return;let t=()=>{let t=null;try{for(let n of e){let e=localStorage.getItem(HE(n)),r=e?String(e).split(`@`)[0]:null;if(r){t=r;break}}}catch{}Pe(t)};t();let n=null;try{n=new BroadcastChannel(VE),n.onmessage=t=>{let n=t.data;if(n?.type===`rotated`){let t=(n.canonical||``).toLowerCase();e.includes(t)&&Pe(n.token||null)}}}catch{}let r=n=>{if(n.key){for(let r of e)if(n.key===HE(r)){t();break}}};return window.addEventListener(`storage`,r,{passive:!0}),()=>{if(window.removeEventListener(`storage`,r),n&&typeof n.close==`function`)try{n.close()}catch{}}},[k?.canonicalHash,i,U]);let Fe=(0,K.useCallback)(async(e,t,n,r,i)=>{try{let a=lE(e,t,n),o=await oE(a);if(!o)return r;let s=new URL(r,window.location.origin);return sE(s,o.r,o.s,o.kid),i&&cE(i,a,o.s,o.kid),s.toString()}catch{return r}},[]);(0,K.useEffect)(()=>{let e=null;try{e=new BroadcastChannel(pE),e.onmessage=()=>{}}catch{}return()=>{if(e&&typeof e.close==`function`)try{e.close()}catch{}}},[]),(0,K.useEffect)(()=>{let e=uE();return()=>{e.destroy?.(),e.teardown?.(),e.disable?.()}},[]);let[Ie,Le]=(0,K.useState)(0),[Re,Ve]=(0,K.useState)(!1),[He,Ue]=(0,K.useState)(null),We=(0,K.useMemo)(()=>{let e=[k?.canonicalHash,U,M?.canonicalHash,He?.matchedHash].filter(Boolean).map(e=>e.toLowerCase());return Array.from(new Set(e))},[k?.canonicalHash,U,M?.canonicalHash,He]);(0,K.useLayoutEffect)(()=>{qC()},[]),(0,K.useEffect)(()=>{let e=dC[k?.chakraDay??`Throat`]??{hue:180,accent:`#00FFD0`},t=document.querySelector(`.sigilpage`);t&&(t.style.setProperty(`--crystal-hue`,String(e.hue)),t.style.setProperty(`--crystal-accent`,e.accent))},[k?.chakraDay]);let[Ge,Ke]=(0,K.useState)(null),{valSeal:qe,livePrice:Je,priceFlash:Ye}=qT({payload:k,urlSearchParams:a,currentPulse:A,routeHash:i}),Xe=a.get(`h`)??``;(0,K.useEffect)(()=>{if(!Xe){Ke(e=>e===null?e:null);return}try{let e=n(jC(Xe.trim()));Ke(t=>Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)}catch{Ke(e=>e===null?e:null)}},[Xe]);let Ze=(0,K.useCallback)((e,t)=>{let n=e.stepsPerBeat??44,r=t.stepsPerBeat??44,i=p(e.pulse,n),a=p(t.pulse,r);return e.pulse===t.pulse&&e.beat===t.beat&&i===a&&e.chakraDay===t.chakraDay},[]),Qe=(0,K.useMemo)(()=>typeof window<`u`?new URL(window.location.href).toString():`${`/s/${encodeURIComponent(e??``)}`}${t.search||``}${t.hash||``}`,[e,t.search,t.hash]),$e=(0,K.useMemo)(()=>e?e.slice(0,16):`—`,[e]),et=(0,K.useCallback)(async(e,t=`Copied`)=>{try{return await navigator.clipboard.writeText(e),SC(_,t),!0}catch{return SC(_,`Copy failed`),!1}},[]),tt=(0,K.useCallback)(async()=>{try{let e=navigator;typeof e?.share==`function`?(await e.share({title:`Kairos Sigil-glyph`,text:`Sealed Kairos Moment`,url:Qe}),SC(_,`Share sheet opened`)):await et(Qe,`Link copied`)}catch{}},[Qe,et]);(0,K.useEffect)(()=>{let e=FE(),t=(i||``).toLowerCase();if(Ie>e||!t||We.length===0)return;let n=We.includes(t),r=l,a=s;!n&&U&&t!==U&&!He||!n&&(He||je===`archived`)?r=`authentic`:(r=n?`authentic`:`forged`,s!==`verified`&&(a=n?`ok`:`mismatch`)),r!==l&&u(r),a!==s&&c(a)},[We,i,je,Ie,He,U,l,s]);let[nt,rt]=(0,K.useState)(null),it=(0,K.useDeferredValue)(k),at=(0,K.useMemo)(()=>{let t=it?.stepsPerBeat??44,n=it?p(it.pulse,t):0,r=it?.chakraDay??`Throat`,i=(it?.userPhiKey??``).slice(0,12),a=(it?.pulse??0).toLocaleString();return{title:`Kai Sigil — ${e?e.slice(0,16):`—`}`,desc:it?`Sealed Sigil-Glyph • Pulse ${a} • Beat ${it.beat}/36 • Step ${n+1}/${t} • ${r}${i?` • Owner ${i}…`:``}.`:`Sealed Sigil-Glyph`}},[it,e]),{series:ot}=QS();(0,K.useEffect)(()=>{let e=Qe;document.title=at.title;let t=lC(`canonical`);t.href=e,sC(`name`,`theme-color`,dC[k?.chakraDay??`Throat`]?.accent||`#00FFD0`),sC(`property`,`og:title`,at.title),sC(`property`,`og:description`,at.desc),sC(`property`,`og:type`,`website`),sC(`property`,`og:url`,e),sC(`name`,`twitter:card`,`summary_large_image`),sC(`name`,`twitter:title`,at.title),sC(`name`,`twitter:description`,at.desc),sC(`property`,`og:site_name`,`Kairos Harmonik Kingdom`);let n=k?.stepsPerBeat??44,r=k?p(k.pulse,n):0,i=k,a=k??{},o={"@context":`https://schema.org`,"@type":`VisualArtwork`,name:at.title,description:at.desc,url:e,image:nt||void 0,genre:`Sigil-Glyph`,identifier:[{"@type":`PropertyValue`,name:`pulse`,value:k?.pulse??null},{"@type":`PropertyValue`,name:`beat`,value:k?.beat??null},{"@type":`PropertyValue`,name:`stepIndex`,value:r},{"@type":`PropertyValue`,name:`stepsPerBeat`,value:n},{"@type":`PropertyValue`,name:`chakraDay`,value:k?.chakraDay??null},{"@type":`PropertyValue`,name:`userPhiKey`,value:k?.userPhiKey??null},{"@type":`PropertyValue`,name:`kaiSignature`,value:k?.kaiSignature??null},{"@type":`PropertyValue`,name:`canonicalHash`,value:(k?.canonicalHash??U)||null},{"@type":`PropertyValue`,name:`expiresAtPulse`,value:k?.expiresAtPulse??null},{"@type":`PropertyValue`,name:`transferNonce`,value:new URLSearchParams(location.search).get(`t`)??k?.transferNonce??null},{"@type":`PropertyValue`,name:`claimExtendUnit`,value:RE(a.claimExtendUnit)?a.claimExtendUnit:null},{"@type":`PropertyValue`,name:`claimExtendAmount`,value:a.claimExtendAmount??null},{"@type":`PropertyValue`,name:`historyLiteCount`,value:Ge?.length??0}].filter(e=>e.value!=null)};i?.lineage?.length&&o.identifier.push({"@type":`PropertyValue`,name:`lineageDepth`,value:i.lineage.length}),uC(`sigil-jsonld`,o)},[Qe,at.title,at.desc,k,nt,U,Ge?.length]),(0,K.useEffect)(()=>JT({stageId:`sigil-stage`,payload:k?{...k}:null,localHash:U,setOgImgUrl:rt,setMeta:sC,seoTitle:at.title,seoDesc:at.desc}),[k,U,v,at.title,at.desc]),(0,K.useLayoutEffect)(()=>(document.documentElement.classList.add(`sigil-scroll`),()=>document.documentElement.classList.remove(`sigil-scroll`)),[]),(0,K.useEffect)(()=>{let e=0,t=()=>{cancelAnimationFrame(e),e=requestAnimationFrame(()=>{let e=window.innerWidth,t=window.innerHeight,n=e<640?Math.max(220,Math.min(360,t*.48)):Math.max(160,Math.min(320,t*.35)),r=Math.max(160,Math.min(640,Math.min(e,t-n))),i=b.current?.clientWidth??e,a=Math.max(160,Math.min(640,i-24));y(Math.round(Math.min(r,a)))})},n=b.current??document.body,r=new ResizeObserver(()=>t());return r.observe(n),window.addEventListener(`resize`,t,{passive:!0}),t(),()=>{r.disconnect(),window.removeEventListener(`resize`,t),cancelAnimationFrame(e)}},[]),(0,K.useEffect)(()=>{D?(c(e=>e===`verified`?`verified`:`checking`),u(e=>e===`authentic`?`authentic`:`checking`),f(!1),h(`Awaiting Verifikation`)):k||(c(e=>e===`verified`?`verified`:i?`notfound`:`checking`),u(e=>e===`authentic`?`authentic`:i?`forged`:`checking`))},[D,k,i]);let st=e=>Array.isArray(e)?[...e].map(e=>({nonce:e.nonce,amount:Number.isFinite(e.amount)?Number(e.amount):0,recipient:e.recipientPhiKey??``,ts:e.timestamp??``})).sort((e,t)=>e.nonce.localeCompare(t.nonce)).map(e=>`${e.nonce}:${e.amount}:${e.recipient}:${e.ts}`).join(`|`):``;(0,K.useEffect)(()=>{let e=hT(a.get(`d`));if(!e)return;let t=PT(k??null,U,He),n=FT(o,k??null),r=wE(e);t&&vT(t,r,n);let i=typeof r.originalAmount==`number`?r.originalAmount:void 0,s=Array.isArray(r.debits)?r.debits:void 0;E(e=>{if(!e)return e;let t=e,n=(t.originalAmount??void 0)===i,r=st(t.debits)===st(s);if(n&&r)return e;let a={...e};return i!==void 0&&(a.originalAmount=i),s&&(a.debits=s,a.totalDebited=xE(s)),a})},[a,k,U,He,o,E]);let[ct,lt]=(0,K.useState)(!1);(0,K.useEffect)(()=>{let e=PT(k??null,U,He);if(!e)return;let t=FT(o,k??null),{merged:n,urlIsStale:r}=CT(e,a,t),i=wE(n);r&<(!0),ST(i,e,t,{broadcast:!1,navigate:r});let s=typeof i.originalAmount==`number`?i.originalAmount:void 0,c=Array.isArray(i.debits)?i.debits:void 0;E(e=>{if(!e)return e;let t=e,n=(t.originalAmount??void 0)===s,r=st(t.debits)===st(c);if(n&&r)return e;let i={...e};return s!==void 0&&(i.originalAmount=s),c&&(i.debits=c,i.totalDebited=xE(c)),i})},[k?.canonicalHash,U,He,a,o,E]),(0,K.useEffect)(()=>{if(!k?.canonicalHash)return;let e=k.canonicalHash.toLowerCase();if(i&&e&&e!==i&&je===`active`&&!He){let t=new URL(window.location.href);t.pathname=`/s/${e}`,r(`${t.pathname}${t.search}${t.hash}`,{replace:!0})}},[k?.canonicalHash,i,je,He,r]),(0,K.useEffect)(()=>{if(k&&!k.canonicalHash&&U&&i&&U!==i&&je===`active`&&!He){let e=new URL(window.location.href);e.pathname=`/s/${U}`,r(`${e.pathname}${e.search}${e.hash}`,{replace:!0})}},[k?.canonicalHash,U,i,je,He,r]),(0,K.useEffect)(()=>{let e=We;if(!e.length)return;let t=FT(o,k??null),n=(e,t)=>{let n={};typeof e?.originalAmount==`number`&&(n.originalAmount=e.originalAmount),n.originalAmount===void 0&&typeof t?.originalAmount==`number`&&(n.originalAmount=t.originalAmount);let r=Array.isArray(e?.debits)?e.debits:[],i=Array.isArray(t?.debits)?t.debits:[],a=CE([...r,...i]);return wE({originalAmount:n.originalAmount,debits:a})},r=(e,t)=>{let n=wE(e??{}),r=wE(t??{}),i=typeof n.originalAmount==`number`?n.originalAmount:NaN,a=typeof r.originalAmount==`number`?r.originalAmount:NaN,o=Number.isNaN(i)&&Number.isNaN(a)||Math.abs(i-a)e.nonce)),c=new Set((Array.isArray(r.debits)?r.debits:[]).map(e=>e.nonce));if(!o||s.size!==c.size)return!1;for(let e of s)if(!c.has(e))return!1;return!0},i=(i,a,o)=>{let s=i.toLowerCase();if(!e.includes(s))return;let c=t??null;if(c!==(o??null))return;let l=hT(a);if(!l)return;let u=hT(new URLSearchParams(window.location.search).get(`d`)),d=n(u,l);r(u,d)||(ST(d,s,c,{broadcast:!1}),E(e=>{if(!e)return e;let t={...e};return typeof d.originalAmount==`number`&&(t.originalAmount=d.originalAmount),Array.isArray(d.debits)&&(t.debits=d.debits,t.totalDebited=xE(d.debits)),t}))},a=null;try{a=new BroadcastChannel(sT),a.onmessage=e=>{let t=e.data;t?.type===`debits`&&t.canonical&&t.qs&&i(t.canonical,t.qs,t.token)}}catch{}let s=t=>{if(!(!t.key||typeof t.newValue!=`string`))for(let n of e){if(!lT(t.key,n))continue;let e=uT(t.key,n);i(n,t.newValue,e);break}};return window.addEventListener(`storage`,s,{passive:!0}),()=>{if(window.removeEventListener(`storage`,s),a&&typeof a.close==`function`)try{a.close()}catch{}}},[We,o,k,E]);let ut=(0,K.useMemo)(()=>k?typeof k.expiresAtPulse==`number`?k.expiresAtPulse:k.pulse+11:null,[k]),dt=(0,K.useMemo)(()=>A==null||ut==null?null:Math.max(0,ut-A),[A,ut]),pt=(0,K.useMemo)(()=>dt===0,[dt]),mt=(0,K.useMemo)(()=>A==null||!k?null:Math.max(0,k.pulse-A),[k,A]),ht=(0,K.useMemo)(()=>A==null||!k?!1:k.pulse>A,[k,A]),gt=k?.chakraDay??`Throat`,_t=k?.stepsPerBeat??44,vt=p(k?.pulse??0,_t),yt=typeof k?.stepPct==`number`?Math.max(0,Math.min(1,k.stepPct)):S(k?.pulse??0),bt=(0,K.useMemo)(()=>`hsl(${((dC[gt]?.hue??180)+(U&&/^[0-9a-f]+$/i.test(U)?parseInt(U.slice(-2),16)%12:0)*2.5)%360} 100% ${50+15*Math.sin(yt*2*Math.PI)}%)`,[gt,yt,U]),xt=dC[gt]?.hue??180,St=(0,K.useMemo)(()=>`qr-${(U||i||`seed`).slice(0,12)}-${gt}-${vt}`,[U,i,gt,vt]),[Ct,wt]=(0,K.useState)(!1),[Tt,Dt]=(0,K.useState)(null);(0,K.useEffect)(()=>{let e=!1;return(async()=>{try{if(!k){Dt(null);return}let t=k.stepsPerBeat??44,n=p(k.pulse,t),r=BC(k),i=zC(k.pulse,k.beat,n,String(k.chakraDay??``),r),a=await FC(i),o=await RC(a),s=typeof k.kaiSignature==`string`?k.kaiSignature.toLowerCase()===a.toLowerCase():!0,c=typeof k.userPhiKey==`string`?k.userPhiKey.toLowerCase()===o.toLowerCase():!0,l={pulse:k.pulse,beat:k.beat,stepsPerBeat:t,stepIndex:n,chakraDay:String(k.chakraDay??``),intention:r??null,sigmaString:i,sigmaHash:a,derivedPhiKey:o,payloadKaiSignature:k.kaiSignature??null,payloadUserPhiKey:k.userPhiKey??null,matches:{sigma:s,phi:c}};e||Dt(l)}catch{e||Dt(null)}})(),()=>{e=!0}},[k]);let Ot=le(()=>{IT({stageEl:document.getElementById(`sigil-stage`),payload:k,localHash:U,routeHash:i,qr:{uid:St,url:Qe,hue:xt,accent:bt},onToast:e=>SC(_,e)})}),[kt,At]=(0,K.useState)(!1),[jt,Mt]=(0,K.useState)(``),Nt=(0,K.useCallback)(async()=>{let e=b.current;e&&(Mt((await(0,dE.default)(e,{backgroundColor:null})).toDataURL(`image/png`)),At(!0),fC()||document.querySelector(`.stargate-overlay`)?.requestFullscreen?.().catch(()=>{}))},[]),Pt=(0,K.useCallback)(()=>{At(!1),document.fullscreenElement&&!fC()&&document.exitFullscreen?.().catch(()=>{})},[]),Ft=le(()=>{Nt()}),It=le(()=>{Pt()}),Lt=le(()=>wt(e=>!e)),Rt=le(()=>Ve(!0)),zt=(0,K.useCallback)(async e=>{let t=await e.arrayBuffer(),n=e.type||`application/octet-stream`,r=`data:${n};base64,${xC(t)}`;F({name:e.name,mime:n,size:e.size,dataUri:r}),SC(_,`Remembered ${e.name}`)},[]),Bt=(0,K.useCallback)((e,t)=>{let n=e.stepsPerBeat??44,r=p(e.pulse,n),a=(e.canonicalHash||U||``).toLowerCase(),o=e.claimExtendUnit,s=RE(o)?o:null,c=e.claimExtendAmount,l=typeof c==`number`?c:null,u=$T({pulse:e.pulse,beat:e.beat,chakraDay:e.chakraDay??`Root`,stepsPerBeat:n,stepIndex:r,userPhiKey:e.userPhiKey??null,kaiSignature:e.kaiSignature??null,canonicalHash:a,transferNonce:e.transferNonce??null,expiresAtPulse:e.expiresAtPulse??null,claimExtendUnit:s,claimExtendAmount:l},t,{localHash:U,routeHash:i,stepsPerBeat:44,stepIndexFromPulse:p})?.url||`/s/${a}`;try{let e=new URL(u,window.location.origin);e.pathname=`/s/${a}`;let t=new URLSearchParams(window.location.search).get(`d`);t&&e.searchParams.set(`d`,t),new URL(window.location.href).searchParams.forEach((t,n)=>{n!==`d`&&e.searchParams.set(n,e.searchParams.get(n)??t)}),u=e.toString()}catch{}let d=new URL(u,window.location.origin);d.pathname=`/s/${a}`,new URL(window.location.href).searchParams.forEach((e,t)=>{t!==`d`&&d.searchParams.set(t,d.searchParams.get(t)??e)});let f=wT(u)||a;return Oe(u),Ae(f),Ee(!0),u},[U,i]),Vt=(0,K.useCallback)((e,t,n=!0)=>{let a=e.stepsPerBeat??44,o=p(e.pulse,a),s=e.claimExtendUnit,c=RE(s)?s:`breaths`,l=e.claimExtendAmount,u=typeof l==`number`?l:11;return eE({pulse:e.pulse,beat:e.beat,chakraDay:e.chakraDay??`Root`,stepsPerBeat:a,stepIndex:o,userPhiKey:e.userPhiKey??null,kaiSignature:e.kaiSignature??null,canonicalHash:t,transferNonce:e.transferNonce??null,expiresAtPulse:e.expiresAtPulse??null,claimExtendUnit:c,claimExtendAmount:u},t,{localHash:U,routeHash:i,stepsPerBeat:44,stepIndexFromPulse:p,getKaiPulseEternalInt:IE,breathsToPulses:ue,shareTransferLink:$T,publishRotation:UE,navigate:e=>{if(n)try{r(e)}catch{try{window.location.href=e}catch{}}}})??null},[U,i,r]),Ht=(0,K.useCallback)(async e=>{if(f(!1),h(`Verifying…`),!(/image\/svg\+xml/i.test(e.type)||/\.svg$/i.test(e.name))){h(`Unsupported file. Upload an SVG sigil (.svg) only.`);return}let t=null;try{let{ok:n,errors:r,payload:i,meta:a}=he(await e.text());if(!n||!i){h(r[0]||`Invalid SVG.`);return}t=i,N(a||{})}catch{h(`Invalid or unreadable SVG uploaded.`);return}if(!k||!t){h(`Load or link a sigil first, then verify stewardship.`);return}if(!Ze(k,t)){h(`File does not match this sealed kairos moment.`),f(!1);return}if(t.canonicalHash){let e=t.canonicalHash.toLowerCase(),n=(U||``).toLowerCase(),r=(i||``).toLowerCase(),a=n&&e===n,o=r&&e===r;if(!a&&!o){h(`SVG canonicalHash doesn’t match this link’s hash.`),f(!1);return}if(o&&!a){Ue({reason:`svg.canonicalHash matched route (legacy)`,matchedHash:e}),u(`authentic`),c(`ok`),Me(`archived`),f(!0),h(`Stewardship verified (legacy SVG). Issuing modern link…`),n&&(Vt({...k},n,!0),h(`Legacy verified. Modern transfer link ready.`));return}}if(new Set([o??void 0,k.transferNonce??void 0,t.transferNonce??void 0,Ne??void 0].filter(e=>!!e)).size>1){h(`This is not the active transfer link for that Φkey.`),f(!1);return}f(!0),h(`Stewardship verified`)},[k,Ze,U,i,o,Ne,Vt]),Ut=le(async()=>{if(I)return;let e=b.current?.querySelector(`svg`),t=k??{},n=RE(t.claimExtendUnit)?t.claimExtendUnit:void 0,r=typeof t.claimExtendAmount==`number`?t.claimExtendAmount:null;await GT({expired:!!pt,exporting:I,setExporting:L,svgEl:e,payload:k?{pulse:k.pulse,beat:k.beat,chakraDay:k.chakraDay??null,stepsPerBeat:k.stepsPerBeat??void 0,stepIndex:k.stepIndex??null,exportedAtPulse:k.exportedAtPulse??null,canonicalHash:k.canonicalHash??null,userPhiKey:k.userPhiKey??null,kaiSignature:k.kaiSignature??null,transferNonce:k.transferNonce??null,expiresAtPulse:k.expiresAtPulse??null,claimExtendUnit:n,claimExtendAmount:r,attachment:k.attachment??null,provenance:k.provenance??null}:null,isFutureSealed:ht,linkStatus:je,setToast:e=>SC(_,e),expiryUnit:B,expiryAmount:ce,localHash:U,routeHash:i,transferToken:o??null,getKaiPulseEternalInt:IE,stepIndexFromPulse:p,STEPS_PER_BEAT:44})}),Wt=(0,K.useCallback)(e=>{let t=typeof e==`string`?e:e?.hash;if(!t)return;let n=t.toLowerCase();de(e=>e===n?e:n)},[]),Gt=D&&!k,Kt=s===`notfound`||s===`error`,qt=k?.pulse??0,Jt=k?.beat??0,Yt=((j??0)/1e3).toFixed(3),Xt=je===`archived`,Zt=d&&!Xt,Qt=(0,K.useMemo)(()=>l===`authentic`&&Xt&&!o&&!!i&&!!U&&i!==U,[l,Xt,o,i,U]);(0,K.useEffect)(()=>{if(!k||l!==`authentic`||s===`mismatch`||s===`error`||s===`notfound`)return;let e=!1;return(async()=>{try{let t=k.stepsPerBeat??44,n=p(k.pulse,t),r=BC(k),i=await FC(zC(k.pulse,k.beat,n,String(k.chakraDay??``),r)),a=typeof k.kaiSignature==`string`?k.kaiSignature.toLowerCase()===i.toLowerCase():!0,o=await RC(i),l=typeof k.userPhiKey==`string`?k.userPhiKey.toLowerCase()===o.toLowerCase():!0;!e&&a&&l&&s!==`verified`&&c(`verified`)}catch{}})(),()=>{e=!0}},[k,l,s,je]),(0,K.useEffect)(()=>{let e=(i||``).toLowerCase(),t=o||null,n=k?.transferNonce||null,r=!!t&&!!n&&t===n&&(ut==null||A==null||A{let e=!0;return(async()=>{if(!k){en(``),nn(``);return}let t=(k.canonicalHash||U||``).toLowerCase(),n=A||PE(),r=await JC(k,t,n,T(n),p(n,k.stepsPerBeat??44));e&&(en(r.ownerPhiKey),nn(r.kaiSig))})(),()=>{e=!1}},[k,U]);let rn=(0,K.useCallback)(async e=>{if(e?.preventDefault?.(),e?.stopPropagation?.(),!k||!U||ht||Xt)return;let t=(k.canonicalHash||U||``).toLowerCase(),n=A||PE(),r=await JC(k,t,n,T(n),p(n,k.stepsPerBeat??44));te(r.ownerPhiKey),re(r.kaiSig),setTimeout(()=>{try{sn()}catch{}},0)},[k,U,ht,Xt]),an=(0,K.useCallback)(e=>{let t=`/${e}`;try{window.location.assign(t)}catch{window.location.href=t}},[]),on=(0,K.useCallback)(async()=>{try{let e=await(await fetch(`/verifier.inline.html`,{cache:`no-store`})).text(),t=new Blob([e],{type:`text/html`}),n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=`verifier.html`,document.body.appendChild(n),n.click(),setTimeout(()=>{URL.revokeObjectURL(n.href),n.remove()},0),SC(_,`Downloading verifier…`)}catch{SC(_,`Download failed`)}},[]);({...Lt});let sn=(0,K.useCallback)(()=>{if(!k)return SC(_,`Nothing to mint`);let e=b.current?.querySelector(`svg`);if(!e)return SC(_,`No Φkey in frame`);if(!U)return SC(_,`Glyph hash not ready yet`);if(je!==`active`)return SC(_,`Archived link — cannot exhale from here`);if(ht)return SC(_,`Opens after the moment—claim unlocks then`);let t=rC(M??{},k.pulse),n=(R||k.userPhiKey||``).trim();if(!n)return SC(_,`Owner ΦKey required`);let r=Math.max(0,Math.floor(ce||0)),a=B===`breaths`?ue(r):fe(r),o=A||PE(),s=o+a,c=U.toLowerCase(),l=crypto.getRandomValues(new Uint32Array(4)).join(``),u=k.stepsPerBeat??44,d=p(k.pulse,u),f=p(o,u),m={...iC(n,z||k.kaiSignature,k,t.length?`transfer`:`mint`,(P??k.attachment)?.name,o),stepIndex:d,atStepIndex:f},h={...k,userPhiKey:n,kaiSignature:z||k.kaiSignature,stepsPerBeat:k.stepsPerBeat??44,attachment:P??k.attachment??void 0,expiresAtPulse:s,canonicalHash:c,transferNonce:l,claimExtendUnit:B,claimExtendAmount:r,provenance:[...t,m]};(async()=>{let t=await FC(zC(h.pulse,h.beat,d,String(h.chakraDay??``),BC(h))),n=await RC(t);h.kaiSignature=t,h.userPhiKey=h.userPhiKey||n;let r=Array.from(new Set([k.canonicalHash,i,U].filter(Boolean).map(e=>e.toLowerCase())));r.length&&UE(r,l),Me(`archived`),Le(FE()+250),pe(e,h),UC(e),E(h),N(h),SC(_,`Sealed & archived`);let a=Bt(h,l)||`/s/${c}`;a=await Fe(h,c,l,a,e),Oe(_E(a)),h.canonicalHash&&UE([h.canonicalHash.toLowerCase()],l),setTimeout(()=>Le(0),0)})()},[k,M,R,z,P,ce,B,U,i,je,ht,Bt]),cn=k,ln=(0,K.useMemo)(()=>xE(cn?.debits??[]),[cn?.debits]),un=(0,K.useMemo)(()=>{let e=(typeof cn?.originalAmount==`number`?cn.originalAmount:qe?.valuePhi??0)-ln;return e>0?e:0},[cn?.originalAmount,qe?.valuePhi,ln]),dn=(cn?.debits?.length??0)>0||typeof cn?.originalAmount==`number`,fn=(0,K.useMemo)(()=>dn?un:Je??qe?.valuePhi??0,[dn,un,Je,qe?.valuePhi]),pn=se,{usdPerPhi:mn,phiPerUsd:hn}=(0,K.useMemo)(()=>{try{let e=w({meta:k||{},nowPulse:A||A,usd:100,currentStreakDays:0,lifetimeUsdSoFar:0},pn);return{usdPerPhi:e.usdPerPhi??0,phiPerUsd:e.phiPerUsd??0}}catch{return{usdPerPhi:0,phiPerUsd:0}}},[k,A,pn]),gn=(fn??0)*(mn||0),_n=(0,K.useCallback)(async()=>{if(!k)return``;let e=k.stepsPerBeat??44,t=p(k.pulse,e);return await RC(k.kaiSignature??await FC(zC(k.pulse,k.beat,t,String(k.chakraDay??``),BC(k))))},[k]),[vn,yn]=(0,K.useState)([]),bn=(0,K.useCallback)(()=>{yn(WE(PT(k??null,U,He),FT(o,k??null)))},[k,U,He,o]);(0,K.useEffect)(()=>{bn();let e=null;try{e=new BroadcastChannel(zE),e.onmessage=e=>{let t=e.data;if(!t||t.type!==`descendants`)return;let n=PT(k??null,U,He),r=FT(o,k??null);!n||!r||t.canonical!==n.toLowerCase()||t.token!==r||Array.isArray(t.list)&&yn(t.list)}}catch{}let t=e=>{if(!e.key||!e.newValue)return;let t=PT(k??null,U,He),n=FT(o,k??null);if(!(!t||!n)&&e.key===BE(t,n))try{let t=JSON.parse(e.newValue||`[]`);Array.isArray(t)&&yn(t)}catch{}};return window.addEventListener(`storage`,t,{passive:!0}),()=>{if(e&&typeof e.close==`function`)try{e.close()}catch{}window.removeEventListener(`storage`,t)}},[k,U,He,o,bn]);let xn=(0,K.useCallback)(async(e,t)=>{if(!k)return null;let n=A||PE(),r=crypto.getRandomValues(new Uint32Array(4)).join(``),i=k.stepsPerBeat??44,a=p(k.pulse,i),s=(U||k.canonicalHash||``).toLowerCase(),c=t??FT(o,k??null),l=Array.isArray(k.lineage)?[...k.lineage]:[],u=(l[l.length-1]?.depth??0)+1,d={token:r,parentToken:c??null,amount:Number(e.toFixed(6)),timestamp:n,depth:u,senderPhiKey:k.userPhiKey??null},f={...k,userPhiKey:void 0,originalAmount:Number(e.toFixed(6)),mintedAtPulse:n,transferNonce:r,expiresAtPulse:n+(B===`breaths`?ue(ce):fe(ce)),claimExtendUnit:B,claimExtendAmount:ce,canonicalHash:s,lineage:[...l,d]},m=await FC(zC(f.pulse,f.beat,a,String(f.chakraDay??``),BC(f))),h=await RC(m);f.kaiSignature=m,f.userPhiKey=h;let g=Bt(f,r)||`/s/${s}`;try{let t=new URL(g,window.location.origin);t.pathname=`/s/${s}`,t.searchParams.set(`d`,pT({originalAmount:f.originalAmount}));let i=NT(t.toString(),f);i=await Fe(f,s,r,i);let a=wT(i)||s;vT(a,hT(new URL(i).searchParams.get(`d`))??{},r);let o=PT(k??null,U,He),l=c??null;if(o&&l){let t=[...WE(o,l),{token:r,parentToken:l,amount:Number(e.toFixed(6)),timestamp:n,depth:1,recipientPhiKey:f.userPhiKey}];GE(o,l,t),KE(o,l,t),yn(t)}return Oe(_E(i)),Ae(a),Ee(!0),i}catch{let e=NT(g||`/s/${s}`,f);return Oe(e),Ae(s),Ee(!0),e||null}},[k,B,ce,U,Bt,He,o]);(0,K.useEffect)(()=>{let e=e=>{if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase();return t===`input`||t===`textarea`||e.isContentEditable},t=t=>{if(t.defaultPrevented||e(t.target))return;let n=t.key.toLowerCase();t.metaKey||t.ctrlKey||t.altKey||(n===`s`?tt():n===`l`?et(Qe,`Link copied`):n===`h`?U&&et(U,`Hash copied`):n===`z`?Ut.onClick?.(new MouseEvent(`click`)):n===`p`?Ot.onClick?.(new MouseEvent(`click`)):n===`g`&&Nt())};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[tt,et,Qe,U,Ut,Ot,Nt]);let Sn=(0,K.useCallback)(e=>{let t=e?.silent??!0;if(!PT(k??null,U,He))return null;let n=FT(o,k??null);if(n)return n;n=crypto.getRandomValues(new Uint32Array(4)).join(``);try{let e=new URL(window.location.href);e.searchParams.set(`t`,n),t?window.history.replaceState(null,``,`${e.pathname}${e.search}${e.hash}`):r(`${e.pathname}${e.search}${e.hash}`,{replace:!0})}catch{}return E(e=>e&&{...e,transferNonce:n}),Me(`active`),n},[k,U,He,o,E,r,Me]),[Cn,wn]=(0,K.useState)(0),Tn=(0,K.useCallback)(async()=>{if(!Zt)return SC(_,`Verify Stewardship first`);if(!k)return SC(_,`No payload`);if(W)return;let e=A||PE(),t=Number(Cn)||0;if(t<=0)return SC(_,`Enter an amount > 0`);let n=PT(k??null,U,He),r=FT(o,k??null);if(r||=Sn({silent:!0})||null,!n||!r)return SC(_,`Link not initialized`);if(Ne&&Ne!==r)return SC(_,`Archived link — cannot exhale from here`);G(!0);let{ok:i,id:a}=vE(n,r,e);if(me.current=a,!i)return G(!1),SC(_,`Another exhale is in progress`);try{let{merged:e}=CT(n,new URLSearchParams(window.location.search),r),i=wE({originalAmount:typeof e.originalAmount==`number`?e.originalAmount:typeof k?.originalAmount==`number`?k.originalAmount:qe?.valuePhi??0,debits:Array.isArray(e.debits)?e.debits:[]});if(t>Math.max(0,(i.originalAmount??0)-xE(i.debits||[]))+fE)return SC(_,`Amount exceeds available`);let a=await _n();if(!a)return SC(_,`Could not derive Φkey`);let o={amount:Number(t.toFixed(6)),nonce:crypto.getRandomValues(new Uint32Array(4)).join(``),recipientPhiKey:a,timestamp:A||PE()};ST(wE({originalAmount:i.originalAmount,debits:[...i.debits??[],o]}),n,r,{broadcast:!0});let{merged:s}=CT(n,new URLSearchParams(window.location.search),r),c=wE(s);if(!(c.debits??[]).some(e=>e.nonce===o.nonce)){SC(_,`Exhale conflicted — try again`);return}E(e=>{if(!e)return e;let t={...e};return t.originalAmount=typeof c.originalAmount==`number`?c.originalAmount:typeof t.originalAmount==`number`?t.originalAmount:qe?.valuePhi??0,t.debits=Array.isArray(c.debits)?c.debits:[],t.totalDebited=xE(t.debits),t}),wn(0),SC(_,`Sent ${AC(o.amount)} Φ`),xn(o.amount,r)}finally{yE(n,r,me.current,A),G(!1)}},[Zt,k,k?.originalAmount,qe?.valuePhi,Cn,Ne,U,He,o,E,_n,xn,wn,W,Sn]),En=Ct||Re||kt||Te||be&&Qt;(0,K.useEffect)(()=>{let e=`bp-open`;return En?document.body.classList.add(e):document.body.classList.remove(e),()=>document.body.classList.remove(e)},[En]);let[Dn,On]=(0,K.useState)(!1),kn=(0,K.useCallback)(()=>{On(!0),window.setTimeout(()=>On(!1),2e3)},[]),An=le(()=>{et(U||``,`Hash copied`)}),jn=le(async()=>{await et(Qe,`Link copied`)&&kn()}),Mn=le(()=>{tt()}),Nn=(0,q.jsxs)(ye,{frameRef:b,children:[!Gt&&!Kt&&k&&(0,q.jsx)(`div`,{id:`sigil-stage`,style:{position:`relative`,width:v,height:v,margin:`0 auto`},children:(0,q.jsx)(ne,{pulse:qt,beat:Jt,stepPct:yt,chakraDay:gt,size:v,hashMode:`deterministic`,origin:``,onReady:Wt})}),Gt&&(0,q.jsx)(`div`,{className:`sp-skeleton`,"aria-hidden":`true`}),Kt&&(0,q.jsx)(`div`,{className:`sp-error`,children:s===`notfound`?`Waiting for SVG upload or ?p= payload.`:`Unable to load sigil.`})]}),Pn=k?.lineage??[],Fn=(0,K.useCallback)((e,t)=>{let n=e=>typeof e==`object`&&!!e,r=e=>{if(typeof t==`string`)return t;if(!n(e))return``;let r=typeof e.reason==`string`?e.reason:``,i=n(e.detail)?e.detail:null,a=i&&typeof i.reason==`string`?i.reason:``;return r||a||``},i=e=>{if(!n(e))return null;let t=e.target;return t instanceof HTMLElement?t:null},a=r(e),o=i(e),s=a===`closeClick`||a===`close-button`||a===`explicit`||a===`close`,c=!!o?.closest?.(`[data-modal-close],[data-close],.sealmoment__close,.sp-modal__close,button[aria-label="Close"],button[aria-label="close"],button[title="Close"]`);if(s||c||e==null&&t==null){Ee(!1),Oe(``),Ae(``);return}},[]);return(0,q.jsxs)(`main`,{className:`sigilpage`,role:`main`,"aria-label":`Kai Sigil Page`,"data-owner-verified":Zt,"data-archived":Xt,"data-old-link":ct?`true`:`false`,"data-version":`v48`,children:[(0,q.jsx)(`div`,{className:`sp-veil`,"aria-hidden":`true`}),(0,q.jsx)(`div`,{className:`sp-veil-stars`,"aria-hidden":`true`}),(0,q.jsx)(`div`,{className:`sp-viewport`,"aria-hidden":!1,children:(0,q.jsxs)(`section`,{className:`sp-shell`,"data-center":!0,children:[(0,q.jsx)(ve,{glyphAuth:l,linkStatus:je,isArchived:Xt,localHash:U,copyHashPress:An}),(l===`authentic`||s===`verified`)&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`style`,{children:` +`;return typeof a==`function`&&a(null,p),p}})),Qw=k(a((e=>{var t=Tw(),n=Jw(),r=Xw(),i=Zw();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))(),1);const $w=1024,eT=2048,tT=1200;function nT(e,t){let n=e.querySelector(`defs`);n||(n=e.ownerDocument.createElementNS(me.SVG_NS,`defs`),e.insertBefore(n,e.firstChild));let r=`ep-neon-glow`;if(!e.querySelector(`#${r}`)){let t=e.ownerDocument.createElementNS(me.SVG_NS,`filter`);t.setAttribute(`id`,r),t.setAttribute(`x`,`-50%`),t.setAttribute(`y`,`-50%`),t.setAttribute(`width`,`200%`),t.setAttribute(`height`,`200%`);let i=e.ownerDocument.createElementNS(me.SVG_NS,`feGaussianBlur`);i.setAttribute(`stdDeviation`,`3`),i.setAttribute(`result`,`b1`);let a=e.ownerDocument.createElementNS(me.SVG_NS,`feGaussianBlur`);a.setAttribute(`in`,`SourceGraphic`),a.setAttribute(`stdDeviation`,`1.2`),a.setAttribute(`result`,`b2`);let o=e.ownerDocument.createElementNS(me.SVG_NS,`feMerge`),s=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);s.setAttribute(`in`,`b1`);let c=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);c.setAttribute(`in`,`b2`);let l=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);l.setAttribute(`in`,`SourceGraphic`),o.appendChild(s),o.appendChild(c),o.appendChild(l),t.appendChild(i),t.appendChild(a),t.appendChild(o),n.appendChild(t)}let i=`ep-gloss-gradient`;if(!e.querySelector(`#${i}`)){let t=e.ownerDocument.createElementNS(me.SVG_NS,`linearGradient`);t.setAttribute(`id`,i),t.setAttribute(`x1`,`0`),t.setAttribute(`y1`,`0`),t.setAttribute(`x2`,`0`),t.setAttribute(`y2`,`1`);let r=e.ownerDocument.createElementNS(me.SVG_NS,`stop`);r.setAttribute(`offset`,`0%`),r.setAttribute(`stop-color`,`rgba(255,255,255,0.15)`);let a=e.ownerDocument.createElementNS(me.SVG_NS,`stop`);a.setAttribute(`offset`,`100%`),a.setAttribute(`stop-color`,`rgba(255,255,255,0.05)`),t.appendChild(r),t.appendChild(a),n.appendChild(t)}let a=`ep-bar-outer-glow`;if(!e.querySelector(`#${a}`)){let r=e.ownerDocument.createElementNS(me.SVG_NS,`filter`);r.setAttribute(`id`,a),r.setAttribute(`x`,`-50%`),r.setAttribute(`y`,`-50%`),r.setAttribute(`width`,`200%`),r.setAttribute(`height`,`200%`);let i=e.ownerDocument.createElementNS(me.SVG_NS,`feFlood`);i.setAttribute(`flood-color`,t),i.setAttribute(`flood-opacity`,`0.5`),i.setAttribute(`result`,`c`);let o=e.ownerDocument.createElementNS(me.SVG_NS,`feComposite`);o.setAttribute(`in`,`c`),o.setAttribute(`in2`,`SourceAlpha`),o.setAttribute(`operator`,`in`),o.setAttribute(`result`,`glow`);let s=e.ownerDocument.createElementNS(me.SVG_NS,`feGaussianBlur`);s.setAttribute(`in`,`glow`),s.setAttribute(`stdDeviation`,`4`),s.setAttribute(`result`,`blurGlow`);let c=e.ownerDocument.createElementNS(me.SVG_NS,`feMerge`),l=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);l.setAttribute(`in`,`blurGlow`);let u=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);u.setAttribute(`in`,`SourceGraphic`),c.appendChild(l),c.appendChild(u),r.appendChild(i),r.appendChild(o),r.appendChild(s),r.appendChild(c),n.appendChild(r)}return{neonId:`ep-neon-glow`,glossId:`ep-gloss-gradient`,barGlowId:`ep-bar-outer-glow`}}async function rT(e,t){let{accent:n,qrUrl:r}=t,i=(e.getAttribute(`viewBox`)||`0 0 ${e.getAttribute(`width`)||1024} ${e.getAttribute(`height`)||1024}`).trim().split(/\s+/).map(Number),a=i[0]||0,o=i[1]||0,s=i[2]||1024,c=i[3]||1024,l=e.ownerDocument.createElementNS(me.SVG_NS,`g`);l.setAttribute(`data-export-qr`,`1`);let u=Math.min(s,c),d=Math.max(u*.035,18),f=Math.max(u*.1,96),p=await Qw.toDataURL(r,{margin:0,color:{dark:n,light:`#00000000`},scale:8}),m=e.ownerDocument.createElementNS(me.SVG_NS,`image`);m.setAttributeNS(me.XLINK_NS,`xlink:href`,p),m.setAttribute(`href`,p),m.setAttribute(`x`,String(a+d)),m.setAttribute(`y`,String(o+c-f-d)),m.setAttribute(`width`,String(f)),m.setAttribute(`height`,String(f)),m.setAttribute(`preserveAspectRatio`,`xMidYMid meet`),l.appendChild(m),e.appendChild(l)}async function iT(e,t=$w,n){let r=e.cloneNode(!0);if(de(r,t),H(r),G(r,n?.title||`Kairos Sigil-Glyph — Sealed Kairos Moment`,n?.desc||`Deterministic sigil-glyph with sovereign metadata.`),n?.metaOverride){let e=W(r);e.textContent=JSON.stringify(n.metaOverride)}if(r.querySelectorAll(`[data-export-qr="1"],[data-export-pulsebar="1"]`).forEach(e=>e.parentNode?.removeChild(e)),n?.addQR&&await rT(r,n.addQR),n?.addPulseBar){let{accent:e,pulseNumber:i}=n.addPulseBar,{barGlowId:a,neonId:o,glossId:s}=nT(r,e),c=(r.getAttribute(`viewBox`)||`0 0 ${t} ${t}`).split(/\s+/).map(Number),[l,u,d,f]=[c[0]||0,c[1]||0,c[2]||t,c[3]||t],p=r.ownerDocument.createElementNS(me.SVG_NS,`g`);p.setAttribute(`data-export-pulsebar`,`1`);let m=Math.min(d,f),h=Math.max(m*.035,18),g=Math.max(m*.34,320),_=Math.max(m*.085,96),v=Math.max(_*.22,18),y=l+d-g-h,b=u+f-_-h,x=r.ownerDocument.createElementNS(me.SVG_NS,`rect`);x.setAttribute(`x`,String(y)),x.setAttribute(`y`,String(b)),x.setAttribute(`rx`,String(v)),x.setAttribute(`ry`,String(v)),x.setAttribute(`width`,String(g)),x.setAttribute(`height`,String(_)),x.setAttribute(`fill`,`url(#${s})`),x.setAttribute(`stroke`,`rgba(255,255,255,0.16)`),x.setAttribute(`stroke-width`,String(Math.max(1.5,m*.0018))),x.setAttribute(`filter`,`url(#${a})`),p.appendChild(x);let S=r.ownerDocument.createElementNS(me.SVG_NS,`text`);S.setAttribute(`x`,String(y+g/2)),S.setAttribute(`y`,String(b+_/2+Math.max(6,_*.06))),S.setAttribute(`text-anchor`,`middle`),S.setAttribute(`dominant-baseline`,`middle`),S.setAttribute(`fill`,e),S.setAttribute(`filter`,`url(#${o})`),S.setAttribute(`font-weight`,`900`),S.setAttribute(`font-family`,`Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto, Helvetica Neue, Arial`),S.setAttribute(`font-size`,String(Math.floor(_*.46))),S.textContent=i.toLocaleString(),p.appendChild(S),r.appendChild(p)}let i=new XMLSerializer().serializeToString(r),a=i.startsWith(`\n${i}`;return new Blob([a],{type:`image/svg+xml;charset=utf-8`})}async function aT(e,t=$w){let n=URL.createObjectURL(e);try{let e=new Image;await new Promise((t,r)=>{e.onload=()=>t(),e.onerror=r,e.src=n});let r=document.createElement(`canvas`);r.width=t,r.height=t;let i=r.getContext(`2d`);if(!i)throw Error(`Canvas unsupported`);return i.drawImage(e,0,0,t,t),await new Promise((e,t)=>r.toBlob(n=>n?e(n):t(Error(`PNG encode failed`)),`image/png`))}finally{URL.revokeObjectURL(n)}}var oT=()=>{let e=N();return e<=0n?0:e>BigInt(2**53-1)?2**53-1:Number(e)};const sT=`sigil-debits-v1`,cT=(e,t)=>t?`sigil:debits:${e}:t:${t}`:`sigil:debits:${e}`,lT=(e,t)=>e===cT(t)||e.startsWith(`${cT(t)}:t:`),uT=(e,t)=>{let n=`sigil:debits:${t}`;if(e===n)return null;let r=`${n}:t:`;return e.startsWith(r)?e.slice(r.length):void 0};function dT(e){let t=new TextEncoder().encode(e),n=``;for(let e=0;e0&&typeof t.recipientPhiKey==`string`&&t.recipientPhiKey.length>0&&typeof t.amount==`number`&&Number.isFinite(t.amount)&&t.amount>0&&typeof t.timestamp==`number`&&Number.isFinite(t.timestamp)}function hT(e){if(!e)return null;try{let t=JSON.parse(fT(e));if(typeof t!=`object`||!t)return null;let n={},r=t;if(typeof r.originalAmount==`number`&&Number.isFinite(r.originalAmount)&&(n.originalAmount=r.originalAmount),Array.isArray(r.debits)){let e=[];for(let t of r.debits)mT(t)&&e.push(t);e.length&&(n.debits=e)}return n}catch{return null}}function gT(e,t){try{let n=new URL(window.location.href),r=typeof e.originalAmount==`number`&&Number.isFinite(e.originalAmount),i=Array.isArray(e.debits)&&e.debits.length>0;!r&&!i?n.searchParams.delete(`d`):n.searchParams.set(`d`,pT(e));let a=`${n.pathname}${n.search}${n.hash}`;t?.navigate?window.location.replace(a):window.history.replaceState(null,``,a)}catch{}}function _T(e,t){let n=(e||``).toLowerCase();if(!n)return null;try{let e=t?localStorage.getItem(cT(n,t)):null;if(e)return hT(e);let r=localStorage.getItem(cT(n));return r?hT(r):null}catch{return null}}function vT(e,t,n){let r=(e||``).toLowerCase();if(r)try{localStorage.setItem(cT(r,n??null),pT(t))}catch{}}function yT(e){let t=new Set,n=[];for(let r of e)!r||typeof r.nonce!=`string`||t.has(r.nonce)||(t.add(r.nonce),n.push(r));return n.sort((e,t)=>(e.timestamp||0)-(t.timestamp||0))}function bT(e,t){let n={},r=typeof e?.originalAmount==`number`?e.originalAmount:void 0,i=typeof t?.originalAmount==`number`?t.originalAmount:void 0;n.originalAmount=typeof r==`number`?r:typeof i==`number`?i:void 0;let a=Array.isArray(e?.debits)?e.debits:[],o=Array.isArray(t?.debits)?t.debits:[],s=yT([...a,...o]);return s.length&&(n.debits=s),n}function xT(e,t){let n=typeof e?.originalAmount==`number`&&Number.isFinite(e.originalAmount)?Number(e.originalAmount):NaN,r=typeof t?.originalAmount==`number`&&Number.isFinite(t.originalAmount)?Number(t.originalAmount):NaN,i=Number.isNaN(n)&&Number.isNaN(r)||Math.abs(n-r)<1e-12,a=new Set((Array.isArray(e?.debits)?e.debits:[]).map(e=>e?.nonce)),o=new Set((Array.isArray(t?.debits)?t.debits:[]).map(e=>e?.nonce));if(!i||a.size!==o.size)return!1;for(let e of a)if(!o.has(e))return!1;return!0}function ST(e,t,n,r){gT(e,{navigate:!!r?.navigate});let i=(t||``).toLowerCase();if(i&&(vT(i,e,n??null),r?.broadcast!==!1))try{let t=new BroadcastChannel(sT),r={type:`debits`,canonical:i,qs:pT(e),stamp:oT(),token:n??null};t.postMessage(r),t.close()}catch{}}function CT(e,t,n){let r=hT(t.get(`d`)),i=bT(n?_T(e,n):_T(e,null),r);return{merged:i,urlIsStale:!xT(i,r)}}function wT(e){try{let t=new URL(e,window.location.origin).pathname.match(/\/s\/([0-9a-fA-F]+)/);return t?t[1].toLowerCase():null}catch{return null}}function TT(e){if(typeof e==`string`)switch(e.trim().toLowerCase().replace(/\s+/g,` `)){case`root`:return`Root`;case`sacral`:return`Sacral`;case`solar plexus`:case`solarplexus`:return`Solar Plexus`;case`heart`:return`Heart`;case`throat`:return`Throat`;case`third eye`:case`thirdeye`:return`Third Eye`;case`crown`:return`Crown`;default:return}}function ET(e){return e===`breaths`||e===`steps`?e:void 0}var DT=e=>!!e&&typeof e==`object`,OT=e=>{if(!DT(e))return!1;let t=`u`in e&&`b`in e,n=`d`in e;return t||n},kT=e=>typeof e==`number`&&Number.isFinite(e)?e:void 0,AT=e=>typeof e==`string`&&e.trim()?e:void 0;function jT(e){if(!e)return{};try{let t=String(e).trim(),n=!1;/^c:/i.test(t)&&(t=t.slice(2),n=!0);let r=JSON.parse(fT(t));if(n||OT(r)){let e=r,t={},n=kT(e.u),i=kT(e.b),a=kT(e.d),o=kT(e.s),s=TT(e.c);return n!==void 0&&(t.pulse=n),i!==void 0&&(t.beat=i),a!==void 0&&(t.stepsPerBeat=a),o!==void 0&&(t.stepIndex=o),s!==void 0&&(t.chakraDay=s),t}if(DT(r)){let e=r,t={},n=kT(e.pulse),i=kT(e.beat),a=kT(e.stepsPerBeat),o=kT(e.stepIndex),s=TT(e.chakraDay),c=AT(e.canonicalHash),l=AT(e.kaiSignature),u=AT(e.userPhiKey),d=AT(e.transferNonce),f=kT(e.expiresAtPulse),p=ET(e.claimExtendUnit),m=kT(e.claimExtendAmount);return n!==void 0&&(t.pulse=n),i!==void 0&&(t.beat=i),a!==void 0&&(t.stepsPerBeat=a),o!==void 0&&(t.stepIndex=o),s!==void 0&&(t.chakraDay=s),c!==void 0&&(t.canonicalHash=c.toLowerCase()),l!==void 0&&(t.kaiSignature=l),u!==void 0&&(t.userPhiKey=u),d!==void 0&&(t.transferNonce=d),f!==void 0&&(t.expiresAtPulse=f),p!==void 0&&(t.claimExtendUnit=p),m!==void 0&&(t.claimExtendAmount=m),Array.isArray(e.lineage)&&(t.lineage=e.lineage),t}return{}}catch{return{}}}function MT(e,t){let n={...e};typeof t.expiresAtPulse==`number`&&(n.expiresAtPulse=t.expiresAtPulse),t.claimExtendUnit!=null&&(n.claimExtendUnit=t.claimExtendUnit),typeof t.claimExtendAmount==`number`&&(n.claimExtendAmount=t.claimExtendAmount),typeof t.pulse==`number`&&(n.pulse=t.pulse),typeof t.beat==`number`&&(n.beat=t.beat),typeof t.stepsPerBeat==`number`&&(n.stepsPerBeat=t.stepsPerBeat),t.chakraDay!==void 0&&(n.chakraDay=t.chakraDay),t.canonicalHash&&(n.canonicalHash=String(t.canonicalHash).toLowerCase()),t.kaiSignature&&(n.kaiSignature=t.kaiSignature),t.userPhiKey&&(n.userPhiKey=t.userPhiKey),t.transferNonce&&(n.transferNonce=t.transferNonce),Array.isArray(t.lineage)&&(n.lineage=t.lineage);let r=typeof n.stepsPerBeat==`number`&&Number.isFinite(n.stepsPerBeat)?n.stepsPerBeat:44,i=kT(t?.stepIndex),a=kT(n.stepIndex);return i===void 0?a===void 0?typeof n.pulse==`number`&&Number.isFinite(n.pulse)&&(n.stepIndex=p(n.pulse,r)):n.stepIndex=a:n.stepIndex=i,n}function NT(e,t){try{let n=new URL(e,window.location.origin),r=MT(jT(n.searchParams.get(`p`)),t);return r.canonicalHash&&=String(r.canonicalHash).toLowerCase(),n.searchParams.set(`p`,dT(JSON.stringify(r))),n.toString()}catch{return e}}function PT(e,t,n){let r=[e?.canonicalHash,t,n?.matchedHash];for(let e of r)if(typeof e==`string`&&e.trim())return e.toLowerCase();return null}function FT(e,t){return typeof e==`string`&&e.trim()?e:typeof t?.transferNonce==`string`&&t.transferNonce.trim()?t.transferNonce:null}async function IT(t){let{stageEl:n,payload:r,localHash:i,routeHash:a,qr:o,onToast:s}=t;if(!n)return s(`No stage found`);try{let t=(await m(async()=>{let{default:t}=await import(`./html2canvas-2MVuntwP.js`).then(e(1));return{default:t}},__vite__mapDeps([0,1,2,3]))).default,l=await t(n,{backgroundColor:null}),u=document.createElement(`canvas`);u.width=eT,u.height=eT;let d=u.getContext(`2d`);if(!d)throw Error(`No canvas context`);d.clearRect(0,0,u.width,u.height);let f=Math.floor(eT*.06),p=eT-f*2,h=eT-f*2,g=l.width,_=l.height,v=Math.min(p/g,h/_),y=Math.floor(g*v),b=Math.floor(_*v),x=Math.floor((eT-y)/2),S=Math.floor((eT-b)/2);d.drawImage(l,x,S,y,b);let C=r?.chakraDay??`Throat`,w=dC[C]?.accent||`#00FFD0`,T=kC(C,typeof r?.stepPct==`number`?r.stepPct:r?r.pulse%11/11:0,i||void 0),E=Math.max(eT*.33,720),D=Math.max(eT*.08,160),O=Math.max(D*.24,30),k=eT-E-f,A=eT-D-f;d.save(),d.shadowColor=w,d.shadowBlur=Math.max(18,Math.floor(eT*.012));let j=d.createLinearGradient(0,A,0,A+D);j.addColorStop(0,`rgba(255,255,255,0.16)`),j.addColorStop(1,`rgba(255,255,255,0.05)`),c(d,k,A,E,D,O),d.fillStyle=j,d.fill(),d.shadowBlur=0,d.lineWidth=Math.max(2,Math.floor(eT*.0016)),d.strokeStyle=`rgba(255,255,255,0.18)`,d.stroke();let M=(r?.pulse??0).toLocaleString();d.textBaseline=`alphabetic`,d.fillStyle=T,d.font=`900 ${Math.floor(D*.48)}px Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto, Helvetica Neue, Arial`,d.shadowColor=T,d.shadowBlur=Math.max(16,Math.floor(eT*.008));let N=d.measureText(M).width,P=Math.floor(k+E/2-N/2),F=Math.floor(A+D/2+D*.18);d.fillText(M,P,F),d.restore();let I=Math.floor(eT*.32),ee=Math.floor((eT-I)/2),L=Math.floor((eT-I)/2),R=LT({provided:o.url,payload:r,localHash:i,routeHash:a}),te=(0,ZC.renderToStaticMarkup)((0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 1000 1000`,children:(0,q.jsx)(ww,{uid:o.uid,url:R,size:800,phaseHue:o.hue,phaseColor:o.accent,animate:!1,pulseMs:5236})})),z=new Blob([te],{type:`image/svg+xml;charset=utf-8`}),ne=URL.createObjectURL(z);await new Promise((e,t)=>{let n=new Image;n.onload=()=>{try{d.drawImage(n,ee,L,I,I)}finally{URL.revokeObjectURL(ne),e()}},n.onerror=e=>{URL.revokeObjectURL(ne),t(e)},n.src=ne});let re=u.toDataURL(`image/png`),B=document.createElement(`a`);B.href=re,B.download=`sigil_poster_${(i||a||`mint`).slice(0,16)}.png`,document.body.appendChild(B),B.click(),B.remove(),s(`Public key PNG saved`)}catch(e){console.error(e),s(`Poster export failed`)}function c(e,t,n,r,i,a){e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath()}}function LT(e){let{provided:t,payload:n,localHash:r,routeHash:i}=e,a=t&&RT(t)?t:(typeof window<`u`?window.location.href:``)||``;if(!n)return a;try{let e=(n.canonicalHash||r||i||``).toLowerCase();if(!e)return a;let t=new URL(a,typeof window<`u`?window.location.origin:`https://local.test`);t.pathname=`/s/${e}`;let o=n.transferNonce||t.searchParams.get(`t`);o&&t.searchParams.set(`t`,o);let s=`${t.pathname}${t.search}${t.hash}`;return NT(s,n)||s}catch{return a}}function RT(e){try{let t=new URL(e,typeof window<`u`?window.location.origin:`https://local.test`);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function zT(e){let t=JSON.stringify(e);return btoa(unescape(encodeURIComponent(t))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function BT(e,t,n){let r=new URL(e,typeof window<`u`?window.location.origin:`http://localhost`);return r.searchParams.set(`p`,zT(t)),n&&r.searchParams.set(`t`,n),r.toString()}function VT(e){switch(String(e??``).trim().toLowerCase()){case`root`:return`Root`;case`sacral`:return`Sacral`;case`solar plexus`:case`solar_plexus`:case`solar-plexus`:return`Solar Plexus`;case`heart`:return`Heart`;case`throat`:return`Throat`;case`third eye`:case`third_eye`:case`third-eye`:return`Third Eye`;case`crown`:return`Crown`;default:return`Root`}}function HT(e,t){let n={pulse:e.pulse,beat:e.beat,chakraDay:VT(e.chakraDay),stepsPerBeat:e.stepsPerBeat??void 0,stepIndex:t,userPhiKey:e.userPhiKey??void 0,kaiSignature:e.kaiSignature??void 0,canonicalHash:e.canonicalHash??void 0,transferNonce:e.transferNonce??void 0,expiresAtPulse:e.expiresAtPulse??void 0,claimExtendUnit:e.claimExtendUnit??void 0,claimExtendAmount:e.claimExtendAmount??void 0,attachment:e.attachment??void 0,provenance:e.provenance??void 0};return Object.keys(n).forEach(e=>{n[e]===void 0&&delete n[e]}),n}function UT(e){return{pulse:e.pulse,beat:e.beat,stepIndex:e.stepIndex,chakraDay:VT(e.chakraDay),stepsPerBeat:e.stepsPerBeat??void 0,userPhiKey:e.userPhiKey??void 0,kaiSignature:e.kaiSignature??void 0}}function WT(e,t){e.setAttribute(`data-share-url`,t),e.querySelectorAll(`a`).forEach(e=>{e.setAttribute(`href`,t);try{e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,t)}catch{}});let n=/\bu=([^·\n\r]+?)(?=\s*·|$)/;e.querySelectorAll(`text`).forEach(e=>{let r=e.textContent||``;n.test(r)&&(e.textContent=r.replace(n,`u=${t}`))})}async function GT(e){let{expired:t,exporting:n,setExporting:r,svgEl:i,payload:a,isFutureSealed:o,linkStatus:c,setToast:l,expiryUnit:u,expiryAmount:d,localHash:f,routeHash:p,transferToken:h,getKaiPulseEternalInt:g,stepIndexFromPulse:_,STEPS_PER_BEAT:v}=e;if(t)return SC(l,`Seal window closed`);if(!n){if(!i)return SC(l,`No SVG found`);if(!a)return SC(l,`No payload`);if(o)return SC(l,`Opens after the moment—claim unlocks then`);if(c!==`active`)return SC(l,`Archived link — cannot claim from here`);try{r(!0);let e=`sigil_${(f||p||`mint`).slice(0,16)}`,t=a.stepsPerBeat??v,n=_(a.pulse,t),o=g(new Date),c=_(o,t),y=HT(a,n),b={...iC(a.userPhiKey||``,a.kaiSignature??void 0,y,`claim`,a.attachment?.name??void 0,o),stepIndex:n,atStepIndex:c},x={...a,exportedAtPulse:o,stepIndex:n,stepsPerBeat:t,provenance:[...a.provenance??[],b],claimExtendUnit:a.claimExtendUnit??u,claimExtendAmount:a.claimExtendAmount??d,canonicalHash:(f||a.canonicalHash||p||null)?.toString()??null},S=await FC(zC(x.pulse,x.beat,n,String(x.chakraDay??``),BC(HT(x,n)))),C=await RC(S),w={...x,kaiSignature:S,userPhiKey:x.userPhiKey||C},T=(f||p||``).toLowerCase(),E=UT({pulse:w.pulse,beat:w.beat,stepIndex:n,chakraDay:w.chakraDay??null,stepsPerBeat:t,userPhiKey:w.userPhiKey??null,kaiSignature:w.kaiSignature??null}),D=BT(s(T,E),E,w.transferNonce??h??void 0),{putMetadata:O}=await m(async()=>{let{putMetadata:e}=await import(`./svgMeta-ADMUtfmL.js`);return{putMetadata:e}},__vite__mapDeps([4,5,2,3])),k={...w,stepsPerBeat:t,shareUrl:D,fullUrl:D};O(i,k);try{i.setAttribute(`data-step-index`,String(n));let e=i.querySelector(`metadata#sigil-display`);e||(e=document.createElementNS(`http://www.w3.org/2000/svg`,`metadata`),e.setAttribute(`id`,`sigil-display`),e.setAttribute(`data-noncanonical`,`1`),i.appendChild(e)),e.textContent=JSON.stringify({stepIndex:n,stepsPerBeat:t})}catch{console.debug(`Display metadata write failed`)}KC(i,w.pulse,w.beat,n),UC(i),WT(i,D);let A=null,j=null;try{let e=new URL(D);A=e.searchParams.get(`p`),j=e.searchParams.get(`t`)}catch{console.debug(`URL parse failed`)}let M=await iT(i,$w,{metaOverride:k,addQR:!1,addPulseBar:!1,title:`Kairos Sigil-Glyph — Sealed KairosMoment`,desc:`Deterministic sigil-glyph with sovereign metadata. Exported as archived key.`}),N=await aT(M,$w),P=new(await(CC()));P.file(`${e}.svg`,M),P.file(`${e}.png`,N);let F={hash:f||p||``,canonicalHash:w.canonicalHash??null,pulse:w.pulse,beat:w.beat,stepIndex:n,atStepIndex:c,chakraDay:w.chakraDay??null,userPhiKey:w.userPhiKey??null,kaiSignature:w.kaiSignature??null,transferNonce:w.transferNonce??null,expiresAtPulse:w.expiresAtPulse??null,exportedAtPulse:w.exportedAtPulse??null,claimedAtPulse:o,overlays:{qr:!1,eternalPulseBar:!1},claimExtendUnit:w.claimExtendUnit??null,claimExtendAmount:w.claimExtendAmount??null,fullUrl:D,p:A,urlQuery:{p:A,t:j}};P.file(`${e}.manifest.json`,JSON.stringify(F,null,2));let I=await P.generateAsync({type:`blob`}),ee=URL.createObjectURL(I),L=document.createElement(`a`);L.href=ee,L.download=`${e}.zip`,document.body.appendChild(L),L.click(),L.remove(),requestAnimationFrame(()=>URL.revokeObjectURL(ee)),SC(l,`Access key generated`)}catch(e){console.error(e),SC(l,`Claim failed`)}finally{r(!1)}}}function KT(){return(0,K.useMemo)(()=>async e=>{let t=new TextEncoder().encode(e),n=await crypto.subtle.digest(`SHA-256`,t);return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,`0`)).join(``)},[])}function qT({payload:e,urlSearchParams:n,currentPulse:r}){let[a,s]=(0,K.useState)(null),[u,p]=(0,K.useState)(null),[m,g]=(0,K.useState)(null),v=(0,K.useRef)(null),y=(0,K.useRef)(null),b=KT(),x=n?.get(`vpol`)??``;(0,K.useEffect)(()=>{let t=!0;return(async()=>{if(!e||!Number.isFinite(r??NaN)){if(!t)return;s(e=>e===null?e:null),p(e=>e===null?e:null),g(e=>e===null?e:null),v.current=null,y.current=null;return}let{seal:n}=await ae({pulse:e.pulse,kaiPulse:e.pulse,beat:e.beat,stepIndex:e.stepIndex,stepsPerBeat:e.stepsPerBeat,seriesSize:e.seriesSize,quality:e.quality,creatorVerified:e.creatorVerified,creatorRep:e.creatorRep,frequencyHz:e.frequencyHz,chakraDay:e.chakraDay,chakraGate:e.chakraGate,transfers:e.transfers,cumulativeTransfers:e.cumulativeTransfers,segments:e.segments,segmentsMerkleRoot:e.segmentsMerkleRoot,transfersWindowRoot:e.transfersWindowRoot,ip:e.ip,kaiSignature:e.kaiSignature,userPhiKey:e.userPhiKey,valuationPolicyId:x||void 0},r,b);if(!t)return;y.current!==n.stamp&&(s(e=>e&&e.stamp===n.stamp?e:n),y.current=n.stamp);let i=n.valuePhi,a=v.current;a!==i&&(p(e=>e===i?e:i),a!=null&&Math.abs(i-a)>1e-9?g(e=>e===`up`&&i>a?e:i>a?`up`:`down`):g(e=>e===null?e:null),v.current=i)})(),()=>{t=!1}},[e,r,x,b]);let S=(0,K.useMemo)(()=>e?.pulse,[e]),C=(0,K.useMemo)(()=>Number.isFinite(S??NaN)?{score:j(S),lines:i(S)}:{score:null,lines:[]},[S]),w=(0,K.useMemo)(()=>{if(!Number.isFinite(S??NaN)||!Number.isFinite(r??NaN))return null;let t=a?.inputs?.pulsesPerBeat?Math.max(1,Math.round(a.inputs.pulsesPerBeat/11)):e?.stepsPerBeat??44,n=a?.inputs?.cadenceRegularity??1,i=a?.inputs?.resonancePhi??.5,s=e?.stepIndex;return o(S,r,{stepsPerBeat:t,cadenceRegularity:n,resonancePhi:i,stepIndexClaimOverride:s})},[S,r,a,e]),T=(0,K.useMemo)(()=>{let t=e?.transfers;return!t||!t.length?[`No closed transfers yet — lineage still forming.`]:_(t,{stepsPerBeat:e?.stepsPerBeat??44})},[e]);return{valSeal:a,livePrice:u,priceFlash:m,rarity:C,oscillation:w,lineageNarrative:T,trust:(0,K.useMemo)(()=>a?B(a.inputs):null,[a]),marketTier:(0,K.useMemo)(()=>Number.isFinite(S??NaN)?h(S,a??void 0):null,[S,a]),kairos:(0,K.useMemo)(()=>Number.isFinite(r??NaN)?{window:l(r,144,1,{stepsPerBeat:e?.stepsPerBeat??44})}:{window:[]},[r,e]),visuals:(0,K.useMemo)(()=>{if(!a||!Number.isFinite(S??NaN))return{spiralSVG:null,scrollSVG:null,scrollText:null,scrollHTML:null};let e=t(S),{scrollSVG:n,scrollText:r}=f(a,{title:`Kai-Sigil Valuation Scroll`});return{spiralSVG:e,scrollSVG:n,scrollText:r,scrollHTML:A(a,{title:`Kai-Sigil Valuation Scroll`})}},[a,S]),audio:(0,K.useMemo)(()=>{if(!Number.isFinite(S??NaN))return{dataURI:null,renderWav:void 0};let{dataURI:e}=c(S,2,44100,{stereo:!0});return{dataURI:e,renderWav:(e=2,t=44100,n)=>c(S,e,t,n)}},[S]),motifSimilarityWith:(0,K.useMemo)(()=>e=>!Number.isFinite(e??NaN)||!Number.isFinite(S??NaN)?null:d(S,e),[S]),helpers:(0,K.useMemo)(()=>({explainRarity:()=>C.lines,explainLineage:()=>T,scanKairos:(t,n,r=1,i)=>l(t,n,r,{stepsPerBeat:i??e?.stepsPerBeat??44}),makeScroll:e=>a?f(a,{title:e??`Kai-Sigil Valuation Scroll`}):null,makeScrollHTML:e=>a?A(a,{title:e}):null,makeSpiral:e=>Number.isFinite(e??S)?t(e??S):null}),[C.lines,T,e,a,S])}}function JT(e){let{stageId:t,payload:n,localHash:r,setOgImgUrl:i,setMeta:a,seoTitle:o,seoDesc:s}=e,c=!1,l=null,u=async()=>{let e=document.getElementById(t);if(!e||!n){i(null),a(`property`,`og:image`,``),a(`property`,`og:image:alt`,``),a(`property`,`og:image:width`,``),a(`property`,`og:image:height`,``),a(`name`,`twitter:image`,``);return}try{let t=n.chakraDay??`Throat`,l=dC[t]?.accent||`#00FFD0`,u=n.pulse||0,f=n.stepsPerBeat??44,p=Math.floor(n.pulse%(f*11)/11),m=kC(t,typeof n.stepPct==`number`?n.stepPct:n.pulse%11/11,r||void 0),h=`Pulse ${u.toLocaleString()} • Beat ${n.beat}/36 • Step ${p+1}/${f} • ${t}`,g=await(0,ge.default)(e),_=document.createElement(`canvas`);_.width=tT,_.height=630;let v=_.getContext(`2d`);if(!v)throw Error(`Canvas unsupported`);let y=v.createLinearGradient(0,0,tT,630);y.addColorStop(0,`rgba(0,0,0,0.92)`),y.addColorStop(1,`rgba(0,0,0,0.70)`),v.fillStyle=y,v.fillRect(0,0,tT,630),v.save(),v.globalCompositeOperation=`lighter`;let b=v.createRadialGradient(tT*.8,630*.2,20,tT*.8,630*.2,600);b.addColorStop(0,`${l}CC`),b.addColorStop(1,`rgba(0,0,0,0)`),v.fillStyle=b,v.beginPath(),v.arc(tT*.8,630*.2,600,0,Math.PI*2),v.fill(),v.restore();let x=Math.floor(tT*.52),S=Math.min(x/g.width,558/g.height),C=Math.floor(g.width*S),w=Math.floor(g.height*S),T=36+Math.floor((x-C)/2),E=36+Math.floor((558-w)/2);v.drawImage(g,T,E,C,w);let D=36+x+32,O=tT-D-36;v.fillStyle=`#EAFBFF`,v.font=`700 38px Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto`,v.fillText(`Kairos Sigil-Glyph — Sealed Kairos Moment`,D,94),v.fillStyle=`rgba(255,255,255,0.82)`,v.font=`400 24px Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto`,d(v,`“${o}” — ${s}`,D,136,O,30);let k=`${u.toLocaleString()}`;v.textBaseline=`alphabetic`,v.font=`900 120px Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto`,v.shadowColor=m,v.shadowBlur=20,v.fillStyle=m;let A=v.measureText(k).width,j=D+Math.floor((O-A)/2);v.fillText(k,j,554),v.shadowBlur=0;let M=_.toDataURL(`image/png`);if(c)return;i(M),a(`property`,`og:image`,M),a(`property`,`og:image:alt`,h),a(`property`,`og:image:type`,`image/png`),a(`property`,`og:image:width`,`1200`),a(`property`,`og:image:height`,`630`),a(`name`,`twitter:image`,M)}catch{if(c)return;i(null)}};return l=wC(()=>{c||u()}),()=>{c=!0,l!=null&&TC(l)};function d(e,t,n,r,i,a){let o=t.split(` `),s=``;for(let t=0;ti&&t>0?(e.fillText(s,n,r),s=o[t]+` `,r+=a):s=c}e.fillText(s.trim(),n,r)}}function YT(e){switch(String(e??``).trim().toLowerCase()){case`root`:case`earth`:case`earth gate`:return`Root`;case`sacral`:return`Sacral`;case`solar plexus`:case`solar_plexus`:case`solar-plexus`:return`Solar Plexus`;case`heart`:return`Heart`;case`throat`:return`Throat`;case`third eye`:case`third_eye`:case`third-eye`:return`Third Eye`;case`crown`:return`Crown`;default:return`Root`}}function XT(){return crypto.getRandomValues(new Uint32Array(4)).join(``)}function ZT(e){let{meta:t,stepIndex:n,stepsPerBeat:r}=e;return{pulse:t.pulse,beat:t.beat,stepIndex:n,chakraDay:YT(t.chakraDay),stepsPerBeat:r,userPhiKey:t.userPhiKey??void 0,kaiSignature:t.kaiSignature??void 0}}function QT(e,t,n){let r=e.stepIndex;return typeof r==`number`&&Number.isFinite(r)&&r>=0&&rNumber(N()/1000n),rE=e=>JSON.stringify({canonicalHash:e.canonicalHash,token:e.token,expiresAtPulse:e.expiresAtPulse,issuedAt:e.issuedAt,version:e.version},tE),iE=e=>btoa(String.fromCharCode(...e)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``);const aE=e=>iE(new TextEncoder().encode(rE(e)));async function oE(e){try{let t=await fetch(`/api/sign-claim`,{method:`POST`,headers:{"content-type":`text/plain;charset=UTF-8`},body:rE(e)});if(!t.ok)return null;let n=await t.json();return!n||!n.s||!n.kid?null:{r:n.r??aE(e),s:n.s,kid:n.kid}}catch{return null}}function sE(e,t,n,r){e.searchParams.set(`r`,t),e.searchParams.set(`s`,n),e.searchParams.set(`kid`,r)}function cE(e,t,n,r){pe(e,{registryClaim:aE(t),registrySig:n,registryKid:r})}function lE(e,t,n){return{canonicalHash:t.toLowerCase(),token:n,expiresAtPulse:e.expiresAtPulse??null,issuedAt:nE(),version:1}}function uE(){if(typeof window>`u`||typeof document>`u`){let e=()=>{},t=()=>{};return{openModal:t,closeModal:t,disable:e,teardown:e,destroy:e}}let e=document,t=e.body,n=[`.sp-breathproof__backdrop`,`.stargate-overlay`,`.valuechart-backdrop`,`.sp-modal`,`.ownership-overlay`],r={".sp-breathproof__backdrop":`.sp-breathproof`,".valuechart-backdrop":`.valuechart`,".ownership-overlay":`.ownership-panel`,".stargate-overlay":`.stargate-content, .stargate-frame, .stargate__content`,".sp-modal":`.sp-modal__content, .sp-modal__card, .sp-card`},i={capture:!0,passive:!1},a={capture:!0},o=0,s=0,c=0,l=``,u=``,d=``,f=``,p=``,m=()=>{o===0&&(s=window.scrollY||e.documentElement.scrollTop||0,c=window.scrollX||e.documentElement.scrollLeft||0,l=t.style.top,u=t.style.left,d=t.style.width,f=t.style.position,p=t.style.overflow,t.style.position=`fixed`,t.style.top=`-${s}px`,t.style.left=`-${c}px`,t.style.width=`100%`,t.style.overflow=`hidden`,t.classList.add(`modal-open`,`bp-open`)),o++},h=()=>{o=Math.max(0,o-1),!(o>0)&&(t.style.position=f,t.style.top=l,t.style.left=u,t.style.width=d,t.style.overflow=p,requestAnimationFrame(()=>{window.scrollTo(c,s)}),t.classList.remove(`modal-open`),t.classList.remove(`bp-open`))},g=e=>{if(!e)return!1;let t=window.getComputedStyle(e);return!(t.display===`none`||t.visibility===`hidden`||e.hasAttribute(`hidden`))},_=()=>{let t=[];return n.forEach(n=>{e.querySelectorAll(n).forEach(e=>{g(e)&&t.push(e)})}),t},v=t=>{if(!t)return null;let r=t;for(;r&&r!==e.documentElement;){for(let e of n)if(r.matches(e))return r;r=r.parentElement}return null},y=(e,t)=>{if(!e||!t)return!1;let i=n.find(t=>e.matches(t))||``,a=i?r[i]:``;return a&&e.querySelector(a)?!t.closest(a):t===e},b=()=>{_().length>0?m():h()},x=e=>{e&&(e.classList.add(`is-open`),e.removeAttribute(`hidden`),b())},S=e=>{e&&(e.classList.remove(`is-open`),e.setAttribute(`hidden`,``),b())},C=e=>{let t=e.target;if(!t)return;let n=t.closest(`.sp-breathproof__close, .stargate-exit, .sp-modal__close, .sealmoment__close, [data-modal-close], [data-dismiss="modal"], button[aria-label="Close"], button[aria-label="close"]`);if(n){let t=v(n);t&&(S(t),e.preventDefault(),e.stopPropagation());return}let r=v(t);if(r&&y(r,t)&&r.getAttribute(`data-backdrop-dismiss`)!==`false`){S(r),e.preventDefault(),e.stopPropagation();return}},w=e=>{if(_().length===0)return;let t=e.target;if(!t)return;let n=t.closest(`[data-scroll], .sp-breathproof, .valuechart, .ownership-panel, .sp-modal__content, .sp-card, .stargate-content`);if(!n){e.preventDefault(),e.stopPropagation();return}if(!(n.scrollHeight>n.clientHeight)){e.preventDefault(),e.stopPropagation();return}},T=e=>{if(e.key!==`Escape`)return;let t=_();if(t.length===0)return;let n=t[t.length-1];n.getAttribute(`data-escape-dismiss`)!==`false`&&(S(n),e.preventDefault(),e.stopPropagation())};e.addEventListener(`click`,C,i),e.addEventListener(`pointerup`,C,i),e.addEventListener(`touchend`,C,i),e.addEventListener(`touchmove`,w,i),e.addEventListener(`keydown`,T,i),b();let E=()=>{e.removeEventListener(`click`,C,a),e.removeEventListener(`pointerup`,C,a),e.removeEventListener(`touchend`,C,a),e.removeEventListener(`touchmove`,w,a),e.removeEventListener(`keydown`,T,a);try{o=1,h()}catch{}};return{openModal:x,closeModal:S,disable:E,teardown:E,destroy:E}}var dE=k(ce(),1),fE=1e-9,pE=`sigil-sendlock-v1`,mE=(e,t)=>`sigil:sendlock:${e}:t:${t}`,hE=3,gE={"--phi-url":`url(/assets/phi.svg)`},_E=e=>{try{return new URL(e,window.location.origin).toString()}catch{return e}},vE=(e,t,n)=>{let r=crypto.getRandomValues(new Uint32Array(4)).join(``);if(!e||!t)return{ok:!1,id:r};let i=mE(e.toLowerCase(),t);try{let a=localStorage.getItem(i),o=a?JSON.parse(a):null,s=!o||!Number.isFinite(o.atPulse)||n-o.atPulse>hE;if(!o||s){localStorage.setItem(i,JSON.stringify({id:r,atPulse:n}));try{let i=new BroadcastChannel(pE),a={type:`lock`,canonical:e.toLowerCase(),token:t,id:r,atPulse:n};i.postMessage(a),i.close()}catch{}return{ok:!0,id:r}}}catch{}return{ok:!1,id:r}},yE=(e,t,n,r)=>{if(!e||!t)return;let i=mE(e.toLowerCase(),t);try{let a=localStorage.getItem(i),o=a?JSON.parse(a):null;if(!o||o.id===n){localStorage.removeItem(i);try{let i=new BroadcastChannel(pE),a={type:`unlock`,canonical:e.toLowerCase(),token:t,id:n,atPulse:r};i.postMessage(a),i.close()}catch{}}}catch{}},bE=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.amount==`number`&&Number.isFinite(t.amount)&&t.amount>0&&typeof t.nonce==`string`&&t.nonce.length>0&&typeof t.timestamp==`number`&&Number.isFinite(t.timestamp)&&(typeof t.recipientPhiKey==`string`||t.recipientPhiKey===void 0)},xE=e=>{if(!Array.isArray(e))return 0;let t=0;for(let n of e)bE(n)&&(t+=n.amount);return t},SE=e=>[...e].sort((e,t)=>{let n=(e.timestamp||0)-(t.timestamp||0);return n===0?e.nonce.localeCompare(t.nonce):n}),CE=e=>{let t=new Set,n=[];for(let r of e)bE(r)&&(t.has(r.nonce)||(t.add(r.nonce),n.push(r)));return n},wE=e=>{let t=typeof e.originalAmount==`number`&&Number.isFinite(e.originalAmount)?e.originalAmount:NaN,n=SE(Array.isArray(e.debits)?CE(e.debits):[]);if(!Number.isFinite(t))return{originalAmount:e.originalAmount,debits:n.length?n:void 0};let r=[],i=0;for(let e of n)bE(e)&&i+e.amount<=t+fE&&(r.push(e),i+=e.amount);return{originalAmount:t,debits:r.length?r:void 0}},TE=1000000n,EE=91536000n,DE=17491270421n,OE=e=>e<0n?-e:e,kE=(e,t)=>{let n=e/t,r=e%t*2n;return rt?n+1n:n%2n==0n?n:n+1n},AE=(e,t)=>{if(t<=0n)throw Error(`divRoundTiesToEven: den must be > 0`);return e===0n?0n:(e<0n?-1n:1n)*kE(OE(e),t)},jE=e=>AE(e*EE,DE),ME=e=>{let t=jE(e);return BigInt(x)+t},NE=e=>AE((e-BigInt(x))*DE,EE),PE=()=>{let e=N();return Number(e/TE)},FE=()=>{let e=ME(N());return Number(e)},IE=e=>{let t=NE(BigInt(e.getTime()));return Number(t/TE)};function LE(){let[e,t]=(0,K.useState)(()=>PE()),[n,r]=(0,K.useState)(0);return(0,K.useEffect)(()=>{let e=!0,n=null,i=()=>{if(!e)return;let a=N(),o=Number(a/TE),s=a%TE,c=jE(s===0n?TE:TE-s),l=Number(c);t(o),r(l);let u=Math.max(1,Math.min(6e4,l));n=window.setTimeout(i,u)};return i(),()=>{e=!1,n!=null&&window.clearTimeout(n)}},[]),{pulse:e,msToNextPulse:n}}var RE=e=>e===`breaths`||e===`steps`,zE=`sigil-lineage-v1`,BE=(e,t)=>t?`sigil:desc:${e}:t:${t}`:`sigil:desc:${e}`,VE=`sigil-xfer-v1`,HE=e=>`sigil:rotated:${e}`,UE=(e,t)=>{Array.from(new Set(e.map(e=>e.toLowerCase()).filter(Boolean))).forEach(e=>{try{localStorage.setItem(HE(e),`${t}@${FE()}`)}catch{}try{let n=new BroadcastChannel(VE);n.postMessage({type:`rotated`,canonical:e,token:t}),n.close()}catch{}try{window.dispatchEvent(new CustomEvent(`sigil:transfer-rotated`,{detail:{canonical:e,token:t}}))}catch{}})};function WE(e,t){let n=(e||``).toLowerCase();if(!n||!t)return[];try{let e=localStorage.getItem(BE(n,t));if(!e)return[];let r=JSON.parse(e);return Array.isArray(r)?r:[]}catch{return[]}}function GE(e,t,n){let r=(e||``).toLowerCase();if(!(!r||!t))try{localStorage.setItem(BE(r,t),JSON.stringify(n||[]))}catch{}}function KE(e,t,n){try{let r=new BroadcastChannel(zE),i={type:`descendants`,canonical:e.toLowerCase(),token:t,list:n,stamp:FE()};r.postMessage(i),r.close()}catch{}}function qE(){let{hash:e}=ie(),t=oe(),r=C(),i=(e??``).toLowerCase(),a=(0,K.useMemo)(()=>new URLSearchParams(t.search),[t.search]),o=a.get(`t`),[s,c]=(0,K.useState)(`checking`),[l,u]=(0,K.useState)(`checking`),[d,f]=(0,K.useState)(!1),[m,h]=(0,K.useState)(`Awaiting Proof Of Breath™`),[g,_]=(0,K.useState)(``),[v,y]=(0,K.useState)(320),b=(0,K.useRef)(null),{payload:x,setPayload:E,loading:D,setLoading:O}=yC(t.search),k=x,{pulse:A,msToNextPulse:j}=LE(),[M,N]=(0,K.useState)(null),[P,F]=(0,K.useState)(null),[I,L]=(0,K.useState)(!1),[R,te]=(0,K.useState)(``),[z,re]=(0,K.useState)(``),[B,ae]=(0,K.useState)(`breaths`),[ce,H]=(0,K.useState)(44),[U,de]=(0,K.useState)(``),[W,G]=(0,K.useState)(!1),me=(0,K.useRef)(``),ge=(0,K.useMemo)(()=>i?`sigil:legacy-upgraded:${i}`:``,[i]),[be,xe]=(0,K.useState)(!1),[Se,Ce]=(0,K.useState)(!1);(0,K.useEffect)(()=>{if(ge)try{Ce(localStorage.getItem(ge)===`1`)}catch{}},[ge]);let we=(0,K.useCallback)(()=>{if(ge){try{localStorage.setItem(ge,`1`)}catch{}Ce(!0),SC(_,`Upgraded — legacy link locked`)}},[ge]),[Te,Ee]=(0,K.useState)(!1),[De,Oe]=(0,K.useState)(``),[ke,Ae]=(0,K.useState)(``),[je,Me]=(0,K.useState)(`checking`),[Ne,Pe]=(0,K.useState)(null);(0,K.useEffect)(()=>{let e=Array.from(new Set([k?.canonicalHash,i,U].filter(Boolean).map(e=>e.toLowerCase())));if(e.length===0)return;let t=()=>{let t=null;try{for(let n of e){let e=localStorage.getItem(HE(n)),r=e?String(e).split(`@`)[0]:null;if(r){t=r;break}}}catch{}Pe(t)};t();let n=null;try{n=new BroadcastChannel(VE),n.onmessage=t=>{let n=t.data;if(n?.type===`rotated`){let t=(n.canonical||``).toLowerCase();e.includes(t)&&Pe(n.token||null)}}}catch{}let r=n=>{if(n.key){for(let r of e)if(n.key===HE(r)){t();break}}};return window.addEventListener(`storage`,r,{passive:!0}),()=>{if(window.removeEventListener(`storage`,r),n&&typeof n.close==`function`)try{n.close()}catch{}}},[k?.canonicalHash,i,U]);let Fe=(0,K.useCallback)(async(e,t,n,r,i)=>{try{let a=lE(e,t,n),o=await oE(a);if(!o)return r;let s=new URL(r,window.location.origin);return sE(s,o.r,o.s,o.kid),i&&cE(i,a,o.s,o.kid),s.toString()}catch{return r}},[]);(0,K.useEffect)(()=>{let e=null;try{e=new BroadcastChannel(pE),e.onmessage=()=>{}}catch{}return()=>{if(e&&typeof e.close==`function`)try{e.close()}catch{}}},[]),(0,K.useEffect)(()=>{let e=uE();return()=>{e.destroy?.(),e.teardown?.(),e.disable?.()}},[]);let[Ie,Le]=(0,K.useState)(0),[Re,Ve]=(0,K.useState)(!1),[He,Ue]=(0,K.useState)(null),We=(0,K.useMemo)(()=>{let e=[k?.canonicalHash,U,M?.canonicalHash,He?.matchedHash].filter(Boolean).map(e=>e.toLowerCase());return Array.from(new Set(e))},[k?.canonicalHash,U,M?.canonicalHash,He]);(0,K.useLayoutEffect)(()=>{qC()},[]),(0,K.useEffect)(()=>{let e=dC[k?.chakraDay??`Throat`]??{hue:180,accent:`#00FFD0`},t=document.querySelector(`.sigilpage`);t&&(t.style.setProperty(`--crystal-hue`,String(e.hue)),t.style.setProperty(`--crystal-accent`,e.accent))},[k?.chakraDay]);let[Ge,Ke]=(0,K.useState)(null),{valSeal:qe,livePrice:Je,priceFlash:Ye}=qT({payload:k,urlSearchParams:a,currentPulse:A,routeHash:i}),Xe=a.get(`h`)??``;(0,K.useEffect)(()=>{if(!Xe){Ke(e=>e===null?e:null);return}try{let e=n(jC(Xe.trim()));Ke(t=>Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)}catch{Ke(e=>e===null?e:null)}},[Xe]);let Ze=(0,K.useCallback)((e,t)=>{let n=e.stepsPerBeat??44,r=t.stepsPerBeat??44,i=p(e.pulse,n),a=p(t.pulse,r);return e.pulse===t.pulse&&e.beat===t.beat&&i===a&&e.chakraDay===t.chakraDay},[]),Qe=(0,K.useMemo)(()=>typeof window<`u`?new URL(window.location.href).toString():`${`/s/${encodeURIComponent(e??``)}`}${t.search||``}${t.hash||``}`,[e,t.search,t.hash]),$e=(0,K.useMemo)(()=>e?e.slice(0,16):`—`,[e]),et=(0,K.useCallback)(async(e,t=`Copied`)=>{try{return await navigator.clipboard.writeText(e),SC(_,t),!0}catch{return SC(_,`Copy failed`),!1}},[]),tt=(0,K.useCallback)(async()=>{try{let e=navigator;typeof e?.share==`function`?(await e.share({title:`Kairos Sigil-glyph`,text:`Sealed Kairos Moment`,url:Qe}),SC(_,`Share sheet opened`)):await et(Qe,`Link copied`)}catch{}},[Qe,et]);(0,K.useEffect)(()=>{let e=FE(),t=(i||``).toLowerCase();if(Ie>e||!t||We.length===0)return;let n=We.includes(t),r=l,a=s;!n&&U&&t!==U&&!He||!n&&(He||je===`archived`)?r=`authentic`:(r=n?`authentic`:`forged`,s!==`verified`&&(a=n?`ok`:`mismatch`)),r!==l&&u(r),a!==s&&c(a)},[We,i,je,Ie,He,U,l,s]);let[nt,rt]=(0,K.useState)(null),it=(0,K.useDeferredValue)(k),at=(0,K.useMemo)(()=>{let t=it?.stepsPerBeat??44,n=it?p(it.pulse,t):0,r=it?.chakraDay??`Throat`,i=(it?.userPhiKey??``).slice(0,12),a=(it?.pulse??0).toLocaleString();return{title:`Kai Sigil — ${e?e.slice(0,16):`—`}`,desc:it?`Sealed Sigil-Glyph • Pulse ${a} • Beat ${it.beat}/36 • Step ${n+1}/${t} • ${r}${i?` • Owner ${i}…`:``}.`:`Sealed Sigil-Glyph`}},[it,e]),{series:ot}=QS();(0,K.useEffect)(()=>{let e=Qe;document.title=at.title;let t=lC(`canonical`);t.href=e,sC(`name`,`theme-color`,dC[k?.chakraDay??`Throat`]?.accent||`#00FFD0`),sC(`property`,`og:title`,at.title),sC(`property`,`og:description`,at.desc),sC(`property`,`og:type`,`website`),sC(`property`,`og:url`,e),sC(`name`,`twitter:card`,`summary_large_image`),sC(`name`,`twitter:title`,at.title),sC(`name`,`twitter:description`,at.desc),sC(`property`,`og:site_name`,`Kairos Harmonik Kingdom`);let n=k?.stepsPerBeat??44,r=k?p(k.pulse,n):0,i=k,a=k??{},o={"@context":`https://schema.org`,"@type":`VisualArtwork`,name:at.title,description:at.desc,url:e,image:nt||void 0,genre:`Sigil-Glyph`,identifier:[{"@type":`PropertyValue`,name:`pulse`,value:k?.pulse??null},{"@type":`PropertyValue`,name:`beat`,value:k?.beat??null},{"@type":`PropertyValue`,name:`stepIndex`,value:r},{"@type":`PropertyValue`,name:`stepsPerBeat`,value:n},{"@type":`PropertyValue`,name:`chakraDay`,value:k?.chakraDay??null},{"@type":`PropertyValue`,name:`userPhiKey`,value:k?.userPhiKey??null},{"@type":`PropertyValue`,name:`kaiSignature`,value:k?.kaiSignature??null},{"@type":`PropertyValue`,name:`canonicalHash`,value:(k?.canonicalHash??U)||null},{"@type":`PropertyValue`,name:`expiresAtPulse`,value:k?.expiresAtPulse??null},{"@type":`PropertyValue`,name:`transferNonce`,value:new URLSearchParams(location.search).get(`t`)??k?.transferNonce??null},{"@type":`PropertyValue`,name:`claimExtendUnit`,value:RE(a.claimExtendUnit)?a.claimExtendUnit:null},{"@type":`PropertyValue`,name:`claimExtendAmount`,value:a.claimExtendAmount??null},{"@type":`PropertyValue`,name:`historyLiteCount`,value:Ge?.length??0}].filter(e=>e.value!=null)};i?.lineage?.length&&o.identifier.push({"@type":`PropertyValue`,name:`lineageDepth`,value:i.lineage.length}),uC(`sigil-jsonld`,o)},[Qe,at.title,at.desc,k,nt,U,Ge?.length]),(0,K.useEffect)(()=>JT({stageId:`sigil-stage`,payload:k?{...k}:null,localHash:U,setOgImgUrl:rt,setMeta:sC,seoTitle:at.title,seoDesc:at.desc}),[k,U,v,at.title,at.desc]),(0,K.useLayoutEffect)(()=>(document.documentElement.classList.add(`sigil-scroll`),()=>document.documentElement.classList.remove(`sigil-scroll`)),[]),(0,K.useEffect)(()=>{let e=0,t=()=>{cancelAnimationFrame(e),e=requestAnimationFrame(()=>{let e=window.innerWidth,t=window.innerHeight,n=e<640?Math.max(220,Math.min(360,t*.48)):Math.max(160,Math.min(320,t*.35)),r=Math.max(160,Math.min(640,Math.min(e,t-n))),i=b.current?.clientWidth??e,a=Math.max(160,Math.min(640,i-24));y(Math.round(Math.min(r,a)))})},n=b.current??document.body,r=new ResizeObserver(()=>t());return r.observe(n),window.addEventListener(`resize`,t,{passive:!0}),t(),()=>{r.disconnect(),window.removeEventListener(`resize`,t),cancelAnimationFrame(e)}},[]),(0,K.useEffect)(()=>{D?(c(e=>e===`verified`?`verified`:`checking`),u(e=>e===`authentic`?`authentic`:`checking`),f(!1),h(`Awaiting Verifikation`)):k||(c(e=>e===`verified`?`verified`:i?`notfound`:`checking`),u(e=>e===`authentic`?`authentic`:i?`forged`:`checking`))},[D,k,i]);let st=e=>Array.isArray(e)?[...e].map(e=>({nonce:e.nonce,amount:Number.isFinite(e.amount)?Number(e.amount):0,recipient:e.recipientPhiKey??``,ts:e.timestamp??``})).sort((e,t)=>e.nonce.localeCompare(t.nonce)).map(e=>`${e.nonce}:${e.amount}:${e.recipient}:${e.ts}`).join(`|`):``;(0,K.useEffect)(()=>{let e=hT(a.get(`d`));if(!e)return;let t=PT(k??null,U,He),n=FT(o,k??null),r=wE(e);t&&vT(t,r,n);let i=typeof r.originalAmount==`number`?r.originalAmount:void 0,s=Array.isArray(r.debits)?r.debits:void 0;E(e=>{if(!e)return e;let t=e,n=(t.originalAmount??void 0)===i,r=st(t.debits)===st(s);if(n&&r)return e;let a={...e};return i!==void 0&&(a.originalAmount=i),s&&(a.debits=s,a.totalDebited=xE(s)),a})},[a,k,U,He,o,E]);let[ct,lt]=(0,K.useState)(!1);(0,K.useEffect)(()=>{let e=PT(k??null,U,He);if(!e)return;let t=FT(o,k??null),{merged:n,urlIsStale:r}=CT(e,a,t),i=wE(n);r&<(!0),ST(i,e,t,{broadcast:!1,navigate:r});let s=typeof i.originalAmount==`number`?i.originalAmount:void 0,c=Array.isArray(i.debits)?i.debits:void 0;E(e=>{if(!e)return e;let t=e,n=(t.originalAmount??void 0)===s,r=st(t.debits)===st(c);if(n&&r)return e;let i={...e};return s!==void 0&&(i.originalAmount=s),c&&(i.debits=c,i.totalDebited=xE(c)),i})},[k?.canonicalHash,U,He,a,o,E]),(0,K.useEffect)(()=>{if(!k?.canonicalHash)return;let e=k.canonicalHash.toLowerCase();if(i&&e&&e!==i&&je===`active`&&!He){let t=new URL(window.location.href);t.pathname=`/s/${e}`,r(`${t.pathname}${t.search}${t.hash}`,{replace:!0})}},[k?.canonicalHash,i,je,He,r]),(0,K.useEffect)(()=>{if(k&&!k.canonicalHash&&U&&i&&U!==i&&je===`active`&&!He){let e=new URL(window.location.href);e.pathname=`/s/${U}`,r(`${e.pathname}${e.search}${e.hash}`,{replace:!0})}},[k?.canonicalHash,U,i,je,He,r]),(0,K.useEffect)(()=>{let e=We;if(!e.length)return;let t=FT(o,k??null),n=(e,t)=>{let n={};typeof e?.originalAmount==`number`&&(n.originalAmount=e.originalAmount),n.originalAmount===void 0&&typeof t?.originalAmount==`number`&&(n.originalAmount=t.originalAmount);let r=Array.isArray(e?.debits)?e.debits:[],i=Array.isArray(t?.debits)?t.debits:[],a=CE([...r,...i]);return wE({originalAmount:n.originalAmount,debits:a})},r=(e,t)=>{let n=wE(e??{}),r=wE(t??{}),i=typeof n.originalAmount==`number`?n.originalAmount:NaN,a=typeof r.originalAmount==`number`?r.originalAmount:NaN,o=Number.isNaN(i)&&Number.isNaN(a)||Math.abs(i-a)e.nonce)),c=new Set((Array.isArray(r.debits)?r.debits:[]).map(e=>e.nonce));if(!o||s.size!==c.size)return!1;for(let e of s)if(!c.has(e))return!1;return!0},i=(i,a,o)=>{let s=i.toLowerCase();if(!e.includes(s))return;let c=t??null;if(c!==(o??null))return;let l=hT(a);if(!l)return;let u=hT(new URLSearchParams(window.location.search).get(`d`)),d=n(u,l);r(u,d)||(ST(d,s,c,{broadcast:!1}),E(e=>{if(!e)return e;let t={...e};return typeof d.originalAmount==`number`&&(t.originalAmount=d.originalAmount),Array.isArray(d.debits)&&(t.debits=d.debits,t.totalDebited=xE(d.debits)),t}))},a=null;try{a=new BroadcastChannel(sT),a.onmessage=e=>{let t=e.data;t?.type===`debits`&&t.canonical&&t.qs&&i(t.canonical,t.qs,t.token)}}catch{}let s=t=>{if(!(!t.key||typeof t.newValue!=`string`))for(let n of e){if(!lT(t.key,n))continue;let e=uT(t.key,n);i(n,t.newValue,e);break}};return window.addEventListener(`storage`,s,{passive:!0}),()=>{if(window.removeEventListener(`storage`,s),a&&typeof a.close==`function`)try{a.close()}catch{}}},[We,o,k,E]);let ut=(0,K.useMemo)(()=>k?typeof k.expiresAtPulse==`number`?k.expiresAtPulse:k.pulse+11:null,[k]),dt=(0,K.useMemo)(()=>A==null||ut==null?null:Math.max(0,ut-A),[A,ut]),pt=(0,K.useMemo)(()=>dt===0,[dt]),mt=(0,K.useMemo)(()=>A==null||!k?null:Math.max(0,k.pulse-A),[k,A]),ht=(0,K.useMemo)(()=>A==null||!k?!1:k.pulse>A,[k,A]),gt=k?.chakraDay??`Throat`,_t=k?.stepsPerBeat??44,vt=p(k?.pulse??0,_t),yt=typeof k?.stepPct==`number`?Math.max(0,Math.min(1,k.stepPct)):S(k?.pulse??0),bt=(0,K.useMemo)(()=>`hsl(${((dC[gt]?.hue??180)+(U&&/^[0-9a-f]+$/i.test(U)?parseInt(U.slice(-2),16)%12:0)*2.5)%360} 100% ${50+15*Math.sin(yt*2*Math.PI)}%)`,[gt,yt,U]),xt=dC[gt]?.hue??180,St=(0,K.useMemo)(()=>`qr-${(U||i||`seed`).slice(0,12)}-${gt}-${vt}`,[U,i,gt,vt]),[Ct,wt]=(0,K.useState)(!1),[Tt,Dt]=(0,K.useState)(null);(0,K.useEffect)(()=>{let e=!1;return(async()=>{try{if(!k){Dt(null);return}let t=k.stepsPerBeat??44,n=p(k.pulse,t),r=BC(k),i=zC(k.pulse,k.beat,n,String(k.chakraDay??``),r),a=await FC(i),o=await RC(a),s=typeof k.kaiSignature==`string`?k.kaiSignature.toLowerCase()===a.toLowerCase():!0,c=typeof k.userPhiKey==`string`?k.userPhiKey.toLowerCase()===o.toLowerCase():!0,l={pulse:k.pulse,beat:k.beat,stepsPerBeat:t,stepIndex:n,chakraDay:String(k.chakraDay??``),intention:r??null,sigmaString:i,sigmaHash:a,derivedPhiKey:o,payloadKaiSignature:k.kaiSignature??null,payloadUserPhiKey:k.userPhiKey??null,matches:{sigma:s,phi:c}};e||Dt(l)}catch{e||Dt(null)}})(),()=>{e=!0}},[k]);let Ot=le(()=>{IT({stageEl:document.getElementById(`sigil-stage`),payload:k,localHash:U,routeHash:i,qr:{uid:St,url:Qe,hue:xt,accent:bt},onToast:e=>SC(_,e)})}),[kt,At]=(0,K.useState)(!1),[jt,Mt]=(0,K.useState)(``),Nt=(0,K.useCallback)(async()=>{let e=b.current;e&&(Mt((await(0,dE.default)(e,{backgroundColor:null})).toDataURL(`image/png`)),At(!0),fC()||document.querySelector(`.stargate-overlay`)?.requestFullscreen?.().catch(()=>{}))},[]),Pt=(0,K.useCallback)(()=>{At(!1),document.fullscreenElement&&!fC()&&document.exitFullscreen?.().catch(()=>{})},[]),Ft=le(()=>{Nt()}),It=le(()=>{Pt()}),Lt=le(()=>wt(e=>!e)),Rt=le(()=>Ve(!0)),zt=(0,K.useCallback)(async e=>{let t=await e.arrayBuffer(),n=e.type||`application/octet-stream`,r=`data:${n};base64,${xC(t)}`;F({name:e.name,mime:n,size:e.size,dataUri:r}),SC(_,`Remembered ${e.name}`)},[]),Bt=(0,K.useCallback)((e,t)=>{let n=e.stepsPerBeat??44,r=p(e.pulse,n),a=(e.canonicalHash||U||``).toLowerCase(),o=e.claimExtendUnit,s=RE(o)?o:null,c=e.claimExtendAmount,l=typeof c==`number`?c:null,u=$T({pulse:e.pulse,beat:e.beat,chakraDay:e.chakraDay??`Root`,stepsPerBeat:n,stepIndex:r,userPhiKey:e.userPhiKey??null,kaiSignature:e.kaiSignature??null,canonicalHash:a,transferNonce:e.transferNonce??null,expiresAtPulse:e.expiresAtPulse??null,claimExtendUnit:s,claimExtendAmount:l},t,{localHash:U,routeHash:i,stepsPerBeat:44,stepIndexFromPulse:p})?.url||`/s/${a}`;try{let e=new URL(u,window.location.origin);e.pathname=`/s/${a}`;let t=new URLSearchParams(window.location.search).get(`d`);t&&e.searchParams.set(`d`,t),new URL(window.location.href).searchParams.forEach((t,n)=>{n!==`d`&&e.searchParams.set(n,e.searchParams.get(n)??t)}),u=e.toString()}catch{}let d=new URL(u,window.location.origin);d.pathname=`/s/${a}`,new URL(window.location.href).searchParams.forEach((e,t)=>{t!==`d`&&d.searchParams.set(t,d.searchParams.get(t)??e)});let f=wT(u)||a;return Oe(u),Ae(f),Ee(!0),u},[U,i]),Vt=(0,K.useCallback)((e,t,n=!0)=>{let a=e.stepsPerBeat??44,o=p(e.pulse,a),s=e.claimExtendUnit,c=RE(s)?s:`breaths`,l=e.claimExtendAmount,u=typeof l==`number`?l:11;return eE({pulse:e.pulse,beat:e.beat,chakraDay:e.chakraDay??`Root`,stepsPerBeat:a,stepIndex:o,userPhiKey:e.userPhiKey??null,kaiSignature:e.kaiSignature??null,canonicalHash:t,transferNonce:e.transferNonce??null,expiresAtPulse:e.expiresAtPulse??null,claimExtendUnit:c,claimExtendAmount:u},t,{localHash:U,routeHash:i,stepsPerBeat:44,stepIndexFromPulse:p,getKaiPulseEternalInt:IE,breathsToPulses:ue,shareTransferLink:$T,publishRotation:UE,navigate:e=>{if(n)try{r(e)}catch{try{window.location.href=e}catch{}}}})??null},[U,i,r]),Ht=(0,K.useCallback)(async e=>{if(f(!1),h(`Verifying…`),!(/image\/svg\+xml/i.test(e.type)||/\.svg$/i.test(e.name))){h(`Unsupported file. Upload an SVG sigil (.svg) only.`);return}let t=null;try{let{ok:n,errors:r,payload:i,meta:a}=he(await e.text());if(!n||!i){h(r[0]||`Invalid SVG.`);return}t=i,N(a||{})}catch{h(`Invalid or unreadable SVG uploaded.`);return}if(!k||!t){h(`Load or link a sigil first, then verify stewardship.`);return}if(!Ze(k,t)){h(`File does not match this sealed kairos moment.`),f(!1);return}if(t.canonicalHash){let e=t.canonicalHash.toLowerCase(),n=(U||``).toLowerCase(),r=(i||``).toLowerCase(),a=n&&e===n,o=r&&e===r;if(!a&&!o){h(`SVG canonicalHash doesn’t match this link’s hash.`),f(!1);return}if(o&&!a){Ue({reason:`svg.canonicalHash matched route (legacy)`,matchedHash:e}),u(`authentic`),c(`ok`),Me(`archived`),f(!0),h(`Stewardship verified (legacy SVG). Issuing modern link…`),n&&(Vt({...k},n,!0),h(`Legacy verified. Modern transfer link ready.`));return}}if(new Set([o??void 0,k.transferNonce??void 0,t.transferNonce??void 0,Ne??void 0].filter(e=>!!e)).size>1){h(`This is not the active transfer link for that Φkey.`),f(!1);return}f(!0),h(`Stewardship verified`)},[k,Ze,U,i,o,Ne,Vt]),Ut=le(async()=>{if(I)return;let e=b.current?.querySelector(`svg`),t=k??{},n=RE(t.claimExtendUnit)?t.claimExtendUnit:void 0,r=typeof t.claimExtendAmount==`number`?t.claimExtendAmount:null;await GT({expired:!!pt,exporting:I,setExporting:L,svgEl:e,payload:k?{pulse:k.pulse,beat:k.beat,chakraDay:k.chakraDay??null,stepsPerBeat:k.stepsPerBeat??void 0,stepIndex:k.stepIndex??null,exportedAtPulse:k.exportedAtPulse??null,canonicalHash:k.canonicalHash??null,userPhiKey:k.userPhiKey??null,kaiSignature:k.kaiSignature??null,transferNonce:k.transferNonce??null,expiresAtPulse:k.expiresAtPulse??null,claimExtendUnit:n,claimExtendAmount:r,attachment:k.attachment??null,provenance:k.provenance??null}:null,isFutureSealed:ht,linkStatus:je,setToast:e=>SC(_,e),expiryUnit:B,expiryAmount:ce,localHash:U,routeHash:i,transferToken:o??null,getKaiPulseEternalInt:IE,stepIndexFromPulse:p,STEPS_PER_BEAT:44})}),Wt=(0,K.useCallback)(e=>{let t=typeof e==`string`?e:e?.hash;if(!t)return;let n=t.toLowerCase();de(e=>e===n?e:n)},[]),Gt=D&&!k,Kt=s===`notfound`||s===`error`,qt=k?.pulse??0,Jt=k?.beat??0,Yt=((j??0)/1e3).toFixed(3),Xt=je===`archived`,Zt=d&&!Xt,Qt=(0,K.useMemo)(()=>l===`authentic`&&Xt&&!o&&!!i&&!!U&&i!==U,[l,Xt,o,i,U]);(0,K.useEffect)(()=>{if(!k||l!==`authentic`||s===`mismatch`||s===`error`||s===`notfound`)return;let e=!1;return(async()=>{try{let t=k.stepsPerBeat??44,n=p(k.pulse,t),r=BC(k),i=await FC(zC(k.pulse,k.beat,n,String(k.chakraDay??``),r)),a=typeof k.kaiSignature==`string`?k.kaiSignature.toLowerCase()===i.toLowerCase():!0,o=await RC(i),l=typeof k.userPhiKey==`string`?k.userPhiKey.toLowerCase()===o.toLowerCase():!0;!e&&a&&l&&s!==`verified`&&c(`verified`)}catch{}})(),()=>{e=!0}},[k,l,s,je]),(0,K.useEffect)(()=>{let e=(i||``).toLowerCase(),t=o||null,n=k?.transferNonce||null,r=!!t&&!!n&&t===n&&(ut==null||A==null||A{let e=!0;return(async()=>{if(!k){en(``),nn(``);return}let t=(k.canonicalHash||U||``).toLowerCase(),n=A||PE(),r=await JC(k,t,n,T(n),p(n,k.stepsPerBeat??44));e&&(en(r.ownerPhiKey),nn(r.kaiSig))})(),()=>{e=!1}},[k,U]);let rn=(0,K.useCallback)(async e=>{if(e?.preventDefault?.(),e?.stopPropagation?.(),!k||!U||ht||Xt)return;let t=(k.canonicalHash||U||``).toLowerCase(),n=A||PE(),r=await JC(k,t,n,T(n),p(n,k.stepsPerBeat??44));te(r.ownerPhiKey),re(r.kaiSig),setTimeout(()=>{try{sn()}catch{}},0)},[k,U,ht,Xt]),an=(0,K.useCallback)(e=>{let t=`/${e}`;try{window.location.assign(t)}catch{window.location.href=t}},[]),on=(0,K.useCallback)(async()=>{try{let e=await(await fetch(`/verifier.inline.html`,{cache:`no-store`})).text(),t=new Blob([e],{type:`text/html`}),n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=`verifier.html`,document.body.appendChild(n),n.click(),setTimeout(()=>{URL.revokeObjectURL(n.href),n.remove()},0),SC(_,`Downloading verifier…`)}catch{SC(_,`Download failed`)}},[]);({...Lt});let sn=(0,K.useCallback)(()=>{if(!k)return SC(_,`Nothing to mint`);let e=b.current?.querySelector(`svg`);if(!e)return SC(_,`No Φkey in frame`);if(!U)return SC(_,`Glyph hash not ready yet`);if(je!==`active`)return SC(_,`Archived link — cannot exhale from here`);if(ht)return SC(_,`Opens after the moment—claim unlocks then`);let t=rC(M??{},k.pulse),n=(R||k.userPhiKey||``).trim();if(!n)return SC(_,`Owner ΦKey required`);let r=Math.max(0,Math.floor(ce||0)),a=B===`breaths`?ue(r):fe(r),o=A||PE(),s=o+a,c=U.toLowerCase(),l=crypto.getRandomValues(new Uint32Array(4)).join(``),u=k.stepsPerBeat??44,d=p(k.pulse,u),f=p(o,u),m={...iC(n,z||k.kaiSignature,k,t.length?`transfer`:`mint`,(P??k.attachment)?.name,o),stepIndex:d,atStepIndex:f},h={...k,userPhiKey:n,kaiSignature:z||k.kaiSignature,stepsPerBeat:k.stepsPerBeat??44,attachment:P??k.attachment??void 0,expiresAtPulse:s,canonicalHash:c,transferNonce:l,claimExtendUnit:B,claimExtendAmount:r,provenance:[...t,m]};(async()=>{let t=await FC(zC(h.pulse,h.beat,d,String(h.chakraDay??``),BC(h))),n=await RC(t);h.kaiSignature=t,h.userPhiKey=h.userPhiKey||n;let r=Array.from(new Set([k.canonicalHash,i,U].filter(Boolean).map(e=>e.toLowerCase())));r.length&&UE(r,l),Me(`archived`),Le(FE()+250),pe(e,h),UC(e),E(h),N(h),SC(_,`Sealed & archived`);let a=Bt(h,l)||`/s/${c}`;a=await Fe(h,c,l,a,e),Oe(_E(a)),h.canonicalHash&&UE([h.canonicalHash.toLowerCase()],l),setTimeout(()=>Le(0),0)})()},[k,M,R,z,P,ce,B,U,i,je,ht,Bt]),cn=k,ln=(0,K.useMemo)(()=>xE(cn?.debits??[]),[cn?.debits]),un=(0,K.useMemo)(()=>{let e=(typeof cn?.originalAmount==`number`?cn.originalAmount:qe?.valuePhi??0)-ln;return e>0?e:0},[cn?.originalAmount,qe?.valuePhi,ln]),dn=(cn?.debits?.length??0)>0||typeof cn?.originalAmount==`number`,fn=(0,K.useMemo)(()=>dn?un:Je??qe?.valuePhi??0,[dn,un,Je,qe?.valuePhi]),pn=se,{usdPerPhi:mn,phiPerUsd:hn}=(0,K.useMemo)(()=>{try{let e=w({meta:k||{},nowPulse:A||A,usd:100,currentStreakDays:0,lifetimeUsdSoFar:0},pn);return{usdPerPhi:e.usdPerPhi??0,phiPerUsd:e.phiPerUsd??0}}catch{return{usdPerPhi:0,phiPerUsd:0}}},[k,A,pn]),gn=(fn??0)*(mn||0),_n=(0,K.useCallback)(async()=>{if(!k)return``;let e=k.stepsPerBeat??44,t=p(k.pulse,e);return await RC(k.kaiSignature??await FC(zC(k.pulse,k.beat,t,String(k.chakraDay??``),BC(k))))},[k]),[vn,yn]=(0,K.useState)([]),bn=(0,K.useCallback)(()=>{yn(WE(PT(k??null,U,He),FT(o,k??null)))},[k,U,He,o]);(0,K.useEffect)(()=>{bn();let e=null;try{e=new BroadcastChannel(zE),e.onmessage=e=>{let t=e.data;if(!t||t.type!==`descendants`)return;let n=PT(k??null,U,He),r=FT(o,k??null);!n||!r||t.canonical!==n.toLowerCase()||t.token!==r||Array.isArray(t.list)&&yn(t.list)}}catch{}let t=e=>{if(!e.key||!e.newValue)return;let t=PT(k??null,U,He),n=FT(o,k??null);if(!(!t||!n)&&e.key===BE(t,n))try{let t=JSON.parse(e.newValue||`[]`);Array.isArray(t)&&yn(t)}catch{}};return window.addEventListener(`storage`,t,{passive:!0}),()=>{if(e&&typeof e.close==`function`)try{e.close()}catch{}window.removeEventListener(`storage`,t)}},[k,U,He,o,bn]);let xn=(0,K.useCallback)(async(e,t)=>{if(!k)return null;let n=A||PE(),r=crypto.getRandomValues(new Uint32Array(4)).join(``),i=k.stepsPerBeat??44,a=p(k.pulse,i),s=(U||k.canonicalHash||``).toLowerCase(),c=t??FT(o,k??null),l=Array.isArray(k.lineage)?[...k.lineage]:[],u=(l[l.length-1]?.depth??0)+1,d={token:r,parentToken:c??null,amount:Number(e.toFixed(6)),timestamp:n,depth:u,senderPhiKey:k.userPhiKey??null},f={...k,userPhiKey:void 0,originalAmount:Number(e.toFixed(6)),mintedAtPulse:n,transferNonce:r,expiresAtPulse:n+(B===`breaths`?ue(ce):fe(ce)),claimExtendUnit:B,claimExtendAmount:ce,canonicalHash:s,lineage:[...l,d]},m=await FC(zC(f.pulse,f.beat,a,String(f.chakraDay??``),BC(f))),h=await RC(m);f.kaiSignature=m,f.userPhiKey=h;let g=Bt(f,r)||`/s/${s}`;try{let t=new URL(g,window.location.origin);t.pathname=`/s/${s}`,t.searchParams.set(`d`,pT({originalAmount:f.originalAmount}));let i=NT(t.toString(),f);i=await Fe(f,s,r,i);let a=wT(i)||s;vT(a,hT(new URL(i).searchParams.get(`d`))??{},r);let o=PT(k??null,U,He),l=c??null;if(o&&l){let t=[...WE(o,l),{token:r,parentToken:l,amount:Number(e.toFixed(6)),timestamp:n,depth:1,recipientPhiKey:f.userPhiKey}];GE(o,l,t),KE(o,l,t),yn(t)}return Oe(_E(i)),Ae(a),Ee(!0),i}catch{let e=NT(g||`/s/${s}`,f);return Oe(e),Ae(s),Ee(!0),e||null}},[k,B,ce,U,Bt,He,o]);(0,K.useEffect)(()=>{let e=e=>{if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase();return t===`input`||t===`textarea`||e.isContentEditable},t=t=>{if(t.defaultPrevented||e(t.target))return;let n=t.key.toLowerCase();t.metaKey||t.ctrlKey||t.altKey||(n===`s`?tt():n===`l`?et(Qe,`Link copied`):n===`h`?U&&et(U,`Hash copied`):n===`z`?Ut.onClick?.(new MouseEvent(`click`)):n===`p`?Ot.onClick?.(new MouseEvent(`click`)):n===`g`&&Nt())};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[tt,et,Qe,U,Ut,Ot,Nt]);let Sn=(0,K.useCallback)(e=>{let t=e?.silent??!0;if(!PT(k??null,U,He))return null;let n=FT(o,k??null);if(n)return n;n=crypto.getRandomValues(new Uint32Array(4)).join(``);try{let e=new URL(window.location.href);e.searchParams.set(`t`,n),t?window.history.replaceState(null,``,`${e.pathname}${e.search}${e.hash}`):r(`${e.pathname}${e.search}${e.hash}`,{replace:!0})}catch{}return E(e=>e&&{...e,transferNonce:n}),Me(`active`),n},[k,U,He,o,E,r,Me]),[Cn,wn]=(0,K.useState)(0),Tn=(0,K.useCallback)(async()=>{if(!Zt)return SC(_,`Verify Stewardship first`);if(!k)return SC(_,`No payload`);if(W)return;let e=A||PE(),t=Number(Cn)||0;if(t<=0)return SC(_,`Enter an amount > 0`);let n=PT(k??null,U,He),r=FT(o,k??null);if(r||=Sn({silent:!0})||null,!n||!r)return SC(_,`Link not initialized`);if(Ne&&Ne!==r)return SC(_,`Archived link — cannot exhale from here`);G(!0);let{ok:i,id:a}=vE(n,r,e);if(me.current=a,!i)return G(!1),SC(_,`Another exhale is in progress`);try{let{merged:e}=CT(n,new URLSearchParams(window.location.search),r),i=wE({originalAmount:typeof e.originalAmount==`number`?e.originalAmount:typeof k?.originalAmount==`number`?k.originalAmount:qe?.valuePhi??0,debits:Array.isArray(e.debits)?e.debits:[]});if(t>Math.max(0,(i.originalAmount??0)-xE(i.debits||[]))+fE)return SC(_,`Amount exceeds available`);let a=await _n();if(!a)return SC(_,`Could not derive Φkey`);let o={amount:Number(t.toFixed(6)),nonce:crypto.getRandomValues(new Uint32Array(4)).join(``),recipientPhiKey:a,timestamp:A||PE()};ST(wE({originalAmount:i.originalAmount,debits:[...i.debits??[],o]}),n,r,{broadcast:!0});let{merged:s}=CT(n,new URLSearchParams(window.location.search),r),c=wE(s);if(!(c.debits??[]).some(e=>e.nonce===o.nonce)){SC(_,`Exhale conflicted — try again`);return}E(e=>{if(!e)return e;let t={...e};return t.originalAmount=typeof c.originalAmount==`number`?c.originalAmount:typeof t.originalAmount==`number`?t.originalAmount:qe?.valuePhi??0,t.debits=Array.isArray(c.debits)?c.debits:[],t.totalDebited=xE(t.debits),t}),wn(0),SC(_,`Sent ${AC(o.amount)} Φ`),xn(o.amount,r)}finally{yE(n,r,me.current,A),G(!1)}},[Zt,k,k?.originalAmount,qe?.valuePhi,Cn,Ne,U,He,o,E,_n,xn,wn,W,Sn]),En=Ct||Re||kt||Te||be&&Qt;(0,K.useEffect)(()=>{let e=`bp-open`;return En?document.body.classList.add(e):document.body.classList.remove(e),()=>document.body.classList.remove(e)},[En]);let[Dn,On]=(0,K.useState)(!1),kn=(0,K.useCallback)(()=>{On(!0),window.setTimeout(()=>On(!1),2e3)},[]),An=le(()=>{et(U||``,`Hash copied`)}),jn=le(async()=>{await et(Qe,`Link copied`)&&kn()}),Mn=le(()=>{tt()}),Nn=(0,q.jsxs)(ye,{frameRef:b,children:[!Gt&&!Kt&&k&&(0,q.jsx)(`div`,{id:`sigil-stage`,style:{position:`relative`,width:v,height:v,margin:`0 auto`},children:(0,q.jsx)(ne,{pulse:qt,beat:Jt,stepPct:yt,chakraDay:gt,size:v,hashMode:`deterministic`,origin:``,onReady:Wt})}),Gt&&(0,q.jsx)(`div`,{className:`sp-skeleton`,"aria-hidden":`true`}),Kt&&(0,q.jsx)(`div`,{className:`sp-error`,children:s===`notfound`?`Waiting for SVG upload or ?p= payload.`:`Unable to load sigil.`})]}),Pn=k?.lineage??[],Fn=(0,K.useCallback)((e,t)=>{let n=e=>typeof e==`object`&&!!e,r=e=>{if(typeof t==`string`)return t;if(!n(e))return``;let r=typeof e.reason==`string`?e.reason:``,i=n(e.detail)?e.detail:null,a=i&&typeof i.reason==`string`?i.reason:``;return r||a||``},i=e=>{if(!n(e))return null;let t=e.target;return t instanceof HTMLElement?t:null},a=r(e),o=i(e),s=a===`closeClick`||a===`close-button`||a===`explicit`||a===`close`,c=!!o?.closest?.(`[data-modal-close],[data-close],.sealmoment__close,.sp-modal__close,button[aria-label="Close"],button[aria-label="close"],button[title="Close"]`);if(s||c||e==null&&t==null){Ee(!1),Oe(``),Ae(``);return}},[]);return(0,q.jsxs)(`main`,{className:`sigilpage`,role:`main`,"aria-label":`Kai Sigil Page`,"data-owner-verified":Zt,"data-archived":Xt,"data-old-link":ct?`true`:`false`,"data-version":`v48`,children:[(0,q.jsx)(`div`,{className:`sp-veil`,"aria-hidden":`true`}),(0,q.jsx)(`div`,{className:`sp-veil-stars`,"aria-hidden":`true`}),(0,q.jsx)(`div`,{className:`sp-viewport`,"aria-hidden":!1,children:(0,q.jsxs)(`section`,{className:`sp-shell`,"data-center":!0,children:[(0,q.jsx)(ve,{glyphAuth:l,linkStatus:je,isArchived:Xt,localHash:U,copyHashPress:An}),(l===`authentic`||s===`verified`)&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`style`,{children:` /* ===== Divine Authority Seal — Ultra-Sleek, Compact, Centered ===== */ .authority-seal{ --gold:#ffd76e; --mint:#00ffc6; --aqua:#8ab4ff; --ink:#061012; --glass:rgba(10,14,15,.86); diff --git a/dist/assets/SigilStreamRoot-BUh8LwJG.js b/dist/assets/SigilStreamRoot-BUh8LwJG.js new file mode 100644 index 00000000..c1b98050 --- /dev/null +++ b/dist/assets/SigilStreamRoot-BUh8LwJG.js @@ -0,0 +1 @@ +import"./html2canvas-CgVfYVZf.js";import"./EternalKlock-DTPPu1Hz.js";import"./SigilModal-B4XBfcke.js";import"./SealMomentModal-BotOOPRg.js";import"./SigilAuthContext-CZfkVeGy.js";import"./sigilRegistry-NyXrDYsE.js";import"./SigilAuthProvider-Crre0ykb.js";import"./usernameClaimRegistry-_VlzEwdK.js";import{n as e,t}from"./SigilStreamRoot-D0R_paBX.js";import"./useFastPress-BuTJ0eyZ.js";export{t as SigilStreamRoot,e as default}; \ No newline at end of file diff --git a/dist/assets/SigilStreamRoot-CHI2vpVS.js b/dist/assets/SigilStreamRoot-CHI2vpVS.js deleted file mode 100644 index b72de543..00000000 --- a/dist/assets/SigilStreamRoot-CHI2vpVS.js +++ /dev/null @@ -1 +0,0 @@ -import"./html2canvas-wYdasO3I.js";import"./EternalKlock-DJuhZsZB.js";import"./SigilModal-Dtnhs3XF.js";import"./SealMomentModal-S7F0w9ki.js";import"./SigilAuthContext-Bpha3aI1.js";import"./sigilRegistry-DVCHqg2o.js";import"./SigilAuthProvider-Bf4S4o9t.js";import"./usernameClaimRegistry-BEUaCJlN.js";import{n as e,t}from"./SigilStreamRoot-lWOSVrBM.js";import"./useFastPress-Cbh2am8D.js";export{t as SigilStreamRoot,e as default}; \ No newline at end of file diff --git a/dist/assets/SigilStreamRoot-lWOSVrBM.js b/dist/assets/SigilStreamRoot-D0R_paBX.js similarity index 99% rename from dist/assets/SigilStreamRoot-lWOSVrBM.js rename to dist/assets/SigilStreamRoot-D0R_paBX.js index a9de5cb4..3bfa319a 100644 --- a/dist/assets/SigilStreamRoot-lWOSVrBM.js +++ b/dist/assets/SigilStreamRoot-D0R_paBX.js @@ -1,5 +1,5 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/postSeal-D7PFnOMd.js","assets/postSeal-ClZBwRbf.js"])))=>i.map(i=>d[i]); -import{Q as e,Sn as t,Tn as n,at as r,bn as i,ct as a,dn as o,et as s,gn as c,gt as l,hn as u,in as d,it as f,jn as p,mn as m,on as h,ot as g,pt as _,rn as v,rt as y,sn as b,tn as x,tt as S,un as C,ut as w,vn as T,w as E,wn as D,yn as O}from"./index-BGzUQCv_.js";import{n as k}from"./EternalKlock-DJuhZsZB.js";import{n as A}from"./SigilAuthContext-Bpha3aI1.js";import{n as ee,t as j}from"./sigilRegistry-DVCHqg2o.js";import{t as M}from"./SigilAuthProvider-Bf4S4o9t.js";import{a as te,i as N,n as ne,o as re,r as ie,t as ae}from"./usernameClaimRegistry-BEUaCJlN.js";import{t as oe}from"./useFastPress-Cbh2am8D.js";var P=p(n(),1);const se=(0,P.createContext)(null);function ce(){let e=(0,P.useContext)(se);if(!e)throw Error(`useToasts() must be used within `);return e}var F=p(x(),1);function le({children:e}){let[t,n]=(0,P.useState)([]),r=(0,P.useRef)(new Map),i=(0,P.useRef)(1),a=(0,P.useCallback)(e=>{let t=r.current.get(e);typeof t==`number`&&(window.clearTimeout(t),r.current.delete(e))},[]),o=(0,P.useCallback)(e=>{a(e),n(t=>t.filter(t=>t.id!==e))},[a]),s=(0,P.useCallback)((e,t)=>{let s=i.current++;n(n=>{let r=[{id:s,kind:e,text:t},...n],i=r.slice(0,3),o=r.slice(3);for(let e of o)a(e.id);return i});let c=window.setTimeout(()=>o(s),2600);r.current.set(s,c)},[a,o]),c=(0,P.useMemo)(()=>({push:s}),[s]);(0,P.useEffect)(()=>()=>{for(let e of r.current.values())window.clearTimeout(e);r.current.clear()},[]);let l=e=>{switch(e){case`success`:return`rgba(16,28,22,.88)`;case`warn`:return`rgba(28,24,12,.88)`;case`error`:return`rgba(36,16,16,.88)`;case`info`:default:return`rgba(12,18,28,.88)`}};return(0,F.jsxs)(se.Provider,{value:c,children:[e,(0,F.jsx)(`div`,{"aria-live":`polite`,"aria-atomic":`false`,style:{position:`fixed`,left:0,right:0,bottom:0,padding:`8px 12px`,display:`grid`,gap:8,zIndex:1e3,pointerEvents:`none`},children:t.map(e=>(0,F.jsx)(`div`,{role:`status`,style:{pointerEvents:`auto`,marginInline:`auto`,maxWidth:`min(720px, 100%)`,width:`100%`,background:l(e.kind),border:`1px solid rgba(255,255,255,.12)`,borderRadius:12,padding:`10px 12px`,color:`rgb(236,241,251)`,boxShadow:`0 8px 28px rgba(0,0,0,.35)`,backdropFilter:`blur(6px)`,fontVariantNumeric:`tabular-nums`},children:e.text},e.id))})]})}var I=le;function L(e){return String(e).padStart(2,`0`)}function R(e,t){let n=e%t;return n<0n?n+(t<0n?-t:t):n}function z(e,t){let n=e/t,r=e%t;return r!==0n&&r>0n!=t>0n?n-1n:n}function ue(e){if(!Number.isFinite(e))return 0n;let t=e<0?-1:1,n=Math.abs(e),r=Math.trunc(n),i=n-r;return i<.5?BigInt(t*r):i>.5?BigInt(t*(r+1)):BigInt(t*(r%2==0?r:r+1))}function B(e,t){try{let n=t instanceof Error?t.message:String(t);console.warn(`[SigilStream:${e}] ${n}`)}catch{}}function V(e){return typeof e==`object`&&!!e}function de(e){try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}}function H(e,t){if(!V(e))return;let n=e[t];if(typeof n==`string`)return n;let r=e.meta;if(V(r)){let e=r[t];if(typeof e==`string`)return e}}function fe(e){let t=e;if(V(t)&&`auth`in t&&(t=t.auth),V(t)){let e=t.meta,n=t.svgText;return{meta:V(e)?e:null,svgText:typeof n==`string`?n:null}}return{meta:null,svgText:null}}async function pe(){try{let e=await fetch(`/links.json`,{cache:`no-store`});if(!e.ok||!(e.headers.get(`content-type`)??``).toLowerCase().includes(`application/json`))return[];let t=await e.text(),n=JSON.parse(t);if(!Array.isArray(n))return[];let r=[];for(let e of n)V(e)&&typeof e.url==`string`&&e.url.trim().length&&r.push({url:e.url});return r}catch(e){return B(`loadLinksJson`,e),[]}}const U=`sf-links`;function W(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)&&t.every(e=>typeof e==`string`)?t:[]}catch(e){return B(`parseStringArray`,e),[]}}function G(e){try{if(typeof window>`u`)return;let t=W(localStorage.getItem(U)),n=e.filter(e=>typeof e==`string`&&e.trim().length);if(n.length===0)return;let r=new Set(t),i=n.filter(e=>!r.has(e));if(i.length===0)return;let a=[...i,...t];localStorage.setItem(U,JSON.stringify(a))}catch(e){B(`prependUniqueToStorage`,e)}}const me=(()=>{try{return((typeof window<`u`?window.__PSHORT__:void 0)?.trim()||(void 0)?.trim()||``).replace(/\s+/g,``)}catch(e){return B(`Resolve PSHORT`,e),``}})();function he(){try{if(me)return new URL(`/`,me)}catch(e){B(`Invalid PSHORT`,e)}let e=typeof window<`u`?window.location.href:`https://example.com`;return new URL(`/`,e)}function K(){let e=typeof window<`u`?window.location.href:`https://example.com`;return new URL(`/`,e)}function ge(e){try{let t=new URL(e);if(!(t.protocol===`https:`||t.protocol===`http:`))return!1;let n=t.pathname;if(n.startsWith(`/stream/p/`)||n.startsWith(`/p~`)&&n.length>3)return!0;if(n===`/p`){let e=t.hash.includes(`t=`),n=t.searchParams.has(`t`);return e||n}return t.search.includes(`p=`)}catch{return!1}}function _e(e){try{let t=he(),n=new URL(e,t),r=K();if(n.pathname.startsWith(`/p~`)&&n.pathname.length>3){r.pathname=`/stream/p/${n.pathname.slice(3)}`;let e=n.searchParams.get(`add`)||(n.hash.startsWith(`#add=`)?new URLSearchParams(n.hash.slice(1)).get(`add`):null);return e&&r.searchParams.set(`add`,ve(e)),r.toString()}if(n.pathname===`/p`){let t=n.hash.startsWith(`#`)?n.hash.slice(1):n.hash,i=new URLSearchParams(t),a=i.get(`t`),o=n.searchParams.get(`t`),s=a||o;if(!s)return e;r.pathname=`/stream/p/${s}`;let c=i.get(`add`),l=n.searchParams.get(`add`),u=c||l;return u&&r.searchParams.set(`add`,ve(u)),r.toString()}return e}catch(t){return B(`expandShortAliasToCanonical`,t),e}}function ve(e){let t=e.trim();if(!t)return t;try{if(t.startsWith(`/p~`))return _e(`${he().origin}${t}`);if(t.startsWith(`/p#t=`)||t.startsWith(`#t=`)||t.includes(`/p?t=`))return _e(t.startsWith(`#t=`)?`${he().origin}/p${t}`:t.startsWith(`/p`)?`${he().origin}${t}`:t);if(de(t)){let e=new URL(t);return e.pathname===`/p`||e.pathname.startsWith(`/p~`)?_e(t):t}return t}catch(e){return B(`normalizeAddParam`,e),t}}function ye(e){let t=K();return t.pathname=`/stream/p/${e}`.replace(/\/{2,}/g,`/`),t.search=``,t.hash=``,t.toString()}function be(e){let t=e.trim();if(t.startsWith(`#`)&&(t=t.slice(1)),t.length===3&&(t=t.split(``).map(e=>e+e).join(``)),t.length!==6)return null;let n=parseInt(t,16);return[n>>16&255,n>>8&255,n&255]}var xe=(e,t=0,n=255)=>Math.max(t,Math.min(n,e));function Se(e,t,n){return[xe(e[0]+(t[0]-e[0])*n),xe(e[1]+(t[1]-e[1])*n),xe(e[2]+(t[2]-e[2])*n)]}var Ce=e=>`${e[0]}, ${e[1]}, ${e[2]}`,we={root:`#FF3B3B`,sacral:`#FF8A33`,solar:`#FFD60A`,heart:`#22C55E`,throat:`#0EA5E9`,thirdEye:`#6366F1`,crown:`#C084FC`},Te=`crown`;function Ee(e){if(e==null)return null;let t;return t=typeof e==`number`?[`root`,`sacral`,`solar`,`heart`,`throat`,`thirdEye`,`crown`][Math.min(7,Math.max(1,e))-1]:e===`krown`?Te:e,be(we[t]??we.crown)}function De(e){let t=Ee(e);if(!t)return null;let n=[255,255,255],r=[255,215,128],i=Se(t,n,.28),a=Se(t,r,.42);return{s1:Ce(t),s2:Ce(i),s3:Ce(a)}}var Oe={s1:`154, 230, 255`,s2:`196, 181, 253`,s3:`255, 215, 128`};function ke(e,t){let n=De(e);if(n)return n;if(t?.primary){let e=be(t.primary)??be(`#9AE6FF`),n=t.secondary?be(t.secondary)??e:Se(e,[255,255,255],.28),r=[255,215,128],i=t.accent?be(t.accent)??r:Se(e,r,.45);return{s1:Ce(e),s2:Ce(n),s3:Ce(i)}}return Oe}function Ae(e){if(!e)return;let t=e.trim();if(t)return t.startsWith(`@`),t}function je({username:e,phiKey:t,kaiSignature:n,sigilColors:r,chakra:i}){let a=ke(i,r),o=Ae(e),s={"--sigil-1":a.s1,"--sigil-2":a.s2,"--sigil-3":a.s3},c=!o&&!t&&!n;return(0,F.jsx)(`div`,{className:`sf-identity`,style:s,...c?{"data-empty":``}:{},children:(0,F.jsxs)(`div`,{className:`sf-reply-id`,style:{rowGap:`.4rem`,columnGap:`.4rem`,display:`flex`,flexWrap:`wrap`},"aria-label":c?`No identity loaded`:`Identity chips`,children:[c&&(0,F.jsx)(`span`,{className:`sf-muted`,children:`No identity loaded this session.`}),o&&(0,F.jsxs)(`span`,{className:`sf-pill sf-pill--user`,title:`Username (session)`,children:[(0,F.jsx)(`strong`,{className:`sf-pill__label`,children:`User`}),`\xA0`,(0,F.jsx)(`span`,{className:`sf-key`,children:o})]}),t&&(0,F.jsxs)(`span`,{className:`sf-pill sf-pill--phikey`,title:`Your ΦKey (session)`,children:[(0,F.jsx)(`strong`,{className:`sf-pill__label`,children:`ΦKey`}),`\xA0`,(0,F.jsx)(`span`,{className:`sf-key`,children:t})]}),n&&(0,F.jsxs)(`span`,{className:`sf-pill sf-pill--ksig`,title:`Kai Signature (session)`,children:[(0,F.jsx)(`strong`,{className:`sf-pill__label`,children:`ΣSig`}),`\xA0`,(0,F.jsx)(`span`,{className:`sf-key`,children:n})]})]})})}var Me=[`sigilActionUrl`,`sigilUrl`,`actionUrl`,`claimedUrl`,`loginUrl`,`sourceUrl`,`originUrl`,`url`,`link`,`href`];function Ne(e){if(!e||!V(e))return[];let t=[],n=new Set;for(let r of Me){let i=H(e,r);if(typeof i!=`string`)continue;let a=i.trim();a&&(n.has(a)||(n.add(a),t.push(a)))}return t}function Pe(e){if(!e)return[];try{let t=e.match(/https?:\/\/[^\s"'<>)#]+/gi)??[],n=[],r=new Set;for(let e of t){let t=(e??``).trim();t&&(r.has(t)||(r.add(t),n.push(t)))}return n}catch{return[]}}function Fe(e){return/^https?:\/\//i.test((e??``).trim())}function Ie(e){try{return new URL(e)}catch{return null}}function Le(e){let t=(e??``).trim();if(!t)return``;let n=t;n=n.replace(/\/stream\/v=/gi,`/stream/t=`),n=n.replace(/\/stream\/v\//gi,`/stream/t/`),n=n.replace(/\/stream\/v(\?|&|#)/gi,`/stream/t$1`),n=n.replace(/([?&#])v=/gi,`$1t=`);let r=Ie(n);if(!r)return n.replace(/([?&#])v=/gi,`$1t=`);let i=r.searchParams,a=(i.get(`t`)??``).trim().length>0,o=(i.get(`v`)??``).trim();if(!a&&o&&i.set(`t`,o),i.delete(`v`),(i.get(`t`)??``).trim().length>0&&i.delete(`p`),r.hash&&r.hash.length>1){let e=r.hash.startsWith(`#`)?r.hash.slice(1):r.hash;if(e.includes(`=`)&&!e.startsWith(`/`)){let t=e.split(`&`).filter(Boolean),n=[],i=!1;for(let e of t){let t=e.indexOf(`=`);if(t<=0){n.push(e);continue}let r=e.slice(0,t),a=e.slice(t+1),o=r.toLowerCase();if(o===`v`){!i&&a.trim().length&&(n.push(`t=${a}`),i=!0);continue}o===`t`&&(i=!0),n.push(e)}if(i){let e=[];for(let t of n){let n=t.indexOf(`=`);(n>0?t.slice(0,n).toLowerCase():``)!==`p`&&e.push(t)}r.hash=e.length?`#${e.join(`&`)}`:``}else r.hash=n.length?`#${n.join(`&`)}`:``}else r.hash=r.hash.replace(/([?&#])v=/gi,`$1t=`)}return r.toString()}function Re(e){let t=(e??``).trim();if(!t)return-1;let n=t.toLowerCase(),r=0;return(/[?&#]v=/.test(n)||n.includes(`/stream/v`))&&(r-=1e4),(/[?&#]t=/.test(n)||n.includes(`/stream/t`)||n.includes(`stream/t=`))&&(r+=500),(/[?&#]p=/.test(n)||n.includes(`/stream/p`)||n.includes(`stream/p=`))&&(r+=280),ge(t)&&(r+=160),n.startsWith(`https://`)?r+=20:n.startsWith(`http://`)&&(r+=10),r+=Math.max(0,120-Math.min(120,Math.floor(t.length/6))),r}function ze(e){let t=``,n=-1;for(let r of e){let e=Le(r),i=Re(e);i>n&&(n=i,t=e)}return t}async function Be(e){let t=e??``;if(!t)return!1;try{if(typeof navigator<`u`&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(t),!0}catch{}try{let e=document.createElement(`textarea`);e.value=t,e.setAttribute(`readonly`,`true`),e.style.position=`fixed`,e.style.left=`-9999px`,e.style.top=`-9999px`,document.body.appendChild(e),e.select(),e.setSelectionRange(0,e.value.length);let n=document.execCommand(`copy`);return document.body.removeChild(e),n}catch{return!1}}function Ve({value:e,isCanonical:t}){let n=(0,P.useMemo)(()=>Ie(e),[e]),r=(0,P.useMemo)(()=>Fe(e)?e:``,[e]),[i,a]=(0,P.useState)(!1),[o,s]=(0,P.useState)(!1),c=(0,P.useRef)(null);(0,P.useEffect)(()=>()=>{c.current&&window.clearTimeout(c.current)},[]);let l=(0,P.useCallback)(e=>{c.current&&window.clearTimeout(c.current),a(e),s(!e),c.current=window.setTimeout(()=>{a(!1),s(!1),c.current=null},1400)},[]),u=(0,P.useCallback)(async()=>{l(await Be(e))},[l,e]),d=(0,P.useCallback)(e=>{let t=e.currentTarget;try{t.focus(),t.select(),t.setSelectionRange(0,t.value.length)}catch{}},[]),f=n?.host??``,p=n?`${n.hostname}${n.pathname}${n.search}${n.hash}`.replace(/\/{2,}/g,`/`):e;return(0,F.jsxs)(`div`,{className:`sf-reply-row sf-actionurl`,children:[(0,F.jsxs)(`div`,{className:`sf-actionurl__head`,children:[(0,F.jsxs)(`label`,{className:`sf-label sf-actionurl__label`,children:[`Proof of Breath™ `,(0,F.jsx)(`span`,{className:`sf-muted`,children:`(Sigil-Glyph)`})]}),(0,F.jsx)(`span`,{className:`sf-actionurl__pill ${t?`is-ok`:`is-warn`}`,children:t?`SIGNED`:`EXTERNAL`})]}),(0,F.jsxs)(`div`,{className:`sf-actionurl__field`,children:[(0,F.jsxs)(`div`,{className:`sf-actionurl__inputWrap`,children:[(0,F.jsx)(`input`,{className:`sf-input sf-input--locked sf-actionurl__input`,type:`url`,value:e,readOnly:!0,onClick:d,onFocus:d,"aria-label":`Proof of Breath™ Sigil-Glyph`}),(0,F.jsxs)(`div`,{className:`sf-actionurl__meta`,"aria-hidden":`true`,children:[f?(0,F.jsx)(`span`,{className:`sf-actionurl__host`,children:f}):(0,F.jsx)(`span`,{className:`sf-actionurl__host`,children:`URL`}),(0,F.jsx)(`span`,{className:`sf-actionurl__dot`,children:`•`}),(0,F.jsx)(`span`,{className:`sf-actionurl__pretty`,children:p})]})]}),(0,F.jsxs)(`div`,{className:`sf-actionurl__btns`,children:[(0,F.jsx)(`button`,{type:`button`,className:`sf-actionurl__btn ${i?`is-copied`:``} ${o?`is-fail`:``}`,onClick:u,"aria-live":`polite`,children:i?`✓ Remembered`:o?`Remember failed`:`Remember`}),r?(0,F.jsx)(`a`,{className:`sf-actionurl__btn sf-actionurl__btn--link`,href:r,target:`_blank`,rel:`noreferrer noopener`,"aria-label":`Open Proof of Breath URL in a new tab`,children:`↗`}):(0,F.jsx)(`button`,{type:`button`,className:`sf-actionurl__btn sf-actionurl__btn--disabled`,disabled:!0,children:`↗`})]})]}),!t&&(0,F.jsx)(`div`,{className:`sf-warn sf-actionurl__warn`,role:`status`,children:`Not recognized as a sealed Proof of Breath™ link; fallback rules may apply.`})]})}function He(){return(0,F.jsxs)(`div`,{className:`sf-reply-row sf-actionurl sf-actionurl--empty`,children:[(0,F.jsxs)(`div`,{className:`sf-actionurl__head`,children:[(0,F.jsxs)(`label`,{className:`sf-label sf-actionurl__label`,children:[`Proof of Breath™ `,(0,F.jsx)(`span`,{className:`sf-muted`,children:`(Sigil-Glyph)`})]}),(0,F.jsx)(`span`,{className:`sf-actionurl__pill is-warn`,children:`MISSING`})]}),(0,F.jsx)(`div`,{className:`sf-warn sf-actionurl__warn`,role:`status`,children:`No Proof of Breath™ sigil-glyph detected; a fallback will be used.`})]})}function Ue({meta:e,svgText:t}){let n=Ne(e),r=Pe(t),i=[...n,...r],a=i.length?ze(i):``,o=a.length>0&&ge(a);return{value:a,isCanonical:o,node:a?(0,F.jsx)(Ve,{value:a,isCanonical:o}):(0,F.jsx)(He,{})}}function We(e){let t=e.trim();if(!t)return null;let n=t.replace(/^(kai|sigil):\/\//i,`https://`);try{if(de(n))return n;if(/^[a-z0-9.-]+\.[a-z]{2,}(?:\/.*)?$/i.test(n))return`https://${n}`}catch{}return null}function Ge({onAdd:e,placeholder:t=`Paste any message (https://… or domain.tld)`,title:n=`Inhale a memory`}){let r=ce(),[i,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(null),c=(0,P.useCallback)(t=>{s(null);let n=We(t);if(!n){s(`Enter a valid URL (https://… or domain.tld).`);return}e(n),a(``),r.push(`success`,`Link inhaled.`)},[e,r]),l=(0,P.useCallback)(async()=>{s(null);try{let e=(await navigator.clipboard.readText()).trim();if(!e){s(`Memory is empty.`);return}let t=We(e);if(!t){s(`Memory does not contain a valid link.`);return}a(t),c(t)}catch{s(`Memory read is not permitted.`)}},[c]);return(0,F.jsxs)(`section`,{className:`sf-inhaler`,"aria-labelledby":`inhaler-title`,style:{marginTop:`1rem`},children:[(0,F.jsx)(`h2`,{id:`inhaler-title`,className:`sf-reply-title`,children:n}),(0,F.jsxs)(`div`,{className:`sf-reply-row`,style:{display:`grid`,gap:`.5rem`},children:[(0,F.jsx)(`input`,{className:`sf-input`,type:`url`,placeholder:t,value:i,onChange:e=>a(e.target.value),autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,inputMode:`url`,enterKeyHint:`go`,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),c(i))}}),(0,F.jsxs)(`div`,{className:`sf-reply-actions`,style:{gap:`.5rem`,display:`flex`,flexWrap:`wrap`},children:[(0,F.jsx)(`button`,{className:`sf-btn`,onClick:()=>c(i),children:`Inhale`}),(0,F.jsx)(`button`,{className:`sf-btn sf-btn--ghost`,onClick:l,children:`Inhale from memory`})]}),o&&(0,F.jsx)(`div`,{className:`sf-error`,role:`alert`,children:o})]})]})}const Ke=[`Solhara`,`Aquaris`,`Flamora`,`Verdari`,`Sonari`,`Kaelith`],qe={Solhara:`Root`,Aquaris:`Sacral`,Flamora:`Solar Plexus`,Verdari:`Heart`,Sonari:`Throat`,Kaelith:`Krown`},Je=[`Aethon`,`Virelai`,`Solari`,`Amarin`,`Kaelus`,`Umbriel`,`Noktura`,`Liora`],Ye=[`Awakening Flame`,`Flowing Heart`,`Radiant Will`,`Harmonic Voh`,`Inner Mirror`,`Dreamfire Memory`,`Krowned Light`],Xe=Date.UTC(2024,4,10,6,45,41,888),Ze=3+Math.sqrt(5),Qe=Ze*1e3,$e=1000000n,et=17491270421n,tt=11000000n,nt=(et+18n)/36n;function rt(e){return ue((e.getTime()-Xe)/1e3/Ze*1e6)}function it(e){let t=rt(e),n=R(t,et),r=z(t,et),i=Number(z(n,nt)),a=n-BigInt(i)*nt,o=Number(a/tt),s=Math.min(Math.max(o,0),43),c=a-BigInt(s)*tt,l=Number(c)/Number(tt),u=Number(z(t,$e)),d=Number(a/$e),f=Number(n/$e),p=Ke[Number(R(r,BigInt(6)))],m=qe[p],h=Number(r),g=(h%42+42)%42+1,_=(Math.floor(h/42)%8+8)%8,v=_+1,y=Je[_],b=Math.floor(h/336),x=Math.floor((g-1)/6),S=Ye[x];return{pulse:u,beat:i,step:s,stepPct:l,pulsesIntoBeat:d,pulsesIntoDay:f,harmonicDay:p,chakraDay:m,chakraStepString:`${i}:${L(s)}`,dayOfMonth:g,monthIndex0:_,monthIndex1:v,monthName:y,yearIndex:b,weekIndex:x,weekName:S,_pμ_in_day:n,_pμ_in_beat:a}}function at(e){try{let t=new URL(e).pathname.split(`/`).pop()||``,n=t.lastIndexOf(`.`);return n>=0?t.slice(n+1).toLowerCase():``}catch{return``}}function ot(e){return[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`bmp`].includes(e)}function st(e){return[`mp4`,`webm`,`ogg`,`ogv`,`mov`,`m4v`].includes(e)}function ct(e){return e===`pdf`}function lt(e){try{return new URL(e).host}catch{return``}}function ut(e){try{let t=new URL(e),n=t.host,r=t.pathname||``;r===`/`&&(r=``),r.endsWith(`/`)&&r.length>1&&(r=r.slice(0,-1));let i=t.search||``;return`${n}${r}${i}`}catch{return e.replace(/^https?:\/\//i,``).replace(/\/+$/g,``)}}function dt(e){try{let t=new URL(e);if(t.hostname.includes(`youtu.be`))return t.pathname.slice(1)||null;if(t.hostname.includes(`youtube.com`)){let e=t.searchParams.get(`v`);if(e)return e;let n=t.pathname.split(`/`).filter(Boolean),r=n.indexOf(`embed`);if(r>=0&&n[r+1])return n[r+1]}return null}catch{return null}}function ft(e){try{let t=new URL(e);return t.hostname.includes(`vimeo.com`)&&t.pathname.split(`/`).filter(Boolean).find(e=>/^\d+$/.test(e))||null}catch{return null}}function pt(e){try{let t=new URL(e);return t.hostname.includes(`spotify.com`)&&(t.pathname.startsWith(`/track/`)||t.pathname.startsWith(`/album/`)||t.pathname.startsWith(`/playlist/`))?`https://open.spotify.com/embed${t.pathname}${t.search}`:null}catch{return null}}function mt({host:e}){return(0,F.jsx)(`img`,{className:`sf-favicon`,src:`https://${e}/favicon.ico`,alt:``,width:16,height:16,loading:`eager`,decoding:`async`,onError:e=>{e.currentTarget.style.visibility=`hidden`}})}function ht(e){let{url:t,title:n,children:r}=e,i=lt(t),a=(n&&n.trim().length?n.trim():``)||ut(t);return(0,F.jsxs)(`div`,{className:`sf-att-card`,children:[(0,F.jsx)(`div`,{className:`sf-att-head`,children:(0,F.jsxs)(`a`,{className:`sf-att-head__hit`,href:t,target:`_blank`,rel:`noopener noreferrer`,title:t,children:[i?(0,F.jsx)(mt,{host:i}):(0,F.jsx)(`span`,{className:`sf-favicon sf-favicon--blank`,"aria-hidden":`true`}),(0,F.jsx)(`div`,{className:`sf-att-head__text`,children:(0,F.jsx)(`div`,{className:`sf-att-head__title`,children:a})}),(0,F.jsx)(`span`,{className:`sf-att-open`,"aria-hidden":`true`,children:`↗`})]})}),r?(0,F.jsx)(`div`,{className:`sf-att-body`,children:r}):null]})}function gt({src:e,title:t}){return(0,F.jsx)(`div`,{className:`sf-embed`,children:(0,F.jsx)(`iframe`,{className:`sf-embed__frame`,src:e,title:t,loading:`eager`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share`,allowFullScreen:!0,sandbox:`allow-same-origin allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox`})})}function _t({url:e,title:t}){return(0,F.jsx)(ht,{url:e,title:t})}function vt({url:e,title:t}){let n=dt(e);if(n)return(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(gt,{src:`https://www.youtube.com/embed/${n}`,title:t||`YouTube`})});let r=ft(e);if(r)return(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(gt,{src:`https://player.vimeo.com/video/${r}`,title:t||`Vimeo`})});let i=pt(e);if(i)return(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(gt,{src:i,title:t||`Spotify`})});let a=at(e);return ot(a)?(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(`div`,{className:`sf-media sf-media--image`,children:(0,F.jsx)(`img`,{className:`sf-media__img`,src:e,alt:t||`image`,loading:`eager`,decoding:`async`})})}):st(a)?(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(`div`,{className:`sf-media sf-media--video`,children:(0,F.jsx)(`video`,{className:`sf-media__video`,src:e,controls:!0,playsInline:!0,preload:`metadata`})})}):ct(a)?(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(`div`,{className:`sf-embed sf-embed--doc`,children:(0,F.jsx)(`iframe`,{className:`sf-embed__frame`,src:e,title:t||`Document`,loading:`eager`})})}):(0,F.jsx)(_t,{url:e,title:t})}function yt(e){let t=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`)),n=``;for(let r=0;r`data:${t};base64,${xt(e)}`;async function Ct(e){let t=typeof crypto<`u`&&crypto.subtle||typeof window<`u`&&window.crypto&&window.crypto.webkitSubtle;if(!t)throw Error(`WebCrypto.subtle is not available in this context.`);let n=await t.digest(`SHA-256`,e);return yt(new Uint8Array(n))}async function wt(e,t=524288){let n=[],r=0,i=0;for(let a of Array.from(e)){r+=a.size;try{let e=await a.arrayBuffer(),r=await Ct(e),o=a.type||`application/octet-stream`;if(a.size<=t){let t=bt(new Uint8Array(e)),s={kind:`file-inline`,name:a.name,type:o,size:a.size,sha256:r,data_b64url:t};i+=a.size,n.push(s)}else{let e={kind:`file-ref`,name:a.name,type:o,size:a.size,sha256:r};n.push(e)}}catch(e){B(`filesToManifest: read/hash failed`,e)}}return{version:1,totalBytes:r,inlinedBytes:i,items:n}}function Tt({n:e}){if(typeof e!=`number`||!Number.isFinite(e)||e<0)return(0,F.jsx)(F.Fragment,{children:`—`});let t=1024,n=t*1024,r=n*1024;return(0,F.jsx)(F.Fragment,{children:e>=r?`${(e/r).toFixed(2)} GB`:e>=n?`${(e/n).toFixed(2)} MB`:e>=t?`${(e/t).toFixed(2)} KB`:`${Math.round(e)} B`})}function Et({it:e}){let t=e.type||`application/octet-stream`,n=St(e.data_b64url,t),r=e.name||`file`;if(t.startsWith(`image/`))return(0,F.jsxs)(`div`,{className:`sf-media sf-media--image`,children:[(0,F.jsx)(`img`,{src:n,alt:r,loading:`eager`,decoding:`async`}),(0,F.jsxs)(`div`,{className:`sf-file-meta`,children:[(0,F.jsx)(`span`,{children:r}),(0,F.jsx)(`span`,{children:(0,F.jsx)(Tt,{n:e.size})})]}),(0,F.jsx)(`a`,{className:`sf-file-dl`,href:n,download:r,children:`Download`})]});if(t.startsWith(`video/`))return(0,F.jsxs)(`div`,{className:`sf-media sf-media--video`,children:[(0,F.jsx)(`video`,{src:n,controls:!0,playsInline:!0,preload:`metadata`}),(0,F.jsxs)(`div`,{className:`sf-file-meta`,children:[(0,F.jsx)(`span`,{children:r}),(0,F.jsx)(`span`,{children:(0,F.jsx)(Tt,{n:e.size})})]}),(0,F.jsx)(`a`,{className:`sf-file-dl`,href:n,download:r,children:`Download`})]});if(t.startsWith(`audio/`))return(0,F.jsxs)(`div`,{className:`sf-media sf-media--audio`,children:[(0,F.jsx)(`audio`,{src:n,controls:!0,preload:`metadata`}),(0,F.jsxs)(`div`,{className:`sf-file-meta`,children:[(0,F.jsx)(`span`,{children:r}),(0,F.jsx)(`span`,{children:(0,F.jsx)(Tt,{n:e.size})})]}),(0,F.jsx)(`a`,{className:`sf-file-dl`,href:n,download:r,children:`Download`})]});let i=t.startsWith(`text/`)||[`application/json`,`application/xml`,`application/svg+xml`].includes(t),a=null;if(i)try{a=atob(e.data_b64url.replace(/-/g,`+`).replace(/_/g,`/`)).slice(0,1200)}catch{a=null}return(0,F.jsxs)(`div`,{className:`sf-file`,children:[(0,F.jsxs)(`div`,{className:`sf-file-head`,children:[(0,F.jsx)(`div`,{className:`sf-file-name`,children:e.relPath||r}),(0,F.jsx)(`div`,{className:`sf-file-size`,children:(0,F.jsx)(Tt,{n:e.size})})]}),a&&(0,F.jsxs)(`pre`,{className:`sf-file-pre`,"aria-label":`${r} preview`,children:[a,a.length>=1200?` +import{Q as e,Sn as t,Tn as n,at as r,bn as i,ct as a,dn as o,et as s,gn as c,gt as l,hn as u,in as d,it as f,jn as p,mn as m,on as h,ot as g,pt as _,rn as v,rt as y,sn as b,tn as x,tt as S,un as C,ut as w,vn as T,w as E,wn as D,yn as O}from"./index-CcPm2yTY.js";import{n as k}from"./EternalKlock-DTPPu1Hz.js";import{n as A}from"./SigilAuthContext-CZfkVeGy.js";import{n as ee,t as j}from"./sigilRegistry-NyXrDYsE.js";import{t as M}from"./SigilAuthProvider-Crre0ykb.js";import{a as te,i as N,n as ne,o as re,r as ie,t as ae}from"./usernameClaimRegistry-_VlzEwdK.js";import{t as oe}from"./useFastPress-BuTJ0eyZ.js";var P=p(n(),1);const se=(0,P.createContext)(null);function ce(){let e=(0,P.useContext)(se);if(!e)throw Error(`useToasts() must be used within `);return e}var F=p(x(),1);function le({children:e}){let[t,n]=(0,P.useState)([]),r=(0,P.useRef)(new Map),i=(0,P.useRef)(1),a=(0,P.useCallback)(e=>{let t=r.current.get(e);typeof t==`number`&&(window.clearTimeout(t),r.current.delete(e))},[]),o=(0,P.useCallback)(e=>{a(e),n(t=>t.filter(t=>t.id!==e))},[a]),s=(0,P.useCallback)((e,t)=>{let s=i.current++;n(n=>{let r=[{id:s,kind:e,text:t},...n],i=r.slice(0,3),o=r.slice(3);for(let e of o)a(e.id);return i});let c=window.setTimeout(()=>o(s),2600);r.current.set(s,c)},[a,o]),c=(0,P.useMemo)(()=>({push:s}),[s]);(0,P.useEffect)(()=>()=>{for(let e of r.current.values())window.clearTimeout(e);r.current.clear()},[]);let l=e=>{switch(e){case`success`:return`rgba(16,28,22,.88)`;case`warn`:return`rgba(28,24,12,.88)`;case`error`:return`rgba(36,16,16,.88)`;case`info`:default:return`rgba(12,18,28,.88)`}};return(0,F.jsxs)(se.Provider,{value:c,children:[e,(0,F.jsx)(`div`,{"aria-live":`polite`,"aria-atomic":`false`,style:{position:`fixed`,left:0,right:0,bottom:0,padding:`8px 12px`,display:`grid`,gap:8,zIndex:1e3,pointerEvents:`none`},children:t.map(e=>(0,F.jsx)(`div`,{role:`status`,style:{pointerEvents:`auto`,marginInline:`auto`,maxWidth:`min(720px, 100%)`,width:`100%`,background:l(e.kind),border:`1px solid rgba(255,255,255,.12)`,borderRadius:12,padding:`10px 12px`,color:`rgb(236,241,251)`,boxShadow:`0 8px 28px rgba(0,0,0,.35)`,backdropFilter:`blur(6px)`,fontVariantNumeric:`tabular-nums`},children:e.text},e.id))})]})}var I=le;function L(e){return String(e).padStart(2,`0`)}function R(e,t){let n=e%t;return n<0n?n+(t<0n?-t:t):n}function z(e,t){let n=e/t,r=e%t;return r!==0n&&r>0n!=t>0n?n-1n:n}function ue(e){if(!Number.isFinite(e))return 0n;let t=e<0?-1:1,n=Math.abs(e),r=Math.trunc(n),i=n-r;return i<.5?BigInt(t*r):i>.5?BigInt(t*(r+1)):BigInt(t*(r%2==0?r:r+1))}function B(e,t){try{let n=t instanceof Error?t.message:String(t);console.warn(`[SigilStream:${e}] ${n}`)}catch{}}function V(e){return typeof e==`object`&&!!e}function de(e){try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}}function H(e,t){if(!V(e))return;let n=e[t];if(typeof n==`string`)return n;let r=e.meta;if(V(r)){let e=r[t];if(typeof e==`string`)return e}}function fe(e){let t=e;if(V(t)&&`auth`in t&&(t=t.auth),V(t)){let e=t.meta,n=t.svgText;return{meta:V(e)?e:null,svgText:typeof n==`string`?n:null}}return{meta:null,svgText:null}}async function pe(){try{let e=await fetch(`/links.json`,{cache:`no-store`});if(!e.ok||!(e.headers.get(`content-type`)??``).toLowerCase().includes(`application/json`))return[];let t=await e.text(),n=JSON.parse(t);if(!Array.isArray(n))return[];let r=[];for(let e of n)V(e)&&typeof e.url==`string`&&e.url.trim().length&&r.push({url:e.url});return r}catch(e){return B(`loadLinksJson`,e),[]}}const U=`sf-links`;function W(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)&&t.every(e=>typeof e==`string`)?t:[]}catch(e){return B(`parseStringArray`,e),[]}}function G(e){try{if(typeof window>`u`)return;let t=W(localStorage.getItem(U)),n=e.filter(e=>typeof e==`string`&&e.trim().length);if(n.length===0)return;let r=new Set(t),i=n.filter(e=>!r.has(e));if(i.length===0)return;let a=[...i,...t];localStorage.setItem(U,JSON.stringify(a))}catch(e){B(`prependUniqueToStorage`,e)}}const me=(()=>{try{return((typeof window<`u`?window.__PSHORT__:void 0)?.trim()||(void 0)?.trim()||``).replace(/\s+/g,``)}catch(e){return B(`Resolve PSHORT`,e),``}})();function he(){try{if(me)return new URL(`/`,me)}catch(e){B(`Invalid PSHORT`,e)}let e=typeof window<`u`?window.location.href:`https://example.com`;return new URL(`/`,e)}function K(){let e=typeof window<`u`?window.location.href:`https://example.com`;return new URL(`/`,e)}function ge(e){try{let t=new URL(e);if(!(t.protocol===`https:`||t.protocol===`http:`))return!1;let n=t.pathname;if(n.startsWith(`/stream/p/`)||n.startsWith(`/p~`)&&n.length>3)return!0;if(n===`/p`){let e=t.hash.includes(`t=`),n=t.searchParams.has(`t`);return e||n}return t.search.includes(`p=`)}catch{return!1}}function _e(e){try{let t=he(),n=new URL(e,t),r=K();if(n.pathname.startsWith(`/p~`)&&n.pathname.length>3){r.pathname=`/stream/p/${n.pathname.slice(3)}`;let e=n.searchParams.get(`add`)||(n.hash.startsWith(`#add=`)?new URLSearchParams(n.hash.slice(1)).get(`add`):null);return e&&r.searchParams.set(`add`,ve(e)),r.toString()}if(n.pathname===`/p`){let t=n.hash.startsWith(`#`)?n.hash.slice(1):n.hash,i=new URLSearchParams(t),a=i.get(`t`),o=n.searchParams.get(`t`),s=a||o;if(!s)return e;r.pathname=`/stream/p/${s}`;let c=i.get(`add`),l=n.searchParams.get(`add`),u=c||l;return u&&r.searchParams.set(`add`,ve(u)),r.toString()}return e}catch(t){return B(`expandShortAliasToCanonical`,t),e}}function ve(e){let t=e.trim();if(!t)return t;try{if(t.startsWith(`/p~`))return _e(`${he().origin}${t}`);if(t.startsWith(`/p#t=`)||t.startsWith(`#t=`)||t.includes(`/p?t=`))return _e(t.startsWith(`#t=`)?`${he().origin}/p${t}`:t.startsWith(`/p`)?`${he().origin}${t}`:t);if(de(t)){let e=new URL(t);return e.pathname===`/p`||e.pathname.startsWith(`/p~`)?_e(t):t}return t}catch(e){return B(`normalizeAddParam`,e),t}}function ye(e){let t=K();return t.pathname=`/stream/p/${e}`.replace(/\/{2,}/g,`/`),t.search=``,t.hash=``,t.toString()}function be(e){let t=e.trim();if(t.startsWith(`#`)&&(t=t.slice(1)),t.length===3&&(t=t.split(``).map(e=>e+e).join(``)),t.length!==6)return null;let n=parseInt(t,16);return[n>>16&255,n>>8&255,n&255]}var xe=(e,t=0,n=255)=>Math.max(t,Math.min(n,e));function Se(e,t,n){return[xe(e[0]+(t[0]-e[0])*n),xe(e[1]+(t[1]-e[1])*n),xe(e[2]+(t[2]-e[2])*n)]}var Ce=e=>`${e[0]}, ${e[1]}, ${e[2]}`,we={root:`#FF3B3B`,sacral:`#FF8A33`,solar:`#FFD60A`,heart:`#22C55E`,throat:`#0EA5E9`,thirdEye:`#6366F1`,crown:`#C084FC`},Te=`crown`;function Ee(e){if(e==null)return null;let t;return t=typeof e==`number`?[`root`,`sacral`,`solar`,`heart`,`throat`,`thirdEye`,`crown`][Math.min(7,Math.max(1,e))-1]:e===`krown`?Te:e,be(we[t]??we.crown)}function De(e){let t=Ee(e);if(!t)return null;let n=[255,255,255],r=[255,215,128],i=Se(t,n,.28),a=Se(t,r,.42);return{s1:Ce(t),s2:Ce(i),s3:Ce(a)}}var Oe={s1:`154, 230, 255`,s2:`196, 181, 253`,s3:`255, 215, 128`};function ke(e,t){let n=De(e);if(n)return n;if(t?.primary){let e=be(t.primary)??be(`#9AE6FF`),n=t.secondary?be(t.secondary)??e:Se(e,[255,255,255],.28),r=[255,215,128],i=t.accent?be(t.accent)??r:Se(e,r,.45);return{s1:Ce(e),s2:Ce(n),s3:Ce(i)}}return Oe}function Ae(e){if(!e)return;let t=e.trim();if(t)return t.startsWith(`@`),t}function je({username:e,phiKey:t,kaiSignature:n,sigilColors:r,chakra:i}){let a=ke(i,r),o=Ae(e),s={"--sigil-1":a.s1,"--sigil-2":a.s2,"--sigil-3":a.s3},c=!o&&!t&&!n;return(0,F.jsx)(`div`,{className:`sf-identity`,style:s,...c?{"data-empty":``}:{},children:(0,F.jsxs)(`div`,{className:`sf-reply-id`,style:{rowGap:`.4rem`,columnGap:`.4rem`,display:`flex`,flexWrap:`wrap`},"aria-label":c?`No identity loaded`:`Identity chips`,children:[c&&(0,F.jsx)(`span`,{className:`sf-muted`,children:`No identity loaded this session.`}),o&&(0,F.jsxs)(`span`,{className:`sf-pill sf-pill--user`,title:`Username (session)`,children:[(0,F.jsx)(`strong`,{className:`sf-pill__label`,children:`User`}),`\xA0`,(0,F.jsx)(`span`,{className:`sf-key`,children:o})]}),t&&(0,F.jsxs)(`span`,{className:`sf-pill sf-pill--phikey`,title:`Your ΦKey (session)`,children:[(0,F.jsx)(`strong`,{className:`sf-pill__label`,children:`ΦKey`}),`\xA0`,(0,F.jsx)(`span`,{className:`sf-key`,children:t})]}),n&&(0,F.jsxs)(`span`,{className:`sf-pill sf-pill--ksig`,title:`Kai Signature (session)`,children:[(0,F.jsx)(`strong`,{className:`sf-pill__label`,children:`ΣSig`}),`\xA0`,(0,F.jsx)(`span`,{className:`sf-key`,children:n})]})]})})}var Me=[`sigilActionUrl`,`sigilUrl`,`actionUrl`,`claimedUrl`,`loginUrl`,`sourceUrl`,`originUrl`,`url`,`link`,`href`];function Ne(e){if(!e||!V(e))return[];let t=[],n=new Set;for(let r of Me){let i=H(e,r);if(typeof i!=`string`)continue;let a=i.trim();a&&(n.has(a)||(n.add(a),t.push(a)))}return t}function Pe(e){if(!e)return[];try{let t=e.match(/https?:\/\/[^\s"'<>)#]+/gi)??[],n=[],r=new Set;for(let e of t){let t=(e??``).trim();t&&(r.has(t)||(r.add(t),n.push(t)))}return n}catch{return[]}}function Fe(e){return/^https?:\/\//i.test((e??``).trim())}function Ie(e){try{return new URL(e)}catch{return null}}function Le(e){let t=(e??``).trim();if(!t)return``;let n=t;n=n.replace(/\/stream\/v=/gi,`/stream/t=`),n=n.replace(/\/stream\/v\//gi,`/stream/t/`),n=n.replace(/\/stream\/v(\?|&|#)/gi,`/stream/t$1`),n=n.replace(/([?&#])v=/gi,`$1t=`);let r=Ie(n);if(!r)return n.replace(/([?&#])v=/gi,`$1t=`);let i=r.searchParams,a=(i.get(`t`)??``).trim().length>0,o=(i.get(`v`)??``).trim();if(!a&&o&&i.set(`t`,o),i.delete(`v`),(i.get(`t`)??``).trim().length>0&&i.delete(`p`),r.hash&&r.hash.length>1){let e=r.hash.startsWith(`#`)?r.hash.slice(1):r.hash;if(e.includes(`=`)&&!e.startsWith(`/`)){let t=e.split(`&`).filter(Boolean),n=[],i=!1;for(let e of t){let t=e.indexOf(`=`);if(t<=0){n.push(e);continue}let r=e.slice(0,t),a=e.slice(t+1),o=r.toLowerCase();if(o===`v`){!i&&a.trim().length&&(n.push(`t=${a}`),i=!0);continue}o===`t`&&(i=!0),n.push(e)}if(i){let e=[];for(let t of n){let n=t.indexOf(`=`);(n>0?t.slice(0,n).toLowerCase():``)!==`p`&&e.push(t)}r.hash=e.length?`#${e.join(`&`)}`:``}else r.hash=n.length?`#${n.join(`&`)}`:``}else r.hash=r.hash.replace(/([?&#])v=/gi,`$1t=`)}return r.toString()}function Re(e){let t=(e??``).trim();if(!t)return-1;let n=t.toLowerCase(),r=0;return(/[?&#]v=/.test(n)||n.includes(`/stream/v`))&&(r-=1e4),(/[?&#]t=/.test(n)||n.includes(`/stream/t`)||n.includes(`stream/t=`))&&(r+=500),(/[?&#]p=/.test(n)||n.includes(`/stream/p`)||n.includes(`stream/p=`))&&(r+=280),ge(t)&&(r+=160),n.startsWith(`https://`)?r+=20:n.startsWith(`http://`)&&(r+=10),r+=Math.max(0,120-Math.min(120,Math.floor(t.length/6))),r}function ze(e){let t=``,n=-1;for(let r of e){let e=Le(r),i=Re(e);i>n&&(n=i,t=e)}return t}async function Be(e){let t=e??``;if(!t)return!1;try{if(typeof navigator<`u`&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(t),!0}catch{}try{let e=document.createElement(`textarea`);e.value=t,e.setAttribute(`readonly`,`true`),e.style.position=`fixed`,e.style.left=`-9999px`,e.style.top=`-9999px`,document.body.appendChild(e),e.select(),e.setSelectionRange(0,e.value.length);let n=document.execCommand(`copy`);return document.body.removeChild(e),n}catch{return!1}}function Ve({value:e,isCanonical:t}){let n=(0,P.useMemo)(()=>Ie(e),[e]),r=(0,P.useMemo)(()=>Fe(e)?e:``,[e]),[i,a]=(0,P.useState)(!1),[o,s]=(0,P.useState)(!1),c=(0,P.useRef)(null);(0,P.useEffect)(()=>()=>{c.current&&window.clearTimeout(c.current)},[]);let l=(0,P.useCallback)(e=>{c.current&&window.clearTimeout(c.current),a(e),s(!e),c.current=window.setTimeout(()=>{a(!1),s(!1),c.current=null},1400)},[]),u=(0,P.useCallback)(async()=>{l(await Be(e))},[l,e]),d=(0,P.useCallback)(e=>{let t=e.currentTarget;try{t.focus(),t.select(),t.setSelectionRange(0,t.value.length)}catch{}},[]),f=n?.host??``,p=n?`${n.hostname}${n.pathname}${n.search}${n.hash}`.replace(/\/{2,}/g,`/`):e;return(0,F.jsxs)(`div`,{className:`sf-reply-row sf-actionurl`,children:[(0,F.jsxs)(`div`,{className:`sf-actionurl__head`,children:[(0,F.jsxs)(`label`,{className:`sf-label sf-actionurl__label`,children:[`Proof of Breath™ `,(0,F.jsx)(`span`,{className:`sf-muted`,children:`(Sigil-Glyph)`})]}),(0,F.jsx)(`span`,{className:`sf-actionurl__pill ${t?`is-ok`:`is-warn`}`,children:t?`SIGNED`:`EXTERNAL`})]}),(0,F.jsxs)(`div`,{className:`sf-actionurl__field`,children:[(0,F.jsxs)(`div`,{className:`sf-actionurl__inputWrap`,children:[(0,F.jsx)(`input`,{className:`sf-input sf-input--locked sf-actionurl__input`,type:`url`,value:e,readOnly:!0,onClick:d,onFocus:d,"aria-label":`Proof of Breath™ Sigil-Glyph`}),(0,F.jsxs)(`div`,{className:`sf-actionurl__meta`,"aria-hidden":`true`,children:[f?(0,F.jsx)(`span`,{className:`sf-actionurl__host`,children:f}):(0,F.jsx)(`span`,{className:`sf-actionurl__host`,children:`URL`}),(0,F.jsx)(`span`,{className:`sf-actionurl__dot`,children:`•`}),(0,F.jsx)(`span`,{className:`sf-actionurl__pretty`,children:p})]})]}),(0,F.jsxs)(`div`,{className:`sf-actionurl__btns`,children:[(0,F.jsx)(`button`,{type:`button`,className:`sf-actionurl__btn ${i?`is-copied`:``} ${o?`is-fail`:``}`,onClick:u,"aria-live":`polite`,children:i?`✓ Remembered`:o?`Remember failed`:`Remember`}),r?(0,F.jsx)(`a`,{className:`sf-actionurl__btn sf-actionurl__btn--link`,href:r,target:`_blank`,rel:`noreferrer noopener`,"aria-label":`Open Proof of Breath URL in a new tab`,children:`↗`}):(0,F.jsx)(`button`,{type:`button`,className:`sf-actionurl__btn sf-actionurl__btn--disabled`,disabled:!0,children:`↗`})]})]}),!t&&(0,F.jsx)(`div`,{className:`sf-warn sf-actionurl__warn`,role:`status`,children:`Not recognized as a sealed Proof of Breath™ link; fallback rules may apply.`})]})}function He(){return(0,F.jsxs)(`div`,{className:`sf-reply-row sf-actionurl sf-actionurl--empty`,children:[(0,F.jsxs)(`div`,{className:`sf-actionurl__head`,children:[(0,F.jsxs)(`label`,{className:`sf-label sf-actionurl__label`,children:[`Proof of Breath™ `,(0,F.jsx)(`span`,{className:`sf-muted`,children:`(Sigil-Glyph)`})]}),(0,F.jsx)(`span`,{className:`sf-actionurl__pill is-warn`,children:`MISSING`})]}),(0,F.jsx)(`div`,{className:`sf-warn sf-actionurl__warn`,role:`status`,children:`No Proof of Breath™ sigil-glyph detected; a fallback will be used.`})]})}function Ue({meta:e,svgText:t}){let n=Ne(e),r=Pe(t),i=[...n,...r],a=i.length?ze(i):``,o=a.length>0&&ge(a);return{value:a,isCanonical:o,node:a?(0,F.jsx)(Ve,{value:a,isCanonical:o}):(0,F.jsx)(He,{})}}function We(e){let t=e.trim();if(!t)return null;let n=t.replace(/^(kai|sigil):\/\//i,`https://`);try{if(de(n))return n;if(/^[a-z0-9.-]+\.[a-z]{2,}(?:\/.*)?$/i.test(n))return`https://${n}`}catch{}return null}function Ge({onAdd:e,placeholder:t=`Paste any message (https://… or domain.tld)`,title:n=`Inhale a memory`}){let r=ce(),[i,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(null),c=(0,P.useCallback)(t=>{s(null);let n=We(t);if(!n){s(`Enter a valid URL (https://… or domain.tld).`);return}e(n),a(``),r.push(`success`,`Link inhaled.`)},[e,r]),l=(0,P.useCallback)(async()=>{s(null);try{let e=(await navigator.clipboard.readText()).trim();if(!e){s(`Memory is empty.`);return}let t=We(e);if(!t){s(`Memory does not contain a valid link.`);return}a(t),c(t)}catch{s(`Memory read is not permitted.`)}},[c]);return(0,F.jsxs)(`section`,{className:`sf-inhaler`,"aria-labelledby":`inhaler-title`,style:{marginTop:`1rem`},children:[(0,F.jsx)(`h2`,{id:`inhaler-title`,className:`sf-reply-title`,children:n}),(0,F.jsxs)(`div`,{className:`sf-reply-row`,style:{display:`grid`,gap:`.5rem`},children:[(0,F.jsx)(`input`,{className:`sf-input`,type:`url`,placeholder:t,value:i,onChange:e=>a(e.target.value),autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,inputMode:`url`,enterKeyHint:`go`,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),c(i))}}),(0,F.jsxs)(`div`,{className:`sf-reply-actions`,style:{gap:`.5rem`,display:`flex`,flexWrap:`wrap`},children:[(0,F.jsx)(`button`,{className:`sf-btn`,onClick:()=>c(i),children:`Inhale`}),(0,F.jsx)(`button`,{className:`sf-btn sf-btn--ghost`,onClick:l,children:`Inhale from memory`})]}),o&&(0,F.jsx)(`div`,{className:`sf-error`,role:`alert`,children:o})]})]})}const Ke=[`Solhara`,`Aquaris`,`Flamora`,`Verdari`,`Sonari`,`Kaelith`],qe={Solhara:`Root`,Aquaris:`Sacral`,Flamora:`Solar Plexus`,Verdari:`Heart`,Sonari:`Throat`,Kaelith:`Krown`},Je=[`Aethon`,`Virelai`,`Solari`,`Amarin`,`Kaelus`,`Umbriel`,`Noktura`,`Liora`],Ye=[`Awakening Flame`,`Flowing Heart`,`Radiant Will`,`Harmonic Voh`,`Inner Mirror`,`Dreamfire Memory`,`Krowned Light`],Xe=Date.UTC(2024,4,10,6,45,41,888),Ze=3+Math.sqrt(5),Qe=Ze*1e3,$e=1000000n,et=17491270421n,tt=11000000n,nt=(et+18n)/36n;function rt(e){return ue((e.getTime()-Xe)/1e3/Ze*1e6)}function it(e){let t=rt(e),n=R(t,et),r=z(t,et),i=Number(z(n,nt)),a=n-BigInt(i)*nt,o=Number(a/tt),s=Math.min(Math.max(o,0),43),c=a-BigInt(s)*tt,l=Number(c)/Number(tt),u=Number(z(t,$e)),d=Number(a/$e),f=Number(n/$e),p=Ke[Number(R(r,BigInt(6)))],m=qe[p],h=Number(r),g=(h%42+42)%42+1,_=(Math.floor(h/42)%8+8)%8,v=_+1,y=Je[_],b=Math.floor(h/336),x=Math.floor((g-1)/6),S=Ye[x];return{pulse:u,beat:i,step:s,stepPct:l,pulsesIntoBeat:d,pulsesIntoDay:f,harmonicDay:p,chakraDay:m,chakraStepString:`${i}:${L(s)}`,dayOfMonth:g,monthIndex0:_,monthIndex1:v,monthName:y,yearIndex:b,weekIndex:x,weekName:S,_pμ_in_day:n,_pμ_in_beat:a}}function at(e){try{let t=new URL(e).pathname.split(`/`).pop()||``,n=t.lastIndexOf(`.`);return n>=0?t.slice(n+1).toLowerCase():``}catch{return``}}function ot(e){return[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`bmp`].includes(e)}function st(e){return[`mp4`,`webm`,`ogg`,`ogv`,`mov`,`m4v`].includes(e)}function ct(e){return e===`pdf`}function lt(e){try{return new URL(e).host}catch{return``}}function ut(e){try{let t=new URL(e),n=t.host,r=t.pathname||``;r===`/`&&(r=``),r.endsWith(`/`)&&r.length>1&&(r=r.slice(0,-1));let i=t.search||``;return`${n}${r}${i}`}catch{return e.replace(/^https?:\/\//i,``).replace(/\/+$/g,``)}}function dt(e){try{let t=new URL(e);if(t.hostname.includes(`youtu.be`))return t.pathname.slice(1)||null;if(t.hostname.includes(`youtube.com`)){let e=t.searchParams.get(`v`);if(e)return e;let n=t.pathname.split(`/`).filter(Boolean),r=n.indexOf(`embed`);if(r>=0&&n[r+1])return n[r+1]}return null}catch{return null}}function ft(e){try{let t=new URL(e);return t.hostname.includes(`vimeo.com`)&&t.pathname.split(`/`).filter(Boolean).find(e=>/^\d+$/.test(e))||null}catch{return null}}function pt(e){try{let t=new URL(e);return t.hostname.includes(`spotify.com`)&&(t.pathname.startsWith(`/track/`)||t.pathname.startsWith(`/album/`)||t.pathname.startsWith(`/playlist/`))?`https://open.spotify.com/embed${t.pathname}${t.search}`:null}catch{return null}}function mt({host:e}){return(0,F.jsx)(`img`,{className:`sf-favicon`,src:`https://${e}/favicon.ico`,alt:``,width:16,height:16,loading:`eager`,decoding:`async`,onError:e=>{e.currentTarget.style.visibility=`hidden`}})}function ht(e){let{url:t,title:n,children:r}=e,i=lt(t),a=(n&&n.trim().length?n.trim():``)||ut(t);return(0,F.jsxs)(`div`,{className:`sf-att-card`,children:[(0,F.jsx)(`div`,{className:`sf-att-head`,children:(0,F.jsxs)(`a`,{className:`sf-att-head__hit`,href:t,target:`_blank`,rel:`noopener noreferrer`,title:t,children:[i?(0,F.jsx)(mt,{host:i}):(0,F.jsx)(`span`,{className:`sf-favicon sf-favicon--blank`,"aria-hidden":`true`}),(0,F.jsx)(`div`,{className:`sf-att-head__text`,children:(0,F.jsx)(`div`,{className:`sf-att-head__title`,children:a})}),(0,F.jsx)(`span`,{className:`sf-att-open`,"aria-hidden":`true`,children:`↗`})]})}),r?(0,F.jsx)(`div`,{className:`sf-att-body`,children:r}):null]})}function gt({src:e,title:t}){return(0,F.jsx)(`div`,{className:`sf-embed`,children:(0,F.jsx)(`iframe`,{className:`sf-embed__frame`,src:e,title:t,loading:`eager`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share`,allowFullScreen:!0,sandbox:`allow-same-origin allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox`})})}function _t({url:e,title:t}){return(0,F.jsx)(ht,{url:e,title:t})}function vt({url:e,title:t}){let n=dt(e);if(n)return(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(gt,{src:`https://www.youtube.com/embed/${n}`,title:t||`YouTube`})});let r=ft(e);if(r)return(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(gt,{src:`https://player.vimeo.com/video/${r}`,title:t||`Vimeo`})});let i=pt(e);if(i)return(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(gt,{src:i,title:t||`Spotify`})});let a=at(e);return ot(a)?(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(`div`,{className:`sf-media sf-media--image`,children:(0,F.jsx)(`img`,{className:`sf-media__img`,src:e,alt:t||`image`,loading:`eager`,decoding:`async`})})}):st(a)?(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(`div`,{className:`sf-media sf-media--video`,children:(0,F.jsx)(`video`,{className:`sf-media__video`,src:e,controls:!0,playsInline:!0,preload:`metadata`})})}):ct(a)?(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(`div`,{className:`sf-embed sf-embed--doc`,children:(0,F.jsx)(`iframe`,{className:`sf-embed__frame`,src:e,title:t||`Document`,loading:`eager`})})}):(0,F.jsx)(_t,{url:e,title:t})}function yt(e){let t=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`)),n=``;for(let r=0;r`data:${t};base64,${xt(e)}`;async function Ct(e){let t=typeof crypto<`u`&&crypto.subtle||typeof window<`u`&&window.crypto&&window.crypto.webkitSubtle;if(!t)throw Error(`WebCrypto.subtle is not available in this context.`);let n=await t.digest(`SHA-256`,e);return yt(new Uint8Array(n))}async function wt(e,t=524288){let n=[],r=0,i=0;for(let a of Array.from(e)){r+=a.size;try{let e=await a.arrayBuffer(),r=await Ct(e),o=a.type||`application/octet-stream`;if(a.size<=t){let t=bt(new Uint8Array(e)),s={kind:`file-inline`,name:a.name,type:o,size:a.size,sha256:r,data_b64url:t};i+=a.size,n.push(s)}else{let e={kind:`file-ref`,name:a.name,type:o,size:a.size,sha256:r};n.push(e)}}catch(e){B(`filesToManifest: read/hash failed`,e)}}return{version:1,totalBytes:r,inlinedBytes:i,items:n}}function Tt({n:e}){if(typeof e!=`number`||!Number.isFinite(e)||e<0)return(0,F.jsx)(F.Fragment,{children:`—`});let t=1024,n=t*1024,r=n*1024;return(0,F.jsx)(F.Fragment,{children:e>=r?`${(e/r).toFixed(2)} GB`:e>=n?`${(e/n).toFixed(2)} MB`:e>=t?`${(e/t).toFixed(2)} KB`:`${Math.round(e)} B`})}function Et({it:e}){let t=e.type||`application/octet-stream`,n=St(e.data_b64url,t),r=e.name||`file`;if(t.startsWith(`image/`))return(0,F.jsxs)(`div`,{className:`sf-media sf-media--image`,children:[(0,F.jsx)(`img`,{src:n,alt:r,loading:`eager`,decoding:`async`}),(0,F.jsxs)(`div`,{className:`sf-file-meta`,children:[(0,F.jsx)(`span`,{children:r}),(0,F.jsx)(`span`,{children:(0,F.jsx)(Tt,{n:e.size})})]}),(0,F.jsx)(`a`,{className:`sf-file-dl`,href:n,download:r,children:`Download`})]});if(t.startsWith(`video/`))return(0,F.jsxs)(`div`,{className:`sf-media sf-media--video`,children:[(0,F.jsx)(`video`,{src:n,controls:!0,playsInline:!0,preload:`metadata`}),(0,F.jsxs)(`div`,{className:`sf-file-meta`,children:[(0,F.jsx)(`span`,{children:r}),(0,F.jsx)(`span`,{children:(0,F.jsx)(Tt,{n:e.size})})]}),(0,F.jsx)(`a`,{className:`sf-file-dl`,href:n,download:r,children:`Download`})]});if(t.startsWith(`audio/`))return(0,F.jsxs)(`div`,{className:`sf-media sf-media--audio`,children:[(0,F.jsx)(`audio`,{src:n,controls:!0,preload:`metadata`}),(0,F.jsxs)(`div`,{className:`sf-file-meta`,children:[(0,F.jsx)(`span`,{children:r}),(0,F.jsx)(`span`,{children:(0,F.jsx)(Tt,{n:e.size})})]}),(0,F.jsx)(`a`,{className:`sf-file-dl`,href:n,download:r,children:`Download`})]});let i=t.startsWith(`text/`)||[`application/json`,`application/xml`,`application/svg+xml`].includes(t),a=null;if(i)try{a=atob(e.data_b64url.replace(/-/g,`+`).replace(/_/g,`/`)).slice(0,1200)}catch{a=null}return(0,F.jsxs)(`div`,{className:`sf-file`,children:[(0,F.jsxs)(`div`,{className:`sf-file-head`,children:[(0,F.jsx)(`div`,{className:`sf-file-name`,children:e.relPath||r}),(0,F.jsx)(`div`,{className:`sf-file-size`,children:(0,F.jsx)(Tt,{n:e.size})})]}),a&&(0,F.jsxs)(`pre`,{className:`sf-file-pre`,"aria-label":`${r} preview`,children:[a,a.length>=1200?` … (truncated preview)`:``]}),(0,F.jsxs)(`div`,{className:`sf-file-foot`,children:[(0,F.jsxs)(`code`,{className:`sf-hash mono`,children:[`sha256:`,e.sha256]}),(0,F.jsx)(`a`,{className:`sf-file-dl`,href:n,download:r,children:`Download`})]})]})}function Dt({it:e}){let t=e.name||`file`;return(0,F.jsxs)(`div`,{className:`sf-fileref`,children:[(0,F.jsxs)(`div`,{className:`sf-file-head`,children:[(0,F.jsx)(`div`,{className:`sf-file-name`,children:e.relPath||t}),(0,F.jsx)(`div`,{className:`sf-file-size`,children:(0,F.jsx)(Tt,{n:e.size})})]}),(0,F.jsxs)(`div`,{className:`sf-file-foot`,children:[(0,F.jsx)(`div`,{className:`sf-file-type`,children:e.type||`application/octet-stream`}),(0,F.jsxs)(`code`,{className:`sf-hash mono`,children:[`sha256:`,e.sha256]})]}),(0,F.jsx)(`div`,{className:`sf-note`,children:`Large file not inlined. Host by hash anywhere and add the public URL as an attachment link.`})]})}function Ot({item:e}){return e.kind===`url`?(0,F.jsx)(vt,{url:e.url,title:e.title}):e.kind===`file-inline`?(0,F.jsx)(Et,{it:e}):(0,F.jsx)(Dt,{it:e})}function kt({manifest:e}){return e.items.length?(0,F.jsxs)(`section`,{className:`sf-attachments`,"aria-labelledby":`sf-att-title`,children:[(0,F.jsx)(`h3`,{id:`sf-att-title`,className:`sf-att-title`,children:`Attachments`}),(0,F.jsx)(`div`,{className:`sf-att-grid`,children:e.items.map((e,t)=>(0,F.jsx)(`div`,{className:`sf-att-item`,children:(0,F.jsx)(Ot,{item:e})},t))}),(0,F.jsxs)(`div`,{className:`sf-att-foot`,children:[(0,F.jsxs)(`span`,{children:[`Total:`,` `,(0,F.jsx)(`strong`,{children:(0,F.jsx)(Tt,{n:e.totalBytes})})]}),typeof e.inlinedBytes==`number`&&e.inlinedBytes>0&&(0,F.jsxs)(`span`,{children:[` `,`• Inlined:`,` `,(0,F.jsx)(`strong`,{children:(0,F.jsx)(Tt,{n:e.inlinedBytes})})]})]})]}):null}function At(e){let t=e.trim();if(!t)return null;if(/^(kai|sigil):\/\//i.test(t))return t.replace(/^(kai|sigil):\/\//i,`https://`);try{if(de(t))return t;if(/^[a-z0-9.-]+\.[a-z]{2,}(\/.*)?$/i.test(t))return`https://${t}`}catch{}return null}function jt(e,t){if(!t)return{next:e,error:`Missing URL.`};if(e.some(e=>e.url===t))return{next:e,error:`Link already added.`};let n={kind:`url`,url:t};return{next:[...e,n],added:n}}function Mt(e,t){return t<0||t>=e.length?e:[...e.slice(0,t),...e.slice(t+1)]}var Nt=512,Pt=`sigil:urls`,Ft=`sigil:feed`,It=`kai-sigil-registry`,Lt=`kai-feed-registry`;function Rt(e){try{return decodeURIComponent(e)}catch{return e}}function zt(e){let t=e.trim();return t.length<16?!1:/^[A-Za-z0-9_-]+$/u.test(t)}function Bt(e){let t=e.trim();if(!t)return``;try{return new URL(t,K().origin).toString()}catch{return t}}function Vt(e){let t=f(e);return t?`t:${t}`:null}function Ht(e){try{let t=new URL(e,K().origin),n=t.hash.startsWith(`#`)?t.hash.slice(1):``;return new URLSearchParams(n).getAll(`add`).length+t.searchParams.getAll(`add`).length}catch{return 0}}function Ut(e){return Ht(e)*1e5+e.length}function Wt(e,t){if(typeof window>`u`||window.localStorage===void 0)return{changed:!1,value:t};let n=Bt(t);if(!n)return{changed:!1,value:t};try{let t=window.localStorage.getItem(e),r=[];if(t){let e=JSON.parse(t);if(Array.isArray(e))for(let t of e)typeof t==`string`&&r.push(t)}let i=[],a=new Map,o=e=>Vt(e)??`u:${Bt(e)}`;for(let e of r){let t=Bt(e);if(!t)continue;let n=o(t),r=Ut(t);a.has(n)?r>a.get(n).score&&a.set(n,{url:t,score:r}):(a.set(n,{url:t,score:r}),i.push(n))}let s=o(n),c=Ut(n);a.has(s)?c>a.get(s).score&&a.set(s,{url:n,score:c}):(a.set(s,{url:n,score:c}),i.push(s));let l=[];for(let e of i){let t=a.get(e);t&&l.push(t.url)}let u=JSON.stringify(r),d=JSON.stringify(l);return u===d?{changed:!1,value:n}:(window.localStorage.setItem(e,d),{changed:!0,value:n})}catch{return{changed:!1,value:n}}}function Gt(e){if(!(typeof window>`u`)){try{window.__SIGIL__?.registerSigilUrl?.(e)}catch{}try{window.dispatchEvent(new CustomEvent(`sigil:url-registered`,{detail:{url:e}}))}catch{}try{if(`BroadcastChannel`in window){let t=new BroadcastChannel(It);t.postMessage({type:`sigil:add`,url:e}),t.close()}}catch{}}}function Kt(e){if(!(typeof window>`u`)){try{window.__FEED__?.registerFeedUrl?.(e)}catch{}try{window.dispatchEvent(new CustomEvent(`feed:url-registered`,{detail:{url:e}}))}catch{}try{if(`BroadcastChannel`in window){let t=new BroadcastChannel(Lt);t.postMessage({type:`feed:add`,url:e}),t.close()}}catch{}}}function qt(e){try{let t=new URL(e,K().origin),n=t.hash.startsWith(`#`)?t.hash.slice(1):``,r=new URLSearchParams(n),i=[...t.searchParams.getAll(`add`),...r.getAll(`add`)],a=[];for(let e of i){let t=Rt(String(e)).trim();if(t){if(t.startsWith(`j:`)&&t.length>10){a.includes(t)||a.push(t);continue}if(zt(t))try{let e=_e(ye(t));e&&!a.includes(e)&&a.push(e);continue}catch{}try{let e=_e(t);e&&!a.includes(e)&&a.push(e)}catch{}}}return a.slice(-Nt)}catch{return[]}}function Jt(e,t){let n=new URL(e,K().origin),r=n.hash.startsWith(`#`)?n.hash.slice(1):``,i=new URLSearchParams(r);i.delete(`add`);for(let e of t)i.append(`add`,e);n.search=``;let a=i.toString();return n.hash=a?`#${a}`:``,n.toString()}function Yt(e){return`${K().origin.replace(/\/+$/g,``)}/stream/p/${encodeURIComponent(e)}`}function Xt(e){try{let t=new URL(e,K().origin),n=t.hash.startsWith(`#`)?t.hash.slice(1):``,r=new URLSearchParams(n).get(`root`)??t.searchParams.get(`root`);if(!r)return null;let i=Rt(String(r)).trim();return i?i.startsWith(`j:`)&&i.length>10?i:/^[A-Za-z0-9_-]{16,}$/u.test(i)?`j:${i}`:null:null}catch{return null}}function Zt(){if(typeof window>`u`)return{replyToUrl:null,originUrl:null,addChain:[]};let e=window.location.href,t=qt(e),n=f(e)??y(window.location),r=n?(()=>{try{return _e(Yt(n))}catch{return Yt(n)}})():null,i=Xt(e),a=!r&&!i&&t.length?t[t.length-1]:null,o=r??i??a;return{replyToUrl:o,originUrl:t.length?t[0]:o,addChain:(a&&t.length?t.slice(0,-1):t.slice(0)).slice(-Nt)}}function Qt({meta:e,svgText:t,onUseDifferentKey:n,inlineLimitBytes:i=512*1024}){let o=ce(),{meta:c,svgText:u}=(0,P.useMemo)(()=>fe({meta:e,svgText:t}),[e,t]),d=(0,P.useMemo)(()=>c?H(c,`userPhiKey`):void 0,[c]),p=(0,P.useMemo)(()=>c?H(c,`kaiSignature`):void 0,[c]),{value:m}=Ue({meta:c,svgText:u}),[h,v]=(0,P.useState)(``),[b,x]=(0,P.useState)(``),[C,T]=(0,P.useState)(``),[E,D]=(0,P.useState)({version:1,totalBytes:0,inlinedBytes:0,items:[]}),[O,k]=(0,P.useState)(``),[A,ee]=(0,P.useState)([]),j=(0,P.useId)(),M=(0,P.useId)(),oe=(0,P.useRef)(null),se=(0,P.useRef)(null),[le,I]=(0,P.useState)(!1),[L,R]=(0,P.useState)(``),[z,ue]=(0,P.useState)(!1),[B,V]=(0,P.useState)(()=>ae()),[de,pe]=(0,P.useState)(null);(0,P.useEffect)(()=>{if(!(typeof window>`u`))try{let e=Zt();if(!e.replyToUrl)return;let t=f(e.replyToUrl)??y(window.location);if(!t)return;let n=s(t);n&&pe(n)}catch{}},[]);let U=(0,P.useMemo)(()=>{if(!de)return null;let e=de.body,t=de.caption??``;e&&(e.kind===`text`?t=e.text:e.kind===`md`?t=e.md:e.kind===`code`?t=e.code:e.kind===`html`&&(t=e.html));let n=t.trim();if(!n)return{author:de.author,url:de.url,snippet:`(Previous memory has no visible text content.)`};let r=n.length>280?`${n.slice(0,279)}…`:n;return{author:de.author,url:de.url,snippet:r}},[de]);(0,P.useEffect)(()=>{V(ae());let e=ie((e,t)=>{V(t=>({...t,[e.normalized]:e}))});return()=>e()},[]);let W=(0,P.useMemo)(()=>re(b),[b]),G=W?B[W]:void 0,me=(0,P.useMemo)(()=>te(C),[C]),he=(0,P.useMemo)(()=>W?G?G.claimHash===me||G.ownerHint&&d&&G.ownerHint===d?`Username claimed by you`:`Username claimed by another`:`Username available`:``,[G,me,W,d]),_e=(0,P.useCallback)(async e=>{let t=e.currentTarget.files;if(!(!t||t.length===0))try{let n=await wt(t,i);D(e=>({version:1,totalBytes:e.totalBytes+n.totalBytes,inlinedBytes:e.inlinedBytes+n.inlinedBytes,items:[...n.items,...e.items]})),e.currentTarget.value=``,o.push(`success`,`Attached.`)}catch(e){console.error(`[Composer] onPickFiles:`,e),o.push(`error`,`Attach failed.`)}},[i,o]),ve=(0,P.useCallback)(e=>{D(t=>{let n=[...t.items],r=n.splice(e,1)[0],i=r&&(r.kind===`file-inline`||r.kind===`file-ref`)?r.size??0:0,a=r&&r.kind===`file-inline`?r.size??0:0;return{version:1,totalBytes:Math.max(0,t.totalBytes-i),inlinedBytes:Math.max(0,t.inlinedBytes-a),items:n}})},[]),ye=e=>{let t=At(e);if(!t){o.push(`warn`,`Invalid URL. Use https://example.com`);return}let{next:n,added:r,error:i}=jt(A,t);if(i){o.push(`warn`,i);return}ee(n),k(``),r&&o.push(`success`,`Link added.`)},be=e=>{ee(t=>Mt(t,e))},xe=async()=>{if(!le){I(!0);try{let e=(m||``).trim();(!e||!ge(e))&&o.push(`info`,`No sigil URL detected; using fallback.`);let t=h.trim(),n=b.trim(),i=re(n),s=A.map(e=>_({url:e.url,title:e.title})),u=E.items.map(e=>e.kind===`file-ref`?a({sha256:e.sha256,name:e.name,type:e.type,size:e.size,url:void 0}):e.kind===`file-inline`?w({name:e.name,type:e.type,size:e.size,data_b64url:e.data_b64url,thumbnail_b64:void 0}):e),v=[...s,...u],y=v.length>0?r(v):void 0,x=it(new Date).pulse,C=t.length>0?{kind:`text`,text:t}:void 0,T;if(i)if(G){if(!me){o.push(`warn`,`Username is claimed. Provide your claim glyph token to seal.`);return}if(me!==G.claimHash){o.push(`warn`,`Claim glyph mismatch. Memory not sealed.`);return}T={hash:G.claimHash,url:G.claimUrl,payload:{kind:l,username:G.username,normalized:G.normalized,originHash:G.originHash,ownerHint:G.ownerHint??null},ownerHint:G.ownerHint??null}}else{if(!c||!p){o.push(`warn`,`Inhale your sigil to mint a username claim.`);return}let e=N({origin:{hash:p,pulseCreated:c?.pulse??x,pulseGenesis:c?.pulse??x,value:1,sentTo:[],receivedFrom:[],metadata:{kaiSignature:p,creator:d??void 0}},username:n,pulse:x,ownerHint:d??null}),t=e.metadata?.usernameClaim;if(t)T={hash:e.hash,payload:t,ownerHint:t.ownerHint??null};else{o.push(`warn`,`Could not mint username-claim glyph.`);return}}let D=Yt(S({...g({url:e||K().origin,pulse:x,caption:t||void 0,body:C,author:n||void 0,sigilId:void 0,phiKey:d??void 0,kaiSignature:p??void 0,parent:void 0,parentUrl:void 0,originUrl:void 0,ts:void 0,attachments:y,usernameClaim:T}),kind:`post`})),O=Zt(),k=[];for(let e of O.addChain){let t=f(e);t&&!k.includes(t)&&k.push(t)}let ee=O.replyToUrl?f(O.replyToUrl):null,j=[...k];ee&&!j.includes(ee)&&j.push(ee);let M=j.length?Jt(D,j.slice(-Nt)):D;if(T){let e=ne({...T,url:T.url??M});if(!e.accepted){o.push(`warn`,e.reason||`Unable to register username claim.`);return}V(e.registry)}await navigator.clipboard.writeText(M),o.push(`success`,`Link kopied. Kai-sealed.`),R(M);try{for(let e of j){let t=Wt(Pt,Yt(e));t.changed&&Gt(t.value)}let e=Wt(Pt,M);e.changed&&Gt(e.value);let t=Wt(Ft,M);t.changed&&Kt(t.value)}catch{}}catch(e){console.error(`[Composer] onGenerateReply:`,e),o.push(`error`,`Could not seal reply.`)}finally{I(!1)}}};return(0,F.jsxs)(`section`,{className:`sf-reply`,"aria-labelledby":`reply-title`,children:[U&&(0,F.jsxs)(`aside`,{className:`sf-reply-context`,"aria-label":`Replying to previous memory`,children:[(0,F.jsxs)(`div`,{className:`sf-reply-context-header`,children:[(0,F.jsx)(`span`,{className:`sf-pill`,children:`Replying to`}),U.author&&(0,F.jsx)(`span`,{className:`sf-reply-context-author`,children:U.author})]}),(0,F.jsx)(`p`,{className:`sf-reply-context-body`,children:U.snippet})]}),(0,F.jsxs)(`div`,{className:`sf-reply-row`,children:[(0,F.jsx)(`label`,{className:`sf-label`,children:`Attach`}),(0,F.jsxs)(`div`,{className:`sf-reply-row-inline`,children:[(0,F.jsx)(`label`,{className:`sf-btn`,htmlFor:M,children:`Record Memory`}),(0,F.jsx)(`label`,{className:`sf-btn sf-btn--ghost`,htmlFor:j,children:`Inhale files`})]}),(0,F.jsx)(`input`,{id:M,ref:se,type:`file`,accept:`image/*,video/*`,capture:`environment`,multiple:!0,onChange:_e,style:{position:`absolute`,opacity:0,pointerEvents:`none`}}),(0,F.jsx)(`input`,{id:j,ref:oe,type:`file`,accept:`image/*,video/*,audio/*,application/pdf,text/plain,application/json,application/xml,application/svg+xml`,multiple:!0,onChange:_e,style:{position:`absolute`,opacity:0,pointerEvents:`none`}}),E.items.length>0&&(0,F.jsx)(`div`,{className:`sf-att-grid`,children:E.items.map((e,t)=>(0,F.jsxs)(`div`,{className:`sf-att-item`,style:{position:`relative`},children:[(0,F.jsx)(Ot,{item:e}),(0,F.jsx)(`button`,{className:`sf-btn sf-btn--icon`,onClick:()=>ve(t),style:{position:`absolute`,top:8,right:8},type:`button`,"aria-label":`Remove attachment`,children:`✕`})]},`${e.kind}:${t}`))})]}),(0,F.jsxs)(`div`,{className:`sf-reply-row`,children:[(0,F.jsx)(`label`,{className:`sf-label`,children:`Add links`}),(0,F.jsxs)(`div`,{className:`sf-reply-row-inline`,children:[(0,F.jsx)(`input`,{className:`sf-input`,type:`url`,placeholder:`https://example.com`,value:O,onChange:e=>k(e.target.value)}),(0,F.jsx)(`button`,{className:`sf-btn`,onClick:()=>ye(O),type:`button`,children:`Add`})]}),A.length>0&&(0,F.jsx)(`div`,{className:`sf-att-grid`,children:A.map((e,t)=>(0,F.jsxs)(`div`,{className:`sf-att-item`,style:{position:`relative`},children:[(0,F.jsx)(Ot,{item:e}),(0,F.jsx)(`button`,{className:`sf-btn sf-btn--icon`,onClick:()=>be(t),style:{position:`absolute`,top:8,right:8},type:`button`,"aria-label":`Remove link`,children:`✕`})]},`${e.kind}:${e.url}:${t}`))})]}),(0,F.jsxs)(`div`,{className:`sf-reply-row`,children:[(0,F.jsx)(`label`,{className:`sf-label`,children:`Author`}),(0,F.jsx)(`input`,{className:`sf-input`,type:`text`,value:b,onChange:e=>x(e.target.value),placeholder:`@you`,"aria-describedby":he?`username-claim-status`:void 0}),he?(0,F.jsx)(`div`,{id:`username-claim-status`,className:`sf-sub`,role:`status`,"aria-live":`polite`,children:he}):null]}),W?(0,F.jsxs)(`div`,{className:`sf-reply-row`,children:[(0,F.jsx)(`label`,{className:`sf-label`,children:`Claim glyph`}),(0,F.jsx)(`input`,{className:`sf-input`,type:`text`,value:C,onChange:e=>T(e.target.value),placeholder:`Paste claim glyph hash or Memory Stream link`})]}):null,(0,F.jsxs)(`div`,{className:`sf-reply-row`,children:[(0,F.jsx)(`label`,{className:`sf-label`,children:`Memory`}),(0,F.jsx)(`textarea`,{className:`sf-textarea`,rows:3,value:h,onChange:e=>v(e.target.value),placeholder:`What do you want this moment to remember?`})]}),(0,F.jsxs)(`div`,{className:`sf-reply-actions`,children:[(0,F.jsx)(`button`,{className:`sf-btn`,onClick:()=>void xe(),disabled:le,type:`button`,children:le?`Sealing…`:`Exhale Reply`}),n&&(0,F.jsx)(`button`,{className:`sf-btn sf-btn--ghost`,onClick:n,type:`button`,children:`Use a different ΦKey`})]}),L&&(0,F.jsxs)(`div`,{className:`sf-reply-result`,children:[(0,F.jsx)(`label`,{className:`sf-label`,children:`Share this link`}),(0,F.jsx)(`input`,{className:`sf-input`,readOnly:!0,value:L,onFocus:e=>e.currentTarget.select()}),(0,F.jsxs)(`div`,{className:`sf-reply-actions`,children:[(0,F.jsx)(`a`,{className:`sf-link`,href:L,target:`_blank`,rel:`noreferrer`,children:`Open →`}),(0,F.jsx)(`button`,{className:`sf-btn`,type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(L),o.push(`success`,`Link remembered.`),ue(!0),window.setTimeout(()=>ue(!1),1200)}catch{o.push(`warn`,`Copy failed.`)}},children:z?`Remembered`:`Remember`})]})]})]})}var $t=()=>{let e=m();return e<=0n?0:e>BigInt(2**53-1)?2**53-1:Number(e)};function en(e){let[t,n]=(0,P.useState)(e?Ze:null),r=(0,P.useRef)(null),i=(0,P.useRef)(null),a=()=>{let e=$t()-Xe;i.current=Xe+Math.max(0,Math.ceil(e/Qe))*Qe};return(0,P.useEffect)(()=>{if(!e){r.current!=null&&window.cancelAnimationFrame(r.current),r.current=null,i.current=null,n(null);return}a();let t=()=>{let e=i.current;if(e==null)n(null);else{let t=$t();t>=e?(a(),n(0)):n((e-t)/1e3)}r.current=window.requestAnimationFrame(t)};r.current=window.requestAnimationFrame(t);let o=()=>{document.visibilityState===`visible`&&a()};return document.addEventListener(`visibilitychange`,o),()=>{r.current!=null&&window.cancelAnimationFrame(r.current),r.current=null,document.removeEventListener(`visibilitychange`,o)}},[e]),t}function tn(){let[e,t]=(0,P.useState)(()=>it(new Date($t()))),n=(0,P.useRef)(null),r=()=>{if(typeof document>`u`)return;let e=document.documentElement,t=(Qe-($t()-Xe)%Qe)%Qe;e.style.setProperty(`--pulse-dur`,`${Qe}ms`),e.style.setProperty(`--pulse-offset`,`-${Math.round(t)}ms`)},i=()=>{n.current!=null&&window.clearTimeout(n.current);let e=$t(),a=e-Xe,o=Xe+Math.max(0,Math.ceil(a/Qe))*Qe,s=Math.max(0,o-e);r(),n.current=window.setTimeout(()=>{t(it(new Date($t()))),i()},s)};return(0,P.useEffect)(()=>{i();let e=()=>{document.visibilityState===`visible`&&(t(it(new Date($t()))),i())};return document.addEventListener(`visibilitychange`,e),()=>{n.current!=null&&window.clearTimeout(n.current),n.current=null,document.removeEventListener(`visibilitychange`,e)}},[]),e}var nn=p(D(),1),rn=3+Math.sqrt(5);function an(e){return e<0?0:e>1?1:e}function on(e){if(!e)return rn;let t=window.getComputedStyle(e).getPropertyValue(`--pulse-dur`).trim(),n=Number.parseFloat(t);return Number.isFinite(n)&&n>0?n:rn}function sn(e){return e>0&&e<360?`nano`:e>0&&e<520?`tiny`:e>0&&e<760?`tight`:`wide`}function cn(e){switch(e){case`nano`:return .84;case`tiny`:return .9;case`tight`:return .95;default:return 1}}function ln(e){return e===`nano`?`stack`:`row`}function un(e){let[t,n]=P.useState(0);return P.useLayoutEffect(()=>{let t=e.current;if(!t)return;let r=()=>{n(Math.round(t.getBoundingClientRect().width))};if(r(),typeof ResizeObserver<`u`){let e=new ResizeObserver(()=>r());return e.observe(t),()=>e.disconnect()}let i=()=>r();return window.addEventListener(`resize`,i,{passive:!0}),()=>window.removeEventListener(`resize`,i)},[e]),t}var dn=[`Ignite`,`Integrate`,`Harmonize`,`Reflekt`,`Purify`,`Dream`];function fn(e){let t=Number.isFinite(e)?Math.floor(e):0;return dn[Math.max(0,Math.min(5,Math.floor(t/6)))]}var pn=(e,t)=>{let n=e%t;return n>=0n?n:n+t},mn=(e,t)=>{if(t===0n)throw Error(`Division by zero`);let n=e/t;return e%t===0n||e>=0n?n:n-1n},hn=e=>{let t=BigInt(2**53-1),n=BigInt(-(2**53-1));return e>t?2**53-1:er(!0),[]),a=P.useCallback(()=>r(!1),[]),o=P.useCallback(e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),r(!0))},[]),s=P.useRef(null),c=sn(un(s)),l=ln(c),u=c===`wide`||c===`tight`,[d,f]=P.useState(rn);P.useEffect(()=>{f(on(s.current))},[e.pulse]);let[p,m]=P.useState(!1),h=P.useRef(null);P.useEffect(()=>{let e=h.current;if(h.current=t,e!=null&&t!=null&&t>e+.25){m(!0);let e=window.setTimeout(()=>m(!1),180);return()=>window.clearTimeout(e)}},[t]);let g=`${e.beat}:${L(e.step)}`,_=P.useMemo(()=>t==null?0:an(1-t/d),[t,d]),v=t===null?`—`:t.toFixed(6),y=t===null?`—`:t.toFixed(6),b=String(e.harmonicDay),x=typeof e.beat==`number`?e.beat:Number.parseInt(String(e.beat),10)||0,S=typeof e.step==`number`?e.step:Number.parseInt(String(e.step),10)||0,C=fn(x),w=En[C]??`Heart`,T=typeof e.pulse==`number`?e.pulse:Number.parseInt(String(e.pulse),10)||0,E=P.useMemo(()=>gn(T),[T]),D=P.useMemo(()=>Cn(e.harmonicDay,E.day),[e.harmonicDay,E.day]),O=P.useMemo(()=>xn(E.month),[E.month]),k=P.useMemo(()=>Tn(E.month),[E.month]),A=`D${E.day}/M${E.month}/Y${E.year}`,ee=vn(D),j=vn(O),M=P.useMemo(()=>({"--kai-progress":_,"--kai-ui-scale":cn(c)}),[_,c]),te=1584,N=Math.max(0,Math.min(te-1,x*44+S))/te*100,ne=_*100,re=String(Math.round(x/36*360));P.useEffect(()=>{if(!n||typeof document>`u`)return;let e=document.documentElement.style.overflow;document.documentElement.style.overflow=`hidden`;let t=e=>{e.key===`Escape`&&a()};return window.addEventListener(`keydown`,t),()=>{document.documentElement.style.overflow=e,window.removeEventListener(`keydown`,t)}},[n,a]);let ie=(0,F.jsxs)(`div`,{className:`kai-status__countdown`,"aria-label":`Next pulse`,children:[(0,F.jsx)(`span`,{className:`kai-status__nLabel`,children:`NEXT`}),(0,F.jsxs)(`span`,{className:`kai-status__nVal`,title:v,"aria-label":`Next pulse in ${v} seconds`,children:[y,` `,(0,F.jsx)(`span`,{className:`kai-status__nUnit`,children:`s`})]})]}),ae=(0,F.jsxs)(`span`,{className:`kai-pill kai-pill--pulse`,title:`Pulse ${T}`,"aria-label":`Pulse ${T}`,"data-chakra":`Pulse`,children:[`☤KAI: `,(0,F.jsx)(`strong`,{className:`kai-pill__num`,children:T})]}),oe=(0,F.jsxs)(`span`,{className:`kai-pill kai-pill--dmy`,title:A,"aria-label":`Date ${A}`,children:[(0,F.jsxs)(`span`,{className:`kai-dmy__seg kai-dmy__seg--day`,"data-chakra":D,children:[`D`,(0,F.jsx)(`span`,{className:`kai-dmy__num`,children:E.day})]}),(0,F.jsx)(`span`,{className:`kai-dmy__sep`,children:`/`}),(0,F.jsxs)(`span`,{className:`kai-dmy__seg kai-dmy__seg--month`,"data-chakra":O,children:[`M`,(0,F.jsx)(`span`,{className:`kai-dmy__num`,children:E.month})]}),(0,F.jsx)(`span`,{className:`kai-dmy__sep`,children:`/`}),(0,F.jsxs)(`span`,{className:`kai-dmy__seg kai-dmy__seg--year`,"data-chakra":`Year`,children:[`Y`,(0,F.jsx)(`span`,{className:`kai-dmy__num`,children:E.year})]})]}),se=(0,F.jsx)(`span`,{className:`kai-pill kai-pill--day`,title:b,"aria-label":`Day ${b}`,"data-chakra":D,children:b}),ce=(0,F.jsx)(`span`,{className:`kai-pill kai-pill--dayChakra`,title:`Day chakra ${ee}`,"aria-label":`Day chakra ${ee}`,"data-chakra":D,children:ee}),le=(0,F.jsx)(`span`,{className:`kai-pill kai-pill--monthName`,title:k,"aria-label":`Month ${k}`,"data-chakra":O,children:k}),I=(0,F.jsx)(`span`,{className:`kai-pill kai-pill--monthChakra`,title:`Month chakra ${j}`,"aria-label":`Month chakra ${j}`,"data-chakra":O,children:j}),R=(0,F.jsx)(`span`,{className:`kai-pill kai-pill--ark`,title:C,"aria-label":`Ark ${C}`,"data-chakra":w,children:C}),z=n&&typeof document<`u`?(0,nn.createPortal)((0,F.jsxs)(`div`,{className:`kk-pop`,role:`dialog`,"aria-modal":`true`,"aria-label":`Kai-Klok`,children:[(0,F.jsx)(`button`,{type:`button`,className:`kk-pop__backdrop`,"aria-label":`Close Kai-Klok`,onClick:a}),(0,F.jsxs)(`div`,{className:`kk-pop__panel`,role:`document`,children:[(0,F.jsxs)(`div`,{className:`kk-pop__head`,children:[(0,F.jsx)(`div`,{className:`kk-pop__title`,children:`Kai-Klok`}),(0,F.jsx)(`button`,{type:`button`,className:`kk-pop__close`,onClick:a,"aria-label":`Close`,children:`✕`})]}),(0,F.jsxs)(`div`,{className:`kk-pop__meta`,"aria-label":`Kai summary`,children:[(0,F.jsx)(`span`,{className:`kk-pop__pill`,children:g}),(0,F.jsx)(`span`,{className:`kk-pop__pill`,children:A}),(0,F.jsx)(`span`,{className:`kk-pop__pill`,children:k}),(0,F.jsx)(`span`,{className:`kk-pop__pill`,children:C})]}),(0,F.jsx)(`div`,{className:`kk-pop__dial`,"aria-label":`Kai-Klok dial`,children:(0,F.jsx)(`div`,{className:`klock-stage`,"data-klock-stage":`1`,children:(0,F.jsx)(`div`,{className:`klock-stage__inner`,children:(0,F.jsx)(Dn,{hue:re,pulse:T,harmonicDayPercent:N,microCyclePercent:ne,dayLabel:b,monthLabel:k,monthDay:E.day,kaiPulseEternal:T,glowPulse:!0,pulseIntervalSec:d,rimFlash:p,solarSpiralStepString:`${L(x)}:${L(S)}`,eternalBeatIndex:x,eternalStepIndex:S})})})}),(0,F.jsx)(`div`,{className:`kk-pop__foot`,children:(0,F.jsx)(`span`,{className:`kk-pop__hint`,children:`Tap the Klok for more details or press x to return.`})})]})]}),document.body):null;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{ref:s,className:`kai-feed-status kai-feed-status--slim${p?` kai-feed-status--flash`:``}`,onClick:i,onKeyDown:o,tabIndex:0,role:`button`,"aria-haspopup":`dialog`,"aria-expanded":n,"aria-label":`Kai status (open Kai-Klok)`,"data-layout":c,"data-bottom":l,"data-kai-bsi":g,"data-kai-ark":C,"data-kai-dmy":A,"data-day-chakra":D,"data-month-chakra":O,"data-ark-chakra":w,"data-day-num":E.day,"data-month-num":E.month,"data-year-num":E.year,style:M,children:[(0,F.jsxs)(`div`,{className:`kai-status__top`,"aria-label":`Kai timeline (day row)`,children:[(0,F.jsxs)(`span`,{className:`kai-status__bsiWrap`,"aria-label":`Beat step ${g}`,children:[(0,F.jsx)(`span`,{className:`kai-status__kLabel`,"aria-hidden":`true`,children:`KAIROS`}),(0,F.jsx)(`span`,{className:`kai-status__bsi`,title:g,children:g})]}),oe,se,ce,u?ae:null]}),(0,F.jsxs)(`div`,{className:`kai-status__mid`,"aria-label":`Kai timeline (month/ark row)`,children:[le,I,R]}),(0,F.jsxs)(`div`,{className:`kai-status__bottom`,"aria-label":`Next pulse row`,children:[u?null:ae,ie]}),(0,F.jsxs)(`div`,{className:`kai-feed-status__bar`,"aria-hidden":`true`,children:[(0,F.jsx)(`div`,{className:`kai-feed-status__barFill`}),(0,F.jsx)(`div`,{className:`kai-feed-status__barSpark`})]})]}),z]})}function kn(e){return typeof e==`object`&&!!e}function q(e){return typeof e==`number`&&Number.isFinite(e)}function J(e){return typeof e==`string`}function An(e){if(!Array.isArray(e))return!1;for(let t of e)if(!J(t))return!1;return!0}function jn(e){let t=e.trim();return t=t.replace(/[)\].,;:!?]+$/g,``),t=t.replace(/^[([{"'`]+/g,``),t.trim()}function Mn(){let e=globalThis.location?.origin;return typeof e==`string`&&e.length>0?e:`https://phi.network`}function Nn(e){let t=jn(e);try{return new URL(t)}catch{}try{return new URL(t,Mn())}catch{return null}}function Pn(e){let t=jn(e);if(/%[0-9A-Fa-f]{2}/.test(t))try{t=decodeURIComponent(t)}catch(e){let t=e instanceof Error?e.message:`decodeURIComponent failed`;throw Error(t)}return t.includes(` `)&&(t=t.replaceAll(` `,`+`)),/[+/=]/.test(t)&&(t=t.replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/g,``)),jn(t)}function Fn(e){let t=e.startsWith(`j:`)||e.startsWith(`c:`)?e.slice(2):e;return/^[A-Za-z0-9_-]{16,}$/.test(t)}function In(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=t.length%4;return n===2?t+=`==`:n===3&&(t+=`=`),t}function Ln(e){let t=jn(e),n=In(t.startsWith(`j:`)||t.startsWith(`c:`)?t.slice(2):t),r=globalThis;if(typeof r.atob!=`function`)throw Error(`Base64 decode failure: atob() unavailable`);if(r.TextDecoder===void 0)throw Error(`Base64 decode failure: TextDecoder unavailable`);try{let e=r.atob(n),t=new Uint8Array(e.length);for(let n=0;n{if(!e)return;let t=Pn(e);Fn(t)&&(n.includes(t)||n.push(t))},i=jn(e);Fn(i)&&r(i);let a=Nn(i);if(!a)return n;r(Bn(a.hash));let o=a.hash&&a.hash.startsWith(`#`)?a.hash.slice(1):a.hash,s=new URLSearchParams(o),c=a.searchParams,l=[`p`,`t`,`token`,`capsule`];r(Vn(c,s,l));for(let e of l)r(s.get(e)),r(c.get(e));if(r(zn(a.pathname)),t<1){let e=[...c.getAll(`add`),...s.getAll(`add`)];for(let n of e){let e=jn(n);if(!e)continue;let i=e;if(/%[0-9A-Fa-f]{2}/.test(i))try{i=decodeURIComponent(i)}catch(e){let t=e instanceof Error?e.message:`decodeURIComponent(add) failed`;throw Error(t)}for(let e of Hn(i,t+1))r(e)}}return n}function Un(e){let t=jn(e);if(t.startsWith(`j:`)||t.startsWith(`c:`))return{rootRef:t,addRefs:[]};let n=Nn(t);if(!n)return{rootRef:null,addRefs:[]};let r=n.hash&&n.hash.startsWith(`#`)?n.hash.slice(1):n.hash,i=new URLSearchParams(r),a=n.searchParams,o=i.get(`root`)??a.get(`root`),s=i.get(`v`)??a.get(`v`),c=[...i.getAll(`add`),...a.getAll(`add`)].map(e=>jn(e)).filter(e=>e.length>0),l=o?jn(o):null;return{v:s?jn(s):void 0,rootRef:l,addRefs:c}}function Wn(e){if(kn(e)&&kn(e.capsule))return e.capsule;if(kn(e)&&kn(e.data)){let t=e.data;if(kn(t)&&kn(t.capsule))return t.capsule;if(kn(t)&&(`post`in t||`message`in t||`share`in t||`reaction`in t))return t}return kn(e)&&(`post`in e||`message`in e||`share`in e||`reaction`in e)||kn(e)&&(`pulse`in e||`u`in e||`kind`in e||`userId`in e||`userPhiKey`in e)?e:null}function Gn(e){let t=q(e.pulse)?e.pulse:q(e.u)?e.u:void 0,n=q(e.beat)?e.beat:q(e.b)?e.b:void 0,r=q(e.stepIndex)?e.stepIndex:q(e.s)?e.s:void 0,i=J(e.chakraDay)||q(e.chakraDay)?e.chakraDay:J(e.c)||q(e.c)?e.c:void 0;return{...e,pulse:t,beat:n,stepIndex:r,chakraDay:i}}function Kn(e){return Rn(Ln(jn(e)))}function qn(e,t){let n=Wn(e);if(!n)throw Error(`Invalid payload (missing capsule)`);let r=Gn(n),i=kn(e)?e:null,a=i&&kn(i.data)?i.data:null,o=Nn(t),s=(()=>{let e=i?.path;if(An(e))return e;let t=a?.path;return An(t)?t:o?o.pathname.split(`/`).filter(Boolean):[]})();return{url:t,appId:(i&&J(i.appId)?i.appId:void 0)??(a&&J(a.appId)?a.appId:void 0)??(s[0]===`s`&&s.length>=2?s[1]:void 0),userId:(i&&J(i.userId)?i.userId:void 0)??(a&&J(a.userId)?a.userId:void 0)??(J(r.userId)?r.userId:J(r.userPhiKey)?r.userPhiKey:void 0),kind:(i&&J(i.kind)?i.kind:void 0)??(a&&J(a.kind)?a.kind:void 0)??(J(r.kind)?r.kind:r.post?`post`:r.message?`message`:r.share?`share`:r.reaction?`reaction`:void 0),pulse:(i&&q(i.pulse)?i.pulse:void 0)??(a&&q(a.pulse)?a.pulse:void 0)??(q(r.pulse)?r.pulse:void 0),beat:(i&&q(i.beat)?i.beat:void 0)??(a&&q(a.beat)?a.beat:void 0)??(q(r.beat)?r.beat:void 0),stepIndex:(i&&q(i.stepIndex)?i.stepIndex:void 0)??(a&&q(a.stepIndex)?a.stepIndex:void 0)??(q(r.stepIndex)?r.stepIndex:void 0),chakraDay:(i&&(J(i.chakraDay)||q(i.chakraDay))?i.chakraDay:void 0)??(a&&(J(a.chakraDay)||q(a.chakraDay))?a.chakraDay:void 0)??(J(r.chakraDay)||q(r.chakraDay)?r.chakraDay:void 0),capsule:r,path:s}}function Jn(e){try{let t=jn(e),n=Un(t);if(n.rootRef){let t=qn(Kn(n.rootRef),e),r=[];for(let e of n.addRefs)if(!(!e.startsWith(`j:`)&&!e.startsWith(`c:`)))try{let t=Kn(e);r.push(qn(t,e))}catch{}return{ok:!0,data:{...t,url:e,stream:{v:n.v,rootRef:n.rootRef,addRefs:n.addRefs,addData:r}}}}let r=Hn(t)[0]??null;if(!r)return{ok:!1,error:`No capsule token found (expected /s/, /p~, /stream/p/, ?p=, #t=, #/p~, a raw token, or a Memory Stream with #root=j:).`};let i=Rn(Ln(r));if(!kn(i))return{ok:!1,error:`Payload is not an object`};let a=Gn(i),o=Nn(t),s=o?o.pathname.split(`/`).filter(Boolean):[],c=s[0]===`s`&&s.length>=2?s[1]:void 0,l=J(a.userId)?a.userId:J(a.userPhiKey)?a.userPhiKey:void 0,u=J(a.kind)?a.kind:a.post?`post`:a.message?`message`:a.share?`share`:a.reaction?`reaction`:void 0,d=s.length>=8?s[6]:void 0;return{ok:!0,data:{url:e,appId:c,userId:l,kind:u??d,pulse:a.pulse,beat:a.beat,stepIndex:a.stepIndex,chakraDay:a.chakraDay,capsule:a,path:s}}}catch(e){return{ok:!1,error:e instanceof Error?e.message:`Decode error`}}}const Yn=`/stream`,Xn=(()=>{if(typeof window>`u`)return Yn;let e=window.location?.origin;return!e||e===`null`?Yn:`${e.replace(/\/+$/g,``)}${Yn}`})();(()=>{if(typeof window>`u`)return`/s`;let e=window.location?.origin;return!e||e===`null`?`/s`:`${e.replace(/\/+$/g,``)}/s`})();function Zn(e){let t=String(e??``).trim();return t=t.replace(/[)\].,;:!?]+$/g,``),t=t.replace(/^[([{"'`]+/g,``),t.trim()}function Qn(e){let t=Zn(e);if(/%[0-9A-Fa-f]{2}/.test(t))try{t=decodeURIComponent(t)}catch{}return t.includes(` `)&&(t=t.replaceAll(` `,`+`)),/[+/=]/.test(t)&&(t=t.replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/g,``)),Zn(t)}function $n(e){let t=Qn(e);return`${Xn||`/stream`}#t=${encodeURIComponent(t)}`}function er(e){return $n(e)}var tr=(e,t=8,n=4)=>e.length<=t+n?e:`${e.slice(0,t)}…${e.slice(-n)}`,nr=e=>{if(e)try{return new URL(e).host}catch{return}},rr=e=>typeof e==`string`&&e.trim().length>0,ir=e=>String(e??``).toUpperCase(),Y=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function ar(e){let t=String(e??``),n=t.length;return{lines:t.length?t.split(/\r\n|\r|\n/).length:0,chars:n}}function or(e,t){let{lines:n,chars:r}=ar(e);return{shouldCollapse:n>(t===`code`?18:10)||r>(t===`code`?1400:700),lines:n,chars:r,maxHeightPx:t===`code`?320:240}}function sr(e){return e instanceof HTMLElement?!!e.closest(`a,button,input,textarea,select,summary,[role="button"],[role="link"],[data-no-open="true"]`):!1}var cr=`/stream`,lr=`/s`,ur=`2`,dr=12e4,X=`j:`,fr=`s:`;function Z(e){let t=e.trim();return t=t.replace(/[)\].,;:!?]+$/g,``),t=t.replace(/^[([{"'`]+/g,``),t.trim()}function pr(e){let t=Z(e);if(/%[0-9A-Fa-f]{2}/.test(t))try{t=decodeURIComponent(t)}catch{}return t.includes(` `)&&(t=t.replaceAll(` `,`+`)),/[+/=]/.test(t)&&(t=t.replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/g,``)),Z(t)}function mr(e){return/^[A-Za-z0-9_-]{16,}$/.test(e)}function hr(){let e=typeof Xn==`string`?Xn.trim():``;if(e)return e.replace(/\/+$/g,``).replace(/\/stream\/?$/g,``);if(typeof window>`u`)return``;let t=window.location?.origin;return t&&t!==`null`?t.replace(/\/+$/g,``):``}function gr(){return hr()||`https://x.invalid`}function _r(){let e=hr();return e?`${e}${cr}`:cr}function vr(){let e=hr();return e?`${e}${lr}`:lr}function yr(e){let t=e.trim();try{return new URL(t)}catch{try{return new URL(t,gr())}catch{return null}}}function br(e){let t=Z(e),n=yr(t),r=n?n.pathname:t;return/^\/s(?:\/|$)/.test(r)}function xr(e){{let t=e.match(/\/s\/([^/?#]+)/);if(t?.[1])return t[1]}{let t=e.match(/\/p(?:\u007e|%7[Ee])\/?([^/?#]+)/);if(t?.[1])return t[1]}{let t=e.match(/\/(?:stream|feed)\/p\/([^/?#]+)/);if(t?.[1])return t[1]}{let t=e.match(/\/p\/([^/?#]+)/);if(t?.[1])return t[1]}return null}function Sr(e,t=0){let n=[],r=e=>{if(!e)return;let t=pr(e);t&&mr(t)&&(n.includes(t)||n.push(t))},i=Z(e);mr(i)&&r(i);let a=yr(i);if(!a)return n;let o=a.hash&&a.hash.startsWith(`#`)?a.hash.slice(1):``,s=new URLSearchParams(o),c=a.searchParams;for(let e of[`t`,`p`,`token`,`capsule`])r(s.get(e)),r(c.get(e));let l=s.get(`v`),u=c.get(`v`);for(let e of[l,u]){if(!e)continue;let t=pr(e);/^\d{1,4}$/.test(t)||t!==ur&&r(t)}if(r(xr(a.pathname)),t<1){let e=[...c.getAll(`add`),...s.getAll(`add`)];for(let n of e){let e=Z(n);if(e){if(/%[0-9A-Fa-f]{2}/.test(e))try{e=decodeURIComponent(e)}catch{}for(let n of Sr(e,t+1))r(n)}}}return n}function Cr(e){let t=_r(),n=pr(e);return`${t}#t=${encodeURIComponent(n)}`}function wr(e){let t=Sr(Z(e))[0];return t?Cr(t):null}function Q(e){let t=Z(e),n=yr(t);if(n){let e=n.hash&&n.hash.startsWith(`#`)?n.hash.slice(1):``,t=new URLSearchParams(e),r=n.searchParams;if(t.get(`root`)||r.get(`root`)){let e=_r(),n=new URL(e||cr,gr()),i=new URLSearchParams;for(let[e,n]of t.entries())i.append(e,n);for(let[e,t]of r.entries())i.append(e,t);return n.hash=i.toString()?`#${i.toString()}`:``,n.search=``,n.toString()}}if(br(t))return t;let r=Sr(t)[0];return r?Cr(r):t}function Tr(e){let t=_r().replace(/\/stream\/?$/g,``),n=pr(e);return[n,`${t}/stream#t=${n}`,`${t}/stream?t=${n}`,`${t}/stream/t=${n}`,`${t}/p#t=${n}`,`${t}/p?t=${n}`,`${t}/stream/p/${n}`,`${t}/p#p=${n}`,`${t}/p?p=${n}`,`${t}/p#token=${n}`,`${t}/p?token=${n}`,`${t}/stream#v=${n}`,`${t}/stream?v=${n}`]}function Er(e){let t=new Set,n=e=>{let n=e.trim();if(!n||t.has(n))return null;t.add(n);let r=Jn(n);return r.ok?r:null},r=Z(e),i=n(r);if(i)return{decoded:i,resolvedUrl:Q(r)};let a=Sr(r);for(let e of a)for(let t of Tr(e)){let r=n(t);if(r)return{decoded:r,resolvedUrl:Cr(e)}}return{decoded:Jn(r),resolvedUrl:Q(r)}}function Dr(e){if(!Y(e))return null;let t=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==void 0,n=e=>t(e,`post`)||t(e,`message`)||t(e,`share`)||t(e,`reaction`),r=(e,n)=>{for(let r of[`post`,`message`,`share`,`reaction`])t(n,r)&&e[r]===void 0&&(e[r]=n[r])},i=e,a=Y(i.data)?i.data:null,o=n(i),s=!!a&&n(a),c=Y(i.capsule)?i.capsule:null,l=a&&Y(a.capsule)?a.capsule:null,u=c??l;if(u&&(o||s)){let e={...u};return s&&a&&r(e,a),o&&r(e,i),e}return u||(o?i:s&&a?a:i)}function Or(e){if(e===null)return null;if(typeof e==`number`)return Number.isFinite(e)?e:null;if(typeof e==`string`||typeof e==`boolean`)return e;if(typeof e==`bigint`)return e.toString();if(Array.isArray(e))return e.map(Or);if(e&&typeof e==`object`){let t=e,n=Object.keys(t).sort((e,t)=>e.localeCompare(t)),r={};for(let e of n)r[e]=Or(t[e]);return r}return null}function kr(e){let t=``,n=32768;for(let r=0;rFr(`leaf:${e}`));for(;t.length>1;){let e=[];for(let n=0;n0)return`p:${Math.floor(a)}`;let o=t.kaiSignature;if(typeof o==`string`&&o.trim())return`ks:${o.trim()}`}return`h:${Fr(JSON.stringify(Or(e)))}`}function Rr(e){return`${fr}${jr(JSON.stringify(Or(e)))}`}function zr(e){let t=Z(e),n=t.startsWith(fr)?t.slice(2):t;if(!/^[A-Za-z0-9_-]{16,}$/.test(n))return null;try{let e=Mr(n),t=JSON.parse(e);if(!t||typeof t!=`object`)return null;let r=t,i=r.v,a=r.id,o=r.m,s=r.n,c=r.a,l=r.r;return typeof i!=`string`||typeof a!=`string`||typeof o!=`string`||typeof s!=`number`||typeof c!=`number`||typeof l!=`string`?null:{v:i,id:a,m:o,n:s,a:c,r:l}}catch{return null}}var Br=(e,t)=>{let n=e%t;return n>=0n?n:n+t},Vr=(e,t)=>{if(t===0n)throw Error(`Division by zero`);let n=e/t;return e%t===0n||e>=0n?n:n-1n},Hr=e=>{let t=BigInt(2**53-1),n=BigInt(-(2**53-1));return e>t?2**53-1:eString(Math.max(0,Math.floor(e))).padStart(2,`0`);function qr(e,t,n,r,i,a){let o=Gr(t),s=`${Kr(t)}:${Kr(n)}`;return{arc:o,label:s,line:`☤KAI:${e} • ${s} D${Math.max(1,Math.floor(r))}/M${Math.max(1,Math.floor(i))}/Y${Math.floor(a)}`}}function Jr(e){let t=Math.max(0,Math.min(43,Math.floor(e)))/44;return t>=1?.999999999999:t}var Yr={Root:[255,88,88],Sacral:[255,146,88],"Solar Plexus":[255,215,128],Heart:[88,255,174],Throat:[42,197,255],"Third Eye":[164,126,255],Crown:[238,241,251],Krown:[238,241,251]};function Xr(e){if(e&&typeof e==`object`&&`source`in e){let t=e.source;return typeof t==`string`?t:void 0}}function Zr(e,t){if(e&&typeof e==`object`&&`kind`in e){let t=e.kind;if(typeof t==`string`&&t.trim().length>0)return t}return t}var Qr=256;function $r(e){let t=yr(Z(e));if(!t)return[];let n=t.hash&&t.hash.startsWith(`#`)?t.hash.slice(1):``,r=new URLSearchParams(n),i=t.searchParams,a=[...r.getAll(`add`),...i.getAll(`add`)],o=[];for(let e of a){let t=Z(e);if(!t)continue;if(/%[0-9A-Fa-f]{2}/.test(t))try{t=decodeURIComponent(t)}catch{}if(t.startsWith(X)&&t.length>10){o.push(t);continue}let n=Pr(t);if(n&&Dr(n)){let e=Z(t.startsWith(X)?t.slice(2):t);o.push(`${X}${e}`);continue}let r=Sr(t)[0];if(r){o.push(Cr(r));continue}if(br(t)){o.push(t);continue}o.push(Q(t))}return o.slice(-Qr)}function ei(e){let t=yr(Z(e));if(!t)return null;let n=t.hash&&t.hash.startsWith(`#`)?t.hash.slice(1):``,r=new URLSearchParams(n),i=t.searchParams,a=r.get(`root`)??i.get(`root`);if(!a)return null;if(a=Z(a),/%[0-9A-Fa-f]{2}/.test(a))try{a=decodeURIComponent(a)}catch{}if(a.startsWith(X))return a;let o=Pr(a);return o&&Dr(o)?`${X}${Z(a)}`:null}function ti(e){let t=yr(Z(e));if(!t)return null;let n=t.hash&&t.hash.startsWith(`#`)?t.hash.slice(1):``,r=new URLSearchParams(n),i=t.searchParams,a=r.get(`seg`)??i.get(`seg`);if(!a)return null;let o=Z(a);if(/%[0-9A-Fa-f]{2}/.test(o))try{o=decodeURIComponent(o)}catch{}return zr(o)}function ni(e){let t=Z(e);if(!t)return null;if(t.startsWith(X)||br(t))return t;{let e=yr(t);if(e){let n=e.hash&&e.hash.startsWith(`#`)?e.hash.slice(1):``,r=new URLSearchParams(n),i=e.searchParams;if(r.get(`root`)||i.get(`root`))return Q(t)}}let n=Sr(t)[0];return n?Cr(n):null}function ri(e){if(typeof e==`string`)return ni(e);if(e&&typeof e==`object`){let t=e;if(typeof t.url==`string`)return ni(t.url);if(typeof t.href==`string`)return ni(t.href)}return null}function ii(e,t=0){if(!e||typeof e!=`object`||Array.isArray(e)||t>4)return null;let n=e,r=n.skip;if(Array.isArray(r)&&typeof r[1]==`string`){let e=ni(r[1]);if(e)return e}for(let e of`prevUrl.prevURL.prev.prevId.prev_id.previousUrl.previousURL.previous.previousId.previous_id.parentUrl.parentURL.parent.parentId.parent_id.replyToUrl.replyToURL.replyTo.replyToId.replyTo_id.inReplyToUrl.inReplyToURL.inReplyTo.inReplyToId.inReplyTo_id.refUrl.ref_url.ref`.split(`.`)){let t=ri(n[e]);if(t)return t}for(let e of[`capsule`,`data`,`payload`]){let r=ii(n[e],t+1);if(r)return r}return null}function ai(e){let t=Math.max(0,Math.floor(e));if(t<=2)return t;let n=1,r=2;for(;;){let e=n+r;if(e>t)return r;n=r,r=e}}function oi(e,t){let n=_r(),r=new URL(n||cr,gr()),i=[e,...t],a=Ir(i),o={v:ur,id:`seg:${a}:${i.length}`,m:a,n:i.length,a:t.length,r:tr(e,8,6)},s=new URLSearchParams;s.set(`v`,ur),s.set(`root`,e),s.set(`seg`,Rr(o));for(let e of t)s.append(`add`,e);return r.hash=s.toString()?`#${s.toString()}`:``,r.search=``,{url:r.toString(),rootRef:e,adds:[...t],meta:o}}function si(e,t){let n=0,r=t.length;for(;n0?a:i)),s=t.length-o;return{keepFrom:s,kept:t.slice(s)}}function ci(e,t,n=0){if(n>64)return{primary:oi(e,[]),archives:[]};let r=oi(e,t);if(r.url.length<=dr)return{primary:r,archives:[]};let{keepFrom:i,kept:a}=si(e,t),o=oi(e,a);if(o.url.length>dr)return{primary:oi(e,[]),archives:[]};if(i<=0)return{primary:o,archives:[]};let s=t.slice(0,i),c=a[0];if(!c)return{primary:o,archives:[]};let l=ci(c,s,n+1);return{primary:o,archives:[l.primary,...l.archives]}}function li(e){let t=[],n=new Set;for(let r of e){let e=String(r??``).trim();e&&(n.has(e)||(n.add(e),t.push(e)))}return t}function ui(e){let t=0;for(let n of e)Z(n).startsWith(X)&&t++;return t}function di(e,t){let n=Z(e);if(t)return`k:${Lr(t)}`;if(n.startsWith(X)){let e=Pr(n);return e?`k:${Lr(e)}`:`k:${Fr(n)}`}let r=Sr(n)[0];return r?`t:${pr(r)}`:`u:${Q(n)}`}var fi=4096,pi=new Map,mi=0,hi=0,gi=!1,_i=new Set;function vi(){if(gi)return;gi=!0;let e=()=>{gi=!1,hi++;for(let e of _i)e()};typeof queueMicrotask==`function`?queueMicrotask(e):Promise.resolve().then(e)}function yi(e){return _i.add(e),()=>_i.delete(e)}function bi(){return hi}function xi(){return 0}function Si(e){let t=pi.get(e.key);if(!(t&&t.prevKey===e.prevKey&&t.payloadRef===e.payloadRef&&t.fallbackRef===e.fallbackRef))for(pi.has(e.key)&&pi.delete(e.key),pi.set(e.key,{...e,tick:++mi}),vi();pi.size>fi;){let e=pi.keys().next().value;if(!e)break;pi.delete(e),vi()}}function Ci(e,t){let n=[],r=new Set,i=pi.get(e)?.prevKey??null,a=0;for(;i&&atypeof e==`string`&&e.trim().toLowerCase()===`manual`,Oi=e=>{if(rr(e))return Di(e)?Ti:e};function ki(e,t=0){if(t>5)return!1;if(Di(e))return!0;if(Array.isArray(e)){for(let n of e)if(ki(n,t+1))return!0;return!1}if(e&&typeof e==`object`){let n=e;for(let e of Object.keys(n))if(ki(n[e],t+1))return!0}return!1}function Ai(e,t){if(!Y(e))return;let n=e[t];return typeof n==`string`&&n.trim()?n.trim():void 0}function ji(e,t){if(!Y(e))return[];let n=e[t];if(!Array.isArray(n))return[];let r=[];for(let e of n)typeof e==`string`&&e.trim()&&r.push(e.trim());return r}function Mi(e){if(!Y(e))return{};let t=Ai(e,`caption`),n=e.body;if(Y(n)){let e=Ai(n,`kind`),r=e===`text`||e===`md`||e===`code`||e===`html`?e:void 0;if(r===`text`)return{text:Ai(n,`text`)??t,kind:r};if(r===`md`)return{text:Ai(n,`md`)??t,kind:r};if(r===`code`)return{text:Ai(n,`code`)??t,kind:r};if(r===`html`)return{text:Ai(n,`html`)??t,kind:r}}return{text:t,kind:void 0}}function Ni(e){if(!Y(e))return[];let t=e.attachments;if(!Y(t))return[];let n=t.items;if(!Array.isArray(n))return[];let r=[];for(let e of n){if(!Y(e))continue;let t=Ai(e,`url`);if(t){r.push({url:t});continue}let n=Ai(e,`href`);n&&r.push({url:n})}return r}function Pi(e,t){let n=e??t;if(!n)return{};let{text:r,kind:i}=Mi(n),a=ji(n,`tags`),o=Ni(n),s=typeof r==`string`&&r.trim().length>0,c=o.length>0,l=a.length>0;return!s&&!c&&!l?{}:{post:{title:void 0,text:s?r:void 0,tags:l?a:void 0,media:c?o.map(e=>({kind:`url`,url:e.url})):void 0},bodyKind:i}}function Fi(e){if(typeof document>`u`)return!1;try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,`true`),t.style.position=`fixed`,t.style.left=`-9999px`,t.style.top=`0`,document.body.appendChild(t);let n=document.activeElement instanceof HTMLElement?document.activeElement:null;t.focus(),t.select();let r=document.execCommand(`copy`);return document.body.removeChild(t),n&&n.focus(),r}catch{return!1}}function Ii(e){if(typeof window>`u`)return null;let t=window.navigator;return t!==void 0&&t.clipboard!==void 0&&typeof t.clipboard.writeText==`function`&&window.isSecureContext?t.clipboard.writeText(e):null}function Li(e,t,n){if(Fi(e)){t();return}let r=Ii(e);if(r){t(),r.catch(e=>n(e));return}n()}var Ri=`sigil:urls`,zi=`sigil:feed`,Bi=`kai-sigil-registry`,Vi=`kai:sigils:v1`,Hi=`kai-feed-registry`,Ui=0,Wi=!1,Gi=new Set,Ki=!1,qi=null,Ji=null;function Yi(){if(Wi)return;Wi=!0;let e=()=>{Wi=!1,Ui++;for(let e of Gi)e()};typeof queueMicrotask==`function`?queueMicrotask(e):Promise.resolve().then(e)}function Xi(e){return Gi.add(e),()=>Gi.delete(e)}function Zi(){return Ui}function Qi(){return 0}function $i(e){let t=[];if(Array.isArray(e)){for(let n of e)typeof n==`string`&&n.trim()&&t.push(n.trim());return t}if(Y(e)){let n=e.urls;if(Array.isArray(n)){for(let e of n)typeof e==`string`&&e.trim()&&t.push(e.trim());return t}let r=Object.keys(e).filter(e=>e.startsWith(`http`)||e.startsWith(`/`)||e.includes(`/stream`)||e.includes(`/s/`));if(r.length)return r;for(let n of Object.values(e))Y(n)&&typeof n.url==`string`&&n.url.trim()&&t.push(n.url.trim());return t}return t}function ea(e){if(typeof window>`u`||window.localStorage===void 0)return[];let t=window.localStorage.getItem(e);if(!t)return[];try{return $i(JSON.parse(t))}catch{return[]}}function ta(e){let t=e.trim();if(!t)return``;try{return new URL(t,gr()).toString()}catch{return t}}function na(){let e=li([...ea(zi),...ea(Ri),...ea(Vi)]),t=[];for(let n of e){let e=ta(n);e&&t.push(e)}return li(t)}function ra(e){let t=Z(e);return t?t.startsWith(X)?oi(t,[]).url:wr(t)??Q(t):``}function ia(e){let t=li($r(e))[0]??e;return di(t,(t.startsWith(X)?Pr(t):null)??void 0)}function aa(e){let t=Z(e);if(!t)return null;if(t.startsWith(X))return Pr(t);let n=Er(t);return n.decoded.ok?n.decoded.data:null}function oa(e,t){let n=Z(e);if(!n)return e;let r=li($r(n));if(r.length>0)return r[0];let i=n,a=t===void 0?null:t;a||=aa(i);let o=new Set;for(let e=0;e<48;e++){let e=di(i,a??void 0);if(o.has(e))break;o.add(e);let t=a?ii(a):null;if(!t)return i;i=t,a=aa(i)}return i}function sa(e,t){let n=oa(e,t);return di(n,(n.startsWith(X)?Pr(n):aa(n))??void 0)}function ca(e){let t=Z(e);if(/^[0-9a-fA-F]{64}$/.test(t))try{return er(t.toLowerCase())}catch{}return`${vr()}/${encodeURIComponent(t)}`}function la(e,t){if(!Y(e))return null;for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim())return t.trim()}return null}function ua(e,t){let n=Z(e);if(br(n))return n;let r=la(t,[`sigilUrl`,`sigilURL`,`sigil_url`,`sigilHref`,`sigil_href`,`sUrl`,`s_url`,`s`])??null;if(r&&br(r))return Q(r);let i=la(t,[`id`,`contentId`,`cid`,`hash`,`contentHash`])??null;if(i&&/^[0-9a-fA-F]{64}$/.test(i))return ca(i);let a=Y(t)?t.sigilId:void 0;if(typeof a==`string`&&a.trim())return ca(a);let o=Sr(n)[0];return o?ca(o):null}function da(e,t){let n=oa(e,t),r=aa(n),i=ua(n,r?Dr(r):null);return i?Q(i):ra(n)}function fa(e){let t=yr(e);if(!t)return 0;let n=t.hash&&t.hash.startsWith(`#`)?t.hash.slice(1):``,r=new URLSearchParams(n),i=t.searchParams;return r.getAll(`add`).length+i.getAll(`add`).length}function pa(e){let t=fa(e),n=e.length;return t*1e5+n}function ma(e){let t=Sr(e)[0];if(t)return`t:${pr(t)}`;let n=ei(e);if(n){let e=Pr(n);return e?`r:${Lr(e)}`:`r:${Fr(n)}`}return`u:${Q(e)}`}function ha(e,t){if(typeof window>`u`||window.localStorage===void 0)return{changed:!1,added:!1,updated:!1,value:t};let n=ta(t);if(!n)return{changed:!1,added:!1,updated:!1,value:t};try{let t=window.localStorage.getItem(e),r=[];if(t){let e=JSON.parse(t);if(Array.isArray(e))for(let t of e)typeof t==`string`&&r.push(t)}let i=new Map,a=[];for(let e of r){let t=ta(e);if(!t)continue;let n=ma(t),r=pa(t),o=i.get(n);o?r>o.score&&i.set(n,{url:t,score:r,index:o.index}):(i.set(n,{url:t,score:r,index:a.length}),a.push(n))}let o=ma(n),s=pa(n),c=i.get(o),l=!1,u=!1;c?s>c.score&&(i.set(o,{url:n,score:s,index:c.index}),u=!0):(i.set(o,{url:n,score:s,index:a.length}),a.push(o),l=!0);let d=[];for(let e of a){let t=i.get(e);t&&d.push(t.url)}let f=JSON.stringify(r),p=JSON.stringify(d);return f===p?{changed:!1,added:l,updated:u,value:n}:(window.localStorage.setItem(e,p),{changed:!0,added:l,updated:u,value:n})}catch{return{changed:!1,added:!1,updated:!1,value:n}}}function ga(e){if(!(typeof window>`u`)){try{window.__SIGIL__?.registerSigilUrl?.(e)}catch{}try{window.dispatchEvent(new CustomEvent(`sigil:url-registered`,{detail:{url:e}}))}catch{}try{if(`BroadcastChannel`in window){let t=new BroadcastChannel(Bi);t.postMessage({type:`sigil:add`,url:e}),t.close()}}catch{}}}function _a(e){if(!(typeof window>`u`)){try{window.dispatchEvent(new CustomEvent(`sigil:feed-registered`,{detail:{url:e}}))}catch{}try{if(`BroadcastChannel`in window){let t=new BroadcastChannel(Hi);t.postMessage({type:`feed:add`,url:e}),t.close()}}catch{}}}function va(e){let t=0,n=e.toLowerCase();return br(e)&&(t+=5e6),(/[?&#]t=/.test(n)||n.includes(`/stream/t`))&&(t+=2e6),n.includes(`/stream/p/`)&&(t-=5e5),/[?&#]v=/.test(n)&&(t-=25e4),t+=pa(e),t}function ya(e,t){if(typeof window>`u`||window.localStorage===void 0)return;let n=ea(zi);if(!n.length)return;let r=[],i=null,a=-1/0;for(let t of n){let n=ta(t);if(!n)continue;if(sa(n)!==e){r.push(n);continue}let o=va(n);o>a&&(a=o,i=n)}if(t){let e=ta(t);if(e){let t=va(e);t>a&&(a=t,i=e)}}i&&r.push(i);let o=li(r);try{let e=window.localStorage.getItem(zi)??`[]`,t=JSON.stringify($i(JSON.parse(e))),n=JSON.stringify(o);t!==n&&window.localStorage.setItem(zi,n)}catch{}}function ba(){if(typeof window>`u`||Ki)return;Ki=!0;let e=e=>{let t=e.key??``;(t===Ri||t===zi||t===Vi)&&Yi()};try{window.addEventListener(`storage`,e)}catch{}try{`BroadcastChannel`in window&&(qi=new BroadcastChannel(Bi),qi.onmessage=e=>{let t=e.data,n=Y(t)&&typeof t.url==`string`?t.url:null;n&&(ha(Ri,n),Yi())},Ji=new BroadcastChannel(Hi),Ji.onmessage=e=>{let t=e.data,n=Y(t)&&typeof t.url==`string`?t.url:null;n&&(ha(zi,n),Yi())})}catch{}Yi()}function xa(e){return Y(e)&&typeof e.pulse==`number`&&Number.isFinite(e.pulse)?e.pulse:Y(e)&&Y(e.data)&&typeof e.data.pulse==`number`&&Number.isFinite(e.data.pulse)?e.data.pulse:0}function Sa(e){let t=Y(e)?e.appId:void 0;if(typeof t==`string`&&t.trim())return t;let n=Y(e)&&Y(e.data)?e.data.appId:void 0;if(typeof n==`string`&&n.trim())return n}function Ca(e){let t=Y(e)?e.userId:void 0;return t===void 0?Y(e)&&Y(e.data)?e.data.userId:void 0:t}function wa(e){let t=Z(e);if(t.startsWith(X)){let e=Pr(t);if(e){let n=t.startsWith(X)?t:`${X}${t}`;return{kind:`embedded`,rootRef:n,payload:e,openUrl:oi(n,[]).url}}}let n=ei(t);if(n){let e=Pr(n);if(e)return{kind:`embedded`,rootRef:n,payload:e,openUrl:oi(n,[]).url}}return{kind:`sigilUrl`,openUrl:Q(t)}}var Ta=({url:e,depth:t=0,seen:n=[],addChain:r,addIndex:i,threadMode:a=`thread`})=>{let[o,s]=(0,P.useState)(!1),[l,u]=(0,P.useState)(!1),[d,f]=(0,P.useState)(!1),p=(0,P.useSyncExternalStore)(yi,bi,xi),m=(0,P.useMemo)(()=>wa(e),[e]),h=(0,P.useMemo)(()=>Er(e),[e]),g=(0,P.useMemo)(()=>{if(m.kind===`embedded`){let e=m.payload,t=Dr(e);if(!t)return{ok:!1,openUrl:m.openUrl,error:`Invalid embedded payload (missing capsule).`};let n=xa(e),r=Sa(e),i=Ca(e);return{ok:!0,openUrl:m.openUrl,dataRaw:e,storePayload:e,pulse:n,appId:r,userId:i,capsule:t}}let t=h.decoded,n=Q(h.resolvedUrl||e);if(!t.ok)return{ok:!1,openUrl:n,error:(`error`in t?t.error:void 0)??`Decode failed.`};let r=t.data,i=Dr(r);if(!i)return{ok:!1,openUrl:n,error:`Decode ok, but capsule missing.`};let a=typeof t.data.pulse==`number`&&Number.isFinite(t.data.pulse)?t.data.pulse:xa(t.data),o=typeof t.data.appId==`string`&&t.data.appId?t.data.appId:Sa(t.data),s=t.data.userId??Ca(t.data);return{ok:!0,openUrl:n,dataRaw:r,storePayload:t.data,pulse:a,appId:o,userId:s,capsule:i}},[m,h.decoded,h.resolvedUrl,e]),_=g.ok,v=_?g:null,y=_?v.storePayload:null,b=_?v.capsule:null,x=(0,P.useMemo)(()=>ua(e,b),[e,b]),S=(0,P.useMemo)(()=>li(r?[...r]:$r(e)).slice(-Qr),[r,e]),C=(0,P.useMemo)(()=>typeof i==`number`&&Number.isFinite(i)?i:S.length-1,[i,S.length]),w=(0,P.useMemo)(()=>!S.length||C<0||C>=S.length?null:S[C]??null,[S,C]),T=(0,P.useMemo)(()=>_&&y?di(e,y):di(e),[_,y,e]),D=(0,P.useMemo)(()=>[...n,T],[n,T]),O=(0,P.useMemo)(()=>{if(t>=Qr)return null;let e=_?v.dataRaw??y:null,n=w??(e?ii(e):null);if(!n)return null;let r=di(n,(n.startsWith(X)?Pr(n):null)??void 0);return D.includes(r)?null:n},[w,t,D,_,v,y]),k=(0,P.useMemo)(()=>{if(!_||!y)return null;try{return Nr(y)}catch{return null}},[_,y]),A=(0,P.useMemo)(()=>S.length?li(S.slice(0,Math.max(0,C+1))).slice(-Qr):[],[S,C]);(0,P.useLayoutEffect)(()=>{if(!_)return;let e=k,t=Q(g.openUrl),n=null;if(O){let e=null;if(O.startsWith(X))e=Pr(O);else{let t=Er(O);t.decoded.ok&&(e=t.decoded.data)}n=di(O,e??void 0)}Si({key:T,prevKey:n,payloadRef:e??null,fallbackRef:t})},[_,g.openUrl,T,O,k]);let ee=(0,P.useSyncExternalStore)(Xi,Zi,Qi);(0,P.useEffect)(()=>{ba()},[]);let j=(0,P.useMemo)(()=>ia(ra(x??g.openUrl??e)),[x,g.openUrl,e]),M=(0,P.useMemo)(()=>{if(!_)return{origin:null,replies:[]};let t=ra(S.length>0?S[0]:x??e),n=ia(t),r=li([ra(e),ra(g.openUrl),...S.map(e=>ra(e)),...na()]).filter(Boolean),i=new Map,a=(e,t)=>{let n=0,r=e.toLowerCase();return t?br(e)?n+=260:n+=40:((/[?&#]t=/.test(r)||r.includes(`/stream/t`))&&(n+=240),r.includes(`/stream/p/`)&&(n-=25),/[?&#]v=/.test(r)&&(n-=20),br(e)&&(n-=40)),n+=Math.max(0,20-Math.floor(e.length/40)),n+=Math.min(2e5,pa(e)),n};for(let e of r){let t=ta(e);if(!t)continue;let r=ia(t);if(!r)continue;let o=li($r(t)),s=r===n;if(!s&&o.length>0){for(let e of o)if(ia(ra(e))===n){s=!0;break}}if(!s)continue;let c=Er(t),l=c.decoded.ok?xa(c.decoded.data):0,u=a(t,r===n),d=i.get(r);if(!d||u>d.score){let e=wr(t)??t;i.set(r,{url:e,score:u,pulse:l})}}let o=i.get(n)?.url??t,s={key:n,url:o,pulse:(()=>{let e=Er(o);return e.decoded.ok?xa(e.decoded.data):0})()},c=[];for(let[e,t]of i.entries())e!==n&&e!==j&&(br(t.url)||c.push({key:e,url:t.url,pulse:t.pulse}));return c.sort((e,t)=>(t.pulse??0)-(e.pulse??0)),{origin:s,replies:c}},[_,S,x,e,g.openUrl,j,ee]),te=(0,P.useCallback)(()=>{if(!_||!y)return{primary:{url:Q(g.openUrl),rootRef:``,adds:[],meta:{v:ur,id:`seg:none`,m:``,n:0,a:0,r:``}},archives:[]};let e=k??Nr(y),t=li(Ci(T,Qr)),n=li(A),r=ui(n),i=ui(t),a=r>i?n:rt.length?n:t.length>n.length?t:n,o=[];for(let e of a){let t=Z(e);if(!t)continue;if(t.startsWith(X)){o.push(t);continue}let n=Er(t),r=n.decoded.ok?n.decoded.data:null;if(r){let e=di(t,r),n=pi.get(e);if(n?.payloadRef){o.push(n.payloadRef);continue}try{o.push(Nr(r));continue}catch{}}o.push(Q(t))}return ci(e,li(o).slice(-Qr))},[_,y,g.openUrl,k,T,A]),N=(0,P.useMemo)(()=>te(),[te,p]),ne=N.primary.url,re=N.archives.length>0,ie=(0,P.useMemo)(()=>wr(e)??wr(g.openUrl),[e,g.openUrl]),ae=(0,P.useMemo)(()=>Pi(b,_?v.dataRaw:null),[b,_,v]),oe=!!O,se=(0,P.useMemo)(()=>{if(!_||!b)return!1;let e=b;return!!(e.post||e.message||e.share||e.reaction)},[_,b]),ce=(0,P.useMemo)(()=>{if(!_||!b)return!1;let e=b,t=Zr(v.dataRaw,``),n=(rr(e.source)?e.source:void 0)??Xr(v.dataRaw);return Di(t)||Di(n)||ki(e)},[_,b,v]),le=(0,P.useMemo)(()=>se||!!ae.post,[se,ae.post]),I=(0,P.useMemo)(()=>ce||le||oe,[ce,le,oe]),L=I;(0,P.useEffect)(()=>{if(typeof window>`u`||t!==0)return;ba();let n=wr(window.location.href)??ie??wr(g.openUrl)??ne??Q(e),r=li([n,...S.map(e=>ra(e)).filter(Boolean)]);for(let e of r){let t=ha(Ri,e);t.changed&&ga(t.value)}if(L){let e=_?v.dataRaw??y:void 0,t=da(n,e),r=ha(zi,t);r.changed&&_a(r.value),ya(sa(n,e),t)}Yi()},[t,e,g.openUrl,ie,ne,L,S,_,v,y]);let R=(0,P.useMemo)(()=>ie??ne,[ie,ne]),z=(0,P.useMemo)(()=>_?I?R:x??R:g.openUrl,[_,g.openUrl,I,R,x]),ue=(0,P.useMemo)(()=>z,[z]),B=(0,P.useCallback)(()=>{let e=te();return[e.primary.url,...e.archives.map(e=>e.url)].join(` `)},[te]),V=(0,P.useCallback)(()=>{Li(ue,()=>{s(!0),typeof window<`u`&&window.setTimeout(()=>s(!1),1100)},e=>{s(!1)})},[ue]),de=(0,P.useCallback)(()=>{Li(B(),()=>{u(!0),typeof window<`u`&&window.setTimeout(()=>u(!1),1100)},e=>{u(!1)})},[B]);if(!g.ok)return(0,F.jsxs)(`article`,{className:`fc fc--error`,role:`group`,"aria-label":`Invalid Sigil-Glyph`,children:[(0,F.jsx)(`div`,{className:`fc-crystal`,"aria-hidden":`true`}),(0,F.jsxs)(`div`,{className:`fc-shell`,children:[(0,F.jsx)(`header`,{className:`fc-head`,children:(0,F.jsxs)(`div`,{className:`fc-titleRow`,children:[(0,F.jsx)(`span`,{className:`fc-chip fc-chip--danger`,children:`INVALID`}),(0,F.jsx)(`span`,{className:`fc-muted`,children:`Sigil-Glyph capsule could not be resolved`})]})}),(0,F.jsx)(`div`,{className:`fc-error`,role:`alert`,children:g.error}),(0,F.jsxs)(`footer`,{className:`fc-actions`,role:`group`,"aria-label":`Actions`,children:[(0,F.jsx)(`a`,{className:`fc-btn`,href:z,target:`_blank`,rel:`noreferrer`,onClick:e=>e.stopPropagation(),title:`Open the best available href for this capsule`,children:`↗ Open`}),(0,F.jsx)(`button`,{className:`fc-btn`,type:`button`,onClick:V,"aria-pressed":o,"data-state":o?`remembered`:`idle`,title:`Copies the same href as Open for this block.`,children:o?`Remembered`:`Remember`})]})]})]});let H=v.capsule,fe=H.post,pe=H.message,U=H.share,W=H.reaction,G=fe??ae.post,me=typeof v.pulse==`number`&&Number.isFinite(v.pulse)?v.pulse:0,he=c(me),K=Math.max(0,Math.floor(he.beat)),ge=Math.max(0,Math.floor(he.stepIndex)),_e=Wr(he.chakraDay,he.chakraDay),ve=_e===`Crown`?`Krown`:String(_e),{day:ye,month:be,year:xe}=Ur(me),Se=G?`post`:pe?`message`:U?`share`:W?`reaction`:`sigil`,Ce=Zr(v.dataRaw,Se),we=String(Ce),Te=typeof v.appId==`string`&&v.appId?`app ${tr(v.appId,10,4)}`:void 0,Ee=v.userId!==void 0&&v.userId!==null?`user ${tr(String(v.userId),10,4)}`:void 0,De=rr(H.sigilId)?H.sigilId:void 0,Oe=rr(H.phiKey)?H.phiKey:void 0,ke=rr(H.kaiSignature),Ae=ke?`Signature present (Kai Signature)`:`Unsigned capsule`,je=rr(H.author)?H.author:void 0,Me=(rr(H.source)?H.source:void 0)??Xr(v.dataRaw),Ne=ir(I?Ti:Ei),Pe=I?Ti:Ei,Fe=Me?Di(Me)?ir(Ti):ir(Me):void 0,Ie=!!Fe&&Fe!==Ne,Le=Oi(G?.title),Re=Oi(G?.text),ze=Oi(pe?.text),Be=Oi(U?.note),Ve=qr(me,K,ge,ye,be,xe),He=Jr(ge),[Ue,We,Ge]=Yr[ve]??Yr.Crown??[238,241,251],Ke=(me%13+13)%13,qe={"--fc-accent-r":String(Ue),"--fc-accent-g":String(We),"--fc-accent-b":String(Ge),"--fc-pulse-dur":`5236ms`,"--fc-pulse-offset":`${-(Ke*120)}ms`,"--fc-thread-depth":String(t)},Je=I?`memory`:we,Ye=I?`↗ Proof of Memory™`:`↗ Proof of Breath™`,Xe=I?`Open ${Ti}`:`Open ${Ei}`,Ze=t===0&&a!==`self`,Qe=(Re??ze??Be??``)||``,$e=ae.bodyKind===`code`||ae.bodyKind===`html`?`code`:`text`,et=Qe?or(Qe,$e):null,tt=!!et?.shouldCollapse,nt=tt&&!d,rt=`fc-body-${Fr(T).slice(0,10)}`,it=e=>{e.preventDefault(),e.stopPropagation(),f(e=>!e)},at=e=>{if(!Ze&&!sr(e.target??null)){if(`key`in e){let t=e.key;if(t!==`Enter`&&t!==` `)return;e.preventDefault()}try{window.open(z,`_blank`,`noopener,noreferrer`)}catch{}}},ot=C-1;return(0,F.jsxs)(F.Fragment,{children:[a!==`self`&&O?(0,F.jsx)(Ta,{url:O,depth:t+1,seen:D,addChain:S,addIndex:ot,threadMode:a}):null,(0,F.jsxs)(`article`,{className:`fc fc--crystal ${ke?`fc--signed`:`fc--unsigned`} ${Ze?`fc--primary`:`fc--preview`}`,role:Ze?`article`:`link`,tabIndex:Ze?-1:0,onClick:at,onKeyDown:at,"aria-label":`${Pe} glyph`,"data-kind":Je,"data-chakra":ve,"data-signed":ke?`true`:`false`,"data-beat":Kr(K),"data-step":Kr(ge),"data-collapsed":nt?`true`:`false`,style:qe,children:[(0,F.jsx)(`div`,{className:`fc-crystal`,"aria-hidden":`true`}),(0,F.jsx)(`div`,{className:`fc-rim`,"aria-hidden":`true`}),(0,F.jsx)(`div`,{className:`fc-veil`,"aria-hidden":`true`}),(0,F.jsxs)(`div`,{className:`fc-shell`,children:[(0,F.jsx)(`aside`,{className:`fc-left`,"aria-label":I?Ti:Ei,children:(0,F.jsxs)(`div`,{className:`fc-sigilStage`,children:[(0,F.jsx)(`div`,{className:`fc-sigilGlass`,"aria-hidden":`true`}),(0,F.jsx)(`div`,{className:`fc-sigil`,"aria-label":I?Ti:Ei,children:(0,F.jsx)(E,{pulse:me,beat:K,stepPct:He,chakraDay:_e})}),(0,F.jsxs)(`div`,{className:`fc-stamp mono`,"aria-label":`Kai stamp`,children:[(0,F.jsx)(`span`,{className:`fc-stamp__pulse`,title:`Pulse`,children:me}),(0,F.jsx)(`span`,{className:`fc-stamp__sep`,children:`•`}),(0,F.jsx)(`span`,{className:`fc-stamp__bbss`,title:`Beat:Step (zero-based)`,children:Ve.label})]})]})}),(0,F.jsxs)(`section`,{className:`fc-right`,children:[(0,F.jsxs)(`header`,{className:`fc-head`,"aria-label":`Glyph metadata`,children:[(0,F.jsxs)(`div`,{className:`fc-metaRow`,children:[(0,F.jsx)(`span`,{className:`fc-chip fc-chip--kind`,title:I?`${Ti} • type: ${we}`:`${Ei} • type: ${we}`,children:Ne}),Te&&(0,F.jsx)(`span`,{className:`fc-chip`,children:Te}),Ee&&(0,F.jsx)(`span`,{className:`fc-chip`,children:Ee}),!I&&De?(0,F.jsxs)(`span`,{className:`fc-chip fc-chip--sigil`,title:`Sigil-Glyph: ${De}`,children:[`SIGIL-GLYPH `,tr(De,6,4)]}):null,Oe&&(0,F.jsxs)(`span`,{className:`fc-chip fc-chip--phikey`,title:`ΦKey: ${Oe}`,children:[`ΦKEY `,tr(Oe,6,4)]}),je&&(0,F.jsx)(`span`,{className:`fc-chip fc-chip--author`,title:`Author handle / origin`,children:je}),Ie&&Fe&&(0,F.jsx)(`span`,{className:`fc-chip fc-chip--source`,title:`Source`,children:Fe}),(0,F.jsx)(`span`,{className:`fc-chip fc-chip--chakra`,title:`Chakra day`,children:ve}),(0,F.jsx)(`span`,{className:`fc-sig ${ke?`fc-sig--ok`:`fc-sig--warn`}`,title:Ae,"aria-label":Ae,children:ke?`SIGNED`:`UNSIGNED`}),(()=>{let e=ti(ne);return e?(0,F.jsxs)(`span`,{className:`fc-chip`,title:`Merkle: ${e.m}`,children:[`SEG `,tr(e.id,10,6)]}):null})()]}),(0,F.jsxs)(`div`,{className:`fc-kaiRow`,"aria-label":`Kai meta`,children:[(0,F.jsx)(`span`,{className:`fc-kai mono`,title:`Kai meta line`,children:Ve.line}),(0,F.jsx)(`span`,{className:`fc-arc`,title:`Arc`,children:Ve.arc})]})]}),G&&(0,F.jsxs)(`section`,{className:`fc-bodywrap`,"aria-label":`Post body`,children:[rr(Le)&&(0,F.jsx)(`h3`,{className:`fc-title`,children:Le}),rr(Re)?(0,F.jsxs)(`div`,{className:`fc-collapse`,"data-open":d?`true`:`false`,children:[(0,F.jsx)(`div`,{id:rt,className:`fc-collapse__content`,style:{maxHeight:nt?`${et?.maxHeightPx??240}px`:`none`,overflow:nt?`hidden`:`visible`},children:ae.bodyKind===`code`||ae.bodyKind===`html`?(0,F.jsx)(`pre`,{className:`fc-body`,style:{whiteSpace:`pre-wrap`},children:Re}):(0,F.jsx)(`p`,{className:`fc-body`,children:Re})}),tt?(0,F.jsx)(`button`,{className:`fc-btn fc-btn--ghost fc-collapse__toggle`,type:`button`,onClick:it,"aria-expanded":d,"aria-controls":rt,"data-no-open":`true`,title:`Expand/collapse long content`,children:d?`Collapse`:`Expand${et?.lines?` • ${et.lines} lines`:``}`}):null]}):null,Array.isArray(G.tags)&&G.tags.length>0&&(0,F.jsx)(`div`,{className:`fc-tags`,"aria-label":`Tags`,children:G.tags.map(e=>(0,F.jsxs)(`span`,{className:`fc-tag`,children:[`#`,e]},e))}),Array.isArray(G.media)&&G.media.length>0&&(0,F.jsx)(`div`,{className:`fc-media`,"aria-label":`Attached media`,children:G.media.map(e=>{let t=`${e.kind}:${e.url}`,n=nr(e.url)??e.kind;return(0,F.jsx)(`a`,{className:`fc-btn fc-btn--ghost`,href:e.url,target:`_blank`,rel:`noreferrer`,title:e.url,onClick:e=>e.stopPropagation(),children:n},t)})})]}),pe&&(0,F.jsxs)(`section`,{className:`fc-bodywrap`,"aria-label":`Message body`,children:[(0,F.jsxs)(`h3`,{className:`fc-title`,children:[`Message → `,tr(String(pe.toUserId??`recipient`),10,4)]}),rr(ze)?(0,F.jsxs)(`div`,{className:`fc-collapse`,"data-open":d?`true`:`false`,children:[(0,F.jsx)(`div`,{id:`${rt}-m`,className:`fc-collapse__content`,style:{maxHeight:nt?`${et?.maxHeightPx??240}px`:`none`,overflow:nt?`hidden`:`visible`},children:(0,F.jsx)(`p`,{className:`fc-body`,children:ze})}),tt?(0,F.jsx)(`button`,{className:`fc-btn fc-btn--ghost fc-collapse__toggle`,type:`button`,onClick:it,"aria-expanded":d,"aria-controls":`${rt}-m`,"data-no-open":`true`,children:d?`Collapse`:`Expand`}):null]}):null]}),U&&(0,F.jsxs)(`section`,{className:`fc-bodywrap`,"aria-label":`Share body`,children:[(0,F.jsx)(`h3`,{className:`fc-title`,children:`Share`}),(0,F.jsx)(`a`,{className:`fc-link`,href:U.refUrl,target:`_blank`,rel:`noreferrer`,title:U.refUrl,onClick:e=>e.stopPropagation(),children:nr(U.refUrl)??U.refUrl}),rr(Be)?(0,F.jsxs)(`div`,{className:`fc-collapse`,"data-open":d?`true`:`false`,children:[(0,F.jsx)(`div`,{id:`${rt}-s`,className:`fc-collapse__content`,style:{maxHeight:nt?`${et?.maxHeightPx??240}px`:`none`,overflow:nt?`hidden`:`visible`},children:(0,F.jsx)(`p`,{className:`fc-body`,children:Be})}),tt?(0,F.jsx)(`button`,{className:`fc-btn fc-btn--ghost fc-collapse__toggle`,type:`button`,onClick:it,"aria-expanded":d,"aria-controls":`${rt}-s`,"data-no-open":`true`,children:d?`Collapse`:`Expand`}):null]}):null]}),W&&(0,F.jsxs)(`section`,{className:`fc-bodywrap`,"aria-label":`Reaction body`,children:[(0,F.jsx)(`h3`,{className:`fc-title`,children:`Reaction`}),(0,F.jsxs)(`div`,{className:`fc-body`,children:[rr(W.emoji)?W.emoji:`❤️`,typeof W.value==`number`?` × ${W.value}`:null]}),(0,F.jsx)(`a`,{className:`fc-link`,href:W.refUrl,target:`_blank`,rel:`noreferrer`,title:W.refUrl,onClick:e=>e.stopPropagation(),children:nr(W.refUrl)??W.refUrl})]}),!G&&!pe&&!U&&!W&&(0,F.jsx)(`section`,{className:`fc-bodywrap`,"aria-label":`Sigil body`,children:I&&re?(0,F.jsxs)(`div`,{className:`fc-muted`,style:{marginTop:8},children:[`Archive segments: `,N.archives.length,` (use `,(0,F.jsx)(`b`,{children:`Pack`}),` to copy them)`]}):null}),a!==`self`&&t===0?(0,F.jsxs)(`section`,{className:`fc-bodywrap`,"aria-label":`Thread`,children:[(0,F.jsx)(`h3`,{className:`fc-title`,children:`Thread`}),M.origin&&M.origin.key!==j?(0,F.jsxs)(`div`,{style:{marginTop:10},children:[(0,F.jsx)(`div`,{className:`fc-muted`,style:{marginBottom:10},children:`Origin`}),(0,F.jsx)(Ta,{url:M.origin.url,threadMode:`self`,depth:1,seen:[T]})]}):null,(0,F.jsxs)(`div`,{style:{marginTop:14},children:[(0,F.jsxs)(`div`,{className:`fc-muted`,style:{marginBottom:10},children:[`Replies (`,M.replies.length,`)`]}),M.replies.length?M.replies.map(e=>(0,F.jsx)(Ta,{url:e.url,threadMode:`self`,depth:1,seen:[T]},e.key)):(0,F.jsx)(`div`,{className:`fc-muted`,children:`No replies captured locally yet.`})]})]}):null,(0,F.jsxs)(`footer`,{className:`fc-actions`,role:`group`,"aria-label":`Actions`,children:[(0,F.jsx)(`a`,{className:`fc-btn`,href:z,target:`_blank`,rel:`noreferrer`,title:Xe,onClick:e=>e.stopPropagation(),children:Ye}),(0,F.jsx)(`button`,{className:`fc-btn`,type:`button`,onClick:e=>{e.stopPropagation(),V()},"aria-pressed":o,"data-state":o?`remembered`:`idle`,title:`Copies the same href as Open for this block. If overflow exists, use Pack.`,children:o?`Remembered`:`Remember`}),re?(0,F.jsx)(`button`,{className:`fc-btn`,type:`button`,onClick:e=>{e.stopPropagation(),de()},"aria-pressed":l,"data-state":l?`packed`:`idle`,title:`Copies the full segment pack (primary + archive segments) as newline-separated URLs.`,children:l?`Packed`:`Pack ${1+N.archives.length}`}):null,(0,F.jsx)(`span`,{className:`fc-live`,"aria-live":`polite`,children:o?`Inhaled to Memory`:l?`Packed to Memory`:``})]})]})]})]})]})},Ea=({url:e,threadMode:t=`thread`})=>{let n=(0,P.useMemo)(()=>ei(e),[e]),r=(0,P.useMemo)(()=>li($r(e)),[e]);return n?(0,F.jsx)(Ta,{url:n,threadMode:t,addChain:r,addIndex:r.length-1}):(0,F.jsx)(Ta,{url:e,threadMode:t})};function Da({urls:e}){return!e||e.length===0?(0,F.jsx)(`section`,{className:`sf-list`,children:(0,F.jsxs)(`div`,{className:`sf-empty`,children:[`No items yet. Paste a link above or open a `,(0,F.jsx)(`code`,{children:`/stream/p/`}),` link and reply to start a thread.`]})}):(0,F.jsx)(`section`,{className:`sf-list`,"aria-label":`Memory Stream`,children:e.map(e=>(0,F.jsx)(Ea,{url:e},e))})}function Oa(e){return V(e)&&e.kind===`url`&&typeof e.url==`string`&&(e.title===void 0||typeof e.title==`string`)}function ka(e){return V(e)&&e.kind===`file-inline`&&typeof e.data_b64url==`string`&&(e.name===void 0||typeof e.name==`string`)&&(e.type===void 0||typeof e.type==`string`)&&(e.size===void 0||typeof e.size==`number`)&&(e.sha256===void 0||typeof e.sha256==`string`)&&(e.thumbnail_b64===void 0||typeof e.thumbnail_b64==`string`)&&(e.relPath===void 0||typeof e.relPath==`string`)}function Aa(e){return V(e)&&e.kind===`file-ref`&&typeof e.sha256==`string`&&(e.name===void 0||typeof e.name==`string`)&&(e.type===void 0||typeof e.type==`string`)&&(e.size===void 0||typeof e.size==`number`)&&(e.url===void 0||typeof e.url==`string`)&&(e.relPath===void 0||typeof e.relPath==`string`)}function ja(e){return Oa(e)||ka(e)||Aa(e)}function Ma(e){return V(e)&&e.version===1&&typeof e.totalBytes==`number`&&typeof e.inlinedBytes==`number`&&Array.isArray(e.items)&&e.items.every(ja)}var Na=`Φ Memory added to PhiStream.`;function Pa(e){let t=(e||``).trim();return t?t.length<=140?t:`${t.slice(0,96)}:${t.slice(-32)}`:`root`}function Fa(e){return`sf.phistream.autoadd.notified:${Pa(e)}`}function Ia(){return typeof window<`u`&&typeof document<`u`}function La(e){let t=(e||``).trim();if(!t||!Ia())return null;try{if(t.startsWith(`/`)){let e=window.location?.origin??`https://kaiklok.com`,n=new URL(t,e);return n.protocol===`http:`||n.protocol===`https:`?n.toString():null}let e=new URL(t);return e.protocol===`http:`||e.protocol===`https:`?e.toString():null}catch{return null}}function Ra(){return W(localStorage.getItem(U))}function za(e){try{return Ra().includes(e)}catch{return!1}}function Ba(e){try{return sessionStorage.getItem(Fa(e))===`1`}catch{return!1}}function Va(e){try{sessionStorage.setItem(Fa(e),`1`)}catch{}}function Ha(e){let{token:t,payloadUrl:n,fallbackUrl:r,toast:i}=e;if(!Ia())return{ok:!1,added:!1,url:null,reason:`no_window`};let a=(n&&n.trim().length?n:r)??``;if(!a.trim())return{ok:!1,added:!1,url:null,reason:`no_url`};let o=La(a);if(!o)return{ok:!1,added:!1,url:null,reason:`invalid_url`};try{j(o)}catch{}let s=Ba(t);try{return za(o)?{ok:!0,added:!1,url:o,reason:`already_present`}:(G([o]),s?{ok:!0,added:!1,url:o,reason:`already_notified`}:(Va(t),i?.(`success`,Na),{ok:!0,added:!0,url:o,reason:`added`}))}catch{return{ok:!1,added:!1,url:null,reason:`storage_unavailable`}}}var Ua=17491.270421,Wa=36,Ga=44,Ka=Wa*Ga,qa=6,Ja=7,Ya=8,Xa=qa*Ja,Za=Xa*Ya;function Qa(e,t){let n=e%t;return n<0?n+t:n}function $a(e){return Number.isFinite(e)?e<0?0:e>1?1:e:0}function eo(e){return Number.isFinite(e)?e:0}function to(e){let t=eo(e);return Math.floor(t/Ua)}function no(e){let t=eo(e),n=(t-to(t)*Ua)%Ua,r=n<0?n+Ua:n;return r>=Ua?0:r}function ro(e){let t=$a(no(e)/Ua),n=Math.floor(t*Ka);return{beat:Math.floor(n/Ga),step:n%Ga}}function io(e){let t=to(e),n=Math.floor(t/Za),r=Qa(t,Za),i=Math.floor(r/Xa);return{d:r%Xa+1,m:i+1,y:n}}var ao=[`Solhara`,`Aquaris`,`Flamora`,`Verdari`,`Sonari`,`Kaelith`],oo=[`Root`,`Sacral`,`Solar`,`Heart`,`Throat`,`Third Eye`,`Crown`];function so(e){return ao[Qa(to(e),ao.length)]??`Kaelith`}function co(e){return oo[Qa(to(e),oo.length)]??`Crown`}var lo=[`Aethon`,`Virelai`,`Solari`,`Amarin`,`Kaelus`,`Umbriel`,`Noktura`,`Liora`];function uo(e){if(typeof window>`u`)return;let t=window.requestIdleCallback;if(typeof t==`function`){t(t=>{if(t.timeRemaining()<=0){e();return}e()});return}window.setTimeout(e,0)}function fo(e){let t=Qa(to(e),Za),n=Math.floor(t/Xa);return lo[n]??`Month ${n+1}`}function po(e){let t=e.trim();return t&&(/^caelith$/i.test(t)||/^kaelith$/i.test(t)?`Kaelith`:t.charAt(0).toUpperCase()+t.slice(1))}function mo(e){let t=e.trim();if(!t)return t;let n=t.toLowerCase();return n===`third-eye`||n===`third eye`||n===`ajna`?`Third Eye`:n===`solar plexus`||n===`solar-plexus`||n===`solar`?`Solar`:n===`root`?`Root`:n===`sacral`?`Sacral`:n===`heart`?`Heart`:n===`throat`?`Throat`:n===`crown`?`Krown`:t.charAt(0).toUpperCase()+t.slice(1)}function ho(e){let t=e.trim();return t&&(/^manual$/i.test(t)?`Proof of Memory™`:t.charAt(0).toUpperCase()+t.slice(1))}var go=Wa/6,_o=[`Ignite`,`Integrate`,`Harmonize`,`Reflekt`,`Purify`,`Dream`];function vo(e){let{beat:t}=ro(e),n=Math.floor(t/go);return n<0?0:n>=_o.length?_o.length-1:n}function yo(e){return _o[vo(e)]??`Dream`}function bo(e){let t=Number.isFinite(e)?Math.trunc(e):0;return String(t).padStart(2,`0`)}function xo(e){return e.length<=140?e:`${e.slice(0,96)}:${e.slice(-32)}`}function So(){let e=globalThis.location?.origin;return e&&typeof e==`string`&&e.length?e:`https://kaiklok.com`}function Co(e){let t=So().replace(/\/+$/,``);return e.length<=3500?`${t}/stream/p/${encodeURIComponent(e)}`:`${t}/stream#t=${e}`}function wo(e){return`${So().replace(/\/+$/,``)}/stream?p=${encodeURIComponent(e)}`}function To(e){return`${So().replace(/\/+$/,``)}/p~${e}`}function Eo(e){return e.length<=3500?To(e):wo(e)}function Do(e){let t=e.trim();try{let e=new URL(t),n=new URLSearchParams(e.hash.startsWith(`#`)?e.hash.slice(1):e.hash),r=new URLSearchParams(e.search),i=n.get(`t`)??n.get(`p`)??n.get(`token`)??r.get(`t`)??r.get(`p`)??r.get(`token`);i?t=i:/\/p~/.test(e.pathname)?t=e.pathname.split(`/p~`)[1]??t:/\/stream\/p\//.test(e.pathname)&&(t=e.pathname.split(`/stream/p/`)[1]??t)}catch{}if(/%[0-9A-Fa-f]{2}/.test(t))try{t=decodeURIComponent(t)}catch{}return t.includes(` `)&&(t=t.replaceAll(` `,`+`)),/[+/=]/.test(t)&&(t=t.replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/g,``)),t}function $(e){return/^[A-Za-z0-9_-]{16,}$/.test(e)}function Oo(e){let t=e.trim();try{return new URL(t)}catch{try{return new URL(t,So())}catch{return null}}}function ko(e){let t=e.trim();if(!t)return null;if($(t))return t;let n=Oo(t);if(!n)return null;let r=n.hash&&n.hash.startsWith(`#`)?n.hash.slice(1):``,i=new URLSearchParams(r),a=n.searchParams,o=i.get(`t`)??i.get(`p`)??i.get(`token`)??i.get(`capsule`)??a.get(`t`)??a.get(`p`)??a.get(`token`)??a.get(`capsule`);if(o&&o.trim().length)return o.trim();if(n.pathname.includes(`/p~`)){let e=n.pathname.indexOf(`/p~`),t=n.pathname.slice(e+3);if(t&&t.length)return t.startsWith(`/`)?t.slice(1):t}{let e=n.pathname.match(/\/stream\/p\/([^/?#]+)/);if(e?.[1])return e[1]}{let e=n.pathname.match(/\/p\/([^/?#]+)/);if(e?.[1])return e[1]}{let e=n.pathname.match(/\/s\/([^/?#]+)/);if(e?.[1])return e[1]}return null}function Ao(t){if(typeof window>`u`)return`/stream/p/${encodeURIComponent(t)}`;let n=new URLSearchParams(window.location.search),r=new URLSearchParams(window.location.hash.startsWith(`#`)?window.location.hash.slice(1):window.location.hash),i=[...n.getAll(`add`),...r.getAll(`add`)].map(ve).filter(e=>typeof e==`string`&&e.trim().length>0),a=[];for(let e of i){let t=jo(e);a.includes(t)||a.push(t)}let o=new URLSearchParams;for(let[e,t]of n.entries())e===`p`||e===`t`||e===`token`||e===`capsule`||e!==`add`&&o.append(e,t);for(let e of a)o.append(`add`,e);let s=new URLSearchParams;for(let[e,t]of r.entries())e===`p`||e===`t`||e===`token`||e===`capsule`||e!==`add`&&s.append(e,t);let c=t.length<=e,l=c?`/stream/p/${encodeURIComponent(t)}`:`/stream`,u=o.toString(),d=u.length?`?${u}`:``;if(c){let e=s.toString();return`${l}${d}${e.length?`#${e}`:``}`}let f=new URLSearchParams;f.set(`t`,t);for(let[e,t]of s.entries())f.append(e,t);return`${l}${d}#${f.toString()}`}function jo(e){let t=e.trim();if(!t)return t;let n=ko(t);if(!n){let e=Oo(t);return e?e.toString():t}return Co(Do(n))}function Mo(e,t){let n=new URL(e,So()),r=n.hash.startsWith(`#`)?n.hash.slice(1):n.hash,i=new URLSearchParams(r);i.delete(`add`);for(let e of t)i.append(`add`,e);n.search=``;let a=i.toString();return n.hash=a?`#${a}`:``,n.toString()}var No=`sf:memoryStream:v2`,Po=2e4,Fo=4096,Io=4096,Lo=2048;function Ro(){return{v:2,parentOf:{},childrenOf:{},pulseOf:{}}}function zo(){if(typeof window>`u`)return Ro();try{let e=window.localStorage.getItem(No);if(!e)return Ro();let t=JSON.parse(e);if(!V(t)||t.v!==2)return Ro();let n=V(t.parentOf)?t.parentOf:{},r=V(t.childrenOf)?t.childrenOf:{},i=V(t.pulseOf)?t.pulseOf:{},a=Ro();for(let[e,t]of Object.entries(n))typeof e==`string`&&typeof t==`string`&&$(e)&&$(t)&&(a.parentOf[e]=t);for(let[e,t]of Object.entries(r)){if(!$(e)||!Array.isArray(t))continue;let n=t.filter(e=>typeof e==`string`&&$(e));a.childrenOf[e]=Array.from(new Set(n)).slice(0,Fo)}for(let[e,t]of Object.entries(i))if($(e)){if(typeof t==`number`&&Number.isFinite(t))a.pulseOf[e]=t;else if(typeof t==`string`&&t.trim().length){let n=Number(t.trim());Number.isFinite(n)&&(a.pulseOf[e]=n)}}return a}catch{return Ro()}}function Bo(e){if(!(typeof window>`u`))try{window.localStorage.setItem(No,JSON.stringify(e))}catch(e){B(`ms2Save`,e)}}function Vo(e,t,n){let r=e.childrenOf[t]??[];if(r.includes(n))return!1;let i=[...r,n].slice(-Fo);return e.childrenOf[t]=i,!0}function Ho(e,t,n){return!$(t)||!$(n)||t===n||e.parentOf[t]===n?!1:(e.parentOf[t]=n,Vo(e,n,t),!0)}function Uo(e,t,n){return!$(t)||!Number.isFinite(n)||e.pulseOf[t]===n?!1:(e.pulseOf[t]=n,!0)}function Wo(e){let t=Oo(e);if(!t)return[];let n=t.hash&&t.hash.startsWith(`#`)?t.hash.slice(1):``,r=new URLSearchParams(n),i=[...t.searchParams.getAll(`add`),...r.getAll(`add`)];if(i.length===0)return[];let a=[];for(let e of i){let t=ve(e);if(!t||!t.trim().length)continue;let n=ko(t)??($(t)?t:null);if(!n)continue;let r=Do(n);$(r)&&(a.includes(r)||a.push(r))}return a}function Go(e,t){let n=ko(t);if(!n)return!1;let r=Do(n);if(!$(r))return!1;let i=Wo(t),a=i.length?i[i.length-1]:null,o=!1;if(a&&(o=Ho(e,r,a)||o),Object.keys(e.parentOf).length+Object.keys(e.childrenOf).length>Po){let t=Object.keys(e.childrenOf);for(let n=0;n{let r=e.pulseOf[t],i=e.pulseOf[n],a=typeof r==`number`&&Number.isFinite(r),o=typeof i==`number`&&Number.isFinite(i);return a&&o?r-i:a?-1:o?1:tn?1:0}),r}function Yo(e,t){let n=Co(t),r=qo(e,t);return r.length?Mo(n,r):n}function Xo(e){if(typeof document>`u`)return!1;try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,`true`),t.style.position=`fixed`,t.style.left=`-9999px`,t.style.top=`0`,document.body.appendChild(t);let n=document.activeElement instanceof HTMLElement?document.activeElement:null;t.focus(),t.select();let r=document.execCommand(`copy`);return document.body.removeChild(t),n&&n.focus(),r}catch{return!1}}function Zo(e){if(typeof window>`u`)return null;let t=window.navigator;return t!==void 0&&t.clipboard!==void 0&&typeof t.clipboard.writeText==`function`&&window.isSecureContext?t.clipboard.writeText(e):null}function Qo(e){return e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`"`,`"`).replaceAll(`'`,`'`)}function $o(e){try{let t=new DOMParser().parseFromString(e,`text/html`);return t.querySelectorAll(`script,style,iframe,object,embed`).forEach(e=>e.remove()),t.querySelectorAll(`*`).forEach(e=>{for(let t of Array.from(e.attributes)){let n=t.name.toLowerCase(),r=t.value;if(n.startsWith(`on`)){e.removeAttribute(t.name);continue}if(n===`href`||n===`src`){let n=r.trim().toLowerCase();(n.startsWith(`javascript:`)||n.startsWith(`data:`))&&e.removeAttribute(t.name)}}}),t.body.innerHTML}catch{return Qo(e)}}function es(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`?t.toString():null}catch{return null}}function ts(e){let t=Qo(e).replace(/```(\w+)?\n([\s\S]*?)```/g,(e,t,n)=>{let r=(t||``).trim();return`
${n}
`});return t=t.replace(/^####\s(.+)$/gm,`

$1

`),t=t.replace(/^###\s(.+)$/gm,`

$1

`),t=t.replace(/^##\s(.+)$/gm,`

$1

`),t=t.replace(/^#\s(.+)$/gm,`

$1

`),t=t.replace(/\*\*(.+?)\*\*/g,`$1`),t=t.replace(/\*(.+?)\*/g,`$1`),t=t.replace(/`([^`]+)`/g,`$1`),t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(e,t,n)=>{let r=es(n);return r?`${t}`:`${t} (${Qo(n)})`}),t=t.split(/\n{2,}/g).map(e=>{let t=e.trim();return t?t.startsWith(``)?t:`

${t.replace(/\n/g,`
`)}

`:``}).filter(Boolean).join(` `),t}function ns(e){let t=0,n=0;for(let r of e){if(r.kind===`file-inline`){typeof r.size==`number`&&Number.isFinite(r.size)&&r.size>=0&&(t+=r.size,n+=r.size);continue}if(r.kind===`file-ref`){typeof r.size==`number`&&Number.isFinite(r.size)&&r.size>=0&&(t+=r.size);continue}}return{total:t,inlined:n}}function rs(e){if(Ma(e))return e;if(!V(e))return null;let t=e.version,n=e.items;if(t!==1||!Array.isArray(n))return null;let r=n.filter(ja),i=ns(r);return{version:1,totalBytes:typeof e.totalBytes==`number`&&Number.isFinite(e.totalBytes)?e.totalBytes:i.total,inlinedBytes:typeof e.inlinedBytes==`number`&&Number.isFinite(e.inlinedBytes)?e.inlinedBytes:i.inlined,items:r}}function is({body:e,caption:t,isSealed:n}){let r=e??(!n&&t&&t.trim().length?{kind:`text`,text:t}:null);return r?r.kind===`text`?(0,F.jsxs)(`div`,{className:`sf-text`,children:[`— `,`"${r.text}"`]}):r.kind===`code`?(0,F.jsx)(`pre`,{className:`sf-code`,children:(0,F.jsx)(`code`,{children:r.code})}):r.kind===`md`?(0,F.jsx)(`div`,{className:`sf-md`,dangerouslySetInnerHTML:{__html:ts(r.md)}}):(r.mode??`code`)===`code`?(0,F.jsx)(`pre`,{className:`sf-code sf-code--html`,children:(0,F.jsx)(`code`,{children:r.html})}):(0,F.jsx)(`div`,{className:`sf-html`,dangerouslySetInnerHTML:{__html:$o(r.html)}}):(0,F.jsx)(F.Fragment,{})}function as(e,t){if(!e||typeof e!=`object`)return null;let n=e;for(let e of t){let t=n[e];if(typeof t==`string`&&t.trim().length)return t.trim()}return null}function os(e,t){if(!e||typeof e!=`object`)return null;let n=e[t];if(typeof n==`number`&&Number.isFinite(n))return n;if(typeof n==`string`&&n.trim().length){let e=Number(n.trim());return Number.isFinite(e)?e:null}return null}function ss(e){return Math.max(0,Math.min(255,Math.round(e)))}function cs(e){if(!V(e))return!1;let t=e.body,n=e.attachments,r=e.caption,i=t===void 0||V(t),a=r===void 0||typeof r==`string`,o=n===void 0||V(n)||Array.isArray(n);return i&&a&&o}function ls(e){return typeof e==`function`}function us(e){return V(e)&&e.ok===!0&&`inner`in e}function ds(e){let t=V(e)?e.seal:void 0;return t?as(t,[`teaser`,`preview`,`hint`,`caption`])??null:null}async function fs(e){let n=await t(()=>import(`./postSeal-D7PFnOMd.js`),__vite__mapDeps([0,1])),r=V(n)?n:{},i=r.openSealedEnvelope??r.openSealedPayload??r.unsealEnvelope??r.unsealPayload??r.unsealEnvelopeV1??null;if(!ls(i))throw Error(`postSeal module is missing an unseal function.`);if(((V(r)&&Object.entries(r).find(([,e])=>e===i)?.[0])??`unseal`)===`unsealEnvelopeV1`){let t=typeof e.meta==`object`&&e.meta!==null?H(e.meta,`kaiSignature`):void 0,n=typeof e.meta==`object`&&e.meta!==null?H(e.meta,`userPhiKey`):void 0;if(!t)throw Error(`Missing kaiSignature in meta (cannot unlock sealed envelope).`);let r=await Promise.resolve(i(e.seal,{kaiSignature:t,phiKey:n}));if(us(r)){let e=r.inner;if(!V(e))throw Error(`Unseal returned non-object inner payload.`);let t=e.body,n=e.attachments,i=e.caption,a={};return t!==void 0&&V(t)&&(a.body=t),n!==void 0&&(a.attachments=n),typeof i==`string`&&(a.caption=i),a}if(cs(r))return r;throw Error(`Unseal returned an unexpected shape.`)}let a=await Promise.resolve(i(e.seal,{meta:e.meta,svgText:e.svgText??void 0}));if(!cs(a))throw Error(`Unseal returned an unexpected shape.`);return a}function ps(e){let{token:t,payload:n,manifest:r,copied:i,onKopy:a,isSealed:o,unsealState:s,canUnseal:c,verifiedThisSession:l,hasComposerMeta:u,onVerifiedNow:d,onResetVerified:f,onUnseal:p,onForgetUnsealed:m,body:h,caption:g}=e,_=(0,P.useRef)(null),v=(0,P.useCallback)(()=>{let e=_.current;if(!e)return;try{e.scrollIntoView({behavior:`smooth`,block:`center`})}catch{}let t=e.querySelector(`input[type="file"]`);if(t){t.click();return}e.querySelector(`button`)?.click()},[]),y=s.status===`opening`?`UNSEALING…`:c?`UNSEAL`:l?u?`UNSEAL`:`RE-INHALE`:`🔐 Sealed`,b=(0,P.useCallback)(()=>{if(!c){v();return}p()},[c,p,v]),x=eo(n.pulse),{beat:S,step:C}=ro(x),{d:w,m:T,y:E}=io(x),D=fo(x),O=po(so(x)),k=yo(x),A=as(n,[`userPhiKey`,`phiKey`,`phikey`,`authorPhiKey`])??as(n.meta,[`userPhiKey`,`phiKey`,`phikey`])??``,M=ho(as(n,[`mode`,`source`,`origin`,`transport`])??as(n.meta,[`mode`,`source`,`origin`])??`Manual`);(0,P.useEffect)(()=>{try{j(Eo(t))}catch(e){B(`register share url (PayloadCard)`,e)}if(typeof n.url==`string`&&n.url.length)try{j(n.url)}catch(e){B(`register payload.url (PayloadCard)`,e)}},[t,n.url]);let te=o&&s.status!==`open`,N=(0,P.useMemo)(()=>o?ds(n):null,[o,n]),ne=o?(0,F.jsx)(`span`,{className:`sf-pill sf-pill--sealed`,title:`Private (Sealed)`,children:`🔒 SEALED`}):null;return(0,F.jsxs)(`section`,{className:`sf-payload`,role:`region`,"aria-label":`Loaded payload`,children:[(0,F.jsxs)(`div`,{className:`sf-payload-line sf-tags`,children:[(0,F.jsx)(`span`,{className:`sf-pill sf-pill--mode`,children:M||`Proof of Memory™`}),ne,A?(0,F.jsxs)(`span`,{className:`sf-pill sf-pill--phikey`,title:A,children:[`ΦKey `,(0,F.jsx)(`span`,{className:`sf-key`,children:A})]}):null]}),(0,F.jsxs)(`div`,{className:`sf-payload-core`,children:[(0,F.jsxs)(`span`,{children:[`☤Kai: `,x]}),(0,F.jsx)(`span`,{className:`sf-muted`,children:` · `}),(0,F.jsxs)(`span`,{className:`sf-kai-label`,children:[bo(S),`:`,bo(C),` — D`,w,`/M`,T,`/Y`,E,` · `,k]}),(0,F.jsx)(`span`,{className:`sf-muted`,children:` · `}),(0,F.jsxs)(`span`,{className:`sf-kai-label`,children:[O,` · `,D]})]}),o?(0,F.jsx)(`div`,{className:`sf-seal`,role:`group`,"aria-label":`Private sealed content`,children:s.status===`open`?(0,F.jsxs)(`div`,{className:`sf-seal__row`,children:[(0,F.jsx)(`span`,{className:`sf-seal__label`,children:`Unsealed`}),(0,F.jsx)(`button`,{type:`button`,className:`sf-seal__btn`,onClick:m,"aria-label":`Seal view`,children:`SEAL`})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`sf-seal__row`,children:[(0,F.jsx)(`span`,{className:`sf-seal__label`,children:`Private`}),(0,F.jsx)(`button`,{type:`button`,className:`sf-seal__btn`,onClick:b,disabled:s.status===`opening`,"aria-label":`Unseal private content`,children:y})]}),N?(0,F.jsx)(`div`,{className:`sf-seal__hint`,role:`note`,children:N}):null,(0,F.jsxs)(`div`,{ref:_,className:`sf-seal__gate`,role:`region`,"aria-label":`Unlock gate`,children:[l?u?c?null:(0,F.jsx)(`div`,{className:`sf-seal__hint`,role:`note`,children:`Inhale your ΦKey to unseal.`}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`sf-seal__hint`,role:`note`,children:`Verified session detected, but no sigil metadata is present. Re-inhale your glyph.`}),(0,F.jsx)(`div`,{className:`sf-seal__login`,"aria-label":`Glyph re-upload`,children:(0,F.jsx)(ee,{onVerified:d})}),(0,F.jsx)(`div`,{className:`sf-seal__row`,children:(0,F.jsx)(`button`,{type:`button`,className:`sf-seal__btn`,onClick:f,"aria-label":`Use a different key`,children:`USE DIFFERENT ΦKEY`})})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`sf-seal__hint`,role:`note`,children:`Inhale your ΦKey, then unseal.`}),(0,F.jsx)(`div`,{className:`sf-seal__login`,"aria-label":`Glyph upload`,children:(0,F.jsx)(ee,{onVerified:d})})]}),s.status===`error`?(0,F.jsx)(`div`,{className:`sf-seal__hint`,role:`note`,children:s.message}):null]})]})}):null,te?null:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(is,{body:h,caption:g,isSealed:!1}),r?(0,F.jsx)(kt,{manifest:r}):null]}),(0,F.jsx)(`div`,{className:`sf-reply-actions`,children:(0,F.jsx)(`button`,{type:`button`,className:`sf-kopyBtn`,onClick:a,disabled:i,"data-state":i?`copied`:`idle`,"aria-label":`Remember share link`,children:i?`REMEMBERED`:`REMEMBER`})})]})}function ms(){return(0,F.jsx)(I,{children:(0,F.jsx)(M,{children:(0,F.jsx)(hs,{})})})}function hs(){let e=ce(),t=O(),n=i(),r=oe(e=>{e.preventDefault(),n(`/keystream`)}),[a,o]=(0,P.useState)([]),c=(0,P.useRef)(new Set),l=(0,P.useRef)(zo()),u=(0,P.useRef)(new Set),[d,f]=(0,P.useState)(0),p=(0,P.useRef)(!1),m=(0,P.useCallback)((e,t)=>{uo(()=>{let t=l.current,n=!1;for(let r of e)!r||!r.trim().length||(n=Go(t,r)||n);n&&(Bo(t),f(e=>e+1))})},[]),h=(0,P.useCallback)(e=>{if(!p.current){p.current=!0;try{let t=new Set,n=e=>{if(!e)return;let n=Do(e);$(n)&&t.add(n)},r=l.current;for(let e of Object.keys(r.parentOf))n(e);for(let e of Object.keys(r.childrenOf)){n(e);for(let t of r.childrenOf[e]??[])n(t)}for(let e of Object.keys(r.pulseOf))n(e);for(let t of e){n(ko(t));for(let e of Wo(t))n(e)}let i=0;for(let e of t){if(i>=Lo)break;i+=1;let t=s(e);if(!t)continue;let n=t.usernameClaim;if(!n)continue;let r=te(n.hash??``),a=n.payload;if(!r||!a||a.kind!==`username_claim`)continue;let o=re(a.normalized||a.username||``),c=re(t.author??``),l=o||c;if(!l)continue;let u=n.url?.trim()||Co(e);if(!u)continue;let d=n.ownerHint??a.ownerHint??null;ne({hash:r,url:u,payload:{...a,normalized:o||l},ownerHint:d})}}catch(e){B(`rehydrate username claims`,e)}}},[]);(0,P.useEffect)(()=>{if(typeof window>`u`)return;let e=e=>{o(t=>{let n=new Set(t.map(({url:e})=>e)),r=[...t],i=[];for(let{url:t}of e){let e=t.trim();!e||n.has(e)||(n.add(e),r.push({url:e}),i.push(e))}if(i.length>0){for(let e of i)j(e);m(i),h(i)}return r})};uo(()=>{let t=W(localStorage.getItem(U));t.length&&e(t.map(e=>({url:e})))});let t=!1;return uo(()=>{(async()=>{try{let n=await pe();!t&&n.length&&e(n)}catch(e){B(`initial seed load`,e)}})().catch(e=>B(`initial seed load outer`,e))}),()=>{t=!0}},[m,h]),(0,P.useEffect)(()=>{if(!(typeof window>`u`))try{let e=new URLSearchParams(window.location.search),t=new URLSearchParams(window.location.hash.startsWith(`#`)?window.location.hash.slice(1):window.location.hash),n=[...e.getAll(`add`),...t.getAll(`add`)].map(ve).filter(e=>typeof e==`string`&&e.trim().length>0).map(jo);if(n.length===0)return;m([window.location.href,...n]),o(e=>{let t=new Set(e.map(e=>e.url)),r=n.filter(e=>!t.has(e));if(r.length){G(r);for(let e of r)j(e);return[...r.map(e=>({url:e})),...e]}return e})}catch(e){B(`add ingestion (location)`,e)}},[t.pathname,t.search,t.hash,m]),(0,P.useEffect)(()=>{typeof window>`u`||uo(()=>{let e=c.current,t=[],n=e=>{e.trim().length&&(t.includes(e)||t.push(e))};for(let t of a){let r=t.url;if(!r||e.has(r))continue;e.add(r);let i=Oo(r);if(!i)continue;let a=i.hash&&i.hash.startsWith(`#`)?i.hash.slice(1):``,o=new URLSearchParams(a),s=[...i.searchParams.getAll(`add`),...o.getAll(`add`)];if(s.length===0)continue;let c=s.map(ve).filter(e=>typeof e==`string`&&e.trim().length>0).map(jo);for(let e of c)n(e)}t.length!==0&&(m(t),o(e=>{let n=new Set(e.map(e=>e.url)),r=t.filter(e=>!n.has(e));if(!r.length)return e;try{G(r)}catch(e){B(`prependUniqueToStorage (infinite replies)`,e)}for(let e of r)try{j(e)}catch(e){B(`registerSigilUrl (infinite replies)`,e)}return[...r.map(e=>({url:e})),...e]}))})},[a,m]),(0,P.useEffect)(()=>{typeof window>`u`||uo(()=>{let e=u.current,t=[];for(let n of a){let r=n.url;if(!(!r||e.has(r))&&(e.add(r),t.push(r),t.length>=256))break}t.length&&m(t)})},[a,m]);let[g,_]=(0,P.useState)(null),[v,b]=(0,P.useState)(null),[x,S]=(0,P.useState)(null),C=(0,P.useRef)(null),[w,E]=(0,P.useState)({status:`none`});(0,P.useEffect)(()=>{if(!v){E({status:`none`});return}E(V(v)&&v.seal!==void 0?{status:`sealed`}:{status:`none`})},[v]);let D=(0,P.useCallback)(async()=>{if(typeof window>`u`)return;let t=y(),n=t?Do(t):null;if(n)try{let e=Ao(n);e!==`${window.location.pathname}${window.location.search}${window.location.hash}`&&window.history.replaceState(null,``,e)}catch(e){B(`canonicalizeLocationRel`,e)}if(_(n),!n){b(null),S(null),C.current=null;return}try{let e=Co(n),t=Eo(n);j(e),t!==e&&j(t)}catch(e){B(`register current stream url (pre-decode)`,e)}try{let e=Co(n);o(t=>{if(new Set(t.map(e=>e.url)).has(e))return t;try{G([e])}catch(e){B(`prependUniqueToStorage (visited stream)`,e)}try{j(e)}catch(e){B(`registerSigilUrl (visited stream)`,e)}return[{url:e},...t]}),m([window.location.href,e])}catch(e){B(`ms2 ingest visited stream`,e)}try{let r=await s(n)||(t&&t!==n?await s(t):null);if(!r){b(null),S(`Invalid or unreadable payload token.`);return}let i=r.usernameClaim,a=i?re(i.payload?.normalized||i.payload?.username||``):``,c=re(r.author??``),u=a||c;if(i){let e=te(i.hash??``),t=i.url?.trim()||Co(n);if(!e||!t){b(null),S(`Username claim missing glyph reference.`);return}if(!u){b(null),S(`Username claim missing normalized username.`);return}let r=ae()[u];if(r&&r.claimHash!==e){b(null),S(`Username claimed by another glyph.`);return}let a=i.payload;if(!a||a.kind!==`username_claim`){b(null),S(`Invalid username-claim payload.`);return}let o=re(a.normalized||a.username||``)||u;if(o!==u){b(null),S(`Username claim does not match author.`);return}let s=ne({hash:e,url:t,payload:{...a,normalized:o},ownerHint:i.ownerHint??a.ownerHint??null});if(!s.accepted){b(null),S(`Username claim rejected: ${s.reason??`unknown`}.`);return}}else if(u&&ae()[u]){b(null),S(`Claim glyph is required for this username.`);return}b(r),S(null);try{let e=l.current;Uo(e,n,eo(r.pulse))&&(Bo(e),f(e=>e+1))}catch(e){B(`ms2SetPulse`,e)}if(r.url&&typeof r.url==`string`&&r.url.length){if(C.current!==n){C.current=n;try{G([r.url])}catch(e){B(`prependUniqueToStorage (payload url)`,e)}let t=Ha({token:n,payloadUrl:r.url,toast:(t,n)=>e.push(t,n)});o(e=>new Set(e.map(e=>e.url)).has(r.url)?e:[{url:r.url},...e]),t.ok||B(`phistream auto-add`,t.reason)}else o(e=>new Set(e.map(e=>e.url)).has(r.url)?e:[{url:r.url},...e]);try{j(r.url)}catch(e){B(`register payload.url (post-decode)`,e)}}try{j(To(n))}catch(e){B(`register short alias url`,e)}}catch(e){B(`payload decode`,e),b(null),S(`Payload decode failed.`)}},[e,m]);(0,P.useEffect)(()=>{D()},[t.pathname,t.search,t.hash,D]);let k=(0,P.useMemo)(()=>{if(!v)return{weekday:void 0,chakra:void 0};let e=eo(v.pulse);return{weekday:po(so(e)),chakra:mo(co(e))}},[v]),M=(0,P.useMemo)(()=>`sf.verifiedSession:${xo(g??(typeof window<`u`?y():null)??`root`)}`,[g]),[N,ie]=(0,P.useState)(()=>{try{if(typeof window>`u`)return!1;let e=`sf.verifiedSession:${xo(y()||`root`)}`;return sessionStorage.getItem(e)===`1`}catch(e){return B(`sessionStorage.getItem (init)`,e),!1}});(0,P.useEffect)(()=>{try{if(typeof window>`u`)return;ie(sessionStorage.getItem(M)===`1`)}catch(e){B(`sessionStorage.getItem (sync)`,e),ie(!1)}},[M]);let se=()=>{ie(!0);try{sessionStorage.setItem(M,`1`)}catch(e){B(`sessionStorage.setItem`,e)}e.push(`success`,`ΦKey inhaled.`)},le=()=>{ie(!1);try{sessionStorage.removeItem(M)}catch(e){B(`sessionStorage.removeItem`,e)}},I=A(),L=(0,P.useMemo)(()=>fe(I),[I]),R=(0,P.useMemo)(()=>N?L.meta:null,[N,L.meta]),z=(0,P.useMemo)(()=>N?L.svgText:null,[N,L.svgText]),ue=(0,P.useMemo)(()=>R?H(R,`userPhiKey`):void 0,[R]),de=(0,P.useMemo)(()=>R?H(R,`kaiSignature`):void 0,[R]),me=(0,P.useMemo)(()=>{let e=os(R,`sigil_r`)??os(R,`sigilR`)??os(R,`tintR`)??null,t=os(R,`sigil_g`)??os(R,`sigilG`)??os(R,`tintG`)??null,n=os(R,`sigil_b`)??os(R,`sigilB`)??os(R,`tintB`)??null;if(e===null||t===null||n===null)return{};let r={};return r[`--sigil-r`]=String(ss(e)),r[`--sigil-g`]=String(ss(t)),r[`--sigil-b`]=String(ss(n)),r},[R]),he=e=>{o(t=>new Set(t.map(e=>e.url)).has(e)?t:(G([e]),j(e),m([e]),[{url:e},...t]))},K=(0,P.useMemo)(()=>v?V(v)&&v.seal!==void 0:!1,[v]),ge=(0,P.useMemo)(()=>!!(K&&N&&R),[K,N,R]),_e=(0,P.useCallback)(()=>{v&&(E(K?{status:`sealed`}:{status:`none`}),e.push(`success`,`Sealed`))},[v,K,e]),ye=(0,P.useCallback)(async()=>{if(!v)return;let t=v.seal;if(!t){E({status:`error`,message:`No seal present on this payload.`});return}if(!N||!R){E({status:`error`,message:`Inhale your ΦKey to unseal.`});return}E({status:`opening`});try{E({status:`open`,content:await fs({seal:t,meta:R,svgText:z??null})}),e.push(`success`,`Unsealed`)}catch(t){B(`unseal`,t),E({status:`error`,message:`Unseal failed. Wrong key, wrong seal, or missing postSeal implementation.`}),e.push(`warn`,`Unseal failed.`)}},[v,N,R,z,e]),be=(0,P.useMemo)(()=>K&&w.status!==`open`,[K,w.status]),xe=(0,P.useMemo)(()=>w.status===`open`?w.content.body:v?.body,[v,w]),Se=(0,P.useMemo)(()=>w.status===`open`?w.content.caption??v?.caption:v?.caption,[v,w]),Ce=(0,P.useMemo)(()=>w.status===`open`?w.content.attachments??v?.attachments:v?.attachments,[v,w]),we=(0,P.useMemo)(()=>Ce?rs(Ce):null,[Ce]),[Te,Ee]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>()=>{De.current!==null&&window.clearTimeout(De.current)},[]);let Oe=(0,P.useCallback)(()=>{let t=g??(typeof window<`u`?y():null),n=t?Do(t):null;if(!n)return;let r=Co(n),i=typeof window<`u`?Wo(window.location.href):[],a=i.length?Mo(r,i):r;if(Xo(a)){Ee(!0),De.current!==null&&window.clearTimeout(De.current),De.current=window.setTimeout(()=>Ee(!1),1200),e.push(`success`,`Remembered`);return}let o=Zo(a);if(o){Ee(!0),De.current!==null&&window.clearTimeout(De.current),De.current=window.setTimeout(()=>Ee(!1),1200),e.push(`success`,`Remembered`),o.catch(t=>{B(`kopy clipboard.writeText`,t),Ee(!1),e.push(`warn`,`Remember failed. Select the address bar.`)});return}e.push(`warn`,`Remember failed. Select the address bar.`)},[g,e]),ke=(0,P.useMemo)(()=>{if(!g)return[];let e=l.current;return Jo(e,g).map(t=>Yo(e,t))},[g,d]);(0,P.useEffect)(()=>{g&&ke.length!==0&&o(e=>{let t=new Set(e.map(e=>e.url)),n=ke.filter(e=>!t.has(e));if(!n.length)return e;try{G(n)}catch(e){B(`prependUniqueToStorage (thread hydrate)`,e)}for(let e of n)try{j(e)}catch(e){B(`registerSigilUrl (thread hydrate)`,e)}return[...n.map(e=>({url:e})),...e]})},[g,ke]);let Ae=(0,P.useMemo)(()=>{let e=a.map(e=>e.url);if(!g||ke.length===0)return e;let t=new Set,n=[];for(let e of ke)t.has(e)||(t.add(e),n.push(e));for(let r of e)t.has(r)||(t.add(r),n.push(r));return n},[a,g,ke]),Me=N&&(R||z)?Ue({meta:R,svgText:z||``}):null;return(0,F.jsxs)(`main`,{className:`sf`,"data-weekday":k.weekday,"data-chakra":k.chakra,style:me,children:[(0,F.jsxs)(`header`,{className:`sf-head`,role:`region`,"aria-labelledby":`glyph-stream-title`,children:[(0,F.jsx)(`nav`,{className:`sf-topnav`,"aria-label":`Back navigation`,children:(0,F.jsx)(T,{className:`sf-back`,to:`/keystream`,...r,children:`← Back to Keystream`})}),(0,F.jsx)(`h1`,{id:`glyph-stream-title`,children:`Memory Stream`}),(0,F.jsx)(On,{}),v&&g?(0,F.jsx)(ps,{token:g,payload:v,manifest:we,copied:Te,onKopy:Oe,isSealed:K,unsealState:w,canUnseal:ge,verifiedThisSession:N,hasComposerMeta:!!R,onVerifiedNow:se,onResetVerified:le,onUnseal:ye,onForgetUnsealed:_e,body:xe,caption:Se}):x?(0,F.jsx)(`div`,{className:`sf-error`,role:`alert`,children:x}):(0,F.jsxs)(`p`,{className:`sf-sub`,children:[`Open a payload link at `,(0,F.jsx)(`code`,{children:`/stream/p/`}),` (or `,(0,F.jsx)(`code`,{children:`/stream#t=`}),`). Replies are Kai-sealed and thread via `,(0,F.jsx)(`code`,{children:`#add=`}),`. Short alias accepted: `,(0,F.jsx)(`code`,{children:`/p~`}),` `,`(and legacy `,(0,F.jsx)(`code`,{children:`/p#t=`}),`, `,(0,F.jsx)(`code`,{children:`/p?t=`}),`, `,(0,F.jsx)(`code`,{children:`/stream?p=`}),`).`]}),!v&&(0,F.jsx)(`section`,{className:`sf-inhaler`,"aria-labelledby":`inhaler-title`,children:(0,F.jsx)(Ge,{onAdd:he})}),(0,F.jsx)(je,{phiKey:ue,kaiSignature:de}),Me?.node?(0,F.jsx)(`section`,{className:`sf-sigilWrap`,"aria-label":`Sigil stage`,children:(0,F.jsx)(`div`,{className:`sf-sigilWrap__inner`,children:Me.node})}):null,v&&!be?(0,F.jsxs)(`section`,{className:`sf-reply`,"aria-labelledby":`reply-title`,children:[(0,F.jsx)(`h2`,{id:`reply-title`,className:`sf-reply-title`,children:`Reply`}),N?R?(0,F.jsx)(Qt,{meta:R,svgText:z,onUseDifferentKey:le}):(0,F.jsx)(`div`,{className:`sf-error`,role:`alert`,children:`Verified, but no sigil metadata found. Re-inhale your glyph.`}):(0,F.jsxs)(`div`,{className:`sf-reply-login`,children:[(0,F.jsx)(`p`,{className:`sf-sub`,children:`Inhale ΦKey to resonate a reply.`}),(0,F.jsx)(ee,{onVerified:se})]})]}):null]}),(0,F.jsx)(`section`,{className:`sf-list`,children:Ae.length===0?(0,F.jsxs)(`div`,{className:`sf-empty`,children:[`No items yet. Paste a link above or open a `,(0,F.jsx)(`code`,{children:`/stream/p/`}),` link and reply to start a thread.`]}):(0,F.jsx)(Da,{urls:Ae})})]})}var gs=ms;export{gs as n,ms as t}; \ No newline at end of file diff --git a/dist/assets/VerifierFrame-CwEJNPi9.js b/dist/assets/VerifierFrame-Dr7oGdbu.js similarity index 99% rename from dist/assets/VerifierFrame-CwEJNPi9.js rename to dist/assets/VerifierFrame-Dr7oGdbu.js index 3bed1065..bedbefc2 100644 --- a/dist/assets/VerifierFrame-CwEJNPi9.js +++ b/dist/assets/VerifierFrame-Dr7oGdbu.js @@ -1 +1 @@ -import{En as e,Tn as t,jn as n,pn as r,tn as i}from"./index-BGzUQCv_.js";import{t as a}from"./prop-types-CQvzhoSE.js";function o(e){return e.replace(/^\/+|\/+$/g,``)}function s(){try{return`/`}catch{}return`/`}function c(){if(typeof window>`u`)return`/verify`;let e=window.location.origin,t=o(s());return`${e}${t.length>0?`/${t}`:``}/verify`}function l(e){let t=typeof e==`string`?e.trim():``,n=t.length>0?t:`unknown-signature`;return n.length>10?n.slice(0,10):n}function u(e,t){return`${e}-${l(t)}`}function d(e,t,n){return`${(n??c()).replace(/\/+$/,``)}/${encodeURIComponent(u(e,t))}`}var f={root:`Root`,sacral:`Sacral`,solar:`Solar Plexus`,solarp:`Solar Plexus`,solarplexus:`Solar Plexus`,heart:`Heart`,throat:`Throat`,thirdeye:`Third Eye`,crown:`Crown`,krown:`Crown`};function p(e){if(typeof e!=`string`)return;let t=e.trim();if(t)return f[t.toLowerCase().replace(/[\s_-]/g,``)]}function m(e){let t=``;for(let n of e)t+=n.toString(16).padStart(2,`0`);return t}async function h(e){if(typeof crypto>`u`||!crypto.subtle)throw Error(`crypto.subtle unavailable; cannot compute proofHash.`);let t=new TextEncoder().encode(e),n=await crypto.subtle.digest(`SHA-256`,t);return m(new Uint8Array(n))}function g(e){return JSON.stringify({v:e.v,pulse:e.pulse,chakraDay:e.chakraDay,kaiSignature:e.kaiSignature,phiKey:e.phiKey,verifierSlug:e.verifierSlug})}async function _(e){return await h(g(e))}var v=e(((e,t)=>{t.exports={L:1,M:0,Q:3,H:2}})),y=e(((e,t)=>{t.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}})),b=e(((e,t)=>{var n=y();function r(e){this.mode=n.MODE_8BIT_BYTE,this.data=e}r.prototype={getLength:function(e){return this.data.length},write:function(e){for(var t=0;t{var n=v();function r(e,t){this.totalCount=e,this.dataCount=t}r.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],r.getRSBlocks=function(e,t){var n=r.getRsBlockTable(e,t);if(n==null)throw Error(`bad rs block @ typeNumber:`+e+`/errorCorrectLevel:`+t);for(var i=n.length/3,a=[],o=0;o{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){var t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(var n=0;n>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),C=e(((e,t)=>{for(var n={glog:function(e){if(e<1)throw Error(`glog(`+e+`)`);return n.LOG_TABLE[e]},gexp:function(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return n.EXP_TABLE[e]},EXP_TABLE:Array(256),LOG_TABLE:Array(256)},r=0;r<8;r++)n.EXP_TABLE[r]=1<{var n=C();function r(e,t){if(e.length==null)throw Error(e.length+`/`+t);for(var n=0;n{var n=y(),r=w(),i=C(),a={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},o={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(e){for(var t=e<<10;o.getBCHDigit(t)-o.getBCHDigit(o.G15)>=0;)t^=o.G15<=0;)t^=o.G18<>>=1;return t},getPatternPosition:function(e){return o.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,n){switch(e){case a.PATTERN000:return(t+n)%2==0;case a.PATTERN001:return t%2==0;case a.PATTERN010:return n%3==0;case a.PATTERN011:return(t+n)%3==0;case a.PATTERN100:return(Math.floor(t/2)+Math.floor(n/3))%2==0;case a.PATTERN101:return t*n%2+t*n%3==0;case a.PATTERN110:return(t*n%2+t*n%3)%2==0;case a.PATTERN111:return(t*n%3+(t+n)%2)%2==0;default:throw Error(`bad maskPattern:`+e)}},getErrorCorrectPolynomial:function(e){for(var t=new r([1],0),n=0;n5&&(n+=3+a-5)}for(var r=0;r{var n=b(),r=x(),i=S(),a=T(),o=w();function s(e,t){this.typeNumber=e,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var c=s.prototype;c.addData=function(e){var t=new n(e);this.dataList.push(t),this.dataCache=null},c.isDark=function(e,t){if(e<0||this.moduleCount<=e||t<0||this.moduleCount<=t)throw Error(e+`,`+t);return this.modules[e][t]},c.getModuleCount=function(){return this.moduleCount},c.make=function(){if(this.typeNumber<1){var e=1;for(e=1;e<40;e++){for(var t=r.getRSBlocks(e,this.errorCorrectLevel),n=new i,o=0,s=0;s=7&&this.setupTypeNumber(e),this.dataCache??=s.createData(this.typeNumber,this.errorCorrectLevel,this.dataList),this.mapData(this.dataCache,t)},c.setupPositionProbePattern=function(e,t){for(var n=-1;n<=7;n++)if(!(e+n<=-1||this.moduleCount<=e+n))for(var r=-1;r<=7;r++)t+r<=-1||this.moduleCount<=t+r||(0<=n&&n<=6&&(r==0||r==6)||0<=r&&r<=6&&(n==0||n==6)||2<=n&&n<=4&&2<=r&&r<=4?this.modules[e+n][t+r]=!0:this.modules[e+n][t+r]=!1)},c.getBestMaskPattern=function(){for(var e=0,t=0,n=0;n<8;n++){this.makeImpl(!0,n);var r=a.getLostPoint(this);(n==0||e>r)&&(e=r,t=n)}return t},c.createMovieClip=function(e,t,n){var r=e.createEmptyMovieClip(t,n),i=1;this.make();for(var a=0;a>n&1)==1;this.modules[Math.floor(n/3)][n%3+this.moduleCount-8-3]=r}for(var n=0;n<18;n++){var r=!e&&(t>>n&1)==1;this.modules[n%3+this.moduleCount-8-3][Math.floor(n/3)]=r}},c.setupTypeInfo=function(e,t){for(var n=this.errorCorrectLevel<<3|t,r=a.getBCHTypeInfo(n),i=0;i<15;i++){var o=!e&&(r>>i&1)==1;i<6?this.modules[i][8]=o:i<8?this.modules[i+1][8]=o:this.modules[this.moduleCount-15+i][8]=o}for(var i=0;i<15;i++){var o=!e&&(r>>i&1)==1;i<8?this.modules[8][this.moduleCount-i-1]=o:i<9?this.modules[8][15-i-1+1]=o:this.modules[8][15-i-1]=o}this.modules[this.moduleCount-8][8]=!e},c.mapData=function(e,t){for(var n=-1,r=this.moduleCount-1,i=7,o=0,s=this.moduleCount-1;s>0;s-=2)for(s==6&&s--;;){for(var c=0;c<2;c++)if(this.modules[r][s-c]==null){var l=!1;o>>i&1)==1),a.getMask(t,r,s-c)&&(l=!l),this.modules[r][s-c]=l,i--,i==-1&&(o++,i=7)}if(r+=n,r<0||this.moduleCount<=r){r-=n,n=-n;break}}},s.PAD0=236,s.PAD1=17,s.createData=function(e,t,n){for(var o=r.getRSBlocks(e,t),c=new i,l=0;ld*8)throw Error(`code length overflow. (`+c.getLengthInBits()+`>`+d*8+`)`);for(c.getLengthInBits()+4<=d*8&&c.put(0,4);c.getLengthInBits()%8!=0;)c.putBit(!1);for(;!(c.getLengthInBits()>=d*8||(c.put(s.PAD0,8),c.getLengthInBits()>=d*8));)c.put(s.PAD1,8);return s.createBytes(c,o)},s.createBytes=function(e,t){for(var n=0,r=0,i=0,s=Array(t.length),c=Array(t.length),l=0;l=0?m.get(h):0}}for(var g=0,f=0;f{Object.defineProperty(e,`__esModule`,{value:!0});var n=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}var l={bgColor:r.default.oneOfType([r.default.object,r.default.string]).isRequired,bgD:r.default.string.isRequired,fgColor:r.default.oneOfType([r.default.object,r.default.string]).isRequired,fgD:r.default.string.isRequired,size:r.default.number.isRequired,title:r.default.string,viewBoxSize:r.default.number.isRequired,xmlns:r.default.string},u=(0,i.forwardRef)(function(e,t){var r=e.bgColor,i=e.bgD,a=e.fgD,s=e.fgColor,l=e.size,u=e.title,d=e.viewBoxSize,f=e.xmlns,p=f===void 0?`http://www.w3.org/2000/svg`:f,m=c(e,[`bgColor`,`bgD`,`fgD`,`fgColor`,`size`,`title`,`viewBoxSize`,`xmlns`]);return o.default.createElement(`svg`,n({},m,{height:l,ref:t,viewBox:`0 0 `+d+` `+d,width:l,xmlns:p}),u?o.default.createElement(`title`,null,u):null,o.default.createElement(`path`,{d:i,fill:r}),o.default.createElement(`path`,{d:a,fill:s}))});u.displayName=`QRCodeSvg`,u.propTypes=l,e.default=u})),O=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.QRCode=void 0;var n=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}var f={bgColor:r.default.oneOfType([r.default.object,r.default.string]),fgColor:r.default.oneOfType([r.default.object,r.default.string]),level:r.default.string,size:r.default.number,value:r.default.string.isRequired},p=(0,s.forwardRef)(function(e,t){var r=e.bgColor,a=r===void 0?`#FFFFFF`:r,s=e.fgColor,u=s===void 0?`#000000`:s,f=e.level,p=f===void 0?`L`:f,m=e.size,h=m===void 0?256:m,g=e.value,_=d(e,[`bgColor`,`fgColor`,`level`,`size`,`value`]),v=new o.default(-1,i.default[p]);v.addData(g),v.make();var y=v.modules;return c.default.createElement(l.default,n({},_,{bgColor:a,bgD:y.map(function(e,t){return e.map(function(e,n){return e?``:`M `+n+` `+t+` l 1 0 0 1 -1 0 Z`}).join(` `)}).join(` `),fgColor:u,fgD:y.map(function(e,t){return e.map(function(e,n){return e?`M `+n+` `+t+` l 1 0 0 1 -1 0 Z`:``}).join(` `)}).join(` `),ref:t,size:h,viewBoxSize:y.length}))});e.QRCode=p,p.displayName=`QRCode`,p.propTypes=f,e.default=p})),k=n(t(),1),A=n(O(),1),j=n(i(),1);function M(e){return typeof e==`object`&&!!e}function N(e){return typeof e==`function`}function P(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`bigint`){let t=BigInt(2**53-1),n=BigInt(-(2**53-1));return e>t||e0?n:null}function I(e){if(M(e)){let t=e.default;if(N(t))return t;let n=e.QRCode;if(N(n))return n}return N(e)?e:function({value:e}){return(0,j.jsx)(`div`,{className:`kv-verifier__qr-fallback`,"aria-label":`QR unavailable`,children:e})}}var L=I(A);function R(e,t=6,n=6){return e?e.length<=t+n+3?e:`${e.slice(0,t)}…${e.slice(-n)}`:``}function z(e,t=10,n=10){return e?e.length<=t+n+3?e:`${e.slice(0,t)}…${e.slice(-n)}`:``}function B(){let e=r;for(let t of[`kaiPulseNow`,`getKaiPulseNow`,`pulseNow`]){let n=e[t];if(N(n)){let e=F(P(n()));if(e)return e}}let t=e.kairosEpochNow,n=P(e.GENESIS_TS),i=P(e.PULSE_MS);if(N(t)&&n!==null&&i!==null&&Number.isFinite(i)&&i>0){let e=P(t());if(e!==null){let t=e-n;if(Number.isFinite(t)){let e=Math.floor(t/i)+1;return e>0?e:null}}}return null}function V(){let e=r,t=e.kairosEpochNow,n=P(e.GENESIS_TS),i=P(e.PULSE_MS);if(!N(t)||n===null||i===null||!(i>0))return null;let a=P(t());if(a===null)return null;let o=a-n;if(!Number.isFinite(o))return null;let s=n+(Math.max(0,Math.floor(o/i))+1)*i-a,c=Math.ceil(Math.max(25,Math.min(6e4,s)));return Number.isFinite(c)?c:null}function H(e){let[t,n]=(0,k.useState)(()=>B()??0);return(0,k.useEffect)(()=>{if(!e)return;let t=!1,r=null,i=()=>{if(t)return;let e=B();e&&e>0&&n(e);let a=V()??1e3;r=window.setTimeout(i,a)};return i(),()=>{t=!0,r!==null&&window.clearTimeout(r)}},[e]),t}function U({pulse:e,kaiSignature:t,phiKey:n,caption:r,chakraDay:i,compact:a=!1,verifierBaseUrl:o}){let[s,f]=(0,k.useState)(`idle`),[m,h]=(0,k.useState)(`idle`),[g,v]=(0,k.useState)(null),y=F(e),b=H(y===null),x=y??b,S=(0,k.useMemo)(()=>{let e=o??c(),r=String(e).replace(/\/+$/,``)||`/verify`,a=typeof t==`string`?t.trim():``,s=l(a),f=Number.isFinite(x)&&x>0?Math.floor(x):0,m=u(f,a),h=d(f,a,r),g=p(typeof i==`string`?i:String(i??``)),_=typeof n==`string`?n.trim():``;return{verifierUrl:h,verifierBaseUrl:r,verifierSlug:m,pulse:f,chakraDay:g,kaiSignature:a,kaiSignatureShort:s,phiKey:_,proofCapsule:f>0&&a.length>0&&_.length>0&&g?{v:`KPV-1`,pulse:f,chakraDay:g,kaiSignature:a,phiKey:_,verifierSlug:m}:null,proofHash:void 0}},[i,t,n,x,o]);(0,k.useEffect)(()=>{let e=!1;return(async()=>{if(!S.proofCapsule){v(null);return}try{let t=await _(S.proofCapsule);e||v(t)}catch{e||v(null)}})(),()=>{e=!0}},[S.proofCapsule]);let C=a?96:160,w=async()=>{if(typeof navigator>`u`||!navigator.clipboard){f(`error`);return}try{await navigator.clipboard.writeText(S.verifierUrl),f(`ok`),window.setTimeout(()=>f(`idle`),2e3)}catch{f(`error`)}},T=async()=>{if(typeof navigator>`u`||!navigator.clipboard){h(`error`);return}try{let e=g??void 0;!e&&S.proofCapsule&&(e=await _(S.proofCapsule),v(e));let t={...S,proofHash:e};await navigator.clipboard.writeText(JSON.stringify(t,null,2)),h(`ok`),window.setTimeout(()=>h(`idle`),2e3)}catch{h(`error`)}},E=a?`kv-verifier kv-verifier--compact`:`kv-verifier`,D=Number.isFinite(S.pulse)&&S.pulse>0?String(S.pulse):`—`,O=typeof r==`string`?r.trim():``,A=R(S.phiKey),M=g?z(g):`—`;return(0,j.jsxs)(`section`,{className:E,"aria-label":`Kai-Sigil verification frame`,"data-role":`verifier-frame`,children:[(0,j.jsx)(`div`,{className:`kv-verifier__qr-shell`,role:`img`,"aria-label":`QR code linking to Kai-Sigil verifier for pulse ${D} and signature ${S.kaiSignatureShort}`,children:(0,j.jsx)(`div`,{className:`kv-verifier__qr-inner`,children:(0,j.jsx)(L,{value:S.verifierUrl,size:C,bgColor:`#00000000`,fgColor:`#ffffff`})})}),(0,j.jsxs)(`div`,{className:`kv-verifier__content`,children:[(0,j.jsxs)(`header`,{className:`kv-verifier__header`,children:[(0,j.jsx)(`h3`,{className:`kv-verifier__title`,children:`Kai-Sigil Verifier`}),(0,j.jsx)(`p`,{className:`kv-verifier__subtitle`,children:`Scan or open the verifier link to confirm this post was sealed by this Φ-Key (KPV-1 payload-bound proof).`})]}),(0,j.jsxs)(`dl`,{className:`kv-verifier__meta`,children:[(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`🌀 Pulse`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value`,children:D})]}),(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`Kai Signature`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value kv-verifier__mono`,children:S.kaiSignatureShort})]}),(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`Φ-Key`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value kv-verifier__mono`,title:S.phiKey,children:A||`—`})]}),S.chakraDay?(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`🧬 Chakra Day`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value`,children:S.chakraDay})]}):null,(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`🔒 Proof Hash`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value kv-verifier__mono`,title:g??``,children:M})]})]}),O.length>0?(0,j.jsxs)(`p`,{className:`kv-verifier__caption`,"aria-label":`Post caption`,children:[`“`,O,`”`]}):null,(0,j.jsxs)(`div`,{className:`kv-verifier__actions`,children:[(0,j.jsx)(`a`,{href:S.verifierUrl,target:`_blank`,rel:`noopener noreferrer`,className:`kv-verifier__btn kv-verifier__btn--primary`,"data-role":`verifier-open-link`,children:`Open Verifier`}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>void w(),className:`kv-verifier__btn kv-verifier__btn--ghost`,"data-role":`verifier-copy-link`,children:s===`ok`?`Remembered!`:s===`error`?`Remember failed`:`Remember Link`}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>void T(),className:`kv-verifier__btn kv-verifier__btn--ghost`,"data-role":`verifier-copy-proof`,children:m===`ok`?`Proof Remembered!`:m===`error`?`Remember failed`:`Remember Proof`})]}),(0,j.jsxs)(`p`,{className:`kv-verifier__url`,"aria-label":`Verifier URL`,children:[(0,j.jsx)(`span`,{className:`kv-verifier__url-label`,children:`Verifier URL:`}),(0,j.jsx)(`span`,{className:`kv-verifier__url-value`,children:S.verifierUrl})]})]})]})}export{p as a,_ as i,u as n,d as r,U as t}; \ No newline at end of file +import{En as e,Tn as t,jn as n,pn as r,tn as i}from"./index-CcPm2yTY.js";import{t as a}from"./prop-types-CQ3MXKCa.js";function o(e){return e.replace(/^\/+|\/+$/g,``)}function s(){try{return`/`}catch{}return`/`}function c(){if(typeof window>`u`)return`/verify`;let e=window.location.origin,t=o(s());return`${e}${t.length>0?`/${t}`:``}/verify`}function l(e){let t=typeof e==`string`?e.trim():``,n=t.length>0?t:`unknown-signature`;return n.length>10?n.slice(0,10):n}function u(e,t){return`${e}-${l(t)}`}function d(e,t,n){return`${(n??c()).replace(/\/+$/,``)}/${encodeURIComponent(u(e,t))}`}var f={root:`Root`,sacral:`Sacral`,solar:`Solar Plexus`,solarp:`Solar Plexus`,solarplexus:`Solar Plexus`,heart:`Heart`,throat:`Throat`,thirdeye:`Third Eye`,crown:`Crown`,krown:`Crown`};function p(e){if(typeof e!=`string`)return;let t=e.trim();if(t)return f[t.toLowerCase().replace(/[\s_-]/g,``)]}function m(e){let t=``;for(let n of e)t+=n.toString(16).padStart(2,`0`);return t}async function h(e){if(typeof crypto>`u`||!crypto.subtle)throw Error(`crypto.subtle unavailable; cannot compute proofHash.`);let t=new TextEncoder().encode(e),n=await crypto.subtle.digest(`SHA-256`,t);return m(new Uint8Array(n))}function g(e){return JSON.stringify({v:e.v,pulse:e.pulse,chakraDay:e.chakraDay,kaiSignature:e.kaiSignature,phiKey:e.phiKey,verifierSlug:e.verifierSlug})}async function _(e){return await h(g(e))}var v=e(((e,t)=>{t.exports={L:1,M:0,Q:3,H:2}})),y=e(((e,t)=>{t.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}})),b=e(((e,t)=>{var n=y();function r(e){this.mode=n.MODE_8BIT_BYTE,this.data=e}r.prototype={getLength:function(e){return this.data.length},write:function(e){for(var t=0;t{var n=v();function r(e,t){this.totalCount=e,this.dataCount=t}r.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],r.getRSBlocks=function(e,t){var n=r.getRsBlockTable(e,t);if(n==null)throw Error(`bad rs block @ typeNumber:`+e+`/errorCorrectLevel:`+t);for(var i=n.length/3,a=[],o=0;o{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){var t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(var n=0;n>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),C=e(((e,t)=>{for(var n={glog:function(e){if(e<1)throw Error(`glog(`+e+`)`);return n.LOG_TABLE[e]},gexp:function(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return n.EXP_TABLE[e]},EXP_TABLE:Array(256),LOG_TABLE:Array(256)},r=0;r<8;r++)n.EXP_TABLE[r]=1<{var n=C();function r(e,t){if(e.length==null)throw Error(e.length+`/`+t);for(var n=0;n{var n=y(),r=w(),i=C(),a={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},o={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(e){for(var t=e<<10;o.getBCHDigit(t)-o.getBCHDigit(o.G15)>=0;)t^=o.G15<=0;)t^=o.G18<>>=1;return t},getPatternPosition:function(e){return o.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,n){switch(e){case a.PATTERN000:return(t+n)%2==0;case a.PATTERN001:return t%2==0;case a.PATTERN010:return n%3==0;case a.PATTERN011:return(t+n)%3==0;case a.PATTERN100:return(Math.floor(t/2)+Math.floor(n/3))%2==0;case a.PATTERN101:return t*n%2+t*n%3==0;case a.PATTERN110:return(t*n%2+t*n%3)%2==0;case a.PATTERN111:return(t*n%3+(t+n)%2)%2==0;default:throw Error(`bad maskPattern:`+e)}},getErrorCorrectPolynomial:function(e){for(var t=new r([1],0),n=0;n5&&(n+=3+a-5)}for(var r=0;r{var n=b(),r=x(),i=S(),a=T(),o=w();function s(e,t){this.typeNumber=e,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var c=s.prototype;c.addData=function(e){var t=new n(e);this.dataList.push(t),this.dataCache=null},c.isDark=function(e,t){if(e<0||this.moduleCount<=e||t<0||this.moduleCount<=t)throw Error(e+`,`+t);return this.modules[e][t]},c.getModuleCount=function(){return this.moduleCount},c.make=function(){if(this.typeNumber<1){var e=1;for(e=1;e<40;e++){for(var t=r.getRSBlocks(e,this.errorCorrectLevel),n=new i,o=0,s=0;s=7&&this.setupTypeNumber(e),this.dataCache??=s.createData(this.typeNumber,this.errorCorrectLevel,this.dataList),this.mapData(this.dataCache,t)},c.setupPositionProbePattern=function(e,t){for(var n=-1;n<=7;n++)if(!(e+n<=-1||this.moduleCount<=e+n))for(var r=-1;r<=7;r++)t+r<=-1||this.moduleCount<=t+r||(0<=n&&n<=6&&(r==0||r==6)||0<=r&&r<=6&&(n==0||n==6)||2<=n&&n<=4&&2<=r&&r<=4?this.modules[e+n][t+r]=!0:this.modules[e+n][t+r]=!1)},c.getBestMaskPattern=function(){for(var e=0,t=0,n=0;n<8;n++){this.makeImpl(!0,n);var r=a.getLostPoint(this);(n==0||e>r)&&(e=r,t=n)}return t},c.createMovieClip=function(e,t,n){var r=e.createEmptyMovieClip(t,n),i=1;this.make();for(var a=0;a>n&1)==1;this.modules[Math.floor(n/3)][n%3+this.moduleCount-8-3]=r}for(var n=0;n<18;n++){var r=!e&&(t>>n&1)==1;this.modules[n%3+this.moduleCount-8-3][Math.floor(n/3)]=r}},c.setupTypeInfo=function(e,t){for(var n=this.errorCorrectLevel<<3|t,r=a.getBCHTypeInfo(n),i=0;i<15;i++){var o=!e&&(r>>i&1)==1;i<6?this.modules[i][8]=o:i<8?this.modules[i+1][8]=o:this.modules[this.moduleCount-15+i][8]=o}for(var i=0;i<15;i++){var o=!e&&(r>>i&1)==1;i<8?this.modules[8][this.moduleCount-i-1]=o:i<9?this.modules[8][15-i-1+1]=o:this.modules[8][15-i-1]=o}this.modules[this.moduleCount-8][8]=!e},c.mapData=function(e,t){for(var n=-1,r=this.moduleCount-1,i=7,o=0,s=this.moduleCount-1;s>0;s-=2)for(s==6&&s--;;){for(var c=0;c<2;c++)if(this.modules[r][s-c]==null){var l=!1;o>>i&1)==1),a.getMask(t,r,s-c)&&(l=!l),this.modules[r][s-c]=l,i--,i==-1&&(o++,i=7)}if(r+=n,r<0||this.moduleCount<=r){r-=n,n=-n;break}}},s.PAD0=236,s.PAD1=17,s.createData=function(e,t,n){for(var o=r.getRSBlocks(e,t),c=new i,l=0;ld*8)throw Error(`code length overflow. (`+c.getLengthInBits()+`>`+d*8+`)`);for(c.getLengthInBits()+4<=d*8&&c.put(0,4);c.getLengthInBits()%8!=0;)c.putBit(!1);for(;!(c.getLengthInBits()>=d*8||(c.put(s.PAD0,8),c.getLengthInBits()>=d*8));)c.put(s.PAD1,8);return s.createBytes(c,o)},s.createBytes=function(e,t){for(var n=0,r=0,i=0,s=Array(t.length),c=Array(t.length),l=0;l=0?m.get(h):0}}for(var g=0,f=0;f{Object.defineProperty(e,`__esModule`,{value:!0});var n=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}var l={bgColor:r.default.oneOfType([r.default.object,r.default.string]).isRequired,bgD:r.default.string.isRequired,fgColor:r.default.oneOfType([r.default.object,r.default.string]).isRequired,fgD:r.default.string.isRequired,size:r.default.number.isRequired,title:r.default.string,viewBoxSize:r.default.number.isRequired,xmlns:r.default.string},u=(0,i.forwardRef)(function(e,t){var r=e.bgColor,i=e.bgD,a=e.fgD,s=e.fgColor,l=e.size,u=e.title,d=e.viewBoxSize,f=e.xmlns,p=f===void 0?`http://www.w3.org/2000/svg`:f,m=c(e,[`bgColor`,`bgD`,`fgD`,`fgColor`,`size`,`title`,`viewBoxSize`,`xmlns`]);return o.default.createElement(`svg`,n({},m,{height:l,ref:t,viewBox:`0 0 `+d+` `+d,width:l,xmlns:p}),u?o.default.createElement(`title`,null,u):null,o.default.createElement(`path`,{d:i,fill:r}),o.default.createElement(`path`,{d:a,fill:s}))});u.displayName=`QRCodeSvg`,u.propTypes=l,e.default=u})),O=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.QRCode=void 0;var n=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}var f={bgColor:r.default.oneOfType([r.default.object,r.default.string]),fgColor:r.default.oneOfType([r.default.object,r.default.string]),level:r.default.string,size:r.default.number,value:r.default.string.isRequired},p=(0,s.forwardRef)(function(e,t){var r=e.bgColor,a=r===void 0?`#FFFFFF`:r,s=e.fgColor,u=s===void 0?`#000000`:s,f=e.level,p=f===void 0?`L`:f,m=e.size,h=m===void 0?256:m,g=e.value,_=d(e,[`bgColor`,`fgColor`,`level`,`size`,`value`]),v=new o.default(-1,i.default[p]);v.addData(g),v.make();var y=v.modules;return c.default.createElement(l.default,n({},_,{bgColor:a,bgD:y.map(function(e,t){return e.map(function(e,n){return e?``:`M `+n+` `+t+` l 1 0 0 1 -1 0 Z`}).join(` `)}).join(` `),fgColor:u,fgD:y.map(function(e,t){return e.map(function(e,n){return e?`M `+n+` `+t+` l 1 0 0 1 -1 0 Z`:``}).join(` `)}).join(` `),ref:t,size:h,viewBoxSize:y.length}))});e.QRCode=p,p.displayName=`QRCode`,p.propTypes=f,e.default=p})),k=n(t(),1),A=n(O(),1),j=n(i(),1);function M(e){return typeof e==`object`&&!!e}function N(e){return typeof e==`function`}function P(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`bigint`){let t=BigInt(2**53-1),n=BigInt(-(2**53-1));return e>t||e0?n:null}function I(e){if(M(e)){let t=e.default;if(N(t))return t;let n=e.QRCode;if(N(n))return n}return N(e)?e:function({value:e}){return(0,j.jsx)(`div`,{className:`kv-verifier__qr-fallback`,"aria-label":`QR unavailable`,children:e})}}var L=I(A);function R(e,t=6,n=6){return e?e.length<=t+n+3?e:`${e.slice(0,t)}…${e.slice(-n)}`:``}function z(e,t=10,n=10){return e?e.length<=t+n+3?e:`${e.slice(0,t)}…${e.slice(-n)}`:``}function B(){let e=r;for(let t of[`kaiPulseNow`,`getKaiPulseNow`,`pulseNow`]){let n=e[t];if(N(n)){let e=F(P(n()));if(e)return e}}let t=e.kairosEpochNow,n=P(e.GENESIS_TS),i=P(e.PULSE_MS);if(N(t)&&n!==null&&i!==null&&Number.isFinite(i)&&i>0){let e=P(t());if(e!==null){let t=e-n;if(Number.isFinite(t)){let e=Math.floor(t/i)+1;return e>0?e:null}}}return null}function V(){let e=r,t=e.kairosEpochNow,n=P(e.GENESIS_TS),i=P(e.PULSE_MS);if(!N(t)||n===null||i===null||!(i>0))return null;let a=P(t());if(a===null)return null;let o=a-n;if(!Number.isFinite(o))return null;let s=n+(Math.max(0,Math.floor(o/i))+1)*i-a,c=Math.ceil(Math.max(25,Math.min(6e4,s)));return Number.isFinite(c)?c:null}function H(e){let[t,n]=(0,k.useState)(()=>B()??0);return(0,k.useEffect)(()=>{if(!e)return;let t=!1,r=null,i=()=>{if(t)return;let e=B();e&&e>0&&n(e);let a=V()??1e3;r=window.setTimeout(i,a)};return i(),()=>{t=!0,r!==null&&window.clearTimeout(r)}},[e]),t}function U({pulse:e,kaiSignature:t,phiKey:n,caption:r,chakraDay:i,compact:a=!1,verifierBaseUrl:o}){let[s,f]=(0,k.useState)(`idle`),[m,h]=(0,k.useState)(`idle`),[g,v]=(0,k.useState)(null),y=F(e),b=H(y===null),x=y??b,S=(0,k.useMemo)(()=>{let e=o??c(),r=String(e).replace(/\/+$/,``)||`/verify`,a=typeof t==`string`?t.trim():``,s=l(a),f=Number.isFinite(x)&&x>0?Math.floor(x):0,m=u(f,a),h=d(f,a,r),g=p(typeof i==`string`?i:String(i??``)),_=typeof n==`string`?n.trim():``;return{verifierUrl:h,verifierBaseUrl:r,verifierSlug:m,pulse:f,chakraDay:g,kaiSignature:a,kaiSignatureShort:s,phiKey:_,proofCapsule:f>0&&a.length>0&&_.length>0&&g?{v:`KPV-1`,pulse:f,chakraDay:g,kaiSignature:a,phiKey:_,verifierSlug:m}:null,proofHash:void 0}},[i,t,n,x,o]);(0,k.useEffect)(()=>{let e=!1;return(async()=>{if(!S.proofCapsule){v(null);return}try{let t=await _(S.proofCapsule);e||v(t)}catch{e||v(null)}})(),()=>{e=!0}},[S.proofCapsule]);let C=a?96:160,w=async()=>{if(typeof navigator>`u`||!navigator.clipboard){f(`error`);return}try{await navigator.clipboard.writeText(S.verifierUrl),f(`ok`),window.setTimeout(()=>f(`idle`),2e3)}catch{f(`error`)}},T=async()=>{if(typeof navigator>`u`||!navigator.clipboard){h(`error`);return}try{let e=g??void 0;!e&&S.proofCapsule&&(e=await _(S.proofCapsule),v(e));let t={...S,proofHash:e};await navigator.clipboard.writeText(JSON.stringify(t,null,2)),h(`ok`),window.setTimeout(()=>h(`idle`),2e3)}catch{h(`error`)}},E=a?`kv-verifier kv-verifier--compact`:`kv-verifier`,D=Number.isFinite(S.pulse)&&S.pulse>0?String(S.pulse):`—`,O=typeof r==`string`?r.trim():``,A=R(S.phiKey),M=g?z(g):`—`;return(0,j.jsxs)(`section`,{className:E,"aria-label":`Kai-Sigil verification frame`,"data-role":`verifier-frame`,children:[(0,j.jsx)(`div`,{className:`kv-verifier__qr-shell`,role:`img`,"aria-label":`QR code linking to Kai-Sigil verifier for pulse ${D} and signature ${S.kaiSignatureShort}`,children:(0,j.jsx)(`div`,{className:`kv-verifier__qr-inner`,children:(0,j.jsx)(L,{value:S.verifierUrl,size:C,bgColor:`#00000000`,fgColor:`#ffffff`})})}),(0,j.jsxs)(`div`,{className:`kv-verifier__content`,children:[(0,j.jsxs)(`header`,{className:`kv-verifier__header`,children:[(0,j.jsx)(`h3`,{className:`kv-verifier__title`,children:`Kai-Sigil Verifier`}),(0,j.jsx)(`p`,{className:`kv-verifier__subtitle`,children:`Scan or open the verifier link to confirm this post was sealed by this Φ-Key (KPV-1 payload-bound proof).`})]}),(0,j.jsxs)(`dl`,{className:`kv-verifier__meta`,children:[(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`🌀 Pulse`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value`,children:D})]}),(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`Kai Signature`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value kv-verifier__mono`,children:S.kaiSignatureShort})]}),(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`Φ-Key`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value kv-verifier__mono`,title:S.phiKey,children:A||`—`})]}),S.chakraDay?(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`🧬 Chakra Day`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value`,children:S.chakraDay})]}):null,(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`🔒 Proof Hash`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value kv-verifier__mono`,title:g??``,children:M})]})]}),O.length>0?(0,j.jsxs)(`p`,{className:`kv-verifier__caption`,"aria-label":`Post caption`,children:[`“`,O,`”`]}):null,(0,j.jsxs)(`div`,{className:`kv-verifier__actions`,children:[(0,j.jsx)(`a`,{href:S.verifierUrl,target:`_blank`,rel:`noopener noreferrer`,className:`kv-verifier__btn kv-verifier__btn--primary`,"data-role":`verifier-open-link`,children:`Open Verifier`}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>void w(),className:`kv-verifier__btn kv-verifier__btn--ghost`,"data-role":`verifier-copy-link`,children:s===`ok`?`Remembered!`:s===`error`?`Remember failed`:`Remember Link`}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>void T(),className:`kv-verifier__btn kv-verifier__btn--ghost`,"data-role":`verifier-copy-proof`,children:m===`ok`?`Proof Remembered!`:m===`error`?`Remember failed`:`Remember Proof`})]}),(0,j.jsxs)(`p`,{className:`kv-verifier__url`,"aria-label":`Verifier URL`,children:[(0,j.jsx)(`span`,{className:`kv-verifier__url-label`,children:`Verifier URL:`}),(0,j.jsx)(`span`,{className:`kv-verifier__url-value`,children:S.verifierUrl})]})]})]})}export{p as a,_ as i,u as n,d as r,U as t}; \ No newline at end of file diff --git a/dist/assets/VerifyPage-Qyj4E4nU.js b/dist/assets/VerifyPage-B34sC8R1.js similarity index 97% rename from dist/assets/VerifyPage-Qyj4E4nU.js rename to dist/assets/VerifyPage-B34sC8R1.js index 24571e56..771cac94 100644 --- a/dist/assets/VerifyPage-Qyj4E4nU.js +++ b/dist/assets/VerifyPage-B34sC8R1.js @@ -1 +1 @@ -import{Ht as e,Tn as t,jn as n,tn as r}from"./index-BGzUQCv_.js";import"./prop-types-CQvzhoSE.js";import{t as i}from"./VerifierFrame-CwEJNPi9.js";var a=n(t(),1),o=n(r(),1);function s(e){return typeof e==`object`&&!!e}function c(e){let t=decodeURIComponent(e||``).trim(),n=t.match(/^(\d+)-([A-Za-z0-9]+)$/);if(!n)return{raw:t,pulse:null,shortSig:null};let r=Number(n[1]);return{raw:t,pulse:Number.isFinite(r)&&r>0?r:null,shortSig:n[2]?String(n[2]):null}}function l(){if(typeof window>`u`)return``;let e=window.location.pathname||``,t=window.location.hash||``,n=e.match(/\/verify\/([^/?#]+)/);if(n&&n[1])return n[1];let r=t.match(/\/verify\/([^/?#]+)/);return r&&r[1]?r[1]:``}function u(e){let t=e.match(/]*>([\s\S]*?)<\/metadata>/i);return t?(t[1]??``).trim():null}function d(e){let t=e.trim();if(!t)return null;try{return JSON.parse(t)}catch{return null}}function f(e){if(!s(e))return{raw:e};let t=typeof e.kaiSignature==`string`?e.kaiSignature:void 0,n=typeof e.pulse==`number`&&Number.isFinite(e.pulse)?e.pulse:void 0,r=typeof e.chakraDay==`string`?e.chakraDay:void 0,i=typeof e.timestamp==`string`?e.timestamp:void 0,a=typeof e.phiKey==`string`?e.phiKey:void 0,o=typeof e.userPhiKey==`string`?e.userPhiKey:void 0;return{pulse:n,chakraDay:r,kaiSignature:t,phiKey:a&&!a.startsWith(`φK-`)?a:o,timestamp:i,verifierUrl:typeof e.verifierUrl==`string`?e.verifierUrl:void 0,raw:e}}function p(e){let t=u(e);if(t){let e=d(t);if(e)return f(e)}let n=e.indexOf(`"kaiSignature"`);if(n>=0){let t=e.slice(Math.max(0,n-800),Math.min(e.length,n+2e3)).match(/\{[\s\S]*\}/);if(t&&t[0]){let e=d(t[0]);if(e)return f(e)}}return{}}function m(e,t){return e.length<=t?e:e.slice(0,t)}async function h(e){return await new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(Error(`Failed to read file.`)),r.onload=()=>t(String(r.result??``)),r.readAsText(e)})}function g(){let t=(0,a.useMemo)(()=>l(),[]),n=(0,a.useMemo)(()=>c(t),[t]),[r,s]=(0,a.useState)(``),[u,d]=(0,a.useState)({status:`idle`}),[f,g]=(0,a.useState)(!1),_=(0,a.useMemo)(()=>({pulse:n.pulse??0,kaiSignature:n.shortSig??`unknown-signature`,phiKey:`—`}),[n.pulse,n.shortSig]),v=(0,a.useCallback)(async()=>{let t=r.trim();if(!t){d({status:`error`,message:`Paste the sealed SVG text or upload the sealed SVG file first.`,slug:n});return}g(!0);try{let r=p(t),i=(r.kaiSignature??``).trim();if(!i){d({status:`error`,message:`No kaiSignature found in the SVG metadata.`,slug:n,embedded:r});return}let a=await e(i),o=(r.phiKey??``).trim(),s=r.pulse,c={hasSignature:!0,slugPulseMatches:n.pulse==null||s==null?null:n.pulse===s,slugShortSigMatches:n.shortSig==null?null:n.shortSig===m(i,n.shortSig.length),derivedPhiKeyMatchesEmbedded:o.length===0?null:a===o};if(c.slugPulseMatches===!1||c.slugShortSigMatches===!1||c.derivedPhiKeyMatchesEmbedded===!1){d({status:`error`,message:`Verification failed: one or more checks did not match.`,slug:n,embedded:r,derivedPhiKey:a,checks:c});return}d({status:`ok`,slug:n,embedded:{...r,phiKey:o.length>0?o:a},derivedPhiKey:a,checks:c})}catch(e){d({status:`error`,message:e instanceof Error?e.message:`Verification failed.`,slug:n})}finally{g(!1)}},[n,r]),y=(0,a.useCallback)(async e=>{if(!e.name.toLowerCase().endsWith(`.svg`)){d({status:`error`,message:`Upload a sealed .svg (this verifier reads embedded JSON).`,slug:n});return}s(await h(e)),d({status:`idle`})},[n]);return(0,o.jsxs)(`div`,{className:`verify-page`,children:[(0,o.jsxs)(`header`,{className:`verify-hero`,children:[(0,o.jsx)(`h1`,{className:`verify-title`,children:`Kai-Sigil Verifier`}),(0,o.jsx)(`p`,{className:`verify-subtitle`,children:`Open a sealed memory and verify its human origin by Kai Signature → Φ-Key.`}),(0,o.jsxs)(`div`,{className:`verify-slug`,children:[(0,o.jsx)(`span`,{className:`verify-slug-label`,children:`Link:`}),(0,o.jsxs)(`code`,{className:`verify-slug-value`,children:[`/verify/`,n.raw||`—`]})]})]}),(0,o.jsxs)(`main`,{className:`verify-main`,children:[(0,o.jsxs)(`section`,{className:`verify-card`,children:[(0,o.jsx)(`h2`,{className:`verify-card-title`,children:`1) Provide the sealed post`}),(0,o.jsxs)(`div`,{className:`verify-upload-row`,children:[(0,o.jsxs)(`label`,{className:`verify-upload`,children:[(0,o.jsx)(`input`,{type:`file`,accept:`.svg,image/svg+xml`,onChange:e=>{let t=e.currentTarget.files?.[0];t&&y(t),e.currentTarget.value=``}}),`Upload sealed SVG`]}),(0,o.jsx)(`button`,{type:`button`,className:`verify-btn`,onClick:()=>void v(),disabled:f,children:f?`Verifying…`:`Verify`})]}),(0,o.jsx)(`textarea`,{className:`verify-textarea`,value:r,onChange:e=>s(e.currentTarget.value),placeholder:`Or paste the sealed SVG text here (must include {...} with kaiSignature + pulse + userPhiKey/phiKey).`,spellCheck:!1})]}),(0,o.jsxs)(`section`,{className:`verify-card`,children:[(0,o.jsx)(`h2`,{className:`verify-card-title`,children:`2) Proof capsule`}),u.status===`ok`?(0,o.jsx)(i,{pulse:u.embedded.pulse??n.pulse??0,kaiSignature:u.embedded.kaiSignature??n.shortSig??`unknown`,phiKey:u.derivedPhiKey,chakraDay:u.embedded.chakraDay,compact:!1}):(0,o.jsx)(i,{pulse:_.pulse,kaiSignature:_.kaiSignature,phiKey:_.phiKey,compact:!1}),(0,o.jsx)(`div`,{className:`verify-status`,children:u.status===`idle`?(0,o.jsx)(`p`,{className:`verify-muted`,children:`Upload/paste a sealed SVG, then click Verify.`}):u.status===`ok`?(0,o.jsxs)(`div`,{className:`verify-ok`,children:[(0,o.jsx)(`div`,{className:`verify-badge verify-badge--ok`,children:`Verified`}),(0,o.jsxs)(`p`,{className:`verify-line`,children:[`Sealed by Φ-Key: `,(0,o.jsx)(`code`,{children:u.derivedPhiKey})]}),(0,o.jsxs)(`ul`,{className:`verify-checks`,children:[(0,o.jsxs)(`li`,{children:[`slug pulse match:`,` `,(0,o.jsx)(`strong`,{children:u.checks.slugPulseMatches===null?`n/a`:String(u.checks.slugPulseMatches)})]}),(0,o.jsxs)(`li`,{children:[`slug shortSig match:`,` `,(0,o.jsx)(`strong`,{children:u.checks.slugShortSigMatches===null?`n/a`:String(u.checks.slugShortSigMatches)})]}),(0,o.jsxs)(`li`,{children:[`derived Φ-Key matches embedded:`,` `,(0,o.jsx)(`strong`,{children:u.checks.derivedPhiKeyMatchesEmbedded===null?`n/a (embed omitted phiKey)`:String(u.checks.derivedPhiKeyMatchesEmbedded)})]})]})]}):(0,o.jsxs)(`div`,{className:`verify-fail`,children:[(0,o.jsx)(`div`,{className:`verify-badge verify-badge--fail`,children:`Not verified`}),(0,o.jsx)(`p`,{className:`verify-line`,children:u.message}),u.checks?(0,o.jsxs)(`ul`,{className:`verify-checks`,children:[(0,o.jsxs)(`li`,{children:[`slug pulse match:`,` `,(0,o.jsx)(`strong`,{children:u.checks.slugPulseMatches===null?`n/a`:String(u.checks.slugPulseMatches)})]}),(0,o.jsxs)(`li`,{children:[`slug shortSig match:`,` `,(0,o.jsx)(`strong`,{children:u.checks.slugShortSigMatches===null?`n/a`:String(u.checks.slugShortSigMatches)})]}),(0,o.jsxs)(`li`,{children:[`derived Φ-Key matches embedded:`,` `,(0,o.jsx)(`strong`,{children:u.checks.derivedPhiKeyMatchesEmbedded===null?`n/a (embed omitted phiKey)`:String(u.checks.derivedPhiKeyMatchesEmbedded)})]})]}):null]})})]})]})]})}export{g as default}; \ No newline at end of file +import{Ht as e,Tn as t,jn as n,tn as r}from"./index-CcPm2yTY.js";import"./prop-types-CQ3MXKCa.js";import{t as i}from"./VerifierFrame-Dr7oGdbu.js";var a=n(t(),1),o=n(r(),1);function s(e){return typeof e==`object`&&!!e}function c(e){let t=decodeURIComponent(e||``).trim(),n=t.match(/^(\d+)-([A-Za-z0-9]+)$/);if(!n)return{raw:t,pulse:null,shortSig:null};let r=Number(n[1]);return{raw:t,pulse:Number.isFinite(r)&&r>0?r:null,shortSig:n[2]?String(n[2]):null}}function l(){if(typeof window>`u`)return``;let e=window.location.pathname||``,t=window.location.hash||``,n=e.match(/\/verify\/([^/?#]+)/);if(n&&n[1])return n[1];let r=t.match(/\/verify\/([^/?#]+)/);return r&&r[1]?r[1]:``}function u(e){let t=e.match(/]*>([\s\S]*?)<\/metadata>/i);return t?(t[1]??``).trim():null}function d(e){let t=e.trim();if(!t)return null;try{return JSON.parse(t)}catch{return null}}function f(e){if(!s(e))return{raw:e};let t=typeof e.kaiSignature==`string`?e.kaiSignature:void 0,n=typeof e.pulse==`number`&&Number.isFinite(e.pulse)?e.pulse:void 0,r=typeof e.chakraDay==`string`?e.chakraDay:void 0,i=typeof e.timestamp==`string`?e.timestamp:void 0,a=typeof e.phiKey==`string`?e.phiKey:void 0,o=typeof e.userPhiKey==`string`?e.userPhiKey:void 0;return{pulse:n,chakraDay:r,kaiSignature:t,phiKey:a&&!a.startsWith(`φK-`)?a:o,timestamp:i,verifierUrl:typeof e.verifierUrl==`string`?e.verifierUrl:void 0,raw:e}}function p(e){let t=u(e);if(t){let e=d(t);if(e)return f(e)}let n=e.indexOf(`"kaiSignature"`);if(n>=0){let t=e.slice(Math.max(0,n-800),Math.min(e.length,n+2e3)).match(/\{[\s\S]*\}/);if(t&&t[0]){let e=d(t[0]);if(e)return f(e)}}return{}}function m(e,t){return e.length<=t?e:e.slice(0,t)}async function h(e){return await new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(Error(`Failed to read file.`)),r.onload=()=>t(String(r.result??``)),r.readAsText(e)})}function g(){let t=(0,a.useMemo)(()=>l(),[]),n=(0,a.useMemo)(()=>c(t),[t]),[r,s]=(0,a.useState)(``),[u,d]=(0,a.useState)({status:`idle`}),[f,g]=(0,a.useState)(!1),_=(0,a.useMemo)(()=>({pulse:n.pulse??0,kaiSignature:n.shortSig??`unknown-signature`,phiKey:`—`}),[n.pulse,n.shortSig]),v=(0,a.useCallback)(async()=>{let t=r.trim();if(!t){d({status:`error`,message:`Paste the sealed SVG text or upload the sealed SVG file first.`,slug:n});return}g(!0);try{let r=p(t),i=(r.kaiSignature??``).trim();if(!i){d({status:`error`,message:`No kaiSignature found in the SVG metadata.`,slug:n,embedded:r});return}let a=await e(i),o=(r.phiKey??``).trim(),s=r.pulse,c={hasSignature:!0,slugPulseMatches:n.pulse==null||s==null?null:n.pulse===s,slugShortSigMatches:n.shortSig==null?null:n.shortSig===m(i,n.shortSig.length),derivedPhiKeyMatchesEmbedded:o.length===0?null:a===o};if(c.slugPulseMatches===!1||c.slugShortSigMatches===!1||c.derivedPhiKeyMatchesEmbedded===!1){d({status:`error`,message:`Verification failed: one or more checks did not match.`,slug:n,embedded:r,derivedPhiKey:a,checks:c});return}d({status:`ok`,slug:n,embedded:{...r,phiKey:o.length>0?o:a},derivedPhiKey:a,checks:c})}catch(e){d({status:`error`,message:e instanceof Error?e.message:`Verification failed.`,slug:n})}finally{g(!1)}},[n,r]),y=(0,a.useCallback)(async e=>{if(!e.name.toLowerCase().endsWith(`.svg`)){d({status:`error`,message:`Upload a sealed .svg (this verifier reads embedded JSON).`,slug:n});return}s(await h(e)),d({status:`idle`})},[n]);return(0,o.jsxs)(`div`,{className:`verify-page`,children:[(0,o.jsxs)(`header`,{className:`verify-hero`,children:[(0,o.jsx)(`h1`,{className:`verify-title`,children:`Kai-Sigil Verifier`}),(0,o.jsx)(`p`,{className:`verify-subtitle`,children:`Open a sealed memory and verify its human origin by Kai Signature → Φ-Key.`}),(0,o.jsxs)(`div`,{className:`verify-slug`,children:[(0,o.jsx)(`span`,{className:`verify-slug-label`,children:`Link:`}),(0,o.jsxs)(`code`,{className:`verify-slug-value`,children:[`/verify/`,n.raw||`—`]})]})]}),(0,o.jsxs)(`main`,{className:`verify-main`,children:[(0,o.jsxs)(`section`,{className:`verify-card`,children:[(0,o.jsx)(`h2`,{className:`verify-card-title`,children:`1) Provide the sealed post`}),(0,o.jsxs)(`div`,{className:`verify-upload-row`,children:[(0,o.jsxs)(`label`,{className:`verify-upload`,children:[(0,o.jsx)(`input`,{type:`file`,accept:`.svg,image/svg+xml`,onChange:e=>{let t=e.currentTarget.files?.[0];t&&y(t),e.currentTarget.value=``}}),`Upload sealed SVG`]}),(0,o.jsx)(`button`,{type:`button`,className:`verify-btn`,onClick:()=>void v(),disabled:f,children:f?`Verifying…`:`Verify`})]}),(0,o.jsx)(`textarea`,{className:`verify-textarea`,value:r,onChange:e=>s(e.currentTarget.value),placeholder:`Or paste the sealed SVG text here (must include {...} with kaiSignature + pulse + userPhiKey/phiKey).`,spellCheck:!1})]}),(0,o.jsxs)(`section`,{className:`verify-card`,children:[(0,o.jsx)(`h2`,{className:`verify-card-title`,children:`2) Proof capsule`}),u.status===`ok`?(0,o.jsx)(i,{pulse:u.embedded.pulse??n.pulse??0,kaiSignature:u.embedded.kaiSignature??n.shortSig??`unknown`,phiKey:u.derivedPhiKey,chakraDay:u.embedded.chakraDay,compact:!1}):(0,o.jsx)(i,{pulse:_.pulse,kaiSignature:_.kaiSignature,phiKey:_.phiKey,compact:!1}),(0,o.jsx)(`div`,{className:`verify-status`,children:u.status===`idle`?(0,o.jsx)(`p`,{className:`verify-muted`,children:`Upload/paste a sealed SVG, then click Verify.`}):u.status===`ok`?(0,o.jsxs)(`div`,{className:`verify-ok`,children:[(0,o.jsx)(`div`,{className:`verify-badge verify-badge--ok`,children:`Verified`}),(0,o.jsxs)(`p`,{className:`verify-line`,children:[`Sealed by Φ-Key: `,(0,o.jsx)(`code`,{children:u.derivedPhiKey})]}),(0,o.jsxs)(`ul`,{className:`verify-checks`,children:[(0,o.jsxs)(`li`,{children:[`slug pulse match:`,` `,(0,o.jsx)(`strong`,{children:u.checks.slugPulseMatches===null?`n/a`:String(u.checks.slugPulseMatches)})]}),(0,o.jsxs)(`li`,{children:[`slug shortSig match:`,` `,(0,o.jsx)(`strong`,{children:u.checks.slugShortSigMatches===null?`n/a`:String(u.checks.slugShortSigMatches)})]}),(0,o.jsxs)(`li`,{children:[`derived Φ-Key matches embedded:`,` `,(0,o.jsx)(`strong`,{children:u.checks.derivedPhiKeyMatchesEmbedded===null?`n/a (embed omitted phiKey)`:String(u.checks.derivedPhiKeyMatchesEmbedded)})]})]})]}):(0,o.jsxs)(`div`,{className:`verify-fail`,children:[(0,o.jsx)(`div`,{className:`verify-badge verify-badge--fail`,children:`Not verified`}),(0,o.jsx)(`p`,{className:`verify-line`,children:u.message}),u.checks?(0,o.jsxs)(`ul`,{className:`verify-checks`,children:[(0,o.jsxs)(`li`,{children:[`slug pulse match:`,` `,(0,o.jsx)(`strong`,{children:u.checks.slugPulseMatches===null?`n/a`:String(u.checks.slugPulseMatches)})]}),(0,o.jsxs)(`li`,{children:[`slug shortSig match:`,` `,(0,o.jsx)(`strong`,{children:u.checks.slugShortSigMatches===null?`n/a`:String(u.checks.slugShortSigMatches)})]}),(0,o.jsxs)(`li`,{children:[`derived Φ-Key matches embedded:`,` `,(0,o.jsx)(`strong`,{children:u.checks.derivedPhiKeyMatchesEmbedded===null?`n/a (embed omitted phiKey)`:String(u.checks.derivedPhiKeyMatchesEmbedded)})]})]}):null]})})]})]})]})}export{g as default}; \ No newline at end of file diff --git a/dist/assets/__vite-browser-external-BPnTbBa4.js b/dist/assets/__vite-browser-external-BPnTbBa4.js deleted file mode 100644 index 58fab5ce..00000000 --- a/dist/assets/__vite-browser-external-BPnTbBa4.js +++ /dev/null @@ -1 +0,0 @@ -import{En as e}from"./index-BGzUQCv_.js";var t=e(((e,t)=>{t.exports={}}));export default t(); \ No newline at end of file diff --git a/dist/assets/__vite-browser-external-CUSLmM9D.js b/dist/assets/__vite-browser-external-CUSLmM9D.js new file mode 100644 index 00000000..6c98a72d --- /dev/null +++ b/dist/assets/__vite-browser-external-CUSLmM9D.js @@ -0,0 +1 @@ +import{En as e}from"./index-CcPm2yTY.js";var t=e(((e,t)=>{t.exports={}}));export default t(); \ No newline at end of file diff --git a/dist/assets/bundler-DKFgLeD8.js b/dist/assets/bundler-H_464dRi.js similarity index 99% rename from dist/assets/bundler-DKFgLeD8.js rename to dist/assets/bundler-H_464dRi.js index e1d0fe3e..a671f61d 100644 --- a/dist/assets/bundler-DKFgLeD8.js +++ b/dist/assets/bundler-H_464dRi.js @@ -1,4 +1,4 @@ -import{En as e,On as t,jn as n}from"./index-BGzUQCv_.js";var r=class{constructor(){this.encoder=new TextEncoder,this._pieces=[],this._parts=[]}append_buffer(e){this.flush(),this._parts.push(e)}append(e){this._pieces.push(e)}flush(){if(this._pieces.length>0){let e=new Uint8Array(this._pieces);this._parts.push(e),this._pieces=[]}}toArrayBuffer(){let e=[];for(let t of this._parts)e.push(t);return i(e).buffer}};function i(e){let t=0;for(let n of e)t+=n.byteLength;let n=new Uint8Array(t),r=0;for(let t of e){let e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);n.set(e,r),r+=t.byteLength}return n}function a(e){return new s(e).unpack()}function o(e){let t=new c,n=t.pack(e);return n instanceof Promise?n.then(()=>t.getBuffer()):t.getBuffer()}var s=class{constructor(e){this.index=0,this.dataBuffer=e,this.dataView=new Uint8Array(this.dataBuffer),this.length=this.dataBuffer.byteLength}unpack(){let e=this.unpack_uint8();if(e<128)return e;if((e^224)<32)return(e^224)-32;let t;if((t=e^160)<=15)return this.unpack_raw(t);if((t=e^176)<=15)return this.unpack_string(t);if((t=e^144)<=15)return this.unpack_array(t);if((t=e^128)<=15)return this.unpack_map(t);switch(e){case 192:return null;case 193:return;case 194:return!1;case 195:return!0;case 202:return this.unpack_float();case 203:return this.unpack_double();case 204:return this.unpack_uint8();case 205:return this.unpack_uint16();case 206:return this.unpack_uint32();case 207:return this.unpack_uint64();case 208:return this.unpack_int8();case 209:return this.unpack_int16();case 210:return this.unpack_int32();case 211:return this.unpack_int64();case 212:return;case 213:return;case 214:return;case 215:return;case 216:return t=this.unpack_uint16(),this.unpack_string(t);case 217:return t=this.unpack_uint32(),this.unpack_string(t);case 218:return t=this.unpack_uint16(),this.unpack_raw(t);case 219:return t=this.unpack_uint32(),this.unpack_raw(t);case 220:return t=this.unpack_uint16(),this.unpack_array(t);case 221:return t=this.unpack_uint32(),this.unpack_array(t);case 222:return t=this.unpack_uint16(),this.unpack_map(t);case 223:return t=this.unpack_uint32(),this.unpack_map(t)}}unpack_uint8(){let e=this.dataView[this.index]&255;return this.index++,e}unpack_uint16(){let e=this.read(2),t=(e[0]&255)*256+(e[1]&255);return this.index+=2,t}unpack_uint32(){let e=this.read(4),t=((e[0]*256+e[1])*256+e[2])*256+e[3];return this.index+=4,t}unpack_uint64(){let e=this.read(8),t=((((((e[0]*256+e[1])*256+e[2])*256+e[3])*256+e[4])*256+e[5])*256+e[6])*256+e[7];return this.index+=8,t}unpack_int8(){let e=this.unpack_uint8();return e<128?e:e-256}unpack_int16(){let e=this.unpack_uint16();return e<32768?e:e-65536}unpack_int32(){let e=this.unpack_uint32();return e<2**31?e:e-2**32}unpack_int64(){let e=this.unpack_uint64();return e<2**63?e:e-2**64}unpack_raw(e){if(this.length>31,n=(e>>23&255)-127,r=e&8388607|8388608;return(t===0?1:-1)*r*2**(n-23)}unpack_double(){let e=this.unpack_uint32(),t=this.unpack_uint32(),n=e>>31,r=(e>>20&2047)-1023,i=(e&1048575|1048576)*2**(r-20)+t*2**(r-52);return(n===0?1:-1)*i}read(e){let t=this.index;if(t+e<=this.length)return this.dataView.subarray(t,t+e);throw Error(`BinaryPackFailure: read index out of range`)}},c=class{getBuffer(){return this._bufferBuilder.toArrayBuffer()}pack(e){if(typeof e==`string`)this.pack_string(e);else if(typeof e==`number`)Math.floor(e)===e?this.pack_integer(e):this.pack_double(e);else if(typeof e==`boolean`)e===!0?this._bufferBuilder.append(195):e===!1&&this._bufferBuilder.append(194);else if(e===void 0)this._bufferBuilder.append(192);else if(typeof e==`object`)if(e===null)this._bufferBuilder.append(192);else{let t=e.constructor;if(e instanceof Array){let t=this.pack_array(e);if(t instanceof Promise)return t.then(()=>this._bufferBuilder.flush())}else if(e instanceof ArrayBuffer)this.pack_bin(new Uint8Array(e));else if(`BYTES_PER_ELEMENT`in e){let t=e;this.pack_bin(new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}else if(e instanceof Date)this.pack_string(e.toString());else if(e instanceof Blob)return e.arrayBuffer().then(e=>{this.pack_bin(new Uint8Array(e)),this._bufferBuilder.flush()});else if(t==Object||t.toString().startsWith(`class`)){let t=this.pack_object(e);if(t instanceof Promise)return t.then(()=>this._bufferBuilder.flush())}else throw Error(`Type "${t.toString()}" not yet supported`)}else throw Error(`Type "${typeof e}" not yet supported`);this._bufferBuilder.flush()}pack_bin(e){let t=e.length;if(t<=15)this.pack_uint8(160+t);else if(t<=65535)this._bufferBuilder.append(218),this.pack_uint16(t);else if(t<=4294967295)this._bufferBuilder.append(219),this.pack_uint32(t);else throw Error(`Invalid length`);this._bufferBuilder.append_buffer(e)}pack_string(e){let t=this._textEncoder.encode(e),n=t.length;if(n<=15)this.pack_uint8(176+n);else if(n<=65535)this._bufferBuilder.append(216),this.pack_uint16(n);else if(n<=4294967295)this._bufferBuilder.append(217),this.pack_uint32(n);else throw Error(`Invalid length`);this._bufferBuilder.append_buffer(t)}pack_array(e){let t=e.length;if(t<=15)this.pack_uint8(144+t);else if(t<=65535)this._bufferBuilder.append(220),this.pack_uint16(t);else if(t<=4294967295)this._bufferBuilder.append(221),this.pack_uint32(t);else throw Error(`Invalid length`);let n=r=>{if(rn(r+1)):n(r+1)}};return n(0)}pack_integer(e){if(e>=-32&&e<=127)this._bufferBuilder.append(e&255);else if(e>=0&&e<=255)this._bufferBuilder.append(204),this.pack_uint8(e);else if(e>=-128&&e<=127)this._bufferBuilder.append(208),this.pack_int8(e);else if(e>=0&&e<=65535)this._bufferBuilder.append(205),this.pack_uint16(e);else if(e>=-32768&&e<=32767)this._bufferBuilder.append(209),this.pack_int16(e);else if(e>=0&&e<=4294967295)this._bufferBuilder.append(206),this.pack_uint32(e);else if(e>=-2147483648&&e<=2147483647)this._bufferBuilder.append(210),this.pack_int32(e);else if(e>=-0x8000000000000000&&e<=0x8000000000000000)this._bufferBuilder.append(211),this.pack_int64(e);else if(e>=0&&e<=0x10000000000000000)this._bufferBuilder.append(207),this.pack_uint64(e);else throw Error(`Invalid integer`)}pack_double(e){let t=0;e<0&&(t=1,e=-e);let n=Math.floor(Math.log(e)/Math.LN2),r=e/2**n-1,i=Math.floor(r*2**52),a=2**32,o=t<<31|n+1023<<20|i/a&1048575,s=i%a;this._bufferBuilder.append(203),this.pack_int32(o),this.pack_int32(s)}pack_object(e){let t=Object.keys(e),n=t.length;if(n<=15)this.pack_uint8(128+n);else if(n<=65535)this._bufferBuilder.append(222),this.pack_uint16(n);else if(n<=4294967295)this._bufferBuilder.append(223),this.pack_uint32(n);else throw Error(`Invalid length`);let r=n=>{if(nr(n+1))}return r(n+1)}};return r(0)}pack_uint8(e){this._bufferBuilder.append(e)}pack_uint16(e){this._bufferBuilder.append(e>>8),this._bufferBuilder.append(e&255)}pack_uint32(e){let t=e&4294967295;this._bufferBuilder.append((t&4278190080)>>>24),this._bufferBuilder.append((t&16711680)>>>16),this._bufferBuilder.append((t&65280)>>>8),this._bufferBuilder.append(t&255)}pack_uint64(e){let t=e/2**32,n=e%2**32;this._bufferBuilder.append((t&4278190080)>>>24),this._bufferBuilder.append((t&16711680)>>>16),this._bufferBuilder.append((t&65280)>>>8),this._bufferBuilder.append(t&255),this._bufferBuilder.append((n&4278190080)>>>24),this._bufferBuilder.append((n&16711680)>>>16),this._bufferBuilder.append((n&65280)>>>8),this._bufferBuilder.append(n&255)}pack_int8(e){this._bufferBuilder.append(e&255)}pack_int16(e){this._bufferBuilder.append((e&65280)>>8),this._bufferBuilder.append(e&255)}pack_int32(e){this._bufferBuilder.append(e>>>24&255),this._bufferBuilder.append((e&16711680)>>>16),this._bufferBuilder.append((e&65280)>>>8),this._bufferBuilder.append(e&255)}pack_int64(e){let t=Math.floor(e/2**32),n=e%2**32;this._bufferBuilder.append((t&4278190080)>>>24),this._bufferBuilder.append((t&16711680)>>>16),this._bufferBuilder.append((t&65280)>>>8),this._bufferBuilder.append(t&255),this._bufferBuilder.append((n&4278190080)>>>24),this._bufferBuilder.append((n&16711680)>>>16),this._bufferBuilder.append((n&65280)>>>8),this._bufferBuilder.append(n&255)}constructor(){this._bufferBuilder=new r,this._textEncoder=new TextEncoder}},l=!0,u=!0;function d(e,t,n){let r=e.match(t);return r&&r.length>=n&&parseFloat(r[n],10)}function f(e,t,n){if(!e.RTCPeerConnection)return;let r=e.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return i.apply(this,arguments);let a=e=>{let t=n(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,a),i.apply(this,[e,a])};let a=r.removeEventListener;r.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t]||!this._eventMap[t].has(n))return a.apply(this,arguments);let r=this._eventMap[t].get(n);return this._eventMap[t].delete(n),this._eventMap[t].size===0&&delete this._eventMap[t],Object.keys(this._eventMap).length===0&&delete this._eventMap,a.apply(this,[e,r])},Object.defineProperty(r,`on`+t,{get(){return this[`_on`+t]},set(e){this[`_on`+t]&&(this.removeEventListener(t,this[`_on`+t]),delete this[`_on`+t]),e&&this.addEventListener(t,this[`_on`+t]=e)},enumerable:!0,configurable:!0})}function p(e){return typeof e==`boolean`?(l=e,e?`adapter.js logging disabled`:`adapter.js logging enabled`):Error(`Argument type: `+typeof e+`. Please use a boolean.`)}function ee(e){return typeof e==`boolean`?(u=!e,`adapter.js deprecation warnings `+(e?`disabled`:`enabled`)):Error(`Argument type: `+typeof e+`. Please use a boolean.`)}function te(){if(typeof window==`object`){if(l)return;typeof console<`u`&&typeof console.log==`function`&&console.log.apply(console,arguments)}}function m(e,t){u&&console.warn(e+` is deprecated, please use `+t+` instead.`)}function ne(e){let t={browser:null,version:null};if(e===void 0||!e.navigator||!e.navigator.userAgent)return t.browser=`Not a browser.`,t;let{navigator:n}=e;if(n.userAgentData&&n.userAgentData.brands){let e=n.userAgentData.brands.find(e=>e.brand===`Chromium`);if(e)return{browser:`chrome`,version:parseInt(e.version,10)}}if(n.mozGetUserMedia)t.browser=`firefox`,t.version=parseInt(d(n.userAgent,/Firefox\/(\d+)\./,1));else if(n.webkitGetUserMedia||e.isSecureContext===!1&&e.webkitRTCPeerConnection)t.browser=`chrome`,t.version=parseInt(d(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2));else if(e.RTCPeerConnection&&n.userAgent.match(/AppleWebKit\/(\d+)\./))t.browser=`safari`,t.version=parseInt(d(n.userAgent,/AppleWebKit\/(\d+)\./,1)),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&`currentDirection`in e.RTCRtpTransceiver.prototype,t._safariVersion=d(n.userAgent,/Version\/(\d+(\.?\d+))/,1);else return t.browser=`Not a supported browser.`,t;return t}function re(e){return Object.prototype.toString.call(e)===`[object Object]`}function ie(e){return re(e)?Object.keys(e).reduce(function(t,n){let r=re(e[n]),i=r?ie(e[n]):e[n],a=r&&!Object.keys(i).length;return i===void 0||a?t:Object.assign(t,{[n]:i})},{}):e}function ae(e,t,n){!t||n.has(t.id)||(n.set(t.id,t),Object.keys(t).forEach(r=>{r.endsWith(`Id`)?ae(e,e.get(t[r]),n):r.endsWith(`Ids`)&&t[r].forEach(t=>{ae(e,e.get(t),n)})}))}function oe(e,t,n){let r=n?`outbound-rtp`:`inbound-rtp`,i=new Map;if(t===null)return i;let a=[];return e.forEach(e=>{e.type===`track`&&e.trackIdentifier===t.id&&a.push(e)}),a.forEach(t=>{e.forEach(n=>{n.type===r&&n.trackId===t.id&&ae(e,n,i)})}),i}var se=te;function ce(e,t){let n=e&&e.navigator;if(!n.mediaDevices)return;let r=function(e){if(typeof e!=`object`||e.mandatory||e.optional)return e;let t={};return Object.keys(e).forEach(n=>{if(n===`require`||n===`advanced`||n===`mediaSource`)return;let r=typeof e[n]==`object`?e[n]:{ideal:e[n]};r.exact!==void 0&&typeof r.exact==`number`&&(r.min=r.max=r.exact);let i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):t===`deviceId`?`sourceId`:t};if(r.ideal!==void 0){t.optional=t.optional||[];let e={};typeof r.ideal==`number`?(e[i(`min`,n)]=r.ideal,t.optional.push(e),e={},e[i(`max`,n)]=r.ideal,t.optional.push(e)):(e[i(``,n)]=r.ideal,t.optional.push(e))}r.exact!==void 0&&typeof r.exact!=`number`?(t.mandatory=t.mandatory||{},t.mandatory[i(``,n)]=r.exact):[`min`,`max`].forEach(e=>{r[e]!==void 0&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])})}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if(e=JSON.parse(JSON.stringify(e)),e&&typeof e.audio==`object`){let t=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};e=JSON.parse(JSON.stringify(e)),t(e.audio,`autoGainControl`,`googAutoGainControl`),t(e.audio,`noiseSuppression`,`googNoiseSuppression`),e.audio=r(e.audio)}if(e&&typeof e.video==`object`){let a=e.video.facingMode;a&&=typeof a==`object`?a:{ideal:a};let o=t.version<66;if(a&&(a.exact===`user`||a.exact===`environment`||a.ideal===`user`||a.ideal===`environment`)&&!(n.mediaDevices.getSupportedConstraints&&n.mediaDevices.getSupportedConstraints().facingMode&&!o)){delete e.video.facingMode;let t;if(a.exact===`environment`||a.ideal===`environment`?t=[`back`,`rear`]:(a.exact===`user`||a.ideal===`user`)&&(t=[`front`]),t)return n.mediaDevices.enumerateDevices().then(n=>{n=n.filter(e=>e.kind===`videoinput`);let o=n.find(e=>t.some(t=>e.label.toLowerCase().includes(t)));return!o&&n.length&&t.includes(`back`)&&(o=n[n.length-1]),o&&(e.video.deviceId=a.exact?{exact:o.deviceId}:{ideal:o.deviceId}),e.video=r(e.video),se(`chrome: `+JSON.stringify(e)),i(e)})}e.video=r(e.video)}return se(`chrome: `+JSON.stringify(e)),i(e)},a=function(e){return t.version>=64?e:{name:{PermissionDeniedError:`NotAllowedError`,PermissionDismissedError:`NotAllowedError`,InvalidStateError:`NotAllowedError`,DevicesNotFoundError:`NotFoundError`,ConstraintNotSatisfiedError:`OverconstrainedError`,TrackStartError:`NotReadableError`,MediaDeviceFailedDueToShutdown:`NotAllowedError`,MediaDeviceKillSwitchOn:`NotAllowedError`,TabCaptureError:`AbortError`,ScreenCaptureError:`AbortError`,DeviceCaptureError:`AbortError`}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&`: `)+this.message}}};if(n.getUserMedia=function(e,t,r){i(e,e=>{n.webkitGetUserMedia(e,t,e=>{r&&r(a(e))})})}.bind(n),n.mediaDevices.getUserMedia){let e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(t){return i(t,t=>e(t).then(e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach(e=>{e.stop()}),new DOMException(``,`NotFoundError`);return e},e=>Promise.reject(a(e))))}}}var le=t({fixNegotiationNeeded:()=>_e,shimAddTrackRemoveTrack:()=>he,shimAddTrackRemoveTrackWithNative:()=>me,shimGetSendersWithDtmf:()=>fe,shimGetUserMedia:()=>ce,shimMediaStream:()=>ue,shimOnTrack:()=>de,shimPeerConnection:()=>ge,shimSenderReceiverGetStats:()=>pe});function ue(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function de(e){if(typeof e==`object`&&e.RTCPeerConnection&&!(`ontrack`in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,`ontrack`,{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener(`track`,this._ontrack),this.addEventListener(`track`,this._ontrack=e)},enumerable:!0,configurable:!0});let t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener(`addtrack`,n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.track.id):{track:n.track};let i=new Event(`track`);i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)}),t.stream.getTracks().forEach(n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.id):{track:n};let i=new Event(`track`);i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)})},this.addEventListener(`addstream`,this._ontrackpoly)),t.apply(this,arguments)}}else f(e,`track`,e=>(e.transceiver||Object.defineProperty(e,`transceiver`,{value:{receiver:e.receiver}}),e))}function fe(e){if(typeof e==`object`&&e.RTCPeerConnection&&!(`getSenders`in e.RTCPeerConnection.prototype)&&`createDTMFSender`in e.RTCPeerConnection.prototype){let t=function(e,t){return{track:t,get dtmf(){return this._dtmf===void 0&&(t.kind===`audio`?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};let n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){let i=n.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};let r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);let t=this._senders.indexOf(e);t!==-1&&this._senders.splice(t,1)}}let n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach(e=>{this._senders.push(t(this,e))})};let r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach(e=>{let t=this._senders.find(t=>t.track===e);t&&this._senders.splice(this._senders.indexOf(t),1)})}}else if(typeof e==`object`&&e.RTCPeerConnection&&`getSenders`in e.RTCPeerConnection.prototype&&`createDTMFSender`in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!(`dtmf`in e.RTCRtpSender.prototype)){let t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e},Object.defineProperty(e.RTCRtpSender.prototype,`dtmf`,{get(){return this._dtmf===void 0&&(this.track.kind===`audio`?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function pe(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!(`getStats`in e.RTCRtpSender.prototype)){let t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});let n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){let e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){let e=this;return this._pc.getStats().then(t=>oe(t,e.track,!0))}}if(!(`getStats`in e.RTCRtpReceiver.prototype)){let t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),f(e,`track`,e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){let e=this;return this._pc.getStats().then(t=>oe(t,e.track,!1))}}if(!(`getStats`in e.RTCRtpSender.prototype&&`getStats`in e.RTCRtpReceiver.prototype))return;let t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){let e=arguments[0],t,n,r;return this.getSenders().forEach(n=>{n.track===e&&(t?r=!0:t=n)}),this.getReceivers().forEach(t=>(t.track===e&&(n?r=!0:n=t),t.track===e)),r||t&&n?Promise.reject(new DOMException(`There are more than one sender or receiver for the track.`,`InvalidAccessError`)):t?t.getStats():n?n.getStats():Promise.reject(new DOMException(`There is no sender or receiver for the track.`,`InvalidAccessError`))}return t.apply(this,arguments)}}function me(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(e=>this._shimmedLocalStreams[e][0])};let t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};let r=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?this._shimmedLocalStreams[n.id].indexOf(r)===-1&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};let n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException(`Track already exists.`,`InvalidAccessError`)});let t=this.getSenders();n.apply(this,arguments);let r=this.getSenders().filter(e=>t.indexOf(e)===-1);this._shimmedLocalStreams[e.id]=[e].concat(r)};let r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};let i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(t=>{let n=this._shimmedLocalStreams[t].indexOf(e);n!==-1&&this._shimmedLocalStreams[t].splice(n,1),this._shimmedLocalStreams[t].length===1&&delete this._shimmedLocalStreams[t]}),i.apply(this,arguments)}}function he(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return me(e);let n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){let e=n.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map(e=>this._reverseStreams[e.id])};let r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException(`Track already exists.`,`InvalidAccessError`)}),!this._reverseStreams[t.id]){let n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};let i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,n){if(this.signalingState===`closed`)throw new DOMException(`The RTCPeerConnection's signalingState is 'closed'.`,`InvalidStateError`);let r=[].slice.call(arguments,1);if(r.length!==1||!r[0].getTracks().find(e=>e===t))throw new DOMException(`The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.`,`NotSupportedError`);if(this.getSenders().find(e=>e.track===t))throw new DOMException(`Track already exists.`,`InvalidAccessError`);this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};let i=this._streams[n.id];if(i)i.addTrack(t),Promise.resolve().then(()=>{this.dispatchEvent(new Event(`negotiationneeded`))});else{let r=new e.MediaStream([t]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find(e=>e.track===t)};function a(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{let r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(i.id,`g`),r.id)}),new RTCSessionDescription({type:t.type,sdp:n})}function o(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{let r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(r.id,`g`),i.id)}),new RTCSessionDescription({type:t.type,sdp:n})}[`createOffer`,`createAnswer`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){let e=arguments;return arguments.length&&typeof arguments[0]==`function`?n.apply(this,[t=>{let n=a(this,t);e[0].apply(null,[n])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):n.apply(this,arguments).then(e=>a(this,e))}};e.RTCPeerConnection.prototype[t]=r[t]});let s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type||(arguments[0]=o(this,arguments[0])),s.apply(this,arguments)};let c=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,`localDescription`);Object.defineProperty(e.RTCPeerConnection.prototype,`localDescription`,{get(){let e=c.get.apply(this);return e.type===``?e:a(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if(this.signalingState===`closed`)throw new DOMException(`The RTCPeerConnection's signalingState is 'closed'.`,`InvalidStateError`);if(!e._pc)throw new DOMException(`Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.`,`TypeError`);if(e._pc!==this)throw new DOMException(`Sender was not created by this connection.`,`InvalidAccessError`);this._streams=this._streams||{};let t;Object.keys(this._streams).forEach(n=>{this._streams[n].getTracks().find(t=>e.track===t)&&(t=this._streams[n])}),t&&(t.getTracks().length===1?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event(`negotiationneeded`)))}}function ge(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&[`setLocalDescription`,`setRemoteDescription`,`addIceCandidate`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new(t===`addIceCandidate`?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]})}function _e(e,t){f(e,`negotiationneeded`,e=>{let n=e.target;if(!((t.version<72||n.getConfiguration&&n.getConfiguration().sdpSemantics===`plan-b`)&&n.signalingState!==`stable`))return e})}function ve(e,t){let n=e&&e.navigator,r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){m(`navigator.getUserMedia`,`navigator.mediaDevices.getUserMedia`),n.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&`autoGainControl`in n.mediaDevices.getSupportedConstraints())){let e=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return typeof n==`object`&&typeof n.audio==`object`&&(n=JSON.parse(JSON.stringify(n)),e(n.audio,`autoGainControl`,`mozAutoGainControl`),e(n.audio,`noiseSuppression`,`mozNoiseSuppression`)),t(n)},r&&r.prototype.getSettings){let t=r.prototype.getSettings;r.prototype.getSettings=function(){let n=t.apply(this,arguments);return e(n,`mozAutoGainControl`,`autoGainControl`),e(n,`mozNoiseSuppression`,`noiseSuppression`),n}}if(r&&r.prototype.applyConstraints){let t=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return this.kind===`audio`&&typeof n==`object`&&(n=JSON.parse(JSON.stringify(n)),e(n,`autoGainControl`,`mozAutoGainControl`),e(n,`noiseSuppression`,`mozNoiseSuppression`)),t.apply(this,[n])}}}}function ye(e,t){e.navigator.mediaDevices&&`getDisplayMedia`in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!(n&&n.video)){let e=new DOMException(`getDisplayMedia without video constraints is undefined`);return e.name=`NotFoundError`,e.code=8,Promise.reject(e)}return n.video===!0?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)})}var be=t({shimAddTransceiver:()=>Ee,shimCreateAnswer:()=>ke,shimCreateOffer:()=>Oe,shimGetDisplayMedia:()=>ye,shimGetParameters:()=>De,shimGetUserMedia:()=>ve,shimOnTrack:()=>xe,shimPeerConnection:()=>h,shimRTCDataChannel:()=>Te,shimReceiverGetStats:()=>Ce,shimRemoveStream:()=>we,shimSenderGetStats:()=>Se});function xe(e){typeof e==`object`&&e.RTCTrackEvent&&`receiver`in e.RTCTrackEvent.prototype&&!(`transceiver`in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,`transceiver`,{get(){return{receiver:this.receiver}}})}function h(e,t){if(typeof e!=`object`||!(e.RTCPeerConnection||e.mozRTCPeerConnection))return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&[`setLocalDescription`,`setRemoteDescription`,`addIceCandidate`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new(t===`addIceCandidate`?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]});let n={inboundrtp:`inbound-rtp`,outboundrtp:`outbound-rtp`,candidatepair:`candidate-pair`,localcandidate:`local-candidate`,remotecandidate:`remote-candidate`},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){let[e,i,a]=arguments;return r.apply(this,[e||null]).then(e=>{if(t.version<53&&!i)try{e.forEach(e=>{e.type=n[e.type]||e.type})}catch(t){if(t.name!==`TypeError`)throw t;e.forEach((t,r)=>{e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))})}return e}).then(i,a)}}function Se(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&`getStats`in e.RTCRtpSender.prototype)return;let t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});let n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){let e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function Ce(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&`getStats`in e.RTCRtpReceiver.prototype)return;let t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),f(e,`track`,e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function we(e){!e.RTCPeerConnection||`removeStream`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){m(`removeStream`,`removeTrack`),this.getSenders().forEach(t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)})})}function Te(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function Ee(e){if(!(typeof e==`object`&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;e===void 0&&(e=[]),e=[...e];let n=e.length>0;n&&e.forEach(e=>{if(`rid`in e&&!/^[a-z0-9]{0,16}$/i.test(e.rid))throw TypeError(`Invalid RID value provided.`);if(`scaleResolutionDownBy`in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw RangeError(`scale_resolution_down_by must be >= 1.0`);if(`maxFramerate`in e&&!(parseFloat(e.maxFramerate)>=0))throw RangeError(`max_framerate must be >= 0.0`)});let r=t.apply(this,arguments);if(n){let{sender:t}=r,n=t.getParameters();(!(`encodings`in n)||n.encodings.length===1&&Object.keys(n.encodings[0]).length===0)&&(n.encodings=e,t.sendEncodings=e,this.setParametersPromises.push(t.setParameters(n).then(()=>{delete t.sendEncodings}).catch(()=>{delete t.sendEncodings})))}return r})}function De(e){if(!(typeof e==`object`&&e.RTCRtpSender))return;let t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){let e=t.apply(this,arguments);return`encodings`in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function Oe(e){if(!(typeof e==`object`&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function ke(e){if(!(typeof e==`object`&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}var Ae=t({shimAudioContext:()=>ze,shimCallbacksAPI:()=>Ne,shimConstraints:()=>Fe,shimCreateOfferLegacy:()=>Re,shimGetUserMedia:()=>Pe,shimLocalStreamsAPI:()=>je,shimRTCIceServerUrls:()=>Ie,shimRemoteStreamsAPI:()=>Me,shimTrackEventTransceiver:()=>Le});function je(e){if(!(typeof e!=`object`||!e.RTCPeerConnection)){if(`getLocalStreams`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||=[],this._localStreams}),!(`addStream`in e.RTCPeerConnection.prototype)){let t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||=[],this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(n=>t.call(this,n,e)),e.getVideoTracks().forEach(n=>t.call(this,n,e))},e.RTCPeerConnection.prototype.addTrack=function(e,...n){return n&&n.forEach(e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]}),t.apply(this,arguments)}}`removeStream`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||=[];let t=this._localStreams.indexOf(e);if(t===-1)return;this._localStreams.splice(t,1);let n=e.getTracks();this.getSenders().forEach(e=>{n.includes(e.track)&&this.removeTrack(e)})})}}function Me(e){if(!(typeof e!=`object`||!e.RTCPeerConnection)&&(`getRemoteStreams`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!(`onaddstream`in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,`onaddstream`,{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener(`addstream`,this._onaddstream),this.removeEventListener(`track`,this._onaddstreampoly)),this.addEventListener(`addstream`,this._onaddstream=e),this.addEventListener(`track`,this._onaddstreampoly=e=>{e.streams.forEach(e=>{if(this._remoteStreams||=[],this._remoteStreams.includes(e))return;this._remoteStreams.push(e);let t=new Event(`addstream`);t.stream=e,this.dispatchEvent(t)})})}});let t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){let e=this;return this._onaddstreampoly||this.addEventListener(`track`,this._onaddstreampoly=function(t){t.streams.forEach(t=>{if(e._remoteStreams||=[],e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);let n=new Event(`addstream`);n.stream=t,e.dispatchEvent(n)})}),t.apply(e,arguments)}}}function Ne(e){if(typeof e!=`object`||!e.RTCPeerConnection)return;let t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,a=t.setRemoteDescription,o=t.addIceCandidate;t.createOffer=function(e,t){let r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){let n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};let s=function(e,t,n){let r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=s,s=function(e,t,n){let r=a.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=s,s=function(e,t,n){let r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=s}function Pe(e){let t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){let e=t.mediaDevices,n=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>n(Fe(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t))}function Fe(e){return e&&e.video!==void 0?Object.assign({},e,{video:ie(e.video)}):e}function Ie(e){if(!e.RTCPeerConnection)return;let t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){let t=[];for(let n=0;ne.receiver.track.kind===`audio`);e.offerToReceiveAudio===!1&&t?t.direction===`sendrecv`?t.setDirection?t.setDirection(`sendonly`):t.direction=`sendonly`:t.direction===`recvonly`&&(t.setDirection?t.setDirection(`inactive`):t.direction=`inactive`):e.offerToReceiveAudio===!0&&!t&&this.addTransceiver(`audio`,{direction:`recvonly`}),e.offerToReceiveVideo!==void 0&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);let n=this.getTransceivers().find(e=>e.receiver.track.kind===`video`);e.offerToReceiveVideo===!1&&n?n.direction===`sendrecv`?n.setDirection?n.setDirection(`sendonly`):n.direction=`sendonly`:n.direction===`recvonly`&&(n.setDirection?n.setDirection(`inactive`):n.direction=`inactive`):e.offerToReceiveVideo===!0&&!n&&this.addTransceiver(`video`,{direction:`recvonly`})}return t.apply(this,arguments)}}function ze(e){typeof e!=`object`||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Be=e(((e,t)=>{var n={};n.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},n.localCName=n.generateIdentifier(),n.splitLines=function(e){return e.trim().split(` +import{En as e,On as t,jn as n}from"./index-CcPm2yTY.js";var r=class{constructor(){this.encoder=new TextEncoder,this._pieces=[],this._parts=[]}append_buffer(e){this.flush(),this._parts.push(e)}append(e){this._pieces.push(e)}flush(){if(this._pieces.length>0){let e=new Uint8Array(this._pieces);this._parts.push(e),this._pieces=[]}}toArrayBuffer(){let e=[];for(let t of this._parts)e.push(t);return i(e).buffer}};function i(e){let t=0;for(let n of e)t+=n.byteLength;let n=new Uint8Array(t),r=0;for(let t of e){let e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);n.set(e,r),r+=t.byteLength}return n}function a(e){return new s(e).unpack()}function o(e){let t=new c,n=t.pack(e);return n instanceof Promise?n.then(()=>t.getBuffer()):t.getBuffer()}var s=class{constructor(e){this.index=0,this.dataBuffer=e,this.dataView=new Uint8Array(this.dataBuffer),this.length=this.dataBuffer.byteLength}unpack(){let e=this.unpack_uint8();if(e<128)return e;if((e^224)<32)return(e^224)-32;let t;if((t=e^160)<=15)return this.unpack_raw(t);if((t=e^176)<=15)return this.unpack_string(t);if((t=e^144)<=15)return this.unpack_array(t);if((t=e^128)<=15)return this.unpack_map(t);switch(e){case 192:return null;case 193:return;case 194:return!1;case 195:return!0;case 202:return this.unpack_float();case 203:return this.unpack_double();case 204:return this.unpack_uint8();case 205:return this.unpack_uint16();case 206:return this.unpack_uint32();case 207:return this.unpack_uint64();case 208:return this.unpack_int8();case 209:return this.unpack_int16();case 210:return this.unpack_int32();case 211:return this.unpack_int64();case 212:return;case 213:return;case 214:return;case 215:return;case 216:return t=this.unpack_uint16(),this.unpack_string(t);case 217:return t=this.unpack_uint32(),this.unpack_string(t);case 218:return t=this.unpack_uint16(),this.unpack_raw(t);case 219:return t=this.unpack_uint32(),this.unpack_raw(t);case 220:return t=this.unpack_uint16(),this.unpack_array(t);case 221:return t=this.unpack_uint32(),this.unpack_array(t);case 222:return t=this.unpack_uint16(),this.unpack_map(t);case 223:return t=this.unpack_uint32(),this.unpack_map(t)}}unpack_uint8(){let e=this.dataView[this.index]&255;return this.index++,e}unpack_uint16(){let e=this.read(2),t=(e[0]&255)*256+(e[1]&255);return this.index+=2,t}unpack_uint32(){let e=this.read(4),t=((e[0]*256+e[1])*256+e[2])*256+e[3];return this.index+=4,t}unpack_uint64(){let e=this.read(8),t=((((((e[0]*256+e[1])*256+e[2])*256+e[3])*256+e[4])*256+e[5])*256+e[6])*256+e[7];return this.index+=8,t}unpack_int8(){let e=this.unpack_uint8();return e<128?e:e-256}unpack_int16(){let e=this.unpack_uint16();return e<32768?e:e-65536}unpack_int32(){let e=this.unpack_uint32();return e<2**31?e:e-2**32}unpack_int64(){let e=this.unpack_uint64();return e<2**63?e:e-2**64}unpack_raw(e){if(this.length>31,n=(e>>23&255)-127,r=e&8388607|8388608;return(t===0?1:-1)*r*2**(n-23)}unpack_double(){let e=this.unpack_uint32(),t=this.unpack_uint32(),n=e>>31,r=(e>>20&2047)-1023,i=(e&1048575|1048576)*2**(r-20)+t*2**(r-52);return(n===0?1:-1)*i}read(e){let t=this.index;if(t+e<=this.length)return this.dataView.subarray(t,t+e);throw Error(`BinaryPackFailure: read index out of range`)}},c=class{getBuffer(){return this._bufferBuilder.toArrayBuffer()}pack(e){if(typeof e==`string`)this.pack_string(e);else if(typeof e==`number`)Math.floor(e)===e?this.pack_integer(e):this.pack_double(e);else if(typeof e==`boolean`)e===!0?this._bufferBuilder.append(195):e===!1&&this._bufferBuilder.append(194);else if(e===void 0)this._bufferBuilder.append(192);else if(typeof e==`object`)if(e===null)this._bufferBuilder.append(192);else{let t=e.constructor;if(e instanceof Array){let t=this.pack_array(e);if(t instanceof Promise)return t.then(()=>this._bufferBuilder.flush())}else if(e instanceof ArrayBuffer)this.pack_bin(new Uint8Array(e));else if(`BYTES_PER_ELEMENT`in e){let t=e;this.pack_bin(new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}else if(e instanceof Date)this.pack_string(e.toString());else if(e instanceof Blob)return e.arrayBuffer().then(e=>{this.pack_bin(new Uint8Array(e)),this._bufferBuilder.flush()});else if(t==Object||t.toString().startsWith(`class`)){let t=this.pack_object(e);if(t instanceof Promise)return t.then(()=>this._bufferBuilder.flush())}else throw Error(`Type "${t.toString()}" not yet supported`)}else throw Error(`Type "${typeof e}" not yet supported`);this._bufferBuilder.flush()}pack_bin(e){let t=e.length;if(t<=15)this.pack_uint8(160+t);else if(t<=65535)this._bufferBuilder.append(218),this.pack_uint16(t);else if(t<=4294967295)this._bufferBuilder.append(219),this.pack_uint32(t);else throw Error(`Invalid length`);this._bufferBuilder.append_buffer(e)}pack_string(e){let t=this._textEncoder.encode(e),n=t.length;if(n<=15)this.pack_uint8(176+n);else if(n<=65535)this._bufferBuilder.append(216),this.pack_uint16(n);else if(n<=4294967295)this._bufferBuilder.append(217),this.pack_uint32(n);else throw Error(`Invalid length`);this._bufferBuilder.append_buffer(t)}pack_array(e){let t=e.length;if(t<=15)this.pack_uint8(144+t);else if(t<=65535)this._bufferBuilder.append(220),this.pack_uint16(t);else if(t<=4294967295)this._bufferBuilder.append(221),this.pack_uint32(t);else throw Error(`Invalid length`);let n=r=>{if(rn(r+1)):n(r+1)}};return n(0)}pack_integer(e){if(e>=-32&&e<=127)this._bufferBuilder.append(e&255);else if(e>=0&&e<=255)this._bufferBuilder.append(204),this.pack_uint8(e);else if(e>=-128&&e<=127)this._bufferBuilder.append(208),this.pack_int8(e);else if(e>=0&&e<=65535)this._bufferBuilder.append(205),this.pack_uint16(e);else if(e>=-32768&&e<=32767)this._bufferBuilder.append(209),this.pack_int16(e);else if(e>=0&&e<=4294967295)this._bufferBuilder.append(206),this.pack_uint32(e);else if(e>=-2147483648&&e<=2147483647)this._bufferBuilder.append(210),this.pack_int32(e);else if(e>=-0x8000000000000000&&e<=0x8000000000000000)this._bufferBuilder.append(211),this.pack_int64(e);else if(e>=0&&e<=0x10000000000000000)this._bufferBuilder.append(207),this.pack_uint64(e);else throw Error(`Invalid integer`)}pack_double(e){let t=0;e<0&&(t=1,e=-e);let n=Math.floor(Math.log(e)/Math.LN2),r=e/2**n-1,i=Math.floor(r*2**52),a=2**32,o=t<<31|n+1023<<20|i/a&1048575,s=i%a;this._bufferBuilder.append(203),this.pack_int32(o),this.pack_int32(s)}pack_object(e){let t=Object.keys(e),n=t.length;if(n<=15)this.pack_uint8(128+n);else if(n<=65535)this._bufferBuilder.append(222),this.pack_uint16(n);else if(n<=4294967295)this._bufferBuilder.append(223),this.pack_uint32(n);else throw Error(`Invalid length`);let r=n=>{if(nr(n+1))}return r(n+1)}};return r(0)}pack_uint8(e){this._bufferBuilder.append(e)}pack_uint16(e){this._bufferBuilder.append(e>>8),this._bufferBuilder.append(e&255)}pack_uint32(e){let t=e&4294967295;this._bufferBuilder.append((t&4278190080)>>>24),this._bufferBuilder.append((t&16711680)>>>16),this._bufferBuilder.append((t&65280)>>>8),this._bufferBuilder.append(t&255)}pack_uint64(e){let t=e/2**32,n=e%2**32;this._bufferBuilder.append((t&4278190080)>>>24),this._bufferBuilder.append((t&16711680)>>>16),this._bufferBuilder.append((t&65280)>>>8),this._bufferBuilder.append(t&255),this._bufferBuilder.append((n&4278190080)>>>24),this._bufferBuilder.append((n&16711680)>>>16),this._bufferBuilder.append((n&65280)>>>8),this._bufferBuilder.append(n&255)}pack_int8(e){this._bufferBuilder.append(e&255)}pack_int16(e){this._bufferBuilder.append((e&65280)>>8),this._bufferBuilder.append(e&255)}pack_int32(e){this._bufferBuilder.append(e>>>24&255),this._bufferBuilder.append((e&16711680)>>>16),this._bufferBuilder.append((e&65280)>>>8),this._bufferBuilder.append(e&255)}pack_int64(e){let t=Math.floor(e/2**32),n=e%2**32;this._bufferBuilder.append((t&4278190080)>>>24),this._bufferBuilder.append((t&16711680)>>>16),this._bufferBuilder.append((t&65280)>>>8),this._bufferBuilder.append(t&255),this._bufferBuilder.append((n&4278190080)>>>24),this._bufferBuilder.append((n&16711680)>>>16),this._bufferBuilder.append((n&65280)>>>8),this._bufferBuilder.append(n&255)}constructor(){this._bufferBuilder=new r,this._textEncoder=new TextEncoder}},l=!0,u=!0;function d(e,t,n){let r=e.match(t);return r&&r.length>=n&&parseFloat(r[n],10)}function f(e,t,n){if(!e.RTCPeerConnection)return;let r=e.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return i.apply(this,arguments);let a=e=>{let t=n(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,a),i.apply(this,[e,a])};let a=r.removeEventListener;r.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t]||!this._eventMap[t].has(n))return a.apply(this,arguments);let r=this._eventMap[t].get(n);return this._eventMap[t].delete(n),this._eventMap[t].size===0&&delete this._eventMap[t],Object.keys(this._eventMap).length===0&&delete this._eventMap,a.apply(this,[e,r])},Object.defineProperty(r,`on`+t,{get(){return this[`_on`+t]},set(e){this[`_on`+t]&&(this.removeEventListener(t,this[`_on`+t]),delete this[`_on`+t]),e&&this.addEventListener(t,this[`_on`+t]=e)},enumerable:!0,configurable:!0})}function p(e){return typeof e==`boolean`?(l=e,e?`adapter.js logging disabled`:`adapter.js logging enabled`):Error(`Argument type: `+typeof e+`. Please use a boolean.`)}function ee(e){return typeof e==`boolean`?(u=!e,`adapter.js deprecation warnings `+(e?`disabled`:`enabled`)):Error(`Argument type: `+typeof e+`. Please use a boolean.`)}function te(){if(typeof window==`object`){if(l)return;typeof console<`u`&&typeof console.log==`function`&&console.log.apply(console,arguments)}}function m(e,t){u&&console.warn(e+` is deprecated, please use `+t+` instead.`)}function ne(e){let t={browser:null,version:null};if(e===void 0||!e.navigator||!e.navigator.userAgent)return t.browser=`Not a browser.`,t;let{navigator:n}=e;if(n.userAgentData&&n.userAgentData.brands){let e=n.userAgentData.brands.find(e=>e.brand===`Chromium`);if(e)return{browser:`chrome`,version:parseInt(e.version,10)}}if(n.mozGetUserMedia)t.browser=`firefox`,t.version=parseInt(d(n.userAgent,/Firefox\/(\d+)\./,1));else if(n.webkitGetUserMedia||e.isSecureContext===!1&&e.webkitRTCPeerConnection)t.browser=`chrome`,t.version=parseInt(d(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2));else if(e.RTCPeerConnection&&n.userAgent.match(/AppleWebKit\/(\d+)\./))t.browser=`safari`,t.version=parseInt(d(n.userAgent,/AppleWebKit\/(\d+)\./,1)),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&`currentDirection`in e.RTCRtpTransceiver.prototype,t._safariVersion=d(n.userAgent,/Version\/(\d+(\.?\d+))/,1);else return t.browser=`Not a supported browser.`,t;return t}function re(e){return Object.prototype.toString.call(e)===`[object Object]`}function ie(e){return re(e)?Object.keys(e).reduce(function(t,n){let r=re(e[n]),i=r?ie(e[n]):e[n],a=r&&!Object.keys(i).length;return i===void 0||a?t:Object.assign(t,{[n]:i})},{}):e}function ae(e,t,n){!t||n.has(t.id)||(n.set(t.id,t),Object.keys(t).forEach(r=>{r.endsWith(`Id`)?ae(e,e.get(t[r]),n):r.endsWith(`Ids`)&&t[r].forEach(t=>{ae(e,e.get(t),n)})}))}function oe(e,t,n){let r=n?`outbound-rtp`:`inbound-rtp`,i=new Map;if(t===null)return i;let a=[];return e.forEach(e=>{e.type===`track`&&e.trackIdentifier===t.id&&a.push(e)}),a.forEach(t=>{e.forEach(n=>{n.type===r&&n.trackId===t.id&&ae(e,n,i)})}),i}var se=te;function ce(e,t){let n=e&&e.navigator;if(!n.mediaDevices)return;let r=function(e){if(typeof e!=`object`||e.mandatory||e.optional)return e;let t={};return Object.keys(e).forEach(n=>{if(n===`require`||n===`advanced`||n===`mediaSource`)return;let r=typeof e[n]==`object`?e[n]:{ideal:e[n]};r.exact!==void 0&&typeof r.exact==`number`&&(r.min=r.max=r.exact);let i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):t===`deviceId`?`sourceId`:t};if(r.ideal!==void 0){t.optional=t.optional||[];let e={};typeof r.ideal==`number`?(e[i(`min`,n)]=r.ideal,t.optional.push(e),e={},e[i(`max`,n)]=r.ideal,t.optional.push(e)):(e[i(``,n)]=r.ideal,t.optional.push(e))}r.exact!==void 0&&typeof r.exact!=`number`?(t.mandatory=t.mandatory||{},t.mandatory[i(``,n)]=r.exact):[`min`,`max`].forEach(e=>{r[e]!==void 0&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])})}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if(e=JSON.parse(JSON.stringify(e)),e&&typeof e.audio==`object`){let t=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};e=JSON.parse(JSON.stringify(e)),t(e.audio,`autoGainControl`,`googAutoGainControl`),t(e.audio,`noiseSuppression`,`googNoiseSuppression`),e.audio=r(e.audio)}if(e&&typeof e.video==`object`){let a=e.video.facingMode;a&&=typeof a==`object`?a:{ideal:a};let o=t.version<66;if(a&&(a.exact===`user`||a.exact===`environment`||a.ideal===`user`||a.ideal===`environment`)&&!(n.mediaDevices.getSupportedConstraints&&n.mediaDevices.getSupportedConstraints().facingMode&&!o)){delete e.video.facingMode;let t;if(a.exact===`environment`||a.ideal===`environment`?t=[`back`,`rear`]:(a.exact===`user`||a.ideal===`user`)&&(t=[`front`]),t)return n.mediaDevices.enumerateDevices().then(n=>{n=n.filter(e=>e.kind===`videoinput`);let o=n.find(e=>t.some(t=>e.label.toLowerCase().includes(t)));return!o&&n.length&&t.includes(`back`)&&(o=n[n.length-1]),o&&(e.video.deviceId=a.exact?{exact:o.deviceId}:{ideal:o.deviceId}),e.video=r(e.video),se(`chrome: `+JSON.stringify(e)),i(e)})}e.video=r(e.video)}return se(`chrome: `+JSON.stringify(e)),i(e)},a=function(e){return t.version>=64?e:{name:{PermissionDeniedError:`NotAllowedError`,PermissionDismissedError:`NotAllowedError`,InvalidStateError:`NotAllowedError`,DevicesNotFoundError:`NotFoundError`,ConstraintNotSatisfiedError:`OverconstrainedError`,TrackStartError:`NotReadableError`,MediaDeviceFailedDueToShutdown:`NotAllowedError`,MediaDeviceKillSwitchOn:`NotAllowedError`,TabCaptureError:`AbortError`,ScreenCaptureError:`AbortError`,DeviceCaptureError:`AbortError`}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&`: `)+this.message}}};if(n.getUserMedia=function(e,t,r){i(e,e=>{n.webkitGetUserMedia(e,t,e=>{r&&r(a(e))})})}.bind(n),n.mediaDevices.getUserMedia){let e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(t){return i(t,t=>e(t).then(e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach(e=>{e.stop()}),new DOMException(``,`NotFoundError`);return e},e=>Promise.reject(a(e))))}}}var le=t({fixNegotiationNeeded:()=>_e,shimAddTrackRemoveTrack:()=>he,shimAddTrackRemoveTrackWithNative:()=>me,shimGetSendersWithDtmf:()=>fe,shimGetUserMedia:()=>ce,shimMediaStream:()=>ue,shimOnTrack:()=>de,shimPeerConnection:()=>ge,shimSenderReceiverGetStats:()=>pe});function ue(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function de(e){if(typeof e==`object`&&e.RTCPeerConnection&&!(`ontrack`in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,`ontrack`,{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener(`track`,this._ontrack),this.addEventListener(`track`,this._ontrack=e)},enumerable:!0,configurable:!0});let t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener(`addtrack`,n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.track.id):{track:n.track};let i=new Event(`track`);i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)}),t.stream.getTracks().forEach(n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.id):{track:n};let i=new Event(`track`);i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)})},this.addEventListener(`addstream`,this._ontrackpoly)),t.apply(this,arguments)}}else f(e,`track`,e=>(e.transceiver||Object.defineProperty(e,`transceiver`,{value:{receiver:e.receiver}}),e))}function fe(e){if(typeof e==`object`&&e.RTCPeerConnection&&!(`getSenders`in e.RTCPeerConnection.prototype)&&`createDTMFSender`in e.RTCPeerConnection.prototype){let t=function(e,t){return{track:t,get dtmf(){return this._dtmf===void 0&&(t.kind===`audio`?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};let n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){let i=n.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};let r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);let t=this._senders.indexOf(e);t!==-1&&this._senders.splice(t,1)}}let n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach(e=>{this._senders.push(t(this,e))})};let r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach(e=>{let t=this._senders.find(t=>t.track===e);t&&this._senders.splice(this._senders.indexOf(t),1)})}}else if(typeof e==`object`&&e.RTCPeerConnection&&`getSenders`in e.RTCPeerConnection.prototype&&`createDTMFSender`in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!(`dtmf`in e.RTCRtpSender.prototype)){let t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e},Object.defineProperty(e.RTCRtpSender.prototype,`dtmf`,{get(){return this._dtmf===void 0&&(this.track.kind===`audio`?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function pe(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!(`getStats`in e.RTCRtpSender.prototype)){let t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});let n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){let e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){let e=this;return this._pc.getStats().then(t=>oe(t,e.track,!0))}}if(!(`getStats`in e.RTCRtpReceiver.prototype)){let t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),f(e,`track`,e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){let e=this;return this._pc.getStats().then(t=>oe(t,e.track,!1))}}if(!(`getStats`in e.RTCRtpSender.prototype&&`getStats`in e.RTCRtpReceiver.prototype))return;let t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){let e=arguments[0],t,n,r;return this.getSenders().forEach(n=>{n.track===e&&(t?r=!0:t=n)}),this.getReceivers().forEach(t=>(t.track===e&&(n?r=!0:n=t),t.track===e)),r||t&&n?Promise.reject(new DOMException(`There are more than one sender or receiver for the track.`,`InvalidAccessError`)):t?t.getStats():n?n.getStats():Promise.reject(new DOMException(`There is no sender or receiver for the track.`,`InvalidAccessError`))}return t.apply(this,arguments)}}function me(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(e=>this._shimmedLocalStreams[e][0])};let t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};let r=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?this._shimmedLocalStreams[n.id].indexOf(r)===-1&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};let n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException(`Track already exists.`,`InvalidAccessError`)});let t=this.getSenders();n.apply(this,arguments);let r=this.getSenders().filter(e=>t.indexOf(e)===-1);this._shimmedLocalStreams[e.id]=[e].concat(r)};let r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};let i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(t=>{let n=this._shimmedLocalStreams[t].indexOf(e);n!==-1&&this._shimmedLocalStreams[t].splice(n,1),this._shimmedLocalStreams[t].length===1&&delete this._shimmedLocalStreams[t]}),i.apply(this,arguments)}}function he(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return me(e);let n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){let e=n.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map(e=>this._reverseStreams[e.id])};let r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException(`Track already exists.`,`InvalidAccessError`)}),!this._reverseStreams[t.id]){let n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};let i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,n){if(this.signalingState===`closed`)throw new DOMException(`The RTCPeerConnection's signalingState is 'closed'.`,`InvalidStateError`);let r=[].slice.call(arguments,1);if(r.length!==1||!r[0].getTracks().find(e=>e===t))throw new DOMException(`The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.`,`NotSupportedError`);if(this.getSenders().find(e=>e.track===t))throw new DOMException(`Track already exists.`,`InvalidAccessError`);this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};let i=this._streams[n.id];if(i)i.addTrack(t),Promise.resolve().then(()=>{this.dispatchEvent(new Event(`negotiationneeded`))});else{let r=new e.MediaStream([t]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find(e=>e.track===t)};function a(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{let r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(i.id,`g`),r.id)}),new RTCSessionDescription({type:t.type,sdp:n})}function o(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{let r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(r.id,`g`),i.id)}),new RTCSessionDescription({type:t.type,sdp:n})}[`createOffer`,`createAnswer`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){let e=arguments;return arguments.length&&typeof arguments[0]==`function`?n.apply(this,[t=>{let n=a(this,t);e[0].apply(null,[n])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):n.apply(this,arguments).then(e=>a(this,e))}};e.RTCPeerConnection.prototype[t]=r[t]});let s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type||(arguments[0]=o(this,arguments[0])),s.apply(this,arguments)};let c=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,`localDescription`);Object.defineProperty(e.RTCPeerConnection.prototype,`localDescription`,{get(){let e=c.get.apply(this);return e.type===``?e:a(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if(this.signalingState===`closed`)throw new DOMException(`The RTCPeerConnection's signalingState is 'closed'.`,`InvalidStateError`);if(!e._pc)throw new DOMException(`Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.`,`TypeError`);if(e._pc!==this)throw new DOMException(`Sender was not created by this connection.`,`InvalidAccessError`);this._streams=this._streams||{};let t;Object.keys(this._streams).forEach(n=>{this._streams[n].getTracks().find(t=>e.track===t)&&(t=this._streams[n])}),t&&(t.getTracks().length===1?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event(`negotiationneeded`)))}}function ge(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&[`setLocalDescription`,`setRemoteDescription`,`addIceCandidate`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new(t===`addIceCandidate`?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]})}function _e(e,t){f(e,`negotiationneeded`,e=>{let n=e.target;if(!((t.version<72||n.getConfiguration&&n.getConfiguration().sdpSemantics===`plan-b`)&&n.signalingState!==`stable`))return e})}function ve(e,t){let n=e&&e.navigator,r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){m(`navigator.getUserMedia`,`navigator.mediaDevices.getUserMedia`),n.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&`autoGainControl`in n.mediaDevices.getSupportedConstraints())){let e=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return typeof n==`object`&&typeof n.audio==`object`&&(n=JSON.parse(JSON.stringify(n)),e(n.audio,`autoGainControl`,`mozAutoGainControl`),e(n.audio,`noiseSuppression`,`mozNoiseSuppression`)),t(n)},r&&r.prototype.getSettings){let t=r.prototype.getSettings;r.prototype.getSettings=function(){let n=t.apply(this,arguments);return e(n,`mozAutoGainControl`,`autoGainControl`),e(n,`mozNoiseSuppression`,`noiseSuppression`),n}}if(r&&r.prototype.applyConstraints){let t=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return this.kind===`audio`&&typeof n==`object`&&(n=JSON.parse(JSON.stringify(n)),e(n,`autoGainControl`,`mozAutoGainControl`),e(n,`noiseSuppression`,`mozNoiseSuppression`)),t.apply(this,[n])}}}}function ye(e,t){e.navigator.mediaDevices&&`getDisplayMedia`in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!(n&&n.video)){let e=new DOMException(`getDisplayMedia without video constraints is undefined`);return e.name=`NotFoundError`,e.code=8,Promise.reject(e)}return n.video===!0?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)})}var be=t({shimAddTransceiver:()=>Ee,shimCreateAnswer:()=>ke,shimCreateOffer:()=>Oe,shimGetDisplayMedia:()=>ye,shimGetParameters:()=>De,shimGetUserMedia:()=>ve,shimOnTrack:()=>xe,shimPeerConnection:()=>h,shimRTCDataChannel:()=>Te,shimReceiverGetStats:()=>Ce,shimRemoveStream:()=>we,shimSenderGetStats:()=>Se});function xe(e){typeof e==`object`&&e.RTCTrackEvent&&`receiver`in e.RTCTrackEvent.prototype&&!(`transceiver`in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,`transceiver`,{get(){return{receiver:this.receiver}}})}function h(e,t){if(typeof e!=`object`||!(e.RTCPeerConnection||e.mozRTCPeerConnection))return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&[`setLocalDescription`,`setRemoteDescription`,`addIceCandidate`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new(t===`addIceCandidate`?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]});let n={inboundrtp:`inbound-rtp`,outboundrtp:`outbound-rtp`,candidatepair:`candidate-pair`,localcandidate:`local-candidate`,remotecandidate:`remote-candidate`},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){let[e,i,a]=arguments;return r.apply(this,[e||null]).then(e=>{if(t.version<53&&!i)try{e.forEach(e=>{e.type=n[e.type]||e.type})}catch(t){if(t.name!==`TypeError`)throw t;e.forEach((t,r)=>{e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))})}return e}).then(i,a)}}function Se(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&`getStats`in e.RTCRtpSender.prototype)return;let t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});let n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){let e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function Ce(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&`getStats`in e.RTCRtpReceiver.prototype)return;let t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),f(e,`track`,e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function we(e){!e.RTCPeerConnection||`removeStream`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){m(`removeStream`,`removeTrack`),this.getSenders().forEach(t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)})})}function Te(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function Ee(e){if(!(typeof e==`object`&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;e===void 0&&(e=[]),e=[...e];let n=e.length>0;n&&e.forEach(e=>{if(`rid`in e&&!/^[a-z0-9]{0,16}$/i.test(e.rid))throw TypeError(`Invalid RID value provided.`);if(`scaleResolutionDownBy`in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw RangeError(`scale_resolution_down_by must be >= 1.0`);if(`maxFramerate`in e&&!(parseFloat(e.maxFramerate)>=0))throw RangeError(`max_framerate must be >= 0.0`)});let r=t.apply(this,arguments);if(n){let{sender:t}=r,n=t.getParameters();(!(`encodings`in n)||n.encodings.length===1&&Object.keys(n.encodings[0]).length===0)&&(n.encodings=e,t.sendEncodings=e,this.setParametersPromises.push(t.setParameters(n).then(()=>{delete t.sendEncodings}).catch(()=>{delete t.sendEncodings})))}return r})}function De(e){if(!(typeof e==`object`&&e.RTCRtpSender))return;let t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){let e=t.apply(this,arguments);return`encodings`in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function Oe(e){if(!(typeof e==`object`&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function ke(e){if(!(typeof e==`object`&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}var Ae=t({shimAudioContext:()=>ze,shimCallbacksAPI:()=>Ne,shimConstraints:()=>Fe,shimCreateOfferLegacy:()=>Re,shimGetUserMedia:()=>Pe,shimLocalStreamsAPI:()=>je,shimRTCIceServerUrls:()=>Ie,shimRemoteStreamsAPI:()=>Me,shimTrackEventTransceiver:()=>Le});function je(e){if(!(typeof e!=`object`||!e.RTCPeerConnection)){if(`getLocalStreams`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||=[],this._localStreams}),!(`addStream`in e.RTCPeerConnection.prototype)){let t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||=[],this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(n=>t.call(this,n,e)),e.getVideoTracks().forEach(n=>t.call(this,n,e))},e.RTCPeerConnection.prototype.addTrack=function(e,...n){return n&&n.forEach(e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]}),t.apply(this,arguments)}}`removeStream`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||=[];let t=this._localStreams.indexOf(e);if(t===-1)return;this._localStreams.splice(t,1);let n=e.getTracks();this.getSenders().forEach(e=>{n.includes(e.track)&&this.removeTrack(e)})})}}function Me(e){if(!(typeof e!=`object`||!e.RTCPeerConnection)&&(`getRemoteStreams`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!(`onaddstream`in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,`onaddstream`,{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener(`addstream`,this._onaddstream),this.removeEventListener(`track`,this._onaddstreampoly)),this.addEventListener(`addstream`,this._onaddstream=e),this.addEventListener(`track`,this._onaddstreampoly=e=>{e.streams.forEach(e=>{if(this._remoteStreams||=[],this._remoteStreams.includes(e))return;this._remoteStreams.push(e);let t=new Event(`addstream`);t.stream=e,this.dispatchEvent(t)})})}});let t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){let e=this;return this._onaddstreampoly||this.addEventListener(`track`,this._onaddstreampoly=function(t){t.streams.forEach(t=>{if(e._remoteStreams||=[],e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);let n=new Event(`addstream`);n.stream=t,e.dispatchEvent(n)})}),t.apply(e,arguments)}}}function Ne(e){if(typeof e!=`object`||!e.RTCPeerConnection)return;let t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,a=t.setRemoteDescription,o=t.addIceCandidate;t.createOffer=function(e,t){let r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){let n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};let s=function(e,t,n){let r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=s,s=function(e,t,n){let r=a.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=s,s=function(e,t,n){let r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=s}function Pe(e){let t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){let e=t.mediaDevices,n=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>n(Fe(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t))}function Fe(e){return e&&e.video!==void 0?Object.assign({},e,{video:ie(e.video)}):e}function Ie(e){if(!e.RTCPeerConnection)return;let t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){let t=[];for(let n=0;ne.receiver.track.kind===`audio`);e.offerToReceiveAudio===!1&&t?t.direction===`sendrecv`?t.setDirection?t.setDirection(`sendonly`):t.direction=`sendonly`:t.direction===`recvonly`&&(t.setDirection?t.setDirection(`inactive`):t.direction=`inactive`):e.offerToReceiveAudio===!0&&!t&&this.addTransceiver(`audio`,{direction:`recvonly`}),e.offerToReceiveVideo!==void 0&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);let n=this.getTransceivers().find(e=>e.receiver.track.kind===`video`);e.offerToReceiveVideo===!1&&n?n.direction===`sendrecv`?n.setDirection?n.setDirection(`sendonly`):n.direction=`sendonly`:n.direction===`recvonly`&&(n.setDirection?n.setDirection(`inactive`):n.direction=`inactive`):e.offerToReceiveVideo===!0&&!n&&this.addTransceiver(`video`,{direction:`recvonly`})}return t.apply(this,arguments)}}function ze(e){typeof e!=`object`||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Be=e(((e,t)=>{var n={};n.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},n.localCName=n.generateIdentifier(),n.splitLines=function(e){return e.trim().split(` `).map(e=>e.trim())},n.splitSections=function(e){return e.split(` m=`).map((e,t)=>(t>0?`m=`+e:e).trim()+`\r `)},n.getDescription=function(e){let t=n.splitSections(e);return t&&t[0]},n.getMediaSections=function(e){let t=n.splitSections(e);return t.shift(),t},n.matchPrefix=function(e,t){return n.splitLines(e).filter(e=>e.indexOf(t)===0)},n.parseCandidate=function(e){let t;t=e.indexOf(`a=candidate:`)===0?e.substring(12).split(` `):e.substring(10).split(` `);let n={foundation:t[0],component:{1:`rtp`,2:`rtcp`}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let e=8;e{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self,n.html2canvas=r())})(e,(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}var n=function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&a[a.length-1]))&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]=55296&&i<=56319&&n>10)+55296,a%1024+56320)),(r+1===t||n.length>16384)&&(i+=String.fromCharCode.apply(String,n),n.length=0)}return i},d=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,f=typeof Uint8Array>`u`?[]:new Uint8Array(256),p=0;p`u`?[]:new Uint8Array(256),g=0;g>4,u[i++]=(o&15)<<4|s>>2,u[i++]=(s&3)<<6|c&63;return l},v=function(e){for(var t=e.length,n=[],r=0;r>b,T=(1<>b)+32,D=65536>>x,O=(1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>b],t=(t<>b)],t=(t<>x),t=this.index[t],t+=e>>b&O,t=this.index[t],t=(t<`u`?[]:new Uint8Array(256),oe=0;oece?(i.push(!0),o-=ce):i.push(!1),[`normal`,`auto`,`loose`].indexOf(t)!==-1&&[8208,8211,12316,12448].indexOf(e)!==-1)return r.push(a),n.push(Ce);if(o===fe||o===ve){if(a===0)return r.push(a),n.push(Ie);var s=n[a-1];return rt.indexOf(s)===-1?(r.push(r[a-1]),n.push(s)):(r.push(a),n.push(Ie))}if(r.push(a),o===Le)return n.push(t===`strict`?Oe:Ue);if(o===Je||o===Fe)return n.push(Ie);if(o===Ye)return e>=131072&&e<=196605||e>=196608&&e<=262141?n.push(Ue):n.push(Ie);n.push(o)}),[r,n,i]},st=function(e,t,n,r){var i=r[n];if(Array.isArray(e)?e.indexOf(i)!==-1:e===i)for(var a=n;a<=r.length;){a++;var o=r[a];if(o===t)return!0;if(o!==_e)break}if(i===_e)for(var a=n;a>0;){a--;var s=r[a];if(Array.isArray(e)?e.indexOf(s)!==-1:e===s)for(var c=n;c<=r.length;){c++;var o=r[c];if(o===t)return!0;if(o!==_e)break}if(s!==_e)break}return!1},ct=function(e,t){for(var n=e;n>=0;){var r=t[n];if(r===_e)n--;else return r}return 0},lt=function(e,t,n,r,i){if(n[r]===0)return A;var a=r-1;if(Array.isArray(i)&&i[a]===!0)return A;var o=a-1,s=a+1,c=t[a],l=o>=0?t[o]:0,u=t[s];if(c===ue&&u===de)return A;if(et.indexOf(c)!==-1)return Ze;if(et.indexOf(u)!==-1||tt.indexOf(u)!==-1)return A;if(ct(a,t)===he)return Qe;if($e.get(e[a])===ve||(c===Re||c===ze)&&$e.get(e[s])===ve||c===me||u===me||c===ge||[_e,be,Se].indexOf(c)===-1&&u===ge||[we,Te,Ee,je,Pe].indexOf(u)!==-1||ct(a,t)===ke||st(Ae,ke,a,t)||st([we,Te],Oe,a,t)||st(ye,ye,a,t))return A;if(c===_e)return Qe;if(c===Ae||u===Ae)return A;if(u===Ce||c===Ce)return Qe;if([be,Se,Oe].indexOf(u)!==-1||c===xe||l===He&&at.indexOf(c)!==-1||c===Pe&&u===He||u===De||j.indexOf(u)!==-1&&c===k||j.indexOf(c)!==-1&&u===k||c===Ne&&[Ue,Re,ze].indexOf(u)!==-1||[Ue,Re,ze].indexOf(c)!==-1&&u===Me||j.indexOf(c)!==-1&&nt.indexOf(u)!==-1||nt.indexOf(c)!==-1&&j.indexOf(u)!==-1||[Ne,Me].indexOf(c)!==-1&&(u===k||[ke,Se].indexOf(u)!==-1&&t[s+1]===k)||[ke,Se].indexOf(c)!==-1&&u===k||c===k&&[k,Pe,je].indexOf(u)!==-1)return A;if([k,Pe,je,we,Te].indexOf(u)!==-1)for(var d=a;d>=0;){var f=t[d];if(f===k)return A;if([Pe,je].indexOf(f)!==-1)d--;else break}if([Ne,Me].indexOf(u)!==-1)for(var d=[we,Te].indexOf(c)===-1?a:o;d>=0;){var f=t[d];if(f===k)return A;if([Pe,je].indexOf(f)!==-1)d--;else break}if(We===c&&[We,Ge,Be,Ve].indexOf(u)!==-1||[Ge,Be].indexOf(c)!==-1&&[Ge,Ke].indexOf(u)!==-1||[Ke,Ve].indexOf(c)!==-1&&u===Ke||it.indexOf(c)!==-1&&[De,Me].indexOf(u)!==-1||it.indexOf(u)!==-1&&c===Ne||j.indexOf(c)!==-1&&j.indexOf(u)!==-1||c===je&&j.indexOf(u)!==-1||j.concat(k).indexOf(c)!==-1&&u===ke&&Xe.indexOf(e[s])===-1||j.concat(k).indexOf(u)!==-1&&c===Te)return A;if(c===qe&&u===qe){for(var p=n[a],m=1;p>0&&(p--,t[p]===qe);)m++;if(m%2!=0)return A}return c===Re&&u===ze?A:Qe},ut=function(e,t){t||={lineBreak:`normal`,wordBreak:`normal`};var n=ot(e,t.lineBreak),r=n[0],i=n[1],a=n[2];(t.wordBreak===`break-all`||t.wordBreak===`break-word`)&&(i=i.map(function(e){return[k,Ie,Je].indexOf(e)===-1?e:Ue}));var o=t.wordBreak===`keep-all`?a.map(function(t,n){return t&&e[n]>=19968&&e[n]<=40959}):void 0;return[r,i,o]},dt=function(){function e(e,t,n,r){this.codePoints=e,this.required=t===Ze,this.start=n,this.end=r}return e.prototype.slice=function(){return u.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),ft=function(e,t){var n=l(e),r=ut(n,t),i=r[0],a=r[1],o=r[2],s=n.length,c=0,u=0;return{next:function(){if(u>=s)return{done:!0,value:null};for(var e=A;u=rn&&e<=57},hn=function(e){return e>=55296&&e<=57343},gn=function(e){return P(e)||e>=un&&e<=fn||e>=an&&e<=sn},_n=function(e){return e>=an&&e<=ln},vn=function(e){return e>=un&&e<=mn},yn=function(e){return _n(e)||vn(e)},bn=function(e){return e>=Ut},xn=function(e){return e===_t||e===bt||e===xt},Sn=function(e){return yn(e)||bn(e)||e===At},Cn=function(e){return Sn(e)||P(e)||e===M},wn=function(e){return e>=Zt&&e<=Qt||e===$t||e>=en&&e<=tn||e===nn},Tn=function(e,t){return e===yt?t!==_t:!1},En=function(e,t,n){return e===M?Sn(t)||Tn(t,n):Sn(e)?!0:!!(e===yt&&Tn(e,t))},Dn=function(e,t,n){return e===Kt||e===M?P(t)?!0:t===Xt&&P(n):P(e===Xt?t:e)},On=function(e){var t=0,n=1;(e[t]===Kt||e[t]===M)&&(e[t]===M&&(n=-1),t++);for(var r=[];P(e[t]);)r.push(e[t++]);var i=r.length?parseInt(u.apply(void 0,r),10):0;e[t]===Xt&&t++;for(var a=[];P(e[t]);)a.push(e[t++]);var o=a.length,s=o?parseInt(u.apply(void 0,a),10):0;(e[t]===dn||e[t]===on)&&t++;var c=1;(e[t]===Kt||e[t]===M)&&(e[t]===M&&(c=-1),t++);for(var l=[];P(e[t]);)l.push(e[t++]);var d=l.length?parseInt(u.apply(void 0,l),10):0;return n*(i+s*10**-o)*10**(c*d)},kn={type:2},An={type:3},jn={type:4},Mn={type:13},Nn={type:8},Pn={type:21},Fn={type:9},In={type:10},Ln={type:11},Rn={type:12},zn={type:14},Bn={type:23},Vn={type:1},Hn={type:25},Un={type:24},Wn={type:26},Gn={type:27},Kn={type:28},qn={type:29},Jn={type:31},Yn={type:32},Xn=function(){function e(){this._value=[]}return e.prototype.write=function(e){this._value=this._value.concat(l(e))},e.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==Yn;)e.push(t),t=this.consumeToken();return e},e.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case St:return this.consumeStringToken(St);case wt:var t=this.peekCodePoint(0),n=this.peekCodePoint(1),r=this.peekCodePoint(2);if(Cn(t)||Tn(n,r)){var i=En(t,n,r)?mt:pt,a=this.consumeName();return{type:5,value:a,flags:i}}break;case Tt:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),Mn;break;case Dt:return this.consumeStringToken(Dt);case Ot:return kn;case kt:return An;case Gt:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),zn;break;case Kt:if(Dn(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case qt:return jn;case M:var o=e,s=this.peekCodePoint(0),c=this.peekCodePoint(1);if(Dn(o,s,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(En(o,s,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(s===M&&c===Nt)return this.consumeCodePoint(),this.consumeCodePoint(),Un;break;case Xt:if(Dn(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case vt:if(this.peekCodePoint(0)===Gt)for(this.consumeCodePoint();;){var l=this.consumeCodePoint();if(l===Gt&&(l=this.consumeCodePoint(),l===vt)||l===N)return this.consumeToken()}break;case Jt:return Wn;case Yt:return Gn;case Mt:if(this.peekCodePoint(0)===jt&&this.peekCodePoint(1)===M&&this.peekCodePoint(2)===M)return this.consumeCodePoint(),this.consumeCodePoint(),Hn;break;case Pt:if(En(this.peekCodePoint(0),this.peekCodePoint(1),this.peekCodePoint(2))){var a=this.consumeName();return{type:7,value:a}}break;case Ft:return Kn;case yt:if(Tn(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case It:return qn;case Lt:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),Nn;break;case Rt:return Ln;case Bt:return Rn;case cn:case pn:var d=this.peekCodePoint(0),f=this.peekCodePoint(1);return d===Kt&&(gn(f)||f===zt)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case Vt:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),Fn;if(this.peekCodePoint(0)===Vt)return this.consumeCodePoint(),Pn;break;case Ht:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),In;break;case N:return Yn}return xn(e)?(this.consumeWhiteSpace(),Jn):P(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):Sn(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:u(e)}},e.prototype.consumeCodePoint=function(){var e=this._value.shift();return e===void 0?-1:e},e.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},e.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},e.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();gn(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var n=!1;t===zt&&e.length<6;)e.push(t),t=this.consumeCodePoint(),n=!0;if(n){var r=parseInt(u.apply(void 0,e.map(function(e){return e===zt?rn:e})),16),i=parseInt(u.apply(void 0,e.map(function(e){return e===zt?fn:e})),16);return{type:30,start:r,end:i}}var a=parseInt(u.apply(void 0,e),16);if(this.peekCodePoint(0)===M&&gn(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];gn(t)&&o.length<6;)o.push(t),t=this.consumeCodePoint();var i=parseInt(u.apply(void 0,o),16);return{type:30,start:a,end:i}}else return{type:30,start:a,end:a}},e.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()===`url`&&this.peekCodePoint(0)===Ot?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===Ot?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},e.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===N)return{type:22,value:``};var t=this.peekCodePoint(0);if(t===Dt||t===St){var n=this.consumeStringToken(this.consumeCodePoint());return n.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===N||this.peekCodePoint(0)===kt)?(this.consumeCodePoint(),{type:22,value:n.value}):(this.consumeBadUrlRemnants(),Bn)}for(;;){var r=this.consumeCodePoint();if(r===N||r===kt)return{type:22,value:u.apply(void 0,e)};if(xn(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===N||this.peekCodePoint(0)===kt?(this.consumeCodePoint(),{type:22,value:u.apply(void 0,e)}):(this.consumeBadUrlRemnants(),Bn);if(r===St||r===Dt||r===Ot||wn(r))return this.consumeBadUrlRemnants(),Bn;if(r===yt)if(Tn(r,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),Bn;else e.push(r)}},e.prototype.consumeWhiteSpace=function(){for(;xn(this.peekCodePoint(0));)this.consumeCodePoint()},e.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===kt||e===N)return;Tn(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},e.prototype.consumeStringSlice=function(e){for(var t=5e4,n=``;e>0;){var r=Math.min(t,e);n+=u.apply(void 0,this._value.splice(0,r)),e-=r}return this._value.shift(),n},e.prototype.consumeStringToken=function(e){var t=``,n=0;do{var r=this._value[n];if(r===N||r===void 0||r===e)return t+=this.consumeStringSlice(n),{type:0,value:t};if(r===_t)return this._value.splice(0,n),Vn;if(r===yt){var i=this._value[n+1];i!==N&&i!==void 0&&(i===_t?(t+=this.consumeStringSlice(n),n=-1,this._value.shift()):Tn(r,i)&&(t+=this.consumeStringSlice(n),t+=u(this.consumeEscapedCodePoint()),n=-1))}n++}while(!0)},e.prototype.consumeNumber=function(){var e=[],t=ht,n=this.peekCodePoint(0);for((n===Kt||n===M)&&e.push(this.consumeCodePoint());P(this.peekCodePoint(0));)e.push(this.consumeCodePoint());n=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(n===Xt&&P(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=gt;P(this.peekCodePoint(0));)e.push(this.consumeCodePoint());n=this.peekCodePoint(0),r=this.peekCodePoint(1);var i=this.peekCodePoint(2);if((n===dn||n===on)&&((r===Kt||r===M)&&P(i)||P(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=gt;P(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[On(e),t]},e.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],n=e[1],r=this.peekCodePoint(0);return En(r,this.peekCodePoint(1),this.peekCodePoint(2))?{type:15,number:t,flags:n,unit:this.consumeName()}:r===Et?(this.consumeCodePoint(),{type:16,number:t,flags:n}):{type:17,number:t,flags:n}},e.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(gn(e)){for(var t=u(e);gn(this.peekCodePoint(0))&&t.length<6;)t+=u(this.consumeCodePoint());xn(this.peekCodePoint(0))&&this.consumeCodePoint();var n=parseInt(t,16);return n===0||hn(n)||n>1114111?Wt:n}return e===N?Wt:e},e.prototype.consumeName=function(){for(var e=``;;){var t=this.consumeCodePoint();if(Cn(t))e+=u(t);else if(Tn(t,this.peekCodePoint(0)))e+=u(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},e}(),Zn=function(){function e(e){this._tokens=e}return e.create=function(t){var n=new Xn;return n.write(t),new e(n.read())},e.parseValue=function(t){return e.create(t).parseComponentValue()},e.parseValues=function(t){return e.create(t).parseComponentValues()},e.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw SyntaxError(`Error parsing CSS component value, unexpected EOF`);this.reconsumeToken(e);var t=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return t;throw SyntaxError(`Error parsing CSS component value, multiple values found when expecting only one`)},e.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},e.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},e.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},n=this.consumeToken();;){if(n.type===32||ir(n,e))return t;this.reconsumeToken(n),t.values.push(this.consumeComponentValue()),n=this.consumeToken()}},e.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var n=this.consumeToken();if(n.type===32||n.type===3)return t;this.reconsumeToken(n),t.values.push(this.consumeComponentValue())}},e.prototype.consumeToken=function(){var e=this._tokens.shift();return e===void 0?Yn:e},e.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},e}(),Qn=function(e){return e.type===15},$n=function(e){return e.type===17},F=function(e){return e.type===20},er=function(e){return e.type===0},tr=function(e,t){return F(e)&&e.value===t},nr=function(e){return e.type!==31},rr=function(e){return e.type!==31&&e.type!==4},I=function(e){var t=[],n=[];return e.forEach(function(e){if(e.type===4){if(n.length===0)throw Error(`Error parsing function args, zero tokens for arg`);t.push(n),n=[];return}e.type!==31&&n.push(e)}),n.length&&t.push(n),t},ir=function(e,t){return t===11&&e.type===12||t===28&&e.type===29?!0:t===2&&e.type===3},ar=function(e){return e.type===17||e.type===15},L=function(e){return e.type===16||ar(e)},or=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},R={type:17,number:0,flags:ht},sr={type:16,number:50,flags:ht},cr={type:16,number:100,flags:ht},lr=function(e,t,n){var r=e[0],i=e[1];return[z(r,t),z(i===void 0?r:i,n)]},z=function(e,t){if(e.type===16)return e.number/100*t;if(Qn(e))switch(e.unit){case`rem`:case`em`:return 16*e.number;case`px`:default:return e.number}return e.number},ur=`deg`,dr=`grad`,fr=`rad`,pr=`turn`,mr={name:`angle`,parse:function(e,t){if(t.type===15)switch(t.unit){case ur:return Math.PI*t.number/180;case dr:return Math.PI/200*t.number;case fr:return t.number;case pr:return Math.PI*2*t.number}throw Error(`Unsupported angle type`)}},hr=function(e){return e.type===15&&(e.unit===ur||e.unit===dr||e.unit===fr||e.unit===pr)},gr=function(e){switch(e.filter(F).map(function(e){return e.value}).join(` `)){case`to bottom right`:case`to right bottom`:case`left top`:case`top left`:return[R,R];case`to top`:case`bottom`:return B(0);case`to bottom left`:case`to left bottom`:case`right top`:case`top right`:return[R,cr];case`to right`:case`left`:return B(90);case`to top left`:case`to left top`:case`right bottom`:case`bottom right`:return[cr,cr];case`to bottom`:case`top`:return B(180);case`to top right`:case`to right top`:case`left bottom`:case`bottom left`:return[cr,R];case`to left`:case`right`:return B(270)}return 0},B=function(e){return Math.PI*e/180},_r={name:`color`,parse:function(e,t){if(t.type===18){var n=wr[t.name];if(n===void 0)throw Error(`Attempting to parse an unsupported color function "`+t.name+`"`);return n(e,t.values)}if(t.type===5){if(t.value.length===3){var r=t.value.substring(0,1),i=t.value.substring(1,2),a=t.value.substring(2,3);return yr(parseInt(r+r,16),parseInt(i+i,16),parseInt(a+a,16),1)}if(t.value.length===4){var r=t.value.substring(0,1),i=t.value.substring(1,2),a=t.value.substring(2,3),o=t.value.substring(3,4);return yr(parseInt(r+r,16),parseInt(i+i,16),parseInt(a+a,16),parseInt(o+o,16)/255)}if(t.value.length===6){var r=t.value.substring(0,2),i=t.value.substring(2,4),a=t.value.substring(4,6);return yr(parseInt(r,16),parseInt(i,16),parseInt(a,16),1)}if(t.value.length===8){var r=t.value.substring(0,2),i=t.value.substring(2,4),a=t.value.substring(4,6),o=t.value.substring(6,8);return yr(parseInt(r,16),parseInt(i,16),parseInt(a,16),parseInt(o,16)/255)}}if(t.type===20){var s=H[t.value.toUpperCase()];if(s!==void 0)return s}return H.TRANSPARENT}},vr=function(e){return(255&e)==0},V=function(e){var t=255&e,n=255&e>>8,r=255&e>>16,i=255&e>>24;return t<255?`rgba(`+i+`,`+r+`,`+n+`,`+t/255+`)`:`rgb(`+i+`,`+r+`,`+n+`)`},yr=function(e,t,n,r){return(e<<24|t<<16|n<<8|Math.round(r*255)<<0)>>>0},br=function(e,t){if(e.type===17)return e.number;if(e.type===16){var n=t===3?1:255;return t===3?e.number/100*n:Math.round(e.number/100*n)}return 0},xr=function(e,t){var n=t.filter(rr);if(n.length===3){var r=n.map(br),i=r[0],a=r[1],o=r[2];return yr(i,a,o,1)}if(n.length===4){var s=n.map(br),i=s[0],a=s[1],o=s[2],c=s[3];return yr(i,a,o,c)}return 0};function Sr(e,t,n){return n<0&&(n+=1),n>=1&&--n,n<1/6?(t-e)*n*6+e:n<1/2?t:n<2/3?(t-e)*6*(2/3-n)+e:e}var Cr=function(e,t){var n=t.filter(rr),r=n[0],i=n[1],a=n[2],o=n[3],s=(r.type===17?B(r.number):mr.parse(e,r))/(Math.PI*2),c=L(i)?i.number/100:0,l=L(a)?a.number/100:0,u=o!==void 0&&L(o)?z(o,1):1;if(c===0)return yr(l*255,l*255,l*255,1);var d=l<=.5?l*(c+1):l+c-l*c,f=l*2-d,p=Sr(f,d,s+1/3),m=Sr(f,d,s),h=Sr(f,d,s-1/3);return yr(p*255,m*255,h*255,u)},wr={hsl:Cr,hsla:Cr,rgb:xr,rgba:xr},Tr=function(e,t){return _r.parse(e,Zn.create(t).parseComponentValue())},H={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},Er={name:`background-clip`,initialValue:`border-box`,prefix:!1,type:1,parse:function(e,t){return t.map(function(e){if(F(e))switch(e.value){case`padding-box`:return 1;case`content-box`:return 2}return 0})}},Dr={name:`background-color`,initialValue:`transparent`,prefix:!1,type:3,format:`color`},Or=function(e,t){var n=_r.parse(e,t[0]),r=t[1];return r&&L(r)?{color:n,stop:r}:{color:n,stop:null}},kr=function(e,t){var n=e[0],r=e[e.length-1];n.stop===null&&(n.stop=R),r.stop===null&&(r.stop=cr);for(var i=[],a=0,o=0;oa?i.push(c):i.push(a),a=c}else i.push(null)}for(var l=null,o=0;oe.optimumDistance)?{optimumCorner:t,optimumDistance:s}:e},{optimumDistance:i?1/0:-1/0,optimumCorner:null}).optimumCorner},Nr=function(e,t,n,r,i){var a=0,o=0;switch(e.size){case 0:e.shape===0?a=o=Math.min(Math.abs(t),Math.abs(t-r),Math.abs(n),Math.abs(n-i)):e.shape===1&&(a=Math.min(Math.abs(t),Math.abs(t-r)),o=Math.min(Math.abs(n),Math.abs(n-i)));break;case 2:if(e.shape===0)a=o=Math.min(U(t,n),U(t,n-i),U(t-r,n),U(t-r,n-i));else if(e.shape===1){var s=Math.min(Math.abs(n),Math.abs(n-i))/Math.min(Math.abs(t),Math.abs(t-r)),c=Mr(r,i,t,n,!0),l=c[0],u=c[1];a=U(l-t,(u-n)/s),o=s*a}break;case 1:e.shape===0?a=o=Math.max(Math.abs(t),Math.abs(t-r),Math.abs(n),Math.abs(n-i)):e.shape===1&&(a=Math.max(Math.abs(t),Math.abs(t-r)),o=Math.max(Math.abs(n),Math.abs(n-i)));break;case 3:if(e.shape===0)a=o=Math.max(U(t,n),U(t,n-i),U(t-r,n),U(t-r,n-i));else if(e.shape===1){var s=Math.max(Math.abs(n),Math.abs(n-i))/Math.max(Math.abs(t),Math.abs(t-r)),d=Mr(r,i,t,n,!1),l=d[0],u=d[1];a=U(l-t,(u-n)/s),o=s*a}break}return Array.isArray(e.size)&&(a=z(e.size[0],r),o=e.size.length===2?z(e.size[1],i):a),[a,o]},Pr=function(e,t){var n=B(180),r=[];return I(t).forEach(function(t,i){if(i===0){var a=t[0];if(a.type===20&&a.value===`to`){n=gr(t);return}else if(hr(a)){n=mr.parse(e,a);return}}var o=Or(e,t);r.push(o)}),{angle:n,stops:r,type:1}},Fr=function(e,t){var n=B(180),r=[];return I(t).forEach(function(t,i){if(i===0){var a=t[0];if(a.type===20&&[`top`,`left`,`right`,`bottom`].indexOf(a.value)!==-1){n=gr(t);return}else if(hr(a)){n=(mr.parse(e,a)+B(270))%B(360);return}}var o=Or(e,t);r.push(o)}),{angle:n,stops:r,type:1}},Ir=function(e,t){var n=B(180),r=[],i=1;return I(t).forEach(function(t,n){var a=t[0];if(n===0){if(F(a)&&a.value===`linear`){i=1;return}else if(F(a)&&a.value===`radial`){i=2;return}}if(a.type===18){if(a.name===`from`){var o=_r.parse(e,a.values[0]);r.push({stop:R,color:o})}else if(a.name===`to`){var o=_r.parse(e,a.values[0]);r.push({stop:cr,color:o})}else if(a.name===`color-stop`){var s=a.values.filter(rr);if(s.length===2){var o=_r.parse(e,s[1]),c=s[0];$n(c)&&r.push({stop:{type:16,number:c.number*100,flags:c.flags},color:o})}}}}),i===1?{angle:(n+B(180))%B(360),stops:r,type:i}:{size:3,shape:0,stops:r,position:[],type:i}},Lr=`closest-side`,Rr=`farthest-side`,zr=`closest-corner`,Br=`farthest-corner`,Vr=`circle`,Hr=`ellipse`,Ur=`cover`,Wr=`contain`,Gr=function(e,t){var n=0,r=3,i=[],a=[];return I(t).forEach(function(t,o){var s=!0;if(o===0){var c=!1;s=t.reduce(function(e,t){if(c)if(F(t))switch(t.value){case`center`:return a.push(sr),e;case`top`:case`left`:return a.push(R),e;case`right`:case`bottom`:return a.push(cr),e}else (L(t)||ar(t))&&a.push(t);else if(F(t))switch(t.value){case Vr:return n=0,!1;case Hr:return n=1,!1;case`at`:return c=!0,!1;case Lr:return r=0,!1;case Ur:case Rr:return r=1,!1;case Wr:case zr:return r=2,!1;case Br:return r=3,!1}else if(ar(t)||L(t))return Array.isArray(r)||(r=[]),r.push(t),!1;return e},s)}if(s){var l=Or(e,t);i.push(l)}}),{size:r,shape:n,stops:i,position:a,type:2}},Kr=function(e,t){var n=0,r=3,i=[],a=[];return I(t).forEach(function(t,o){var s=!0;if(o===0?s=t.reduce(function(e,t){if(F(t))switch(t.value){case`center`:return a.push(sr),!1;case`top`:case`left`:return a.push(R),!1;case`right`:case`bottom`:return a.push(cr),!1}else if(L(t)||ar(t))return a.push(t),!1;return e},s):o===1&&(s=t.reduce(function(e,t){if(F(t))switch(t.value){case Vr:return n=0,!1;case Hr:return n=1,!1;case Wr:case Lr:return r=0,!1;case Rr:return r=1,!1;case zr:return r=2,!1;case Ur:case Br:return r=3,!1}else if(ar(t)||L(t))return Array.isArray(r)||(r=[]),r.push(t),!1;return e},s)),s){var c=Or(e,t);i.push(c)}}),{size:r,shape:n,stops:i,position:a,type:2}},qr=function(e){return e.type===1},Jr=function(e){return e.type===2},Yr={name:`image`,parse:function(e,t){if(t.type===22){var n={url:t.value,type:0};return e.cache.addImage(t.value),n}if(t.type===18){var r=Zr[t.name];if(r===void 0)throw Error(`Attempting to parse an unsupported image function "`+t.name+`"`);return r(e,t.values)}throw Error(`Unsupported image type `+t.type)}};function Xr(e){return!(e.type===20&&e.value===`none`)&&(e.type!==18||!!Zr[e.name])}var Zr={"linear-gradient":Pr,"-moz-linear-gradient":Fr,"-ms-linear-gradient":Fr,"-o-linear-gradient":Fr,"-webkit-linear-gradient":Fr,"radial-gradient":Gr,"-moz-radial-gradient":Kr,"-ms-radial-gradient":Kr,"-o-radial-gradient":Kr,"-webkit-radial-gradient":Kr,"-webkit-gradient":Ir},Qr={name:`background-image`,initialValue:`none`,type:1,prefix:!1,parse:function(e,t){if(t.length===0)return[];var n=t[0];return n.type===20&&n.value===`none`?[]:t.filter(function(e){return rr(e)&&Xr(e)}).map(function(t){return Yr.parse(e,t)})}},$r={name:`background-origin`,initialValue:`border-box`,prefix:!1,type:1,parse:function(e,t){return t.map(function(e){if(F(e))switch(e.value){case`padding-box`:return 1;case`content-box`:return 2}return 0})}},ei={name:`background-position`,initialValue:`0% 0%`,type:1,prefix:!1,parse:function(e,t){return I(t).map(function(e){return e.filter(L)}).map(or)}},ti={name:`background-repeat`,initialValue:`repeat`,prefix:!1,type:1,parse:function(e,t){return I(t).map(function(e){return e.filter(F).map(function(e){return e.value}).join(` `)}).map(ni)}},ni=function(e){switch(e){case`no-repeat`:return 1;case`repeat-x`:case`repeat no-repeat`:return 2;case`repeat-y`:case`no-repeat repeat`:return 3;case`repeat`:default:return 0}},ri;(function(e){e.AUTO=`auto`,e.CONTAIN=`contain`,e.COVER=`cover`})(ri||={});var ii={name:`background-size`,initialValue:`0`,prefix:!1,type:1,parse:function(e,t){return I(t).map(function(e){return e.filter(ai)})}},ai=function(e){return F(e)||L(e)},oi=function(e){return{name:`border-`+e+`-color`,initialValue:`transparent`,prefix:!1,type:3,format:`color`}},si=oi(`top`),ci=oi(`right`),li=oi(`bottom`),ui=oi(`left`),di=function(e){return{name:`border-radius-`+e,initialValue:`0 0`,prefix:!1,type:1,parse:function(e,t){return or(t.filter(L))}}},fi=di(`top-left`),pi=di(`top-right`),mi=di(`bottom-right`),hi=di(`bottom-left`),gi=function(e){return{name:`border-`+e+`-style`,initialValue:`solid`,prefix:!1,type:2,parse:function(e,t){switch(t){case`none`:return 0;case`dashed`:return 2;case`dotted`:return 3;case`double`:return 4}return 1}}},_i=gi(`top`),vi=gi(`right`),yi=gi(`bottom`),bi=gi(`left`),xi=function(e){return{name:`border-`+e+`-width`,initialValue:`0`,type:0,prefix:!1,parse:function(e,t){return Qn(t)?t.number:0}}},Si=xi(`top`),Ci=xi(`right`),wi=xi(`bottom`),Ti=xi(`left`),Ei={name:`color`,initialValue:`transparent`,prefix:!1,type:3,format:`color`},Di={name:`direction`,initialValue:`ltr`,prefix:!1,type:2,parse:function(e,t){switch(t){case`rtl`:return 1;case`ltr`:default:return 0}}},Oi={name:`display`,initialValue:`inline-block`,prefix:!1,type:1,parse:function(e,t){return t.filter(F).reduce(function(e,t){return e|ki(t.value)},0)}},ki=function(e){switch(e){case`block`:case`-webkit-box`:return 2;case`inline`:return 4;case`run-in`:return 8;case`flow`:return 16;case`flow-root`:return 32;case`table`:return 64;case`flex`:case`-webkit-flex`:return 128;case`grid`:case`-ms-grid`:return 256;case`ruby`:return 512;case`subgrid`:return 1024;case`list-item`:return 2048;case`table-row-group`:return 4096;case`table-header-group`:return 8192;case`table-footer-group`:return 16384;case`table-row`:return 32768;case`table-cell`:return 65536;case`table-column-group`:return 131072;case`table-column`:return 262144;case`table-caption`:return 524288;case`ruby-base`:return 1048576;case`ruby-text`:return 2097152;case`ruby-base-container`:return 4194304;case`ruby-text-container`:return 8388608;case`contents`:return 16777216;case`inline-block`:return 33554432;case`inline-list-item`:return 67108864;case`inline-table`:return 134217728;case`inline-flex`:return 268435456;case`inline-grid`:return 536870912}return 0},Ai={name:`float`,initialValue:`none`,prefix:!1,type:2,parse:function(e,t){switch(t){case`left`:return 1;case`right`:return 2;case`inline-start`:return 3;case`inline-end`:return 4}return 0}},ji={name:`letter-spacing`,initialValue:`0`,prefix:!1,type:0,parse:function(e,t){return t.type===20&&t.value===`normal`?0:t.type===17||t.type===15?t.number:0}},Mi;(function(e){e.NORMAL=`normal`,e.STRICT=`strict`})(Mi||={});var Ni={name:`line-break`,initialValue:`normal`,prefix:!1,type:2,parse:function(e,t){switch(t){case`strict`:return Mi.STRICT;case`normal`:default:return Mi.NORMAL}}},Pi={name:`line-height`,initialValue:`normal`,prefix:!1,type:4},Fi=function(e,t){return F(e)&&e.value===`normal`?1.2*t:e.type===17?t*e.number:L(e)?z(e,t):t},Ii={name:`list-style-image`,initialValue:`none`,type:0,prefix:!1,parse:function(e,t){return t.type===20&&t.value===`none`?null:Yr.parse(e,t)}},Li={name:`list-style-position`,initialValue:`outside`,prefix:!1,type:2,parse:function(e,t){switch(t){case`inside`:return 0;case`outside`:default:return 1}}},Ri={name:`list-style-type`,initialValue:`none`,prefix:!1,type:2,parse:function(e,t){switch(t){case`disc`:return 0;case`circle`:return 1;case`square`:return 2;case`decimal`:return 3;case`cjk-decimal`:return 4;case`decimal-leading-zero`:return 5;case`lower-roman`:return 6;case`upper-roman`:return 7;case`lower-greek`:return 8;case`lower-alpha`:return 9;case`upper-alpha`:return 10;case`arabic-indic`:return 11;case`armenian`:return 12;case`bengali`:return 13;case`cambodian`:return 14;case`cjk-earthly-branch`:return 15;case`cjk-heavenly-stem`:return 16;case`cjk-ideographic`:return 17;case`devanagari`:return 18;case`ethiopic-numeric`:return 19;case`georgian`:return 20;case`gujarati`:return 21;case`gurmukhi`:return 22;case`hebrew`:return 22;case`hiragana`:return 23;case`hiragana-iroha`:return 24;case`japanese-formal`:return 25;case`japanese-informal`:return 26;case`kannada`:return 27;case`katakana`:return 28;case`katakana-iroha`:return 29;case`khmer`:return 30;case`korean-hangul-formal`:return 31;case`korean-hanja-formal`:return 32;case`korean-hanja-informal`:return 33;case`lao`:return 34;case`lower-armenian`:return 35;case`malayalam`:return 36;case`mongolian`:return 37;case`myanmar`:return 38;case`oriya`:return 39;case`persian`:return 40;case`simp-chinese-formal`:return 41;case`simp-chinese-informal`:return 42;case`tamil`:return 43;case`telugu`:return 44;case`thai`:return 45;case`tibetan`:return 46;case`trad-chinese-formal`:return 47;case`trad-chinese-informal`:return 48;case`upper-armenian`:return 49;case`disclosure-open`:return 50;case`disclosure-closed`:return 51;case`none`:default:return-1}}},zi=function(e){return{name:`margin-`+e,initialValue:`0`,prefix:!1,type:4}},Bi=zi(`top`),Vi=zi(`right`),Hi=zi(`bottom`),Ui=zi(`left`),Wi={name:`overflow`,initialValue:`visible`,prefix:!1,type:1,parse:function(e,t){return t.filter(F).map(function(e){switch(e.value){case`hidden`:return 1;case`scroll`:return 2;case`clip`:return 3;case`auto`:return 4;case`visible`:default:return 0}})}},Gi={name:`overflow-wrap`,initialValue:`normal`,prefix:!1,type:2,parse:function(e,t){switch(t){case`break-word`:return`break-word`;case`normal`:default:return`normal`}}},Ki=function(e){return{name:`padding-`+e,initialValue:`0`,prefix:!1,type:3,format:`length-percentage`}},qi=Ki(`top`),Ji=Ki(`right`),Yi=Ki(`bottom`),Xi=Ki(`left`),Zi={name:`text-align`,initialValue:`left`,prefix:!1,type:2,parse:function(e,t){switch(t){case`right`:return 2;case`center`:case`justify`:return 1;case`left`:default:return 0}}},Qi={name:`position`,initialValue:`static`,prefix:!1,type:2,parse:function(e,t){switch(t){case`relative`:return 1;case`absolute`:return 2;case`fixed`:return 3;case`sticky`:return 4}return 0}},$i={name:`text-shadow`,initialValue:`none`,type:1,prefix:!1,parse:function(e,t){return t.length===1&&tr(t[0],`none`)?[]:I(t).map(function(t){for(var n={color:H.TRANSPARENT,offsetX:R,offsetY:R,blur:R},r=0,i=0;i1?1:0],this.overflowWrap=G(e,Gi,t.overflowWrap),this.paddingTop=G(e,qi,t.paddingTop),this.paddingRight=G(e,Ji,t.paddingRight),this.paddingBottom=G(e,Yi,t.paddingBottom),this.paddingLeft=G(e,Xi,t.paddingLeft),this.paintOrder=G(e,Ea,t.paintOrder),this.position=G(e,Qi,t.position),this.textAlign=G(e,Zi,t.textAlign),this.textDecorationColor=G(e,fa,t.textDecorationColor??t.color),this.textDecorationLine=G(e,pa,t.textDecorationLine??t.textDecoration),this.textShadow=G(e,$i,t.textShadow),this.textTransform=G(e,ea,t.textTransform),this.transform=G(e,ta,t.transform),this.transformOrigin=G(e,aa,t.transformOrigin),this.visibility=G(e,oa,t.visibility),this.webkitTextStrokeColor=G(e,Da,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=G(e,Oa,t.webkitTextStrokeWidth),this.wordBreak=G(e,ca,t.wordBreak),this.zIndex=G(e,la,t.zIndex)}return e.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},e.prototype.isTransparent=function(){return vr(this.backgroundColor)},e.prototype.isTransformed=function(){return this.transform!==null},e.prototype.isPositioned=function(){return this.position!==0},e.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},e.prototype.isFloating=function(){return this.float!==0},e.prototype.isInlineLevel=function(){return W(this.display,4)||W(this.display,33554432)||W(this.display,268435456)||W(this.display,536870912)||W(this.display,67108864)||W(this.display,134217728)},e}(),Aa=function(){function e(e,t){this.content=G(e,ya,t.content),this.quotes=G(e,Ca,t.quotes)}return e}(),ja=function(){function e(e,t){this.counterIncrement=G(e,ba,t.counterIncrement),this.counterReset=G(e,xa,t.counterReset)}return e}(),G=function(e,t,n){var r=new Xn,i=n==null?t.initialValue:n.toString();r.write(i);var a=new Zn(r.read());switch(t.type){case 2:var o=a.parseComponentValue();return t.parse(e,F(o)?o.value:t.initialValue);case 0:return t.parse(e,a.parseComponentValue());case 1:return t.parse(e,a.parseComponentValues());case 4:return a.parseComponentValue();case 3:switch(t.format){case`angle`:return mr.parse(e,a.parseComponentValue());case`color`:return _r.parse(e,a.parseComponentValue());case`image`:return Yr.parse(e,a.parseComponentValue());case`length`:var s=a.parseComponentValue();return ar(s)?s:R;case`length-percentage`:var c=a.parseComponentValue();return L(c)?c:R;case`time`:return ua.parse(e,a.parseComponentValue())}break}},Ma=`data-html2canvas-debug`,Na=function(e){switch(e.getAttribute(Ma)){case`all`:return 1;case`clone`:return 2;case`parse`:return 3;case`render`:return 4;default:return 0}},Pa=function(e,t){var n=Na(e);return n===1||t===n},K=function(){function e(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Pa(t,3))debugger;this.styles=new ka(e,window.getComputedStyle(t,null)),xs(t)&&(this.styles.animationDuration.some(function(e){return e>0})&&(t.style.animationDuration=`0s`),this.styles.transform!==null&&(t.style.transform=`none`)),this.bounds=s(this.context,t),Pa(t,4)&&(this.flags|=16)}return e}(),Fa=`AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=`,Ia=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,La=typeof Uint8Array>`u`?[]:new Uint8Array(256),Ra=0;Ra>4,u[i++]=(o&15)<<4|s>>2,u[i++]=(s&3)<<6|c&63;return l},Ba=function(e){for(var t=e.length,n=[],r=0;r>Ha,qa=(1<>Ha)+32,Ya=65536>>Ua,Xa=(1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Ha],t=(t<>Ha)],t=(t<>Ua),t=this.index[t],t+=e>>Ha&Xa,t=this.index[t],t=(t<`u`?[]:new Uint8Array(256),ro=0;ro=55296&&i<=56319&&n>10)+55296,a%1024+56320)),(r+1===t||n.length>16384)&&(i+=String.fromCharCode.apply(String,n),n.length=0)}return i},xo=$a(Fa),So=`×`,Co=`÷`,wo=function(e){return xo.get(e)},To=function(e,t,n){var r=n-2,i=t[r],a=t[n-1],o=t[n];if(a===ao&&o===oo)return So;if(a===ao||a===oo||a===so||o===ao||o===oo||o===so)return Co;if(a===uo&&[uo,fo,mo,ho].indexOf(o)!==-1||(a===mo||a===fo)&&(o===fo||o===po)||(a===ho||a===po)&&o===po||o===go||o===co||o===lo||a===io)return So;if(a===go&&o===_o){for(;i===co;)i=t[--r];if(i===_o)return So}if(a===vo&&o===vo){for(var s=0;i===vo;)s++,i=t[--r];if(s%2==0)return So}return Co},Eo=function(e){var t=yo(e),n=t.length,r=0,i=0,a=t.map(wo);return{next:function(){if(r>=n)return{done:!0,value:null};for(var e=So;ro.x||i.y>o.y;return o=i,t===0?!0:s});return e.body.removeChild(t),s},Ao=function(){return new Image().crossOrigin!==void 0},jo=function(){return typeof new XMLHttpRequest().responseType==`string`},Mo=function(e){var t=new Image,n=e.createElement(`canvas`),r=n.getContext(`2d`);if(!r)return!1;t.src=`data:image/svg+xml,`;try{r.drawImage(t,0,0),n.toDataURL()}catch{return!1}return!0},No=function(e){return e[0]===0&&e[1]===255&&e[2]===0&&e[3]===255},Po=function(e){var t=e.createElement(`canvas`),n=100;t.width=n,t.height=n;var r=t.getContext(`2d`);if(!r)return Promise.reject(!1);r.fillStyle=`rgb(0, 255, 0)`,r.fillRect(0,0,n,n);var i=new Image,a=t.toDataURL();i.src=a;var o=Fo(n,n,0,0,i);return r.fillStyle=`red`,r.fillRect(0,0,n,n),Io(o).then(function(t){r.drawImage(t,0,0);var i=r.getImageData(0,0,n,n).data;r.fillStyle=`red`,r.fillRect(0,0,n,n);var o=e.createElement(`div`);return o.style.backgroundImage=`url(`+a+`)`,o.style.height=n+`px`,No(i)?Io(Fo(n,n,0,0,o)):Promise.reject(!1)}).then(function(e){return r.drawImage(e,0,0),No(r.getImageData(0,0,n,n).data)}).catch(function(){return!1})},Fo=function(e,t,n,r,i){var a=`http://www.w3.org/2000/svg`,o=document.createElementNS(a,`svg`),s=document.createElementNS(a,`foreignObject`);return o.setAttributeNS(null,`width`,e.toString()),o.setAttributeNS(null,`height`,t.toString()),s.setAttributeNS(null,`width`,`100%`),s.setAttributeNS(null,`height`,`100%`),s.setAttributeNS(null,`x`,n.toString()),s.setAttributeNS(null,`y`,r.toString()),s.setAttributeNS(null,`externalResourcesRequired`,`true`),o.appendChild(s),s.appendChild(i),o},Io=function(e){return new Promise(function(t,n){var r=new Image;r.onload=function(){return t(r)},r.onerror=n,r.src=`data:image/svg+xml;charset=utf-8,`+encodeURIComponent(new XMLSerializer().serializeToString(e))})},q={get SUPPORT_RANGE_BOUNDS(){var e=Oo(document);return Object.defineProperty(q,`SUPPORT_RANGE_BOUNDS`,{value:e}),e},get SUPPORT_WORD_BREAKING(){var e=q.SUPPORT_RANGE_BOUNDS&&ko(document);return Object.defineProperty(q,`SUPPORT_WORD_BREAKING`,{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=Mo(document);return Object.defineProperty(q,`SUPPORT_SVG_DRAWING`,{value:e}),e},get SUPPORT_FOREIGNOBJECT_DRAWING(){var e=typeof Array.from==`function`&&typeof window.fetch==`function`?Po(document):Promise.resolve(!1);return Object.defineProperty(q,`SUPPORT_FOREIGNOBJECT_DRAWING`,{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=Ao();return Object.defineProperty(q,`SUPPORT_CORS_IMAGES`,{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e=jo();return Object.defineProperty(q,`SUPPORT_RESPONSE_TYPE`,{value:e}),e},get SUPPORT_CORS_XHR(){var e=`withCredentials`in new XMLHttpRequest;return Object.defineProperty(q,`SUPPORT_CORS_XHR`,{value:e}),e},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var e=!!(typeof Intl<`u`&&Intl.Segmenter);return Object.defineProperty(q,`SUPPORT_NATIVE_TEXT_SEGMENTATION`,{value:e}),e}},Lo=function(){function e(e,t){this.text=e,this.bounds=t}return e}(),Ro=function(e,t,n,r){var i=Uo(t,n),a=[],s=0;return i.forEach(function(t){if(n.textDecorationLine.length||t.trim().length>0)if(q.SUPPORT_RANGE_BOUNDS){var i=Bo(r,s,t.length).getClientRects();if(i.length>1){var c=Vo(t),l=0;c.forEach(function(t){a.push(new Lo(t,o.fromDOMRectList(e,Bo(r,l+s,t.length).getClientRects()))),l+=t.length})}else a.push(new Lo(t,o.fromDOMRectList(e,i)))}else{var u=r.splitText(t.length);a.push(new Lo(t,zo(e,r))),r=u}else q.SUPPORT_RANGE_BOUNDS||(r=r.splitText(t.length));s+=t.length}),a},zo=function(e,t){var n=t.ownerDocument;if(n){var r=n.createElement(`html2canvaswrapper`);r.appendChild(t.cloneNode(!0));var i=t.parentNode;if(i){i.replaceChild(r,t);var a=s(e,r);return r.firstChild&&i.replaceChild(r.firstChild,r),a}}return o.EMPTY},Bo=function(e,t,n){var r=e.ownerDocument;if(!r)throw Error(`Node has no owner document`);var i=r.createRange();return i.setStart(e,t),i.setEnd(e,t+n),i},Vo=function(e){if(q.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:`grapheme`});return Array.from(t.segment(e)).map(function(e){return e.segment})}return Do(e)},Ho=function(e,t){if(q.SUPPORT_NATIVE_TEXT_SEGMENTATION){var n=new Intl.Segmenter(void 0,{granularity:`word`});return Array.from(n.segment(e)).map(function(e){return e.segment})}return Go(e,t)},Uo=function(e,t){return t.letterSpacing===0?Ho(e,t):Vo(e)},Wo=[32,160,4961,65792,65793,4153,4241],Go=function(e,t){for(var n=ft(e,{lineBreak:t.lineBreak,wordBreak:t.overflowWrap===`break-word`?`break-word`:t.wordBreak}),r=[],i,a=function(){if(i.value){var e=l(i.value.slice()),t=``;e.forEach(function(e){Wo.indexOf(e)===-1?t+=u(e):(t.length&&r.push(t),r.push(u(e)),t=``)}),t.length&&r.push(t)}};!(i=n.next()).done;)a();return r},Ko=function(){function e(e,t,n){this.text=qo(t.data,n.textTransform),this.textBounds=Ro(e,this.text,n,t)}return e}(),qo=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(Jo,Yo);case 2:return e.toUpperCase();default:return e}},Jo=/(^|\s|:|-|\(|\))([a-z])/g,Yo=function(e,t,n){return e.length>0?t+n.toUpperCase():e},Xo=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.src=n.currentSrc||n.src,r.intrinsicWidth=n.naturalWidth,r.intrinsicHeight=n.naturalHeight,r.context.cache.addImage(r.src),r}return n}(K),Zo=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.canvas=n,r.intrinsicWidth=n.width,r.intrinsicHeight=n.height,r}return n}(K),Qo=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this,i=new XMLSerializer,a=s(t,n);return n.setAttribute(`width`,a.width+`px`),n.setAttribute(`height`,a.height+`px`),r.svg=`data:image/svg+xml,`+encodeURIComponent(i.serializeToString(n)),r.intrinsicWidth=n.width.baseVal.value,r.intrinsicHeight=n.height.baseVal.value,r.context.cache.addImage(r.svg),r}return n}(K),$o=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.value=n.value,r}return n}(K),es=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.start=n.start,r.reversed=typeof n.reversed==`boolean`&&n.reversed===!0,r}return n}(K),ts=[{type:15,flags:0,unit:`px`,number:3}],ns=[{type:16,flags:0,number:50}],rs=function(e){return e.width>e.height?new o(e.left+(e.width-e.height)/2,e.top,e.height,e.height):e.width0)n.textNodes.push(new Ko(e,i,n.styles));else if(bs(i))if(Ls(i)&&i.assignedNodes)i.assignedNodes().forEach(function(t){return ms(e,t,n,r)});else{var o=hs(e,i);o.styles.isVisible()&&(_s(i,o,r)?o.flags|=4:vs(o.styles)&&(o.flags|=2),ps.indexOf(i.tagName)!==-1&&(o.flags|=8),n.elements.push(o),i.slot,i.shadowRoot?ms(e,i.shadowRoot,o,r):!Fs(i)&&!Ds(i)&&!Is(i)&&ms(e,i,o,r))}},hs=function(e,t){return js(t)?new Xo(e,t):ks(t)?new Zo(e,t):Ds(t)?new Qo(e,t):Cs(t)?new $o(e,t):ws(t)?new es(e,t):Ts(t)?new ls(e,t):Is(t)?new us(e,t):Fs(t)?new ds(e,t):Ms(t)?new fs(e,t):new K(e,t)},gs=function(e,t){var n=hs(e,t);return n.flags|=4,ms(e,t,n,n),n},_s=function(e,t,n){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||Os(e)&&n.styles.isTransparent()},vs=function(e){return e.isPositioned()||e.isFloating()},ys=function(e){return e.nodeType===Node.TEXT_NODE},bs=function(e){return e.nodeType===Node.ELEMENT_NODE},xs=function(e){return bs(e)&&e.style!==void 0&&!Ss(e)},Ss=function(e){return typeof e.className==`object`},Cs=function(e){return e.tagName===`LI`},ws=function(e){return e.tagName===`OL`},Ts=function(e){return e.tagName===`INPUT`},Es=function(e){return e.tagName===`HTML`},Ds=function(e){return e.tagName===`svg`},Os=function(e){return e.tagName===`BODY`},ks=function(e){return e.tagName===`CANVAS`},As=function(e){return e.tagName===`VIDEO`},js=function(e){return e.tagName===`IMG`},Ms=function(e){return e.tagName===`IFRAME`},Ns=function(e){return e.tagName===`STYLE`},Ps=function(e){return e.tagName===`SCRIPT`},Fs=function(e){return e.tagName===`TEXTAREA`},Is=function(e){return e.tagName===`SELECT`},Ls=function(e){return e.tagName===`SLOT`},Rs=function(e){return e.tagName.indexOf(`-`)>0},zs=function(){function e(){this.counters={}}return e.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},e.prototype.getCounterValues=function(e){return this.counters[e]||[]},e.prototype.pop=function(e){var t=this;e.forEach(function(e){return t.counters[e].pop()})},e.prototype.parse=function(e){var t=this,n=e.counterIncrement,r=e.counterReset,i=!0;n!==null&&n.forEach(function(e){var n=t.counters[e.counter];n&&e.increment!==0&&(i=!1,n.length||n.push(1),n[Math.max(0,n.length-1)]+=e.increment)});var a=[];return i&&r.forEach(function(e){var n=t.counters[e.counter];a.push(e.counter),n||=t.counters[e.counter]=[],n.push(e.reset)}),a},e}(),Bs={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:[`M`,`CM`,`D`,`CD`,`C`,`XC`,`L`,`XL`,`X`,`IX`,`V`,`IV`,`I`]},Vs={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:`Ք.Փ.Ւ.Ց.Ր.Տ.Վ.Ս.Ռ.Ջ.Պ.Չ.Ո.Շ.Ն.Յ.Մ.Ճ.Ղ.Ձ.Հ.Կ.Ծ.Խ.Լ.Ի.Ժ.Թ.Ը.Է.Զ.Ե.Դ.Գ.Բ.Ա`.split(`.`)},Hs={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:`י׳.ט׳.ח׳.ז׳.ו׳.ה׳.ד׳.ג׳.ב׳.א׳.ת.ש.ר.ק.צ.פ.ע.ס.נ.מ.ל.כ.יט.יח.יז.טז.טו.י.ט.ח.ז.ו.ה.ד.ג.ב.א`.split(`.`)},Us={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:`ჵ.ჰ.ჯ.ჴ.ხ.ჭ.წ.ძ.ც.ჩ.შ.ყ.ღ.ქ.ფ.ჳ.ტ.ს.რ.ჟ.პ.ო.ჲ.ნ.მ.ლ.კ.ი.თ.ჱ.ზ.ვ.ე.დ.გ.ბ.ა`.split(`.`)},Ws=function(e,t,n,r,i,a){return en?nc(e,i,a.length>0):r.integers.reduce(function(t,n,i){for(;e>=n;)e-=n,t+=r.values[i];return t},``)+a},Gs=function(e,t,n,r){var i=``;do n||e--,i=r(e)+i,e/=t;while(e*t>=t);return i},J=function(e,t,n,r,i){var a=n-t+1;return(e<0?`-`:``)+(Gs(Math.abs(e),a,r,function(e){return u(Math.floor(e%a)+t)})+i)},Ks=function(e,t,n){n===void 0&&(n=`. `);var r=t.length;return Gs(Math.abs(e),r,!1,function(e){return t[Math.floor(e%r)]})+n},qs=1,Js=2,Ys=4,Xs=8,Zs=function(e,t,n,r,i,a){if(e<-9999||e>9999)return nc(e,4,i.length>0);var o=Math.abs(e),s=i;if(o===0)return t[0]+s;for(var c=0;o>0&&c<=4;c++){var l=o%10;l===0&&W(a,qs)&&s!==``?s=t[l]+s:l>1||l===1&&c===0||l===1&&c===1&&W(a,Js)||l===1&&c===1&&W(a,Ys)&&e>100||l===1&&c>1&&W(a,Xs)?s=t[l]+(c>0?n[c-1]:``)+s:l===1&&c>0&&(s=n[c-1]+s),o=Math.floor(o/10)}return(e<0?r:``)+s},Qs=`十百千萬`,$s=`拾佰仟萬`,ec=`マイナス`,tc=`마이너스`,nc=function(e,t,n){var r=n?`. `:``,i=n?`、`:``,a=n?`, `:``,o=n?` `:``;switch(t){case 0:return`•`+o;case 1:return`◦`+o;case 2:return`◾`+o;case 5:var s=J(e,48,57,!0,r);return s.length<4?`0`+s:s;case 4:return Ks(e,`〇一二三四五六七八九`,i);case 6:return Ws(e,1,3999,Bs,3,r).toLowerCase();case 7:return Ws(e,1,3999,Bs,3,r);case 8:return J(e,945,969,!1,r);case 9:return J(e,97,122,!1,r);case 10:return J(e,65,90,!1,r);case 11:return J(e,1632,1641,!0,r);case 12:case 49:return Ws(e,1,9999,Vs,3,r);case 35:return Ws(e,1,9999,Vs,3,r).toLowerCase();case 13:return J(e,2534,2543,!0,r);case 14:case 30:return J(e,6112,6121,!0,r);case 15:return Ks(e,`子丑寅卯辰巳午未申酉戌亥`,i);case 16:return Ks(e,`甲乙丙丁戊己庚辛壬癸`,i);case 17:case 48:return Zs(e,`零一二三四五六七八九`,Qs,`負`,i,Js|Ys|Xs);case 47:return Zs(e,`零壹貳參肆伍陸柒捌玖`,$s,`負`,i,qs|Js|Ys|Xs);case 42:return Zs(e,`零一二三四五六七八九`,Qs,`负`,i,Js|Ys|Xs);case 41:return Zs(e,`零壹贰叁肆伍陆柒捌玖`,$s,`负`,i,qs|Js|Ys|Xs);case 26:return Zs(e,`〇一二三四五六七八九`,`十百千万`,ec,i,0);case 25:return Zs(e,`零壱弐参四伍六七八九`,`拾百千万`,ec,i,qs|Js|Ys);case 31:return Zs(e,`영일이삼사오육칠팔구`,`십백천만`,tc,a,qs|Js|Ys);case 33:return Zs(e,`零一二三四五六七八九`,`十百千萬`,tc,a,0);case 32:return Zs(e,`零壹貳參四五六七八九`,`拾百千`,tc,a,qs|Js|Ys);case 18:return J(e,2406,2415,!0,r);case 20:return Ws(e,1,19999,Us,3,r);case 21:return J(e,2790,2799,!0,r);case 22:return J(e,2662,2671,!0,r);case 22:return Ws(e,1,10999,Hs,3,r);case 23:return Ks(e,`あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん`);case 24:return Ks(e,`いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす`);case 27:return J(e,3302,3311,!0,r);case 28:return Ks(e,`アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン`,i);case 29:return Ks(e,`イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス`,i);case 34:return J(e,3792,3801,!0,r);case 37:return J(e,6160,6169,!0,r);case 38:return J(e,4160,4169,!0,r);case 39:return J(e,2918,2927,!0,r);case 40:return J(e,1776,1785,!0,r);case 43:return J(e,3046,3055,!0,r);case 44:return J(e,3174,3183,!0,r);case 45:return J(e,3664,3673,!0,r);case 46:return J(e,3872,3881,!0,r);case 3:default:return J(e,48,57,!0,r)}},rc=`data-html2canvas-ignore`,ic=function(){function e(e,t,n){if(this.context=e,this.options=n,this.scrolledElements=[],this.referenceElement=t,this.counters=new zs,this.quoteDepth=0,!t.ownerDocument)throw Error(`Cloned element does not have an owner document`);this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return e.prototype.toIFrame=function(e,t){var n=this,a=oc(e,t);if(!a.contentWindow)return Promise.reject(`Unable to find iframe window`);var o=e.defaultView.pageXOffset,s=e.defaultView.pageYOffset,c=a.contentWindow,l=c.document,u=lc(a).then(function(){return r(n,void 0,void 0,function(){var e,n;return i(this,function(r){switch(r.label){case 0:return this.scrolledElements.forEach(mc),c&&(c.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(c.scrollY!==t.top||c.scrollX!==t.left)&&(this.context.logger.warn(`Unable to restore scroll position for cloned document`),this.context.windowBounds=this.context.windowBounds.add(c.scrollX-t.left,c.scrollY-t.top,0,0))),e=this.options.onclone,n=this.clonedReferenceElement,n===void 0?[2,Promise.reject(`Error finding the `+this.referenceElement.nodeName+` in the cloned document`)]:l.fonts&&l.fonts.ready?[4,l.fonts.ready]:[3,2];case 1:r.sent(),r.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,cc(l)]:[3,4];case 3:r.sent(),r.label=4;case 4:return typeof e==`function`?[2,Promise.resolve().then(function(){return e(l,n)}).then(function(){return a})]:[2,a]}})})});return l.open(),l.write(fc(document.doctype)+``),pc(this.referenceElement.ownerDocument,o,s),l.replaceChild(l.adoptNode(this.documentElement),l.documentElement),l.close(),u},e.prototype.createElementClone=function(e){if(Pa(e,2))debugger;if(ks(e))return this.createCanvasClone(e);if(As(e))return this.createVideoClone(e);if(Ns(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return js(t)&&(js(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=``),t.loading===`lazy`&&(t.loading=`eager`)),Rs(t)?this.createCustomElementClone(t):t},e.prototype.createCustomElementClone=function(e){var t=document.createElement(`html2canvascustomelement`);return dc(e.style,t),t},e.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var n=[].slice.call(t.cssRules,0).reduce(function(e,t){return t&&typeof t.cssText==`string`?e+t.cssText:e},``),r=e.cloneNode(!1);return r.textContent=n,r}}catch(e){if(this.context.logger.error(`Unable to access cssRules property`,e),e.name!==`SecurityError`)throw e}return e.cloneNode(!1)},e.prototype.createCanvasClone=function(e){if(this.options.inlineImages&&e.ownerDocument){var t=e.ownerDocument.createElement(`img`);try{return t.src=e.toDataURL(),t}catch{this.context.logger.info(`Unable to inline canvas contents, canvas is tainted`,e)}}var n=e.cloneNode(!1);try{n.width=e.width,n.height=e.height;var r=e.getContext(`2d`),i=n.getContext(`2d`);if(i)if(!this.options.allowTaint&&r)i.putImageData(r.getImageData(0,0,e.width,e.height),0,0);else{var a=e.getContext(`webgl2`)??e.getContext(`webgl`);a&&a.getContextAttributes()?.preserveDrawingBuffer===!1&&this.context.logger.warn(`Unable to clone WebGL context as it has preserveDrawingBuffer=false`,e),i.drawImage(e,0,0)}return n}catch{this.context.logger.info(`Unable to clone canvas as it is tainted`,e)}return n},e.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement(`canvas`);t.width=e.offsetWidth,t.height=e.offsetHeight;var n=t.getContext(`2d`);try{return n&&(n.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||n.getImageData(0,0,t.width,t.height)),t}catch{this.context.logger.info(`Unable to clone video as it is tainted`,e)}var r=e.ownerDocument.createElement(`canvas`);return r.width=e.offsetWidth,r.height=e.offsetHeight,r},e.prototype.appendChildNode=function(e,t,n){(!bs(t)||!Ps(t)&&!t.hasAttribute(rc)&&(typeof this.options.ignoreElements!=`function`||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!bs(t)||!Ns(t))&&e.appendChild(this.cloneNode(t,n))},e.prototype.cloneChildNodes=function(e,t,n){for(var r=this,i=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;i;i=i.nextSibling)if(bs(i)&&Ls(i)&&typeof i.assignedNodes==`function`){var a=i.assignedNodes();a.length&&a.forEach(function(e){return r.appendChildNode(t,e,n)})}else this.appendChildNode(t,i,n)},e.prototype.cloneNode=function(e,t){if(ys(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var n=e.ownerDocument.defaultView;if(n&&bs(e)&&(xs(e)||Ss(e))){var r=this.createElementClone(e);r.style.transitionProperty=`none`;var i=n.getComputedStyle(e),a=n.getComputedStyle(e,`:before`),o=n.getComputedStyle(e,`:after`);this.referenceElement===e&&xs(r)&&(this.clonedReferenceElement=r),Os(r)&&bc(r);var s=this.counters.parse(new ja(this.context,i)),c=this.resolvePseudoContent(e,r,a,ac.BEFORE);Rs(e)&&(t=!0),As(e)||this.cloneChildNodes(e,r,t),c&&r.insertBefore(c,r.firstChild);var l=this.resolvePseudoContent(e,r,o,ac.AFTER);return l&&r.appendChild(l),this.counters.pop(s),(i&&(this.options.copyStyles||Ss(e))&&!Ms(e)||t)&&dc(i,r),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(Fs(e)||Is(e))&&(Fs(r)||Is(r))&&(r.value=e.value),r}return e.cloneNode(!1)},e.prototype.resolvePseudoContent=function(e,t,n,r){var i=this;if(n){var a=n.content,o=t.ownerDocument;if(!(!o||!a||a===`none`||a===`-moz-alt-content`||n.display===`none`)){this.counters.parse(new ja(this.context,n));var s=new Aa(this.context,n),c=o.createElement(`html2canvaspseudoelement`);dc(n,c),s.content.forEach(function(t){if(t.type===0)c.appendChild(o.createTextNode(t.value));else if(t.type===22){var n=o.createElement(`img`);n.src=t.value,n.style.opacity=`1`,c.appendChild(n)}else if(t.type===18){if(t.name===`attr`){var r=t.values.filter(F);r.length&&c.appendChild(o.createTextNode(e.getAttribute(r[0].value)||``))}else if(t.name===`counter`){var a=t.values.filter(rr),l=a[0],u=a[1];if(l&&F(l)){var d=i.counters.getCounterValue(l.value),f=u&&F(u)?Ri.parse(i.context,u.value):3;c.appendChild(o.createTextNode(nc(d,f,!1)))}}else if(t.name===`counters`){var p=t.values.filter(rr),l=p[0],m=p[1],u=p[2];if(l&&F(l)){var h=i.counters.getCounterValues(l.value),g=u&&F(u)?Ri.parse(i.context,u.value):3,_=m&&m.type===0?m.value:``,v=h.map(function(e){return nc(e,g,!1)}).join(_);c.appendChild(o.createTextNode(v))}}}else if(t.type===20)switch(t.value){case`open-quote`:c.appendChild(o.createTextNode(wa(s.quotes,i.quoteDepth++,!0)));break;case`close-quote`:c.appendChild(o.createTextNode(wa(s.quotes,--i.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(t.value))}}),c.className=_c+` `+vc;var l=r===ac.BEFORE?` `+_c:` `+vc;return Ss(t)?t.className.baseValue+=l:t.className+=l,c}}},e.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},e}(),ac;(function(e){e[e.BEFORE=0]=`BEFORE`,e[e.AFTER=1]=`AFTER`})(ac||={});var oc=function(e,t){var n=e.createElement(`iframe`);return n.className=`html2canvas-container`,n.style.visibility=`hidden`,n.style.position=`fixed`,n.style.left=`-10000px`,n.style.top=`0px`,n.style.border=`0`,n.width=t.width.toString(),n.height=t.height.toString(),n.scrolling=`no`,n.setAttribute(rc,`true`),e.body.appendChild(n),n},sc=function(e){return new Promise(function(t){if(e.complete){t();return}if(!e.src){t();return}e.onload=t,e.onerror=t})},cc=function(e){return Promise.all([].slice.call(e.images,0).map(sc))},lc=function(e){return new Promise(function(t,n){var r=e.contentWindow;if(!r)return n(`No window assigned for iframe`);var i=r.document;r.onload=e.onload=function(){r.onload=e.onload=null;var n=setInterval(function(){i.body.childNodes.length>0&&i.readyState===`complete`&&(clearInterval(n),t(e))},50)}})},uc=[`all`,`d`,`content`],dc=function(e,t){for(var n=e.length-1;n>=0;n--){var r=e.item(n);uc.indexOf(r)===-1&&t.style.setProperty(r,e.getPropertyValue(r))}return t},fc=function(e){var t=``;return e&&(t+=``),t},pc=function(e,t,n){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||n!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,n)},mc=function(e){var t=e[0],n=e[1],r=e[2];t.scrollLeft=n,t.scrollTop=r},hc=`:before`,gc=`:after`,_c=`___html2canvas___pseudoelement_before`,vc=`___html2canvas___pseudoelement_after`,yc=`{ +import{En as e}from"./index-CcPm2yTY.js";var t=e(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self,n.html2canvas=r())})(e,(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}var n=function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&a[a.length-1]))&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]=55296&&i<=56319&&n>10)+55296,a%1024+56320)),(r+1===t||n.length>16384)&&(i+=String.fromCharCode.apply(String,n),n.length=0)}return i},d=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,f=typeof Uint8Array>`u`?[]:new Uint8Array(256),p=0;p`u`?[]:new Uint8Array(256),g=0;g>4,u[i++]=(o&15)<<4|s>>2,u[i++]=(s&3)<<6|c&63;return l},v=function(e){for(var t=e.length,n=[],r=0;r>b,T=(1<>b)+32,D=65536>>x,O=(1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>b],t=(t<>b)],t=(t<>x),t=this.index[t],t+=e>>b&O,t=this.index[t],t=(t<`u`?[]:new Uint8Array(256),oe=0;oece?(i.push(!0),o-=ce):i.push(!1),[`normal`,`auto`,`loose`].indexOf(t)!==-1&&[8208,8211,12316,12448].indexOf(e)!==-1)return r.push(a),n.push(Ce);if(o===fe||o===ve){if(a===0)return r.push(a),n.push(Ie);var s=n[a-1];return rt.indexOf(s)===-1?(r.push(r[a-1]),n.push(s)):(r.push(a),n.push(Ie))}if(r.push(a),o===Le)return n.push(t===`strict`?Oe:Ue);if(o===Je||o===Fe)return n.push(Ie);if(o===Ye)return e>=131072&&e<=196605||e>=196608&&e<=262141?n.push(Ue):n.push(Ie);n.push(o)}),[r,n,i]},st=function(e,t,n,r){var i=r[n];if(Array.isArray(e)?e.indexOf(i)!==-1:e===i)for(var a=n;a<=r.length;){a++;var o=r[a];if(o===t)return!0;if(o!==_e)break}if(i===_e)for(var a=n;a>0;){a--;var s=r[a];if(Array.isArray(e)?e.indexOf(s)!==-1:e===s)for(var c=n;c<=r.length;){c++;var o=r[c];if(o===t)return!0;if(o!==_e)break}if(s!==_e)break}return!1},ct=function(e,t){for(var n=e;n>=0;){var r=t[n];if(r===_e)n--;else return r}return 0},lt=function(e,t,n,r,i){if(n[r]===0)return A;var a=r-1;if(Array.isArray(i)&&i[a]===!0)return A;var o=a-1,s=a+1,c=t[a],l=o>=0?t[o]:0,u=t[s];if(c===ue&&u===de)return A;if(et.indexOf(c)!==-1)return Ze;if(et.indexOf(u)!==-1||tt.indexOf(u)!==-1)return A;if(ct(a,t)===he)return Qe;if($e.get(e[a])===ve||(c===Re||c===ze)&&$e.get(e[s])===ve||c===me||u===me||c===ge||[_e,be,Se].indexOf(c)===-1&&u===ge||[we,Te,Ee,je,Pe].indexOf(u)!==-1||ct(a,t)===ke||st(Ae,ke,a,t)||st([we,Te],Oe,a,t)||st(ye,ye,a,t))return A;if(c===_e)return Qe;if(c===Ae||u===Ae)return A;if(u===Ce||c===Ce)return Qe;if([be,Se,Oe].indexOf(u)!==-1||c===xe||l===He&&at.indexOf(c)!==-1||c===Pe&&u===He||u===De||j.indexOf(u)!==-1&&c===k||j.indexOf(c)!==-1&&u===k||c===Ne&&[Ue,Re,ze].indexOf(u)!==-1||[Ue,Re,ze].indexOf(c)!==-1&&u===Me||j.indexOf(c)!==-1&&nt.indexOf(u)!==-1||nt.indexOf(c)!==-1&&j.indexOf(u)!==-1||[Ne,Me].indexOf(c)!==-1&&(u===k||[ke,Se].indexOf(u)!==-1&&t[s+1]===k)||[ke,Se].indexOf(c)!==-1&&u===k||c===k&&[k,Pe,je].indexOf(u)!==-1)return A;if([k,Pe,je,we,Te].indexOf(u)!==-1)for(var d=a;d>=0;){var f=t[d];if(f===k)return A;if([Pe,je].indexOf(f)!==-1)d--;else break}if([Ne,Me].indexOf(u)!==-1)for(var d=[we,Te].indexOf(c)===-1?a:o;d>=0;){var f=t[d];if(f===k)return A;if([Pe,je].indexOf(f)!==-1)d--;else break}if(We===c&&[We,Ge,Be,Ve].indexOf(u)!==-1||[Ge,Be].indexOf(c)!==-1&&[Ge,Ke].indexOf(u)!==-1||[Ke,Ve].indexOf(c)!==-1&&u===Ke||it.indexOf(c)!==-1&&[De,Me].indexOf(u)!==-1||it.indexOf(u)!==-1&&c===Ne||j.indexOf(c)!==-1&&j.indexOf(u)!==-1||c===je&&j.indexOf(u)!==-1||j.concat(k).indexOf(c)!==-1&&u===ke&&Xe.indexOf(e[s])===-1||j.concat(k).indexOf(u)!==-1&&c===Te)return A;if(c===qe&&u===qe){for(var p=n[a],m=1;p>0&&(p--,t[p]===qe);)m++;if(m%2!=0)return A}return c===Re&&u===ze?A:Qe},ut=function(e,t){t||={lineBreak:`normal`,wordBreak:`normal`};var n=ot(e,t.lineBreak),r=n[0],i=n[1],a=n[2];(t.wordBreak===`break-all`||t.wordBreak===`break-word`)&&(i=i.map(function(e){return[k,Ie,Je].indexOf(e)===-1?e:Ue}));var o=t.wordBreak===`keep-all`?a.map(function(t,n){return t&&e[n]>=19968&&e[n]<=40959}):void 0;return[r,i,o]},dt=function(){function e(e,t,n,r){this.codePoints=e,this.required=t===Ze,this.start=n,this.end=r}return e.prototype.slice=function(){return u.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),ft=function(e,t){var n=l(e),r=ut(n,t),i=r[0],a=r[1],o=r[2],s=n.length,c=0,u=0;return{next:function(){if(u>=s)return{done:!0,value:null};for(var e=A;u=rn&&e<=57},hn=function(e){return e>=55296&&e<=57343},gn=function(e){return P(e)||e>=un&&e<=fn||e>=an&&e<=sn},_n=function(e){return e>=an&&e<=ln},vn=function(e){return e>=un&&e<=mn},yn=function(e){return _n(e)||vn(e)},bn=function(e){return e>=Ut},xn=function(e){return e===_t||e===bt||e===xt},Sn=function(e){return yn(e)||bn(e)||e===At},Cn=function(e){return Sn(e)||P(e)||e===M},wn=function(e){return e>=Zt&&e<=Qt||e===$t||e>=en&&e<=tn||e===nn},Tn=function(e,t){return e===yt?t!==_t:!1},En=function(e,t,n){return e===M?Sn(t)||Tn(t,n):Sn(e)?!0:!!(e===yt&&Tn(e,t))},Dn=function(e,t,n){return e===Kt||e===M?P(t)?!0:t===Xt&&P(n):P(e===Xt?t:e)},On=function(e){var t=0,n=1;(e[t]===Kt||e[t]===M)&&(e[t]===M&&(n=-1),t++);for(var r=[];P(e[t]);)r.push(e[t++]);var i=r.length?parseInt(u.apply(void 0,r),10):0;e[t]===Xt&&t++;for(var a=[];P(e[t]);)a.push(e[t++]);var o=a.length,s=o?parseInt(u.apply(void 0,a),10):0;(e[t]===dn||e[t]===on)&&t++;var c=1;(e[t]===Kt||e[t]===M)&&(e[t]===M&&(c=-1),t++);for(var l=[];P(e[t]);)l.push(e[t++]);var d=l.length?parseInt(u.apply(void 0,l),10):0;return n*(i+s*10**-o)*10**(c*d)},kn={type:2},An={type:3},jn={type:4},Mn={type:13},Nn={type:8},Pn={type:21},Fn={type:9},In={type:10},Ln={type:11},Rn={type:12},zn={type:14},Bn={type:23},Vn={type:1},Hn={type:25},Un={type:24},Wn={type:26},Gn={type:27},Kn={type:28},qn={type:29},Jn={type:31},Yn={type:32},Xn=function(){function e(){this._value=[]}return e.prototype.write=function(e){this._value=this._value.concat(l(e))},e.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==Yn;)e.push(t),t=this.consumeToken();return e},e.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case St:return this.consumeStringToken(St);case wt:var t=this.peekCodePoint(0),n=this.peekCodePoint(1),r=this.peekCodePoint(2);if(Cn(t)||Tn(n,r)){var i=En(t,n,r)?mt:pt,a=this.consumeName();return{type:5,value:a,flags:i}}break;case Tt:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),Mn;break;case Dt:return this.consumeStringToken(Dt);case Ot:return kn;case kt:return An;case Gt:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),zn;break;case Kt:if(Dn(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case qt:return jn;case M:var o=e,s=this.peekCodePoint(0),c=this.peekCodePoint(1);if(Dn(o,s,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(En(o,s,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(s===M&&c===Nt)return this.consumeCodePoint(),this.consumeCodePoint(),Un;break;case Xt:if(Dn(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case vt:if(this.peekCodePoint(0)===Gt)for(this.consumeCodePoint();;){var l=this.consumeCodePoint();if(l===Gt&&(l=this.consumeCodePoint(),l===vt)||l===N)return this.consumeToken()}break;case Jt:return Wn;case Yt:return Gn;case Mt:if(this.peekCodePoint(0)===jt&&this.peekCodePoint(1)===M&&this.peekCodePoint(2)===M)return this.consumeCodePoint(),this.consumeCodePoint(),Hn;break;case Pt:if(En(this.peekCodePoint(0),this.peekCodePoint(1),this.peekCodePoint(2))){var a=this.consumeName();return{type:7,value:a}}break;case Ft:return Kn;case yt:if(Tn(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case It:return qn;case Lt:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),Nn;break;case Rt:return Ln;case Bt:return Rn;case cn:case pn:var d=this.peekCodePoint(0),f=this.peekCodePoint(1);return d===Kt&&(gn(f)||f===zt)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case Vt:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),Fn;if(this.peekCodePoint(0)===Vt)return this.consumeCodePoint(),Pn;break;case Ht:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),In;break;case N:return Yn}return xn(e)?(this.consumeWhiteSpace(),Jn):P(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):Sn(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:u(e)}},e.prototype.consumeCodePoint=function(){var e=this._value.shift();return e===void 0?-1:e},e.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},e.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},e.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();gn(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var n=!1;t===zt&&e.length<6;)e.push(t),t=this.consumeCodePoint(),n=!0;if(n){var r=parseInt(u.apply(void 0,e.map(function(e){return e===zt?rn:e})),16),i=parseInt(u.apply(void 0,e.map(function(e){return e===zt?fn:e})),16);return{type:30,start:r,end:i}}var a=parseInt(u.apply(void 0,e),16);if(this.peekCodePoint(0)===M&&gn(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];gn(t)&&o.length<6;)o.push(t),t=this.consumeCodePoint();var i=parseInt(u.apply(void 0,o),16);return{type:30,start:a,end:i}}else return{type:30,start:a,end:a}},e.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()===`url`&&this.peekCodePoint(0)===Ot?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===Ot?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},e.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===N)return{type:22,value:``};var t=this.peekCodePoint(0);if(t===Dt||t===St){var n=this.consumeStringToken(this.consumeCodePoint());return n.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===N||this.peekCodePoint(0)===kt)?(this.consumeCodePoint(),{type:22,value:n.value}):(this.consumeBadUrlRemnants(),Bn)}for(;;){var r=this.consumeCodePoint();if(r===N||r===kt)return{type:22,value:u.apply(void 0,e)};if(xn(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===N||this.peekCodePoint(0)===kt?(this.consumeCodePoint(),{type:22,value:u.apply(void 0,e)}):(this.consumeBadUrlRemnants(),Bn);if(r===St||r===Dt||r===Ot||wn(r))return this.consumeBadUrlRemnants(),Bn;if(r===yt)if(Tn(r,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),Bn;else e.push(r)}},e.prototype.consumeWhiteSpace=function(){for(;xn(this.peekCodePoint(0));)this.consumeCodePoint()},e.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===kt||e===N)return;Tn(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},e.prototype.consumeStringSlice=function(e){for(var t=5e4,n=``;e>0;){var r=Math.min(t,e);n+=u.apply(void 0,this._value.splice(0,r)),e-=r}return this._value.shift(),n},e.prototype.consumeStringToken=function(e){var t=``,n=0;do{var r=this._value[n];if(r===N||r===void 0||r===e)return t+=this.consumeStringSlice(n),{type:0,value:t};if(r===_t)return this._value.splice(0,n),Vn;if(r===yt){var i=this._value[n+1];i!==N&&i!==void 0&&(i===_t?(t+=this.consumeStringSlice(n),n=-1,this._value.shift()):Tn(r,i)&&(t+=this.consumeStringSlice(n),t+=u(this.consumeEscapedCodePoint()),n=-1))}n++}while(!0)},e.prototype.consumeNumber=function(){var e=[],t=ht,n=this.peekCodePoint(0);for((n===Kt||n===M)&&e.push(this.consumeCodePoint());P(this.peekCodePoint(0));)e.push(this.consumeCodePoint());n=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(n===Xt&&P(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=gt;P(this.peekCodePoint(0));)e.push(this.consumeCodePoint());n=this.peekCodePoint(0),r=this.peekCodePoint(1);var i=this.peekCodePoint(2);if((n===dn||n===on)&&((r===Kt||r===M)&&P(i)||P(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=gt;P(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[On(e),t]},e.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],n=e[1],r=this.peekCodePoint(0);return En(r,this.peekCodePoint(1),this.peekCodePoint(2))?{type:15,number:t,flags:n,unit:this.consumeName()}:r===Et?(this.consumeCodePoint(),{type:16,number:t,flags:n}):{type:17,number:t,flags:n}},e.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(gn(e)){for(var t=u(e);gn(this.peekCodePoint(0))&&t.length<6;)t+=u(this.consumeCodePoint());xn(this.peekCodePoint(0))&&this.consumeCodePoint();var n=parseInt(t,16);return n===0||hn(n)||n>1114111?Wt:n}return e===N?Wt:e},e.prototype.consumeName=function(){for(var e=``;;){var t=this.consumeCodePoint();if(Cn(t))e+=u(t);else if(Tn(t,this.peekCodePoint(0)))e+=u(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},e}(),Zn=function(){function e(e){this._tokens=e}return e.create=function(t){var n=new Xn;return n.write(t),new e(n.read())},e.parseValue=function(t){return e.create(t).parseComponentValue()},e.parseValues=function(t){return e.create(t).parseComponentValues()},e.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw SyntaxError(`Error parsing CSS component value, unexpected EOF`);this.reconsumeToken(e);var t=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return t;throw SyntaxError(`Error parsing CSS component value, multiple values found when expecting only one`)},e.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},e.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},e.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},n=this.consumeToken();;){if(n.type===32||ir(n,e))return t;this.reconsumeToken(n),t.values.push(this.consumeComponentValue()),n=this.consumeToken()}},e.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var n=this.consumeToken();if(n.type===32||n.type===3)return t;this.reconsumeToken(n),t.values.push(this.consumeComponentValue())}},e.prototype.consumeToken=function(){var e=this._tokens.shift();return e===void 0?Yn:e},e.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},e}(),Qn=function(e){return e.type===15},$n=function(e){return e.type===17},F=function(e){return e.type===20},er=function(e){return e.type===0},tr=function(e,t){return F(e)&&e.value===t},nr=function(e){return e.type!==31},rr=function(e){return e.type!==31&&e.type!==4},I=function(e){var t=[],n=[];return e.forEach(function(e){if(e.type===4){if(n.length===0)throw Error(`Error parsing function args, zero tokens for arg`);t.push(n),n=[];return}e.type!==31&&n.push(e)}),n.length&&t.push(n),t},ir=function(e,t){return t===11&&e.type===12||t===28&&e.type===29?!0:t===2&&e.type===3},ar=function(e){return e.type===17||e.type===15},L=function(e){return e.type===16||ar(e)},or=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},R={type:17,number:0,flags:ht},sr={type:16,number:50,flags:ht},cr={type:16,number:100,flags:ht},lr=function(e,t,n){var r=e[0],i=e[1];return[z(r,t),z(i===void 0?r:i,n)]},z=function(e,t){if(e.type===16)return e.number/100*t;if(Qn(e))switch(e.unit){case`rem`:case`em`:return 16*e.number;case`px`:default:return e.number}return e.number},ur=`deg`,dr=`grad`,fr=`rad`,pr=`turn`,mr={name:`angle`,parse:function(e,t){if(t.type===15)switch(t.unit){case ur:return Math.PI*t.number/180;case dr:return Math.PI/200*t.number;case fr:return t.number;case pr:return Math.PI*2*t.number}throw Error(`Unsupported angle type`)}},hr=function(e){return e.type===15&&(e.unit===ur||e.unit===dr||e.unit===fr||e.unit===pr)},gr=function(e){switch(e.filter(F).map(function(e){return e.value}).join(` `)){case`to bottom right`:case`to right bottom`:case`left top`:case`top left`:return[R,R];case`to top`:case`bottom`:return B(0);case`to bottom left`:case`to left bottom`:case`right top`:case`top right`:return[R,cr];case`to right`:case`left`:return B(90);case`to top left`:case`to left top`:case`right bottom`:case`bottom right`:return[cr,cr];case`to bottom`:case`top`:return B(180);case`to top right`:case`to right top`:case`left bottom`:case`bottom left`:return[cr,R];case`to left`:case`right`:return B(270)}return 0},B=function(e){return Math.PI*e/180},_r={name:`color`,parse:function(e,t){if(t.type===18){var n=wr[t.name];if(n===void 0)throw Error(`Attempting to parse an unsupported color function "`+t.name+`"`);return n(e,t.values)}if(t.type===5){if(t.value.length===3){var r=t.value.substring(0,1),i=t.value.substring(1,2),a=t.value.substring(2,3);return yr(parseInt(r+r,16),parseInt(i+i,16),parseInt(a+a,16),1)}if(t.value.length===4){var r=t.value.substring(0,1),i=t.value.substring(1,2),a=t.value.substring(2,3),o=t.value.substring(3,4);return yr(parseInt(r+r,16),parseInt(i+i,16),parseInt(a+a,16),parseInt(o+o,16)/255)}if(t.value.length===6){var r=t.value.substring(0,2),i=t.value.substring(2,4),a=t.value.substring(4,6);return yr(parseInt(r,16),parseInt(i,16),parseInt(a,16),1)}if(t.value.length===8){var r=t.value.substring(0,2),i=t.value.substring(2,4),a=t.value.substring(4,6),o=t.value.substring(6,8);return yr(parseInt(r,16),parseInt(i,16),parseInt(a,16),parseInt(o,16)/255)}}if(t.type===20){var s=H[t.value.toUpperCase()];if(s!==void 0)return s}return H.TRANSPARENT}},vr=function(e){return(255&e)==0},V=function(e){var t=255&e,n=255&e>>8,r=255&e>>16,i=255&e>>24;return t<255?`rgba(`+i+`,`+r+`,`+n+`,`+t/255+`)`:`rgb(`+i+`,`+r+`,`+n+`)`},yr=function(e,t,n,r){return(e<<24|t<<16|n<<8|Math.round(r*255)<<0)>>>0},br=function(e,t){if(e.type===17)return e.number;if(e.type===16){var n=t===3?1:255;return t===3?e.number/100*n:Math.round(e.number/100*n)}return 0},xr=function(e,t){var n=t.filter(rr);if(n.length===3){var r=n.map(br),i=r[0],a=r[1],o=r[2];return yr(i,a,o,1)}if(n.length===4){var s=n.map(br),i=s[0],a=s[1],o=s[2],c=s[3];return yr(i,a,o,c)}return 0};function Sr(e,t,n){return n<0&&(n+=1),n>=1&&--n,n<1/6?(t-e)*n*6+e:n<1/2?t:n<2/3?(t-e)*6*(2/3-n)+e:e}var Cr=function(e,t){var n=t.filter(rr),r=n[0],i=n[1],a=n[2],o=n[3],s=(r.type===17?B(r.number):mr.parse(e,r))/(Math.PI*2),c=L(i)?i.number/100:0,l=L(a)?a.number/100:0,u=o!==void 0&&L(o)?z(o,1):1;if(c===0)return yr(l*255,l*255,l*255,1);var d=l<=.5?l*(c+1):l+c-l*c,f=l*2-d,p=Sr(f,d,s+1/3),m=Sr(f,d,s),h=Sr(f,d,s-1/3);return yr(p*255,m*255,h*255,u)},wr={hsl:Cr,hsla:Cr,rgb:xr,rgba:xr},Tr=function(e,t){return _r.parse(e,Zn.create(t).parseComponentValue())},H={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},Er={name:`background-clip`,initialValue:`border-box`,prefix:!1,type:1,parse:function(e,t){return t.map(function(e){if(F(e))switch(e.value){case`padding-box`:return 1;case`content-box`:return 2}return 0})}},Dr={name:`background-color`,initialValue:`transparent`,prefix:!1,type:3,format:`color`},Or=function(e,t){var n=_r.parse(e,t[0]),r=t[1];return r&&L(r)?{color:n,stop:r}:{color:n,stop:null}},kr=function(e,t){var n=e[0],r=e[e.length-1];n.stop===null&&(n.stop=R),r.stop===null&&(r.stop=cr);for(var i=[],a=0,o=0;oa?i.push(c):i.push(a),a=c}else i.push(null)}for(var l=null,o=0;oe.optimumDistance)?{optimumCorner:t,optimumDistance:s}:e},{optimumDistance:i?1/0:-1/0,optimumCorner:null}).optimumCorner},Nr=function(e,t,n,r,i){var a=0,o=0;switch(e.size){case 0:e.shape===0?a=o=Math.min(Math.abs(t),Math.abs(t-r),Math.abs(n),Math.abs(n-i)):e.shape===1&&(a=Math.min(Math.abs(t),Math.abs(t-r)),o=Math.min(Math.abs(n),Math.abs(n-i)));break;case 2:if(e.shape===0)a=o=Math.min(U(t,n),U(t,n-i),U(t-r,n),U(t-r,n-i));else if(e.shape===1){var s=Math.min(Math.abs(n),Math.abs(n-i))/Math.min(Math.abs(t),Math.abs(t-r)),c=Mr(r,i,t,n,!0),l=c[0],u=c[1];a=U(l-t,(u-n)/s),o=s*a}break;case 1:e.shape===0?a=o=Math.max(Math.abs(t),Math.abs(t-r),Math.abs(n),Math.abs(n-i)):e.shape===1&&(a=Math.max(Math.abs(t),Math.abs(t-r)),o=Math.max(Math.abs(n),Math.abs(n-i)));break;case 3:if(e.shape===0)a=o=Math.max(U(t,n),U(t,n-i),U(t-r,n),U(t-r,n-i));else if(e.shape===1){var s=Math.max(Math.abs(n),Math.abs(n-i))/Math.max(Math.abs(t),Math.abs(t-r)),d=Mr(r,i,t,n,!1),l=d[0],u=d[1];a=U(l-t,(u-n)/s),o=s*a}break}return Array.isArray(e.size)&&(a=z(e.size[0],r),o=e.size.length===2?z(e.size[1],i):a),[a,o]},Pr=function(e,t){var n=B(180),r=[];return I(t).forEach(function(t,i){if(i===0){var a=t[0];if(a.type===20&&a.value===`to`){n=gr(t);return}else if(hr(a)){n=mr.parse(e,a);return}}var o=Or(e,t);r.push(o)}),{angle:n,stops:r,type:1}},Fr=function(e,t){var n=B(180),r=[];return I(t).forEach(function(t,i){if(i===0){var a=t[0];if(a.type===20&&[`top`,`left`,`right`,`bottom`].indexOf(a.value)!==-1){n=gr(t);return}else if(hr(a)){n=(mr.parse(e,a)+B(270))%B(360);return}}var o=Or(e,t);r.push(o)}),{angle:n,stops:r,type:1}},Ir=function(e,t){var n=B(180),r=[],i=1;return I(t).forEach(function(t,n){var a=t[0];if(n===0){if(F(a)&&a.value===`linear`){i=1;return}else if(F(a)&&a.value===`radial`){i=2;return}}if(a.type===18){if(a.name===`from`){var o=_r.parse(e,a.values[0]);r.push({stop:R,color:o})}else if(a.name===`to`){var o=_r.parse(e,a.values[0]);r.push({stop:cr,color:o})}else if(a.name===`color-stop`){var s=a.values.filter(rr);if(s.length===2){var o=_r.parse(e,s[1]),c=s[0];$n(c)&&r.push({stop:{type:16,number:c.number*100,flags:c.flags},color:o})}}}}),i===1?{angle:(n+B(180))%B(360),stops:r,type:i}:{size:3,shape:0,stops:r,position:[],type:i}},Lr=`closest-side`,Rr=`farthest-side`,zr=`closest-corner`,Br=`farthest-corner`,Vr=`circle`,Hr=`ellipse`,Ur=`cover`,Wr=`contain`,Gr=function(e,t){var n=0,r=3,i=[],a=[];return I(t).forEach(function(t,o){var s=!0;if(o===0){var c=!1;s=t.reduce(function(e,t){if(c)if(F(t))switch(t.value){case`center`:return a.push(sr),e;case`top`:case`left`:return a.push(R),e;case`right`:case`bottom`:return a.push(cr),e}else (L(t)||ar(t))&&a.push(t);else if(F(t))switch(t.value){case Vr:return n=0,!1;case Hr:return n=1,!1;case`at`:return c=!0,!1;case Lr:return r=0,!1;case Ur:case Rr:return r=1,!1;case Wr:case zr:return r=2,!1;case Br:return r=3,!1}else if(ar(t)||L(t))return Array.isArray(r)||(r=[]),r.push(t),!1;return e},s)}if(s){var l=Or(e,t);i.push(l)}}),{size:r,shape:n,stops:i,position:a,type:2}},Kr=function(e,t){var n=0,r=3,i=[],a=[];return I(t).forEach(function(t,o){var s=!0;if(o===0?s=t.reduce(function(e,t){if(F(t))switch(t.value){case`center`:return a.push(sr),!1;case`top`:case`left`:return a.push(R),!1;case`right`:case`bottom`:return a.push(cr),!1}else if(L(t)||ar(t))return a.push(t),!1;return e},s):o===1&&(s=t.reduce(function(e,t){if(F(t))switch(t.value){case Vr:return n=0,!1;case Hr:return n=1,!1;case Wr:case Lr:return r=0,!1;case Rr:return r=1,!1;case zr:return r=2,!1;case Ur:case Br:return r=3,!1}else if(ar(t)||L(t))return Array.isArray(r)||(r=[]),r.push(t),!1;return e},s)),s){var c=Or(e,t);i.push(c)}}),{size:r,shape:n,stops:i,position:a,type:2}},qr=function(e){return e.type===1},Jr=function(e){return e.type===2},Yr={name:`image`,parse:function(e,t){if(t.type===22){var n={url:t.value,type:0};return e.cache.addImage(t.value),n}if(t.type===18){var r=Zr[t.name];if(r===void 0)throw Error(`Attempting to parse an unsupported image function "`+t.name+`"`);return r(e,t.values)}throw Error(`Unsupported image type `+t.type)}};function Xr(e){return!(e.type===20&&e.value===`none`)&&(e.type!==18||!!Zr[e.name])}var Zr={"linear-gradient":Pr,"-moz-linear-gradient":Fr,"-ms-linear-gradient":Fr,"-o-linear-gradient":Fr,"-webkit-linear-gradient":Fr,"radial-gradient":Gr,"-moz-radial-gradient":Kr,"-ms-radial-gradient":Kr,"-o-radial-gradient":Kr,"-webkit-radial-gradient":Kr,"-webkit-gradient":Ir},Qr={name:`background-image`,initialValue:`none`,type:1,prefix:!1,parse:function(e,t){if(t.length===0)return[];var n=t[0];return n.type===20&&n.value===`none`?[]:t.filter(function(e){return rr(e)&&Xr(e)}).map(function(t){return Yr.parse(e,t)})}},$r={name:`background-origin`,initialValue:`border-box`,prefix:!1,type:1,parse:function(e,t){return t.map(function(e){if(F(e))switch(e.value){case`padding-box`:return 1;case`content-box`:return 2}return 0})}},ei={name:`background-position`,initialValue:`0% 0%`,type:1,prefix:!1,parse:function(e,t){return I(t).map(function(e){return e.filter(L)}).map(or)}},ti={name:`background-repeat`,initialValue:`repeat`,prefix:!1,type:1,parse:function(e,t){return I(t).map(function(e){return e.filter(F).map(function(e){return e.value}).join(` `)}).map(ni)}},ni=function(e){switch(e){case`no-repeat`:return 1;case`repeat-x`:case`repeat no-repeat`:return 2;case`repeat-y`:case`no-repeat repeat`:return 3;case`repeat`:default:return 0}},ri;(function(e){e.AUTO=`auto`,e.CONTAIN=`contain`,e.COVER=`cover`})(ri||={});var ii={name:`background-size`,initialValue:`0`,prefix:!1,type:1,parse:function(e,t){return I(t).map(function(e){return e.filter(ai)})}},ai=function(e){return F(e)||L(e)},oi=function(e){return{name:`border-`+e+`-color`,initialValue:`transparent`,prefix:!1,type:3,format:`color`}},si=oi(`top`),ci=oi(`right`),li=oi(`bottom`),ui=oi(`left`),di=function(e){return{name:`border-radius-`+e,initialValue:`0 0`,prefix:!1,type:1,parse:function(e,t){return or(t.filter(L))}}},fi=di(`top-left`),pi=di(`top-right`),mi=di(`bottom-right`),hi=di(`bottom-left`),gi=function(e){return{name:`border-`+e+`-style`,initialValue:`solid`,prefix:!1,type:2,parse:function(e,t){switch(t){case`none`:return 0;case`dashed`:return 2;case`dotted`:return 3;case`double`:return 4}return 1}}},_i=gi(`top`),vi=gi(`right`),yi=gi(`bottom`),bi=gi(`left`),xi=function(e){return{name:`border-`+e+`-width`,initialValue:`0`,type:0,prefix:!1,parse:function(e,t){return Qn(t)?t.number:0}}},Si=xi(`top`),Ci=xi(`right`),wi=xi(`bottom`),Ti=xi(`left`),Ei={name:`color`,initialValue:`transparent`,prefix:!1,type:3,format:`color`},Di={name:`direction`,initialValue:`ltr`,prefix:!1,type:2,parse:function(e,t){switch(t){case`rtl`:return 1;case`ltr`:default:return 0}}},Oi={name:`display`,initialValue:`inline-block`,prefix:!1,type:1,parse:function(e,t){return t.filter(F).reduce(function(e,t){return e|ki(t.value)},0)}},ki=function(e){switch(e){case`block`:case`-webkit-box`:return 2;case`inline`:return 4;case`run-in`:return 8;case`flow`:return 16;case`flow-root`:return 32;case`table`:return 64;case`flex`:case`-webkit-flex`:return 128;case`grid`:case`-ms-grid`:return 256;case`ruby`:return 512;case`subgrid`:return 1024;case`list-item`:return 2048;case`table-row-group`:return 4096;case`table-header-group`:return 8192;case`table-footer-group`:return 16384;case`table-row`:return 32768;case`table-cell`:return 65536;case`table-column-group`:return 131072;case`table-column`:return 262144;case`table-caption`:return 524288;case`ruby-base`:return 1048576;case`ruby-text`:return 2097152;case`ruby-base-container`:return 4194304;case`ruby-text-container`:return 8388608;case`contents`:return 16777216;case`inline-block`:return 33554432;case`inline-list-item`:return 67108864;case`inline-table`:return 134217728;case`inline-flex`:return 268435456;case`inline-grid`:return 536870912}return 0},Ai={name:`float`,initialValue:`none`,prefix:!1,type:2,parse:function(e,t){switch(t){case`left`:return 1;case`right`:return 2;case`inline-start`:return 3;case`inline-end`:return 4}return 0}},ji={name:`letter-spacing`,initialValue:`0`,prefix:!1,type:0,parse:function(e,t){return t.type===20&&t.value===`normal`?0:t.type===17||t.type===15?t.number:0}},Mi;(function(e){e.NORMAL=`normal`,e.STRICT=`strict`})(Mi||={});var Ni={name:`line-break`,initialValue:`normal`,prefix:!1,type:2,parse:function(e,t){switch(t){case`strict`:return Mi.STRICT;case`normal`:default:return Mi.NORMAL}}},Pi={name:`line-height`,initialValue:`normal`,prefix:!1,type:4},Fi=function(e,t){return F(e)&&e.value===`normal`?1.2*t:e.type===17?t*e.number:L(e)?z(e,t):t},Ii={name:`list-style-image`,initialValue:`none`,type:0,prefix:!1,parse:function(e,t){return t.type===20&&t.value===`none`?null:Yr.parse(e,t)}},Li={name:`list-style-position`,initialValue:`outside`,prefix:!1,type:2,parse:function(e,t){switch(t){case`inside`:return 0;case`outside`:default:return 1}}},Ri={name:`list-style-type`,initialValue:`none`,prefix:!1,type:2,parse:function(e,t){switch(t){case`disc`:return 0;case`circle`:return 1;case`square`:return 2;case`decimal`:return 3;case`cjk-decimal`:return 4;case`decimal-leading-zero`:return 5;case`lower-roman`:return 6;case`upper-roman`:return 7;case`lower-greek`:return 8;case`lower-alpha`:return 9;case`upper-alpha`:return 10;case`arabic-indic`:return 11;case`armenian`:return 12;case`bengali`:return 13;case`cambodian`:return 14;case`cjk-earthly-branch`:return 15;case`cjk-heavenly-stem`:return 16;case`cjk-ideographic`:return 17;case`devanagari`:return 18;case`ethiopic-numeric`:return 19;case`georgian`:return 20;case`gujarati`:return 21;case`gurmukhi`:return 22;case`hebrew`:return 22;case`hiragana`:return 23;case`hiragana-iroha`:return 24;case`japanese-formal`:return 25;case`japanese-informal`:return 26;case`kannada`:return 27;case`katakana`:return 28;case`katakana-iroha`:return 29;case`khmer`:return 30;case`korean-hangul-formal`:return 31;case`korean-hanja-formal`:return 32;case`korean-hanja-informal`:return 33;case`lao`:return 34;case`lower-armenian`:return 35;case`malayalam`:return 36;case`mongolian`:return 37;case`myanmar`:return 38;case`oriya`:return 39;case`persian`:return 40;case`simp-chinese-formal`:return 41;case`simp-chinese-informal`:return 42;case`tamil`:return 43;case`telugu`:return 44;case`thai`:return 45;case`tibetan`:return 46;case`trad-chinese-formal`:return 47;case`trad-chinese-informal`:return 48;case`upper-armenian`:return 49;case`disclosure-open`:return 50;case`disclosure-closed`:return 51;case`none`:default:return-1}}},zi=function(e){return{name:`margin-`+e,initialValue:`0`,prefix:!1,type:4}},Bi=zi(`top`),Vi=zi(`right`),Hi=zi(`bottom`),Ui=zi(`left`),Wi={name:`overflow`,initialValue:`visible`,prefix:!1,type:1,parse:function(e,t){return t.filter(F).map(function(e){switch(e.value){case`hidden`:return 1;case`scroll`:return 2;case`clip`:return 3;case`auto`:return 4;case`visible`:default:return 0}})}},Gi={name:`overflow-wrap`,initialValue:`normal`,prefix:!1,type:2,parse:function(e,t){switch(t){case`break-word`:return`break-word`;case`normal`:default:return`normal`}}},Ki=function(e){return{name:`padding-`+e,initialValue:`0`,prefix:!1,type:3,format:`length-percentage`}},qi=Ki(`top`),Ji=Ki(`right`),Yi=Ki(`bottom`),Xi=Ki(`left`),Zi={name:`text-align`,initialValue:`left`,prefix:!1,type:2,parse:function(e,t){switch(t){case`right`:return 2;case`center`:case`justify`:return 1;case`left`:default:return 0}}},Qi={name:`position`,initialValue:`static`,prefix:!1,type:2,parse:function(e,t){switch(t){case`relative`:return 1;case`absolute`:return 2;case`fixed`:return 3;case`sticky`:return 4}return 0}},$i={name:`text-shadow`,initialValue:`none`,type:1,prefix:!1,parse:function(e,t){return t.length===1&&tr(t[0],`none`)?[]:I(t).map(function(t){for(var n={color:H.TRANSPARENT,offsetX:R,offsetY:R,blur:R},r=0,i=0;i1?1:0],this.overflowWrap=G(e,Gi,t.overflowWrap),this.paddingTop=G(e,qi,t.paddingTop),this.paddingRight=G(e,Ji,t.paddingRight),this.paddingBottom=G(e,Yi,t.paddingBottom),this.paddingLeft=G(e,Xi,t.paddingLeft),this.paintOrder=G(e,Ea,t.paintOrder),this.position=G(e,Qi,t.position),this.textAlign=G(e,Zi,t.textAlign),this.textDecorationColor=G(e,fa,t.textDecorationColor??t.color),this.textDecorationLine=G(e,pa,t.textDecorationLine??t.textDecoration),this.textShadow=G(e,$i,t.textShadow),this.textTransform=G(e,ea,t.textTransform),this.transform=G(e,ta,t.transform),this.transformOrigin=G(e,aa,t.transformOrigin),this.visibility=G(e,oa,t.visibility),this.webkitTextStrokeColor=G(e,Da,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=G(e,Oa,t.webkitTextStrokeWidth),this.wordBreak=G(e,ca,t.wordBreak),this.zIndex=G(e,la,t.zIndex)}return e.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},e.prototype.isTransparent=function(){return vr(this.backgroundColor)},e.prototype.isTransformed=function(){return this.transform!==null},e.prototype.isPositioned=function(){return this.position!==0},e.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},e.prototype.isFloating=function(){return this.float!==0},e.prototype.isInlineLevel=function(){return W(this.display,4)||W(this.display,33554432)||W(this.display,268435456)||W(this.display,536870912)||W(this.display,67108864)||W(this.display,134217728)},e}(),Aa=function(){function e(e,t){this.content=G(e,ya,t.content),this.quotes=G(e,Ca,t.quotes)}return e}(),ja=function(){function e(e,t){this.counterIncrement=G(e,ba,t.counterIncrement),this.counterReset=G(e,xa,t.counterReset)}return e}(),G=function(e,t,n){var r=new Xn,i=n==null?t.initialValue:n.toString();r.write(i);var a=new Zn(r.read());switch(t.type){case 2:var o=a.parseComponentValue();return t.parse(e,F(o)?o.value:t.initialValue);case 0:return t.parse(e,a.parseComponentValue());case 1:return t.parse(e,a.parseComponentValues());case 4:return a.parseComponentValue();case 3:switch(t.format){case`angle`:return mr.parse(e,a.parseComponentValue());case`color`:return _r.parse(e,a.parseComponentValue());case`image`:return Yr.parse(e,a.parseComponentValue());case`length`:var s=a.parseComponentValue();return ar(s)?s:R;case`length-percentage`:var c=a.parseComponentValue();return L(c)?c:R;case`time`:return ua.parse(e,a.parseComponentValue())}break}},Ma=`data-html2canvas-debug`,Na=function(e){switch(e.getAttribute(Ma)){case`all`:return 1;case`clone`:return 2;case`parse`:return 3;case`render`:return 4;default:return 0}},Pa=function(e,t){var n=Na(e);return n===1||t===n},K=function(){function e(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Pa(t,3))debugger;this.styles=new ka(e,window.getComputedStyle(t,null)),xs(t)&&(this.styles.animationDuration.some(function(e){return e>0})&&(t.style.animationDuration=`0s`),this.styles.transform!==null&&(t.style.transform=`none`)),this.bounds=s(this.context,t),Pa(t,4)&&(this.flags|=16)}return e}(),Fa=`AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=`,Ia=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,La=typeof Uint8Array>`u`?[]:new Uint8Array(256),Ra=0;Ra>4,u[i++]=(o&15)<<4|s>>2,u[i++]=(s&3)<<6|c&63;return l},Ba=function(e){for(var t=e.length,n=[],r=0;r>Ha,qa=(1<>Ha)+32,Ya=65536>>Ua,Xa=(1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Ha],t=(t<>Ha)],t=(t<>Ua),t=this.index[t],t+=e>>Ha&Xa,t=this.index[t],t=(t<`u`?[]:new Uint8Array(256),ro=0;ro=55296&&i<=56319&&n>10)+55296,a%1024+56320)),(r+1===t||n.length>16384)&&(i+=String.fromCharCode.apply(String,n),n.length=0)}return i},xo=$a(Fa),So=`×`,Co=`÷`,wo=function(e){return xo.get(e)},To=function(e,t,n){var r=n-2,i=t[r],a=t[n-1],o=t[n];if(a===ao&&o===oo)return So;if(a===ao||a===oo||a===so||o===ao||o===oo||o===so)return Co;if(a===uo&&[uo,fo,mo,ho].indexOf(o)!==-1||(a===mo||a===fo)&&(o===fo||o===po)||(a===ho||a===po)&&o===po||o===go||o===co||o===lo||a===io)return So;if(a===go&&o===_o){for(;i===co;)i=t[--r];if(i===_o)return So}if(a===vo&&o===vo){for(var s=0;i===vo;)s++,i=t[--r];if(s%2==0)return So}return Co},Eo=function(e){var t=yo(e),n=t.length,r=0,i=0,a=t.map(wo);return{next:function(){if(r>=n)return{done:!0,value:null};for(var e=So;ro.x||i.y>o.y;return o=i,t===0?!0:s});return e.body.removeChild(t),s},Ao=function(){return new Image().crossOrigin!==void 0},jo=function(){return typeof new XMLHttpRequest().responseType==`string`},Mo=function(e){var t=new Image,n=e.createElement(`canvas`),r=n.getContext(`2d`);if(!r)return!1;t.src=`data:image/svg+xml,`;try{r.drawImage(t,0,0),n.toDataURL()}catch{return!1}return!0},No=function(e){return e[0]===0&&e[1]===255&&e[2]===0&&e[3]===255},Po=function(e){var t=e.createElement(`canvas`),n=100;t.width=n,t.height=n;var r=t.getContext(`2d`);if(!r)return Promise.reject(!1);r.fillStyle=`rgb(0, 255, 0)`,r.fillRect(0,0,n,n);var i=new Image,a=t.toDataURL();i.src=a;var o=Fo(n,n,0,0,i);return r.fillStyle=`red`,r.fillRect(0,0,n,n),Io(o).then(function(t){r.drawImage(t,0,0);var i=r.getImageData(0,0,n,n).data;r.fillStyle=`red`,r.fillRect(0,0,n,n);var o=e.createElement(`div`);return o.style.backgroundImage=`url(`+a+`)`,o.style.height=n+`px`,No(i)?Io(Fo(n,n,0,0,o)):Promise.reject(!1)}).then(function(e){return r.drawImage(e,0,0),No(r.getImageData(0,0,n,n).data)}).catch(function(){return!1})},Fo=function(e,t,n,r,i){var a=`http://www.w3.org/2000/svg`,o=document.createElementNS(a,`svg`),s=document.createElementNS(a,`foreignObject`);return o.setAttributeNS(null,`width`,e.toString()),o.setAttributeNS(null,`height`,t.toString()),s.setAttributeNS(null,`width`,`100%`),s.setAttributeNS(null,`height`,`100%`),s.setAttributeNS(null,`x`,n.toString()),s.setAttributeNS(null,`y`,r.toString()),s.setAttributeNS(null,`externalResourcesRequired`,`true`),o.appendChild(s),s.appendChild(i),o},Io=function(e){return new Promise(function(t,n){var r=new Image;r.onload=function(){return t(r)},r.onerror=n,r.src=`data:image/svg+xml;charset=utf-8,`+encodeURIComponent(new XMLSerializer().serializeToString(e))})},q={get SUPPORT_RANGE_BOUNDS(){var e=Oo(document);return Object.defineProperty(q,`SUPPORT_RANGE_BOUNDS`,{value:e}),e},get SUPPORT_WORD_BREAKING(){var e=q.SUPPORT_RANGE_BOUNDS&&ko(document);return Object.defineProperty(q,`SUPPORT_WORD_BREAKING`,{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=Mo(document);return Object.defineProperty(q,`SUPPORT_SVG_DRAWING`,{value:e}),e},get SUPPORT_FOREIGNOBJECT_DRAWING(){var e=typeof Array.from==`function`&&typeof window.fetch==`function`?Po(document):Promise.resolve(!1);return Object.defineProperty(q,`SUPPORT_FOREIGNOBJECT_DRAWING`,{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=Ao();return Object.defineProperty(q,`SUPPORT_CORS_IMAGES`,{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e=jo();return Object.defineProperty(q,`SUPPORT_RESPONSE_TYPE`,{value:e}),e},get SUPPORT_CORS_XHR(){var e=`withCredentials`in new XMLHttpRequest;return Object.defineProperty(q,`SUPPORT_CORS_XHR`,{value:e}),e},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var e=!!(typeof Intl<`u`&&Intl.Segmenter);return Object.defineProperty(q,`SUPPORT_NATIVE_TEXT_SEGMENTATION`,{value:e}),e}},Lo=function(){function e(e,t){this.text=e,this.bounds=t}return e}(),Ro=function(e,t,n,r){var i=Uo(t,n),a=[],s=0;return i.forEach(function(t){if(n.textDecorationLine.length||t.trim().length>0)if(q.SUPPORT_RANGE_BOUNDS){var i=Bo(r,s,t.length).getClientRects();if(i.length>1){var c=Vo(t),l=0;c.forEach(function(t){a.push(new Lo(t,o.fromDOMRectList(e,Bo(r,l+s,t.length).getClientRects()))),l+=t.length})}else a.push(new Lo(t,o.fromDOMRectList(e,i)))}else{var u=r.splitText(t.length);a.push(new Lo(t,zo(e,r))),r=u}else q.SUPPORT_RANGE_BOUNDS||(r=r.splitText(t.length));s+=t.length}),a},zo=function(e,t){var n=t.ownerDocument;if(n){var r=n.createElement(`html2canvaswrapper`);r.appendChild(t.cloneNode(!0));var i=t.parentNode;if(i){i.replaceChild(r,t);var a=s(e,r);return r.firstChild&&i.replaceChild(r.firstChild,r),a}}return o.EMPTY},Bo=function(e,t,n){var r=e.ownerDocument;if(!r)throw Error(`Node has no owner document`);var i=r.createRange();return i.setStart(e,t),i.setEnd(e,t+n),i},Vo=function(e){if(q.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:`grapheme`});return Array.from(t.segment(e)).map(function(e){return e.segment})}return Do(e)},Ho=function(e,t){if(q.SUPPORT_NATIVE_TEXT_SEGMENTATION){var n=new Intl.Segmenter(void 0,{granularity:`word`});return Array.from(n.segment(e)).map(function(e){return e.segment})}return Go(e,t)},Uo=function(e,t){return t.letterSpacing===0?Ho(e,t):Vo(e)},Wo=[32,160,4961,65792,65793,4153,4241],Go=function(e,t){for(var n=ft(e,{lineBreak:t.lineBreak,wordBreak:t.overflowWrap===`break-word`?`break-word`:t.wordBreak}),r=[],i,a=function(){if(i.value){var e=l(i.value.slice()),t=``;e.forEach(function(e){Wo.indexOf(e)===-1?t+=u(e):(t.length&&r.push(t),r.push(u(e)),t=``)}),t.length&&r.push(t)}};!(i=n.next()).done;)a();return r},Ko=function(){function e(e,t,n){this.text=qo(t.data,n.textTransform),this.textBounds=Ro(e,this.text,n,t)}return e}(),qo=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(Jo,Yo);case 2:return e.toUpperCase();default:return e}},Jo=/(^|\s|:|-|\(|\))([a-z])/g,Yo=function(e,t,n){return e.length>0?t+n.toUpperCase():e},Xo=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.src=n.currentSrc||n.src,r.intrinsicWidth=n.naturalWidth,r.intrinsicHeight=n.naturalHeight,r.context.cache.addImage(r.src),r}return n}(K),Zo=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.canvas=n,r.intrinsicWidth=n.width,r.intrinsicHeight=n.height,r}return n}(K),Qo=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this,i=new XMLSerializer,a=s(t,n);return n.setAttribute(`width`,a.width+`px`),n.setAttribute(`height`,a.height+`px`),r.svg=`data:image/svg+xml,`+encodeURIComponent(i.serializeToString(n)),r.intrinsicWidth=n.width.baseVal.value,r.intrinsicHeight=n.height.baseVal.value,r.context.cache.addImage(r.svg),r}return n}(K),$o=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.value=n.value,r}return n}(K),es=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.start=n.start,r.reversed=typeof n.reversed==`boolean`&&n.reversed===!0,r}return n}(K),ts=[{type:15,flags:0,unit:`px`,number:3}],ns=[{type:16,flags:0,number:50}],rs=function(e){return e.width>e.height?new o(e.left+(e.width-e.height)/2,e.top,e.height,e.height):e.width0)n.textNodes.push(new Ko(e,i,n.styles));else if(bs(i))if(Ls(i)&&i.assignedNodes)i.assignedNodes().forEach(function(t){return ms(e,t,n,r)});else{var o=hs(e,i);o.styles.isVisible()&&(_s(i,o,r)?o.flags|=4:vs(o.styles)&&(o.flags|=2),ps.indexOf(i.tagName)!==-1&&(o.flags|=8),n.elements.push(o),i.slot,i.shadowRoot?ms(e,i.shadowRoot,o,r):!Fs(i)&&!Ds(i)&&!Is(i)&&ms(e,i,o,r))}},hs=function(e,t){return js(t)?new Xo(e,t):ks(t)?new Zo(e,t):Ds(t)?new Qo(e,t):Cs(t)?new $o(e,t):ws(t)?new es(e,t):Ts(t)?new ls(e,t):Is(t)?new us(e,t):Fs(t)?new ds(e,t):Ms(t)?new fs(e,t):new K(e,t)},gs=function(e,t){var n=hs(e,t);return n.flags|=4,ms(e,t,n,n),n},_s=function(e,t,n){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||Os(e)&&n.styles.isTransparent()},vs=function(e){return e.isPositioned()||e.isFloating()},ys=function(e){return e.nodeType===Node.TEXT_NODE},bs=function(e){return e.nodeType===Node.ELEMENT_NODE},xs=function(e){return bs(e)&&e.style!==void 0&&!Ss(e)},Ss=function(e){return typeof e.className==`object`},Cs=function(e){return e.tagName===`LI`},ws=function(e){return e.tagName===`OL`},Ts=function(e){return e.tagName===`INPUT`},Es=function(e){return e.tagName===`HTML`},Ds=function(e){return e.tagName===`svg`},Os=function(e){return e.tagName===`BODY`},ks=function(e){return e.tagName===`CANVAS`},As=function(e){return e.tagName===`VIDEO`},js=function(e){return e.tagName===`IMG`},Ms=function(e){return e.tagName===`IFRAME`},Ns=function(e){return e.tagName===`STYLE`},Ps=function(e){return e.tagName===`SCRIPT`},Fs=function(e){return e.tagName===`TEXTAREA`},Is=function(e){return e.tagName===`SELECT`},Ls=function(e){return e.tagName===`SLOT`},Rs=function(e){return e.tagName.indexOf(`-`)>0},zs=function(){function e(){this.counters={}}return e.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},e.prototype.getCounterValues=function(e){return this.counters[e]||[]},e.prototype.pop=function(e){var t=this;e.forEach(function(e){return t.counters[e].pop()})},e.prototype.parse=function(e){var t=this,n=e.counterIncrement,r=e.counterReset,i=!0;n!==null&&n.forEach(function(e){var n=t.counters[e.counter];n&&e.increment!==0&&(i=!1,n.length||n.push(1),n[Math.max(0,n.length-1)]+=e.increment)});var a=[];return i&&r.forEach(function(e){var n=t.counters[e.counter];a.push(e.counter),n||=t.counters[e.counter]=[],n.push(e.reset)}),a},e}(),Bs={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:[`M`,`CM`,`D`,`CD`,`C`,`XC`,`L`,`XL`,`X`,`IX`,`V`,`IV`,`I`]},Vs={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:`Ք.Փ.Ւ.Ց.Ր.Տ.Վ.Ս.Ռ.Ջ.Պ.Չ.Ո.Շ.Ն.Յ.Մ.Ճ.Ղ.Ձ.Հ.Կ.Ծ.Խ.Լ.Ի.Ժ.Թ.Ը.Է.Զ.Ե.Դ.Գ.Բ.Ա`.split(`.`)},Hs={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:`י׳.ט׳.ח׳.ז׳.ו׳.ה׳.ד׳.ג׳.ב׳.א׳.ת.ש.ר.ק.צ.פ.ע.ס.נ.מ.ל.כ.יט.יח.יז.טז.טו.י.ט.ח.ז.ו.ה.ד.ג.ב.א`.split(`.`)},Us={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:`ჵ.ჰ.ჯ.ჴ.ხ.ჭ.წ.ძ.ც.ჩ.შ.ყ.ღ.ქ.ფ.ჳ.ტ.ს.რ.ჟ.პ.ო.ჲ.ნ.მ.ლ.კ.ი.თ.ჱ.ზ.ვ.ე.დ.გ.ბ.ა`.split(`.`)},Ws=function(e,t,n,r,i,a){return en?nc(e,i,a.length>0):r.integers.reduce(function(t,n,i){for(;e>=n;)e-=n,t+=r.values[i];return t},``)+a},Gs=function(e,t,n,r){var i=``;do n||e--,i=r(e)+i,e/=t;while(e*t>=t);return i},J=function(e,t,n,r,i){var a=n-t+1;return(e<0?`-`:``)+(Gs(Math.abs(e),a,r,function(e){return u(Math.floor(e%a)+t)})+i)},Ks=function(e,t,n){n===void 0&&(n=`. `);var r=t.length;return Gs(Math.abs(e),r,!1,function(e){return t[Math.floor(e%r)]})+n},qs=1,Js=2,Ys=4,Xs=8,Zs=function(e,t,n,r,i,a){if(e<-9999||e>9999)return nc(e,4,i.length>0);var o=Math.abs(e),s=i;if(o===0)return t[0]+s;for(var c=0;o>0&&c<=4;c++){var l=o%10;l===0&&W(a,qs)&&s!==``?s=t[l]+s:l>1||l===1&&c===0||l===1&&c===1&&W(a,Js)||l===1&&c===1&&W(a,Ys)&&e>100||l===1&&c>1&&W(a,Xs)?s=t[l]+(c>0?n[c-1]:``)+s:l===1&&c>0&&(s=n[c-1]+s),o=Math.floor(o/10)}return(e<0?r:``)+s},Qs=`十百千萬`,$s=`拾佰仟萬`,ec=`マイナス`,tc=`마이너스`,nc=function(e,t,n){var r=n?`. `:``,i=n?`、`:``,a=n?`, `:``,o=n?` `:``;switch(t){case 0:return`•`+o;case 1:return`◦`+o;case 2:return`◾`+o;case 5:var s=J(e,48,57,!0,r);return s.length<4?`0`+s:s;case 4:return Ks(e,`〇一二三四五六七八九`,i);case 6:return Ws(e,1,3999,Bs,3,r).toLowerCase();case 7:return Ws(e,1,3999,Bs,3,r);case 8:return J(e,945,969,!1,r);case 9:return J(e,97,122,!1,r);case 10:return J(e,65,90,!1,r);case 11:return J(e,1632,1641,!0,r);case 12:case 49:return Ws(e,1,9999,Vs,3,r);case 35:return Ws(e,1,9999,Vs,3,r).toLowerCase();case 13:return J(e,2534,2543,!0,r);case 14:case 30:return J(e,6112,6121,!0,r);case 15:return Ks(e,`子丑寅卯辰巳午未申酉戌亥`,i);case 16:return Ks(e,`甲乙丙丁戊己庚辛壬癸`,i);case 17:case 48:return Zs(e,`零一二三四五六七八九`,Qs,`負`,i,Js|Ys|Xs);case 47:return Zs(e,`零壹貳參肆伍陸柒捌玖`,$s,`負`,i,qs|Js|Ys|Xs);case 42:return Zs(e,`零一二三四五六七八九`,Qs,`负`,i,Js|Ys|Xs);case 41:return Zs(e,`零壹贰叁肆伍陆柒捌玖`,$s,`负`,i,qs|Js|Ys|Xs);case 26:return Zs(e,`〇一二三四五六七八九`,`十百千万`,ec,i,0);case 25:return Zs(e,`零壱弐参四伍六七八九`,`拾百千万`,ec,i,qs|Js|Ys);case 31:return Zs(e,`영일이삼사오육칠팔구`,`십백천만`,tc,a,qs|Js|Ys);case 33:return Zs(e,`零一二三四五六七八九`,`十百千萬`,tc,a,0);case 32:return Zs(e,`零壹貳參四五六七八九`,`拾百千`,tc,a,qs|Js|Ys);case 18:return J(e,2406,2415,!0,r);case 20:return Ws(e,1,19999,Us,3,r);case 21:return J(e,2790,2799,!0,r);case 22:return J(e,2662,2671,!0,r);case 22:return Ws(e,1,10999,Hs,3,r);case 23:return Ks(e,`あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん`);case 24:return Ks(e,`いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす`);case 27:return J(e,3302,3311,!0,r);case 28:return Ks(e,`アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン`,i);case 29:return Ks(e,`イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス`,i);case 34:return J(e,3792,3801,!0,r);case 37:return J(e,6160,6169,!0,r);case 38:return J(e,4160,4169,!0,r);case 39:return J(e,2918,2927,!0,r);case 40:return J(e,1776,1785,!0,r);case 43:return J(e,3046,3055,!0,r);case 44:return J(e,3174,3183,!0,r);case 45:return J(e,3664,3673,!0,r);case 46:return J(e,3872,3881,!0,r);case 3:default:return J(e,48,57,!0,r)}},rc=`data-html2canvas-ignore`,ic=function(){function e(e,t,n){if(this.context=e,this.options=n,this.scrolledElements=[],this.referenceElement=t,this.counters=new zs,this.quoteDepth=0,!t.ownerDocument)throw Error(`Cloned element does not have an owner document`);this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return e.prototype.toIFrame=function(e,t){var n=this,a=oc(e,t);if(!a.contentWindow)return Promise.reject(`Unable to find iframe window`);var o=e.defaultView.pageXOffset,s=e.defaultView.pageYOffset,c=a.contentWindow,l=c.document,u=lc(a).then(function(){return r(n,void 0,void 0,function(){var e,n;return i(this,function(r){switch(r.label){case 0:return this.scrolledElements.forEach(mc),c&&(c.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(c.scrollY!==t.top||c.scrollX!==t.left)&&(this.context.logger.warn(`Unable to restore scroll position for cloned document`),this.context.windowBounds=this.context.windowBounds.add(c.scrollX-t.left,c.scrollY-t.top,0,0))),e=this.options.onclone,n=this.clonedReferenceElement,n===void 0?[2,Promise.reject(`Error finding the `+this.referenceElement.nodeName+` in the cloned document`)]:l.fonts&&l.fonts.ready?[4,l.fonts.ready]:[3,2];case 1:r.sent(),r.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,cc(l)]:[3,4];case 3:r.sent(),r.label=4;case 4:return typeof e==`function`?[2,Promise.resolve().then(function(){return e(l,n)}).then(function(){return a})]:[2,a]}})})});return l.open(),l.write(fc(document.doctype)+``),pc(this.referenceElement.ownerDocument,o,s),l.replaceChild(l.adoptNode(this.documentElement),l.documentElement),l.close(),u},e.prototype.createElementClone=function(e){if(Pa(e,2))debugger;if(ks(e))return this.createCanvasClone(e);if(As(e))return this.createVideoClone(e);if(Ns(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return js(t)&&(js(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=``),t.loading===`lazy`&&(t.loading=`eager`)),Rs(t)?this.createCustomElementClone(t):t},e.prototype.createCustomElementClone=function(e){var t=document.createElement(`html2canvascustomelement`);return dc(e.style,t),t},e.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var n=[].slice.call(t.cssRules,0).reduce(function(e,t){return t&&typeof t.cssText==`string`?e+t.cssText:e},``),r=e.cloneNode(!1);return r.textContent=n,r}}catch(e){if(this.context.logger.error(`Unable to access cssRules property`,e),e.name!==`SecurityError`)throw e}return e.cloneNode(!1)},e.prototype.createCanvasClone=function(e){if(this.options.inlineImages&&e.ownerDocument){var t=e.ownerDocument.createElement(`img`);try{return t.src=e.toDataURL(),t}catch{this.context.logger.info(`Unable to inline canvas contents, canvas is tainted`,e)}}var n=e.cloneNode(!1);try{n.width=e.width,n.height=e.height;var r=e.getContext(`2d`),i=n.getContext(`2d`);if(i)if(!this.options.allowTaint&&r)i.putImageData(r.getImageData(0,0,e.width,e.height),0,0);else{var a=e.getContext(`webgl2`)??e.getContext(`webgl`);a&&a.getContextAttributes()?.preserveDrawingBuffer===!1&&this.context.logger.warn(`Unable to clone WebGL context as it has preserveDrawingBuffer=false`,e),i.drawImage(e,0,0)}return n}catch{this.context.logger.info(`Unable to clone canvas as it is tainted`,e)}return n},e.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement(`canvas`);t.width=e.offsetWidth,t.height=e.offsetHeight;var n=t.getContext(`2d`);try{return n&&(n.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||n.getImageData(0,0,t.width,t.height)),t}catch{this.context.logger.info(`Unable to clone video as it is tainted`,e)}var r=e.ownerDocument.createElement(`canvas`);return r.width=e.offsetWidth,r.height=e.offsetHeight,r},e.prototype.appendChildNode=function(e,t,n){(!bs(t)||!Ps(t)&&!t.hasAttribute(rc)&&(typeof this.options.ignoreElements!=`function`||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!bs(t)||!Ns(t))&&e.appendChild(this.cloneNode(t,n))},e.prototype.cloneChildNodes=function(e,t,n){for(var r=this,i=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;i;i=i.nextSibling)if(bs(i)&&Ls(i)&&typeof i.assignedNodes==`function`){var a=i.assignedNodes();a.length&&a.forEach(function(e){return r.appendChildNode(t,e,n)})}else this.appendChildNode(t,i,n)},e.prototype.cloneNode=function(e,t){if(ys(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var n=e.ownerDocument.defaultView;if(n&&bs(e)&&(xs(e)||Ss(e))){var r=this.createElementClone(e);r.style.transitionProperty=`none`;var i=n.getComputedStyle(e),a=n.getComputedStyle(e,`:before`),o=n.getComputedStyle(e,`:after`);this.referenceElement===e&&xs(r)&&(this.clonedReferenceElement=r),Os(r)&&bc(r);var s=this.counters.parse(new ja(this.context,i)),c=this.resolvePseudoContent(e,r,a,ac.BEFORE);Rs(e)&&(t=!0),As(e)||this.cloneChildNodes(e,r,t),c&&r.insertBefore(c,r.firstChild);var l=this.resolvePseudoContent(e,r,o,ac.AFTER);return l&&r.appendChild(l),this.counters.pop(s),(i&&(this.options.copyStyles||Ss(e))&&!Ms(e)||t)&&dc(i,r),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(Fs(e)||Is(e))&&(Fs(r)||Is(r))&&(r.value=e.value),r}return e.cloneNode(!1)},e.prototype.resolvePseudoContent=function(e,t,n,r){var i=this;if(n){var a=n.content,o=t.ownerDocument;if(!(!o||!a||a===`none`||a===`-moz-alt-content`||n.display===`none`)){this.counters.parse(new ja(this.context,n));var s=new Aa(this.context,n),c=o.createElement(`html2canvaspseudoelement`);dc(n,c),s.content.forEach(function(t){if(t.type===0)c.appendChild(o.createTextNode(t.value));else if(t.type===22){var n=o.createElement(`img`);n.src=t.value,n.style.opacity=`1`,c.appendChild(n)}else if(t.type===18){if(t.name===`attr`){var r=t.values.filter(F);r.length&&c.appendChild(o.createTextNode(e.getAttribute(r[0].value)||``))}else if(t.name===`counter`){var a=t.values.filter(rr),l=a[0],u=a[1];if(l&&F(l)){var d=i.counters.getCounterValue(l.value),f=u&&F(u)?Ri.parse(i.context,u.value):3;c.appendChild(o.createTextNode(nc(d,f,!1)))}}else if(t.name===`counters`){var p=t.values.filter(rr),l=p[0],m=p[1],u=p[2];if(l&&F(l)){var h=i.counters.getCounterValues(l.value),g=u&&F(u)?Ri.parse(i.context,u.value):3,_=m&&m.type===0?m.value:``,v=h.map(function(e){return nc(e,g,!1)}).join(_);c.appendChild(o.createTextNode(v))}}}else if(t.type===20)switch(t.value){case`open-quote`:c.appendChild(o.createTextNode(wa(s.quotes,i.quoteDepth++,!0)));break;case`close-quote`:c.appendChild(o.createTextNode(wa(s.quotes,--i.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(t.value))}}),c.className=_c+` `+vc;var l=r===ac.BEFORE?` `+_c:` `+vc;return Ss(t)?t.className.baseValue+=l:t.className+=l,c}}},e.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},e}(),ac;(function(e){e[e.BEFORE=0]=`BEFORE`,e[e.AFTER=1]=`AFTER`})(ac||={});var oc=function(e,t){var n=e.createElement(`iframe`);return n.className=`html2canvas-container`,n.style.visibility=`hidden`,n.style.position=`fixed`,n.style.left=`-10000px`,n.style.top=`0px`,n.style.border=`0`,n.width=t.width.toString(),n.height=t.height.toString(),n.scrolling=`no`,n.setAttribute(rc,`true`),e.body.appendChild(n),n},sc=function(e){return new Promise(function(t){if(e.complete){t();return}if(!e.src){t();return}e.onload=t,e.onerror=t})},cc=function(e){return Promise.all([].slice.call(e.images,0).map(sc))},lc=function(e){return new Promise(function(t,n){var r=e.contentWindow;if(!r)return n(`No window assigned for iframe`);var i=r.document;r.onload=e.onload=function(){r.onload=e.onload=null;var n=setInterval(function(){i.body.childNodes.length>0&&i.readyState===`complete`&&(clearInterval(n),t(e))},50)}})},uc=[`all`,`d`,`content`],dc=function(e,t){for(var n=e.length-1;n>=0;n--){var r=e.item(n);uc.indexOf(r)===-1&&t.style.setProperty(r,e.getPropertyValue(r))}return t},fc=function(e){var t=``;return e&&(t+=``),t},pc=function(e,t,n){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||n!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,n)},mc=function(e){var t=e[0],n=e[1],r=e[2];t.scrollLeft=n,t.scrollTop=r},hc=`:before`,gc=`:after`,_c=`___html2canvas___pseudoelement_before`,vc=`___html2canvas___pseudoelement_after`,yc=`{ content: "" !important; display: none !important; }`,bc=function(e){xc(e,`.`+_c+hc+yc+` diff --git a/dist/assets/html2canvas-Dw4vJfGn.js b/dist/assets/html2canvas-Dw4vJfGn.js deleted file mode 100644 index 8d395252..00000000 --- a/dist/assets/html2canvas-Dw4vJfGn.js +++ /dev/null @@ -1 +0,0 @@ -import{t as e}from"./html2canvas-wYdasO3I.js";export default e(); \ No newline at end of file diff --git a/dist/assets/index-BGzUQCv_.js b/dist/assets/index-CcPm2yTY.js similarity index 99% rename from dist/assets/index-BGzUQCv_.js rename to dist/assets/index-CcPm2yTY.js index 81fc7d27..3df12979 100644 --- a/dist/assets/index-BGzUQCv_.js +++ b/dist/assets/index-CcPm2yTY.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KaiVohModal-DRgYu3Ad.js","assets/x-B04jFFwi.js","assets/SigilAuthContext-Bpha3aI1.js","assets/SigilAuthProvider-Bf4S4o9t.js","assets/KaiVohModal-BoBXtABf.css","assets/SigilModal-Bw4sFNR6.js","assets/html2canvas-wYdasO3I.js","assets/SealMomentModal-S7F0w9ki.js","assets/SigilModal-Dtnhs3XF.js","assets/SigilModal-DGdZ8fUg.css","assets/HomePriceChartCard-CMBb8I-f.js","assets/prop-types-CQvzhoSE.js","assets/HomePriceChartCard-CJ53Phm1.css","assets/SigilExplorer-Be22x_Dh.js","assets/usernameClaimRegistry-BEUaCJlN.js","assets/SigilExplorer-Cps9vI9P.css","assets/EternalKlock-CHwy1bt-.js","assets/EternalKlock-DJuhZsZB.js","assets/EternalKlock-6uoAd3Qk.css","assets/SigilStreamRoot-CHI2vpVS.js","assets/SigilStreamRoot-lWOSVrBM.js","assets/sigilRegistry-DVCHqg2o.js","assets/sigilRegistry-Cw7cMZ5l.css","assets/useFastPress-Cbh2am8D.js","assets/SigilStreamRoot-w6_y4vVF.css","assets/SigilFeedPage-CYooRvDo.js","assets/SigilFeedPage-CqIDmlsu.css","assets/SigilPage-ECNAzu9S.js","assets/svgMeta-B547igV7.js","assets/SigilPage-BE_ftg2I.css","assets/VerifyPage-Qyj4E4nU.js","assets/VerifierFrame-CwEJNPi9.js","assets/VerifierFrame-D0e_dB-R.css","assets/VerifyPage-jbjk8aGt.css"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KaiVohModal-Bbtn2GfV.js","assets/x-B0A9hqeh.js","assets/SigilAuthContext-CZfkVeGy.js","assets/SigilAuthProvider-Crre0ykb.js","assets/KaiVohModal-BoBXtABf.css","assets/SigilModal-BvJNBKka.js","assets/html2canvas-CgVfYVZf.js","assets/SealMomentModal-BotOOPRg.js","assets/SigilModal-B4XBfcke.js","assets/SigilModal-DGdZ8fUg.css","assets/HomePriceChartCard-CG0g_aGu.js","assets/prop-types-CQ3MXKCa.js","assets/HomePriceChartCard-CJ53Phm1.css","assets/SigilExplorer-YG_XvkA-.js","assets/usernameClaimRegistry-_VlzEwdK.js","assets/SigilExplorer-Cps9vI9P.css","assets/EternalKlock-D-hEMVRl.js","assets/EternalKlock-DTPPu1Hz.js","assets/EternalKlock-6uoAd3Qk.css","assets/SigilStreamRoot-BUh8LwJG.js","assets/SigilStreamRoot-D0R_paBX.js","assets/sigilRegistry-NyXrDYsE.js","assets/sigilRegistry-Cw7cMZ5l.css","assets/useFastPress-BuTJ0eyZ.js","assets/SigilStreamRoot-w6_y4vVF.css","assets/SigilFeedPage-DGJJwxYi.js","assets/SigilFeedPage-CqIDmlsu.css","assets/SigilPage-DF86EQ7y.js","assets/svgMeta-BqZogknt.js","assets/SigilPage-BE_ftg2I.css","assets/VerifyPage-B34sC8R1.js","assets/VerifierFrame-Dr7oGdbu.js","assets/VerifierFrame-D0e_dB-R.css","assets/VerifyPage-jbjk8aGt.css"])))=>i.map(i=>d[i]); var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(e&&(t=e(e=0)),t),s=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),c=e=>{let n={};for(var r in e)t(n,r,{get:e[r],enumerable:!0});return n},l=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},u=(n,r,a)=>(a=n==null?{}:e(i(n)),l(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),d=e=>l(t({},`__esModule`,{value:!0}),e),f=e=>t=>u(t.default,e),p=(e=>typeof require<`u`?require:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof require<`u`?require:e)[t]}):e)(function(e){if(typeof require<`u`)return require.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function.")});(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var m=s((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u{t.exports=m()})),g=s((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-Tt&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),_=s(((e,t)=>{t.exports=g()})),v=s((e=>{var t=h();function n(e){var t=`https://react.dev/errors/`+e;if(1{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=v()})),b=s((e=>{var t=_(),n=h(),r=y();function i(e){var t=`https://react.dev/errors/`+e;if(1B||(e.current=z[B],z[B]=null,B--)}function U(e,t){B++,z[B]=e.current,e.current=t}var ee=V(null),te=V(null),ne=V(null),re=V(null);function ie(e,t){switch(U(ne,t),U(te,e),U(ee,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Yd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Yd(t),e=Xd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}H(ee),U(ee,e)}function ae(){H(ee),H(te),H(ne)}function oe(e){e.memoizedState!==null&&U(re,e);var t=ee.current,n=Xd(t,e.type);t!==n&&(U(te,e),U(ee,n))}function se(e){te.current===e&&(H(ee),H(te)),re.current===e&&(H(re),op._currentValue=R)}var ce,le;function ue(e){if(ce===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ce=t&&t[1]||``,le=-1)`:-1 to String(e).padStart(2,`0`);return{beat1:n,step1:r,label:`${i(n)}:${i(r)}`}}function Ur(e,t){let n=Math.max(0,Math.min(35,Math.floor(e))),r=Math.max(0,Math.min(43,Math.floor(t)));return`${n}:${String(r).padStart(2,`0`)}`}function Wr(e,t){return Lr(e,t)}function Gr(e){return Fr(e)}function Kr(e){return typeof e==`bigint`?jr(e):br()}function qr(e){return Pr(Kr(e))}var Jr=51.4769,Yr=0,Xr=Math.PI/180,Zr=1/(2*Math.PI),Qr=2440587.5,$r=new Map;function ei(e){return e/864e5+Qr}function ti(e){return(e-Qr)*864e5}function ni(e){let t=e%360;return t<0?t+360:t}function ri(e,t,n){return en?n:e}function ii(e){let t=new Date(Number(e));return{y:t.getUTCFullYear(),m:t.getUTCMonth()+1,d:t.getUTCDate()}}function ai(e,t){let n=-t*Xr,r=Math.round(e-2451545.0009-n*Zr);return 2451545.0009+n*Zr+r}function oi(e,t,n,r=Jr,i=Yr){let a=ai(ei(Date.UTC(e,t-1,n)),i),o=357.5291+.98560028*(a-2451545),s=o*Xr,c=ni(o+(1.9148*Math.sin(s)+.02*Math.sin(2*s)+3e-4*Math.sin(3*s))+180+102.9372)*Xr,l=a+.0053*Math.sin(s)-.0069*Math.sin(2*c),u=23.4397*Xr,d=Math.asin(Math.sin(c)*Math.sin(u)),f=r*Xr,p=-.833*Xr,m=(Math.sin(p)-Math.sin(f)*Math.sin(d))/(Math.cos(f)*Math.cos(d));return l-Math.acos(ri(m,-1,1))*Zr}function si(e){let{y:t,m:n,d:r}=ii(e),i=`${t}-${String(n).padStart(2,`0`)}-${String(r).padStart(2,`0`)}`,a=$r.get(i);if(a!==void 0)return a;let o=oi(t,n,r),s=BigInt(Math.round(ti(o)));return $r.set(i,s),s}var ci=[`Ignition Ark`,`Integration Ark`,`Harmonization Ark`,`Reflection Ark`,`Purification Ark`,`Dream Ark`],li={"Ignition Ark":`Ignite Ark`,"Integration Ark":`Integration Ark`,"Harmonization Ark":`Harmonization Ark`,"Reflection Ark":`Reflection Ark`,"Purification Ark":`Purify Ark`,"Dream Ark":`Dream Ark`},ui={"Ignition Ark":`Resurrection, will, awakening`,"Integration Ark":`Emotional grounding, emergence`,"Harmonization Ark":`Radiance, balance, coherent action`,"Reflection Ark":`Union, compassion, spoken resonance`,"Purification Ark":`Truth, remembrance, etheric light`,"Dream Ark":`Divine memory, lucid integration, dreaming awake`},di=[{name:`Aethon`,desc:`Resurrection fire: Root awakening`},{name:`Virelai`,desc:`Waters of becoming: Emotional emergence`},{name:`Solari`,desc:`Solar ignition: Radiant embodiment`},{name:`Amarin`,desc:`Heart bloom: Sacred balance`},{name:`Kaelus`,desc:`Voice of stars: Resonant expression`},{name:`Umbriel`,desc:`Divine remembrance: Krown alignment`},{name:`Noktura`,desc:`Light spiral: Selestial flow`},{name:`Liora`,desc:`Eternal mirror: Infinite now`}],fi=[{name:`Awakening Flame`,desc:`Root fire of ignition, will, resurrektion`},{name:`Flowing Heart`,desc:`Emotional waters, intimasy, surrender`},{name:`Radiant Will`,desc:`Solar klarity, aligned konfidence, embodiment`},{name:`Harmonic Voice`,desc:`Spoken truth, vibration, koherense in sound`},{name:`Inner Mirror`,desc:`Reflektion, purifikation, self-seeing`},{name:`Dreamfire Memory`,desc:`Lusid vision, divine memory, encoded light`},{name:`Krowned Light`,desc:`Integration, sovereignty, harmonik ascension`}],pi=44,mi=36;function hi(e){let t=Math.max(0,Math.min(5,Math.floor(e/6))),n=ci[t];return{idx:t,name:n,desc:ui[n]}}function gi(e,t){if(t===0n)return 0;let n=Number(e)/Number(t);return n<0?0:n>1?1:n}function _i(e,t=2){return(e*100).toFixed(t)}function vi(e){return e<10?`0${e}`:String(e)}function yi(e){return Number(e>9007199254740991n?9007199254740991n:e<-9007199254740991n?-9007199254740991n:e)}function bi(e){let t=(1+Math.sqrt(5))/2,n=Math.max(1,e);return Math.floor(Math.log(n)/Math.log(t))}function xi(e){return ar(e,Sr)}function Si(e){let t=e+719468n,n=Dr(t,146097n),r=t-n*146097n,i=Dr(r-Dr(r,1460n)+Dr(r,36524n)-Dr(r,146096n),365n),a=i+n*400n,o=r-(365n*i+Dr(i,4n)-Dr(i,100n)),s=Dr(5n*o+2n,153n),c=o-Dr(153n*s+2n,5n)+1n,l=s<10n?s+3n:s-9n;return{year:l<=2n?a+1n:a,month:l<=2n?l+12n-12n:l,day:c}}var Ci=Or(2024n,5n,11n);function wi(e){let t=si(e);if(e`u`||typeof document>`u`)return!1;let e=navigator,t=window.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches??!1,n=window.matchMedia?.(`(prefers-reduced-transparency: reduce)`)?.matches??!1;return t||n||typeof e.deviceMemory==`number`&&e.deviceMemory<=4||typeof e.hardwareConcurrency==`number`&&e.hardwareConcurrency<=4}function Bi(){(0,C.useEffect)(()=>{if(typeof document>`u`)return;let e=document.documentElement;zi()?e.dataset.perf=`low`:delete e.dataset.perf},[])}const Vi=`sigil:explorer:open`;var Hi=s((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Ui=s(((e,t)=>{t.exports=Hi()})),W=u(Ui(),1);function Wi(){return window.innerWidth-document.documentElement.clientWidth}function Gi(e){return Array.from(e.querySelectorAll(`a[href],button:not([disabled]),textarea,input,select,[tabindex]:not([tabindex="-1"])`)).filter(e=>!e.hasAttribute(`disabled`)&&e.tabIndex!==-1)}function Ki(){let[e,t]=(0,C.useState)(!1),n=(0,C.useId)(),r=(0,C.useId)(),i=(0,C.useId)(),a=(0,C.useRef)(null),o=(0,C.useRef)(null),s=(0,C.useRef)(null),c=(0,C.useRef)(null),l=(0,C.useCallback)(()=>t(!1),[]),u=(0,C.useCallback)(()=>t(!0),[]),d=(0,C.useMemo)(()=>`Kairos Notes — Legal Tender`,[]);return(0,C.useEffect)(()=>{if(!e)return;let t=document.body.style.overflow,n=document.body.style.paddingRight,r=Wi();document.body.style.overflow=`hidden`,r>0&&(document.body.style.paddingRight=`${r}px`);let i=document.activeElement,u=i instanceof HTMLElement?i:a.current,d=e=>{if(e.key===`Escape`){e.preventDefault(),l();return}if(e.key===`Tab`){let t=o.current;if(!t)return;let n=Gi(t);if(n.length===0)return;let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey?(!a||a===r)&&(e.preventDefault(),i.focus()):a===i&&(e.preventDefault(),r.focus())}};return window.addEventListener(`keydown`,d,{capture:!0}),requestAnimationFrame(()=>{(s.current??c.current)?.focus()}),()=>{window.removeEventListener(`keydown`,d,{capture:!0}),document.body.style.overflow=t,document.body.style.paddingRight=n,requestAnimationFrame(()=>{u&&`focus`in u?u.focus():a.current?.focus()})}},[e,l]),(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`nav-foot`,"aria-label":`Sovereign declarations`,children:(0,W.jsxs)(`button`,{ref:a,type:`button`,className:`nav-foot__toggle`,onClick:u,"aria-haspopup":`dialog`,"aria-expanded":e,"aria-controls":n,children:[(0,W.jsx)(`span`,{className:`nav-foot__badge`,"aria-hidden":`true`,children:(0,W.jsx)(`img`,{className:`nav-foot__phiLogo`,src:`/phi.svg`,alt:``,draggable:!1})}),(0,W.jsxs)(`span`,{className:`nav-foot__main`,children:[(0,W.jsx)(`span`,{className:`nav-foot__kicker`,children:`SOVEREIGN WRIT`}),(0,W.jsx)(`span`,{className:`nav-foot__summary`,children:d})]}),(0,W.jsx)(`span`,{className:`nav-foot__chev`,"aria-hidden":`true`,children:(0,W.jsx)(`span`,{className:`nav-foot__chevIcon`,"aria-hidden":`true`,children:(0,W.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,children:(0,W.jsx)(`path`,{d:`M9 18l6-6-6-6`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})})})})]})}),e&&(0,w.createPortal)((0,W.jsxs)(`div`,{className:`nav-footSheet`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":r,"aria-describedby":i,id:n,children:[(0,W.jsx)(`button`,{type:`button`,className:`nav-footSheet__backdrop`,"aria-label":`Dismiss`,onClick:l}),(0,W.jsxs)(`div`,{ref:o,className:`nav-footSheet__panel`,role:`document`,children:[(0,W.jsxs)(`div`,{className:`nav-footSheet__head`,children:[(0,W.jsxs)(`div`,{className:`nav-footSheet__titleWrap`,children:[(0,W.jsxs)(`div`,{className:`nav-footSheet__title`,id:r,children:[(0,W.jsx)(`img`,{className:`nav-footSheet__phiLogo`,src:`/phi.svg`,alt:``,"aria-hidden":`true`,draggable:!1}),` `,`Sovereign Writ`]}),(0,W.jsx)(`div`,{className:`nav-footSheet__sub`,children:`Official instrument of value & transfer — Kairos-native, breath-backed, offline-verifiable.`})]}),(0,W.jsx)(`button`,{ref:c,type:`button`,className:`nav-footSheet__close`,onClick:l,"aria-label":`Dismiss`,title:`Dismiss`,children:(0,W.jsx)(`span`,{className:`nav-footSheet__closeIcon`,"aria-hidden":`true`,children:(0,W.jsxs)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,W.jsx)(`path`,{d:`M18 6L6 18`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M6 6L18 18`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`})]})})})]}),(0,W.jsxs)(`div`,{className:`nav-footSheet__body`,id:i,children:[(0,W.jsxs)(`p`,{className:`nav-foot__line`,children:[(0,W.jsx)(`strong`,{children:` Kairos Notes`}),` are legal tender — sealed by `,(0,W.jsx)(`strong`,{children:`Proof of Breath™`}),`, pulsed by `,(0,W.jsx)(`strong`,{children:`Kai-Signature™`}),`, auditable as: Σ → SHA-256(Σ) → Φ.`]}),(0,W.jsxs)(`p`,{className:`nav-foot__line`,children:[(0,W.jsx)(`strong`,{children:`Sigil-Glyphs`}),` are origin ΦKey seals for minting, custody, and lawful transfer. Derivative glyphs maintain sovereign lineage and are redeemable by re-inhale.`]}),(0,W.jsx)(`div`,{className:`nav-footSheet__divider`,role:`separator`,"aria-hidden":`true`}),(0,W.jsx)(`p`,{className:`nav-foot__line nav-foot__line--fine`,children:`Operational Mandate: readable offline, provable by breath-writ, unforgeable without determinate seals.`}),(0,W.jsx)(`p`,{className:`nav-foot__line nav-foot__line--fine`,children:`This writ exists independent of domains, DNS, or consensus. It is sealed in breath, bound in math, and verifiable by anyone who remembers the pulse.`})]}),(0,W.jsx)(`div`,{className:`nav-footSheet__foot`,children:(0,W.jsx)(`button`,{ref:s,type:`button`,className:`nav-footSheet__cta`,onClick:l,children:`Seal Acknowledged`})})]})]}),document.body)]})}const qi=`kairos:sw-version`;var Ji=u(y(),1),Yi=(0,C.lazy)(()=>O(()=>import(`./KaiVohModal-DRgYu3Ad.js`),__vite__mapDeps([0,1,2,3,4]))),Xi=(0,C.lazy)(()=>O(()=>import(`./SigilModal-Bw4sFNR6.js`),__vite__mapDeps([5,6,7,8,9]))),Zi=(0,C.lazy)(()=>O(()=>import(`./HomePriceChartCard-CMBb8I-f.js`),__vite__mapDeps([10,11,12]))),Qi=(0,C.lazy)(()=>O(()=>import(`./SigilExplorer-Be22x_Dh.js`),__vite__mapDeps([13,14,15]))),$i=(0,C.lazy)(()=>O(()=>import(`./EternalKlock-CHwy1bt-.js`),__vite__mapDeps([16,17,8,6,7,9,18])));function ea(){if(!(typeof document>`u`||typeof window>`u`)&&window.location.pathname===`/`){for(let e of[`app-splash`,`pwa-splash`,`splash`,`splash-screen`,`boot-splash`]){let t=document.getElementById(e);t&&t.remove()}document.querySelectorAll(`[data-splash], .app-splash, .pwa-splash, .splash-screen, .splash, .boot-splash`).forEach(e=>e.remove())}}try{ea()}catch{}var ta=typeof window<`u`?C.useLayoutEffect:C.useEffect,na=[`/sigil.wasm`,`/sigil.zkey`,`/sigil.artifacts.json`,`/sigil.vkey.json`,`/verification_key.json`,`/verifier-core.js`,`/verifier.inline.html`,`/verifier.html`,`/pdf-lib.min.js`],ra=[`/`,`/mint`,`/voh`,`/keystream`,`/klock`,`/klok`,`/sigil/new`,`/pulse`,`/verify`,...[`/stream`,`/stream/p`,`/stream/c`,`/feed`,`/feed/p`,`/p`,`/p~`]],ia=[`/`,`/?source=pwa`,`/index.html`],aa=[{to:`/`,label:`Verifier`,desc:`Inhale + Exhale`,end:!0},{to:`/mint`,label:`Mint ΦKey`,desc:`Breath-minted seal`},{to:`/voh`,label:`KaiVoh`,desc:`Memory OS`},{to:`/keystream`,label:`ΦStream`,desc:`Live keystream`}],oa=`137.66.18.241`,sa=3+Math.sqrt(5),ca=sa*1e3,la=17491.270421,ua=36,da=44,fa=ua*da,pa=17491.270421,ma=[`var(--chakra-ark-0)`,`var(--chakra-ark-1)`,`var(--chakra-ark-2)`,`var(--chakra-ark-3)`,`var(--chakra-ark-4)`,`var(--chakra-ark-5)`],ha={Root:`var(--chakra-ink-0)`,Sacral:`var(--chakra-ink-1)`,"Solar Plexus":`var(--chakra-ink-2)`,Heart:`var(--chakra-ink-3)`,Throat:`var(--chakra-ink-4)`,"Third Eye":`var(--chakra-ink-5)`,Crown:`var(--chakra-ink-6)`},ga=[`#ff7a7a`,`#ffbd66`,`#ffe25c`,`#86ff86`,`#79c2ff`,`#c99aff`,`#e29aff`,`#e5e5e5`],_a=1000000n,va=`phi_kai_anchor_pmicro_v1`,ya=`phi_kai_anchor_msutc_v1`,ba={anchor:null};function xa(e,t){let n=e/t,r=e%t;return r!==0n&&r>0n!=t>0n?n-1n:n}function Sa(e){if(!Number.isFinite(e))return 0n;let t=e<0?-1:1,n=Math.abs(e),r=Math.trunc(n),i=n-r;return i<.5?BigInt(t*r):i>.5?BigInt(t*(r+1)):BigInt(t*(r%2==0?r:r+1))}function Ca(e){if(typeof window>`u`)return null;try{let t=window.localStorage.getItem(e);return!t||!/^-?\d+$/.test(t.trim())?null:BigInt(t.trim())}catch{return null}}function wa(e,t){if(!(typeof window>`u`))try{window.localStorage.setItem(e,t.toString())}catch{}}function Ta(e){if(typeof window>`u`)return null;try{let t=window.localStorage.getItem(e);if(!t)return null;let n=Number(t);return!Number.isFinite(n)||n<=0?null:Math.floor(n)}catch{return null}}function Ea(e){return Sa((e-In)/qn*1e6)}function Da(e){let t=xa(e,_a);if(t>=0n&&t<500000000n)return e;let n=e/1000n,r=BigInt(2**53-1),i=BigInt(-(2**53-1));if(n>r||n0n&&n<4000000000000n){let e=Number(n);if(Number.isFinite(e))return Ea(e)}return n}catch{return null}}function ka(){return Da(Kr())}function Aa(){if(ba.anchor)return ba.anchor;if(typeof window>`u`)return ba.anchor={pμ0:0n,perf0:0,source:`kpp`},ba.anchor;let e=window.performance.now(),t=Ca(va);if(t!==null&&t>0n)return ba.anchor={pμ0:t,perf0:e,source:`storage`},ba.anchor;let n=Ta(ya);if(n!==null&&n>0){let t=Ea(n);if(t>0n)return wa(va,t),ba.anchor={pμ0:t,perf0:e,source:`storage`},ba.anchor}let r=Oa();if(r!==null&&r>0n)return wa(va,r),ba.anchor={pμ0:r,perf0:e,source:`env`},ba.anchor;let i=ka();return i>0n&&wa(va,i),ba.anchor={pμ0:i,perf0:e,source:`kpp`},ba.anchor}function ja(){if(typeof window>`u`)return;let e=window.performance.now(),t=ka();t>0n&&wa(va,t),ba.anchor={pμ0:t,perf0:e,source:`kpp`}}function Ma(){if(typeof window>`u`)return 0n;let e=Aa(),t=Sa((window.performance.now()-e.perf0)/qn*1e6);return e.pμ0+t}function Na(e){let t=BigInt(2**53-1),n=BigInt(-(2**53-1));if(e>t||e0?n/pa:0,i=Math.floor(r*fa),a=Math.min(fa-1,Math.max(0,i)),o=Math.min(ua-1,Math.max(0,Math.floor(a/da))),s=Math.min(da-1,Math.max(0,a-o*da)),c=Fi(e,`dayIndex`)??Fi(e,`dayIndex0`)??Fi(e,`dayIndexSinceGenesis`),l=c===null?Math.floor((t+1e-9)/pa):Math.floor(c),u=Math.floor(l/336),d=Ri(l,336),f=Math.floor(d/42);f<0&&(f=0),f>7&&(f=7);let p=d-f*42,m=f+1;return{beat:o,step:s,day:Math.floor(p)+1,month:m,year:u}}function za(e){return`${Ii(e.beat)}:${Ii(e.step)}`}function Ba(e){return`D${e.day}/M${e.month}/Y${e.year}`}function Va(){(0,C.useEffect)(()=>{if(typeof window>`u`||typeof document>`u`)return;let e=0,t=e=>{let t=e.timeStamp;return typeof t==`number`&&Number.isFinite(t)?t:performance.now()},n=n=>{if(Ia(n.target))return;let r=t(n);r-e<=300&&n.preventDefault(),e=r},r=e=>{e.touches.length>1&&e.preventDefault()},i=e=>{(e.ctrlKey||e.metaKey)&&e.preventDefault()},a=e=>{if(!e.ctrlKey&&!e.metaKey)return;let t=e.key;(t===`+`||t===`-`||t===`=`||t===`_`||t===`0`)&&e.preventDefault()},o=e=>{e.preventDefault()},s=document.documentElement,c=document.body,l=s.style.touchAction,u=c.style.touchAction,d=s.style.webkitTextSizeAdjust;return s.style.touchAction=`manipulation`,c.style.touchAction=`manipulation`,s.style.webkitTextSizeAdjust=`100%`,document.addEventListener(`touchend`,n,{passive:!1,capture:!0}),document.addEventListener(`touchmove`,r,{passive:!1,capture:!0}),document.addEventListener(`gesturestart`,o,{passive:!1,capture:!0}),document.addEventListener(`gesturechange`,o,{passive:!1,capture:!0}),document.addEventListener(`gestureend`,o,{passive:!1,capture:!0}),window.addEventListener(`wheel`,i,{passive:!1}),window.addEventListener(`keydown`,a),()=>{document.removeEventListener(`touchend`,n,!0),document.removeEventListener(`touchmove`,r,!0),document.removeEventListener(`gesturestart`,o,!0),document.removeEventListener(`gesturechange`,o,!0),document.removeEventListener(`gestureend`,o,!0),window.removeEventListener(`wheel`,i),window.removeEventListener(`keydown`,a),s.style.touchAction=l,c.style.touchAction=u,s.style.webkitTextSizeAdjust=d}},[])}var Ha={size:{width:0,height:0},subs:new Set,listening:!1,rafId:null,cleanup:null};function Ua(){if(typeof window>`u`)return{width:0,height:0};let e=window.visualViewport;return e?{width:Math.round(e.width),height:Math.round(e.height)}:{width:window.innerWidth,height:window.innerHeight}}function Wa(){if(typeof window>`u`||Ha.listening)return;Ha.listening=!0,Ha.size=Ua();let e=()=>{Ha.rafId=null;let e=Ua(),t=Ha.size;e.width===t.width&&e.height===t.height||(Ha.size=e,Ha.subs.forEach(t=>t(e)))},t=()=>{Ha.rafId===null&&(Ha.rafId=window.requestAnimationFrame(e))},n=window.visualViewport;window.addEventListener(`resize`,t,{passive:!0}),n&&(n.addEventListener(`resize`,t,{passive:!0}),n.addEventListener(`scroll`,t,{passive:!0})),Ha.cleanup=()=>{Ha.rafId!==null&&(window.cancelAnimationFrame(Ha.rafId),Ha.rafId=null),window.removeEventListener(`resize`,t),n&&(n.removeEventListener(`resize`,t),n.removeEventListener(`scroll`,t)),Ha.cleanup=null,Ha.listening=!1}}function Ga(){Ha.subs.size>0||Ha.cleanup?.()}function Ka(){let[e,t]=(0,C.useState)(()=>Ua());return(0,C.useEffect)(()=>{if(typeof window>`u`)return;Wa();let e=e=>t(e);return Ha.subs.add(e),e(Ha.size),()=>{Ha.subs.delete(e),Ga()}},[]),e}function qa(e){let t=(0,C.useRef)(null);(0,C.useEffect)(()=>{if(!e||typeof window>`u`||typeof document>`u`)return;let n=document.documentElement,r=document.body,i=window.scrollY||window.pageYOffset||0;return t.current={scrollY:i,htmlOverflow:n.style.overflow,bodyOverflow:r.style.overflow,bodyPosition:r.style.position,bodyTop:r.style.top,bodyLeft:r.style.left,bodyRight:r.style.right,bodyWidth:r.style.width},n.style.overflow=`hidden`,r.style.overflow=`hidden`,r.style.position=`fixed`,r.style.top=`-${i}px`,r.style.left=`0`,r.style.right=`0`,r.style.width=`100%`,()=>{let e=t.current;e&&(n.style.overflow=e.htmlOverflow,r.style.overflow=e.bodyOverflow,r.style.position=e.bodyPosition,r.style.top=e.bodyTop,r.style.left=e.bodyLeft,r.style.right=e.bodyRight,r.style.width=e.bodyWidth,window.scrollTo(0,e.scrollY),t.current=null)}},[e])}function Ja(e){let t=window.getComputedStyle(e),n=t.backdropFilter,r=t.willChange||``;return!(t.transform&&t.transform!==`none`||t.perspective&&t.perspective!==`none`||t.filter&&t.filter!==`none`||n&&n!==`none`||t.contain&&t.contain!==`none`||r.includes(`transform`)||r.includes(`perspective`)||r.includes(`filter`))}function Ya(){let e=document.querySelector(`.app-shell`);if(e instanceof HTMLElement)try{if(Ja(e))return e}catch{}return document.body}function Xa(e){return e===`/`?`Verifier`:e.startsWith(`/mint`)?`Mint Sigil`:e.startsWith(`/voh`)?`KaiVoh`:e.startsWith(`/keystream`)?`PhiStream`:e.startsWith(`/klock`)?`KaiKlok`:`Sovereign Gate`}function Za(e){return e===`/`||e.startsWith(`/voh`)||e.startsWith(`/mint`)||e.startsWith(`/keystream`)||e.startsWith(`/klock`)}function Qa(e){return e<680?200:240}function $a(e){return Math.max(220,Math.min(520,Math.floor(e*.52)))}function eo(e){(0,C.useEffect)(()=>{document.title=`ΦNet • ${e}`},[e])}function to(e){return(0,C.useMemo)(()=>{let t=e.height||0,n=e.width||0;return t>=820&&n>=980},[e.height,e.width])}function no(){let[e,t]=(0,C.useState)(La);return(0,C.useEffect)(()=>{let e=e=>{let n=e.detail;typeof n==`string`&&n.length&&t(n)};return window.addEventListener(qi,e),()=>window.removeEventListener(qi,e)},[]),e}function ro(){(0,C.useEffect)(()=>{if(typeof window>`u`)return;ja();let e=()=>{let e=Ma();e>0n&&wa(va,e)},t=()=>{typeof document<`u`&&document.visibilityState===`hidden`&&e()};e();let n=window.setInterval(e,15e3);return window.addEventListener(`pagehide`,e),document.addEventListener(`visibilitychange`,t),()=>{window.clearInterval(n),window.removeEventListener(`pagehide`,e),document.removeEventListener(`visibilitychange`,t),e()}},[])}function io(){let[e,t]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{if(typeof window>`u`)return;let e=window,n=typeof e.requestIdleCallback==`function`?e.requestIdleCallback(()=>t(!0),{timeout:900}):window.setTimeout(()=>t(!0),220);return()=>{typeof e.cancelIdleCallback==`function`?e.cancelIdleCallback(n):window.clearTimeout(n)}},[]),(0,C.useEffect)(()=>{e&&(O(()=>import(`./HomePriceChartCard-CMBb8I-f.js`),__vite__mapDeps([10,11,12])),O(()=>import(`./KaiVohModal-DRgYu3Ad.js`),__vite__mapDeps([0,1,2,3,4])),O(()=>import(`./SigilModal-Bw4sFNR6.js`),__vite__mapDeps([5,6,7,8,9])),O(()=>import(`./SigilExplorer-Be22x_Dh.js`),__vite__mapDeps([13,14,15])),O(()=>import(`./EternalKlock-CHwy1bt-.js`),__vite__mapDeps([16,17,8,6,7,9,18])),O(()=>import(`./SigilStreamRoot-CHI2vpVS.js`),__vite__mapDeps([19,17,8,6,7,9,18,20,2,3,21,22,14,23,24])))},[e]),e}function ao(e){(0,C.useEffect)(()=>{if(typeof window>`u`||!(`serviceWorker`in navigator))return;let t=new AbortController,n=navigator,r=!!n.connection?.saveData,i=n.connection?.effectiveType||``;if(r||i===`slow-2g`||i===`2g`)return()=>t.abort();let a=async()=>{try{let e=await navigator.serviceWorker.ready;(e.active||e.waiting||e.installing)?.postMessage({type:`WARM_URLS`,urls:[...na,...ra,...ia],mapShell:!0}),await Promise.all([...na,...ra].map(async e=>{try{await fetch(e,{cache:`no-cache`,signal:t.signal})}catch{}}))}catch{}},o=window,s=()=>void a(),c=typeof o.requestIdleCallback==`function`?o.requestIdleCallback(s,{timeout:2500}):window.setTimeout(s,1200),l=()=>{e.current!==null&&window.clearTimeout(e.current),e.current=window.setTimeout(s,240)};return window.addEventListener(`focus`,l),()=>{t.abort(),e.current!==null&&(window.clearTimeout(e.current),e.current=null),typeof o.cancelIdleCallback==`function`?o.cancelIdleCallback(c):window.clearTimeout(c),window.removeEventListener(`focus`,l)}},[e])}function oo(e,t){let n=(0,C.useRef)(null),r=(0,C.useRef)(null),[i,a]=(0,C.useState)(!1),o=(0,C.useRef)(null),s=(0,C.useCallback)(()=>{let e=n.current,t=r.current;if(!e||!t)return!1;let i=t.firstElementChild;return(i?i.scrollHeight:t.scrollHeight)>e.clientHeight+6},[]),c=(0,C.useCallback)(()=>{o.current===null&&(o.current=window.requestAnimationFrame(()=>{o.current=null;let e=s();a(t=>t===e?t:e)}))},[s]);(0,C.useEffect)(()=>{e&&c()},[e,t,c]),(0,C.useEffect)(()=>{let e=n.current,t=r.current;if(!e||!t)return;let i=t.firstElementChild,a=()=>c(),s=null;return typeof ResizeObserver<`u`&&(s=new ResizeObserver(a),s.observe(e),s.observe(t),i&&s.observe(i)),window.addEventListener(`resize`,a,{passive:!0}),c(),()=>{window.removeEventListener(`resize`,a),s?.disconnect(),o.current!==null&&(window.cancelAnimationFrame(o.current),o.current=null)}},[c,t]);let l=e&&i;return{panelBodyRef:n,panelCenterRef:r,panelShouldScroll:l,panelBodyInlineStyle:(0,C.useMemo)(()=>{if(l)return{overflowY:`auto`,overflowX:`hidden`,WebkitOverflowScrolling:`touch`,alignItems:`stretch`,justifyContent:`flex-start`,paddingBottom:`calc(1.25rem + var(--safe-bottom))`}},[l]),panelCenterInlineStyle:(0,C.useMemo)(()=>{if(l)return{height:`auto`,minHeight:`100%`,alignItems:`flex-start`,justifyContent:`flex-start`}},[l])}}function so(e,t){(0,C.useEffect)(()=>{if(typeof window>`u`)return;let t=e.current;if(!t||!window.matchMedia(`(max-width: 980px)`).matches)return;let n=t.querySelector(`.nav-item--active`);n&&window.requestAnimationFrame(()=>{try{n.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`center`})}catch{n.scrollIntoView()}})},[t,e])}function co({open:e,onClose:t,children:n}){let r=typeof document<`u`,i=Ka(),a=(0,C.useMemo)(()=>r?Ya():null,[r]);qa(e&&r),(0,C.useEffect)(()=>{if(!e||!r)return;let n=e=>{e.key===`Escape`&&t()};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t,r]),(0,C.useEffect)(()=>{!e||!r||window.dispatchEvent(new CustomEvent(Vi))},[e,r]);let o=(0,C.useRef)(null);(0,C.useEffect)(()=>{e&&window.requestAnimationFrame(()=>o.current?.focus())},[e]);let s=(0,C.useMemo)(()=>{if(!e||!r)return;let t=i.height,n=i.width;return{position:`fixed`,inset:0,pointerEvents:`auto`,height:t>0?`${t}px`:void 0,width:n>0?`${n}px`:void 0,"--sx-breath":`5.236s`,"--sx-border":`rgba(60, 220, 205, 0.35)`,"--sx-border-strong":`rgba(55, 255, 228, 0.55)`,"--sx-ring":`0 0 0 2px rgba(55, 255, 228, 0.25), 0 0 0 6px rgba(55, 255, 228, 0.12)`}},[e,r,i]),c=(0,C.useCallback)(e=>{e.target===e.currentTarget&&(e.preventDefault(),e.stopPropagation())},[]),l=(0,C.useCallback)(e=>{e.target===e.currentTarget&&(e.preventDefault(),e.stopPropagation(),t())},[t]),u=(0,C.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]);return!e||!r||!a?null:(0,Ji.createPortal)((0,W.jsx)(`div`,{className:`explorer-pop`,style:s,role:`dialog`,"aria-modal":`true`,"aria-label":`PhiStream Explorer`,onPointerDown:c,onClick:l,children:(0,W.jsxs)(`div`,{className:`explorer-pop__panel`,role:`document`,children:[(0,W.jsx)(`button`,{ref:o,type:`button`,className:`explorer-pop__close kx-x`,onPointerDown:u,onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},"aria-label":`Close PhiStream Explorer`,title:`Close (Esc)`,children:`×`}),(0,W.jsx)(`div`,{className:`explorer-pop__body`,children:n}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:`PhiStream explorer portal open`})]})}),a)}function lo({open:e,onClose:t,children:n}){let r=typeof document<`u`,i=Ka(),a=(0,C.useMemo)(()=>r?Ya():null,[r]);qa(e&&r),(0,C.useEffect)(()=>{if(!e||!r)return;let n=e=>{e.key===`Escape`&&t()};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t,r]);let o=(0,C.useRef)(null);(0,C.useEffect)(()=>{e&&window.requestAnimationFrame(()=>o.current?.focus())},[e]);let s=(0,C.useMemo)(()=>{if(!e||!r)return;let t=i.height,n=i.width;return{position:`fixed`,inset:0,pointerEvents:`auto`,height:t>0?`${t}px`:void 0,width:n>0?`${n}px`:void 0,"--klock-breath":`5.236s`,"--klock-border":`rgba(255, 216, 120, 0.26)`,"--klock-border-strong":`rgba(255, 231, 160, 0.55)`,"--klock-ring":`0 0 0 2px rgba(255, 225, 150, 0.22), 0 0 0 6px rgba(255, 210, 120, 0.10)`,"--klock-scale":`5`}},[e,r,i]),c=(0,C.useCallback)(e=>{e.target===e.currentTarget&&(e.preventDefault(),e.stopPropagation())},[]),l=(0,C.useCallback)(e=>{e.target===e.currentTarget&&(e.preventDefault(),e.stopPropagation(),t())},[t]),u=(0,C.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]);return!e||!r||!a?null:(0,Ji.createPortal)((0,W.jsx)(`div`,{className:`klock-pop`,style:s,role:`dialog`,"aria-modal":`true`,"aria-label":`Eternal KaiKlok`,onPointerDown:c,onClick:l,children:(0,W.jsxs)(`div`,{className:`klock-pop__panel`,role:`document`,"data-klock-size":`xl`,children:[(0,W.jsx)(`button`,{ref:o,type:`button`,className:`klock-pop__close kx-x`,onPointerDown:u,onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},"aria-label":`Close Eternal KaiKlok`,title:`Close (Esc)`,children:`×`}),(0,W.jsx)(`div`,{className:`klock-pop__body`,children:(0,W.jsx)(`div`,{className:`klock-stage`,role:`presentation`,"data-klock-stage":`1`,children:(0,W.jsx)(`div`,{className:`klock-stage__inner`,children:n})})}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:`Eternal KaiKlok portal open`})]})}),a)}function uo(){let e=$e(),[t,n]=(0,C.useState)(!0);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(C.Suspense,{fallback:null,children:(0,W.jsx)(Yi,{open:t,onClose:(0,C.useCallback)(()=>{n(!1),e(`/`,{replace:!0})},[e])})}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:`KaiVoh portal open`})]})}function fo(){let e=$e(),[t,n]=(0,C.useState)(!0),r=(0,C.useMemo)(()=>Fi(Fa(),`pulse`)??0,[]),i=(0,C.useCallback)(()=>{n(!1),e(`/`,{replace:!0})},[e]);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(C.Suspense,{fallback:null,children:t?(0,W.jsx)(Xi,{initialPulse:r,onClose:i}):null}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:`Sigil mint portal open`})]})}function po(){let e=$e(),[t,n]=(0,C.useState)(!0);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(co,{open:t,onClose:(0,C.useCallback)(()=>{n(!1),e(`/`,{replace:!0})},[e]),children:(0,W.jsx)(C.Suspense,{fallback:null,children:(0,W.jsx)(Qi,{})})}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:`PhiStream explorer portal open`})]})}function mo(){let e=$e(),t=Xe(),[n,r]=(0,C.useState)(!0);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(lo,{open:n,onClose:(0,C.useCallback)(()=>{r(!1),e(`/`,{replace:!0})},[e]),children:(0,W.jsx)(C.Suspense,{fallback:null,children:(0,W.jsx)($i,{initialDetailsOpen:(t.state??null)?.openDetails??!0})})}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:`Eternal KaiKlok portal open`})]})}function ho(e){let t=Fr(Na(e)),n=xa(e,_a),r=n>BigInt(2**53-1)?2**53-1:n<0n?0:Number(n),i=Li(r),a={...t,pulse:r},o=Ra(a);return{pulse:r,pulseStr:i,beatStepDMY:o,beatStepLabel:za(o),dmyLabel:Ba(o),chakraDay:a.chakraDay}}function go(){let[e,t]=(0,C.useState)(()=>ho(Ma()));return(0,C.useEffect)(()=>{let e=!0,n=null,r=()=>{n!==null&&(window.clearTimeout(n),n=null)},i=e=>{let n=ho(e);t(e=>e.pulseStr===n.pulseStr&&e.beatStepLabel===n.beatStepLabel&&e.dmyLabel===n.dmyLabel?e:n)},a=()=>{if(!e)return;if(typeof document<`u`&&document.visibilityState===`hidden`){r();return}let t=Ma();i(t);let o=t%_a;o<0n&&(o+=_a);let s=_a-o,c=Number(s),l=Math.max(0,Math.floor(c/1e6*qn));r(),n=window.setTimeout(a,l)};a();let o=()=>{e&&typeof document<`u`&&document.visibilityState===`visible`&&(ja(),a())};return document.addEventListener(`visibilitychange`,o),window.addEventListener(`focus`,o),()=>{e=!1,document.removeEventListener(`visibilitychange`,o),window.removeEventListener(`focus`,o),r()}},[]),e}var _o=(0,C.memo)(function({onOpenKlock:e,breathS:t,breathMs:n,breathsPerDay:r}){let i=go(),a=(0,C.useMemo)(()=>({color:`var(--accent-color)`,textShadow:`0 0 14px rgba(0, 255, 255, 0.22), 0 0 28px rgba(0, 255, 255, 0.12)`}),[]),o=(0,C.useMemo)(()=>({color:`var(--accent-color)`,textShadow:`0 0 14px rgba(0, 255, 255, 0.22), 0 0 28px rgba(0, 255, 255, 0.12)`,fontSize:`0.5em`,lineHeight:1.05}),[]),s=(0,C.useMemo)(()=>{let e=Ri(i.pulse,pa),t=pa/ma.length;return ma[Math.min(ma.length-1,Math.max(0,Math.floor(e/t)))]??ma[0]},[i.pulse]),c=(0,C.useMemo)(()=>ha[i.chakraDay]??ha.Heart,[i.chakraDay]),l=(0,C.useMemo)(()=>ga[Math.min(ga.length-1,Math.max(0,i.beatStepDMY.month-1))]??ha.Heart,[i.beatStepDMY.month]),u=(0,C.useMemo)(()=>({"--kai-ark":s,"--kai-chakra":c,"--kai-month":l}),[s,c,l]),d=(0,C.useMemo)(()=>`LIVE • NOW PULSE ${i.pulseStr} • ${i.beatStepLabel} • ${i.dmyLabel} • Breath ${t.toFixed(6)}s (${Math.round(n)}ms) • ${r.toLocaleString(`en-US`,{minimumFractionDigits:6,maximumFractionDigits:6})}/day • Open Eternal KaiKlok`,[i.pulseStr,i.beatStepLabel,i.dmyLabel,t,n,r]),f=(0,C.useMemo)(()=>`LIVE. Kai Pulse now ${i.pulse}. Beat ${i.beatStepDMY.beat} step ${i.beatStepDMY.step}. D ${i.beatStepDMY.day}. M ${i.beatStepDMY.month}. Y ${i.beatStepDMY.year}. Open Eternal KaiKlok.`,[i]);return(0,W.jsxs)(`button`,{type:`button`,className:`topbar-live`,onClick:e,"aria-label":f,title:d,style:u,children:[(0,W.jsx)(`span`,{className:`live-orb`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`live-scroll`,"aria-hidden":`true`,children:(0,W.jsxs)(`div`,{className:`live-text`,children:[(0,W.jsx)(`div`,{className:`live-meta`,children:(0,W.jsx)(`span`,{className:`mono`,style:a,children:`☤KAI`})}),(0,W.jsx)(`div`,{className:`live-meta`,children:(0,W.jsx)(`span`,{className:`mono`,style:a,children:i.pulseStr})}),(0,W.jsx)(`div`,{className:`live-sub`,children:(0,W.jsxs)(`span`,{className:`mono`,style:o,children:[(0,W.jsx)(`span`,{className:`kai-num kai-num--ark`,children:i.beatStepLabel}),` `,(0,W.jsx)(`span`,{"aria-hidden":`true`,style:{opacity:.7},children:`•`}),` `,(0,W.jsx)(`span`,{className:`kai-tag`,children:`D`}),(0,W.jsx)(`span`,{className:`kai-num kai-num--chakra`,children:i.beatStepDMY.day}),(0,W.jsx)(`span`,{className:`kai-sep`,children:`/`}),(0,W.jsx)(`span`,{className:`kai-tag`,children:`M`}),(0,W.jsx)(`span`,{className:`kai-num kai-num--month`,children:i.beatStepDMY.month}),(0,W.jsx)(`span`,{className:`kai-sep`,children:`/`}),(0,W.jsx)(`span`,{className:`kai-tag`,children:`Y`}),(0,W.jsx)(`span`,{className:`kai-num`,children:i.beatStepDMY.year})]})})]})})]})});function vo(){let e=Xe(),t=$e();Va(),Bi(),ta(()=>{ea()},[e.pathname]),ro();let n=no(),r=io();ao((0,C.useRef)(null));let i=Ka(),a=to(i),o=(0,C.useMemo)(()=>({"--breath-s":`${sa}s`,"--vvh-px":`${i.height}px`}),[i.height]),s=(0,C.useMemo)(()=>Xa(e.pathname),[e.pathname]);eo(s);let c=(0,C.useMemo)(()=>Za(e.pathname),[e.pathname]),l=c,u=(0,C.useMemo)(()=>Qa(i.height||800),[i.height]),d=(0,C.useMemo)(()=>$a(i.height||800),[i.height]),{panelBodyRef:f,panelCenterRef:p,panelShouldScroll:m,panelBodyInlineStyle:h,panelCenterInlineStyle:g}=oo(c,e.pathname),_=(0,C.useRef)(null);so(_,e.pathname);let v=(0,C.useCallback)(()=>{t(`/klock`,{state:{openDetails:!0}})},[t]),y=(0,C.useCallback)(async e=>{try{await navigator.clipboard.writeText(oa)}catch{let e=document.createElement(`textarea`);e.value=oa,e.setAttribute(`readonly`,`true`),e.style.position=`fixed`,e.style.left=`-9999px`,e.style.top=`-9999px`,document.body.appendChild(e),e.select(),document.execCommand(`copy`),document.body.removeChild(e)}e&&(e.classList.add(`is-copied`),window.setTimeout(()=>e.classList.remove(`is-copied`),900))},[]),b=(0,C.useMemo)(()=>{if(a)return{alignSelf:`start`,height:`auto`}},[a]);return(0,W.jsxs)(`div`,{className:`app-shell`,"data-ui":`atlantean-banking`,"data-panel-scroll":m?`1`:`0`,"data-roomy":a?`1`:`0`,style:o,children:[(0,W.jsx)(`a`,{className:`skip-link`,href:`#app-content`,children:`Skip to content`}),(0,W.jsx)(`div`,{className:`app-bg-orbit`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`app-bg-grid`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`app-bg-glow`,"aria-hidden":`true`}),(0,W.jsxs)(`header`,{className:`app-topbar`,role:`banner`,"aria-label":`ΦNet Sovereign Gate Header`,children:[(0,W.jsx)(`div`,{className:`topbar-left`,children:(0,W.jsxs)(`div`,{className:`brand`,"aria-label":`ΦNet Sovereign Gate`,children:[(0,W.jsx)(`div`,{className:`brand__mark`,"aria-hidden":`true`,children:(0,W.jsx)(`img`,{src:`/phi.svg`,alt:``,className:`brand__mark-img`})}),(0,W.jsxs)(`div`,{className:`brand__text`,children:[(0,W.jsx)(`div`,{className:`brand__title`,children:`PHI.NETWORK`}),(0,W.jsx)(`div`,{className:`brand__subtitle`,children:`Breath-Minted Value · Kairos Identity Registry`})]})]})}),(0,W.jsx)(`div`,{className:`topbar-right`,"aria-label":`Live Kai clock`,children:(0,W.jsx)(_o,{onOpenKlock:v,breathS:sa,breathMs:ca,breathsPerDay:la})})]}),(0,W.jsx)(`main`,{className:`app-stage`,id:`app-content`,role:`main`,"aria-label":`Sovereign Value Workspace`,children:(0,W.jsx)(`div`,{className:`app-frame`,role:`region`,"aria-label":`Secure frame`,children:(0,W.jsx)(`div`,{className:`app-frame-inner`,children:(0,W.jsxs)(`div`,{className:`app-workspace`,children:[l&&(0,W.jsx)(`div`,{className:`workspace-topbar`,"aria-label":`Atrium live Φ value + chart`,style:{overflow:`visible`,position:`relative`},children:(0,W.jsx)(`div`,{className:`workspace-topbar-scroll`,style:{maxHeight:`${d}px`,overflowY:`auto`,overflowX:`hidden`,WebkitOverflowScrolling:`touch`,overscrollBehavior:`contain`,borderRadius:`inherit`},children:r?(0,W.jsx)(C.Suspense,{fallback:(0,W.jsx)(`div`,{style:{height:u},"aria-hidden":`true`}),children:(0,W.jsx)(Zi,{apiBase:`https://pay.kaiklok.com`,ctaAmountUsd:144,chartHeight:u})}):(0,W.jsx)(`div`,{style:{height:u},"aria-hidden":`true`})})}),(0,W.jsxs)(`nav`,{className:`app-nav`,"aria-label":`Primary navigation`,"data-nav-roomy":a?`1`:`0`,style:b,children:[(0,W.jsxs)(`div`,{className:`nav-head`,children:[(0,W.jsx)(`div`,{className:`nav-head__title`,children:`Atrium`}),(0,W.jsx)(`div`,{className:`nav-head__sub`,children:`Breath-Sealed Identity · Kairos-ZK Proof`})]}),(0,W.jsx)(`div`,{ref:_,className:`nav-list`,role:`list`,"aria-label":`Atrium navigation tiles`,children:aa.map(e=>(0,W.jsxs)(vn,{to:e.to,end:e.end,className:e=>`nav-item ${e.isActive?`nav-item--active`:``}`,"aria-label":`${e.label}: ${e.desc}`,children:[(0,W.jsx)(`div`,{className:`nav-item__label`,children:e.label}),(0,W.jsx)(`div`,{className:`nav-item__desc`,children:e.desc})]},e.to))}),(0,W.jsx)(`div`,{className:`nav-writ-slot`,"data-writ-slim":`1`,children:(0,W.jsx)(Ki,{})})]}),(0,W.jsxs)(`section`,{className:`app-panel`,"aria-label":`Sovereign Gate panel`,children:[(0,W.jsxs)(`div`,{className:`panel-head`,children:[(0,W.jsx)(`div`,{className:`panel-head__title`,children:s}),(0,W.jsxs)(`div`,{className:`panel-head__meta`,children:[(0,W.jsx)(`span`,{className:`meta-chip`,children:`Proof of Breath™`}),(0,W.jsx)(`span`,{className:`meta-chip`,children:`Kai-Signature™`})]})]}),(0,W.jsx)(`div`,{ref:f,className:`panel-body ${c?`panel-body--locked`:``} ${m?`panel-body--scroll`:``}`,style:h,children:(0,W.jsx)(`div`,{ref:p,className:`panel-center`,style:g,children:(0,W.jsx)(Dt,{})})}),(0,W.jsxs)(`footer`,{className:`panel-foot`,"aria-label":`Footer`,children:[(0,W.jsxs)(`div`,{className:`panel-foot__left`,children:[(0,W.jsx)(`span`,{className:`mono`,children:`ΦNet`}),` • Sovereign Gate •`,` `,(0,W.jsxs)(`button`,{type:`button`,className:`dns-copy mono`,onClick:e=>void y(e.currentTarget),"aria-label":`Remember .kai DNS IP ${oa}`,title:`Remember DNS IP`,children:[`.kai DNS: `,(0,W.jsx)(`span`,{className:`mono`,children:oa})]})]}),(0,W.jsxs)(`div`,{className:`panel-foot__right`,children:[(0,W.jsx)(`span`,{className:`mono`,children:`V`}),` `,(0,W.jsx)(`a`,{className:`mono`,href:`https://github.com/phinetwork/phi.network`,target:`_blank`,rel:`noreferrer`,"aria-label":`Version ${n} (opens GitHub)`,title:`Open GitHub`,children:n})]})]})]})]})})})})]})}function yo(){return(0,W.jsxs)(`div`,{className:`notfound`,role:`region`,"aria-label":`Not found`,children:[(0,W.jsx)(`div`,{className:`notfound__code`,children:`404`}),(0,W.jsx)(`div`,{className:`notfound__title`,children:`Route not found`}),(0,W.jsx)(`div`,{className:`notfound__hint`,children:`Use the Sovereign Gate navigation to return to Verifier, Mint Sigil, KaiVoh, or PhiStream.`}),(0,W.jsx)(`div`,{className:`notfound__actions`,children:(0,W.jsx)(vn,{className:`notfound__cta`,to:`/`,children:`Go to Verifier`})})]})}var bo=u(y(),1),xo=typeof window<`u`?C.useLayoutEffect:C.useEffect,So=[`/s`,`/s/:hash`,`/stream`,`/stream/*`,`/feed`,`/feed/*`,`/p~:token`,`/p~:token/*`,`/token`,`/p~token`,`/p`,`/verify/*`];function Co(){let[e,t]=(0,C.useState)(()=>typeof window>`u`||window.matchMedia===void 0?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches);return(0,C.useEffect)(()=>{if(typeof window>`u`||window.matchMedia===void 0)return;let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),n=e=>{t(e.matches)};n(e);try{return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)}catch{return e.addListener(n),()=>e.removeListener(n)}},[]),e}function wo(){let e=Xe(),t=Co(),[n,r]=(0,C.useState)(`show`),[i,a]=(0,C.useState)(!0),[o,s]=(0,C.useState)(!0),c=(0,C.useRef)(!1),l=(0,C.useRef)(null),u=(0,C.useRef)(null),d=(0,C.useRef)(null),f=(0,C.useRef)(null),p=(0,C.useMemo)(()=>t?140:260,[t]),m=(0,C.useMemo)(()=>t?220:420,[t]),h=(0,C.useMemo)(()=>t?800:1200,[t]),g=(0,C.useMemo)(()=>t?70:120,[t]),_=(0,C.useCallback)(()=>{l.current!==null&&window.clearTimeout(l.current),u.current!==null&&window.clearTimeout(u.current),l.current=null,u.current=null},[]),v=(0,C.useCallback)(()=>{f.current!==null&&window.cancelAnimationFrame(f.current),f.current=null},[]),y=(0,C.useCallback)(()=>{d.current!==null&&window.clearTimeout(d.current),d.current=null},[]),b=(0,C.useMemo)(()=>So.some(t=>!!fe({path:t,end:!1},e.pathname)),[e.pathname]),x=(0,C.useMemo)(()=>o||b,[o,b]),S=(0,C.useCallback)(e=>{_(),y(),l.current=window.setTimeout(()=>{r(`fade`),u.current=window.setTimeout(()=>{r(`hidden`),s(!1),a(!1)},p)},Math.max(0,e))},[y,_,p]),w=(0,C.useCallback)(e=>{v(),!(typeof window>`u`)&&(f.current=window.requestAnimationFrame(()=>S(e)))},[v,S]),T=(0,C.useCallback)(()=>{_(),v(),y(),a(!0),r(`show`)},[y,v,_]);return xo(()=>{if(typeof document>`u`)return;let e=document.body,t=e.style.backgroundColor;return t||(e.style.backgroundColor=`var(--bg-0, #040f24)`),()=>{e.style.backgroundColor=t}},[]),(0,C.useEffect)(()=>{if(!x)return;let e=null,n=()=>w(t?30:80);document.readyState===`complete`||document.readyState===`interactive`?e=window.setTimeout(n,t?30:60):window.addEventListener(`load`,n,{once:!0});let r=window.setTimeout(()=>S(0),h);return()=>{e!==null&&window.clearTimeout(e),window.removeEventListener(`load`,n),window.clearTimeout(r),_(),y(),v()}},[y,v,_,w,S,h,t,x]),(0,C.useEffect)(()=>{if(!c.current){c.current=!0;return}if(b)return d.current=window.setTimeout(()=>{T(),w(t?60:m)},g),()=>{y(),_(),v()}},[y,v,_,w,b,m,g,t,T,e.pathname,e.search,e.hash]),(0,C.useEffect)(()=>()=>{_(),y(),v()},[y,v,_]),i?(0,bo.createPortal)((0,W.jsxs)(`div`,{className:`kai-splash`,"data-state":n,"aria-live":`polite`,role:`status`,children:[(0,W.jsx)(`div`,{className:`kai-splash__grid`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`kai-splash__content`,"aria-hidden":`true`,children:(0,W.jsxs)(`div`,{className:`kai-splash__badge`,children:[(0,W.jsx)(`span`,{className:`kai-splash__badge-halo`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`kai-splash__badge-glow`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`kai-splash__rays`,"aria-hidden":`true`}),(0,W.jsxs)(`div`,{className:`kai-splash__badge-core`,children:[(0,W.jsx)(`img`,{className:`kai-splash__phi`,src:`/phi.svg`,alt:``,loading:`eager`,decoding:`sync`,draggable:!1}),(0,W.jsx)(`span`,{className:`kai-splash__badge-orb`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`kai-splash__badge-core-shine`,"aria-hidden":`true`})]}),(0,W.jsx)(`div`,{className:`kai-splash__ring`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`kai-splash__ring kai-splash__ring--inner`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`kai-splash__flare`,"aria-hidden":`true`})]})}),(0,W.jsx)(`span`,{className:`sr-only`,children:`Preparing Atlantean link…`})]}),document.body):null}var To=/^\d*(?:\.\d{0,4})?$/,Eo=/^\d*(?:\.\d{0,2})?$/,Do=({msg:e})=>e?(0,W.jsx)(`div`,{className:`phi-error-toast`,role:`status`,"aria-live":`polite`,children:(0,W.jsxs)(`div`,{className:`phi-error-card`,children:[(0,W.jsx)(`span`,{className:`badge`,children:`OFFICIAL`}),(0,W.jsx)(`p`,{className:`phi-error-text`,children:e})]})}):null,Oo=[26,70,38],ko=()=>{if(typeof window>`u`)return;let e=window.navigator;if(typeof e.vibrate==`function`)try{e.vibrate(Oo)}catch{}},Ao=({state:e,onClose:t})=>{let n=e.mode===`receive`?`Φ Inhale Complete`:`Φ Exhale Complete`,r=e.mode===`receive`?`RECEIVED`:`SENT`,i=e.message??(e.mode===`receive`?`You just inhaled Φ into your Sovereign field. This moment is sealed.`:`You just exhaled Φ from your Sovereign field. This moment is sealed.`);return(0,W.jsx)(`div`,{className:`phi-send-success-overlay`,role:`dialog`,"aria-modal":`true`,"aria-label":`Φ move complete`,onClick:t,children:(0,W.jsxs)(`div`,{className:`phi-send-success-card`,onClick:e=>e.stopPropagation(),children:[(0,W.jsx)(`div`,{className:`phi-success-orb`,"aria-hidden":`true`,children:(0,W.jsx)(`div`,{className:`phi-success-orb-inner`})}),(0,W.jsxs)(`div`,{className:`phi-success-header`,children:[(0,W.jsx)(`span`,{className:`phi-success-pill`,children:r}),(0,W.jsx)(`button`,{type:`button`,className:`phi-success-close`,onClick:t,"aria-label":`Close confirmation`,children:`✕`})]}),(0,W.jsx)(`h2`,{className:`phi-success-title`,children:n}),e.amountDisplay&&(0,W.jsx)(`p`,{className:`phi-success-amount`,children:(0,W.jsx)(`span`,{className:`mono`,children:e.amountDisplay})}),(0,W.jsx)(`p`,{className:`phi-success-body`,children:i}),e.downloadUrl&&(0,W.jsxs)(`a`,{className:`phi-send-success-download`,href:e.downloadUrl,download:e.downloadLabel||`phi-receipt`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(`span`,{className:`phi-send-success-download-icon`,"aria-hidden":`true`,children:`⬇︎`}),(0,W.jsx)(`span`,{className:`phi-send-success-download-text`,children:`Download sealed receipt`})]}),(0,W.jsx)(`button`,{type:`button`,className:`phi-success-ok`,onClick:t,children:`Done`})]})})},jo=({amountMode:e,setAmountMode:t,usdInput:n,phiInput:r,setUsdInput:i,setPhiInput:a,convDisplayRight:o,remainingPhiDisplay4:s,canonicalContext:c,onAttachClick:l,attachmentLabel:u,attachmentActive:d})=>{let f=c===`derivative`,[p,m]=(0,C.useState)(null),[h,g]=(0,C.useState)(!1),[_,v]=(0,C.useState)(null);(0,C.useEffect)(()=>{if(!p||f)return;let e=window.setTimeout(()=>m(null),2200);return()=>window.clearTimeout(e)},[p,f]),(0,C.useEffect)(()=>{if(typeof window>`u`)return;let e=e=>{let t=e.detail;if(!t)return;let n=t.mode===`receive`?`receive`:`send`;ko(),v({mode:n,amountDisplay:t.amountPhiDisplay??t.amountDisplay??(typeof t.amountPhi==`number`?String(t.amountPhi):void 0),downloadUrl:t.downloadUrl,downloadLabel:t.downloadLabel,message:t.message})};return window.addEventListener(`kk:phi-move-success`,e),()=>{window.removeEventListener(`kk:phi-move-success`,e)}},[]);let y=e=>{m(e);try{window.dispatchEvent(new CustomEvent(`kk:error`,{detail:{where:`SendPhiAmountField`,error:e}}))}catch{}},b=(0,C.useMemo)(()=>e===`USD`?`\\d*(?:\\.\\d{0,2})?`:`\\d*(?:\\.\\d{0,4})?`,[e]),x=e===`USD`?`$`:`Φ`,S=e===`USD`?`Dollar amount to exhale`:`Phi amount to exhale`,w=t=>{let n=t.replace(/\s+/g,``);e===`USD`?Eo.test(n)&&i(n):To.test(n)&&a(n)},T=t=>{if(t.key!==`Enter`)return;if(e!==`PHI`){y(`Enter a Φ amount or switch to Φ to exhale.`);return}let n=(r||``).trim();if(n===``||n===`.`){y(`No Φ entered — specify an amount to exhale.`);return}let i=Number((n.startsWith(`.`)?`0`:``)+n);if(!Number.isFinite(i)||i<=0){y(`Invalid Φ amount — enter a number greater than 0.`);return}let a=Number(String(s).replace(/[^\d.]/g,``));Number.isFinite(a)&&i>a+1e-9&&y(`Exceeds remaining — Rem: Φ ${s}`)},E=typeof l==`function`;return f?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Do,{msg:p}),_&&(0,W.jsx)(Ao,{state:_,onClose:()=>v(null)})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`phi-send-field`,"data-state":h?`focus`:`idle`,children:[(0,W.jsxs)(`div`,{className:`phi-send-label`,children:[(0,W.jsx)(`span`,{className:`label-main`,children:`Exhale Amount`}),(0,W.jsxs)(`span`,{className:`label-sub`,children:[e===`USD`?`Enter in $`:`Enter in Φ`,` · 🛕: Φ`,` `,s]})]}),(0,W.jsxs)(`div`,{className:`phi-send-bar`,children:[(0,W.jsxs)(`div`,{className:`phi-send-inputShell`,"aria-live":`polite`,children:[(0,W.jsx)(`span`,{className:`phi-prefix`,"aria-hidden":`true`,children:x}),(0,W.jsx)(`input`,{className:`phi-send-input`,type:`text`,inputMode:`decimal`,pattern:b,"aria-label":S,placeholder:x,value:e===`USD`?n:r,onChange:e=>w(e.target.value),onKeyDown:T,onFocus:()=>g(!0),onBlur:()=>g(!1),"aria-invalid":p?!0:void 0,autoComplete:`off`,enterKeyHint:`send`}),(0,W.jsx)(`i`,{"aria-hidden":`true`,className:`phi-input-glow`})]}),(0,W.jsx)(`div`,{className:`phi-conv-right convert-readout`,"aria-live":`polite`,children:o}),(0,W.jsxs)(`div`,{className:`phi-send-controls`,children:[(0,W.jsxs)(`div`,{role:`tablist`,"aria-label":`Amount unit`,className:`phi-mode-toggle seg`,children:[(0,W.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e===`USD`,className:`phi-mode-btn ${e===`USD`?`is-active`:``}`,onClick:()=>t(`USD`),title:`Enter in dollars`,children:`$`}),(0,W.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e===`PHI`,className:`phi-mode-btn ${e===`PHI`?`is-active`:``}`,onClick:()=>t(`PHI`),title:`Enter in Φ`,children:`Φ`})]}),E&&(0,W.jsxs)(`button`,{type:`button`,className:`phi-attach-btn ${d?`is-active`:``}`,onClick:l,title:u||`Attach sigil / note`,children:[(0,W.jsx)(`span`,{className:`phi-attach-icon`,"aria-hidden":`true`,children:`📎`}),u&&(0,W.jsx)(`span`,{className:`phi-attach-label`,children:u})]})]})]})]}),(0,W.jsx)(Do,{msg:p}),_&&(0,W.jsx)(Ao,{state:_,onClose:()=>v(null)})]})};function Mo(e,t){if(console.error(`[VerifierStamper] ${e}`,t),!(typeof window>`u`))try{window.dispatchEvent(new CustomEvent(`kk:error`,{detail:{where:e,error:t instanceof Error?t.message:String(t)}}))}catch(t){console.error(`[VerifierStamper] kk:error dispatch failed in ${e}`,t)}}function No(e){try{let t=new TextEncoder().encode(e),n=``;for(let e=0;ee?`0.`:``).split(`.`),a=r.replace(/^0+(?=\d)/,``)||`0`,o=(i+`0`.repeat(Number(Fo))).slice(0,Number(Fo));return n*(BigInt(a)*Lo+BigInt(o||`0`))}function zo(e){let t=e<0n?`-`:``,n=e<0n?-e:e,r=n/Lo,i=(n%Lo).toString().padStart(Number(Fo),`0`);return i=i.replace(/0+$/,``),i.length?`${t}${r}.${i}`:`${t}${r}`}function Bo(e,t){return e*t/Lo}function Vo(e,t){return t===0n?0n:e*Lo/t}function Ho(e,t){let n=Math.max(0,Math.min(Number(Fo),t)),r=Io(Fo-BigInt(n)),i=r/2n;return e>=0n?(e+i)/r*r:(e-i)/r*r}function Uo(e,t){let n=Math.max(0,Math.min(Number(Fo),t)),r=e<0n?`-`:``,i=(e<0n?-e:e)/Io(Fo-BigInt(n)),a=Io(BigInt(n));return`${r}${i/a}.${(i%a).toString().padStart(n,`0`)}`}function Wo(e){return Uo(Ho(Ro(e),4),4)}function Go(e){try{if(!e||!e.payload)return 0n;let{mime:t,encoded:n}=e.payload;if(!t||!n||!/^application\/vnd\.kairos-exhale/i.test(t))return 0n;let r=Po(n),i=JSON.parse(r);if(!i||i.kind!==`exhale`)return 0n;let a=String(i.amountPhi??``);return a?Ro(a):0n}catch{return 0n}}const Ko=e=>{let t=Uo(Ho(Ro(String(e??`0`)),6),6);return Number(t.replace(`.`,``))},qo=e=>Number((e/1e6).toFixed(6)),Jo=e=>qo(Ko(e)),Yo=(e,t)=>qo(Ko(e)+Ko(t)),Xo=(e,t)=>qo(Math.max(0,Ko(e)-Ko(t))),Zo=e=>qo(e.reduce((e,t)=>e+Ko(t),0)),Qo=e=>Ho(Ro(String(e??`0`)),6),$o=e=>Uo(e,6);var es=class extends C.Component{constructor(e){super(e),this.state={hasError:!1,error:void 0}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`[VerifierStamper] crashed`,e,t);try{typeof window<`u`&&window.dispatchEvent(new CustomEvent(`kk:error`,{detail:{where:`VerifierStamper`,error:e instanceof Error?e.message:String(e)}}))}catch(e){console.error(`[VerifierStamper] failed to dispatch kk:error`,e)}}handleReset=()=>{this.setState({hasError:!1,error:void 0}),this.props.onReset?.()};render(){if(this.state.hasError){let e=this.state.error instanceof Error?this.state.error.message:String(this.state.error??`Unknown error`),t=this.state.error instanceof Error?this.state.error.stack:void 0;return(0,W.jsxs)(`div`,{role:`alert`,style:{padding:16},children:[(0,W.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:8},children:[(0,W.jsx)(`strong`,{children:`Verifier crashed`}),(0,W.jsx)(`button`,{className:`secondary`,onClick:this.handleReset,title:`Reset Verifier`,"aria-label":`Reset Verifier`,children:`Reset`})]}),(0,W.jsx)(`div`,{style:{fontSize:14,color:`var(--dim, #999)`},children:e}),t&&(0,W.jsxs)(`details`,{style:{marginTop:8},children:[(0,W.jsx)(`summary`,{children:`Stack`}),(0,W.jsx)(`pre`,{style:{whiteSpace:`pre-wrap`},children:t})]})]})}return(0,W.jsx)(W.Fragment,{children:this.props.children})}},ts=[`Root`,`Sacral`,`Solar Plexus`,`Heart`,`Throat`,`Third Eye`,`Crown`].reduce((e,t)=>(e[t.toLowerCase()]=t,e),{});function ns(e){let t=e.toLowerCase().trim().replace(/[-_]/g,` `).replace(/\b(gate|chakra|day)\b/g,``).replace(/\s+/g,` `).trim();return/(third\s*eye)/.test(t)?`third eye`:/(solar\s*plexus)/.test(t)?`solar plexus`:t}function rs(e){if(typeof e!=`string`)return null;let t=ns(e),n=ts[t];if(n)return n;switch(t){case`root`:return`Root`;case`sacral`:return`Sacral`;case`solar`:case`plexus`:return`Solar Plexus`;case`heart`:return`Heart`;case`throat`:return`Throat`;case`third`:case`eye`:return`Third Eye`;case`crown`:return`Crown`;default:return null}}function is(e){return rs(e.chakraDay??``)||rs(e.chakraGate??``)||null}function as(e,t,n=``){if(typeof e==`object`&&e){let n=e[t];if(typeof n==`string`)return n}return n}function os(e,t){if(typeof e==`object`&&e){let n=e[t];if(typeof n==`number`&&Number.isFinite(n))return n}}function ss(e){let{meta:t,sigilSvgRaw:n,verifyUrl:r,pulseNow:i}=e;if(!t)return{nowPulse:String(i)};let a=t.valuation??null,o=os(t,`beat`)??t.beat??0,s=os(t,`stepIndex`)??t.stepIndex??0,c=os(t,`pulse`)??t.pulse??0,l=(t.transfers??[]).map(e=>({action:e.receiverSignature?`receive`:`send`,pulse:e.senderKaiPulse,beat:o,stepIndex:s,ownerPhiKey:t.userPhiKey})),u=t,d=u.zk,f;if(typeof d==`object`&&d){let e=d,t=typeof e.scheme==`string`?e.scheme:void 0,n=typeof e.poseidon==`string`?e.poseidon:void 0;f=t?{scheme:t,poseidon:n}:void 0}return{purpose:as(t,`purpose`),to:as(t,`to`),from:as(t,`from`),location:as(t,`location`),witnesses:as(t,`witnesses`),reference:as(t,`reference`),remark:as(t,`remark`,`In Yahuah We Trust — Secured by Φ, not man-made law`),valuePhi:typeof a?.valuePhi==`number`?String(a.valuePhi):``,premiumPhi:typeof a?.premiumPhi==`number`?String(a.premiumPhi):``,computedPulse:typeof c==`number`?String(c):``,nowPulse:String(i),kaiSignature:typeof t.kaiSignature==`string`?t.kaiSignature:``,userPhiKey:typeof t.userPhiKey==`string`?t.userPhiKey:``,sigmaCanon:as(u,`sigmaCanon`),shaHex:as(u,`shaHex`),phiDerived:as(u,`phiDerived`),valuationAlg:a?.algorithm==null?``:String(a.algorithm),valuationStamp:a?.stamp==null?``:String(a.stamp),provenance:l.slice(-7),zk:f,sigilSvg:n??``,verifyUrl:r||``}}function cs(e,t){let n=e;if(!n)return{used:!1,expired:!1};let r=!!n.sendLock?.used,i=n.childClaim?.expireAtPulse;if(typeof i!=`number`||!Number.isFinite(i)){let e=n.transfers?.slice(-1)[0]?.senderKaiPulse;typeof e==`number`&&(i=e+77)}return{used:r,expired:typeof i==`number`?t>i:!1,expireAt:i}}function ls(e,t){if(!e)return{expired:!1};let n=e.transfers?.slice(-1)[0];if(!(n&&!n.receiverSignature))return{expired:!1};let r=n?.senderKaiPulse;if(typeof r!=`number`)return{expired:!1};let i=r+77;return{expired:t>i,expireAt:i}}function us(e){let{contextOk:t,typeOk:n,hasCore:r,contentSigMatches:i,isOwner:a,hasTransfers:o,lastOpen:s,lastClosed:c,isUnsigned:l,childUsed:u,childExpired:d,parentOpenExpired:f,isChildContext:p}=e;return!t||!n?`invalid`:r?i===!1?`sigMismatch`:a===!1?`notOwner`:l?`unsigned`:s?d||f?`complete`:`readyReceive`:p?u||o&&c?`readySend`:`complete`:`readySend`:`structMismatch`}const ds=e=>`sigil:rotated:${e}`;function fs(e,t){let n=Array.from(new Set((e??[]).map(e=>String(e||``).toLowerCase()).filter(e=>e.length>0)));for(let e of n){try{typeof localStorage<`u`&&localStorage.setItem(ds(e),`${t}@${Kr()}`)}catch(e){Mo(`publishRotation.localStorage`,e)}try{let n=new BroadcastChannel(`sigil-xfer-v1`),r={type:`rotated`,canonical:e,token:t};n.postMessage(r),n.close()}catch(e){Mo(`publishRotation.bc`,e)}try{typeof window<`u`&&window.dispatchEvent(new CustomEvent(`sigil:transfer-rotated`,{detail:{canonical:e,token:t}}))}catch(e){Mo(`publishRotation.dispatch`,e)}}}(3+Math.sqrt(5))*1e3;const ps=`https://schema.phi.network/sigil/v1`,ms=`application/phi.kairos.sigil+svg`,hs=2e3,gs=e=>Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``);async function _s(e){let t=typeof e==`string`?new TextEncoder().encode(e):e,n=await crypto.subtle.digest(`SHA-256`,t);return gs(new Uint8Array(n))}var vs=`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`;function ys(e){let t=0n;for(let n of e)t=(t<<8n)+BigInt(n);let n=``;for(;t>0n;)n=vs[Number(t%58n)]+n,t/=58n;for(let t=0;t1;){let e=[];for(let n=0;n1;){let e=n%2==1?n-1:n+1,t=r[e]??r[n];i.push(t);let a=[];for(let e=0;eJSON.stringify(e)+`:`+ks(t[e])).join(`,`)+`}`}async function As(e){let{pulse:t,beat:n,stepIndex:r,chakraDay:i}=e;return typeof t!=`number`||typeof n!=`number`||typeof r!=`number`||typeof i!=`string`?null:_s(`${t}|${n}|${r}|${i}|${e.intentionSigil??``}`)}async function js(e){let t=await _s(e+`φ`),n=new Uint8Array(20);for(let e=0;e<20;e++)n[e]=parseInt(t.slice(e*2,e*2+2),16);return bs(n,0)}function Ms(e){let t={senderSignature:e.senderSignature,senderStamp:e.senderStamp,senderKaiPulse:e.senderKaiPulse};return e.payload&&(t.payload={name:e.payload.name,mime:e.payload.mime,size:e.payload.size}),e.receiverSignature&&(t.receiverSignature=e.receiverSignature),e.receiverStamp&&(t.receiverStamp=e.receiverStamp),e.receiverKaiPulse!=null&&(t.receiverKaiPulse=e.receiverKaiPulse),t}async function Ns(e){return _s(JSON.stringify(Ms(e)))}function Ps(e){let t={senderSignature:e.senderSignature,senderStamp:e.senderStamp,senderKaiPulse:e.senderKaiPulse};return e.payload&&(t.payload={name:e.payload.name,mime:e.payload.mime,size:e.payload.size}),t}async function Fs(e){return _s(JSON.stringify(Ps(e)))}async function Is(e){return ws(await Promise.all(e.map(Ns)))}async function Ls(e,t){return _s(ks({pulse:e.pulse??0,beat:e.beat??0,stepIndex:e.stepIndex??0,chakraDay:e.chakraDay??``,kaiSignature:e.kaiSignature??``,creatorPublicKey:e.creatorPublicKey??``,cumulativeTransfers:t??e.cumulativeTransfers??0,segments:(e.segments??[]).map(e=>({index:e.index,root:e.root,cid:e.cid,count:e.count})),segmentsMerkleRoot:e.segmentsMerkleRoot??``}))}function Rs(e){return(e.segments??[]).reduce((e,t)=>e+(t.count||0),0)}async function zs(e,t){return Ls(e,Rs(e)+t)}function Bs(e,t){let n=rs(e.chakraDay)??`Root`,r={v:1,type:`send`,sigil:{pulse:e.pulse??0,beat:e.beat??0,stepIndex:e.stepIndex??0,chakraDay:n,kaiSignature:e.kaiSignature??``},previousHeadRoot:t.previousHeadRoot,senderKaiPulse:t.senderKaiPulse,senderPubKey:t.senderPubKey,nonce:t.nonce,transferLeafHashSend:t.transferLeafHashSend};return new TextEncoder().encode(ks(r))}function Vs(e){let t={v:1,type:`receive`,link:e.senderSig,previousHeadRoot:e.previousHeadRoot,receiverKaiPulse:e.receiverKaiPulse,receiverPubKey:e.receiverPubKey,transferLeafHashReceive:e.transferLeafHashReceive};return new TextEncoder().encode(ks(t))}async function Hs(e){return _s(JSON.stringify({pulse:e.pulse,beat:e.beat,stepIndex:e.stepIndex,chakraDay:e.chakraDay,kaiSignature:e.kaiSignature,userPhiKey:e.userPhiKey,cumulativeTransfers:e.cumulativeTransfers??0,segments:(e.segments??[]).map(e=>({index:e.index,root:e.root,cid:e.cid,count:e.count})),segmentsMerkleRoot:e.segmentsMerkleRoot??``}))}function Us(e){let t=JSON.stringify(e);return btoa(unescape(encodeURIComponent(t))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function Ws(){let e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``)}async function Gs(e){return _s(ks(e))}async function Ks(e){let t=JSON.stringify(e),n=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(t));return[...new Uint8Array(n)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}function qs(e,t,n,r){let i=typeof window<`u`&&typeof window.location?.origin==`string`?window.location.origin:`http://localhost`,a=new URL(e,i);return a.searchParams.set(`p`,Us(t)),n&&a.searchParams.set(`t`,n),r&&r.length>0&&a.searchParams.set(`h`,r),a.toString()}var Js=0;function Ys(e,t){console.error(`[modal] ${e}:`,t)}function Xs(e){return!!(e.open||e.hasAttribute(`open`))}function Zs(){Js+=1,typeof document<`u`&&Js===1&&(document.documentElement.classList.add(`kk-dialog-open`),document.body.style.overflow=`hidden`,document.body.style.touchAction=`none`)}function Qs(){Js=Math.max(0,Js-1),typeof document<`u`&&Js===0&&(document.documentElement.classList.remove(`kk-dialog-open`),document.body.style.overflow=``,document.body.style.touchAction=``)}function $s(e){let t=()=>{e.removeEventListener(`close`,t),e.removeEventListener(`cancel`,t),e.setAttribute(`data-open`,`false`),e.removeAttribute(`data-rotate`),Qs()};e.addEventListener(`close`,t,{once:!0}),e.addEventListener(`cancel`,t,{once:!0})}function ec(e){return e.querySelector(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`)??null}function tc(e){if(!(typeof window>`u`||!e))try{if(Xs(e)){e.setAttribute(`data-open`,`true`);let t=ec(e)??e;typeof t.focus==`function`&&t.focus();return}let t=typeof e.showModal==`function`,n=typeof e.show==`function`;try{t?e.showModal():n?e.show():e.setAttribute(`open`,``)}catch(t){Ys(`showModal/show`,t),e.setAttribute(`open`,``)}e.setAttribute(`data-open`,`true`),$s(e),Zs();let r=ec(e)??e;typeof r.focus==`function`&&r.focus()}catch(e){Ys(`safeShowDialog`,e)}}function nc(e,t,n){let r=n?.delayMs??0,i=()=>{if(r>0){window.setTimeout(t,r);return}try{let e=typeof window<`u`?window.requestAnimationFrame:void 0;typeof e==`function`?e(()=>e(t)):window.setTimeout(t,16)}catch(e){Ys(`switchModal.runNext`,e),window.setTimeout(t,16)}};if(!e){i();return}try{if(Xs(e)){e.setAttribute(`data-open`,`false`),e.removeAttribute(`data-rotate`);let t=()=>{e.removeEventListener(`close`,t),Qs()};e.addEventListener(`close`,t,{once:!0});try{e.close()}catch(t){Ys(`current.close`,t),e.removeAttribute(`open`);try{e.dispatchEvent(new Event(`close`))}catch(e){Ys(`dispatch(close)`,e)}}i();return}}catch(e){Ys(`switchModal`,e)}i()}function rc(){let e=window;e.__SIGIL__||={};let t=e.__SIGIL__;return{registerSigilUrl:typeof t.registerSigilUrl==`function`?t.registerSigilUrl:void 0,registerSend:typeof t.registerSend==`function`?t.registerSend:void 0}}const ic=typeof window<`u`&&typeof document<`u`;function ac(e,t){if(!e||typeof e!=`object`)return;let n=t.split(`.`),r=e;for(let e of n)if(r&&typeof r==`object`&&e in r)r=r[e];else return;return r}function oc(e){return e==null?``:String(e)}function sc(e,t){for(let n of t){let t=ac(e,n);if(t!=null&&t!==``)return oc(t)}return``}function cc(e,t){if(!ic)return``;let n=oc(ac(e,`pulse`)),r=oc(ac(e,`beat`)),i=oc(ac(e,`stepIndex`)),a=n&&r&&i?`ks-${n}-${r}-${i}`:``,o=a?document.getElementById(a):null;if(!o)return``;let s=t.replace(/^data-/,``).replace(/-([a-z])/g,(e,t)=>t.toUpperCase());return(o.dataset||{})[s]??o.getAttribute(t)??``}const lc=({data:e})=>{if(typeof e!=`object`||!e)return(0,W.jsx)(`span`,{className:`json-primitive`,children:String(e)});let t=Array.isArray(e);return(0,W.jsx)(`ul`,{className:`json-node`,children:(t?e.map((e,t)=>[t,e]):Object.entries(e)).map(([e,n])=>(0,W.jsx)(`li`,{children:(0,W.jsxs)(`details`,{children:[(0,W.jsx)(`summary`,{children:t?`[${e}]`:`"${e}"`}),(0,W.jsx)(lc,{data:n})]})},String(e)))})};var uc=lc;const dc=({path:e,label:t})=>{let n={check:`M5 13l4 4L19 7`,x:`M6 6l12 12M6 18L18 6`,warn:`M12 9v4m0 4h.01M12 3l9 16H3z`,shield:`M12 3l7 4v6l-7 4-7-4V7l7-4z`,sigma:`M18 6H9l5 6-5 6h9M6 6h2M6 18h2`,phi:`M12 4a8 8 0 100 16 8 8 0 000-16zm0 0v16`,send:`M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z`,recv:`M2 22l11-11M2 22l20-7-9-4-4-9-7 20z`,done:`M12 21c4.97 0 9-4.03 9-9S16.97 3 12 3 3 7.03 3 12s4.03 9 9 9zm-1-6l6-6M8 12l3 3`,stack:`M12 3l9 4-9 4-9-4 9-4zm-9 8l9 4 9-4M3 19l9 4 9-4`,hash:`M10 3L8 21M16 3l-2 18M3 8h18M3 16h18`,zk:`M12 3l7 4v6l-7 4-7-4V7l7-4zM9 12h6`,paperclip:`M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.2a2 2 0 01-2.83-2.83l8.49-8.49`,lock:`M7 10V7a5 5 0 0110 0v3h1a2 2 0 012 2v7a2 2 0 01-2 2H6a2 2 0 01-2-2v-7a2 2 0 012-2h1zm3 0h4V7a3 3 0 00-6 0v3z`,timer:`M12 8v5l3 3M12 2a10 10 0 100 20 10 10 0 000-20`,ban:`M4.93 4.93l14.14 14.14M12 2a10 10 0 110 20 10 10 0 010-20`};return(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`18`,height:`18`,"aria-hidden":`true`,focusable:`false`,className:`ico`,children:[(0,W.jsx)(`path`,{d:n[e],stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`}),t?(0,W.jsx)(`title`,{children:t}):null]})},fc=({title:e,kind:t=`info`,children:n,badge:r=null})=>(0,W.jsx)(`span`,{className:`chip icon ${t}`,role:`img`,"aria-label":e,title:e,...r==null?{}:{"data-badge":String(r)},children:n});function pc({uiState:e,meta:t,contentSigMatches:n,phiKeyMatches:r,headProof:i,canonicalContext:a,childUsed:o,childExpired:s,parentOpenExpired:c,isSendFilename:l}){let u=[],d=e=>u.push(e);e===`invalid`&&d((0,W.jsx)(fc,{kind:`err`,title:`Invalid`,children:(0,W.jsx)(dc,{path:`x`})},`inv`)),e===`structMismatch`&&d((0,W.jsx)(fc,{kind:`err`,title:`Structure mismatch`,children:(0,W.jsx)(dc,{path:`warn`})},`struct`)),e===`sigMismatch`&&d((0,W.jsx)(fc,{kind:`err`,title:`Signature mismatch`,children:(0,W.jsx)(dc,{path:`x`})},`sigm`)),e===`notOwner`&&d((0,W.jsx)(fc,{kind:`warn`,title:`Not owner`,children:(0,W.jsx)(dc,{path:`shield`})},`owner`)),e===`unsigned`&&d((0,W.jsx)(fc,{kind:`warn`,title:`Unsigned`,children:(0,W.jsx)(dc,{path:`hash`})},`unsigned`)),e===`readySend`&&d((0,W.jsx)(fc,{kind:`info`,title:`Ready to send`,children:(0,W.jsx)(dc,{path:`send`})},`send`)),e===`readyReceive`&&d((0,W.jsx)(fc,{kind:`info`,title:`Ready to receive`,children:(0,W.jsx)(dc,{path:`recv`})},`recv`)),e===`complete`&&d((0,W.jsx)(fc,{kind:`ok`,title:`Receipt`,children:(0,W.jsx)(dc,{path:`done`})},`done`)),e===`verified`&&d((0,W.jsx)(fc,{kind:`ok`,title:`Verified`,children:(0,W.jsx)(dc,{path:`check`})},`ver`)),n===!0&&d((0,W.jsx)(fc,{kind:`ok`,title:`Content Σ match`,children:(0,W.jsx)(dc,{path:`sigma`})},`sigok`)),n===!1&&d((0,W.jsx)(fc,{kind:`err`,title:`Content Σ mismatch`,children:(0,W.jsx)(dc,{path:`sigma`})},`sigerr`)),r===!0&&d((0,W.jsx)(fc,{kind:`ok`,title:`Φ-Key match`,children:(0,W.jsx)(dc,{path:`phi`})},`phiok`)),r===!1&&d((0,W.jsx)(fc,{kind:`err`,title:`Φ-Key mismatch`,children:(0,W.jsx)(dc,{path:`phi`})},`phierr`)),t?.cumulativeTransfers!=null&&d((0,W.jsx)(fc,{kind:`info`,title:`Cumulative transfers`,badge:t.cumulativeTransfers,children:(0,W.jsx)(dc,{path:`hash`})},`cum`)),(t?.segments?.length??0)>0&&d((0,W.jsx)(fc,{kind:`info`,title:`Segments`,badge:t?.segments?.length??0,children:(0,W.jsx)(dc,{path:`stack`})},`segs`)),i&&d((0,W.jsx)(fc,{kind:i.ok?`ok`:`err`,title:i.ok?`Head proof verified`:`Head proof failed`,children:(0,W.jsx)(dc,{path:`shield`})},`headproof`)),t?.transfersWindowRootV14&&d((0,W.jsx)(fc,{kind:`info`,title:`v14 head root present`,children:(0,W.jsx)(dc,{path:`hash`})},`v14root`)),(t?.hardenedTransfers??[]).some(e=>!!(e.zkSend?.verified||e.zkReceive?.verified))&&d((0,W.jsx)(fc,{kind:`ok`,title:`Zero-knowledge proof verified`,children:(0,W.jsx)(dc,{path:`zk`})},`zk`));let f=a===`derivative`;return f&&o&&d((0,W.jsx)(fc,{kind:`warn`,title:`Transfer link used`,children:(0,W.jsx)(dc,{path:`lock`})},`used`)),f&&s&&d((0,W.jsx)(fc,{kind:`warn`,title:`Transfer link expired`,children:(0,W.jsx)(dc,{path:`timer`})},`expired`)),a===`parent`&&c&&d((0,W.jsx)(fc,{kind:`warn`,title:`Send expired`,children:(0,W.jsx)(dc,{path:`timer`})},`pexp`)),l&&d((0,W.jsx)(fc,{kind:`warn`,title:`SEND file: segmentation disabled`,children:(0,W.jsx)(dc,{path:`ban`})},`nosg`)),u}var mc=({className:e,scrollable:t=!0,ariaLive:n=`polite`,...r})=>{let i=pc(r);return(0,W.jsxs)(`div`,{className:`status-chips ${e??``}`,role:`group`,"aria-label":`Verification status`,"aria-live":n,style:t?{overflowX:`auto`,whiteSpace:`nowrap`}:void 0,"data-count":i.length,children:[(0,W.jsx)(`span`,{className:`chip-sentinel`,"aria-hidden":`true`}),i.map((e,t)=>(0,W.jsx)(`span`,{className:`chip-wrap`,"data-i":t,style:{display:`inline-block`},children:e},t))]})},hc=u(y(),1),gc=`sigil:urls`;function _c(e){if(!(typeof window>`u`))try{let t=window.localStorage.getItem(gc),n=t?JSON.parse(t):[];n.includes(e)||(n.push(e),window.localStorage.setItem(gc,JSON.stringify(n)));let r=new CustomEvent(`sigil:url-registered`,{detail:{url:e}});window.dispatchEvent(r)}catch{}}var vc=e=>{let{open:t,url:n,hash:r,onClose:i}=e,a=(0,C.useRef)(null),o=(0,C.useRef)(null),s=(0,C.useRef)(null),c=(0,C.useRef)(null),[l,u]=(0,C.useState)(``),d=(0,C.useRef)(null);(0,C.useEffect)(()=>{if(!(!t||!n)&&d.current!==n)if(d.current=n,typeof window<`u`&&window.__SIGIL__&&typeof window.__SIGIL__.registerSigilUrl==`function`)try{window.__SIGIL__.registerSigilUrl(n)}catch{_c(n)}else _c(n)},[t,n]),(0,C.useEffect)(()=>{let e=a.current;if(!e)return;let n=e=>e.preventDefault();if(e.addEventListener(`cancel`,n),t){c.current=document.activeElement??null;try{if(!e.open)try{e.showModal()}catch{e.show()}e.setAttribute(`data-open`,`true`)}catch{}let t=window.setTimeout(()=>s.current?.focus({preventScroll:!0}),0);return()=>{clearTimeout(t),e.removeEventListener(`cancel`,n)}}else e.open&&e.close(),e.setAttribute(`data-open`,`false`),e.removeEventListener(`cancel`,n),c.current?.focus?.()},[t]);let f=(0,C.useMemo)(()=>{if(typeof navigator>`u`)return!1;let e=navigator;return typeof e.share==`function`?n&&typeof e.canShare==`function`?e.canShare({url:n}):!0:!1},[n]),p=(0,C.useCallback)(e=>{if(e.key!==`Tab`)return;let t=o.current;if(!t)return;let n=t.querySelectorAll([`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex='-1'])`].join(`,`));if(n.length===0)return;let r=n[0],i=n[n.length-1];!e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus())},[]);(0,C.useEffect)(()=>{if(!t)return;let e=e=>p(e);return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[t,p]);let m=e=>{u(e),window.setTimeout(()=>u(``),900)},h=async(e,t)=>{try{await navigator.clipboard.writeText(e),m(`${t} copied to clipboard`)}catch{m(`Could not copy ${t}`)}},g=async()=>{try{f&&typeof navigator<`u`?(await navigator.share?.({title:`Kairos Sigil-Glyph`,text:`Sealed Kairos Moment`,url:n}),m(`Share sheet opened`)):await h(n,`Link`)}catch{}},_=(0,C.useMemo)(()=>r?r.slice(0,16):`—`,[r]),v=e=>{e.preventDefault(),e.stopPropagation(),i?.()};return t?(0,hc.createPortal)((0,W.jsxs)(`dialog`,{ref:a,className:`seal-dialog seal-toplayer glass-modal fullscreen`,"aria-label":`Moment Sealed`,style:{zIndex:2147483647,padding:0,border:`none`,background:`transparent`},children:[(0,W.jsx)(`div`,{className:`seal-veil`,"aria-hidden":`true`}),(0,W.jsxs)(`div`,{ref:o,className:`seal-card`,role:`document`,onClick:e=>e.stopPropagation(),children:[(0,W.jsx)(`div`,{className:`seal-ornament seal-ornament--tl`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`seal-ornament seal-ornament--tr`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`seal-ornament seal-ornament--bl`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`seal-ornament seal-ornament--br`,"aria-hidden":`true`}),(0,W.jsx)(`button`,{ref:s,className:`seal-close`,"aria-label":`Close`,onClick:v,type:`button`,children:(0,W.jsx)(yc,{})}),(0,W.jsxs)(`header`,{className:`seal-header`,children:[(0,W.jsx)(`h3`,{id:`seal-title`,className:`seal-title`,children:`Moment Sealed`}),(0,W.jsx)(`p`,{id:`seal-desc`,className:`seal-subtitle`,children:`Your Kairos imprint is preserved. Proceed to the url below to Inhale Claimed Ownership.`})]}),(0,W.jsxs)(`label`,{className:`field`,children:[(0,W.jsx)(`span`,{className:`field-label`,children:`Hash`}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`code`,{className:`hash`,title:r||`—`,children:r?_:`—`}),(0,W.jsx)(`button`,{className:`icon-btn`,onClick:()=>h(r,`Hash`),disabled:!r,"aria-label":`Copy hash`,title:`Copy hash`,type:`button`,children:(0,W.jsx)(xc,{})})]}),r&&(0,W.jsxs)(`p`,{className:`micro`,children:[`Full: `,(0,W.jsx)(`span`,{className:`mono`,children:r})]})]}),(0,W.jsxs)(`label`,{className:`field`,children:[(0,W.jsx)(`span`,{className:`field-label`,children:`URL`}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`input`,{className:`url-input`,value:n,readOnly:!0,"aria-readonly":`true`,spellCheck:!1,dir:`ltr`,title:n,onFocus:e=>e.currentTarget.select()}),(0,W.jsx)(`button`,{className:`icon-btn`,onClick:()=>h(n,`Link`),disabled:!n,"aria-label":`Copy link`,title:`Copy link`,type:`button`,children:(0,W.jsx)(xc,{})}),n&&(0,W.jsx)(`a`,{className:`open-link`,href:n,target:`_blank`,rel:`noopener`,"aria-label":`Open link in new tab`,title:`Open link`,children:(0,W.jsx)(Sc,{})})]})]}),(0,W.jsx)(`div`,{className:`cta-row`,children:(0,W.jsxs)(`button`,{className:`secondary cta`,onClick:g,type:`button`,children:[(0,W.jsx)(bc,{}),(0,W.jsx)(`span`,{children:f?`Share`:`Remember Link`})]})}),(0,W.jsx)(`p`,{className:`fine`,children:`This moment is now sealed in time. Use the link above within the next 11 breaths to claim ownership & gain permanent access to this kairos moment.`}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:l})]})]}),document.body):null},yc=()=>(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`seal-close-ico`,children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,opacity:`.35`}),(0,W.jsx)(`path`,{d:`M7 7l10 10M17 7L7 17`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`})]}),bc=()=>(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,W.jsx)(`path`,{d:`M15 8a3 3 0 100-6 3 3 0 000 6zM6 14a3 3 0 100-6 3 3 0 000 6zm9 12a3 3 0 100-6 3 3 0 000 6z`,fill:`currentColor`}),(0,W.jsx)(`path`,{d:`M8.6 9.7l6.8-3.4M8.6 12.3l6.8 3.4`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`})]}),xc=()=>(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,W.jsx)(`rect`,{x:`9`,y:`9`,width:`10`,height:`10`,rx:`2`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,W.jsx)(`rect`,{x:`5`,y:`5`,width:`10`,height:`10`,rx:`2`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`,opacity:`.5`})]}),Sc=()=>(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,W.jsx)(`path`,{d:`M10 14a5 5 0 007.07 0l1.41-1.41a5 5 0 00-7.07-7.07L10 6`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,W.jsx)(`path`,{d:`M14 10a5 5 0 00-7.07 0L5.5 11.43a5 5 0 007.07 7.07L14 18`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`})]}),Cc=vc,G=(1+Math.sqrt(5))/2,wc=44,Tc=11,Ec=wc*Tc,Dc=17491.270421,Oc=G,kc=1/G,Ac={low:1-1/G**6,med:1,high:1+1/G**6},jc=1/G**6,Mc=1/G**5,Nc=1/G**3,Pc=1/G**4,Fc=1+1/G**4,Ic=.7,Lc=.3,Rc=1/Lc,zc=1/G**6,Bc=1/G**6,Vc=.15,Hc=1/G**5,Uc=1+1/G**3,Wc=1/G**5,Gc=Dc,Kc=1/G**7,qc=1/G**7,Jc=1/G**8,Yc=1/G,Xc=1/G**2,Zc=1/G**2,Qc=1/G**3,$c=1/G**4,el=1/G**4,tl=1/G**5,nl=1/G**6,rl=1/G**5,il=Dc*365,al=il,ol=1/G**3,sl=1/G**2,cl=1/G**4,ll=1/G**6,ul=1/G**7,dl=1/G**8,fl=1/G**8,pl=1/G**9,ml=1/G**4,hl=1/G,gl={RARITY_ONE_OF_ONE:Oc,RARITY_EXP:kc,QUALITY_MAP:Ac,CREATOR_VERIFIED_LIFT:jc,CREATOR_REP_MAX:Mc,PROV_LOG_SLOPE:Nc,HOLD_SLOPE:Pc,HOLD_CAP:Fc,CLOSURE_CENTER:Ic,CLOSURE_RANGE:Lc,CLOSURE_GAIN:zc,CADENCE_GAIN:Bc,CHURN_KAPPA:Vc,AGE_EPS:Hc,AGE_CAP:Uc,RESONANCE_GAIN:Wc,DISCOUNT_PULSE_HALFSPAN:Gc,GEOM_EDGE_GAIN:Kc,GEOM_PHI_GAIN:qc,GEOM_PRIME_GAIN:Jc,MOMENT_FIB_EXACT_GAIN:Yc,MOMENT_LUCAS_EXACT_GAIN:Xc,MOMENT_PHI_TRANSITION_GAIN:Zc,MOMENT_UNIFORM_GAIN:Qc,MOMENT_PAL_GAIN:$c,MOMENT_RUN_GAIN:el,MOMENT_SEQ_GAIN:tl,MOMENT_LOW_ENTROPY_GAIN:nl,GENESIS_BIAS_GAIN:rl,YEAR_PULSES_APPROX:il,ADOPTION_TAU_PULSES:al,ADOPTION_GAIN_BASE:ol,ADOPTION_GAIN_RARE:sl,INDEX_SCARCITY_GAIN:cl,FIB_STEP_GAIN:ll,LUCAS_STEP_GAIN:ul,BREATH_WAVE_GAIN:dl,DAY_WAVE_GAIN:fl,STROBE_WAVE_GAIN:pl,MOMENT_AFFINITY_GAIN_BASE:ml,MOMENT_AFFINITY_DIGIT_WEIGHT:hl,DEFAULT_STEPS_PER_BEAT:wc,PULSES_PER_STEP:Tc,PULSES_PER_BEAT_CANON:Ec,PULSES_PER_DAY_EXACT:Dc,PHI:G};function _l(e){if(e===null)return`null`;switch(typeof e){case`string`:case`number`:case`boolean`:return JSON.stringify(e);case`object`:{if(Array.isArray(e))return`[`+e.map(_l).join(`,`)+`]`;let t=e;return`{`+Object.keys(t).sort().map(e=>JSON.stringify(e)+`:`+_l(t[e])).join(`,`)+`}`}default:return`null`}}function vl(e){return _l(e)}function yl(){let e=`val-policy:`+vl(gl),t=2166136261;for(let n=0;n>>0;return(`00000000`+(t>>>0).toString(16)).slice(-8)}var bl=yl(),xl=(e,t,n)=>Math.max(t,Math.min(n,e)),Sl=e=>Math.log(1+Math.max(0,e)),Cl=e=>e-Math.floor(e);function wl(e){if(!e.length)return 0;let t=e.slice().sort((e,t)=>e-t),n=Math.floor(t.length/2);return t.length%2?t[n]:(t[n-1]+t[n])/2}function Tl(e){let t=new Set;for(let n of e)n.receiverSignature&&t.add(n.receiverSignature);return Math.max(t.size,1)}function El(e){return e.filter(e=>e.receiverSignature&&e.receiverKaiPulse!=null)}function Dl(e){if(e.length<2)return[];let t=[];for(let n=1;n=r&&t.push(i-r)}return t}function Ol(e){if(e.length===0)return 1;let t=wl(e)||1,n=0;for(let r of e)n+=Math.abs(r-t)/t;return 1/(1+n/e.length)}function kl(e,t){let n=e?.expectedCashflowPhi?.map(e=>({atPulse:e.atPulse,amount:e.amountPhi}))??[],r=e?.expectedCashflowKS?.map(e=>({atPulse:e.atPulse,amount:e.amountKS}))??[];return[...n,...r].reduce((e,n)=>{let r=n.atPulse-t,i=1/(1+Math.max(0,r)/Gc);return e+n.amount*i},0)}function Al(e){if(!e||!Number.isFinite(e)||e<=0)return .5;let t=Math.log(e)/Math.log(G);return .5+.5*xl(1-2*Math.abs(t-Math.round(t)),0,1)}function jl(e){if(typeof e!=`number`||!Number.isFinite(e)||e<2)return!1;let t=Math.floor(e);if(t%2==0)return t===2;for(let e=3;e*e<=t;e+=2)if(t%e===0)return!1;return!0}function Ml(e,t,n){let r=1;if(typeof e.stepIndex==`number`&&(e.stepIndex===0||e.stepIndex===(t>0?t-1:-1))&&(r*=1+Kc),jl(e.beat)&&(r*=1+Jc),n>.9){let e=(n-.9)/.1;r*=1+qc*xl(e,0,1)}return r}function Nl(e){if(e<0n)throw Error(`sqrt of negative`);if(e<2n)return e;let t=e,n=(e>>1n)+1n;for(;n>1n;return t}function Pl(e){if(e<0n)return!1;let t=Nl(e);return t*t===e}var Fl=new Map;function Il(e){if(!Number.isFinite(e)||e<0)return!1;let t=Math.trunc(Math.abs(e)),n=Fl.get(t);if(n!==void 0)return n;let r=BigInt(t),i=5n*r*r+4n,a=5n*r*r-4n,o=Pl(i)||Pl(a);return Fl.set(t,o),o}var Ll=new Map;function Rl(e){if(!Number.isFinite(e)||e<0)return!1;let t=Math.trunc(Math.abs(e)),n=Ll.get(t);if(n!==void 0)return n;let r=BigInt(t),i=2n,a=1n;for(;at&&(t=n)):n=1;return t}function Ul(e){if(e.length===0)return{len:0,digit:``};let t=1,n=1,r=e[0],i=e[0];for(let a=1;at&&(t=n,r=i)):(n=1,i=e[a]);return{len:t,digit:r}}function Wl(e){if(e.length<=1)return 1;let t=1,n=1,r=0;for(let i=1;it&&(t=n)}return t}function Gl(e){if(e.length===0)return 1;let t=Array(10).fill(0);for(let n of e)t[n.charCodeAt(0)-48]++;let n=0;for(let r of t)if(r){let t=r/e.length;n-=t*Math.log(t)}let r=Math.log(Math.min(10,e.length));return xl(n/(r||1),0,1)}function Kl(e){return!Number.isFinite(e)||e<0?1:1+rl*(1-2*(e/(e+il)))}var ql=new Map;function Jl(e){if(!Number.isFinite(e)||e<1)return null;let t=Math.trunc(e),n=ql.get(t);if(n!==void 0)return n;let r=t,i=Math.log(r)/Math.log(G),a=Math.max(1,Math.floor(i)-2),o=null;for(let e=a;e<=a+6;e++)if(Math.ceil(G**+e)===r){o=e;break}return ql.set(t,o),o}function Yl(e){if(!Number.isFinite(e)||e<0)return 1;let t=zl(e),n=t.length,r=1;Il(e)&&(r*=1+Yc),Rl(e)&&(r*=1+Xc),Jl(e)!==null&&(r*=1+Zc),Bl(t)&&(r*=1+Qc),Vl(t)&&(r*=1+$c);let i=Hl(t);if(i>=3){let e=xl((i-2)/Math.max(3,n-2),0,1);r*=1+el*e}let a=Wl(t);if(a>=4){let e=xl((a-3)/Math.max(4,n-3),0,1);r*=1+tl*e}let o=Gl(t);return r*=1+nl*(1-o),r}function Xl(e){if(!Number.isFinite(e)||e<0)return 0;let t=zl(e),n=t.length,r=0,i=0,a=Il(e)?1:0;r+=1*a,i+=1;let o=Rl(e)?1:0;r+=1/G*o,i+=1/G;let s=Bl(t)?1:0;r+=1/G*s,i+=1/G;let c=Vl(t)?1:0;r+=1/G**2*c,i+=1/G**2;let l=xl((Hl(t)-2)/Math.max(3,n-2),0,1);r+=1/G**2*l,i+=1/G**2;let u=xl((Wl(t)-3)/Math.max(4,n-3),0,1);r+=1/G**3*u,i+=1/G**3;let d=Gl(t);return r+=1/G**3*(1-d),i+=1/G**3,i<=0?0:xl(r/i,0,1)}function Zl(e){if(!e.length)return 1;let t=0;for(let n of e)t+=Math.log(Math.max(n,1e-12));return Math.exp(t/e.length)}function Ql(e,t,n){if(!Number.isFinite(e)||!Number.isFinite(t)||n<=0)return .5;let r=((e-t)%n+n)%n,i=2*Math.PI*r/n;return .5*(1+Math.cos(i))}function $l(e,t){return!Number.isFinite(e)||t<=0?0:Math.floor(Math.floor(Math.max(0,e))/Tc)%t}function eu(e){return Number.isFinite(e)?Math.floor(Math.max(0,e))%Tc:0}function tu(e){return!Number.isFinite(e)||e<=0?0:Cl(Math.log(e)/Math.log(G))}function nu(e,t){if(e.size===0&&t.size===0)return 0;let n=new Set([...e,...t]),r=0;for(let n of e)t.has(n)&&r++;return r/n.size}function ru(e){let t=new Set;Il(e)&&t.add(`fib`),Rl(e)&&t.add(`lucas`);let n=zl(e);return Bl(n)&&t.add(`uniform`),Vl(n)&&t.add(`pal`),Hl(n)>=4&&t.add(`longrun`),Wl(n)>=5&&t.add(`longseq`),t}function iu(e){return!Number.isFinite(e)||e<=0?0:1-G**+(-e/al)}function au(e){if(!Number.isFinite(e)||e<=0)return 0;let t=1n,n=1n,r=0,i=BigInt(Math.trunc(e));for(;n<=i;){r++;let e=t+n;t=n,n=e}return r}function ou(e){if(!Number.isFinite(e)||e<=0)return 0;let t=2n,n=1n,r=0,i=BigInt(Math.trunc(e));for(;n<=i;){r++;let e=t+n;t=n,n=e}return r}function su(e,t){let n=Cl((e+t)*G);return{phase01:n,wave:1+pl*(2*n-1)}}function cu(e){return Number.isFinite(e)&&e>0?Math.trunc(e):wc}function lu(e,t){return typeof e.kaiPulse==`number`?e.kaiPulse:typeof e.pulse==`number`?e.pulse:t}function uu(e,t,n){return typeof e.stepIndex==`number`&&Number.isFinite(e.stepIndex)?xl(Math.trunc(e.stepIndex),0,t-1):$l(n,t)}function du(e,t,n){return typeof e.beat==`number`&&Number.isFinite(e.beat)?Math.trunc(e.beat):Math.floor(n/t)}function fu(e){return Object.freeze(e.inputs),Object.freeze(e.headRef),Object.freeze(e)}var pu=new Map;function mu(e,t){let n=cu(e.stepsPerBeat),r=n*Tc,i=lu(e,t),a=e.transfers??[],o=El(a),s=Math.max(1,(t-i)/r),c=a.length/s,l=Tl(a),u=a.length===0?1:o.length/a.length,d=Ol(Dl(a)),f=wl(o.map(e=>(e.receiverKaiPulse-e.senderKaiPulse)/r).filter(e=>e>=0)),p=Al(e.frequencyHz),m=uu(e,n,i),h=du(e,r,i),g=Ml({...e,stepIndex:m,beat:h},n,p),_=Math.max(0,t-i),v=kl(e.ip,t),y=e.seriesSize??1,b=y<=1?Oc:y**+-kc,x=e.quality??`med`,S=Ac[x],C=(e.creatorVerified?1+jc:1)+(e.creatorRep??0)*Mc,w=1+Nc*Sl(l-1),T=1+zc*xl((u-Ic)*Rc,-1,1),E=1+Bc*(2*d-1),D=xl(1+Pc*Sl(f),1,Fc),O=1+Wc*(2*p-1),k=_/r,A=Math.min(Uc,1+Hc*Sl(k)),j=1/(1+Vc*Math.max(0,c)),M=Yl(i),N=Zl(o.map(e=>Number.isFinite(e.receiverKaiPulse)?Yl(e.receiverKaiPulse):1)),P=Kl(i),F=M*Math.max(1,N)*P,I=b*S*C*w*T*E*D*O*A*j*g*F,L=iu(i),R=iu(t),z=Math.max(0,R-L),B=Xl(i),V=ol+sl*B,H=Math.exp(V*z),U=1+cl*(1-L),ee=au(_),te=ou(_),ne=Math.exp(ll*ee),re=Math.exp(ul*te),ie=U*H*ne*re,ae=1*M*U*H*ne*re*Math.max(1,P),oe=r>0?t%r/r:0,se=1+dl*(.5+.5*d)*Math.sin(2*Math.PI*oe),ce=Cl(t/Dc),le=Cl(i/Dc),ue=1-Math.abs((ce-le+1)%1-.5)*2,de=1+fl*(.5+.5*p)*(.5+.5*d)*(2*ue-1),{phase01:fe,wave:pe}=su(i,t),me=m,he=Ql($l(t,n),me,n),ge=eu(i),_e=Ql(eu(t),ge,Tc),ve=1-Math.abs((tu(t+1)-tu(i+1)+1)%1-.5)*2,ye=B,be=Xl(t),xe=1-Math.abs(ye-be),Se=hl*nu(ru(i),ru(t))+(1-hl)*xe,Ce=.3*he+.3*_e+.2*ve+.2*Se,we=ml*(.5+.5*ye)*(.5+.5*p),Te=1+we*(2*Ce-1),Ee=se*de*pe*Te,De=I*ie,Oe=Math.max(0,De-ae),ke=ae+Oe*Ee,Ae=1*ke+v,je={headHash:void 0,transfersWindowRoot:e.transfersWindowRoot,cumulativeTransfers:e.cumulativeTransfers??a.length},Me={size:y,quality:x,creatorVerified:!!e.creatorVerified,creatorRep:e.creatorRep??0,uniqueHolders:l,closedFraction:u,cadenceRegularity:d,medianHoldBeats:f,velocityPerBeat:c,resonancePhi:p,pulsesPerBeat:r,agePulses:_,geometryLift:g,momentLift:F,pv_phi:v,algorithmVersion:`phi/kosmos-vφ-5`,adoptionAtClaim:L,adoptionNow:R,adoptionDelta:z,rarityScore01:B,fibAccrualLevels:ee,lucasAccrualLevels:te,indexScarcity:U,adoptionLift:H,fibAccrualLift:ne,lucasAccrualLift:re,breathPhase01:oe,breathWave:se,dayPhase01:ce,dayWave:de,strobePhase01:fe,strobeWave:pe,momentAffinitySim01:Ce,momentAffinityAmp:we,momentAffinityOsc:Te,combinedOsc:Ee,dynamicGrowth:ie,rarityFloor:ae,premiumBandBase:Oe},Ne=bl,Pe={version:1,unit:`Φ`,algorithm:`phi/kosmos-vφ-5`,policyId:e.valuationPolicyId,policyChecksum:Ne,valuePhi:Ae,premium:ke,inputs:Me,computedAtPulse:t,headRef:je},Fe=vl({algorithm:Pe.algorithm,policy:Pe.policyId??null,policyChecksum:Pe.policyChecksum,inputs:Pe.inputs,minimalHead:{headHash:Pe.headRef.headHash??null,transfersWindowRoot:Pe.headRef.transfersWindowRoot??null,cumulativeTransfers:Pe.headRef.cumulativeTransfers}}),Ie=pu.get(Fe);if(Ie)return{unsigned:Ie,stampPayload:Fe};let Le=fu({...Pe,inputs:{...Pe.inputs},headRef:{...Pe.headRef}});return pu.set(Fe,Le),{unsigned:Le,stampPayload:Fe}}async function hu(e,t,n,r){let{unsigned:i,stampPayload:a}=mu(e,t),o={...i,headRef:{...i.headRef,headHash:r}},s=await n(a);return{seal:{...o,stamp:s}}}function gu(e,t){return{...e,valuation:t}}function _u(e){let t=e.inputs;return[`Algorithm: ${e.algorithm} • Policy checksum: ${e.policyChecksum}`,`Series rarity: size=${t.size} → rarityFactor≈${t.size<=1?Oc:t.size**+-kc}`,`Moment lifts: geometry=${t.geometryLift} × numericMoment=${t.momentLift} × genesis/baseline floor=${t.rarityFloor}`,`Adoption field: ΔA=${t.adoptionDelta} → adoptionLift=${t.adoptionLift} • indexScarcity=${t.indexScarcity} • fibLevels=${t.fibAccrualLevels} • lucasLevels=${t.lucasAccrualLevels}`,`Live alignment: breath=${t.breathWave} • day=${t.dayWave} • strobe=${t.strobeWave} • affinity=${t.momentAffinityOsc} → combined=${t.combinedOsc}`,`Premium: floor=${t.rarityFloor} + band=${t.premiumBandBase} × combined=${t.combinedOsc} ⇒ premium=${e.premium} → valueΦ=${e.valuePhi}`].join(` +`);return lr()}function xr(e){let t=sr(e,Jn,Yn*1000000n);return BigInt(In)+t}var Sr=86400000n,Cr=3600000n,wr=60000n,Tr=1000n,Er=/^([+-]?\d{4,})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?(Z|[+-]\d{2}:\d{2})$/,Dr=ar;function Or(e,t,n){let r=t<=2n?e-1n:e,i=t<=2n?t+12n:t,a=Dr(r>=0n?r:r-399n,400n),o=r-a*400n,s=Dr(153n*(i-3n)+2n,5n)+n-1n,c=o*365n+Dr(o,4n)-Dr(o,100n)+s;return a*146097n+c-719468n}function kr(e){let t=Er.exec(e);if(!t){let t=new Date(e).getTime();if(Number.isFinite(t))return BigInt(Math.trunc(t));throw Error(`Invalid ISO datetime.`)}let[,n,r,i,a,o,s=`00`,c=`0`,l]=t,u=BigInt(n),d=BigInt(r),f=BigInt(i),p=BigInt(a),m=BigInt(o),h=BigInt(s),g=0n;if(c&&c!==`0`){let e=(c+`000000000`).slice(0,9);g=(BigInt(e)+500000n)/1000000n}let _=p*Cr+m*wr+h*Tr+g,v=0n;if(l!==`Z`){let e=l[0]===`-`?-1n:1n,[t,n]=l.slice(1).split(`:`);v=e*(BigInt(t)*60n+BigInt(n))}return Or(u,d,f)*Sr+_-v*wr}function Ar(e){return sr(typeof e==`bigint`?e:BigInt(Math.trunc(e)),Xn,Zn)}function jr(e){let t;if(typeof e==`bigint`)t=e;else if(typeof e==`number`){if(!Number.isFinite(e))throw Error(`Invalid ms epoch number.`);t=BigInt(Math.trunc(e))}else if(typeof e==`string`)t=kr(e);else{let n=e.getTime();if(!Number.isFinite(n))throw Error(`Invalid Date: ${String(e)}`);t=BigInt(Math.trunc(n))}return sr(t-BigInt(In),Xn,Zn)}function Mr(e){let t=sr(typeof e==`bigint`?e:BigInt(Math.trunc(e)),Jn,Yn);return BigInt(In)+t}function Nr(e){let t=ir(e,Bn)%Un,n=t/Hn,r=t-n*Hn,i=r/Vn,a=r-i*Vn,o=Number(a)/Number(Vn);return{beat:Number(n),stepIndex:Number(i),percentIntoStep:o}}function Pr(e){let t=or(ar(e,1000000n)),{beat:n,stepIndex:r,percentIntoStep:i}=Nr(e),a=er((r+i)/44),{weekday:o,chakraDay:s}=cr(or(ir(ar(e,Bn),nr(Qn.length))));return{pulse:t,beat:n,stepIndex:r,stepPctAcrossBeat:a,chakraDay:s,weekday:o}}function Fr(e){return Pr(jr(e))}function Ir(e){return Fr(Mr(e))}function Lr(e,t){let n=new Date(e);if(Number.isNaN(n.getTime()))return``;let r=n.getTime(),i=r-r%6e4,a=Math.max(1,Math.floor(t))-1,o=sr(BigInt(a),Jn,Yn),s=BigInt(i)+o;return new Date(Number(s)).toISOString()}function Rr(e){let t=Number(e.kaiPulseEternal)||0,[n,r]=(e.chakraStepString??``).trim().split(`:`),i=Math.max(0,Math.min(35,Math.floor(Number(n))||0)),a=Math.max(0,Math.min(43,Math.floor(Number(r))||0)),o=0;if(typeof e.chakraStep?.percentIntoStep==`number`){let t=e.chakraStep.percentIntoStep;o=t>1.0000001?t/100:t,o=tr(o)}let s=er((a+o)/44),c=e=>{if(!e)return null;let t=e.trim().toLowerCase();return{root:`Root`,sacral:`Sacral`,"solar plexus":`Solar Plexus`,heart:`Heart`,throat:`Throat`,"third eye":`Third Eye`,thirdeye:`Third Eye`,crown:`Crown`}[t]??null},l=Qn[or(ir(ar(BigInt(Math.trunc(t))*1000000n,Bn),nr(Qn.length)))],u=e.harmonicDay??l,d=c(e.eternalChakraArc)??$n[u];return{pulse:Math.trunc(t),beat:i,stepIndex:a,stepPctAcrossBeat:s,chakraDay:d,weekday:u}}async function zr(e){return e===void 0?Promise.resolve(Pr(br())):Promise.resolve(Fr(e))}async function Br(e,t){return e===void 0?t?Promise.resolve(Fr(t)):Promise.resolve(Pr(br())):Promise.resolve(Fr(e))}function Vr(e){let t=Math.floor(tr(e)*44);return Math.max(0,Math.min(43,t))}function Hr(e,t){let n=e+1,r=t+1,i=e=>String(e).padStart(2,`0`);return{beat1:n,step1:r,label:`${i(n)}:${i(r)}`}}function Ur(e,t){let n=Math.max(0,Math.min(35,Math.floor(e))),r=Math.max(0,Math.min(43,Math.floor(t)));return`${n}:${String(r).padStart(2,`0`)}`}function Wr(e,t){return Lr(e,t)}function Gr(e){return Fr(e)}function Kr(e){return typeof e==`bigint`?jr(e):br()}function qr(e){return Pr(Kr(e))}var Jr=51.4769,Yr=0,Xr=Math.PI/180,Zr=1/(2*Math.PI),Qr=2440587.5,$r=new Map;function ei(e){return e/864e5+Qr}function ti(e){return(e-Qr)*864e5}function ni(e){let t=e%360;return t<0?t+360:t}function ri(e,t,n){return en?n:e}function ii(e){let t=new Date(Number(e));return{y:t.getUTCFullYear(),m:t.getUTCMonth()+1,d:t.getUTCDate()}}function ai(e,t){let n=-t*Xr,r=Math.round(e-2451545.0009-n*Zr);return 2451545.0009+n*Zr+r}function oi(e,t,n,r=Jr,i=Yr){let a=ai(ei(Date.UTC(e,t-1,n)),i),o=357.5291+.98560028*(a-2451545),s=o*Xr,c=ni(o+(1.9148*Math.sin(s)+.02*Math.sin(2*s)+3e-4*Math.sin(3*s))+180+102.9372)*Xr,l=a+.0053*Math.sin(s)-.0069*Math.sin(2*c),u=23.4397*Xr,d=Math.asin(Math.sin(c)*Math.sin(u)),f=r*Xr,p=-.833*Xr,m=(Math.sin(p)-Math.sin(f)*Math.sin(d))/(Math.cos(f)*Math.cos(d));return l-Math.acos(ri(m,-1,1))*Zr}function si(e){let{y:t,m:n,d:r}=ii(e),i=`${t}-${String(n).padStart(2,`0`)}-${String(r).padStart(2,`0`)}`,a=$r.get(i);if(a!==void 0)return a;let o=oi(t,n,r),s=BigInt(Math.round(ti(o)));return $r.set(i,s),s}var ci=[`Ignition Ark`,`Integration Ark`,`Harmonization Ark`,`Reflection Ark`,`Purification Ark`,`Dream Ark`],li={"Ignition Ark":`Ignite Ark`,"Integration Ark":`Integration Ark`,"Harmonization Ark":`Harmonization Ark`,"Reflection Ark":`Reflection Ark`,"Purification Ark":`Purify Ark`,"Dream Ark":`Dream Ark`},ui={"Ignition Ark":`Resurrection, will, awakening`,"Integration Ark":`Emotional grounding, emergence`,"Harmonization Ark":`Radiance, balance, coherent action`,"Reflection Ark":`Union, compassion, spoken resonance`,"Purification Ark":`Truth, remembrance, etheric light`,"Dream Ark":`Divine memory, lucid integration, dreaming awake`},di=[{name:`Aethon`,desc:`Resurrection fire: Root awakening`},{name:`Virelai`,desc:`Waters of becoming: Emotional emergence`},{name:`Solari`,desc:`Solar ignition: Radiant embodiment`},{name:`Amarin`,desc:`Heart bloom: Sacred balance`},{name:`Kaelus`,desc:`Voice of stars: Resonant expression`},{name:`Umbriel`,desc:`Divine remembrance: Krown alignment`},{name:`Noktura`,desc:`Light spiral: Selestial flow`},{name:`Liora`,desc:`Eternal mirror: Infinite now`}],fi=[{name:`Awakening Flame`,desc:`Root fire of ignition, will, resurrektion`},{name:`Flowing Heart`,desc:`Emotional waters, intimasy, surrender`},{name:`Radiant Will`,desc:`Solar klarity, aligned konfidence, embodiment`},{name:`Harmonic Voice`,desc:`Spoken truth, vibration, koherense in sound`},{name:`Inner Mirror`,desc:`Reflektion, purifikation, self-seeing`},{name:`Dreamfire Memory`,desc:`Lusid vision, divine memory, encoded light`},{name:`Krowned Light`,desc:`Integration, sovereignty, harmonik ascension`}],pi=44,mi=36;function hi(e){let t=Math.max(0,Math.min(5,Math.floor(e/6))),n=ci[t];return{idx:t,name:n,desc:ui[n]}}function gi(e,t){if(t===0n)return 0;let n=Number(e)/Number(t);return n<0?0:n>1?1:n}function _i(e,t=2){return(e*100).toFixed(t)}function vi(e){return e<10?`0${e}`:String(e)}function yi(e){return Number(e>9007199254740991n?9007199254740991n:e<-9007199254740991n?-9007199254740991n:e)}function bi(e){let t=(1+Math.sqrt(5))/2,n=Math.max(1,e);return Math.floor(Math.log(n)/Math.log(t))}function xi(e){return ar(e,Sr)}function Si(e){let t=e+719468n,n=Dr(t,146097n),r=t-n*146097n,i=Dr(r-Dr(r,1460n)+Dr(r,36524n)-Dr(r,146096n),365n),a=i+n*400n,o=r-(365n*i+Dr(i,4n)-Dr(i,100n)),s=Dr(5n*o+2n,153n),c=o-Dr(153n*s+2n,5n)+1n,l=s<10n?s+3n:s-9n;return{year:l<=2n?a+1n:a,month:l<=2n?l+12n-12n:l,day:c}}var Ci=Or(2024n,5n,11n);function wi(e){let t=si(e);if(e`u`||typeof document>`u`)return!1;let e=navigator,t=window.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches??!1,n=window.matchMedia?.(`(prefers-reduced-transparency: reduce)`)?.matches??!1;return t||n||typeof e.deviceMemory==`number`&&e.deviceMemory<=4||typeof e.hardwareConcurrency==`number`&&e.hardwareConcurrency<=4}function Bi(){(0,C.useEffect)(()=>{if(typeof document>`u`)return;let e=document.documentElement;zi()?e.dataset.perf=`low`:delete e.dataset.perf},[])}const Vi=`sigil:explorer:open`;var Hi=s((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Ui=s(((e,t)=>{t.exports=Hi()})),W=u(Ui(),1);function Wi(){return window.innerWidth-document.documentElement.clientWidth}function Gi(e){return Array.from(e.querySelectorAll(`a[href],button:not([disabled]),textarea,input,select,[tabindex]:not([tabindex="-1"])`)).filter(e=>!e.hasAttribute(`disabled`)&&e.tabIndex!==-1)}function Ki(){let[e,t]=(0,C.useState)(!1),n=(0,C.useId)(),r=(0,C.useId)(),i=(0,C.useId)(),a=(0,C.useRef)(null),o=(0,C.useRef)(null),s=(0,C.useRef)(null),c=(0,C.useRef)(null),l=(0,C.useCallback)(()=>t(!1),[]),u=(0,C.useCallback)(()=>t(!0),[]),d=(0,C.useMemo)(()=>`Kairos Notes — Legal Tender`,[]);return(0,C.useEffect)(()=>{if(!e)return;let t=document.body.style.overflow,n=document.body.style.paddingRight,r=Wi();document.body.style.overflow=`hidden`,r>0&&(document.body.style.paddingRight=`${r}px`);let i=document.activeElement,u=i instanceof HTMLElement?i:a.current,d=e=>{if(e.key===`Escape`){e.preventDefault(),l();return}if(e.key===`Tab`){let t=o.current;if(!t)return;let n=Gi(t);if(n.length===0)return;let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey?(!a||a===r)&&(e.preventDefault(),i.focus()):a===i&&(e.preventDefault(),r.focus())}};return window.addEventListener(`keydown`,d,{capture:!0}),requestAnimationFrame(()=>{(s.current??c.current)?.focus()}),()=>{window.removeEventListener(`keydown`,d,{capture:!0}),document.body.style.overflow=t,document.body.style.paddingRight=n,requestAnimationFrame(()=>{u&&`focus`in u?u.focus():a.current?.focus()})}},[e,l]),(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`nav-foot`,"aria-label":`Sovereign declarations`,children:(0,W.jsxs)(`button`,{ref:a,type:`button`,className:`nav-foot__toggle`,onClick:u,"aria-haspopup":`dialog`,"aria-expanded":e,"aria-controls":n,children:[(0,W.jsx)(`span`,{className:`nav-foot__badge`,"aria-hidden":`true`,children:(0,W.jsx)(`img`,{className:`nav-foot__phiLogo`,src:`/phi.svg`,alt:``,draggable:!1})}),(0,W.jsxs)(`span`,{className:`nav-foot__main`,children:[(0,W.jsx)(`span`,{className:`nav-foot__kicker`,children:`SOVEREIGN WRIT`}),(0,W.jsx)(`span`,{className:`nav-foot__summary`,children:d})]}),(0,W.jsx)(`span`,{className:`nav-foot__chev`,"aria-hidden":`true`,children:(0,W.jsx)(`span`,{className:`nav-foot__chevIcon`,"aria-hidden":`true`,children:(0,W.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,children:(0,W.jsx)(`path`,{d:`M9 18l6-6-6-6`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})})})})]})}),e&&(0,w.createPortal)((0,W.jsxs)(`div`,{className:`nav-footSheet`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":r,"aria-describedby":i,id:n,children:[(0,W.jsx)(`button`,{type:`button`,className:`nav-footSheet__backdrop`,"aria-label":`Dismiss`,onClick:l}),(0,W.jsxs)(`div`,{ref:o,className:`nav-footSheet__panel`,role:`document`,children:[(0,W.jsxs)(`div`,{className:`nav-footSheet__head`,children:[(0,W.jsxs)(`div`,{className:`nav-footSheet__titleWrap`,children:[(0,W.jsxs)(`div`,{className:`nav-footSheet__title`,id:r,children:[(0,W.jsx)(`img`,{className:`nav-footSheet__phiLogo`,src:`/phi.svg`,alt:``,"aria-hidden":`true`,draggable:!1}),` `,`Sovereign Writ`]}),(0,W.jsx)(`div`,{className:`nav-footSheet__sub`,children:`Official instrument of value & transfer — Kairos-native, breath-backed, offline-verifiable.`})]}),(0,W.jsx)(`button`,{ref:c,type:`button`,className:`nav-footSheet__close`,onClick:l,"aria-label":`Dismiss`,title:`Dismiss`,children:(0,W.jsx)(`span`,{className:`nav-footSheet__closeIcon`,"aria-hidden":`true`,children:(0,W.jsxs)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,W.jsx)(`path`,{d:`M18 6L6 18`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M6 6L18 18`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`})]})})})]}),(0,W.jsxs)(`div`,{className:`nav-footSheet__body`,id:i,children:[(0,W.jsxs)(`p`,{className:`nav-foot__line`,children:[(0,W.jsx)(`strong`,{children:` Kairos Notes`}),` are legal tender — sealed by `,(0,W.jsx)(`strong`,{children:`Proof of Breath™`}),`, pulsed by `,(0,W.jsx)(`strong`,{children:`Kai-Signature™`}),`, auditable as: Σ → SHA-256(Σ) → Φ.`]}),(0,W.jsxs)(`p`,{className:`nav-foot__line`,children:[(0,W.jsx)(`strong`,{children:`Sigil-Glyphs`}),` are origin ΦKey seals for minting, custody, and lawful transfer. Derivative glyphs maintain sovereign lineage and are redeemable by re-inhale.`]}),(0,W.jsx)(`div`,{className:`nav-footSheet__divider`,role:`separator`,"aria-hidden":`true`}),(0,W.jsx)(`p`,{className:`nav-foot__line nav-foot__line--fine`,children:`Operational Mandate: readable offline, provable by breath-writ, unforgeable without determinate seals.`}),(0,W.jsx)(`p`,{className:`nav-foot__line nav-foot__line--fine`,children:`This writ exists independent of domains, DNS, or consensus. It is sealed in breath, bound in math, and verifiable by anyone who remembers the pulse.`})]}),(0,W.jsx)(`div`,{className:`nav-footSheet__foot`,children:(0,W.jsx)(`button`,{ref:s,type:`button`,className:`nav-footSheet__cta`,onClick:l,children:`Seal Acknowledged`})})]})]}),document.body)]})}const qi=`kairos:sw-version`;var Ji=u(y(),1),Yi=(0,C.lazy)(()=>O(()=>import(`./KaiVohModal-Bbtn2GfV.js`),__vite__mapDeps([0,1,2,3,4]))),Xi=(0,C.lazy)(()=>O(()=>import(`./SigilModal-BvJNBKka.js`),__vite__mapDeps([5,6,7,8,9]))),Zi=(0,C.lazy)(()=>O(()=>import(`./HomePriceChartCard-CG0g_aGu.js`),__vite__mapDeps([10,11,12]))),Qi=(0,C.lazy)(()=>O(()=>import(`./SigilExplorer-YG_XvkA-.js`),__vite__mapDeps([13,14,15]))),$i=(0,C.lazy)(()=>O(()=>import(`./EternalKlock-D-hEMVRl.js`),__vite__mapDeps([16,17,8,6,7,9,18])));function ea(){if(!(typeof document>`u`||typeof window>`u`)&&window.location.pathname===`/`){for(let e of[`app-splash`,`pwa-splash`,`splash`,`splash-screen`,`boot-splash`]){let t=document.getElementById(e);t&&t.remove()}document.querySelectorAll(`[data-splash], .app-splash, .pwa-splash, .splash-screen, .splash, .boot-splash`).forEach(e=>e.remove())}}try{ea()}catch{}var ta=typeof window<`u`?C.useLayoutEffect:C.useEffect,na=[`/sigil.wasm`,`/sigil.zkey`,`/sigil.artifacts.json`,`/sigil.vkey.json`,`/verification_key.json`,`/verifier-core.js`,`/verifier.inline.html`,`/verifier.html`,`/pdf-lib.min.js`],ra=[`/`,`/mint`,`/voh`,`/keystream`,`/klock`,`/klok`,`/sigil/new`,`/pulse`,`/verify`,...[`/stream`,`/stream/p`,`/stream/c`,`/feed`,`/feed/p`,`/p`,`/p~`]],ia=[`/`,`/?source=pwa`,`/index.html`],aa=[{to:`/`,label:`Verifier`,desc:`Inhale + Exhale`,end:!0},{to:`/mint`,label:`Mint ΦKey`,desc:`Breath-minted seal`},{to:`/voh`,label:`KaiVoh`,desc:`Memory OS`},{to:`/keystream`,label:`ΦStream`,desc:`Live keystream`}],oa=`137.66.18.241`,sa=3+Math.sqrt(5),ca=sa*1e3,la=17491.270421,ua=36,da=44,fa=ua*da,pa=17491.270421,ma=[`var(--chakra-ark-0)`,`var(--chakra-ark-1)`,`var(--chakra-ark-2)`,`var(--chakra-ark-3)`,`var(--chakra-ark-4)`,`var(--chakra-ark-5)`],ha={Root:`var(--chakra-ink-0)`,Sacral:`var(--chakra-ink-1)`,"Solar Plexus":`var(--chakra-ink-2)`,Heart:`var(--chakra-ink-3)`,Throat:`var(--chakra-ink-4)`,"Third Eye":`var(--chakra-ink-5)`,Crown:`var(--chakra-ink-6)`},ga=[`#ff7a7a`,`#ffbd66`,`#ffe25c`,`#86ff86`,`#79c2ff`,`#c99aff`,`#e29aff`,`#e5e5e5`],_a=1000000n,va=`phi_kai_anchor_pmicro_v1`,ya=`phi_kai_anchor_msutc_v1`,ba={anchor:null};function xa(e,t){let n=e/t,r=e%t;return r!==0n&&r>0n!=t>0n?n-1n:n}function Sa(e){if(!Number.isFinite(e))return 0n;let t=e<0?-1:1,n=Math.abs(e),r=Math.trunc(n),i=n-r;return i<.5?BigInt(t*r):i>.5?BigInt(t*(r+1)):BigInt(t*(r%2==0?r:r+1))}function Ca(e){if(typeof window>`u`)return null;try{let t=window.localStorage.getItem(e);return!t||!/^-?\d+$/.test(t.trim())?null:BigInt(t.trim())}catch{return null}}function wa(e,t){if(!(typeof window>`u`))try{window.localStorage.setItem(e,t.toString())}catch{}}function Ta(e){if(typeof window>`u`)return null;try{let t=window.localStorage.getItem(e);if(!t)return null;let n=Number(t);return!Number.isFinite(n)||n<=0?null:Math.floor(n)}catch{return null}}function Ea(e){return Sa((e-In)/qn*1e6)}function Da(e){let t=xa(e,_a);if(t>=0n&&t<500000000n)return e;let n=e/1000n,r=BigInt(2**53-1),i=BigInt(-(2**53-1));if(n>r||n0n&&n<4000000000000n){let e=Number(n);if(Number.isFinite(e))return Ea(e)}return n}catch{return null}}function ka(){return Da(Kr())}function Aa(){if(ba.anchor)return ba.anchor;if(typeof window>`u`)return ba.anchor={pμ0:0n,perf0:0,source:`kpp`},ba.anchor;let e=window.performance.now(),t=Ca(va);if(t!==null&&t>0n)return ba.anchor={pμ0:t,perf0:e,source:`storage`},ba.anchor;let n=Ta(ya);if(n!==null&&n>0){let t=Ea(n);if(t>0n)return wa(va,t),ba.anchor={pμ0:t,perf0:e,source:`storage`},ba.anchor}let r=Oa();if(r!==null&&r>0n)return wa(va,r),ba.anchor={pμ0:r,perf0:e,source:`env`},ba.anchor;let i=ka();return i>0n&&wa(va,i),ba.anchor={pμ0:i,perf0:e,source:`kpp`},ba.anchor}function ja(){if(typeof window>`u`)return;let e=window.performance.now(),t=ka();t>0n&&wa(va,t),ba.anchor={pμ0:t,perf0:e,source:`kpp`}}function Ma(){if(typeof window>`u`)return 0n;let e=Aa(),t=Sa((window.performance.now()-e.perf0)/qn*1e6);return e.pμ0+t}function Na(e){let t=BigInt(2**53-1),n=BigInt(-(2**53-1));if(e>t||e0?n/pa:0,i=Math.floor(r*fa),a=Math.min(fa-1,Math.max(0,i)),o=Math.min(ua-1,Math.max(0,Math.floor(a/da))),s=Math.min(da-1,Math.max(0,a-o*da)),c=Fi(e,`dayIndex`)??Fi(e,`dayIndex0`)??Fi(e,`dayIndexSinceGenesis`),l=c===null?Math.floor((t+1e-9)/pa):Math.floor(c),u=Math.floor(l/336),d=Ri(l,336),f=Math.floor(d/42);f<0&&(f=0),f>7&&(f=7);let p=d-f*42,m=f+1;return{beat:o,step:s,day:Math.floor(p)+1,month:m,year:u}}function za(e){return`${Ii(e.beat)}:${Ii(e.step)}`}function Ba(e){return`D${e.day}/M${e.month}/Y${e.year}`}function Va(){(0,C.useEffect)(()=>{if(typeof window>`u`||typeof document>`u`)return;let e=0,t=e=>{let t=e.timeStamp;return typeof t==`number`&&Number.isFinite(t)?t:performance.now()},n=n=>{if(Ia(n.target))return;let r=t(n);r-e<=300&&n.preventDefault(),e=r},r=e=>{e.touches.length>1&&e.preventDefault()},i=e=>{(e.ctrlKey||e.metaKey)&&e.preventDefault()},a=e=>{if(!e.ctrlKey&&!e.metaKey)return;let t=e.key;(t===`+`||t===`-`||t===`=`||t===`_`||t===`0`)&&e.preventDefault()},o=e=>{e.preventDefault()},s=document.documentElement,c=document.body,l=s.style.touchAction,u=c.style.touchAction,d=s.style.webkitTextSizeAdjust;return s.style.touchAction=`manipulation`,c.style.touchAction=`manipulation`,s.style.webkitTextSizeAdjust=`100%`,document.addEventListener(`touchend`,n,{passive:!1,capture:!0}),document.addEventListener(`touchmove`,r,{passive:!1,capture:!0}),document.addEventListener(`gesturestart`,o,{passive:!1,capture:!0}),document.addEventListener(`gesturechange`,o,{passive:!1,capture:!0}),document.addEventListener(`gestureend`,o,{passive:!1,capture:!0}),window.addEventListener(`wheel`,i,{passive:!1}),window.addEventListener(`keydown`,a),()=>{document.removeEventListener(`touchend`,n,!0),document.removeEventListener(`touchmove`,r,!0),document.removeEventListener(`gesturestart`,o,!0),document.removeEventListener(`gesturechange`,o,!0),document.removeEventListener(`gestureend`,o,!0),window.removeEventListener(`wheel`,i),window.removeEventListener(`keydown`,a),s.style.touchAction=l,c.style.touchAction=u,s.style.webkitTextSizeAdjust=d}},[])}var Ha={size:{width:0,height:0},subs:new Set,listening:!1,rafId:null,cleanup:null};function Ua(){if(typeof window>`u`)return{width:0,height:0};let e=window.visualViewport;return e?{width:Math.round(e.width),height:Math.round(e.height)}:{width:window.innerWidth,height:window.innerHeight}}function Wa(){if(typeof window>`u`||Ha.listening)return;Ha.listening=!0,Ha.size=Ua();let e=()=>{Ha.rafId=null;let e=Ua(),t=Ha.size;e.width===t.width&&e.height===t.height||(Ha.size=e,Ha.subs.forEach(t=>t(e)))},t=()=>{Ha.rafId===null&&(Ha.rafId=window.requestAnimationFrame(e))},n=window.visualViewport;window.addEventListener(`resize`,t,{passive:!0}),n&&(n.addEventListener(`resize`,t,{passive:!0}),n.addEventListener(`scroll`,t,{passive:!0})),Ha.cleanup=()=>{Ha.rafId!==null&&(window.cancelAnimationFrame(Ha.rafId),Ha.rafId=null),window.removeEventListener(`resize`,t),n&&(n.removeEventListener(`resize`,t),n.removeEventListener(`scroll`,t)),Ha.cleanup=null,Ha.listening=!1}}function Ga(){Ha.subs.size>0||Ha.cleanup?.()}function Ka(){let[e,t]=(0,C.useState)(()=>Ua());return(0,C.useEffect)(()=>{if(typeof window>`u`)return;Wa();let e=e=>t(e);return Ha.subs.add(e),e(Ha.size),()=>{Ha.subs.delete(e),Ga()}},[]),e}function qa(e){let t=(0,C.useRef)(null);(0,C.useEffect)(()=>{if(!e||typeof window>`u`||typeof document>`u`)return;let n=document.documentElement,r=document.body,i=window.scrollY||window.pageYOffset||0;return t.current={scrollY:i,htmlOverflow:n.style.overflow,bodyOverflow:r.style.overflow,bodyPosition:r.style.position,bodyTop:r.style.top,bodyLeft:r.style.left,bodyRight:r.style.right,bodyWidth:r.style.width},n.style.overflow=`hidden`,r.style.overflow=`hidden`,r.style.position=`fixed`,r.style.top=`-${i}px`,r.style.left=`0`,r.style.right=`0`,r.style.width=`100%`,()=>{let e=t.current;e&&(n.style.overflow=e.htmlOverflow,r.style.overflow=e.bodyOverflow,r.style.position=e.bodyPosition,r.style.top=e.bodyTop,r.style.left=e.bodyLeft,r.style.right=e.bodyRight,r.style.width=e.bodyWidth,window.scrollTo(0,e.scrollY),t.current=null)}},[e])}function Ja(e){let t=window.getComputedStyle(e),n=t.backdropFilter,r=t.willChange||``;return!(t.transform&&t.transform!==`none`||t.perspective&&t.perspective!==`none`||t.filter&&t.filter!==`none`||n&&n!==`none`||t.contain&&t.contain!==`none`||r.includes(`transform`)||r.includes(`perspective`)||r.includes(`filter`))}function Ya(){let e=document.querySelector(`.app-shell`);if(e instanceof HTMLElement)try{if(Ja(e))return e}catch{}return document.body}function Xa(e){return e===`/`?`Verifier`:e.startsWith(`/mint`)?`Mint Sigil`:e.startsWith(`/voh`)?`KaiVoh`:e.startsWith(`/keystream`)?`PhiStream`:e.startsWith(`/klock`)?`KaiKlok`:`Sovereign Gate`}function Za(e){return e===`/`||e.startsWith(`/voh`)||e.startsWith(`/mint`)||e.startsWith(`/keystream`)||e.startsWith(`/klock`)}function Qa(e){return e<680?200:240}function $a(e){return Math.max(220,Math.min(520,Math.floor(e*.52)))}function eo(e){(0,C.useEffect)(()=>{document.title=`ΦNet • ${e}`},[e])}function to(e){return(0,C.useMemo)(()=>{let t=e.height||0,n=e.width||0;return t>=820&&n>=980},[e.height,e.width])}function no(){let[e,t]=(0,C.useState)(La);return(0,C.useEffect)(()=>{let e=e=>{let n=e.detail;typeof n==`string`&&n.length&&t(n)};return window.addEventListener(qi,e),()=>window.removeEventListener(qi,e)},[]),e}function ro(){(0,C.useEffect)(()=>{if(typeof window>`u`)return;ja();let e=()=>{let e=Ma();e>0n&&wa(va,e)},t=()=>{typeof document<`u`&&document.visibilityState===`hidden`&&e()};e();let n=window.setInterval(e,15e3);return window.addEventListener(`pagehide`,e),document.addEventListener(`visibilitychange`,t),()=>{window.clearInterval(n),window.removeEventListener(`pagehide`,e),document.removeEventListener(`visibilitychange`,t),e()}},[])}function io(){let[e,t]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{if(typeof window>`u`)return;let e=window,n=typeof e.requestIdleCallback==`function`?e.requestIdleCallback(()=>t(!0),{timeout:900}):window.setTimeout(()=>t(!0),220);return()=>{typeof e.cancelIdleCallback==`function`?e.cancelIdleCallback(n):window.clearTimeout(n)}},[]),(0,C.useEffect)(()=>{e&&(O(()=>import(`./HomePriceChartCard-CG0g_aGu.js`),__vite__mapDeps([10,11,12])),O(()=>import(`./KaiVohModal-Bbtn2GfV.js`),__vite__mapDeps([0,1,2,3,4])),O(()=>import(`./SigilModal-BvJNBKka.js`),__vite__mapDeps([5,6,7,8,9])),O(()=>import(`./SigilExplorer-YG_XvkA-.js`),__vite__mapDeps([13,14,15])),O(()=>import(`./EternalKlock-D-hEMVRl.js`),__vite__mapDeps([16,17,8,6,7,9,18])),O(()=>import(`./SigilStreamRoot-BUh8LwJG.js`),__vite__mapDeps([19,17,8,6,7,9,18,20,2,3,21,22,14,23,24])))},[e]),e}function ao(e){(0,C.useEffect)(()=>{if(typeof window>`u`||!(`serviceWorker`in navigator))return;let t=new AbortController,n=navigator,r=!!n.connection?.saveData,i=n.connection?.effectiveType||``;if(r||i===`slow-2g`||i===`2g`)return()=>t.abort();let a=async()=>{try{let e=await navigator.serviceWorker.ready;(e.active||e.waiting||e.installing)?.postMessage({type:`WARM_URLS`,urls:[...na,...ra,...ia],mapShell:!0}),await Promise.all([...na,...ra].map(async e=>{try{await fetch(e,{cache:`no-cache`,signal:t.signal})}catch{}}))}catch{}},o=window,s=()=>void a(),c=typeof o.requestIdleCallback==`function`?o.requestIdleCallback(s,{timeout:2500}):window.setTimeout(s,1200),l=()=>{e.current!==null&&window.clearTimeout(e.current),e.current=window.setTimeout(s,240)};return window.addEventListener(`focus`,l),()=>{t.abort(),e.current!==null&&(window.clearTimeout(e.current),e.current=null),typeof o.cancelIdleCallback==`function`?o.cancelIdleCallback(c):window.clearTimeout(c),window.removeEventListener(`focus`,l)}},[e])}function oo(e,t){let n=(0,C.useRef)(null),r=(0,C.useRef)(null),[i,a]=(0,C.useState)(!1),o=(0,C.useRef)(null),s=(0,C.useCallback)(()=>{let e=n.current,t=r.current;if(!e||!t)return!1;let i=t.firstElementChild;return(i?i.scrollHeight:t.scrollHeight)>e.clientHeight+6},[]),c=(0,C.useCallback)(()=>{o.current===null&&(o.current=window.requestAnimationFrame(()=>{o.current=null;let e=s();a(t=>t===e?t:e)}))},[s]);(0,C.useEffect)(()=>{e&&c()},[e,t,c]),(0,C.useEffect)(()=>{let e=n.current,t=r.current;if(!e||!t)return;let i=t.firstElementChild,a=()=>c(),s=null;return typeof ResizeObserver<`u`&&(s=new ResizeObserver(a),s.observe(e),s.observe(t),i&&s.observe(i)),window.addEventListener(`resize`,a,{passive:!0}),c(),()=>{window.removeEventListener(`resize`,a),s?.disconnect(),o.current!==null&&(window.cancelAnimationFrame(o.current),o.current=null)}},[c,t]);let l=e&&i;return{panelBodyRef:n,panelCenterRef:r,panelShouldScroll:l,panelBodyInlineStyle:(0,C.useMemo)(()=>{if(l)return{overflowY:`auto`,overflowX:`hidden`,WebkitOverflowScrolling:`touch`,alignItems:`stretch`,justifyContent:`flex-start`,paddingBottom:`calc(1.25rem + var(--safe-bottom))`}},[l]),panelCenterInlineStyle:(0,C.useMemo)(()=>{if(l)return{height:`auto`,minHeight:`100%`,alignItems:`flex-start`,justifyContent:`flex-start`}},[l])}}function so(e,t){(0,C.useEffect)(()=>{if(typeof window>`u`)return;let t=e.current;if(!t||!window.matchMedia(`(max-width: 980px)`).matches)return;let n=t.querySelector(`.nav-item--active`);n&&window.requestAnimationFrame(()=>{try{n.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`center`})}catch{n.scrollIntoView()}})},[t,e])}function co({open:e,onClose:t,children:n}){let r=typeof document<`u`,i=Ka(),a=(0,C.useMemo)(()=>r?Ya():null,[r]);qa(e&&r),(0,C.useEffect)(()=>{if(!e||!r)return;let n=e=>{e.key===`Escape`&&t()};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t,r]),(0,C.useEffect)(()=>{!e||!r||window.dispatchEvent(new CustomEvent(Vi))},[e,r]);let o=(0,C.useRef)(null);(0,C.useEffect)(()=>{e&&window.requestAnimationFrame(()=>o.current?.focus())},[e]);let s=(0,C.useMemo)(()=>{if(!e||!r)return;let t=i.height,n=i.width;return{position:`fixed`,inset:0,pointerEvents:`auto`,height:t>0?`${t}px`:void 0,width:n>0?`${n}px`:void 0,"--sx-breath":`5.236s`,"--sx-border":`rgba(60, 220, 205, 0.35)`,"--sx-border-strong":`rgba(55, 255, 228, 0.55)`,"--sx-ring":`0 0 0 2px rgba(55, 255, 228, 0.25), 0 0 0 6px rgba(55, 255, 228, 0.12)`}},[e,r,i]),c=(0,C.useCallback)(e=>{e.target===e.currentTarget&&(e.preventDefault(),e.stopPropagation())},[]),l=(0,C.useCallback)(e=>{e.target===e.currentTarget&&(e.preventDefault(),e.stopPropagation(),t())},[t]),u=(0,C.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]);return!e||!r||!a?null:(0,Ji.createPortal)((0,W.jsx)(`div`,{className:`explorer-pop`,style:s,role:`dialog`,"aria-modal":`true`,"aria-label":`PhiStream Explorer`,onPointerDown:c,onClick:l,children:(0,W.jsxs)(`div`,{className:`explorer-pop__panel`,role:`document`,children:[(0,W.jsx)(`button`,{ref:o,type:`button`,className:`explorer-pop__close kx-x`,onPointerDown:u,onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},"aria-label":`Close PhiStream Explorer`,title:`Close (Esc)`,children:`×`}),(0,W.jsx)(`div`,{className:`explorer-pop__body`,children:n}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:`PhiStream explorer portal open`})]})}),a)}function lo({open:e,onClose:t,children:n}){let r=typeof document<`u`,i=Ka(),a=(0,C.useMemo)(()=>r?Ya():null,[r]);qa(e&&r),(0,C.useEffect)(()=>{if(!e||!r)return;let n=e=>{e.key===`Escape`&&t()};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t,r]);let o=(0,C.useRef)(null);(0,C.useEffect)(()=>{e&&window.requestAnimationFrame(()=>o.current?.focus())},[e]);let s=(0,C.useMemo)(()=>{if(!e||!r)return;let t=i.height,n=i.width;return{position:`fixed`,inset:0,pointerEvents:`auto`,height:t>0?`${t}px`:void 0,width:n>0?`${n}px`:void 0,"--klock-breath":`5.236s`,"--klock-border":`rgba(255, 216, 120, 0.26)`,"--klock-border-strong":`rgba(255, 231, 160, 0.55)`,"--klock-ring":`0 0 0 2px rgba(255, 225, 150, 0.22), 0 0 0 6px rgba(255, 210, 120, 0.10)`,"--klock-scale":`5`}},[e,r,i]),c=(0,C.useCallback)(e=>{e.target===e.currentTarget&&(e.preventDefault(),e.stopPropagation())},[]),l=(0,C.useCallback)(e=>{e.target===e.currentTarget&&(e.preventDefault(),e.stopPropagation(),t())},[t]),u=(0,C.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]);return!e||!r||!a?null:(0,Ji.createPortal)((0,W.jsx)(`div`,{className:`klock-pop`,style:s,role:`dialog`,"aria-modal":`true`,"aria-label":`Eternal KaiKlok`,onPointerDown:c,onClick:l,children:(0,W.jsxs)(`div`,{className:`klock-pop__panel`,role:`document`,"data-klock-size":`xl`,children:[(0,W.jsx)(`button`,{ref:o,type:`button`,className:`klock-pop__close kx-x`,onPointerDown:u,onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},"aria-label":`Close Eternal KaiKlok`,title:`Close (Esc)`,children:`×`}),(0,W.jsx)(`div`,{className:`klock-pop__body`,children:(0,W.jsx)(`div`,{className:`klock-stage`,role:`presentation`,"data-klock-stage":`1`,children:(0,W.jsx)(`div`,{className:`klock-stage__inner`,children:n})})}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:`Eternal KaiKlok portal open`})]})}),a)}function uo(){let e=$e(),[t,n]=(0,C.useState)(!0);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(C.Suspense,{fallback:null,children:(0,W.jsx)(Yi,{open:t,onClose:(0,C.useCallback)(()=>{n(!1),e(`/`,{replace:!0})},[e])})}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:`KaiVoh portal open`})]})}function fo(){let e=$e(),[t,n]=(0,C.useState)(!0),r=(0,C.useMemo)(()=>Fi(Fa(),`pulse`)??0,[]),i=(0,C.useCallback)(()=>{n(!1),e(`/`,{replace:!0})},[e]);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(C.Suspense,{fallback:null,children:t?(0,W.jsx)(Xi,{initialPulse:r,onClose:i}):null}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:`Sigil mint portal open`})]})}function po(){let e=$e(),[t,n]=(0,C.useState)(!0);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(co,{open:t,onClose:(0,C.useCallback)(()=>{n(!1),e(`/`,{replace:!0})},[e]),children:(0,W.jsx)(C.Suspense,{fallback:null,children:(0,W.jsx)(Qi,{})})}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:`PhiStream explorer portal open`})]})}function mo(){let e=$e(),t=Xe(),[n,r]=(0,C.useState)(!0);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(lo,{open:n,onClose:(0,C.useCallback)(()=>{r(!1),e(`/`,{replace:!0})},[e]),children:(0,W.jsx)(C.Suspense,{fallback:null,children:(0,W.jsx)($i,{initialDetailsOpen:(t.state??null)?.openDetails??!0})})}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:`Eternal KaiKlok portal open`})]})}function ho(e){let t=Fr(Na(e)),n=xa(e,_a),r=n>BigInt(2**53-1)?2**53-1:n<0n?0:Number(n),i=Li(r),a={...t,pulse:r},o=Ra(a);return{pulse:r,pulseStr:i,beatStepDMY:o,beatStepLabel:za(o),dmyLabel:Ba(o),chakraDay:a.chakraDay}}function go(){let[e,t]=(0,C.useState)(()=>ho(Ma()));return(0,C.useEffect)(()=>{let e=!0,n=null,r=()=>{n!==null&&(window.clearTimeout(n),n=null)},i=e=>{let n=ho(e);t(e=>e.pulseStr===n.pulseStr&&e.beatStepLabel===n.beatStepLabel&&e.dmyLabel===n.dmyLabel?e:n)},a=()=>{if(!e)return;if(typeof document<`u`&&document.visibilityState===`hidden`){r();return}let t=Ma();i(t);let o=t%_a;o<0n&&(o+=_a);let s=_a-o,c=Number(s),l=Math.max(0,Math.floor(c/1e6*qn));r(),n=window.setTimeout(a,l)};a();let o=()=>{e&&typeof document<`u`&&document.visibilityState===`visible`&&(ja(),a())};return document.addEventListener(`visibilitychange`,o),window.addEventListener(`focus`,o),()=>{e=!1,document.removeEventListener(`visibilitychange`,o),window.removeEventListener(`focus`,o),r()}},[]),e}var _o=(0,C.memo)(function({onOpenKlock:e,breathS:t,breathMs:n,breathsPerDay:r}){let i=go(),a=(0,C.useMemo)(()=>({color:`var(--accent-color)`,textShadow:`0 0 14px rgba(0, 255, 255, 0.22), 0 0 28px rgba(0, 255, 255, 0.12)`}),[]),o=(0,C.useMemo)(()=>({color:`var(--accent-color)`,textShadow:`0 0 14px rgba(0, 255, 255, 0.22), 0 0 28px rgba(0, 255, 255, 0.12)`,fontSize:`0.5em`,lineHeight:1.05}),[]),s=(0,C.useMemo)(()=>{let e=Ri(i.pulse,pa),t=pa/ma.length;return ma[Math.min(ma.length-1,Math.max(0,Math.floor(e/t)))]??ma[0]},[i.pulse]),c=(0,C.useMemo)(()=>ha[i.chakraDay]??ha.Heart,[i.chakraDay]),l=(0,C.useMemo)(()=>ga[Math.min(ga.length-1,Math.max(0,i.beatStepDMY.month-1))]??ha.Heart,[i.beatStepDMY.month]),u=(0,C.useMemo)(()=>({"--kai-ark":s,"--kai-chakra":c,"--kai-month":l}),[s,c,l]),d=(0,C.useMemo)(()=>`LIVE • NOW PULSE ${i.pulseStr} • ${i.beatStepLabel} • ${i.dmyLabel} • Breath ${t.toFixed(6)}s (${Math.round(n)}ms) • ${r.toLocaleString(`en-US`,{minimumFractionDigits:6,maximumFractionDigits:6})}/day • Open Eternal KaiKlok`,[i.pulseStr,i.beatStepLabel,i.dmyLabel,t,n,r]),f=(0,C.useMemo)(()=>`LIVE. Kai Pulse now ${i.pulse}. Beat ${i.beatStepDMY.beat} step ${i.beatStepDMY.step}. D ${i.beatStepDMY.day}. M ${i.beatStepDMY.month}. Y ${i.beatStepDMY.year}. Open Eternal KaiKlok.`,[i]);return(0,W.jsxs)(`button`,{type:`button`,className:`topbar-live`,onClick:e,"aria-label":f,title:d,style:u,children:[(0,W.jsx)(`span`,{className:`live-orb`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`live-scroll`,"aria-hidden":`true`,children:(0,W.jsxs)(`div`,{className:`live-text`,children:[(0,W.jsx)(`div`,{className:`live-meta`,children:(0,W.jsx)(`span`,{className:`mono`,style:a,children:`☤KAI`})}),(0,W.jsx)(`div`,{className:`live-meta`,children:(0,W.jsx)(`span`,{className:`mono`,style:a,children:i.pulseStr})}),(0,W.jsx)(`div`,{className:`live-sub`,children:(0,W.jsxs)(`span`,{className:`mono`,style:o,children:[(0,W.jsx)(`span`,{className:`kai-num kai-num--ark`,children:i.beatStepLabel}),` `,(0,W.jsx)(`span`,{"aria-hidden":`true`,style:{opacity:.7},children:`•`}),` `,(0,W.jsx)(`span`,{className:`kai-tag`,children:`D`}),(0,W.jsx)(`span`,{className:`kai-num kai-num--chakra`,children:i.beatStepDMY.day}),(0,W.jsx)(`span`,{className:`kai-sep`,children:`/`}),(0,W.jsx)(`span`,{className:`kai-tag`,children:`M`}),(0,W.jsx)(`span`,{className:`kai-num kai-num--month`,children:i.beatStepDMY.month}),(0,W.jsx)(`span`,{className:`kai-sep`,children:`/`}),(0,W.jsx)(`span`,{className:`kai-tag`,children:`Y`}),(0,W.jsx)(`span`,{className:`kai-num`,children:i.beatStepDMY.year})]})})]})})]})});function vo(){let e=Xe(),t=$e();Va(),Bi(),ta(()=>{ea()},[e.pathname]),ro();let n=no(),r=io();ao((0,C.useRef)(null));let i=Ka(),a=to(i),o=(0,C.useMemo)(()=>({"--breath-s":`${sa}s`,"--vvh-px":`${i.height}px`}),[i.height]),s=(0,C.useMemo)(()=>Xa(e.pathname),[e.pathname]);eo(s);let c=(0,C.useMemo)(()=>Za(e.pathname),[e.pathname]),l=c,u=(0,C.useMemo)(()=>Qa(i.height||800),[i.height]),d=(0,C.useMemo)(()=>$a(i.height||800),[i.height]),{panelBodyRef:f,panelCenterRef:p,panelShouldScroll:m,panelBodyInlineStyle:h,panelCenterInlineStyle:g}=oo(c,e.pathname),_=(0,C.useRef)(null);so(_,e.pathname);let v=(0,C.useCallback)(()=>{t(`/klock`,{state:{openDetails:!0}})},[t]),y=(0,C.useCallback)(async e=>{try{await navigator.clipboard.writeText(oa)}catch{let e=document.createElement(`textarea`);e.value=oa,e.setAttribute(`readonly`,`true`),e.style.position=`fixed`,e.style.left=`-9999px`,e.style.top=`-9999px`,document.body.appendChild(e),e.select(),document.execCommand(`copy`),document.body.removeChild(e)}e&&(e.classList.add(`is-copied`),window.setTimeout(()=>e.classList.remove(`is-copied`),900))},[]),b=(0,C.useMemo)(()=>{if(a)return{alignSelf:`start`,height:`auto`}},[a]);return(0,W.jsxs)(`div`,{className:`app-shell`,"data-ui":`atlantean-banking`,"data-panel-scroll":m?`1`:`0`,"data-roomy":a?`1`:`0`,style:o,children:[(0,W.jsx)(`a`,{className:`skip-link`,href:`#app-content`,children:`Skip to content`}),(0,W.jsx)(`div`,{className:`app-bg-orbit`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`app-bg-grid`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`app-bg-glow`,"aria-hidden":`true`}),(0,W.jsxs)(`header`,{className:`app-topbar`,role:`banner`,"aria-label":`ΦNet Sovereign Gate Header`,children:[(0,W.jsx)(`div`,{className:`topbar-left`,children:(0,W.jsxs)(`div`,{className:`brand`,"aria-label":`ΦNet Sovereign Gate`,children:[(0,W.jsx)(`div`,{className:`brand__mark`,"aria-hidden":`true`,children:(0,W.jsx)(`img`,{src:`/phi.svg`,alt:``,className:`brand__mark-img`})}),(0,W.jsxs)(`div`,{className:`brand__text`,children:[(0,W.jsx)(`div`,{className:`brand__title`,children:`PHI.NETWORK`}),(0,W.jsx)(`div`,{className:`brand__subtitle`,children:`Breath-Minted Value · Kairos Identity Registry`})]})]})}),(0,W.jsx)(`div`,{className:`topbar-right`,"aria-label":`Live Kai clock`,children:(0,W.jsx)(_o,{onOpenKlock:v,breathS:sa,breathMs:ca,breathsPerDay:la})})]}),(0,W.jsx)(`main`,{className:`app-stage`,id:`app-content`,role:`main`,"aria-label":`Sovereign Value Workspace`,children:(0,W.jsx)(`div`,{className:`app-frame`,role:`region`,"aria-label":`Secure frame`,children:(0,W.jsx)(`div`,{className:`app-frame-inner`,children:(0,W.jsxs)(`div`,{className:`app-workspace`,children:[l&&(0,W.jsx)(`div`,{className:`workspace-topbar`,"aria-label":`Atrium live Φ value + chart`,style:{overflow:`visible`,position:`relative`},children:(0,W.jsx)(`div`,{className:`workspace-topbar-scroll`,style:{maxHeight:`${d}px`,overflowY:`auto`,overflowX:`hidden`,WebkitOverflowScrolling:`touch`,overscrollBehavior:`contain`,borderRadius:`inherit`},children:r?(0,W.jsx)(C.Suspense,{fallback:(0,W.jsx)(`div`,{style:{height:u},"aria-hidden":`true`}),children:(0,W.jsx)(Zi,{apiBase:`https://pay.kaiklok.com`,ctaAmountUsd:144,chartHeight:u})}):(0,W.jsx)(`div`,{style:{height:u},"aria-hidden":`true`})})}),(0,W.jsxs)(`nav`,{className:`app-nav`,"aria-label":`Primary navigation`,"data-nav-roomy":a?`1`:`0`,style:b,children:[(0,W.jsxs)(`div`,{className:`nav-head`,children:[(0,W.jsx)(`div`,{className:`nav-head__title`,children:`Atrium`}),(0,W.jsx)(`div`,{className:`nav-head__sub`,children:`Breath-Sealed Identity · Kairos-ZK Proof`})]}),(0,W.jsx)(`div`,{ref:_,className:`nav-list`,role:`list`,"aria-label":`Atrium navigation tiles`,children:aa.map(e=>(0,W.jsxs)(vn,{to:e.to,end:e.end,className:e=>`nav-item ${e.isActive?`nav-item--active`:``}`,"aria-label":`${e.label}: ${e.desc}`,children:[(0,W.jsx)(`div`,{className:`nav-item__label`,children:e.label}),(0,W.jsx)(`div`,{className:`nav-item__desc`,children:e.desc})]},e.to))}),(0,W.jsx)(`div`,{className:`nav-writ-slot`,"data-writ-slim":`1`,children:(0,W.jsx)(Ki,{})})]}),(0,W.jsxs)(`section`,{className:`app-panel`,"aria-label":`Sovereign Gate panel`,children:[(0,W.jsxs)(`div`,{className:`panel-head`,children:[(0,W.jsx)(`div`,{className:`panel-head__title`,children:s}),(0,W.jsxs)(`div`,{className:`panel-head__meta`,children:[(0,W.jsx)(`span`,{className:`meta-chip`,children:`Proof of Breath™`}),(0,W.jsx)(`span`,{className:`meta-chip`,children:`Kai-Signature™`})]})]}),(0,W.jsx)(`div`,{ref:f,className:`panel-body ${c?`panel-body--locked`:``} ${m?`panel-body--scroll`:``}`,style:h,children:(0,W.jsx)(`div`,{ref:p,className:`panel-center`,style:g,children:(0,W.jsx)(Dt,{})})}),(0,W.jsxs)(`footer`,{className:`panel-foot`,"aria-label":`Footer`,children:[(0,W.jsxs)(`div`,{className:`panel-foot__left`,children:[(0,W.jsx)(`span`,{className:`mono`,children:`ΦNet`}),` • Sovereign Gate •`,` `,(0,W.jsxs)(`button`,{type:`button`,className:`dns-copy mono`,onClick:e=>void y(e.currentTarget),"aria-label":`Remember .kai DNS IP ${oa}`,title:`Remember DNS IP`,children:[`.kai DNS: `,(0,W.jsx)(`span`,{className:`mono`,children:oa})]})]}),(0,W.jsxs)(`div`,{className:`panel-foot__right`,children:[(0,W.jsx)(`span`,{className:`mono`,children:`V`}),` `,(0,W.jsx)(`a`,{className:`mono`,href:`https://github.com/phinetwork/phi.network`,target:`_blank`,rel:`noreferrer`,"aria-label":`Version ${n} (opens GitHub)`,title:`Open GitHub`,children:n})]})]})]})]})})})})]})}function yo(){return(0,W.jsxs)(`div`,{className:`notfound`,role:`region`,"aria-label":`Not found`,children:[(0,W.jsx)(`div`,{className:`notfound__code`,children:`404`}),(0,W.jsx)(`div`,{className:`notfound__title`,children:`Route not found`}),(0,W.jsx)(`div`,{className:`notfound__hint`,children:`Use the Sovereign Gate navigation to return to Verifier, Mint Sigil, KaiVoh, or PhiStream.`}),(0,W.jsx)(`div`,{className:`notfound__actions`,children:(0,W.jsx)(vn,{className:`notfound__cta`,to:`/`,children:`Go to Verifier`})})]})}var bo=u(y(),1),xo=typeof window<`u`?C.useLayoutEffect:C.useEffect,So=[`/s`,`/s/:hash`,`/stream`,`/stream/*`,`/feed`,`/feed/*`,`/p~:token`,`/p~:token/*`,`/token`,`/p~token`,`/p`,`/verify/*`];function Co(){let[e,t]=(0,C.useState)(()=>typeof window>`u`||window.matchMedia===void 0?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches);return(0,C.useEffect)(()=>{if(typeof window>`u`||window.matchMedia===void 0)return;let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),n=e=>{t(e.matches)};n(e);try{return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)}catch{return e.addListener(n),()=>e.removeListener(n)}},[]),e}function wo(){let e=Xe(),t=Co(),[n,r]=(0,C.useState)(`show`),[i,a]=(0,C.useState)(!0),[o,s]=(0,C.useState)(!0),c=(0,C.useRef)(!1),l=(0,C.useRef)(null),u=(0,C.useRef)(null),d=(0,C.useRef)(null),f=(0,C.useRef)(null),p=(0,C.useMemo)(()=>t?140:260,[t]),m=(0,C.useMemo)(()=>t?220:420,[t]),h=(0,C.useMemo)(()=>t?800:1200,[t]),g=(0,C.useMemo)(()=>t?70:120,[t]),_=(0,C.useCallback)(()=>{l.current!==null&&window.clearTimeout(l.current),u.current!==null&&window.clearTimeout(u.current),l.current=null,u.current=null},[]),v=(0,C.useCallback)(()=>{f.current!==null&&window.cancelAnimationFrame(f.current),f.current=null},[]),y=(0,C.useCallback)(()=>{d.current!==null&&window.clearTimeout(d.current),d.current=null},[]),b=(0,C.useMemo)(()=>So.some(t=>!!fe({path:t,end:!1},e.pathname)),[e.pathname]),x=(0,C.useMemo)(()=>o||b,[o,b]),S=(0,C.useCallback)(e=>{_(),y(),l.current=window.setTimeout(()=>{r(`fade`),u.current=window.setTimeout(()=>{r(`hidden`),s(!1),a(!1)},p)},Math.max(0,e))},[y,_,p]),w=(0,C.useCallback)(e=>{v(),!(typeof window>`u`)&&(f.current=window.requestAnimationFrame(()=>S(e)))},[v,S]),T=(0,C.useCallback)(()=>{_(),v(),y(),a(!0),r(`show`)},[y,v,_]);return xo(()=>{if(typeof document>`u`)return;let e=document.body,t=e.style.backgroundColor;return t||(e.style.backgroundColor=`var(--bg-0, #040f24)`),()=>{e.style.backgroundColor=t}},[]),(0,C.useEffect)(()=>{if(!x)return;let e=null,n=()=>w(t?30:80);document.readyState===`complete`||document.readyState===`interactive`?e=window.setTimeout(n,t?30:60):window.addEventListener(`load`,n,{once:!0});let r=window.setTimeout(()=>S(0),h);return()=>{e!==null&&window.clearTimeout(e),window.removeEventListener(`load`,n),window.clearTimeout(r),_(),y(),v()}},[y,v,_,w,S,h,t,x]),(0,C.useEffect)(()=>{if(!c.current){c.current=!0;return}if(b)return d.current=window.setTimeout(()=>{T(),w(t?60:m)},g),()=>{y(),_(),v()}},[y,v,_,w,b,m,g,t,T,e.pathname,e.search,e.hash]),(0,C.useEffect)(()=>()=>{_(),y(),v()},[y,v,_]),i?(0,bo.createPortal)((0,W.jsxs)(`div`,{className:`kai-splash`,"data-state":n,"aria-live":`polite`,role:`status`,children:[(0,W.jsx)(`div`,{className:`kai-splash__grid`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`kai-splash__content`,"aria-hidden":`true`,children:(0,W.jsxs)(`div`,{className:`kai-splash__badge`,children:[(0,W.jsx)(`span`,{className:`kai-splash__badge-halo`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`kai-splash__badge-glow`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`kai-splash__rays`,"aria-hidden":`true`}),(0,W.jsxs)(`div`,{className:`kai-splash__badge-core`,children:[(0,W.jsx)(`img`,{className:`kai-splash__phi`,src:`/phi.svg`,alt:``,loading:`eager`,decoding:`sync`,draggable:!1}),(0,W.jsx)(`span`,{className:`kai-splash__badge-orb`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`kai-splash__badge-core-shine`,"aria-hidden":`true`})]}),(0,W.jsx)(`div`,{className:`kai-splash__ring`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`kai-splash__ring kai-splash__ring--inner`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`kai-splash__flare`,"aria-hidden":`true`})]})}),(0,W.jsx)(`span`,{className:`sr-only`,children:`Preparing Atlantean link…`})]}),document.body):null}var To=/^\d*(?:\.\d{0,4})?$/,Eo=/^\d*(?:\.\d{0,2})?$/,Do=({msg:e})=>e?(0,W.jsx)(`div`,{className:`phi-error-toast`,role:`status`,"aria-live":`polite`,children:(0,W.jsxs)(`div`,{className:`phi-error-card`,children:[(0,W.jsx)(`span`,{className:`badge`,children:`OFFICIAL`}),(0,W.jsx)(`p`,{className:`phi-error-text`,children:e})]})}):null,Oo=[26,70,38],ko=()=>{if(typeof window>`u`)return;let e=window.navigator;if(typeof e.vibrate==`function`)try{e.vibrate(Oo)}catch{}},Ao=({state:e,onClose:t})=>{let n=e.mode===`receive`?`Φ Inhale Complete`:`Φ Exhale Complete`,r=e.mode===`receive`?`RECEIVED`:`SENT`,i=e.message??(e.mode===`receive`?`You just inhaled Φ into your Sovereign field. This moment is sealed.`:`You just exhaled Φ from your Sovereign field. This moment is sealed.`);return(0,W.jsx)(`div`,{className:`phi-send-success-overlay`,role:`dialog`,"aria-modal":`true`,"aria-label":`Φ move complete`,onClick:t,children:(0,W.jsxs)(`div`,{className:`phi-send-success-card`,onClick:e=>e.stopPropagation(),children:[(0,W.jsx)(`div`,{className:`phi-success-orb`,"aria-hidden":`true`,children:(0,W.jsx)(`div`,{className:`phi-success-orb-inner`})}),(0,W.jsxs)(`div`,{className:`phi-success-header`,children:[(0,W.jsx)(`span`,{className:`phi-success-pill`,children:r}),(0,W.jsx)(`button`,{type:`button`,className:`phi-success-close`,onClick:t,"aria-label":`Close confirmation`,children:`✕`})]}),(0,W.jsx)(`h2`,{className:`phi-success-title`,children:n}),e.amountDisplay&&(0,W.jsx)(`p`,{className:`phi-success-amount`,children:(0,W.jsx)(`span`,{className:`mono`,children:e.amountDisplay})}),(0,W.jsx)(`p`,{className:`phi-success-body`,children:i}),e.downloadUrl&&(0,W.jsxs)(`a`,{className:`phi-send-success-download`,href:e.downloadUrl,download:e.downloadLabel||`phi-receipt`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(`span`,{className:`phi-send-success-download-icon`,"aria-hidden":`true`,children:`⬇︎`}),(0,W.jsx)(`span`,{className:`phi-send-success-download-text`,children:`Download sealed receipt`})]}),(0,W.jsx)(`button`,{type:`button`,className:`phi-success-ok`,onClick:t,children:`Done`})]})})},jo=({amountMode:e,setAmountMode:t,usdInput:n,phiInput:r,setUsdInput:i,setPhiInput:a,convDisplayRight:o,remainingPhiDisplay4:s,canonicalContext:c,onAttachClick:l,attachmentLabel:u,attachmentActive:d})=>{let f=c===`derivative`,[p,m]=(0,C.useState)(null),[h,g]=(0,C.useState)(!1),[_,v]=(0,C.useState)(null);(0,C.useEffect)(()=>{if(!p||f)return;let e=window.setTimeout(()=>m(null),2200);return()=>window.clearTimeout(e)},[p,f]),(0,C.useEffect)(()=>{if(typeof window>`u`)return;let e=e=>{let t=e.detail;if(!t)return;let n=t.mode===`receive`?`receive`:`send`;ko(),v({mode:n,amountDisplay:t.amountPhiDisplay??t.amountDisplay??(typeof t.amountPhi==`number`?String(t.amountPhi):void 0),downloadUrl:t.downloadUrl,downloadLabel:t.downloadLabel,message:t.message})};return window.addEventListener(`kk:phi-move-success`,e),()=>{window.removeEventListener(`kk:phi-move-success`,e)}},[]);let y=e=>{m(e);try{window.dispatchEvent(new CustomEvent(`kk:error`,{detail:{where:`SendPhiAmountField`,error:e}}))}catch{}},b=(0,C.useMemo)(()=>e===`USD`?`\\d*(?:\\.\\d{0,2})?`:`\\d*(?:\\.\\d{0,4})?`,[e]),x=e===`USD`?`$`:`Φ`,S=e===`USD`?`Dollar amount to exhale`:`Phi amount to exhale`,w=t=>{let n=t.replace(/\s+/g,``);e===`USD`?Eo.test(n)&&i(n):To.test(n)&&a(n)},T=t=>{if(t.key!==`Enter`)return;if(e!==`PHI`){y(`Enter a Φ amount or switch to Φ to exhale.`);return}let n=(r||``).trim();if(n===``||n===`.`){y(`No Φ entered — specify an amount to exhale.`);return}let i=Number((n.startsWith(`.`)?`0`:``)+n);if(!Number.isFinite(i)||i<=0){y(`Invalid Φ amount — enter a number greater than 0.`);return}let a=Number(String(s).replace(/[^\d.]/g,``));Number.isFinite(a)&&i>a+1e-9&&y(`Exceeds remaining — Rem: Φ ${s}`)},E=typeof l==`function`;return f?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Do,{msg:p}),_&&(0,W.jsx)(Ao,{state:_,onClose:()=>v(null)})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`phi-send-field`,"data-state":h?`focus`:`idle`,children:[(0,W.jsxs)(`div`,{className:`phi-send-label`,children:[(0,W.jsx)(`span`,{className:`label-main`,children:`Exhale Amount`}),(0,W.jsxs)(`span`,{className:`label-sub`,children:[e===`USD`?`Enter in $`:`Enter in Φ`,` · 🛕: Φ`,` `,s]})]}),(0,W.jsxs)(`div`,{className:`phi-send-bar`,children:[(0,W.jsxs)(`div`,{className:`phi-send-inputShell`,"aria-live":`polite`,children:[(0,W.jsx)(`span`,{className:`phi-prefix`,"aria-hidden":`true`,children:x}),(0,W.jsx)(`input`,{className:`phi-send-input`,type:`text`,inputMode:`decimal`,pattern:b,"aria-label":S,placeholder:x,value:e===`USD`?n:r,onChange:e=>w(e.target.value),onKeyDown:T,onFocus:()=>g(!0),onBlur:()=>g(!1),"aria-invalid":p?!0:void 0,autoComplete:`off`,enterKeyHint:`send`}),(0,W.jsx)(`i`,{"aria-hidden":`true`,className:`phi-input-glow`})]}),(0,W.jsx)(`div`,{className:`phi-conv-right convert-readout`,"aria-live":`polite`,children:o}),(0,W.jsxs)(`div`,{className:`phi-send-controls`,children:[(0,W.jsxs)(`div`,{role:`tablist`,"aria-label":`Amount unit`,className:`phi-mode-toggle seg`,children:[(0,W.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e===`USD`,className:`phi-mode-btn ${e===`USD`?`is-active`:``}`,onClick:()=>t(`USD`),title:`Enter in dollars`,children:`$`}),(0,W.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e===`PHI`,className:`phi-mode-btn ${e===`PHI`?`is-active`:``}`,onClick:()=>t(`PHI`),title:`Enter in Φ`,children:`Φ`})]}),E&&(0,W.jsxs)(`button`,{type:`button`,className:`phi-attach-btn ${d?`is-active`:``}`,onClick:l,title:u||`Attach sigil / note`,children:[(0,W.jsx)(`span`,{className:`phi-attach-icon`,"aria-hidden":`true`,children:`📎`}),u&&(0,W.jsx)(`span`,{className:`phi-attach-label`,children:u})]})]})]})]}),(0,W.jsx)(Do,{msg:p}),_&&(0,W.jsx)(Ao,{state:_,onClose:()=>v(null)})]})};function Mo(e,t){if(console.error(`[VerifierStamper] ${e}`,t),!(typeof window>`u`))try{window.dispatchEvent(new CustomEvent(`kk:error`,{detail:{where:e,error:t instanceof Error?t.message:String(t)}}))}catch(t){console.error(`[VerifierStamper] kk:error dispatch failed in ${e}`,t)}}function No(e){try{let t=new TextEncoder().encode(e),n=``;for(let e=0;ee?`0.`:``).split(`.`),a=r.replace(/^0+(?=\d)/,``)||`0`,o=(i+`0`.repeat(Number(Fo))).slice(0,Number(Fo));return n*(BigInt(a)*Lo+BigInt(o||`0`))}function zo(e){let t=e<0n?`-`:``,n=e<0n?-e:e,r=n/Lo,i=(n%Lo).toString().padStart(Number(Fo),`0`);return i=i.replace(/0+$/,``),i.length?`${t}${r}.${i}`:`${t}${r}`}function Bo(e,t){return e*t/Lo}function Vo(e,t){return t===0n?0n:e*Lo/t}function Ho(e,t){let n=Math.max(0,Math.min(Number(Fo),t)),r=Io(Fo-BigInt(n)),i=r/2n;return e>=0n?(e+i)/r*r:(e-i)/r*r}function Uo(e,t){let n=Math.max(0,Math.min(Number(Fo),t)),r=e<0n?`-`:``,i=(e<0n?-e:e)/Io(Fo-BigInt(n)),a=Io(BigInt(n));return`${r}${i/a}.${(i%a).toString().padStart(n,`0`)}`}function Wo(e){return Uo(Ho(Ro(e),4),4)}function Go(e){try{if(!e||!e.payload)return 0n;let{mime:t,encoded:n}=e.payload;if(!t||!n||!/^application\/vnd\.kairos-exhale/i.test(t))return 0n;let r=Po(n),i=JSON.parse(r);if(!i||i.kind!==`exhale`)return 0n;let a=String(i.amountPhi??``);return a?Ro(a):0n}catch{return 0n}}const Ko=e=>{let t=Uo(Ho(Ro(String(e??`0`)),6),6);return Number(t.replace(`.`,``))},qo=e=>Number((e/1e6).toFixed(6)),Jo=e=>qo(Ko(e)),Yo=(e,t)=>qo(Ko(e)+Ko(t)),Xo=(e,t)=>qo(Math.max(0,Ko(e)-Ko(t))),Zo=e=>qo(e.reduce((e,t)=>e+Ko(t),0)),Qo=e=>Ho(Ro(String(e??`0`)),6),$o=e=>Uo(e,6);var es=class extends C.Component{constructor(e){super(e),this.state={hasError:!1,error:void 0}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`[VerifierStamper] crashed`,e,t);try{typeof window<`u`&&window.dispatchEvent(new CustomEvent(`kk:error`,{detail:{where:`VerifierStamper`,error:e instanceof Error?e.message:String(e)}}))}catch(e){console.error(`[VerifierStamper] failed to dispatch kk:error`,e)}}handleReset=()=>{this.setState({hasError:!1,error:void 0}),this.props.onReset?.()};render(){if(this.state.hasError){let e=this.state.error instanceof Error?this.state.error.message:String(this.state.error??`Unknown error`),t=this.state.error instanceof Error?this.state.error.stack:void 0;return(0,W.jsxs)(`div`,{role:`alert`,style:{padding:16},children:[(0,W.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:8},children:[(0,W.jsx)(`strong`,{children:`Verifier crashed`}),(0,W.jsx)(`button`,{className:`secondary`,onClick:this.handleReset,title:`Reset Verifier`,"aria-label":`Reset Verifier`,children:`Reset`})]}),(0,W.jsx)(`div`,{style:{fontSize:14,color:`var(--dim, #999)`},children:e}),t&&(0,W.jsxs)(`details`,{style:{marginTop:8},children:[(0,W.jsx)(`summary`,{children:`Stack`}),(0,W.jsx)(`pre`,{style:{whiteSpace:`pre-wrap`},children:t})]})]})}return(0,W.jsx)(W.Fragment,{children:this.props.children})}},ts=[`Root`,`Sacral`,`Solar Plexus`,`Heart`,`Throat`,`Third Eye`,`Crown`].reduce((e,t)=>(e[t.toLowerCase()]=t,e),{});function ns(e){let t=e.toLowerCase().trim().replace(/[-_]/g,` `).replace(/\b(gate|chakra|day)\b/g,``).replace(/\s+/g,` `).trim();return/(third\s*eye)/.test(t)?`third eye`:/(solar\s*plexus)/.test(t)?`solar plexus`:t}function rs(e){if(typeof e!=`string`)return null;let t=ns(e),n=ts[t];if(n)return n;switch(t){case`root`:return`Root`;case`sacral`:return`Sacral`;case`solar`:case`plexus`:return`Solar Plexus`;case`heart`:return`Heart`;case`throat`:return`Throat`;case`third`:case`eye`:return`Third Eye`;case`crown`:return`Crown`;default:return null}}function is(e){return rs(e.chakraDay??``)||rs(e.chakraGate??``)||null}function as(e,t,n=``){if(typeof e==`object`&&e){let n=e[t];if(typeof n==`string`)return n}return n}function os(e,t){if(typeof e==`object`&&e){let n=e[t];if(typeof n==`number`&&Number.isFinite(n))return n}}function ss(e){let{meta:t,sigilSvgRaw:n,verifyUrl:r,pulseNow:i}=e;if(!t)return{nowPulse:String(i)};let a=t.valuation??null,o=os(t,`beat`)??t.beat??0,s=os(t,`stepIndex`)??t.stepIndex??0,c=os(t,`pulse`)??t.pulse??0,l=(t.transfers??[]).map(e=>({action:e.receiverSignature?`receive`:`send`,pulse:e.senderKaiPulse,beat:o,stepIndex:s,ownerPhiKey:t.userPhiKey})),u=t,d=u.zk,f;if(typeof d==`object`&&d){let e=d,t=typeof e.scheme==`string`?e.scheme:void 0,n=typeof e.poseidon==`string`?e.poseidon:void 0;f=t?{scheme:t,poseidon:n}:void 0}return{purpose:as(t,`purpose`),to:as(t,`to`),from:as(t,`from`),location:as(t,`location`),witnesses:as(t,`witnesses`),reference:as(t,`reference`),remark:as(t,`remark`,`In Yahuah We Trust — Secured by Φ, not man-made law`),valuePhi:typeof a?.valuePhi==`number`?String(a.valuePhi):``,premiumPhi:typeof a?.premiumPhi==`number`?String(a.premiumPhi):``,computedPulse:typeof c==`number`?String(c):``,nowPulse:String(i),kaiSignature:typeof t.kaiSignature==`string`?t.kaiSignature:``,userPhiKey:typeof t.userPhiKey==`string`?t.userPhiKey:``,sigmaCanon:as(u,`sigmaCanon`),shaHex:as(u,`shaHex`),phiDerived:as(u,`phiDerived`),valuationAlg:a?.algorithm==null?``:String(a.algorithm),valuationStamp:a?.stamp==null?``:String(a.stamp),provenance:l.slice(-7),zk:f,sigilSvg:n??``,verifyUrl:r||``}}function cs(e,t){let n=e;if(!n)return{used:!1,expired:!1};let r=!!n.sendLock?.used,i=n.childClaim?.expireAtPulse;if(typeof i!=`number`||!Number.isFinite(i)){let e=n.transfers?.slice(-1)[0]?.senderKaiPulse;typeof e==`number`&&(i=e+77)}return{used:r,expired:typeof i==`number`?t>i:!1,expireAt:i}}function ls(e,t){if(!e)return{expired:!1};let n=e.transfers?.slice(-1)[0];if(!(n&&!n.receiverSignature))return{expired:!1};let r=n?.senderKaiPulse;if(typeof r!=`number`)return{expired:!1};let i=r+77;return{expired:t>i,expireAt:i}}function us(e){let{contextOk:t,typeOk:n,hasCore:r,contentSigMatches:i,isOwner:a,hasTransfers:o,lastOpen:s,lastClosed:c,isUnsigned:l,childUsed:u,childExpired:d,parentOpenExpired:f,isChildContext:p}=e;return!t||!n?`invalid`:r?i===!1?`sigMismatch`:a===!1?`notOwner`:l?`unsigned`:s?d||f?`complete`:`readyReceive`:p?u||o&&c?`readySend`:`complete`:`readySend`:`structMismatch`}const ds=e=>`sigil:rotated:${e}`;function fs(e,t){let n=Array.from(new Set((e??[]).map(e=>String(e||``).toLowerCase()).filter(e=>e.length>0)));for(let e of n){try{typeof localStorage<`u`&&localStorage.setItem(ds(e),`${t}@${Kr()}`)}catch(e){Mo(`publishRotation.localStorage`,e)}try{let n=new BroadcastChannel(`sigil-xfer-v1`),r={type:`rotated`,canonical:e,token:t};n.postMessage(r),n.close()}catch(e){Mo(`publishRotation.bc`,e)}try{typeof window<`u`&&window.dispatchEvent(new CustomEvent(`sigil:transfer-rotated`,{detail:{canonical:e,token:t}}))}catch(e){Mo(`publishRotation.dispatch`,e)}}}(3+Math.sqrt(5))*1e3;const ps=`https://schema.phi.network/sigil/v1`,ms=`application/phi.kairos.sigil+svg`,hs=2e3,gs=e=>Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``);async function _s(e){let t=typeof e==`string`?new TextEncoder().encode(e):e,n=await crypto.subtle.digest(`SHA-256`,t);return gs(new Uint8Array(n))}var vs=`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`;function ys(e){let t=0n;for(let n of e)t=(t<<8n)+BigInt(n);let n=``;for(;t>0n;)n=vs[Number(t%58n)]+n,t/=58n;for(let t=0;t1;){let e=[];for(let n=0;n1;){let e=n%2==1?n-1:n+1,t=r[e]??r[n];i.push(t);let a=[];for(let e=0;eJSON.stringify(e)+`:`+ks(t[e])).join(`,`)+`}`}async function As(e){let{pulse:t,beat:n,stepIndex:r,chakraDay:i}=e;return typeof t!=`number`||typeof n!=`number`||typeof r!=`number`||typeof i!=`string`?null:_s(`${t}|${n}|${r}|${i}|${e.intentionSigil??``}`)}async function js(e){let t=await _s(e+`φ`),n=new Uint8Array(20);for(let e=0;e<20;e++)n[e]=parseInt(t.slice(e*2,e*2+2),16);return bs(n,0)}function Ms(e){let t={senderSignature:e.senderSignature,senderStamp:e.senderStamp,senderKaiPulse:e.senderKaiPulse};return e.payload&&(t.payload={name:e.payload.name,mime:e.payload.mime,size:e.payload.size}),e.receiverSignature&&(t.receiverSignature=e.receiverSignature),e.receiverStamp&&(t.receiverStamp=e.receiverStamp),e.receiverKaiPulse!=null&&(t.receiverKaiPulse=e.receiverKaiPulse),t}async function Ns(e){return _s(JSON.stringify(Ms(e)))}function Ps(e){let t={senderSignature:e.senderSignature,senderStamp:e.senderStamp,senderKaiPulse:e.senderKaiPulse};return e.payload&&(t.payload={name:e.payload.name,mime:e.payload.mime,size:e.payload.size}),t}async function Fs(e){return _s(JSON.stringify(Ps(e)))}async function Is(e){return ws(await Promise.all(e.map(Ns)))}async function Ls(e,t){return _s(ks({pulse:e.pulse??0,beat:e.beat??0,stepIndex:e.stepIndex??0,chakraDay:e.chakraDay??``,kaiSignature:e.kaiSignature??``,creatorPublicKey:e.creatorPublicKey??``,cumulativeTransfers:t??e.cumulativeTransfers??0,segments:(e.segments??[]).map(e=>({index:e.index,root:e.root,cid:e.cid,count:e.count})),segmentsMerkleRoot:e.segmentsMerkleRoot??``}))}function Rs(e){return(e.segments??[]).reduce((e,t)=>e+(t.count||0),0)}async function zs(e,t){return Ls(e,Rs(e)+t)}function Bs(e,t){let n=rs(e.chakraDay)??`Root`,r={v:1,type:`send`,sigil:{pulse:e.pulse??0,beat:e.beat??0,stepIndex:e.stepIndex??0,chakraDay:n,kaiSignature:e.kaiSignature??``},previousHeadRoot:t.previousHeadRoot,senderKaiPulse:t.senderKaiPulse,senderPubKey:t.senderPubKey,nonce:t.nonce,transferLeafHashSend:t.transferLeafHashSend};return new TextEncoder().encode(ks(r))}function Vs(e){let t={v:1,type:`receive`,link:e.senderSig,previousHeadRoot:e.previousHeadRoot,receiverKaiPulse:e.receiverKaiPulse,receiverPubKey:e.receiverPubKey,transferLeafHashReceive:e.transferLeafHashReceive};return new TextEncoder().encode(ks(t))}async function Hs(e){return _s(JSON.stringify({pulse:e.pulse,beat:e.beat,stepIndex:e.stepIndex,chakraDay:e.chakraDay,kaiSignature:e.kaiSignature,userPhiKey:e.userPhiKey,cumulativeTransfers:e.cumulativeTransfers??0,segments:(e.segments??[]).map(e=>({index:e.index,root:e.root,cid:e.cid,count:e.count})),segmentsMerkleRoot:e.segmentsMerkleRoot??``}))}function Us(e){let t=JSON.stringify(e);return btoa(unescape(encodeURIComponent(t))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function Ws(){let e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``)}async function Gs(e){return _s(ks(e))}async function Ks(e){let t=JSON.stringify(e),n=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(t));return[...new Uint8Array(n)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}function qs(e,t,n,r){let i=typeof window<`u`&&typeof window.location?.origin==`string`?window.location.origin:`http://localhost`,a=new URL(e,i);return a.searchParams.set(`p`,Us(t)),n&&a.searchParams.set(`t`,n),r&&r.length>0&&a.searchParams.set(`h`,r),a.toString()}var Js=0;function Ys(e,t){console.error(`[modal] ${e}:`,t)}function Xs(e){return!!(e.open||e.hasAttribute(`open`))}function Zs(){Js+=1,typeof document<`u`&&Js===1&&(document.documentElement.classList.add(`kk-dialog-open`),document.body.style.overflow=`hidden`,document.body.style.touchAction=`none`)}function Qs(){Js=Math.max(0,Js-1),typeof document<`u`&&Js===0&&(document.documentElement.classList.remove(`kk-dialog-open`),document.body.style.overflow=``,document.body.style.touchAction=``)}function $s(e){let t=()=>{e.removeEventListener(`close`,t),e.removeEventListener(`cancel`,t),e.setAttribute(`data-open`,`false`),e.removeAttribute(`data-rotate`),Qs()};e.addEventListener(`close`,t,{once:!0}),e.addEventListener(`cancel`,t,{once:!0})}function ec(e){return e.querySelector(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`)??null}function tc(e){if(!(typeof window>`u`||!e))try{if(Xs(e)){e.setAttribute(`data-open`,`true`);let t=ec(e)??e;typeof t.focus==`function`&&t.focus();return}let t=typeof e.showModal==`function`,n=typeof e.show==`function`;try{t?e.showModal():n?e.show():e.setAttribute(`open`,``)}catch(t){Ys(`showModal/show`,t),e.setAttribute(`open`,``)}e.setAttribute(`data-open`,`true`),$s(e),Zs();let r=ec(e)??e;typeof r.focus==`function`&&r.focus()}catch(e){Ys(`safeShowDialog`,e)}}function nc(e,t,n){let r=n?.delayMs??0,i=()=>{if(r>0){window.setTimeout(t,r);return}try{let e=typeof window<`u`?window.requestAnimationFrame:void 0;typeof e==`function`?e(()=>e(t)):window.setTimeout(t,16)}catch(e){Ys(`switchModal.runNext`,e),window.setTimeout(t,16)}};if(!e){i();return}try{if(Xs(e)){e.setAttribute(`data-open`,`false`),e.removeAttribute(`data-rotate`);let t=()=>{e.removeEventListener(`close`,t),Qs()};e.addEventListener(`close`,t,{once:!0});try{e.close()}catch(t){Ys(`current.close`,t),e.removeAttribute(`open`);try{e.dispatchEvent(new Event(`close`))}catch(e){Ys(`dispatch(close)`,e)}}i();return}}catch(e){Ys(`switchModal`,e)}i()}function rc(){let e=window;e.__SIGIL__||={};let t=e.__SIGIL__;return{registerSigilUrl:typeof t.registerSigilUrl==`function`?t.registerSigilUrl:void 0,registerSend:typeof t.registerSend==`function`?t.registerSend:void 0}}const ic=typeof window<`u`&&typeof document<`u`;function ac(e,t){if(!e||typeof e!=`object`)return;let n=t.split(`.`),r=e;for(let e of n)if(r&&typeof r==`object`&&e in r)r=r[e];else return;return r}function oc(e){return e==null?``:String(e)}function sc(e,t){for(let n of t){let t=ac(e,n);if(t!=null&&t!==``)return oc(t)}return``}function cc(e,t){if(!ic)return``;let n=oc(ac(e,`pulse`)),r=oc(ac(e,`beat`)),i=oc(ac(e,`stepIndex`)),a=n&&r&&i?`ks-${n}-${r}-${i}`:``,o=a?document.getElementById(a):null;if(!o)return``;let s=t.replace(/^data-/,``).replace(/-([a-z])/g,(e,t)=>t.toUpperCase());return(o.dataset||{})[s]??o.getAttribute(t)??``}const lc=({data:e})=>{if(typeof e!=`object`||!e)return(0,W.jsx)(`span`,{className:`json-primitive`,children:String(e)});let t=Array.isArray(e);return(0,W.jsx)(`ul`,{className:`json-node`,children:(t?e.map((e,t)=>[t,e]):Object.entries(e)).map(([e,n])=>(0,W.jsx)(`li`,{children:(0,W.jsxs)(`details`,{children:[(0,W.jsx)(`summary`,{children:t?`[${e}]`:`"${e}"`}),(0,W.jsx)(lc,{data:n})]})},String(e)))})};var uc=lc;const dc=({path:e,label:t})=>{let n={check:`M5 13l4 4L19 7`,x:`M6 6l12 12M6 18L18 6`,warn:`M12 9v4m0 4h.01M12 3l9 16H3z`,shield:`M12 3l7 4v6l-7 4-7-4V7l7-4z`,sigma:`M18 6H9l5 6-5 6h9M6 6h2M6 18h2`,phi:`M12 4a8 8 0 100 16 8 8 0 000-16zm0 0v16`,send:`M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z`,recv:`M2 22l11-11M2 22l20-7-9-4-4-9-7 20z`,done:`M12 21c4.97 0 9-4.03 9-9S16.97 3 12 3 3 7.03 3 12s4.03 9 9 9zm-1-6l6-6M8 12l3 3`,stack:`M12 3l9 4-9 4-9-4 9-4zm-9 8l9 4 9-4M3 19l9 4 9-4`,hash:`M10 3L8 21M16 3l-2 18M3 8h18M3 16h18`,zk:`M12 3l7 4v6l-7 4-7-4V7l7-4zM9 12h6`,paperclip:`M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.2a2 2 0 01-2.83-2.83l8.49-8.49`,lock:`M7 10V7a5 5 0 0110 0v3h1a2 2 0 012 2v7a2 2 0 01-2 2H6a2 2 0 01-2-2v-7a2 2 0 012-2h1zm3 0h4V7a3 3 0 00-6 0v3z`,timer:`M12 8v5l3 3M12 2a10 10 0 100 20 10 10 0 000-20`,ban:`M4.93 4.93l14.14 14.14M12 2a10 10 0 110 20 10 10 0 010-20`};return(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`18`,height:`18`,"aria-hidden":`true`,focusable:`false`,className:`ico`,children:[(0,W.jsx)(`path`,{d:n[e],stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`}),t?(0,W.jsx)(`title`,{children:t}):null]})},fc=({title:e,kind:t=`info`,children:n,badge:r=null})=>(0,W.jsx)(`span`,{className:`chip icon ${t}`,role:`img`,"aria-label":e,title:e,...r==null?{}:{"data-badge":String(r)},children:n});function pc({uiState:e,meta:t,contentSigMatches:n,phiKeyMatches:r,headProof:i,canonicalContext:a,childUsed:o,childExpired:s,parentOpenExpired:c,isSendFilename:l}){let u=[],d=e=>u.push(e);e===`invalid`&&d((0,W.jsx)(fc,{kind:`err`,title:`Invalid`,children:(0,W.jsx)(dc,{path:`x`})},`inv`)),e===`structMismatch`&&d((0,W.jsx)(fc,{kind:`err`,title:`Structure mismatch`,children:(0,W.jsx)(dc,{path:`warn`})},`struct`)),e===`sigMismatch`&&d((0,W.jsx)(fc,{kind:`err`,title:`Signature mismatch`,children:(0,W.jsx)(dc,{path:`x`})},`sigm`)),e===`notOwner`&&d((0,W.jsx)(fc,{kind:`warn`,title:`Not owner`,children:(0,W.jsx)(dc,{path:`shield`})},`owner`)),e===`unsigned`&&d((0,W.jsx)(fc,{kind:`warn`,title:`Unsigned`,children:(0,W.jsx)(dc,{path:`hash`})},`unsigned`)),e===`readySend`&&d((0,W.jsx)(fc,{kind:`info`,title:`Ready to send`,children:(0,W.jsx)(dc,{path:`send`})},`send`)),e===`readyReceive`&&d((0,W.jsx)(fc,{kind:`info`,title:`Ready to receive`,children:(0,W.jsx)(dc,{path:`recv`})},`recv`)),e===`complete`&&d((0,W.jsx)(fc,{kind:`ok`,title:`Receipt`,children:(0,W.jsx)(dc,{path:`done`})},`done`)),e===`verified`&&d((0,W.jsx)(fc,{kind:`ok`,title:`Verified`,children:(0,W.jsx)(dc,{path:`check`})},`ver`)),n===!0&&d((0,W.jsx)(fc,{kind:`ok`,title:`Content Σ match`,children:(0,W.jsx)(dc,{path:`sigma`})},`sigok`)),n===!1&&d((0,W.jsx)(fc,{kind:`err`,title:`Content Σ mismatch`,children:(0,W.jsx)(dc,{path:`sigma`})},`sigerr`)),r===!0&&d((0,W.jsx)(fc,{kind:`ok`,title:`Φ-Key match`,children:(0,W.jsx)(dc,{path:`phi`})},`phiok`)),r===!1&&d((0,W.jsx)(fc,{kind:`err`,title:`Φ-Key mismatch`,children:(0,W.jsx)(dc,{path:`phi`})},`phierr`)),t?.cumulativeTransfers!=null&&d((0,W.jsx)(fc,{kind:`info`,title:`Cumulative transfers`,badge:t.cumulativeTransfers,children:(0,W.jsx)(dc,{path:`hash`})},`cum`)),(t?.segments?.length??0)>0&&d((0,W.jsx)(fc,{kind:`info`,title:`Segments`,badge:t?.segments?.length??0,children:(0,W.jsx)(dc,{path:`stack`})},`segs`)),i&&d((0,W.jsx)(fc,{kind:i.ok?`ok`:`err`,title:i.ok?`Head proof verified`:`Head proof failed`,children:(0,W.jsx)(dc,{path:`shield`})},`headproof`)),t?.transfersWindowRootV14&&d((0,W.jsx)(fc,{kind:`info`,title:`v14 head root present`,children:(0,W.jsx)(dc,{path:`hash`})},`v14root`)),(t?.hardenedTransfers??[]).some(e=>!!(e.zkSend?.verified||e.zkReceive?.verified))&&d((0,W.jsx)(fc,{kind:`ok`,title:`Zero-knowledge proof verified`,children:(0,W.jsx)(dc,{path:`zk`})},`zk`));let f=a===`derivative`;return f&&o&&d((0,W.jsx)(fc,{kind:`warn`,title:`Transfer link used`,children:(0,W.jsx)(dc,{path:`lock`})},`used`)),f&&s&&d((0,W.jsx)(fc,{kind:`warn`,title:`Transfer link expired`,children:(0,W.jsx)(dc,{path:`timer`})},`expired`)),a===`parent`&&c&&d((0,W.jsx)(fc,{kind:`warn`,title:`Send expired`,children:(0,W.jsx)(dc,{path:`timer`})},`pexp`)),l&&d((0,W.jsx)(fc,{kind:`warn`,title:`SEND file: segmentation disabled`,children:(0,W.jsx)(dc,{path:`ban`})},`nosg`)),u}var mc=({className:e,scrollable:t=!0,ariaLive:n=`polite`,...r})=>{let i=pc(r);return(0,W.jsxs)(`div`,{className:`status-chips ${e??``}`,role:`group`,"aria-label":`Verification status`,"aria-live":n,style:t?{overflowX:`auto`,whiteSpace:`nowrap`}:void 0,"data-count":i.length,children:[(0,W.jsx)(`span`,{className:`chip-sentinel`,"aria-hidden":`true`}),i.map((e,t)=>(0,W.jsx)(`span`,{className:`chip-wrap`,"data-i":t,style:{display:`inline-block`},children:e},t))]})},hc=u(y(),1),gc=`sigil:urls`;function _c(e){if(!(typeof window>`u`))try{let t=window.localStorage.getItem(gc),n=t?JSON.parse(t):[];n.includes(e)||(n.push(e),window.localStorage.setItem(gc,JSON.stringify(n)));let r=new CustomEvent(`sigil:url-registered`,{detail:{url:e}});window.dispatchEvent(r)}catch{}}var vc=e=>{let{open:t,url:n,hash:r,onClose:i}=e,a=(0,C.useRef)(null),o=(0,C.useRef)(null),s=(0,C.useRef)(null),c=(0,C.useRef)(null),[l,u]=(0,C.useState)(``),d=(0,C.useRef)(null);(0,C.useEffect)(()=>{if(!(!t||!n)&&d.current!==n)if(d.current=n,typeof window<`u`&&window.__SIGIL__&&typeof window.__SIGIL__.registerSigilUrl==`function`)try{window.__SIGIL__.registerSigilUrl(n)}catch{_c(n)}else _c(n)},[t,n]),(0,C.useEffect)(()=>{let e=a.current;if(!e)return;let n=e=>e.preventDefault();if(e.addEventListener(`cancel`,n),t){c.current=document.activeElement??null;try{if(!e.open)try{e.showModal()}catch{e.show()}e.setAttribute(`data-open`,`true`)}catch{}let t=window.setTimeout(()=>s.current?.focus({preventScroll:!0}),0);return()=>{clearTimeout(t),e.removeEventListener(`cancel`,n)}}else e.open&&e.close(),e.setAttribute(`data-open`,`false`),e.removeEventListener(`cancel`,n),c.current?.focus?.()},[t]);let f=(0,C.useMemo)(()=>{if(typeof navigator>`u`)return!1;let e=navigator;return typeof e.share==`function`?n&&typeof e.canShare==`function`?e.canShare({url:n}):!0:!1},[n]),p=(0,C.useCallback)(e=>{if(e.key!==`Tab`)return;let t=o.current;if(!t)return;let n=t.querySelectorAll([`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex='-1'])`].join(`,`));if(n.length===0)return;let r=n[0],i=n[n.length-1];!e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus())},[]);(0,C.useEffect)(()=>{if(!t)return;let e=e=>p(e);return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[t,p]);let m=e=>{u(e),window.setTimeout(()=>u(``),900)},h=async(e,t)=>{try{await navigator.clipboard.writeText(e),m(`${t} copied to clipboard`)}catch{m(`Could not copy ${t}`)}},g=async()=>{try{f&&typeof navigator<`u`?(await navigator.share?.({title:`Kairos Sigil-Glyph`,text:`Sealed Kairos Moment`,url:n}),m(`Share sheet opened`)):await h(n,`Link`)}catch{}},_=(0,C.useMemo)(()=>r?r.slice(0,16):`—`,[r]),v=e=>{e.preventDefault(),e.stopPropagation(),i?.()};return t?(0,hc.createPortal)((0,W.jsxs)(`dialog`,{ref:a,className:`seal-dialog seal-toplayer glass-modal fullscreen`,"aria-label":`Moment Sealed`,style:{zIndex:2147483647,padding:0,border:`none`,background:`transparent`},children:[(0,W.jsx)(`div`,{className:`seal-veil`,"aria-hidden":`true`}),(0,W.jsxs)(`div`,{ref:o,className:`seal-card`,role:`document`,onClick:e=>e.stopPropagation(),children:[(0,W.jsx)(`div`,{className:`seal-ornament seal-ornament--tl`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`seal-ornament seal-ornament--tr`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`seal-ornament seal-ornament--bl`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`seal-ornament seal-ornament--br`,"aria-hidden":`true`}),(0,W.jsx)(`button`,{ref:s,className:`seal-close`,"aria-label":`Close`,onClick:v,type:`button`,children:(0,W.jsx)(yc,{})}),(0,W.jsxs)(`header`,{className:`seal-header`,children:[(0,W.jsx)(`h3`,{id:`seal-title`,className:`seal-title`,children:`Moment Sealed`}),(0,W.jsx)(`p`,{id:`seal-desc`,className:`seal-subtitle`,children:`Your Kairos imprint is preserved. Proceed to the url below to Inhale Claimed Ownership.`})]}),(0,W.jsxs)(`label`,{className:`field`,children:[(0,W.jsx)(`span`,{className:`field-label`,children:`Hash`}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`code`,{className:`hash`,title:r||`—`,children:r?_:`—`}),(0,W.jsx)(`button`,{className:`icon-btn`,onClick:()=>h(r,`Hash`),disabled:!r,"aria-label":`Copy hash`,title:`Copy hash`,type:`button`,children:(0,W.jsx)(xc,{})})]}),r&&(0,W.jsxs)(`p`,{className:`micro`,children:[`Full: `,(0,W.jsx)(`span`,{className:`mono`,children:r})]})]}),(0,W.jsxs)(`label`,{className:`field`,children:[(0,W.jsx)(`span`,{className:`field-label`,children:`URL`}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`input`,{className:`url-input`,value:n,readOnly:!0,"aria-readonly":`true`,spellCheck:!1,dir:`ltr`,title:n,onFocus:e=>e.currentTarget.select()}),(0,W.jsx)(`button`,{className:`icon-btn`,onClick:()=>h(n,`Link`),disabled:!n,"aria-label":`Copy link`,title:`Copy link`,type:`button`,children:(0,W.jsx)(xc,{})}),n&&(0,W.jsx)(`a`,{className:`open-link`,href:n,target:`_blank`,rel:`noopener`,"aria-label":`Open link in new tab`,title:`Open link`,children:(0,W.jsx)(Sc,{})})]})]}),(0,W.jsx)(`div`,{className:`cta-row`,children:(0,W.jsxs)(`button`,{className:`secondary cta`,onClick:g,type:`button`,children:[(0,W.jsx)(bc,{}),(0,W.jsx)(`span`,{children:f?`Share`:`Remember Link`})]})}),(0,W.jsx)(`p`,{className:`fine`,children:`This moment is now sealed in time. Use the link above within the next 11 breaths to claim ownership & gain permanent access to this kairos moment.`}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:l})]})]}),document.body):null},yc=()=>(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`seal-close-ico`,children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,opacity:`.35`}),(0,W.jsx)(`path`,{d:`M7 7l10 10M17 7L7 17`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`})]}),bc=()=>(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,W.jsx)(`path`,{d:`M15 8a3 3 0 100-6 3 3 0 000 6zM6 14a3 3 0 100-6 3 3 0 000 6zm9 12a3 3 0 100-6 3 3 0 000 6z`,fill:`currentColor`}),(0,W.jsx)(`path`,{d:`M8.6 9.7l6.8-3.4M8.6 12.3l6.8 3.4`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`})]}),xc=()=>(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,W.jsx)(`rect`,{x:`9`,y:`9`,width:`10`,height:`10`,rx:`2`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,W.jsx)(`rect`,{x:`5`,y:`5`,width:`10`,height:`10`,rx:`2`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`,opacity:`.5`})]}),Sc=()=>(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,W.jsx)(`path`,{d:`M10 14a5 5 0 007.07 0l1.41-1.41a5 5 0 00-7.07-7.07L10 6`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,W.jsx)(`path`,{d:`M14 10a5 5 0 00-7.07 0L5.5 11.43a5 5 0 007.07 7.07L14 18`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`})]}),Cc=vc,G=(1+Math.sqrt(5))/2,wc=44,Tc=11,Ec=wc*Tc,Dc=17491.270421,Oc=G,kc=1/G,Ac={low:1-1/G**6,med:1,high:1+1/G**6},jc=1/G**6,Mc=1/G**5,Nc=1/G**3,Pc=1/G**4,Fc=1+1/G**4,Ic=.7,Lc=.3,Rc=1/Lc,zc=1/G**6,Bc=1/G**6,Vc=.15,Hc=1/G**5,Uc=1+1/G**3,Wc=1/G**5,Gc=Dc,Kc=1/G**7,qc=1/G**7,Jc=1/G**8,Yc=1/G,Xc=1/G**2,Zc=1/G**2,Qc=1/G**3,$c=1/G**4,el=1/G**4,tl=1/G**5,nl=1/G**6,rl=1/G**5,il=Dc*365,al=il,ol=1/G**3,sl=1/G**2,cl=1/G**4,ll=1/G**6,ul=1/G**7,dl=1/G**8,fl=1/G**8,pl=1/G**9,ml=1/G**4,hl=1/G,gl={RARITY_ONE_OF_ONE:Oc,RARITY_EXP:kc,QUALITY_MAP:Ac,CREATOR_VERIFIED_LIFT:jc,CREATOR_REP_MAX:Mc,PROV_LOG_SLOPE:Nc,HOLD_SLOPE:Pc,HOLD_CAP:Fc,CLOSURE_CENTER:Ic,CLOSURE_RANGE:Lc,CLOSURE_GAIN:zc,CADENCE_GAIN:Bc,CHURN_KAPPA:Vc,AGE_EPS:Hc,AGE_CAP:Uc,RESONANCE_GAIN:Wc,DISCOUNT_PULSE_HALFSPAN:Gc,GEOM_EDGE_GAIN:Kc,GEOM_PHI_GAIN:qc,GEOM_PRIME_GAIN:Jc,MOMENT_FIB_EXACT_GAIN:Yc,MOMENT_LUCAS_EXACT_GAIN:Xc,MOMENT_PHI_TRANSITION_GAIN:Zc,MOMENT_UNIFORM_GAIN:Qc,MOMENT_PAL_GAIN:$c,MOMENT_RUN_GAIN:el,MOMENT_SEQ_GAIN:tl,MOMENT_LOW_ENTROPY_GAIN:nl,GENESIS_BIAS_GAIN:rl,YEAR_PULSES_APPROX:il,ADOPTION_TAU_PULSES:al,ADOPTION_GAIN_BASE:ol,ADOPTION_GAIN_RARE:sl,INDEX_SCARCITY_GAIN:cl,FIB_STEP_GAIN:ll,LUCAS_STEP_GAIN:ul,BREATH_WAVE_GAIN:dl,DAY_WAVE_GAIN:fl,STROBE_WAVE_GAIN:pl,MOMENT_AFFINITY_GAIN_BASE:ml,MOMENT_AFFINITY_DIGIT_WEIGHT:hl,DEFAULT_STEPS_PER_BEAT:wc,PULSES_PER_STEP:Tc,PULSES_PER_BEAT_CANON:Ec,PULSES_PER_DAY_EXACT:Dc,PHI:G};function _l(e){if(e===null)return`null`;switch(typeof e){case`string`:case`number`:case`boolean`:return JSON.stringify(e);case`object`:{if(Array.isArray(e))return`[`+e.map(_l).join(`,`)+`]`;let t=e;return`{`+Object.keys(t).sort().map(e=>JSON.stringify(e)+`:`+_l(t[e])).join(`,`)+`}`}default:return`null`}}function vl(e){return _l(e)}function yl(){let e=`val-policy:`+vl(gl),t=2166136261;for(let n=0;n>>0;return(`00000000`+(t>>>0).toString(16)).slice(-8)}var bl=yl(),xl=(e,t,n)=>Math.max(t,Math.min(n,e)),Sl=e=>Math.log(1+Math.max(0,e)),Cl=e=>e-Math.floor(e);function wl(e){if(!e.length)return 0;let t=e.slice().sort((e,t)=>e-t),n=Math.floor(t.length/2);return t.length%2?t[n]:(t[n-1]+t[n])/2}function Tl(e){let t=new Set;for(let n of e)n.receiverSignature&&t.add(n.receiverSignature);return Math.max(t.size,1)}function El(e){return e.filter(e=>e.receiverSignature&&e.receiverKaiPulse!=null)}function Dl(e){if(e.length<2)return[];let t=[];for(let n=1;n=r&&t.push(i-r)}return t}function Ol(e){if(e.length===0)return 1;let t=wl(e)||1,n=0;for(let r of e)n+=Math.abs(r-t)/t;return 1/(1+n/e.length)}function kl(e,t){let n=e?.expectedCashflowPhi?.map(e=>({atPulse:e.atPulse,amount:e.amountPhi}))??[],r=e?.expectedCashflowKS?.map(e=>({atPulse:e.atPulse,amount:e.amountKS}))??[];return[...n,...r].reduce((e,n)=>{let r=n.atPulse-t,i=1/(1+Math.max(0,r)/Gc);return e+n.amount*i},0)}function Al(e){if(!e||!Number.isFinite(e)||e<=0)return .5;let t=Math.log(e)/Math.log(G);return .5+.5*xl(1-2*Math.abs(t-Math.round(t)),0,1)}function jl(e){if(typeof e!=`number`||!Number.isFinite(e)||e<2)return!1;let t=Math.floor(e);if(t%2==0)return t===2;for(let e=3;e*e<=t;e+=2)if(t%e===0)return!1;return!0}function Ml(e,t,n){let r=1;if(typeof e.stepIndex==`number`&&(e.stepIndex===0||e.stepIndex===(t>0?t-1:-1))&&(r*=1+Kc),jl(e.beat)&&(r*=1+Jc),n>.9){let e=(n-.9)/.1;r*=1+qc*xl(e,0,1)}return r}function Nl(e){if(e<0n)throw Error(`sqrt of negative`);if(e<2n)return e;let t=e,n=(e>>1n)+1n;for(;n>1n;return t}function Pl(e){if(e<0n)return!1;let t=Nl(e);return t*t===e}var Fl=new Map;function Il(e){if(!Number.isFinite(e)||e<0)return!1;let t=Math.trunc(Math.abs(e)),n=Fl.get(t);if(n!==void 0)return n;let r=BigInt(t),i=5n*r*r+4n,a=5n*r*r-4n,o=Pl(i)||Pl(a);return Fl.set(t,o),o}var Ll=new Map;function Rl(e){if(!Number.isFinite(e)||e<0)return!1;let t=Math.trunc(Math.abs(e)),n=Ll.get(t);if(n!==void 0)return n;let r=BigInt(t),i=2n,a=1n;for(;at&&(t=n)):n=1;return t}function Ul(e){if(e.length===0)return{len:0,digit:``};let t=1,n=1,r=e[0],i=e[0];for(let a=1;at&&(t=n,r=i)):(n=1,i=e[a]);return{len:t,digit:r}}function Wl(e){if(e.length<=1)return 1;let t=1,n=1,r=0;for(let i=1;it&&(t=n)}return t}function Gl(e){if(e.length===0)return 1;let t=Array(10).fill(0);for(let n of e)t[n.charCodeAt(0)-48]++;let n=0;for(let r of t)if(r){let t=r/e.length;n-=t*Math.log(t)}let r=Math.log(Math.min(10,e.length));return xl(n/(r||1),0,1)}function Kl(e){return!Number.isFinite(e)||e<0?1:1+rl*(1-2*(e/(e+il)))}var ql=new Map;function Jl(e){if(!Number.isFinite(e)||e<1)return null;let t=Math.trunc(e),n=ql.get(t);if(n!==void 0)return n;let r=t,i=Math.log(r)/Math.log(G),a=Math.max(1,Math.floor(i)-2),o=null;for(let e=a;e<=a+6;e++)if(Math.ceil(G**+e)===r){o=e;break}return ql.set(t,o),o}function Yl(e){if(!Number.isFinite(e)||e<0)return 1;let t=zl(e),n=t.length,r=1;Il(e)&&(r*=1+Yc),Rl(e)&&(r*=1+Xc),Jl(e)!==null&&(r*=1+Zc),Bl(t)&&(r*=1+Qc),Vl(t)&&(r*=1+$c);let i=Hl(t);if(i>=3){let e=xl((i-2)/Math.max(3,n-2),0,1);r*=1+el*e}let a=Wl(t);if(a>=4){let e=xl((a-3)/Math.max(4,n-3),0,1);r*=1+tl*e}let o=Gl(t);return r*=1+nl*(1-o),r}function Xl(e){if(!Number.isFinite(e)||e<0)return 0;let t=zl(e),n=t.length,r=0,i=0,a=Il(e)?1:0;r+=1*a,i+=1;let o=Rl(e)?1:0;r+=1/G*o,i+=1/G;let s=Bl(t)?1:0;r+=1/G*s,i+=1/G;let c=Vl(t)?1:0;r+=1/G**2*c,i+=1/G**2;let l=xl((Hl(t)-2)/Math.max(3,n-2),0,1);r+=1/G**2*l,i+=1/G**2;let u=xl((Wl(t)-3)/Math.max(4,n-3),0,1);r+=1/G**3*u,i+=1/G**3;let d=Gl(t);return r+=1/G**3*(1-d),i+=1/G**3,i<=0?0:xl(r/i,0,1)}function Zl(e){if(!e.length)return 1;let t=0;for(let n of e)t+=Math.log(Math.max(n,1e-12));return Math.exp(t/e.length)}function Ql(e,t,n){if(!Number.isFinite(e)||!Number.isFinite(t)||n<=0)return .5;let r=((e-t)%n+n)%n,i=2*Math.PI*r/n;return .5*(1+Math.cos(i))}function $l(e,t){return!Number.isFinite(e)||t<=0?0:Math.floor(Math.floor(Math.max(0,e))/Tc)%t}function eu(e){return Number.isFinite(e)?Math.floor(Math.max(0,e))%Tc:0}function tu(e){return!Number.isFinite(e)||e<=0?0:Cl(Math.log(e)/Math.log(G))}function nu(e,t){if(e.size===0&&t.size===0)return 0;let n=new Set([...e,...t]),r=0;for(let n of e)t.has(n)&&r++;return r/n.size}function ru(e){let t=new Set;Il(e)&&t.add(`fib`),Rl(e)&&t.add(`lucas`);let n=zl(e);return Bl(n)&&t.add(`uniform`),Vl(n)&&t.add(`pal`),Hl(n)>=4&&t.add(`longrun`),Wl(n)>=5&&t.add(`longseq`),t}function iu(e){return!Number.isFinite(e)||e<=0?0:1-G**+(-e/al)}function au(e){if(!Number.isFinite(e)||e<=0)return 0;let t=1n,n=1n,r=0,i=BigInt(Math.trunc(e));for(;n<=i;){r++;let e=t+n;t=n,n=e}return r}function ou(e){if(!Number.isFinite(e)||e<=0)return 0;let t=2n,n=1n,r=0,i=BigInt(Math.trunc(e));for(;n<=i;){r++;let e=t+n;t=n,n=e}return r}function su(e,t){let n=Cl((e+t)*G);return{phase01:n,wave:1+pl*(2*n-1)}}function cu(e){return Number.isFinite(e)&&e>0?Math.trunc(e):wc}function lu(e,t){return typeof e.kaiPulse==`number`?e.kaiPulse:typeof e.pulse==`number`?e.pulse:t}function uu(e,t,n){return typeof e.stepIndex==`number`&&Number.isFinite(e.stepIndex)?xl(Math.trunc(e.stepIndex),0,t-1):$l(n,t)}function du(e,t,n){return typeof e.beat==`number`&&Number.isFinite(e.beat)?Math.trunc(e.beat):Math.floor(n/t)}function fu(e){return Object.freeze(e.inputs),Object.freeze(e.headRef),Object.freeze(e)}var pu=new Map;function mu(e,t){let n=cu(e.stepsPerBeat),r=n*Tc,i=lu(e,t),a=e.transfers??[],o=El(a),s=Math.max(1,(t-i)/r),c=a.length/s,l=Tl(a),u=a.length===0?1:o.length/a.length,d=Ol(Dl(a)),f=wl(o.map(e=>(e.receiverKaiPulse-e.senderKaiPulse)/r).filter(e=>e>=0)),p=Al(e.frequencyHz),m=uu(e,n,i),h=du(e,r,i),g=Ml({...e,stepIndex:m,beat:h},n,p),_=Math.max(0,t-i),v=kl(e.ip,t),y=e.seriesSize??1,b=y<=1?Oc:y**+-kc,x=e.quality??`med`,S=Ac[x],C=(e.creatorVerified?1+jc:1)+(e.creatorRep??0)*Mc,w=1+Nc*Sl(l-1),T=1+zc*xl((u-Ic)*Rc,-1,1),E=1+Bc*(2*d-1),D=xl(1+Pc*Sl(f),1,Fc),O=1+Wc*(2*p-1),k=_/r,A=Math.min(Uc,1+Hc*Sl(k)),j=1/(1+Vc*Math.max(0,c)),M=Yl(i),N=Zl(o.map(e=>Number.isFinite(e.receiverKaiPulse)?Yl(e.receiverKaiPulse):1)),P=Kl(i),F=M*Math.max(1,N)*P,I=b*S*C*w*T*E*D*O*A*j*g*F,L=iu(i),R=iu(t),z=Math.max(0,R-L),B=Xl(i),V=ol+sl*B,H=Math.exp(V*z),U=1+cl*(1-L),ee=au(_),te=ou(_),ne=Math.exp(ll*ee),re=Math.exp(ul*te),ie=U*H*ne*re,ae=1*M*U*H*ne*re*Math.max(1,P),oe=r>0?t%r/r:0,se=1+dl*(.5+.5*d)*Math.sin(2*Math.PI*oe),ce=Cl(t/Dc),le=Cl(i/Dc),ue=1-Math.abs((ce-le+1)%1-.5)*2,de=1+fl*(.5+.5*p)*(.5+.5*d)*(2*ue-1),{phase01:fe,wave:pe}=su(i,t),me=m,he=Ql($l(t,n),me,n),ge=eu(i),_e=Ql(eu(t),ge,Tc),ve=1-Math.abs((tu(t+1)-tu(i+1)+1)%1-.5)*2,ye=B,be=Xl(t),xe=1-Math.abs(ye-be),Se=hl*nu(ru(i),ru(t))+(1-hl)*xe,Ce=.3*he+.3*_e+.2*ve+.2*Se,we=ml*(.5+.5*ye)*(.5+.5*p),Te=1+we*(2*Ce-1),Ee=se*de*pe*Te,De=I*ie,Oe=Math.max(0,De-ae),ke=ae+Oe*Ee,Ae=1*ke+v,je={headHash:void 0,transfersWindowRoot:e.transfersWindowRoot,cumulativeTransfers:e.cumulativeTransfers??a.length},Me={size:y,quality:x,creatorVerified:!!e.creatorVerified,creatorRep:e.creatorRep??0,uniqueHolders:l,closedFraction:u,cadenceRegularity:d,medianHoldBeats:f,velocityPerBeat:c,resonancePhi:p,pulsesPerBeat:r,agePulses:_,geometryLift:g,momentLift:F,pv_phi:v,algorithmVersion:`phi/kosmos-vφ-5`,adoptionAtClaim:L,adoptionNow:R,adoptionDelta:z,rarityScore01:B,fibAccrualLevels:ee,lucasAccrualLevels:te,indexScarcity:U,adoptionLift:H,fibAccrualLift:ne,lucasAccrualLift:re,breathPhase01:oe,breathWave:se,dayPhase01:ce,dayWave:de,strobePhase01:fe,strobeWave:pe,momentAffinitySim01:Ce,momentAffinityAmp:we,momentAffinityOsc:Te,combinedOsc:Ee,dynamicGrowth:ie,rarityFloor:ae,premiumBandBase:Oe},Ne=bl,Pe={version:1,unit:`Φ`,algorithm:`phi/kosmos-vφ-5`,policyId:e.valuationPolicyId,policyChecksum:Ne,valuePhi:Ae,premium:ke,inputs:Me,computedAtPulse:t,headRef:je},Fe=vl({algorithm:Pe.algorithm,policy:Pe.policyId??null,policyChecksum:Pe.policyChecksum,inputs:Pe.inputs,minimalHead:{headHash:Pe.headRef.headHash??null,transfersWindowRoot:Pe.headRef.transfersWindowRoot??null,cumulativeTransfers:Pe.headRef.cumulativeTransfers}}),Ie=pu.get(Fe);if(Ie)return{unsigned:Ie,stampPayload:Fe};let Le=fu({...Pe,inputs:{...Pe.inputs},headRef:{...Pe.headRef}});return pu.set(Fe,Le),{unsigned:Le,stampPayload:Fe}}async function hu(e,t,n,r){let{unsigned:i,stampPayload:a}=mu(e,t),o={...i,headRef:{...i.headRef,headHash:r}},s=await n(a);return{seal:{...o,stamp:s}}}function gu(e,t){return{...e,valuation:t}}function _u(e){let t=e.inputs;return[`Algorithm: ${e.algorithm} • Policy checksum: ${e.policyChecksum}`,`Series rarity: size=${t.size} → rarityFactor≈${t.size<=1?Oc:t.size**+-kc}`,`Moment lifts: geometry=${t.geometryLift} × numericMoment=${t.momentLift} × genesis/baseline floor=${t.rarityFloor}`,`Adoption field: ΔA=${t.adoptionDelta} → adoptionLift=${t.adoptionLift} • indexScarcity=${t.indexScarcity} • fibLevels=${t.fibAccrualLevels} • lucasLevels=${t.lucasAccrualLevels}`,`Live alignment: breath=${t.breathWave} • day=${t.dayWave} • strobe=${t.strobeWave} • affinity=${t.momentAffinityOsc} → combined=${t.combinedOsc}`,`Premium: floor=${t.rarityFloor} + band=${t.premiumBandBase} × combined=${t.combinedOsc} ⇒ premium=${e.premium} → valueΦ=${e.valuePhi}`].join(` `)}function vu(e){return Xl(e)}function yu(e){let t=[],n=zl(e),r=n.length;Il(e)&&t.push(`✓ Fibonacci exact (+${Yc*100}%)`),Rl(e)&&t.push(`✓ Lucas exact (+${Xc*100}%)`),Jl(e)!==null&&t.push(`✓ φ-spiral transition (+${Zc*100}%)`),Bl(n)&&t.push(`✓ Uniform digits (${n[0].repeat(Math.max(1,r))}) (+${Qc*100}%)`),Vl(n)&&t.push(`✓ Palindrome (+${$c*100}%)`);let{len:i,digit:a}=Ul(n);if(i>=3){let e=xl((i-2)/Math.max(3,r-2),0,1);t.push(`✓ Long digit run (${i}×${a}) (+${el*e*100}%)`)}let o=Wl(n);if(o>=4){let e=xl((o-3)/Math.max(4,r-3),0,1);t.push(`✓ Consecutive sequence (len ${o}) (+${tl*e*100}%)`)}let s=Gl(n);return s<1&&t.push(`✓ Low entropy (digit uniformity) (+${nl*(1-s)*100}%)`),t.length===0&&t.push(`• Clean moment (no special digit motifs)`),t}function bu(e,t,n){let r=cu(n?.stepsPerBeat),i=r*Tc,a=typeof n?.cadenceRegularity==`number`?xl(n.cadenceRegularity,0,1):1,o=typeof n?.resonancePhi==`number`?xl(n.resonancePhi,0,1):.5,s=i>0?t%i/i:0,c=1+dl*(.5+.5*a)*Math.sin(2*Math.PI*s),l=Cl(t/Dc),u=Cl(e/Dc),d=1-Math.abs((l-u+1)%1-.5)*2,f=1+fl*(.5+.5*o)*(.5+.5*a)*(2*d-1),p=typeof n?.stepIndexClaimOverride==`number`?xl(Math.trunc(n.stepIndexClaimOverride),0,r-1):$l(e,r),m=Ql($l(t,r),p,r),h=eu(e),g=Ql(eu(t),h,Tc),_=1-Math.abs((tu(t+1)-tu(e+1)+1)%1-.5)*2,v=Xl(e),y=Xl(t),b=1-Math.abs(v-y),x=nu(ru(e),ru(t)),{phase01:S,wave:C}=su(e,t),w=hl*x+(1-hl)*b,T=.3*m+.3*g+.2*_+.2*w,E=ml*(.5+.5*v)*(.5+.5*o),D=1+E*(2*T-1);return{breathWave:c,dayWave:f,strobeWave:C,momentAffinity:D,combinedOsc:c*f*C*D,breathPhase01:s,dayPhase01:l,strobePhase01:S,momentAffinitySim01:T,momentAffinityAmp:E}}function xu(e,t){let n=cu(t?.stepsPerBeat)*Tc,r=El(e),i=[];return r.forEach((e,t)=>{let r=t+1,a=(e.receiverKaiPulse-e.senderKaiPulse)/n,o=[];Il(e.receiverKaiPulse)&&o.push(`Fibonacci pulse`),Rl(e.receiverKaiPulse)&&o.push(`Lucas pulse`);let s=zl(e.receiverKaiPulse);Bl(s)&&o.push(`uniform digits`),Vl(s)&&o.push(`palindrome`);let c=Hl(s);if(c>=4){let{digit:e}=Ul(s);o.push(`long run (${c}×${e})`)}let l=``;l=a<5?`quick flip → churn penalty`:a<20?`held ${a} beats`:`held ${a} beats (strong stewardship)`;let u=o.length?` + ${o.join(` • `)}`:``;i.push(`Transfer ${r}: ${l}${u}`)}),i.length||i.push(`No closed transfers yet — lineage still forming.`),i}function Su(e,t){let n=nu(ru(e),ru(t)),r=Xl(e),i=Xl(t),a=1-Math.abs(r-i);return hl*n+(1-hl)*a}function Cu(e,t){let n=t?.title??`Kai-Sigil Valuation Scroll`,r=[`# ${n}`,``,"```",_u(e),"```",``,`### Rarity Evidence`,...yu(e.computedAtPulse).map(e=>`- `+e)].join(` `),i=t?.width??800,a=t?.padding??24,o=_u(e).split(` `),s=o.map((e,t)=>`${wu(e)}`).join(``),c=`${wu(n)} · φ`,l=a+80+o.length*20+a;return{seal:e,scrollText:r,scrollSVG:` @@ -55,7 +55,7 @@ Please change the parent to ${r} `}function Fu(e){return e.replace(/&/g,`&`).replace(//g,`>`).replace(/"/g,`"`)}var Iu=(1+Math.sqrt(5))/2,Lu=17491.270421,Ru=11,zu=(e,t,n)=>Math.max(t,Math.min(n,e)),Bu=(e,t=9)=>Math.round(e*10**t)/10**t;function Vu(e,t){let n=Math.trunc(Math.max(0,e));return Math.floor(n/Ru)%Math.max(1,t)}function Hu(e){return Math.trunc(Math.max(0,e))%Ru}function Uu(e,t,n){let r=((e-t)%n+n)%n;return .5*(1+Math.cos(2*Math.PI*r/n))}const Wu={basePhiPerUsd:.1,adoptionLambda:1/Iu,premiumGamma:1/Iu**2,momentBoostMax:1/Iu**2,sizeScaleUsd:100,sizeMu:1/Iu**3,sizeCap:1+1/Iu**2,whaleTaper:{k:1/Iu**4},streakMaxBoost:1/Iu**3,lifetimeTiers:[{thresholdUsd:200,boost:.05},{thresholdUsd:1e3,boost:.1},{thresholdUsd:3e3,boost:.16}],holdBonus:{eta:1/Iu**2,rho:1/Iu**3,capMultiple:1/Iu},choir:{windowPulses:242,maxBoost:1/Iu**3,wStep:.6,wBreath:.4},breath:{maxBoost:1/Iu**4},festival:{mode:`beatEvery`,interval:13,widthBeats:1,bonus:1/Iu**4},milestones:{adoption:[{atAdoption:.1,multiplier:.95},{atAdoption:.25,multiplier:.9},{atAdoption:.5,multiplier:1/Iu},{atAdoption:.75,multiplier:1/Iu**1.25}],phiTransition:[{atN:18,multiplier:.92},{atN:21,multiplier:.88},{atN:25,multiplier:.82}],combine:`min`,interpolation:`step`},vow:{earlyUnlockPenalty:.5,stewardEpochBeats:55,stewardSpreadBeats:21}};function Gu(e,t){let n=1;for(let r of t)e>=r.at&&(n=r.multiplier);return n}function Ku(e,t){if(!t.length)return 1;if(e<=t[0].at)return t[0].multiplier;for(let n=1;ne*t,1):1}function Ju(e,t,n,r){let i=[],a=null,o=e.milestones;if(!o)return{M_milestone:1,next:a};let s=o.interpolation??`step`;if(o.adoption?.length){let e=o.adoption.slice().sort((e,t)=>e.atAdoption-t.atAdoption).map(e=>({at:zu(e.atAdoption,0,1),multiplier:e.multiplier})),t=s===`linear`?Ku(n,e):Gu(n,e);i.push(t);let r=e.find(e=>e.at>n);r&&(a??={kind:`adoption`,at:r.at,multiplier:r.multiplier})}if(o.pulse?.length){let e=o.pulse.slice().sort((e,t)=>e.atPulse-t.atPulse).map(e=>({at:Math.max(0,Math.trunc(e.atPulse)),multiplier:e.multiplier})),n=s===`linear`?Ku(t,e):Gu(t,e);i.push(n);let r=e.find(e=>e.at>t);r&&!a&&(a={kind:`pulse`,at:r.at,multiplier:r.multiplier})}if(o.beat?.length){let e=Math.floor(t/r),n=o.beat.slice().sort((e,t)=>e.atBeat-t.atBeat).map(e=>({at:Math.max(0,Math.trunc(e.atBeat)),multiplier:e.multiplier})),c=s===`linear`?Ku(e,n):Gu(e,n);i.push(c);let l=n.find(t=>t.at>e);l&&!a&&(a={kind:`beat`,at:l.at,multiplier:l.multiplier})}if(o.phiTransition?.length){let e=Math.floor(Math.log(Math.max(1,t))/Math.log(Iu)),n=o.phiTransition.slice().sort((e,t)=>e.atN-t.atN).map(e=>({at:Math.max(1,Math.trunc(e.atN)),multiplier:e.multiplier})),r=s===`linear`?Ku(e,n):Gu(e,n);i.push(r);let c=n.find(t=>t.at>e);c&&!a&&(a={kind:`phiTransition`,at:c.at,multiplier:c.multiplier})}return{M_milestone:Bu(qu(i,o.combine??`min`)),next:a}}function Yu(e,t,n,r){if(!r||!n?.length)return 1;let i=Math.max(1,r.windowPulses),a=e-i,o=e+i,s=n.filter(e=>e.pulse>=a&&e.pulse<=o);if(!s.length)return 1;let c=Vu(e,t),l=Hu(e),u=0;for(let e of s){let n=Vu(e.pulse,t),i=Hu(e.pulse),a=Uu(c,n,t),o=Uu(l,i,Ru),s=(r.wStep??.5)*a+(r.wBreath??.5)*o;u+=s}let d=u/s.length;return Bu(1+(r.maxBoost??0)*(2*d-1))}function Xu(e,t,n){if(!n||t==null)return 1;let r=Hu(e)/Ru,i=1-Math.abs((t-r+1)%1-.5)*2;return Bu(1+(n.maxBoost??0)*(2*i-1))}function Zu(e,t,n){if(!n)return 1;let r=Math.floor(e/t);if(n.mode===`beatEvery`){let e=Math.max(1,Math.trunc(n.interval)),t=Math.max(0,Math.trunc(n.widthBeats));return Bu(r%e===0||Math.abs(r%e)<=t||Math.abs(r%e-e)<=t?1+(n.bonus||0):1)}let i=Math.floor(Math.log(Math.max(1,e))/Math.log(Iu)),a=Math.ceil(Iu**+i),o=i%Math.max(1,Math.trunc(n.interval))===0,s=Math.max(0,Math.trunc(n.widthBeats)),c=Math.floor(a/t),l=Math.abs(r-c)<=s;return Bu(o&&l?1+(n.bonus||0):1)}function Qu(e,t=Wu){let{unsigned:n}=mu(e.meta,e.nowPulse),{premium:r,inputs:i}=n,a=i.adoptionNow,o=i.rarityScore01,s=i.pulsesPerBeat,c=Math.max(0,e.usd||0),l=t.basePhiPerUsd,u=Bu(Math.exp(-t.adoptionLambda*a)),d=Bu((1/Math.max(r,1e-9))**t.premiumGamma),f=Bu(1+t.momentBoostMax*o),p=1+t.sizeMu*Math.log1p(c/Math.max(t.sizeScaleUsd,1)),m=Math.min(p,t.sizeCap),h=t.whaleTaper?1/Math.sqrt(1+t.whaleTaper.k*c):1,g=Bu(m*h),_=Math.max(0,e.currentStreakDays||0),v=Bu(1+t.streakMaxBoost*(1-Iu**+-_)),y=Math.max(0,(e.lifetimeUsdSoFar||0)+c),b=Bu(1+(t.lifetimeTiers||[]).reduce((e,t)=>y>=t.thresholdUsd?Math.max(e,t.boost):e,0)),x=Bu(Yu(e.nowPulse,s/Ru,e.choirNearby??[],t.choir)),S=Bu(Xu(e.nowPulse,e.breathPhase01,t.breath)),C=Bu(Zu(e.nowPulse,s,t.festival)),{M_milestone:w,next:T}=Ju(t,e.nowPulse,a,s),E=Bu(u*d*f*g*v*b*x*S*C*w),D=Bu(l*E),O=Bu(c*D),k=null,A=0,j=0;if(t.holdBonus&&(e.plannedHoldBeats||0)>0){let n=Math.max(0,e.plannedHoldBeats),r=e.nowPulse+n*s;k=Math.trunc(r);let i=O*t.holdBonus.eta*(1-Math.exp(-t.holdBonus.rho*n));A=Math.min(i,O*t.holdBonus.capMultiple);let a=1/(1+Math.max(0,k-e.nowPulse)/Lu);j=Bu(A*a)}let M=Bu(1*r+i.pv_phi),N=Bu(M+O+j),P=t.vow&&k?{earlyUnlockPenalty:t.vow.earlyUnlockPenalty,stewardEpochBeats:t.vow.stewardEpochBeats,stewardSpreadBeats:t.vow.stewardSpreadBeats}:null;return{phiPerUsd:D,usdPerPhi:D>0?Bu(1/D):1/0,addPhiNow:O,issuanceMultiplier:E,multipliers:{M_adoption:u,M_premium:d,M_moment:f,sizeMultiplier:g,M_streak:v,M_tier:b,M_choir:x,M_breath:S,M_festival:C,M_milestone:w,M_taper:h},hold:k?{vestAtPulse:k,bonusPhiAtVest:Bu(A),bonusNowPV:j}:null,vow:P,premium:r,rarityFloor:i.rarityFloor,adoption:a,rarityScore:o,pulsesPerBeat:s,nextMilestone:T,valuePhiBefore:M,valuePhiAfterPV:N,ipEntries:[{atPulse:e.nowPulse,amountPhi:O},...k?[{atPulse:k,amountPhi:Bu(A)}]:[]]}}var $u=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),ed=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),td=e=>{let t=ed(e);return t.charAt(0).toUpperCase()+t.slice(1)},nd=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),rd=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0},id={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ad=(0,C.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,C.createElement)(`svg`,{ref:c,...id,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:nd(`lucide`,i),...!a&&!rd(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,C.createElement)(e,t)),...Array.isArray(a)?a:[a]])),od=(e,t)=>{let n=(0,C.forwardRef)(({className:n,...r},i)=>(0,C.createElement)(ad,{ref:i,iconNode:t,className:nd(`lucide-${$u(td(e))}`,`lucide-${e}`,n),...r}));return n.displayName=td(e),n},sd=od(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),cd=od(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),ld=od(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),ud=od(`gem`,[[`path`,{d:`M10.5 3 8 9l4 13 4-13-2.5-6`,key:`b3dvk1`}],[`path`,{d:`M17 3a2 2 0 0 1 1.6.8l3 4a2 2 0 0 1 .013 2.382l-7.99 10.986a2 2 0 0 1-3.247 0l-7.99-10.986A2 2 0 0 1 2.4 7.8l2.998-3.997A2 2 0 0 1 7 3z`,key:`7w4byz`}],[`path`,{d:`M2 9h20`,key:`16fsjt`}]]),dd=od(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),fd=od(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),pd=od(`send-horizontal`,[[`path`,{d:`M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z`,key:`117uat`}],[`path`,{d:`M6 12h16`,key:`s4cdu5`}]]),md=od(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),hd=od(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),gd=od(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),_d=od(`wind`,[[`path`,{d:`M12.8 19.6A2 2 0 1 0 14 16H2`,key:`148xed`}],[`path`,{d:`M17.5 8a2.5 2.5 0 1 1 2 4H2`,key:`1u4tom`}],[`path`,{d:`M9.8 4.4A2 2 0 1 1 11 8H2`,key:`75valh`}]]);function vd(e){let t=new Uint8Array(e.byteLength);return t.set(e),t.buffer}var yd=e=>Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``);async function bd(e){let t=typeof e==`string`?new TextEncoder().encode(e):e,n=await crypto.subtle.digest(`SHA-256`,vd(t));return yd(new Uint8Array(n))}async function xd(e){let{pulse:t,beat:n,stepIndex:r,chakraDay:i}=e;return typeof t!=`number`||typeof n!=`number`||typeof r!=`number`||typeof i!=`string`?null:bd(`${t}|${n}|${r}|${i}|${typeof e.intentionSigil==`string`?e.intentionSigil:``}`)}function Sd(e,t){let n=e.match(RegExp(`${t}="([^"]+)"`,`i`));return n?n[1]:void 0}function Cd(e,t){let n=Sd(e,t);if(!n)return;let r=Number(n);return Number.isFinite(r)?r:void 0}function wd(e){try{let t=new DOMParser().parseFromString(e,`image/svg+xml`).querySelector(`metadata`);return t?t.textContent??null:null}catch{return null}}function Td(e){let t={},n=wd(e);if(n)try{t={...JSON.parse(n)}}catch{}if(t.pulse??=Cd(e,`data-pulse`),t.beat??=Cd(e,`data-beat`),t.stepIndex??=Cd(e,`data-step-index`),t.frequencyHz==null){let n=Sd(e,`data-frequency-hz`);n&&(t.frequencyHz=Number(n))}if(t.chakraGate??=Sd(e,`data-chakra-gate`),!t.chakraDay){let n=Sd(e,`data-harmonic-day`)||Sd(e,`data-chakra-day`);n&&(t.chakraDay=n)}t.kaiSignature??=Sd(e,`data-kai-signature`),t.userPhiKey??=Sd(e,`data-phi-key`);let r=Sd(e,`data-intention-sigil`);return r&&typeof t.intentionSigil!=`string`&&(t.intentionSigil=r),t}async function Ed(e,t){let n=t?Sd(t,`data-payload-hash`):void 0;return n?n.toLowerCase():typeof e.canonicalHash==`string`&&e.canonicalHash.length>=32?e.canonicalHash.toLowerCase():(await bd(`${e.pulse??0}|${e.beat??0}|${e.stepIndex??0}|${e.chakraDay??``}`)).toLowerCase()}async function Dd(e){try{if(!new DOMParser().parseFromString(e,`image/svg+xml`).querySelector(`svg`))return{ok:!1,reason:`Unrecognized SVG content.`}}catch{return{ok:!1,reason:`Unrecognized SVG content.`}}let t=Td(e),n=!t[`@context`]||t[`@context`]===`https://schema.phi.network/sigil/v1`,r=!t.type||t.type===`application/phi.kairos.sigil+svg`;if(!n||!r)return{ok:!1,reason:`Invalid sigil context/type.`};if(!(typeof t.pulse==`number`&&typeof t.beat==`number`&&typeof t.stepIndex==`number`&&typeof t.chakraDay==`string`))return{ok:!1,reason:`Missing core fields (pulse/beat/stepIndex/chakraDay).`};let i=await xd(t),a=!1;if(i&&t.kaiSignature&&(a=i.toLowerCase()!==t.kaiSignature.toLowerCase()),a){let n=Cd(e,`data-step-index-canonical`),r=Sd(e,`data-kai-signature`);if(typeof n==`number`&&r){let e=await xd({...t,stepIndex:n,kaiSignature:r});e&&e.toLowerCase()===r.toLowerCase()&&(t.stepIndex=n,t.kaiSignature=r,a=!1)}}if(a)return{ok:!1,reason:`Content signature mismatch (Σ).`};t.segmentSize??=2e3,typeof t.cumulativeTransfers!=`number`&&(t.cumulativeTransfers=(t.segments??[]).reduce((e,t)=>e+(t.count||0),0)+(t.transfers?.length??0));let o=await Ed(t,e);return{ok:!0,unsigned:!t.kaiSignature,meta:t,canonical:o}}function Od(e){let t=e.credits;if(!Array.isArray(t))return;let n=t.map(e=>{if(e&&typeof e==`object`){let t=e.atPulse,n=e.amountPhi,r=e.source;if(typeof t==`number`&&typeof n==`number`)return{atPulse:t,amountPhi:n,source:typeof r==`string`?r:void 0}}return null}).filter(e=>e!==null);return n.length?n:void 0}function kd(e,t){if(!t)return e;let n=[...Od(e)??[],t];return{...e,credits:n}}var Ad=e=>Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``);async function jd(e){let t;t=typeof e==`string`?new TextEncoder().encode(e).buffer:e instanceof Uint8Array?e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.slice().buffer:e;let n=await crypto.subtle.digest(`SHA-256`,t);return Ad(new Uint8Array(n))}function Md({open:e,onClose:t,onImport:n,onCreditPhi:r}){let i=(0,C.useRef)(null),a=(0,C.useRef)(null),[o,s]=(0,C.useState)(null),[c,l]=(0,C.useState)(null),[u,d]=(0,C.useState)(null),[f,p]=(0,C.useState)(!1),[m,h]=(0,C.useState)(null),[g,_]=(0,C.useState)(0),[v,y]=(0,C.useState)(null),b=(0,C.useCallback)(()=>i.current?.click(),[]);(0,C.useEffect)(()=>{if(!e)return;let t=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=t}},[e]),(0,C.useEffect)(()=>{e||(l(null),s(null),d(null),p(!1),h(null),_(0),y(null))},[e]),(0,C.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&t(),(e.key===` `||e.key===`Enter`)&&document.activeElement?.dataset?.upload===`true`&&(e.preventDefault(),b())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,b]);let x=(0,C.useCallback)(async e=>{if(!e.name.toLowerCase().endsWith(`.svg`)){s(`Please select a Kairos Sigil .svg file.`),d(`err`);return}s(null),d(`checking`),l(null),h(null),p(!1),_(0),y(e.name);try{let t=await e.text();if(!new DOMParser().parseFromString(t,`image/svg+xml`).querySelector(`svg`))throw Error(`Unrecognized SVG content.`);let n=await Dd(t);if(!n?.ok){d(`err`),s(n?.reason||`Failed verification.`);return}let r=n.meta||{},i=n.canonical,{unsigned:a}=mu(r,r.exportedAtPulse??r.kaiPulse??r.pulse??0),o=a.valuePhi,c=r.pulse??0;l({hash:i,value:o,pulseCreated:c,meta:r}),p(!!n.unsigned),h({hash:i,value:o,pulse:c}),d(n.unsigned?`warn`:`ok`)}catch(e){console.error(`Glyph import error:`,e),d(`err`);let t=e?.message,n=typeof t==`string`?t:``;s(/signature mismatch|Σ/i.test(n)?`Content signature mismatch (Σ).`:`Invalid glyph file. Ensure it's an authentic Kairos Sigil SVG with .`)}finally{i.current&&(i.current.value=``)}},[]),S=(0,C.useCallback)(async e=>{if(e.preventDefault(),!e.dataTransfer.files?.length)return;let t=e.dataTransfer.files[0];await x(t)},[x]),w=(0,C.useCallback)(e=>{e.preventDefault()},[]),T=(0,C.useCallback)(async e=>{let t=e.target.files?.[0];t&&await x(t)},[x]),E=(0,C.useCallback)(async()=>{if(!c)return;let e=Math.max(0,c.value||0),i=Math.max(0,Math.min(Number.isFinite(g)?g:0,e));try{let e=c.meta||{},a=e.exportedAtPulse??e.kaiPulse??e.pulse??0,o=kd(e,i>0?{atPulse:a,amountPhi:Number(i.toFixed(6)),source:`import`}:null),{seal:s}=await hu(o,a,jd),l=gu(o,s),u={...c,value:s.valuePhi,meta:l};r&&i>0&&r(Number(i.toFixed(6))),n(u),t()}catch(e){console.error(`Finalize import error:`,e),d(`err`),s(`Failed to finalize valuation for this glyph.`)}},[c,g,r,n,t]),D=(0,C.useMemo)(()=>u===`checking`?`Validating…`:u===`ok`?`Verified`:u===`warn`?`Unsigned (permissible)`:u===`err`?`Invalid`:``,[u]);if(!e)return null;let O=m?.value??0,k=g<0?`Cannot credit a negative amount.`:g>O?`Exceeds available value.`:null;return(0,W.jsx)(`div`,{className:`glyph-import-backdrop`,onClick:e=>{e.target===e.currentTarget&&t()},"aria-hidden":!e,children:(0,W.jsxs)(`div`,{className:`glyph-import-modal`,ref:a,role:`dialog`,"aria-modal":`true`,"aria-label":`Import Kairos Sigil`,"aria-busy":u===`checking`,"data-status":u??``,children:[(0,W.jsx)(`button`,{className:`close-button`,onClick:t,"aria-label":`Close`,children:(0,W.jsx)(cd,{size:22})}),(0,W.jsxs)(`header`,{className:`modal-header`,children:[(0,W.jsx)(`h2`,{className:`modal-title`,children:`Import Kairos Sigil`}),(0,W.jsx)(`p`,{className:`modal-sub`,children:`breathe in the moment — measure in Φ`})]}),(0,W.jsxs)(`div`,{className:`upload-section`,onClick:b,role:`button`,tabIndex:0,"data-upload":`true`,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),b())},onDrop:S,onDragOver:w,children:[(0,W.jsx)(`div`,{className:`halo`,"aria-hidden":`true`}),(0,W.jsx)(ld,{size:48}),(0,W.jsx)(`p`,{className:`upload-title`,children:`Drop your Kairos Sigil .svg here`}),(0,W.jsx)(`p`,{className:`upload-sub`,children:`or tap to select`}),v&&(0,W.jsx)(`div`,{className:`file-name`,children:v}),(0,W.jsx)(`input`,{type:`file`,accept:`image/svg+xml,.svg`,ref:i,onChange:T,hidden:!0})]}),u&&(0,W.jsx)(`div`,{className:`import-status ${u}`,children:u===`err`?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(gd,{size:18}),(0,W.jsx)(`span`,{className:`label`,children:D})]}):(0,W.jsxs)(W.Fragment,{children:[u===`ok`&&(0,W.jsx)(sd,{size:18,className:`success-icon`}),u===`warn`&&(0,W.jsx)(gd,{size:18}),(0,W.jsx)(`span`,{className:`label`,children:D})]})}),m&&(0,W.jsxs)(`div`,{className:`import-preview`,children:[(0,W.jsxs)(`div`,{className:`kv`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Canonical Hash`}),(0,W.jsx)(`span`,{className:`v mono`,children:m.hash})]}),(0,W.jsxs)(`div`,{className:`kv`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Intrinsic Value`}),(0,W.jsxs)(`span`,{className:`v`,children:[m.value.toFixed(6),` Φ`]})]}),(0,W.jsxs)(`div`,{className:`kv`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Pulse`}),(0,W.jsxs)(`span`,{className:`v`,children:[m.pulse,f&&(0,W.jsx)(`span`,{className:`chip warn`,children:`unsigned`})]})]}),(0,W.jsxs)(`div`,{className:`phi-credit`,children:[(0,W.jsxs)(`label`,{htmlFor:`phi-credit-input`,children:[`Credit Φ to balance before import`,` `,(0,W.jsxs)(`em`,{children:[`(max `,O.toFixed(6),` Φ)`]})]}),(0,W.jsxs)(`div`,{className:`credit-row`,children:[(0,W.jsx)(`input`,{id:`phi-credit-input`,type:`number`,inputMode:`decimal`,min:0,step:1e-6,value:Number.isFinite(g)?g:0,onChange:e=>_(Number(e.target.value))}),(0,W.jsx)(`button`,{className:`chip quick`,onClick:()=>_(Number((O*.236).toFixed(6))),title:`φ^-3 (~23.6%)`,children:`23.6%`}),(0,W.jsx)(`button`,{className:`chip quick`,onClick:()=>_(Number((O*.382).toFixed(6))),title:`φ^-2 (~38.2%)`,children:`38.2%`}),(0,W.jsx)(`button`,{className:`chip quick`,onClick:()=>_(Number((O*.618).toFixed(6))),title:`1/φ (~61.8%)`,children:`61.8%`}),(0,W.jsx)(`button`,{className:`chip quick`,onClick:()=>_(Number(O.toFixed(6))),title:`All`,children:`Max`})]}),k&&(0,W.jsx)(`div`,{className:`helper error`,children:k}),!k&&g>0&&(0,W.jsxs)(`div`,{className:`helper`,children:[`Remaining intrinsic value after credit:`,` `,(O-g).toFixed(6),` Φ`]})]}),(0,W.jsx)(`button`,{className:`import-confirm`,onClick:E,disabled:!c||!!k,title:k??`Import glyph`,children:`Import Glyph`})]}),o&&(0,W.jsxs)(`div`,{className:`import-error`,role:`status`,"aria-live":`polite`,children:[(0,W.jsx)(gd,{size:20}),(0,W.jsx)(`p`,{children:o})]}),(0,W.jsxs)(`footer`,{className:`modal-footer`,children:[(0,W.jsx)(`span`,{className:`seal`,children:`Σ`}),(0,W.jsx)(`span`,{className:`foot`,children:`Authentic SVG only • deterministic valuation • one breath = 1 Φ`})]})]})})}function Nd(e){let t=2166136261;for(let n=0;n>>0).toString(16).padStart(8,`0`)}function Pd(e){let t=[`send`,`src=${e.sourceHash}`,`p=${e.pulse}`,`amt=${e.amount}`,`to=${e.recipientHash??``}`,`msg=${e.message??``}`].join(`|`);return`glyph::${e.pulse}::${Nd(t)}`}function Fd(e){return e}function Id(e,t,n,r,i){if(t<=0)throw Error(`Amount must be positive.`);if(e.value{(function(n){typeof e==`object`&&t!==void 0?t.exports=n():typeof define==`function`&&define.amd?define([],n):(typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:this).JSZip=n()})(function(){return function e(t,n,r){function i(o,s){if(!n[o]){if(!t[o]){var c=typeof p==`function`&&p;if(!s&&c)return c(o,!0);if(a)return a(o,!0);var l=Error(`Cannot find module '`+o+`'`);throw l.code=`MODULE_NOT_FOUND`,l}var u=n[o]={exports:{}};t[o][0].call(u.exports,function(e){var n=t[o][1][e];return i(n||e)},u,u.exports,e,t,n,r)}return n[o].exports}for(var a=typeof p==`function`&&p,o=0;o>2,s=(3&t)<<4|n>>4,c=1>6:64,l=2>4,n=(15&o)<<4|(s=a.indexOf(e.charAt(l++)))>>2,r=(3&s)<<6|(c=a.indexOf(e.charAt(l++))),f[u++]=t,s!==64&&(f[u++]=n),c!==64&&(f[u++]=r);return f}},{"./support":30,"./utils":32}],2:[function(e,t,n){var r=e(`./external`),i=e(`./stream/DataWorker`),a=e(`./stream/Crc32Probe`),o=e(`./stream/DataLengthProbe`);function s(e,t,n,r,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=r,this.compressedContent=i}s.prototype={getContentWorker:function(){var e=new i(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o(`data_length`)),t=this;return e.on(`end`,function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw Error(`Bug : uncompressed data size mismatch`)}),e},getCompressedWorker:function(){return new i(r.Promise.resolve(this.compressedContent)).withStreamInfo(`compressedSize`,this.compressedSize).withStreamInfo(`uncompressedSize`,this.uncompressedSize).withStreamInfo(`crc32`,this.crc32).withStreamInfo(`compression`,this.compression)}},s.createWorkerFrom=function(e,t,n){return e.pipe(new a).pipe(new o(`uncompressedSize`)).pipe(t.compressWorker(n)).pipe(new o(`compressedSize`)).withStreamInfo(`compression`,t)},t.exports=s},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,n){var r=e(`./stream/GenericWorker`);n.STORE={magic:`\0\0`,compressWorker:function(){return new r(`STORE compression`)},uncompressWorker:function(){return new r(`STORE decompression`)}},n.DEFLATE=e(`./flate`)},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,n){var r=e(`./utils`),i=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t){return e!==void 0&&e.length?r.getTypeOf(e)===`string`?function(e,t,n,r){var a=i,o=r+n;e^=-1;for(var s=r;s>>8^a[255&(e^t.charCodeAt(s))];return-1^e}(0|t,e,e.length,0):function(e,t,n,r){var a=i,o=r+n;e^=-1;for(var s=r;s>>8^a[255&(e^t[s])];return-1^e}(0|t,e,e.length,0):0}},{"./utils":32}],5:[function(e,t,n){n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(e,t,n){var r=null;r=typeof Promise<`u`?Promise:e(`lie`),t.exports={Promise:r}},{lie:37}],7:[function(e,t,n){var r=typeof Uint8Array<`u`&&typeof Uint16Array<`u`&&typeof Uint32Array<`u`,i=e(`pako`),a=e(`./utils`),o=e(`./stream/GenericWorker`),s=r?`uint8array`:`array`;function c(e,t){o.call(this,`FlateWorker/`+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}n.magic=`\b\0`,a.inherits(c,o),c.prototype.processChunk=function(e){this.meta=e.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(s,e.data),!1)},c.prototype.flush=function(){o.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},n.compressWorker=function(e){return new c(`Deflate`,e)},n.uncompressWorker=function(){return new c(`Inflate`,{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,n){function r(e,t){var n,r=``;for(n=0;n>>=8;return r}function i(e,t,n,i,o,u){var d,f,p=e.file,m=e.compression,h=u!==s.utf8encode,g=a.transformTo(`string`,u(p.name)),_=a.transformTo(`string`,s.utf8encode(p.name)),v=p.comment,y=a.transformTo(`string`,u(v)),b=a.transformTo(`string`,s.utf8encode(v)),x=_.length!==p.name.length,S=b.length!==v.length,C=``,w=``,T=``,E=p.dir,D=p.date,O={crc32:0,compressedSize:0,uncompressedSize:0};t&&!n||(O.crc32=e.crc32,O.compressedSize=e.compressedSize,O.uncompressedSize=e.uncompressedSize);var k=0;t&&(k|=8),h||!x&&!S||(k|=2048);var A=0,j=0;E&&(A|=16),o===`UNIX`?(j=798,A|=function(e,t){var n=e;return e||(n=t?16893:33204),(65535&n)<<16}(p.unixPermissions,E)):(j=20,A|=function(e){return 63&(e||0)}(p.dosPermissions)),d=D.getUTCHours(),d<<=6,d|=D.getUTCMinutes(),d<<=5,d|=D.getUTCSeconds()/2,f=D.getUTCFullYear()-1980,f<<=4,f|=D.getUTCMonth()+1,f<<=5,f|=D.getUTCDate(),x&&(w=r(1,1)+r(c(g),4)+_,C+=`up`+r(w.length,2)+w),S&&(T=r(1,1)+r(c(y),4)+b,C+=`uc`+r(T.length,2)+T);var M=``;return M+=` -\0`,M+=r(k,2),M+=m.magic,M+=r(d,2),M+=r(f,2),M+=r(O.crc32,4),M+=r(O.compressedSize,4),M+=r(O.uncompressedSize,4),M+=r(g.length,2),M+=r(C.length,2),{fileRecord:l.LOCAL_FILE_HEADER+M+g+C,dirRecord:l.CENTRAL_FILE_HEADER+r(j,2)+M+r(y.length,2)+`\0\0\0\0`+r(A,4)+r(i,4)+g+C+y}}var a=e(`../utils`),o=e(`../stream/GenericWorker`),s=e(`../utf8`),c=e(`../crc32`),l=e(`../signature`);function u(e,t,n,r){o.call(this,`ZipFileWorker`),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(u,o),u.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-r-1))/n:100}}))},u.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var n=i(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},u.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=i(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:function(e){return l.DATA_DESCRIPTOR+r(e.crc32,4)+r(e.compressedSize,4)+r(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},u.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return r.transformTo(`string`,this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,n){var r=e(`./Uint8ArrayReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,n){var r=e(`./DataReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,n){var r=e(`./ArrayReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.readData=function(e){if(this.checkOffset(e),e===0)return new Uint8Array;var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,n){var r=e(`../utils`),i=e(`../support`),a=e(`./ArrayReader`),o=e(`./StringReader`),s=e(`./NodeBufferReader`),c=e(`./Uint8ArrayReader`);t.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),t!==`string`||i.uint8array?t===`nodebuffer`?new s(e):i.uint8array?new c(r.transformTo(`uint8array`,e)):new a(r.transformTo(`array`,e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,n){n.LOCAL_FILE_HEADER=`PK`,n.CENTRAL_FILE_HEADER=`PK`,n.CENTRAL_DIRECTORY_END=`PK`,n.ZIP64_CENTRAL_DIRECTORY_LOCATOR=`PK\x07`,n.ZIP64_CENTRAL_DIRECTORY_END=`PK`,n.DATA_DESCRIPTOR=`PK\x07\b`},{}],24:[function(e,t,n){var r=e(`./GenericWorker`),i=e(`../utils`);function a(e){r.call(this,`ConvertWorker to `+e),this.destType=e}i.inherits(a,r),a.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,n){var r=e(`./GenericWorker`),i=e(`../crc32`);function a(){r.call(this,`Crc32Probe`),this.withStreamInfo(`crc32`,0)}e(`../utils`).inherits(a,r),a.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,n){var r=e(`../utils`),i=e(`./GenericWorker`);function a(e){i.call(this,`DataLengthProbe for `+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(a,i),a.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,n){var r=e(`../utils`),i=e(`./GenericWorker`);function a(e){i.call(this,`DataWorker`);var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type=``,this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}r.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case`string`:e=this.data.substring(this.index,t);break;case`uint8array`:e=this.data.subarray(this.index,t);break;case`array`:case`nodebuffer`:e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,n){function r(e){this.name=e||`default`,this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit(`data`,e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit(`end`),this.cleanUp(),this.isFinished=!0}catch(e){this.emit(`error`,e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit(`error`,e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n `+e:e}},t.exports=r},{}],29:[function(e,t,n){var r=e(`../utils`),i=e(`./ConvertWorker`),a=e(`./GenericWorker`),o=e(`../base64`),s=e(`../support`),c=e(`../external`),l=null;if(s.nodestream)try{l=e(`../nodejs/NodejsStreamOutputAdapter`)}catch{}function u(e,t){return new c.Promise(function(n,i){var a=[],s=e._internalType,c=e._outputType,l=e._mimeType;e.on(`data`,function(e,n){a.push(e),t&&t(n)}).on(`error`,function(e){a=[],i(e)}).on(`end`,function(){try{n(function(e,t,n){switch(e){case`blob`:return r.newBlob(r.transformTo(`arraybuffer`,t),n);case`base64`:return o.encode(t);default:return r.transformTo(e,t)}}(c,function(e,t){var n,r=0,i=null,a=0;for(n=0;n`u`)n.blob=!1;else{var r=new ArrayBuffer(0);try{n.blob=new Blob([r],{type:`application/zip`}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(r),n.blob=i.getBlob(`application/zip`).size===0}catch{n.blob=!1}}}try{n.nodestream=!!e(`readable-stream`).Readable}catch{n.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,n){for(var r=e(`./utils`),i=e(`./support`),a=e(`./nodejsUtils`),o=e(`./stream/GenericWorker`),s=Array(256),c=0;c<256;c++)s[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;s[254]=s[254]=1;function l(){o.call(this,`utf-8 decode`),this.leftOver=null}function u(){o.call(this,`utf-8 encode`)}n.utf8encode=function(e){return i.nodebuffer?a.newBufferFrom(e,`utf-8`):function(e){var t,n,r,a,o,s=e.length,c=0;for(a=0;a>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t}(e)},n.utf8decode=function(e){return i.nodebuffer?r.transformTo(`nodebuffer`,e).toString(`utf-8`):function(e){var t,n,i,a,o=e.length,c=Array(2*o);for(t=n=0;t>10&1023,c[n++]=56320|1023&i)}return c.length!==n&&(c.subarray?c=c.subarray(0,n):c.length=n),r.applyFromCharCode(c)}(e=r.transformTo(i.uint8array?`uint8array`:`array`,e))},r.inherits(l,o),l.prototype.processChunk=function(e){var t=r.transformTo(i.uint8array?`uint8array`:`array`,e.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var a=t;(t=new Uint8Array(a.length+this.leftOver.length)).set(this.leftOver,0),t.set(a,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var n;for((t||=e.length)>e.length&&(t=e.length),n=t-1;0<=n&&(192&e[n])==128;)n--;return n<0||n===0?t:n+s[e[n]]>t?n:t}(t),c=t;o!==t.length&&(i.uint8array?(c=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(c=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:n.utf8decode(c),meta:e.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=l,r.inherits(u,o),u.prototype.processChunk=function(e){this.push({data:n.utf8encode(e.data),meta:e.meta})},n.Utf8EncodeWorker=u},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,n){var r=e(`./support`),i=e(`./base64`),a=e(`./nodejsUtils`),o=e(`./external`);function s(e){return e}function c(e,t){for(var n=0;n>8;this.dir=!!(16&this.externalFileAttributes),e==0&&(this.dosPermissions=63&this.externalFileAttributes),e==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!==`/`||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=r(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,n,r,i=e.index+this.extraFieldsLength;for(this.extraFields||={};e.index+4>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t},n.buf2binstring=function(e){return c(e,e.length)},n.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n>10&1023,l[r++]=56320|1023&i)}return c(l,r)},n.utf8border=function(e,t){var n;for((t||=e.length)>e.length&&(t=e.length),n=t-1;0<=n&&(192&e[n])==128;)n--;return n<0||n===0?t:n+o[e[n]]>t?n:t}},{"./common":41}],43:[function(e,t,n){t.exports=function(e,t,n,r){for(var i=65535&e|0,a=e>>>16&65535|0,o=0;n!==0;){for(n-=o=2e3>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,i){var a=r,o=i+n;e^=-1;for(var s=i;s>>8^a[255&(e^t[s])];return-1^e}},{}],46:[function(e,t,n){var r,i=e(`../utils/common`),a=e(`./trees`),o=e(`./adler32`),s=e(`./crc32`),c=e(`./messages`),l=0,u=4,d=0,f=-2,p=-1,m=4,h=2,g=8,_=9,v=286,y=30,b=19,x=2*v+1,S=15,C=3,w=258,T=w+C+1,E=42,D=113,O=1,k=2,A=3,j=4;function M(e,t){return e.msg=c[t],t}function N(e){return(e<<1)-(4e.avail_out&&(n=e.avail_out),n!==0&&(i.arraySet(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 I(e,t){a._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,F(e.strm)}function L(e,t){e.pending_buf[e.pending++]=t}function R(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function z(e,t){var n,r,i=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-T?e.strstart-(e.w_size-T):0,l=e.window,u=e.w_mask,d=e.prev,f=e.strstart+w,p=l[a+o-1],m=l[a+o];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do if(l[(n=t)+o]===m&&l[n+o-1]===p&&l[n]===l[a]&&l[++n]===l[a+1]){a+=2,n++;do;while(l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&ac&&--i!=0);return o<=e.lookahead?o:e.lookahead}function B(e){var t,n,r,a,c,l,u,d,f,p,m=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=m+(m-T)){for(i.arraySet(e.window,e.window,m,m,0),e.match_start-=m,e.strstart-=m,e.block_start-=m,t=n=e.hash_size;r=e.head[--t],e.head[t]=m<=r?r-m:0,--n;);for(t=n=m;r=e.prev[--t],e.prev[t]=m<=r?r-m:0,--n;);a+=m}if(e.strm.avail_in===0)break;if(l=e.strm,u=e.window,d=e.strstart+e.lookahead,f=a,p=void 0,p=l.avail_in,f=C)for(c=e.strstart-e.insert,e.ins_h=e.window[c],e.ins_h=(e.ins_h<=C&&(e.ins_h=(e.ins_h<=C)if(r=a._tr_tally(e,e.strstart-e.match_start,e.match_length-C),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=C){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=C&&(e.ins_h=(e.ins_h<=C&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-C,r=a._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-C),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(B(e),e.lookahead===0&&t===l)return O;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,I(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-T&&(I(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(I(e,!0),e.strm.avail_out===0?A:j):(e.strstart>e.block_start&&(I(e,!1),e.strm.avail_out),O)}),new U(4,4,8,4,V),new U(4,5,16,8,V),new U(4,6,32,32,V),new U(4,4,16,16,H),new U(8,16,32,32,H),new U(8,16,128,128,H),new U(8,32,128,256,H),new U(32,128,258,1024,H),new U(32,258,258,4096,H)],n.deflateInit=function(e,t){return re(e,t,g,15,8,0)},n.deflateInit2=re,n.deflateReset=ne,n.deflateResetKeep=te,n.deflateSetHeader=function(e,t){return e&&e.state&&e.state.wrap===2?(e.state.gzhead=t,d):f},n.deflate=function(e,t){var n,i,o,c;if(!e||!e.state||5>8&255),L(i,i.gzhead.time>>16&255),L(i,i.gzhead.time>>24&255),L(i,i.level===9?2:2<=i.strategy||i.level<2?4:0),L(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(L(i,255&i.gzhead.extra.length),L(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=s(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(L(i,0),L(i,0),L(i,0),L(i,0),L(i,0),L(i,i.level===9?2:2<=i.strategy||i.level<2?4:0),L(i,3),i.status=D);else{var p=g+(i.w_bits-8<<4)<<8;p|=(2<=i.strategy||i.level<2?0:i.level<6?1:i.level===6?2:3)<<6,i.strstart!==0&&(p|=32),p+=31-p%31,i.status=D,R(i,p),i.strstart!==0&&(R(i,e.adler>>>16),R(i,65535&e.adler)),e.adler=1}if(i.status===69)if(i.gzhead.extra){for(o=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),F(e),o=i.pending,i.pending!==i.pending_buf_size));)L(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(i.status===73)if(i.gzhead.name){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),F(e),o=i.pending,i.pending===i.pending_buf_size)){c=1;break}c=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),c===0&&(i.gzindex=0,i.status=91)}else i.status=91;if(i.status===91)if(i.gzhead.comment){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),F(e),o=i.pending,i.pending===i.pending_buf_size)){c=1;break}c=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),c===0&&(i.status=103)}else i.status=103;if(i.status===103&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&F(e),i.pending+2<=i.pending_buf_size&&(L(i,255&e.adler),L(i,e.adler>>8&255),e.adler=0,i.status=D)):i.status=D),i.pending!==0){if(F(e),e.avail_out===0)return i.last_flush=-1,d}else if(e.avail_in===0&&N(t)<=N(n)&&t!==u)return M(e,-5);if(i.status===666&&e.avail_in!==0)return M(e,-5);if(e.avail_in!==0||i.lookahead!==0||t!==l&&i.status!==666){var m=i.strategy===2?function(e,t){for(var n;;){if(e.lookahead===0&&(B(e),e.lookahead===0)){if(t===l)return O;break}if(e.match_length=0,n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(I(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(I(e,!0),e.strm.avail_out===0?A:j):e.last_lit&&(I(e,!1),e.strm.avail_out===0)?O:k}(i,t):i.strategy===3?function(e,t){for(var n,r,i,o,s=e.window;;){if(e.lookahead<=w){if(B(e),e.lookahead<=w&&t===l)return O;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=C&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=C?(n=a._tr_tally(e,1,e.match_length-C),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(I(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(I(e,!0),e.strm.avail_out===0?A:j):e.last_lit&&(I(e,!1),e.strm.avail_out===0)?O:k}(i,t):r[i.level].func(i,t);if(m!==A&&m!==j||(i.status=666),m===O||m===A)return e.avail_out===0&&(i.last_flush=-1),d;if(m===k&&(t===1?a._tr_align(i):t!==5&&(a._tr_stored_block(i,0,0,!1),t===3&&(P(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),F(e),e.avail_out===0))return i.last_flush=-1,d}return t===u?i.wrap<=0?1:(i.wrap===2?(L(i,255&e.adler),L(i,e.adler>>8&255),L(i,e.adler>>16&255),L(i,e.adler>>24&255),L(i,255&e.total_in),L(i,e.total_in>>8&255),L(i,e.total_in>>16&255),L(i,e.total_in>>24&255)):(R(i,e.adler>>>16),R(i,65535&e.adler)),F(e),0=n.w_size&&(s===0&&(P(n.head),n.strstart=0,n.block_start=0,n.insert=0),p=new i.Buf8(n.w_size),i.arraySet(p,t,m-n.w_size,n.w_size,0),t=p,m=n.w_size),c=e.avail_in,l=e.next_in,u=e.input,e.avail_in=m,e.next_in=0,e.input=t,B(n);n.lookahead>=C;){for(r=n.strstart,a=n.lookahead-(C-1);n.ins_h=(n.ins_h<>>=b=y>>>24,m-=b,(b=y>>>16&255)==0)E[a++]=65535&y;else{if(!(16&b)){if(!(64&b)){y=h[(65535&y)+(p&(1<>>=b,m-=b),m<15&&(p+=T[r++]<>>=b=y>>>24,m-=b,!(16&(b=y>>>16&255))){if(!(64&b)){y=g[(65535&y)+(p&(1<>>=b,m-=b,(b=a-o)>3,p&=(1<<(m-=x<<3))-1,e.next_in=r,e.next_out=a,e.avail_in=r>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function g(){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 r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg=``,t.wrap&&(e.adler=1&t.wrap),t.mode=f,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(p),t.distcode=t.distdyn=new r.Buf32(m),t.sane=1,t.back=-1,u):d}function v(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,_(e)):d}function y(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=o.wsize?(r.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(i<(a=o.wsize-o.wnext)&&(a=i),r.arraySet(o.window,t,n-i,a,o.wnext),(i-=a)?(r.arraySet(o.window,t,n-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,n.check=a(n.check,B,2,0),x=b=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&b)<<8)+(b>>8))%31){e.msg=`incorrect header check`,n.mode=30;break}if((15&b)!=8){e.msg=`unknown compression method`,n.mode=30;break}if(x-=4,F=8+(15&(b>>>=4)),n.wbits===0)n.wbits=F;else if(F>n.wbits){e.msg=`invalid window size`,n.mode=30;break}n.dmax=1<>8&1),512&n.flags&&(B[0]=255&b,B[1]=b>>>8&255,n.check=a(n.check,B,2,0)),x=b=0,n.mode=3;case 3:for(;x<32;){if(v===0)break e;v--,b+=p[g++]<>>8&255,B[2]=b>>>16&255,B[3]=b>>>24&255,n.check=a(n.check,B,4,0)),x=b=0,n.mode=4;case 4:for(;x<16;){if(v===0)break e;v--,b+=p[g++]<>8),512&n.flags&&(B[0]=255&b,B[1]=b>>>8&255,n.check=a(n.check,B,2,0)),x=b=0,n.mode=5;case 5:if(1024&n.flags){for(;x<16;){if(v===0)break e;v--,b+=p[g++]<>>8&255,n.check=a(n.check,B,2,0)),x=b=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(v<(E=n.length)&&(E=v),E&&(n.head&&(F=n.head.extra_len-n.length,n.head.extra||(n.head.extra=Array(n.head.extra_len)),r.arraySet(n.head.extra,p,g,E,F)),512&n.flags&&(n.check=a(n.check,p,E,g)),v-=E,g+=E,n.length-=E),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(v===0)break e;for(E=0;F=p[g+ E++],n.head&&F&&n.length<65536&&(n.head.name+=String.fromCharCode(F)),F&&E>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;x<32;){if(v===0)break e;v--,b+=p[g++]<>>=7&x,x-=7&x,n.mode=27;break}for(;x<3;){if(v===0)break e;v--,b+=p[g++]<>>=1)){case 0:n.mode=14;break;case 1:if(w(n),n.mode=20,t!==6)break;b>>>=2,x-=2;break e;case 2:n.mode=17;break;case 3:e.msg=`invalid block type`,n.mode=30}b>>>=2,x-=2;break;case 14:for(b>>>=7&x,x-=7&x;x<32;){if(v===0)break e;v--,b+=p[g++]<>>16^65535)){e.msg=`invalid stored block lengths`,n.mode=30;break}if(n.length=65535&b,x=b=0,n.mode=15,t===6)break e;case 15:n.mode=16;case 16:if(E=n.length){if(v>>=5,x-=5,n.ndist=1+(31&b),b>>>=5,x-=5,n.ncode=4+(15&b),b>>>=4,x-=4,286>>=3,x-=3}for(;n.have<19;)n.lens[V[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,L={bits:n.lenbits},I=s(0,n.lens,0,19,n.lencode,0,n.work,L),n.lenbits=L.bits,I){e.msg=`invalid code lengths set`,n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,j=65535&z,!((k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=k,x-=k,n.lens[n.have++]=j;else{if(j===16){for(R=k+2;x>>=k,x-=k,n.have===0){e.msg=`invalid bit length repeat`,n.mode=30;break}F=n.lens[n.have-1],E=3+(3&b),b>>>=2,x-=2}else if(j===17){for(R=k+3;x>>=k)),b>>>=3,x-=3}else{for(R=k+7;x>>=k)),b>>>=7,x-=7}if(n.have+E>n.nlen+n.ndist){e.msg=`invalid bit length repeat`,n.mode=30;break}for(;E--;)n.lens[n.have++]=F}}if(n.mode===30)break;if(n.lens[256]===0){e.msg=`invalid code -- missing end-of-block`,n.mode=30;break}if(n.lenbits=9,L={bits:n.lenbits},I=s(c,n.lens,0,n.nlen,n.lencode,0,n.work,L),n.lenbits=L.bits,I){e.msg=`invalid literal/lengths set`,n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,L={bits:n.distbits},I=s(l,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,L),n.distbits=L.bits,I){e.msg=`invalid distances set`,n.mode=30;break}if(n.mode=20,t===6)break e;case 20:n.mode=21;case 21:if(6<=v&&258<=y){e.next_out=_,e.avail_out=y,e.next_in=g,e.avail_in=v,n.hold=b,n.bits=x,o(e,C),_=e.next_out,m=e.output,y=e.avail_out,g=e.next_in,p=e.input,v=e.avail_in,b=n.hold,x=n.bits,n.mode===12&&(n.back=-1);break}for(n.back=0;A=(z=n.lencode[b&(1<>>16&255,j=65535&z,!((k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>M)])>>>16&255,j=65535&z,!(M+(k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=M,x-=M,n.back+=M}if(b>>>=k,x-=k,n.back+=k,n.length=j,A===0){n.mode=26;break}if(32&A){n.back=-1,n.mode=12;break}if(64&A){e.msg=`invalid literal/length code`,n.mode=30;break}n.extra=15&A,n.mode=22;case 22:if(n.extra){for(R=n.extra;x>>=n.extra,x-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;A=(z=n.distcode[b&(1<>>16&255,j=65535&z,!((k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>M)])>>>16&255,j=65535&z,!(M+(k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=M,x-=M,n.back+=M}if(b>>>=k,x-=k,n.back+=k,64&A){e.msg=`invalid distance code`,n.mode=30;break}n.offset=j,n.extra=15&A,n.mode=24;case 24:if(n.extra){for(R=n.extra;x>>=n.extra,x-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg=`invalid distance too far back`,n.mode=30;break}n.mode=25;case 25:if(y===0)break e;if(E=C-y,n.offset>E){if((E=n.offset-E)>n.whave&&n.sane){e.msg=`invalid distance too far back`,n.mode=30;break}D=E>n.wnext?(E-=n.wnext,n.wsize-E):n.wnext-E,E>n.length&&(E=n.length),O=n.window}else O=m,D=_-n.offset,E=n.length;for(yv?(b=L[R+d[w]],N[P+d[w]]):(b=96,0),p=1<>k)+(m-=p)]=y<<24|b<<16|x|0,m!==0;);for(p=1<>=1;if(p===0?M=0:(M&=p-1,M+=p),w++,--F[C]==0){if(C===E)break;C=t[n+d[w]]}if(D>>7)]}function L(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function R(e,t,n){e.bi_valid>h-n?(e.bi_buf|=t<>h-e.bi_valid,e.bi_valid+=n-h):(e.bi_buf|=t<>>=1,n<<=1,0<--t;);return n>>>1}function V(e,t,n){var r,i,a=Array(m+1),o=0;for(r=1;r<=m;r++)a[r]=o=o+n[r-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];s!==0&&(e[2*i]=B(a[s]++,s))}}function H(e){var t;for(t=0;t>1;1<=n;n--)te(e,a,n);for(i=c;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],te(e,a,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,a[2*i]=a[2*n]+a[2*r],e.depth[i]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,a[2*n+1]=a[2*r+1]=i,e.heap[1]=i++,te(e,a,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,i,a,o,s,c=t.dyn_tree,l=t.max_code,u=t.stat_desc.static_tree,d=t.stat_desc.has_stree,f=t.stat_desc.extra_bits,h=t.stat_desc.extra_base,g=t.stat_desc.max_length,_=0;for(a=0;a<=m;a++)e.bl_count[a]=0;for(c[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n>=7;r>>=1)if(1&n&&e.dyn_ltree[2*t]!==0)return i;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return a;for(t=32;t>>3,(s=e.static_len+3+7>>>3)<=o&&(o=s)):o=s=n+5,n+4<=o&&t!==-1?se(e,t,n,r):e.strategy===4||s===o?(R(e,2+(r?1:0),3),ne(e,T,E)):(R(e,4+(r?1:0),3),function(e,t,n,r){var i;for(R(e,t-257,5),R(e,n-1,5),R(e,r-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,t===0?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(O[n]+l+1)]++,e.dyn_dtree[2*I(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){R(e,2,3),z(e,_,T),function(e){e.bi_valid===16?(L(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,n){t.exports=function(){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}},{}],54:[function(e,t,n){(function(e){(function(e,t){if(!e.setImmediate){var n,r,i,a,o=1,s={},c=!1,l=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,n={}.toString.call(e.process)===`[object process]`?function(e){process.nextTick(function(){f(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage(``,`*`),e.onmessage=n,t}}()?(a=`setImmediate$`+Math.random()+`$`,e.addEventListener?e.addEventListener(`message`,p,!1):e.attachEvent(`onmessage`,p),function(t){e.postMessage(a+t,`*`)}):e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){f(e.data)},function(e){i.port2.postMessage(e)}):l&&`onreadystatechange`in l.createElement(`script`)?(r=l.documentElement,function(e){var t=l.createElement(`script`);t.onreadystatechange=function(){f(e),t.onreadystatechange=null,r.removeChild(t),t=null},r.appendChild(t)}):function(e){setTimeout(f,0,e)},u.setImmediate=function(e){typeof e!=`function`&&(e=Function(``+e));for(var t=Array(arguments.length-1),r=0;r`u`?e===void 0?this:e:self)}).call(this,typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:{})},{}]},{},[10])(10)})})),Rd=u(Ld(),1);const zd=`username_claim`,Bd=1,Vd=1800,Hd=3500;function Ud(e){return typeof e==`object`&&!!e}function Wd(e){return typeof e==`string`}function Gd(e){return typeof e==`number`&&Number.isFinite(e)}function Kd(e){return e===void 0||Wd(e)}function qd(e){return e===void 0||Gd(e)}function Jd(e){return e===void 0||e===`x`||e===`manual`}function Yd(e){return Ud(e)?e.kind===`username_claim`&&Wd(e.username)&&Wd(e.normalized)&&Wd(e.originHash)&&(e.ownerHint===void 0||e.ownerHint===null||Wd(e.ownerHint)):!1}function Xd(e){return Ud(e)?Wd(e.hash)&&(e.url===void 0||Wd(e.url))&&Yd(e.payload)&&(e.ownerHint===void 0||e.ownerHint===null||Wd(e.ownerHint)):!1}function Zd(e){return Ud(e)?e.kind===`text`&&Wd(e.text):!1}function Qd(e){return Ud(e)?e.kind===`code`&&Wd(e.code)&&Kd(e.lang):!1}function $d(e){if(!Ud(e))return!1;let t=e.mode,n=t===void 0||t===`code`||t===`sanitized`;return e.kind===`html`&&Wd(e.html)&&n}function ef(e){return Ud(e)?e.kind===`md`&&Wd(e.md):!1}function tf(e){return Zd(e)||Qd(e)||$d(e)||ef(e)}function nf(e){return e===void 0||tf(e)}function rf(e){return Ud(e)?e.kind===`url`&&Wd(e.url)&&Kd(e.title):!1}function af(e){if(!Ud(e))return!1;let t=e.kind===`file-ref`,n=e.sha256;return!!t&&Wd(n)&&/^[0-9a-f]{64}$/.test(n)&&Kd(e.name)&&Kd(e.type)&&qd(e.size)&&(e.url===void 0||Wd(e.url))}function of(e){return Ud(e)?e.kind===`file-inline`&&Kd(e.name)&&Kd(e.type)&&qd(e.size)&&Wd(e.data_b64url)&&(e.thumbnail_b64===void 0||Wd(e.thumbnail_b64)):!1}function sf(e){return rf(e)||af(e)||of(e)}function cf(e){return!(!Ud(e)||e.version!==1||!Array.isArray(e.items)||!e.items.every(sf)||!qd(e.totalBytes)||!qd(e.inlinedBytes))}function lf(e){return e===void 0||Ud(e)}function uf(e){return Ud(e)?e.v===2&&Wd(e.url)&&Gd(e.pulse)&&Jd(e.source)&&Kd(e.caption)&&nf(e.body)&&Kd(e.author)&&Kd(e.sigilId)&&Kd(e.phiKey)&&Kd(e.kaiSignature)&&Kd(e.parent)&&Kd(e.parentUrl)&&Kd(e.originUrl)&&qd(e.ts)&&(e.attachments===void 0||cf(e.attachments))&&lf(e.seal)&&(e.usernameClaim===void 0||Xd(e.usernameClaim)):!1}function df(e){return Ud(e)?e.v===1&&Wd(e.url)&&Gd(e.pulse)&&Jd(e.source)&&Kd(e.caption)&&Kd(e.author)&&Kd(e.sigilId)&&Kd(e.phiKey)&&Kd(e.kaiSignature)&&Kd(e.parent)&&Kd(e.parentUrl)&&Kd(e.originUrl)&&qd(e.ts)&&(e.attachments===void 0||cf(e.attachments)):!1}var ff=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,pf=(()=>{let e=new Int16Array(256);for(let t=0;t<256;t++)e[t]=-1;for(let t=0;t<64;t++)e[ff.charCodeAt(t)]=t;return e})();function mf(e){let t=[],n=e.length,r=0;for(;r+2>>18&63]+ff[n>>>12&63]+ff[n>>>6&63]+ff[n&63])}let i=n-r;if(i===1){let n=e[r]<<16;t.push(ff[n>>>18&63]+ff[n>>>12&63]+`==`)}else if(i===2){let n=e[r]<<16|e[r+1]<<8;t.push(ff[n>>>18&63]+ff[n>>>12&63]+ff[n>>>6&63]+`=`)}return t.join(``).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function hf(e){let t=(e??``).trim();if(!t)return new Uint8Array;let n=t.replace(/-/g,`+`).replace(/_/g,`/`);n=n.replace(/[\r\n\s]/g,``);let r=(4-n.length%4)%4;r&&(n+=`=`.repeat(r));let i=n.length;if(i%4!=0)throw Error(`Invalid base64 length`);let a=i/4*3;i>=2&&n[i-2]===`=`&&n[i-1]===`=`?a-=2:i>=1&&n[i-1]===`=`&&--a;let o=new Uint8Array(a),s=0;for(let e=0;e>>16&255,d!==64&&s>>8&255),f!==64&&s1e6)return null;let t=hf(e);if(t.length===0)return null;let n=new TextDecoder().decode(t),r=JSON.parse(n);return uf(r)?r:df(r)?_f(r):null}catch{return null}}function yf(e){if(e instanceof ArrayBuffer)return e;let t=new Uint8Array(e),n=new ArrayBuffer(t.byteLength);return new Uint8Array(n).set(t),n}function bf(e){let t=new Uint8Array(e),n=``;for(let e=0;e{let{createHash:e}=await import(`./__vite-browser-external-BPnTbBa4.js`).then(f(1));return{createHash:e}},[]);return n(`sha256`).update(new Uint8Array(t)).digest(`hex`)}function Sf(e,t){let n=yf(e);try{return new Blob([n],{type:t||`application/octet-stream`})}catch{return new Blob([n])}}function Cf(e){return hf(e)}function wf(e){let t=0,n=0,r=e.attachments?.items??[];for(let e of r)e.kind===`file-ref`?t+=e.size??0:e.kind===`file-inline`&&(t+=e.size??0,n+=e.data_b64url.length*.75,e.thumbnail_b64&&(n+=e.thumbnail_b64.length*.75));return{totalBytes:Math.round(t),inlinedBytes:Math.round(n)}}function Tf(e){if(!e.attachments)return e;let t=e.attachments.items.map(e=>{if(e.kind===`file-inline`&&e.thumbnail_b64){let t={...e};return delete t.thumbnail_b64,t}return e}),{totalBytes:n,inlinedBytes:r}=wf({attachments:{...e.attachments,items:t}});return{...e,attachments:{version:1,items:t,totalBytes:n,inlinedBytes:r}}}async function Ef(e,t={}){let n=t.cacheName??`sigil-attachments-v1`,r=(t.pathPrefix??`/att/`).replace(/\/+$/,``)+`/`,i=Tf(e);if(!i.attachments||i.attachments.items.length===0||!(globalThis.caches!==void 0&&typeof globalThis.caches.open==`function`))return i;let a=null;try{a=await globalThis.caches.open(n)}catch{a=null}let o=[];for(let e of i.attachments.items){if(e.kind!==`file-inline`){o.push(e);continue}if(!a){o.push(e);continue}try{let t=Cf(e.data_b64url),n=await xf(t.buffer),i=Sf(t.buffer,e.type),s=`${r}${n}`;await a.put(new Request(s,{method:`GET`}),new Response(i,{headers:e.type?{"Content-Type":e.type}:void 0}));let c={kind:`file-ref`,name:e.name,type:e.type,size:e.size,sha256:n,url:s};o.push(c)}catch{o.push(e)}}return{...i,attachments:Rf(o)}}function Df(e){let t=gf(Tf(e));return{token:t,withinSoft:t.length<=Vd,withinHard:t.length<=Hd}}function Of(e){let t=(e??``).trim();if(!t)return``;if(/%[0-9A-Fa-f]{2}/.test(t))try{t=decodeURIComponent(t)}catch{}return t.includes(` `)&&(t=t.replace(/ /g,`+`)),/[+/=]/.test(t)&&(t=t.replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)),t}function kf(e){try{let t=e??(typeof window<`u`&&window.location?window.location:null);if(!t)return null;let n=t.hash.startsWith(`#`)?t.hash.slice(1):t.hash,r=t.search.startsWith(`?`)?t.search.slice(1):t.search,i=new URLSearchParams(n),a=new URLSearchParams(r),o=i.get(`t`)??i.get(`p`)??i.get(`token`);if(o)return Of(o);let s=a.get(`t`)??a.get(`p`)??a.get(`token`);if(s)return Of(s);let c=t.pathname.match(/^\/(?:stream|feed)\/p\/([^/?#]+)\/?$/);if(c?.[1])return Of(c[1]);let l=t.pathname.match(/^\/p~([^/?#]+)\/?$/);return l?.[1]?Of(l[1]):null}catch{return null}}function Af(e){let t=(e??``).trim();if(!t)return null;let n=t.split(`?`)[0].split(`#`)[0],r=e=>{try{return decodeURIComponent(e)}catch{return e}},i=n.match(/^\/p~([^/?#]+)\/?$/);if(i?.[1])return Of(r(i[1]));let a=n.match(/^\/(?:stream|feed)\/p\/([^/?#]+)\/?$/);return a?.[1]?Of(r(a[1])):null}function jf(e){let t=typeof window<`u`?window.location?.origin??void 0:void 0,n=e.trim();if(!n)return null;if(/^[A-Za-z0-9_-]{16,}$/u.test(n))return Of(n);let r;try{r=new URL(n)}catch{try{r=new URL(n,t)}catch{return null}}let i=r.pathname||``;{let e=i.match(/\/(?:stream|feed)\/p\/([^/?#]+)/u);if(e?.[1])return Of(e[1])}{let e=i.match(/\/p\/([^/?#]+)/u);if(e?.[1])return Of(e[1])}{let e=i.match(/\/p(?:\u007e|%7[Ee])\/?([^/?#]+)/u);if(e?.[1])return Of(e[1])}let a=r.hash&&r.hash.startsWith(`#`)?r.hash.slice(1):``,o=new URLSearchParams(a);for(let e of[`t`,`p`,`token`,`capsule`]){let t=o.get(e);if(t)return Of(t);let n=r.searchParams.get(e);if(n)return Of(n)}return null}async function Mf(e,t={}){let n=Tf(e);if(Df(n).withinHard||!(n.attachments?.items?.some(e=>e.kind===`file-inline`)??!1))return n;if(!(globalThis.caches!==void 0&&typeof globalThis.caches.open==`function`))throw Error(`Inline attachments exceed safe token size, but CacheStorage is unavailable on this device/session. Attach via a public URL (Drive/S3/IPFS) or use smaller files.`);let r=await Ef(n,t),i=Df(r),a=r.attachments?.items?.some(e=>e.kind===`file-inline`)??!1;if(!i.withinHard&&a)throw Error(`Inline attachments are still too large to share safely (and could not be cached). Attach via public URL or reduce inline file size/count.`);return Tf(r)}function Nf(e){return{kind:`text`,text:e}}function Pf(e,t){return{kind:`code`,code:e,lang:t}}function Ff(e,t){return{kind:`html`,html:e,mode:t}}function If(e){return{kind:`md`,md:e}}function Lf(e){let t=e.parentUrl??e.parent,n=e.caption??(e.body?.kind===`text`&&e.body.text.length>0?e.body.text:void 0);return{v:2,url:e.url,pulse:e.pulse,caption:n,body:e.body,author:e.author,source:e.source,sigilId:e.sigilId,phiKey:e.phiKey,kaiSignature:e.kaiSignature,parent:e.parent,parentUrl:t,originUrl:e.originUrl,ts:e.ts,attachments:e.attachments,seal:e.seal,usernameClaim:e.usernameClaim}}function Rf(e){let t={version:1,items:e.slice()},{totalBytes:n,inlinedBytes:r}=wf({attachments:t});return t.totalBytes=n,t.inlinedBytes=r,t}function zf(e){return{kind:`file-inline`,name:e.name,type:e.type,size:e.size,data_b64url:e.data_b64url,thumbnail_b64:e.thumbnail_b64}}function Bf(e){if(!/^[0-9a-f]{64}$/.test(e.sha256))throw Error(`sha256 must be 64 hex chars`);return{kind:`file-ref`,sha256:e.sha256,name:e.name,type:e.type,size:e.size,url:e.url}}function Vf(e){return{kind:`url`,url:e.url,title:e.title}}function Hf(e){let t=JSON.stringify(e);return`h:${Jf(Kf(new TextEncoder().encode(t)))}`}function Uf(e){if(!e.startsWith(`h:`))throw Error(`Invalid history param`);let t=qf(Yf(e.slice(2))),n=new TextDecoder().decode(t);return JSON.parse(n)}var Wf=e=>typeof globalThis.btoa==`function`?globalThis.btoa(e):Buffer.from(e,`binary`).toString(`base64`),Gf=e=>typeof globalThis.atob==`function`?globalThis.atob(e):Buffer.from(e,`base64`).toString(`binary`),Kf=e=>Wf(String.fromCharCode(...e)),qf=e=>Uint8Array.from(Gf(e),e=>e.charCodeAt(0)),Jf=e=>e.replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``),Yf=e=>{let t=e.replace(/-/g,`+`).replace(/_/g,`/`);return t+(t.length%4?`=`.repeat(4-t.length%4):``)};function Xf(e){let t={u:e.pulse,b:e.beat,s:e.stepIndex,c:e.chakraDay,d:e.stepsPerBeat??44,k:e.kaiSignature,p:e.userPhiKey};e.parentUrl&&(t.r=e.parentUrl),e.originUrl&&(t.o=e.originUrl);let n=JSON.stringify(t);return`c:${Jf(Kf(new TextEncoder().encode(n)))}`}function Zf(e){if(e.startsWith(`c:`)){let t=qf(Yf(e.slice(2))),n=new TextDecoder().decode(t),r=JSON.parse(n);return{pulse:Number(r.u)||0,beat:Number(r.b)||0,stepIndex:Number(r.s)||0,chakraDay:r.c,stepsPerBeat:Number(r.d)||44,kaiSignature:typeof r.k==`string`?r.k:void 0,userPhiKey:typeof r.p==`string`?r.p:void 0,parentUrl:typeof r.r==`string`?r.r:void 0,originUrl:typeof r.o==`string`?r.o:void 0}}let t=qf(Yf(e.startsWith(`j:`)?e.slice(2):e)),n=new TextDecoder().decode(t),r=JSON.parse(n),i={pulse:Number(r.pulse)||0,beat:Number(r.beat)||0,stepIndex:Number(r.stepIndex)||0,chakraDay:r.chakraDay,stepsPerBeat:Number(r.stepsPerBeat)||44,kaiSignature:typeof r.kaiSignature==`string`?r.kaiSignature:void 0,userPhiKey:typeof r.userPhiKey==`string`?r.userPhiKey:void 0,parentUrl:typeof r.parentUrl==`string`?r.parentUrl:void 0,originUrl:typeof r.originUrl==`string`?r.originUrl:void 0},a={expiresAtPulse:r.expiresAtPulse==null?void 0:Number(r.expiresAtPulse),canonicalHash:typeof r.canonicalHash==`string`?r.canonicalHash:void 0,transferNonce:typeof r.transferNonce==`string`?r.transferNonce:void 0,exportedAtPulse:r.exportedAtPulse==null?void 0:Number(r.exportedAtPulse),claimExtendUnit:r.claimExtendUnit===`breaths`||r.claimExtendUnit===`steps`?r.claimExtendUnit:void 0,claimExtendAmount:r.claimExtendAmount==null?void 0:Number(r.claimExtendAmount)};return{...r,...a,...i}}function Qf(e,t,n){let r=typeof window<`u`&&window.location?.origin?window.location.origin:``,i=n?.absolute===!1?``:n?.origin??r,a={...t},o=n?.parentUrl||(n?.autoInferParent&&typeof window<`u`?window.location.href:void 0);if(o&&!a.parentUrl){a.parentUrl=o;try{let e=np(o);a.originUrl=a.originUrl||e?.originUrl||o}catch{a.originUrl=a.originUrl||o}}let s=Xf(a),c=`/s/${encodeURIComponent(e)}?p=${s}`;return i?`${i}${c}`:c}function $f(e){try{return new URL(e,`resolve://`).searchParams.get(`p`)??null}catch{let t=e.match(/[?&]p=([^&#]+)/);return t?decodeURIComponent(t[1]):null}}function ep(e){try{let t=new URL(e,`https://example.invalid`);if(t.hash){let e=new URLSearchParams(t.hash.replace(/^#/,``)).get(`t`);if(e)return e}return Af(t.pathname)||(t.searchParams.get(`p`)??null)}catch{let t=e.match(/#(?:t|p)=([^&#]+)/);if(t)return decodeURIComponent(t[1]);let n=e.match(/\/p~([^/?#]+)/);if(n)return decodeURIComponent(n[1]);let r=e.match(/\/(?:stream|feed)\/p\/([^/]+)/);if(r)return decodeURIComponent(r[1]);let i=e.match(/[?&]p=([^&#]+)/);return i?decodeURIComponent(i[1]):null}}function tp(e){let t=ep(e);if(!t)return null;let n=vf(t);if(!n)return null;let r=0,i=0,a=`Root`,o=44;try{let e=Ir(n.pulse);typeof e.beat==`number`?r=e.beat:typeof e.beatIndex==`number`&&(r=e.beatIndex),typeof e.stepIndex==`number`&&(i=e.stepIndex),typeof e.chakraDay==`string`&&(a=e.chakraDay),typeof e.stepsPerBeat==`number`&&(o=e.stepsPerBeat)}catch{}let s=typeof n.parentUrl==`string`?n.parentUrl:typeof n.parent==`string`?n.parent:void 0;return{pulse:n.pulse,beat:r,stepIndex:i,chakraDay:a,stepsPerBeat:o,kaiSignature:typeof n.kaiSignature==`string`?n.kaiSignature:void 0,userPhiKey:typeof n.phiKey==`string`?n.phiKey:void 0,parentUrl:s,originUrl:typeof n.originUrl==`string`?n.originUrl:void 0,feed:n}}function np(e){let t=$f(e);if(t)try{return Zf(t)}catch{}return tp(e)}function rp(e){let t=[],n=e,r=new Set;for(;n&&!r.has(n);){r.add(n),t.push(n);let e=np(n);if(!e?.parentUrl)break;n=e.parentUrl}return t}function ip(e){let t=np(e);if(t?.originUrl)return t.originUrl;let n=rp(e);return n.length?n[n.length-1]:void 0}const ap=`kai:sigils:v1`,op=`sigil:urls`,sp=`kai-sigil-registry`;var cp=typeof window<`u`;function lp(e){if(!cp)return[];try{let t=window.localStorage.getItem(e);if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(e=>typeof e==`string`):[]}catch{return[]}}function up(e,t){if(cp)try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}}function dp(e,t){return e.includes(t)?!1:(e.push(t),!0)}function fp(e){try{return new URL(e,cp?window.location.origin:`https://example.invalid`).toString()}catch{return e}}var pp=null;function mp(){return!cp||!(`BroadcastChannel`in window)?null:pp||(pp=new BroadcastChannel(sp),pp)}function hp(e){if(!cp||!e)return;let t=fp(e),n=lp(ap);dp(n,t)&&up(ap,n);let r=lp(op);dp(r,t)&&up(op,r);try{window.dispatchEvent(new CustomEvent(`sigil:url-registered`,{detail:{url:t}}))}catch{}try{mp()?.postMessage({type:`sigil:add`,url:t})}catch{}}function gp(e){try{let t=new URL(e),n=t.pathname.match(/\/(?:s|sigil)\/([a-f0-9]{6,})/i)?.[1],r=np(e);if(n&&r)return Qf(n,r);let i=t.hash?.slice(1).match(/^([a-f0-9]{6,})$/i)?.[1];return i&&r?Qf(i,r):null}catch(e){return console.error(`Failed to generate canonical QR URL:`,e),null}}function _p(e){if(e)try{return new URL(e).origin}catch{}return typeof window<`u`&&typeof window.location?.origin==`string`&&window.location.origin?window.location.origin:`https://kaiklok.com`}function vp(e,t){let n=_p(t),r=(e??``).toString().trim().toLowerCase();if(!r)return n+`/`;let i=new URL(`/s/${encodeURIComponent(r)}`,n);if(typeof window<`u`){let e=new URLSearchParams(window.location.search),t=e.get(`d`);t&&i.searchParams.set(`d`,t);let n=e.get(`t`);n&&i.searchParams.set(`t`,n)}return i.toString()}const yp=(1+Math.sqrt(5))/2,bp=`ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial`,xp=1e3,Sp=xp/2,Cp={Root:{sides:4,hue:0},Sacral:{sides:6,hue:30},"Solar Plexus":{sides:5,hue:53},Heart:{sides:8,hue:122},Throat:{sides:12,hue:180},"Third Eye":{sides:14,hue:222},Crown:{sides:16,hue:258}},wp={Root:`Earth Gate`,Sacral:`Water Gate`,"Solar Plexus":`Fire Gate`,Heart:`Air Gate`,Throat:`Will Gate`,"Third Eye":`Light Gate`,Crown:`Ether Gate`},Tp={Root:194.18,Sacral:210.42,"Solar Plexus":378.4,Heart:620.9,Throat:1292.3,"Third Eye":1664.7,Crown:2594.2},Ep={Solhara:`Root`,Aquaris:`Solar Plexus`,Flamora:`Heart`,Verdari:`Throat`,Sonari:`Third Eye`,Kaelith:`Crown`},Dp=e=>e===`Solhara`||e===`Aquaris`||e===`Flamora`||e===`Verdari`||e===`Sonari`||e===`Kaelith`,Op=e=>Dp(e)?Ep[e]:e,kp=(e,t=100,n=50)=>`hsl(${e} ${t}% ${n}%)`,Ap=(e,t=0,n=.38)=>{let r=xp*n,i=[];for(let n=0;n{let r=[];for(let i=0;i<360;i+=1){let a=i/359*2*Math.PI,o=(Math.sin(e*a+n)+1)/2*xp,s=(Math.sin(t*a)+1)/2*xp;r.push(`${i?`L`:`M`}${o},${s}`)}return`${r.join(``)}Z`};function Mp(e){let t=((Number.isFinite(e)?Math.trunc(e):0)%484+484)%484,n=Math.floor(t/11);return Math.min(Math.max(0,n),43)}function Np(e){let t=((Number.isFinite(e)?Math.trunc(e):0)%484+484)%484%11/11;return t>=1?1-2**-52:t<0?0:t}const Pp=(e,t)=>+(Tp[e]*yp**((Number.isFinite(t)?t:0)/44)).toFixed(3),Fp=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Ip=e=>JSON.stringify(e,(e,t)=>t instanceof Date?t.toISOString():typeof t==`bigint`?t.toString():t),Lp=(e,t)=>{if(!Fp(e))return;let n=e[t];return typeof n==`string`?n:void 0},Rp=(e,t)=>{if(!Fp(e))return;let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0},zp=e=>`${e}`;var Bp=e=>e instanceof Date?e.toISOString():String(e);function Vp(e,t,n=6){let r={},i=(e,t)=>{r[`data-${e}`]=t},a=(e,t,r)=>{if(!(r>n)){if(Array.isArray(t)){i(e,JSON.stringify(t.map(e=>e instanceof Date?e.toISOString():e)));return}if(Fp(t)){for(let[n,i]of Object.entries(t))a(`${e}-${n.replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-+|-+$/g,``).toLowerCase()}`,i,r+1);return}typeof t==`number`||typeof t==`string`||t===void 0||t===`null`||t===null?i(e,t===null?void 0:typeof t==`number`?t:Bp(t)):i(e,Bp(t))}};for(let[n,r]of Object.entries(t))a(`${e}-${n.replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-+|-+$/g,``).toLowerCase()}`,r,1);return r}const Hp=(e,t=220)=>e?e.replace(/\s+/g,` `).trim().slice(0,t):void 0,Up=(e,t=NaN)=>typeof e==`number`&&Number.isFinite(e)?Math.trunc(e):t,Wp=(e,t=NaN)=>typeof e==`number`&&Number.isFinite(e)?Math.max(0,Math.min(1-2**-52,e)):t,Gp=e=>[...e].map(e=>e.toString(16)).map(e=>e.padStart(2,`0`)).join(``);function Kp(e){return!(typeof SharedArrayBuffer<`u`&&e.buffer instanceof SharedArrayBuffer)&&e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.slice().buffer}async function qp(e){let t=typeof e==`string`?new TextEncoder().encode(e):e,n=await crypto.subtle.digest(`SHA-256`,Kp(t));return new Uint8Array(n)}var Jp=`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`;function Yp(e){let t=0n;for(let n of e)t=(t<<8n)+BigInt(n);let n=``;for(;t>0n;){let e=t%58n;n=Jp[Number(e)]+n,t/=58n}for(let t=0;t>>0;return function(){t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|t)^e,((e^e>>>14)>>>0)/4294967296}}const Qp=e=>{let t=e.replace(/^0x/i,``),n=new Uint8Array(t.length/2);for(let e=0;e>>0;for(let n=0;n>>1:t>>>1}return~t>>>0}const em=e=>{let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=t.length%4;n&&(t+=`=`.repeat(4-n));let r=atob(t),i=new Uint8Array(r.length);for(let e=0;eString(e))),typeof e.ext==`boolean`&&(t.ext=e.ext),t}function rm(){let[e,t]=(0,C.useState)(!1),[n,r]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),n=window.matchMedia(`(prefers-contrast: more)`),i=()=>{t(!!e.matches),r(!!n.matches)};return i(),e.addEventListener?.(`change`,i),n.addEventListener?.(`change`,i),()=>{e.removeEventListener?.(`change`,i),n.removeEventListener?.(`change`,i)}},[]),{prefersReduce:e,prefersContrast:n}}var im=e=>typeof e==`object`&&!!e;function am(e){let[t,n]=(0,C.useState)(null),r=(0,C.useRef)(null);return(0,C.useEffect)(()=>{r.current=t},[t]),(0,C.useEffect)(()=>{if(e!==`moment`)return;let t=!1,r=async()=>{try{let e=await ji();!t&&im(e)&&n(e)}catch{}};r();let i=window.setInterval(r,qn);return()=>{t=!0,window.clearInterval(i)}},[e]),{kaiData:t,kaiDataRef:r}}function om(e){let t=e=>{let t=2166136261;for(let n=0;n>>0};return(0,C.useMemo)(()=>t(e),[e])}function sm(){return(0,C.useMemo)(()=>async e=>{let t=new TextEncoder().encode(e),n=await crypto.subtle.digest(`SHA-256`,Kp(t));return Array.from(new Uint8Array(n)).map(e=>e.toString(16)).map(e=>e.padStart(2,`0`)).join(``)},[])}var cm=({uid:e,size:t,phaseColor:n,outerRingText:r,innerRingText:i,animate:a,prefersReduce:o})=>{xp*.34;let s=340/yp,c=s*.96/(xp/2),l=`${e}-zk-phi-ring`,u=`${e}-zk-bin-ring`,d=`${e}-zk-grad`,f=`${e}-zk-petal-def`,p=Math.max(1,(t??240)*.008),m=Math.max(.9,(t??240)*.007),h=Math.max(1.2,(t??240)*.009),g=a&&!o,_=(0,C.useRef)(null);(0,C.useEffect)(()=>{if(!g)return;let e=_.current;if(!e)return;let t=0,n=performance.now(),r=qn/1e3,i=1/r*(yp*.21),a=1/r*((yp-1)*.17),o=1/r*(Math.SQRT2*.15),s=Math.PI/2,c=Math.PI/3,l=()=>{let r=(performance.now()-n)/1e3,u=5+1.6*(.5+.5*Math.sin(2*Math.PI*i*r)),d=8+1.2*(.5+.5*Math.sin(2*Math.PI*a*r+1.234)),f=s+c*Math.sin(2*Math.PI*o*r+.777);e.setAttribute(`d`,jp(u,d,f)),t=requestAnimationFrame(l)};return t=requestAnimationFrame(l),()=>cancelAnimationFrame(t)},[g]);let v=Math.max(8,(t??240)*.026),y=Math.max(7,(t??240)*.022),b=e=>e*.62,x=(e,t)=>{let n=2*Math.PI*e;return Math.max(48,Math.floor(n/b(t)))},S=(e,t)=>{let n=(e??``).trim();if(!n)return``;let r=[`sig=`,`b58=`,`len=`,`crc32=`,`creator=`,`zk=`,`alg=`,`day=`,`beat=`,`hz=`,`poseidon=`],i=n.split(` · `).map(e=>e.trim()).filter(Boolean),a=i.filter(e=>r.some(t=>e.startsWith(t))),o=(a.length?a:i).join(` · `);return o.length<=t?o:o.slice(0,Math.max(0,t-1)).trimEnd()+`…`},w=(0,C.useMemo)(()=>S(r,x(340,v)),[r,340,v]),T=(0,C.useMemo)(()=>S(i,x(s,y)),[i,s,y]),E=(e,t,n,r,i,a)=>{let o=Array.from(e);if(!o.length)return null;let s=-Math.PI/2,c=o.length,l=Math.max(.45,r*.085);return(0,W.jsx)(`g`,{"aria-hidden":`true`,pointerEvents:`none`,children:o.map((e,o)=>{let u=s+o/c*Math.PI*2;return(0,W.jsx)(`text`,{transform:`translate(${500+t*Math.cos(u)} ${500+t*Math.sin(u)}) rotate(${u*180/Math.PI+90})`,fontFamily:n,fontSize:r,fill:i,opacity:a,textAnchor:`middle`,dominantBaseline:`middle`,letterSpacing:`0`,stroke:`#001014`,strokeOpacity:`0.6`,strokeWidth:l,paintOrder:`stroke`,children:e},`${o}-${e}`)})})};return(0,W.jsxs)(`g`,{id:`${e}-zk-glyph`,"aria-label":`Atlantean zero-knowledge verification glyph`,pointerEvents:`none`,children:[(0,W.jsxs)(`defs`,{children:[(0,W.jsxs)(`radialGradient`,{id:d,cx:`50%`,cy:`50%`,r:`60%`,children:[(0,W.jsx)(`stop`,{offset:`0%`,stopColor:n,stopOpacity:`0.85`,children:g&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`animate`,{attributeName:`stop-opacity`,values:`.55;.85;.55`,dur:`${qn}ms`,repeatCount:`indefinite`}),(0,W.jsx)(`animate`,{attributeName:`stop-color`,values:`${n};#00FFD0;${n}`,dur:`${qn*3}ms`,repeatCount:`indefinite`})]})}),(0,W.jsx)(`stop`,{offset:`55%`,stopColor:n,stopOpacity:`0.55`,children:g&&(0,W.jsx)(`animate`,{attributeName:`stop-color`,values:`${n};#00FFD0;${n}`,dur:`${qn*3}ms`,repeatCount:`indefinite`})}),(0,W.jsx)(`stop`,{offset:`100%`,stopColor:`#00FFD0`,stopOpacity:`0.25`,children:g&&(0,W.jsx)(`animate`,{attributeName:`stop-opacity`,values:`.15;.35;.15`,dur:`${qn}ms`,repeatCount:`indefinite`})})]}),(0,W.jsx)(`path`,{id:l,d:`M 500 160 a 340 340 0 1 1 0 ${2*340} a 340 340 0 1 1 0 -${2*340}`,fill:`none`}),(0,W.jsx)(`path`,{id:u,d:`M 500 ${500-s} a ${s} ${s} 0 1 1 0 ${2*s} a ${s} ${s} 0 1 1 0 -${2*s}`,fill:`none`}),(0,W.jsx)(`path`,{id:f,ref:_,d:jp(5,8,Math.PI/2)})]}),(0,W.jsx)(`circle`,{cx:500,cy:500,r:340,fill:`none`,stroke:`url(#${d})`,strokeWidth:h,opacity:`0.5`,vectorEffect:`non-scaling-stroke`}),Array.from({length:12},(e,t)=>(0,W.jsx)(`use`,{href:`#${f}`,transform:`translate(500,500) scale(${c}) rotate(${t*30}) translate(-500,-500)`,stroke:`url(#${d})`,strokeWidth:p,strokeLinecap:`round`,strokeLinejoin:`round`,opacity:`0.42`,fill:`none`,vectorEffect:`non-scaling-stroke`},t)),(0,W.jsxs)(`g`,{opacity:`0.25`,children:[(0,W.jsx)(`circle`,{cx:500-s/2.2,cy:500,r:s*.86,fill:`none`,stroke:n,strokeWidth:m}),(0,W.jsx)(`circle`,{cx:500+s/2.2,cy:500,r:s*.86,fill:`none`,stroke:`#00FFD0`,strokeWidth:m})]}),(0,W.jsx)(`circle`,{cx:500,cy:500,r:s,fill:`none`,stroke:`url(#${d})`,strokeWidth:m,opacity:`0.55`,vectorEffect:`non-scaling-stroke`}),w&&E(w,340,`ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`,v,n,.33),T&&E(T,s,`ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial`,y,`#00FFD0`,.28)]})};function lm(e){if(e instanceof Date)return e.toISOString();if(e===null||typeof e==`string`||typeof e==`boolean`)return e;if(typeof e==`number`)return Number.isFinite(e)?e:null;if(Array.isArray(e))return e.map(e=>lm(e));let t=e,n={},r=Object.keys(t).sort();for(let e of r){let r=t[e];r!==void 0&&(n[e]=lm(r))}return n}function um(e){let t=lm(e);return JSON.stringify(t)}function dm(e){return new TextEncoder().encode(um(e))}async function fm(e){let{blake3:t}=await O(async()=>{let{blake3:e}=await import(`./index.esm-jE_FWBZ6.js`);return{blake3:e}},[]);return t(e)}var pm=4,mm=0,hm=1,gm=2;function _m(e){let t=e.length;for(;--t>=0;)e[t]=0}var vm=0,ym=1,bm=2,xm=3,Sm=258,Cm=29,wm=256,Tm=wm+1+Cm,Em=30,Dm=19,Om=2*Tm+1,km=15,Am=16,jm=7,Mm=256,Nm=16,Pm=17,Fm=18,Im=new Uint8Array([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]),Lm=new Uint8Array([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]),Rm=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),zm=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Bm=512,Vm=Array((Tm+2)*2);_m(Vm);var Hm=Array(Em*2);_m(Hm);var Um=Array(Bm);_m(Um);var Wm=Array(Sm-xm+1);_m(Wm);var Gm=Array(Cm);_m(Gm);var Km=Array(Em);_m(Km);function qm(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 Jm,Ym,Xm;function Zm(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}var Qm=e=>e<256?Um[e]:Um[256+(e>>>7)],$m=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},eh=(e,t,n)=>{e.bi_valid>Am-n?(e.bi_buf|=t<>Am-e.bi_valid,e.bi_valid+=n-Am):(e.bi_buf|=t<{eh(e,n[t*2],n[t*2+1])},nh=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},rh=e=>{e.bi_valid===16?($m(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)},ih=(e,t)=>{let 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<=km;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;lc&&(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--)}},ah=(e,t,n)=>{let r=Array(km+1),i=0,a,o;for(a=1;a<=km;a++)i=i+n[a-1]<<1,r[a]=i;for(o=0;o<=t;o++){let t=e[o*2+1];t!==0&&(e[o*2]=nh(r[t]++,t))}},oh=()=>{let e,t,n,r,i,a=Array(km+1);for(n=0,r=0;r>=7;r{let t;for(t=0;t{e.bi_valid>8?$m(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},lh=(e,t,n,r)=>{let i=t*2,a=n*2;return e[i]{let r=e.heap[n],i=n<<1;for(;i<=e.heap_len&&(i{let r,i,a=0,o,s;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+ a++]&255,r+=(e.pending_buf[e.sym_buf+ a++]&255)<<8,i=e.pending_buf[e.sym_buf+ a++],r===0?th(e,i,t):(o=Wm[i],th(e,o+wm+1,t),s=Im[o],s!==0&&(i-=Gm[o],eh(e,i,s)),r--,o=Qm(r),th(e,o,n),s=Lm[o],s!==0&&(r-=Km[o],eh(e,r,s)));while(a{let 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=Om,o=0;o>1;o>=1;o--)uh(e,n,o);l=a;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],uh(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++,uh(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],ih(e,t),ah(n,c,e.bl_count)},ph=(e,t,n)=>{let 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{let 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{let t;for(ph(e,e.dyn_ltree,e.l_desc.max_code),ph(e,e.dyn_dtree,e.d_desc.max_code),fh(e,e.bl_desc),t=Dm-1;t>=3&&e.bl_tree[zm[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},gh=(e,t,n,r)=>{let i;for(eh(e,t-257,5),eh(e,n-1,5),eh(e,r-4,4),i=0;i{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return mm;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return hm;for(n=32;n{vh||=(oh(),!0),e.l_desc=new Zm(e.dyn_ltree,Jm),e.d_desc=new Zm(e.dyn_dtree,Ym),e.bl_desc=new Zm(e.bl_tree,Xm),e.bi_buf=0,e.bi_valid=0,sh(e)},bh=(e,t,n,r)=>{eh(e,(vm<<1)+(r?1:0),3),ch(e),$m(e,n),$m(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},xh={_tr_init:yh,_tr_stored_block:bh,_tr_flush_block:(e,t,n,r)=>{let i,a,o=0;e.level>0?(e.strm.data_type===gm&&(e.strm.data_type=_h(e)),fh(e,e.l_desc),fh(e,e.d_desc),o=hh(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?bh(e,t,n,r):e.strategy===pm||a===i?(eh(e,(ym<<1)+(r?1:0),3),dh(e,Vm,Hm)):(eh(e,(bm<<1)+(r?1:0),3),gh(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),dh(e,e.dyn_ltree,e.dyn_dtree)),sh(e),r&&ch(e)},_tr_tally:(e,t,n)=>(e.pending_buf[e.sym_buf+ e.sym_next++]=t,e.pending_buf[e.sym_buf+ e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+ e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(Wm[n]+wm+1)*2]++,e.dyn_dtree[Qm(t)*2]++),e.sym_next===e.sym_end),_tr_align:e=>{eh(e,ym<<1,3),th(e,Mm,Vm),rh(e)}},Sh=(e,t,n,r)=>{let i=e&65535|0,a=e>>>16&65535|0,o=0;for(;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},Ch=new Uint32Array((()=>{let e,t=[];for(var 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})()),wh=(e,t,n,r)=>{let i=Ch,a=r+n;e^=-1;for(let n=r;n>>8^i[(e^t[n])&255];return e^-1},Th={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`},Eh={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:Dh,_tr_stored_block:Oh,_tr_flush_block:kh,_tr_tally:Ah,_tr_align:jh}=xh,{Z_NO_FLUSH:Mh,Z_PARTIAL_FLUSH:Nh,Z_FULL_FLUSH:Ph,Z_FINISH:Fh,Z_BLOCK:Ih,Z_OK:Lh,Z_STREAM_END:Rh,Z_STREAM_ERROR:zh,Z_DATA_ERROR:Bh,Z_BUF_ERROR:Vh,Z_DEFAULT_COMPRESSION:Hh,Z_FILTERED:Uh,Z_HUFFMAN_ONLY:Wh,Z_RLE:Gh,Z_FIXED:Kh,Z_DEFAULT_STRATEGY:qh,Z_UNKNOWN:Jh,Z_DEFLATED:Yh}=Eh,Xh=9,Zh=15,Qh=8,$h=286,eg=30,tg=19,ng=2*$h+1,rg=15,ig=3,ag=258,og=ag+ig+1,sg=32,cg=42,lg=57,ug=69,dg=73,fg=91,pg=103,mg=113,hg=666,gg=1,_g=2,vg=3,yg=4,bg=3,xg=(e,t)=>(e.msg=Th[t],t),Sg=e=>e*2-(e>4?9:0),Cg=e=>{let t=e.length;for(;--t>=0;)e[t]=0},wg=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=i?n-i:0;while(--t);t=i,r=t;do n=e.prev[--r],e.prev[r]=n>=i?n-i:0;while(--t)},Tg=(e,t,n)=>(t<{let t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,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))},Dg=(e,t)=>{kh(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Eg(e.strm)},Og=(e,t)=>{e.pending_buf[e.pending++]=t},kg=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},Ag=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),e.state.wrap===1?e.adler=Sh(e.adler,t,i,n):e.state.wrap===2&&(e.adler=wh(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},jg=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,a,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-og?e.strstart-(e.w_size-og):0,l=e.window,u=e.w_mask,d=e.prev,f=e.strstart+ag,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])continue;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]&&ro){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},Mg=e=>{let t=e.w_size,n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-og)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),wg(e),r+=t),e.strm.avail_in===0)break;if(n=Ag(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=ig)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Tg(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Tg(e,e.ins_h,e.window[i+ig-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,a,o=0,s=e.strm.avail_in;do{if(r=65535,a=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(r=i+e.strm.avail_in),r>a&&(r=a),r>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,Eg(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(Ag(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(o===0);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_watera&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,a+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),a>e.strm.avail_in&&(a=e.strm.avail_in),a&&(Ag(e.strm,e.window,e.strstart,a),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.high_water>3,a=e.pending_buf_size-a>65535?65535:e.pending_buf_size-a,n=a>e.w_size?e.w_size:a,i=e.strstart-e.block_start,(i>=n||(i||t===Fh)&&t!==Mh&&e.strm.avail_in===0&&i<=a)&&(r=i>a?a:i,o=t===Fh&&e.strm.avail_in===0&&r===i?1:0,Oh(e,e.block_start,r,o),e.block_start+=r,Eg(e.strm)),o?vg:gg)},Pg=(e,t)=>{let n,r;for(;;){if(e.lookahead=ig&&(e.ins_h=Tg(e,e.ins_h,e.window[e.strstart+ig-1]),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-og&&(e.match_length=jg(e,n)),e.match_length>=ig)if(r=Ah(e,e.strstart-e.match_start,e.match_length-ig),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=ig){e.match_length--;do e.strstart++,e.ins_h=Tg(e,e.ins_h,e.window[e.strstart+ig-1]),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=Tg(e,e.ins_h,e.window[e.strstart+1]);else r=Ah(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Dg(e,!1),e.strm.avail_out===0))return gg}return e.insert=e.strstart{let n,r,i;for(;;){if(e.lookahead=ig&&(e.ins_h=Tg(e,e.ins_h,e.window[e.strstart+ig-1]),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=ig-1,n!==0&&e.prev_length4096)&&(e.match_length=ig-1)),e.prev_length>=ig&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-ig,r=Ah(e,e.strstart-1-e.prev_match,e.prev_length-ig),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=Tg(e,e.ins_h,e.window[e.strstart+ig-1]),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=ig-1,e.strstart++,r&&(Dg(e,!1),e.strm.avail_out===0))return gg}else if(e.match_available){if(r=Ah(e,0,e.window[e.strstart-1]),r&&Dg(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return gg}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&=(r=Ah(e,0,e.window[e.strstart-1]),0),e.insert=e.strstart{let n,r,i,a,o=e.window;for(;;){if(e.lookahead<=ag){if(Mg(e),e.lookahead<=ag&&t===Mh)return gg;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=ig&&e.strstart>0&&(i=e.strstart-1,r=o[i],r===o[++i]&&r===o[++i]&&r===o[++i])){a=e.strstart+ag;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]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=ig?(n=Ah(e,1,e.match_length-ig),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Ah(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Dg(e,!1),e.strm.avail_out===0))return gg}return e.insert=0,t===Fh?(Dg(e,!0),e.strm.avail_out===0?vg:yg):e.sym_next&&(Dg(e,!1),e.strm.avail_out===0)?gg:_g},Lg=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(Mg(e),e.lookahead===0)){if(t===Mh)return gg;break}if(e.match_length=0,n=Ah(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Dg(e,!1),e.strm.avail_out===0))return gg}return e.insert=0,t===Fh?(Dg(e,!0),e.strm.avail_out===0?vg:yg):e.sym_next&&(Dg(e,!1),e.strm.avail_out===0)?gg:_g};function Rg(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 zg=[new Rg(0,0,0,0,Ng),new Rg(4,4,8,4,Pg),new Rg(4,5,16,8,Pg),new Rg(4,6,32,32,Pg),new Rg(4,4,16,16,Fg),new Rg(8,16,32,32,Fg),new Rg(8,16,128,128,Fg),new Rg(8,32,128,256,Fg),new Rg(32,128,258,1024,Fg),new Rg(32,258,258,4096,Fg)],Bg=e=>{e.window_size=2*e.w_size,Cg(e.head),e.max_lazy_match=zg[e.level].max_lazy,e.good_match=zg[e.level].good_length,e.nice_match=zg[e.level].nice_length,e.max_chain_length=zg[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=ig-1,e.match_available=0,e.ins_h=0};function Vg(){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=Yh,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 Uint16Array(ng*2),this.dyn_dtree=new Uint16Array((2*eg+1)*2),this.bl_tree=new Uint16Array((2*tg+1)*2),Cg(this.dyn_ltree),Cg(this.dyn_dtree),Cg(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(rg+1),this.heap=new Uint16Array(2*$h+1),Cg(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*$h+1),Cg(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var Hg=e=>{if(!e)return 1;let t=e.state;return!t||t.strm!==e||t.status!==cg&&t.status!==lg&&t.status!==ug&&t.status!==dg&&t.status!==fg&&t.status!==pg&&t.status!==mg&&t.status!==hg?1:0},Ug=e=>{if(Hg(e))return xg(e,zh);e.total_in=e.total_out=0,e.data_type=Jh;let t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?lg:t.wrap?cg:mg,e.adler=t.wrap===2?0:1,t.last_flush=-2,Dh(t),Lh},Wg=e=>{let t=Ug(e);return t===Lh&&Bg(e.state),t},Gg=(e,t)=>Hg(e)||e.state.wrap!==2?zh:(e.state.gzhead=t,Lh),Kg=(e,t,n,r,i,a)=>{if(!e)return zh;let o=1;if(t===Hh&&(t=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),i<1||i>Xh||n!==Yh||r<8||r>15||t<0||t>9||a<0||a>Kh||r===8&&o!==1)return xg(e,zh);r===8&&(r=9);let s=new Vg;return e.state=s,s.strm=e,s.status=cg,s.wrap=o,s.gzhead=null,s.w_bits=r,s.w_size=1<Kg(e,t,Yh,Zh,Qh,qh),deflateInit2:Kg,deflateReset:Wg,deflateResetKeep:Ug,deflateSetHeader:Gg,deflate:(e,t)=>{if(Hg(e)||t>Ih||t<0)return e?xg(e,zh):zh;let n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===hg&&t!==Fh)return xg(e,e.avail_out===0?Vh:zh);let r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(Eg(e),e.avail_out===0)return n.last_flush=-1,Lh}else if(e.avail_in===0&&Sg(t)<=Sg(r)&&t!==Fh)return xg(e,Vh);if(n.status===hg&&e.avail_in!==0)return xg(e,Vh);if(n.status===cg&&n.wrap===0&&(n.status=mg),n.status===cg){let t=Yh+(n.w_bits-8<<4)<<8,r=-1;if(r=n.strategy>=Wh||n.level<2?0:n.level<6?1:n.level===6?2:3,t|=r<<6,n.strstart!==0&&(t|=sg),t+=31-t%31,kg(n,t),n.strstart!==0&&(kg(n,e.adler>>>16),kg(n,e.adler&65535)),e.adler=1,n.status=mg,Eg(e),n.pending!==0)return n.last_flush=-1,Lh}if(n.status===lg){if(e.adler=0,Og(n,31),Og(n,139),Og(n,8),n.gzhead)Og(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Og(n,n.gzhead.time&255),Og(n,n.gzhead.time>>8&255),Og(n,n.gzhead.time>>16&255),Og(n,n.gzhead.time>>24&255),Og(n,n.level===9?2:n.strategy>=Wh||n.level<2?4:0),Og(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(Og(n,n.gzhead.extra.length&255),Og(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=wh(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=ug;else if(Og(n,0),Og(n,0),Og(n,0),Og(n,0),Og(n,0),Og(n,n.level===9?2:n.strategy>=Wh||n.level<2?4:0),Og(n,bg),n.status=mg,Eg(e),n.pending!==0)return n.last_flush=-1,Lh}if(n.status===ug){if(n.gzhead.extra){let t=n.pending,r=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+r>n.pending_buf_size;){let i=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>t&&(e.adler=wh(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex+=i,Eg(e),n.pending!==0)return n.last_flush=-1,Lh;t=0,r-=i}let i=new Uint8Array(n.gzhead.extra);n.pending_buf.set(i.subarray(n.gzindex,n.gzindex+r),n.pending),n.pending+=r,n.gzhead.hcrc&&n.pending>t&&(e.adler=wh(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=dg}if(n.status===dg){if(n.gzhead.name){let t=n.pending,r;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>t&&(e.adler=wh(e.adler,n.pending_buf,n.pending-t,t)),Eg(e),n.pending!==0)return n.last_flush=-1,Lh;t=0}r=n.gzindext&&(e.adler=wh(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=fg}if(n.status===fg){if(n.gzhead.comment){let t=n.pending,r;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>t&&(e.adler=wh(e.adler,n.pending_buf,n.pending-t,t)),Eg(e),n.pending!==0)return n.last_flush=-1,Lh;t=0}r=n.gzindext&&(e.adler=wh(e.adler,n.pending_buf,n.pending-t,t))}n.status=pg}if(n.status===pg){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Eg(e),n.pending!==0))return n.last_flush=-1,Lh;Og(n,e.adler&255),Og(n,e.adler>>8&255),e.adler=0}if(n.status=mg,Eg(e),n.pending!==0)return n.last_flush=-1,Lh}if(e.avail_in!==0||n.lookahead!==0||t!==Mh&&n.status!==hg){let r=n.level===0?Ng(n,t):n.strategy===Wh?Lg(n,t):n.strategy===Gh?Ig(n,t):zg[n.level].func(n,t);if((r===vg||r===yg)&&(n.status=hg),r===gg||r===vg)return e.avail_out===0&&(n.last_flush=-1),Lh;if(r===_g&&(t===Nh?jh(n):t!==Ih&&(Oh(n,0,0,!1),t===Ph&&(Cg(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),Eg(e),e.avail_out===0))return n.last_flush=-1,Lh}return t===Fh?n.wrap<=0?Rh:(n.wrap===2?(Og(n,e.adler&255),Og(n,e.adler>>8&255),Og(n,e.adler>>16&255),Og(n,e.adler>>24&255),Og(n,e.total_in&255),Og(n,e.total_in>>8&255),Og(n,e.total_in>>16&255),Og(n,e.total_in>>24&255)):(kg(n,e.adler>>>16),kg(n,e.adler&65535)),Eg(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending===0?Rh:Lh):Lh},deflateEnd:e=>{if(Hg(e))return zh;let t=e.state.status;return e.state=null,t===mg?xg(e,Bh):Lh},deflateSetDictionary:(e,t)=>{let n=t.length;if(Hg(e))return zh;let r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==cg||r.lookahead)return zh;if(i===1&&(e.adler=Sh(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(Cg(r.head),r.strstart=0,r.block_start=0,r.insert=0);let e=new Uint8Array(r.w_size);e.set(t.subarray(n-r.w_size,n),0),t=e,n=r.w_size}let a=e.avail_in,o=e.next_in,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,Mg(r);r.lookahead>=ig;){let e=r.strstart,t=r.lookahead-(ig-1);do r.ins_h=Tg(r,r.ins_h,r.window[e+ig-1]),r.prev[e&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=e,e++;while(--t);r.strstart=e,r.lookahead=ig-1,Mg(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=ig-1,r.match_available=0,e.next_in=o,e.input=s,e.avail_in=a,r.wrap=i,Lh},deflateInfo:`pako deflate (from Nodeca project)`},Jg=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Yg={assign:function(e){let t=Array.prototype.slice.call(arguments,1);for(;t.length;){let n=t.shift();if(n){if(typeof n!=`object`)throw TypeError(n+`must be non-object`);for(let t in n)Jg(n,t)&&(e[t]=n[t])}}return e},flattenChunks:e=>{let t=0;for(let n=0,r=e.length;n=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Zg[254]=Zg[254]=1;var Qg=e=>{if(typeof TextEncoder==`function`&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,a,o=e.length,s=0;for(i=0;i>>6,t[a++]=128|n&63):n<65536?(t[a++]=224|n>>>12,t[a++]=128|n>>>6&63,t[a++]=128|n&63):(t[a++]=240|n>>>18,t[a++]=128|n>>>12&63,t[a++]=128|n>>>6&63,t[a++]=128|n&63);return t},$g=(e,t)=>{if(t<65534&&e.subarray&&Xg)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n=``;for(let r=0;r{let n=t||e.length;if(typeof TextDecoder==`function`&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i,a=Array(n*2);for(i=0,r=0;r4){a[i++]=65533,r+=o-1;continue}for(t&=o===2?31:o===3?15:7;o>1&&r1){a[i++]=65533;continue}t<65536?a[i++]=t:(t-=65536,a[i++]=55296|t>>10&1023,a[i++]=56320|t&1023)}return $g(a,i)},utf8border:(e,t)=>{t||=e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)==128;)n--;return n<0||n===0?t:n+Zg[e[n]]>t?n:t}};function t_(){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}var n_=t_,r_=Object.prototype.toString,{Z_NO_FLUSH:i_,Z_SYNC_FLUSH:a_,Z_FULL_FLUSH:o_,Z_FINISH:s_,Z_OK:c_,Z_STREAM_END:l_,Z_DEFAULT_COMPRESSION:u_,Z_DEFAULT_STRATEGY:d_,Z_DEFLATED:f_}=Eh;function p_(e){this.options=Yg.assign({level:u_,method:f_,chunkSize:16384,windowBits:15,memLevel:8,strategy:d_},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg=``,this.ended=!1,this.chunks=[],this.strm=new n_,this.strm.avail_out=0;let n=qg.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==c_)throw Error(Th[n]);if(t.header&&qg.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e=typeof t.dictionary==`string`?e_.string2buf(t.dictionary):r_.call(t.dictionary)===`[object ArrayBuffer]`?new Uint8Array(t.dictionary):t.dictionary,n=qg.deflateSetDictionary(this.strm,e),n!==c_)throw Error(Th[n]);this._dict_set=!0}}p_.prototype.push=function(e,t){let n=this.strm,r=this.options.chunkSize,i,a;if(this.ended)return!1;for(a=t===~~t?t:t===!0?s_:i_,typeof e==`string`?n.input=e_.string2buf(e):r_.call(e)===`[object ArrayBuffer]`?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(a===a_||a===o_)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=qg.deflate(n,a),i===l_)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=qg.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===c_;if(n.avail_out===0){this.onData(n.output);continue}if(a>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0},p_.prototype.onData=function(e){this.chunks.push(e)},p_.prototype.onEnd=function(e){e===c_&&(this.result=Yg.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function m_(e,t){let n=new p_(t);if(n.push(e,!0),n.err)throw n.msg||Th[n.err];return n.result}function h_(e,t){return t||={},t.raw=!0,m_(e,t)}function g_(e,t){return t||={},t.gzip=!0,m_(e,t)}var __={Deflate:p_,deflate:m_,deflateRaw:h_,gzip:g_,constants:Eh},v_=16209,y_=16191,b_=function(e,t){let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E=e.state;n=e.next_in,w=e.input,r=n+(e.avail_in-5),i=e.next_out,T=e.output,a=i-(t-e.avail_out),o=i+(e.avail_out-257),s=E.dmax,c=E.wsize,l=E.whave,u=E.wnext,d=E.window,f=E.hold,p=E.bits,m=E.lencode,h=E.distcode,g=(1<>>24,f>>>=y,p-=y,y=v>>>16&255,y===0)T[i++]=v&65535;else if(y&16){b=v&65535,y&=15,y&&(p>>=y,p-=y),p<15&&(f+=w[n++]<>>24,f>>>=y,p-=y,y=v>>>16&255,y&16){if(x=v&65535,y&=15,ps){e.msg=`invalid distance too far back`,E.mode=v_;break top}if(f>>>=y,p-=y,y=i-a,x>y){if(y=x-y,y>l&&E.sane){e.msg=`invalid distance too far back`,E.mode=v_;break top}if(S=0,C=d,u===0){if(S+=c-y,y2;)T[i++]=C[S++],T[i++]=C[S++],T[i++]=C[S++],b-=3;b&&(T[i++]=C[S++],b>1&&(T[i++]=C[S++]))}else{S=i-x;do T[i++]=T[S++],T[i++]=T[S++],T[i++]=T[S++],b-=3;while(b>2);b&&(T[i++]=T[S++],b>1&&(T[i++]=T[S++]))}}else if(y&64){e.msg=`invalid distance code`,E.mode=v_;break top}else{v=h[(v&65535)+(f&(1<>3,n-=b,p-=b<<3,f&=(1<{let 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,E=new Uint16Array(x_+1),D=new Uint16Array(x_+1),O=null,k,A,j;for(l=0;l<=x_;l++)E[l]=0;for(u=0;u=1&&E[f]===0;f--);if(p>f&&(p=f),f===0)return i[a++]=20971520,i[a++]=20971520,s.bits=1,0;for(d=1;d0&&(e===w_||f!==1))return-1;for(D[1]=0,l=1;lS_||e===E_&&_>C_)return 1;for(;;){k=l-h,o[u]+1=T?(A=O[o[u]-T],j=w[o[u]-T]):(A=96,j=0),y=1<>h)+b]=k<<24|A<<16|j|0;while(b!==0);for(y=1<>=1;if(y===0?v=0:(v&=y-1,v+=y),u++,--E[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<S_||e===E_&&_>C_)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},M_=0,N_=1,P_=2,{Z_FINISH:F_,Z_BLOCK:I_,Z_TREES:L_,Z_OK:R_,Z_STREAM_END:z_,Z_NEED_DICT:B_,Z_STREAM_ERROR:V_,Z_DATA_ERROR:H_,Z_MEM_ERROR:U_,Z_BUF_ERROR:W_,Z_DEFLATED:G_}=Eh,K_=16180,q_=16181,J_=16182,Y_=16183,X_=16184,Z_=16185,Q_=16186,$_=16187,ev=16188,tv=16189,nv=16190,rv=16191,iv=16192,av=16193,ov=16194,sv=16195,cv=16196,lv=16197,uv=16198,dv=16199,fv=16200,pv=16201,mv=16202,hv=16203,gv=16204,_v=16205,vv=16206,yv=16207,bv=16208,xv=16209,Sv=16210,Cv=16211,wv=852,Tv=592,Ev=15,Dv=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function Ov(){this.strm=null,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 Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var kv=e=>{if(!e)return 1;let t=e.state;return!t||t.strm!==e||t.modeCv?1:0},Av=e=>{if(kv(e))return V_;let t=e.state;return e.total_in=e.total_out=t.total=0,e.msg=``,t.wrap&&(e.adler=t.wrap&1),t.mode=K_,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(wv),t.distcode=t.distdyn=new Int32Array(Tv),t.sane=1,t.back=-1,R_},jv=e=>{if(kv(e))return V_;let t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Av(e)},Mv=(e,t)=>{let n;if(kv(e))return V_;let r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?V_:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,jv(e))},Nv=(e,t)=>{if(!e)return V_;let n=new Ov;e.state=n,n.strm=e,n.window=null,n.mode=K_;let r=Mv(e,t);return r!==R_&&(e.state=null),r},Pv=e=>Nv(e,Ev),Fv=!0,Iv,Lv,Rv=e=>{if(Fv){Iv=new Int32Array(512),Lv=new Int32Array(32);let t=0;for(;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(j_(N_,e.lens,0,288,Iv,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;j_(P_,e.lens,0,32,Lv,0,e.work,{bits:5}),Fv=!1}e.lencode=Iv,e.lenbits=9,e.distcode=Lv,e.distbits=5},zv=(e,t,n,r)=>{let i,a=e.state;return a.window===null&&(a.wsize=1<=a.wsize?(a.window.set(t.subarray(n-a.wsize,n),0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>r&&(i=r),a.window.set(t.subarray(n-r,n-r+i),a.wnext),r-=i,r?(a.window.set(t.subarray(n-r,n),0),a.wnext=r,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave{let 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 Uint8Array(4),E,D,O=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(kv(e)||!e.output||!e.input&&e.avail_in!==0)return V_;n=e.state,n.mode===rv&&(n.mode=iv),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=R_;inf_leave:for(;;)switch(n.mode){case K_:if(n.wrap===0){n.mode=iv;break}for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<>>8&255,n.check=wh(n.check,T,2,0),l=0,u=0,n.mode=q_;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((l&255)<<8)+(l>>8))%31){e.msg=`incorrect header check`,n.mode=xv;break}if((l&15)!==G_){e.msg=`unknown compression method`,n.mode=xv;break}if(l>>>=4,u-=4,C=(l&15)+8,n.wbits===0&&(n.wbits=C),C>15||C>n.wbits){e.msg=`invalid window size`,n.mode=xv;break}n.dmax=1<>8&1),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,n.check=wh(n.check,T,2,0)),l=0,u=0,n.mode=J_;case J_:for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<>>8&255,T[2]=l>>>16&255,T[3]=l>>>24&255,n.check=wh(n.check,T,4,0)),l=0,u=0,n.mode=Y_;case Y_:for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<>8),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,n.check=wh(n.check,T,2,0)),l=0,u=0,n.mode=X_;case X_:if(n.flags&1024){for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<>>8&255,n.check=wh(n.check,T,2,0)),l=0,u=0}else n.head&&(n.head.extra=null);n.mode=Z_;case Z_: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=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(a,a+p),C)),n.flags&512&&n.wrap&4&&(n.check=wh(n.check,r,p,a)),s-=p,a+=p,n.length-=p),n.length))break inf_leave;n.length=0,n.mode=Q_;case Q_: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>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=rv;break;case tv:for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<>>=u&7,u-=u&7,n.mode=vv;break}for(;u<3;){if(s===0)break inf_leave;s--,l+=r[a++]<>>=1,--u,l&3){case 0:n.mode=av;break;case 1:if(Rv(n),n.mode=dv,t===L_){l>>>=2,u-=2;break inf_leave}break;case 2:n.mode=cv;break;case 3:e.msg=`invalid block type`,n.mode=xv}l>>>=2,u-=2;break;case av:for(l>>>=u&7,u-=u&7;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<>>16^65535)){e.msg=`invalid stored block lengths`,n.mode=xv;break}if(n.length=l&65535,l=0,u=0,n.mode=ov,t===L_)break inf_leave;case ov:n.mode=sv;case sv:if(p=n.length,p){if(p>s&&(p=s),p>c&&(p=c),p===0)break inf_leave;i.set(r.subarray(a,a+p),o),s-=p,a+=p,c-=p,o+=p,n.length-=p;break}n.mode=rv;break;case cv:for(;u<14;){if(s===0)break inf_leave;s--,l+=r[a++]<>>=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=xv;break}n.have=0,n.mode=lv;case lv:for(;n.have>>=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=j_(M_,n.lens,0,19,n.lencode,0,n.work,E),n.lenbits=E.bits,w){e.msg=`invalid code lengths set`,n.mode=xv;break}n.have=0,n.mode=uv;case uv:for(;n.have>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<>>=_,u-=_,n.lens[n.have++]=y;else{if(y===16){for(D=_+2;u>>=_,u-=_,n.have===0){e.msg=`invalid bit length repeat`,n.mode=xv;break}C=n.lens[n.have-1],p=3+(l&3),l>>>=2,u-=2}else if(y===17){for(D=_+3;u>>=_,u-=_,C=0,p=3+(l&7),l>>>=3,u-=3}else{for(D=_+7;u>>=_,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=xv;break}for(;p--;)n.lens[n.have++]=C}}if(n.mode===xv)break;if(n.lens[256]===0){e.msg=`invalid code -- missing end-of-block`,n.mode=xv;break}if(n.lenbits=9,E={bits:n.lenbits},w=j_(N_,n.lens,0,n.nlen,n.lencode,0,n.work,E),n.lenbits=E.bits,w){e.msg=`invalid literal/lengths set`,n.mode=xv;break}if(n.distbits=6,n.distcode=n.distdyn,E={bits:n.distbits},w=j_(P_,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,E),n.distbits=E.bits,w){e.msg=`invalid distances set`,n.mode=xv;break}if(n.mode=dv,t===L_)break inf_leave;case dv:n.mode=fv;case fv: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,b_(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===rv&&(n.back=-1);break}for(n.back=0;g=n.lencode[l&(1<>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<>b)],_=g>>>24,v=g>>>16&255,y=g&65535,!(b+_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<>>=b,u-=b,n.back+=b}if(l>>>=_,u-=_,n.back+=_,n.length=y,v===0){n.mode=_v;break}if(v&32){n.back=-1,n.mode=rv;break}if(v&64){e.msg=`invalid literal/length code`,n.mode=xv;break}n.extra=v&15,n.mode=pv;case pv:if(n.extra){for(D=n.extra;u>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=mv;case mv:for(;g=n.distcode[l&(1<>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<>b)],_=g>>>24,v=g>>>16&255,y=g&65535,!(b+_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<>>=b,u-=b,n.back+=b}if(l>>>=_,u-=_,n.back+=_,v&64){e.msg=`invalid distance code`,n.mode=xv;break}n.offset=y,n.extra=v&15,n.mode=hv;case hv:if(n.extra){for(D=n.extra;u>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg=`invalid distance too far back`,n.mode=xv;break}n.mode=gv;case gv: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=xv;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=fv);break;case _v:if(c===0)break inf_leave;i[o++]=n.length,c--,n.mode=fv;break;case vv:if(n.wrap){for(;u<32;){if(s===0)break inf_leave;s--,l|=r[a++]<{if(kv(e))return V_;let t=e.state;return t.window&&=null,e.state=null,R_},inflateGetHeader:(e,t)=>{if(kv(e))return V_;let n=e.state;return n.wrap&2?(n.head=t,t.done=!1,R_):V_},inflateSetDictionary:(e,t)=>{let n=t.length,r,i,a;return kv(e)||(r=e.state,r.wrap!==0&&r.mode!==nv)?V_:r.mode===nv&&(i=1,i=Sh(i,t,n,0),i!==r.check)?H_:(a=zv(e,t,n,n),a?(r.mode=Sv,U_):(r.havedict=1,R_))},inflateInfo:`pako inflate (from Nodeca project)`};function Vv(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name=``,this.comment=``,this.hcrc=0,this.done=!1}var Hv=Vv,Uv=Object.prototype.toString,{Z_NO_FLUSH:Wv,Z_FINISH:Gv,Z_OK:Kv,Z_STREAM_END:qv,Z_NEED_DICT:Jv,Z_STREAM_ERROR:Yv,Z_DATA_ERROR:Xv,Z_MEM_ERROR:Zv}=Eh;function Qv(e){this.options=Yg.assign({chunkSize:1024*64,windowBits:15,to:``},e||{});let t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg=``,this.ended=!1,this.chunks=[],this.strm=new n_,this.strm.avail_out=0;let n=Bv.inflateInit2(this.strm,t.windowBits);if(n!==Kv||(this.header=new Hv,Bv.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary==`string`?t.dictionary=e_.string2buf(t.dictionary):Uv.call(t.dictionary)===`[object ArrayBuffer]`&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=Bv.inflateSetDictionary(this.strm,t.dictionary),n!==Kv))))throw Error(Th[n])}Qv.prototype.push=function(e,t){let n=this.strm,r=this.options.chunkSize,i=this.options.dictionary,a,o,s;if(this.ended)return!1;for(o=t===~~t?t:t===!0?Gv:Wv,Uv.call(e)===`[object ArrayBuffer]`?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),a=Bv.inflate(n,o),a===Jv&&i&&(a=Bv.inflateSetDictionary(n,i),a===Kv?a=Bv.inflate(n,o):a===Xv&&(a=Jv));n.avail_in>0&&a===qv&&n.state.wrap>0&&e[n.next_in]!==0;)Bv.inflateReset(n),a=Bv.inflate(n,o);switch(a){case Yv:case Xv:case Jv:case Zv:return this.onEnd(a),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(n.avail_out===0||a===qv))if(this.options.to===`string`){let e=e_.utf8border(n.output,n.next_out),t=n.next_out-e,i=e_.buf2string(n.output,e);n.next_out=t,n.avail_out=r-t,t&&n.output.set(n.output.subarray(e,e+t),0),this.onData(i)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(a===Kv&&s===0)){if(a===qv)return a=Bv.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(n.avail_in===0)break}}return!0},Qv.prototype.onData=function(e){this.chunks.push(e)},Qv.prototype.onEnd=function(e){e===Kv&&(this.options.to===`string`?this.result=this.chunks.join(``):this.result=Yg.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function $v(e,t){let n=new Qv(t);if(n.push(e),n.err)throw n.msg||Th[n.err];return n.result}function ey(e,t){return t||={},t.raw=!0,$v(e,t)}var ty={Inflate:Qv,inflate:$v,inflateRaw:ey,ungzip:$v,constants:Eh},{Deflate:ny,deflate:ry,deflateRaw:iy,gzip:ay}=__,{Inflate:oy,inflate:sy,inflateRaw:cy,ungzip:ly}=ty,uy=ay;function dy(e){if(typeof window<`u`&&typeof window.btoa==`function`){let t=``;for(let n=0;ne.hash);for(;t.length>1;){let e=[];for(let n=0;ne.pulse),0)}}async function ky(e){let t=JSON.stringify(e);return{v:1,codec:`gzip+base64`,payload:fy(new TextEncoder().encode(t))}}const Ay={async publish(e){return{headCid:``}}};async function jy(e){let{ipfs:t=Ay,packedLedgerBytes:n,prevCid:r,sign:i,pubKeyJwk:a,merkleRoot:o,pulse:s}=e,{headCid:c}=await t.publish(n).catch(()=>({headCid:``})),l=``;return c&&i&&(l=My(await i(new TextEncoder().encode(`${c}|${o}|${s}`)))),{headCid:c,prevCid:r,merkleRoot:o,pulse:s,headSig:l,pubKeyJwk:a}}function My(e){let t=``,n=32768;for(let r=0;r{let t=(e||``).toLowerCase().replace(/\s+/g,` `).trim();return t===`root`?`Root`:t===`sacral`?`Sacral`:t===`solar plexus`||t===`solarplexus`?`Solar Plexus`:t===`heart`?`Heart`:t===`throat`?`Throat`:t===`third eye`||t===`thirdeye`||t===`third-eye`?`Third Eye`:`Crown`};async function Iy(e){let{canon:t,hashMode:n,chakraGate:r,kaiSignature:i,userPhiKey:a,origin:o,title:s,weekdayResolved:c,valuationSource:l,mintSeal:u,frequencyHzCurrent:d,creatorResolved:f}=e,p=new Date().toISOString(),m=(n??`moment`)===`moment`,h={v:`1.0`,title:s,creator:f.creator,creatorAlg:f.creatorAlg,creatorId:f.creatorId,pulse:t.pulse,...m?{timestamp:p}:{}},g=Hp(s,300)??`Day Seal: ${t.beat}:${t.stepIndex} • Kai-Pulse ${t.pulse}`,_={v:`1.0`,kaiSignature:i??``,phikey:a??``,pulse:t.pulse,beat:t.beat,stepIndex:t.stepIndex,chakraDay:t.chakraDayKey,chakraGate:r,kaiPulse:t.pulse,stepsPerBeat:t.stepsPerBeat,...m?{timestamp:p}:{},eternalRecord:g,creatorResolved:h.creator,origin:o??(typeof window<`u`?window.location.origin:``),proofHints:{scheme:`groth16-poseidon`,api:`/api/proof/sigil`,explorer:`/keystream/hash/`},zkPoseidonHash:`7110303097080024260800444665787206606103183587082596139871399733998958991511`,zkProof:{pi_a:[`19856134890912647180646267915828904326160277174078581619567068747845749027250`,`10106391353796902212003294779502313309244930326624220933310482777016833544602`,`1`],pi_b:[[`15332824283171511432216330300808558575577774780613056045013182220474274609373`,`520780065640616094309336546820413644814574749252299536726307039414737648361`],[`19765599185680435083316275297102369245623399312670847112193589466041197993879`,`18523858679421850672423367816452968252787306686524085684854491935388533516266`],[`1`,`0`]],pi_c:[`17563530240039003419001811545927065585981558862932312235837455317235418749777`,`8962254954310810065423022980767523639237247171719646270365369937175985524426`,`1`]}},v=dm({v:_.v,kaiSignature:_.kaiSignature,phikey:_.phikey,pulse:_.pulse,beat:_.beat,stepIndex:_.stepIndex,chakraDay:_.chakraDay,chakraGate:_.chakraGate,kaiPulse:_.kaiPulse,stepsPerBeat:_.stepsPerBeat,timestamp:_.timestamp,eternalRecord:_.eternalRecord,creatorResolved:_.creatorResolved,origin:_.origin,proofHints:_.proofHints,zkPoseidonHash:_.zkPoseidonHash,zkProof:_.zkProof,ownerPubKey:_.ownerPubKey?nm(_.ownerPubKey):void 0,ownerSig:_.ownerSig}),y=(await fm(v)).toLowerCase(),b=Array.from(await qp(v)).map(e=>e.toString(16).padStart(2,`0`)).join(``),x=fy(v),S;hy()&&(S=await gy(y));let C={payloadEncoding:`gzip+base64`,payloadHash:{alg:`blake3`,value:y},payloadHashSecondary:{alg:`sha256`,value:b},payloadSignature:S??{alg:`harmonic-sig`,public:a??f.creatorId,value:``}},w=Ny(Kp(dm({parentCanonical:`optional-parent-ref`,parentStateRoot:`optional-state-root`,eventKind:`mint`,pulse:t.pulse,beat:t.beat,stepIndex:t.stepIndex,chakraDay:t.chakraDayKey,childNonce:`${t.beat}-${t.stepIndex}`,amount:`1.000`,expiresAtPulse:t.pulse+12,lineageCommitment:`optional-hash-of-lineage`}))),{publicKeyJwk:T,privateKey:E}=await yy(),D=await by(E,w);_.ownerPubKey=T,_.ownerSig=D;let O=Qf(y,{pulse:t.pulse,beat:t.beat,stepIndex:t.stepIndex,chakraDay:Fy(String(t.chakraDayKey)),stepsPerBeat:t.stepsPerBeat,canonicalHash:y,exportedAt:p,expiresAtPulse:t.pulse+11,kaiSignature:i??void 0,userPhiKey:a??void 0}),k=await Oy([{v:1,pulse:t.pulse,beat:t.beat,stepIndex:t.stepIndex,chakraDay:t.chakraDayKey,stepsPerBeat:t.stepsPerBeat,kaiSignature:i??void 0,userPhiKey:a??void 0,ts:p}]),A=await ky(k),j=await jy({ipfs:Ay,packedLedgerBytes:em(A.payload),prevCid:void 0,pubKeyJwk:_.ownerPubKey,merkleRoot:k.root,pulse:t.pulse,sign:async e=>{let t=Ny(e),n=Py(E),r=await crypto.subtle.sign(n,E,t);return new Uint8Array(r)}}),M={$schema:`https://atlantean.lumitech/schemas/kai-sigil/1.0.json`,contentType:`application/vnd.kai-sigil+json;v=1`,header:{...h,shareUrl:O},payload:x,integrity:C,frequencyHzAtMint:d,valuationSource:l??null,valuationSeal:u??null},N=v.length,P=$p(v).toString(16).padStart(8,`0`),F=Yp(Qp(y)),I=f.creatorId.slice(0,12),L=String(_.zkPoseidonHash).slice(0,12);return{parityUrl:O,payloadHashHex:y,innerRingText:[`u=${O}`,`b58=${F}`,`len=${N}`,`crc32=${P}`,`creator=${I}`,`zk=${L}`,`alg=${f.creatorAlg}`].join(` · `),sigilUrl:O,hashB58:F,embeddedBase:{...M,ledger:A,dht:j,weekdayResolved:c??null}}}function Ly(e){return JSON.stringify(e)}function Ry(e,t){let n=e=>{if(typeof window>`u`||typeof window.btoa!=`function`)throw Error(`Base64 encoding unavailable in this environment`);let t=encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)));return window.btoa(t)};return{toDataURL:()=>{let t=e.current;if(!t)throw Error(`SVG not mounted`);return`data:image/svg+xml;base64,${n(new XMLSerializer().serializeToString(t))}`},async exportBlob(n=`image/svg+xml`,r=2){let i=e.current;if(!i)throw Error(`SVG not mounted`);let a=new XMLSerializer().serializeToString(i);if(n===`image/svg+xml`)return new Blob([a],{type:n});let o=URL.createObjectURL(new Blob([a],{type:`image/svg+xml`}));try{let e=new Image,n=Math.round((t??240)*r);e.decoding=`async`,e.src=o,await e.decode();let i=document.createElement(`canvas`);i.width=n,i.height=n;let a=i.getContext(`2d`);if(!a)throw Error(`Canvas 2D context not available`);return a.drawImage(e,0,0,n,n),await new Promise((e,t)=>{i.toBlob(n=>n?e(n):t(Error(`Canvas toBlob failed`)),`image/png`)})}finally{URL.revokeObjectURL(o)}},async verifySvgHash(t){let n=e.current;if(!n)throw Error(`SVG not mounted`);let r=n.cloneNode(!0);r.removeAttribute(`data-svg-hash`),r.removeAttribute(`data-svg-valid`);let i=Gp(await qp(new XMLSerializer().serializeToString(r)));if(i!==t.toLowerCase())throw Error(`SVG HASH MISMATCH (${i} != ${t})`);return i}}}var zy=({uid:e,hue:t,visualClamped:n,doAnim:r,quality:i,dpr:a,seed:o,payloadHashHex:s,auraPath:c})=>{let l=`${e}-halo`,u=`${e}-glow`,d=`${e}-bloom`,f=`${e}-mask`,p=`${e}-net`,m=`${e}-warp`;return(0,W.jsxs)(`defs`,{children:[(0,W.jsx)(`path`,{id:`${e}-aura`,d:c}),(0,W.jsxs)(`radialGradient`,{id:l,cx:`50%`,cy:`50%`,r:`50%`,children:[(0,W.jsx)(`stop`,{offset:`0%`,stopColor:kp(t,100,50+15*Math.sin(n*2*Math.PI)),stopOpacity:`.55`,children:r&&i!==`low`&&(0,W.jsx)(`animate`,{attributeName:`stop-opacity`,values:`.35;.75;.35`,dur:`var(--dur)`,begin:`var(--off)`,repeatCount:`indefinite`})}),(0,W.jsx)(`stop`,{offset:`100%`,stopColor:`#000`,stopOpacity:`0`})]}),i!==`low`&&a>1&&(0,W.jsxs)(`filter`,{id:u,x:`-30%`,y:`-30%`,width:`160%`,height:`160%`,children:[(0,W.jsx)(`feGaussianBlur`,{stdDeviation:`2.2`,result:`b`}),(0,W.jsxs)(`feMerge`,{children:[(0,W.jsx)(`feMergeNode`,{in:`b`}),(0,W.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]}),i===`ultra`&&(0,W.jsxs)(`filter`,{id:d,x:`-50%`,y:`-50%`,width:`200%`,height:`200%`,children:[(0,W.jsx)(`feGaussianBlur`,{stdDeviation:`6`,result:`u`}),(0,W.jsx)(`feBlend`,{in:`SourceGraphic`,in2:`u`,mode:`screen`})]}),(0,W.jsx)(`mask`,{id:f,children:(0,W.jsx)(`rect`,{width:`100%`,height:`100%`,fill:`white`})}),(0,W.jsx)(`pattern`,{id:p,patternUnits:`userSpaceOnUse`,width:`160`,height:`160`,patternTransform:`rotate(${o*7%60} 500 500)`,children:(0,W.jsx)(`path`,{d:`M0 80 H160 M80 0 V160 M160 0 L0 160 M0 0 L160 160`,stroke:`#00FFD0`,strokeOpacity:`.06`,strokeWidth:`1`})}),(0,W.jsxs)(`filter`,{id:m,x:`-20%`,y:`-20%`,width:`140%`,height:`140%`,children:[(0,W.jsx)(`feTurbulence`,{type:`fractalNoise`,baseFrequency:`0.006`,numOctaves:`2`,seed:o%997+3,result:`noise`}),(0,W.jsx)(`feDisplacementMap`,{in:`SourceGraphic`,in2:`noise`,scale:.35+(s?parseInt(s.slice(-2),16):0)%12*.05,xChannelSelector:`R`,yChannelSelector:`G`})]})]})},By=({uid:e,stateKeyOk:t,embeddedMetaJson:n,klockIsoSnapshot:r,apiSnapshot:i,extraEmbed:a,mintSealJson:o,valuationSourceJson:s,displayStepIndex:c,stepsPerBeat:l,eternalSeal:u,ledgerJson:d,dhtJson:f})=>(0,W.jsxs)(W.Fragment,{children:[t&&n&&(0,W.jsx)(`metadata`,{children:zp(n)}),r&&(0,W.jsx)(`metadata`,{id:`${e}-klock-json`,children:zp(Ip(r))}),i&&(0,W.jsx)(`metadata`,{id:`${e}-kai-api-json`,children:zp(Ip(i))}),u&&(0,W.jsx)(`metadata`,{id:`${e}-eternal-seal`,children:zp(u)}),a&&(0,W.jsx)(`metadata`,{id:`${e}-extra-embed`,children:zp(Ip(a))}),o&&(0,W.jsx)(`metadata`,{id:`${e}-valuation-seal-json`,children:zp(o)}),t&&s&&(0,W.jsx)(`metadata`,{id:`${e}-valuation-source-json`,children:zp(s)}),(0,W.jsx)(`metadata`,{id:`sigil-display`,children:`{"stepIndex":${c},"stepsPerBeat":${l}}`}),t&&n&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`metadata`,{id:`${e}-ledger-json`,children:zp(d)}),(0,W.jsx)(`metadata`,{id:`${e}-dht-json`,children:zp(f)})]})]}),Vy=({uid:e,size:t,baseColor:n,corePath:r,auraId:i,sigPathId:a,doAnim:o,quality:s,dpr:c,pad:l,safeTextWidth:u,outlineWidth:d,strokeCore:f,dotR:p,debugOutline:m,prefersContrast:h,haloId:g,netId:_,warpId:v,glowId:y,maskId:b,rotation:x,chakraSides:S,binaryForRender:C,summary:w,pulse:T})=>(0,W.jsxs)(`g`,{id:`${e}-art`,filter:`url(#${v})`,children:[(0,W.jsx)(`rect`,{width:xp,height:xp,fill:`url(#${g})`,"aria-hidden":`true`,pointerEvents:`none`}),(0,W.jsx)(`rect`,{x:`0`,y:`0`,width:xp,height:xp,fill:`url(#${_})`,pointerEvents:`none`}),(0,W.jsx)(`path`,{d:r,fill:`none`,stroke:n,strokeWidth:f,vectorEffect:`non-scaling-stroke`,strokeLinecap:`round`,strokeLinejoin:`round`,mask:`url(#${b})`,filter:s!==`low`&&c>1?`url(#${y})`:void 0,style:{strokeDasharray:m||h?`4 4`:void 0},"aria-hidden":`true`,pointerEvents:`none`}),(m||h)&&(0,W.jsx)(`path`,{d:r,fill:`none`,stroke:`#00FFD0`,strokeWidth:Math.max(1,f*.45),vectorEffect:`non-scaling-stroke`,opacity:.6,"aria-hidden":!0,pointerEvents:`none`}),s!==`low`&&Array.from({length:S},(e,t)=>{let r=t/S*2*Math.PI+x;return(0,W.jsx)(`circle`,{cx:500+380*Math.cos(r),cy:500+380*Math.sin(r),r:p,fill:n,"aria-hidden":`true`,pointerEvents:`none`},t)}),o&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`use`,{href:`#${i}`,stroke:`#00FFD0`,strokeWidth:Math.max(2,f*1.05),fill:`none`,opacity:`.2`,strokeLinecap:`round`,strokeLinejoin:`round`,vectorEffect:`non-scaling-stroke`,"aria-hidden":`true`,pointerEvents:`none`,children:(0,W.jsx)(`animate`,{attributeName:`stroke-opacity`,values:`.2;.6;.2`,dur:`var(--dur)`,begin:`var(--off)`,repeatCount:`indefinite`})}),(0,W.jsx)(`use`,{href:`#${i}`,stroke:n,strokeWidth:Math.max(1.2,f*.8),fill:`none`,opacity:`.4`,strokeLinecap:`round`,strokeLinejoin:`round`,vectorEffect:`non-scaling-stroke`,"aria-hidden":`true`,pointerEvents:`none`,children:(0,W.jsx)(`animate`,{attributeName:`stroke-opacity`,values:`.4;.9;.4`,dur:`var(--dur)`,begin:`var(--off)`,repeatCount:`indefinite`})})]}),(0,W.jsx)(`circle`,{cx:500,cy:500,r:Math.max(3,p),fill:`#00FFD0`,"aria-hidden":`true`,pointerEvents:`none`,children:o&&(0,W.jsx)(`animateTransform`,{attributeName:`transform`,type:`scale`,values:`1;1.5;1`,dur:`var(--dur)`,begin:`var(--off)`,repeatCount:`indefinite`})}),s!==`low`&&a&&C&&(0,W.jsx)(`g`,{id:`signature`,children:(0,W.jsx)(`text`,{fontFamily:`ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial`,fontSize:Math.max(4,t*.028),fill:n,letterSpacing:`1.2`,textAnchor:`middle`,dominantBaseline:`middle`,opacity:`.7`,pointerEvents:`none`,children:(0,W.jsx)(`textPath`,{href:`#${a}`,startOffset:`50%`,children:C})})}),(0,W.jsxs)(`g`,{id:`signature-hint`,"aria-hidden":`true`,pointerEvents:`none`,children:[(0,W.jsx)(`text`,{x:l,y:t-6,fontFamily:bp,fontSize:Math.max(4,t*.025),fill:n,opacity:`.12`,textAnchor:`start`,lengthAdjust:`spacingAndGlyphs`,textLength:u,style:{paintOrder:`stroke`,stroke:`#000`,strokeWidth:d,fontVariantNumeric:`tabular-nums`,fontFeatureSettings:`'tnum' 1`},children:w}),(0,W.jsx)(`text`,{x:t-l,y:t-l,fontFamily:bp,fontSize:t*.25,fill:n,opacity:`0.04`,textAnchor:`end`,dominantBaseline:`ideographic`,lengthAdjust:`spacingAndGlyphs`,textLength:u,vectorEffect:`non-scaling-stroke`,style:{paintOrder:`stroke`,stroke:`#000`,strokeWidth:d,fontVariantNumeric:`tabular-nums`,fontFeatureSettings:`'tnum' 1`},children:typeof T==`number`?T.toLocaleString?.()??String(T):String(T)})]})]});const Hy=[`Solhara`,`Aquaris`,`Flamora`,`Verdari`,`Sonari`,`Kaelith`],Uy=e=>typeof e==`string`&&Hy.includes(e);function Wy(e){return typeof e==`object`&&!!e}const Gy=e=>e===`low`?`low`:e===`ultra`||e===`high`?`high`:`med`,Ky=e=>e.replace(/^0x/i,``).split(``).map(e=>parseInt(e,16).toString(2).padStart(4,`0`)).join(``);function qy(e,t,n,r){return e?`Eternal Seal • ${e}`:`Day Seal: ${t}:${n} • Kai-Pulse ${r}`}var Jy=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`;function Yy(e){let t=``,n=e.length,r=0;for(;r+2>>18&63]+Jy[n>>>12&63]+Jy[n>>>6&63]+Jy[n&63]}let i=n-r;if(i===1){let n=e[r]<<16;t+=Jy[n>>>18&63]+Jy[n>>>12&63]+`==`}else if(i===2){let n=e[r]<<16|e[r+1]<<8;t+=Jy[n>>>18&63]+Jy[n>>>12&63]+Jy[n>>>6&63]+`=`}return t}function Xy(e){let t=e.replace(/\s+/g,``);if(!/^[A-Za-z0-9+/]*={0,2}$/.test(t)||t.length%4!=0)return new Uint8Array;let n=t.length/4*3-(t.endsWith(`==`)?2:t.endsWith(`=`)?1:0),r=new Uint8Array(n),i=0;for(let e=0;e>>16&255,s>=0&&i>>8&255),c>=0&&ie.replace(/·|\u2022/g,`•`);function Qy(e){if(!e)return``;let t=Zy(e);return Yy(new TextEncoder().encode(t))}function $y(e){if(!e)return``;try{let t=Xy(e);return Zy(new TextDecoder().decode(t))}catch{return``}}function eb(e){let t=`null`;if(!e)return{ledgerJson:t,dhtJson:t};try{let t=JSON.parse(e);return{ledgerJson:JSON.stringify(t.ledger??null),dhtJson:JSON.stringify(t.dht??null)}}catch{return{ledgerJson:t,dhtJson:t}}}function tb(e){let t=Object.entries(e).flatMap(([e,t])=>t==null?[]:[[e,String(t)]]);return Object.fromEntries(t)}function nb(e,t){let n=Fp(e)?JSON.parse(Ip(e)):null,r=Fp(t)?JSON.parse(Ip(t)):null,i=tb(n?Vp(`klock`,n):{}),a=Lp(e,`eternalMonth`),o=Lp(e,`harmonicDay`),s=Rp(e,`kaiPulseEternal`),c=Lp(e,`solarChakraStepString`),l=Lp(e,`chakraArc`);return{klockIsoSnapshot:n,apiSnapshot:r,klockDataAttrs:i,eternalMonth:a,harmonicDay:o,kaiPulseEternal:typeof s==`number`?s:void 0,solarChakraStepString:c,chakraArc:l}}function rb(e,t,n,r,i,a,o){let s=String(n).replace(/\s+/g,`_`),c=[`sig=${t?e??`pending`:`pending`}`,`pulse=${i}`,`beat=${a}`,`day=${s}`,`hz=${r}`];return o&&c.push(`poseidon=${o}`),c.join(` | `)}function ib(e,t,n){return kp((e+(n?parseInt(n.slice(-2),16)%12*2.5:0))%360,100,50+15*Math.sin(t*2*Math.PI))}var ab=(0,C.forwardRef)((e,t)=>{let{id:n,pulse:r,beat:i,stepIndex:a,stepPct:o,chakraDay:s,size:c=240,hashOverride:l,strict:u=!0,quality:d=`high`,animate:f=!0,debugOutline:p=!1,goldenId:m,hashMode:h=`moment`,userPhiKey:g,kaiSignature:_,intentionSigil:v,creatorPublicKey:y,origin:b,onReady:x,onError:S,showZKBadge:w=!0,qrHref:T,klock:E,embed:D}=e,O=Up(r),k=Up(i),A=(0,C.useMemo)(()=>Mp(O),[O]),j=(0,C.useMemo)(()=>Np(O),[O]),M=(0,C.useMemo)(()=>{let e=Up(a,NaN);return(!Number.isFinite(e)||e<0||e>=44)&&(e=A),Math.trunc((e%44+44)%44)},[a,A]),N=(0,C.useMemo)(()=>{let e=Wp(o,NaN);return Number.isFinite(e)||(e=j),Math.max(0,Math.min(1-2**-52,e))},[o,j]),P=Op(s),F=Uy(s)?s:void 0,I=(0,C.useMemo)(()=>({pulse:O,beat:k,stepIndex:M,chakraDayKey:P,stepsPerBeat:44,visualClamped:N}),[O,k,M,P,N]),{prefersReduce:L,prefersContrast:R}=rm(),{kaiData:z,kaiDataRef:B}=am(h),V=om(`${I.pulse}|${I.beat}|${I.stepIndex}|${I.chakraDayKey}`),H=(0,C.useMemo)(()=>Zp(V),[V]),{sides:U,hue:ee}=Cp[P],te=I.pulse%7+1,ne=I.beat%5+2,re=I.visualClamped*2*Math.PI,ie=yp**2*Math.PI*(I.pulse%97)%(2*Math.PI),ae=50+15*Math.sin(I.visualClamped*2*Math.PI),oe=kp((ee+360*.03*I.visualClamped)%360,100,ae),se=wp[P],ce=(0,C.useMemo)(()=>Pp(P,M),[P,M]),le=typeof window<`u`?window.devicePixelRatio??1:1,ue=f&&!L,de=(m?`${m}-${M}`:void 0)??`ks-${I.pulse}-${I.beat}-${M}`,fe=Math.max(10,Math.floor((c??240)*.08)),pe=Math.max(40,(c??240)-fe*2),me=Math.max(.6,(c??240)*.003),he=Math.max(1.4,(c??240)*.009),ge=Math.max(2.5,(c??240)*.016),_e=5e3+Math.floor(H()*800)+Math.floor(V%436/2),ve=Math.floor((V>>>1)%_e),ye=(0,C.useMemo)(()=>Ap(U,ie),[U,ie]),be=(0,C.useMemo)(()=>jp(te,ne,re),[te,ne,re]),[xe,Se]=(0,C.useState)(),[Ce,we]=(0,C.useState)();(0,C.useEffect)(()=>{(async()=>{let e=_;e||(e=Gp(await qp(`${I.pulse}|${I.beat}|${M}|${P}|${v??``}`)),Se(e));let t=g;!t&&e&&(t=await Xp((await qp(`${e}φ`)).slice(0,20)),we(t))})().catch(S)},[_,g,I.pulse,I.beat,M,P,v,S]);let Te=_??xe,Ee=g??Ce,De=sm(),Oe=(0,C.useRef)(I.pulse),[ke,Ae]=(0,C.useState)(null),[je,Me]=(0,C.useState)(null),Ne=(0,C.useRef)(null);(0,C.useEffect)(()=>{Ne.current={pulse:Oe.current,kaiPulse:Oe.current,kaiSignature:Te??void 0,userPhiKey:Ee??void 0,beat:I.beat,stepIndex:I.stepIndex,stepsPerBeat:I.stepsPerBeat,quality:Gy(d),frequencyHz:ce,chakraDay:I.chakraDayKey,chakraGate:se}},[I.beat,I.stepIndex,Te,Ee,ce,I.chakraDayKey,se,d]);let Pe=(0,C.useMemo)(()=>`${I.pulse}|${I.beat}|${I.stepIndex}|${I.chakraDayKey}`,[I.pulse,I.beat,I.stepIndex,I.chakraDayKey]),[Fe,Ie]=(0,C.useState)(null);(0,C.useEffect)(()=>{let e=!1,t=I.pulse,n=I.beat,r=I.stepIndex,i=I.chakraDayKey,a=I.stepsPerBeat,o=ce,c=Pe,l=Uy(s)?s:null;return(async()=>{try{let s=await tm({creatorPublicKey:y,userPhiKey:Ee,kaiSignature:Te,origin:b,pulse:t,beat:n,chakraDay:i,stepIndex:r}),u=B.current,f=Hp(Lp(u,`kaiMomentSummary`))??Hp(Lp(u,`kairos_seal`))??Hp(Lp(u,`kairos_seal_day_month_percent`))??`Kairos HarmoniK Sigil • ${i} • Beat ${n} • Step ${r}`,p={pulse:Oe.current,kaiPulse:Oe.current,kaiSignature:Te??void 0,userPhiKey:Ee??void 0,beat:n,stepsPerBeat:a,quality:d===`low`?`low`:`high`,frequencyHz:o,chakraDay:i,chakraGate:se};try{let{seal:e}=await hu(p,Oe.current,De);Me(e)}catch(e){S?.(e)}let m=await Iy({canon:{pulse:t,beat:n,stepIndex:r,chakraDayKey:i,stepsPerBeat:a},hashMode:h,chakraGate:se,kaiSignature:Te,userPhiKey:Ee,intentionSigil:v,origin:b,title:f,klockSnapshot:Fp(E)?JSON.parse(Ip(E)):null,kaiApiSnapshot:Fp(z)?JSON.parse(Ip(z)):null,weekdayResolved:l,valuationSource:p,mintSeal:null,frequencyHzCurrent:o,qrHref:T,canonicalUrlFromContext:vp,creatorResolved:s}),g={},_=``,C=``,w=``,D=``,O=``;if(Wy(m)){let e=m.embeddedBase;Wy(e)&&(g=e);let t=m.payloadHashHex;typeof t==`string`&&(_=t);let n=m.parityUrl;typeof n==`string`&&(C=n);let r=m.innerRingText;typeof r==`string`&&(w=r);let i=m.sigilUrl;typeof i==`string`&&(D=i);let a=m.hashB58;typeof a==`string`&&(O=a)}let k={PULSE_MS:qn,STEPS_BEAT:a,PHI:yp,algorithm:`computeIntrinsicUnsigned`,version:`1`},A=p?mu(p,t).unsigned.valuePhi:null,j=Ly({...g,valuation:je??null,valuationSource:p,valuationRuntime:k,valuationLiveAtExport:A}),M={createdFor:{pulse:t,beat:n,stepIndex:r,chakraDayKey:i,stateKey:c},payloadHashHex:_,shareUrl:C,embeddedMetaJson:j,valuationSourceJson:JSON.stringify(p),zkScheme:`groth16-poseidon`,zkPoseidonHash:`7110303097080024260800444665787206606103183587082596139871399733998958991511`,innerRingText:w,sigilUrl:D,hashB58:O,frequencyHz:o};!e&&M.createdFor.stateKey===c&&(Ie(M),x?.({hash:M.payloadHashHex,url:M.shareUrl,metadataJson:M.embeddedMetaJson}))}catch(e){if(S?.(e),u)throw e instanceof Error?e:Error(String(e))}})().catch(e=>{if(S?.(e),u)throw e instanceof Error?e:Error(String(e))}),()=>{e=!0}},[Pe,I.pulse,I.beat,I.stepIndex,I.chakraDayKey,I.stepsPerBeat,ce,Te,Ee,h,y,b,T,u,x,S,P,d,E,z,B,De,se,s]);let Le=(0,C.useMemo)(()=>{let e=Fe;return e&&e.createdFor.stateKey===Pe?e.createdFor.stepIndex:I.stepIndex},[Fe,Pe,I.stepIndex]),Re=(0,C.useMemo)(()=>{let e=Fe;return e&&e.createdFor.stateKey===Pe?e.frequencyHz:ce},[Fe,Pe,ce]);(0,C.useEffect)(()=>{try{if(!Ne.current||!Number.isFinite(I.pulse)){Ae(null);return}let{unsigned:e}=mu(Ne.current,I.pulse);Ae(e.valuePhi)}catch(e){S?.(e),Ae(null)}},[I.pulse,S]);let ze=Lp(E,`eternalSeal`)??Lp(E,`seal`)??Lp(z,`kairos_seal`),Be=(0,C.useMemo)(()=>qy(ze,I.beat,Le,I.pulse),[ze,I.beat,Le,I.pulse]),Ve=(0,C.useMemo)(()=>{let e=Fe&&Fe.createdFor.stateKey===Pe?Fe.createdFor.stepIndex:Le;return qy(ze,I.beat,e,I.pulse)},[Fe,Pe,ze,I.beat,Le,I.pulse]),He=(0,C.useMemo)(()=>Qy(Ve),[Ve]),{klockIsoSnapshot:Ue,apiSnapshot:We,klockDataAttrs:Ge,eternalMonth:Ke,harmonicDay:qe,kaiPulseEternal:Je,solarChakraStepString:Ye,chakraArc:Xe}=(0,C.useMemo)(()=>nb(E,z),[E,z]),Ze=(0,C.useRef)(null);(0,C.useLayoutEffect)(()=>{let e=Ze.current;if(!e||!l)return;let t=!1;return(async()=>{try{let n=e.cloneNode(!0);n.removeAttribute(`data-svg-hash`),n.removeAttribute(`data-svg-valid`);let r=Gp(await qp(new XMLSerializer().serializeToString(n)));if(t)return;if(e.dataset.svgHash=r,e.dataset.svgValid=String(r===l.toLowerCase()),r!==l.toLowerCase()&&u)throw Error(`[KaiSigil] SVG HASH MISMATCH (${r})`)}catch(e){if(S?.(e),u)throw e instanceof Error?e:Error(String(e))}})().catch(e=>{if(S?.(e),u)throw e instanceof Error?e:Error(String(e))}),()=>{t=!0}},[l,u,Pe,S]),(0,C.useLayoutEffect)(()=>{if(!u)return;let e=Ze.current;if(!e)return;let t=Fe;if(!t||t.createdFor.stateKey!==Pe)return;let n=e.getAttribute(`data-step-index`),r=e.getAttribute(`data-frequency-hz`),i=e.getAttribute(`data-summary-b64`)??``,a=n!=null&&n!==``?Number(n):NaN,o=r!=null&&r!==``?Number(r):NaN,s=e.getAttribute(`data-share-url`)||void 0,c=e.getAttribute(`data-payload-hash`)||void 0,l=``;try{l=$y(i)}catch{l=``}let d=Ve,f=e=>e.replace(/•|·|\u2022/g,`•`),p=[];if(f(l)!==f(d)&&p.push(`summary mismatch (“${l}” != “${d}”)`),Number.isFinite(a)?a!==t.createdFor.stepIndex&&p.push(`data-step-index(${a}) != built(${t.createdFor.stepIndex})`):p.push(`missing/invalid data-step-index`),!Number.isFinite(o))p.push(`missing/invalid data-frequency-hz`);else{let e=Pp(P,a);(Math.abs(o-t.frequencyHz)>1e-6||Math.abs(e-o)>1e-6)&&p.push(`frequency/step mismatch (${o} vs step ${a})`)}if(s!==t.shareUrl&&p.push(`data-share-url != built.shareUrl`),c&&c!==t.payloadHashHex&&p.push(`data-payload-hash != built.payloadHashHex`),p.length)throw Error(`[KaiSigil] Invariant violation → ${p.join(`; `)}`)},[u,Fe,Pe,P,I.beat,I.pulse,Re,Ve]);let{toDataURL:Qe,exportBlob:$e,verifySvgHash:et}=Ry(Ze,c),tt=(0,C.useMemo)(()=>Fp(D)?JSON.parse(Ip(D)):null,[D]),nt=Fe?.createdFor.stateKey===Pe?Fe?.payloadHashHex:void 0,rt=Fe?.createdFor.stateKey===Pe?Fe?.zkScheme:void 0,it=Fe?.createdFor.stateKey===Pe?Fe?.zkPoseidonHash:void 0,at=Fe?.createdFor.stateKey===Pe?Fe?.shareUrl:void 0,ot=(Fe?.createdFor.stateKey===Pe?Fe?.frequencyHz:void 0)??ce,st=(0,C.useMemo)(()=>{if(!Te)return``;let e=Ky(Te),t=2*Math.PI*((c??240)*.46),n=Math.max(3.5,(c??240)*.028*.55),r=Math.max(24,Math.floor(t/n));return e.length>r?e.slice(0,r):e},[Te,c]),ct=ib(ee,I.visualClamped,Fe?.payloadHashHex),lt=Te?`${de}-sig-path`:void 0,ut=`${de}-desc`,dt=Fe?.createdFor.stateKey===Pe?Fe?.shareUrl:void 0,ft=({children:e})=>dt?(0,W.jsx)(`a`,{href:dt,target:`_self`,"aria-label":`Open canonical sigil ${Fe?.payloadHashHex??``}`,children:e}):(0,W.jsx)(`g`,{tabIndex:0,role:`button`,"aria-label":`Sigil not yet canonicalized`,children:e}),pt=Fe?.createdFor.stateKey===Pe,mt=rb(nt,pt,P,ot,I.pulse,I.beat,it),{ledgerJson:ht,dhtJson:gt}=(0,C.useMemo)(()=>eb(pt?Fe?.embeddedMetaJson:void 0),[Fe,pt]);return(0,C.useImperativeHandle)(t,()=>({toDataURL:Qe,exportBlob:$e,verifySvgHash:et,verifyConsistency:()=>{let e=Fe;if(!e)throw Error(`No built snapshot yet`);if(e.createdFor.stateKey!==Pe)throw Error(`Built snapshot does not match current stateKey`)},uid:de,stepIndex:M,payloadHashHex:Fe?.payloadHashHex,sigilUrl:Fe?.sigilUrl,userPhiKey:Ee,kaiSignature:Te})),(0,W.jsxs)(`svg`,{ref:Ze,id:n??de,role:`img`,"aria-describedby":ut,lang:`en`,"aria-label":`Kairos sigil — pulse ${I.pulse}`,viewBox:`0 0 ${xp} ${xp}`,width:c,height:c,shapeRendering:`geometricPrecision`,style:{background:`transparent`,"--dur":`${_e}ms`,"--off":`${ve}ms`,"--pulse":`${qn}ms`,cursor:at?`pointer`:`default`},"data-pulse":String(I.pulse),"data-beat":String(I.beat),"data-step-index":String(Le),"data-frequency-hz":String(Re),"data-chakra-day":P,"data-weekday":F??void 0,"data-chakra-gate":se,"data-quality":d,"data-golden-id":m??void 0,"data-kai-signature":Te??void 0,"data-phi-key":Ee??void 0,"data-payload-hash":nt??void 0,"data-zk-scheme":rt??void 0,"data-zk-poseidon-hash":it??void 0,"data-share-url":at||void 0,"data-eternal-seal":ze??void 0,"data-eternal-month":Ke??void 0,"data-harmonic-day":qe??void 0,"data-kai-pulse-eternal":typeof Je==`number`?String(Je):void 0,"data-solar-chakra-step":Ye??void 0,"data-arc":Xe??void 0,"data-summary-b64":He,...Ge,"data-valuation-algorithm":je?.algorithm??void 0,"data-valuation-policy":je?.policyId??void 0,"data-valuation-policy-checksum":je?.policyChecksum??void 0,"data-valuation-stamp":je?.stamp??void 0,"data-valuation-value-phi":je?.valuePhi==null?void 0:String(je.valuePhi),"data-valuation-computed-at":je?.computedAtPulse==null?void 0:String(je.computedAtPulse),"data-value-phi-live":ke==null?void 0:String(ke),children:[(0,W.jsx)(`title`,{children:`Kairos HarmoniK Sigil • Pulse ${I.pulse}`}),(0,W.jsxs)(`desc`,{id:ut,children:[`↳ `,Be]}),(0,W.jsx)(By,{uid:de,stateKeyOk:pt,embeddedMetaJson:pt?Fe?.embeddedMetaJson:void 0,klockIsoSnapshot:Ue,apiSnapshot:We,extraEmbed:tt,mintSealJson:je?JSON.stringify(je):null,valuationSourceJson:pt?Fe?.valuationSourceJson:void 0,displayStepIndex:Le,stepsPerBeat:I.stepsPerBeat,eternalSeal:ze??void 0,ledgerJson:ht,dhtJson:gt}),(0,W.jsx)(zy,{uid:de,hue:ee,visualClamped:I.visualClamped,doAnim:ue,quality:d,dpr:le,seed:V,payloadHashHex:Fe?.payloadHashHex,auraPath:be}),Te&&(0,W.jsx)(`defs`,{children:(0,W.jsx)(`path`,{id:lt,d:`M 500 ${500-1e3*.46} +\0`,M+=r(k,2),M+=m.magic,M+=r(d,2),M+=r(f,2),M+=r(O.crc32,4),M+=r(O.compressedSize,4),M+=r(O.uncompressedSize,4),M+=r(g.length,2),M+=r(C.length,2),{fileRecord:l.LOCAL_FILE_HEADER+M+g+C,dirRecord:l.CENTRAL_FILE_HEADER+r(j,2)+M+r(y.length,2)+`\0\0\0\0`+r(A,4)+r(i,4)+g+C+y}}var a=e(`../utils`),o=e(`../stream/GenericWorker`),s=e(`../utf8`),c=e(`../crc32`),l=e(`../signature`);function u(e,t,n,r){o.call(this,`ZipFileWorker`),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(u,o),u.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-r-1))/n:100}}))},u.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var n=i(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},u.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=i(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:function(e){return l.DATA_DESCRIPTOR+r(e.crc32,4)+r(e.compressedSize,4)+r(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},u.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return r.transformTo(`string`,this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,n){var r=e(`./Uint8ArrayReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,n){var r=e(`./DataReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,n){var r=e(`./ArrayReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.readData=function(e){if(this.checkOffset(e),e===0)return new Uint8Array;var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,n){var r=e(`../utils`),i=e(`../support`),a=e(`./ArrayReader`),o=e(`./StringReader`),s=e(`./NodeBufferReader`),c=e(`./Uint8ArrayReader`);t.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),t!==`string`||i.uint8array?t===`nodebuffer`?new s(e):i.uint8array?new c(r.transformTo(`uint8array`,e)):new a(r.transformTo(`array`,e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,n){n.LOCAL_FILE_HEADER=`PK`,n.CENTRAL_FILE_HEADER=`PK`,n.CENTRAL_DIRECTORY_END=`PK`,n.ZIP64_CENTRAL_DIRECTORY_LOCATOR=`PK\x07`,n.ZIP64_CENTRAL_DIRECTORY_END=`PK`,n.DATA_DESCRIPTOR=`PK\x07\b`},{}],24:[function(e,t,n){var r=e(`./GenericWorker`),i=e(`../utils`);function a(e){r.call(this,`ConvertWorker to `+e),this.destType=e}i.inherits(a,r),a.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,n){var r=e(`./GenericWorker`),i=e(`../crc32`);function a(){r.call(this,`Crc32Probe`),this.withStreamInfo(`crc32`,0)}e(`../utils`).inherits(a,r),a.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,n){var r=e(`../utils`),i=e(`./GenericWorker`);function a(e){i.call(this,`DataLengthProbe for `+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(a,i),a.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,n){var r=e(`../utils`),i=e(`./GenericWorker`);function a(e){i.call(this,`DataWorker`);var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type=``,this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}r.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case`string`:e=this.data.substring(this.index,t);break;case`uint8array`:e=this.data.subarray(this.index,t);break;case`array`:case`nodebuffer`:e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,n){function r(e){this.name=e||`default`,this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit(`data`,e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit(`end`),this.cleanUp(),this.isFinished=!0}catch(e){this.emit(`error`,e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit(`error`,e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n `+e:e}},t.exports=r},{}],29:[function(e,t,n){var r=e(`../utils`),i=e(`./ConvertWorker`),a=e(`./GenericWorker`),o=e(`../base64`),s=e(`../support`),c=e(`../external`),l=null;if(s.nodestream)try{l=e(`../nodejs/NodejsStreamOutputAdapter`)}catch{}function u(e,t){return new c.Promise(function(n,i){var a=[],s=e._internalType,c=e._outputType,l=e._mimeType;e.on(`data`,function(e,n){a.push(e),t&&t(n)}).on(`error`,function(e){a=[],i(e)}).on(`end`,function(){try{n(function(e,t,n){switch(e){case`blob`:return r.newBlob(r.transformTo(`arraybuffer`,t),n);case`base64`:return o.encode(t);default:return r.transformTo(e,t)}}(c,function(e,t){var n,r=0,i=null,a=0;for(n=0;n`u`)n.blob=!1;else{var r=new ArrayBuffer(0);try{n.blob=new Blob([r],{type:`application/zip`}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(r),n.blob=i.getBlob(`application/zip`).size===0}catch{n.blob=!1}}}try{n.nodestream=!!e(`readable-stream`).Readable}catch{n.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,n){for(var r=e(`./utils`),i=e(`./support`),a=e(`./nodejsUtils`),o=e(`./stream/GenericWorker`),s=Array(256),c=0;c<256;c++)s[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;s[254]=s[254]=1;function l(){o.call(this,`utf-8 decode`),this.leftOver=null}function u(){o.call(this,`utf-8 encode`)}n.utf8encode=function(e){return i.nodebuffer?a.newBufferFrom(e,`utf-8`):function(e){var t,n,r,a,o,s=e.length,c=0;for(a=0;a>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t}(e)},n.utf8decode=function(e){return i.nodebuffer?r.transformTo(`nodebuffer`,e).toString(`utf-8`):function(e){var t,n,i,a,o=e.length,c=Array(2*o);for(t=n=0;t>10&1023,c[n++]=56320|1023&i)}return c.length!==n&&(c.subarray?c=c.subarray(0,n):c.length=n),r.applyFromCharCode(c)}(e=r.transformTo(i.uint8array?`uint8array`:`array`,e))},r.inherits(l,o),l.prototype.processChunk=function(e){var t=r.transformTo(i.uint8array?`uint8array`:`array`,e.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var a=t;(t=new Uint8Array(a.length+this.leftOver.length)).set(this.leftOver,0),t.set(a,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var n;for((t||=e.length)>e.length&&(t=e.length),n=t-1;0<=n&&(192&e[n])==128;)n--;return n<0||n===0?t:n+s[e[n]]>t?n:t}(t),c=t;o!==t.length&&(i.uint8array?(c=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(c=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:n.utf8decode(c),meta:e.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=l,r.inherits(u,o),u.prototype.processChunk=function(e){this.push({data:n.utf8encode(e.data),meta:e.meta})},n.Utf8EncodeWorker=u},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,n){var r=e(`./support`),i=e(`./base64`),a=e(`./nodejsUtils`),o=e(`./external`);function s(e){return e}function c(e,t){for(var n=0;n>8;this.dir=!!(16&this.externalFileAttributes),e==0&&(this.dosPermissions=63&this.externalFileAttributes),e==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!==`/`||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=r(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,n,r,i=e.index+this.extraFieldsLength;for(this.extraFields||={};e.index+4>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t},n.buf2binstring=function(e){return c(e,e.length)},n.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n>10&1023,l[r++]=56320|1023&i)}return c(l,r)},n.utf8border=function(e,t){var n;for((t||=e.length)>e.length&&(t=e.length),n=t-1;0<=n&&(192&e[n])==128;)n--;return n<0||n===0?t:n+o[e[n]]>t?n:t}},{"./common":41}],43:[function(e,t,n){t.exports=function(e,t,n,r){for(var i=65535&e|0,a=e>>>16&65535|0,o=0;n!==0;){for(n-=o=2e3>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,i){var a=r,o=i+n;e^=-1;for(var s=i;s>>8^a[255&(e^t[s])];return-1^e}},{}],46:[function(e,t,n){var r,i=e(`../utils/common`),a=e(`./trees`),o=e(`./adler32`),s=e(`./crc32`),c=e(`./messages`),l=0,u=4,d=0,f=-2,p=-1,m=4,h=2,g=8,_=9,v=286,y=30,b=19,x=2*v+1,S=15,C=3,w=258,T=w+C+1,E=42,D=113,O=1,k=2,A=3,j=4;function M(e,t){return e.msg=c[t],t}function N(e){return(e<<1)-(4e.avail_out&&(n=e.avail_out),n!==0&&(i.arraySet(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 I(e,t){a._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,F(e.strm)}function L(e,t){e.pending_buf[e.pending++]=t}function R(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function z(e,t){var n,r,i=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-T?e.strstart-(e.w_size-T):0,l=e.window,u=e.w_mask,d=e.prev,f=e.strstart+w,p=l[a+o-1],m=l[a+o];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do if(l[(n=t)+o]===m&&l[n+o-1]===p&&l[n]===l[a]&&l[++n]===l[a+1]){a+=2,n++;do;while(l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&ac&&--i!=0);return o<=e.lookahead?o:e.lookahead}function B(e){var t,n,r,a,c,l,u,d,f,p,m=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=m+(m-T)){for(i.arraySet(e.window,e.window,m,m,0),e.match_start-=m,e.strstart-=m,e.block_start-=m,t=n=e.hash_size;r=e.head[--t],e.head[t]=m<=r?r-m:0,--n;);for(t=n=m;r=e.prev[--t],e.prev[t]=m<=r?r-m:0,--n;);a+=m}if(e.strm.avail_in===0)break;if(l=e.strm,u=e.window,d=e.strstart+e.lookahead,f=a,p=void 0,p=l.avail_in,f=C)for(c=e.strstart-e.insert,e.ins_h=e.window[c],e.ins_h=(e.ins_h<=C&&(e.ins_h=(e.ins_h<=C)if(r=a._tr_tally(e,e.strstart-e.match_start,e.match_length-C),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=C){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=C&&(e.ins_h=(e.ins_h<=C&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-C,r=a._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-C),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(B(e),e.lookahead===0&&t===l)return O;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,I(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-T&&(I(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(I(e,!0),e.strm.avail_out===0?A:j):(e.strstart>e.block_start&&(I(e,!1),e.strm.avail_out),O)}),new U(4,4,8,4,V),new U(4,5,16,8,V),new U(4,6,32,32,V),new U(4,4,16,16,H),new U(8,16,32,32,H),new U(8,16,128,128,H),new U(8,32,128,256,H),new U(32,128,258,1024,H),new U(32,258,258,4096,H)],n.deflateInit=function(e,t){return re(e,t,g,15,8,0)},n.deflateInit2=re,n.deflateReset=ne,n.deflateResetKeep=te,n.deflateSetHeader=function(e,t){return e&&e.state&&e.state.wrap===2?(e.state.gzhead=t,d):f},n.deflate=function(e,t){var n,i,o,c;if(!e||!e.state||5>8&255),L(i,i.gzhead.time>>16&255),L(i,i.gzhead.time>>24&255),L(i,i.level===9?2:2<=i.strategy||i.level<2?4:0),L(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(L(i,255&i.gzhead.extra.length),L(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=s(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(L(i,0),L(i,0),L(i,0),L(i,0),L(i,0),L(i,i.level===9?2:2<=i.strategy||i.level<2?4:0),L(i,3),i.status=D);else{var p=g+(i.w_bits-8<<4)<<8;p|=(2<=i.strategy||i.level<2?0:i.level<6?1:i.level===6?2:3)<<6,i.strstart!==0&&(p|=32),p+=31-p%31,i.status=D,R(i,p),i.strstart!==0&&(R(i,e.adler>>>16),R(i,65535&e.adler)),e.adler=1}if(i.status===69)if(i.gzhead.extra){for(o=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),F(e),o=i.pending,i.pending!==i.pending_buf_size));)L(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(i.status===73)if(i.gzhead.name){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),F(e),o=i.pending,i.pending===i.pending_buf_size)){c=1;break}c=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),c===0&&(i.gzindex=0,i.status=91)}else i.status=91;if(i.status===91)if(i.gzhead.comment){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),F(e),o=i.pending,i.pending===i.pending_buf_size)){c=1;break}c=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),c===0&&(i.status=103)}else i.status=103;if(i.status===103&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&F(e),i.pending+2<=i.pending_buf_size&&(L(i,255&e.adler),L(i,e.adler>>8&255),e.adler=0,i.status=D)):i.status=D),i.pending!==0){if(F(e),e.avail_out===0)return i.last_flush=-1,d}else if(e.avail_in===0&&N(t)<=N(n)&&t!==u)return M(e,-5);if(i.status===666&&e.avail_in!==0)return M(e,-5);if(e.avail_in!==0||i.lookahead!==0||t!==l&&i.status!==666){var m=i.strategy===2?function(e,t){for(var n;;){if(e.lookahead===0&&(B(e),e.lookahead===0)){if(t===l)return O;break}if(e.match_length=0,n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(I(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(I(e,!0),e.strm.avail_out===0?A:j):e.last_lit&&(I(e,!1),e.strm.avail_out===0)?O:k}(i,t):i.strategy===3?function(e,t){for(var n,r,i,o,s=e.window;;){if(e.lookahead<=w){if(B(e),e.lookahead<=w&&t===l)return O;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=C&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=C?(n=a._tr_tally(e,1,e.match_length-C),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(I(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(I(e,!0),e.strm.avail_out===0?A:j):e.last_lit&&(I(e,!1),e.strm.avail_out===0)?O:k}(i,t):r[i.level].func(i,t);if(m!==A&&m!==j||(i.status=666),m===O||m===A)return e.avail_out===0&&(i.last_flush=-1),d;if(m===k&&(t===1?a._tr_align(i):t!==5&&(a._tr_stored_block(i,0,0,!1),t===3&&(P(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),F(e),e.avail_out===0))return i.last_flush=-1,d}return t===u?i.wrap<=0?1:(i.wrap===2?(L(i,255&e.adler),L(i,e.adler>>8&255),L(i,e.adler>>16&255),L(i,e.adler>>24&255),L(i,255&e.total_in),L(i,e.total_in>>8&255),L(i,e.total_in>>16&255),L(i,e.total_in>>24&255)):(R(i,e.adler>>>16),R(i,65535&e.adler)),F(e),0=n.w_size&&(s===0&&(P(n.head),n.strstart=0,n.block_start=0,n.insert=0),p=new i.Buf8(n.w_size),i.arraySet(p,t,m-n.w_size,n.w_size,0),t=p,m=n.w_size),c=e.avail_in,l=e.next_in,u=e.input,e.avail_in=m,e.next_in=0,e.input=t,B(n);n.lookahead>=C;){for(r=n.strstart,a=n.lookahead-(C-1);n.ins_h=(n.ins_h<>>=b=y>>>24,m-=b,(b=y>>>16&255)==0)E[a++]=65535&y;else{if(!(16&b)){if(!(64&b)){y=h[(65535&y)+(p&(1<>>=b,m-=b),m<15&&(p+=T[r++]<>>=b=y>>>24,m-=b,!(16&(b=y>>>16&255))){if(!(64&b)){y=g[(65535&y)+(p&(1<>>=b,m-=b,(b=a-o)>3,p&=(1<<(m-=x<<3))-1,e.next_in=r,e.next_out=a,e.avail_in=r>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function g(){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 r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg=``,t.wrap&&(e.adler=1&t.wrap),t.mode=f,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(p),t.distcode=t.distdyn=new r.Buf32(m),t.sane=1,t.back=-1,u):d}function v(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,_(e)):d}function y(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=o.wsize?(r.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(i<(a=o.wsize-o.wnext)&&(a=i),r.arraySet(o.window,t,n-i,a,o.wnext),(i-=a)?(r.arraySet(o.window,t,n-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,n.check=a(n.check,B,2,0),x=b=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&b)<<8)+(b>>8))%31){e.msg=`incorrect header check`,n.mode=30;break}if((15&b)!=8){e.msg=`unknown compression method`,n.mode=30;break}if(x-=4,F=8+(15&(b>>>=4)),n.wbits===0)n.wbits=F;else if(F>n.wbits){e.msg=`invalid window size`,n.mode=30;break}n.dmax=1<>8&1),512&n.flags&&(B[0]=255&b,B[1]=b>>>8&255,n.check=a(n.check,B,2,0)),x=b=0,n.mode=3;case 3:for(;x<32;){if(v===0)break e;v--,b+=p[g++]<>>8&255,B[2]=b>>>16&255,B[3]=b>>>24&255,n.check=a(n.check,B,4,0)),x=b=0,n.mode=4;case 4:for(;x<16;){if(v===0)break e;v--,b+=p[g++]<>8),512&n.flags&&(B[0]=255&b,B[1]=b>>>8&255,n.check=a(n.check,B,2,0)),x=b=0,n.mode=5;case 5:if(1024&n.flags){for(;x<16;){if(v===0)break e;v--,b+=p[g++]<>>8&255,n.check=a(n.check,B,2,0)),x=b=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(v<(E=n.length)&&(E=v),E&&(n.head&&(F=n.head.extra_len-n.length,n.head.extra||(n.head.extra=Array(n.head.extra_len)),r.arraySet(n.head.extra,p,g,E,F)),512&n.flags&&(n.check=a(n.check,p,E,g)),v-=E,g+=E,n.length-=E),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(v===0)break e;for(E=0;F=p[g+ E++],n.head&&F&&n.length<65536&&(n.head.name+=String.fromCharCode(F)),F&&E>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;x<32;){if(v===0)break e;v--,b+=p[g++]<>>=7&x,x-=7&x,n.mode=27;break}for(;x<3;){if(v===0)break e;v--,b+=p[g++]<>>=1)){case 0:n.mode=14;break;case 1:if(w(n),n.mode=20,t!==6)break;b>>>=2,x-=2;break e;case 2:n.mode=17;break;case 3:e.msg=`invalid block type`,n.mode=30}b>>>=2,x-=2;break;case 14:for(b>>>=7&x,x-=7&x;x<32;){if(v===0)break e;v--,b+=p[g++]<>>16^65535)){e.msg=`invalid stored block lengths`,n.mode=30;break}if(n.length=65535&b,x=b=0,n.mode=15,t===6)break e;case 15:n.mode=16;case 16:if(E=n.length){if(v>>=5,x-=5,n.ndist=1+(31&b),b>>>=5,x-=5,n.ncode=4+(15&b),b>>>=4,x-=4,286>>=3,x-=3}for(;n.have<19;)n.lens[V[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,L={bits:n.lenbits},I=s(0,n.lens,0,19,n.lencode,0,n.work,L),n.lenbits=L.bits,I){e.msg=`invalid code lengths set`,n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,j=65535&z,!((k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=k,x-=k,n.lens[n.have++]=j;else{if(j===16){for(R=k+2;x>>=k,x-=k,n.have===0){e.msg=`invalid bit length repeat`,n.mode=30;break}F=n.lens[n.have-1],E=3+(3&b),b>>>=2,x-=2}else if(j===17){for(R=k+3;x>>=k)),b>>>=3,x-=3}else{for(R=k+7;x>>=k)),b>>>=7,x-=7}if(n.have+E>n.nlen+n.ndist){e.msg=`invalid bit length repeat`,n.mode=30;break}for(;E--;)n.lens[n.have++]=F}}if(n.mode===30)break;if(n.lens[256]===0){e.msg=`invalid code -- missing end-of-block`,n.mode=30;break}if(n.lenbits=9,L={bits:n.lenbits},I=s(c,n.lens,0,n.nlen,n.lencode,0,n.work,L),n.lenbits=L.bits,I){e.msg=`invalid literal/lengths set`,n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,L={bits:n.distbits},I=s(l,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,L),n.distbits=L.bits,I){e.msg=`invalid distances set`,n.mode=30;break}if(n.mode=20,t===6)break e;case 20:n.mode=21;case 21:if(6<=v&&258<=y){e.next_out=_,e.avail_out=y,e.next_in=g,e.avail_in=v,n.hold=b,n.bits=x,o(e,C),_=e.next_out,m=e.output,y=e.avail_out,g=e.next_in,p=e.input,v=e.avail_in,b=n.hold,x=n.bits,n.mode===12&&(n.back=-1);break}for(n.back=0;A=(z=n.lencode[b&(1<>>16&255,j=65535&z,!((k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>M)])>>>16&255,j=65535&z,!(M+(k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=M,x-=M,n.back+=M}if(b>>>=k,x-=k,n.back+=k,n.length=j,A===0){n.mode=26;break}if(32&A){n.back=-1,n.mode=12;break}if(64&A){e.msg=`invalid literal/length code`,n.mode=30;break}n.extra=15&A,n.mode=22;case 22:if(n.extra){for(R=n.extra;x>>=n.extra,x-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;A=(z=n.distcode[b&(1<>>16&255,j=65535&z,!((k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>M)])>>>16&255,j=65535&z,!(M+(k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=M,x-=M,n.back+=M}if(b>>>=k,x-=k,n.back+=k,64&A){e.msg=`invalid distance code`,n.mode=30;break}n.offset=j,n.extra=15&A,n.mode=24;case 24:if(n.extra){for(R=n.extra;x>>=n.extra,x-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg=`invalid distance too far back`,n.mode=30;break}n.mode=25;case 25:if(y===0)break e;if(E=C-y,n.offset>E){if((E=n.offset-E)>n.whave&&n.sane){e.msg=`invalid distance too far back`,n.mode=30;break}D=E>n.wnext?(E-=n.wnext,n.wsize-E):n.wnext-E,E>n.length&&(E=n.length),O=n.window}else O=m,D=_-n.offset,E=n.length;for(yv?(b=L[R+d[w]],N[P+d[w]]):(b=96,0),p=1<>k)+(m-=p)]=y<<24|b<<16|x|0,m!==0;);for(p=1<>=1;if(p===0?M=0:(M&=p-1,M+=p),w++,--F[C]==0){if(C===E)break;C=t[n+d[w]]}if(D>>7)]}function L(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function R(e,t,n){e.bi_valid>h-n?(e.bi_buf|=t<>h-e.bi_valid,e.bi_valid+=n-h):(e.bi_buf|=t<>>=1,n<<=1,0<--t;);return n>>>1}function V(e,t,n){var r,i,a=Array(m+1),o=0;for(r=1;r<=m;r++)a[r]=o=o+n[r-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];s!==0&&(e[2*i]=B(a[s]++,s))}}function H(e){var t;for(t=0;t>1;1<=n;n--)te(e,a,n);for(i=c;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],te(e,a,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,a[2*i]=a[2*n]+a[2*r],e.depth[i]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,a[2*n+1]=a[2*r+1]=i,e.heap[1]=i++,te(e,a,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,i,a,o,s,c=t.dyn_tree,l=t.max_code,u=t.stat_desc.static_tree,d=t.stat_desc.has_stree,f=t.stat_desc.extra_bits,h=t.stat_desc.extra_base,g=t.stat_desc.max_length,_=0;for(a=0;a<=m;a++)e.bl_count[a]=0;for(c[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n>=7;r>>=1)if(1&n&&e.dyn_ltree[2*t]!==0)return i;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return a;for(t=32;t>>3,(s=e.static_len+3+7>>>3)<=o&&(o=s)):o=s=n+5,n+4<=o&&t!==-1?se(e,t,n,r):e.strategy===4||s===o?(R(e,2+(r?1:0),3),ne(e,T,E)):(R(e,4+(r?1:0),3),function(e,t,n,r){var i;for(R(e,t-257,5),R(e,n-1,5),R(e,r-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,t===0?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(O[n]+l+1)]++,e.dyn_dtree[2*I(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){R(e,2,3),z(e,_,T),function(e){e.bi_valid===16?(L(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,n){t.exports=function(){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}},{}],54:[function(e,t,n){(function(e){(function(e,t){if(!e.setImmediate){var n,r,i,a,o=1,s={},c=!1,l=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,n={}.toString.call(e.process)===`[object process]`?function(e){process.nextTick(function(){f(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage(``,`*`),e.onmessage=n,t}}()?(a=`setImmediate$`+Math.random()+`$`,e.addEventListener?e.addEventListener(`message`,p,!1):e.attachEvent(`onmessage`,p),function(t){e.postMessage(a+t,`*`)}):e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){f(e.data)},function(e){i.port2.postMessage(e)}):l&&`onreadystatechange`in l.createElement(`script`)?(r=l.documentElement,function(e){var t=l.createElement(`script`);t.onreadystatechange=function(){f(e),t.onreadystatechange=null,r.removeChild(t),t=null},r.appendChild(t)}):function(e){setTimeout(f,0,e)},u.setImmediate=function(e){typeof e!=`function`&&(e=Function(``+e));for(var t=Array(arguments.length-1),r=0;r`u`?e===void 0?this:e:self)}).call(this,typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:{})},{}]},{},[10])(10)})})),Rd=u(Ld(),1);const zd=`username_claim`,Bd=1,Vd=1800,Hd=3500;function Ud(e){return typeof e==`object`&&!!e}function Wd(e){return typeof e==`string`}function Gd(e){return typeof e==`number`&&Number.isFinite(e)}function Kd(e){return e===void 0||Wd(e)}function qd(e){return e===void 0||Gd(e)}function Jd(e){return e===void 0||e===`x`||e===`manual`}function Yd(e){return Ud(e)?e.kind===`username_claim`&&Wd(e.username)&&Wd(e.normalized)&&Wd(e.originHash)&&(e.ownerHint===void 0||e.ownerHint===null||Wd(e.ownerHint)):!1}function Xd(e){return Ud(e)?Wd(e.hash)&&(e.url===void 0||Wd(e.url))&&Yd(e.payload)&&(e.ownerHint===void 0||e.ownerHint===null||Wd(e.ownerHint)):!1}function Zd(e){return Ud(e)?e.kind===`text`&&Wd(e.text):!1}function Qd(e){return Ud(e)?e.kind===`code`&&Wd(e.code)&&Kd(e.lang):!1}function $d(e){if(!Ud(e))return!1;let t=e.mode,n=t===void 0||t===`code`||t===`sanitized`;return e.kind===`html`&&Wd(e.html)&&n}function ef(e){return Ud(e)?e.kind===`md`&&Wd(e.md):!1}function tf(e){return Zd(e)||Qd(e)||$d(e)||ef(e)}function nf(e){return e===void 0||tf(e)}function rf(e){return Ud(e)?e.kind===`url`&&Wd(e.url)&&Kd(e.title):!1}function af(e){if(!Ud(e))return!1;let t=e.kind===`file-ref`,n=e.sha256;return!!t&&Wd(n)&&/^[0-9a-f]{64}$/.test(n)&&Kd(e.name)&&Kd(e.type)&&qd(e.size)&&(e.url===void 0||Wd(e.url))}function of(e){return Ud(e)?e.kind===`file-inline`&&Kd(e.name)&&Kd(e.type)&&qd(e.size)&&Wd(e.data_b64url)&&(e.thumbnail_b64===void 0||Wd(e.thumbnail_b64)):!1}function sf(e){return rf(e)||af(e)||of(e)}function cf(e){return!(!Ud(e)||e.version!==1||!Array.isArray(e.items)||!e.items.every(sf)||!qd(e.totalBytes)||!qd(e.inlinedBytes))}function lf(e){return e===void 0||Ud(e)}function uf(e){return Ud(e)?e.v===2&&Wd(e.url)&&Gd(e.pulse)&&Jd(e.source)&&Kd(e.caption)&&nf(e.body)&&Kd(e.author)&&Kd(e.sigilId)&&Kd(e.phiKey)&&Kd(e.kaiSignature)&&Kd(e.parent)&&Kd(e.parentUrl)&&Kd(e.originUrl)&&qd(e.ts)&&(e.attachments===void 0||cf(e.attachments))&&lf(e.seal)&&(e.usernameClaim===void 0||Xd(e.usernameClaim)):!1}function df(e){return Ud(e)?e.v===1&&Wd(e.url)&&Gd(e.pulse)&&Jd(e.source)&&Kd(e.caption)&&Kd(e.author)&&Kd(e.sigilId)&&Kd(e.phiKey)&&Kd(e.kaiSignature)&&Kd(e.parent)&&Kd(e.parentUrl)&&Kd(e.originUrl)&&qd(e.ts)&&(e.attachments===void 0||cf(e.attachments)):!1}var ff=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,pf=(()=>{let e=new Int16Array(256);for(let t=0;t<256;t++)e[t]=-1;for(let t=0;t<64;t++)e[ff.charCodeAt(t)]=t;return e})();function mf(e){let t=[],n=e.length,r=0;for(;r+2>>18&63]+ff[n>>>12&63]+ff[n>>>6&63]+ff[n&63])}let i=n-r;if(i===1){let n=e[r]<<16;t.push(ff[n>>>18&63]+ff[n>>>12&63]+`==`)}else if(i===2){let n=e[r]<<16|e[r+1]<<8;t.push(ff[n>>>18&63]+ff[n>>>12&63]+ff[n>>>6&63]+`=`)}return t.join(``).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function hf(e){let t=(e??``).trim();if(!t)return new Uint8Array;let n=t.replace(/-/g,`+`).replace(/_/g,`/`);n=n.replace(/[\r\n\s]/g,``);let r=(4-n.length%4)%4;r&&(n+=`=`.repeat(r));let i=n.length;if(i%4!=0)throw Error(`Invalid base64 length`);let a=i/4*3;i>=2&&n[i-2]===`=`&&n[i-1]===`=`?a-=2:i>=1&&n[i-1]===`=`&&--a;let o=new Uint8Array(a),s=0;for(let e=0;e>>16&255,d!==64&&s>>8&255),f!==64&&s1e6)return null;let t=hf(e);if(t.length===0)return null;let n=new TextDecoder().decode(t),r=JSON.parse(n);return uf(r)?r:df(r)?_f(r):null}catch{return null}}function yf(e){if(e instanceof ArrayBuffer)return e;let t=new Uint8Array(e),n=new ArrayBuffer(t.byteLength);return new Uint8Array(n).set(t),n}function bf(e){let t=new Uint8Array(e),n=``;for(let e=0;e{let{createHash:e}=await import(`./__vite-browser-external-CUSLmM9D.js`).then(f(1));return{createHash:e}},[]);return n(`sha256`).update(new Uint8Array(t)).digest(`hex`)}function Sf(e,t){let n=yf(e);try{return new Blob([n],{type:t||`application/octet-stream`})}catch{return new Blob([n])}}function Cf(e){return hf(e)}function wf(e){let t=0,n=0,r=e.attachments?.items??[];for(let e of r)e.kind===`file-ref`?t+=e.size??0:e.kind===`file-inline`&&(t+=e.size??0,n+=e.data_b64url.length*.75,e.thumbnail_b64&&(n+=e.thumbnail_b64.length*.75));return{totalBytes:Math.round(t),inlinedBytes:Math.round(n)}}function Tf(e){if(!e.attachments)return e;let t=e.attachments.items.map(e=>{if(e.kind===`file-inline`&&e.thumbnail_b64){let t={...e};return delete t.thumbnail_b64,t}return e}),{totalBytes:n,inlinedBytes:r}=wf({attachments:{...e.attachments,items:t}});return{...e,attachments:{version:1,items:t,totalBytes:n,inlinedBytes:r}}}async function Ef(e,t={}){let n=t.cacheName??`sigil-attachments-v1`,r=(t.pathPrefix??`/att/`).replace(/\/+$/,``)+`/`,i=Tf(e);if(!i.attachments||i.attachments.items.length===0||!(globalThis.caches!==void 0&&typeof globalThis.caches.open==`function`))return i;let a=null;try{a=await globalThis.caches.open(n)}catch{a=null}let o=[];for(let e of i.attachments.items){if(e.kind!==`file-inline`){o.push(e);continue}if(!a){o.push(e);continue}try{let t=Cf(e.data_b64url),n=await xf(t.buffer),i=Sf(t.buffer,e.type),s=`${r}${n}`;await a.put(new Request(s,{method:`GET`}),new Response(i,{headers:e.type?{"Content-Type":e.type}:void 0}));let c={kind:`file-ref`,name:e.name,type:e.type,size:e.size,sha256:n,url:s};o.push(c)}catch{o.push(e)}}return{...i,attachments:Rf(o)}}function Df(e){let t=gf(Tf(e));return{token:t,withinSoft:t.length<=Vd,withinHard:t.length<=Hd}}function Of(e){let t=(e??``).trim();if(!t)return``;if(/%[0-9A-Fa-f]{2}/.test(t))try{t=decodeURIComponent(t)}catch{}return t.includes(` `)&&(t=t.replace(/ /g,`+`)),/[+/=]/.test(t)&&(t=t.replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)),t}function kf(e){try{let t=e??(typeof window<`u`&&window.location?window.location:null);if(!t)return null;let n=t.hash.startsWith(`#`)?t.hash.slice(1):t.hash,r=t.search.startsWith(`?`)?t.search.slice(1):t.search,i=new URLSearchParams(n),a=new URLSearchParams(r),o=i.get(`t`)??i.get(`p`)??i.get(`token`);if(o)return Of(o);let s=a.get(`t`)??a.get(`p`)??a.get(`token`);if(s)return Of(s);let c=t.pathname.match(/^\/(?:stream|feed)\/p\/([^/?#]+)\/?$/);if(c?.[1])return Of(c[1]);let l=t.pathname.match(/^\/p~([^/?#]+)\/?$/);return l?.[1]?Of(l[1]):null}catch{return null}}function Af(e){let t=(e??``).trim();if(!t)return null;let n=t.split(`?`)[0].split(`#`)[0],r=e=>{try{return decodeURIComponent(e)}catch{return e}},i=n.match(/^\/p~([^/?#]+)\/?$/);if(i?.[1])return Of(r(i[1]));let a=n.match(/^\/(?:stream|feed)\/p\/([^/?#]+)\/?$/);return a?.[1]?Of(r(a[1])):null}function jf(e){let t=typeof window<`u`?window.location?.origin??void 0:void 0,n=e.trim();if(!n)return null;if(/^[A-Za-z0-9_-]{16,}$/u.test(n))return Of(n);let r;try{r=new URL(n)}catch{try{r=new URL(n,t)}catch{return null}}let i=r.pathname||``;{let e=i.match(/\/(?:stream|feed)\/p\/([^/?#]+)/u);if(e?.[1])return Of(e[1])}{let e=i.match(/\/p\/([^/?#]+)/u);if(e?.[1])return Of(e[1])}{let e=i.match(/\/p(?:\u007e|%7[Ee])\/?([^/?#]+)/u);if(e?.[1])return Of(e[1])}let a=r.hash&&r.hash.startsWith(`#`)?r.hash.slice(1):``,o=new URLSearchParams(a);for(let e of[`t`,`p`,`token`,`capsule`]){let t=o.get(e);if(t)return Of(t);let n=r.searchParams.get(e);if(n)return Of(n)}return null}async function Mf(e,t={}){let n=Tf(e);if(Df(n).withinHard||!(n.attachments?.items?.some(e=>e.kind===`file-inline`)??!1))return n;if(!(globalThis.caches!==void 0&&typeof globalThis.caches.open==`function`))throw Error(`Inline attachments exceed safe token size, but CacheStorage is unavailable on this device/session. Attach via a public URL (Drive/S3/IPFS) or use smaller files.`);let r=await Ef(n,t),i=Df(r),a=r.attachments?.items?.some(e=>e.kind===`file-inline`)??!1;if(!i.withinHard&&a)throw Error(`Inline attachments are still too large to share safely (and could not be cached). Attach via public URL or reduce inline file size/count.`);return Tf(r)}function Nf(e){return{kind:`text`,text:e}}function Pf(e,t){return{kind:`code`,code:e,lang:t}}function Ff(e,t){return{kind:`html`,html:e,mode:t}}function If(e){return{kind:`md`,md:e}}function Lf(e){let t=e.parentUrl??e.parent,n=e.caption??(e.body?.kind===`text`&&e.body.text.length>0?e.body.text:void 0);return{v:2,url:e.url,pulse:e.pulse,caption:n,body:e.body,author:e.author,source:e.source,sigilId:e.sigilId,phiKey:e.phiKey,kaiSignature:e.kaiSignature,parent:e.parent,parentUrl:t,originUrl:e.originUrl,ts:e.ts,attachments:e.attachments,seal:e.seal,usernameClaim:e.usernameClaim}}function Rf(e){let t={version:1,items:e.slice()},{totalBytes:n,inlinedBytes:r}=wf({attachments:t});return t.totalBytes=n,t.inlinedBytes=r,t}function zf(e){return{kind:`file-inline`,name:e.name,type:e.type,size:e.size,data_b64url:e.data_b64url,thumbnail_b64:e.thumbnail_b64}}function Bf(e){if(!/^[0-9a-f]{64}$/.test(e.sha256))throw Error(`sha256 must be 64 hex chars`);return{kind:`file-ref`,sha256:e.sha256,name:e.name,type:e.type,size:e.size,url:e.url}}function Vf(e){return{kind:`url`,url:e.url,title:e.title}}function Hf(e){let t=JSON.stringify(e);return`h:${Jf(Kf(new TextEncoder().encode(t)))}`}function Uf(e){if(!e.startsWith(`h:`))throw Error(`Invalid history param`);let t=qf(Yf(e.slice(2))),n=new TextDecoder().decode(t);return JSON.parse(n)}var Wf=e=>typeof globalThis.btoa==`function`?globalThis.btoa(e):Buffer.from(e,`binary`).toString(`base64`),Gf=e=>typeof globalThis.atob==`function`?globalThis.atob(e):Buffer.from(e,`base64`).toString(`binary`),Kf=e=>Wf(String.fromCharCode(...e)),qf=e=>Uint8Array.from(Gf(e),e=>e.charCodeAt(0)),Jf=e=>e.replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``),Yf=e=>{let t=e.replace(/-/g,`+`).replace(/_/g,`/`);return t+(t.length%4?`=`.repeat(4-t.length%4):``)};function Xf(e){let t={u:e.pulse,b:e.beat,s:e.stepIndex,c:e.chakraDay,d:e.stepsPerBeat??44,k:e.kaiSignature,p:e.userPhiKey};e.parentUrl&&(t.r=e.parentUrl),e.originUrl&&(t.o=e.originUrl);let n=JSON.stringify(t);return`c:${Jf(Kf(new TextEncoder().encode(n)))}`}function Zf(e){if(e.startsWith(`c:`)){let t=qf(Yf(e.slice(2))),n=new TextDecoder().decode(t),r=JSON.parse(n);return{pulse:Number(r.u)||0,beat:Number(r.b)||0,stepIndex:Number(r.s)||0,chakraDay:r.c,stepsPerBeat:Number(r.d)||44,kaiSignature:typeof r.k==`string`?r.k:void 0,userPhiKey:typeof r.p==`string`?r.p:void 0,parentUrl:typeof r.r==`string`?r.r:void 0,originUrl:typeof r.o==`string`?r.o:void 0}}let t=qf(Yf(e.startsWith(`j:`)?e.slice(2):e)),n=new TextDecoder().decode(t),r=JSON.parse(n),i={pulse:Number(r.pulse)||0,beat:Number(r.beat)||0,stepIndex:Number(r.stepIndex)||0,chakraDay:r.chakraDay,stepsPerBeat:Number(r.stepsPerBeat)||44,kaiSignature:typeof r.kaiSignature==`string`?r.kaiSignature:void 0,userPhiKey:typeof r.userPhiKey==`string`?r.userPhiKey:void 0,parentUrl:typeof r.parentUrl==`string`?r.parentUrl:void 0,originUrl:typeof r.originUrl==`string`?r.originUrl:void 0},a={expiresAtPulse:r.expiresAtPulse==null?void 0:Number(r.expiresAtPulse),canonicalHash:typeof r.canonicalHash==`string`?r.canonicalHash:void 0,transferNonce:typeof r.transferNonce==`string`?r.transferNonce:void 0,exportedAtPulse:r.exportedAtPulse==null?void 0:Number(r.exportedAtPulse),claimExtendUnit:r.claimExtendUnit===`breaths`||r.claimExtendUnit===`steps`?r.claimExtendUnit:void 0,claimExtendAmount:r.claimExtendAmount==null?void 0:Number(r.claimExtendAmount)};return{...r,...a,...i}}function Qf(e,t,n){let r=typeof window<`u`&&window.location?.origin?window.location.origin:``,i=n?.absolute===!1?``:n?.origin??r,a={...t},o=n?.parentUrl||(n?.autoInferParent&&typeof window<`u`?window.location.href:void 0);if(o&&!a.parentUrl){a.parentUrl=o;try{let e=np(o);a.originUrl=a.originUrl||e?.originUrl||o}catch{a.originUrl=a.originUrl||o}}let s=Xf(a),c=`/s/${encodeURIComponent(e)}?p=${s}`;return i?`${i}${c}`:c}function $f(e){try{return new URL(e,`resolve://`).searchParams.get(`p`)??null}catch{let t=e.match(/[?&]p=([^&#]+)/);return t?decodeURIComponent(t[1]):null}}function ep(e){try{let t=new URL(e,`https://example.invalid`);if(t.hash){let e=new URLSearchParams(t.hash.replace(/^#/,``)).get(`t`);if(e)return e}return Af(t.pathname)||(t.searchParams.get(`p`)??null)}catch{let t=e.match(/#(?:t|p)=([^&#]+)/);if(t)return decodeURIComponent(t[1]);let n=e.match(/\/p~([^/?#]+)/);if(n)return decodeURIComponent(n[1]);let r=e.match(/\/(?:stream|feed)\/p\/([^/]+)/);if(r)return decodeURIComponent(r[1]);let i=e.match(/[?&]p=([^&#]+)/);return i?decodeURIComponent(i[1]):null}}function tp(e){let t=ep(e);if(!t)return null;let n=vf(t);if(!n)return null;let r=0,i=0,a=`Root`,o=44;try{let e=Ir(n.pulse);typeof e.beat==`number`?r=e.beat:typeof e.beatIndex==`number`&&(r=e.beatIndex),typeof e.stepIndex==`number`&&(i=e.stepIndex),typeof e.chakraDay==`string`&&(a=e.chakraDay),typeof e.stepsPerBeat==`number`&&(o=e.stepsPerBeat)}catch{}let s=typeof n.parentUrl==`string`?n.parentUrl:typeof n.parent==`string`?n.parent:void 0;return{pulse:n.pulse,beat:r,stepIndex:i,chakraDay:a,stepsPerBeat:o,kaiSignature:typeof n.kaiSignature==`string`?n.kaiSignature:void 0,userPhiKey:typeof n.phiKey==`string`?n.phiKey:void 0,parentUrl:s,originUrl:typeof n.originUrl==`string`?n.originUrl:void 0,feed:n}}function np(e){let t=$f(e);if(t)try{return Zf(t)}catch{}return tp(e)}function rp(e){let t=[],n=e,r=new Set;for(;n&&!r.has(n);){r.add(n),t.push(n);let e=np(n);if(!e?.parentUrl)break;n=e.parentUrl}return t}function ip(e){let t=np(e);if(t?.originUrl)return t.originUrl;let n=rp(e);return n.length?n[n.length-1]:void 0}const ap=`kai:sigils:v1`,op=`sigil:urls`,sp=`kai-sigil-registry`;var cp=typeof window<`u`;function lp(e){if(!cp)return[];try{let t=window.localStorage.getItem(e);if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(e=>typeof e==`string`):[]}catch{return[]}}function up(e,t){if(cp)try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}}function dp(e,t){return e.includes(t)?!1:(e.push(t),!0)}function fp(e){try{return new URL(e,cp?window.location.origin:`https://example.invalid`).toString()}catch{return e}}var pp=null;function mp(){return!cp||!(`BroadcastChannel`in window)?null:pp||(pp=new BroadcastChannel(sp),pp)}function hp(e){if(!cp||!e)return;let t=fp(e),n=lp(ap);dp(n,t)&&up(ap,n);let r=lp(op);dp(r,t)&&up(op,r);try{window.dispatchEvent(new CustomEvent(`sigil:url-registered`,{detail:{url:t}}))}catch{}try{mp()?.postMessage({type:`sigil:add`,url:t})}catch{}}function gp(e){try{let t=new URL(e),n=t.pathname.match(/\/(?:s|sigil)\/([a-f0-9]{6,})/i)?.[1],r=np(e);if(n&&r)return Qf(n,r);let i=t.hash?.slice(1).match(/^([a-f0-9]{6,})$/i)?.[1];return i&&r?Qf(i,r):null}catch(e){return console.error(`Failed to generate canonical QR URL:`,e),null}}function _p(e){if(e)try{return new URL(e).origin}catch{}return typeof window<`u`&&typeof window.location?.origin==`string`&&window.location.origin?window.location.origin:`https://kaiklok.com`}function vp(e,t){let n=_p(t),r=(e??``).toString().trim().toLowerCase();if(!r)return n+`/`;let i=new URL(`/s/${encodeURIComponent(r)}`,n);if(typeof window<`u`){let e=new URLSearchParams(window.location.search),t=e.get(`d`);t&&i.searchParams.set(`d`,t);let n=e.get(`t`);n&&i.searchParams.set(`t`,n)}return i.toString()}const yp=(1+Math.sqrt(5))/2,bp=`ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial`,xp=1e3,Sp=xp/2,Cp={Root:{sides:4,hue:0},Sacral:{sides:6,hue:30},"Solar Plexus":{sides:5,hue:53},Heart:{sides:8,hue:122},Throat:{sides:12,hue:180},"Third Eye":{sides:14,hue:222},Crown:{sides:16,hue:258}},wp={Root:`Earth Gate`,Sacral:`Water Gate`,"Solar Plexus":`Fire Gate`,Heart:`Air Gate`,Throat:`Will Gate`,"Third Eye":`Light Gate`,Crown:`Ether Gate`},Tp={Root:194.18,Sacral:210.42,"Solar Plexus":378.4,Heart:620.9,Throat:1292.3,"Third Eye":1664.7,Crown:2594.2},Ep={Solhara:`Root`,Aquaris:`Solar Plexus`,Flamora:`Heart`,Verdari:`Throat`,Sonari:`Third Eye`,Kaelith:`Crown`},Dp=e=>e===`Solhara`||e===`Aquaris`||e===`Flamora`||e===`Verdari`||e===`Sonari`||e===`Kaelith`,Op=e=>Dp(e)?Ep[e]:e,kp=(e,t=100,n=50)=>`hsl(${e} ${t}% ${n}%)`,Ap=(e,t=0,n=.38)=>{let r=xp*n,i=[];for(let n=0;n{let r=[];for(let i=0;i<360;i+=1){let a=i/359*2*Math.PI,o=(Math.sin(e*a+n)+1)/2*xp,s=(Math.sin(t*a)+1)/2*xp;r.push(`${i?`L`:`M`}${o},${s}`)}return`${r.join(``)}Z`};function Mp(e){let t=((Number.isFinite(e)?Math.trunc(e):0)%484+484)%484,n=Math.floor(t/11);return Math.min(Math.max(0,n),43)}function Np(e){let t=((Number.isFinite(e)?Math.trunc(e):0)%484+484)%484%11/11;return t>=1?1-2**-52:t<0?0:t}const Pp=(e,t)=>+(Tp[e]*yp**((Number.isFinite(t)?t:0)/44)).toFixed(3),Fp=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Ip=e=>JSON.stringify(e,(e,t)=>t instanceof Date?t.toISOString():typeof t==`bigint`?t.toString():t),Lp=(e,t)=>{if(!Fp(e))return;let n=e[t];return typeof n==`string`?n:void 0},Rp=(e,t)=>{if(!Fp(e))return;let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0},zp=e=>`${e}`;var Bp=e=>e instanceof Date?e.toISOString():String(e);function Vp(e,t,n=6){let r={},i=(e,t)=>{r[`data-${e}`]=t},a=(e,t,r)=>{if(!(r>n)){if(Array.isArray(t)){i(e,JSON.stringify(t.map(e=>e instanceof Date?e.toISOString():e)));return}if(Fp(t)){for(let[n,i]of Object.entries(t))a(`${e}-${n.replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-+|-+$/g,``).toLowerCase()}`,i,r+1);return}typeof t==`number`||typeof t==`string`||t===void 0||t===`null`||t===null?i(e,t===null?void 0:typeof t==`number`?t:Bp(t)):i(e,Bp(t))}};for(let[n,r]of Object.entries(t))a(`${e}-${n.replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-+|-+$/g,``).toLowerCase()}`,r,1);return r}const Hp=(e,t=220)=>e?e.replace(/\s+/g,` `).trim().slice(0,t):void 0,Up=(e,t=NaN)=>typeof e==`number`&&Number.isFinite(e)?Math.trunc(e):t,Wp=(e,t=NaN)=>typeof e==`number`&&Number.isFinite(e)?Math.max(0,Math.min(1-2**-52,e)):t,Gp=e=>[...e].map(e=>e.toString(16)).map(e=>e.padStart(2,`0`)).join(``);function Kp(e){return!(typeof SharedArrayBuffer<`u`&&e.buffer instanceof SharedArrayBuffer)&&e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.slice().buffer}async function qp(e){let t=typeof e==`string`?new TextEncoder().encode(e):e,n=await crypto.subtle.digest(`SHA-256`,Kp(t));return new Uint8Array(n)}var Jp=`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`;function Yp(e){let t=0n;for(let n of e)t=(t<<8n)+BigInt(n);let n=``;for(;t>0n;){let e=t%58n;n=Jp[Number(e)]+n,t/=58n}for(let t=0;t>>0;return function(){t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|t)^e,((e^e>>>14)>>>0)/4294967296}}const Qp=e=>{let t=e.replace(/^0x/i,``),n=new Uint8Array(t.length/2);for(let e=0;e>>0;for(let n=0;n>>1:t>>>1}return~t>>>0}const em=e=>{let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=t.length%4;n&&(t+=`=`.repeat(4-n));let r=atob(t),i=new Uint8Array(r.length);for(let e=0;eString(e))),typeof e.ext==`boolean`&&(t.ext=e.ext),t}function rm(){let[e,t]=(0,C.useState)(!1),[n,r]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),n=window.matchMedia(`(prefers-contrast: more)`),i=()=>{t(!!e.matches),r(!!n.matches)};return i(),e.addEventListener?.(`change`,i),n.addEventListener?.(`change`,i),()=>{e.removeEventListener?.(`change`,i),n.removeEventListener?.(`change`,i)}},[]),{prefersReduce:e,prefersContrast:n}}var im=e=>typeof e==`object`&&!!e;function am(e){let[t,n]=(0,C.useState)(null),r=(0,C.useRef)(null);return(0,C.useEffect)(()=>{r.current=t},[t]),(0,C.useEffect)(()=>{if(e!==`moment`)return;let t=!1,r=async()=>{try{let e=await ji();!t&&im(e)&&n(e)}catch{}};r();let i=window.setInterval(r,qn);return()=>{t=!0,window.clearInterval(i)}},[e]),{kaiData:t,kaiDataRef:r}}function om(e){let t=e=>{let t=2166136261;for(let n=0;n>>0};return(0,C.useMemo)(()=>t(e),[e])}function sm(){return(0,C.useMemo)(()=>async e=>{let t=new TextEncoder().encode(e),n=await crypto.subtle.digest(`SHA-256`,Kp(t));return Array.from(new Uint8Array(n)).map(e=>e.toString(16)).map(e=>e.padStart(2,`0`)).join(``)},[])}var cm=({uid:e,size:t,phaseColor:n,outerRingText:r,innerRingText:i,animate:a,prefersReduce:o})=>{xp*.34;let s=340/yp,c=s*.96/(xp/2),l=`${e}-zk-phi-ring`,u=`${e}-zk-bin-ring`,d=`${e}-zk-grad`,f=`${e}-zk-petal-def`,p=Math.max(1,(t??240)*.008),m=Math.max(.9,(t??240)*.007),h=Math.max(1.2,(t??240)*.009),g=a&&!o,_=(0,C.useRef)(null);(0,C.useEffect)(()=>{if(!g)return;let e=_.current;if(!e)return;let t=0,n=performance.now(),r=qn/1e3,i=1/r*(yp*.21),a=1/r*((yp-1)*.17),o=1/r*(Math.SQRT2*.15),s=Math.PI/2,c=Math.PI/3,l=()=>{let r=(performance.now()-n)/1e3,u=5+1.6*(.5+.5*Math.sin(2*Math.PI*i*r)),d=8+1.2*(.5+.5*Math.sin(2*Math.PI*a*r+1.234)),f=s+c*Math.sin(2*Math.PI*o*r+.777);e.setAttribute(`d`,jp(u,d,f)),t=requestAnimationFrame(l)};return t=requestAnimationFrame(l),()=>cancelAnimationFrame(t)},[g]);let v=Math.max(8,(t??240)*.026),y=Math.max(7,(t??240)*.022),b=e=>e*.62,x=(e,t)=>{let n=2*Math.PI*e;return Math.max(48,Math.floor(n/b(t)))},S=(e,t)=>{let n=(e??``).trim();if(!n)return``;let r=[`sig=`,`b58=`,`len=`,`crc32=`,`creator=`,`zk=`,`alg=`,`day=`,`beat=`,`hz=`,`poseidon=`],i=n.split(` · `).map(e=>e.trim()).filter(Boolean),a=i.filter(e=>r.some(t=>e.startsWith(t))),o=(a.length?a:i).join(` · `);return o.length<=t?o:o.slice(0,Math.max(0,t-1)).trimEnd()+`…`},w=(0,C.useMemo)(()=>S(r,x(340,v)),[r,340,v]),T=(0,C.useMemo)(()=>S(i,x(s,y)),[i,s,y]),E=(e,t,n,r,i,a)=>{let o=Array.from(e);if(!o.length)return null;let s=-Math.PI/2,c=o.length,l=Math.max(.45,r*.085);return(0,W.jsx)(`g`,{"aria-hidden":`true`,pointerEvents:`none`,children:o.map((e,o)=>{let u=s+o/c*Math.PI*2;return(0,W.jsx)(`text`,{transform:`translate(${500+t*Math.cos(u)} ${500+t*Math.sin(u)}) rotate(${u*180/Math.PI+90})`,fontFamily:n,fontSize:r,fill:i,opacity:a,textAnchor:`middle`,dominantBaseline:`middle`,letterSpacing:`0`,stroke:`#001014`,strokeOpacity:`0.6`,strokeWidth:l,paintOrder:`stroke`,children:e},`${o}-${e}`)})})};return(0,W.jsxs)(`g`,{id:`${e}-zk-glyph`,"aria-label":`Atlantean zero-knowledge verification glyph`,pointerEvents:`none`,children:[(0,W.jsxs)(`defs`,{children:[(0,W.jsxs)(`radialGradient`,{id:d,cx:`50%`,cy:`50%`,r:`60%`,children:[(0,W.jsx)(`stop`,{offset:`0%`,stopColor:n,stopOpacity:`0.85`,children:g&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`animate`,{attributeName:`stop-opacity`,values:`.55;.85;.55`,dur:`${qn}ms`,repeatCount:`indefinite`}),(0,W.jsx)(`animate`,{attributeName:`stop-color`,values:`${n};#00FFD0;${n}`,dur:`${qn*3}ms`,repeatCount:`indefinite`})]})}),(0,W.jsx)(`stop`,{offset:`55%`,stopColor:n,stopOpacity:`0.55`,children:g&&(0,W.jsx)(`animate`,{attributeName:`stop-color`,values:`${n};#00FFD0;${n}`,dur:`${qn*3}ms`,repeatCount:`indefinite`})}),(0,W.jsx)(`stop`,{offset:`100%`,stopColor:`#00FFD0`,stopOpacity:`0.25`,children:g&&(0,W.jsx)(`animate`,{attributeName:`stop-opacity`,values:`.15;.35;.15`,dur:`${qn}ms`,repeatCount:`indefinite`})})]}),(0,W.jsx)(`path`,{id:l,d:`M 500 160 a 340 340 0 1 1 0 ${2*340} a 340 340 0 1 1 0 -${2*340}`,fill:`none`}),(0,W.jsx)(`path`,{id:u,d:`M 500 ${500-s} a ${s} ${s} 0 1 1 0 ${2*s} a ${s} ${s} 0 1 1 0 -${2*s}`,fill:`none`}),(0,W.jsx)(`path`,{id:f,ref:_,d:jp(5,8,Math.PI/2)})]}),(0,W.jsx)(`circle`,{cx:500,cy:500,r:340,fill:`none`,stroke:`url(#${d})`,strokeWidth:h,opacity:`0.5`,vectorEffect:`non-scaling-stroke`}),Array.from({length:12},(e,t)=>(0,W.jsx)(`use`,{href:`#${f}`,transform:`translate(500,500) scale(${c}) rotate(${t*30}) translate(-500,-500)`,stroke:`url(#${d})`,strokeWidth:p,strokeLinecap:`round`,strokeLinejoin:`round`,opacity:`0.42`,fill:`none`,vectorEffect:`non-scaling-stroke`},t)),(0,W.jsxs)(`g`,{opacity:`0.25`,children:[(0,W.jsx)(`circle`,{cx:500-s/2.2,cy:500,r:s*.86,fill:`none`,stroke:n,strokeWidth:m}),(0,W.jsx)(`circle`,{cx:500+s/2.2,cy:500,r:s*.86,fill:`none`,stroke:`#00FFD0`,strokeWidth:m})]}),(0,W.jsx)(`circle`,{cx:500,cy:500,r:s,fill:`none`,stroke:`url(#${d})`,strokeWidth:m,opacity:`0.55`,vectorEffect:`non-scaling-stroke`}),w&&E(w,340,`ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`,v,n,.33),T&&E(T,s,`ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial`,y,`#00FFD0`,.28)]})};function lm(e){if(e instanceof Date)return e.toISOString();if(e===null||typeof e==`string`||typeof e==`boolean`)return e;if(typeof e==`number`)return Number.isFinite(e)?e:null;if(Array.isArray(e))return e.map(e=>lm(e));let t=e,n={},r=Object.keys(t).sort();for(let e of r){let r=t[e];r!==void 0&&(n[e]=lm(r))}return n}function um(e){let t=lm(e);return JSON.stringify(t)}function dm(e){return new TextEncoder().encode(um(e))}async function fm(e){let{blake3:t}=await O(async()=>{let{blake3:e}=await import(`./index.esm-jE_FWBZ6.js`);return{blake3:e}},[]);return t(e)}var pm=4,mm=0,hm=1,gm=2;function _m(e){let t=e.length;for(;--t>=0;)e[t]=0}var vm=0,ym=1,bm=2,xm=3,Sm=258,Cm=29,wm=256,Tm=wm+1+Cm,Em=30,Dm=19,Om=2*Tm+1,km=15,Am=16,jm=7,Mm=256,Nm=16,Pm=17,Fm=18,Im=new Uint8Array([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]),Lm=new Uint8Array([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]),Rm=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),zm=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Bm=512,Vm=Array((Tm+2)*2);_m(Vm);var Hm=Array(Em*2);_m(Hm);var Um=Array(Bm);_m(Um);var Wm=Array(Sm-xm+1);_m(Wm);var Gm=Array(Cm);_m(Gm);var Km=Array(Em);_m(Km);function qm(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 Jm,Ym,Xm;function Zm(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}var Qm=e=>e<256?Um[e]:Um[256+(e>>>7)],$m=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},eh=(e,t,n)=>{e.bi_valid>Am-n?(e.bi_buf|=t<>Am-e.bi_valid,e.bi_valid+=n-Am):(e.bi_buf|=t<{eh(e,n[t*2],n[t*2+1])},nh=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},rh=e=>{e.bi_valid===16?($m(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)},ih=(e,t)=>{let 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<=km;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;lc&&(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--)}},ah=(e,t,n)=>{let r=Array(km+1),i=0,a,o;for(a=1;a<=km;a++)i=i+n[a-1]<<1,r[a]=i;for(o=0;o<=t;o++){let t=e[o*2+1];t!==0&&(e[o*2]=nh(r[t]++,t))}},oh=()=>{let e,t,n,r,i,a=Array(km+1);for(n=0,r=0;r>=7;r{let t;for(t=0;t{e.bi_valid>8?$m(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},lh=(e,t,n,r)=>{let i=t*2,a=n*2;return e[i]{let r=e.heap[n],i=n<<1;for(;i<=e.heap_len&&(i{let r,i,a=0,o,s;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+ a++]&255,r+=(e.pending_buf[e.sym_buf+ a++]&255)<<8,i=e.pending_buf[e.sym_buf+ a++],r===0?th(e,i,t):(o=Wm[i],th(e,o+wm+1,t),s=Im[o],s!==0&&(i-=Gm[o],eh(e,i,s)),r--,o=Qm(r),th(e,o,n),s=Lm[o],s!==0&&(r-=Km[o],eh(e,r,s)));while(a{let 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=Om,o=0;o>1;o>=1;o--)uh(e,n,o);l=a;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],uh(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++,uh(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],ih(e,t),ah(n,c,e.bl_count)},ph=(e,t,n)=>{let 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{let 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{let t;for(ph(e,e.dyn_ltree,e.l_desc.max_code),ph(e,e.dyn_dtree,e.d_desc.max_code),fh(e,e.bl_desc),t=Dm-1;t>=3&&e.bl_tree[zm[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},gh=(e,t,n,r)=>{let i;for(eh(e,t-257,5),eh(e,n-1,5),eh(e,r-4,4),i=0;i{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return mm;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return hm;for(n=32;n{vh||=(oh(),!0),e.l_desc=new Zm(e.dyn_ltree,Jm),e.d_desc=new Zm(e.dyn_dtree,Ym),e.bl_desc=new Zm(e.bl_tree,Xm),e.bi_buf=0,e.bi_valid=0,sh(e)},bh=(e,t,n,r)=>{eh(e,(vm<<1)+(r?1:0),3),ch(e),$m(e,n),$m(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},xh={_tr_init:yh,_tr_stored_block:bh,_tr_flush_block:(e,t,n,r)=>{let i,a,o=0;e.level>0?(e.strm.data_type===gm&&(e.strm.data_type=_h(e)),fh(e,e.l_desc),fh(e,e.d_desc),o=hh(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?bh(e,t,n,r):e.strategy===pm||a===i?(eh(e,(ym<<1)+(r?1:0),3),dh(e,Vm,Hm)):(eh(e,(bm<<1)+(r?1:0),3),gh(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),dh(e,e.dyn_ltree,e.dyn_dtree)),sh(e),r&&ch(e)},_tr_tally:(e,t,n)=>(e.pending_buf[e.sym_buf+ e.sym_next++]=t,e.pending_buf[e.sym_buf+ e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+ e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(Wm[n]+wm+1)*2]++,e.dyn_dtree[Qm(t)*2]++),e.sym_next===e.sym_end),_tr_align:e=>{eh(e,ym<<1,3),th(e,Mm,Vm),rh(e)}},Sh=(e,t,n,r)=>{let i=e&65535|0,a=e>>>16&65535|0,o=0;for(;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},Ch=new Uint32Array((()=>{let e,t=[];for(var 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})()),wh=(e,t,n,r)=>{let i=Ch,a=r+n;e^=-1;for(let n=r;n>>8^i[(e^t[n])&255];return e^-1},Th={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`},Eh={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:Dh,_tr_stored_block:Oh,_tr_flush_block:kh,_tr_tally:Ah,_tr_align:jh}=xh,{Z_NO_FLUSH:Mh,Z_PARTIAL_FLUSH:Nh,Z_FULL_FLUSH:Ph,Z_FINISH:Fh,Z_BLOCK:Ih,Z_OK:Lh,Z_STREAM_END:Rh,Z_STREAM_ERROR:zh,Z_DATA_ERROR:Bh,Z_BUF_ERROR:Vh,Z_DEFAULT_COMPRESSION:Hh,Z_FILTERED:Uh,Z_HUFFMAN_ONLY:Wh,Z_RLE:Gh,Z_FIXED:Kh,Z_DEFAULT_STRATEGY:qh,Z_UNKNOWN:Jh,Z_DEFLATED:Yh}=Eh,Xh=9,Zh=15,Qh=8,$h=286,eg=30,tg=19,ng=2*$h+1,rg=15,ig=3,ag=258,og=ag+ig+1,sg=32,cg=42,lg=57,ug=69,dg=73,fg=91,pg=103,mg=113,hg=666,gg=1,_g=2,vg=3,yg=4,bg=3,xg=(e,t)=>(e.msg=Th[t],t),Sg=e=>e*2-(e>4?9:0),Cg=e=>{let t=e.length;for(;--t>=0;)e[t]=0},wg=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=i?n-i:0;while(--t);t=i,r=t;do n=e.prev[--r],e.prev[r]=n>=i?n-i:0;while(--t)},Tg=(e,t,n)=>(t<{let t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,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))},Dg=(e,t)=>{kh(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Eg(e.strm)},Og=(e,t)=>{e.pending_buf[e.pending++]=t},kg=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},Ag=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),e.state.wrap===1?e.adler=Sh(e.adler,t,i,n):e.state.wrap===2&&(e.adler=wh(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},jg=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,a,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-og?e.strstart-(e.w_size-og):0,l=e.window,u=e.w_mask,d=e.prev,f=e.strstart+ag,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])continue;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]&&ro){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},Mg=e=>{let t=e.w_size,n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-og)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),wg(e),r+=t),e.strm.avail_in===0)break;if(n=Ag(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=ig)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Tg(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Tg(e,e.ins_h,e.window[i+ig-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,a,o=0,s=e.strm.avail_in;do{if(r=65535,a=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(r=i+e.strm.avail_in),r>a&&(r=a),r>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,Eg(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(Ag(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(o===0);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_watera&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,a+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),a>e.strm.avail_in&&(a=e.strm.avail_in),a&&(Ag(e.strm,e.window,e.strstart,a),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.high_water>3,a=e.pending_buf_size-a>65535?65535:e.pending_buf_size-a,n=a>e.w_size?e.w_size:a,i=e.strstart-e.block_start,(i>=n||(i||t===Fh)&&t!==Mh&&e.strm.avail_in===0&&i<=a)&&(r=i>a?a:i,o=t===Fh&&e.strm.avail_in===0&&r===i?1:0,Oh(e,e.block_start,r,o),e.block_start+=r,Eg(e.strm)),o?vg:gg)},Pg=(e,t)=>{let n,r;for(;;){if(e.lookahead=ig&&(e.ins_h=Tg(e,e.ins_h,e.window[e.strstart+ig-1]),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-og&&(e.match_length=jg(e,n)),e.match_length>=ig)if(r=Ah(e,e.strstart-e.match_start,e.match_length-ig),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=ig){e.match_length--;do e.strstart++,e.ins_h=Tg(e,e.ins_h,e.window[e.strstart+ig-1]),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=Tg(e,e.ins_h,e.window[e.strstart+1]);else r=Ah(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Dg(e,!1),e.strm.avail_out===0))return gg}return e.insert=e.strstart{let n,r,i;for(;;){if(e.lookahead=ig&&(e.ins_h=Tg(e,e.ins_h,e.window[e.strstart+ig-1]),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=ig-1,n!==0&&e.prev_length4096)&&(e.match_length=ig-1)),e.prev_length>=ig&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-ig,r=Ah(e,e.strstart-1-e.prev_match,e.prev_length-ig),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=Tg(e,e.ins_h,e.window[e.strstart+ig-1]),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=ig-1,e.strstart++,r&&(Dg(e,!1),e.strm.avail_out===0))return gg}else if(e.match_available){if(r=Ah(e,0,e.window[e.strstart-1]),r&&Dg(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return gg}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&=(r=Ah(e,0,e.window[e.strstart-1]),0),e.insert=e.strstart{let n,r,i,a,o=e.window;for(;;){if(e.lookahead<=ag){if(Mg(e),e.lookahead<=ag&&t===Mh)return gg;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=ig&&e.strstart>0&&(i=e.strstart-1,r=o[i],r===o[++i]&&r===o[++i]&&r===o[++i])){a=e.strstart+ag;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]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=ig?(n=Ah(e,1,e.match_length-ig),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Ah(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Dg(e,!1),e.strm.avail_out===0))return gg}return e.insert=0,t===Fh?(Dg(e,!0),e.strm.avail_out===0?vg:yg):e.sym_next&&(Dg(e,!1),e.strm.avail_out===0)?gg:_g},Lg=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(Mg(e),e.lookahead===0)){if(t===Mh)return gg;break}if(e.match_length=0,n=Ah(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Dg(e,!1),e.strm.avail_out===0))return gg}return e.insert=0,t===Fh?(Dg(e,!0),e.strm.avail_out===0?vg:yg):e.sym_next&&(Dg(e,!1),e.strm.avail_out===0)?gg:_g};function Rg(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 zg=[new Rg(0,0,0,0,Ng),new Rg(4,4,8,4,Pg),new Rg(4,5,16,8,Pg),new Rg(4,6,32,32,Pg),new Rg(4,4,16,16,Fg),new Rg(8,16,32,32,Fg),new Rg(8,16,128,128,Fg),new Rg(8,32,128,256,Fg),new Rg(32,128,258,1024,Fg),new Rg(32,258,258,4096,Fg)],Bg=e=>{e.window_size=2*e.w_size,Cg(e.head),e.max_lazy_match=zg[e.level].max_lazy,e.good_match=zg[e.level].good_length,e.nice_match=zg[e.level].nice_length,e.max_chain_length=zg[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=ig-1,e.match_available=0,e.ins_h=0};function Vg(){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=Yh,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 Uint16Array(ng*2),this.dyn_dtree=new Uint16Array((2*eg+1)*2),this.bl_tree=new Uint16Array((2*tg+1)*2),Cg(this.dyn_ltree),Cg(this.dyn_dtree),Cg(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(rg+1),this.heap=new Uint16Array(2*$h+1),Cg(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*$h+1),Cg(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var Hg=e=>{if(!e)return 1;let t=e.state;return!t||t.strm!==e||t.status!==cg&&t.status!==lg&&t.status!==ug&&t.status!==dg&&t.status!==fg&&t.status!==pg&&t.status!==mg&&t.status!==hg?1:0},Ug=e=>{if(Hg(e))return xg(e,zh);e.total_in=e.total_out=0,e.data_type=Jh;let t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?lg:t.wrap?cg:mg,e.adler=t.wrap===2?0:1,t.last_flush=-2,Dh(t),Lh},Wg=e=>{let t=Ug(e);return t===Lh&&Bg(e.state),t},Gg=(e,t)=>Hg(e)||e.state.wrap!==2?zh:(e.state.gzhead=t,Lh),Kg=(e,t,n,r,i,a)=>{if(!e)return zh;let o=1;if(t===Hh&&(t=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),i<1||i>Xh||n!==Yh||r<8||r>15||t<0||t>9||a<0||a>Kh||r===8&&o!==1)return xg(e,zh);r===8&&(r=9);let s=new Vg;return e.state=s,s.strm=e,s.status=cg,s.wrap=o,s.gzhead=null,s.w_bits=r,s.w_size=1<Kg(e,t,Yh,Zh,Qh,qh),deflateInit2:Kg,deflateReset:Wg,deflateResetKeep:Ug,deflateSetHeader:Gg,deflate:(e,t)=>{if(Hg(e)||t>Ih||t<0)return e?xg(e,zh):zh;let n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===hg&&t!==Fh)return xg(e,e.avail_out===0?Vh:zh);let r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(Eg(e),e.avail_out===0)return n.last_flush=-1,Lh}else if(e.avail_in===0&&Sg(t)<=Sg(r)&&t!==Fh)return xg(e,Vh);if(n.status===hg&&e.avail_in!==0)return xg(e,Vh);if(n.status===cg&&n.wrap===0&&(n.status=mg),n.status===cg){let t=Yh+(n.w_bits-8<<4)<<8,r=-1;if(r=n.strategy>=Wh||n.level<2?0:n.level<6?1:n.level===6?2:3,t|=r<<6,n.strstart!==0&&(t|=sg),t+=31-t%31,kg(n,t),n.strstart!==0&&(kg(n,e.adler>>>16),kg(n,e.adler&65535)),e.adler=1,n.status=mg,Eg(e),n.pending!==0)return n.last_flush=-1,Lh}if(n.status===lg){if(e.adler=0,Og(n,31),Og(n,139),Og(n,8),n.gzhead)Og(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Og(n,n.gzhead.time&255),Og(n,n.gzhead.time>>8&255),Og(n,n.gzhead.time>>16&255),Og(n,n.gzhead.time>>24&255),Og(n,n.level===9?2:n.strategy>=Wh||n.level<2?4:0),Og(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(Og(n,n.gzhead.extra.length&255),Og(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=wh(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=ug;else if(Og(n,0),Og(n,0),Og(n,0),Og(n,0),Og(n,0),Og(n,n.level===9?2:n.strategy>=Wh||n.level<2?4:0),Og(n,bg),n.status=mg,Eg(e),n.pending!==0)return n.last_flush=-1,Lh}if(n.status===ug){if(n.gzhead.extra){let t=n.pending,r=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+r>n.pending_buf_size;){let i=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>t&&(e.adler=wh(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex+=i,Eg(e),n.pending!==0)return n.last_flush=-1,Lh;t=0,r-=i}let i=new Uint8Array(n.gzhead.extra);n.pending_buf.set(i.subarray(n.gzindex,n.gzindex+r),n.pending),n.pending+=r,n.gzhead.hcrc&&n.pending>t&&(e.adler=wh(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=dg}if(n.status===dg){if(n.gzhead.name){let t=n.pending,r;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>t&&(e.adler=wh(e.adler,n.pending_buf,n.pending-t,t)),Eg(e),n.pending!==0)return n.last_flush=-1,Lh;t=0}r=n.gzindext&&(e.adler=wh(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=fg}if(n.status===fg){if(n.gzhead.comment){let t=n.pending,r;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>t&&(e.adler=wh(e.adler,n.pending_buf,n.pending-t,t)),Eg(e),n.pending!==0)return n.last_flush=-1,Lh;t=0}r=n.gzindext&&(e.adler=wh(e.adler,n.pending_buf,n.pending-t,t))}n.status=pg}if(n.status===pg){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Eg(e),n.pending!==0))return n.last_flush=-1,Lh;Og(n,e.adler&255),Og(n,e.adler>>8&255),e.adler=0}if(n.status=mg,Eg(e),n.pending!==0)return n.last_flush=-1,Lh}if(e.avail_in!==0||n.lookahead!==0||t!==Mh&&n.status!==hg){let r=n.level===0?Ng(n,t):n.strategy===Wh?Lg(n,t):n.strategy===Gh?Ig(n,t):zg[n.level].func(n,t);if((r===vg||r===yg)&&(n.status=hg),r===gg||r===vg)return e.avail_out===0&&(n.last_flush=-1),Lh;if(r===_g&&(t===Nh?jh(n):t!==Ih&&(Oh(n,0,0,!1),t===Ph&&(Cg(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),Eg(e),e.avail_out===0))return n.last_flush=-1,Lh}return t===Fh?n.wrap<=0?Rh:(n.wrap===2?(Og(n,e.adler&255),Og(n,e.adler>>8&255),Og(n,e.adler>>16&255),Og(n,e.adler>>24&255),Og(n,e.total_in&255),Og(n,e.total_in>>8&255),Og(n,e.total_in>>16&255),Og(n,e.total_in>>24&255)):(kg(n,e.adler>>>16),kg(n,e.adler&65535)),Eg(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending===0?Rh:Lh):Lh},deflateEnd:e=>{if(Hg(e))return zh;let t=e.state.status;return e.state=null,t===mg?xg(e,Bh):Lh},deflateSetDictionary:(e,t)=>{let n=t.length;if(Hg(e))return zh;let r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==cg||r.lookahead)return zh;if(i===1&&(e.adler=Sh(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(Cg(r.head),r.strstart=0,r.block_start=0,r.insert=0);let e=new Uint8Array(r.w_size);e.set(t.subarray(n-r.w_size,n),0),t=e,n=r.w_size}let a=e.avail_in,o=e.next_in,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,Mg(r);r.lookahead>=ig;){let e=r.strstart,t=r.lookahead-(ig-1);do r.ins_h=Tg(r,r.ins_h,r.window[e+ig-1]),r.prev[e&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=e,e++;while(--t);r.strstart=e,r.lookahead=ig-1,Mg(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=ig-1,r.match_available=0,e.next_in=o,e.input=s,e.avail_in=a,r.wrap=i,Lh},deflateInfo:`pako deflate (from Nodeca project)`},Jg=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Yg={assign:function(e){let t=Array.prototype.slice.call(arguments,1);for(;t.length;){let n=t.shift();if(n){if(typeof n!=`object`)throw TypeError(n+`must be non-object`);for(let t in n)Jg(n,t)&&(e[t]=n[t])}}return e},flattenChunks:e=>{let t=0;for(let n=0,r=e.length;n=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Zg[254]=Zg[254]=1;var Qg=e=>{if(typeof TextEncoder==`function`&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,a,o=e.length,s=0;for(i=0;i>>6,t[a++]=128|n&63):n<65536?(t[a++]=224|n>>>12,t[a++]=128|n>>>6&63,t[a++]=128|n&63):(t[a++]=240|n>>>18,t[a++]=128|n>>>12&63,t[a++]=128|n>>>6&63,t[a++]=128|n&63);return t},$g=(e,t)=>{if(t<65534&&e.subarray&&Xg)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n=``;for(let r=0;r{let n=t||e.length;if(typeof TextDecoder==`function`&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i,a=Array(n*2);for(i=0,r=0;r4){a[i++]=65533,r+=o-1;continue}for(t&=o===2?31:o===3?15:7;o>1&&r1){a[i++]=65533;continue}t<65536?a[i++]=t:(t-=65536,a[i++]=55296|t>>10&1023,a[i++]=56320|t&1023)}return $g(a,i)},utf8border:(e,t)=>{t||=e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)==128;)n--;return n<0||n===0?t:n+Zg[e[n]]>t?n:t}};function t_(){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}var n_=t_,r_=Object.prototype.toString,{Z_NO_FLUSH:i_,Z_SYNC_FLUSH:a_,Z_FULL_FLUSH:o_,Z_FINISH:s_,Z_OK:c_,Z_STREAM_END:l_,Z_DEFAULT_COMPRESSION:u_,Z_DEFAULT_STRATEGY:d_,Z_DEFLATED:f_}=Eh;function p_(e){this.options=Yg.assign({level:u_,method:f_,chunkSize:16384,windowBits:15,memLevel:8,strategy:d_},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg=``,this.ended=!1,this.chunks=[],this.strm=new n_,this.strm.avail_out=0;let n=qg.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==c_)throw Error(Th[n]);if(t.header&&qg.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e=typeof t.dictionary==`string`?e_.string2buf(t.dictionary):r_.call(t.dictionary)===`[object ArrayBuffer]`?new Uint8Array(t.dictionary):t.dictionary,n=qg.deflateSetDictionary(this.strm,e),n!==c_)throw Error(Th[n]);this._dict_set=!0}}p_.prototype.push=function(e,t){let n=this.strm,r=this.options.chunkSize,i,a;if(this.ended)return!1;for(a=t===~~t?t:t===!0?s_:i_,typeof e==`string`?n.input=e_.string2buf(e):r_.call(e)===`[object ArrayBuffer]`?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(a===a_||a===o_)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=qg.deflate(n,a),i===l_)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=qg.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===c_;if(n.avail_out===0){this.onData(n.output);continue}if(a>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0},p_.prototype.onData=function(e){this.chunks.push(e)},p_.prototype.onEnd=function(e){e===c_&&(this.result=Yg.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function m_(e,t){let n=new p_(t);if(n.push(e,!0),n.err)throw n.msg||Th[n.err];return n.result}function h_(e,t){return t||={},t.raw=!0,m_(e,t)}function g_(e,t){return t||={},t.gzip=!0,m_(e,t)}var __={Deflate:p_,deflate:m_,deflateRaw:h_,gzip:g_,constants:Eh},v_=16209,y_=16191,b_=function(e,t){let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E=e.state;n=e.next_in,w=e.input,r=n+(e.avail_in-5),i=e.next_out,T=e.output,a=i-(t-e.avail_out),o=i+(e.avail_out-257),s=E.dmax,c=E.wsize,l=E.whave,u=E.wnext,d=E.window,f=E.hold,p=E.bits,m=E.lencode,h=E.distcode,g=(1<>>24,f>>>=y,p-=y,y=v>>>16&255,y===0)T[i++]=v&65535;else if(y&16){b=v&65535,y&=15,y&&(p>>=y,p-=y),p<15&&(f+=w[n++]<>>24,f>>>=y,p-=y,y=v>>>16&255,y&16){if(x=v&65535,y&=15,ps){e.msg=`invalid distance too far back`,E.mode=v_;break top}if(f>>>=y,p-=y,y=i-a,x>y){if(y=x-y,y>l&&E.sane){e.msg=`invalid distance too far back`,E.mode=v_;break top}if(S=0,C=d,u===0){if(S+=c-y,y2;)T[i++]=C[S++],T[i++]=C[S++],T[i++]=C[S++],b-=3;b&&(T[i++]=C[S++],b>1&&(T[i++]=C[S++]))}else{S=i-x;do T[i++]=T[S++],T[i++]=T[S++],T[i++]=T[S++],b-=3;while(b>2);b&&(T[i++]=T[S++],b>1&&(T[i++]=T[S++]))}}else if(y&64){e.msg=`invalid distance code`,E.mode=v_;break top}else{v=h[(v&65535)+(f&(1<>3,n-=b,p-=b<<3,f&=(1<{let 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,E=new Uint16Array(x_+1),D=new Uint16Array(x_+1),O=null,k,A,j;for(l=0;l<=x_;l++)E[l]=0;for(u=0;u=1&&E[f]===0;f--);if(p>f&&(p=f),f===0)return i[a++]=20971520,i[a++]=20971520,s.bits=1,0;for(d=1;d0&&(e===w_||f!==1))return-1;for(D[1]=0,l=1;lS_||e===E_&&_>C_)return 1;for(;;){k=l-h,o[u]+1=T?(A=O[o[u]-T],j=w[o[u]-T]):(A=96,j=0),y=1<>h)+b]=k<<24|A<<16|j|0;while(b!==0);for(y=1<>=1;if(y===0?v=0:(v&=y-1,v+=y),u++,--E[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<S_||e===E_&&_>C_)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},M_=0,N_=1,P_=2,{Z_FINISH:F_,Z_BLOCK:I_,Z_TREES:L_,Z_OK:R_,Z_STREAM_END:z_,Z_NEED_DICT:B_,Z_STREAM_ERROR:V_,Z_DATA_ERROR:H_,Z_MEM_ERROR:U_,Z_BUF_ERROR:W_,Z_DEFLATED:G_}=Eh,K_=16180,q_=16181,J_=16182,Y_=16183,X_=16184,Z_=16185,Q_=16186,$_=16187,ev=16188,tv=16189,nv=16190,rv=16191,iv=16192,av=16193,ov=16194,sv=16195,cv=16196,lv=16197,uv=16198,dv=16199,fv=16200,pv=16201,mv=16202,hv=16203,gv=16204,_v=16205,vv=16206,yv=16207,bv=16208,xv=16209,Sv=16210,Cv=16211,wv=852,Tv=592,Ev=15,Dv=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function Ov(){this.strm=null,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 Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var kv=e=>{if(!e)return 1;let t=e.state;return!t||t.strm!==e||t.modeCv?1:0},Av=e=>{if(kv(e))return V_;let t=e.state;return e.total_in=e.total_out=t.total=0,e.msg=``,t.wrap&&(e.adler=t.wrap&1),t.mode=K_,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(wv),t.distcode=t.distdyn=new Int32Array(Tv),t.sane=1,t.back=-1,R_},jv=e=>{if(kv(e))return V_;let t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Av(e)},Mv=(e,t)=>{let n;if(kv(e))return V_;let r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?V_:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,jv(e))},Nv=(e,t)=>{if(!e)return V_;let n=new Ov;e.state=n,n.strm=e,n.window=null,n.mode=K_;let r=Mv(e,t);return r!==R_&&(e.state=null),r},Pv=e=>Nv(e,Ev),Fv=!0,Iv,Lv,Rv=e=>{if(Fv){Iv=new Int32Array(512),Lv=new Int32Array(32);let t=0;for(;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(j_(N_,e.lens,0,288,Iv,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;j_(P_,e.lens,0,32,Lv,0,e.work,{bits:5}),Fv=!1}e.lencode=Iv,e.lenbits=9,e.distcode=Lv,e.distbits=5},zv=(e,t,n,r)=>{let i,a=e.state;return a.window===null&&(a.wsize=1<=a.wsize?(a.window.set(t.subarray(n-a.wsize,n),0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>r&&(i=r),a.window.set(t.subarray(n-r,n-r+i),a.wnext),r-=i,r?(a.window.set(t.subarray(n-r,n),0),a.wnext=r,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave{let 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 Uint8Array(4),E,D,O=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(kv(e)||!e.output||!e.input&&e.avail_in!==0)return V_;n=e.state,n.mode===rv&&(n.mode=iv),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=R_;inf_leave:for(;;)switch(n.mode){case K_:if(n.wrap===0){n.mode=iv;break}for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<>>8&255,n.check=wh(n.check,T,2,0),l=0,u=0,n.mode=q_;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((l&255)<<8)+(l>>8))%31){e.msg=`incorrect header check`,n.mode=xv;break}if((l&15)!==G_){e.msg=`unknown compression method`,n.mode=xv;break}if(l>>>=4,u-=4,C=(l&15)+8,n.wbits===0&&(n.wbits=C),C>15||C>n.wbits){e.msg=`invalid window size`,n.mode=xv;break}n.dmax=1<>8&1),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,n.check=wh(n.check,T,2,0)),l=0,u=0,n.mode=J_;case J_:for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<>>8&255,T[2]=l>>>16&255,T[3]=l>>>24&255,n.check=wh(n.check,T,4,0)),l=0,u=0,n.mode=Y_;case Y_:for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<>8),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,n.check=wh(n.check,T,2,0)),l=0,u=0,n.mode=X_;case X_:if(n.flags&1024){for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<>>8&255,n.check=wh(n.check,T,2,0)),l=0,u=0}else n.head&&(n.head.extra=null);n.mode=Z_;case Z_: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=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(a,a+p),C)),n.flags&512&&n.wrap&4&&(n.check=wh(n.check,r,p,a)),s-=p,a+=p,n.length-=p),n.length))break inf_leave;n.length=0,n.mode=Q_;case Q_: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>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=rv;break;case tv:for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<>>=u&7,u-=u&7,n.mode=vv;break}for(;u<3;){if(s===0)break inf_leave;s--,l+=r[a++]<>>=1,--u,l&3){case 0:n.mode=av;break;case 1:if(Rv(n),n.mode=dv,t===L_){l>>>=2,u-=2;break inf_leave}break;case 2:n.mode=cv;break;case 3:e.msg=`invalid block type`,n.mode=xv}l>>>=2,u-=2;break;case av:for(l>>>=u&7,u-=u&7;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<>>16^65535)){e.msg=`invalid stored block lengths`,n.mode=xv;break}if(n.length=l&65535,l=0,u=0,n.mode=ov,t===L_)break inf_leave;case ov:n.mode=sv;case sv:if(p=n.length,p){if(p>s&&(p=s),p>c&&(p=c),p===0)break inf_leave;i.set(r.subarray(a,a+p),o),s-=p,a+=p,c-=p,o+=p,n.length-=p;break}n.mode=rv;break;case cv:for(;u<14;){if(s===0)break inf_leave;s--,l+=r[a++]<>>=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=xv;break}n.have=0,n.mode=lv;case lv:for(;n.have>>=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=j_(M_,n.lens,0,19,n.lencode,0,n.work,E),n.lenbits=E.bits,w){e.msg=`invalid code lengths set`,n.mode=xv;break}n.have=0,n.mode=uv;case uv:for(;n.have>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<>>=_,u-=_,n.lens[n.have++]=y;else{if(y===16){for(D=_+2;u>>=_,u-=_,n.have===0){e.msg=`invalid bit length repeat`,n.mode=xv;break}C=n.lens[n.have-1],p=3+(l&3),l>>>=2,u-=2}else if(y===17){for(D=_+3;u>>=_,u-=_,C=0,p=3+(l&7),l>>>=3,u-=3}else{for(D=_+7;u>>=_,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=xv;break}for(;p--;)n.lens[n.have++]=C}}if(n.mode===xv)break;if(n.lens[256]===0){e.msg=`invalid code -- missing end-of-block`,n.mode=xv;break}if(n.lenbits=9,E={bits:n.lenbits},w=j_(N_,n.lens,0,n.nlen,n.lencode,0,n.work,E),n.lenbits=E.bits,w){e.msg=`invalid literal/lengths set`,n.mode=xv;break}if(n.distbits=6,n.distcode=n.distdyn,E={bits:n.distbits},w=j_(P_,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,E),n.distbits=E.bits,w){e.msg=`invalid distances set`,n.mode=xv;break}if(n.mode=dv,t===L_)break inf_leave;case dv:n.mode=fv;case fv: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,b_(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===rv&&(n.back=-1);break}for(n.back=0;g=n.lencode[l&(1<>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<>b)],_=g>>>24,v=g>>>16&255,y=g&65535,!(b+_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<>>=b,u-=b,n.back+=b}if(l>>>=_,u-=_,n.back+=_,n.length=y,v===0){n.mode=_v;break}if(v&32){n.back=-1,n.mode=rv;break}if(v&64){e.msg=`invalid literal/length code`,n.mode=xv;break}n.extra=v&15,n.mode=pv;case pv:if(n.extra){for(D=n.extra;u>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=mv;case mv:for(;g=n.distcode[l&(1<>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<>b)],_=g>>>24,v=g>>>16&255,y=g&65535,!(b+_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<>>=b,u-=b,n.back+=b}if(l>>>=_,u-=_,n.back+=_,v&64){e.msg=`invalid distance code`,n.mode=xv;break}n.offset=y,n.extra=v&15,n.mode=hv;case hv:if(n.extra){for(D=n.extra;u>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg=`invalid distance too far back`,n.mode=xv;break}n.mode=gv;case gv: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=xv;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=fv);break;case _v:if(c===0)break inf_leave;i[o++]=n.length,c--,n.mode=fv;break;case vv:if(n.wrap){for(;u<32;){if(s===0)break inf_leave;s--,l|=r[a++]<{if(kv(e))return V_;let t=e.state;return t.window&&=null,e.state=null,R_},inflateGetHeader:(e,t)=>{if(kv(e))return V_;let n=e.state;return n.wrap&2?(n.head=t,t.done=!1,R_):V_},inflateSetDictionary:(e,t)=>{let n=t.length,r,i,a;return kv(e)||(r=e.state,r.wrap!==0&&r.mode!==nv)?V_:r.mode===nv&&(i=1,i=Sh(i,t,n,0),i!==r.check)?H_:(a=zv(e,t,n,n),a?(r.mode=Sv,U_):(r.havedict=1,R_))},inflateInfo:`pako inflate (from Nodeca project)`};function Vv(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name=``,this.comment=``,this.hcrc=0,this.done=!1}var Hv=Vv,Uv=Object.prototype.toString,{Z_NO_FLUSH:Wv,Z_FINISH:Gv,Z_OK:Kv,Z_STREAM_END:qv,Z_NEED_DICT:Jv,Z_STREAM_ERROR:Yv,Z_DATA_ERROR:Xv,Z_MEM_ERROR:Zv}=Eh;function Qv(e){this.options=Yg.assign({chunkSize:1024*64,windowBits:15,to:``},e||{});let t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg=``,this.ended=!1,this.chunks=[],this.strm=new n_,this.strm.avail_out=0;let n=Bv.inflateInit2(this.strm,t.windowBits);if(n!==Kv||(this.header=new Hv,Bv.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary==`string`?t.dictionary=e_.string2buf(t.dictionary):Uv.call(t.dictionary)===`[object ArrayBuffer]`&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=Bv.inflateSetDictionary(this.strm,t.dictionary),n!==Kv))))throw Error(Th[n])}Qv.prototype.push=function(e,t){let n=this.strm,r=this.options.chunkSize,i=this.options.dictionary,a,o,s;if(this.ended)return!1;for(o=t===~~t?t:t===!0?Gv:Wv,Uv.call(e)===`[object ArrayBuffer]`?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),a=Bv.inflate(n,o),a===Jv&&i&&(a=Bv.inflateSetDictionary(n,i),a===Kv?a=Bv.inflate(n,o):a===Xv&&(a=Jv));n.avail_in>0&&a===qv&&n.state.wrap>0&&e[n.next_in]!==0;)Bv.inflateReset(n),a=Bv.inflate(n,o);switch(a){case Yv:case Xv:case Jv:case Zv:return this.onEnd(a),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(n.avail_out===0||a===qv))if(this.options.to===`string`){let e=e_.utf8border(n.output,n.next_out),t=n.next_out-e,i=e_.buf2string(n.output,e);n.next_out=t,n.avail_out=r-t,t&&n.output.set(n.output.subarray(e,e+t),0),this.onData(i)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(a===Kv&&s===0)){if(a===qv)return a=Bv.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(n.avail_in===0)break}}return!0},Qv.prototype.onData=function(e){this.chunks.push(e)},Qv.prototype.onEnd=function(e){e===Kv&&(this.options.to===`string`?this.result=this.chunks.join(``):this.result=Yg.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function $v(e,t){let n=new Qv(t);if(n.push(e),n.err)throw n.msg||Th[n.err];return n.result}function ey(e,t){return t||={},t.raw=!0,$v(e,t)}var ty={Inflate:Qv,inflate:$v,inflateRaw:ey,ungzip:$v,constants:Eh},{Deflate:ny,deflate:ry,deflateRaw:iy,gzip:ay}=__,{Inflate:oy,inflate:sy,inflateRaw:cy,ungzip:ly}=ty,uy=ay;function dy(e){if(typeof window<`u`&&typeof window.btoa==`function`){let t=``;for(let n=0;ne.hash);for(;t.length>1;){let e=[];for(let n=0;ne.pulse),0)}}async function ky(e){let t=JSON.stringify(e);return{v:1,codec:`gzip+base64`,payload:fy(new TextEncoder().encode(t))}}const Ay={async publish(e){return{headCid:``}}};async function jy(e){let{ipfs:t=Ay,packedLedgerBytes:n,prevCid:r,sign:i,pubKeyJwk:a,merkleRoot:o,pulse:s}=e,{headCid:c}=await t.publish(n).catch(()=>({headCid:``})),l=``;return c&&i&&(l=My(await i(new TextEncoder().encode(`${c}|${o}|${s}`)))),{headCid:c,prevCid:r,merkleRoot:o,pulse:s,headSig:l,pubKeyJwk:a}}function My(e){let t=``,n=32768;for(let r=0;r{let t=(e||``).toLowerCase().replace(/\s+/g,` `).trim();return t===`root`?`Root`:t===`sacral`?`Sacral`:t===`solar plexus`||t===`solarplexus`?`Solar Plexus`:t===`heart`?`Heart`:t===`throat`?`Throat`:t===`third eye`||t===`thirdeye`||t===`third-eye`?`Third Eye`:`Crown`};async function Iy(e){let{canon:t,hashMode:n,chakraGate:r,kaiSignature:i,userPhiKey:a,origin:o,title:s,weekdayResolved:c,valuationSource:l,mintSeal:u,frequencyHzCurrent:d,creatorResolved:f}=e,p=new Date().toISOString(),m=(n??`moment`)===`moment`,h={v:`1.0`,title:s,creator:f.creator,creatorAlg:f.creatorAlg,creatorId:f.creatorId,pulse:t.pulse,...m?{timestamp:p}:{}},g=Hp(s,300)??`Day Seal: ${t.beat}:${t.stepIndex} • Kai-Pulse ${t.pulse}`,_={v:`1.0`,kaiSignature:i??``,phikey:a??``,pulse:t.pulse,beat:t.beat,stepIndex:t.stepIndex,chakraDay:t.chakraDayKey,chakraGate:r,kaiPulse:t.pulse,stepsPerBeat:t.stepsPerBeat,...m?{timestamp:p}:{},eternalRecord:g,creatorResolved:h.creator,origin:o??(typeof window<`u`?window.location.origin:``),proofHints:{scheme:`groth16-poseidon`,api:`/api/proof/sigil`,explorer:`/keystream/hash/`},zkPoseidonHash:`7110303097080024260800444665787206606103183587082596139871399733998958991511`,zkProof:{pi_a:[`19856134890912647180646267915828904326160277174078581619567068747845749027250`,`10106391353796902212003294779502313309244930326624220933310482777016833544602`,`1`],pi_b:[[`15332824283171511432216330300808558575577774780613056045013182220474274609373`,`520780065640616094309336546820413644814574749252299536726307039414737648361`],[`19765599185680435083316275297102369245623399312670847112193589466041197993879`,`18523858679421850672423367816452968252787306686524085684854491935388533516266`],[`1`,`0`]],pi_c:[`17563530240039003419001811545927065585981558862932312235837455317235418749777`,`8962254954310810065423022980767523639237247171719646270365369937175985524426`,`1`]}},v=dm({v:_.v,kaiSignature:_.kaiSignature,phikey:_.phikey,pulse:_.pulse,beat:_.beat,stepIndex:_.stepIndex,chakraDay:_.chakraDay,chakraGate:_.chakraGate,kaiPulse:_.kaiPulse,stepsPerBeat:_.stepsPerBeat,timestamp:_.timestamp,eternalRecord:_.eternalRecord,creatorResolved:_.creatorResolved,origin:_.origin,proofHints:_.proofHints,zkPoseidonHash:_.zkPoseidonHash,zkProof:_.zkProof,ownerPubKey:_.ownerPubKey?nm(_.ownerPubKey):void 0,ownerSig:_.ownerSig}),y=(await fm(v)).toLowerCase(),b=Array.from(await qp(v)).map(e=>e.toString(16).padStart(2,`0`)).join(``),x=fy(v),S;hy()&&(S=await gy(y));let C={payloadEncoding:`gzip+base64`,payloadHash:{alg:`blake3`,value:y},payloadHashSecondary:{alg:`sha256`,value:b},payloadSignature:S??{alg:`harmonic-sig`,public:a??f.creatorId,value:``}},w=Ny(Kp(dm({parentCanonical:`optional-parent-ref`,parentStateRoot:`optional-state-root`,eventKind:`mint`,pulse:t.pulse,beat:t.beat,stepIndex:t.stepIndex,chakraDay:t.chakraDayKey,childNonce:`${t.beat}-${t.stepIndex}`,amount:`1.000`,expiresAtPulse:t.pulse+12,lineageCommitment:`optional-hash-of-lineage`}))),{publicKeyJwk:T,privateKey:E}=await yy(),D=await by(E,w);_.ownerPubKey=T,_.ownerSig=D;let O=Qf(y,{pulse:t.pulse,beat:t.beat,stepIndex:t.stepIndex,chakraDay:Fy(String(t.chakraDayKey)),stepsPerBeat:t.stepsPerBeat,canonicalHash:y,exportedAt:p,expiresAtPulse:t.pulse+11,kaiSignature:i??void 0,userPhiKey:a??void 0}),k=await Oy([{v:1,pulse:t.pulse,beat:t.beat,stepIndex:t.stepIndex,chakraDay:t.chakraDayKey,stepsPerBeat:t.stepsPerBeat,kaiSignature:i??void 0,userPhiKey:a??void 0,ts:p}]),A=await ky(k),j=await jy({ipfs:Ay,packedLedgerBytes:em(A.payload),prevCid:void 0,pubKeyJwk:_.ownerPubKey,merkleRoot:k.root,pulse:t.pulse,sign:async e=>{let t=Ny(e),n=Py(E),r=await crypto.subtle.sign(n,E,t);return new Uint8Array(r)}}),M={$schema:`https://atlantean.lumitech/schemas/kai-sigil/1.0.json`,contentType:`application/vnd.kai-sigil+json;v=1`,header:{...h,shareUrl:O},payload:x,integrity:C,frequencyHzAtMint:d,valuationSource:l??null,valuationSeal:u??null},N=v.length,P=$p(v).toString(16).padStart(8,`0`),F=Yp(Qp(y)),I=f.creatorId.slice(0,12),L=String(_.zkPoseidonHash).slice(0,12);return{parityUrl:O,payloadHashHex:y,innerRingText:[`u=${O}`,`b58=${F}`,`len=${N}`,`crc32=${P}`,`creator=${I}`,`zk=${L}`,`alg=${f.creatorAlg}`].join(` · `),sigilUrl:O,hashB58:F,embeddedBase:{...M,ledger:A,dht:j,weekdayResolved:c??null}}}function Ly(e){return JSON.stringify(e)}function Ry(e,t){let n=e=>{if(typeof window>`u`||typeof window.btoa!=`function`)throw Error(`Base64 encoding unavailable in this environment`);let t=encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)));return window.btoa(t)};return{toDataURL:()=>{let t=e.current;if(!t)throw Error(`SVG not mounted`);return`data:image/svg+xml;base64,${n(new XMLSerializer().serializeToString(t))}`},async exportBlob(n=`image/svg+xml`,r=2){let i=e.current;if(!i)throw Error(`SVG not mounted`);let a=new XMLSerializer().serializeToString(i);if(n===`image/svg+xml`)return new Blob([a],{type:n});let o=URL.createObjectURL(new Blob([a],{type:`image/svg+xml`}));try{let e=new Image,n=Math.round((t??240)*r);e.decoding=`async`,e.src=o,await e.decode();let i=document.createElement(`canvas`);i.width=n,i.height=n;let a=i.getContext(`2d`);if(!a)throw Error(`Canvas 2D context not available`);return a.drawImage(e,0,0,n,n),await new Promise((e,t)=>{i.toBlob(n=>n?e(n):t(Error(`Canvas toBlob failed`)),`image/png`)})}finally{URL.revokeObjectURL(o)}},async verifySvgHash(t){let n=e.current;if(!n)throw Error(`SVG not mounted`);let r=n.cloneNode(!0);r.removeAttribute(`data-svg-hash`),r.removeAttribute(`data-svg-valid`);let i=Gp(await qp(new XMLSerializer().serializeToString(r)));if(i!==t.toLowerCase())throw Error(`SVG HASH MISMATCH (${i} != ${t})`);return i}}}var zy=({uid:e,hue:t,visualClamped:n,doAnim:r,quality:i,dpr:a,seed:o,payloadHashHex:s,auraPath:c})=>{let l=`${e}-halo`,u=`${e}-glow`,d=`${e}-bloom`,f=`${e}-mask`,p=`${e}-net`,m=`${e}-warp`;return(0,W.jsxs)(`defs`,{children:[(0,W.jsx)(`path`,{id:`${e}-aura`,d:c}),(0,W.jsxs)(`radialGradient`,{id:l,cx:`50%`,cy:`50%`,r:`50%`,children:[(0,W.jsx)(`stop`,{offset:`0%`,stopColor:kp(t,100,50+15*Math.sin(n*2*Math.PI)),stopOpacity:`.55`,children:r&&i!==`low`&&(0,W.jsx)(`animate`,{attributeName:`stop-opacity`,values:`.35;.75;.35`,dur:`var(--dur)`,begin:`var(--off)`,repeatCount:`indefinite`})}),(0,W.jsx)(`stop`,{offset:`100%`,stopColor:`#000`,stopOpacity:`0`})]}),i!==`low`&&a>1&&(0,W.jsxs)(`filter`,{id:u,x:`-30%`,y:`-30%`,width:`160%`,height:`160%`,children:[(0,W.jsx)(`feGaussianBlur`,{stdDeviation:`2.2`,result:`b`}),(0,W.jsxs)(`feMerge`,{children:[(0,W.jsx)(`feMergeNode`,{in:`b`}),(0,W.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]}),i===`ultra`&&(0,W.jsxs)(`filter`,{id:d,x:`-50%`,y:`-50%`,width:`200%`,height:`200%`,children:[(0,W.jsx)(`feGaussianBlur`,{stdDeviation:`6`,result:`u`}),(0,W.jsx)(`feBlend`,{in:`SourceGraphic`,in2:`u`,mode:`screen`})]}),(0,W.jsx)(`mask`,{id:f,children:(0,W.jsx)(`rect`,{width:`100%`,height:`100%`,fill:`white`})}),(0,W.jsx)(`pattern`,{id:p,patternUnits:`userSpaceOnUse`,width:`160`,height:`160`,patternTransform:`rotate(${o*7%60} 500 500)`,children:(0,W.jsx)(`path`,{d:`M0 80 H160 M80 0 V160 M160 0 L0 160 M0 0 L160 160`,stroke:`#00FFD0`,strokeOpacity:`.06`,strokeWidth:`1`})}),(0,W.jsxs)(`filter`,{id:m,x:`-20%`,y:`-20%`,width:`140%`,height:`140%`,children:[(0,W.jsx)(`feTurbulence`,{type:`fractalNoise`,baseFrequency:`0.006`,numOctaves:`2`,seed:o%997+3,result:`noise`}),(0,W.jsx)(`feDisplacementMap`,{in:`SourceGraphic`,in2:`noise`,scale:.35+(s?parseInt(s.slice(-2),16):0)%12*.05,xChannelSelector:`R`,yChannelSelector:`G`})]})]})},By=({uid:e,stateKeyOk:t,embeddedMetaJson:n,klockIsoSnapshot:r,apiSnapshot:i,extraEmbed:a,mintSealJson:o,valuationSourceJson:s,displayStepIndex:c,stepsPerBeat:l,eternalSeal:u,ledgerJson:d,dhtJson:f})=>(0,W.jsxs)(W.Fragment,{children:[t&&n&&(0,W.jsx)(`metadata`,{children:zp(n)}),r&&(0,W.jsx)(`metadata`,{id:`${e}-klock-json`,children:zp(Ip(r))}),i&&(0,W.jsx)(`metadata`,{id:`${e}-kai-api-json`,children:zp(Ip(i))}),u&&(0,W.jsx)(`metadata`,{id:`${e}-eternal-seal`,children:zp(u)}),a&&(0,W.jsx)(`metadata`,{id:`${e}-extra-embed`,children:zp(Ip(a))}),o&&(0,W.jsx)(`metadata`,{id:`${e}-valuation-seal-json`,children:zp(o)}),t&&s&&(0,W.jsx)(`metadata`,{id:`${e}-valuation-source-json`,children:zp(s)}),(0,W.jsx)(`metadata`,{id:`sigil-display`,children:`{"stepIndex":${c},"stepsPerBeat":${l}}`}),t&&n&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`metadata`,{id:`${e}-ledger-json`,children:zp(d)}),(0,W.jsx)(`metadata`,{id:`${e}-dht-json`,children:zp(f)})]})]}),Vy=({uid:e,size:t,baseColor:n,corePath:r,auraId:i,sigPathId:a,doAnim:o,quality:s,dpr:c,pad:l,safeTextWidth:u,outlineWidth:d,strokeCore:f,dotR:p,debugOutline:m,prefersContrast:h,haloId:g,netId:_,warpId:v,glowId:y,maskId:b,rotation:x,chakraSides:S,binaryForRender:C,summary:w,pulse:T})=>(0,W.jsxs)(`g`,{id:`${e}-art`,filter:`url(#${v})`,children:[(0,W.jsx)(`rect`,{width:xp,height:xp,fill:`url(#${g})`,"aria-hidden":`true`,pointerEvents:`none`}),(0,W.jsx)(`rect`,{x:`0`,y:`0`,width:xp,height:xp,fill:`url(#${_})`,pointerEvents:`none`}),(0,W.jsx)(`path`,{d:r,fill:`none`,stroke:n,strokeWidth:f,vectorEffect:`non-scaling-stroke`,strokeLinecap:`round`,strokeLinejoin:`round`,mask:`url(#${b})`,filter:s!==`low`&&c>1?`url(#${y})`:void 0,style:{strokeDasharray:m||h?`4 4`:void 0},"aria-hidden":`true`,pointerEvents:`none`}),(m||h)&&(0,W.jsx)(`path`,{d:r,fill:`none`,stroke:`#00FFD0`,strokeWidth:Math.max(1,f*.45),vectorEffect:`non-scaling-stroke`,opacity:.6,"aria-hidden":!0,pointerEvents:`none`}),s!==`low`&&Array.from({length:S},(e,t)=>{let r=t/S*2*Math.PI+x;return(0,W.jsx)(`circle`,{cx:500+380*Math.cos(r),cy:500+380*Math.sin(r),r:p,fill:n,"aria-hidden":`true`,pointerEvents:`none`},t)}),o&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`use`,{href:`#${i}`,stroke:`#00FFD0`,strokeWidth:Math.max(2,f*1.05),fill:`none`,opacity:`.2`,strokeLinecap:`round`,strokeLinejoin:`round`,vectorEffect:`non-scaling-stroke`,"aria-hidden":`true`,pointerEvents:`none`,children:(0,W.jsx)(`animate`,{attributeName:`stroke-opacity`,values:`.2;.6;.2`,dur:`var(--dur)`,begin:`var(--off)`,repeatCount:`indefinite`})}),(0,W.jsx)(`use`,{href:`#${i}`,stroke:n,strokeWidth:Math.max(1.2,f*.8),fill:`none`,opacity:`.4`,strokeLinecap:`round`,strokeLinejoin:`round`,vectorEffect:`non-scaling-stroke`,"aria-hidden":`true`,pointerEvents:`none`,children:(0,W.jsx)(`animate`,{attributeName:`stroke-opacity`,values:`.4;.9;.4`,dur:`var(--dur)`,begin:`var(--off)`,repeatCount:`indefinite`})})]}),(0,W.jsx)(`circle`,{cx:500,cy:500,r:Math.max(3,p),fill:`#00FFD0`,"aria-hidden":`true`,pointerEvents:`none`,children:o&&(0,W.jsx)(`animateTransform`,{attributeName:`transform`,type:`scale`,values:`1;1.5;1`,dur:`var(--dur)`,begin:`var(--off)`,repeatCount:`indefinite`})}),s!==`low`&&a&&C&&(0,W.jsx)(`g`,{id:`signature`,children:(0,W.jsx)(`text`,{fontFamily:`ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial`,fontSize:Math.max(4,t*.028),fill:n,letterSpacing:`1.2`,textAnchor:`middle`,dominantBaseline:`middle`,opacity:`.7`,pointerEvents:`none`,children:(0,W.jsx)(`textPath`,{href:`#${a}`,startOffset:`50%`,children:C})})}),(0,W.jsxs)(`g`,{id:`signature-hint`,"aria-hidden":`true`,pointerEvents:`none`,children:[(0,W.jsx)(`text`,{x:l,y:t-6,fontFamily:bp,fontSize:Math.max(4,t*.025),fill:n,opacity:`.12`,textAnchor:`start`,lengthAdjust:`spacingAndGlyphs`,textLength:u,style:{paintOrder:`stroke`,stroke:`#000`,strokeWidth:d,fontVariantNumeric:`tabular-nums`,fontFeatureSettings:`'tnum' 1`},children:w}),(0,W.jsx)(`text`,{x:t-l,y:t-l,fontFamily:bp,fontSize:t*.25,fill:n,opacity:`0.04`,textAnchor:`end`,dominantBaseline:`ideographic`,lengthAdjust:`spacingAndGlyphs`,textLength:u,vectorEffect:`non-scaling-stroke`,style:{paintOrder:`stroke`,stroke:`#000`,strokeWidth:d,fontVariantNumeric:`tabular-nums`,fontFeatureSettings:`'tnum' 1`},children:typeof T==`number`?T.toLocaleString?.()??String(T):String(T)})]})]});const Hy=[`Solhara`,`Aquaris`,`Flamora`,`Verdari`,`Sonari`,`Kaelith`],Uy=e=>typeof e==`string`&&Hy.includes(e);function Wy(e){return typeof e==`object`&&!!e}const Gy=e=>e===`low`?`low`:e===`ultra`||e===`high`?`high`:`med`,Ky=e=>e.replace(/^0x/i,``).split(``).map(e=>parseInt(e,16).toString(2).padStart(4,`0`)).join(``);function qy(e,t,n,r){return e?`Eternal Seal • ${e}`:`Day Seal: ${t}:${n} • Kai-Pulse ${r}`}var Jy=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`;function Yy(e){let t=``,n=e.length,r=0;for(;r+2>>18&63]+Jy[n>>>12&63]+Jy[n>>>6&63]+Jy[n&63]}let i=n-r;if(i===1){let n=e[r]<<16;t+=Jy[n>>>18&63]+Jy[n>>>12&63]+`==`}else if(i===2){let n=e[r]<<16|e[r+1]<<8;t+=Jy[n>>>18&63]+Jy[n>>>12&63]+Jy[n>>>6&63]+`=`}return t}function Xy(e){let t=e.replace(/\s+/g,``);if(!/^[A-Za-z0-9+/]*={0,2}$/.test(t)||t.length%4!=0)return new Uint8Array;let n=t.length/4*3-(t.endsWith(`==`)?2:t.endsWith(`=`)?1:0),r=new Uint8Array(n),i=0;for(let e=0;e>>16&255,s>=0&&i>>8&255),c>=0&&ie.replace(/·|\u2022/g,`•`);function Qy(e){if(!e)return``;let t=Zy(e);return Yy(new TextEncoder().encode(t))}function $y(e){if(!e)return``;try{let t=Xy(e);return Zy(new TextDecoder().decode(t))}catch{return``}}function eb(e){let t=`null`;if(!e)return{ledgerJson:t,dhtJson:t};try{let t=JSON.parse(e);return{ledgerJson:JSON.stringify(t.ledger??null),dhtJson:JSON.stringify(t.dht??null)}}catch{return{ledgerJson:t,dhtJson:t}}}function tb(e){let t=Object.entries(e).flatMap(([e,t])=>t==null?[]:[[e,String(t)]]);return Object.fromEntries(t)}function nb(e,t){let n=Fp(e)?JSON.parse(Ip(e)):null,r=Fp(t)?JSON.parse(Ip(t)):null,i=tb(n?Vp(`klock`,n):{}),a=Lp(e,`eternalMonth`),o=Lp(e,`harmonicDay`),s=Rp(e,`kaiPulseEternal`),c=Lp(e,`solarChakraStepString`),l=Lp(e,`chakraArc`);return{klockIsoSnapshot:n,apiSnapshot:r,klockDataAttrs:i,eternalMonth:a,harmonicDay:o,kaiPulseEternal:typeof s==`number`?s:void 0,solarChakraStepString:c,chakraArc:l}}function rb(e,t,n,r,i,a,o){let s=String(n).replace(/\s+/g,`_`),c=[`sig=${t?e??`pending`:`pending`}`,`pulse=${i}`,`beat=${a}`,`day=${s}`,`hz=${r}`];return o&&c.push(`poseidon=${o}`),c.join(` | `)}function ib(e,t,n){return kp((e+(n?parseInt(n.slice(-2),16)%12*2.5:0))%360,100,50+15*Math.sin(t*2*Math.PI))}var ab=(0,C.forwardRef)((e,t)=>{let{id:n,pulse:r,beat:i,stepIndex:a,stepPct:o,chakraDay:s,size:c=240,hashOverride:l,strict:u=!0,quality:d=`high`,animate:f=!0,debugOutline:p=!1,goldenId:m,hashMode:h=`moment`,userPhiKey:g,kaiSignature:_,intentionSigil:v,creatorPublicKey:y,origin:b,onReady:x,onError:S,showZKBadge:w=!0,qrHref:T,klock:E,embed:D}=e,O=Up(r),k=Up(i),A=(0,C.useMemo)(()=>Mp(O),[O]),j=(0,C.useMemo)(()=>Np(O),[O]),M=(0,C.useMemo)(()=>{let e=Up(a,NaN);return(!Number.isFinite(e)||e<0||e>=44)&&(e=A),Math.trunc((e%44+44)%44)},[a,A]),N=(0,C.useMemo)(()=>{let e=Wp(o,NaN);return Number.isFinite(e)||(e=j),Math.max(0,Math.min(1-2**-52,e))},[o,j]),P=Op(s),F=Uy(s)?s:void 0,I=(0,C.useMemo)(()=>({pulse:O,beat:k,stepIndex:M,chakraDayKey:P,stepsPerBeat:44,visualClamped:N}),[O,k,M,P,N]),{prefersReduce:L,prefersContrast:R}=rm(),{kaiData:z,kaiDataRef:B}=am(h),V=om(`${I.pulse}|${I.beat}|${I.stepIndex}|${I.chakraDayKey}`),H=(0,C.useMemo)(()=>Zp(V),[V]),{sides:U,hue:ee}=Cp[P],te=I.pulse%7+1,ne=I.beat%5+2,re=I.visualClamped*2*Math.PI,ie=yp**2*Math.PI*(I.pulse%97)%(2*Math.PI),ae=50+15*Math.sin(I.visualClamped*2*Math.PI),oe=kp((ee+360*.03*I.visualClamped)%360,100,ae),se=wp[P],ce=(0,C.useMemo)(()=>Pp(P,M),[P,M]),le=typeof window<`u`?window.devicePixelRatio??1:1,ue=f&&!L,de=(m?`${m}-${M}`:void 0)??`ks-${I.pulse}-${I.beat}-${M}`,fe=Math.max(10,Math.floor((c??240)*.08)),pe=Math.max(40,(c??240)-fe*2),me=Math.max(.6,(c??240)*.003),he=Math.max(1.4,(c??240)*.009),ge=Math.max(2.5,(c??240)*.016),_e=5e3+Math.floor(H()*800)+Math.floor(V%436/2),ve=Math.floor((V>>>1)%_e),ye=(0,C.useMemo)(()=>Ap(U,ie),[U,ie]),be=(0,C.useMemo)(()=>jp(te,ne,re),[te,ne,re]),[xe,Se]=(0,C.useState)(),[Ce,we]=(0,C.useState)();(0,C.useEffect)(()=>{(async()=>{let e=_;e||(e=Gp(await qp(`${I.pulse}|${I.beat}|${M}|${P}|${v??``}`)),Se(e));let t=g;!t&&e&&(t=await Xp((await qp(`${e}φ`)).slice(0,20)),we(t))})().catch(S)},[_,g,I.pulse,I.beat,M,P,v,S]);let Te=_??xe,Ee=g??Ce,De=sm(),Oe=(0,C.useRef)(I.pulse),[ke,Ae]=(0,C.useState)(null),[je,Me]=(0,C.useState)(null),Ne=(0,C.useRef)(null);(0,C.useEffect)(()=>{Ne.current={pulse:Oe.current,kaiPulse:Oe.current,kaiSignature:Te??void 0,userPhiKey:Ee??void 0,beat:I.beat,stepIndex:I.stepIndex,stepsPerBeat:I.stepsPerBeat,quality:Gy(d),frequencyHz:ce,chakraDay:I.chakraDayKey,chakraGate:se}},[I.beat,I.stepIndex,Te,Ee,ce,I.chakraDayKey,se,d]);let Pe=(0,C.useMemo)(()=>`${I.pulse}|${I.beat}|${I.stepIndex}|${I.chakraDayKey}`,[I.pulse,I.beat,I.stepIndex,I.chakraDayKey]),[Fe,Ie]=(0,C.useState)(null);(0,C.useEffect)(()=>{let e=!1,t=I.pulse,n=I.beat,r=I.stepIndex,i=I.chakraDayKey,a=I.stepsPerBeat,o=ce,c=Pe,l=Uy(s)?s:null;return(async()=>{try{let s=await tm({creatorPublicKey:y,userPhiKey:Ee,kaiSignature:Te,origin:b,pulse:t,beat:n,chakraDay:i,stepIndex:r}),u=B.current,f=Hp(Lp(u,`kaiMomentSummary`))??Hp(Lp(u,`kairos_seal`))??Hp(Lp(u,`kairos_seal_day_month_percent`))??`Kairos HarmoniK Sigil • ${i} • Beat ${n} • Step ${r}`,p={pulse:Oe.current,kaiPulse:Oe.current,kaiSignature:Te??void 0,userPhiKey:Ee??void 0,beat:n,stepsPerBeat:a,quality:d===`low`?`low`:`high`,frequencyHz:o,chakraDay:i,chakraGate:se};try{let{seal:e}=await hu(p,Oe.current,De);Me(e)}catch(e){S?.(e)}let m=await Iy({canon:{pulse:t,beat:n,stepIndex:r,chakraDayKey:i,stepsPerBeat:a},hashMode:h,chakraGate:se,kaiSignature:Te,userPhiKey:Ee,intentionSigil:v,origin:b,title:f,klockSnapshot:Fp(E)?JSON.parse(Ip(E)):null,kaiApiSnapshot:Fp(z)?JSON.parse(Ip(z)):null,weekdayResolved:l,valuationSource:p,mintSeal:null,frequencyHzCurrent:o,qrHref:T,canonicalUrlFromContext:vp,creatorResolved:s}),g={},_=``,C=``,w=``,D=``,O=``;if(Wy(m)){let e=m.embeddedBase;Wy(e)&&(g=e);let t=m.payloadHashHex;typeof t==`string`&&(_=t);let n=m.parityUrl;typeof n==`string`&&(C=n);let r=m.innerRingText;typeof r==`string`&&(w=r);let i=m.sigilUrl;typeof i==`string`&&(D=i);let a=m.hashB58;typeof a==`string`&&(O=a)}let k={PULSE_MS:qn,STEPS_BEAT:a,PHI:yp,algorithm:`computeIntrinsicUnsigned`,version:`1`},A=p?mu(p,t).unsigned.valuePhi:null,j=Ly({...g,valuation:je??null,valuationSource:p,valuationRuntime:k,valuationLiveAtExport:A}),M={createdFor:{pulse:t,beat:n,stepIndex:r,chakraDayKey:i,stateKey:c},payloadHashHex:_,shareUrl:C,embeddedMetaJson:j,valuationSourceJson:JSON.stringify(p),zkScheme:`groth16-poseidon`,zkPoseidonHash:`7110303097080024260800444665787206606103183587082596139871399733998958991511`,innerRingText:w,sigilUrl:D,hashB58:O,frequencyHz:o};!e&&M.createdFor.stateKey===c&&(Ie(M),x?.({hash:M.payloadHashHex,url:M.shareUrl,metadataJson:M.embeddedMetaJson}))}catch(e){if(S?.(e),u)throw e instanceof Error?e:Error(String(e))}})().catch(e=>{if(S?.(e),u)throw e instanceof Error?e:Error(String(e))}),()=>{e=!0}},[Pe,I.pulse,I.beat,I.stepIndex,I.chakraDayKey,I.stepsPerBeat,ce,Te,Ee,h,y,b,T,u,x,S,P,d,E,z,B,De,se,s]);let Le=(0,C.useMemo)(()=>{let e=Fe;return e&&e.createdFor.stateKey===Pe?e.createdFor.stepIndex:I.stepIndex},[Fe,Pe,I.stepIndex]),Re=(0,C.useMemo)(()=>{let e=Fe;return e&&e.createdFor.stateKey===Pe?e.frequencyHz:ce},[Fe,Pe,ce]);(0,C.useEffect)(()=>{try{if(!Ne.current||!Number.isFinite(I.pulse)){Ae(null);return}let{unsigned:e}=mu(Ne.current,I.pulse);Ae(e.valuePhi)}catch(e){S?.(e),Ae(null)}},[I.pulse,S]);let ze=Lp(E,`eternalSeal`)??Lp(E,`seal`)??Lp(z,`kairos_seal`),Be=(0,C.useMemo)(()=>qy(ze,I.beat,Le,I.pulse),[ze,I.beat,Le,I.pulse]),Ve=(0,C.useMemo)(()=>{let e=Fe&&Fe.createdFor.stateKey===Pe?Fe.createdFor.stepIndex:Le;return qy(ze,I.beat,e,I.pulse)},[Fe,Pe,ze,I.beat,Le,I.pulse]),He=(0,C.useMemo)(()=>Qy(Ve),[Ve]),{klockIsoSnapshot:Ue,apiSnapshot:We,klockDataAttrs:Ge,eternalMonth:Ke,harmonicDay:qe,kaiPulseEternal:Je,solarChakraStepString:Ye,chakraArc:Xe}=(0,C.useMemo)(()=>nb(E,z),[E,z]),Ze=(0,C.useRef)(null);(0,C.useLayoutEffect)(()=>{let e=Ze.current;if(!e||!l)return;let t=!1;return(async()=>{try{let n=e.cloneNode(!0);n.removeAttribute(`data-svg-hash`),n.removeAttribute(`data-svg-valid`);let r=Gp(await qp(new XMLSerializer().serializeToString(n)));if(t)return;if(e.dataset.svgHash=r,e.dataset.svgValid=String(r===l.toLowerCase()),r!==l.toLowerCase()&&u)throw Error(`[KaiSigil] SVG HASH MISMATCH (${r})`)}catch(e){if(S?.(e),u)throw e instanceof Error?e:Error(String(e))}})().catch(e=>{if(S?.(e),u)throw e instanceof Error?e:Error(String(e))}),()=>{t=!0}},[l,u,Pe,S]),(0,C.useLayoutEffect)(()=>{if(!u)return;let e=Ze.current;if(!e)return;let t=Fe;if(!t||t.createdFor.stateKey!==Pe)return;let n=e.getAttribute(`data-step-index`),r=e.getAttribute(`data-frequency-hz`),i=e.getAttribute(`data-summary-b64`)??``,a=n!=null&&n!==``?Number(n):NaN,o=r!=null&&r!==``?Number(r):NaN,s=e.getAttribute(`data-share-url`)||void 0,c=e.getAttribute(`data-payload-hash`)||void 0,l=``;try{l=$y(i)}catch{l=``}let d=Ve,f=e=>e.replace(/•|·|\u2022/g,`•`),p=[];if(f(l)!==f(d)&&p.push(`summary mismatch (“${l}” != “${d}”)`),Number.isFinite(a)?a!==t.createdFor.stepIndex&&p.push(`data-step-index(${a}) != built(${t.createdFor.stepIndex})`):p.push(`missing/invalid data-step-index`),!Number.isFinite(o))p.push(`missing/invalid data-frequency-hz`);else{let e=Pp(P,a);(Math.abs(o-t.frequencyHz)>1e-6||Math.abs(e-o)>1e-6)&&p.push(`frequency/step mismatch (${o} vs step ${a})`)}if(s!==t.shareUrl&&p.push(`data-share-url != built.shareUrl`),c&&c!==t.payloadHashHex&&p.push(`data-payload-hash != built.payloadHashHex`),p.length)throw Error(`[KaiSigil] Invariant violation → ${p.join(`; `)}`)},[u,Fe,Pe,P,I.beat,I.pulse,Re,Ve]);let{toDataURL:Qe,exportBlob:$e,verifySvgHash:et}=Ry(Ze,c),tt=(0,C.useMemo)(()=>Fp(D)?JSON.parse(Ip(D)):null,[D]),nt=Fe?.createdFor.stateKey===Pe?Fe?.payloadHashHex:void 0,rt=Fe?.createdFor.stateKey===Pe?Fe?.zkScheme:void 0,it=Fe?.createdFor.stateKey===Pe?Fe?.zkPoseidonHash:void 0,at=Fe?.createdFor.stateKey===Pe?Fe?.shareUrl:void 0,ot=(Fe?.createdFor.stateKey===Pe?Fe?.frequencyHz:void 0)??ce,st=(0,C.useMemo)(()=>{if(!Te)return``;let e=Ky(Te),t=2*Math.PI*((c??240)*.46),n=Math.max(3.5,(c??240)*.028*.55),r=Math.max(24,Math.floor(t/n));return e.length>r?e.slice(0,r):e},[Te,c]),ct=ib(ee,I.visualClamped,Fe?.payloadHashHex),lt=Te?`${de}-sig-path`:void 0,ut=`${de}-desc`,dt=Fe?.createdFor.stateKey===Pe?Fe?.shareUrl:void 0,ft=({children:e})=>dt?(0,W.jsx)(`a`,{href:dt,target:`_self`,"aria-label":`Open canonical sigil ${Fe?.payloadHashHex??``}`,children:e}):(0,W.jsx)(`g`,{tabIndex:0,role:`button`,"aria-label":`Sigil not yet canonicalized`,children:e}),pt=Fe?.createdFor.stateKey===Pe,mt=rb(nt,pt,P,ot,I.pulse,I.beat,it),{ledgerJson:ht,dhtJson:gt}=(0,C.useMemo)(()=>eb(pt?Fe?.embeddedMetaJson:void 0),[Fe,pt]);return(0,C.useImperativeHandle)(t,()=>({toDataURL:Qe,exportBlob:$e,verifySvgHash:et,verifyConsistency:()=>{let e=Fe;if(!e)throw Error(`No built snapshot yet`);if(e.createdFor.stateKey!==Pe)throw Error(`Built snapshot does not match current stateKey`)},uid:de,stepIndex:M,payloadHashHex:Fe?.payloadHashHex,sigilUrl:Fe?.sigilUrl,userPhiKey:Ee,kaiSignature:Te})),(0,W.jsxs)(`svg`,{ref:Ze,id:n??de,role:`img`,"aria-describedby":ut,lang:`en`,"aria-label":`Kairos sigil — pulse ${I.pulse}`,viewBox:`0 0 ${xp} ${xp}`,width:c,height:c,shapeRendering:`geometricPrecision`,style:{background:`transparent`,"--dur":`${_e}ms`,"--off":`${ve}ms`,"--pulse":`${qn}ms`,cursor:at?`pointer`:`default`},"data-pulse":String(I.pulse),"data-beat":String(I.beat),"data-step-index":String(Le),"data-frequency-hz":String(Re),"data-chakra-day":P,"data-weekday":F??void 0,"data-chakra-gate":se,"data-quality":d,"data-golden-id":m??void 0,"data-kai-signature":Te??void 0,"data-phi-key":Ee??void 0,"data-payload-hash":nt??void 0,"data-zk-scheme":rt??void 0,"data-zk-poseidon-hash":it??void 0,"data-share-url":at||void 0,"data-eternal-seal":ze??void 0,"data-eternal-month":Ke??void 0,"data-harmonic-day":qe??void 0,"data-kai-pulse-eternal":typeof Je==`number`?String(Je):void 0,"data-solar-chakra-step":Ye??void 0,"data-arc":Xe??void 0,"data-summary-b64":He,...Ge,"data-valuation-algorithm":je?.algorithm??void 0,"data-valuation-policy":je?.policyId??void 0,"data-valuation-policy-checksum":je?.policyChecksum??void 0,"data-valuation-stamp":je?.stamp??void 0,"data-valuation-value-phi":je?.valuePhi==null?void 0:String(je.valuePhi),"data-valuation-computed-at":je?.computedAtPulse==null?void 0:String(je.computedAtPulse),"data-value-phi-live":ke==null?void 0:String(ke),children:[(0,W.jsx)(`title`,{children:`Kairos HarmoniK Sigil • Pulse ${I.pulse}`}),(0,W.jsxs)(`desc`,{id:ut,children:[`↳ `,Be]}),(0,W.jsx)(By,{uid:de,stateKeyOk:pt,embeddedMetaJson:pt?Fe?.embeddedMetaJson:void 0,klockIsoSnapshot:Ue,apiSnapshot:We,extraEmbed:tt,mintSealJson:je?JSON.stringify(je):null,valuationSourceJson:pt?Fe?.valuationSourceJson:void 0,displayStepIndex:Le,stepsPerBeat:I.stepsPerBeat,eternalSeal:ze??void 0,ledgerJson:ht,dhtJson:gt}),(0,W.jsx)(zy,{uid:de,hue:ee,visualClamped:I.visualClamped,doAnim:ue,quality:d,dpr:le,seed:V,payloadHashHex:Fe?.payloadHashHex,auraPath:be}),Te&&(0,W.jsx)(`defs`,{children:(0,W.jsx)(`path`,{id:lt,d:`M 500 ${500-1e3*.46} a ${1e3*.46} ${1e3*.46} 0 1 1 0 ${1e3*.92} a ${1e3*.46} ${1e3*.46} 0 1 1 0 -${1e3*.92}`,fill:`none`})}),(0,W.jsx)(ft,{children:(0,W.jsxs)(`g`,{id:`${de}-tilt`,style:{transformOrigin:`500px 500px`},children:[ue&&(0,W.jsx)(`animateTransform`,{attributeName:`transform`,type:`rotate`,values:`-2 500 500;2 500 500;-2 500 500`,dur:`var(--dur)`,begin:`var(--off)`,repeatCount:`indefinite`}),(0,W.jsx)(Vy,{uid:de,size:c,baseColor:oe,corePath:ye,auraId:`${de}-aura`,sigPathId:lt,doAnim:ue,quality:d,dpr:le,pad:fe,safeTextWidth:pe,outlineWidth:R?me*1.2:me,strokeCore:he,dotR:ge,debugOutline:p,prefersContrast:R,haloId:`${de}-halo`,netId:`${de}-net`,warpId:`${de}-warp`,glowId:`${de}-glow`,maskId:`${de}-mask`,rotation:ie,chakraSides:Cp[P].sides,binaryForRender:st,summary:Be,pulse:I.pulse})]})}),w&&(0,W.jsx)(cm,{uid:de,size:c,phaseColor:ct,outerRingText:mt,innerRingText:Fe&&Fe.createdFor.stateKey===Pe?Fe.innerRingText:`initializing…`,animate:f,prefersReduce:L})]})});ab.displayName=`KaiSigil`;var ob=ab,sb=9e15,cb=1e9,lb=`0123456789abcdef`,ub=`2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058`,db=`3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789`,fb={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-sb,maxE:sb,crypto:!1},pb,mb,K=!0,hb=`[DecimalError] `,gb=hb+`Invalid argument: `,_b=hb+`Precision limit exceeded`,vb=hb+`crypto unavailable`,yb=`[object Decimal]`,bb=Math.floor,xb=Math.pow,Sb=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Cb=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,wb=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Tb=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Eb=1e7,q=7,Db=9007199254740991,Ob=ub.length-1,kb=db.length-1,J={toStringTag:yb};J.absoluteValue=J.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Y(e)},J.ceil=function(){return Y(new this.constructor(this),this.e+1,2)},J.clampedTo=J.clamp=function(e,t){var n,r=this,i=r.constructor;if(e=new i(e),t=new i(t),!e.s||!t.s)return new i(NaN);if(e.gt(t))throw Error(gb+t);return n=r.cmp(e),n<0?e:r.cmp(t)>0?t:new i(r)},J.comparedTo=J.cmp=function(e){var t,n,r,i,a=this,o=a.d,s=(e=new a.constructor(e)).d,c=a.s,l=e.s;if(!o||!s)return!c||!l?NaN:c===l?o===s?0:!o^c<0?1:-1:c;if(!o[0]||!s[0])return o[0]?c:s[0]?-l:0;if(c!==l)return c;if(a.e!==e.e)return a.e>e.e^c<0?1:-1;for(r=o.length,i=s.length,t=0,n=rs[t]^c<0?1:-1;return r===i?0:r>i^c<0?1:-1},J.cosine=J.cos=function(){var e,t,n=this,r=n.constructor;return n.d?n.d[0]?(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+q,r.rounding=1,n=Pb(r,$b(r,n)),r.precision=e,r.rounding=t,Y(mb==2||mb==3?n.neg():n,e,t,!0)):new r(1):new r(NaN)},J.cubeRoot=J.cbrt=function(){var e,t,n,r,i,a,o,s,c,l,u=this,d=u.constructor;if(!u.isFinite()||u.isZero())return new d(u);for(K=!1,a=u.s*xb(u.s*u,1/3),!a||Math.abs(a)==1/0?(n=Ab(u.d),e=u.e,(a=(e-n.length+1)%3)&&(n+=a==1||a==-2?`0`:`00`),a=xb(n,1/3),e=bb((e+1)/3)-(e%3==(e<0?-1:2)),a==1/0?n=`5e`+e:(n=a.toExponential(),n=n.slice(0,n.indexOf(`e`)+1)+e),r=new d(n),r.s=u.s):r=new d(a.toString()),o=(e=d.precision)+3;;)if(s=r,c=s.times(s).times(s),l=c.plus(u),r=Fb(l.plus(u).times(s),l.plus(c),o+2,1),Ab(s.d).slice(0,o)===(n=Ab(r.d)).slice(0,o))if(n=n.slice(o-3,o+1),n==`9999`||!i&&n==`4999`){if(!i&&(Y(s,e+1,0),s.times(s).times(s).eq(u))){r=s;break}o+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)==`5`)&&(Y(r,e+1,1),t=!r.times(r).times(r).eq(u));break}return K=!0,Y(r,e,d.rounding,t)},J.decimalPlaces=J.dp=function(){var e,t=this.d,n=NaN;if(t){if(e=t.length-1,n=(e-bb(this.e/q))*q,e=t[e],e)for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n},J.dividedBy=J.div=function(e){return Fb(this,new this.constructor(e))},J.dividedToIntegerBy=J.divToInt=function(e){var t=this,n=t.constructor;return Y(Fb(t,new n(e),0,1,1),n.precision,n.rounding)},J.equals=J.eq=function(e){return this.cmp(e)===0},J.floor=function(){return Y(new this.constructor(this),this.e+1,3)},J.greaterThan=J.gt=function(e){return this.cmp(e)>0},J.greaterThanOrEqualTo=J.gte=function(e){var t=this.cmp(e);return t==1||t===0},J.hyperbolicCosine=J.cosh=function(){var e,t,n,r,i,a=this,o=a.constructor,s=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return s;n=o.precision,r=o.rounding,o.precision=n+Math.max(a.e,a.sd())+4,o.rounding=1,i=a.d.length,i<32?(e=Math.ceil(i/3),t=(1/Qb(4,e)).toString()):(e=16,t=`2.3283064365386962890625e-10`),a=Zb(o,1,a.times(t),new o(1),!0);for(var c,l=e,u=new o(8);l--;)c=a.times(a),a=s.minus(c.times(u.minus(c.times(u))));return Y(a,o.precision=n,o.rounding=r,!0)},J.hyperbolicSine=J.sinh=function(){var e,t,n,r,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(t=a.precision,n=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,r=i.d.length,r<3)i=Zb(a,2,i,i,!0);else{e=1.4*Math.sqrt(r),e=e>16?16:e|0,i=i.times(1/Qb(5,e)),i=Zb(a,2,i,i,!0);for(var o,s=new a(5),c=new a(16),l=new a(20);e--;)o=i.times(i),i=i.times(s.plus(o.times(c.times(o).plus(l))))}return a.precision=t,a.rounding=n,Y(i,t,n,!0)},J.hyperbolicTangent=J.tanh=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,Fb(n.sinh(),n.cosh(),r.precision=e,r.rounding=t)):new r(n.s)},J.inverseCosine=J.acos=function(){var e=this,t=e.constructor,n=e.abs().cmp(1),r=t.precision,i=t.rounding;return n===-1?e.isZero()?zb(t,r+4,i).times(.5):(t.precision=r+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=r,t.rounding=i,e.times(2)):n===0?e.isNeg()?zb(t,r,i):new t(0):new t(NaN)},J.inverseHyperbolicCosine=J.acosh=function(){var e,t,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(e=r.precision,t=r.rounding,r.precision=e+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,K=!1,n=n.times(n).minus(1).sqrt().plus(n),K=!0,r.precision=e,r.rounding=t,n.ln()):new r(n)},J.inverseHyperbolicSine=J.asinh=function(){var e,t,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,K=!1,n=n.times(n).plus(1).sqrt().plus(n),K=!0,r.precision=e,r.rounding=t,n.ln())},J.inverseHyperbolicTangent=J.atanh=function(){var e,t,n,r,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=a.precision,t=a.rounding,r=i.sd(),Math.max(r,e)<2*-i.e-1?Y(new a(i),e,t,!0):(a.precision=n=r-i.e,i=Fb(i.plus(1),new a(1).minus(i),n+e,1),a.precision=e+4,a.rounding=1,i=i.ln(),a.precision=e,a.rounding=t,i.times(.5))):new a(NaN)},J.inverseSine=J.asin=function(){var e,t,n,r,i=this,a=i.constructor;return i.isZero()?new a(i):(t=i.abs().cmp(1),n=a.precision,r=a.rounding,t===-1?(a.precision=n+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=n,a.rounding=r,i.times(2)):t===0?(e=zb(a,n+4,r).times(.5),e.s=i.s,e):new a(NaN))},J.inverseTangent=J.atan=function(){var e,t,n,r,i,a,o,s,c,l=this,u=l.constructor,d=u.precision,f=u.rounding;if(l.isFinite()){if(l.isZero())return new u(l);if(l.abs().eq(1)&&d+4<=kb)return o=zb(u,d+4,f).times(.25),o.s=l.s,o}else{if(!l.s)return new u(NaN);if(d+4<=kb)return o=zb(u,d+4,f).times(.5),o.s=l.s,o}for(u.precision=s=d+10,u.rounding=1,n=Math.min(28,s/q+2|0),e=n;e;--e)l=l.div(l.times(l).plus(1).sqrt().plus(1));for(K=!1,t=Math.ceil(s/q),r=1,c=l.times(l),o=new u(l),i=l;e!==-1;)if(i=i.times(c),a=o.minus(i.div(r+=2)),i=i.times(c),o=a.plus(i.div(r+=2)),o.d[t]!==void 0)for(e=t;o.d[e]===a.d[e]&&e--;);return n&&(o=o.times(2<this.d.length-2},J.isNaN=function(){return!this.s},J.isNegative=J.isNeg=function(){return this.s<0},J.isPositive=J.isPos=function(){return this.s>0},J.isZero=function(){return!!this.d&&this.d[0]===0},J.lessThan=J.lt=function(e){return this.cmp(e)<0},J.lessThanOrEqualTo=J.lte=function(e){return this.cmp(e)<1},J.logarithm=J.log=function(e){var t,n,r,i,a,o,s,c,l=this,u=l.constructor,d=u.precision,f=u.rounding,p=5;if(e==null)e=new u(10),t=!0;else{if(e=new u(e),n=e.d,e.s<0||!n||!n[0]||e.eq(1))return new u(NaN);t=e.eq(10)}if(n=l.d,l.s<0||!n||!n[0]||l.eq(1))return new u(n&&!n[0]?-1/0:l.s==1?n?0:1/0:NaN);if(t)if(n.length>1)a=!0;else{for(i=n[0];i%10==0;)i/=10;a=i!==1}if(K=!1,s=d+p,o=Kb(l,s),r=t?Rb(u,s+10):Kb(e,s),c=Fb(o,r,s,1),Mb(c.d,i=d,f))do if(s+=10,o=Kb(l,s),r=t?Rb(u,s+10):Kb(e,s),c=Fb(o,r,s,1),!a){+Ab(c.d).slice(i+1,i+15)+1==0x5af3107a4000&&(c=Y(c,d+1,0));break}while(Mb(c.d,i+=10,f));return K=!0,Y(c,d,f)},J.minus=J.sub=function(e){var t,n,r,i,a,o,s,c,l,u,d,f,p=this,m=p.constructor;if(e=new m(e),!p.d||!e.d)return!p.s||!e.s?e=new m(NaN):p.d?e.s=-e.s:e=new m(e.d||p.s!==e.s?p:NaN),e;if(p.s!=e.s)return e.s=-e.s,p.plus(e);if(l=p.d,f=e.d,s=m.precision,c=m.rounding,!l[0]||!f[0]){if(f[0])e.s=-e.s;else if(l[0])e=new m(p);else return new m(c===3?-0:0);return K?Y(e,s,c):e}if(n=bb(e.e/q),u=bb(p.e/q),l=l.slice(),a=u-n,a){for(d=a<0,d?(t=l,a=-a,o=f.length):(t=f,n=u,o=l.length),r=Math.max(Math.ceil(s/q),o)+2,a>r&&(a=r,t.length=1),t.reverse(),r=a;r--;)t.push(0);t.reverse()}else{for(r=l.length,o=f.length,d=r0;--r)l[o++]=0;for(r=f.length;r>a;){if(l[--r]o?a+1:o+1,i>o&&(i=o,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(o=l.length,i=u.length,o-i<0&&(i=o,n=u,u=l,l=n),t=0;i;)t=(l[--i]=l[i]+u[i]+t)/Eb|0,l[i]%=Eb;for(t&&(l.unshift(t),++r),o=l.length;l[--o]==0;)l.pop();return e.d=l,e.e=Lb(l,r),K?Y(e,s,c):e},J.precision=J.sd=function(e){var t,n=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(gb+e);return n.d?(t=Bb(n.d),e&&n.e+1>t&&(t=n.e+1)):t=NaN,t},J.round=function(){var e=this,t=e.constructor;return Y(new t(e),e.e+1,t.rounding)},J.sine=J.sin=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+q,r.rounding=1,n=Xb(r,$b(r,n)),r.precision=e,r.rounding=t,Y(mb>2?n.neg():n,e,t,!0)):new r(NaN)},J.squareRoot=J.sqrt=function(){var e,t,n,r,i,a,o=this,s=o.d,c=o.e,l=o.s,u=o.constructor;if(l!==1||!s||!s[0])return new u(!l||l<0&&(!s||s[0])?NaN:s?o:1/0);for(K=!1,l=Math.sqrt(+o),l==0||l==1/0?(t=Ab(s),(t.length+c)%2==0&&(t+=`0`),l=Math.sqrt(t),c=bb((c+1)/2)-(c<0||c%2),l==1/0?t=`5e`+c:(t=l.toExponential(),t=t.slice(0,t.indexOf(`e`)+1)+c),r=new u(t)):r=new u(l.toString()),n=(c=u.precision)+3;;)if(a=r,r=a.plus(Fb(o,a,n+2,1)).times(.5),Ab(a.d).slice(0,n)===(t=Ab(r.d)).slice(0,n))if(t=t.slice(n-3,n+1),t==`9999`||!i&&t==`4999`){if(!i&&(Y(a,c+1,0),a.times(a).eq(o))){r=a;break}n+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)==`5`)&&(Y(r,c+1,1),e=!r.times(r).eq(o));break}return K=!0,Y(r,c,u.rounding,e)},J.tangent=J.tan=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+10,r.rounding=1,n=n.sin(),n.s=1,n=Fb(n,new r(1).minus(n.times(n)).sqrt(),e+10,0),r.precision=e,r.rounding=t,Y(mb==2||mb==4?n.neg():n,e,t,!0)):new r(NaN)},J.times=J.mul=function(e){var t,n,r,i,a,o,s,c,l,u=this,d=u.constructor,f=u.d,p=(e=new d(e)).d;if(e.s*=u.s,!f||!f[0]||!p||!p[0])return new d(!e.s||f&&!f[0]&&!p||p&&!p[0]&&!f?NaN:!f||!p?e.s/0:e.s*0);for(n=bb(u.e/q)+bb(e.e/q),c=f.length,l=p.length,c=0;){for(t=0,i=c+r;i>r;)s=a[i]+p[r]*f[i-r-1]+t,a[i--]=s%Eb|0,t=s/Eb|0;a[i]=(a[i]+t)%Eb|0}for(;!a[--o];)a.pop();return t?++n:a.shift(),e.d=a,e.e=Lb(a,n),K?Y(e,d.precision,d.rounding):e},J.toBinary=function(e,t){return ex(this,2,e,t)},J.toDecimalPlaces=J.toDP=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(jb(e,0,cb),t===void 0?t=r.rounding:jb(t,0,8),Y(n,e+n.e+1,t))},J.toExponential=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=Ib(r,!0):(jb(e,0,cb),t===void 0?t=i.rounding:jb(t,0,8),r=Y(new i(r),e+1,t),n=Ib(r,!0,e+1)),r.isNeg()&&!r.isZero()?`-`+n:n},J.toFixed=function(e,t){var n,r,i=this,a=i.constructor;return e===void 0?n=Ib(i):(jb(e,0,cb),t===void 0?t=a.rounding:jb(t,0,8),r=Y(new a(i),e+i.e+1,t),n=Ib(r,!1,e+r.e+1)),i.isNeg()&&!i.isZero()?`-`+n:n},J.toFraction=function(e){var t,n,r,i,a,o,s,c,l,u,d,f,p=this,m=p.d,h=p.constructor;if(!m)return new h(p);if(l=n=new h(1),r=c=new h(0),t=new h(r),a=t.e=Bb(m)-p.e-1,o=a%q,t.d[0]=xb(10,o<0?q+o:o),e==null)e=a>0?t:l;else{if(s=new h(e),!s.isInt()||s.lt(l))throw Error(gb+s);e=s.gt(t)?a>0?t:l:s}for(K=!1,s=new h(Ab(m)),u=h.precision,h.precision=a=m.length*q*2;d=Fb(s,t,0,1,1),i=n.plus(d.times(r)),i.cmp(e)!=1;)n=r,r=i,i=l,l=c.plus(d.times(i)),c=i,i=t,t=s.minus(d.times(i)),s=i;return i=Fb(e.minus(n),r,0,1,1),c=c.plus(i.times(l)),n=n.plus(i.times(r)),c.s=l.s=p.s,f=Fb(l,r,a,1).minus(p).abs().cmp(Fb(c,n,a,1).minus(p).abs())<1?[l,r]:[c,n],h.precision=u,K=!0,f},J.toHexadecimal=J.toHex=function(e,t){return ex(this,16,e,t)},J.toNearest=function(e,t){var n=this,r=n.constructor;if(n=new r(n),e==null){if(!n.d)return n;e=new r(1),t=r.rounding}else{if(e=new r(e),t===void 0?t=r.rounding:jb(t,0,8),!n.d)return e.s?n:e;if(!e.d)return e.s&&=n.s,e}return e.d[0]?(K=!1,n=Fb(n,e,0,t,1).times(e),K=!0,Y(n)):(e.s=n.s,n=e),n},J.toNumber=function(){return+this},J.toOctal=function(e,t){return ex(this,8,e,t)},J.toPower=J.pow=function(e){var t,n,r,i,a,o,s=this,c=s.constructor,l=+(e=new c(e));if(!s.d||!e.d||!s.d[0]||!e.d[0])return new c(xb(+s,l));if(s=new c(s),s.eq(1))return s;if(r=c.precision,a=c.rounding,e.eq(1))return Y(s,r,a);if(t=bb(e.e/q),t>=e.d.length-1&&(n=l<0?-l:l)<=Db)return i=Hb(c,s,n,r),e.s<0?new c(1).div(i):Y(i,r,a);if(o=s.s,o<0){if(tc.maxE+1||t0?o/0:0):(K=!1,c.rounding=s.s=1,n=Math.min(12,(t+``).length),i=Gb(e.times(Kb(s,r+n)),r),i.d&&(i=Y(i,r+5,1),Mb(i.d,r,a)&&(t=r+10,i=Y(Gb(e.times(Kb(s,t+n)),t),t+5,1),+Ab(i.d).slice(r+1,r+15)+1==0x5af3107a4000&&(i=Y(i,r+1,0)))),i.s=o,K=!0,c.rounding=a,Y(i,r,a))},J.toPrecision=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=Ib(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(jb(e,1,cb),t===void 0?t=i.rounding:jb(t,0,8),r=Y(new i(r),e,t),n=Ib(r,e<=r.e||r.e<=i.toExpNeg,e)),r.isNeg()&&!r.isZero()?`-`+n:n},J.toSignificantDigits=J.toSD=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(jb(e,1,cb),t===void 0?t=r.rounding:jb(t,0,8)),Y(new r(n),e,t)},J.toString=function(){var e=this,t=e.constructor,n=Ib(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?`-`+n:n},J.truncated=J.trunc=function(){return Y(new this.constructor(this),this.e+1,1)},J.valueOf=J.toJSON=function(){var e=this,t=e.constructor,n=Ib(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?`-`+n:n};function Ab(e){var t,n,r,i=e.length-1,a=``,o=e[0];if(i>0){for(a+=o,t=1;tn)throw Error(gb+e)}function Mb(e,t,n,r){var i,a,o,s;for(a=e[0];a>=10;a/=10)--t;return--t<0?(t+=q,i=0):(i=Math.ceil((t+1)/q),t%=q),a=xb(10,q-t),s=e[i]%a|0,r==null?t<3?(t==0?s=s/100|0:t==1&&(s=s/10|0),o=n<4&&s==99999||n>3&&s==49999||s==5e4||s==0):o=(n<4&&s+1==a||n>3&&s+1==a/2)&&(e[i+1]/a/100|0)==xb(10,t-2)-1||(s==a/2||s==0)&&(e[i+1]/a/100|0)==0:t<4?(t==0?s=s/1e3|0:t==1?s=s/100|0:t==2&&(s=s/10|0),o=(r||n<4)&&s==9999||!r&&n>3&&s==4999):o=((r||n<4)&&s+1==a||!r&&n>3&&s+1==a/2)&&(e[i+1]/a/1e3|0)==xb(10,t-3)-1,o}function Nb(e,t,n){for(var r,i=[0],a,o=0,s=e.length;on-1&&(i[r+1]===void 0&&(i[r+1]=0),i[r+1]+=i[r]/n|0,i[r]%=n)}return i.reverse()}function Pb(e,t){var n,r,i;if(t.isZero())return t;r=t.d.length,r<32?(n=Math.ceil(r/3),i=(1/Qb(4,n)).toString()):(n=16,i=`2.3283064365386962890625e-10`),e.precision+=n,t=Zb(e,1,t.times(i),new e(1));for(var a=n;a--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=n,t}var Fb=(function(){function e(e,t,n){var r,i=0,a=e.length;for(e=e.slice();a--;)r=e[a]*t+i,e[a]=r%n|0,i=r/n|0;return i&&e.unshift(i),e}function t(e,t,n,r){var i,a;if(n!=r)a=n>r?1:-1;else for(i=a=0;it[i]?1:-1;break}return a}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]1;)e.shift()}return function(r,i,a,o,s,c){var l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k=r.constructor,A=r.s==i.s?1:-1,j=r.d,M=i.d;if(!j||!j[0]||!M||!M[0])return new k(!r.s||!i.s||(j?M&&j[0]==M[0]:!M)?NaN:j&&j[0]==0||!M?A*0:A/0);for(c?(p=1,u=r.e-i.e):(c=Eb,p=q,u=bb(r.e/p)-bb(i.e/p)),D=M.length,T=j.length,_=new k(A),v=_.d=[],d=0;M[d]==(j[d]||0);d++);if(M[d]>(j[d]||0)&&u--,a==null?(S=a=k.precision,o=k.rounding):S=s?a+(r.e-i.e)+1:a,S<0)v.push(1),m=!0;else{if(S=S/p+2|0,d=0,D==1){for(f=0,M=M[0],S++;(d1&&(M=e(M,f,c),j=e(j,f,c),D=M.length,T=j.length),w=D,y=j.slice(0,D),b=y.length;b=c/2&&++E;do f=0,l=t(M,y,D,b),l<0?(x=y[0],D!=b&&(x=x*c+(y[1]||0)),f=x/E|0,f>1?(f>=c&&(f=c-1),h=e(M,f,c),g=h.length,b=y.length,l=t(h,y,g,b),l==1&&(f--,n(h,D=10;f/=10)d++;_.e=d+u*p-1,Y(_,s?a+_.e+1:a,o,m)}return _}})();function Y(e,t,n,r){var i,a,o,s,c,l,u,d,f,p=e.constructor;out:if(t!=null){if(d=e.d,!d)return e;for(i=1,s=d[0];s>=10;s/=10)i++;if(a=t-i,a<0)a+=q,o=t,u=d[f=0],c=u/xb(10,i-o-1)%10|0;else if(f=Math.ceil((a+1)/q),s=d.length,f>=s)if(r){for(;s++<=f;)d.push(0);u=c=0,i=1,a%=q,o=a-q+1}else break out;else{for(u=s=d[f],i=1;s>=10;s/=10)i++;a%=q,o=a-q+i,c=o<0?0:u/xb(10,i-o-1)%10|0}if(r=r||t<0||d[f+1]!==void 0||(o<0?u:u%xb(10,i-o-1)),l=n<4?(c||r)&&(n==0||n==(e.s<0?3:2)):c>5||c==5&&(n==4||r||n==6&&(a>0?o>0?u/xb(10,i-o):0:d[f-1])%10&1||n==(e.s<0?8:7)),t<1||!d[0])return d.length=0,l?(t-=e.e+1,d[0]=xb(10,(q-t%q)%q),e.e=-t||0):d[0]=e.e=0,e;if(a==0?(d.length=f,s=1,f--):(d.length=f+1,s=xb(10,q-a),d[f]=o>0?(u/xb(10,i-o)%xb(10,o)|0)*s:0),l)for(;;)if(f==0){for(a=1,o=d[0];o>=10;o/=10)a++;for(o=d[0]+=s,s=1;o>=10;o/=10)s++;a!=s&&(e.e++,d[0]==Eb&&(d[0]=1));break}else{if(d[f]+=s,d[f]!=Eb)break;d[f--]=0,s=1}for(a=d.length;d[--a]===0;)d.pop()}return K&&(e.e>p.maxE?(e.d=null,e.e=NaN):e.e0?a=a.charAt(0)+`.`+a.slice(1)+Vb(r):o>1&&(a=a.charAt(0)+`.`+a.slice(1)),a=a+(e.e<0?`e`:`e+`)+e.e):i<0?(a=`0.`+Vb(-i-1)+a,n&&(r=n-o)>0&&(a+=Vb(r))):i>=o?(a+=Vb(i+1-o),n&&(r=n-i-1)>0&&(a=a+`.`+Vb(r))):((r=i+1)0&&(i+1===o&&(a+=`.`),a+=Vb(r))),a}function Lb(e,t){var n=e[0];for(t*=q;n>=10;n/=10)t++;return t}function Rb(e,t,n){if(t>Ob)throw K=!0,n&&(e.precision=n),Error(_b);return Y(new e(ub),t,1,!0)}function zb(e,t,n){if(t>kb)throw Error(_b);return Y(new e(db),t,n,!0)}function Bb(e){var t=e.length-1,n=t*q+1;if(t=e[t],t){for(;t%10==0;t/=10)n--;for(t=e[0];t>=10;t/=10)n++}return n}function Vb(e){for(var t=``;e--;)t+=`0`;return t}function Hb(e,t,n,r){var i,a=new e(1),o=Math.ceil(r/q+4);for(K=!1;;){if(n%2&&(a=a.times(t),tx(a.d,o)&&(i=!0)),n=bb(n/2),n===0){n=a.d.length-1,i&&a.d[n]===0&&++a.d[n];break}t=t.times(t),tx(t.d,o)}return K=!0,a}function Ub(e){return e.d[e.d.length-1]&1}function Wb(e,t,n){for(var r,i,a=new e(t[0]),o=0;++o17)return new f(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(t==null?(K=!1,c=m):c=t,s=new f(.03125);e.e>-2;)e=e.times(s),d+=5;for(r=Math.log(xb(2,d))/Math.LN10*2+5|0,c+=r,n=a=o=new f(1),f.precision=c;;){if(a=Y(a.times(e),c,1),n=n.times(++u),s=o.plus(Fb(a,n,c,1)),Ab(s.d).slice(0,c)===Ab(o.d).slice(0,c)){for(i=d;i--;)o=Y(o.times(o),c,1);if(t==null)if(l<3&&Mb(o.d,c-r,p,l))f.precision=c+=10,n=a=s=new f(1),u=0,l++;else return Y(o,f.precision=m,p,K=!0);else return f.precision=m,o}o=s}}function Kb(e,t){var n,r,i,a,o,s,c,l,u,d,f,p=1,m=10,h=e,g=h.d,_=h.constructor,v=_.rounding,y=_.precision;if(h.s<0||!g||!g[0]||!h.e&&g[0]==1&&g.length==1)return new _(g&&!g[0]?-1/0:h.s==1?g?0:h:NaN);if(t==null?(K=!1,u=y):u=t,_.precision=u+=m,n=Ab(g),r=n.charAt(0),Math.abs(a=h.e)<0x5543df729c000){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)h=h.times(e),n=Ab(h.d),r=n.charAt(0),p++;a=h.e,r>1?(h=new _(`0.`+n),a++):h=new _(r+`.`+n.slice(1))}else return l=Rb(_,u+2,y).times(a+``),h=Kb(new _(r+`.`+n.slice(1)),u-m).plus(l),_.precision=y,t==null?Y(h,y,v,K=!0):h;for(d=h,c=o=h=Fb(h.minus(1),h.plus(1),u,1),f=Y(h.times(h),u,1),i=3;;){if(o=Y(o.times(f),u,1),l=c.plus(Fb(o,new _(i),u,1)),Ab(l.d).slice(0,u)===Ab(c.d).slice(0,u))if(c=c.times(2),a!==0&&(c=c.plus(Rb(_,u+2,y).times(a+``))),c=Fb(c,new _(p),u,1),t==null)if(Mb(c.d,u-m,v,s))_.precision=u+=m,l=o=h=Fb(d.minus(1),d.plus(1),u,1),f=Y(h.times(h),u,1),i=s=1;else return Y(c,_.precision=y,v,K=!0);else return _.precision=y,c;c=l,i+=2}}function qb(e){return String(e.s*e.s/0)}function Jb(e,t){var n,r,i;for((n=t.indexOf(`.`))>-1&&(t=t.replace(`.`,``)),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;r++);for(i=t.length;t.charCodeAt(i-1)===48;--i);if(t=t.slice(r,i),t){if(i-=r,e.e=n=n-r-1,e.d=[],r=(n+1)%q,n<0&&(r+=q),re.constructor.maxE?(e.d=null,e.e=NaN):e.e-1){if(t=t.replace(/(\d)_(?=\d)/g,`$1`),Tb.test(t))return Jb(e,t)}else if(t===`Infinity`||t===`NaN`)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(Cb.test(t))n=16,t=t.toLowerCase();else if(Sb.test(t))n=2;else if(wb.test(t))n=8;else throw Error(gb+t);for(a=t.search(/p/i),a>0?(c=+t.slice(a+1),t=t.substring(2,a)):t=t.slice(2),a=t.indexOf(`.`),o=a>=0,r=e.constructor,o&&(t=t.replace(`.`,``),s=t.length,a=s-a,i=Hb(r,new r(n),a,a*2)),l=Nb(t,n,Eb),u=l.length-1,a=u;l[a]===0;--a)l.pop();return a<0?new r(e.s*0):(e.e=Lb(l,u),e.d=l,K=!1,o&&(e=Fb(e,i,s*4)),c&&(e=e.times(Math.abs(c)<54?xb(2,c):Ux.pow(2,c))),K=!0,e)}function Xb(e,t){var n,r=t.d.length;if(r<3)return t.isZero()?t:Zb(e,2,t,t);n=1.4*Math.sqrt(r),n=n>16?16:n|0,t=t.times(1/Qb(5,n)),t=Zb(e,2,t,t);for(var i,a=new e(5),o=new e(16),s=new e(20);n--;)i=t.times(t),t=t.times(a.plus(i.times(o.times(i).minus(s))));return t}function Zb(e,t,n,r,i){var a,o,s,c,l=1,u=e.precision,d=Math.ceil(u/q);for(K=!1,c=n.times(n),s=new e(r);;){if(o=Fb(s.times(c),new e(t++*t++),u,1),s=i?r.plus(o):r.minus(o),r=Fb(o.times(c),new e(t++*t++),u,1),o=s.plus(r),o.d[d]!==void 0){for(a=d;o.d[a]===s.d[a]&&a--;);if(a==-1)break}a=s,s=r,r=o,o=a,l++}return K=!0,o.d.length=d+1,o}function Qb(e,t){for(var n=e;--t;)n*=e;return n}function $b(e,t){var n,r=t.s<0,i=zb(e,e.precision,1),a=i.times(.5);if(t=t.abs(),t.lte(a))return mb=r?4:1,t;if(n=t.divToInt(i),n.isZero())mb=r?3:2;else{if(t=t.minus(n.times(i)),t.lte(a))return mb=Ub(n)?r?2:3:r?4:1,t;mb=Ub(n)?r?1:4:r?3:2}return t.minus(i).abs()}function ex(e,t,n,r){var i,a,o,s,c,l,u,d,f,p=e.constructor,m=n!==void 0;if(m?(jb(n,1,cb),r===void 0?r=p.rounding:jb(r,0,8)):(n=p.precision,r=p.rounding),!e.isFinite())u=qb(e);else{for(u=Ib(e),o=u.indexOf(`.`),m?(i=2,t==16?n=n*4-3:t==8&&(n=n*3-2)):i=t,o>=0&&(u=u.replace(`.`,``),f=new p(1),f.e=u.length-o,f.d=Nb(Ib(f),10,i),f.e=f.d.length),d=Nb(u,10,i),a=c=d.length;d[--c]==0;)d.pop();if(!d[0])u=m?`0p+0`:`0`;else{if(o<0?a--:(e=new p(e),e.d=d,e.e=a,e=Fb(e,f,n,r,0,i),d=e.d,a=e.e,l=pb),o=d[n],s=i/2,l||=d[n+1]!==void 0,l=r<4?(o!==void 0||l)&&(r===0||r===(e.s<0?3:2)):o>s||o===s&&(r===4||l||r===6&&d[n-1]&1||r===(e.s<0?8:7)),d.length=n,l)for(;++d[--n]>i-1;)d[n]=0,n||(++a,d.unshift(1));for(c=d.length;!d[c-1];--c);for(o=0,u=``;o1)if(t==16||t==8){for(o=t==16?4:3,--c;c%o;c++)u+=`0`;for(d=Nb(u,i,t),c=d.length;!d[c-1];--c);for(o=1,u=`1.`;oc)for(a-=c;a--;)u+=`0`;else at)return e.length=t,!0}function nx(e){return new this(e).abs()}function rx(e){return new this(e).acos()}function ix(e){return new this(e).acosh()}function ax(e,t){return new this(e).plus(t)}function ox(e){return new this(e).asin()}function sx(e){return new this(e).asinh()}function cx(e){return new this(e).atan()}function lx(e){return new this(e).atanh()}function ux(e,t){e=new this(e),t=new this(t);var n,r=this.precision,i=this.rounding,a=r+4;return!e.s||!t.s?n=new this(NaN):!e.d&&!t.d?(n=zb(this,a,1).times(t.s>0?.25:.75),n.s=e.s):!t.d||e.isZero()?(n=t.s<0?zb(this,r,i):new this(0),n.s=e.s):!e.d||t.isZero()?(n=zb(this,a,1).times(.5),n.s=e.s):t.s<0?(this.precision=a,this.rounding=1,n=this.atan(Fb(e,t,a,1)),t=zb(this,a,1),this.precision=r,this.rounding=i,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan(Fb(e,t,a,1)),n}function dx(e){return new this(e).cbrt()}function fx(e){return Y(e=new this(e),e.e+1,2)}function px(e,t,n){return new this(e).clamp(t,n)}function mx(e){if(!e||typeof e!=`object`)throw Error(hb+`Object expected`);var t,n,r,i=e.defaults===!0,a=[`precision`,1,cb,`rounding`,0,8,`toExpNeg`,-sb,0,`toExpPos`,0,sb,`maxE`,0,sb,`minE`,-sb,0,`modulo`,0,9];for(t=0;t=a[t+1]&&r<=a[t+2])this[n]=r;else throw Error(gb+n+`: `+r);if(n=`crypto`,i&&(this[n]=fb[n]),(r=e[n])!==void 0)if(r===!0||r===!1||r===0||r===1)if(r)if(typeof crypto<`u`&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[n]=!0;else throw Error(vb);else this[n]=!1;else throw Error(gb+n+`: `+r);return this}function hx(e){return new this(e).cos()}function gx(e){return new this(e).cosh()}function _x(e){var t,n,r;function i(e){var t,n,r,a=this;if(!(a instanceof i))return new i(e);if(a.constructor=i,Sx(e)){a.s=e.s,K?!e.d||e.e>i.maxE?(a.e=NaN,a.d=null):e.e=10;n/=10)t++;K?t>i.maxE?(a.e=NaN,a.d=null):t=429e7?t[a]=crypto.getRandomValues(new Uint32Array(1))[0]:s[a++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(r*=4);a=214e7?crypto.randomBytes(4).copy(t,a):(s.push(i%1e7),a+=4);a=r/4}else throw Error(vb);else for(;a=10;i/=10)r++;re<0?0:e>1?1:e,mS=(e,t)=>(e%t+t)%t;function hS(e){return e instanceof Wx?e:new Wx(e)}function gS(e){let t=new Wx(e).minus(Zx).div(1e3).div(Yx).mul(1e6).toDecimalPlaces(0,Wx.ROUND_FLOOR);return BigInt(t.toString())}function _S(e){let t=new Wx(e.toString()).div(1e6).mul(Yx).mul(1e3).plus(Zx);return Number(t.toNearest(1,Wx.ROUND_HALF_EVEN).toString())}var vS=`kai.sunrise.offsetSec`,yS=`kai.sunrise.anchorISO`;function bS(){let e=localStorage.getItem(vS);try{return e?new Wx(e):new Wx(0)}catch{return new Wx(0)}}function xS(){return Number(bS())}function SS(e){let t=hS(e).mod(86400).plus(86400).mod(86400);localStorage.setItem(vS,t.toString()),localStorage.setItem(yS,new Date().toISOString())}function CS(e=new Date){let t=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));SS(new Wx(e.getTime()-t.getTime()).div(1e3))}function wS(e,t=new Date){let n=e.match(/^(\d{1,2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?$/);if(!n)return;let r=Math.min(23,Math.max(0,Number(n[1]))),i=Math.min(59,Math.max(0,Number(n[2]))),a=n[3]?Math.min(59,Math.max(0,Number(n[3]))):0,o=n[4]?new Wx(`0.`+n[4]):new Wx(0),s=new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0),c=new Date(s.getTime());c.setHours(r,i,a,0);let l=new Wx(c.getTime()).plus(o.mul(1e3)),u=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()));SS(l.minus(u.getTime()).div(1e3))}function TS(){let e=bS(),t=new Date(Zx),n=gS(new Wx(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())).plus(e.mul(1e3)).toNumber());return n<=gS(1715323541888)?n+oS:n}function ES(e=new Date){let t=bS(),n=gS(e.getTime()),r=gS(new Wx(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())).plus(t.mul(1e3)).toNumber()),i=r,a=r+oS;return nArray.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``);function RS(e){let t=e.buffer;return t instanceof ArrayBuffer&&e.byteOffset===0&&e.byteLength===t.byteLength?t:e.slice().buffer}async function zS(e){let t=RS(typeof e==`string`?new TextEncoder().encode(e):e),n=await crypto.subtle.digest(`SHA-256`,t);return LS(new Uint8Array(n))}async function BS(e,t){let n=URL.createObjectURL(e);try{let e=new Image;e.decoding=`async`,e.src=n,await e.decode();let r=document.createElement(`canvas`);r.width=e.width,r.height=e.height;let i=r.getContext(`2d`);if(!i)throw Error(`Canvas 2D context unavailable`);i.drawImage(e,0,0);let{data:a}=i.getImageData(Math.floor(e.width/2),Math.floor(e.height/2),1,1),o=[a[0],a[1],a[2]];return{sig:(await zS(`${t}-2:3-${o.join(`,`)}`)).slice(0,32),rgb:o}}finally{URL.revokeObjectURL(n)}}function VS(e){return btoa(String.fromCharCode(...e)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function HS(e){let t=JSON.stringify(e);return VS(new TextEncoder().encode(t))}function US(e){let t=JSON.stringify(e);return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))).replace(/=+$/g,``)}function WS(e,t,n){return`${e}_${t}_${n}`}function GS(e,t){try{let n=new URL(e,typeof window<`u`?window.location.origin:`http://localhost`),r={k:`phi.transfer.claim`,v:1,a:t.amountPhi,p:t.sendPulse,s:t.senderStamp,h:t.canonicalHash};return n.searchParams.set(`x`,`t:`+HS(r)),n.toString()}catch{return e}}var KS=e=>typeof e==`object`&&!!e,qS=(e,t)=>{if(!KS(e))return;let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0},JS=(e,t)=>{if(!KS(e))return;let n=e[t];return typeof n==`string`?n:void 0},YS=e=>{let t=typeof e==`string`?e:void 0;return t&&[`Root`,`Sacral`,`Solar Plexus`,`Heart`,`Throat`,`Third Eye`,`Crown`].includes(t)?t:void 0};function XS(e){let t=KS(e)&&`meta`in e?e.meta:void 0,n=qS(t,`pulse`)??(KS(e)?qS(e,`pulseCreated`):void 0)??AS(),r=qS(t,`beat`)??0,i=qS(t,`stepsPerBeat`)??44,a=qS(t,`stepIndex`)??Math.floor((qS(t,`stepPct`)??.5)*i),o=JS(t,`chakraDay`),s=KS(e)?JS(e,`chakraDay`):void 0,c=YS(o)??(s?YS(s):void 0)??`Root`,l=JS(t,`userPhiKey`),u=JS(t,`kaiSignature`),d=JS(t,`creatorPublicKey`);return{pulse:n,beat:r,stepsPerBeat:i,stepIndex:a,chakraDay:c,userPhiKey:l||void 0,kaiSignature:u||void 0,creatorPublicKey:d||void 0}}function ZS(e,t,n){let r=new Date,{kaiPulseToday:i,beatIndex:a,stepIndex:o,percentIntoStep:s}=MS(r),{display:c}=FS(r),l=IS(r),u=iS(e),d=`Kairos • ${c.dayName} (D${c.dayIndex1}/6) • Month ${c.monthIndex1} ${c.monthName} • Day ${c.dayInMonth1}/42 • YearDay ${c.dayInYear1}/336 • Beat ${a+1}/36 • Step ${o+1}/44 • ΦPulse ${e} • Ark ${l} • Chakra ${n}`;return{version:1,eternalPulse:e,sigilPulse:t,dayName:c.dayName,dayIndex1:c.dayIndex1,dayInMonth1:c.dayInMonth1,dayInYear1:c.dayInYear1,monthIndex1:c.monthIndex1,monthName:c.monthName,weekIndex1:c.weekIndex1,beatIndex:a,stepIndex:o,pulsesIntoBeat:u,kaiPulseToday:i,percentIntoStep:s,arcName:l,chakraDay:n,text:d}}function QS(e=9){return VS(crypto.getRandomValues(new Uint8Array(e)))}async function $S(e,t,n){let r=await e.text(),i=JSON.stringify(t,null,2).replace(/]]>/g,`]]]]>>`),a=JSON.stringify({phiTransfer:n},null,2).replace(//g,`]]]]>>`),o=`<metadata id="sigil-meta" data-type="application/json"><![CDATA[${i}`,s=`${a}`,c=r;return c=/]/i.test(c)?c.replace(//i,o):c.replace(/]*)?>/i,e=>`${e}${o}`),c=c.replace(/<\/svg>\s*$/i,`${s}`),new Blob([c],{type:`image/svg+xml`})}function eC({isOpen:e,onClose:t,sourceGlyph:n,onSend:r}){let[i,a]=(0,C.useState)(``),[o,s]=(0,C.useState)(``),[c,l]=(0,C.useState)(``),[u,d]=(0,C.useState)(null),[f,p]=(0,C.useState)(!1),m=(0,C.useRef)(null),[h,g]=(0,C.useState)(null),[_,v]=(0,C.useState)(null),[y,b]=(0,C.useState)(null),x=(0,C.useMemo)(()=>Number(KS(n)&&`value`in n?n.value:0),[n]),S=(0,C.useMemo)(()=>XS(n),[n]),w=Math.min(Math.max(S.stepIndex/S.stepsPerBeat,0),1);if((0,C.useEffect)(()=>{e||(a(``),s(``),l(``),d(null),p(!1))},[e]),!e)return null;let T=async()=>{d(null);let e=parseFloat(i);if(isNaN(e)||e<=0){d(`Enter a valid Φ amount.`);return}if(e>x){d(`Insufficient balance. Only ${x.toFixed(3)} Φ available.`);return}try{p(!0);let i=AS(),a=S.pulse,s=m.current;if(!s)throw Error(`Renderer unavailable`);let l=await s.exportBlob(`image/svg+xml`),u=await s.exportBlob(`image/png`,3),{sig:d,rgb:f}=await BS(u,a),g=await zS(`${d}-${a}-${i}`),v=ZS(i,a,S.chakraDay);if(!h)throw Error(`Sigil hash not ready`);let b={pulse:S.pulse,beat:S.beat,stepIndex:S.stepIndex,chakraDay:S.chakraDay,stepsPerBeat:S.stepsPerBeat,kaiSignature:S.kaiSignature,userPhiKey:S.userPhiKey},x=_??Qf(h,b,{origin:typeof window<`u`?window.location.origin:``,autoInferParent:!0}),C=GS(x,{amountPhi:e,sendPulse:i,senderStamp:g,canonicalHash:h}),w={kind:`phi.transfer`,version:1,amountPhi:e,recipient:o||null,message:c||null,createdAtPulseEternal:i,sigilPulse:a,sendPulse:i,rgbSeed:f,canonicalHash:h,shareUrl:C,sourcePhiKey:S.userPhiKey??null,kairosStamp:v},T=US(w),E={senderSignature:d,senderStamp:g,senderKaiPulse:i,payload:{name:`phi_transfer_value.json`,mime:`application/phi.transfer+json`,size:T.length,encoded:T}},D=y&&y.trim().length>0?JSON.parse(y):null,O={"@context":ps,type:ms,pulse:a,beat:S.beat,stepIndex:S.stepIndex,chakraDay:S.chakraDay,stepsPerBeat:S.stepsPerBeat,kaiSignature:S.kaiSignature??void 0,userPhiKey:S.userPhiKey??void 0,creatorPublicKey:S.creatorPublicKey??void 0,kaiPulse:i,canonicalHash:h,transferNonce:QS(),segmentSize:hs,transfers:[E],canonicalUrl:x,shareUrl:C,embeddedMeta:D},k=await $S(l,O,w),A=WS(`sigil_transfer`,a,i),j={version:1,kind:`phi.sigil.mint`,canonicalHash:h,canonicalUrl:x,shareUrl:C,meta:O},M=new Rd.default;M.file(`${A}.svg`,k),M.file(`${A}.png`,u),M.file(`${A}.json`,JSON.stringify(j,null,2));let N=await M.generateAsync({type:`blob`}),P=document.createElement(`a`),F=URL.createObjectURL(N);P.href=F,P.download=`${A}.zip`,P.rel=`noopener`,document.body.appendChild(P),P.click(),P.remove(),setTimeout(()=>URL.revokeObjectURL(F),0),hp(C),r(Id(n,e,i,o,c)),p(!1),t()}catch(e){p(!1),d(`Failed to mint & send glyph. `+(e instanceof Error?e.message:String(e)))}};return(0,W.jsx)(`div`,{className:`modal-overlay`,children:(0,W.jsxs)(`dialog`,{className:`send-sigil-modal`,open:!0,children:[(0,W.jsx)(`button`,{className:`close-btn`,onClick:t,"aria-label":`Close`,children:(0,W.jsx)(cd,{size:22})}),(0,W.jsx)(`h2`,{children:`Exhale Composite Derivative Breath`}),(0,W.jsx)(`div`,{"aria-hidden":!0,style:{position:`absolute`,width:0,height:0,overflow:`hidden`},children:(0,W.jsx)(ob,{ref:m,pulse:S.pulse,beat:S.beat,stepPct:w,chakraDay:S.chakraDay,userPhiKey:S.userPhiKey,kaiSignature:S.kaiSignature,creatorPublicKey:S.creatorPublicKey,origin:typeof window<`u`?window.location.origin:void 0,animate:!1,quality:`high`,showZKBadge:!1,onReady:({hash:e,metadataJson:t})=>{let n=Qf(e,{pulse:S.pulse,beat:S.beat,stepIndex:S.stepIndex,chakraDay:S.chakraDay,stepsPerBeat:S.stepsPerBeat,kaiSignature:S.kaiSignature,userPhiKey:S.userPhiKey},{origin:typeof window<`u`?window.location.origin:``,autoInferParent:!0});g(e),v(n),b(t)},onError:()=>{}})}),(0,W.jsxs)(`div`,{className:`field-group`,children:[(0,W.jsx)(`label`,{children:`Recipient Hash (optional)`}),(0,W.jsx)(`input`,{type:`text`,placeholder:`e.g. phikey::sig`,value:o,onChange:e=>s(e.currentTarget.value)})]}),(0,W.jsxs)(`div`,{className:`field-group`,children:[(0,W.jsx)(`label`,{children:`Memory (optional)`}),(0,W.jsx)(`input`,{type:`text`,placeholder:`Message to attach`,value:c,onChange:e=>l(e.currentTarget.value)})]}),(0,W.jsxs)(`div`,{className:`field-group`,children:[(0,W.jsx)(`label`,{children:`Amount to Exhale (Φ)`}),(0,W.jsx)(`input`,{type:`number`,value:i,onChange:e=>a(e.currentTarget.value),placeholder:`0.0`,min:`0`,step:`0.001`})]}),(0,W.jsxs)(`div`,{className:`balance-hint`,children:[`Available: `,x.toFixed(3),` Φ`]}),u&&(0,W.jsx)(`div`,{className:`error-msg`,children:u}),(0,W.jsxs)(`button`,{className:`send-btn`,onClick:T,disabled:f,children:[(0,W.jsx)(pd,{size:18}),` `,f?`Exhaling…`:`Exhale Breath`]}),(0,W.jsx)(`p`,{className:`small subtle`,style:{marginTop:8},children:h?`canonical: ${h.slice(0,10)}…`:`remembering sigil…`})]})})}var tC=e=>typeof e==`number`&&Number.isFinite(e),nC=new Map;function rC(e=2){if(nC.has(e))return nC.get(e);try{if(typeof Intl<`u`&&typeof Intl.NumberFormat==`function`){let t=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:e,maximumFractionDigits:e});return t.format(0),nC.set(e,t),t}}catch{}return nC.set(e,null),null}function iC(e,t){let n=e<0?`-`:``,[r,i]=Math.abs(e).toFixed(Math.max(0,t)).split(`.`);return`${n}$${r.replace(/\B(?=(\d{3})+(?!\d))/g,`,`)}${t>0?`.`+i:``}`}function aC(e,t=2){if(!tC(e))return t===0?`$0`:`$0.00`;let n=rC(t);return n?n.format(e):iC(e,t)}function oC(e,t=6){return`Φ ${(tC(e)?e:0).toFixed(Math.max(0,t))}`}const sC=(e,t=3)=>typeof e==`number`&&Number.isFinite(e)?`${(e*100).toFixed(t)}%`:`—`,cC=(e,t=3)=>typeof e==`number`&&Number.isFinite(e)?e.toFixed(t):`—`,lC=(e,t=2)=>`${tC(e)&&e>=0?`+`:``}${(e*100).toFixed(t)}%`,uC=(e,t=2)=>`${tC(e)&&e>=0?`+`:``}${(tC(e)?e:0).toFixed(t)}%`;function dC(e){let t=(e||``).trim();if(!t)return null;try{let e=new URL(t,typeof window<`u`?window.location.origin:`http://localhost`).pathname.match(/[/]s[/]([a-f0-9]{64})/i);if(e)return e[1].toLowerCase();let n=t.match(/[a-f0-9]{64}/i);return n?n[0].toLowerCase():null}catch{let e=t.match(/[a-f0-9]{64}/i);return e?e[0].toLowerCase():null}}function fC(e){return Number((Number.isFinite(e)?e:0).toFixed(6))}function pC(e){let t=(e.url||``).trim(),n=Math.max(0,Number.isFinite(e.amount)?e.amount:0);if(!t&&n<=0)return{...e,canonicalHash:null,valid:!1,error:`Enter URL and amount`};if(!t)return{...e,canonicalHash:null,valid:!1,error:`Missing URL`};let r=dC(t);return r?n<=0?{...e,canonicalHash:r,valid:!1,error:`Amount must be > 0`}:{...e,canonicalHash:r,valid:!0,error:null}:{...e,canonicalHash:null,valid:!1,error:`No canonical hash found`}}function mC({donors:e,balancePhi:t,balanceForMintPhi:n,setBalanceForMintPhi:r,addDonor:i,removeDonor:a,updateDonor:o,onMintComposite:s,minting:c,totalDonorAmount:l}){let u=(0,C.useMemo)(()=>e.map(pC),[e]),d=(0,C.useMemo)(()=>{let e=new Map;for(let t of u)t.canonicalHash&&e.set(t.canonicalHash,(e.get(t.canonicalHash)||0)+1);return e},[u]),f=u.some(e=>e.valid===!1&&(e.url||e.amount>0))||u.some(e=>e.canonicalHash&&(d.get(e.canonicalHash)||0)>1),p=(0,C.useMemo)(()=>fC(l+Math.max(0,Number(n||0))),[l,n]),m=(0,C.useCallback)((t,n)=>{let r=pC({...e[t],url:n});o(t,{url:n,canonicalHash:r.canonicalHash,valid:r.valid,error:r.error})},[e,o]),h=(0,C.useCallback)((t,n)=>{let r=Math.max(0,Number(n||0)),i=pC({...e[t],amount:r});o(t,{amount:r,canonicalHash:i.canonicalHash,valid:i.valid,error:i.error})},[e,o]);return(0,W.jsxs)(`section`,{className:`card donors-card streams-card`,"aria-label":`Create Temple-Glyph streams`,children:[(0,W.jsxs)(`header`,{className:`card-hd`,children:[(0,W.jsxs)(`div`,{className:`hd-left`,children:[(0,W.jsx)(_d,{size:16}),` `,(0,W.jsx)(`strong`,{children:`Temple-Glyph — Streams`})]}),(0,W.jsxs)(`div`,{className:`badge dim small`,title:`Validated streams · total Φ from streams only`,children:[u.filter(e=>e.url).length,` streams • Φ `,fC(l).toFixed(6)]})]}),(0,W.jsxs)(`div`,{className:`card-bd donors-bd`,children:[(0,W.jsxs)(`div`,{className:`donor-row local`,children:[(0,W.jsxs)(`div`,{className:`local-balance`,title:`Current pooled balance (available in-app)`,children:[(0,W.jsx)(`span`,{className:`mono`,children:`Pool`}),(0,W.jsx)(`strong`,{children:oC(t)})]}),(0,W.jsx)(`input`,{className:`donor-amt`,type:`number`,step:`0.000001`,min:0,max:t,placeholder:`Φ from pool`,"aria-label":`Amount from pooled balance`,value:Number.isFinite(n)?n:0,onChange:e=>r(Math.min(Math.max(0,Number(e.currentTarget.value||0)),t)),onBlur:e=>r(fC(Number(e.currentTarget.value||0)))}),(0,W.jsxs)(`div`,{className:`quick-pcts`,"aria-label":`Quick allocations`,children:[(0,W.jsx)(`button`,{className:`btn ghost tiny`,onClick:()=>r(fC(t*.618)),title:`1/φ (~61.8%)`,children:`61.8%`}),(0,W.jsx)(`button`,{className:`btn ghost tiny`,onClick:()=>r(fC(t)),title:`Use all`,children:`Max`})]})]}),(0,W.jsx)(`div`,{className:`donors-grid`,role:`list`,"aria-label":`Stream entries`,children:u.map((e,t)=>{let n=e.canonicalHash&&(d.get(e.canonicalHash)||0)>1,r=e.error||n;return(0,W.jsxs)(`div`,{className:`donor-row ${e.valid&&!n?`ok`:r?`err`:``}`,role:`listitem`,children:[(0,W.jsxs)(`div`,{className:`url-wrap`,children:[(0,W.jsx)(`input`,{className:`donor-url`,type:`url`,placeholder:`Stream sigil URL (or paste a 64-hex canonical hash)`,"aria-label":`Stream ${t+1} URL`,value:e.url,onChange:e=>m(t,e.currentTarget.value),spellCheck:!1,inputMode:`url`}),e.canonicalHash?(0,W.jsxs)(`span`,{className:`chip mono`,title:`Parsed canonical hash`,children:[(0,W.jsx)(dd,{size:12}),` `,e.canonicalHash.slice(0,8),`…`]}):e.url&&(0,W.jsxs)(`span`,{className:`chip warn`,title:`No canonical hash parsed`,children:[(0,W.jsx)(gd,{size:12}),` hash?`]})]}),(0,W.jsx)(`div`,{className:`amt-wrap`,children:(0,W.jsx)(`input`,{className:`donor-amt`,type:`number`,step:`0.000001`,min:0,placeholder:`Φ amount`,"aria-label":`Stream ${t+1} amount (Phi)`,value:Number.isFinite(e.amount)?e.amount:0,onChange:e=>h(t,e.currentTarget.value),onBlur:e=>h(t,fC(Number(e.currentTarget.value||0)).toString())})}),(0,W.jsx)(`button`,{className:`btn ghost small`,title:`Remove stream`,"aria-label":`Remove stream ${t+1}`,onClick:()=>a(t),children:`×`}),r&&(0,W.jsxs)(`div`,{className:`donor-hint`,role:`status`,"aria-live":`polite`,children:[(0,W.jsx)(gd,{size:14}),(0,W.jsx)(`span`,{children:n?`Duplicate stream (same hash)`:e.error})]}),e.valid&&!n&&(0,W.jsxs)(`div`,{className:`donor-hint ok`,"aria-hidden":`true`,children:[(0,W.jsx)(sd,{size:14}),(0,W.jsx)(`span`,{children:`Ready`})]})]},`stream-${t}`)})}),(0,W.jsxs)(`div`,{className:`donors-actions`,children:[(0,W.jsxs)(`button`,{className:`btn ghost`,onClick:i,children:[(0,W.jsx)(fd,{size:16}),` Add stream`]}),(0,W.jsxs)(`button`,{className:`btn primary`,disabled:c||f||!u.some(e=>e.valid&&!((d.get(e.canonicalHash||``)||0)>1))&&fC(n)<=0,title:f?`Fix invalid streams (URL/amount/duplicates)`:`Continue to seal your composite Temple-Glyph`,onClick:s,children:[(0,W.jsx)(_d,{size:16}),` `,c?`Exhaling...`:`➵ to Exhale Temple-Glyph`]})]}),(0,W.jsxs)(`div`,{className:`donors-summary`,children:[(0,W.jsxs)(`div`,{className:`kv`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Streams (valid)`}),(0,W.jsxs)(`span`,{className:`v`,children:[u.filter(e=>e.valid&&!(e.canonicalHash&&(d.get(e.canonicalHash)||0)>1)).length,`/`,u.filter(e=>e.url).length]})]}),(0,W.jsxs)(`div`,{className:`kv`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Σ streams`}),(0,W.jsxs)(`span`,{className:`v`,children:[`Φ `,fC(l).toFixed(6)]})]}),(0,W.jsxs)(`div`,{className:`kv`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Pool allocation`}),(0,W.jsxs)(`span`,{className:`v`,children:[`Φ `,fC(n).toFixed(6)]})]}),(0,W.jsxs)(`div`,{className:`kv total`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Total (Temple-Glyph)`}),(0,W.jsxs)(`span`,{className:`v strong`,children:[`Φ `,p.toFixed(6)]})]})]}),(0,W.jsxs)(`p`,{className:`small subtle`,children:[`You’re one breath away. This step gathers your streams (each with a canonical hash) and any pool allocation into a single memory. In the next step, your composite`,` `,(0,W.jsx)(`strong`,{children:`Temple Glyph`}),` will embed a verifier-compatible `,(0,W.jsx)(`code`,{children:`Temple-Glyph`}),` key listing each stream’s hash and Φ amount, plus your pool contribution. The export includes`,(0,W.jsx)(`code`,{children:` Φkey*.svg`}),` (with `,(0,W.jsx)(`code`,{children:``}),`), a PNG preview, and a`,` `,(0,W.jsx)(`code`,{children:`manifest.json`}),` mirroring the values for auditing.`]})]})]})}var hC=u(Ld(),1),gC=e=>Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``);function _C(e){let t=e.buffer;if(t instanceof ArrayBuffer&&e.byteOffset===0&&e.byteLength===t.byteLength)return t;let n=new Uint8Array(e.byteLength);return n.set(e),n.buffer}async function vC(e){let t=typeof e==`string`?new TextEncoder().encode(e):e,n=await crypto.subtle.digest(`SHA-256`,_C(t));return gC(new Uint8Array(n))}async function yC(e,t){let n=URL.createObjectURL(e);try{let e=new Image;e.decoding=`async`,e.src=n,await e.decode();let r=document.createElement(`canvas`);r.width=e.width,r.height=e.height;let i=r.getContext(`2d`);if(!i)throw Error(`Canvas 2D context unavailable`);i.drawImage(e,0,0);let{data:a}=i.getImageData(Math.floor(e.width/2),Math.floor(e.height/2),1,1),o=[a[0],a[1],a[2]];return{sig:(await vC(`${t}-2:3-${o.join(`,`)}`)).slice(0,32),rgb:o}}finally{URL.revokeObjectURL(n)}}function bC(e=9){let t=crypto.getRandomValues(new Uint8Array(e));return btoa(String.fromCharCode(...t)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function xC(e,t,n){return`${e}_${t}_${n}`}function SC(e,t,n){let r=new Date,{kaiPulseToday:i,beatIndex:a,stepIndex:o,percentIntoStep:s}=MS(r),{display:c}=FS(r),l=IS(r),u=iS(e),d=`Kairos • ${c.dayName} (D${c.dayIndex1}/6) • Month ${c.monthIndex1} ${c.monthName} • Day ${c.dayInMonth1}/42 • YearDay ${c.dayInYear1}/336 • Beat ${a+1}/36 • Step ${o+1}/44 • ΦPulse ${e} • Arc ${l} • Chakra ${n}`;return{version:1,eternalPulse:e,sigilPulse:t,dayName:c.dayName,dayIndex1:c.dayIndex1,dayInMonth1:c.dayInMonth1,dayInYear1:c.dayInYear1,monthIndex1:c.monthIndex1,monthName:c.monthName,weekIndex1:c.weekIndex1,beatIndex:a,stepIndex:o,pulsesIntoBeat:u,kaiPulseToday:i,percentIntoStep:s,arcName:l,chakraDay:n,text:d}}async function CC(e,t,n){let r=await e.text(),i=JSON.stringify(t,null,2).replace(/]]>/g,`]]]]>`),a=JSON.stringify({wallet:n},null,2).replace(/]]>/g,`]]]]>`),o=``,s=``,c=r;return c=/]/i.test(c)?c.replace(//i,o):c.replace(/]*)?>/i,e=>`${e}${o}`),c=c.replace(/<\/svg>\s*$/i,`${s}`),new Blob([c],{type:`image/svg+xml`})}function wC({isOpen:e,onClose:t,donors:n,balancePhi:r,balanceForMintPhi:i,setBalanceForMintPhi:a,addDonor:o,removeDonor:s,updateDonor:c,totalDonorAmount:l,userPhiKey:u,kaiSignature:d,creatorPublicKey:f,chakraDay:p=`Throat`,onMinted:m}){let[h,g]=(0,C.useState)(null),[_,v]=(0,C.useState)(!1),y=(0,C.useRef)(null),[b,x]=(0,C.useState)(null),[S,w]=(0,C.useState)(null),[T,E]=(0,C.useState)(null),D=(0,C.useMemo)(()=>AS(),[]),O=(0,C.useMemo)(()=>MS(new Date),[]),k=(0,C.useMemo)(()=>Math.min(Math.max(O.stepIndex/44,0),1),[O.stepIndex]);(0,C.useEffect)(()=>{e||(g(null),v(!1))},[e]);let A=(0,C.useMemo)(()=>n.map(e=>({canonicalHash:(e.canonicalHash||``).toLowerCase(),url:e.url||void 0,amountPhi:Math.max(0,Number.isFinite(e.amount)?e.amount:0)})).filter(e=>e.canonicalHash&&e.amountPhi>0).map(e=>{let t;try{e.url&&(t=np(e.url)?.originUrl)}catch{t=void 0}return{...e,originUrl:t}}),[n]),j=(0,C.useMemo)(()=>{let e=A.reduce((e,t)=>e+t.amountPhi,0),t=Math.max(0,Number.isFinite(i)?i:0);return{totalDonorPhi:e,poolAllocationPhi:+t.toFixed(6),totalPhi:Number((e+t).toFixed(6))}},[A,i]),M=(0,C.useCallback)(async()=>{if(g(null),!(A.length>0||j.poolAllocationPhi>0)){g(`Add at least one donor or a pool allocation.`);return}try{v(!0);let e=y.current;if(!e)throw Error(`Renderer unavailable`);let n=await e.exportBlob(`image/svg+xml`),r=await e.exportBlob(`image/png`,3),{sig:i,rgb:a}=await yC(r,D),o=await vC(`${i}-${O.kaiPulseToday}-${D}`),{display:s}=FS(new Date),c={version:1,mintedAtPulseEternal:D,pulsesIntoBeat:iS(D),kaiPulseToday:O.kaiPulseToday,beatIndex:O.beatIndex,stepIndex:O.stepIndex,dayName:s.dayName,monthName:s.monthName,dayInMonth1:s.dayInMonth1,dayInYear1:s.dayInYear1,monthIndex1:s.monthIndex1,weekIndex1:s.weekIndex1},l={donors:A,poolAllocationPhi:j.poolAllocationPhi,totalDonorPhi:+j.totalDonorPhi.toFixed(6),totalPhi:+j.totalPhi.toFixed(6),createdAtPulseEternal:D};if(!b)throw Error(`Sigil hash not ready`);let h={pulse:D,beat:O.beatIndex,stepIndex:O.stepIndex,chakraDay:p,stepsPerBeat:44,kaiSignature:d,userPhiKey:u},g=S??Qf(b,h,{origin:typeof window<`u`?window.location.origin:``,autoInferParent:!0}),_=T&&T.trim().length>0?JSON.parse(T):null,x=SC(D,D,p),C={"@context":ps,type:ms,pulse:D,beat:O.beatIndex,stepIndex:O.stepIndex,chakraDay:p,stepsPerBeat:44,kaiSignature:d||void 0,userPhiKey:u||void 0,creatorPublicKey:f||void 0,kaiPulse:D,canonicalHash:b,transferNonce:bC(),segmentSize:hs,composite:{kind:`phi.sigil.composite`,wallet:l},kairosStamp:x,canonicalUrl:g,shareUrl:g,embeddedMeta:_},w=await CC(n,C,l),E=xC(`sigil_phiglyph`,D,D),k={version:1,kind:`phi.sigil.composite`,canonicalHash:b,canonicalUrl:g,shareUrl:g,meta:C,donors:A.map(e=>({canonicalHash:e.canonicalHash,amountPhi:+e.amountPhi.toFixed(6),url:e.url,originUrl:e.originUrl})),totals:{totalDonorPhi:+j.totalDonorPhi.toFixed(6),poolAllocationPhi:j.poolAllocationPhi,totalPhi:+j.totalPhi.toFixed(6)},provenance:c},M={version:1,centrePixelSig:i,sealStamp:o,centreRgb:a,kairosStamp:x,provenance:c},N=new hC.default;N.file(`${E}.svg`,w),N.file(`${E}.png`,r),N.file(`${E}.json`,JSON.stringify(k,null,2)),N.file(`${E}_provenance.json`,JSON.stringify(M,null,2));let P=await N.generateAsync({type:`blob`}),F=document.createElement(`a`),I=URL.createObjectURL(P);F.href=I,F.download=`${E}.zip`,F.rel=`noopener`,document.body.appendChild(F),F.click(),F.remove(),setTimeout(()=>URL.revokeObjectURL(I),0),hp(g),m?.(k),v(!1),t()}catch(e){v(!1),g(`Failed to exhale Temple-Glyph. `+(e instanceof Error?e.message:String(e)))}},[A,j.poolAllocationPhi,j.totalDonorPhi,j.totalPhi,D,O.beatIndex,O.kaiPulseToday,O.stepIndex,p,b,S,T,d,u,f,m,t]);return e?(0,W.jsx)(`div`,{className:`modal-overlay`,role:`presentation`,children:(0,W.jsx)(`dialog`,{className:`send-sigil-modal`,open:!0,"aria-label":`Mint Composite ΦGlyph`,children:(0,W.jsxs)(`div`,{className:`modal-viewport`,children:[(0,W.jsxs)(`div`,{className:`modal-topbar`,children:[(0,W.jsx)(`h2`,{className:`modal-title`,children:`Exhale Temple-Glyph`}),(0,W.jsx)(`button`,{className:`close-btn`,onClick:t,"aria-label":`Close`,children:(0,W.jsx)(cd,{size:22})})]}),(0,W.jsx)(`div`,{"aria-hidden":!0,style:{position:`absolute`,width:0,height:0,overflow:`hidden`},children:(0,W.jsx)(ob,{ref:y,pulse:D,beat:O.beatIndex,stepPct:k,chakraDay:p,userPhiKey:u,kaiSignature:d,creatorPublicKey:f,origin:typeof window<`u`?window.location.origin:void 0,animate:!1,quality:`high`,showZKBadge:!1,onReady:({hash:e,url:t,metadataJson:n})=>{x(e),w(t),E(n)},onError:()=>{}})}),(0,W.jsxs)(`div`,{className:`modal-body`,children:[(0,W.jsx)(mC,{donors:n,balancePhi:r,balanceForMintPhi:i,setBalanceForMintPhi:a,addDonor:o,removeDonor:s,updateDonor:c,onMintComposite:e=>{e.preventDefault(),M()},minting:_,totalDonorAmount:l}),h&&(0,W.jsx)(`div`,{className:`error-msg`,role:`alert`,children:h})]}),(0,W.jsxs)(`div`,{className:`modal-footer`,children:[(0,W.jsxs)(`button`,{className:`send-btn`,onClick:()=>void M(),disabled:_,"aria-label":`Exhale Temple-Glyph`,title:`Exhale a Temple-Glyph at the current Eternal pulse`,children:[(0,W.jsx)(`span`,{className:`ico-exhale`,"aria-hidden":!0,children:`⟿`}),_?`Exhale...`:`Exhale Temple-Glyph`]}),(0,W.jsx)(`p`,{className:`small subtle status-line`,"aria-live":`polite`,children:b?`canonical: ${b.slice(0,10)}…`:`canonicalizing…`})]})]})})}):null}const TC=[`#37ffe4`,`#a78bfa`,`#5ce1ff`,`#11d7ff`],EC=(3+Math.sqrt(5))*1e3;BigInt(2**53-1);const DC=(()=>{if(typeof navigator>`u`)return!1;let e=navigator.userAgent||``;return/\bFBAN|FBAV|Instagram|Line|Twitter|TikTok|; wv\)|\bWebView\b/i.test(e)})(),OC=typeof window<`u`&&window.HTMLDialogElement!==void 0&&typeof window.HTMLDialogElement.prototype.showModal==`function`&&!DC;function kC(){let[e,t]=(0,C.useState)(!1);return(0,C.useEffect)(()=>t(!0),[]),e}function AC(e){let[t,n]=(0,C.useState)(()=>typeof window<`u`?window.matchMedia(e).matches:!1);return(0,C.useEffect)(()=>{if(typeof window>`u`)return;let t=window.matchMedia(e),r=e=>n(e.matches),i=function(e){r(e)};return typeof t.addEventListener==`function`?t.addEventListener(`change`,r):t.addListener?.(i),n(t.matches),()=>{typeof t.removeEventListener==`function`?t.removeEventListener(`change`,r):t.removeListener?.(i)}},[e]),t}function jC(e){(0,C.useEffect)(()=>{let t=typeof window<`u`?window.matchMedia(`(max-width: 560px)`).matches:!1;if(!e||t)return;let{scrollY:n}=window,r={top:document.body.style.top,pos:document.body.style.position,w:document.body.style.width,o:document.documentElement.style.overflow};return document.documentElement.style.overflow=`hidden`,document.body.style.position=`fixed`,document.body.style.top=`-${n}px`,document.body.style.width=`100%`,()=>{document.documentElement.style.overflow=r.o,document.body.style.position=r.pos,document.body.style.top=r.top,document.body.style.width=r.w,window.scrollTo(0,n)}},[e])}function MC(e,t){(0,C.useEffect)(()=>{if(!e)return;let n=t.current;if(!n)return;let r=`a[href], button:not([disabled]), textarea, input, select, summary, [tabindex]:not([tabindex="-1"])`,i=()=>{(n.querySelector(`.close-btn`)||n.querySelector(`.btn.primary`)||n.querySelector(r))?.focus()},a=e=>{if(e.key!==`Tab`)return;let t=Array.from(n.querySelectorAll(r)).filter(e=>e.offsetParent!==null||e===document.activeElement);if(!t.length)return;let i=t[0],a=t[t.length-1];e.shiftKey?document.activeElement===i&&(e.preventDefault(),a.focus()):document.activeElement===a&&(e.preventDefault(),i.focus())},o=document.activeElement;return i(),n.addEventListener(`keydown`,a),()=>{n.removeEventListener(`keydown`,a),o?.focus?.()}},[e,t])}function NC(e){return function(){let t=e+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}function PC(e){let t=e.length,n=0,r=0,i=0,a=0;for(let o=0;o>>0}function IC(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t{var{children:n,width:r,height:i,viewBox:a,className:o,style:s,title:c,desc:l}=e,u=YC(e,qC),d=a||{width:r,height:i,x:0,y:0},f=LC(`recharts-surface`,o);return C.createElement(`svg`,JC({},GC(u),{className:f,width:r,height:i,style:s,viewBox:`${d.x} ${d.y} ${d.width} ${d.height}`,ref:t}),C.createElement(`title`,null,c),C.createElement(`desc`,null,l),n)}),QC=[`children`,`className`];function $C(){return $C=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:n,className:r}=e,i=ew(e,QC),a=LC(`recharts-layer`,r);return C.createElement(`g`,$C({className:a},GC(i),{ref:t}),n)}),rw=(0,C.createContext)(null);function iw(e){return function(){return e}}const aw=Math.cos,ow=Math.sin,sw=Math.sqrt,cw=Math.PI;cw/2;const lw=2*cw;var uw=Math.PI,dw=2*uw,fw=1e-6,pw=dw-fw;function mw(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return mw;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;tfw)if(!(Math.abs(u*s-c*l)>fw)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((uw-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>fw&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>fw||Math.abs(this._y1-l)>fw)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%dw+dw),d>pw?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>fw&&this._append`A${n},${n},0,${+(d>=uw)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};function _w(){return new gw}_w.prototype=gw.prototype;function vw(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new gw(t)}Array.prototype.slice;function yw(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function bw(e){this._context=e}bw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function xw(e){return new bw(e)}function Sw(e){return e[0]}function Cw(e){return e[1]}function ww(e,t){var n=iw(!0),r=null,i=xw,a=null,o=vw(s);e=typeof e==`function`?e:e===void 0?Sw:iw(e),t=typeof t==`function`?t:t===void 0?Cw:iw(t);function s(s){var c,l=(s=yw(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return ww().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:iw(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:iw(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:iw(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:iw(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:iw(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:iw(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:iw(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var Ew=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t);break}this._x0=e,this._y0=t}};function Dw(e){return new Ew(e,!0)}function Ow(e){return new Ew(e,!1)}var kw={draw(e,t){let n=sw(t/cw);e.moveTo(n,0),e.arc(0,0,n,0,lw)}},Aw={draw(e,t){let n=sw(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},jw=sw(1/3),Mw=jw*2,Nw={draw(e,t){let n=sw(t/Mw),r=n*jw;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},Pw={draw(e,t){let n=sw(t),r=-n/2;e.rect(r,r,n,n)}},Fw=.8908130915292852,Iw=ow(cw/10)/ow(7*cw/10),Lw=ow(lw/10)*Iw,Rw=-aw(lw/10)*Iw,zw={draw(e,t){let n=sw(t*Fw),r=Lw*n,i=Rw*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=lw*t/5,o=aw(a),s=ow(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},Bw=sw(3),Vw={draw(e,t){let n=-sw(t/(Bw*3));e.moveTo(0,n*2),e.lineTo(-Bw*n,-n),e.lineTo(Bw*n,-n),e.closePath()}},Hw=-.5,Uw=sw(3)/2,Ww=1/sw(12),Gw=(Ww/2+1)*3,Kw={draw(e,t){let n=sw(t/Gw),r=n/2,i=n*Ww,a=r,o=n*Ww+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(Hw*r-Uw*i,Uw*r+Hw*i),e.lineTo(Hw*a-Uw*o,Uw*a+Hw*o),e.lineTo(Hw*s-Uw*c,Uw*s+Hw*c),e.lineTo(Hw*r+Uw*i,Hw*i-Uw*r),e.lineTo(Hw*a+Uw*o,Hw*o-Uw*a),e.lineTo(Hw*s+Uw*c,Hw*c-Uw*s),e.closePath()}};function qw(e,t){let n=null,r=vw(i);e=typeof e==`function`?e:iw(e||kw),t=typeof t==`function`?t:iw(t===void 0?64:+t);function i(){let i;if(n||=i=r(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+``||null}return i.type=function(t){return arguments.length?(e=typeof t==`function`?t:iw(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:iw(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}function Jw(){}function Yw(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Xw(e){this._context=e}Xw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Yw(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Yw(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Zw(e){return new Xw(e)}function Qw(e){this._context=e}Qw.prototype={areaStart:Jw,areaEnd:Jw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Yw(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function $w(e){return new Qw(e)}function eT(e){this._context=e}eT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Yw(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function tT(e){return new eT(e)}function nT(e){this._context=e}nT.prototype={areaStart:Jw,areaEnd:Jw,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function rT(e){return new nT(e)}function iT(e){return e<0?-1:1}function aT(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(iT(a)+iT(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function oT(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function sT(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function cT(e){this._context=e}cT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:sT(this,this._t0,oT(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,sT(this,oT(this,n=aT(this,e,t)),n);break;default:sT(this,this._t0,n=aT(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function lT(e){this._context=new uT(e)}(lT.prototype=Object.create(cT.prototype)).point=function(e,t){cT.prototype.point.call(this,t,e)};function uT(e){this._context=e}uT.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function dT(e){return new cT(e)}function fT(e){return new lT(e)}function pT(e){this._context=e}pT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=mT(e),i=mT(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}this._x=e,this._y=t}};function _T(e){return new gT(e,.5)}function vT(e){return new gT(e,0)}function yT(e){return new gT(e,1)}function bT(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n=0;)n[t]=t;return n}function ST(e,t){return e[t]}function CT(e){let t=[];return t.key=e,t}function wT(){var e=iw([]),t=xT,n=bT,r=ST;function i(i){var a=Array.from(e.apply(this,arguments),CT),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o0){for(var n,r,i=0,a=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,a=r.length;n0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return e===`__proto__`}e.isUnsafeProperty=t})),kT=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e.includes(`.`)||e.includes(`[`)||e.includes(`]`)}}e.isDeepKey=t})),AT=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}e.toKey=t})),jT=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){if(e==null)return``;if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(t).join(`,`);let n=String(e);return n===`0`&&Object.is(Number(e),-0)?`-0`:n}e.toString=t})),MT=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=jT(),n=AT();function r(e){if(Array.isArray(e))return e.map(n.toKey);if(typeof e==`symbol`)return[e];e=t.toString(e);let r=[],i=e.length;if(i===0)return r;let a=0,o=``,s=``,c=!1;for(e.charCodeAt(0)===46&&(r.push(``),a++);a{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=OT(),n=kT(),r=AT(),i=MT();function a(e,s,c){if(e==null)return c;switch(typeof s){case`string`:{if(t.isUnsafeProperty(s))return c;let r=e[s];return r===void 0?n.isDeepKey(s)?a(e,i.toPath(s),c):c:r}case`number`:case`symbol`:{typeof s==`number`&&(s=r.toKey(s));let t=e[s];return t===void 0?c:t}default:{if(Array.isArray(s))return o(e,s,c);if(s=Object.is(s?.valueOf(),-0)?`-0`:String(s),t.isUnsafeProperty(s))return c;let n=e[s];return n===void 0?c:n}}}function o(e,n,r){if(n.length===0)return r;let i=e;for(let e=0;e{t.exports=NT().get})),FT=4;function IT(e){var t=10**(arguments.length>1&&arguments[1]!==void 0?arguments[1]:FT),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function LT(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+IT(i)+n},``)}var RT=u(PT()),zT=e=>e===0?0:e>0?1:-1,BT=e=>typeof e==`number`&&e!=+e,VT=e=>typeof e==`string`&&e.indexOf(`%`)===e.length-1,X=e=>(typeof e==`number`||e instanceof Number)&&!BT(e),HT=e=>X(e)||typeof e==`string`,UT=0,WT=e=>{var t=++UT;return`${e||``}${t}`},GT=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!X(e)&&typeof e!=`string`)return n;var i;if(VT(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return BT(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},KT=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;re&&(typeof t==`function`?t(e):(0,RT.default)(e,t))===n)}var YT=e=>e==null,XT=e=>YT(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function ZT(e){return e!=null}function QT(){}var $T=[`type`,`size`,`sizeType`];function eE(){return eE=Object.assign?Object.assign.bind():function(e){for(var t=1;tcE[`symbol${XT(e)}`]||kw,dE=(e,t,n)=>{if(t===`area`)return e;switch(n){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var r=18*lE;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2);case`triangle`:return Math.sqrt(3)*e*e/4;case`wye`:return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},fE=(e,t)=>{cE[`symbol${XT(e)}`]=t},pE=e=>{var{type:t=`circle`,size:n=64,sizeType:r=`area`}=e,i=nE(nE({},oE(e,$T)),{},{type:t,size:n,sizeType:r}),a=`circle`;typeof t==`string`&&(a=t);var o=()=>{var e=uE(a),t=qw().type(e).size(dE(n,r,a))();if(t!==null)return t},{className:s,cx:c,cy:l}=i,u=GC(i);return X(c)&&X(l)&&X(n)?C.createElement(`path`,eE({},u,{className:LC(`recharts-symbols`,s),transform:`translate(${c}, ${l})`,d:o()})):null};pE.registerSymbol=fE;var mE=e=>`radius`in e&&`startAngle`in e&&`endAngle`in e,hE=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,C.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{zC(e)&&(r[e]=t||(t=>n[e](n,t)))}),r},gE=(e,t,n)=>r=>(e(t,n,r),null),_E=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];zC(i)&&typeof a==`function`&&(r||={},r[i]=gE(a,t,n))}),r};function vE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function yE(e){for(var t=1;t(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}var wE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e,t){let n=new Map;for(let r=0;r{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return e}e.identity=t})),EE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return Number.isSafeInteger(e)&&e>=0}e.isLength=t})),DE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=EE();function n(e){return e!=null&&typeof e!=`function`&&t.isLength(e.length)}e.isArrayLike=n})),OE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return typeof e==`object`&&!!e}e.isObjectLike=t})),kE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=DE(),n=OE();function r(e){return n.isObjectLike(e)&&t.isArrayLike(e)}e.isArrayLikeObject=r})),AE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=NT();function n(e){return function(n){return t.get(n,e)}}e.property=n})),jE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}e.isObject=t})),ME=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return e==null||typeof e!=`object`&&typeof e!=`function`}e.isPrimitive=t})),NE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}e.eq=t})),PE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=jE(),n=ME(),r=NE();function i(e,t,n){return typeof n==`function`?a(e,t,function e(t,r,i,o,s,c){let l=n(t,r,i,o,s,c);return l===void 0?a(t,r,e,c):!!l},new Map):i(e,t,()=>void 0)}function a(e,n,i,s){if(n===e)return!0;switch(typeof n){case`object`:return o(e,n,i,s);case`function`:return Object.keys(n).length>0?a(e,{...n},i,s):r.eq(e,n);default:return t.isObject(e)?typeof n==`string`?n===``:!0:r.eq(e,n)}}function o(e,t,r,i){if(t==null)return!0;if(Array.isArray(t))return c(e,t,r,i);if(t instanceof Map)return s(e,t,r,i);if(t instanceof Set)return l(e,t,r,i);let a=Object.keys(t);if(e==null||n.isPrimitive(e))return a.length===0;if(a.length===0)return!0;if(i?.has(t))return i.get(t)===e;i?.set(t,e);try{for(let o=0;o{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=PE();function n(e,n){return t.isMatchWith(e,n,()=>void 0)}e.isMatch=n})),IE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}e.getSymbols=t})),LE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}e.getTag=t})),RE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`}),e.argumentsTag=`[object Arguments]`,e.arrayBufferTag=`[object ArrayBuffer]`,e.arrayTag=`[object Array]`,e.bigInt64ArrayTag=`[object BigInt64Array]`,e.bigUint64ArrayTag=`[object BigUint64Array]`,e.booleanTag=`[object Boolean]`,e.dataViewTag=`[object DataView]`,e.dateTag=`[object Date]`,e.errorTag=`[object Error]`,e.float32ArrayTag=`[object Float32Array]`,e.float64ArrayTag=`[object Float64Array]`,e.functionTag=`[object Function]`,e.int16ArrayTag=`[object Int16Array]`,e.int32ArrayTag=`[object Int32Array]`,e.int8ArrayTag=`[object Int8Array]`,e.mapTag=`[object Map]`,e.numberTag=`[object Number]`,e.objectTag=`[object Object]`,e.regexpTag=`[object RegExp]`,e.setTag=`[object Set]`,e.stringTag=`[object String]`,e.symbolTag=`[object Symbol]`,e.uint16ArrayTag=`[object Uint16Array]`,e.uint32ArrayTag=`[object Uint32Array]`,e.uint8ArrayTag=`[object Uint8Array]`,e.uint8ClampedArrayTag=`[object Uint8ClampedArray]`})),zE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}e.isTypedArray=t})),BE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=IE(),n=LE(),r=RE(),i=ME(),a=zE();function o(e,t){return s(e,void 0,e,new Map,t)}function s(e,t,n,r=new Map,o=void 0){let u=o?.(e,t,n,r);if(u!==void 0)return u;if(i.isPrimitive(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){let t=Array(e.length);r.set(e,t);for(let i=0;i{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=BE();function n(e){return t.cloneDeepWithImpl(e,void 0,e,new Map,void 0)}e.cloneDeep=n})),HE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=FE(),n=VE();function r(e){return e=n.cloneDeep(e),n=>t.isMatch(n,e)}e.matches=r})),UE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=BE(),n=RE();function r(e,r){return t.cloneDeepWith(e,(i,a,o,s)=>{let c=r?.(i,a,o,s);if(c!==void 0)return c;if(typeof e==`object`)switch(Object.prototype.toString.call(e)){case n.numberTag:case n.stringTag:case n.booleanTag:{let n=new e.constructor(e?.valueOf());return t.copyProperties(n,e),n}case n.argumentsTag:{let n={};return t.copyProperties(n,e),n.length=e.length,n[Symbol.iterator]=e[Symbol.iterator],n}default:return}})}e.cloneDeepWith=r})),WE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=UE();function n(e){return t.cloneDeepWith(e)}e.cloneDeep=n})),GE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=/^(?:0|[1-9]\d*)$/;function n(e,n=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=LE();function n(e){return typeof e==`object`&&!!e&&t.getTag(e)===`[object Arguments]`}e.isArguments=n})),qE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=kT(),n=GE(),r=KE(),i=MT();function a(e,a){let o;if(o=Array.isArray(a)?a:typeof a==`string`&&t.isDeepKey(a)&&e?.[a]==null?i.toPath(a):[a],o.length===0)return!1;let s=e;for(let e=0;e{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=FE(),n=AT(),r=WE(),i=NT(),a=qE();function o(e,o){switch(typeof e){case`object`:Object.is(e?.valueOf(),-0)&&(e=`-0`);break;case`number`:e=n.toKey(e);break}return o=r.cloneDeep(o),function(n){let r=i.get(n,e);return r===void 0?a.has(n,e):o===void 0?r===void 0:t.isMatch(r,o)}}e.matchesProperty=o})),YE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=TE(),n=AE(),r=HE(),i=JE();function a(e){if(e==null)return t.identity;switch(typeof e){case`function`:return e;case`object`:return Array.isArray(e)&&e.length===2?i.matchesProperty(e[0],e[1]):r.matches(e);case`string`:case`symbol`:case`number`:return n.property(e)}}e.iteratee=a})),XE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=wE(),n=TE(),r=kE(),i=YE();function a(e,a=n.identity){return r.isArrayLikeObject(e)?t.uniqBy(Array.from(e),i.iteratee(a)):[]}e.uniqBy=a})),ZE=u(s(((e,t)=>{t.exports=XE().uniqBy}))());function QE(e,t,n){return t===!0?(0,ZE.default)(e,n):typeof t==`function`?(0,ZE.default)(e,t):e}var $E=s((e=>{var t=h();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),eD=s(((e,t)=>{t.exports=$E()})),tD=s((e=>{var t=h(),n=eD();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),nD=s(((e,t)=>{t.exports=tD()})),rD=(0,C.createContext)(null),iD=u(nD()),aD=e=>e,oD=()=>{var e=(0,C.useContext)(rD);return e?e.store.dispatch:aD},sD=()=>{},cD=()=>sD,lD=(e,t)=>e===t;function Z(e){var t=(0,C.useContext)(rD);return(0,iD.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:cD,t?t.store.getState:sD,t?t.store.getState:sD,t?e:sD,lD)}function uD(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function dD(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!=`object`)throw TypeError(t)}function fD(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var pD=e=>Array.isArray(e)?e:[e];function mD(e){let t=Array.isArray(e[0])?e[0]:e;return fD(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function hD(e,t){let n=[],{length:r}=e;for(let i=0;i{n=bD(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function SD(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),uD(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=xD,argsMemoizeOptions:u=[],devModeChecks:d={}}={...n,...a},f=pD(c),p=pD(u),m=mD(e),h=s(function(){return t++,o.apply(null,arguments)},...f),g=l(function(){r++;let e=hD(m,arguments);return i=h.apply(null,e),i},...p);return Object.assign(g,{resultFunc:o,memoizedResultFunc:h,dependencies:m,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var Q=SD(xD),CD=Object.assign((e,t=Q)=>{dD(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>CD}),wD=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return typeof e==`symbol`?1:e===null?2:e===void 0?3:e===e?0:4}e.compareValues=(e,n,r)=>{if(e!==n){let i=t(e),a=t(n);if(i===a&&i===0){if(en)return r===`desc`?-1:1}return r===`desc`?a-i:i-a}return 0}})),TD=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return typeof e==`symbol`||e instanceof Symbol}e.isSymbol=t})),ED=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=TD(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(e,i){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||t.isSymbol(e)?!0:typeof e==`string`&&(r.test(e)||!n.test(e))||i!=null&&Object.hasOwn(i,e)}e.isKey=i})),DD=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=wD(),n=ED(),r=MT();function i(e,i,a,o){if(e==null)return[];a=o?void 0:a,Array.isArray(e)||(e=Object.values(e)),Array.isArray(i)||(i=i==null?[null]:[i]),i.length===0&&(i=[null]),Array.isArray(a)||(a=a==null?[]:[a]),a=a.map(e=>String(e));let s=(e,t)=>{let n=e;for(let e=0;et==null||e==null?t:typeof e==`object`&&`key`in e?Object.hasOwn(t,e.key)?t[e.key]:s(t,e.path):typeof e==`function`?e(t):Array.isArray(e)?s(t,e):typeof t==`object`?t[e]:t,l=i.map(e=>(Array.isArray(e)&&e.length===1&&(e=e[0]),e==null||typeof e==`function`||Array.isArray(e)||n.isKey(e)?e:{key:e,path:r.toPath(e)}));return e.map(e=>({original:e,criteria:l.map(t=>c(t,e))})).slice().sort((e,n)=>{for(let r=0;re.original)}e.orderBy=i})),OD=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=GE(),n=DE(),r=jE(),i=NE();function a(e,a,o){return r.isObject(o)&&(typeof a==`number`&&n.isArrayLike(o)&&t.isIndex(a)&&a{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=DD(),n=OD(),r=kD();function i(e,...i){let a=i.length;return a>1&&r.isIterateeCall(e,i[0],i[1])?i=[]:a>2&&r.isIterateeCall(i[0],i[1],i[2])&&(i=[i[0]]),t.orderBy(e,n.flatten(i),[`asc`])}e.sortBy=i})),jD=s(((e,t)=>{t.exports=AD().sortBy})),MD=u(jD()),ND=e=>e.legend.settings,PD=e=>e.legend.size;Q([e=>e.legend.payload,ND],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?(0,MD.default)(r,n):r});var FD=1;function ID(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,n]=(0,C.useState)({height:0,left:0,top:0,width:0});return[t,(0,C.useCallback)(e=>{if(e!=null){var r=e.getBoundingClientRect(),i={height:r.height,left:r.left,top:r.top,width:r.width};(Math.abs(i.height-t.height)>FD||Math.abs(i.left-t.left)>FD||Math.abs(i.top-t.top)>FD||Math.abs(i.width-t.width)>FD)&&n({height:i.height,left:i.left,top:i.top,width:i.width})}},[t.width,t.height,t.top,t.left,...e])]}function LD(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var RD=(()=>typeof Symbol==`function`&&Symbol.observable||`@@observable`)(),zD=()=>Math.random().toString(36).substring(7).split(``).join(`.`),BD={INIT:`@@redux/INIT${zD()}`,REPLACE:`@@redux/REPLACE${zD()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${zD()}`};function VD(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function HD(e,t,n){if(typeof e!=`function`)throw Error(LD(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(LD(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(LD(1));return n(HD)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error(LD(3));return i}function d(e){if(typeof e!=`function`)throw Error(LD(4));if(c)throw Error(LD(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(LD(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!VD(e))throw Error(LD(7));if(e.type===void 0)throw Error(LD(8));if(typeof e.type!=`string`)throw Error(LD(17));if(c)throw Error(LD(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error(LD(10));r=e,f({type:BD.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(LD(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[RD](){return this}}}return f({type:BD.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[RD]:m}}function UD(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:BD.INIT})===void 0)throw Error(LD(12));if(n(void 0,{type:BD.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(LD(13))})}function WD(e){let t=Object.keys(e),n={};for(let r=0;re:e.length===1?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function KD(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(LD(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=GD(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}function qD(e){return VD(e)&&`type`in e&&typeof e.type==`string`}var JD=Symbol.for(`immer-nothing`),YD=Symbol.for(`immer-draftable`),XD=Symbol.for(`immer-state`);function ZD(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var QD=Object,$D=QD.getPrototypeOf,eO=`constructor`,tO=`prototype`,nO=`configurable`,rO=`enumerable`,iO=`writable`,aO=`value`,oO=e=>!!e&&!!e[XD];function sO(e){return e?uO(e)||_O(e)||!!e[YD]||!!e[eO]?.[YD]||vO(e)||yO(e):!1}var cO=QD[tO][eO].toString(),lO=new WeakMap;function uO(e){if(!e||!bO(e))return!1;let t=$D(e);if(t===null||t===QD[tO])return!0;let n=QD.hasOwnProperty.call(t,eO)&&t[eO];if(n===Object)return!0;if(!xO(n))return!1;let r=lO.get(n);return r===void 0&&(r=Function.toString.call(n),lO.set(n,r)),r===cO}function dO(e,t,n=!0){fO(e)===0?(n?Reflect.ownKeys(e):QD.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function fO(e){let t=e[XD];return t?t.type_:_O(e)?1:vO(e)?2:yO(e)?3:0}var pO=(e,t,n=fO(e))=>n===2?e.has(t):QD[tO].hasOwnProperty.call(e,t),mO=(e,t,n=fO(e))=>n===2?e.get(t):e[t],hO=(e,t,n,r=fO(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function gO(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var _O=Array.isArray,vO=e=>e instanceof Map,yO=e=>e instanceof Set,bO=e=>typeof e==`object`,xO=e=>typeof e==`function`,SO=e=>typeof e==`boolean`;function CO(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var wO=e=>e.copy_||e.base_,TO=e=>e.modified_?e.copy_:e.base_;function EO(e,t){if(vO(e))return new Map(e);if(yO(e))return new Set(e);if(_O(e))return Array[tO].slice.call(e);let n=uO(e);if(t===!0||t===`class_only`&&!n){let t=QD.getOwnPropertyDescriptors(e);delete t[XD];let n=Reflect.ownKeys(t);for(let r=0;r1&&QD.defineProperties(e,{set:kO,add:kO,clear:kO,delete:kO}),QD.freeze(e),t&&dO(e,(e,t)=>{DO(t,!0)},!1),e)}function OO(){ZD(2)}var kO={[aO]:OO};function AO(e){return e===null||!bO(e)?!0:QD.isFrozen(e)}var jO=`MapSet`,MO=`Patches`,NO=`ArrayMethods`,PO={};function FO(e){let t=PO[e];return t||ZD(0,e),t}var IO=e=>!!PO[e],LO,RO=()=>LO,zO=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:IO(jO)?FO(jO):void 0,arrayMethodsPlugin_:IO(NO)?FO(NO):void 0});function BO(e,t){t&&(e.patchPlugin_=FO(MO),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function VO(e){HO(e),e.drafts_.forEach(WO),e.drafts_=null}function HO(e){e===LO&&(LO=e.parent_)}var UO=e=>LO=zO(LO,e);function WO(e){let t=e[XD];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function GO(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[XD].modified_&&(VO(t),ZD(4)),sO(e)&&(e=KO(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[XD].base_,e,t)}else e=KO(t,n);return qO(t,e,!0),VO(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===JD?void 0:e}function KO(e,t){if(AO(t))return t;let n=t[XD];if(!n)return tk(t,e.handledSet_,e);if(!YO(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);$O(n,e)}return n.copy_}function qO(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&DO(t,n)}function JO(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var YO=(e,t)=>e.scope_===t,XO=[];function ZO(e,t,n,r){let i=wO(e),a=e.type_;if(r!==void 0&&mO(i,r,a)===t){hO(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;dO(i,(e,n)=>{if(oO(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??XO;for(let e of o)hO(i,e,n,a)}function QO(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!YO(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=TO(i);ZO(e,i.draft_??i,a,n),$O(i,r)})}function $O(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}JO(e)}}function ek(e,t,n){let{scope_:r}=e;if(oO(n)){let i=n[XD];YO(i,r)&&i.callbacks_.push(function(){lk(e),ZO(e,n,TO(i),t)})}else sO(n)&&e.callbacks_.push(function(){mO(wO(e),t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&tk(mO(e.copy_,t,e.type_),r.handledSet_,r)})}function tk(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||oO(e)||t.has(e)||!sO(e)||AO(e)?e:(t.add(e),dO(e,(r,i)=>{if(oO(i)){let t=i[XD];YO(t,n)&&(hO(e,r,TO(t),e.type_),JO(t))}else sO(i)&&tk(i,t,n)}),e)}function nk(e,t){let n=_O(e),r={type_:n?1:0,scope_:t?t.scope_:RO(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=rk;n&&(i=[r],a=ik);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var rk={get(e,t){if(t===XD)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=wO(e);if(!pO(i,t,e.type_))return ok(e,i,t);let a=i[t];if(e.finalized_||!sO(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&CO(t))return a;if(a===ak(e.base_,t)){lk(e);let n=e.type_===1?+t:t,r=dk(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in wO(e)},ownKeys(e){return Reflect.ownKeys(wO(e))},set(e,t,n){let r=sk(wO(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=ak(wO(e),t),i=r?.[XD];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(gO(n,r)&&(n!==void 0||pO(e.base_,t,e.type_)))return!0;lk(e),ck(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_.set(t,!0),ek(e,t,n),!0)},deleteProperty(e,t){return lk(e),ak(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),ck(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=wO(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[iO]:!0,[nO]:e.type_!==1||t!==`length`,[rO]:r[rO],[aO]:n[t]}},defineProperty(){ZD(11)},getPrototypeOf(e){return $D(e.base_)},setPrototypeOf(){ZD(12)}},ik={};dO(rk,(e,t)=>{ik[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}),ik.deleteProperty=function(e,t){return ik.set.call(this,e,t,void 0)},ik.set=function(e,t,n){return rk.set.call(this,e[0],t,n,e[0])};function ak(e,t){let n=e[XD];return(n?wO(n):e)[t]}function ok(e,t,n){let r=sk(t,n);return r?aO in r?r[aO]:r.get?.call(e.draft_):void 0}function sk(e,t){if(!(t in e))return;let n=$D(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=$D(n)}}function ck(e){e.modified_||(e.modified_=!0,e.parent_&&ck(e.parent_))}function lk(e){e.copy_||=(e.assigned_=new Map,EO(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var uk=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(xO(e)&&!xO(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}xO(t)||ZD(6),n!==void 0&&!xO(n)&&ZD(7);let r;if(sO(e)){let i=UO(this),a=dk(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?VO(i):HO(i)}return BO(i,n),GO(r,i)}else if(!e||!bO(e)){if(r=t(e),r===void 0&&(r=e),r===JD&&(r=void 0),this.autoFreeze_&&DO(r,!0),n){let t=[],i=[];FO(MO).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}else ZD(1,e)},this.produceWithPatches=(e,t)=>{if(xO(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},SO(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),SO(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),SO(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){sO(e)||ZD(8),oO(e)&&(e=fk(e));let t=UO(this),n=dk(t,e,void 0);return n[XD].isManual_=!0,HO(t),n}finishDraft(e,t){let n=e&&e[XD];(!n||!n.isManual_)&&ZD(9);let{scope_:r}=n;return BO(r,t),GO(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=FO(MO).applyPatches_;return oO(e)?r(e,t):this.produce(e,e=>r(e,t))}};function dk(e,t,n,r){let[i,a]=vO(t)?FO(jO).proxyMap_(t,n):yO(t)?FO(jO).proxySet_(t,n):nk(t,n);return(n?.scope_??RO()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?QO(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function fk(e){return oO(e)||ZD(10,e),pk(e)}function pk(e){if(!sO(e)||AO(e))return e;let t=e[XD],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=EO(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=EO(e,!0);return dO(n,(e,t)=>{hO(n,e,pk(t))},r),t&&(t.finalized_=!1),n}var mk=new uk().produce;function hk(e){return({dispatch:t,getState:n})=>r=>i=>typeof i==`function`?i(t,n,e):r(i)}var gk=hk(),_k=hk,vk=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]==`object`?GD:GD.apply(null,arguments)};typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;function yk(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw Error(DA(0));return{type:e,payload:r.payload,...`meta`in r&&{meta:r.meta},...`error`in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>qD(t)&&t.type===e,n}var bk=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function xk(e){return sO(e)?mk(e,()=>{}):e}function Sk(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function Ck(e){return typeof e==`boolean`}var wk=()=>function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new bk;return t&&(Ck(t)?a.push(gk):a.push(_k(t.extraArgument))),a},Tk=`RTK_autoBatch`,Ek=()=>e=>({payload:e,meta:{[Tk]:!0}}),Dk=e=>t=>{setTimeout(t,e)},Ok=(e={type:`raf`})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,c=e.type===`tick`?queueMicrotask:e.type===`raf`?typeof window<`u`&&window.requestAnimationFrame?window.requestAnimationFrame:Dk(10):e.type===`callback`?e.queueNotification:Dk(e.timeout),l=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.[Tk],a=!i,a&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})},kk=e=>function(t){let{autoBatch:n=!0}=t??{},r=new bk(e);return n&&r.push(Ok(typeof n==`object`?n:void 0)),r};function Ak(e){let t=wk(),{reducer:n=void 0,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:a=!0,preloadedState:o=void 0,enhancers:s=void 0}=e||{},c;if(typeof n==`function`)c=n;else if(VD(n))c=WD(n);else throw Error(DA(1));let l;l=typeof r==`function`?r(t):t();let u=GD;i&&(u=vk({trace:!1,...typeof i==`object`&&i}));let d=kk(KD(...l)),f=typeof s==`function`?s(d):d(),p=u(...f);return HD(c,o,p)}function jk(e){let t={},n=[],r,i={addCase(e,n){let r=typeof e==`string`?e:e.type;if(!r)throw Error(DA(28));if(r in t)throw Error(DA(29));return t[r]=n,i},addAsyncThunk(e,r){return r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i},addMatcher(e,t){return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){return r=e,i}};return e(i),[t,n,r]}function Mk(e){return typeof e==`function`}function Nk(e,t){let[n,r,i]=jk(t),a;if(Mk(e))a=()=>xk(e());else{let t=xk(e);a=()=>t}function o(e=a(),t){let o=[n[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return o.filter(e=>!!e).length===0&&(o=[i]),o.reduce((e,n)=>{if(n)if(oO(e)){let r=n(e,t);return r===void 0?e:r}else if(sO(e))return mk(e,e=>n(e,t));else{let r=n(e,t);if(r===void 0){if(e===null)return e;throw Error(`A case reducer on a non-draftable value must not return undefined`)}return r}return e},e)}return o.getInitialState=a,o}var Pk=`ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW`,Fk=(e=21)=>{let t=``,n=e;for(;n--;)t+=Pk[Math.random()*64|0];return t},Ik=Symbol.for(`rtk-slice-createasyncthunk`);function Lk(e,t){return`${e}/${t}`}function Rk({creators:e}={}){let t=e?.asyncThunk?.[Ik];return function(e){let{name:n,reducerPath:r=n}=e;if(!n)throw Error(DA(11));let i=(typeof e.reducers==`function`?e.reducers(Vk()):e.reducers)||{},a=Object.keys(i),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},s={addCase(e,t){let n=typeof e==`string`?e:e.type;if(!n)throw Error(DA(12));if(n in o.sliceCaseReducersByType)throw Error(DA(13));return o.sliceCaseReducersByType[n]=t,s},addMatcher(e,t){return o.sliceMatchers.push({matcher:e,reducer:t}),s},exposeAction(e,t){return o.actionCreators[e]=t,s},exposeCaseReducer(e,t){return o.sliceCaseReducersByName[e]=t,s}};a.forEach(r=>{let a=i[r],o={reducerName:r,type:Lk(n,r),createNotation:typeof e.reducers==`function`};Uk(a)?Gk(o,a,s,t):Hk(o,a,s)});function c(){let[t={},n=[],r=void 0]=typeof e.extraReducers==`function`?jk(e.extraReducers):[e.extraReducers],i={...t,...o.sliceCaseReducersByType};return Nk(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of o.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}let l=e=>e,u=new Map,d=new WeakMap,f;function p(e,t){return f||=c(),f(e,t)}function m(){return f||=c(),f.getInitialState()}function h(t,n=!1){function r(e){let i=e[t];return i===void 0&&n&&(i=Sk(d,r,m)),i}function i(t=l){return Sk(Sk(u,n,()=>new WeakMap),t,()=>{let r={};for(let[i,a]of Object.entries(e.selectors??{}))r[i]=zk(a,t,()=>Sk(d,t,m),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}let g={name:n,reducer:p,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:m,...h(r),injectInto(e,{reducerPath:t,...n}={}){let i=t??r;return e.inject({reducerPath:i,reducer:p},n),{...g,...h(i,!0)}}};return g}}function zk(e,t,n,r){function i(i,...a){let o=t(i);return o===void 0&&r&&(o=n()),e(o,...a)}return i.unwrapped=e,i}var Bk=Rk();function Vk(){function e(e,t){return{_reducerDefinitionType:`asyncThunk`,payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer(e){return Object.assign({[e.name](...t){return e(...t)}}[e.name],{_reducerDefinitionType:`reducer`})},preparedReducer(e,t){return{_reducerDefinitionType:`reducerWithPrepare`,prepare:e,reducer:t}},asyncThunk:e}}function Hk({type:e,reducerName:t,createNotation:n},r,i){let a,o;if(`reducer`in r){if(n&&!Wk(r))throw Error(DA(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?yk(e,o):yk(e))}function Uk(e){return e._reducerDefinitionType===`asyncThunk`}function Wk(e){return e._reducerDefinitionType===`reducerWithPrepare`}function Gk({type:e,reducerName:t},n,r,i){if(!i)throw Error(DA(18));let{payloadCreator:a,fulfilled:o,pending:s,rejected:c,settled:l,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:o||Kk,pending:s||Kk,rejected:c||Kk,settled:l||Kk})}function Kk(){}var qk=`task`,Jk=`listener`,Yk=`completed`,Xk=`cancelled`,Zk=`task-${Xk}`,Qk=`task-${Yk}`,$k=`${Jk}-${Xk}`,eA=`${Jk}-${Yk}`,tA=class{constructor(e){this.code=e,this.message=`${qk} ${Xk} (reason: ${e})`}name=`TaskAbortError`;message},nA=(e,t)=>{if(typeof e!=`function`)throw TypeError(DA(32))},rA=()=>{},iA=(e,t=rA)=>(e.catch(t),e),aA=(e,t)=>(e.addEventListener(`abort`,t,{once:!0}),()=>e.removeEventListener(`abort`,t)),oA=e=>{if(e.aborted)throw new tA(e.reason)};function sA(e,t){let n=rA;return new Promise((r,i)=>{let a=()=>i(new tA(e.reason));if(e.aborted){a();return}n=aA(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=rA})}var cA=async(e,t)=>{try{return await Promise.resolve(),{status:`ok`,value:await e()}}catch(e){return{status:e instanceof tA?`cancelled`:`rejected`,error:e}}finally{t?.()}},lA=e=>t=>iA(sA(e,t).then(t=>(oA(e),t))),uA=e=>{let t=lA(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:dA}=Object,fA={},pA=`listenerMiddleware`,mA=(e,t)=>{let n=t=>aA(e,()=>t.abort(e.reason));return(r,i)=>{nA(r,`taskExecutor`);let a=new AbortController;n(a);let o=cA(async()=>{oA(e),oA(a.signal);let t=await r({pause:lA(a.signal),delay:uA(a.signal),signal:a.signal});return oA(a.signal),t},()=>a.abort(Qk));return i?.autoJoin&&t.push(o.catch(rA)),{result:lA(e)(o),cancel(){a.abort(Zk)}}}},hA=(e,t)=>{let n=async(n,r)=>{oA(t);let i=()=>{},a=[new Promise((t,r)=>{let a=e({predicate:n,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});i=()=>{a(),r()}})];r!=null&&a.push(new Promise(e=>setTimeout(e,r,null)));try{let e=await sA(t,Promise.race(a));return oA(t),e}finally{i()}};return(e,t)=>iA(n(e,t))},gA=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=yk(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw Error(DA(21));return nA(a,`options.listener`),{predicate:i,type:t,effect:a}},_A=dA(e=>{let{type:t,predicate:n,effect:r}=gA(e);return{id:Fk(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw Error(DA(22))}}},{withTypes:()=>_A}),vA=(e,t)=>{let{type:n,effect:r,predicate:i}=gA(t);return Array.from(e.values()).find(e=>(typeof n==`string`?e.type===n:e.predicate===i)&&e.effect===r)},yA=e=>{e.pending.forEach(e=>{e.abort($k)})},bA=(e,t)=>()=>{for(let e of t.keys())yA(e);e.clear()},xA=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},SA=dA(yk(`${pA}/add`),{withTypes:()=>SA}),CA=yk(`${pA}/removeAll`),wA=dA(yk(`${pA}/remove`),{withTypes:()=>wA}),TA=(...e)=>{console.error(`${pA}/error`,...e)},EA=(e={})=>{let t=new Map,n=new Map,r=e=>{let t=n.get(e)??0;n.set(e,t+1)},i=e=>{let t=n.get(e)??1;t===1?n.delete(e):n.set(e,t-1)},{extra:a,onError:o=TA}=e;nA(o,`onError`);let s=e=>(e.unsubscribe=()=>t.delete(e.id),t.set(e.id,e),t=>{e.unsubscribe(),t?.cancelActive&&yA(e)}),c=e=>s(vA(t,e)??_A(e));dA(c,{withTypes:()=>c});let l=e=>{let n=vA(t,e);return n&&(n.unsubscribe(),e.cancelActive&&yA(n)),!!n};dA(l,{withTypes:()=>l});let u=async(e,n,s,l)=>{let u=new AbortController,d=hA(c,u.signal),f=[];try{e.pending.add(u),r(e),await Promise.resolve(e.effect(n,dA({},s,{getOriginalState:l,condition:(e,t)=>d(e,t).then(Boolean),take:d,delay:uA(u.signal),pause:lA(u.signal),extra:a,signal:u.signal,fork:mA(u.signal,f),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==u&&(e.abort($k),n.delete(e))})},cancel:()=>{u.abort($k),e.pending.delete(u)},throwIfCancelled:()=>{oA(u.signal)}})))}catch(e){e instanceof tA||xA(o,e,{raisedBy:`effect`})}finally{await Promise.all(f),u.abort(eA),i(e),e.pending.delete(u)}},d=bA(t,n);return{middleware:e=>n=>r=>{if(!qD(r))return n(r);if(SA.match(r))return c(r.payload);if(CA.match(r)){d();return}if(wA.match(r))return l(r.payload);let i=e.getState(),a=()=>{if(i===fA)throw Error(DA(23));return i},s;try{if(s=n(r),t.size>0){let n=e.getState(),s=Array.from(t.values());for(let t of s){let s=!1;try{s=t.predicate(r,n,i)}catch(e){s=!1,xA(o,e,{raisedBy:`predicate`})}s&&u(t,r,e,a)}}}finally{i=fA}return s},startListening:c,stopListening:l,clearListeners:d}};function DA(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var OA=Bk({name:`chartLayout`,initialState:{layoutType:`horizontal`,width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){e.margin.top=t.payload.top??0,e.margin.right=t.payload.right??0,e.margin.bottom=t.payload.bottom??0,e.margin.left=t.payload.left??0},setScale(e,t){e.scale=t.payload}}}),{setMargin:kA,setLayout:AA,setChartSize:jA,setScale:MA}=OA.actions,NA=OA.reducer;function PA(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function FA(e){return Number.isFinite(e)}function IA(e){return typeof e==`number`&&e>0&&Number.isFinite(e)}var LA=u(jD()),RA=u(PT());function zA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function BA(e){for(var t=1;t{if(t&&n){var{width:r,height:i}=n,{align:a,verticalAlign:o,layout:s}=t;if((s===`vertical`||s===`horizontal`&&o===`middle`)&&a!==`center`&&X(e[a]))return BA(BA({},e),{},{[a]:e[a]+(r||0)});if((s===`horizontal`||s===`vertical`&&a===`center`)&&o!==`middle`&&X(e[o]))return BA(BA({},e),{},{[o]:e[o]+(i||0)})}return e},KA=(e,t)=>e===`horizontal`&&t===`xAxis`||e===`vertical`&&t===`yAxis`||e===`centric`&&t===`angleAxis`||e===`radial`&&t===`radiusAxis`,qA=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},JA=(e,t,n)=>{if(!e)return null;var{duplicateDomain:r,type:i,range:a,scale:o,realScaleType:s,isCategorical:c,categoricalDomain:l,tickCount:u,ticks:d,niceTicks:f,axisType:p}=e;if(!o)return null;var m=s===`scaleBand`&&o.bandwidth?o.bandwidth()/2:2,h=(t||n)&&i===`category`&&o.bandwidth?o.bandwidth()/m:0;return h=p===`angleAxis`&&a&&a.length>=2?zT(a[0]-a[1])*2*h:h,t&&(d||f)?(d||f||[]).map((e,t)=>({coordinate:o(r?r.indexOf(e):e)+h,value:e,offset:h,index:t})).filter(e=>!BT(e.coordinate)):c&&l?l.map((e,t)=>({coordinate:o(e)+h,value:e,index:t,offset:h})):o.ticks&&!n&&u!=null?o.ticks(u).map((e,t)=>({coordinate:o(e)+h,value:e,offset:h,index:t})):o.domain().map((e,t)=>({coordinate:o(e)+h,value:r?r[e]:e,index:t,offset:h}))},YA=1e-4,XA=e=>{var t=e.domain();if(!(!t||t.length<=2)){var n=t.length,r=e.range(),i=Math.min(r[0],r[1])-YA,a=Math.max(r[0],r[1])+YA,o=e(t[0]),s=e(t[n-1]);(oa||sa)&&e.domain([t[0],t[n-1]])}},ZA={sign:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r=0?(s[0]=i,s[1]=i+u,i=c):(s[0]=a,s[1]=a+u,a=c)}}}},expand:TT,none:bT,silhouette:ET,wiggle:DT,positive:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r=0?(o[0]=i,o[1]=i+s,i=o[1]):(o[0]=0,o[1]=0)}}}}},QA=(e,t,n)=>{var r=ZA[n]??bT,i=wT().keys(t).value((e,t)=>Number(WA(e,t,0))).order(xT).offset(r)(e);return i.forEach((n,r)=>{n.forEach((n,i)=>{var a=WA(e[i],t[r],0);Array.isArray(a)&&a.length===2&&X(a[0])&&X(a[1])&&(n[0]=a[0],n[1]=a[1])})}),i};function $A(e){return e==null?void 0:String(e)}function ej(e){var{axis:t,ticks:n,bandSize:r,entry:i,index:a,dataKey:o}=e;if(t.type===`category`){if(!t.allowDuplicatedCategory&&t.dataKey&&!YT(i[t.dataKey])){var s=JT(n,`value`,i[t.dataKey]);if(s)return s.coordinate+r/2}return n[a]?n[a].coordinate+r/2:null}var c=WA(i,YT(o)?t.dataKey:o);return YT(c)?null:t.scale(c)}var tj=e=>{var t=e.flat(2).filter(X);return[Math.min(...t),Math.max(...t)]},nj=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],rj=(e,t,n)=>{if(e!=null)return nj(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var{stackedData:o}=a,s=o.reduce((e,r)=>{var i=tj(PA(r,t,n));return!FA(i[0])||!FA(i[1])?e:[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(s[0],r[0]),Math.max(s[1],r[1])]},[1/0,-1/0]))},ij=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,aj=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,oj=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=(0,LA.default)(t,e=>e.coordinate),a=1/0,o=1,s=i.length;o{if(t===`horizontal`)return e.chartX;if(t===`vertical`)return e.chartY},uj=(e,t)=>t===`centric`?e.angle:e.radius,dj=e=>e.layout.width,fj=e=>e.layout.height,pj=e=>e.layout.scale,mj=e=>e.layout.margin,hj=Q(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),gj=Q(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),_j=`data-recharts-item-index`,vj=`data-recharts-item-id`;function yj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function bj(e){for(var t=1;te.brush.height;function Tj(e){return gj(e).reduce((e,t)=>t.orientation===`left`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function Ej(e){return gj(e).reduce((e,t)=>t.orientation===`right`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function Dj(e){return hj(e).reduce((e,t)=>t.orientation===`top`&&!t.mirror&&!t.hide?e+t.height:e,0)}function Oj(e){return hj(e).reduce((e,t)=>t.orientation===`bottom`&&!t.mirror&&!t.hide?e+t.height:e,0)}var kj=Q([dj,fj,mj,wj,Tj,Ej,Dj,Oj,ND,PD],(e,t,n,r,i,a,o,s,c,l)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=bj(bj({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),f=d.bottom;d.bottom+=r,d=GA(d,c,l);var p=e-d.left-d.right,m=t-d.top-d.bottom;return bj(bj({brushBottom:f},d),{},{width:Math.max(p,0),height:Math.max(m,0)})}),Aj=Q(kj,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),jj=Q(dj,fj,(e,t)=>({x:0,y:0,width:e,height:t})),Mj=(0,C.createContext)(null),Nj=()=>(0,C.useContext)(Mj)!=null,Pj=e=>e.brush,Fj=Q([Pj,kj,mj],(e,t,n)=>({height:e.height,x:X(e.x)?e.x:t.left,y:X(e.y)?e.y:t.top+t.height+t.brushBottom-(n?.bottom||0),width:X(e.width)?e.width:t.width})),Ij=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}e.debounce=t})),Lj=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Ij();function n(e,n=0,r={}){typeof r!=`object`&&(r={});let{leading:i=!1,trailing:a=!0,maxWait:o}=r,s=[,,];i&&(s[0]=`leading`),a&&(s[1]=`trailing`);let c,l=null,u=t.debounce(function(...t){c=e.apply(this,t),l=null},n,{edges:s}),d=function(...t){return o!=null&&(l===null&&(l=Date.now()),Date.now()-l>=o)?(c=e.apply(this,t),l=Date.now(),u.cancel(),u.schedule(),c):(u.apply(this,t),c)};return d.cancel=u.cancel,d.flush=()=>(u.flush(),c),d}e.debounce=n})),Rj=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Lj();function n(e,n=0,r={}){let{leading:i=!0,trailing:a=!0}=r;return t.debounce(e,n,{leading:i,maxWait:n,trailing:a})}e.throttle=n})),zj=s(((e,t)=>{t.exports=Rj().throttle})),Bj=!0,Vj=function(e,t){var n=[...arguments].slice(2);if(Bj&&typeof console<`u`&&console.warn&&(t===void 0&&console.warn(`LogUtils requires an error message argument`),!e))if(t===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var r=0;console.warn(t.replace(/%s/g,()=>n[r++]))}},Hj=(e,t,n)=>{var{width:r=`100%`,height:i=`100%`,aspect:a,maxHeight:o}=n,s=VT(r)?e:Number(r),c=VT(i)?t:Number(i);return a&&a>0&&(s?c=s/a:c&&(s=c*a),o&&c!=null&&c>o&&(c=o)),{calculatedWidth:s,calculatedHeight:c}},Uj={width:0,height:0,overflow:`visible`},Wj={width:0,overflowX:`visible`},Gj={height:0,overflowY:`visible`},Kj={},qj=e=>{var{width:t,height:n}=e,r=VT(t),i=VT(n);return r&&i?Uj:r?Wj:i?Gj:Kj};function Jj(e){var{width:t,height:n,aspect:r}=e,i=t,a=n;return i===void 0&&a===void 0?(i=`100%`,a=`100%`):i===void 0?i=r&&r>0?void 0:`100%`:a===void 0&&(a=r&&r>0?void 0:`100%`),{width:i,height:a}}var Yj=u(zj());function Xj(){return Xj=Object.assign?Object.assign.bind():function(e){for(var t=1;t({width:n,height:r}),[n,r]);return rM(i)?C.createElement(nM.Provider,{value:i},t):null}var aM=()=>(0,C.useContext)(nM),oM=(0,C.forwardRef)((e,t)=>{var{aspect:n,initialDimension:r={width:-1,height:-1},width:i,height:a,minWidth:o=0,minHeight:s,maxHeight:c,children:l,debounce:u=0,id:d,className:f,onResize:p,style:m={}}=e,h=(0,C.useRef)(null),g=(0,C.useRef)();g.current=p,(0,C.useImperativeHandle)(t,()=>h.current);var[_,v]=(0,C.useState)({containerWidth:r.width,containerHeight:r.height}),y=(0,C.useCallback)((e,t)=>{v(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]);(0,C.useEffect)(()=>{if(h.current==null||typeof ResizeObserver>`u`)return QT;var e=e=>{var t,{width:n,height:r}=e[0].contentRect;y(n,r),(t=g.current)==null||t.call(g,n,r)};u>0&&(e=(0,Yj.default)(e,u,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),{width:n,height:r}=h.current.getBoundingClientRect();return y(n,r),t.observe(h.current),()=>{t.disconnect()}},[y,u]);var{containerWidth:b,containerHeight:x}=_;Vj(!n||n>0,`The aspect(%s) must be greater than zero.`,n);var{calculatedWidth:S,calculatedHeight:w}=Hj(b,x,{width:i,height:a,aspect:n,maxHeight:c});return Vj(S!=null&&S>0||w!=null&&w>0,`The width(%s) and height(%s) of chart should be greater than 0, please check the style of container, or the props width(%s) and height(%s), @@ -665,4 +665,4 @@ Please change the parent to {let s=(0,C.useId)(),c=(0,C.useRef)(null),l=(0,C.useRef)(null);(0,C.useEffect)(()=>{k5(),A5()},[]);let u=(0,C.useCallback)(()=>{let e=b5(Kr()),t=x5(e),n=r?.(),i=typeof n==`number`&&Number.isFinite(n)&&Math.abs(Math.trunc(n)-Math.trunc(t))<=2;return{pulse:Math.trunc(i?n:t),micro:e}},[r]),[{pulse:d},f]=(0,C.useState)(()=>u()),p=(0,C.useRef)(null),m=(0,C.useRef)(d),h=(0,C.useCallback)(()=>{p.current!==null&&(window.clearTimeout(p.current),p.current=null);let e=()=>{let t=u();m.current=t.pulse,f(e=>e.pulse===t.pulse?e:t);let n=R5(t.micro);p.current=window.setTimeout(()=>{let t=u();t.pulse!==m.current&&(m.current=t.pulse,f(t)),e()},Math.max(0,n))};e()},[u]);(0,C.useEffect)(()=>(h(),()=>{p.current!==null&&window.clearTimeout(p.current)}),[h]),(0,C.useEffect)(()=>{let e=()=>{typeof document<`u`&&!document.hidden&&h()};return document.addEventListener(`visibilitychange`,e,{passive:!0}),()=>document.removeEventListener(`visibilitychange`,e)},[h]);let g=(0,C.useMemo)(()=>{if(typeof window>`u`)return`/`;let e=String(window.location.href||``).trim();if(e&&/^https?:\/\//i.test(e))return e;let t=window.location.origin,n=`${window.location.pathname}${window.location.search}${window.location.hash}`;return t&&t!==`null`?`${t}${n||`/`}`:n||`/`},[]),[_,v]=(0,C.useState)(()=>{let e={purpose:``,to:``,from:``,location:``,witnesses:``,reference:``,remark:`In Yahuah We Trust — Secured by Φ, not man-made law`,valuePhi:``,premiumPhi:``,computedPulse:``,nowPulse:``,kaiSignature:``,userPhiKey:``,sigmaCanon:``,shaHex:``,phiDerived:``,valuationAlg:``,valuationStamp:``,provenance:[],zk:void 0,sigilSvg:``,verifyUrl:g,...a??{}};return{...e,verifyUrl:O5(e.verifyUrl,g)}}),[y,b]=(0,C.useState)(null),x=(0,C.useRef)(!1),[S,w]=(0,C.useState)(!1),T=e=>t=>v(n=>({...n,[e]:t})),E=Math.trunc(d),D=(0,C.useMemo)(()=>{let{unsigned:t}=mu(e,E);return t},[e,E]),O=(0,C.useMemo)(()=>`${D.algorithm} • ${D.policyChecksum}`,[D.algorithm,D.policyChecksum]);(0,C.useEffect)(()=>{v(e=>e.valuationAlg?e:{...e,valuationAlg:O})},[O]);let k=(0,C.useMemo)(()=>Qu({meta:e,nowPulse:E,usd:t,currentStreakDays:0,lifetimeUsdSoFar:0},n),[e,E,t,n]),A=D.valuePhi,j=D.premium??0,M=k.usdPerPhi,N=k.phiPerUsd,P=A*M,F=(0,C.useCallback)(()=>{let e=!!y,t=Z8(e?y.valuePhi:A),n=e&&_.premiumPhi||Z8(j),r=e?String(y.lockedPulse):``,i=e?_.valuationStamp||y.seal.stamp:``,a=O5(_.verifyUrl,g);return k8({purpose:_.purpose,to:_.to,from:_.from,location:_.location,witnesses:_.witnesses,reference:_.reference,remark:_.remark,valuePhi:t,premiumPhi:n,computedPulse:r,nowPulse:String(E),kaiSignature:_.kaiSignature||``,userPhiKey:_.userPhiKey||``,valuationAlg:_.valuationAlg||O,valuationStamp:i,sigilSvg:_.sigilSvg||``,verifyUrl:a,provenance:_.provenance??[]})},[_,A,j,E,O,y,g]),I=j5(()=>{let e=c.current;if(e)try{o8(e,F())}catch(e){console.error(`preview render failed`,e)}});(0,C.useEffect)(()=>{I()},[I,F]);let L=(0,C.useCallback)(async()=>{if(!(x.current||S)){w(!0);try{await new Promise(e=>requestAnimationFrame(()=>e()));let r=E,{unsigned:a}=mu(e,r),o=await L5(a),s=Qu({meta:e,nowPulse:r,usd:t,currentStreakDays:0,lifetimeUsdSoFar:0},n),c={...C5(a),stamp:o},l={lockedPulse:r,seal:c,usdPerPhi:s.usdPerPhi,phiPerUsd:s.phiPerUsd,valuePhi:c.valuePhi,valueUsdIndicative:c.valuePhi*s.usdPerPhi,quote:s};p.current!==null&&(window.clearTimeout(p.current),p.current=null),x.current=!0,b(l),v(e=>({...e,computedPulse:String(r),nowPulse:String(r),valuationStamp:o,premiumPhi:a.premium===void 0?e.premiumPhi:Z8(a.premium),valuationAlg:e.valuationAlg||`${a.algorithm} • ${a.policyChecksum}`,valuePhi:Z8(c.valuePhi),verifyUrl:O5(e.verifyUrl,g)})),i?.(l)}catch(e){console.error(`Render/Lock failed`,e),window.alert(`Render failed.\n${e instanceof Error?e.message:String(e)}`)}finally{w(!1)}}},[E,e,t,n,i,S,g]),R=(0,C.useRef)(``);(0,C.useEffect)(()=>{let e=!0;(async()=>{try{let t=await o5();if(!e||!t)return;let n={...t,verifyUrl:t.verifyUrl?O5(t.verifyUrl,g):void 0};v(e=>({...e,...n,verifyUrl:O5(n.verifyUrl??e.verifyUrl,g)}))}catch(e){console.error(`bridge hydration failed`,e)}})();let t=e=>{try{let t=e.detail;if(!t)return;let n=e=>(typeof e.verifyUrl==`string`&&(e.verifyUrl=O5(e.verifyUrl,g)),e);if(x.current){let e=[`kaiSignature`,`userPhiKey`,`sigmaCanon`,`shaHex`,`phiDerived`,`zk`,`provenance`,`sigilSvg`,`verifyUrl`],r=n(Object.fromEntries(Object.entries(t).filter(([t])=>e.includes(t)))),i=JSON.stringify(r);if(i===R.current)return;R.current=i,v(e=>({...e,...r}));return}let r=n({...t}),i=JSON.stringify(r);if(i===R.current)return;R.current=i,v(e=>({...e,...r}))}catch(e){console.error(`bridge event failed`,e)}};return window.addEventListener(`kk:note-data`,t,{passive:!0}),()=>{e=!1,window.removeEventListener(`kk:note-data`,t)}},[g]);let z=(0,C.useCallback)(async()=>{let e=l.current;if(!e)return;if(!x.current||!y){window.alert(`Please Render to lock the valuation before printing.`);return}let t=O5(_.verifyUrl,g),n=k8({..._,valuePhi:_.valuePhi||Z8(y.valuePhi),premiumPhi:_.premiumPhi||Z8(j),computedPulse:String(y.lockedPulse),nowPulse:String(y.lockedPulse),kaiSignature:_.kaiSignature||``,userPhiKey:_.userPhiKey||``,valuationAlg:_.valuationAlg||O,valuationStamp:_.valuationStamp||y.seal.stamp,sigilSvg:_.sigilSvg||``,verifyUrl:t,provenance:_.provenance??[]}),r=L8({frozenPulse:String(y.lockedPulse),kaiSignature:_.kaiSignature||``,userPhiKey:_.userPhiKey||``,sigmaCanon:_.sigmaCanon||``,shaHex:_.shaHex||``,phiDerived:_.phiDerived||``,valuePhi:_.valuePhi||Z8(y.valuePhi),premiumPhi:_.premiumPhi||Z8(j),valuationAlg:_.valuationAlg||O,valuationStamp:_.valuationStamp||y.seal.stamp,zk:_.zk,provenance:_.provenance??[],sigilSvg:_.sigilSvg||``,verifyUrl:t});G8(e,n,String(y.lockedPulse),r),e.setAttribute(`aria-hidden`,`false`),await D5(),await K8(`☤KAI ${w5(y.lockedPulse)} — ${a8}`),e.setAttribute(`aria-hidden`,`true`)},[_,y,j,O,g]),B=(0,C.useCallback)(async()=>{try{if(!x.current||!y){window.alert(`Please Render to lock the valuation before saving PNG.`);return}let e=O5(_.verifyUrl,g),t=await _5(k8({..._,valuePhi:_.valuePhi||Z8(y.valuePhi),premiumPhi:_.premiumPhi||Z8(j),computedPulse:String(y.lockedPulse),nowPulse:String(y.lockedPulse),kaiSignature:_.kaiSignature||``,userPhiKey:_.userPhiKey||``,valuationAlg:_.valuationAlg||O,valuationStamp:_.valuationStamp||y.seal.stamp,sigilSvg:_.sigilSvg||``,verifyUrl:e,provenance:_.provenance??[]}),2400);v5(`${T5(_.kaiSignature||``,String(y.lockedPulse),_.valuationStamp||y.seal.stamp||``)}.png`,t,`image/png`)}catch(e){window.alert(`Save PNG failed: `+(e instanceof Error?e.message:String(e))),console.error(e)}},[_,y,j,O,g]),V=y?y.lockedPulse:E,H=y?y.valuePhi:A,U=y?y.valueUsdIndicative:P,ee=y?y.usdPerPhi:M,te=y?y.phiPerUsd:N,ne=y?_.premiumPhi?Number(_.premiumPhi):0:j,re=E5(H),ie=(0,C.useMemo)(()=>`☤KAI ${w5(V)}`,[V]);return(0,W.jsxs)(`div`,{"data-kk-scope":s,className:`kk-note ${o??``}`,children:[(0,W.jsxs)(`div`,{className:`kk-bar`,children:[(0,W.jsx)(`div`,{className:`kk-brand`,children:(0,W.jsx)(`strong`,{children:`☤KAI — Kairos Kurrensy · Sovereign Harmonik Kingdom`})}),(0,W.jsx)(`div`,{className:`kk-legal-pill`,children:`Issued under Yahuah’s Law of Eternal Light (Φ • Kai-Turah)`})]}),(0,W.jsxs)(`section`,{className:`kk-hero ${y?`is-locked`:`is-live`}`,children:[(0,W.jsxs)(`div`,{className:`kk-status`,children:[(0,W.jsx)(`span`,{className:`kk-chip ${y?`chip-locked`:`chip-live`}`,children:y?`LOCKED`:`LIVE`}),(0,W.jsxs)(`span`,{className:`kk-chip kk-chip-pulse`,children:[`☤KAI `,w5(V)]}),(0,W.jsxs)(`span`,{className:`kk-chip`,children:[`value: `,Y8(H)]}),(0,W.jsxs)(`span`,{className:`kk-chip`,children:[`$ / φ: `,Z8(ee)]}),(0,W.jsxs)(`span`,{className:`kk-chip`,children:[`φ / $: `,Z8(te)]}),(0,W.jsxs)(`span`,{className:`kk-chip`,children:[`premium φ: `,Z8(ne)]})]}),(0,W.jsxs)(`div`,{className:`kk-value-row`,children:[(0,W.jsxs)(`div`,{className:`kk-value-block`,children:[(0,W.jsx)(`div`,{className:`kk-value-label`,children:`VALUE`}),(0,W.jsxs)(`div`,{className:`kk-value`,children:[(0,W.jsx)(`span`,{className:`kk-value-sigil`,children:`Φ`}),(0,W.jsx)(`span`,{className:`kk-value-int`,children:re.int}),(0,W.jsx)(`span`,{className:`kk-value-frac`,children:re.frac})]}),(0,W.jsxs)(`div`,{className:`kk-value-usd`,children:[`≈ `,X8(U)]})]}),(0,W.jsxs)(`div`,{className:`kk-cta`,children:[y?(0,W.jsxs)(`div`,{className:`kk-locked-banner`,role:`status`,"aria-live":`polite`,children:[(0,W.jsx)(`div`,{className:`kk-locked-title`,children:`Valuation Locked`}),(0,W.jsxs)(`div`,{className:`kk-locked-sub`,children:[`☤KAI `,w5(y.lockedPulse),` • Hash: `,_.valuationStamp||y.seal.stamp||`—`]})]}):(0,W.jsx)(`button`,{className:`kk-btn kk-btn-primary kk-btn-xl`,onClick:L,title:`Freeze current pulse and valuation`,disabled:S,children:S?`Rendering…`:`Render — Lock Valuation`}),(0,W.jsxs)(`div`,{className:`kk-cta-actions`,children:[(0,W.jsx)(`button`,{className:`kk-btn`,onClick:z,disabled:!y,title:`Print proof pages`,children:`Print / Save PDF`}),(0,W.jsx)(`button`,{className:`kk-btn kk-btn-ghost`,onClick:B,disabled:!y,title:`Export note PNG`,children:`Save PNG`})]})]})]})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Title`}),(0,W.jsx)(`input`,{value:`${ie} — ${a8}`,disabled:!0,className:`kk-out`})]}),(0,W.jsxs)(`div`,{className:`kk-grid`,children:[(0,W.jsxs)(`div`,{className:`kk-stack`,children:[(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Purpose`}),(0,W.jsx)(`input`,{value:_.purpose,onChange:e=>T(`purpose`)(e.target.value),placeholder:`e.g., consideration for work / gift / exchange`,disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`To`}),(0,W.jsx)(`input`,{value:_.to,onChange:e=>T(`to`)(e.target.value),placeholder:`Recipient`,disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`From`}),(0,W.jsx)(`input`,{value:_.from,onChange:e=>T(`from`)(e.target.value),placeholder:`Issuer`,disabled:!!y})]})]}),(0,W.jsxs)(`div`,{className:`kk-stack`,children:[(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Location`}),(0,W.jsx)(`input`,{value:_.location,onChange:e=>T(`location`)(e.target.value),placeholder:`(optional)`,disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Witnesses`}),(0,W.jsx)(`input`,{value:_.witnesses,onChange:e=>T(`witnesses`)(e.target.value),placeholder:`(optional)`,disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Reference`}),(0,W.jsx)(`input`,{value:_.reference,onChange:e=>T(`reference`)(e.target.value),placeholder:`(optional)`,disabled:!!y})]})]})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Remark`}),(0,W.jsx)(`input`,{value:_.remark,onChange:e=>T(`remark`)(e.target.value),placeholder:`In Yahuah We Trust — Secured by Φ, not man-made law`,disabled:!!y})]}),(0,W.jsxs)(`details`,{className:`kk-stack`,style:{marginTop:8},open:!0,children:[(0,W.jsxs)(`summary`,{children:[(0,W.jsx)(`strong`,{children:`Identity & Valuation`}),` `,(0,W.jsx)(`span`,{className:`kk-hint`,children:`— appears on the bill + proof pages`})]}),(0,W.jsxs)(`div`,{className:`kk-grid`,style:{marginTop:8},children:[(0,W.jsxs)(`div`,{className:`kk-stack`,children:[(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Value Φ`}),(0,W.jsx)(`input`,{value:Z8(H),readOnly:!0})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Premium Φ`}),(0,W.jsx)(`input`,{value:Z8(ne),readOnly:!0})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Valuation Alg`}),(0,W.jsx)(`input`,{value:_.valuationAlg||O,readOnly:!0})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Valuation Stamp`}),(0,W.jsx)(`input`,{value:y?_.valuationStamp||y.seal.stamp||`—`:``,readOnly:!0})]})]}),(0,W.jsxs)(`div`,{className:`kk-stack`,children:[(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Pulse (locked)`}),(0,W.jsx)(`input`,{value:y?String(y.lockedPulse):``,readOnly:!0,placeholder:`set on Render`})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Pulse (live)`}),(0,W.jsx)(`input`,{value:String(E),readOnly:!0,placeholder:`live`})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`kaiSignature`}),(0,W.jsx)(`input`,{value:_.kaiSignature,onChange:e=>T(`kaiSignature`)(e.target.value),disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`userΦkey`}),(0,W.jsx)(`input`,{value:_.userPhiKey,onChange:e=>T(`userPhiKey`)(e.target.value),disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Σ (canonical)`}),(0,W.jsx)(`input`,{value:_.sigmaCanon,onChange:e=>T(`sigmaCanon`)(e.target.value),disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`sha256(Σ)`}),(0,W.jsx)(`input`,{value:_.shaHex,onChange:e=>T(`shaHex`)(e.target.value),disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Φ (derived)`}),(0,W.jsx)(`input`,{value:_.phiDerived,onChange:e=>T(`phiDerived`)(e.target.value),disabled:!!y})]})]})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Verify URL`}),(0,W.jsx)(`input`,{value:_.verifyUrl,onChange:e=>T(`verifyUrl`)(e.target.value),placeholder:`Used for QR & clickable sigil`,disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Sigil SVG (raw)`}),(0,W.jsx)(`textarea`,{value:_.sigilSvg,onChange:e=>T(`sigilSvg`)(e.target.value),className:`kk-out`,disabled:!!y})]})]}),(0,W.jsxs)(`div`,{className:`kk-row kk-actions`,children:[(0,W.jsx)(`div`,{}),(0,W.jsxs)(`div`,{className:`kk-flex`,children:[!y&&(0,W.jsx)(`button`,{className:`kk-btn kk-btn-primary`,onClick:L,disabled:S,children:S?`Rendering…`:`Render — Lock Valuation`}),(0,W.jsx)(`button`,{className:`kk-btn`,onClick:z,disabled:!y,children:`Print / Save PDF`}),(0,W.jsx)(`button`,{className:`kk-btn kk-btn-ghost`,onClick:B,disabled:!y,children:`Save PNG`})]}),(0,W.jsx)(`div`,{})]}),(0,W.jsx)(`div`,{ref:c,id:`note-preview`,className:`kk-note-preview kk-out`}),(0,W.jsx)(`div`,{ref:l,id:`print-root`,"aria-hidden":`true`})]})},B5=`kairos:key:pkcs8`,V5=`kairos:key:spki`,H5={name:`ECDSA`,namedCurve:`P-256`},U5={name:`ECDSA`,hash:`SHA-256`};function W5(e){let t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(e),t}async function G5(e){return crypto.subtle.importKey(`pkcs8`,e,H5,!0,[`sign`])}async function K5(e){return crypto.subtle.importKey(`spki`,e,H5,!0,[`verify`])}async function q5(e){let t=await crypto.subtle.exportKey(`pkcs8`,e);return xs.encode(new Uint8Array(t))}async function J5(e){let t=await crypto.subtle.exportKey(`spki`,e);return xs.encode(new Uint8Array(t))}async function Y5(){let e=await crypto.subtle.generateKey(H5,!0,[`sign`,`verify`]),t=await J5(e.publicKey);return{priv:e.privateKey,pub:e.publicKey,spkiB64u:t}}async function X5(){try{let e=localStorage.getItem(B5),t=localStorage.getItem(V5);if(e&&t){let n=xs.decode(e),r=xs.decode(t);return{priv:await G5(W5(n)),pub:await K5(W5(r)),spkiB64u:t}}let n=await Y5();return localStorage.setItem(B5,await q5(n.priv)),localStorage.setItem(V5,n.spkiB64u),n}catch{return Y5()}}async function Z5(e,t){let n=W5(t),r=await crypto.subtle.sign(U5,e,n);return xs.encode(new Uint8Array(r))}function Q5(e,t){let n=e.match(RegExp(`${t}="([^"]+)"`,`i`));return n?n[1]:void 0}function $5(e,t){let n=Q5(e,t);if(!n)return;let r=Number(n);return Number.isFinite(r)?r:void 0}function e7(e){try{let t=new DOMParser().parseFromString(e,`image/svg+xml`).querySelector(`metadata`);return t?t.textContent??null:null}catch{return null}}async function t7(e){let t=await e.text(),n={},r=e7(t);if(r)try{n=JSON.parse(r)}catch{}if(n.pulse??=$5(t,`data-pulse`),n.beat??=$5(t,`data-beat`),n.stepIndex??=$5(t,`data-step-index`),n.frequencyHz??=(()=>{let e=Q5(t,`data-frequency-hz`);return e?Number(e):void 0})(),n.chakraGate??=Q5(t,`data-chakra-gate`),!n.chakraDay){let e=Q5(t,`data-harmonic-day`)||Q5(t,`data-chakra-day`);e&&(n.chakraDay=e)}n.kaiSignature??=Q5(t,`data-kai-signature`),n.userPhiKey??=Q5(t,`data-phi-key`);let i=!n[`@context`]||n[`@context`]===`https://schema.phi.network/sigil/v1`,a=!n.type||n.type===`application/phi.kairos.sigil+svg`;return{text:t,meta:n,contextOk:i,typeOk:a}}async function n7(e,t){let n=new Image;n.crossOrigin=`anonymous`,n.src=e,await n.decode();let r=document.createElement(`canvas`);r.width=n.width,r.height=n.height;let i=r.getContext(`2d`);if(!i)throw Error(`Canvas 2D context unavailable`);i.drawImage(n,0,0);let{data:a}=i.getImageData(Math.floor(n.width/2),Math.floor(n.height/2),1,1),o=[a[0],a[1],a[2]];return{sig:(await _s(`${t}-2:3-${o.join(`,`)}`)).slice(0,32),rgb:o}}async function r7(e,t){let n=await fetch(e).then(e=>e.text()),r=JSON.stringify(t,null,2),i=n.match(/]*>/i)?n.replace(/]*>[\s\S]*?<\/metadata>/i,`${r}`):n.replace(/]*)>/i,`${r}`);return`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(i)))}`}async function i7(e,t=1024){let n=new Image;await new Promise((t,r)=>{n.onload=()=>t(),n.onerror=r,n.src=e});let r=document.createElement(`canvas`);r.width=t,r.height=t;let i=r.getContext(`2d`);if(!i)throw Error(`Canvas unsupported`);return i.clearRect(0,0,t,t),i.drawImage(n,0,0,t,t),await new Promise((e,t)=>r.toBlob(n=>n?e(n):t(Error(`PNG encode failed`)),`image/png`))}const a7=()=>new Date().toISOString(),o7=(e,t)=>`${e}_${t}_${a7().replace(/[:.]/g,`-`)}`,s7=(e,t,n)=>`${e}_${t}_${n}`,c7=(e,t)=>{let n=document.createElement(`a`);if(typeof e==`string`)n.href=e;else{let t=URL.createObjectURL(e);n.href=t,setTimeout(()=>URL.revokeObjectURL(t),0)}n.download=t,n.rel=`noopener`,document.body.appendChild(n),n.click(),n.remove()},l7=e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let n=String(r.result),i=n.indexOf(`,`),a=i>=0?n.slice(i+1):``;t({name:e.name,mime:e.type,size:e.size,encoded:a})},r.onerror=n,r.readAsDataURL(e)});var u7=18n;function d7(e){let t=1n;for(let n=0n;ne?`0.`:``).split(`.`),a=(r||`0`).replace(/^0+(?=\d)/,``)||`0`,o=(i+`0`.repeat(Number(u7))).slice(0,Number(u7));return n*(BigInt(a)*f7+BigInt(o||`0`))}function m7(e){let t=e<0n?`-`:``,n=e<0n?-e:e,r=n/f7,i=(n%f7).toString().padStart(Number(u7),`0`);return i=i.replace(/0+$/,``),i?`${t}${r}.${i}`:`${t}${r}`}function h7(e){try{let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e=0;e--)if(t[e]?.receiverSignature){n=e;break}let r=0n;for(let e=Math.max(0,n+1);e=0)i=g7(t[n]);else{let t=e.valuation;t&&typeof t.valuePhi==`number`&&(i=p7(String(t.valuePhi)))}let a=p7(e.branchSpentPhi??`0`)+r,o=e.segments?.length??0,s=e.cumulativeTransfers??0,c=s+t.length-1,l=await ws(await Promise.all(t.map(async e=>{let t={senderSignature:e.senderSignature,senderStamp:e.senderStamp,senderKaiPulse:e.senderKaiPulse};return e.payload&&(t.payload={name:e.payload.name,mime:e.payload.mime,size:e.payload.size}),e.receiverSignature&&(t.receiverSignature=e.receiverSignature),e.receiverStamp&&(t.receiverStamp=e.receiverStamp),e.receiverKaiPulse!=null&&(t.receiverKaiPulse=e.receiverKaiPulse),_s(JSON.stringify(t))}))),u=await Hs(e),d={version:1,segmentIndex:o,segmentRange:[s,c],segmentRoot:l,headHashAtSeal:u,leafHash:`sha256`,transfers:t},f=JSON.stringify(d),p=await _s(f),m=new Blob([f],{type:`application/json`}),h=[...e.segments??[],{index:o,root:l,cid:p,count:t.length}],g=await ws(h.map(e=>e.root));return{meta:{...e,segments:h,segmentsMerkleRoot:g,cumulativeTransfers:(e.cumulativeTransfers??0)+t.length,transfers:[],transfersWindowRoot:void 0,headHashAtSeal:u,segmentSize:e.segmentSize??2e3,...i>0n?{branchBasePhi:m7(i)}:{},branchSpentPhi:m7(a)},segmentFileBlob:m}}async function v7(e,t){if(t.kind===`head`)return!e.transfersWindowRoot||e.transfersWindowRoot!==t.windowMerkleRoot?!1:Es(e.transfersWindowRoot,t.transferProof);if(!e.segments||!e.segmentsMerkleRoot)return!1;let n=e.segments.find(e=>e.index===t.segmentIndex);if(!n||n.root!==t.segmentRoot)return!1;let r=t.segmentRoot,i=t.segmentIndex;for(let e of t.segmentsSiblings){let t=i%2==0?[r,e]:[e,r];r=await Cs(t[0]<=t[1]?t[0]:t[1],t[0]<=t[1]?t[1]:t[0]),i=Math.floor(i/2)}return r===e.segmentsMerkleRoot?Es(t.segmentRoot,t.transferProof):!1}var y7=e=>typeof e==`object`&&!!e,b7=e=>typeof e==`string`||typeof e==`number`||typeof e==`bigint`;function x7(e){return y7(e)}function S7(e){return y7(e)}function C7(e){return Array.isArray(e)?e.every(b7):y7(e)?Object.values(e).every(e=>b7(e)):!1}function w7(e){return typeof e==`object`&&!!e&&`verify`in e&&typeof e.verify==`function`}async function T7(){if(typeof window<`u`&&window.snarkjs?.groth16&&w7(window.snarkjs.groth16))return window.snarkjs.groth16;try{let e=await O(()=>import(`snarkjs`),[]),t=e.groth16??e.default?.groth16;if(w7(t))return t}catch{}return null}async function E7(e){let t=await T7();if(!t)return null;let n=e.vkey??e.fallbackVkey;return!x7(n)||!C7(e.publicSignals)||!S7(e.proof)?!1:!!await t.verify(n,e.publicSignals,e.proof)}async function D7(e){let t=e.zkVerifyingKey,n=typeof window<`u`?window.SIGIL_ZK_VKEY:void 0,r=t??n,i=e.hardenedTransfers??[];for(let e=0;ee?String(e).toLowerCase():``;function F7(e){let t=typeof e==`string`?e.trim():String(e??``);return t&&(t.replace(/[^0-9]/g,``)||`0`).replace(/^0+(?=\d)/,``)||`0`}function I7(e){let t=BigInt(2**53-1);return e>t?2**53-1:e<-t?-(2**53-1):Number(e)}function L7(){return I7(Kr())}function R7(){if(!M7)return[];try{let e=localStorage.getItem(O7);return e?JSON.parse(e):[]}catch{return[]}}function z7(){if(M7)try{if(localStorage.getItem(O7))return;for(let e of k7){let t=localStorage.getItem(e);if(t)try{let e=JSON.parse(t);if(!Array.isArray(e))continue;let n=[];for(let t of e){let e=t??{},r=P7(e.parentCanonical??e.parent??e.p),i=P7(e.childCanonical??e.child??e.c),a=F7(e.amountPhiScaled??e.amountScaled??e.a),o=Number(e.senderKaiPulse??e.k??0)||0,s=String(e.transferNonce??e.n??``),c=String(e.senderStamp??e.s??``),l=String(e.previousHeadRoot??e.r??``),u=String(e.transferLeafHashSend??e.l??``),d=!!e.confirmed,f=e.createdAt??e.t,p=(f==null?L7():Number(f))||L7();!r||!i||n.push({id:``,parentCanonical:r,childCanonical:i,amountPhiScaled:a,senderKaiPulse:o,transferNonce:s,senderStamp:c,previousHeadRoot:l,transferLeafHashSend:u,confirmed:d,createdAt:p})}(async()=>{for(let e of n)e.id=await H7({parentCanonical:e.parentCanonical,childCanonical:e.childCanonical,amountPhiScaled:e.amountPhiScaled,senderKaiPulse:e.senderKaiPulse,transferNonce:e.transferNonce,senderStamp:e.senderStamp,previousHeadRoot:e.previousHeadRoot,transferLeafHashSend:e.transferLeafHashSend});let e=new Map;for(let t of n)e.set(t.id,t);V7(Array.from(e.values()))})();return}catch{}}}catch{}}function B7(){z7();let e=R7();if(!Array.isArray(e))return[];let t=[];for(let n of e)try{let e=n,r={id:String(e.id??``),parentCanonical:P7(e.parentCanonical),childCanonical:P7(e.childCanonical),amountPhiScaled:F7(e.amountPhiScaled),senderKaiPulse:Number(e.senderKaiPulse??0)||0,transferNonce:String(e.transferNonce??``),senderStamp:String(e.senderStamp??``),previousHeadRoot:String(e.previousHeadRoot??``),transferLeafHashSend:String(e.transferLeafHashSend??``),confirmed:!!e.confirmed,createdAt:Number(e.createdAt??L7())||L7()};if(!r.parentCanonical||!r.childCanonical||!r.id)continue;t.push(r)}catch{}return t.sort((e,t)=>e.createdAt-t.createdAt),t}function V7(e){if(M7)try{let t=e.map(e=>({...e,parentCanonical:P7(e.parentCanonical),childCanonical:P7(e.childCanonical),amountPhiScaled:F7(e.amountPhiScaled),createdAt:Number(e.createdAt||L7())||L7()}));localStorage.setItem(O7,JSON.stringify(t))}catch{}}async function H7(e){return(await _s(JSON.stringify({p:P7(e.parentCanonical),c:P7(e.childCanonical),a:F7(e.amountPhiScaled),k:e.senderKaiPulse,n:e.transferNonce,s:e.senderStamp,r:e.previousHeadRoot,l:e.transferLeafHashSend}))).toLowerCase()}async function U7(e){let t=B7(),n=await H7(e);if(!t.some(e=>e.id===n)){let r={...e,id:n,parentCanonical:P7(e.parentCanonical),childCanonical:P7(e.childCanonical),amountPhiScaled:F7(e.amountPhiScaled),createdAt:L7()};V7([...t,r]),q7({type:`send:add`,record:r})}return n}function W7(e,t){let n=P7(e),r=String(t||``),i=B7(),a=!1;for(let e of i)e.parentCanonical===n&&e.transferLeafHashSend===r&&!e.confirmed&&(e.confirmed=!0,a=!0);a&&(V7(i),q7({type:`send:update`,parentCanonical:n}))}function G7(e){let t=P7(e);return B7().filter(e=>e.parentCanonical===t)}function K7(e){return G7(e).reduce((e,t)=>e+BigInt(F7(t.amountPhiScaled)),0n)}function q7(e){try{N7?.postMessage(e)}catch{}}var J7=({size:e=22,color:t=`currentColor`,label:n=`Inhale & Upload`})=>(0,W.jsxs)(`div`,{style:{display:`inline-flex`,alignItems:`center`,gap:`8px`,cursor:`pointer`,userSelect:`none`,transition:`transform 0.35s ease`},className:`inhale-upload`,title:n,children:[(0,W.jsxs)(`svg`,{viewBox:`0 0 64 64`,width:e,height:e,"aria-hidden":`true`,style:{display:`inline-block`,verticalAlign:`middle`,filter:`drop-shadow(0 0 6px rgba(55,255,228,0.25))`},children:[(0,W.jsx)(`circle`,{cx:`32`,cy:`32`,r:`28`,stroke:t,strokeWidth:`2`,fill:`none`,strokeDasharray:`4 6`,opacity:`0.6`,children:(0,W.jsx)(`animateTransform`,{attributeName:`transform`,type:`rotate`,values:`0 32 32;360 32 32`,dur:`6s`,repeatCount:`indefinite`})}),(0,W.jsx)(`path`,{d:`M32 44V18`,stroke:t,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,W.jsx)(`animate`,{attributeName:`stroke-dasharray`,values:`0,50;50,0;0,50`,dur:`3.236s`,repeatCount:`indefinite`})}),(0,W.jsx)(`polyline`,{points:`22,26 32,16 42,26`,fill:`none`,stroke:t,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,W.jsx)(`animateTransform`,{attributeName:`transform`,type:`translate`,values:`0 2;0 -2;0 2`,dur:`2.618s`,repeatCount:`indefinite`})}),(0,W.jsx)(`rect`,{x:`22`,y:`46`,width:`20`,height:`4`,rx:`2`,fill:t,opacity:`0.7`,children:(0,W.jsx)(`animate`,{attributeName:`opacity`,values:`0.5;1;0.5`,dur:`4s`,repeatCount:`indefinite`})})]}),(0,W.jsx)(`span`,{style:{fontFamily:`var(--font-sans, 'Inter', sans-serif)`,fontWeight:600,letterSpacing:`0.03em`,color:t,fontSize:`0.9rem`}})]}),Y7={full:{width:`100vw`,maxWidth:`100vw`,height:`100dvh`,maxHeight:`100dvh`,margin:0,padding:0,overflow:`hidden`},viewport:{display:`flex`,flexDirection:`column`,width:`100%`,height:`100%`,maxWidth:`100vw`,overflow:`hidden`},gridBar:{display:`grid`,gridTemplateColumns:`1fr auto`,alignItems:`center`},stickyTabs:{position:`sticky`,top:48,zIndex:2},mono:{overflowWrap:`anywhere`},iconBtn:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:44,height:44,padding:0,flex:`0 0 auto`},iconBtnSm:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:40,height:40,padding:0,flex:`0 0 auto`},modalBody:{flex:`1 1 auto`,minHeight:0,overflowY:`auto`,overflowX:`hidden`,paddingBottom:80},headerImg:{maxWidth:`64px`,height:`auto`,flex:`0 0 auto`},valueStrip:{overflowX:`auto`,whiteSpace:`nowrap`},popBg:{position:`fixed`,inset:0,zIndex:9999,background:`rgba(0,0,0,.55)`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:14},popCard:{width:`min(980px, 100%)`,maxHeight:`min(680px, calc(100dvh - 28px))`,borderRadius:18,overflow:`hidden`,background:`rgba(8,10,16,.92)`,border:`1px solid rgba(255,255,255,.12)`,boxShadow:`0 24px 70px rgba(0,0,0,.6)`,display:`flex`,flexDirection:`column`},popHead:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:10,padding:`12px 12px 10px 14px`,borderBottom:`1px solid rgba(255,255,255,.08)`},popBody:{flex:`1 1 auto`,minHeight:0,overflow:`auto`,padding:10},popTitle:{fontSize:12,color:`rgba(255,255,255,.82)`,letterSpacing:`.02em`}};function X7(e=[],t=16,n=.65){let r=(0,C.useRef)(null),i=(0,C.useRef)(null),[a,o]=(0,C.useState)(1);return(0,C.useEffect)(()=>{let e=r.current,a=i.current;if(!e||!a)return;let s=()=>{let r=Math.max(0,e.clientWidth-t),i=a.scrollWidth;if(r<=0||i<=0)return o(1);o(Math.min(1,Math.max(n,r/i)))};s();let c=new ResizeObserver(s);c.observe(e),c.observe(a),window.addEventListener(`resize`,s);let l=window.setInterval(s,250);return()=>{c.disconnect(),window.removeEventListener(`resize`,s),window.clearInterval(l)}},e),{boxRef:r,textRef:i,scale:a}}var Z7=({k:e,v:t,wide:n,mono:r})=>(0,W.jsxs)(`div`,{className:`kv${n?` wide`:``}`,children:[(0,W.jsx)(`span`,{className:`k`,children:e}),(0,W.jsx)(`span`,{className:`v${r?` mono`:``}`,style:r?Y7.mono:void 0,children:t})]}),Q7=({kind:e,trend:t,flash:n,title:r,children:i,onClick:a,ariaLabel:o})=>{let{boxRef:s,textRef:c,scale:l}=X7([i,t,n],16,.65),u=typeof a==`function`,d=e=>{u&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),a?.())};return(0,W.jsx)(`div`,{ref:s,className:`value-chip ${e} ${t}${n?` is-flashing`:``}${u?` is-clickable`:``}`,"data-trend":t,title:r,role:u?`button`:void 0,tabIndex:u?0:void 0,"aria-label":u?o||r:void 0,onClick:a,onKeyDown:d,style:u?{cursor:`pointer`,userSelect:`none`}:void 0,children:(0,W.jsx)(`span`,{ref:c,className:`amount`,style:{display:`inline-block`,whiteSpace:`nowrap`,lineHeight:1,transform:`scale(${l})`,transformOrigin:`left center`,willChange:`transform`},children:i})})},$7=({small:e,aria:t,titleText:n,path:r,...i})=>(0,W.jsx)(`button`,{...i,className:i.className||`secondary`,"aria-label":t,title:n,style:e?Y7.iconBtnSm:Y7.iconBtn,children:(0,W.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`18`,height:`18`,"aria-hidden":`true`,focusable:`false`,className:`ico`,children:(0,W.jsx)(`path`,{d:r,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`})})}),e9=`kai:sigils:v1`,t9=`sigil:urls`,n9=`kai-sigil-registry`;function r9(e){if(typeof window>`u`)return;let t=t=>{try{let n=window.localStorage.getItem(t),r=n?JSON.parse(n):[],i=Array.isArray(r)?r.slice():[];i.includes(e)||i.unshift(e),window.localStorage.setItem(t,JSON.stringify(i.slice(0,2e4)))}catch{}};t(e9),t(t9);try{let t=new BroadcastChannel(n9);t.postMessage({type:`add`,url:e}),t.close()}catch{}try{window.dispatchEvent(new CustomEvent(`kai:registry:add`,{detail:{url:e}}))}catch{}}var i9=1000000n,a9=17491270421n,o9=11000000n,s9=44,c9=36,l9=6,u9=[`Solhara`,`Aquaris`,`Flamora`,`Verdari`,`Sonari`,`Kaelith`],d9={Solhara:`Root`,Aquaris:`Sacral`,Flamora:`Solar Plexus`,Verdari:`Heart`,Sonari:`Throat`,Kaelith:`Crown`},f9=(a9+18n)/36n,p9=(e,t)=>(e%t+t)%t;function m9(e,t){let n=e/t,r=e%t;return r!==0n&&r>0n!=t>0n?n-1n:n}function h9(e){let t=(e-In)/qn*1e6,n=t<0?-1:1,r=Math.abs(t),i=Math.trunc(r),a=r-i,o=i;return a>.5?o=i+1:a===.5&&(o=i%2==0?i:i+1),BigInt(n)*BigInt(o)}function g9(e){if(e>=0n&&e<500000000n)return e*i9;let t=m9(e,i9);if(t>=0n&&t<500000000n)return e;let n=e/1000n,r=BigInt(2**53-1),i=BigInt(-(2**53-1));if(n>r||nBigInt(2**53-1)?2**53-1:Number(t),r=p9(e,i9),i=i9-r;return{pμ:e,pulse:n,μInPulse:r,msToNext:Math.max(0,Math.ceil(Number(i)*qn/1e6))}}function v9(e){let t=m9(e,i9),n=t<=0n?0:t>BigInt(2**53-1)?2**53-1:Number(t),r=p9(e,a9),i=m9(e,a9),a=Number(m9(r,f9)),o=Math.min(Math.max(a,0),c9-1),s=r-BigInt(o)*f9,c=Number(s/o9),l=Math.min(Math.max(c,0),s9-1),u=u9[Number(p9(i,BigInt(l9)))];return{pulse:n,beat:o,stepIndex:l,harmonicDay:u,chakraDay:d9[u]}}function y9(e){let[t,n]=(0,C.useState)(()=>_9()),r=(0,C.useRef)(null);return(0,C.useEffect)(()=>{if(r.current!==null&&(window.clearTimeout(r.current),r.current=null),!e)return;let t=()=>{let e=_9();n(t=>t.pulse===e.pulse?t:e),r.current=window.setTimeout(t,e.msToNext)};return t(),()=>{r.current!==null&&window.clearTimeout(r.current),r.current=null}},[e]),t}function b9(e){let[t,n]=(0,C.useState)(qn/1e3),r=(0,C.useRef)(null);return(0,C.useEffect)(()=>{if(r.current!==null&&(cancelAnimationFrame(r.current),r.current=null),!e)return;let t=()=>{let e=i9-_9().μInPulse,i=Number(e)*qn/1e6;n(Math.max(0,i/1e3)),r.current=requestAnimationFrame(t)};return r.current=requestAnimationFrame(t),()=>{r.current!==null&&cancelAnimationFrame(r.current),r.current=null}},[e]),e?t:null}function x9(){return _9().pulse}var S9=()=>{let e=(0,C.useRef)(null),t=(0,C.useRef)(null),n=(0,C.useRef)(null),r=(0,C.useRef)(null),i=y9(!0),a=(0,C.useMemo)(()=>v9(i.pμ),[i.pμ]);b9(!0);let o=a.pulse;(0,C.useMemo)(()=>`${a.beat}:${String(a.stepIndex).padStart(2,`0`)}`,[a.beat,a.stepIndex]);let[s,c]=(0,C.useState)(null),[l,u]=(0,C.useState)(null),[d,p]=(0,C.useState)(null),[m,h]=(0,C.useState)(null),[g,_]=(0,C.useState)(null),[v,y]=(0,C.useState)(null),[b,x]=(0,C.useState)(null),[S,w]=(0,C.useState)(null),[T,E]=(0,C.useState)(null),[D,k]=(0,C.useState)(null),[A,j]=(0,C.useState)(null),[M,N]=(0,C.useState)(`PHI`),[P,F]=(0,C.useState)(``),[I,L]=(0,C.useState)(``),[R,z]=(0,C.useState)(`idle`),[B,V]=(0,C.useState)(`summary`),[H,U]=(0,C.useState)(null),[ee,te]=(0,C.useState)(!1),[ne,re]=(0,C.useState)(null),[ie,ae]=(0,C.useState)(!1),[oe,se]=(0,C.useState)(``),[ce,le]=(0,C.useState)(``),[ue,de]=(0,C.useState)(!1),[fe,pe]=(0,C.useState)(!1),[me,he]=(0,C.useState)(null),[ge,_e]=(0,C.useState)(!1);(0,C.useEffect)(()=>{let e=n.current;e&&(ge?e.setAttribute(`data-rotate`,`true`):e.removeAttribute(`data-rotate`))},[ge]);let[ve,ye]=(0,C.useState)(null);(0,C.useEffect)(()=>{(async()=>{try{ye(await X5())}catch(e){Mo(`loadOrCreateKeypair`,e)}})()},[]),(0,C.useEffect)(()=>{let e=!0;return(async()=>{try{let t=await fetch(`/verification_key.json`,{cache:`no-store`});if(!t.ok)return;let n=await t.json();if(!e)return;window.SIGIL_ZK_VKEY=n}catch(e){Mo(`fetch(/verification_key.json)`,e)}})(),()=>{e=!1}},[]);let[be,xe]=(0,C.useState)(null),[Se,Ce]=(0,C.useState)(null),we=()=>tc(n.current),Te=()=>{U(null),z(`idle`),V(`summary`),te(!1),F(``),L(``),j(null),e.current&&(e.current.value=``),t.current&&(t.current.value=``),n.current?.close(),n.current?.setAttribute(`data-open`,`false`)},Ee=(0,C.useMemo)(()=>ss({meta:m,sigilSvgRaw:me,verifyUrl:oe||(typeof window<`u`?window.location.href:``),pulseNow:o}),[m,me,oe,o]),De=()=>nc(n.current,()=>{let e=r.current;if(!e)return;let t=ss({meta:m,sigilSvgRaw:me,verifyUrl:oe||(typeof window<`u`?window.location.href:``),pulseNow:o}),n={getNoteData:async()=>t};window.KKVerifier=n;try{window.dispatchEvent(new CustomEvent(`kk:note-data`,{detail:t}))}catch(e){Mo(`dispatch(kk:note-data)`,e)}tc(e),pe(!0)}),Oe=()=>{let e=r.current;e?.close(),e?.setAttribute(`data-open`,`false`),pe(!1)},ke=()=>nc(n.current,()=>de(!0)),Ae=()=>de(!1),je=async e=>{if(!m)return;let t=gu(m,e);h(t),p(JSON.stringify(t,null,2)),s&&c7(await r7(s,t),`${s7(`sigil_with_valuation`,t.pulse??0,o)}.svg`),de(!1)},Me=(0,C.useCallback)(async e=>{let t=e.transfers??[],n=await(await O(async()=>{let{computeHeadWindowRoot:e}=await import(`./sigilUtils-CQzAWmTd.js`);return{computeHeadWindowRoot:e}},[])).computeHeadWindowRoot(t);if(e.transfersWindowRoot=n,t.length>0){let r=await Promise.all(t.map(Ns)),i=r.length-1,a=await Ts(r,i),o=await Es(n,a),s=await v7(e,{kind:`head`,windowMerkleRoot:n,transferProof:a});re({ok:o&&s,index:i,root:n})}else re(null);try{e.transfersWindowRootV14=await ws(await Promise.all((e.hardenedTransfers??[]).map(async e=>_s(ks({previousHeadRoot:e.previousHeadRoot,senderPubKey:e.senderPubKey,senderSig:e.senderSig,senderKaiPulse:e.senderKaiPulse,nonce:e.nonce,transferLeafHashSend:e.transferLeafHashSend,receiverPubKey:e.receiverPubKey,receiverSig:e.receiverSig,receiverKaiPulse:e.receiverKaiPulse,transferLeafHashReceive:e.transferLeafHashReceive,zkSend:e.zkSend??null,zkReceive:e.zkReceive??null})))))}catch(e){Mo(`refreshHeadWindow.buildMerkleRoot(v14)`,e)}try{await D7(e),h({...e})}catch(e){Mo(`refreshHeadWindow.verifyZkOnHead`,e)}return e},[]),Ne=(0,C.useCallback)(async e=>{let t=e.canonicalHash?.toLowerCase()||(await _s(`${e.pulse}|${e.beat}|${e.stepIndex}|${e.chakraDay}`)).toLowerCase();return e.childOfHash?.toLowerCase()&&(e.canonicalHash?.toLowerCase()??``)!==t?!0:(e.canonicalHash?.toLowerCase()??``)!==t},[]),Pe=(0,C.useCallback)(async e=>{let t=e.canonicalHash?.toLowerCase()||(await _s(`${e.pulse}|${e.beat}|${e.stepIndex}|${e.chakraDay}`)).toLowerCase();if(await Ne(e)){let t=e.canonicalHash.toLowerCase(),n=!!e.sendLock?.used,r=!!(e.transfers??[]).slice(-1)[0]?.receiverSignature;return{canonical:t,context:n||r?`parent`:`derivative`}}let n=(e.transfers??[]).slice(-1)[0],r=(e.hardenedTransfers??[]).slice(-1)[0];if(!(n&&!n.receiverSignature))return{canonical:t,context:`parent`};let i=n?await Fs(n):``,a=r?.previousHeadRoot||e.transfersWindowRootV14||e.transfersWindowRoot||``;return{canonical:(await _s(ks({parent:t,nonce:e.transferNonce||``,senderStamp:n?.senderStamp||``,senderKaiPulse:n?.senderKaiPulse||0,prevHead:a,leafSend:i}))).toLowerCase(),context:`derivative`}},[Ne]),Fe=async e=>{let t=e.target.files?.[0];if(!t)return;try{he(await t.text())}catch(e){Mo(`handleSvg.readFile`,e),he(null)}u(t.name||null),U(null),j(null),V(`summary`),te(!1);let n=URL.createObjectURL(t);c(n);let{meta:r,contextOk:i,typeOk:a}=await t7(t);r.segmentSize??=hs;let o=(r.segments??[]).reduce((e,t)=>e+(t.count||0),0);typeof r.cumulativeTransfers!=`number`&&(r.cumulativeTransfers=o+(r.transfers?.length??0)),(r.segments?.length??0)>0&&!r.segmentsMerkleRoot&&(r.segmentsMerkleRoot=await ws((r.segments??[]).map(e=>e.root)));let{sig:s,rgb:l}=await n7(n,typeof r.pulse==`number`?r.pulse:x9());E(s),k(l);let d=await As(r);_(d);let f=d&&r.kaiSignature?d.toLowerCase()===r.kaiSignature.toLowerCase():null;if(y(f),r.kaiSignature){let e=await js(r.kaiSignature);x(e),w(r.userPhiKey?e===r.userPhiKey:null)}else x(null),w(null);try{if(r.creatorPublicKey){let e=await Ss(r.creatorPublicKey);r.userPhiKey||=e}}catch(e){Mo(`handleSvg.phiFromPublicKey`,e)}let m=typeof r.pulse==`number`&&typeof r.beat==`number`&&typeof r.stepIndex==`number`&&typeof r.chakraDay==`string`,g=r.transfers?.slice(-1)[0],v=g?.receiverSignature||g?.senderSignature||null,b=v&&s?v===s:null,S=!!(r.transfers&&r.transfers.length>0),C=!!(g&&!g.receiverSignature),T=!!(g&&g.receiverSignature),D=!r.kaiSignature,O=await Me(r),A=null;try{let e=await Pe(O);xe(e.canonical),Ce(e.context),A=e.context}catch(e){Mo(`computeEffectiveCanonical`,e),xe(null),Ce(null)}let{used:M,expired:P}=cs(O,x9()),{expired:I}=ls(O,x9());h(O),p(JSON.stringify(O,null,2)),z(us({contextOk:i,typeOk:a,hasCore:m,contentSigMatches:f,isOwner:b,hasTransfers:S,lastOpen:C,lastClosed:T,isUnsigned:D,childUsed:M,childExpired:P,parentOpenExpired:I,isChildContext:A===`derivative`})),N(`PHI`),F(``),L(``),we(),e.target&&(e.target.value=``)},Ie=async e=>{let t=e.target.files?.[0];t&&j(await l7(t))},Le=async()=>{if(!m||!s)return;let e={...m},t=x9();if(!e.kaiSignature){let t=await As(e);if(!t){U(`Cannot compute kaiSignature — missing core fields.`);return}e.kaiSignature=t}!e.userPhiKey&&e.kaiSignature&&(e.userPhiKey=await js(e.kaiSignature)),typeof e.kaiPulse!=`number`&&(e.kaiPulse=t);try{!e.creatorPublicKey&&ve&&(e.creatorPublicKey=ve.spkiB64u)}catch(e){Mo(`sealUnsigned.creatorPublicKey`,e)}c7(await r7(s,e),`${o7(`sigil_sealed`,t)}.svg`);let n=await Me(e);h(n),p(JSON.stringify(n,null,2)),z(e=>e===`unsigned`?`readySend`:e),U(null)};async function Re(e,t){let n=JSON.parse(JSON.stringify(e));return n.canonicalHash=t.childCanonical,n.childOfHash=t.parentCanonical,n.childAllocationPhi=t.allocationPhiStr,n.childIssuedPulse=t.issuedPulse,n.childClaim={steps:7,expireAtPulse:t.issuedPulse+77},n.sendLock={nonce:e.transferNonce,used:!1},n.branchBasePhi=t.allocationPhiStr,n.branchSpentPhi=`0`,n}let ze=(0,C.useCallback)(async e=>{let t=e.canonicalHash?.toLowerCase()||(await _s(`${e.pulse}|${e.beat}|${e.stepIndex}|${e.chakraDay}`)).toLowerCase(),r=(e.transfers??[]).slice(-1)[0],i=(e.hardenedTransfers??[]).slice(-1)[0],a=r?await Fs(r):``,o=(await _s(ks({parent:t,nonce:e.transferNonce||``,senderStamp:r?.senderStamp||``,senderKaiPulse:r?.senderKaiPulse||0,prevHead:i?.previousHeadRoot||e.transfersWindowRootV14||e.transfersWindowRoot||``,leafSend:a}))).toLowerCase(),s=e.transferNonce||Ws(),c=e.chakraDay||`Root`,l={pulse:e.pulse,beat:e.beat,stepIndex:e.stepIndex,chakraDay:c,kaiSignature:e.kaiSignature,userPhiKey:e.userPhiKey},u={steps:7,expireAtPulse:(r?.senderKaiPulse??x9())+77,stepsPerBeat:e.stepsPerBeat??44},d;try{if(r?.payload?.mime?.startsWith(`application/vnd.kairos-exhale`)){let e=JSON.parse(Po(r.payload.encoded));e?.kind===`exhale`&&(d={unit:e.unit,amountPhi:e.amountPhi,amountUsd:e.amountUsd,usdPerPhi:e.usdPerPhi})}}catch(e){Mo(`shareTransferLink.previewDecode`,e)}let f={...l,canonicalHash:o,parentHash:t,transferNonce:s,claim:u,preview:d},p=``;try{let{makeSigilUrl:e}=await O(async()=>{let{makeSigilUrl:e}=await import(`./sigilUrl-Bbrnoz50.js`);return{makeSigilUrl:e}},[]);p=e(o,l)}catch(e){Mo(`shareTransferLink.makeSigilUrl`,e);let t=new URL(typeof window<`u`?window.location.href:`http://localhost`);t.pathname=`/s/${o}`,p=t.toString()}let m;try{let{encodeSigilHistory:t}=await O(async()=>{let{encodeSigilHistory:e}=await import(`./sigilUrl-Bbrnoz50.js`);return{encodeSigilHistory:e}},[]),n=[];for(let t of e.transfers??[])!t?.senderSignature||typeof t.senderKaiPulse!=`number`||n.push(typeof t.receiverSignature==`string`&&typeof t.receiverKaiPulse==`number`?{s:t.senderSignature,p:t.senderKaiPulse,r:t.receiverSignature}:{s:t.senderSignature,p:t.senderKaiPulse});let r=t(n);m=r.startsWith(`h:`)?r.slice(2):r}catch(e){Mo(`shareTransferLink.encodeSigilHistory`,e)}let h=qs(p,f,s,m);se(h),le(o),_e(!0),r9(h),nc(n.current,()=>ae(!0));try{fs([t],s)}catch(e){Mo(`shareTransferLink.publishRotation`,e)}},[]),Be=(0,C.useCallback)(async e=>{h(e),p(JSON.stringify(e,null,2));let t=typeof e.pulse==`number`&&typeof e.beat==`number`&&typeof e.stepIndex==`number`&&typeof e.chakraDay==`string`,n=e.transfers?.slice(-1)[0],r=n?.receiverSignature||n?.senderSignature||null,i=r&&T?r===T:null,a=!!(e.transfers&&e.transfers.length>0),o=!!(n&&!n.receiverSignature),s=!!(n&&n.receiverSignature),c=!e.kaiSignature,l=null;try{let t=await Pe(e);xe(t.canonical),Ce(t.context),l=t.context}catch(e){Mo(`syncMetaAndUi.computeEffectiveCanonical`,e),xe(null),Ce(null)}let{used:u,expired:d}=cs(e,x9()),{expired:f}=ls(e,x9());z(us({contextOk:!0,typeOk:!0,hasCore:t,contentSigMatches:g&&e.kaiSignature?g.toLowerCase()===e.kaiSignature.toLowerCase():null,isOwner:i,hasTransfers:a,lastOpen:o,lastClosed:s,isUnsigned:c,childUsed:u,childExpired:d,parentOpenExpired:f,isChildContext:l===`derivative`}))},[T,Pe,g]),Ve=(0,C.useCallback)(e=>{let t=(e||``).trim();return t?(t.startsWith(`.`)&&(t=`0`+t),t=t.replace(/\.?$/,e=>/\.\d/.test(t)?e:``),t):`0`},[]),He=(0,C.useCallback)(e=>new Intl.NumberFormat(void 0,{minimumFractionDigits:2,maximumFractionDigits:2,useGrouping:!0}).format(Math.max(0,e||0)),[]),Ue=(0,C.useMemo)(()=>typeof navigator<`u`&&typeof navigator.share==`function`,[]);(0,C.useEffect)(()=>()=>{if(s?.startsWith(`blob:`))try{URL.revokeObjectURL(s)}catch(e){Mo(`revokeObjectURL`,e)}},[s]);let We=(0,C.useMemo)(()=>{if(!m)return null;let e=m,t=typeof e.stepsPerBeat==`number`?e.stepsPerBeat:12,n=e.transfersWindowRoot??e.transfersWindowRootV14??``;return{pulse:m.pulse,beat:m.beat,stepIndex:m.stepIndex,stepsPerBeat:t,chakraDay:m.chakraDay||`Root`,kaiSignature:m.kaiSignature??``,userPhiKey:m.userPhiKey??``,transfersWindowRoot:n,canonicalContext:Se??void 0,childOfHash:e.childOfHash??void 0,sendLock:e.sendLock??void 0,childClaim:e.childClaim??void 0,childAllocationPhi:e.childAllocationPhi??void 0,branchBasePhi:e.branchBasePhi??void 0,valuationSource:e.valuationSource,stats:e.stats,fileName:l??void 0}},[m,Se,l]),Ge=(0,C.useMemo)(()=>{if(!m)return null;let e=sc(m,[`chakraGate`,`valuationSource.chakraGate`])||cc(m,`data-chakra-gate`)||null;return e?e.replace(/\bgate\b/gi,``).replace(/\s{2,}/g,` `).trim()||e:null},[m]),[Ke,qe]=(0,C.useState)(null);(0,C.useEffect)(()=>{let e=!1;return(async()=>{if(!We){qe(null);return}let t=(m?.canonicalHash)?.toLowerCase()||(await _s(`${We.pulse}|${We.beat}|${We.stepIndex}|${We.chakraDay}`)).toLowerCase();try{let{seal:n}=await hu(We,o,_s,m?.transfersWindowRoot||m?.transfersWindowRootV14||``);e||qe({hash:t,value:n.valuePhi??0,pulseCreated:We.pulse??o,meta:We})}catch(n){Mo(`buildValueSeal`,n),e||qe({hash:t,value:0,pulseCreated:We.pulse??o,meta:We})}})(),()=>{e=!0}},[We,m,o]),(0,C.useEffect)(()=>{!fe||me||!s||(async()=>{try{he(await fetch(s).then(e=>e.text()))}catch(e){Mo(`ensureRawSvgForNote`,e)}})()},[fe,me,s]);let Je=Wu,{usdPerPhi:Ye}=(0,C.useMemo)(()=>{try{return{usdPerPhi:Qu({meta:We??{pulse:0,beat:0,stepIndex:0,stepsPerBeat:12,chakraDay:`Root`,kaiSignature:``,userPhiKey:``,transfersWindowRoot:``},nowPulse:o,usd:100,currentStreakDays:0,lifetimeUsdSoFar:0},Je).usdPerPhi??0}}catch(e){return Mo(`quotePhiForUsd`,e),{usdPerPhi:0}}},[We,o,Je]),Xe=(0,C.useMemo)(()=>Ro(m?.branchBasePhi??``),[m]),Ze=(0,C.useMemo)(()=>Ro(m?.branchSpentPhi??`0`),[m]),Qe=(0,C.useMemo)(()=>{let e=m?.transfers??[];for(let t=e.length-1;t>=0;--t)if(e[t]?.receiverSignature)return t;return e.length>0?e.length-1:-1},[m?.transfers]),$e=(0,C.useMemo)(()=>{let e=m?.transfers??[],t=0;for(let n=e.length-1;n>=0;--n)if(e[n]?.receiverSignature&&++t===2)return n;return-1},[m?.transfers]),et=(0,C.useMemo)(()=>(m?.transfers??[]).slice(-1)[0],[m?.transfers]),tt=(0,C.useMemo)(()=>Se===`derivative`,[Se]),nt=(0,C.useMemo)(()=>{if(tt){let e=m?.childAllocationPhi;if(e){let t=Ro(e);if(t>0n)return t}let t=Ro(zo(Go(et)));return t>0n?t:0n}if(Xe>0n)return Xe;if(Qe>=0&&m?.transfers){let e=Go(m.transfers[Qe]);return e>0n?e:0n}return Ro(String(Ke?.value??0)||`0`)},[tt,m,et,Xe,Qe,Ke]),rt=(0,C.useMemo)(()=>{try{let e=m?.transfers??[],t=0n;for(let n=Math.max(0,Qe+1);n{try{let e=m?.transfers??[];if(Qe<=0)return 0n;let t=Math.max(0,$e+1),n=Math.max(t,Qe),r=0n;for(let i=t;i{if(!be)return 0n;try{return K7(be)}catch(e){return Mo(`ledgerSpentScaled`,e),0n}},[be]),ot=(0,C.useMemo)(()=>Ze>it?Ze:it,[Ze,it]),st=(0,C.useMemo)(()=>tt?0n:ot+rt,[tt,ot,rt]),ct=(0,C.useMemo)(()=>at>st?at:st,[at,st]),lt=(0,C.useMemo)(()=>nt>ct?nt-ct:0n,[nt,ct]),ut=(0,C.useMemo)(()=>Uo(Ho(lt,4),4),[lt]),dt=(0,C.useMemo)(()=>Jo(Number(zo(lt))),[lt]),ft=(0,C.useMemo)(()=>Ro((Ye||0).toFixed(18)),[Ye]),pt=(0,C.useMemo)(()=>Number(zo(Bo(lt,ft)))||0,[lt,ft]),[mt,ht]=(0,C.useState)(`flat`),[gt,_t]=(0,C.useState)(`flat`),[vt,yt]=(0,C.useState)(!1),[bt,xt]=(0,C.useState)(!1),St=(0,C.useRef)(dt),Ct=(0,C.useRef)(pt),wt=(0,C.useRef)(dt),Tt=(0,C.useRef)(Math.round(pt*100)/100),Et=(0,C.useRef)(null),Dt=(0,C.useRef)(null);(0,C.useEffect)(()=>{St.current=dt},[dt]),(0,C.useEffect)(()=>{Ct.current=pt},[pt]),(0,C.useEffect)(()=>{let e=1e-9,t=()=>{let t=St.current,n=t-wt.current,r=n>e?`up`:n<-e?`down`:`flat`;r!==`flat`&&Math.abs(n)>e?(ht(r),yt(!0),Et.current&&window.clearTimeout(Et.current),Et.current=window.setTimeout(()=>yt(!1),420)):ht(`flat`),wt.current=t;let i=Math.round(Ct.current*100)/100,a=i-Tt.current,o=a>e?`up`:a<-e?`down`:`flat`;o!==`flat`&&Math.abs(a)>e?(_t(o),xt(!0),Dt.current&&window.clearTimeout(Dt.current),Dt.current=window.setTimeout(()=>xt(!1),420)):_t(`flat`),Tt.current=i};wt.current=St.current,Tt.current=Math.round(Ct.current*100)/100;let n=window.setInterval(t,EC);return()=>{window.clearInterval(n),Et.current&&window.clearTimeout(Et.current),Dt.current&&window.clearTimeout(Dt.current)}},[]);let[Ot,kt]=(0,C.useState)(!1),[At,jt]=(0,C.useState)(`phi`),[Mt,Nt]=(0,C.useState)(0),Pt=(0,C.useCallback)(e=>{jt(e),kt(!0),Nt(e=>e+1)},[]);(0,C.useEffect)(()=>{Ot&&Nt(e=>e+1)},[Ot,At]);let Ft=(0,C.useCallback)(()=>{kt(!1)},[]);(0,C.useEffect)(()=>{if(!Ot)return;let e=e=>{e.key===`Escape`&&Ft()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Ot,Ft]);let It=(0,C.useMemo)(()=>{if(M===`PHI`){let e=$o(Qo(Ve(P))),t=Bo(Ro(e),ft),n=Number(zo(t));return{displayLeftLabel:`Φ`,displayRight:Number.isFinite(n)?`$ ${He(n)}`:`$ 0.00`,phiStringToSend:e,usdNumberAtSend:Number.isFinite(n)?n:0}}let e=Ro(I),t=Vo(e,ft),n=Uo(Ho(t,6),6);return{displayLeftLabel:`$`,displayRight:`≈ Φ ${Uo(Ho(t,4),4)}`,phiStringToSend:n,usdNumberAtSend:Number(zo(e))||0}},[M,P,I,ft,He,Ve]),Lt=(0,C.useMemo)(()=>Ro(It.phiStringToSend||`0`)>0n&&Ro(It.phiStringToSend||`0`)<=lt,[It.phiStringToSend,lt]),Rt=(0,C.useCallback)(async()=>{if(!m||!s)return;let e=await r7(s,m),t=await fetch(e).then(e=>e.blob()),n=null;try{n=await i7(e,1024)}catch(e){Mo(`pngBlobFromSvgDataUrl`,e)}let{default:r}=await O(async()=>{let{default:e}=await import(`./jszip.min-DiUCJUtt.js`).then(f(1));return{default:e}},[]),i=new r,a=s7(`sigil_bundle`,m.pulse??0,m.transfers?.slice(-1)[0]?.senderKaiPulse??m.kaiPulse??x9());i.file(`${a}.svg`,t),n&&i.file(`${a}.png`,n),c7(await i.generateAsync({type:`blob`}),`${a}.zip`)},[m,s]),zt=(0,C.useMemo)(()=>(l||``).toLowerCase().includes(`sigil_send`),[l]),Bt=async()=>{if(!m||!s||!T)return;if(m.kaiSignature&&g&&m.kaiSignature.toLowerCase()!==g.toLowerCase()){U(`Content signature mismatch — cannot send.`),z(`sigMismatch`);return}let e={...m};if(!e.kaiSignature){let t=await As(e);if(!t){U(`Cannot compute kaiSignature — missing core fields.`);return}e.kaiSignature=t,e.userPhiKey||=await js(t)}typeof e.kaiPulse!=`number`&&(e.kaiPulse=x9());let t=x9(),n=await _s(`${T}-${e.pulse??0}-${t}`),r=(It.phiStringToSend||``).trim(),i=Ro(r);if(i<=0n){U(`Enter a Φ amount greater than zero.`);return}if(i>lt){U(`Exhale exceeds resonance Φ — requested Φ ${Uo(i,4)} but only Φ ${ut} remains on this glyph.`);return}let a=Number.isFinite(It.usdNumberAtSend)?Math.max(0,It.usdNumberAtSend):0,o;{let n={kind:`exhale`,unit:M,amountPhi:r,amountUsd:a.toFixed(2),usdPerPhi:Ye||0,atPulse:t,kaiSignature:e.kaiSignature||``,userPhiKey:e.userPhiKey||``};o={name:`exhale_${r.replace(/\./g,`_`)}phi.json`,mime:`application/vnd.kairos-exhale+json`,size:No(JSON.stringify(n)).length,encoded:No(JSON.stringify(n))}}!o&&A&&(o=A);let c={senderSignature:T,senderStamp:n,senderKaiPulse:t,payload:o??void 0},l={...e,"@context":e[`@context`]??`https://schema.phi.network/sigil/v1`,type:e.type??`application/phi.kairos.sigil+svg`,canonicalHash:e.canonicalHash||void 0,transferNonce:e.transferNonce||Ws(),transfers:[...e.transfers??[],c],segmentSize:e.segmentSize??2e3};try{let e=Ro(m?.branchSpentPhi??`0`)+i;l.branchBasePhi=m?.branchBasePhi??zo(nt),l.branchSpentPhi=zo(e)}catch(e){Mo(`send.persistBranchProgress`,e)}let u=``,d=``,f=``,p=``;try{if(u=l.canonicalHash?.toLowerCase()||(await _s(`${l.pulse}|${l.beat}|${l.stepIndex}|${l.chakraDay}`)).toLowerCase(),ve){l.creatorPublicKey??=ve.spkiB64u,p=await zs(l,l.hardenedTransfers?.length??0),f=await Fs(c);let e=l.transferNonce,n=await O(()=>import(`./sigilUtils-CQzAWmTd.js`),[]),r=n.buildSendMessageV14(l,{previousHeadRoot:p,senderKaiPulse:t,senderPubKey:l.creatorPublicKey,nonce:e,transferLeafHashSend:f}),i=await Z5(ve.priv,r),a={previousHeadRoot:p,senderPubKey:l.creatorPublicKey,senderSig:i,senderKaiPulse:t,nonce:e,transferLeafHashSend:f};if(window.SIGIL_ZK?.provideSendProof)try{let t=await window.SIGIL_ZK.provideSendProof({meta:l,leafHash:f,previousHeadRoot:p,nonce:e});if(t){a.zkSendBundle={scheme:`groth16`,curve:`BLS12-381`,proof:t.proof,publicSignals:t.publicSignals,vkey:t.vkey};let e=await n.hashAny(t.publicSignals),r=await n.hashAny(t.proof),i=t.vkey??l.zkVerifyingKey??window.SIGIL_ZK_VKEY;a.zkSend={scheme:`groth16`,curve:`BLS12-381`,publicHash:e,proofHash:r,vkeyHash:i?await n.hashAny(i):void 0}}}catch(e){Mo(`provideSendProof`,e)}l.hardenedTransfers=[...l.hardenedTransfers??[],a]}d=(await _s(ks({parent:u,nonce:l.transferNonce||``,senderStamp:c.senderStamp||``,senderKaiPulse:c.senderKaiPulse||0,prevHead:p||l.transfersWindowRootV14||l.transfersWindowRoot||``,leafSend:f}))).toLowerCase();let e={parentCanonical:u,childCanonical:d,amountPhiScaled:Ro(r).toString(),senderKaiPulse:t,transferNonce:l.transferNonce,senderStamp:n,previousHeadRoot:p,transferLeafHashSend:f};try{await U7(e)}catch(e){Mo(`recordSend`,e)}try{rc().registerSend?.(e)}catch(e){Mo(`__SIGIL__.registerSend`,e)}try{window.dispatchEvent(new CustomEvent(`sigil:sent`,{detail:e}))}catch(e){Mo(`dispatchEvent(sigil:sent)`,e)}}catch(e){Mo(`send.hardenedBuild/ledger`,e)}if(c7(await r7(s,await Re(l,{parentCanonical:u,childCanonical:d,allocationPhiStr:r,issuedPulse:t})),`${s7(`sigil_send`,l.pulse??0,t)}.svg`),(l.transfers??[]).length>=(l.segmentSize??2e3)){let{meta:e,segmentFileBlob:n}=await _7(l);n&&c7(n,`sigil_segment_${e.pulse??0}_${String((e.segments?.length??1)-1).padStart(6,`0`)}.json`),c7(await r7(s,e),`${s7(`sigil_head_after_seal`,e.pulse??0,t)}.svg`);let r=await Me(e);await Be(r),U(null),F(``),L(``),await ze(r);return}let h=await Me(l);await Be(h),U(null),F(``),L(``),await ze(h)},Vt=async()=>{if(!m||!s||!T)return;if(Se===`parent`){let{expired:e}=ls(m,x9());if(e){U(`This open send has expired.`);return}}let{used:e,expired:t}=cs(m,x9());if(e){U(`This transfer link has already been used.`);return}if(t){U(`This transfer link has expired.`),z(`complete`);return}let n=m.transfers?.slice(-1)[0];if(!n||n.receiverSignature)return;let r=x9(),i={...n,receiverSignature:T,receiverStamp:await _s(`${T}-${n.senderStamp}-${r}`),receiverKaiPulse:r},a={...m,transfers:[...(m.transfers??[]).slice(0,-1),i]};try{if(ve&&(a.hardenedTransfers?.length??0)>0){let e=a.hardenedTransfers[a.hardenedTransfers.length-1];if(!e.receiverSig){a.creatorPublicKey??=ve.spkiB64u;let t=await Ns(i),n=await O(()=>import(`./sigilUtils-CQzAWmTd.js`),[]),o=n.buildReceiveMessageV14({previousHeadRoot:e.previousHeadRoot,senderSig:e.senderSig,receiverKaiPulse:r,receiverPubKey:a.creatorPublicKey,transferLeafHashReceive:t}),s=await Z5(ve.priv,o),c={...e,receiverPubKey:a.creatorPublicKey,receiverSig:s,receiverKaiPulse:r,transferLeafHashReceive:t};if(window.SIGIL_ZK?.provideReceiveProof)try{let r=await window.SIGIL_ZK.provideReceiveProof({meta:a,leafHash:t,previousHeadRoot:e.previousHeadRoot,linkSig:e.senderSig});if(r){c.zkReceiveBundle={scheme:`groth16`,curve:`BLS12-381`,proof:r.proof,publicSignals:r.publicSignals,vkey:r.vkey};let e=await n.hashAny(r.publicSignals),t=await n.hashAny(r.proof),i=r.vkey??a.zkVerifyingKey??window.SIGIL_ZK_VKEY;c.zkReceive={scheme:`groth16`,curve:`BLS12-381`,publicHash:e,proofHash:t,vkeyHash:i?await n.hashAny(i):void 0}}}catch(e){Mo(`provideReceiveProof`,e)}a.hardenedTransfers=[...a.hardenedTransfers.slice(0,-1),c];try{let t=a.childOfHash?.toLowerCase()||(await _s(`${a.pulse}|${a.beat}|${a.stepIndex}|${a.chakraDay}`)).toLowerCase();e.transferLeafHashSend&&W7(t,e.transferLeafHashSend)}catch(e){Mo(`ledger.markConfirmedByLeaf`,e)}}}}catch(e){Mo(`receive.hardenedSeal`,e)}try{await Ne(a)&&(a.sendLock={...a.sendLock??{nonce:a.transferNonce},used:!0,usedPulse:r})}catch(e){Mo(`receive.setUsedLock`,e)}c7(await r7(s,a),`${s7(`sigil_receive`,a.pulse??0,r)}.svg`),await Be(await Me(a)),U(null)},Ht=(0,C.useCallback)(async()=>{if(!m||!m.transfers?.length)return;if(zt){U(`Segmentation is disabled on SEND sigils.`);return}let{meta:e,segmentFileBlob:t}=await _7(m);t&&c7(t,`sigil_segment_${e.pulse??0}_${String((e.segments?.length??1)-1).padStart(6,`0`)}.json`),s&&c7(await r7(s,e),`${s7(`sigil_head_after_seal`,e.pulse??0,x9())}.svg`),await Be(await Me(e)),U(null)},[m,s,zt,Me,Be]),Ut=(0,C.useMemo)(()=>sc(m,[`frequencyHz`,`valuationSource.frequencyHz`])||cc(m,`data-frequency-hz`),[m]),Wt=(0,C.useMemo)(()=>is(m??{}),[m]),Gt=(0,C.useMemo)(()=>{if(Se!==`derivative`)return null;let e=cs(m,o);if(!e.expireAt)return null;let t=Math.max(0,e.expireAt-o);return{leftPulses:t,leftSteps:Math.ceil(t/11),expireAt:e.expireAt}},[m,o,Se]),{used:Kt,expired:qt}=(0,C.useMemo)(()=>cs(m,o),[m,o]),Jt=(0,C.useMemo)(()=>ls(m,o).expired,[m,o]);function Yt({seriesKey:e,sampleMs:t,valuePhi:n,usdPerPhi:r,maxPoints:i=2048,snapKey:a}){let[o,s]=C.useState([]),c=C.useRef([]),l=C.useRef(n),u=C.useRef(r);C.useEffect(()=>{Number.isFinite(n)&&(l.current=n)},[n]),C.useEffect(()=>{Number.isFinite(r)&&r>0&&(u.current=r)},[r]);let d=C.useCallback(()=>{let e=x9(),t=Number.isFinite(l.current)?l.current:0,n=Number.isFinite(u.current)&&u.current>0?u.current:0,r=c.current;if(!r.length){let r=[{i:e-1,value:t,fx:n},{i:e,value:t,fx:n}];c.current=r,s(r);return}let a=r[r.length-1],o;o=a?.i===e?[...r.slice(0,-1),{...a,value:t,fx:n}]:typeof a?.i==`number`&&a.ii&&o.splice(0,o.length-i),c.current=o,s(o)},[i]);return C.useEffect(()=>{c.current=[],s([]),d()},[e,d]),C.useEffect(()=>{d()},[n,r,d]),C.useEffect(()=>{typeof a==`number`&&d()},[a,d]),C.useEffect(()=>{let e=window.setInterval(()=>{let e=x9(),t=c.current;if(t[t.length-1]?.i===e)return;let n={i:e,value:l.current,fx:u.current},r=t.length?[...t,n]:[n];r.length>i&&r.splice(0,r.length-i),c.current=r,s(r)},t);return()=>window.clearInterval(e)},[t,i]),o}let Xt=Yt({seriesKey:(0,C.useMemo)(()=>be||(m?`${m.pulse??`x`}|${m.beat??`x`}|${m.stepIndex??`x`}|${m.chakraDay??`x`}`:`none`),[be,m]),sampleMs:EC,valuePhi:dt,usdPerPhi:Ye,maxPoints:4096,snapKey:Mt}),Zt=(0,C.useMemo)(()=>{let e=Number(Ke?.value);return Number.isFinite(e)&&e>0?e:dt},[Ke,dt]);return(0,W.jsxs)(`div`,{className:`verifier-stamper`,role:`application`,style:{maxWidth:`100vw`,overflowX:`hidden`},children:[(0,W.jsx)(`div`,{className:`toolbar`,children:(0,W.jsxs)(`div`,{className:`toolbar-main`,children:[(0,W.jsx)(`div`,{className:`brand-lockup`,"aria-label":`Kairos live status`,children:(0,W.jsx)(`div`,{className:`brand-text`,children:(0,W.jsxs)(`div`,{className:`live-pulse`,children:[(0,W.jsx)(`span`,{className:`now`,children:`LIVE`}),(0,W.jsxs)(`span`,{className:`pulse-number`,children:[` ☤KAI `,o]})]})})}),(0,W.jsx)(`div`,{className:`toolbar-actions`,"aria-label":`Verifier actions`,children:(0,W.jsxs)(`button`,{className:`primary`,onClick:()=>e.current?.click(),type:`button`,children:[(0,W.jsx)(J7,{color:`#37FFE4`}),(0,W.jsxs)(`span`,{className:`phikey-label`,"aria-label":`PhiKey`,children:[(0,W.jsx)(`img`,{className:`phikey-mark`,src:`/phi.svg`,alt:`Φ`}),(0,W.jsx)(`span`,{className:`phikey-text`,children:`Key`})]})]})})]})}),(0,W.jsx)(`input`,{ref:e,type:`file`,accept:`.svg`,hidden:!0,onChange:Fe}),(0,W.jsx)(`dialog`,{ref:n,className:`glass-modal fullscreen`,id:`verifier-dialog`,"data-open":`false`,"aria-label":`Kai-Sigil Verifier Modal`,style:Y7.full,children:(0,W.jsxs)(`div`,{className:`modal-viewport`,style:Y7.viewport,children:[(0,W.jsxs)(`div`,{className:`modal-topbar`,style:Y7.gridBar,children:[(0,W.jsx)(`div`,{className:`status-strip`,"aria-live":`polite`,style:Y7.valueStrip,children:(0,W.jsx)(mc,{uiState:R,contentSigMatches:v,phiKeyMatches:S,meta:m,headProof:ne,canonicalContext:Se,childUsed:Kt,childExpired:qt,parentOpenExpired:Jt,isSendFilename:zt})}),(0,W.jsx)(`button`,{className:`close-btn holo`,"data-aurora":`true`,"aria-label":`Close`,title:`Close`,onClick:Te,style:{justifySelf:`end`,marginRight:8},children:`×`})]}),s&&m&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`header`,{className:`modal-header`,style:{paddingInline:16},children:[(0,W.jsx)(`img`,{src:s,alt:`Sigil thumbnail`,width:64,height:64,style:Y7.headerImg}),(0,W.jsxs)(`div`,{className:`header-fields`,style:{minWidth:0},children:[(0,W.jsxs)(`h2`,{style:{overflowWrap:`anywhere`},children:[`Pulse `,(0,W.jsx)(`span`,{children:m.pulse??`—`})]}),(0,W.jsxs)(`p`,{children:[`Beat `,(0,W.jsx)(`span`,{children:m.beat??`—`}),` · Step `,(0,W.jsx)(`span`,{children:m.stepIndex??`—`}),` · Day:`,` `,(0,W.jsx)(`span`,{children:Wt??m.chakraDay??`—`})]}),(0,W.jsxs)(`div`,{className:`value-strip`,"aria-live":`polite`,children:[(0,W.jsxs)(Q7,{kind:`phi`,trend:mt,flash:vt,title:Se===`derivative`?`Resonance Φ for this derivative glyph`:`Resonance Φ on this glyph`,ariaLabel:`Open live chart for Φ value`,onClick:()=>Pt(`phi`),children:[(0,W.jsx)(`span`,{className:`sym`,children:`Φ`}),dt.toFixed(6)]}),(0,W.jsxs)(Q7,{kind:`usd`,trend:gt,flash:bt,title:`Indicative USD (issuance model)`,ariaLabel:`Open live chart for USD value`,onClick:()=>Pt(`usd`),children:[(0,W.jsx)(`span`,{className:`sym`,children:`$`}),He(pt)]})]}),zt&&(0,W.jsxs)(`div`,{className:`child-banner tooltip-container`,style:{fontSize:10,opacity:.9,marginTop:6},children:[(0,W.jsx)(`strong`,{children:`7 Steps from Exhale`}),` `,(0,W.jsx)(`span`,{className:`tooltip-trigger`,children:`INHALE:`}),(0,W.jsx)(`div`,{className:`tooltip`,children:`You have 7 steps (77 pulses) to inhale & seal this Sigil. After this period, INHALE is permanently finalized & the Sigil is eternally sealed.`})]})]})]}),Ot&&(0,W.jsx)(`div`,{className:`chart-popover-backdrop`,role:`dialog`,"aria-modal":`true`,"aria-label":`Live chart`,onMouseDown:Ft,onClick:Ft,style:Y7.popBg,children:(0,W.jsxs)(`div`,{className:`chart-popover`,onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),style:Y7.popCard,children:[(0,W.jsxs)(`div`,{className:`chart-popover-head`,style:Y7.popHead,children:[(0,W.jsx)(`div`,{style:Y7.popTitle,className:`chart-popover-title`,children:At===`phi`?`Φ Resonance · Live`:`$ Price · Live`}),(0,W.jsx)(`button`,{className:`close-btn holo`,"data-aurora":`true`,"aria-label":`Close chart`,title:`Close`,onClick:Ft,style:{width:40,height:40,display:`inline-flex`,alignItems:`center`,justifyContent:`center`},children:`×`})]}),(0,W.jsx)(`div`,{className:`chart-popover-body`,style:Y7.popBody,children:(0,W.jsx)(C.Suspense,{fallback:(0,W.jsx)(`div`,{style:{padding:16,color:`var(--dim)`},children:`Loading chart…`}),children:(0,W.jsx)(v6,{data:Xt,live:dt,pv:Zt,premiumX:1,momentX:1,colors:[`rgba(167,255,244,1)`],usdPerPhi:Ye,mode:At===`usd`?`usd`:`phi`,isChildGlyph:Se===`derivative`,reflowKey:Mt})})})]})}),(0,W.jsxs)(`nav`,{className:`tabs`,role:`tablist`,"aria-label":`Views`,style:Y7.stickyTabs,children:[(0,W.jsx)(`button`,{role:`tab`,"aria-selected":B===`summary`,className:B===`summary`?`active`:``,onClick:()=>V(`summary`),children:`Presence`}),(0,W.jsx)(`button`,{role:`tab`,"aria-selected":B===`lineage`,className:B===`lineage`?`active`:``,onClick:()=>V(`lineage`),children:`Stewardship`}),(0,W.jsx)(`button`,{role:`tab`,"aria-selected":B===`data`,className:B===`data`?`active`:``,onClick:()=>V(`data`),children:`Memory`}),(0,W.jsx)(`button`,{className:`secondary`,onClick:ke,disabled:!m,children:`Resonance`}),(0,W.jsx)(`button`,{className:`secondary`,onClick:De,disabled:!s,children:`Note`})]}),(0,W.jsxs)(`section`,{className:`modal-body`,role:`tabpanel`,style:Y7.modalBody,children:[B===`summary`&&(0,W.jsxs)(`div`,{className:`summary-grid`,children:[(0,W.jsx)(Z7,{k:`Now`,v:o}),Gt&&(0,W.jsx)(Z7,{k:`Inhale Seal:`,v:`${Gt.leftSteps} steps (${Gt.leftPulses} pulses) left`}),Se===`derivative`&&(()=>{let{expireAt:e}=cs(m,o);return typeof e==`number`&&Number.isFinite(e)?(0,W.jsx)(Z7,{k:`Inhale by:`,v:e}):null})(),m.userPhiKey&&(0,W.jsx)(Z7,{k:`Φ-Key:`,v:(0,W.jsxs)(W.Fragment,{children:[m.userPhiKey,b&&(S?(0,W.jsx)(`span`,{className:`chip ok`,children:`match`}):(0,W.jsx)(`span`,{className:`chip err`,children:`mismatch`}))]}),wide:!0,mono:!0}),m.kaiSignature&&(0,W.jsx)(Z7,{k:`Kai-Signature (Σ):`,v:(0,W.jsxs)(W.Fragment,{children:[m.kaiSignature,v===!0&&(0,W.jsx)(`span`,{className:`chip ok`,children:`match`}),v===!1&&(0,W.jsx)(`span`,{className:`chip err`,children:`mismatch`})]}),wide:!0,mono:!0}),Ut&&(0,W.jsx)(Z7,{k:`Frequency (Hz):`,v:Ut}),Ge&&(0,W.jsx)(Z7,{k:`Spiral Gate:`,v:Ge}),T&&(0,W.jsx)(Z7,{k:`PROOF OF BREATH™:`,v:T,wide:!0,mono:!0}),(0,W.jsx)(Z7,{k:`Stewardship Hash:`,v:be??`—`,wide:!0,mono:!0}),(0,W.jsx)(Z7,{k:Se===`derivative`?`Derivative Resonance`:`Resonance `,v:` Φ${ut}`}),(0,W.jsx)(Z7,{k:`Exhale key:`,v:m?.creatorPublicKey??`—`,wide:!0,mono:!0}),(0,W.jsx)(Z7,{k:`Exhale nonce:`,v:m.transferNonce??`—`,wide:!0,mono:!0}),(0,W.jsx)(Z7,{k:`Issued @ (derivative):`,v:m?.childIssuedPulse??`—`}),(0,W.jsx)(Z7,{k:`Derivative of (source):`,v:m?.childOfHash??`—`,wide:!0,mono:!0}),ne&&(0,W.jsx)(Z7,{k:`Latest proof:`,v:ne.ok?`#${ne.index+1} ✓`:`#${ne.index} ×`}),ne!==null&&(0,W.jsx)(Z7,{k:`Head proof root:`,v:ne.root,wide:!0,mono:!0}),(0,W.jsx)(Z7,{k:`Head proof root (v14):`,v:m?.transfersWindowRootV14??`—`,wide:!0,mono:!0}),Se===`parent`&&(()=>{let e=ls(m,o);return e.expireAt?(0,W.jsx)(Z7,{k:`Inhale expires @:`,v:e.expireAt}):null})(),Se===`derivative`&&m?.sendLock?.used&&(0,W.jsx)(Z7,{k:`One-time lock:`,v:`Used`}),(0,W.jsx)(Z7,{k:`Hardened transfers:`,v:m.hardenedTransfers?.length??0}),(0,W.jsx)(Z7,{k:`Segments:`,v:m.segments?.length??0}),(0,W.jsx)(Z7,{k:`Segment size:`,v:m.segmentSize??2e3}),(0,W.jsx)(Z7,{k:`Segment Depth:`,v:m.cumulativeTransfers??0}),(0,W.jsx)(Z7,{k:`Segment Tree Root:`,v:m.segmentsMerkleRoot??`—`,wide:!0,mono:!0}),D&&(0,W.jsx)(Z7,{k:`RGB seed:`,v:D.join(`, `)})]}),B===`lineage`&&(0,W.jsx)(`div`,{className:`lineage`,children:m.transfers?.length?(0,W.jsx)(`ol`,{className:`transfers`,children:m.transfers.map((e,t)=>{let n=!e.receiverSignature,r=m.hardenedTransfers?.[t],i=null;try{if(e.payload?.mime?.startsWith(`application/vnd.kairos-exhale`)){let t=JSON.parse(Po(e.payload.encoded));t?.kind===`exhale`&&(i={unit:t.unit,amountPhi:t.amountPhi,amountUsd:t.amountUsd,usdPerPhi:t.usdPerPhi})}}catch(e){Mo(`lineage.decodeExhalePayload`,e)}let a=``,o=``;try{i?.amountPhi&&(a=Wo(i.amountPhi),o=typeof i.amountUsd==`string`&&i.amountUsd?i.amountUsd:typeof i.usdPerPhi==`number`&&Number.isFinite(i.usdPerPhi)?He((Number(i.amountPhi)||0)*i.usdPerPhi):`0.00`)}catch(e){Mo(`lineage.computeDisplay`,e)}return(0,W.jsxs)(`li`,{className:n?`transfer open`:`transfer closed`,children:[(0,W.jsxs)(`header`,{children:[(0,W.jsxs)(`span`,{className:`index`,children:[`#`,t+1]}),(0,W.jsx)(`span`,{className:`state ${n?`open`:`closed`}`,children:n?`Pending receive`:`Sealed`})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Exhaler Σ`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:e.senderSignature})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Exhaler Seal:`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:e.senderStamp})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Exhaler Pulse`}),(0,W.jsx)(`span`,{className:`v`,children:e.senderKaiPulse})]}),i?.amountPhi&&(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Exhaled`}),(0,W.jsxs)(`span`,{className:`v`,children:[`Φ `,a,` · $`,o]})]}),r&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Prev-Head`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:r.previousHeadRoot})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Exhale leaf`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:r.transferLeafHashSend})]}),r.transferLeafHashReceive&&(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Inhale leaf`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:r.transferLeafHashReceive})]}),r.zkSend&&(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`ZK Exhale:`}),(0,W.jsxs)(`span`,{className:`v`,children:[r.zkSend.verified?`✓`:`•`,` `,r.zkSend.scheme]})]}),r.zkSend?.proofHash&&(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`ZK Exhale hash:`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:r.zkSend.proofHash})]}),r.zkReceive&&(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`ZK Inhale`}),(0,W.jsxs)(`span`,{className:`v`,children:[r.zkReceive.verified?`✓`:`•`,` `,r.zkReceive.scheme]})]}),r.zkReceive?.proofHash&&(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`ZK Inhale hash`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:r.zkReceive.proofHash})]})]}),e.receiverSignature&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Inhaler Σ`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:e.receiverSignature})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Inhaler Seal`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:e.receiverStamp})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Inhaler Pulse`}),(0,W.jsx)(`span`,{className:`v`,children:e.receiverKaiPulse})]})]}),e.payload&&(0,W.jsxs)(`details`,{className:`payload`,open:!0,children:[(0,W.jsx)(`summary`,{children:`Payload`}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Name`}),(0,W.jsx)(`span`,{className:`v`,children:e.payload.name})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`MIME`}),(0,W.jsx)(`span`,{className:`v`,children:e.payload.mime})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Size`}),(0,W.jsxs)(`span`,{className:`v`,children:[e.payload.size,` bytes`]})]})]})]},t)})}):(0,W.jsx)(`p`,{className:`empty`,children:`No stewardship yet — ready to exhale from Sigil-Glyph.`})}),B===`data`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`json-toggle`,children:(0,W.jsxs)(`label`,{children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:ee,onChange:()=>te(e=>!e)}),` View raw JSON`]})}),ee?(0,W.jsx)(`pre`,{className:`raw-json`,style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:d}):(0,W.jsx)(`div`,{className:`json-tree-wrap`,style:{overflowX:`hidden`},children:(0,W.jsx)(uc,{data:m})})]})]}),(0,W.jsxs)(`footer`,{className:`modal-footer`,style:{position:`sticky`,bottom:0},children:[H&&(0,W.jsx)(`p`,{className:`status error`,style:{overflowWrap:`anywhere`},children:H}),(0,W.jsxs)(`div`,{className:`footer-actions`,style:{display:`flex`,alignItems:`center`,gap:8,flexWrap:`wrap`,width:`100%`,boxSizing:`border-box`},children:[R===`unsigned`&&(0,W.jsx)(`button`,{className:`secondary`,onClick:Le,children:`Seal content (Σ + Φ)`}),(R===`readySend`||R===`verified`)&&(0,W.jsxs)(`div`,{className:`send-row no-zoom-input`,"data-nozoom":`true`,style:{display:`flex`,alignItems:`center`,gap:8,flex:`1 1 auto`,minWidth:0,fontSize:16,WebkitTextSizeAdjust:`100%`},children:[(0,W.jsx)(jo,{amountMode:M,setAmountMode:N,usdInput:I,phiInput:P,setUsdInput:L,setPhiInput:F,convDisplayRight:It.displayRight,remainingPhiDisplay4:ut,canonicalContext:Se,phiFormatter:e=>$o(Qo(Ve(e)))}),(0,W.jsx)($7,{className:`primary`,onClick:Bt,aria:`Exhale (send)`,titleText:Ue?`Exhale (seal & share)`:`Exhale (seal & copy link)`,disabled:!Lt,path:`M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z`})]}),(0,W.jsx)($7,{onClick:()=>t.current?.click(),aria:`Attach a file`,titleText:`Attach a file`,small:!0,path:`M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.2a2 2 0 01-2.83-2.83l8.49-8.49`}),(0,W.jsx)(`input`,{ref:t,type:`file`,hidden:!0,onChange:Ie}),R===`readyReceive`&&(0,W.jsx)($7,{className:`primary`,onClick:Vt,aria:`Inhale (receive)`,titleText:Se===`derivative`?qt?`Link expired`:Kt?`Link already used`:`Inhale`:Jt?`Send expired`:`Inhale`,disabled:Se===`derivative`&&(qt||Kt)||Se===`parent`&&Jt,path:`M2 22l11-11M2 22l20-7-9-4-4-9-7 20z`}),(m?.transfers?.length??0)>0&&(0,W.jsx)($7,{className:`secondary`,onClick:Ht,aria:`Segment head window`,titleText:`Roll current head-window into a segment (continuous)`,disabled:zt,small:!0,path:`M12 3l9 4-9 4-9-4 9-4zm-9 8l9 4 9-4M3 19l9 4 9-4`})]})]})]})]})}),(0,W.jsx)(Cc,{open:ie,url:oe,hash:ce,onClose:()=>{ae(!1),_e(!1),we()},onDownloadZip:Rt}),m&&We&&(0,W.jsx)(i8,{open:ue,onClose:Ae,meta:We,nowPulse:o,initialGlyph:Ke??void 0,onAttach:R===`verified`?je:void 0}),(0,W.jsx)(`dialog`,{ref:r,className:`glass-modal fullscreen`,id:`note-dialog`,"data-open":fe?`true`:`false`,"aria-label":`Note Exhaler`,style:Y7.full,children:(0,W.jsxs)(`div`,{className:`modal-viewport`,style:Y7.viewport,children:[(0,W.jsxs)(`div`,{className:`modal-topbar`,style:Y7.gridBar,children:[(0,W.jsx)(`div`,{style:{paddingInline:12,fontSize:12,color:`var(--dim)`},children:`Kairos — Note Exhaler`}),(0,W.jsx)(`button`,{className:`close-btn holo`,"data-aurora":`true`,"aria-label":`Close`,title:`Close`,onClick:Oe,style:{justifySelf:`end`,marginRight:8},children:`×`})]}),(0,W.jsx)(`div`,{style:{flex:`1 1 auto`,minHeight:0,overflowY:`auto`},children:me&&We?(0,W.jsx)(z5,{meta:We,initial:Ee}):me?(0,W.jsx)(`div`,{style:{padding:16,color:`var(--dim)`},children:`Missing valuation metadata for Note — upload/parse a sigil first.`}):(0,W.jsx)(`div`,{style:{padding:16,color:`var(--dim)`},children:`Load a sigil to print a note.`})})]})})]})};function C9(){return(0,W.jsx)(es,{onReset:()=>{},children:(0,W.jsx)(C.Suspense,{fallback:(0,W.jsx)(`div`,{style:{padding:16},children:`Loading…`}),children:(0,W.jsx)(S9,{})})})}var w9=C.lazy(()=>O(()=>import(`./SigilFeedPage-CYooRvDo.js`),__vite__mapDeps([25,17,8,6,7,9,18,20,2,3,21,22,14,23,24,26]))),T9=C.lazy(()=>O(()=>import(`./SigilPage-ECNAzu9S.js`),__vite__mapDeps([27,6,7,23,28,29]))),E9=C.lazy(()=>O(()=>import(`./PShort-CHrK750U.js`),[])),D9=C.lazy(()=>O(()=>import(`./VerifyPage-Qyj4E4nU.js`),__vite__mapDeps([30,11,31,32,33]))),O9=[()=>O(()=>import(`./SigilFeedPage-CYooRvDo.js`),__vite__mapDeps([25,17,8,6,7,9,18,20,2,3,21,22,14,23,24,26])),()=>O(()=>import(`./SigilPage-ECNAzu9S.js`),__vite__mapDeps([27,6,7,23,28,29])),()=>O(()=>import(`./PShort-CHrK750U.js`),[]),()=>O(()=>import(`./VerifyPage-Qyj4E4nU.js`),__vite__mapDeps([30,11,31,32,33]))];function k9(){return(0,W.jsxs)(`div`,{className:`route-loader`,role:`status`,"aria-live":`polite`,"aria-label":`Loading`,children:[(0,W.jsx)(`div`,{className:`route-loader__bg`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`route-loader__grid`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`route-loader__halo`,"aria-hidden":`true`}),(0,W.jsxs)(`div`,{className:`route-loader__stage`,children:[(0,W.jsxs)(`div`,{className:`route-loader__orb`,"aria-hidden":`true`,children:[(0,W.jsx)(`div`,{className:`route-loader__orb-ring route-loader__orb-ring--a`}),(0,W.jsx)(`div`,{className:`route-loader__orb-ring route-loader__orb-ring--b`}),(0,W.jsx)(`div`,{className:`route-loader__orb-ring route-loader__orb-ring--c`}),(0,W.jsx)(`div`,{className:`route-loader__orb-core`}),(0,W.jsx)(`span`,{className:`route-loader__spark route-loader__spark--a`}),(0,W.jsx)(`span`,{className:`route-loader__spark route-loader__spark--b`})]}),(0,W.jsx)(`div`,{className:`route-loader__content`,children:(0,W.jsxs)(`div`,{className:`route-loader__content-inner`,children:[(0,W.jsx)(`div`,{className:`route-loader__dot`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`route-loader__text`,children:`BREATH REMEMBERS`}),(0,W.jsx)(`div`,{className:`route-loader__sub`,children:`Aligning…`})]})})]})]})}function A9(e){return(0,W.jsx)(C.Suspense,{fallback:(0,W.jsx)(k9,{}),children:e})}function j9(e){return(0,W.jsx)(C.Suspense,{fallback:null,children:e})}function M9(){return(0,C.useEffect)(()=>{if(typeof window>`u`)return;let e=window,t=()=>{for(let e of O9)e().catch(()=>{})},n=typeof e.requestIdleCallback==`function`?e.requestIdleCallback(t,{timeout:1e3}):window.setTimeout(t,380);return()=>{typeof e.cancelIdleCallback==`function`?e.cancelIdleCallback(n):window.clearTimeout(n)}},[]),(0,W.jsxs)(mn,{children:[(0,W.jsx)(wo,{}),(0,W.jsxs)(At,{children:[(0,W.jsx)(Ot,{path:`s`,element:A9((0,W.jsx)(T9,{}))}),(0,W.jsx)(Ot,{path:`s/:hash`,element:A9((0,W.jsx)(T9,{}))}),(0,W.jsx)(Ot,{path:`stream`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`stream/p/:token`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`stream/c/:token`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`feed`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`feed/p/:token`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`p~:token`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`p~:token/*`,element:A9((0,W.jsx)(E9,{}))}),(0,W.jsx)(Ot,{path:`token`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`p~token`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`p`,element:A9((0,W.jsx)(E9,{}))}),(0,W.jsx)(Ot,{path:`verify/*`,element:A9((0,W.jsx)(D9,{}))}),(0,W.jsxs)(Ot,{element:(0,W.jsx)(vo,{}),children:[(0,W.jsx)(Ot,{index:!0,element:(0,W.jsx)(C9,{})}),(0,W.jsx)(Ot,{path:`mint`,element:(0,W.jsx)(fo,{})}),(0,W.jsx)(Ot,{path:`voh`,element:(0,W.jsx)(uo,{})}),(0,W.jsx)(Ot,{path:`explorer`,element:(0,W.jsx)(po,{})}),(0,W.jsx)(Ot,{path:`keystream`,element:(0,W.jsx)(po,{})}),(0,W.jsx)(Ot,{path:`klock`,element:(0,W.jsx)(mo,{})}),(0,W.jsx)(Ot,{path:`klok`,element:(0,W.jsx)(mo,{})}),(0,W.jsx)(Ot,{path:`*`,element:j9((0,W.jsx)(yo,{}))})]})]})]})}var N9=(e,t,n)=>{let r=Math.floor(e);return rn?n:r},P9=250,F9=2**31-1;function I9(e){return e===`pulse`?qn:qn*484}function L9(e){let t=e.pauseWhenHidden!==!1,n=N9(N9(e.every,1,1e6)*I9(e.unit),P9,F9),r=!1,i=null,a=()=>{i!==null&&window.clearTimeout(i),i=null},o=e=>{if(r)return;let t=N9(e,P9,F9);i=window.setTimeout(()=>void s(),t)},s=async()=>{if(!r){if(t&&document.visibilityState!==`visible`){o(n);return}try{await e.onTick()}finally{o(n)}}};o(n);let c=()=>{document.visibilityState===`visible`&&(a(),o(Math.min(n,1e3)))};return document.addEventListener(`visibilitychange`,c,{passive:!0}),{stop:()=>{r=!0,a(),document.removeEventListener(`visibilitychange`,c)}}}var R9=[`kai.now.micro`,`kai_now_micro`,`kai_anchor_micro`,`KAI_ANCHOR_MICRO`,`KAI_NOW_MICRO`],z9=e=>{if(typeof e!=`string`)return null;let t=e.trim();if(!/^-?\d+$/.test(t))return null;try{return BigInt(t)}catch{return null}},B9=e=>{if(!Number.isFinite(e))return 0n;let t=e<0?-1:1,n=Math.abs(e),r=Math.trunc(n),i=n-r;return i<.5?BigInt(t*r):i>.5?BigInt(t*(r+1)):BigInt(t*(r%2==0?r:r+1))},V9=e=>B9((e-In)/qn*1e6),H9=()=>{if(typeof window>`u`)return null;try{for(let e of R9){let t=z9(window.localStorage.getItem(e));if(t!==null)return t}}catch{}return null},U9=()=>{let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`30.0.4`,VITE_KAI_ANCHOR_MICRO:null,VITE_KAI_BEATS_DAY:36,VITE_KAI_GENESIS_TS_MS_UTC:1715323541888,VITE_KAI_N_DAY_MICRO:`17491270421`,VITE_KAI_PULSES_STEP:11,VITE_KAI_PULSE_MS:5236,VITE_KAI_SOLAR_GENESIS_TS_MS_UTC:1715400806e3,VITE_KAI_STEPS_BEAT:44,VITE_SOVEREIGN_BUILD_JSON:`{"appVersion":"30.0.4","genesisTsMsUtc":1715323541888,"solarGenesisTsMsUtc":1715400806000,"pulseMs":5236,"pulsesPerStep":11,"stepsPerBeat":44,"beatsPerDay":36,"nDayMicro":"17491270421","kaiAnchorMicro":null}`}.VITE_KAI_ANCHOR_MICRO;return z9(typeof e==`string`?e:void 0)};typeof window<`u`&&_r((()=>{let e=H9();if(e!==null)return e;let t=U9();return t===null?V9(performance.timeOrigin+performance.now()):t})());var W9=!0;function G9(){let e=window.location.hash||``;if(!e.startsWith(`#/`))return;let t=e.slice(1),n=t.indexOf(`?`),r=(n===-1?t:t.slice(0,n))||`/`,i=n===-1?``:t.slice(n+1);if(!r.startsWith(`/stream/p/`))return;let a=new URLSearchParams(i),o=a.get(`add`)||``;a.delete(`add`);let s=a.toString(),c=`${r}${s?`?${s}`:``}${o?`#add=${o}`:``}`;window.history.replaceState(null,``,c)}window.addEventListener(`DOMContentLoaded`,G9,{once:!0}),S.createRoot(document.getElementById(`root`)).render((0,W.jsx)(C.StrictMode,{children:(0,W.jsx)(M9,{})})),`serviceWorker`in navigator&&W9&&window.addEventListener(`load`,async()=>{try{let e=await navigator.serviceWorker.register(`/sw.js?v=30.0.4`,{scope:`/`}),t=!1;navigator.serviceWorker.addEventListener(`controllerchange`,()=>{t||(t=!0,window.location.reload())});let n=e=>{e?.postMessage({type:`SKIP_WAITING`})};(e=>{e.addEventListener(`updatefound`,()=>{let t=e.installing;t&&t.addEventListener(`statechange`,()=>{t.state===`installed`&&navigator.serviceWorker.controller&&n(t)})})})(e),navigator.serviceWorker.addEventListener(`message`,e=>{e.data?.type===`SW_ACTIVATED`&&(console.log(`Kairos service worker active`,e.data.version),typeof e.data.version==`string`&&(window.kairosSwVersion=e.data.version,window.dispatchEvent(new CustomEvent(qi,{detail:e.data.version}))))}),L9({unit:`beat`,every:1,onTick:async()=>{await e.update()}}),console.log(`Kairos Service Worker registered:`,e)}catch(e){console.error(`Service Worker error:`,e)}});export{Vd as $,ps as $t,yp as A,f as An,Nu as At,Uf as B,As as Bt,CS as C,x as Cn,mu as Ct,Sp as D,o as Dn,yu as Dt,Pp as E,s as En,bu as Et,Ap as F,Ds as Ft,$f as G,Gs as Gt,Hf as H,js as Ht,sp as I,Us as It,Qf as J,Hs as Jt,ip as K,Ns as Kt,op as L,Vs as Lt,kp as M,Ou as Mt,jp as N,Du as Nt,Cp as O,c as On,Su as Ot,Op as P,Cu as Pt,Hd as Q,Rs as Qt,ap as R,Bs as Rt,nS as S,O as Sn,Eu as St,qy as T,h as Tn,xu as Tt,Xf as U,zs as Ut,Zf as V,Ks as Vt,np as W,Ws as Wt,rp as X,Os as Xt,hp as Y,Ls as Yt,Bd as Z,ks as Zt,IS as _,Fr as _n,Ld as _t,Kx as a,In as an,Rf as at,rS as b,$e as bn,Qu as bt,Gx as c,Rn as cn,Bf as ct,tS as d,Mr as dn,If as dt,ms as en,vf as et,FS as f,zr as fn,Nf as ft,NS as g,Ir as gn,zd as gt,MS as h,jr as hn,Mf as ht,Xx as i,Kn as in,jf as it,xp as j,u as jn,Pu as jt,wp as k,d as kn,vu as kt,$x as l,qn as ln,Ff as lt,AS as m,Kr as mn,Of as mt,nD as n,Vi as nn,Df as nt,qx as o,Gn as on,Lf as ot,jS as p,Fn as pn,Vf as pt,gp as q,Fs as qt,aC as r,Wn as rn,kf as rt,Zx as s,Bn as sn,Pf as st,t7 as t,Ui as tn,gf as tt,Qx as u,zn as un,zf as ut,OS as v,_n as vn,od as vt,ob as w,y as wn,Tu as wt,wS as x,rt as xn,hu as xt,xS as y,Xe as yn,Wu as yt,vp as z,Is as zt}; \ No newline at end of file + `,document.head.appendChild(t)}function j5(e){let t=(0,C.useRef)(e);(0,C.useEffect)(()=>{t.current=e},[e]);let n=(0,C.useRef)(null);return(0,C.useEffect)(()=>()=>{n.current!=null&&cancelAnimationFrame(n.current)},[]),(0,C.useCallback)(()=>{n.current??=requestAnimationFrame(()=>{n.current=null,t.current()})},[])}function M5(e){let t=new Uint8Array(e),n=``;for(let e=0;e>>e|t<<32-e}function n(e,t,n){return e&t^~e&n}function r(e,t,n){return e&t^e&n^t&n}function i(e){return t(7,e)^t(18,e)^e>>>3}function a(e){return t(17,e)^t(19,e)^e>>>10}function o(e){return t(2,e)^t(13,e)^t(22,e)}function s(e){return t(6,e)^t(11,e)^t(25,e)}let c=new Uint32Array([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]),l=new TextEncoder().encode(e),u=l.length,d=u+1,f=d+(d%64<=56?56-d%64:120-d%64)+8,p=new Uint8Array(f);p.set(l),p[u]=128;let m=u*8;for(let e=0;e<8;e++)p[f-1-e]=m>>>e*8&255;let h=1779033703,g=3144134277,_=1013904242,v=2773480762,y=1359893119,b=2600822924,x=528734635,S=1541459225,C=new Uint32Array(64);for(let e=0;e>>0;let t=h,l=g,u=_,d=v,f=y,m=b,w=x,T=S;for(let e=0;e<64;e++){let i=T+s(f)+n(f,m,w)+c[e]+C[e]>>>0,a=o(t)+r(t,l,u)>>>0;T=w,w=m,m=f,f=d+i>>>0,d=u,u=l,l=t,t=i+a>>>0}h=h+t>>>0,g=g+l>>>0,_=_+u>>>0,v=v+d>>>0,y=y+f>>>0,b=b+m>>>0,x=x+w>>>0,S=S+T>>>0}let w=e=>e.toString(16).padStart(8,`0`);return w(h)+w(g)+w(_)+w(v)+w(y)+w(b)+w(x)+w(S)}async function P5(e){try{let t=(typeof crypto<`u`?crypto:void 0)??globalThis.crypto;if(t?.subtle){let n=new TextEncoder().encode(e);return M5(await t.subtle.digest(`SHA-256`,n))}}catch{}return N5(e)}function F5(e){try{return JSON.stringify(e,(e,t)=>typeof t==`bigint`?t.toString():t)}catch{try{return JSON.stringify({error:`unstringifiable`,kind:typeof e})}catch{return`{"error":"unstringifiable"}`}}}function I5(e){let t=e;return{algorithm:e.algorithm,policy:t.policyId??null,policyChecksum:e.policyChecksum,valuePhi:e.valuePhi,premium:e.premium??null,inputs:t.inputs,minimalHead:{headHash:t.headRef?.headHash??null,transfersWindowRoot:t.headRef?.transfersWindowRoot??null,cumulativeTransfers:t.headRef?.cumulativeTransfers??0}}}async function L5(e){return P5(`val-stamp:${F5(I5(e))}`)}function R5(e){try{let t=Mr(x5(e)+1)-S5(e);return t<=0n?0:Number(t)}catch{return Math.max(0,Math.floor(qn))}}var z5=({meta:e,usdSample:t=100,policy:n=Wu,getNowPulse:r,onRender:i,initial:a,className:o})=>{let s=(0,C.useId)(),c=(0,C.useRef)(null),l=(0,C.useRef)(null);(0,C.useEffect)(()=>{k5(),A5()},[]);let u=(0,C.useCallback)(()=>{let e=b5(Kr()),t=x5(e),n=r?.(),i=typeof n==`number`&&Number.isFinite(n)&&Math.abs(Math.trunc(n)-Math.trunc(t))<=2;return{pulse:Math.trunc(i?n:t),micro:e}},[r]),[{pulse:d},f]=(0,C.useState)(()=>u()),p=(0,C.useRef)(null),m=(0,C.useRef)(d),h=(0,C.useCallback)(()=>{p.current!==null&&(window.clearTimeout(p.current),p.current=null);let e=()=>{let t=u();m.current=t.pulse,f(e=>e.pulse===t.pulse?e:t);let n=R5(t.micro);p.current=window.setTimeout(()=>{let t=u();t.pulse!==m.current&&(m.current=t.pulse,f(t)),e()},Math.max(0,n))};e()},[u]);(0,C.useEffect)(()=>(h(),()=>{p.current!==null&&window.clearTimeout(p.current)}),[h]),(0,C.useEffect)(()=>{let e=()=>{typeof document<`u`&&!document.hidden&&h()};return document.addEventListener(`visibilitychange`,e,{passive:!0}),()=>document.removeEventListener(`visibilitychange`,e)},[h]);let g=(0,C.useMemo)(()=>{if(typeof window>`u`)return`/`;let e=String(window.location.href||``).trim();if(e&&/^https?:\/\//i.test(e))return e;let t=window.location.origin,n=`${window.location.pathname}${window.location.search}${window.location.hash}`;return t&&t!==`null`?`${t}${n||`/`}`:n||`/`},[]),[_,v]=(0,C.useState)(()=>{let e={purpose:``,to:``,from:``,location:``,witnesses:``,reference:``,remark:`In Yahuah We Trust — Secured by Φ, not man-made law`,valuePhi:``,premiumPhi:``,computedPulse:``,nowPulse:``,kaiSignature:``,userPhiKey:``,sigmaCanon:``,shaHex:``,phiDerived:``,valuationAlg:``,valuationStamp:``,provenance:[],zk:void 0,sigilSvg:``,verifyUrl:g,...a??{}};return{...e,verifyUrl:O5(e.verifyUrl,g)}}),[y,b]=(0,C.useState)(null),x=(0,C.useRef)(!1),[S,w]=(0,C.useState)(!1),T=e=>t=>v(n=>({...n,[e]:t})),E=Math.trunc(d),D=(0,C.useMemo)(()=>{let{unsigned:t}=mu(e,E);return t},[e,E]),O=(0,C.useMemo)(()=>`${D.algorithm} • ${D.policyChecksum}`,[D.algorithm,D.policyChecksum]);(0,C.useEffect)(()=>{v(e=>e.valuationAlg?e:{...e,valuationAlg:O})},[O]);let k=(0,C.useMemo)(()=>Qu({meta:e,nowPulse:E,usd:t,currentStreakDays:0,lifetimeUsdSoFar:0},n),[e,E,t,n]),A=D.valuePhi,j=D.premium??0,M=k.usdPerPhi,N=k.phiPerUsd,P=A*M,F=(0,C.useCallback)(()=>{let e=!!y,t=Z8(e?y.valuePhi:A),n=e&&_.premiumPhi||Z8(j),r=e?String(y.lockedPulse):``,i=e?_.valuationStamp||y.seal.stamp:``,a=O5(_.verifyUrl,g);return k8({purpose:_.purpose,to:_.to,from:_.from,location:_.location,witnesses:_.witnesses,reference:_.reference,remark:_.remark,valuePhi:t,premiumPhi:n,computedPulse:r,nowPulse:String(E),kaiSignature:_.kaiSignature||``,userPhiKey:_.userPhiKey||``,valuationAlg:_.valuationAlg||O,valuationStamp:i,sigilSvg:_.sigilSvg||``,verifyUrl:a,provenance:_.provenance??[]})},[_,A,j,E,O,y,g]),I=j5(()=>{let e=c.current;if(e)try{o8(e,F())}catch(e){console.error(`preview render failed`,e)}});(0,C.useEffect)(()=>{I()},[I,F]);let L=(0,C.useCallback)(async()=>{if(!(x.current||S)){w(!0);try{await new Promise(e=>requestAnimationFrame(()=>e()));let r=E,{unsigned:a}=mu(e,r),o=await L5(a),s=Qu({meta:e,nowPulse:r,usd:t,currentStreakDays:0,lifetimeUsdSoFar:0},n),c={...C5(a),stamp:o},l={lockedPulse:r,seal:c,usdPerPhi:s.usdPerPhi,phiPerUsd:s.phiPerUsd,valuePhi:c.valuePhi,valueUsdIndicative:c.valuePhi*s.usdPerPhi,quote:s};p.current!==null&&(window.clearTimeout(p.current),p.current=null),x.current=!0,b(l),v(e=>({...e,computedPulse:String(r),nowPulse:String(r),valuationStamp:o,premiumPhi:a.premium===void 0?e.premiumPhi:Z8(a.premium),valuationAlg:e.valuationAlg||`${a.algorithm} • ${a.policyChecksum}`,valuePhi:Z8(c.valuePhi),verifyUrl:O5(e.verifyUrl,g)})),i?.(l)}catch(e){console.error(`Render/Lock failed`,e),window.alert(`Render failed.\n${e instanceof Error?e.message:String(e)}`)}finally{w(!1)}}},[E,e,t,n,i,S,g]),R=(0,C.useRef)(``);(0,C.useEffect)(()=>{let e=!0;(async()=>{try{let t=await o5();if(!e||!t)return;let n={...t,verifyUrl:t.verifyUrl?O5(t.verifyUrl,g):void 0};v(e=>({...e,...n,verifyUrl:O5(n.verifyUrl??e.verifyUrl,g)}))}catch(e){console.error(`bridge hydration failed`,e)}})();let t=e=>{try{let t=e.detail;if(!t)return;let n=e=>(typeof e.verifyUrl==`string`&&(e.verifyUrl=O5(e.verifyUrl,g)),e);if(x.current){let e=[`kaiSignature`,`userPhiKey`,`sigmaCanon`,`shaHex`,`phiDerived`,`zk`,`provenance`,`sigilSvg`,`verifyUrl`],r=n(Object.fromEntries(Object.entries(t).filter(([t])=>e.includes(t)))),i=JSON.stringify(r);if(i===R.current)return;R.current=i,v(e=>({...e,...r}));return}let r=n({...t}),i=JSON.stringify(r);if(i===R.current)return;R.current=i,v(e=>({...e,...r}))}catch(e){console.error(`bridge event failed`,e)}};return window.addEventListener(`kk:note-data`,t,{passive:!0}),()=>{e=!1,window.removeEventListener(`kk:note-data`,t)}},[g]);let z=(0,C.useCallback)(async()=>{let e=l.current;if(!e)return;if(!x.current||!y){window.alert(`Please Render to lock the valuation before printing.`);return}let t=O5(_.verifyUrl,g),n=k8({..._,valuePhi:_.valuePhi||Z8(y.valuePhi),premiumPhi:_.premiumPhi||Z8(j),computedPulse:String(y.lockedPulse),nowPulse:String(y.lockedPulse),kaiSignature:_.kaiSignature||``,userPhiKey:_.userPhiKey||``,valuationAlg:_.valuationAlg||O,valuationStamp:_.valuationStamp||y.seal.stamp,sigilSvg:_.sigilSvg||``,verifyUrl:t,provenance:_.provenance??[]}),r=L8({frozenPulse:String(y.lockedPulse),kaiSignature:_.kaiSignature||``,userPhiKey:_.userPhiKey||``,sigmaCanon:_.sigmaCanon||``,shaHex:_.shaHex||``,phiDerived:_.phiDerived||``,valuePhi:_.valuePhi||Z8(y.valuePhi),premiumPhi:_.premiumPhi||Z8(j),valuationAlg:_.valuationAlg||O,valuationStamp:_.valuationStamp||y.seal.stamp,zk:_.zk,provenance:_.provenance??[],sigilSvg:_.sigilSvg||``,verifyUrl:t});G8(e,n,String(y.lockedPulse),r),e.setAttribute(`aria-hidden`,`false`),await D5(),await K8(`☤KAI ${w5(y.lockedPulse)} — ${a8}`),e.setAttribute(`aria-hidden`,`true`)},[_,y,j,O,g]),B=(0,C.useCallback)(async()=>{try{if(!x.current||!y){window.alert(`Please Render to lock the valuation before saving PNG.`);return}let e=O5(_.verifyUrl,g),t=await _5(k8({..._,valuePhi:_.valuePhi||Z8(y.valuePhi),premiumPhi:_.premiumPhi||Z8(j),computedPulse:String(y.lockedPulse),nowPulse:String(y.lockedPulse),kaiSignature:_.kaiSignature||``,userPhiKey:_.userPhiKey||``,valuationAlg:_.valuationAlg||O,valuationStamp:_.valuationStamp||y.seal.stamp,sigilSvg:_.sigilSvg||``,verifyUrl:e,provenance:_.provenance??[]}),2400);v5(`${T5(_.kaiSignature||``,String(y.lockedPulse),_.valuationStamp||y.seal.stamp||``)}.png`,t,`image/png`)}catch(e){window.alert(`Save PNG failed: `+(e instanceof Error?e.message:String(e))),console.error(e)}},[_,y,j,O,g]),V=y?y.lockedPulse:E,H=y?y.valuePhi:A,U=y?y.valueUsdIndicative:P,ee=y?y.usdPerPhi:M,te=y?y.phiPerUsd:N,ne=y?_.premiumPhi?Number(_.premiumPhi):0:j,re=E5(H),ie=(0,C.useMemo)(()=>`☤KAI ${w5(V)}`,[V]);return(0,W.jsxs)(`div`,{"data-kk-scope":s,className:`kk-note ${o??``}`,children:[(0,W.jsxs)(`div`,{className:`kk-bar`,children:[(0,W.jsx)(`div`,{className:`kk-brand`,children:(0,W.jsx)(`strong`,{children:`☤KAI — Kairos Kurrensy · Sovereign Harmonik Kingdom`})}),(0,W.jsx)(`div`,{className:`kk-legal-pill`,children:`Issued under Yahuah’s Law of Eternal Light (Φ • Kai-Turah)`})]}),(0,W.jsxs)(`section`,{className:`kk-hero ${y?`is-locked`:`is-live`}`,children:[(0,W.jsxs)(`div`,{className:`kk-status`,children:[(0,W.jsx)(`span`,{className:`kk-chip ${y?`chip-locked`:`chip-live`}`,children:y?`LOCKED`:`LIVE`}),(0,W.jsxs)(`span`,{className:`kk-chip kk-chip-pulse`,children:[`☤KAI `,w5(V)]}),(0,W.jsxs)(`span`,{className:`kk-chip`,children:[`value: `,Y8(H)]}),(0,W.jsxs)(`span`,{className:`kk-chip`,children:[`$ / φ: `,Z8(ee)]}),(0,W.jsxs)(`span`,{className:`kk-chip`,children:[`φ / $: `,Z8(te)]}),(0,W.jsxs)(`span`,{className:`kk-chip`,children:[`premium φ: `,Z8(ne)]})]}),(0,W.jsxs)(`div`,{className:`kk-value-row`,children:[(0,W.jsxs)(`div`,{className:`kk-value-block`,children:[(0,W.jsx)(`div`,{className:`kk-value-label`,children:`VALUE`}),(0,W.jsxs)(`div`,{className:`kk-value`,children:[(0,W.jsx)(`span`,{className:`kk-value-sigil`,children:`Φ`}),(0,W.jsx)(`span`,{className:`kk-value-int`,children:re.int}),(0,W.jsx)(`span`,{className:`kk-value-frac`,children:re.frac})]}),(0,W.jsxs)(`div`,{className:`kk-value-usd`,children:[`≈ `,X8(U)]})]}),(0,W.jsxs)(`div`,{className:`kk-cta`,children:[y?(0,W.jsxs)(`div`,{className:`kk-locked-banner`,role:`status`,"aria-live":`polite`,children:[(0,W.jsx)(`div`,{className:`kk-locked-title`,children:`Valuation Locked`}),(0,W.jsxs)(`div`,{className:`kk-locked-sub`,children:[`☤KAI `,w5(y.lockedPulse),` • Hash: `,_.valuationStamp||y.seal.stamp||`—`]})]}):(0,W.jsx)(`button`,{className:`kk-btn kk-btn-primary kk-btn-xl`,onClick:L,title:`Freeze current pulse and valuation`,disabled:S,children:S?`Rendering…`:`Render — Lock Valuation`}),(0,W.jsxs)(`div`,{className:`kk-cta-actions`,children:[(0,W.jsx)(`button`,{className:`kk-btn`,onClick:z,disabled:!y,title:`Print proof pages`,children:`Print / Save PDF`}),(0,W.jsx)(`button`,{className:`kk-btn kk-btn-ghost`,onClick:B,disabled:!y,title:`Export note PNG`,children:`Save PNG`})]})]})]})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Title`}),(0,W.jsx)(`input`,{value:`${ie} — ${a8}`,disabled:!0,className:`kk-out`})]}),(0,W.jsxs)(`div`,{className:`kk-grid`,children:[(0,W.jsxs)(`div`,{className:`kk-stack`,children:[(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Purpose`}),(0,W.jsx)(`input`,{value:_.purpose,onChange:e=>T(`purpose`)(e.target.value),placeholder:`e.g., consideration for work / gift / exchange`,disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`To`}),(0,W.jsx)(`input`,{value:_.to,onChange:e=>T(`to`)(e.target.value),placeholder:`Recipient`,disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`From`}),(0,W.jsx)(`input`,{value:_.from,onChange:e=>T(`from`)(e.target.value),placeholder:`Issuer`,disabled:!!y})]})]}),(0,W.jsxs)(`div`,{className:`kk-stack`,children:[(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Location`}),(0,W.jsx)(`input`,{value:_.location,onChange:e=>T(`location`)(e.target.value),placeholder:`(optional)`,disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Witnesses`}),(0,W.jsx)(`input`,{value:_.witnesses,onChange:e=>T(`witnesses`)(e.target.value),placeholder:`(optional)`,disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Reference`}),(0,W.jsx)(`input`,{value:_.reference,onChange:e=>T(`reference`)(e.target.value),placeholder:`(optional)`,disabled:!!y})]})]})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Remark`}),(0,W.jsx)(`input`,{value:_.remark,onChange:e=>T(`remark`)(e.target.value),placeholder:`In Yahuah We Trust — Secured by Φ, not man-made law`,disabled:!!y})]}),(0,W.jsxs)(`details`,{className:`kk-stack`,style:{marginTop:8},open:!0,children:[(0,W.jsxs)(`summary`,{children:[(0,W.jsx)(`strong`,{children:`Identity & Valuation`}),` `,(0,W.jsx)(`span`,{className:`kk-hint`,children:`— appears on the bill + proof pages`})]}),(0,W.jsxs)(`div`,{className:`kk-grid`,style:{marginTop:8},children:[(0,W.jsxs)(`div`,{className:`kk-stack`,children:[(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Value Φ`}),(0,W.jsx)(`input`,{value:Z8(H),readOnly:!0})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Premium Φ`}),(0,W.jsx)(`input`,{value:Z8(ne),readOnly:!0})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Valuation Alg`}),(0,W.jsx)(`input`,{value:_.valuationAlg||O,readOnly:!0})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Valuation Stamp`}),(0,W.jsx)(`input`,{value:y?_.valuationStamp||y.seal.stamp||`—`:``,readOnly:!0})]})]}),(0,W.jsxs)(`div`,{className:`kk-stack`,children:[(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Pulse (locked)`}),(0,W.jsx)(`input`,{value:y?String(y.lockedPulse):``,readOnly:!0,placeholder:`set on Render`})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Pulse (live)`}),(0,W.jsx)(`input`,{value:String(E),readOnly:!0,placeholder:`live`})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`kaiSignature`}),(0,W.jsx)(`input`,{value:_.kaiSignature,onChange:e=>T(`kaiSignature`)(e.target.value),disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`userΦkey`}),(0,W.jsx)(`input`,{value:_.userPhiKey,onChange:e=>T(`userPhiKey`)(e.target.value),disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Σ (canonical)`}),(0,W.jsx)(`input`,{value:_.sigmaCanon,onChange:e=>T(`sigmaCanon`)(e.target.value),disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`sha256(Σ)`}),(0,W.jsx)(`input`,{value:_.shaHex,onChange:e=>T(`shaHex`)(e.target.value),disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Φ (derived)`}),(0,W.jsx)(`input`,{value:_.phiDerived,onChange:e=>T(`phiDerived`)(e.target.value),disabled:!!y})]})]})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Verify URL`}),(0,W.jsx)(`input`,{value:_.verifyUrl,onChange:e=>T(`verifyUrl`)(e.target.value),placeholder:`Used for QR & clickable sigil`,disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Sigil SVG (raw)`}),(0,W.jsx)(`textarea`,{value:_.sigilSvg,onChange:e=>T(`sigilSvg`)(e.target.value),className:`kk-out`,disabled:!!y})]})]}),(0,W.jsxs)(`div`,{className:`kk-row kk-actions`,children:[(0,W.jsx)(`div`,{}),(0,W.jsxs)(`div`,{className:`kk-flex`,children:[!y&&(0,W.jsx)(`button`,{className:`kk-btn kk-btn-primary`,onClick:L,disabled:S,children:S?`Rendering…`:`Render — Lock Valuation`}),(0,W.jsx)(`button`,{className:`kk-btn`,onClick:z,disabled:!y,children:`Print / Save PDF`}),(0,W.jsx)(`button`,{className:`kk-btn kk-btn-ghost`,onClick:B,disabled:!y,children:`Save PNG`})]}),(0,W.jsx)(`div`,{})]}),(0,W.jsx)(`div`,{ref:c,id:`note-preview`,className:`kk-note-preview kk-out`}),(0,W.jsx)(`div`,{ref:l,id:`print-root`,"aria-hidden":`true`})]})},B5=`kairos:key:pkcs8`,V5=`kairos:key:spki`,H5={name:`ECDSA`,namedCurve:`P-256`},U5={name:`ECDSA`,hash:`SHA-256`};function W5(e){let t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(e),t}async function G5(e){return crypto.subtle.importKey(`pkcs8`,e,H5,!0,[`sign`])}async function K5(e){return crypto.subtle.importKey(`spki`,e,H5,!0,[`verify`])}async function q5(e){let t=await crypto.subtle.exportKey(`pkcs8`,e);return xs.encode(new Uint8Array(t))}async function J5(e){let t=await crypto.subtle.exportKey(`spki`,e);return xs.encode(new Uint8Array(t))}async function Y5(){let e=await crypto.subtle.generateKey(H5,!0,[`sign`,`verify`]),t=await J5(e.publicKey);return{priv:e.privateKey,pub:e.publicKey,spkiB64u:t}}async function X5(){try{let e=localStorage.getItem(B5),t=localStorage.getItem(V5);if(e&&t){let n=xs.decode(e),r=xs.decode(t);return{priv:await G5(W5(n)),pub:await K5(W5(r)),spkiB64u:t}}let n=await Y5();return localStorage.setItem(B5,await q5(n.priv)),localStorage.setItem(V5,n.spkiB64u),n}catch{return Y5()}}async function Z5(e,t){let n=W5(t),r=await crypto.subtle.sign(U5,e,n);return xs.encode(new Uint8Array(r))}function Q5(e,t){let n=e.match(RegExp(`${t}="([^"]+)"`,`i`));return n?n[1]:void 0}function $5(e,t){let n=Q5(e,t);if(!n)return;let r=Number(n);return Number.isFinite(r)?r:void 0}function e7(e){try{let t=new DOMParser().parseFromString(e,`image/svg+xml`).querySelector(`metadata`);return t?t.textContent??null:null}catch{return null}}async function t7(e){let t=await e.text(),n={},r=e7(t);if(r)try{n=JSON.parse(r)}catch{}if(n.pulse??=$5(t,`data-pulse`),n.beat??=$5(t,`data-beat`),n.stepIndex??=$5(t,`data-step-index`),n.frequencyHz??=(()=>{let e=Q5(t,`data-frequency-hz`);return e?Number(e):void 0})(),n.chakraGate??=Q5(t,`data-chakra-gate`),!n.chakraDay){let e=Q5(t,`data-harmonic-day`)||Q5(t,`data-chakra-day`);e&&(n.chakraDay=e)}n.kaiSignature??=Q5(t,`data-kai-signature`),n.userPhiKey??=Q5(t,`data-phi-key`);let i=!n[`@context`]||n[`@context`]===`https://schema.phi.network/sigil/v1`,a=!n.type||n.type===`application/phi.kairos.sigil+svg`;return{text:t,meta:n,contextOk:i,typeOk:a}}async function n7(e,t){let n=new Image;n.crossOrigin=`anonymous`,n.src=e,await n.decode();let r=document.createElement(`canvas`);r.width=n.width,r.height=n.height;let i=r.getContext(`2d`);if(!i)throw Error(`Canvas 2D context unavailable`);i.drawImage(n,0,0);let{data:a}=i.getImageData(Math.floor(n.width/2),Math.floor(n.height/2),1,1),o=[a[0],a[1],a[2]];return{sig:(await _s(`${t}-2:3-${o.join(`,`)}`)).slice(0,32),rgb:o}}async function r7(e,t){let n=await fetch(e).then(e=>e.text()),r=JSON.stringify(t,null,2),i=n.match(/]*>/i)?n.replace(/]*>[\s\S]*?<\/metadata>/i,`${r}`):n.replace(/]*)>/i,`${r}`);return`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(i)))}`}async function i7(e,t=1024){let n=new Image;await new Promise((t,r)=>{n.onload=()=>t(),n.onerror=r,n.src=e});let r=document.createElement(`canvas`);r.width=t,r.height=t;let i=r.getContext(`2d`);if(!i)throw Error(`Canvas unsupported`);return i.clearRect(0,0,t,t),i.drawImage(n,0,0,t,t),await new Promise((e,t)=>r.toBlob(n=>n?e(n):t(Error(`PNG encode failed`)),`image/png`))}const a7=()=>new Date().toISOString(),o7=(e,t)=>`${e}_${t}_${a7().replace(/[:.]/g,`-`)}`,s7=(e,t,n)=>`${e}_${t}_${n}`,c7=(e,t)=>{let n=document.createElement(`a`);if(typeof e==`string`)n.href=e;else{let t=URL.createObjectURL(e);n.href=t,setTimeout(()=>URL.revokeObjectURL(t),0)}n.download=t,n.rel=`noopener`,document.body.appendChild(n),n.click(),n.remove()},l7=e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let n=String(r.result),i=n.indexOf(`,`),a=i>=0?n.slice(i+1):``;t({name:e.name,mime:e.type,size:e.size,encoded:a})},r.onerror=n,r.readAsDataURL(e)});var u7=18n;function d7(e){let t=1n;for(let n=0n;ne?`0.`:``).split(`.`),a=(r||`0`).replace(/^0+(?=\d)/,``)||`0`,o=(i+`0`.repeat(Number(u7))).slice(0,Number(u7));return n*(BigInt(a)*f7+BigInt(o||`0`))}function m7(e){let t=e<0n?`-`:``,n=e<0n?-e:e,r=n/f7,i=(n%f7).toString().padStart(Number(u7),`0`);return i=i.replace(/0+$/,``),i?`${t}${r}.${i}`:`${t}${r}`}function h7(e){try{let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e=0;e--)if(t[e]?.receiverSignature){n=e;break}let r=0n;for(let e=Math.max(0,n+1);e=0)i=g7(t[n]);else{let t=e.valuation;t&&typeof t.valuePhi==`number`&&(i=p7(String(t.valuePhi)))}let a=p7(e.branchSpentPhi??`0`)+r,o=e.segments?.length??0,s=e.cumulativeTransfers??0,c=s+t.length-1,l=await ws(await Promise.all(t.map(async e=>{let t={senderSignature:e.senderSignature,senderStamp:e.senderStamp,senderKaiPulse:e.senderKaiPulse};return e.payload&&(t.payload={name:e.payload.name,mime:e.payload.mime,size:e.payload.size}),e.receiverSignature&&(t.receiverSignature=e.receiverSignature),e.receiverStamp&&(t.receiverStamp=e.receiverStamp),e.receiverKaiPulse!=null&&(t.receiverKaiPulse=e.receiverKaiPulse),_s(JSON.stringify(t))}))),u=await Hs(e),d={version:1,segmentIndex:o,segmentRange:[s,c],segmentRoot:l,headHashAtSeal:u,leafHash:`sha256`,transfers:t},f=JSON.stringify(d),p=await _s(f),m=new Blob([f],{type:`application/json`}),h=[...e.segments??[],{index:o,root:l,cid:p,count:t.length}],g=await ws(h.map(e=>e.root));return{meta:{...e,segments:h,segmentsMerkleRoot:g,cumulativeTransfers:(e.cumulativeTransfers??0)+t.length,transfers:[],transfersWindowRoot:void 0,headHashAtSeal:u,segmentSize:e.segmentSize??2e3,...i>0n?{branchBasePhi:m7(i)}:{},branchSpentPhi:m7(a)},segmentFileBlob:m}}async function v7(e,t){if(t.kind===`head`)return!e.transfersWindowRoot||e.transfersWindowRoot!==t.windowMerkleRoot?!1:Es(e.transfersWindowRoot,t.transferProof);if(!e.segments||!e.segmentsMerkleRoot)return!1;let n=e.segments.find(e=>e.index===t.segmentIndex);if(!n||n.root!==t.segmentRoot)return!1;let r=t.segmentRoot,i=t.segmentIndex;for(let e of t.segmentsSiblings){let t=i%2==0?[r,e]:[e,r];r=await Cs(t[0]<=t[1]?t[0]:t[1],t[0]<=t[1]?t[1]:t[0]),i=Math.floor(i/2)}return r===e.segmentsMerkleRoot?Es(t.segmentRoot,t.transferProof):!1}var y7=e=>typeof e==`object`&&!!e,b7=e=>typeof e==`string`||typeof e==`number`||typeof e==`bigint`;function x7(e){return y7(e)}function S7(e){return y7(e)}function C7(e){return Array.isArray(e)?e.every(b7):y7(e)?Object.values(e).every(e=>b7(e)):!1}function w7(e){return typeof e==`object`&&!!e&&`verify`in e&&typeof e.verify==`function`}async function T7(){if(typeof window<`u`&&window.snarkjs?.groth16&&w7(window.snarkjs.groth16))return window.snarkjs.groth16;try{let e=await O(()=>import(`snarkjs`),[]),t=e.groth16??e.default?.groth16;if(w7(t))return t}catch{}return null}async function E7(e){let t=await T7();if(!t)return null;let n=e.vkey??e.fallbackVkey;return!x7(n)||!C7(e.publicSignals)||!S7(e.proof)?!1:!!await t.verify(n,e.publicSignals,e.proof)}async function D7(e){let t=e.zkVerifyingKey,n=typeof window<`u`?window.SIGIL_ZK_VKEY:void 0,r=t??n,i=e.hardenedTransfers??[];for(let e=0;ee?String(e).toLowerCase():``;function F7(e){let t=typeof e==`string`?e.trim():String(e??``);return t&&(t.replace(/[^0-9]/g,``)||`0`).replace(/^0+(?=\d)/,``)||`0`}function I7(e){let t=BigInt(2**53-1);return e>t?2**53-1:e<-t?-(2**53-1):Number(e)}function L7(){return I7(Kr())}function R7(){if(!M7)return[];try{let e=localStorage.getItem(O7);return e?JSON.parse(e):[]}catch{return[]}}function z7(){if(M7)try{if(localStorage.getItem(O7))return;for(let e of k7){let t=localStorage.getItem(e);if(t)try{let e=JSON.parse(t);if(!Array.isArray(e))continue;let n=[];for(let t of e){let e=t??{},r=P7(e.parentCanonical??e.parent??e.p),i=P7(e.childCanonical??e.child??e.c),a=F7(e.amountPhiScaled??e.amountScaled??e.a),o=Number(e.senderKaiPulse??e.k??0)||0,s=String(e.transferNonce??e.n??``),c=String(e.senderStamp??e.s??``),l=String(e.previousHeadRoot??e.r??``),u=String(e.transferLeafHashSend??e.l??``),d=!!e.confirmed,f=e.createdAt??e.t,p=(f==null?L7():Number(f))||L7();!r||!i||n.push({id:``,parentCanonical:r,childCanonical:i,amountPhiScaled:a,senderKaiPulse:o,transferNonce:s,senderStamp:c,previousHeadRoot:l,transferLeafHashSend:u,confirmed:d,createdAt:p})}(async()=>{for(let e of n)e.id=await H7({parentCanonical:e.parentCanonical,childCanonical:e.childCanonical,amountPhiScaled:e.amountPhiScaled,senderKaiPulse:e.senderKaiPulse,transferNonce:e.transferNonce,senderStamp:e.senderStamp,previousHeadRoot:e.previousHeadRoot,transferLeafHashSend:e.transferLeafHashSend});let e=new Map;for(let t of n)e.set(t.id,t);V7(Array.from(e.values()))})();return}catch{}}}catch{}}function B7(){z7();let e=R7();if(!Array.isArray(e))return[];let t=[];for(let n of e)try{let e=n,r={id:String(e.id??``),parentCanonical:P7(e.parentCanonical),childCanonical:P7(e.childCanonical),amountPhiScaled:F7(e.amountPhiScaled),senderKaiPulse:Number(e.senderKaiPulse??0)||0,transferNonce:String(e.transferNonce??``),senderStamp:String(e.senderStamp??``),previousHeadRoot:String(e.previousHeadRoot??``),transferLeafHashSend:String(e.transferLeafHashSend??``),confirmed:!!e.confirmed,createdAt:Number(e.createdAt??L7())||L7()};if(!r.parentCanonical||!r.childCanonical||!r.id)continue;t.push(r)}catch{}return t.sort((e,t)=>e.createdAt-t.createdAt),t}function V7(e){if(M7)try{let t=e.map(e=>({...e,parentCanonical:P7(e.parentCanonical),childCanonical:P7(e.childCanonical),amountPhiScaled:F7(e.amountPhiScaled),createdAt:Number(e.createdAt||L7())||L7()}));localStorage.setItem(O7,JSON.stringify(t))}catch{}}async function H7(e){return(await _s(JSON.stringify({p:P7(e.parentCanonical),c:P7(e.childCanonical),a:F7(e.amountPhiScaled),k:e.senderKaiPulse,n:e.transferNonce,s:e.senderStamp,r:e.previousHeadRoot,l:e.transferLeafHashSend}))).toLowerCase()}async function U7(e){let t=B7(),n=await H7(e);if(!t.some(e=>e.id===n)){let r={...e,id:n,parentCanonical:P7(e.parentCanonical),childCanonical:P7(e.childCanonical),amountPhiScaled:F7(e.amountPhiScaled),createdAt:L7()};V7([...t,r]),q7({type:`send:add`,record:r})}return n}function W7(e,t){let n=P7(e),r=String(t||``),i=B7(),a=!1;for(let e of i)e.parentCanonical===n&&e.transferLeafHashSend===r&&!e.confirmed&&(e.confirmed=!0,a=!0);a&&(V7(i),q7({type:`send:update`,parentCanonical:n}))}function G7(e){let t=P7(e);return B7().filter(e=>e.parentCanonical===t)}function K7(e){return G7(e).reduce((e,t)=>e+BigInt(F7(t.amountPhiScaled)),0n)}function q7(e){try{N7?.postMessage(e)}catch{}}var J7=({size:e=22,color:t=`currentColor`,label:n=`Inhale & Upload`})=>(0,W.jsxs)(`div`,{style:{display:`inline-flex`,alignItems:`center`,gap:`8px`,cursor:`pointer`,userSelect:`none`,transition:`transform 0.35s ease`},className:`inhale-upload`,title:n,children:[(0,W.jsxs)(`svg`,{viewBox:`0 0 64 64`,width:e,height:e,"aria-hidden":`true`,style:{display:`inline-block`,verticalAlign:`middle`,filter:`drop-shadow(0 0 6px rgba(55,255,228,0.25))`},children:[(0,W.jsx)(`circle`,{cx:`32`,cy:`32`,r:`28`,stroke:t,strokeWidth:`2`,fill:`none`,strokeDasharray:`4 6`,opacity:`0.6`,children:(0,W.jsx)(`animateTransform`,{attributeName:`transform`,type:`rotate`,values:`0 32 32;360 32 32`,dur:`6s`,repeatCount:`indefinite`})}),(0,W.jsx)(`path`,{d:`M32 44V18`,stroke:t,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,W.jsx)(`animate`,{attributeName:`stroke-dasharray`,values:`0,50;50,0;0,50`,dur:`3.236s`,repeatCount:`indefinite`})}),(0,W.jsx)(`polyline`,{points:`22,26 32,16 42,26`,fill:`none`,stroke:t,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,W.jsx)(`animateTransform`,{attributeName:`transform`,type:`translate`,values:`0 2;0 -2;0 2`,dur:`2.618s`,repeatCount:`indefinite`})}),(0,W.jsx)(`rect`,{x:`22`,y:`46`,width:`20`,height:`4`,rx:`2`,fill:t,opacity:`0.7`,children:(0,W.jsx)(`animate`,{attributeName:`opacity`,values:`0.5;1;0.5`,dur:`4s`,repeatCount:`indefinite`})})]}),(0,W.jsx)(`span`,{style:{fontFamily:`var(--font-sans, 'Inter', sans-serif)`,fontWeight:600,letterSpacing:`0.03em`,color:t,fontSize:`0.9rem`}})]}),Y7={full:{width:`100vw`,maxWidth:`100vw`,height:`100dvh`,maxHeight:`100dvh`,margin:0,padding:0,overflow:`hidden`},viewport:{display:`flex`,flexDirection:`column`,width:`100%`,height:`100%`,maxWidth:`100vw`,overflow:`hidden`},gridBar:{display:`grid`,gridTemplateColumns:`1fr auto`,alignItems:`center`},stickyTabs:{position:`sticky`,top:48,zIndex:2},mono:{overflowWrap:`anywhere`},iconBtn:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:44,height:44,padding:0,flex:`0 0 auto`},iconBtnSm:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:40,height:40,padding:0,flex:`0 0 auto`},modalBody:{flex:`1 1 auto`,minHeight:0,overflowY:`auto`,overflowX:`hidden`,paddingBottom:80},headerImg:{maxWidth:`64px`,height:`auto`,flex:`0 0 auto`},valueStrip:{overflowX:`auto`,whiteSpace:`nowrap`},popBg:{position:`fixed`,inset:0,zIndex:9999,background:`rgba(0,0,0,.55)`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:14},popCard:{width:`min(980px, 100%)`,maxHeight:`min(680px, calc(100dvh - 28px))`,borderRadius:18,overflow:`hidden`,background:`rgba(8,10,16,.92)`,border:`1px solid rgba(255,255,255,.12)`,boxShadow:`0 24px 70px rgba(0,0,0,.6)`,display:`flex`,flexDirection:`column`},popHead:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:10,padding:`12px 12px 10px 14px`,borderBottom:`1px solid rgba(255,255,255,.08)`},popBody:{flex:`1 1 auto`,minHeight:0,overflow:`auto`,padding:10},popTitle:{fontSize:12,color:`rgba(255,255,255,.82)`,letterSpacing:`.02em`}};function X7(e=[],t=16,n=.65){let r=(0,C.useRef)(null),i=(0,C.useRef)(null),[a,o]=(0,C.useState)(1);return(0,C.useEffect)(()=>{let e=r.current,a=i.current;if(!e||!a)return;let s=()=>{let r=Math.max(0,e.clientWidth-t),i=a.scrollWidth;if(r<=0||i<=0)return o(1);o(Math.min(1,Math.max(n,r/i)))};s();let c=new ResizeObserver(s);c.observe(e),c.observe(a),window.addEventListener(`resize`,s);let l=window.setInterval(s,250);return()=>{c.disconnect(),window.removeEventListener(`resize`,s),window.clearInterval(l)}},e),{boxRef:r,textRef:i,scale:a}}var Z7=({k:e,v:t,wide:n,mono:r})=>(0,W.jsxs)(`div`,{className:`kv${n?` wide`:``}`,children:[(0,W.jsx)(`span`,{className:`k`,children:e}),(0,W.jsx)(`span`,{className:`v${r?` mono`:``}`,style:r?Y7.mono:void 0,children:t})]}),Q7=({kind:e,trend:t,flash:n,title:r,children:i,onClick:a,ariaLabel:o})=>{let{boxRef:s,textRef:c,scale:l}=X7([i,t,n],16,.65),u=typeof a==`function`,d=e=>{u&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),a?.())};return(0,W.jsx)(`div`,{ref:s,className:`value-chip ${e} ${t}${n?` is-flashing`:``}${u?` is-clickable`:``}`,"data-trend":t,title:r,role:u?`button`:void 0,tabIndex:u?0:void 0,"aria-label":u?o||r:void 0,onClick:a,onKeyDown:d,style:u?{cursor:`pointer`,userSelect:`none`}:void 0,children:(0,W.jsx)(`span`,{ref:c,className:`amount`,style:{display:`inline-block`,whiteSpace:`nowrap`,lineHeight:1,transform:`scale(${l})`,transformOrigin:`left center`,willChange:`transform`},children:i})})},$7=({small:e,aria:t,titleText:n,path:r,...i})=>(0,W.jsx)(`button`,{...i,className:i.className||`secondary`,"aria-label":t,title:n,style:e?Y7.iconBtnSm:Y7.iconBtn,children:(0,W.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`18`,height:`18`,"aria-hidden":`true`,focusable:`false`,className:`ico`,children:(0,W.jsx)(`path`,{d:r,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`})})}),e9=`kai:sigils:v1`,t9=`sigil:urls`,n9=`kai-sigil-registry`;function r9(e){if(typeof window>`u`)return;let t=t=>{try{let n=window.localStorage.getItem(t),r=n?JSON.parse(n):[],i=Array.isArray(r)?r.slice():[];i.includes(e)||i.unshift(e),window.localStorage.setItem(t,JSON.stringify(i.slice(0,2e4)))}catch{}};t(e9),t(t9);try{let t=new BroadcastChannel(n9);t.postMessage({type:`add`,url:e}),t.close()}catch{}try{window.dispatchEvent(new CustomEvent(`kai:registry:add`,{detail:{url:e}}))}catch{}}var i9=1000000n,a9=17491270421n,o9=11000000n,s9=44,c9=36,l9=6,u9=[`Solhara`,`Aquaris`,`Flamora`,`Verdari`,`Sonari`,`Kaelith`],d9={Solhara:`Root`,Aquaris:`Sacral`,Flamora:`Solar Plexus`,Verdari:`Heart`,Sonari:`Throat`,Kaelith:`Crown`},f9=(a9+18n)/36n,p9=(e,t)=>(e%t+t)%t;function m9(e,t){let n=e/t,r=e%t;return r!==0n&&r>0n!=t>0n?n-1n:n}function h9(e){let t=(e-In)/qn*1e6,n=t<0?-1:1,r=Math.abs(t),i=Math.trunc(r),a=r-i,o=i;return a>.5?o=i+1:a===.5&&(o=i%2==0?i:i+1),BigInt(n)*BigInt(o)}function g9(e){if(e>=0n&&e<500000000n)return e*i9;let t=m9(e,i9);if(t>=0n&&t<500000000n)return e;let n=e/1000n,r=BigInt(2**53-1),i=BigInt(-(2**53-1));if(n>r||nBigInt(2**53-1)?2**53-1:Number(t),r=p9(e,i9),i=i9-r;return{pμ:e,pulse:n,μInPulse:r,msToNext:Math.max(0,Math.ceil(Number(i)*qn/1e6))}}function v9(e){let t=m9(e,i9),n=t<=0n?0:t>BigInt(2**53-1)?2**53-1:Number(t),r=p9(e,a9),i=m9(e,a9),a=Number(m9(r,f9)),o=Math.min(Math.max(a,0),c9-1),s=r-BigInt(o)*f9,c=Number(s/o9),l=Math.min(Math.max(c,0),s9-1),u=u9[Number(p9(i,BigInt(l9)))];return{pulse:n,beat:o,stepIndex:l,harmonicDay:u,chakraDay:d9[u]}}function y9(e){let[t,n]=(0,C.useState)(()=>_9()),r=(0,C.useRef)(null);return(0,C.useEffect)(()=>{if(r.current!==null&&(window.clearTimeout(r.current),r.current=null),!e)return;let t=()=>{let e=_9();n(t=>t.pulse===e.pulse?t:e),r.current=window.setTimeout(t,e.msToNext)};return t(),()=>{r.current!==null&&window.clearTimeout(r.current),r.current=null}},[e]),t}function b9(e){let[t,n]=(0,C.useState)(qn/1e3),r=(0,C.useRef)(null);return(0,C.useEffect)(()=>{if(r.current!==null&&(cancelAnimationFrame(r.current),r.current=null),!e)return;let t=()=>{let e=i9-_9().μInPulse,i=Number(e)*qn/1e6;n(Math.max(0,i/1e3)),r.current=requestAnimationFrame(t)};return r.current=requestAnimationFrame(t),()=>{r.current!==null&&cancelAnimationFrame(r.current),r.current=null}},[e]),e?t:null}function x9(){return _9().pulse}var S9=()=>{let e=(0,C.useRef)(null),t=(0,C.useRef)(null),n=(0,C.useRef)(null),r=(0,C.useRef)(null),i=y9(!0),a=(0,C.useMemo)(()=>v9(i.pμ),[i.pμ]);b9(!0);let o=a.pulse;(0,C.useMemo)(()=>`${a.beat}:${String(a.stepIndex).padStart(2,`0`)}`,[a.beat,a.stepIndex]);let[s,c]=(0,C.useState)(null),[l,u]=(0,C.useState)(null),[d,p]=(0,C.useState)(null),[m,h]=(0,C.useState)(null),[g,_]=(0,C.useState)(null),[v,y]=(0,C.useState)(null),[b,x]=(0,C.useState)(null),[S,w]=(0,C.useState)(null),[T,E]=(0,C.useState)(null),[D,k]=(0,C.useState)(null),[A,j]=(0,C.useState)(null),[M,N]=(0,C.useState)(`PHI`),[P,F]=(0,C.useState)(``),[I,L]=(0,C.useState)(``),[R,z]=(0,C.useState)(`idle`),[B,V]=(0,C.useState)(`summary`),[H,U]=(0,C.useState)(null),[ee,te]=(0,C.useState)(!1),[ne,re]=(0,C.useState)(null),[ie,ae]=(0,C.useState)(!1),[oe,se]=(0,C.useState)(``),[ce,le]=(0,C.useState)(``),[ue,de]=(0,C.useState)(!1),[fe,pe]=(0,C.useState)(!1),[me,he]=(0,C.useState)(null),[ge,_e]=(0,C.useState)(!1);(0,C.useEffect)(()=>{let e=n.current;e&&(ge?e.setAttribute(`data-rotate`,`true`):e.removeAttribute(`data-rotate`))},[ge]);let[ve,ye]=(0,C.useState)(null);(0,C.useEffect)(()=>{(async()=>{try{ye(await X5())}catch(e){Mo(`loadOrCreateKeypair`,e)}})()},[]),(0,C.useEffect)(()=>{let e=!0;return(async()=>{try{let t=await fetch(`/verification_key.json`,{cache:`no-store`});if(!t.ok)return;let n=await t.json();if(!e)return;window.SIGIL_ZK_VKEY=n}catch(e){Mo(`fetch(/verification_key.json)`,e)}})(),()=>{e=!1}},[]);let[be,xe]=(0,C.useState)(null),[Se,Ce]=(0,C.useState)(null),we=()=>tc(n.current),Te=()=>{U(null),z(`idle`),V(`summary`),te(!1),F(``),L(``),j(null),e.current&&(e.current.value=``),t.current&&(t.current.value=``),n.current?.close(),n.current?.setAttribute(`data-open`,`false`)},Ee=(0,C.useMemo)(()=>ss({meta:m,sigilSvgRaw:me,verifyUrl:oe||(typeof window<`u`?window.location.href:``),pulseNow:o}),[m,me,oe,o]),De=()=>nc(n.current,()=>{let e=r.current;if(!e)return;let t=ss({meta:m,sigilSvgRaw:me,verifyUrl:oe||(typeof window<`u`?window.location.href:``),pulseNow:o}),n={getNoteData:async()=>t};window.KKVerifier=n;try{window.dispatchEvent(new CustomEvent(`kk:note-data`,{detail:t}))}catch(e){Mo(`dispatch(kk:note-data)`,e)}tc(e),pe(!0)}),Oe=()=>{let e=r.current;e?.close(),e?.setAttribute(`data-open`,`false`),pe(!1)},ke=()=>nc(n.current,()=>de(!0)),Ae=()=>de(!1),je=async e=>{if(!m)return;let t=gu(m,e);h(t),p(JSON.stringify(t,null,2)),s&&c7(await r7(s,t),`${s7(`sigil_with_valuation`,t.pulse??0,o)}.svg`),de(!1)},Me=(0,C.useCallback)(async e=>{let t=e.transfers??[],n=await(await O(async()=>{let{computeHeadWindowRoot:e}=await import(`./sigilUtils-BWqerTXt.js`);return{computeHeadWindowRoot:e}},[])).computeHeadWindowRoot(t);if(e.transfersWindowRoot=n,t.length>0){let r=await Promise.all(t.map(Ns)),i=r.length-1,a=await Ts(r,i),o=await Es(n,a),s=await v7(e,{kind:`head`,windowMerkleRoot:n,transferProof:a});re({ok:o&&s,index:i,root:n})}else re(null);try{e.transfersWindowRootV14=await ws(await Promise.all((e.hardenedTransfers??[]).map(async e=>_s(ks({previousHeadRoot:e.previousHeadRoot,senderPubKey:e.senderPubKey,senderSig:e.senderSig,senderKaiPulse:e.senderKaiPulse,nonce:e.nonce,transferLeafHashSend:e.transferLeafHashSend,receiverPubKey:e.receiverPubKey,receiverSig:e.receiverSig,receiverKaiPulse:e.receiverKaiPulse,transferLeafHashReceive:e.transferLeafHashReceive,zkSend:e.zkSend??null,zkReceive:e.zkReceive??null})))))}catch(e){Mo(`refreshHeadWindow.buildMerkleRoot(v14)`,e)}try{await D7(e),h({...e})}catch(e){Mo(`refreshHeadWindow.verifyZkOnHead`,e)}return e},[]),Ne=(0,C.useCallback)(async e=>{let t=e.canonicalHash?.toLowerCase()||(await _s(`${e.pulse}|${e.beat}|${e.stepIndex}|${e.chakraDay}`)).toLowerCase();return e.childOfHash?.toLowerCase()&&(e.canonicalHash?.toLowerCase()??``)!==t?!0:(e.canonicalHash?.toLowerCase()??``)!==t},[]),Pe=(0,C.useCallback)(async e=>{let t=e.canonicalHash?.toLowerCase()||(await _s(`${e.pulse}|${e.beat}|${e.stepIndex}|${e.chakraDay}`)).toLowerCase();if(await Ne(e)){let t=e.canonicalHash.toLowerCase(),n=!!e.sendLock?.used,r=!!(e.transfers??[]).slice(-1)[0]?.receiverSignature;return{canonical:t,context:n||r?`parent`:`derivative`}}let n=(e.transfers??[]).slice(-1)[0],r=(e.hardenedTransfers??[]).slice(-1)[0];if(!(n&&!n.receiverSignature))return{canonical:t,context:`parent`};let i=n?await Fs(n):``,a=r?.previousHeadRoot||e.transfersWindowRootV14||e.transfersWindowRoot||``;return{canonical:(await _s(ks({parent:t,nonce:e.transferNonce||``,senderStamp:n?.senderStamp||``,senderKaiPulse:n?.senderKaiPulse||0,prevHead:a,leafSend:i}))).toLowerCase(),context:`derivative`}},[Ne]),Fe=async e=>{let t=e.target.files?.[0];if(!t)return;try{he(await t.text())}catch(e){Mo(`handleSvg.readFile`,e),he(null)}u(t.name||null),U(null),j(null),V(`summary`),te(!1);let n=URL.createObjectURL(t);c(n);let{meta:r,contextOk:i,typeOk:a}=await t7(t);r.segmentSize??=hs;let o=(r.segments??[]).reduce((e,t)=>e+(t.count||0),0);typeof r.cumulativeTransfers!=`number`&&(r.cumulativeTransfers=o+(r.transfers?.length??0)),(r.segments?.length??0)>0&&!r.segmentsMerkleRoot&&(r.segmentsMerkleRoot=await ws((r.segments??[]).map(e=>e.root)));let{sig:s,rgb:l}=await n7(n,typeof r.pulse==`number`?r.pulse:x9());E(s),k(l);let d=await As(r);_(d);let f=d&&r.kaiSignature?d.toLowerCase()===r.kaiSignature.toLowerCase():null;if(y(f),r.kaiSignature){let e=await js(r.kaiSignature);x(e),w(r.userPhiKey?e===r.userPhiKey:null)}else x(null),w(null);try{if(r.creatorPublicKey){let e=await Ss(r.creatorPublicKey);r.userPhiKey||=e}}catch(e){Mo(`handleSvg.phiFromPublicKey`,e)}let m=typeof r.pulse==`number`&&typeof r.beat==`number`&&typeof r.stepIndex==`number`&&typeof r.chakraDay==`string`,g=r.transfers?.slice(-1)[0],v=g?.receiverSignature||g?.senderSignature||null,b=v&&s?v===s:null,S=!!(r.transfers&&r.transfers.length>0),C=!!(g&&!g.receiverSignature),T=!!(g&&g.receiverSignature),D=!r.kaiSignature,O=await Me(r),A=null;try{let e=await Pe(O);xe(e.canonical),Ce(e.context),A=e.context}catch(e){Mo(`computeEffectiveCanonical`,e),xe(null),Ce(null)}let{used:M,expired:P}=cs(O,x9()),{expired:I}=ls(O,x9());h(O),p(JSON.stringify(O,null,2)),z(us({contextOk:i,typeOk:a,hasCore:m,contentSigMatches:f,isOwner:b,hasTransfers:S,lastOpen:C,lastClosed:T,isUnsigned:D,childUsed:M,childExpired:P,parentOpenExpired:I,isChildContext:A===`derivative`})),N(`PHI`),F(``),L(``),we(),e.target&&(e.target.value=``)},Ie=async e=>{let t=e.target.files?.[0];t&&j(await l7(t))},Le=async()=>{if(!m||!s)return;let e={...m},t=x9();if(!e.kaiSignature){let t=await As(e);if(!t){U(`Cannot compute kaiSignature — missing core fields.`);return}e.kaiSignature=t}!e.userPhiKey&&e.kaiSignature&&(e.userPhiKey=await js(e.kaiSignature)),typeof e.kaiPulse!=`number`&&(e.kaiPulse=t);try{!e.creatorPublicKey&&ve&&(e.creatorPublicKey=ve.spkiB64u)}catch(e){Mo(`sealUnsigned.creatorPublicKey`,e)}c7(await r7(s,e),`${o7(`sigil_sealed`,t)}.svg`);let n=await Me(e);h(n),p(JSON.stringify(n,null,2)),z(e=>e===`unsigned`?`readySend`:e),U(null)};async function Re(e,t){let n=JSON.parse(JSON.stringify(e));return n.canonicalHash=t.childCanonical,n.childOfHash=t.parentCanonical,n.childAllocationPhi=t.allocationPhiStr,n.childIssuedPulse=t.issuedPulse,n.childClaim={steps:7,expireAtPulse:t.issuedPulse+77},n.sendLock={nonce:e.transferNonce,used:!1},n.branchBasePhi=t.allocationPhiStr,n.branchSpentPhi=`0`,n}let ze=(0,C.useCallback)(async e=>{let t=e.canonicalHash?.toLowerCase()||(await _s(`${e.pulse}|${e.beat}|${e.stepIndex}|${e.chakraDay}`)).toLowerCase(),r=(e.transfers??[]).slice(-1)[0],i=(e.hardenedTransfers??[]).slice(-1)[0],a=r?await Fs(r):``,o=(await _s(ks({parent:t,nonce:e.transferNonce||``,senderStamp:r?.senderStamp||``,senderKaiPulse:r?.senderKaiPulse||0,prevHead:i?.previousHeadRoot||e.transfersWindowRootV14||e.transfersWindowRoot||``,leafSend:a}))).toLowerCase(),s=e.transferNonce||Ws(),c=e.chakraDay||`Root`,l={pulse:e.pulse,beat:e.beat,stepIndex:e.stepIndex,chakraDay:c,kaiSignature:e.kaiSignature,userPhiKey:e.userPhiKey},u={steps:7,expireAtPulse:(r?.senderKaiPulse??x9())+77,stepsPerBeat:e.stepsPerBeat??44},d;try{if(r?.payload?.mime?.startsWith(`application/vnd.kairos-exhale`)){let e=JSON.parse(Po(r.payload.encoded));e?.kind===`exhale`&&(d={unit:e.unit,amountPhi:e.amountPhi,amountUsd:e.amountUsd,usdPerPhi:e.usdPerPhi})}}catch(e){Mo(`shareTransferLink.previewDecode`,e)}let f={...l,canonicalHash:o,parentHash:t,transferNonce:s,claim:u,preview:d},p=``;try{let{makeSigilUrl:e}=await O(async()=>{let{makeSigilUrl:e}=await import(`./sigilUrl-w0EYDFh2.js`);return{makeSigilUrl:e}},[]);p=e(o,l)}catch(e){Mo(`shareTransferLink.makeSigilUrl`,e);let t=new URL(typeof window<`u`?window.location.href:`http://localhost`);t.pathname=`/s/${o}`,p=t.toString()}let m;try{let{encodeSigilHistory:t}=await O(async()=>{let{encodeSigilHistory:e}=await import(`./sigilUrl-w0EYDFh2.js`);return{encodeSigilHistory:e}},[]),n=[];for(let t of e.transfers??[])!t?.senderSignature||typeof t.senderKaiPulse!=`number`||n.push(typeof t.receiverSignature==`string`&&typeof t.receiverKaiPulse==`number`?{s:t.senderSignature,p:t.senderKaiPulse,r:t.receiverSignature}:{s:t.senderSignature,p:t.senderKaiPulse});let r=t(n);m=r.startsWith(`h:`)?r.slice(2):r}catch(e){Mo(`shareTransferLink.encodeSigilHistory`,e)}let h=qs(p,f,s,m);se(h),le(o),_e(!0),r9(h),nc(n.current,()=>ae(!0));try{fs([t],s)}catch(e){Mo(`shareTransferLink.publishRotation`,e)}},[]),Be=(0,C.useCallback)(async e=>{h(e),p(JSON.stringify(e,null,2));let t=typeof e.pulse==`number`&&typeof e.beat==`number`&&typeof e.stepIndex==`number`&&typeof e.chakraDay==`string`,n=e.transfers?.slice(-1)[0],r=n?.receiverSignature||n?.senderSignature||null,i=r&&T?r===T:null,a=!!(e.transfers&&e.transfers.length>0),o=!!(n&&!n.receiverSignature),s=!!(n&&n.receiverSignature),c=!e.kaiSignature,l=null;try{let t=await Pe(e);xe(t.canonical),Ce(t.context),l=t.context}catch(e){Mo(`syncMetaAndUi.computeEffectiveCanonical`,e),xe(null),Ce(null)}let{used:u,expired:d}=cs(e,x9()),{expired:f}=ls(e,x9());z(us({contextOk:!0,typeOk:!0,hasCore:t,contentSigMatches:g&&e.kaiSignature?g.toLowerCase()===e.kaiSignature.toLowerCase():null,isOwner:i,hasTransfers:a,lastOpen:o,lastClosed:s,isUnsigned:c,childUsed:u,childExpired:d,parentOpenExpired:f,isChildContext:l===`derivative`}))},[T,Pe,g]),Ve=(0,C.useCallback)(e=>{let t=(e||``).trim();return t?(t.startsWith(`.`)&&(t=`0`+t),t=t.replace(/\.?$/,e=>/\.\d/.test(t)?e:``),t):`0`},[]),He=(0,C.useCallback)(e=>new Intl.NumberFormat(void 0,{minimumFractionDigits:2,maximumFractionDigits:2,useGrouping:!0}).format(Math.max(0,e||0)),[]),Ue=(0,C.useMemo)(()=>typeof navigator<`u`&&typeof navigator.share==`function`,[]);(0,C.useEffect)(()=>()=>{if(s?.startsWith(`blob:`))try{URL.revokeObjectURL(s)}catch(e){Mo(`revokeObjectURL`,e)}},[s]);let We=(0,C.useMemo)(()=>{if(!m)return null;let e=m,t=typeof e.stepsPerBeat==`number`?e.stepsPerBeat:12,n=e.transfersWindowRoot??e.transfersWindowRootV14??``;return{pulse:m.pulse,beat:m.beat,stepIndex:m.stepIndex,stepsPerBeat:t,chakraDay:m.chakraDay||`Root`,kaiSignature:m.kaiSignature??``,userPhiKey:m.userPhiKey??``,transfersWindowRoot:n,canonicalContext:Se??void 0,childOfHash:e.childOfHash??void 0,sendLock:e.sendLock??void 0,childClaim:e.childClaim??void 0,childAllocationPhi:e.childAllocationPhi??void 0,branchBasePhi:e.branchBasePhi??void 0,valuationSource:e.valuationSource,stats:e.stats,fileName:l??void 0}},[m,Se,l]),Ge=(0,C.useMemo)(()=>{if(!m)return null;let e=sc(m,[`chakraGate`,`valuationSource.chakraGate`])||cc(m,`data-chakra-gate`)||null;return e?e.replace(/\bgate\b/gi,``).replace(/\s{2,}/g,` `).trim()||e:null},[m]),[Ke,qe]=(0,C.useState)(null);(0,C.useEffect)(()=>{let e=!1;return(async()=>{if(!We){qe(null);return}let t=(m?.canonicalHash)?.toLowerCase()||(await _s(`${We.pulse}|${We.beat}|${We.stepIndex}|${We.chakraDay}`)).toLowerCase();try{let{seal:n}=await hu(We,o,_s,m?.transfersWindowRoot||m?.transfersWindowRootV14||``);e||qe({hash:t,value:n.valuePhi??0,pulseCreated:We.pulse??o,meta:We})}catch(n){Mo(`buildValueSeal`,n),e||qe({hash:t,value:0,pulseCreated:We.pulse??o,meta:We})}})(),()=>{e=!0}},[We,m,o]),(0,C.useEffect)(()=>{!fe||me||!s||(async()=>{try{he(await fetch(s).then(e=>e.text()))}catch(e){Mo(`ensureRawSvgForNote`,e)}})()},[fe,me,s]);let Je=Wu,{usdPerPhi:Ye}=(0,C.useMemo)(()=>{try{return{usdPerPhi:Qu({meta:We??{pulse:0,beat:0,stepIndex:0,stepsPerBeat:12,chakraDay:`Root`,kaiSignature:``,userPhiKey:``,transfersWindowRoot:``},nowPulse:o,usd:100,currentStreakDays:0,lifetimeUsdSoFar:0},Je).usdPerPhi??0}}catch(e){return Mo(`quotePhiForUsd`,e),{usdPerPhi:0}}},[We,o,Je]),Xe=(0,C.useMemo)(()=>Ro(m?.branchBasePhi??``),[m]),Ze=(0,C.useMemo)(()=>Ro(m?.branchSpentPhi??`0`),[m]),Qe=(0,C.useMemo)(()=>{let e=m?.transfers??[];for(let t=e.length-1;t>=0;--t)if(e[t]?.receiverSignature)return t;return e.length>0?e.length-1:-1},[m?.transfers]),$e=(0,C.useMemo)(()=>{let e=m?.transfers??[],t=0;for(let n=e.length-1;n>=0;--n)if(e[n]?.receiverSignature&&++t===2)return n;return-1},[m?.transfers]),et=(0,C.useMemo)(()=>(m?.transfers??[]).slice(-1)[0],[m?.transfers]),tt=(0,C.useMemo)(()=>Se===`derivative`,[Se]),nt=(0,C.useMemo)(()=>{if(tt){let e=m?.childAllocationPhi;if(e){let t=Ro(e);if(t>0n)return t}let t=Ro(zo(Go(et)));return t>0n?t:0n}if(Xe>0n)return Xe;if(Qe>=0&&m?.transfers){let e=Go(m.transfers[Qe]);return e>0n?e:0n}return Ro(String(Ke?.value??0)||`0`)},[tt,m,et,Xe,Qe,Ke]),rt=(0,C.useMemo)(()=>{try{let e=m?.transfers??[],t=0n;for(let n=Math.max(0,Qe+1);n{try{let e=m?.transfers??[];if(Qe<=0)return 0n;let t=Math.max(0,$e+1),n=Math.max(t,Qe),r=0n;for(let i=t;i{if(!be)return 0n;try{return K7(be)}catch(e){return Mo(`ledgerSpentScaled`,e),0n}},[be]),ot=(0,C.useMemo)(()=>Ze>it?Ze:it,[Ze,it]),st=(0,C.useMemo)(()=>tt?0n:ot+rt,[tt,ot,rt]),ct=(0,C.useMemo)(()=>at>st?at:st,[at,st]),lt=(0,C.useMemo)(()=>nt>ct?nt-ct:0n,[nt,ct]),ut=(0,C.useMemo)(()=>Uo(Ho(lt,4),4),[lt]),dt=(0,C.useMemo)(()=>Jo(Number(zo(lt))),[lt]),ft=(0,C.useMemo)(()=>Ro((Ye||0).toFixed(18)),[Ye]),pt=(0,C.useMemo)(()=>Number(zo(Bo(lt,ft)))||0,[lt,ft]),[mt,ht]=(0,C.useState)(`flat`),[gt,_t]=(0,C.useState)(`flat`),[vt,yt]=(0,C.useState)(!1),[bt,xt]=(0,C.useState)(!1),St=(0,C.useRef)(dt),Ct=(0,C.useRef)(pt),wt=(0,C.useRef)(dt),Tt=(0,C.useRef)(Math.round(pt*100)/100),Et=(0,C.useRef)(null),Dt=(0,C.useRef)(null);(0,C.useEffect)(()=>{St.current=dt},[dt]),(0,C.useEffect)(()=>{Ct.current=pt},[pt]),(0,C.useEffect)(()=>{let e=1e-9,t=()=>{let t=St.current,n=t-wt.current,r=n>e?`up`:n<-e?`down`:`flat`;r!==`flat`&&Math.abs(n)>e?(ht(r),yt(!0),Et.current&&window.clearTimeout(Et.current),Et.current=window.setTimeout(()=>yt(!1),420)):ht(`flat`),wt.current=t;let i=Math.round(Ct.current*100)/100,a=i-Tt.current,o=a>e?`up`:a<-e?`down`:`flat`;o!==`flat`&&Math.abs(a)>e?(_t(o),xt(!0),Dt.current&&window.clearTimeout(Dt.current),Dt.current=window.setTimeout(()=>xt(!1),420)):_t(`flat`),Tt.current=i};wt.current=St.current,Tt.current=Math.round(Ct.current*100)/100;let n=window.setInterval(t,EC);return()=>{window.clearInterval(n),Et.current&&window.clearTimeout(Et.current),Dt.current&&window.clearTimeout(Dt.current)}},[]);let[Ot,kt]=(0,C.useState)(!1),[At,jt]=(0,C.useState)(`phi`),[Mt,Nt]=(0,C.useState)(0),Pt=(0,C.useCallback)(e=>{jt(e),kt(!0),Nt(e=>e+1)},[]);(0,C.useEffect)(()=>{Ot&&Nt(e=>e+1)},[Ot,At]);let Ft=(0,C.useCallback)(()=>{kt(!1)},[]);(0,C.useEffect)(()=>{if(!Ot)return;let e=e=>{e.key===`Escape`&&Ft()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Ot,Ft]);let It=(0,C.useMemo)(()=>{if(M===`PHI`){let e=$o(Qo(Ve(P))),t=Bo(Ro(e),ft),n=Number(zo(t));return{displayLeftLabel:`Φ`,displayRight:Number.isFinite(n)?`$ ${He(n)}`:`$ 0.00`,phiStringToSend:e,usdNumberAtSend:Number.isFinite(n)?n:0}}let e=Ro(I),t=Vo(e,ft),n=Uo(Ho(t,6),6);return{displayLeftLabel:`$`,displayRight:`≈ Φ ${Uo(Ho(t,4),4)}`,phiStringToSend:n,usdNumberAtSend:Number(zo(e))||0}},[M,P,I,ft,He,Ve]),Lt=(0,C.useMemo)(()=>Ro(It.phiStringToSend||`0`)>0n&&Ro(It.phiStringToSend||`0`)<=lt,[It.phiStringToSend,lt]),Rt=(0,C.useCallback)(async()=>{if(!m||!s)return;let e=await r7(s,m),t=await fetch(e).then(e=>e.blob()),n=null;try{n=await i7(e,1024)}catch(e){Mo(`pngBlobFromSvgDataUrl`,e)}let{default:r}=await O(async()=>{let{default:e}=await import(`./jszip.min-BlBKh1bQ.js`).then(f(1));return{default:e}},[]),i=new r,a=s7(`sigil_bundle`,m.pulse??0,m.transfers?.slice(-1)[0]?.senderKaiPulse??m.kaiPulse??x9());i.file(`${a}.svg`,t),n&&i.file(`${a}.png`,n),c7(await i.generateAsync({type:`blob`}),`${a}.zip`)},[m,s]),zt=(0,C.useMemo)(()=>(l||``).toLowerCase().includes(`sigil_send`),[l]),Bt=async()=>{if(!m||!s||!T)return;if(m.kaiSignature&&g&&m.kaiSignature.toLowerCase()!==g.toLowerCase()){U(`Content signature mismatch — cannot send.`),z(`sigMismatch`);return}let e={...m};if(!e.kaiSignature){let t=await As(e);if(!t){U(`Cannot compute kaiSignature — missing core fields.`);return}e.kaiSignature=t,e.userPhiKey||=await js(t)}typeof e.kaiPulse!=`number`&&(e.kaiPulse=x9());let t=x9(),n=await _s(`${T}-${e.pulse??0}-${t}`),r=(It.phiStringToSend||``).trim(),i=Ro(r);if(i<=0n){U(`Enter a Φ amount greater than zero.`);return}if(i>lt){U(`Exhale exceeds resonance Φ — requested Φ ${Uo(i,4)} but only Φ ${ut} remains on this glyph.`);return}let a=Number.isFinite(It.usdNumberAtSend)?Math.max(0,It.usdNumberAtSend):0,o;{let n={kind:`exhale`,unit:M,amountPhi:r,amountUsd:a.toFixed(2),usdPerPhi:Ye||0,atPulse:t,kaiSignature:e.kaiSignature||``,userPhiKey:e.userPhiKey||``};o={name:`exhale_${r.replace(/\./g,`_`)}phi.json`,mime:`application/vnd.kairos-exhale+json`,size:No(JSON.stringify(n)).length,encoded:No(JSON.stringify(n))}}!o&&A&&(o=A);let c={senderSignature:T,senderStamp:n,senderKaiPulse:t,payload:o??void 0},l={...e,"@context":e[`@context`]??`https://schema.phi.network/sigil/v1`,type:e.type??`application/phi.kairos.sigil+svg`,canonicalHash:e.canonicalHash||void 0,transferNonce:e.transferNonce||Ws(),transfers:[...e.transfers??[],c],segmentSize:e.segmentSize??2e3};try{let e=Ro(m?.branchSpentPhi??`0`)+i;l.branchBasePhi=m?.branchBasePhi??zo(nt),l.branchSpentPhi=zo(e)}catch(e){Mo(`send.persistBranchProgress`,e)}let u=``,d=``,f=``,p=``;try{if(u=l.canonicalHash?.toLowerCase()||(await _s(`${l.pulse}|${l.beat}|${l.stepIndex}|${l.chakraDay}`)).toLowerCase(),ve){l.creatorPublicKey??=ve.spkiB64u,p=await zs(l,l.hardenedTransfers?.length??0),f=await Fs(c);let e=l.transferNonce,n=await O(()=>import(`./sigilUtils-BWqerTXt.js`),[]),r=n.buildSendMessageV14(l,{previousHeadRoot:p,senderKaiPulse:t,senderPubKey:l.creatorPublicKey,nonce:e,transferLeafHashSend:f}),i=await Z5(ve.priv,r),a={previousHeadRoot:p,senderPubKey:l.creatorPublicKey,senderSig:i,senderKaiPulse:t,nonce:e,transferLeafHashSend:f};if(window.SIGIL_ZK?.provideSendProof)try{let t=await window.SIGIL_ZK.provideSendProof({meta:l,leafHash:f,previousHeadRoot:p,nonce:e});if(t){a.zkSendBundle={scheme:`groth16`,curve:`BLS12-381`,proof:t.proof,publicSignals:t.publicSignals,vkey:t.vkey};let e=await n.hashAny(t.publicSignals),r=await n.hashAny(t.proof),i=t.vkey??l.zkVerifyingKey??window.SIGIL_ZK_VKEY;a.zkSend={scheme:`groth16`,curve:`BLS12-381`,publicHash:e,proofHash:r,vkeyHash:i?await n.hashAny(i):void 0}}}catch(e){Mo(`provideSendProof`,e)}l.hardenedTransfers=[...l.hardenedTransfers??[],a]}d=(await _s(ks({parent:u,nonce:l.transferNonce||``,senderStamp:c.senderStamp||``,senderKaiPulse:c.senderKaiPulse||0,prevHead:p||l.transfersWindowRootV14||l.transfersWindowRoot||``,leafSend:f}))).toLowerCase();let e={parentCanonical:u,childCanonical:d,amountPhiScaled:Ro(r).toString(),senderKaiPulse:t,transferNonce:l.transferNonce,senderStamp:n,previousHeadRoot:p,transferLeafHashSend:f};try{await U7(e)}catch(e){Mo(`recordSend`,e)}try{rc().registerSend?.(e)}catch(e){Mo(`__SIGIL__.registerSend`,e)}try{window.dispatchEvent(new CustomEvent(`sigil:sent`,{detail:e}))}catch(e){Mo(`dispatchEvent(sigil:sent)`,e)}}catch(e){Mo(`send.hardenedBuild/ledger`,e)}if(c7(await r7(s,await Re(l,{parentCanonical:u,childCanonical:d,allocationPhiStr:r,issuedPulse:t})),`${s7(`sigil_send`,l.pulse??0,t)}.svg`),(l.transfers??[]).length>=(l.segmentSize??2e3)){let{meta:e,segmentFileBlob:n}=await _7(l);n&&c7(n,`sigil_segment_${e.pulse??0}_${String((e.segments?.length??1)-1).padStart(6,`0`)}.json`),c7(await r7(s,e),`${s7(`sigil_head_after_seal`,e.pulse??0,t)}.svg`);let r=await Me(e);await Be(r),U(null),F(``),L(``),await ze(r);return}let h=await Me(l);await Be(h),U(null),F(``),L(``),await ze(h)},Vt=async()=>{if(!m||!s||!T)return;if(Se===`parent`){let{expired:e}=ls(m,x9());if(e){U(`This open send has expired.`);return}}let{used:e,expired:t}=cs(m,x9());if(e){U(`This transfer link has already been used.`);return}if(t){U(`This transfer link has expired.`),z(`complete`);return}let n=m.transfers?.slice(-1)[0];if(!n||n.receiverSignature)return;let r=x9(),i={...n,receiverSignature:T,receiverStamp:await _s(`${T}-${n.senderStamp}-${r}`),receiverKaiPulse:r},a={...m,transfers:[...(m.transfers??[]).slice(0,-1),i]};try{if(ve&&(a.hardenedTransfers?.length??0)>0){let e=a.hardenedTransfers[a.hardenedTransfers.length-1];if(!e.receiverSig){a.creatorPublicKey??=ve.spkiB64u;let t=await Ns(i),n=await O(()=>import(`./sigilUtils-BWqerTXt.js`),[]),o=n.buildReceiveMessageV14({previousHeadRoot:e.previousHeadRoot,senderSig:e.senderSig,receiverKaiPulse:r,receiverPubKey:a.creatorPublicKey,transferLeafHashReceive:t}),s=await Z5(ve.priv,o),c={...e,receiverPubKey:a.creatorPublicKey,receiverSig:s,receiverKaiPulse:r,transferLeafHashReceive:t};if(window.SIGIL_ZK?.provideReceiveProof)try{let r=await window.SIGIL_ZK.provideReceiveProof({meta:a,leafHash:t,previousHeadRoot:e.previousHeadRoot,linkSig:e.senderSig});if(r){c.zkReceiveBundle={scheme:`groth16`,curve:`BLS12-381`,proof:r.proof,publicSignals:r.publicSignals,vkey:r.vkey};let e=await n.hashAny(r.publicSignals),t=await n.hashAny(r.proof),i=r.vkey??a.zkVerifyingKey??window.SIGIL_ZK_VKEY;c.zkReceive={scheme:`groth16`,curve:`BLS12-381`,publicHash:e,proofHash:t,vkeyHash:i?await n.hashAny(i):void 0}}}catch(e){Mo(`provideReceiveProof`,e)}a.hardenedTransfers=[...a.hardenedTransfers.slice(0,-1),c];try{let t=a.childOfHash?.toLowerCase()||(await _s(`${a.pulse}|${a.beat}|${a.stepIndex}|${a.chakraDay}`)).toLowerCase();e.transferLeafHashSend&&W7(t,e.transferLeafHashSend)}catch(e){Mo(`ledger.markConfirmedByLeaf`,e)}}}}catch(e){Mo(`receive.hardenedSeal`,e)}try{await Ne(a)&&(a.sendLock={...a.sendLock??{nonce:a.transferNonce},used:!0,usedPulse:r})}catch(e){Mo(`receive.setUsedLock`,e)}c7(await r7(s,a),`${s7(`sigil_receive`,a.pulse??0,r)}.svg`),await Be(await Me(a)),U(null)},Ht=(0,C.useCallback)(async()=>{if(!m||!m.transfers?.length)return;if(zt){U(`Segmentation is disabled on SEND sigils.`);return}let{meta:e,segmentFileBlob:t}=await _7(m);t&&c7(t,`sigil_segment_${e.pulse??0}_${String((e.segments?.length??1)-1).padStart(6,`0`)}.json`),s&&c7(await r7(s,e),`${s7(`sigil_head_after_seal`,e.pulse??0,x9())}.svg`),await Be(await Me(e)),U(null)},[m,s,zt,Me,Be]),Ut=(0,C.useMemo)(()=>sc(m,[`frequencyHz`,`valuationSource.frequencyHz`])||cc(m,`data-frequency-hz`),[m]),Wt=(0,C.useMemo)(()=>is(m??{}),[m]),Gt=(0,C.useMemo)(()=>{if(Se!==`derivative`)return null;let e=cs(m,o);if(!e.expireAt)return null;let t=Math.max(0,e.expireAt-o);return{leftPulses:t,leftSteps:Math.ceil(t/11),expireAt:e.expireAt}},[m,o,Se]),{used:Kt,expired:qt}=(0,C.useMemo)(()=>cs(m,o),[m,o]),Jt=(0,C.useMemo)(()=>ls(m,o).expired,[m,o]);function Yt({seriesKey:e,sampleMs:t,valuePhi:n,usdPerPhi:r,maxPoints:i=2048,snapKey:a}){let[o,s]=C.useState([]),c=C.useRef([]),l=C.useRef(n),u=C.useRef(r);C.useEffect(()=>{Number.isFinite(n)&&(l.current=n)},[n]),C.useEffect(()=>{Number.isFinite(r)&&r>0&&(u.current=r)},[r]);let d=C.useCallback(()=>{let e=x9(),t=Number.isFinite(l.current)?l.current:0,n=Number.isFinite(u.current)&&u.current>0?u.current:0,r=c.current;if(!r.length){let r=[{i:e-1,value:t,fx:n},{i:e,value:t,fx:n}];c.current=r,s(r);return}let a=r[r.length-1],o;o=a?.i===e?[...r.slice(0,-1),{...a,value:t,fx:n}]:typeof a?.i==`number`&&a.ii&&o.splice(0,o.length-i),c.current=o,s(o)},[i]);return C.useEffect(()=>{c.current=[],s([]),d()},[e,d]),C.useEffect(()=>{d()},[n,r,d]),C.useEffect(()=>{typeof a==`number`&&d()},[a,d]),C.useEffect(()=>{let e=window.setInterval(()=>{let e=x9(),t=c.current;if(t[t.length-1]?.i===e)return;let n={i:e,value:l.current,fx:u.current},r=t.length?[...t,n]:[n];r.length>i&&r.splice(0,r.length-i),c.current=r,s(r)},t);return()=>window.clearInterval(e)},[t,i]),o}let Xt=Yt({seriesKey:(0,C.useMemo)(()=>be||(m?`${m.pulse??`x`}|${m.beat??`x`}|${m.stepIndex??`x`}|${m.chakraDay??`x`}`:`none`),[be,m]),sampleMs:EC,valuePhi:dt,usdPerPhi:Ye,maxPoints:4096,snapKey:Mt}),Zt=(0,C.useMemo)(()=>{let e=Number(Ke?.value);return Number.isFinite(e)&&e>0?e:dt},[Ke,dt]);return(0,W.jsxs)(`div`,{className:`verifier-stamper`,role:`application`,style:{maxWidth:`100vw`,overflowX:`hidden`},children:[(0,W.jsx)(`div`,{className:`toolbar`,children:(0,W.jsxs)(`div`,{className:`toolbar-main`,children:[(0,W.jsx)(`div`,{className:`brand-lockup`,"aria-label":`Kairos live status`,children:(0,W.jsx)(`div`,{className:`brand-text`,children:(0,W.jsxs)(`div`,{className:`live-pulse`,children:[(0,W.jsx)(`span`,{className:`now`,children:`LIVE`}),(0,W.jsxs)(`span`,{className:`pulse-number`,children:[` ☤KAI `,o]})]})})}),(0,W.jsx)(`div`,{className:`toolbar-actions`,"aria-label":`Verifier actions`,children:(0,W.jsxs)(`button`,{className:`primary`,onClick:()=>e.current?.click(),type:`button`,children:[(0,W.jsx)(J7,{color:`#37FFE4`}),(0,W.jsxs)(`span`,{className:`phikey-label`,"aria-label":`PhiKey`,children:[(0,W.jsx)(`img`,{className:`phikey-mark`,src:`/phi.svg`,alt:`Φ`}),(0,W.jsx)(`span`,{className:`phikey-text`,children:`Key`})]})]})})]})}),(0,W.jsx)(`input`,{ref:e,type:`file`,accept:`.svg`,hidden:!0,onChange:Fe}),(0,W.jsx)(`dialog`,{ref:n,className:`glass-modal fullscreen`,id:`verifier-dialog`,"data-open":`false`,"aria-label":`Kai-Sigil Verifier Modal`,style:Y7.full,children:(0,W.jsxs)(`div`,{className:`modal-viewport`,style:Y7.viewport,children:[(0,W.jsxs)(`div`,{className:`modal-topbar`,style:Y7.gridBar,children:[(0,W.jsx)(`div`,{className:`status-strip`,"aria-live":`polite`,style:Y7.valueStrip,children:(0,W.jsx)(mc,{uiState:R,contentSigMatches:v,phiKeyMatches:S,meta:m,headProof:ne,canonicalContext:Se,childUsed:Kt,childExpired:qt,parentOpenExpired:Jt,isSendFilename:zt})}),(0,W.jsx)(`button`,{className:`close-btn holo`,"data-aurora":`true`,"aria-label":`Close`,title:`Close`,onClick:Te,style:{justifySelf:`end`,marginRight:8},children:`×`})]}),s&&m&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`header`,{className:`modal-header`,style:{paddingInline:16},children:[(0,W.jsx)(`img`,{src:s,alt:`Sigil thumbnail`,width:64,height:64,style:Y7.headerImg}),(0,W.jsxs)(`div`,{className:`header-fields`,style:{minWidth:0},children:[(0,W.jsxs)(`h2`,{style:{overflowWrap:`anywhere`},children:[`Pulse `,(0,W.jsx)(`span`,{children:m.pulse??`—`})]}),(0,W.jsxs)(`p`,{children:[`Beat `,(0,W.jsx)(`span`,{children:m.beat??`—`}),` · Step `,(0,W.jsx)(`span`,{children:m.stepIndex??`—`}),` · Day:`,` `,(0,W.jsx)(`span`,{children:Wt??m.chakraDay??`—`})]}),(0,W.jsxs)(`div`,{className:`value-strip`,"aria-live":`polite`,children:[(0,W.jsxs)(Q7,{kind:`phi`,trend:mt,flash:vt,title:Se===`derivative`?`Resonance Φ for this derivative glyph`:`Resonance Φ on this glyph`,ariaLabel:`Open live chart for Φ value`,onClick:()=>Pt(`phi`),children:[(0,W.jsx)(`span`,{className:`sym`,children:`Φ`}),dt.toFixed(6)]}),(0,W.jsxs)(Q7,{kind:`usd`,trend:gt,flash:bt,title:`Indicative USD (issuance model)`,ariaLabel:`Open live chart for USD value`,onClick:()=>Pt(`usd`),children:[(0,W.jsx)(`span`,{className:`sym`,children:`$`}),He(pt)]})]}),zt&&(0,W.jsxs)(`div`,{className:`child-banner tooltip-container`,style:{fontSize:10,opacity:.9,marginTop:6},children:[(0,W.jsx)(`strong`,{children:`7 Steps from Exhale`}),` `,(0,W.jsx)(`span`,{className:`tooltip-trigger`,children:`INHALE:`}),(0,W.jsx)(`div`,{className:`tooltip`,children:`You have 7 steps (77 pulses) to inhale & seal this Sigil. After this period, INHALE is permanently finalized & the Sigil is eternally sealed.`})]})]})]}),Ot&&(0,W.jsx)(`div`,{className:`chart-popover-backdrop`,role:`dialog`,"aria-modal":`true`,"aria-label":`Live chart`,onMouseDown:Ft,onClick:Ft,style:Y7.popBg,children:(0,W.jsxs)(`div`,{className:`chart-popover`,onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),style:Y7.popCard,children:[(0,W.jsxs)(`div`,{className:`chart-popover-head`,style:Y7.popHead,children:[(0,W.jsx)(`div`,{style:Y7.popTitle,className:`chart-popover-title`,children:At===`phi`?`Φ Resonance · Live`:`$ Price · Live`}),(0,W.jsx)(`button`,{className:`close-btn holo`,"data-aurora":`true`,"aria-label":`Close chart`,title:`Close`,onClick:Ft,style:{width:40,height:40,display:`inline-flex`,alignItems:`center`,justifyContent:`center`},children:`×`})]}),(0,W.jsx)(`div`,{className:`chart-popover-body`,style:Y7.popBody,children:(0,W.jsx)(C.Suspense,{fallback:(0,W.jsx)(`div`,{style:{padding:16,color:`var(--dim)`},children:`Loading chart…`}),children:(0,W.jsx)(v6,{data:Xt,live:dt,pv:Zt,premiumX:1,momentX:1,colors:[`rgba(167,255,244,1)`],usdPerPhi:Ye,mode:At===`usd`?`usd`:`phi`,isChildGlyph:Se===`derivative`,reflowKey:Mt})})})]})}),(0,W.jsxs)(`nav`,{className:`tabs`,role:`tablist`,"aria-label":`Views`,style:Y7.stickyTabs,children:[(0,W.jsx)(`button`,{role:`tab`,"aria-selected":B===`summary`,className:B===`summary`?`active`:``,onClick:()=>V(`summary`),children:`Presence`}),(0,W.jsx)(`button`,{role:`tab`,"aria-selected":B===`lineage`,className:B===`lineage`?`active`:``,onClick:()=>V(`lineage`),children:`Stewardship`}),(0,W.jsx)(`button`,{role:`tab`,"aria-selected":B===`data`,className:B===`data`?`active`:``,onClick:()=>V(`data`),children:`Memory`}),(0,W.jsx)(`button`,{className:`secondary`,onClick:ke,disabled:!m,children:`Resonance`}),(0,W.jsx)(`button`,{className:`secondary`,onClick:De,disabled:!s,children:`Note`})]}),(0,W.jsxs)(`section`,{className:`modal-body`,role:`tabpanel`,style:Y7.modalBody,children:[B===`summary`&&(0,W.jsxs)(`div`,{className:`summary-grid`,children:[(0,W.jsx)(Z7,{k:`Now`,v:o}),Gt&&(0,W.jsx)(Z7,{k:`Inhale Seal:`,v:`${Gt.leftSteps} steps (${Gt.leftPulses} pulses) left`}),Se===`derivative`&&(()=>{let{expireAt:e}=cs(m,o);return typeof e==`number`&&Number.isFinite(e)?(0,W.jsx)(Z7,{k:`Inhale by:`,v:e}):null})(),m.userPhiKey&&(0,W.jsx)(Z7,{k:`Φ-Key:`,v:(0,W.jsxs)(W.Fragment,{children:[m.userPhiKey,b&&(S?(0,W.jsx)(`span`,{className:`chip ok`,children:`match`}):(0,W.jsx)(`span`,{className:`chip err`,children:`mismatch`}))]}),wide:!0,mono:!0}),m.kaiSignature&&(0,W.jsx)(Z7,{k:`Kai-Signature (Σ):`,v:(0,W.jsxs)(W.Fragment,{children:[m.kaiSignature,v===!0&&(0,W.jsx)(`span`,{className:`chip ok`,children:`match`}),v===!1&&(0,W.jsx)(`span`,{className:`chip err`,children:`mismatch`})]}),wide:!0,mono:!0}),Ut&&(0,W.jsx)(Z7,{k:`Frequency (Hz):`,v:Ut}),Ge&&(0,W.jsx)(Z7,{k:`Spiral Gate:`,v:Ge}),T&&(0,W.jsx)(Z7,{k:`PROOF OF BREATH™:`,v:T,wide:!0,mono:!0}),(0,W.jsx)(Z7,{k:`Stewardship Hash:`,v:be??`—`,wide:!0,mono:!0}),(0,W.jsx)(Z7,{k:Se===`derivative`?`Derivative Resonance`:`Resonance `,v:` Φ${ut}`}),(0,W.jsx)(Z7,{k:`Exhale key:`,v:m?.creatorPublicKey??`—`,wide:!0,mono:!0}),(0,W.jsx)(Z7,{k:`Exhale nonce:`,v:m.transferNonce??`—`,wide:!0,mono:!0}),(0,W.jsx)(Z7,{k:`Issued @ (derivative):`,v:m?.childIssuedPulse??`—`}),(0,W.jsx)(Z7,{k:`Derivative of (source):`,v:m?.childOfHash??`—`,wide:!0,mono:!0}),ne&&(0,W.jsx)(Z7,{k:`Latest proof:`,v:ne.ok?`#${ne.index+1} ✓`:`#${ne.index} ×`}),ne!==null&&(0,W.jsx)(Z7,{k:`Head proof root:`,v:ne.root,wide:!0,mono:!0}),(0,W.jsx)(Z7,{k:`Head proof root (v14):`,v:m?.transfersWindowRootV14??`—`,wide:!0,mono:!0}),Se===`parent`&&(()=>{let e=ls(m,o);return e.expireAt?(0,W.jsx)(Z7,{k:`Inhale expires @:`,v:e.expireAt}):null})(),Se===`derivative`&&m?.sendLock?.used&&(0,W.jsx)(Z7,{k:`One-time lock:`,v:`Used`}),(0,W.jsx)(Z7,{k:`Hardened transfers:`,v:m.hardenedTransfers?.length??0}),(0,W.jsx)(Z7,{k:`Segments:`,v:m.segments?.length??0}),(0,W.jsx)(Z7,{k:`Segment size:`,v:m.segmentSize??2e3}),(0,W.jsx)(Z7,{k:`Segment Depth:`,v:m.cumulativeTransfers??0}),(0,W.jsx)(Z7,{k:`Segment Tree Root:`,v:m.segmentsMerkleRoot??`—`,wide:!0,mono:!0}),D&&(0,W.jsx)(Z7,{k:`RGB seed:`,v:D.join(`, `)})]}),B===`lineage`&&(0,W.jsx)(`div`,{className:`lineage`,children:m.transfers?.length?(0,W.jsx)(`ol`,{className:`transfers`,children:m.transfers.map((e,t)=>{let n=!e.receiverSignature,r=m.hardenedTransfers?.[t],i=null;try{if(e.payload?.mime?.startsWith(`application/vnd.kairos-exhale`)){let t=JSON.parse(Po(e.payload.encoded));t?.kind===`exhale`&&(i={unit:t.unit,amountPhi:t.amountPhi,amountUsd:t.amountUsd,usdPerPhi:t.usdPerPhi})}}catch(e){Mo(`lineage.decodeExhalePayload`,e)}let a=``,o=``;try{i?.amountPhi&&(a=Wo(i.amountPhi),o=typeof i.amountUsd==`string`&&i.amountUsd?i.amountUsd:typeof i.usdPerPhi==`number`&&Number.isFinite(i.usdPerPhi)?He((Number(i.amountPhi)||0)*i.usdPerPhi):`0.00`)}catch(e){Mo(`lineage.computeDisplay`,e)}return(0,W.jsxs)(`li`,{className:n?`transfer open`:`transfer closed`,children:[(0,W.jsxs)(`header`,{children:[(0,W.jsxs)(`span`,{className:`index`,children:[`#`,t+1]}),(0,W.jsx)(`span`,{className:`state ${n?`open`:`closed`}`,children:n?`Pending receive`:`Sealed`})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Exhaler Σ`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:e.senderSignature})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Exhaler Seal:`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:e.senderStamp})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Exhaler Pulse`}),(0,W.jsx)(`span`,{className:`v`,children:e.senderKaiPulse})]}),i?.amountPhi&&(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Exhaled`}),(0,W.jsxs)(`span`,{className:`v`,children:[`Φ `,a,` · $`,o]})]}),r&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Prev-Head`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:r.previousHeadRoot})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Exhale leaf`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:r.transferLeafHashSend})]}),r.transferLeafHashReceive&&(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Inhale leaf`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:r.transferLeafHashReceive})]}),r.zkSend&&(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`ZK Exhale:`}),(0,W.jsxs)(`span`,{className:`v`,children:[r.zkSend.verified?`✓`:`•`,` `,r.zkSend.scheme]})]}),r.zkSend?.proofHash&&(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`ZK Exhale hash:`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:r.zkSend.proofHash})]}),r.zkReceive&&(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`ZK Inhale`}),(0,W.jsxs)(`span`,{className:`v`,children:[r.zkReceive.verified?`✓`:`•`,` `,r.zkReceive.scheme]})]}),r.zkReceive?.proofHash&&(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`ZK Inhale hash`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:r.zkReceive.proofHash})]})]}),e.receiverSignature&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Inhaler Σ`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:e.receiverSignature})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Inhaler Seal`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:e.receiverStamp})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Inhaler Pulse`}),(0,W.jsx)(`span`,{className:`v`,children:e.receiverKaiPulse})]})]}),e.payload&&(0,W.jsxs)(`details`,{className:`payload`,open:!0,children:[(0,W.jsx)(`summary`,{children:`Payload`}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Name`}),(0,W.jsx)(`span`,{className:`v`,children:e.payload.name})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`MIME`}),(0,W.jsx)(`span`,{className:`v`,children:e.payload.mime})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Size`}),(0,W.jsxs)(`span`,{className:`v`,children:[e.payload.size,` bytes`]})]})]})]},t)})}):(0,W.jsx)(`p`,{className:`empty`,children:`No stewardship yet — ready to exhale from Sigil-Glyph.`})}),B===`data`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`json-toggle`,children:(0,W.jsxs)(`label`,{children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:ee,onChange:()=>te(e=>!e)}),` View raw JSON`]})}),ee?(0,W.jsx)(`pre`,{className:`raw-json`,style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:d}):(0,W.jsx)(`div`,{className:`json-tree-wrap`,style:{overflowX:`hidden`},children:(0,W.jsx)(uc,{data:m})})]})]}),(0,W.jsxs)(`footer`,{className:`modal-footer`,style:{position:`sticky`,bottom:0},children:[H&&(0,W.jsx)(`p`,{className:`status error`,style:{overflowWrap:`anywhere`},children:H}),(0,W.jsxs)(`div`,{className:`footer-actions`,style:{display:`flex`,alignItems:`center`,gap:8,flexWrap:`wrap`,width:`100%`,boxSizing:`border-box`},children:[R===`unsigned`&&(0,W.jsx)(`button`,{className:`secondary`,onClick:Le,children:`Seal content (Σ + Φ)`}),(R===`readySend`||R===`verified`)&&(0,W.jsxs)(`div`,{className:`send-row no-zoom-input`,"data-nozoom":`true`,style:{display:`flex`,alignItems:`center`,gap:8,flex:`1 1 auto`,minWidth:0,fontSize:16,WebkitTextSizeAdjust:`100%`},children:[(0,W.jsx)(jo,{amountMode:M,setAmountMode:N,usdInput:I,phiInput:P,setUsdInput:L,setPhiInput:F,convDisplayRight:It.displayRight,remainingPhiDisplay4:ut,canonicalContext:Se,phiFormatter:e=>$o(Qo(Ve(e)))}),(0,W.jsx)($7,{className:`primary`,onClick:Bt,aria:`Exhale (send)`,titleText:Ue?`Exhale (seal & share)`:`Exhale (seal & copy link)`,disabled:!Lt,path:`M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z`})]}),(0,W.jsx)($7,{onClick:()=>t.current?.click(),aria:`Attach a file`,titleText:`Attach a file`,small:!0,path:`M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.2a2 2 0 01-2.83-2.83l8.49-8.49`}),(0,W.jsx)(`input`,{ref:t,type:`file`,hidden:!0,onChange:Ie}),R===`readyReceive`&&(0,W.jsx)($7,{className:`primary`,onClick:Vt,aria:`Inhale (receive)`,titleText:Se===`derivative`?qt?`Link expired`:Kt?`Link already used`:`Inhale`:Jt?`Send expired`:`Inhale`,disabled:Se===`derivative`&&(qt||Kt)||Se===`parent`&&Jt,path:`M2 22l11-11M2 22l20-7-9-4-4-9-7 20z`}),(m?.transfers?.length??0)>0&&(0,W.jsx)($7,{className:`secondary`,onClick:Ht,aria:`Segment head window`,titleText:`Roll current head-window into a segment (continuous)`,disabled:zt,small:!0,path:`M12 3l9 4-9 4-9-4 9-4zm-9 8l9 4 9-4M3 19l9 4 9-4`})]})]})]})]})}),(0,W.jsx)(Cc,{open:ie,url:oe,hash:ce,onClose:()=>{ae(!1),_e(!1),we()},onDownloadZip:Rt}),m&&We&&(0,W.jsx)(i8,{open:ue,onClose:Ae,meta:We,nowPulse:o,initialGlyph:Ke??void 0,onAttach:R===`verified`?je:void 0}),(0,W.jsx)(`dialog`,{ref:r,className:`glass-modal fullscreen`,id:`note-dialog`,"data-open":fe?`true`:`false`,"aria-label":`Note Exhaler`,style:Y7.full,children:(0,W.jsxs)(`div`,{className:`modal-viewport`,style:Y7.viewport,children:[(0,W.jsxs)(`div`,{className:`modal-topbar`,style:Y7.gridBar,children:[(0,W.jsx)(`div`,{style:{paddingInline:12,fontSize:12,color:`var(--dim)`},children:`Kairos — Note Exhaler`}),(0,W.jsx)(`button`,{className:`close-btn holo`,"data-aurora":`true`,"aria-label":`Close`,title:`Close`,onClick:Oe,style:{justifySelf:`end`,marginRight:8},children:`×`})]}),(0,W.jsx)(`div`,{style:{flex:`1 1 auto`,minHeight:0,overflowY:`auto`},children:me&&We?(0,W.jsx)(z5,{meta:We,initial:Ee}):me?(0,W.jsx)(`div`,{style:{padding:16,color:`var(--dim)`},children:`Missing valuation metadata for Note — upload/parse a sigil first.`}):(0,W.jsx)(`div`,{style:{padding:16,color:`var(--dim)`},children:`Load a sigil to print a note.`})})]})})]})};function C9(){return(0,W.jsx)(es,{onReset:()=>{},children:(0,W.jsx)(C.Suspense,{fallback:(0,W.jsx)(`div`,{style:{padding:16},children:`Loading…`}),children:(0,W.jsx)(S9,{})})})}var w9=C.lazy(()=>O(()=>import(`./SigilFeedPage-DGJJwxYi.js`),__vite__mapDeps([25,17,8,6,7,9,18,20,2,3,21,22,14,23,24,26]))),T9=C.lazy(()=>O(()=>import(`./SigilPage-DF86EQ7y.js`),__vite__mapDeps([27,6,7,23,28,29]))),E9=C.lazy(()=>O(()=>import(`./PShort-Bmqr2bV5.js`),[])),D9=C.lazy(()=>O(()=>import(`./VerifyPage-B34sC8R1.js`),__vite__mapDeps([30,11,31,32,33]))),O9=[()=>O(()=>import(`./SigilFeedPage-DGJJwxYi.js`),__vite__mapDeps([25,17,8,6,7,9,18,20,2,3,21,22,14,23,24,26])),()=>O(()=>import(`./SigilPage-DF86EQ7y.js`),__vite__mapDeps([27,6,7,23,28,29])),()=>O(()=>import(`./PShort-Bmqr2bV5.js`),[]),()=>O(()=>import(`./VerifyPage-B34sC8R1.js`),__vite__mapDeps([30,11,31,32,33]))];function k9(){return(0,W.jsxs)(`div`,{className:`route-loader`,role:`status`,"aria-live":`polite`,"aria-label":`Loading`,children:[(0,W.jsx)(`div`,{className:`route-loader__bg`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`route-loader__grid`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`route-loader__halo`,"aria-hidden":`true`}),(0,W.jsxs)(`div`,{className:`route-loader__stage`,children:[(0,W.jsxs)(`div`,{className:`route-loader__orb`,"aria-hidden":`true`,children:[(0,W.jsx)(`div`,{className:`route-loader__orb-ring route-loader__orb-ring--a`}),(0,W.jsx)(`div`,{className:`route-loader__orb-ring route-loader__orb-ring--b`}),(0,W.jsx)(`div`,{className:`route-loader__orb-ring route-loader__orb-ring--c`}),(0,W.jsx)(`div`,{className:`route-loader__orb-core`}),(0,W.jsx)(`span`,{className:`route-loader__spark route-loader__spark--a`}),(0,W.jsx)(`span`,{className:`route-loader__spark route-loader__spark--b`})]}),(0,W.jsx)(`div`,{className:`route-loader__content`,children:(0,W.jsxs)(`div`,{className:`route-loader__content-inner`,children:[(0,W.jsx)(`div`,{className:`route-loader__dot`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`route-loader__text`,children:`BREATH REMEMBERS`}),(0,W.jsx)(`div`,{className:`route-loader__sub`,children:`Aligning…`})]})})]})]})}function A9(e){return(0,W.jsx)(C.Suspense,{fallback:(0,W.jsx)(k9,{}),children:e})}function j9(e){return(0,W.jsx)(C.Suspense,{fallback:null,children:e})}function M9(){return(0,C.useEffect)(()=>{if(typeof window>`u`)return;let e=window,t=()=>{for(let e of O9)e().catch(()=>{})},n=typeof e.requestIdleCallback==`function`?e.requestIdleCallback(t,{timeout:1e3}):window.setTimeout(t,380);return()=>{typeof e.cancelIdleCallback==`function`?e.cancelIdleCallback(n):window.clearTimeout(n)}},[]),(0,W.jsxs)(mn,{children:[(0,W.jsx)(wo,{}),(0,W.jsxs)(At,{children:[(0,W.jsx)(Ot,{path:`s`,element:A9((0,W.jsx)(T9,{}))}),(0,W.jsx)(Ot,{path:`s/:hash`,element:A9((0,W.jsx)(T9,{}))}),(0,W.jsx)(Ot,{path:`stream`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`stream/p/:token`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`stream/c/:token`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`feed`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`feed/p/:token`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`p~:token`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`p~:token/*`,element:A9((0,W.jsx)(E9,{}))}),(0,W.jsx)(Ot,{path:`token`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`p~token`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`p`,element:A9((0,W.jsx)(E9,{}))}),(0,W.jsx)(Ot,{path:`verify/*`,element:A9((0,W.jsx)(D9,{}))}),(0,W.jsxs)(Ot,{element:(0,W.jsx)(vo,{}),children:[(0,W.jsx)(Ot,{index:!0,element:(0,W.jsx)(C9,{})}),(0,W.jsx)(Ot,{path:`mint`,element:(0,W.jsx)(fo,{})}),(0,W.jsx)(Ot,{path:`voh`,element:(0,W.jsx)(uo,{})}),(0,W.jsx)(Ot,{path:`explorer`,element:(0,W.jsx)(po,{})}),(0,W.jsx)(Ot,{path:`keystream`,element:(0,W.jsx)(po,{})}),(0,W.jsx)(Ot,{path:`klock`,element:(0,W.jsx)(mo,{})}),(0,W.jsx)(Ot,{path:`klok`,element:(0,W.jsx)(mo,{})}),(0,W.jsx)(Ot,{path:`*`,element:j9((0,W.jsx)(yo,{}))})]})]})]})}var N9=(e,t,n)=>{let r=Math.floor(e);return rn?n:r},P9=250,F9=2**31-1;function I9(e){return e===`pulse`?qn:qn*484}function L9(e){let t=e.pauseWhenHidden!==!1,n=N9(N9(e.every,1,1e6)*I9(e.unit),P9,F9),r=!1,i=null,a=()=>{i!==null&&window.clearTimeout(i),i=null},o=e=>{if(r)return;let t=N9(e,P9,F9);i=window.setTimeout(()=>void s(),t)},s=async()=>{if(!r){if(t&&document.visibilityState!==`visible`){o(n);return}try{await e.onTick()}finally{o(n)}}};o(n);let c=()=>{document.visibilityState===`visible`&&(a(),o(Math.min(n,1e3)))};return document.addEventListener(`visibilitychange`,c,{passive:!0}),{stop:()=>{r=!0,a(),document.removeEventListener(`visibilitychange`,c)}}}var R9=[`kai.now.micro`,`kai_now_micro`,`kai_anchor_micro`,`KAI_ANCHOR_MICRO`,`KAI_NOW_MICRO`],z9=e=>{if(typeof e!=`string`)return null;let t=e.trim();if(!/^-?\d+$/.test(t))return null;try{return BigInt(t)}catch{return null}},B9=e=>{if(!Number.isFinite(e))return 0n;let t=e<0?-1:1,n=Math.abs(e),r=Math.trunc(n),i=n-r;return i<.5?BigInt(t*r):i>.5?BigInt(t*(r+1)):BigInt(t*(r%2==0?r:r+1))},V9=e=>B9((e-In)/qn*1e6),H9=()=>{if(typeof window>`u`)return null;try{for(let e of R9){let t=z9(window.localStorage.getItem(e));if(t!==null)return t}}catch{}return null},U9=()=>{let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`30.0.5`,VITE_KAI_ANCHOR_MICRO:null,VITE_KAI_BEATS_DAY:36,VITE_KAI_GENESIS_TS_MS_UTC:1715323541888,VITE_KAI_N_DAY_MICRO:`17491270421`,VITE_KAI_PULSES_STEP:11,VITE_KAI_PULSE_MS:5236,VITE_KAI_SOLAR_GENESIS_TS_MS_UTC:1715400806e3,VITE_KAI_STEPS_BEAT:44,VITE_SOVEREIGN_BUILD_JSON:`{"appVersion":"30.0.5","genesisTsMsUtc":1715323541888,"solarGenesisTsMsUtc":1715400806000,"pulseMs":5236,"pulsesPerStep":11,"stepsPerBeat":44,"beatsPerDay":36,"nDayMicro":"17491270421","kaiAnchorMicro":null}`}.VITE_KAI_ANCHOR_MICRO;return z9(typeof e==`string`?e:void 0)};typeof window<`u`&&_r((()=>{let e=H9();if(e!==null)return e;let t=U9();return t===null?V9(performance.timeOrigin+performance.now()):t})());var W9=!0;function G9(){let e=window.location.hash||``;if(!e.startsWith(`#/`))return;let t=e.slice(1),n=t.indexOf(`?`),r=(n===-1?t:t.slice(0,n))||`/`,i=n===-1?``:t.slice(n+1);if(!r.startsWith(`/stream/p/`))return;let a=new URLSearchParams(i),o=a.get(`add`)||``;a.delete(`add`);let s=a.toString(),c=`${r}${s?`?${s}`:``}${o?`#add=${o}`:``}`;window.history.replaceState(null,``,c)}window.addEventListener(`DOMContentLoaded`,G9,{once:!0}),S.createRoot(document.getElementById(`root`)).render((0,W.jsx)(C.StrictMode,{children:(0,W.jsx)(M9,{})})),`serviceWorker`in navigator&&W9&&window.addEventListener(`load`,async()=>{try{let e=await navigator.serviceWorker.register(`/sw.js?v=30.0.5`,{scope:`/`}),t=!1;navigator.serviceWorker.addEventListener(`controllerchange`,()=>{t||(t=!0,window.location.reload())});let n=e=>{e?.postMessage({type:`SKIP_WAITING`})};(e=>{e.addEventListener(`updatefound`,()=>{let t=e.installing;t&&t.addEventListener(`statechange`,()=>{t.state===`installed`&&navigator.serviceWorker.controller&&n(t)})})})(e),navigator.serviceWorker.addEventListener(`message`,e=>{e.data?.type===`SW_ACTIVATED`&&(console.log(`Kairos service worker active`,e.data.version),typeof e.data.version==`string`&&(window.kairosSwVersion=e.data.version,window.dispatchEvent(new CustomEvent(qi,{detail:e.data.version}))))}),L9({unit:`beat`,every:1,onTick:async()=>{await e.update()}}),console.log(`Kairos Service Worker registered:`,e)}catch(e){console.error(`Service Worker error:`,e)}});export{Vd as $,ps as $t,yp as A,f as An,Nu as At,Uf as B,As as Bt,CS as C,x as Cn,mu as Ct,Sp as D,o as Dn,yu as Dt,Pp as E,s as En,bu as Et,Ap as F,Ds as Ft,$f as G,Gs as Gt,Hf as H,js as Ht,sp as I,Us as It,Qf as J,Hs as Jt,ip as K,Ns as Kt,op as L,Vs as Lt,kp as M,Ou as Mt,jp as N,Du as Nt,Cp as O,c as On,Su as Ot,Op as P,Cu as Pt,Hd as Q,Rs as Qt,ap as R,Bs as Rt,nS as S,O as Sn,Eu as St,qy as T,h as Tn,xu as Tt,Xf as U,zs as Ut,Zf as V,Ks as Vt,np as W,Ws as Wt,rp as X,Os as Xt,hp as Y,Ls as Yt,Bd as Z,ks as Zt,IS as _,Fr as _n,Ld as _t,Kx as a,In as an,Rf as at,rS as b,$e as bn,Qu as bt,Gx as c,Rn as cn,Bf as ct,tS as d,Mr as dn,If as dt,ms as en,vf as et,FS as f,zr as fn,Nf as ft,NS as g,Ir as gn,zd as gt,MS as h,jr as hn,Mf as ht,Xx as i,Kn as in,jf as it,xp as j,u as jn,Pu as jt,wp as k,d as kn,vu as kt,$x as l,qn as ln,Ff as lt,AS as m,Kr as mn,Of as mt,nD as n,Vi as nn,Df as nt,qx as o,Gn as on,Lf as ot,jS as p,Fn as pn,Vf as pt,gp as q,Fs as qt,aC as r,Wn as rn,kf as rt,Zx as s,Bn as sn,Pf as st,t7 as t,Ui as tn,gf as tt,Qx as u,zn as un,zf as ut,OS as v,_n as vn,od as vt,ob as w,y as wn,Tu as wt,wS as x,rt as xn,hu as xt,xS as y,Xe as yn,Wu as yt,vp as z,Is as zt}; \ No newline at end of file diff --git a/dist/assets/jszip.min-BlBKh1bQ.js b/dist/assets/jszip.min-BlBKh1bQ.js new file mode 100644 index 00000000..0db01eda --- /dev/null +++ b/dist/assets/jszip.min-BlBKh1bQ.js @@ -0,0 +1 @@ +import{_t as e}from"./index-CcPm2yTY.js";export default e(); \ No newline at end of file diff --git a/dist/assets/jszip.min-DiUCJUtt.js b/dist/assets/jszip.min-DiUCJUtt.js deleted file mode 100644 index 95b4faa4..00000000 --- a/dist/assets/jszip.min-DiUCJUtt.js +++ /dev/null @@ -1 +0,0 @@ -import{_t as e}from"./index-BGzUQCv_.js";export default e(); \ No newline at end of file diff --git a/dist/assets/prop-types-CQvzhoSE.js b/dist/assets/prop-types-CQ3MXKCa.js similarity index 92% rename from dist/assets/prop-types-CQvzhoSE.js rename to dist/assets/prop-types-CQ3MXKCa.js index 5c3f7d86..741996ad 100644 --- a/dist/assets/prop-types-CQvzhoSE.js +++ b/dist/assets/prop-types-CQ3MXKCa.js @@ -1 +1 @@ -import{En as e}from"./index-BGzUQCv_.js";var t=e(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),n=e(((e,n)=>{var r=t();function i(){}function a(){}a.resetWarningCache=i,n.exports=function(){function e(e,t,n,i,a,o){if(o!==r){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:i};return n.PropTypes=n,n}})),r=e(((e,t)=>{t.exports=n()()}));export{r as t}; \ No newline at end of file +import{En as e}from"./index-CcPm2yTY.js";var t=e(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),n=e(((e,n)=>{var r=t();function i(){}function a(){}a.resetWarningCache=i,n.exports=function(){function e(e,t,n,i,a,o){if(o!==r){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:i};return n.PropTypes=n,n}})),r=e(((e,t)=>{t.exports=n()()}));export{r as t}; \ No newline at end of file diff --git a/dist/assets/sigilRegistry-DVCHqg2o.js b/dist/assets/sigilRegistry-NyXrDYsE.js similarity index 99% rename from dist/assets/sigilRegistry-DVCHqg2o.js rename to dist/assets/sigilRegistry-NyXrDYsE.js index 6a0dea08..425b31cb 100644 --- a/dist/assets/sigilRegistry-DVCHqg2o.js +++ b/dist/assets/sigilRegistry-NyXrDYsE.js @@ -1 +1 @@ -import{Bt as e,Ht as t,Tn as n,jn as r,t as i,tn as a}from"./index-BGzUQCv_.js";import{n as o}from"./SigilAuthContext-Bpha3aI1.js";var s=r(n(),1),c=r(a(),1);function l(e){return typeof e==`string`?e.toLowerCase():``}function u(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function d(e){return typeof e==`string`&&e.length>0}function f(e){return typeof e==`number`&&Number.isFinite(e)}function p(e){if(typeof e!=`string`||!e)return!1;try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}}function m(e){if(typeof e!=`object`||!e)throw Error(`Malformed sigil metadata.`);let t=e;for(let e of[`pulse`,`beat`,`stepIndex`,`chakraDay`])if(!u(t,e))throw Error(`Missing Kai field: ${e}`);if(!u(t,`kaiSignature`))throw Error(`Invalid Kai Signature — tampered or unsigned sigil.`);if(!f(t.pulse))throw Error(`Invalid field: pulse`);if(!f(t.beat))throw Error(`Invalid field: beat`);if(!f(t.stepIndex))throw Error(`Invalid field: stepIndex`);if(!d(t.chakraDay))throw Error(`Invalid field: chakraDay`);if(!d(t.kaiSignature))throw Error(`Invalid field: kaiSignature`)}function h(e){try{let t=new DOMParser().parseFromString(e,`image/svg+xml`),n=Array.from(t.getElementsByTagName(`metadata`)),r=[`valuation`,`ledger`,`dht`,`source`];for(let e of n){let t=e.getAttribute(`id`)??``;if(r.some(e=>t.includes(e)))continue;let n=(e.textContent??``).trim();if(!n)continue;let i=n.replace(/^$/,``);try{let e=JSON.parse(i);if(typeof e==`object`&&e&&u(e,`pulse`)&&u(e,`beat`)&&u(e,`stepIndex`)&&u(e,`chakraDay`)&&u(e,`kaiSignature`))return e}catch{}}return null}catch{return null}}function g(e,t){let n=[`sigilActionUrl`,`sigilUrl`,`actionUrl`,`url`,`claimedUrl`,`loginUrl`,`sourceUrl`,`originUrl`,`link`,`href`];if(t)for(let e of n){let n=t[e];if(p(n))return n}try{let t=new DOMParser().parseFromString(e,`image/svg+xml`);for(let e of Array.from(t.getElementsByTagName(`metadata`))){let t=(e.textContent??``).trim();if(!t)continue;let r=t.replace(/^$/,``);try{let e=JSON.parse(r);if(typeof e==`object`&&e)for(let t of n){let n=e[t];if(p(n))return n}}catch{let e=r.match(/https?:\/\/[^\s"'<>)#]+/i);if(e&&p(e[0]))return e[0]}}for(let e of Array.from(t.getElementsByTagName(`a`))){let t=e.getAttribute(`href`)||e.getAttribute(`xlink:href`);if(p(t))return t}}catch{}return null}function _(){return(0,c.jsxs)(`svg`,{className:`kai-orb-svg`,viewBox:`0 0 88 88`,role:`img`,"aria-label":`Kai Orb`,children:[(0,c.jsx)(`defs`,{children:(0,c.jsxs)(`radialGradient`,{id:`orbGlow`,cx:`50%`,cy:`50%`,r:`50%`,children:[(0,c.jsx)(`stop`,{offset:`0%`,stopColor:`#ffffff`,stopOpacity:`1`}),(0,c.jsx)(`stop`,{offset:`55%`,stopColor:`#00ffd0`,stopOpacity:`1`}),(0,c.jsx)(`stop`,{offset:`100%`,stopColor:`#00ffd0`,stopOpacity:`0`})]})}),(0,c.jsx)(`circle`,{cx:`44`,cy:`44`,r:`41`,fill:`none`,stroke:`#00ffd0`,strokeOpacity:`0.38`,strokeWidth:`1.6`}),(0,c.jsx)(`circle`,{cx:`44`,cy:`44`,r:`32`,fill:`none`,stroke:`#8a2be2`,strokeOpacity:`0.45`,strokeWidth:`1.4`}),(0,c.jsxs)(`g`,{opacity:`0.45`,children:[(0,c.jsx)(`circle`,{cx:`44`,cy:`44`,r:`20`,fill:`none`,stroke:`rgba(255,255,255,.3)`,strokeWidth:`.8`}),(0,c.jsx)(`circle`,{cx:`44`,cy:`44`,r:`10`,fill:`none`,stroke:`rgba(255,255,255,.25)`,strokeWidth:`.7`}),(0,c.jsx)(`line`,{x1:`44`,y1:`4`,x2:`44`,y2:`84`,stroke:`rgba(255,255,255,.2)`,strokeWidth:`.8`}),(0,c.jsx)(`line`,{x1:`4`,y1:`44`,x2:`84`,y2:`44`,stroke:`rgba(255,255,255,.2)`,strokeWidth:`.8`})]}),(0,c.jsx)(`circle`,{cx:`44`,cy:`44`,r:`10`,fill:`url(#orbGlow)`}),(0,c.jsx)(`path`,{d:`M44 14 L72 68 H16 Z`,fill:`none`,stroke:`#00b4ff`,strokeOpacity:`0.35`,strokeWidth:`1.2`})]})}function v({onVerified:n}){let r=(0,s.useRef)(null),[a,d]=(0,s.useState)(null),[f,p]=(0,s.useState)(!1),[v,y]=(0,s.useState)(!1),[b,x]=(0,s.useState)(null),{setAuth:S}=o(),C=(0,s.useCallback)(async a=>{p(!0),d(null),x(null);try{if(a.type!==`image/svg+xml`&&!a.name.toLowerCase().endsWith(`.svg`))throw Error(`Please upload an SVG sigil file.`);let r=await a.text(),{meta:o,contextOk:s,typeOk:c}=await i(a),d=o&&u(o,`kaiSignature`)&&u(o,`pulse`)?o:h(r);if(!d||!s||!c)throw Error(`Malformed or unrecognized sigil structure.`);m(d);let f=d,p=await e(f);if(!p||l(p)!==l(f.kaiSignature))throw Error(`Invalid Kai Signature — tampered or unsigned sigil.`);let _=await t(f.kaiSignature);if(typeof f.userPhiKey==`string`){if(l(_)!==l(f.userPhiKey))throw Error(`Φ-Key mismatch — identity invalid.`)}else f.userPhiKey=_;let v=g(r,f)??void 0;S(r,{pulse:f.pulse,beat:f.beat,stepIndex:f.stepIndex,chakraDay:f.chakraDay,kaiSignature:f.kaiSignature,userPhiKey:f.userPhiKey,...typeof f.sigilId==`string`?{sigilId:f.sigilId}:{},...v?{sigilActionUrl:v}:{}}),x(f),n(r,f)}catch(e){d(e instanceof Error?e.message:`Invalid sigil file. Ensure it’s a Kai-sealed SVG with embedded JSON .`)}finally{p(!1),r.current&&(r.current.value=``)}},[n,S]),w=async e=>{let t=e.target.files?.[0];t&&await C(t)};return(0,c.jsx)(`div`,{className:`sigil-login-only w-full max-w-xl mx-auto`,children:(0,c.jsxs)(`div`,{onDrop:async e=>{e.preventDefault(),e.stopPropagation(),y(!1);let t=e.dataTransfer.files?.[0];t&&await C(t)},onDragOver:e=>{e.preventDefault(),e.stopPropagation(),y(!0)},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),y(!1)},onKeyDown:e=>{f||(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),r.current?.click())},className:[`sigil-dropzone`,v?`sigil-dropzone--over`:``,f?`sigil-dropzone--loading`:``,b?`sigil-dropzone--ok`:``,a?`sigil-dropzone--err`:``].filter(Boolean).join(` `),role:`button`,tabIndex:0,"aria-disabled":f,title:`Drag & drop your Kai-sealed SVG here, or tap to browse`,"aria-label":`Inhale or drop your Kai-sealed SVG sigil`,"aria-describedby":`sigil-instructions sigil-trustline`,onClick:()=>{f||r.current?.click()},children:[(0,c.jsx)(`div`,{className:`sigil-grid`,"aria-hidden":!0}),(0,c.jsx)(`div`,{className:`sigil-ring sigil-ring--outer`,"aria-hidden":!0}),(0,c.jsx)(`div`,{className:`sigil-ring sigil-ring--inner`,"aria-hidden":!0}),(0,c.jsxs)(`div`,{className:`sigil-center`,children:[(0,c.jsx)(`div`,{className:`sigil-orb`,"aria-hidden":!0,children:(0,c.jsx)(_,{})}),(0,c.jsxs)(`p`,{id:`sigil-instructions`,className:`sigil-instructions`,children:[`Inhale, `,(0,c.jsx)(`span`,{className:`sigil-accent`,children:`Φkey here.`})]}),(0,c.jsxs)(`div`,{className:`sigil-status`,"aria-live":`polite`,children:[f&&(0,c.jsxs)(`div`,{className:`sigil-status__row`,children:[(0,c.jsx)(`span`,{className:`sigil-spinner`,"aria-hidden":`true`}),(0,c.jsx)(`span`,{children:`Verifying signature & deriving Φ-Key…`})]}),!f&&b&&(0,c.jsxs)(`div`,{className:`sigil-status__ok`,children:[(0,c.jsx)(`span`,{className:`ok-dot`,"aria-hidden":`true`}),(0,c.jsx)(`span`,{children:`Verified — Φ-Key bound`})]}),!f&&a&&(0,c.jsx)(`div`,{className:`sigil-status__err`,children:a})]})]}),(0,c.jsx)(`input`,{ref:r,type:`file`,accept:`.svg,image/svg+xml`,onChange:w,className:`sigil-file-input`,tabIndex:-1,"aria-hidden":`true`})]})})}const y=`kai:sigils:v1`,b=`sigil:urls`;var x=typeof window<`u`;function S(){if(!x)return{};let e=window;return e.__SIGIL__||={},e.__SIGIL__}function C(e){if(!x)return[];try{let t=window.localStorage.getItem(e);if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean):[]}catch{return[]}}function w(e,t){if(x)try{let n=Array.from(new Set(t.map(e=>e.trim()).filter(Boolean)));window.localStorage.setItem(e,JSON.stringify(n))}catch{}}function T(e,t){return e.includes(t)?!1:(e.push(t),!0)}function E(e){let t=e.trim();if(!t)return null;if(!x)return t;try{return new URL(t,window.location.origin).toString()}catch{return t}}var D=null;function O(){return!x||!(`BroadcastChannel`in window)?null:D||(D=new BroadcastChannel(`kai-sigil-registry`),D)}function k(e){if(!x)return;let t=E(e);if(!t)return;let n=C(y);T(n,t)&&w(y,n);let r=C(b);T(r,t)&&w(b,r);try{let e=new CustomEvent(`sigil:url-registered`,{detail:{url:t}});window.dispatchEvent(e)}catch{}try{O()?.postMessage({type:`sigil:add`,url:t})}catch{}try{let e=S();e.registerSigilUrl!==k&&(e.registerSigilUrl=k)}catch{}}if(x)try{let e=S();e.registerSigilUrl!==k&&(e.registerSigilUrl=k)}catch{}export{v as n,k as t}; \ No newline at end of file +import{Bt as e,Ht as t,Tn as n,jn as r,t as i,tn as a}from"./index-CcPm2yTY.js";import{n as o}from"./SigilAuthContext-CZfkVeGy.js";var s=r(n(),1),c=r(a(),1);function l(e){return typeof e==`string`?e.toLowerCase():``}function u(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function d(e){return typeof e==`string`&&e.length>0}function f(e){return typeof e==`number`&&Number.isFinite(e)}function p(e){if(typeof e!=`string`||!e)return!1;try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}}function m(e){if(typeof e!=`object`||!e)throw Error(`Malformed sigil metadata.`);let t=e;for(let e of[`pulse`,`beat`,`stepIndex`,`chakraDay`])if(!u(t,e))throw Error(`Missing Kai field: ${e}`);if(!u(t,`kaiSignature`))throw Error(`Invalid Kai Signature — tampered or unsigned sigil.`);if(!f(t.pulse))throw Error(`Invalid field: pulse`);if(!f(t.beat))throw Error(`Invalid field: beat`);if(!f(t.stepIndex))throw Error(`Invalid field: stepIndex`);if(!d(t.chakraDay))throw Error(`Invalid field: chakraDay`);if(!d(t.kaiSignature))throw Error(`Invalid field: kaiSignature`)}function h(e){try{let t=new DOMParser().parseFromString(e,`image/svg+xml`),n=Array.from(t.getElementsByTagName(`metadata`)),r=[`valuation`,`ledger`,`dht`,`source`];for(let e of n){let t=e.getAttribute(`id`)??``;if(r.some(e=>t.includes(e)))continue;let n=(e.textContent??``).trim();if(!n)continue;let i=n.replace(/^$/,``);try{let e=JSON.parse(i);if(typeof e==`object`&&e&&u(e,`pulse`)&&u(e,`beat`)&&u(e,`stepIndex`)&&u(e,`chakraDay`)&&u(e,`kaiSignature`))return e}catch{}}return null}catch{return null}}function g(e,t){let n=[`sigilActionUrl`,`sigilUrl`,`actionUrl`,`url`,`claimedUrl`,`loginUrl`,`sourceUrl`,`originUrl`,`link`,`href`];if(t)for(let e of n){let n=t[e];if(p(n))return n}try{let t=new DOMParser().parseFromString(e,`image/svg+xml`);for(let e of Array.from(t.getElementsByTagName(`metadata`))){let t=(e.textContent??``).trim();if(!t)continue;let r=t.replace(/^$/,``);try{let e=JSON.parse(r);if(typeof e==`object`&&e)for(let t of n){let n=e[t];if(p(n))return n}}catch{let e=r.match(/https?:\/\/[^\s"'<>)#]+/i);if(e&&p(e[0]))return e[0]}}for(let e of Array.from(t.getElementsByTagName(`a`))){let t=e.getAttribute(`href`)||e.getAttribute(`xlink:href`);if(p(t))return t}}catch{}return null}function _(){return(0,c.jsxs)(`svg`,{className:`kai-orb-svg`,viewBox:`0 0 88 88`,role:`img`,"aria-label":`Kai Orb`,children:[(0,c.jsx)(`defs`,{children:(0,c.jsxs)(`radialGradient`,{id:`orbGlow`,cx:`50%`,cy:`50%`,r:`50%`,children:[(0,c.jsx)(`stop`,{offset:`0%`,stopColor:`#ffffff`,stopOpacity:`1`}),(0,c.jsx)(`stop`,{offset:`55%`,stopColor:`#00ffd0`,stopOpacity:`1`}),(0,c.jsx)(`stop`,{offset:`100%`,stopColor:`#00ffd0`,stopOpacity:`0`})]})}),(0,c.jsx)(`circle`,{cx:`44`,cy:`44`,r:`41`,fill:`none`,stroke:`#00ffd0`,strokeOpacity:`0.38`,strokeWidth:`1.6`}),(0,c.jsx)(`circle`,{cx:`44`,cy:`44`,r:`32`,fill:`none`,stroke:`#8a2be2`,strokeOpacity:`0.45`,strokeWidth:`1.4`}),(0,c.jsxs)(`g`,{opacity:`0.45`,children:[(0,c.jsx)(`circle`,{cx:`44`,cy:`44`,r:`20`,fill:`none`,stroke:`rgba(255,255,255,.3)`,strokeWidth:`.8`}),(0,c.jsx)(`circle`,{cx:`44`,cy:`44`,r:`10`,fill:`none`,stroke:`rgba(255,255,255,.25)`,strokeWidth:`.7`}),(0,c.jsx)(`line`,{x1:`44`,y1:`4`,x2:`44`,y2:`84`,stroke:`rgba(255,255,255,.2)`,strokeWidth:`.8`}),(0,c.jsx)(`line`,{x1:`4`,y1:`44`,x2:`84`,y2:`44`,stroke:`rgba(255,255,255,.2)`,strokeWidth:`.8`})]}),(0,c.jsx)(`circle`,{cx:`44`,cy:`44`,r:`10`,fill:`url(#orbGlow)`}),(0,c.jsx)(`path`,{d:`M44 14 L72 68 H16 Z`,fill:`none`,stroke:`#00b4ff`,strokeOpacity:`0.35`,strokeWidth:`1.2`})]})}function v({onVerified:n}){let r=(0,s.useRef)(null),[a,d]=(0,s.useState)(null),[f,p]=(0,s.useState)(!1),[v,y]=(0,s.useState)(!1),[b,x]=(0,s.useState)(null),{setAuth:S}=o(),C=(0,s.useCallback)(async a=>{p(!0),d(null),x(null);try{if(a.type!==`image/svg+xml`&&!a.name.toLowerCase().endsWith(`.svg`))throw Error(`Please upload an SVG sigil file.`);let r=await a.text(),{meta:o,contextOk:s,typeOk:c}=await i(a),d=o&&u(o,`kaiSignature`)&&u(o,`pulse`)?o:h(r);if(!d||!s||!c)throw Error(`Malformed or unrecognized sigil structure.`);m(d);let f=d,p=await e(f);if(!p||l(p)!==l(f.kaiSignature))throw Error(`Invalid Kai Signature — tampered or unsigned sigil.`);let _=await t(f.kaiSignature);if(typeof f.userPhiKey==`string`){if(l(_)!==l(f.userPhiKey))throw Error(`Φ-Key mismatch — identity invalid.`)}else f.userPhiKey=_;let v=g(r,f)??void 0;S(r,{pulse:f.pulse,beat:f.beat,stepIndex:f.stepIndex,chakraDay:f.chakraDay,kaiSignature:f.kaiSignature,userPhiKey:f.userPhiKey,...typeof f.sigilId==`string`?{sigilId:f.sigilId}:{},...v?{sigilActionUrl:v}:{}}),x(f),n(r,f)}catch(e){d(e instanceof Error?e.message:`Invalid sigil file. Ensure it’s a Kai-sealed SVG with embedded JSON .`)}finally{p(!1),r.current&&(r.current.value=``)}},[n,S]),w=async e=>{let t=e.target.files?.[0];t&&await C(t)};return(0,c.jsx)(`div`,{className:`sigil-login-only w-full max-w-xl mx-auto`,children:(0,c.jsxs)(`div`,{onDrop:async e=>{e.preventDefault(),e.stopPropagation(),y(!1);let t=e.dataTransfer.files?.[0];t&&await C(t)},onDragOver:e=>{e.preventDefault(),e.stopPropagation(),y(!0)},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),y(!1)},onKeyDown:e=>{f||(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),r.current?.click())},className:[`sigil-dropzone`,v?`sigil-dropzone--over`:``,f?`sigil-dropzone--loading`:``,b?`sigil-dropzone--ok`:``,a?`sigil-dropzone--err`:``].filter(Boolean).join(` `),role:`button`,tabIndex:0,"aria-disabled":f,title:`Drag & drop your Kai-sealed SVG here, or tap to browse`,"aria-label":`Inhale or drop your Kai-sealed SVG sigil`,"aria-describedby":`sigil-instructions sigil-trustline`,onClick:()=>{f||r.current?.click()},children:[(0,c.jsx)(`div`,{className:`sigil-grid`,"aria-hidden":!0}),(0,c.jsx)(`div`,{className:`sigil-ring sigil-ring--outer`,"aria-hidden":!0}),(0,c.jsx)(`div`,{className:`sigil-ring sigil-ring--inner`,"aria-hidden":!0}),(0,c.jsxs)(`div`,{className:`sigil-center`,children:[(0,c.jsx)(`div`,{className:`sigil-orb`,"aria-hidden":!0,children:(0,c.jsx)(_,{})}),(0,c.jsxs)(`p`,{id:`sigil-instructions`,className:`sigil-instructions`,children:[`Inhale, `,(0,c.jsx)(`span`,{className:`sigil-accent`,children:`Φkey here.`})]}),(0,c.jsxs)(`div`,{className:`sigil-status`,"aria-live":`polite`,children:[f&&(0,c.jsxs)(`div`,{className:`sigil-status__row`,children:[(0,c.jsx)(`span`,{className:`sigil-spinner`,"aria-hidden":`true`}),(0,c.jsx)(`span`,{children:`Verifying signature & deriving Φ-Key…`})]}),!f&&b&&(0,c.jsxs)(`div`,{className:`sigil-status__ok`,children:[(0,c.jsx)(`span`,{className:`ok-dot`,"aria-hidden":`true`}),(0,c.jsx)(`span`,{children:`Verified — Φ-Key bound`})]}),!f&&a&&(0,c.jsx)(`div`,{className:`sigil-status__err`,children:a})]})]}),(0,c.jsx)(`input`,{ref:r,type:`file`,accept:`.svg,image/svg+xml`,onChange:w,className:`sigil-file-input`,tabIndex:-1,"aria-hidden":`true`})]})})}const y=`kai:sigils:v1`,b=`sigil:urls`;var x=typeof window<`u`;function S(){if(!x)return{};let e=window;return e.__SIGIL__||={},e.__SIGIL__}function C(e){if(!x)return[];try{let t=window.localStorage.getItem(e);if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean):[]}catch{return[]}}function w(e,t){if(x)try{let n=Array.from(new Set(t.map(e=>e.trim()).filter(Boolean)));window.localStorage.setItem(e,JSON.stringify(n))}catch{}}function T(e,t){return e.includes(t)?!1:(e.push(t),!0)}function E(e){let t=e.trim();if(!t)return null;if(!x)return t;try{return new URL(t,window.location.origin).toString()}catch{return t}}var D=null;function O(){return!x||!(`BroadcastChannel`in window)?null:D||(D=new BroadcastChannel(`kai-sigil-registry`),D)}function k(e){if(!x)return;let t=E(e);if(!t)return;let n=C(y);T(n,t)&&w(y,n);let r=C(b);T(r,t)&&w(b,r);try{let e=new CustomEvent(`sigil:url-registered`,{detail:{url:t}});window.dispatchEvent(e)}catch{}try{O()?.postMessage({type:`sigil:add`,url:t})}catch{}try{let e=S();e.registerSigilUrl!==k&&(e.registerSigilUrl=k)}catch{}}if(x)try{let e=S();e.registerSigilUrl!==k&&(e.registerSigilUrl=k)}catch{}export{v as n,k as t}; \ No newline at end of file diff --git a/dist/assets/sigilUrl-Bbrnoz50.js b/dist/assets/sigilUrl-w0EYDFh2.js similarity index 75% rename from dist/assets/sigilUrl-Bbrnoz50.js rename to dist/assets/sigilUrl-w0EYDFh2.js index 35666f2d..408743d9 100644 --- a/dist/assets/sigilUrl-Bbrnoz50.js +++ b/dist/assets/sigilUrl-w0EYDFh2.js @@ -1 +1 @@ -import{B as e,G as t,H as n,I as r,J as i,K as a,L as o,R as s,U as c,V as l,W as u,X as d,Y as f,q as p,z as m}from"./index-BGzUQCv_.js";export{r as SIGIL_CHANNEL_NAME,o as SIGIL_MODAL_FALLBACK_LS_KEY,s as SIGIL_REGISTRY_LS_KEY,m as canonicalUrlFromContext,e as decodeSigilHistory,l as decodeSigilPayload,n as encodeSigilHistory,c as encodeSigilPayload,u as extractPayloadFromUrl,t as extractPayloadParamFromUrl,a as getOriginUrl,p as makeCanonicalQrUrl,i as makeSigilUrl,f as registerSigilUrl,d as resolveLineageBackwards}; \ No newline at end of file +import{B as e,G as t,H as n,I as r,J as i,K as a,L as o,R as s,U as c,V as l,W as u,X as d,Y as f,q as p,z as m}from"./index-CcPm2yTY.js";export{r as SIGIL_CHANNEL_NAME,o as SIGIL_MODAL_FALLBACK_LS_KEY,s as SIGIL_REGISTRY_LS_KEY,m as canonicalUrlFromContext,e as decodeSigilHistory,l as decodeSigilPayload,n as encodeSigilHistory,c as encodeSigilPayload,u as extractPayloadFromUrl,t as extractPayloadParamFromUrl,a as getOriginUrl,p as makeCanonicalQrUrl,i as makeSigilUrl,f as registerSigilUrl,d as resolveLineageBackwards}; \ No newline at end of file diff --git a/dist/assets/sigilUtils-CQzAWmTd.js b/dist/assets/sigilUtils-BWqerTXt.js similarity index 89% rename from dist/assets/sigilUtils-CQzAWmTd.js rename to dist/assets/sigilUtils-BWqerTXt.js index 203cce8d..a7334955 100644 --- a/dist/assets/sigilUtils-CQzAWmTd.js +++ b/dist/assets/sigilUtils-BWqerTXt.js @@ -1 +1 @@ -import{Bt as e,Ft as t,Gt as n,Ht as r,It as i,Jt as a,Kt as o,Lt as s,Qt as c,Rt as l,Ut as u,Vt as d,Wt as f,Xt as p,Yt as m,Zt as h,qt as g,zt as _}from"./index-BGzUQCv_.js";export{t as SIGIL_SCHEMA,i as base64urlJson,s as buildReceiveMessageV14,l as buildSendMessageV14,_ as computeHeadWindowRoot,e as computeKaiSignature,d as derivePhiKeyFromMeta,r as derivePhiKeyFromSig,u as expectedPrevHeadRootV14,f as genNonce,n as hashAny,o as hashTransfer,g as hashTransferSenderSide,a as headCanonicalHash,m as headCanonicalHashV14,p as isSigilMetaOk,h as stableStringify,c as sumSegments}; \ No newline at end of file +import{Bt as e,Ft as t,Gt as n,Ht as r,It as i,Jt as a,Kt as o,Lt as s,Qt as c,Rt as l,Ut as u,Vt as d,Wt as f,Xt as p,Yt as m,Zt as h,qt as g,zt as _}from"./index-CcPm2yTY.js";export{t as SIGIL_SCHEMA,i as base64urlJson,s as buildReceiveMessageV14,l as buildSendMessageV14,_ as computeHeadWindowRoot,e as computeKaiSignature,d as derivePhiKeyFromMeta,r as derivePhiKeyFromSig,u as expectedPrevHeadRootV14,f as genNonce,n as hashAny,o as hashTransfer,g as hashTransferSenderSide,a as headCanonicalHash,m as headCanonicalHashV14,p as isSigilMetaOk,h as stableStringify,c as sumSegments}; \ No newline at end of file diff --git a/dist/assets/svgMeta-Drisw1CT.js b/dist/assets/svgMeta-ADMUtfmL.js similarity index 79% rename from dist/assets/svgMeta-Drisw1CT.js rename to dist/assets/svgMeta-ADMUtfmL.js index df720eb5..8b6103f0 100644 --- a/dist/assets/svgMeta-Drisw1CT.js +++ b/dist/assets/svgMeta-ADMUtfmL.js @@ -1 +1 @@ -import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c,u as l}from"./svgMeta-B547igV7.js";export{c as NS,i as ensureMetadata,o as ensureTitleAndDesc,n as ensureViewBoxOnClone,e as ensureXmlns,a as parseSvgAndMetadata,s as putMetadata,t as sanitizeSvgString,r as validateSigilMeta,l as validateSvgForVerifier}; \ No newline at end of file +import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c,u as l}from"./svgMeta-BqZogknt.js";export{c as NS,i as ensureMetadata,o as ensureTitleAndDesc,n as ensureViewBoxOnClone,e as ensureXmlns,a as parseSvgAndMetadata,s as putMetadata,t as sanitizeSvgString,r as validateSigilMeta,l as validateSvgForVerifier}; \ No newline at end of file diff --git a/dist/assets/svgMeta-B547igV7.js b/dist/assets/svgMeta-BqZogknt.js similarity index 98% rename from dist/assets/svgMeta-B547igV7.js rename to dist/assets/svgMeta-BqZogknt.js index 50800803..a649290a 100644 --- a/dist/assets/svgMeta-B547igV7.js +++ b/dist/assets/svgMeta-BqZogknt.js @@ -1 +1 @@ -import{cn as e,un as t}from"./index-BGzUQCv_.js";function n(e){return Math.max(0,Math.floor(e))*11}function r(e){return Math.max(0,Math.floor(e))}function i(e,t){let n=11*t,r=(e%n+n)%n;return Math.floor(r/11)}var a=`http://www.w3.org/2000/svg`,o=`http://www.w3.org/1999/xlink`;function s(e){if(typeof e!=`string`||e.trim()===``)return e;let t=e.replace(//gi,``);return t=t.replace(/\son[a-z]+\s*=\s*"[^"]*"/gi,``),t=t.replace(/\son[a-z]+\s*=\s*'[^']*'/gi,``),t=t.replace(/\son[a-z]+\s*=\s*[^\s>'"]+/gi,``),t=t.replace(/\s(?:xlink:)?href\s*=\s*"(?:https?:)?\/\/[^"]*"/gi,``),t=t.replace(/\s(?:xlink:)?href\s*=\s*'(?:https?:)?\/\/[^']*'/gi,``),t=t.replace(//gi,``),t}function c(e){let t=s(e),n=new DOMParser().parseFromString(t,`image/svg+xml`).documentElement;if(!n||n.nodeName.toLowerCase()!==`svg`)throw Error(`Invalid SVG`);let r=n.querySelector(`metadata`),i={};if(r&&r.textContent)try{i=JSON.parse(r.textContent)}catch{i={}}return{svg:n,meta:i}}function l(e){e.getAttribute(`xmlns`)||e.setAttribute(`xmlns`,a),e.getAttribute(`xmlns:xlink`)||e.setAttribute(`xmlns:xlink`,o)}function u(e){let t=e.ownerDocument??document,n=e.querySelector(`metadata`);if(n)return n;let r=t.createElementNS(a,`metadata`);return e.insertBefore(r,e.firstChild),r}function d(e,t,n){let r=e.ownerDocument??document,i=e.querySelector(`title`);i||(i=r.createElementNS(a,`title`),e.insertBefore(i,e.firstChild)),i.textContent=t;let o=e.querySelector(`desc`);o||(o=r.createElementNS(a,`desc`),e.insertBefore(o,i.nextSibling)),o.textContent=n}function f(e,t){if(!e.getAttribute(`viewBox`))try{let n=e.viewBox.baseVal;if(n?.width&&n?.height)e.setAttribute(`viewBox`,`${n.x} ${n.y} ${n.width} ${n.height}`);else if(typeof e.getBBox==`function`){let n=e.getBBox();n?.width&&n?.height?e.setAttribute(`viewBox`,`${n.x} ${n.y} ${n.width} ${n.height}`):e.setAttribute(`viewBox`,`0 0 ${t} ${t}`)}else e.setAttribute(`viewBox`,`0 0 ${t} ${t}`)}catch{e.setAttribute(`viewBox`,`0 0 ${t} ${t}`)}e.setAttribute(`width`,String(t)),e.setAttribute(`height`,String(t)),e.setAttribute(`preserveAspectRatio`,`xMidYMid meet`)}function p(e,t){let n=u(e);n.textContent=JSON.stringify(t),l(e);let r=new XMLSerializer().serializeToString(e);return r.startsWith(`\n${r}`}var m=e=>typeof e==`number`&&Number.isFinite(e),h=(e,t=0)=>{if(m(e))return e;if(typeof e==`string`&&e.trim()!==``){let n=Number(e);return Number.isFinite(n)?n:t}return t};function g(e){let t=[];if(e.pulse??t.push(`Missing metadata field: pulse`),e.beat??t.push(`Missing metadata field: beat`),e.chakraDay??t.push(`Missing metadata field: chakraDay`),t.length>0)return{ok:!1,errors:t};let n=Number.isFinite(e.stepsPerBeat)?Math.max(1,Number(e.stepsPerBeat)):44,r=Number(e.pulse),a=Number(e.stepIndex),o=Number.isFinite(a)&&a>=0&&a.`),a||l.push(`Missing viewBox on .`),o||l.push(`Missing width/height on .`),t&&u?.canonicalHash&&u.canonicalHash!==t&&l.push(`canonicalHash in Φkey metadata does not match the live glyph hash.`),{ok:l.length===0&&s,errors:l,payload:u??null,meta:r}}catch(e){return{ok:!1,errors:[e instanceof Error&&e.message?e.message:`Invalid SVG`],payload:null,meta:null}}}const v={SVG_NS:a,XLINK_NS:o};export{l as a,s as c,r as d,i as f,f as i,g as l,u as n,c as o,n as p,d as r,p as s,v as t,_ as u}; \ No newline at end of file +import{cn as e,un as t}from"./index-CcPm2yTY.js";function n(e){return Math.max(0,Math.floor(e))*11}function r(e){return Math.max(0,Math.floor(e))}function i(e,t){let n=11*t,r=(e%n+n)%n;return Math.floor(r/11)}var a=`http://www.w3.org/2000/svg`,o=`http://www.w3.org/1999/xlink`;function s(e){if(typeof e!=`string`||e.trim()===``)return e;let t=e.replace(//gi,``);return t=t.replace(/\son[a-z]+\s*=\s*"[^"]*"/gi,``),t=t.replace(/\son[a-z]+\s*=\s*'[^']*'/gi,``),t=t.replace(/\son[a-z]+\s*=\s*[^\s>'"]+/gi,``),t=t.replace(/\s(?:xlink:)?href\s*=\s*"(?:https?:)?\/\/[^"]*"/gi,``),t=t.replace(/\s(?:xlink:)?href\s*=\s*'(?:https?:)?\/\/[^']*'/gi,``),t=t.replace(//gi,``),t}function c(e){let t=s(e),n=new DOMParser().parseFromString(t,`image/svg+xml`).documentElement;if(!n||n.nodeName.toLowerCase()!==`svg`)throw Error(`Invalid SVG`);let r=n.querySelector(`metadata`),i={};if(r&&r.textContent)try{i=JSON.parse(r.textContent)}catch{i={}}return{svg:n,meta:i}}function l(e){e.getAttribute(`xmlns`)||e.setAttribute(`xmlns`,a),e.getAttribute(`xmlns:xlink`)||e.setAttribute(`xmlns:xlink`,o)}function u(e){let t=e.ownerDocument??document,n=e.querySelector(`metadata`);if(n)return n;let r=t.createElementNS(a,`metadata`);return e.insertBefore(r,e.firstChild),r}function d(e,t,n){let r=e.ownerDocument??document,i=e.querySelector(`title`);i||(i=r.createElementNS(a,`title`),e.insertBefore(i,e.firstChild)),i.textContent=t;let o=e.querySelector(`desc`);o||(o=r.createElementNS(a,`desc`),e.insertBefore(o,i.nextSibling)),o.textContent=n}function f(e,t){if(!e.getAttribute(`viewBox`))try{let n=e.viewBox.baseVal;if(n?.width&&n?.height)e.setAttribute(`viewBox`,`${n.x} ${n.y} ${n.width} ${n.height}`);else if(typeof e.getBBox==`function`){let n=e.getBBox();n?.width&&n?.height?e.setAttribute(`viewBox`,`${n.x} ${n.y} ${n.width} ${n.height}`):e.setAttribute(`viewBox`,`0 0 ${t} ${t}`)}else e.setAttribute(`viewBox`,`0 0 ${t} ${t}`)}catch{e.setAttribute(`viewBox`,`0 0 ${t} ${t}`)}e.setAttribute(`width`,String(t)),e.setAttribute(`height`,String(t)),e.setAttribute(`preserveAspectRatio`,`xMidYMid meet`)}function p(e,t){let n=u(e);n.textContent=JSON.stringify(t),l(e);let r=new XMLSerializer().serializeToString(e);return r.startsWith(`\n${r}`}var m=e=>typeof e==`number`&&Number.isFinite(e),h=(e,t=0)=>{if(m(e))return e;if(typeof e==`string`&&e.trim()!==``){let n=Number(e);return Number.isFinite(n)?n:t}return t};function g(e){let t=[];if(e.pulse??t.push(`Missing metadata field: pulse`),e.beat??t.push(`Missing metadata field: beat`),e.chakraDay??t.push(`Missing metadata field: chakraDay`),t.length>0)return{ok:!1,errors:t};let n=Number.isFinite(e.stepsPerBeat)?Math.max(1,Number(e.stepsPerBeat)):44,r=Number(e.pulse),a=Number(e.stepIndex),o=Number.isFinite(a)&&a>=0&&a.`),a||l.push(`Missing viewBox on .`),o||l.push(`Missing width/height on .`),t&&u?.canonicalHash&&u.canonicalHash!==t&&l.push(`canonicalHash in Φkey metadata does not match the live glyph hash.`),{ok:l.length===0&&s,errors:l,payload:u??null,meta:r}}catch(e){return{ok:!1,errors:[e instanceof Error&&e.message?e.message:`Invalid SVG`],payload:null,meta:null}}}const v={SVG_NS:a,XLINK_NS:o};export{l as a,s as c,r as d,i as f,f as i,g as l,u as n,c as o,n as p,d as r,p as s,v as t,_ as u}; \ No newline at end of file diff --git a/dist/assets/useFastPress-Cbh2am8D.js b/dist/assets/useFastPress-BuTJ0eyZ.js similarity index 80% rename from dist/assets/useFastPress-Cbh2am8D.js rename to dist/assets/useFastPress-BuTJ0eyZ.js index 756c7a57..0bee3bc6 100644 --- a/dist/assets/useFastPress-Cbh2am8D.js +++ b/dist/assets/useFastPress-BuTJ0eyZ.js @@ -1 +1 @@ -import{Tn as e,jn as t}from"./index-BGzUQCv_.js";var n=t(e(),1);function r(e){let t=(0,n.useRef)(!1);return{onPointerUp:(0,n.useCallback)(n=>{n.pointerType&&n.pointerType!==`mouse`&&(t.current=!0,e(n),setTimeout(()=>{t.current=!1},0))},[e]),onClick:(0,n.useCallback)(n=>{if(t.current){t.current=!1;return}e(n)},[e])}}export{r as t}; \ No newline at end of file +import{Tn as e,jn as t}from"./index-CcPm2yTY.js";var n=t(e(),1);function r(e){let t=(0,n.useRef)(!1);return{onPointerUp:(0,n.useCallback)(n=>{n.pointerType&&n.pointerType!==`mouse`&&(t.current=!0,e(n),setTimeout(()=>{t.current=!1},0))},[e]),onClick:(0,n.useCallback)(n=>{if(t.current){t.current=!1;return}e(n)},[e])}}export{r as t}; \ No newline at end of file diff --git a/dist/assets/usernameClaimRegistry-BEUaCJlN.js b/dist/assets/usernameClaimRegistry-_VlzEwdK.js similarity index 98% rename from dist/assets/usernameClaimRegistry-BEUaCJlN.js rename to dist/assets/usernameClaimRegistry-_VlzEwdK.js index 130d4736..81ac7669 100644 --- a/dist/assets/usernameClaimRegistry-BEUaCJlN.js +++ b/dist/assets/usernameClaimRegistry-_VlzEwdK.js @@ -1 +1 @@ -import{Ct as e,gt as t,mn as n,mt as r}from"./index-BGzUQCv_.js";function i(e){let t=2166136261;for(let n=0;n>>0).toString(16).padStart(8,`0`)}function a(e,t,n){let r=e.metadata?.kaiSignature??``,a=typeof n?.kaiSignature==`string`?n.kaiSignature:``,o=typeof n?.timestamp==`number`?String(n.timestamp):``;return`glyph::${t}::${i(`evolve|p=${t}|parentHash=${e.hash}|parentSig=${r}|patchSig=${a}|patchTs=${o}`)}`}function o(t,n,r){let i=a(t,n,r),o=typeof r?.timestamp==`number`?r.timestamp:n,s={...t.metadata??{},...r??{},kaiSignature:i,timestamp:o},c={hash:i,pulseCreated:n,pulseGenesis:t.pulseGenesis??t.pulseCreated,parentHash:t.hash,sentFrom:t.hash,value:1,inhaled:{},metadata:s},l=(t.sentTo??[]).map(e=>({senderSignature:t.metadata?.kaiSignature??t.hash,senderStamp:t.hash,senderKaiPulse:e.pulseSent,receiverSignature:e.recipientHash})),{unsigned:u}=e({pulse:n,kaiSignature:i,seriesSize:1,quality:`med`,creatorVerified:!1,creatorRep:0,transfers:l,cumulativeTransfers:l.length},n);return c.value=u.valuePhi,c}function s(e){let t=(e??``).trim();return t?t.replace(/^@+/,``).replace(/[\s_]+/g,` `).trim().toLowerCase().replace(/[.,;:!?]+$/g,``):``}function c(e){let t=(e??``).trim();if(!t)return``;if(/^[0-9a-f]{64}$/i.test(t))return t.toLowerCase();if(/^[A-Za-z0-9_-]{16,}$/u.test(t))return r(t);try{let e=new URL(t),n=e.pathname||``,i=n.match(/\/(?:stream|feed)\/p\/([^/?#]+)/u)||n.match(/\/p\/([^/?#]+)/u)||n.match(/\/p(?:\u007e|%7[Ee])\/?([^/?#]+)/u);if(i?.[1])return r(i[1]);let a=e.hash&&e.hash.startsWith(`#`)?e.hash.slice(1):``,o=new URLSearchParams(a),s=e.searchParams;for(let e of[`t`,`p`,`token`,`capsule`]){let t=o.get(e);if(t)return r(t);let n=s.get(e);if(n)return r(n)}}catch{}return``}function l(e,n,r){let i=s(n);if(!i)throw Error(`Username required for claim payload`);return{kind:t,username:n.trim(),normalized:i,originHash:e,ownerHint:r??null}}function u(e){let t=l(e.origin.hash,e.username,e.ownerHint??e.origin.meta?.userPhiKey??e.origin.metadata?.creator??null),n={...e.origin.metadata??{},usernameClaim:t};return o(e.origin,e.pulse,n)}var d=typeof window<`u`,f=`kai:username-claims:v1`,p=`kai-username-claims`,m=`username-claim:registered`,h=`username-claim`,g={};function _(e){return Object.fromEntries(Object.entries(e))}function v(e){let t=BigInt(2**53-1);return e>t?2**53-1:e<-t?-(2**53-1):Number(e)}function y(){return v(n())}function b(e){let t=(e??``).trim();if(!t)return null;if(!d)return t;try{return new URL(t,window.location?.origin??void 0).toString()}catch{return t}}function x(e){if(typeof e==`number`)return Number.isFinite(e)?e:0;if(typeof e==`bigint`)return v(e);if(typeof e==`string`){let t=e.trim();if(!t)return 0;let n=Number(t);return Number.isFinite(n)?n:0}return 0}function S(e){if(!e||typeof e!=`object`)return null;let t=e,n=typeof t.normalized==`string`?t.normalized:``,r=typeof t.claimHash==`string`?t.claimHash:``;if(!n||!r)return null;let i={username:typeof t.username==`string`?t.username:n,normalized:n,claimHash:r,claimUrl:typeof t.claimUrl==`string`?t.claimUrl:``,originHash:typeof t.originHash==`string`?t.originHash:``,ownerHint:t.ownerHint===null||typeof t.ownerHint==`string`?t.ownerHint:null,updatedAt:x(t.updatedAt)};return!i.claimUrl||!i.originHash?null:i}function C(){if(!d)return _(g);try{let e=window.localStorage.getItem(f);if(!e)return g={},{};let t=JSON.parse(e);if(!t||typeof t!=`object`)return{};let n=t,r={};for(let[e,t]of Object.entries(n)){let n=S(t);n&&(r[e]=n)}return g=_(r),_(r)}catch{return _(g)}}function w(e){if(g=_(e),d)try{window.localStorage.setItem(f,JSON.stringify(e))}catch{}}var T=null;function E(){return!d||!(`BroadcastChannel`in window)?null:T||(T=new BroadcastChannel(p),T)}function D(e){let t=C(),n={...e,updatedAt:x(e?.updatedAt)},r=t[n.normalized];return r&&r.claimHash!==n.claimHash?!1:r&&r.claimHash===n.claimHash&&r.claimUrl===n.claimUrl&&r.originHash===n.originHash&&r.ownerHint===n.ownerHint&&r.updatedAt===n.updatedAt?!0:(t[n.normalized]=n,w(t),!0)}function O(e){if(d){try{let t=new CustomEvent(m,{detail:e});window.dispatchEvent(t)}catch{}try{E()?.postMessage({type:h,entry:e})}catch{}}}function k(e,t){let n=t.payload;if(!n||n.kind!==`username_claim`)return{updated:!1,reason:`not a username-claim glyph`};let r=c(t.hash);if(!r)return{updated:!1,reason:`missing glyph hash`};let i=s(n.normalized||n.username);if(!i)return{updated:!1,reason:`missing username`};let a=e[i];if(a&&a.claimHash!==r)return{updated:!1,reason:`username already bound`};let o=b(t.url??``);if(!o)return{updated:!1,reason:`missing claim url`};let l=t.ownerHint??n.ownerHint??null,u={username:n.username,normalized:i,claimHash:r,claimUrl:o,originHash:n.originHash,ownerHint:l,updatedAt:y()},d=a&&a.claimHash===u.claimHash&&a.claimUrl===u.claimUrl&&a.originHash===u.originHash&&a.ownerHint===u.ownerHint;return e[i]=u,{updated:!d,entry:u}}function A(e){let t=C(),{updated:n,entry:r,reason:i}=k(t,e);return n?(w(t),r&&O(r),{accepted:!0,updated:!0,registry:t}):{accepted:!!r,updated:!1,reason:i,registry:t}}function j(){return C()}function M(e){if(!d)return()=>{};let t=t=>{let n=t;n?.detail&&D(n.detail)&&e(n.detail,`event`)},n=E(),r=t=>{let n=t?.data;n?.type===h&&n.entry&&D(n.entry)&&e(n.entry,`broadcast`)},i=t=>{if(!(t.key!==f||typeof t.newValue!=`string`))try{let n=JSON.parse(t.newValue);for(let t of Object.values(n)){let n=S(t);n&&D(n)&&e(n,`storage`)}}catch{}};return window.addEventListener(m,t),n&&n.addEventListener(`message`,r),window.addEventListener(`storage`,i),()=>{window.removeEventListener(m,t),n&&n.removeEventListener(`message`,r),window.removeEventListener(`storage`,i)}}export{c as a,u as i,A as n,s as o,M as r,j as t}; \ No newline at end of file +import{Ct as e,gt as t,mn as n,mt as r}from"./index-CcPm2yTY.js";function i(e){let t=2166136261;for(let n=0;n>>0).toString(16).padStart(8,`0`)}function a(e,t,n){let r=e.metadata?.kaiSignature??``,a=typeof n?.kaiSignature==`string`?n.kaiSignature:``,o=typeof n?.timestamp==`number`?String(n.timestamp):``;return`glyph::${t}::${i(`evolve|p=${t}|parentHash=${e.hash}|parentSig=${r}|patchSig=${a}|patchTs=${o}`)}`}function o(t,n,r){let i=a(t,n,r),o=typeof r?.timestamp==`number`?r.timestamp:n,s={...t.metadata??{},...r??{},kaiSignature:i,timestamp:o},c={hash:i,pulseCreated:n,pulseGenesis:t.pulseGenesis??t.pulseCreated,parentHash:t.hash,sentFrom:t.hash,value:1,inhaled:{},metadata:s},l=(t.sentTo??[]).map(e=>({senderSignature:t.metadata?.kaiSignature??t.hash,senderStamp:t.hash,senderKaiPulse:e.pulseSent,receiverSignature:e.recipientHash})),{unsigned:u}=e({pulse:n,kaiSignature:i,seriesSize:1,quality:`med`,creatorVerified:!1,creatorRep:0,transfers:l,cumulativeTransfers:l.length},n);return c.value=u.valuePhi,c}function s(e){let t=(e??``).trim();return t?t.replace(/^@+/,``).replace(/[\s_]+/g,` `).trim().toLowerCase().replace(/[.,;:!?]+$/g,``):``}function c(e){let t=(e??``).trim();if(!t)return``;if(/^[0-9a-f]{64}$/i.test(t))return t.toLowerCase();if(/^[A-Za-z0-9_-]{16,}$/u.test(t))return r(t);try{let e=new URL(t),n=e.pathname||``,i=n.match(/\/(?:stream|feed)\/p\/([^/?#]+)/u)||n.match(/\/p\/([^/?#]+)/u)||n.match(/\/p(?:\u007e|%7[Ee])\/?([^/?#]+)/u);if(i?.[1])return r(i[1]);let a=e.hash&&e.hash.startsWith(`#`)?e.hash.slice(1):``,o=new URLSearchParams(a),s=e.searchParams;for(let e of[`t`,`p`,`token`,`capsule`]){let t=o.get(e);if(t)return r(t);let n=s.get(e);if(n)return r(n)}}catch{}return``}function l(e,n,r){let i=s(n);if(!i)throw Error(`Username required for claim payload`);return{kind:t,username:n.trim(),normalized:i,originHash:e,ownerHint:r??null}}function u(e){let t=l(e.origin.hash,e.username,e.ownerHint??e.origin.meta?.userPhiKey??e.origin.metadata?.creator??null),n={...e.origin.metadata??{},usernameClaim:t};return o(e.origin,e.pulse,n)}var d=typeof window<`u`,f=`kai:username-claims:v1`,p=`kai-username-claims`,m=`username-claim:registered`,h=`username-claim`,g={};function _(e){return Object.fromEntries(Object.entries(e))}function v(e){let t=BigInt(2**53-1);return e>t?2**53-1:e<-t?-(2**53-1):Number(e)}function y(){return v(n())}function b(e){let t=(e??``).trim();if(!t)return null;if(!d)return t;try{return new URL(t,window.location?.origin??void 0).toString()}catch{return t}}function x(e){if(typeof e==`number`)return Number.isFinite(e)?e:0;if(typeof e==`bigint`)return v(e);if(typeof e==`string`){let t=e.trim();if(!t)return 0;let n=Number(t);return Number.isFinite(n)?n:0}return 0}function S(e){if(!e||typeof e!=`object`)return null;let t=e,n=typeof t.normalized==`string`?t.normalized:``,r=typeof t.claimHash==`string`?t.claimHash:``;if(!n||!r)return null;let i={username:typeof t.username==`string`?t.username:n,normalized:n,claimHash:r,claimUrl:typeof t.claimUrl==`string`?t.claimUrl:``,originHash:typeof t.originHash==`string`?t.originHash:``,ownerHint:t.ownerHint===null||typeof t.ownerHint==`string`?t.ownerHint:null,updatedAt:x(t.updatedAt)};return!i.claimUrl||!i.originHash?null:i}function C(){if(!d)return _(g);try{let e=window.localStorage.getItem(f);if(!e)return g={},{};let t=JSON.parse(e);if(!t||typeof t!=`object`)return{};let n=t,r={};for(let[e,t]of Object.entries(n)){let n=S(t);n&&(r[e]=n)}return g=_(r),_(r)}catch{return _(g)}}function w(e){if(g=_(e),d)try{window.localStorage.setItem(f,JSON.stringify(e))}catch{}}var T=null;function E(){return!d||!(`BroadcastChannel`in window)?null:T||(T=new BroadcastChannel(p),T)}function D(e){let t=C(),n={...e,updatedAt:x(e?.updatedAt)},r=t[n.normalized];return r&&r.claimHash!==n.claimHash?!1:r&&r.claimHash===n.claimHash&&r.claimUrl===n.claimUrl&&r.originHash===n.originHash&&r.ownerHint===n.ownerHint&&r.updatedAt===n.updatedAt?!0:(t[n.normalized]=n,w(t),!0)}function O(e){if(d){try{let t=new CustomEvent(m,{detail:e});window.dispatchEvent(t)}catch{}try{E()?.postMessage({type:h,entry:e})}catch{}}}function k(e,t){let n=t.payload;if(!n||n.kind!==`username_claim`)return{updated:!1,reason:`not a username-claim glyph`};let r=c(t.hash);if(!r)return{updated:!1,reason:`missing glyph hash`};let i=s(n.normalized||n.username);if(!i)return{updated:!1,reason:`missing username`};let a=e[i];if(a&&a.claimHash!==r)return{updated:!1,reason:`username already bound`};let o=b(t.url??``);if(!o)return{updated:!1,reason:`missing claim url`};let l=t.ownerHint??n.ownerHint??null,u={username:n.username,normalized:i,claimHash:r,claimUrl:o,originHash:n.originHash,ownerHint:l,updatedAt:y()},d=a&&a.claimHash===u.claimHash&&a.claimUrl===u.claimUrl&&a.originHash===u.originHash&&a.ownerHint===u.ownerHint;return e[i]=u,{updated:!d,entry:u}}function A(e){let t=C(),{updated:n,entry:r,reason:i}=k(t,e);return n?(w(t),r&&O(r),{accepted:!0,updated:!0,registry:t}):{accepted:!!r,updated:!1,reason:i,registry:t}}function j(){return C()}function M(e){if(!d)return()=>{};let t=t=>{let n=t;n?.detail&&D(n.detail)&&e(n.detail,`event`)},n=E(),r=t=>{let n=t?.data;n?.type===h&&n.entry&&D(n.entry)&&e(n.entry,`broadcast`)},i=t=>{if(!(t.key!==f||typeof t.newValue!=`string`))try{let n=JSON.parse(t.newValue);for(let t of Object.values(n)){let n=S(t);n&&D(n)&&e(n,`storage`)}}catch{}};return window.addEventListener(m,t),n&&n.addEventListener(`message`,r),window.addEventListener(`storage`,i),()=>{window.removeEventListener(m,t),n&&n.removeEventListener(`message`,r),window.removeEventListener(`storage`,i)}}export{c as a,u as i,A as n,s as o,M as r,j as t}; \ No newline at end of file diff --git a/dist/assets/x-B04jFFwi.js b/dist/assets/x-B0A9hqeh.js similarity index 55% rename from dist/assets/x-B04jFFwi.js rename to dist/assets/x-B0A9hqeh.js index 3e60417f..572b4334 100644 --- a/dist/assets/x-B04jFFwi.js +++ b/dist/assets/x-B0A9hqeh.js @@ -1 +1 @@ -import{vt as e}from"./index-BGzUQCv_.js";var t=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t}; \ No newline at end of file +import{vt as e}from"./index-CcPm2yTY.js";var t=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t}; \ No newline at end of file diff --git a/dist/index.html b/dist/index.html index a9a3d7a8..413d22de 100644 --- a/dist/index.html +++ b/dist/index.html @@ -117,7 +117,7 @@ - + diff --git a/dist/sw.js b/dist/sw.js index ade0d1e4..1cf30d48 100644 --- a/dist/sw.js +++ b/dist/sw.js @@ -9,7 +9,7 @@ // Update this version string manually to keep the app + cache versions in sync. // The value is forwarded to the UI via the service worker "SW_ACTIVATED" message. -const APP_VERSION = "30.0.4"; // update on release +const APP_VERSION = "30.0.5"; // update on release const VERSION = new URL(self.location.href).searchParams.get("v") || APP_VERSION; // derived from build const PREFIX = "PHINETWORK"; const PRECACHE = `${PREFIX}-precache-${VERSION}`; diff --git a/node_modules/@types/babel__core/README.md b/node_modules/@types/babel__core/README.md index 5121fc3a..3e4c0244 100644 --- a/node_modules/@types/babel__core/README.md +++ b/node_modules/@types/babel__core/README.md @@ -1,15 +1,15 @@ -# Installation -> `npm install --save @types/babel__core` - -# Summary -This package contains type definitions for @babel/core (https://github.com/babel/babel/tree/master/packages/babel-core). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel__core. - -### Additional Details - * Last updated: Mon, 20 Nov 2023 23:36:23 GMT - * Dependencies: [@babel/parser](https://npmjs.com/package/@babel/parser), [@babel/types](https://npmjs.com/package/@babel/types), [@types/babel__generator](https://npmjs.com/package/@types/babel__generator), [@types/babel__template](https://npmjs.com/package/@types/babel__template), [@types/babel__traverse](https://npmjs.com/package/@types/babel__traverse) - -# Credits -These definitions were written by [Troy Gerwien](https://github.com/yortus), [Marvin Hagemeister](https://github.com/marvinhagemeister), [Melvin Groenhoff](https://github.com/mgroenhoff), [Jessica Franco](https://github.com/Jessidhia), and [Ifiok Jr.](https://github.com/ifiokjr). +# Installation +> `npm install --save @types/babel__core` + +# Summary +This package contains type definitions for @babel/core (https://github.com/babel/babel/tree/master/packages/babel-core). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel__core. + +### Additional Details + * Last updated: Mon, 20 Nov 2023 23:36:23 GMT + * Dependencies: [@babel/parser](https://npmjs.com/package/@babel/parser), [@babel/types](https://npmjs.com/package/@babel/types), [@types/babel__generator](https://npmjs.com/package/@types/babel__generator), [@types/babel__template](https://npmjs.com/package/@types/babel__template), [@types/babel__traverse](https://npmjs.com/package/@types/babel__traverse) + +# Credits +These definitions were written by [Troy Gerwien](https://github.com/yortus), [Marvin Hagemeister](https://github.com/marvinhagemeister), [Melvin Groenhoff](https://github.com/mgroenhoff), [Jessica Franco](https://github.com/Jessidhia), and [Ifiok Jr.](https://github.com/ifiokjr). diff --git a/node_modules/@types/babel__generator/README.md b/node_modules/@types/babel__generator/README.md index c8b10df2..8bb78e41 100644 --- a/node_modules/@types/babel__generator/README.md +++ b/node_modules/@types/babel__generator/README.md @@ -1,15 +1,15 @@ -# Installation -> `npm install --save @types/babel__generator` - -# Summary -This package contains type definitions for @babel/generator (https://github.com/babel/babel/tree/master/packages/babel-generator). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel__generator. - -### Additional Details - * Last updated: Thu, 03 Apr 2025 16:02:41 GMT - * Dependencies: [@babel/types](https://npmjs.com/package/@babel/types) - -# Credits -These definitions were written by [Troy Gerwien](https://github.com/yortus), [Melvin Groenhoff](https://github.com/mgroenhoff), [Cameron Yan](https://github.com/khell), and [Lyanbin](https://github.com/Lyanbin). +# Installation +> `npm install --save @types/babel__generator` + +# Summary +This package contains type definitions for @babel/generator (https://github.com/babel/babel/tree/master/packages/babel-generator). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel__generator. + +### Additional Details + * Last updated: Thu, 03 Apr 2025 16:02:41 GMT + * Dependencies: [@babel/types](https://npmjs.com/package/@babel/types) + +# Credits +These definitions were written by [Troy Gerwien](https://github.com/yortus), [Melvin Groenhoff](https://github.com/mgroenhoff), [Cameron Yan](https://github.com/khell), and [Lyanbin](https://github.com/Lyanbin). diff --git a/node_modules/@types/babel__template/README.md b/node_modules/@types/babel__template/README.md index 63be1568..bc4ea0ba 100644 --- a/node_modules/@types/babel__template/README.md +++ b/node_modules/@types/babel__template/README.md @@ -1,15 +1,15 @@ -# Installation -> `npm install --save @types/babel__template` - -# Summary -This package contains type definitions for @babel/template (https://github.com/babel/babel/tree/master/packages/babel-template). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel__template. - -### Additional Details - * Last updated: Mon, 06 Nov 2023 22:41:04 GMT - * Dependencies: [@babel/parser](https://npmjs.com/package/@babel/parser), [@babel/types](https://npmjs.com/package/@babel/types) - -# Credits -These definitions were written by [Troy Gerwien](https://github.com/yortus), [Marvin Hagemeister](https://github.com/marvinhagemeister), [Melvin Groenhoff](https://github.com/mgroenhoff), and [ExE Boss](https://github.com/ExE-Boss). +# Installation +> `npm install --save @types/babel__template` + +# Summary +This package contains type definitions for @babel/template (https://github.com/babel/babel/tree/master/packages/babel-template). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel__template. + +### Additional Details + * Last updated: Mon, 06 Nov 2023 22:41:04 GMT + * Dependencies: [@babel/parser](https://npmjs.com/package/@babel/parser), [@babel/types](https://npmjs.com/package/@babel/types) + +# Credits +These definitions were written by [Troy Gerwien](https://github.com/yortus), [Marvin Hagemeister](https://github.com/marvinhagemeister), [Melvin Groenhoff](https://github.com/mgroenhoff), and [ExE Boss](https://github.com/ExE-Boss). diff --git a/node_modules/@types/babel__traverse/README.md b/node_modules/@types/babel__traverse/README.md index 1c572f76..40fd89f7 100644 --- a/node_modules/@types/babel__traverse/README.md +++ b/node_modules/@types/babel__traverse/README.md @@ -1,15 +1,15 @@ -# Installation -> `npm install --save @types/babel__traverse` - -# Summary -This package contains type definitions for @babel/traverse (https://github.com/babel/babel/tree/main/packages/babel-traverse). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel__traverse. - -### Additional Details - * Last updated: Thu, 31 Jul 2025 21:02:30 GMT - * Dependencies: [@babel/types](https://npmjs.com/package/@babel/types) - -# Credits -These definitions were written by [Troy Gerwien](https://github.com/yortus), [Marvin Hagemeister](https://github.com/marvinhagemeister), [Ryan Petrich](https://github.com/rpetrich), [Melvin Groenhoff](https://github.com/mgroenhoff), [Dean L.](https://github.com/dlgrit), [Ifiok Jr.](https://github.com/ifiokjr), [ExE Boss](https://github.com/ExE-Boss), and [Daniel Tschinder](https://github.com/danez). +# Installation +> `npm install --save @types/babel__traverse` + +# Summary +This package contains type definitions for @babel/traverse (https://github.com/babel/babel/tree/main/packages/babel-traverse). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel__traverse. + +### Additional Details + * Last updated: Thu, 31 Jul 2025 21:02:30 GMT + * Dependencies: [@babel/types](https://npmjs.com/package/@babel/types) + +# Credits +These definitions were written by [Troy Gerwien](https://github.com/yortus), [Marvin Hagemeister](https://github.com/marvinhagemeister), [Ryan Petrich](https://github.com/rpetrich), [Melvin Groenhoff](https://github.com/mgroenhoff), [Dean L.](https://github.com/dlgrit), [Ifiok Jr.](https://github.com/ifiokjr), [ExE Boss](https://github.com/ExE-Boss), and [Daniel Tschinder](https://github.com/danez). diff --git a/node_modules/@types/estree/README.md b/node_modules/@types/estree/README.md index 3a8c0415..2af760b2 100644 --- a/node_modules/@types/estree/README.md +++ b/node_modules/@types/estree/README.md @@ -1,15 +1,15 @@ -# Installation -> `npm install --save @types/estree` - -# Summary -This package contains type definitions for estree (https://github.com/estree/estree). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree. - -### Additional Details - * Last updated: Fri, 06 Jun 2025 00:04:33 GMT - * Dependencies: none - -# Credits -These definitions were written by [RReverser](https://github.com/RReverser). +# Installation +> `npm install --save @types/estree` + +# Summary +This package contains type definitions for estree (https://github.com/estree/estree). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree. + +### Additional Details + * Last updated: Fri, 06 Jun 2025 00:04:33 GMT + * Dependencies: none + +# Credits +These definitions were written by [RReverser](https://github.com/RReverser). diff --git a/node_modules/@types/history/README.md b/node_modules/@types/history/README.md index 5b0d5810..21e04744 100755 --- a/node_modules/@types/history/README.md +++ b/node_modules/@types/history/README.md @@ -1,16 +1,16 @@ -# Installation -> `npm install --save @types/history` - -# Summary -This package contains type definitions for history (https://github.com/mjackson/history). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/history. - -### Additional Details - * Last updated: Sun, 16 Jan 2022 17:31:24 GMT - * Dependencies: none - * Global values: `History` - -# Credits -These definitions were written by [Sergey Buturlakin](https://github.com/sergey-buturlakin), [Nathan Brown](https://github.com/ngbrown), [Young Rok Kim](https://github.com/rokoroku), and [Daniel Nixon](https://github.com/danielnixon). +# Installation +> `npm install --save @types/history` + +# Summary +This package contains type definitions for history (https://github.com/mjackson/history). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/history. + +### Additional Details + * Last updated: Sun, 16 Jan 2022 17:31:24 GMT + * Dependencies: none + * Global values: `History` + +# Credits +These definitions were written by [Sergey Buturlakin](https://github.com/sergey-buturlakin), [Nathan Brown](https://github.com/ngbrown), [Young Rok Kim](https://github.com/rokoroku), and [Daniel Nixon](https://github.com/danielnixon). diff --git a/node_modules/@types/json-schema/README.md b/node_modules/@types/json-schema/README.md index 42d55d37..78c610f0 100644 --- a/node_modules/@types/json-schema/README.md +++ b/node_modules/@types/json-schema/README.md @@ -1,15 +1,15 @@ -# Installation -> `npm install --save @types/json-schema` - -# Summary -This package contains type definitions for json-schema (https://github.com/kriszyp/json-schema). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/json-schema. - -### Additional Details - * Last updated: Tue, 07 Nov 2023 03:09:37 GMT - * Dependencies: none - -# Credits -These definitions were written by [Boris Cherny](https://github.com/bcherny), [Lucian Buzzo](https://github.com/lucianbuzzo), [Roland Groza](https://github.com/rolandjitsu), and [Jason Kwok](https://github.com/JasonHK). +# Installation +> `npm install --save @types/json-schema` + +# Summary +This package contains type definitions for json-schema (https://github.com/kriszyp/json-schema). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/json-schema. + +### Additional Details + * Last updated: Tue, 07 Nov 2023 03:09:37 GMT + * Dependencies: none + +# Credits +These definitions were written by [Boris Cherny](https://github.com/bcherny), [Lucian Buzzo](https://github.com/lucianbuzzo), [Roland Groza](https://github.com/rolandjitsu), and [Jason Kwok](https://github.com/JasonHK). diff --git a/node_modules/@types/node/README.md b/node_modules/@types/node/README.md index f95e3e7d..0b7d3eee 100644 --- a/node_modules/@types/node/README.md +++ b/node_modules/@types/node/README.md @@ -1,15 +1,15 @@ -# Installation -> `npm install --save @types/node` - -# Summary -This package contains type definitions for node (https://nodejs.org/). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v24. - -### Additional Details - * Last updated: Sun, 14 Dec 2025 00:04:32 GMT - * Dependencies: [undici-types](https://npmjs.com/package/undici-types) - -# Credits -These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [Alberto Schiabel](https://github.com/jkomyno), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [David Junger](https://github.com/touffy), [Mohsen Azimi](https://github.com/mohsen1), [Nikita Galkin](https://github.com/galkin), [Sebastian Silbermann](https://github.com/eps1lon), [Wilco Bakker](https://github.com/WilcoBakker), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), [Dmitry Semigradsky](https://github.com/Semigradsky), [René](https://github.com/Renegade334), and [Yagiz Nizipli](https://github.com/anonrig). +# Installation +> `npm install --save @types/node` + +# Summary +This package contains type definitions for node (https://nodejs.org/). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v24. + +### Additional Details + * Last updated: Sun, 14 Dec 2025 00:04:32 GMT + * Dependencies: [undici-types](https://npmjs.com/package/undici-types) + +# Credits +These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [Alberto Schiabel](https://github.com/jkomyno), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [David Junger](https://github.com/touffy), [Mohsen Azimi](https://github.com/mohsen1), [Nikita Galkin](https://github.com/galkin), [Sebastian Silbermann](https://github.com/eps1lon), [Wilco Bakker](https://github.com/WilcoBakker), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), [Dmitry Semigradsky](https://github.com/Semigradsky), [René](https://github.com/Renegade334), and [Yagiz Nizipli](https://github.com/anonrig). diff --git a/node_modules/@types/pako/README.md b/node_modules/@types/pako/README.md index 2c5125bc..e820f272 100644 --- a/node_modules/@types/pako/README.md +++ b/node_modules/@types/pako/README.md @@ -1,15 +1,15 @@ -# Installation -> `npm install --save @types/pako` - -# Summary -This package contains type definitions for pako (https://github.com/nodeca/pako). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pako. - -### Additional Details - * Last updated: Fri, 15 Aug 2025 08:39:32 GMT - * Dependencies: none - -# Credits -These definitions were written by [Caleb Eggensperger](https://github.com/calebegg), [Muhammet Öztürk](https://github.com/hlthi), and [Thibault Poisson](https://github.com/OrIOg). +# Installation +> `npm install --save @types/pako` + +# Summary +This package contains type definitions for pako (https://github.com/nodeca/pako). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pako. + +### Additional Details + * Last updated: Fri, 15 Aug 2025 08:39:32 GMT + * Dependencies: none + +# Credits +These definitions were written by [Caleb Eggensperger](https://github.com/calebegg), [Muhammet Öztürk](https://github.com/hlthi), and [Thibault Poisson](https://github.com/OrIOg). diff --git a/node_modules/@types/qrcode-generator/README.md b/node_modules/@types/qrcode-generator/README.md index aa2ed39b..ef5c6369 100644 --- a/node_modules/@types/qrcode-generator/README.md +++ b/node_modules/@types/qrcode-generator/README.md @@ -1,16 +1,16 @@ -# Installation -> `npm install --save @types/qrcode-generator` - -# Summary -This package contains type definitions for grcode-generator (https://github.com/kazuhikoarase/qrcode-generator). - -# Details -Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/qrcode-generator - -Additional Details - * Last updated: Mon, 21 Aug 2017 21:59:27 GMT - * Dependencies: none - * Global values: qrcode - -# Credits -These definitions were written by Stefan Huber . +# Installation +> `npm install --save @types/qrcode-generator` + +# Summary +This package contains type definitions for grcode-generator (https://github.com/kazuhikoarase/qrcode-generator). + +# Details +Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/qrcode-generator + +Additional Details + * Last updated: Mon, 21 Aug 2017 21:59:27 GMT + * Dependencies: none + * Global values: qrcode + +# Credits +These definitions were written by Stefan Huber . diff --git a/node_modules/@types/qrcode/README.md b/node_modules/@types/qrcode/README.md index 595dcb78..2c32b7fc 100644 --- a/node_modules/@types/qrcode/README.md +++ b/node_modules/@types/qrcode/README.md @@ -1,15 +1,15 @@ -# Installation -> `npm install --save @types/qrcode` - -# Summary -This package contains type definitions for qrcode (https://github.com/soldair/node-qrcode). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/qrcode. - -### Additional Details - * Last updated: Fri, 24 Oct 2025 04:02:41 GMT - * Dependencies: [@types/node](https://npmjs.com/package/@types/node) - -# Credits -These definitions were written by [York Yao](https://github.com/plantain-00), [Michael Nahkies](https://github.com/mnahkies), [Rémi Sormain](https://github.com/Marchelune), and [BendingBender](https://github.com/BendingBender). +# Installation +> `npm install --save @types/qrcode` + +# Summary +This package contains type definitions for qrcode (https://github.com/soldair/node-qrcode). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/qrcode. + +### Additional Details + * Last updated: Fri, 24 Oct 2025 04:02:41 GMT + * Dependencies: [@types/node](https://npmjs.com/package/@types/node) + +# Credits +These definitions were written by [York Yao](https://github.com/plantain-00), [Michael Nahkies](https://github.com/mnahkies), [Rémi Sormain](https://github.com/Marchelune), and [BendingBender](https://github.com/BendingBender). diff --git a/node_modules/@types/react-dom/README.md b/node_modules/@types/react-dom/README.md index fc49a162..79ab708b 100644 --- a/node_modules/@types/react-dom/README.md +++ b/node_modules/@types/react-dom/README.md @@ -1,16 +1,16 @@ -# Installation -> `npm install --save @types/react-dom` - -# Summary -This package contains type definitions for react-dom (https://react.dev/). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dom. - -### Additional Details - * Last updated: Wed, 12 Nov 2025 04:37:38 GMT - * Dependencies: none - * Peer dependencies: [@types/react](https://npmjs.com/package/@types/react) - -# Credits -These definitions were written by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com), [MartynasZilinskas](https://github.com/MartynasZilinskas), [Josh Rutherford](https://github.com/theruther4d), [Jessica Franco](https://github.com/Jessidhia), and [Sebastian Silbermann](https://github.com/eps1lon). +# Installation +> `npm install --save @types/react-dom` + +# Summary +This package contains type definitions for react-dom (https://react.dev/). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dom. + +### Additional Details + * Last updated: Wed, 12 Nov 2025 04:37:38 GMT + * Dependencies: none + * Peer dependencies: [@types/react](https://npmjs.com/package/@types/react) + +# Credits +These definitions were written by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com), [MartynasZilinskas](https://github.com/MartynasZilinskas), [Josh Rutherford](https://github.com/theruther4d), [Jessica Franco](https://github.com/Jessidhia), and [Sebastian Silbermann](https://github.com/eps1lon). diff --git a/node_modules/@types/react-router-dom/README.md b/node_modules/@types/react-router-dom/README.md index a47cecfb..4469d361 100755 --- a/node_modules/@types/react-router-dom/README.md +++ b/node_modules/@types/react-router-dom/README.md @@ -1,16 +1,16 @@ -# Installation -> `npm install --save @types/react-router-dom` - -# Summary -This package contains type definitions for react-router-dom (https://github.com/ReactTraining/react-router). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-router-dom. - -### Additional Details - * Last updated: Tue, 18 Jan 2022 22:01:52 GMT - * Dependencies: [@types/react-router](https://npmjs.com/package/@types/react-router), [@types/react](https://npmjs.com/package/@types/react), [@types/history](https://npmjs.com/package/@types/history) - * Global values: none - -# Credits -These definitions were written by [Huy Nguyen](https://github.com/huy-nguyen), [Philip Jackson](https://github.com/p-jackson), [John Reilly](https://github.com/johnnyreilly), [Sebastian Silbermann](https://github.com/eps1lon), [Daniel Nixon](https://github.com/danielnixon), [Tony Ward](https://github.com/ynotdraw), and [Pirasis Leelatanon](https://github.com/1pete). +# Installation +> `npm install --save @types/react-router-dom` + +# Summary +This package contains type definitions for react-router-dom (https://github.com/ReactTraining/react-router). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-router-dom. + +### Additional Details + * Last updated: Tue, 18 Jan 2022 22:01:52 GMT + * Dependencies: [@types/react-router](https://npmjs.com/package/@types/react-router), [@types/react](https://npmjs.com/package/@types/react), [@types/history](https://npmjs.com/package/@types/history) + * Global values: none + +# Credits +These definitions were written by [Huy Nguyen](https://github.com/huy-nguyen), [Philip Jackson](https://github.com/p-jackson), [John Reilly](https://github.com/johnnyreilly), [Sebastian Silbermann](https://github.com/eps1lon), [Daniel Nixon](https://github.com/danielnixon), [Tony Ward](https://github.com/ynotdraw), and [Pirasis Leelatanon](https://github.com/1pete). diff --git a/node_modules/@types/react-router/README.md b/node_modules/@types/react-router/README.md index 95884c1b..3335e72f 100755 --- a/node_modules/@types/react-router/README.md +++ b/node_modules/@types/react-router/README.md @@ -1,16 +1,16 @@ -# Installation -> `npm install --save @types/react-router` - -# Summary -This package contains type definitions for React Router (https://github.com/ReactTraining/react-router). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-router. - -### Additional Details - * Last updated: Fri, 23 Dec 2022 11:02:45 GMT - * Dependencies: [@types/history](https://npmjs.com/package/@types/history), [@types/react](https://npmjs.com/package/@types/react) - * Global values: none - -# Credits -These definitions were written by [Sergey Buturlakin](https://github.com/sergey-buturlakin), [Yuichi Murata](https://github.com/mrk21), [Václav Ostrožlík](https://github.com/vasek17), [Nathan Brown](https://github.com/ngbrown), [Alex Wendland](https://github.com/awendland), [Kostya Esmukov](https://github.com/KostyaEsmukov), [John Reilly](https://github.com/johnnyreilly), [Karol Janyst](https://github.com/LKay), [Dovydas Navickas](https://github.com/DovydasNavickas), [Huy Nguyen](https://github.com/huy-nguyen), [Jérémy Fauvel](https://github.com/grmiade), [Daniel Roth](https://github.com/DaIgeb), [Egor Shulga](https://github.com/egorshulga), [Rahul Raina](https://github.com/rraina), [Duong Tran](https://github.com/t49tran), [Ben Smith](https://github.com/8enSmith), [Wesley Tsai](https://github.com/wezleytsai), [Sebastian Silbermann](https://github.com/eps1lon), [Nicholas Hehr](https://github.com/HipsterBrown), and [Pawel Fajfer](https://github.com/pawfa). +# Installation +> `npm install --save @types/react-router` + +# Summary +This package contains type definitions for React Router (https://github.com/ReactTraining/react-router). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-router. + +### Additional Details + * Last updated: Fri, 23 Dec 2022 11:02:45 GMT + * Dependencies: [@types/history](https://npmjs.com/package/@types/history), [@types/react](https://npmjs.com/package/@types/react) + * Global values: none + +# Credits +These definitions were written by [Sergey Buturlakin](https://github.com/sergey-buturlakin), [Yuichi Murata](https://github.com/mrk21), [Václav Ostrožlík](https://github.com/vasek17), [Nathan Brown](https://github.com/ngbrown), [Alex Wendland](https://github.com/awendland), [Kostya Esmukov](https://github.com/KostyaEsmukov), [John Reilly](https://github.com/johnnyreilly), [Karol Janyst](https://github.com/LKay), [Dovydas Navickas](https://github.com/DovydasNavickas), [Huy Nguyen](https://github.com/huy-nguyen), [Jérémy Fauvel](https://github.com/grmiade), [Daniel Roth](https://github.com/DaIgeb), [Egor Shulga](https://github.com/egorshulga), [Rahul Raina](https://github.com/rraina), [Duong Tran](https://github.com/t49tran), [Ben Smith](https://github.com/8enSmith), [Wesley Tsai](https://github.com/wezleytsai), [Sebastian Silbermann](https://github.com/eps1lon), [Nicholas Hehr](https://github.com/HipsterBrown), and [Pawel Fajfer](https://github.com/pawfa). diff --git a/node_modules/@types/react/README.md b/node_modules/@types/react/README.md index a6062d30..358ee7f8 100644 --- a/node_modules/@types/react/README.md +++ b/node_modules/@types/react/README.md @@ -1,15 +1,15 @@ -# Installation -> `npm install --save @types/react` - -# Summary -This package contains type definitions for react (https://react.dev/). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react. - -### Additional Details - * Last updated: Mon, 24 Nov 2025 09:38:12 GMT - * Dependencies: [csstype](https://npmjs.com/package/csstype) - -# Credits -These definitions were written by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com), [John Reilly](https://github.com/johnnyreilly), [Benoit Benezech](https://github.com/bbenezech), [Patricio Zavolinsky](https://github.com/pzavolinsky), [Eric Anderson](https://github.com/ericanderson), [Dovydas Navickas](https://github.com/DovydasNavickas), [Josh Rutherford](https://github.com/theruther4d), [Guilherme Hübner](https://github.com/guilhermehubner), [Ferdy Budhidharma](https://github.com/ferdaber), [Johann Rakotoharisoa](https://github.com/jrakotoharisoa), [Olivier Pascal](https://github.com/pascaloliv), [Martin Hochel](https://github.com/hotell), [Frank Li](https://github.com/franklixuefei), [Jessica Franco](https://github.com/Jessidhia), [Saransh Kataria](https://github.com/saranshkataria), [Kanitkorn Sujautra](https://github.com/lukyth), [Sebastian Silbermann](https://github.com/eps1lon), [Kyle Scully](https://github.com/zieka), [Cong Zhang](https://github.com/dancerphil), [Dimitri Mitropoulos](https://github.com/dimitropoulos), [JongChan Choi](https://github.com/disjukr), [Victor Magalhães](https://github.com/vhfmag), [Priyanshu Rav](https://github.com/priyanshurav), [Dmitry Semigradsky](https://github.com/Semigradsky), and [Matt Pocock](https://github.com/mattpocock). +# Installation +> `npm install --save @types/react` + +# Summary +This package contains type definitions for react (https://react.dev/). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react. + +### Additional Details + * Last updated: Mon, 24 Nov 2025 09:38:12 GMT + * Dependencies: [csstype](https://npmjs.com/package/csstype) + +# Credits +These definitions were written by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com), [John Reilly](https://github.com/johnnyreilly), [Benoit Benezech](https://github.com/bbenezech), [Patricio Zavolinsky](https://github.com/pzavolinsky), [Eric Anderson](https://github.com/ericanderson), [Dovydas Navickas](https://github.com/DovydasNavickas), [Josh Rutherford](https://github.com/theruther4d), [Guilherme Hübner](https://github.com/guilhermehubner), [Ferdy Budhidharma](https://github.com/ferdaber), [Johann Rakotoharisoa](https://github.com/jrakotoharisoa), [Olivier Pascal](https://github.com/pascaloliv), [Martin Hochel](https://github.com/hotell), [Frank Li](https://github.com/franklixuefei), [Jessica Franco](https://github.com/Jessidhia), [Saransh Kataria](https://github.com/saranshkataria), [Kanitkorn Sujautra](https://github.com/lukyth), [Sebastian Silbermann](https://github.com/eps1lon), [Kyle Scully](https://github.com/zieka), [Cong Zhang](https://github.com/dancerphil), [Dimitri Mitropoulos](https://github.com/dimitropoulos), [JongChan Choi](https://github.com/disjukr), [Victor Magalhães](https://github.com/vhfmag), [Priyanshu Rav](https://github.com/priyanshurav), [Dmitry Semigradsky](https://github.com/Semigradsky), and [Matt Pocock](https://github.com/mattpocock). diff --git a/node_modules/color-name/LICENSE b/node_modules/color-name/LICENSE index 4d9802a8..c6b10012 100644 --- a/node_modules/color-name/LICENSE +++ b/node_modules/color-name/LICENSE @@ -1,8 +1,8 @@ -The MIT License (MIT) -Copyright (c) 2015 Dmitry Ivanov - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - +The MIT License (MIT) +Copyright (c) 2015 Dmitry Ivanov + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/color-name/README.md b/node_modules/color-name/README.md index 3611a6b5..932b9791 100644 --- a/node_modules/color-name/README.md +++ b/node_modules/color-name/README.md @@ -1,11 +1,11 @@ -A JSON with color names and its values. Based on http://dev.w3.org/csswg/css-color/#named-colors. - -[![NPM](https://nodei.co/npm/color-name.png?mini=true)](https://nodei.co/npm/color-name/) - - -```js -var colors = require('color-name'); -colors.red //[255,0,0] -``` - - +A JSON with color names and its values. Based on http://dev.w3.org/csswg/css-color/#named-colors. + +[![NPM](https://nodei.co/npm/color-name.png?mini=true)](https://nodei.co/npm/color-name/) + + +```js +var colors = require('color-name'); +colors.red //[255,0,0] +``` + + diff --git a/node_modules/color-name/index.js b/node_modules/color-name/index.js index e42aa68a..b7c198a6 100644 --- a/node_modules/color-name/index.js +++ b/node_modules/color-name/index.js @@ -1,152 +1,152 @@ -'use strict' - -module.exports = { - "aliceblue": [240, 248, 255], - "antiquewhite": [250, 235, 215], - "aqua": [0, 255, 255], - "aquamarine": [127, 255, 212], - "azure": [240, 255, 255], - "beige": [245, 245, 220], - "bisque": [255, 228, 196], - "black": [0, 0, 0], - "blanchedalmond": [255, 235, 205], - "blue": [0, 0, 255], - "blueviolet": [138, 43, 226], - "brown": [165, 42, 42], - "burlywood": [222, 184, 135], - "cadetblue": [95, 158, 160], - "chartreuse": [127, 255, 0], - "chocolate": [210, 105, 30], - "coral": [255, 127, 80], - "cornflowerblue": [100, 149, 237], - "cornsilk": [255, 248, 220], - "crimson": [220, 20, 60], - "cyan": [0, 255, 255], - "darkblue": [0, 0, 139], - "darkcyan": [0, 139, 139], - "darkgoldenrod": [184, 134, 11], - "darkgray": [169, 169, 169], - "darkgreen": [0, 100, 0], - "darkgrey": [169, 169, 169], - "darkkhaki": [189, 183, 107], - "darkmagenta": [139, 0, 139], - "darkolivegreen": [85, 107, 47], - "darkorange": [255, 140, 0], - "darkorchid": [153, 50, 204], - "darkred": [139, 0, 0], - "darksalmon": [233, 150, 122], - "darkseagreen": [143, 188, 143], - "darkslateblue": [72, 61, 139], - "darkslategray": [47, 79, 79], - "darkslategrey": [47, 79, 79], - "darkturquoise": [0, 206, 209], - "darkviolet": [148, 0, 211], - "deeppink": [255, 20, 147], - "deepskyblue": [0, 191, 255], - "dimgray": [105, 105, 105], - "dimgrey": [105, 105, 105], - "dodgerblue": [30, 144, 255], - "firebrick": [178, 34, 34], - "floralwhite": [255, 250, 240], - "forestgreen": [34, 139, 34], - "fuchsia": [255, 0, 255], - "gainsboro": [220, 220, 220], - "ghostwhite": [248, 248, 255], - "gold": [255, 215, 0], - "goldenrod": [218, 165, 32], - "gray": [128, 128, 128], - "green": [0, 128, 0], - "greenyellow": [173, 255, 47], - "grey": [128, 128, 128], - "honeydew": [240, 255, 240], - "hotpink": [255, 105, 180], - "indianred": [205, 92, 92], - "indigo": [75, 0, 130], - "ivory": [255, 255, 240], - "khaki": [240, 230, 140], - "lavender": [230, 230, 250], - "lavenderblush": [255, 240, 245], - "lawngreen": [124, 252, 0], - "lemonchiffon": [255, 250, 205], - "lightblue": [173, 216, 230], - "lightcoral": [240, 128, 128], - "lightcyan": [224, 255, 255], - "lightgoldenrodyellow": [250, 250, 210], - "lightgray": [211, 211, 211], - "lightgreen": [144, 238, 144], - "lightgrey": [211, 211, 211], - "lightpink": [255, 182, 193], - "lightsalmon": [255, 160, 122], - "lightseagreen": [32, 178, 170], - "lightskyblue": [135, 206, 250], - "lightslategray": [119, 136, 153], - "lightslategrey": [119, 136, 153], - "lightsteelblue": [176, 196, 222], - "lightyellow": [255, 255, 224], - "lime": [0, 255, 0], - "limegreen": [50, 205, 50], - "linen": [250, 240, 230], - "magenta": [255, 0, 255], - "maroon": [128, 0, 0], - "mediumaquamarine": [102, 205, 170], - "mediumblue": [0, 0, 205], - "mediumorchid": [186, 85, 211], - "mediumpurple": [147, 112, 219], - "mediumseagreen": [60, 179, 113], - "mediumslateblue": [123, 104, 238], - "mediumspringgreen": [0, 250, 154], - "mediumturquoise": [72, 209, 204], - "mediumvioletred": [199, 21, 133], - "midnightblue": [25, 25, 112], - "mintcream": [245, 255, 250], - "mistyrose": [255, 228, 225], - "moccasin": [255, 228, 181], - "navajowhite": [255, 222, 173], - "navy": [0, 0, 128], - "oldlace": [253, 245, 230], - "olive": [128, 128, 0], - "olivedrab": [107, 142, 35], - "orange": [255, 165, 0], - "orangered": [255, 69, 0], - "orchid": [218, 112, 214], - "palegoldenrod": [238, 232, 170], - "palegreen": [152, 251, 152], - "paleturquoise": [175, 238, 238], - "palevioletred": [219, 112, 147], - "papayawhip": [255, 239, 213], - "peachpuff": [255, 218, 185], - "peru": [205, 133, 63], - "pink": [255, 192, 203], - "plum": [221, 160, 221], - "powderblue": [176, 224, 230], - "purple": [128, 0, 128], - "rebeccapurple": [102, 51, 153], - "red": [255, 0, 0], - "rosybrown": [188, 143, 143], - "royalblue": [65, 105, 225], - "saddlebrown": [139, 69, 19], - "salmon": [250, 128, 114], - "sandybrown": [244, 164, 96], - "seagreen": [46, 139, 87], - "seashell": [255, 245, 238], - "sienna": [160, 82, 45], - "silver": [192, 192, 192], - "skyblue": [135, 206, 235], - "slateblue": [106, 90, 205], - "slategray": [112, 128, 144], - "slategrey": [112, 128, 144], - "snow": [255, 250, 250], - "springgreen": [0, 255, 127], - "steelblue": [70, 130, 180], - "tan": [210, 180, 140], - "teal": [0, 128, 128], - "thistle": [216, 191, 216], - "tomato": [255, 99, 71], - "turquoise": [64, 224, 208], - "violet": [238, 130, 238], - "wheat": [245, 222, 179], - "white": [255, 255, 255], - "whitesmoke": [245, 245, 245], - "yellow": [255, 255, 0], - "yellowgreen": [154, 205, 50] -}; +'use strict' + +module.exports = { + "aliceblue": [240, 248, 255], + "antiquewhite": [250, 235, 215], + "aqua": [0, 255, 255], + "aquamarine": [127, 255, 212], + "azure": [240, 255, 255], + "beige": [245, 245, 220], + "bisque": [255, 228, 196], + "black": [0, 0, 0], + "blanchedalmond": [255, 235, 205], + "blue": [0, 0, 255], + "blueviolet": [138, 43, 226], + "brown": [165, 42, 42], + "burlywood": [222, 184, 135], + "cadetblue": [95, 158, 160], + "chartreuse": [127, 255, 0], + "chocolate": [210, 105, 30], + "coral": [255, 127, 80], + "cornflowerblue": [100, 149, 237], + "cornsilk": [255, 248, 220], + "crimson": [220, 20, 60], + "cyan": [0, 255, 255], + "darkblue": [0, 0, 139], + "darkcyan": [0, 139, 139], + "darkgoldenrod": [184, 134, 11], + "darkgray": [169, 169, 169], + "darkgreen": [0, 100, 0], + "darkgrey": [169, 169, 169], + "darkkhaki": [189, 183, 107], + "darkmagenta": [139, 0, 139], + "darkolivegreen": [85, 107, 47], + "darkorange": [255, 140, 0], + "darkorchid": [153, 50, 204], + "darkred": [139, 0, 0], + "darksalmon": [233, 150, 122], + "darkseagreen": [143, 188, 143], + "darkslateblue": [72, 61, 139], + "darkslategray": [47, 79, 79], + "darkslategrey": [47, 79, 79], + "darkturquoise": [0, 206, 209], + "darkviolet": [148, 0, 211], + "deeppink": [255, 20, 147], + "deepskyblue": [0, 191, 255], + "dimgray": [105, 105, 105], + "dimgrey": [105, 105, 105], + "dodgerblue": [30, 144, 255], + "firebrick": [178, 34, 34], + "floralwhite": [255, 250, 240], + "forestgreen": [34, 139, 34], + "fuchsia": [255, 0, 255], + "gainsboro": [220, 220, 220], + "ghostwhite": [248, 248, 255], + "gold": [255, 215, 0], + "goldenrod": [218, 165, 32], + "gray": [128, 128, 128], + "green": [0, 128, 0], + "greenyellow": [173, 255, 47], + "grey": [128, 128, 128], + "honeydew": [240, 255, 240], + "hotpink": [255, 105, 180], + "indianred": [205, 92, 92], + "indigo": [75, 0, 130], + "ivory": [255, 255, 240], + "khaki": [240, 230, 140], + "lavender": [230, 230, 250], + "lavenderblush": [255, 240, 245], + "lawngreen": [124, 252, 0], + "lemonchiffon": [255, 250, 205], + "lightblue": [173, 216, 230], + "lightcoral": [240, 128, 128], + "lightcyan": [224, 255, 255], + "lightgoldenrodyellow": [250, 250, 210], + "lightgray": [211, 211, 211], + "lightgreen": [144, 238, 144], + "lightgrey": [211, 211, 211], + "lightpink": [255, 182, 193], + "lightsalmon": [255, 160, 122], + "lightseagreen": [32, 178, 170], + "lightskyblue": [135, 206, 250], + "lightslategray": [119, 136, 153], + "lightslategrey": [119, 136, 153], + "lightsteelblue": [176, 196, 222], + "lightyellow": [255, 255, 224], + "lime": [0, 255, 0], + "limegreen": [50, 205, 50], + "linen": [250, 240, 230], + "magenta": [255, 0, 255], + "maroon": [128, 0, 0], + "mediumaquamarine": [102, 205, 170], + "mediumblue": [0, 0, 205], + "mediumorchid": [186, 85, 211], + "mediumpurple": [147, 112, 219], + "mediumseagreen": [60, 179, 113], + "mediumslateblue": [123, 104, 238], + "mediumspringgreen": [0, 250, 154], + "mediumturquoise": [72, 209, 204], + "mediumvioletred": [199, 21, 133], + "midnightblue": [25, 25, 112], + "mintcream": [245, 255, 250], + "mistyrose": [255, 228, 225], + "moccasin": [255, 228, 181], + "navajowhite": [255, 222, 173], + "navy": [0, 0, 128], + "oldlace": [253, 245, 230], + "olive": [128, 128, 0], + "olivedrab": [107, 142, 35], + "orange": [255, 165, 0], + "orangered": [255, 69, 0], + "orchid": [218, 112, 214], + "palegoldenrod": [238, 232, 170], + "palegreen": [152, 251, 152], + "paleturquoise": [175, 238, 238], + "palevioletred": [219, 112, 147], + "papayawhip": [255, 239, 213], + "peachpuff": [255, 218, 185], + "peru": [205, 133, 63], + "pink": [255, 192, 203], + "plum": [221, 160, 221], + "powderblue": [176, 224, 230], + "purple": [128, 0, 128], + "rebeccapurple": [102, 51, 153], + "red": [255, 0, 0], + "rosybrown": [188, 143, 143], + "royalblue": [65, 105, 225], + "saddlebrown": [139, 69, 19], + "salmon": [250, 128, 114], + "sandybrown": [244, 164, 96], + "seagreen": [46, 139, 87], + "seashell": [255, 245, 238], + "sienna": [160, 82, 45], + "silver": [192, 192, 192], + "skyblue": [135, 206, 235], + "slateblue": [106, 90, 205], + "slategray": [112, 128, 144], + "slategrey": [112, 128, 144], + "snow": [255, 250, 250], + "springgreen": [0, 255, 127], + "steelblue": [70, 130, 180], + "tan": [210, 180, 140], + "teal": [0, 128, 128], + "thistle": [216, 191, 216], + "tomato": [255, 99, 71], + "turquoise": [64, 224, 208], + "violet": [238, 130, 238], + "wheat": [245, 222, 179], + "white": [255, 255, 255], + "whitesmoke": [245, 245, 245], + "yellow": [255, 255, 0], + "yellowgreen": [154, 205, 50] +}; diff --git a/node_modules/color-name/package.json b/node_modules/color-name/package.json index 7acc9028..782dd828 100644 --- a/node_modules/color-name/package.json +++ b/node_modules/color-name/package.json @@ -1,28 +1,28 @@ -{ - "name": "color-name", - "version": "1.1.4", - "description": "A list of color names and its values", - "main": "index.js", - "files": [ - "index.js" - ], - "scripts": { - "test": "node test.js" - }, - "repository": { - "type": "git", - "url": "git@github.com:colorjs/color-name.git" - }, - "keywords": [ - "color-name", - "color", - "color-keyword", - "keyword" - ], - "author": "DY ", - "license": "MIT", - "bugs": { - "url": "https://github.com/colorjs/color-name/issues" - }, - "homepage": "https://github.com/colorjs/color-name" -} +{ + "name": "color-name", + "version": "1.1.4", + "description": "A list of color names and its values", + "main": "index.js", + "files": [ + "index.js" + ], + "scripts": { + "test": "node test.js" + }, + "repository": { + "type": "git", + "url": "git@github.com:colorjs/color-name.git" + }, + "keywords": [ + "color-name", + "color", + "color-keyword", + "keyword" + ], + "author": "DY ", + "license": "MIT", + "bugs": { + "url": "https://github.com/colorjs/color-name/issues" + }, + "homepage": "https://github.com/colorjs/color-name" +} diff --git a/node_modules/decimal.js/LICENCE.md b/node_modules/decimal.js/LICENCE.md index e62dbae8..57740b9d 100644 --- a/node_modules/decimal.js/LICENCE.md +++ b/node_modules/decimal.js/LICENCE.md @@ -1,23 +1,23 @@ -The MIT Licence. - -Copyright (c) 2025 Michael Mclaughlin - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - +The MIT Licence. + +Copyright (c) 2025 Michael Mclaughlin + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/node_modules/decimal.js/README.md b/node_modules/decimal.js/README.md index f59a9cfe..f75c0a55 100644 --- a/node_modules/decimal.js/README.md +++ b/node_modules/decimal.js/README.md @@ -1,246 +1,246 @@ -![decimal.js](https://raw.githubusercontent.com/MikeMcl/decimal.js/gh-pages/decimaljs.png) - -An arbitrary-precision Decimal type for JavaScript. - -[![npm version](https://img.shields.io/npm/v/decimal.js.svg)](https://www.npmjs.com/package/decimal.js) -[![npm downloads](https://img.shields.io/npm/dw/decimal.js)](https://www.npmjs.com/package/decimal.js) -[![CDNJS](https://img.shields.io/cdnjs/v/decimal.js.svg)](https://cdnjs.com/libraries/decimal.js) -[![](https://data.jsdelivr.com/v1/package/npm/decimal.js/badge)](https://www.jsdelivr.com/package/npm/decimal.js) - -
- -## Features - - - Integers and floats - - Simple but full-featured API - - Replicates many of the methods of JavaScript's `Number.prototype` and `Math` objects - - Also handles hexadecimal, binary and octal values - - Faster, smaller, and perhaps easier to use than JavaScript versions of Java's BigDecimal - - No dependencies - - Wide platform compatibility: uses JavaScript 1.5 (ECMAScript 3) features only - - Comprehensive [documentation](https://mikemcl.github.io/decimal.js/) and test set - - Used under the hood by [math.js](https://github.com/josdejong/mathjs) - - Includes a TypeScript declaration file: *decimal.d.ts* - -![API](https://raw.githubusercontent.com/MikeMcl/decimal.js/gh-pages/API.png) - -The library is similar to [bignumber.js](https://github.com/MikeMcl/bignumber.js/), but here -precision is specified in terms of significant digits rather than decimal places, and all -calculations are rounded to the precision (similar to Python's decimal module) rather than just -those involving division. - -This library also adds the trigonometric functions, among others, and supports non-integer powers, -which makes it a significantly larger library than *bignumber.js* and the even smaller -[big.js](https://github.com/MikeMcl/big.js/). - -For a lighter version of this library without the trigonometric functions see -[decimal.js-light](https://github.com/MikeMcl/decimal.js-light/). - -## Load - -The library is the single JavaScript file *decimal.js* or ES module *decimal.mjs*. - -Browser: - -```html - - - -``` - -[Node.js](https://nodejs.org): - -```bash -npm install decimal.js -``` -```js -const Decimal = require('decimal.js'); - -import Decimal from 'decimal.js'; - -import {Decimal} from 'decimal.js'; -``` - -## Use - -*In all examples below, semicolons and `toString` calls are not shown. -If a commented-out value is in quotes it means `toString` has been called on the preceding expression.* - -The library exports a single constructor function, `Decimal`, which expects a single argument that is a number, string or Decimal instance. - -```js -x = new Decimal(123.4567) -y = new Decimal('123456.7e-3') -z = new Decimal(x) -x.equals(y) && y.equals(z) && x.equals(z) // true -``` - -If using values with more than a few digits, it is recommended to pass strings rather than numbers to avoid a potential loss of precision. - -```js -// Precision loss from using numeric literals with more than 15 significant digits. -new Decimal(1.0000000000000001) // '1' -new Decimal(88259496234518.57) // '88259496234518.56' -new Decimal(99999999999999999999) // '100000000000000000000' - -// Precision loss from using numeric literals outside the range of Number values. -new Decimal(2e+308) // 'Infinity' -new Decimal(1e-324) // '0' - -// Precision loss from the unexpected result of arithmetic with Number values. -new Decimal(0.7 + 0.1) // '0.7999999999999999' -``` - -As with JavaScript numbers, strings can contain underscores as separators to improve readability. - -```js -x = new Decimal('2_147_483_647') -``` - -String values in binary, hexadecimal or octal notation are also accepted if the appropriate prefix is included. - -```js -x = new Decimal('0xff.f') // '255.9375' -y = new Decimal('0b10101100') // '172' -z = x.plus(y) // '427.9375' - -z.toBinary() // '0b110101011.1111' -z.toBinary(13) // '0b1.101010111111p+8' - -// Using binary exponential notation to create a Decimal with the value of `Number.MAX_VALUE`. -x = new Decimal('0b1.1111111111111111111111111111111111111111111111111111p+1023') -// '1.7976931348623157081e+308' -``` - -Decimal instances are immutable in the sense that they are not changed by their methods. - -```js -0.3 - 0.1 // 0.19999999999999998 -x = new Decimal(0.3) -x.minus(0.1) // '0.2' -x // '0.3' -``` - -The methods that return a Decimal can be chained. - -```js -x.dividedBy(y).plus(z).times(9).floor() -x.times('1.23456780123456789e+9').plus(9876.5432321).dividedBy('4444562598.111772').ceil() -``` - -Many method names have a shorter alias. - -```js -x.squareRoot().dividedBy(y).toPower(3).equals(x.sqrt().div(y).pow(3)) // true -x.comparedTo(y.modulo(z).negated() === x.cmp(y.mod(z).neg()) // true -``` - -Most of the methods of JavaScript's `Number.prototype` and `Math` objects are replicated. - -```js -x = new Decimal(255.5) -x.toExponential(5) // '2.55500e+2' -x.toFixed(5) // '255.50000' -x.toPrecision(5) // '255.50' - -Decimal.sqrt('6.98372465832e+9823') // '8.3568682281821340204e+4911' -Decimal.pow(2, 0.0979843) // '1.0702770511687781839' - -// Using `toFixed()` to avoid exponential notation: -x = new Decimal('0.0000001') -x.toString() // '1e-7' -x.toFixed() // '0.0000001' -``` - -And there are `isNaN` and `isFinite` methods, as `NaN` and `Infinity` are valid `Decimal` values. - -```js -x = new Decimal(NaN) // 'NaN' -y = new Decimal(Infinity) // 'Infinity' -x.isNaN() && !y.isNaN() && !x.isFinite() && !y.isFinite() // true -``` - -There is also a `toFraction` method with an optional *maximum denominator* argument. - -```js -z = new Decimal(355) -pi = z.dividedBy(113) // '3.1415929204' -pi.toFraction() // [ '7853982301', '2500000000' ] -pi.toFraction(1000) // [ '355', '113' ] -``` - -All calculations are rounded according to the number of significant digits and rounding mode specified -by the `precision` and `rounding` properties of the Decimal constructor. - -For advanced usage, multiple Decimal constructors can be created, each with their own independent -configuration which applies to all Decimal numbers created from it. - -```js -// Set the precision and rounding of the default Decimal constructor -Decimal.set({ precision: 5, rounding: 4 }) - -// Create another Decimal constructor, optionally passing in a configuration object -Dec = Decimal.clone({ precision: 9, rounding: 1 }) - -x = new Decimal(5) -y = new Dec(5) - -x.div(3) // '1.6667' -y.div(3) // '1.66666666' -``` - -The value of a Decimal is stored in a floating point format in terms of its digits, exponent and sign, but these properties should be considered read-only. - -```js -x = new Decimal(-12345.67); -x.d // [ 12345, 6700000 ] digits (base 10000000) -x.e // 4 exponent (base 10) -x.s // -1 sign -``` - -For further information see the [API](http://mikemcl.github.io/decimal.js/) reference in the *doc* directory. - -## Test - -To run the tests using Node.js from the root directory: - -```bash -npm test -``` - -Each separate test module can also be executed individually, for example: - -```bash -node test/modules/toFraction -``` - -To run the tests in a browser, open *test/test.html*. - -## Minify - -Two minification examples: - -Using [uglify-js](https://github.com/mishoo/UglifyJS) to minify the *decimal.js* file: - -```bash -npm install uglify-js -g -uglifyjs decimal.js --source-map url=decimal.min.js.map -c -m -o decimal.min.js -``` - -Using [terser](https://github.com/terser/terser) to minify the ES module version, *decimal.mjs*: - -```bash -npm install terser -g -terser decimal.mjs --source-map url=decimal.min.mjs.map -c -m --toplevel -o decimal.min.mjs -``` - -```js -import Decimal from './decimal.min.mjs'; -``` - -## Licence - -[The MIT Licence](LICENCE.md) +![decimal.js](https://raw.githubusercontent.com/MikeMcl/decimal.js/gh-pages/decimaljs.png) + +An arbitrary-precision Decimal type for JavaScript. + +[![npm version](https://img.shields.io/npm/v/decimal.js.svg)](https://www.npmjs.com/package/decimal.js) +[![npm downloads](https://img.shields.io/npm/dw/decimal.js)](https://www.npmjs.com/package/decimal.js) +[![CDNJS](https://img.shields.io/cdnjs/v/decimal.js.svg)](https://cdnjs.com/libraries/decimal.js) +[![](https://data.jsdelivr.com/v1/package/npm/decimal.js/badge)](https://www.jsdelivr.com/package/npm/decimal.js) + +
+ +## Features + + - Integers and floats + - Simple but full-featured API + - Replicates many of the methods of JavaScript's `Number.prototype` and `Math` objects + - Also handles hexadecimal, binary and octal values + - Faster, smaller, and perhaps easier to use than JavaScript versions of Java's BigDecimal + - No dependencies + - Wide platform compatibility: uses JavaScript 1.5 (ECMAScript 3) features only + - Comprehensive [documentation](https://mikemcl.github.io/decimal.js/) and test set + - Used under the hood by [math.js](https://github.com/josdejong/mathjs) + - Includes a TypeScript declaration file: *decimal.d.ts* + +![API](https://raw.githubusercontent.com/MikeMcl/decimal.js/gh-pages/API.png) + +The library is similar to [bignumber.js](https://github.com/MikeMcl/bignumber.js/), but here +precision is specified in terms of significant digits rather than decimal places, and all +calculations are rounded to the precision (similar to Python's decimal module) rather than just +those involving division. + +This library also adds the trigonometric functions, among others, and supports non-integer powers, +which makes it a significantly larger library than *bignumber.js* and the even smaller +[big.js](https://github.com/MikeMcl/big.js/). + +For a lighter version of this library without the trigonometric functions see +[decimal.js-light](https://github.com/MikeMcl/decimal.js-light/). + +## Load + +The library is the single JavaScript file *decimal.js* or ES module *decimal.mjs*. + +Browser: + +```html + + + +``` + +[Node.js](https://nodejs.org): + +```bash +npm install decimal.js +``` +```js +const Decimal = require('decimal.js'); + +import Decimal from 'decimal.js'; + +import {Decimal} from 'decimal.js'; +``` + +## Use + +*In all examples below, semicolons and `toString` calls are not shown. +If a commented-out value is in quotes it means `toString` has been called on the preceding expression.* + +The library exports a single constructor function, `Decimal`, which expects a single argument that is a number, string or Decimal instance. + +```js +x = new Decimal(123.4567) +y = new Decimal('123456.7e-3') +z = new Decimal(x) +x.equals(y) && y.equals(z) && x.equals(z) // true +``` + +If using values with more than a few digits, it is recommended to pass strings rather than numbers to avoid a potential loss of precision. + +```js +// Precision loss from using numeric literals with more than 15 significant digits. +new Decimal(1.0000000000000001) // '1' +new Decimal(88259496234518.57) // '88259496234518.56' +new Decimal(99999999999999999999) // '100000000000000000000' + +// Precision loss from using numeric literals outside the range of Number values. +new Decimal(2e+308) // 'Infinity' +new Decimal(1e-324) // '0' + +// Precision loss from the unexpected result of arithmetic with Number values. +new Decimal(0.7 + 0.1) // '0.7999999999999999' +``` + +As with JavaScript numbers, strings can contain underscores as separators to improve readability. + +```js +x = new Decimal('2_147_483_647') +``` + +String values in binary, hexadecimal or octal notation are also accepted if the appropriate prefix is included. + +```js +x = new Decimal('0xff.f') // '255.9375' +y = new Decimal('0b10101100') // '172' +z = x.plus(y) // '427.9375' + +z.toBinary() // '0b110101011.1111' +z.toBinary(13) // '0b1.101010111111p+8' + +// Using binary exponential notation to create a Decimal with the value of `Number.MAX_VALUE`. +x = new Decimal('0b1.1111111111111111111111111111111111111111111111111111p+1023') +// '1.7976931348623157081e+308' +``` + +Decimal instances are immutable in the sense that they are not changed by their methods. + +```js +0.3 - 0.1 // 0.19999999999999998 +x = new Decimal(0.3) +x.minus(0.1) // '0.2' +x // '0.3' +``` + +The methods that return a Decimal can be chained. + +```js +x.dividedBy(y).plus(z).times(9).floor() +x.times('1.23456780123456789e+9').plus(9876.5432321).dividedBy('4444562598.111772').ceil() +``` + +Many method names have a shorter alias. + +```js +x.squareRoot().dividedBy(y).toPower(3).equals(x.sqrt().div(y).pow(3)) // true +x.comparedTo(y.modulo(z).negated() === x.cmp(y.mod(z).neg()) // true +``` + +Most of the methods of JavaScript's `Number.prototype` and `Math` objects are replicated. + +```js +x = new Decimal(255.5) +x.toExponential(5) // '2.55500e+2' +x.toFixed(5) // '255.50000' +x.toPrecision(5) // '255.50' + +Decimal.sqrt('6.98372465832e+9823') // '8.3568682281821340204e+4911' +Decimal.pow(2, 0.0979843) // '1.0702770511687781839' + +// Using `toFixed()` to avoid exponential notation: +x = new Decimal('0.0000001') +x.toString() // '1e-7' +x.toFixed() // '0.0000001' +``` + +And there are `isNaN` and `isFinite` methods, as `NaN` and `Infinity` are valid `Decimal` values. + +```js +x = new Decimal(NaN) // 'NaN' +y = new Decimal(Infinity) // 'Infinity' +x.isNaN() && !y.isNaN() && !x.isFinite() && !y.isFinite() // true +``` + +There is also a `toFraction` method with an optional *maximum denominator* argument. + +```js +z = new Decimal(355) +pi = z.dividedBy(113) // '3.1415929204' +pi.toFraction() // [ '7853982301', '2500000000' ] +pi.toFraction(1000) // [ '355', '113' ] +``` + +All calculations are rounded according to the number of significant digits and rounding mode specified +by the `precision` and `rounding` properties of the Decimal constructor. + +For advanced usage, multiple Decimal constructors can be created, each with their own independent +configuration which applies to all Decimal numbers created from it. + +```js +// Set the precision and rounding of the default Decimal constructor +Decimal.set({ precision: 5, rounding: 4 }) + +// Create another Decimal constructor, optionally passing in a configuration object +Dec = Decimal.clone({ precision: 9, rounding: 1 }) + +x = new Decimal(5) +y = new Dec(5) + +x.div(3) // '1.6667' +y.div(3) // '1.66666666' +``` + +The value of a Decimal is stored in a floating point format in terms of its digits, exponent and sign, but these properties should be considered read-only. + +```js +x = new Decimal(-12345.67); +x.d // [ 12345, 6700000 ] digits (base 10000000) +x.e // 4 exponent (base 10) +x.s // -1 sign +``` + +For further information see the [API](http://mikemcl.github.io/decimal.js/) reference in the *doc* directory. + +## Test + +To run the tests using Node.js from the root directory: + +```bash +npm test +``` + +Each separate test module can also be executed individually, for example: + +```bash +node test/modules/toFraction +``` + +To run the tests in a browser, open *test/test.html*. + +## Minify + +Two minification examples: + +Using [uglify-js](https://github.com/mishoo/UglifyJS) to minify the *decimal.js* file: + +```bash +npm install uglify-js -g +uglifyjs decimal.js --source-map url=decimal.min.js.map -c -m -o decimal.min.js +``` + +Using [terser](https://github.com/terser/terser) to minify the ES module version, *decimal.mjs*: + +```bash +npm install terser -g +terser decimal.mjs --source-map url=decimal.min.mjs.map -c -m --toplevel -o decimal.min.mjs +``` + +```js +import Decimal from './decimal.min.mjs'; +``` + +## Licence + +[The MIT Licence](LICENCE.md) diff --git a/node_modules/decimal.js/decimal.d.ts b/node_modules/decimal.js/decimal.d.ts index 526a896d..e0db32ef 100644 --- a/node_modules/decimal.js/decimal.d.ts +++ b/node_modules/decimal.js/decimal.d.ts @@ -1,301 +1,301 @@ -// Type definitions for decimal.js >=7.0.0 -// Project: https://github.com/MikeMcl/decimal.js -// Definitions by: Michael Mclaughlin -// Definitions: https://github.com/MikeMcl/decimal.js -// -// Documentation: http://mikemcl.github.io/decimal.js/ -// -// Exports: -// -// class Decimal (default export) -// type Decimal.Constructor -// type Decimal.Instance -// type Decimal.Modulo -// type Decimal.Rounding -// type Decimal.Value -// interface Decimal.Config -// -// Example (alternative syntax commented-out): -// -// import {Decimal} from "decimal.js" -// //import Decimal from "decimal.js" -// -// let r: Decimal.Rounding = Decimal.ROUND_UP; -// let c: Decimal.Configuration = {precision: 4, rounding: r}; -// Decimal.set(c); -// let v: Decimal.Value = '12345.6789'; -// let d: Decimal = new Decimal(v); -// //let d: Decimal.Instance = new Decimal(v); -// -// The use of compiler option `--strictNullChecks` is recommended. - -export default Decimal; - -export namespace Decimal { - export type Constructor = typeof Decimal; - export type Instance = Decimal; - export type Rounding = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8; - export type Modulo = Rounding | 9; - export type Value = string | number | bigint | Decimal; - - // http://mikemcl.github.io/decimal.js/#constructor-properties - export interface Config { - precision?: number; - rounding?: Rounding; - toExpNeg?: number; - toExpPos?: number; - minE?: number; - maxE?: number; - crypto?: boolean; - modulo?: Modulo; - defaults?: boolean; - } -} - -export declare class Decimal { - readonly d: number[]; - readonly e: number; - readonly s: number; - - constructor(n: Decimal.Value); - - absoluteValue(): Decimal; - abs(): Decimal; - - ceil(): Decimal; - - clampedTo(min: Decimal.Value, max: Decimal.Value): Decimal; - clamp(min: Decimal.Value, max: Decimal.Value): Decimal; - - comparedTo(n: Decimal.Value): number; - cmp(n: Decimal.Value): number; - - cosine(): Decimal; - cos(): Decimal; - - cubeRoot(): Decimal; - cbrt(): Decimal; - - decimalPlaces(): number; - dp(): number; - - dividedBy(n: Decimal.Value): Decimal; - div(n: Decimal.Value): Decimal; - - dividedToIntegerBy(n: Decimal.Value): Decimal; - divToInt(n: Decimal.Value): Decimal; - - equals(n: Decimal.Value): boolean; - eq(n: Decimal.Value): boolean; - - floor(): Decimal; - - greaterThan(n: Decimal.Value): boolean; - gt(n: Decimal.Value): boolean; - - greaterThanOrEqualTo(n: Decimal.Value): boolean; - gte(n: Decimal.Value): boolean; - - hyperbolicCosine(): Decimal; - cosh(): Decimal; - - hyperbolicSine(): Decimal; - sinh(): Decimal; - - hyperbolicTangent(): Decimal; - tanh(): Decimal; - - inverseCosine(): Decimal; - acos(): Decimal; - - inverseHyperbolicCosine(): Decimal; - acosh(): Decimal; - - inverseHyperbolicSine(): Decimal; - asinh(): Decimal; - - inverseHyperbolicTangent(): Decimal; - atanh(): Decimal; - - inverseSine(): Decimal; - asin(): Decimal; - - inverseTangent(): Decimal; - atan(): Decimal; - - isFinite(): boolean; - - isInteger(): boolean; - isInt(): boolean; - - isNaN(): boolean; - - isNegative(): boolean; - isNeg(): boolean; - - isPositive(): boolean; - isPos(): boolean; - - isZero(): boolean; - - lessThan(n: Decimal.Value): boolean; - lt(n: Decimal.Value): boolean; - - lessThanOrEqualTo(n: Decimal.Value): boolean; - lte(n: Decimal.Value): boolean; - - logarithm(n?: Decimal.Value): Decimal; - log(n?: Decimal.Value): Decimal; - - minus(n: Decimal.Value): Decimal; - sub(n: Decimal.Value): Decimal; - - modulo(n: Decimal.Value): Decimal; - mod(n: Decimal.Value): Decimal; - - naturalExponential(): Decimal; - exp(): Decimal; - - naturalLogarithm(): Decimal; - ln(): Decimal; - - negated(): Decimal; - neg(): Decimal; - - plus(n: Decimal.Value): Decimal; - add(n: Decimal.Value): Decimal; - - precision(includeZeros?: boolean): number; - sd(includeZeros?: boolean): number; - - round(): Decimal; - - sine() : Decimal; - sin() : Decimal; - - squareRoot(): Decimal; - sqrt(): Decimal; - - tangent() : Decimal; - tan() : Decimal; - - times(n: Decimal.Value): Decimal; - mul(n: Decimal.Value) : Decimal; - - toBinary(significantDigits?: number): string; - toBinary(significantDigits: number, rounding: Decimal.Rounding): string; - - toDecimalPlaces(decimalPlaces?: number): Decimal; - toDecimalPlaces(decimalPlaces: number, rounding: Decimal.Rounding): Decimal; - toDP(decimalPlaces?: number): Decimal; - toDP(decimalPlaces: number, rounding: Decimal.Rounding): Decimal; - - toExponential(decimalPlaces?: number): string; - toExponential(decimalPlaces: number, rounding: Decimal.Rounding): string; - - toFixed(decimalPlaces?: number): string; - toFixed(decimalPlaces: number, rounding: Decimal.Rounding): string; - - toFraction(max_denominator?: Decimal.Value): Decimal[]; - - toHexadecimal(significantDigits?: number): string; - toHexadecimal(significantDigits: number, rounding: Decimal.Rounding): string; - toHex(significantDigits?: number): string; - toHex(significantDigits: number, rounding?: Decimal.Rounding): string; - - toJSON(): string; - - toNearest(n: Decimal.Value, rounding?: Decimal.Rounding): Decimal; - - toNumber(): number; - - toOctal(significantDigits?: number): string; - toOctal(significantDigits: number, rounding: Decimal.Rounding): string; - - toPower(n: Decimal.Value): Decimal; - pow(n: Decimal.Value): Decimal; - - toPrecision(significantDigits?: number): string; - toPrecision(significantDigits: number, rounding: Decimal.Rounding): string; - - toSignificantDigits(significantDigits?: number): Decimal; - toSignificantDigits(significantDigits: number, rounding: Decimal.Rounding): Decimal; - toSD(significantDigits?: number): Decimal; - toSD(significantDigits: number, rounding: Decimal.Rounding): Decimal; - - toString(): string; - - truncated(): Decimal; - trunc(): Decimal; - - valueOf(): string; - - static abs(n: Decimal.Value): Decimal; - static acos(n: Decimal.Value): Decimal; - static acosh(n: Decimal.Value): Decimal; - static add(x: Decimal.Value, y: Decimal.Value): Decimal; - static asin(n: Decimal.Value): Decimal; - static asinh(n: Decimal.Value): Decimal; - static atan(n: Decimal.Value): Decimal; - static atanh(n: Decimal.Value): Decimal; - static atan2(y: Decimal.Value, x: Decimal.Value): Decimal; - static cbrt(n: Decimal.Value): Decimal; - static ceil(n: Decimal.Value): Decimal; - static clamp(n: Decimal.Value, min: Decimal.Value, max: Decimal.Value): Decimal; - static clone(object?: Decimal.Config): Decimal.Constructor; - static config(object: Decimal.Config): Decimal.Constructor; - static cos(n: Decimal.Value): Decimal; - static cosh(n: Decimal.Value): Decimal; - static div(x: Decimal.Value, y: Decimal.Value): Decimal; - static exp(n: Decimal.Value): Decimal; - static floor(n: Decimal.Value): Decimal; - static hypot(...n: Decimal.Value[]): Decimal; - static isDecimal(object: any): object is Decimal; - static ln(n: Decimal.Value): Decimal; - static log(n: Decimal.Value, base?: Decimal.Value): Decimal; - static log2(n: Decimal.Value): Decimal; - static log10(n: Decimal.Value): Decimal; - static max(...n: Decimal.Value[]): Decimal; - static min(...n: Decimal.Value[]): Decimal; - static mod(x: Decimal.Value, y: Decimal.Value): Decimal; - static mul(x: Decimal.Value, y: Decimal.Value): Decimal; - static noConflict(): Decimal.Constructor; // Browser only - static pow(base: Decimal.Value, exponent: Decimal.Value): Decimal; - static random(significantDigits?: number): Decimal; - static round(n: Decimal.Value): Decimal; - static set(object: Decimal.Config): Decimal.Constructor; - static sign(n: Decimal.Value): number; - static sin(n: Decimal.Value): Decimal; - static sinh(n: Decimal.Value): Decimal; - static sqrt(n: Decimal.Value): Decimal; - static sub(x: Decimal.Value, y: Decimal.Value): Decimal; - static sum(...n: Decimal.Value[]): Decimal; - static tan(n: Decimal.Value): Decimal; - static tanh(n: Decimal.Value): Decimal; - static trunc(n: Decimal.Value): Decimal; - - static readonly default?: Decimal.Constructor; - static readonly Decimal?: Decimal.Constructor; - - static readonly precision: number; - static readonly rounding: Decimal.Rounding; - static readonly toExpNeg: number; - static readonly toExpPos: number; - static readonly minE: number; - static readonly maxE: number; - static readonly crypto: boolean; - static readonly modulo: Decimal.Modulo; - - static readonly ROUND_UP: 0; - static readonly ROUND_DOWN: 1; - static readonly ROUND_CEIL: 2; - static readonly ROUND_FLOOR: 3; - static readonly ROUND_HALF_UP: 4; - static readonly ROUND_HALF_DOWN: 5; - static readonly ROUND_HALF_EVEN: 6; - static readonly ROUND_HALF_CEIL: 7; - static readonly ROUND_HALF_FLOOR: 8; - static readonly EUCLID: 9; -} - -export declare function Decimal(n: Decimal.Value): Decimal; +// Type definitions for decimal.js >=7.0.0 +// Project: https://github.com/MikeMcl/decimal.js +// Definitions by: Michael Mclaughlin +// Definitions: https://github.com/MikeMcl/decimal.js +// +// Documentation: http://mikemcl.github.io/decimal.js/ +// +// Exports: +// +// class Decimal (default export) +// type Decimal.Constructor +// type Decimal.Instance +// type Decimal.Modulo +// type Decimal.Rounding +// type Decimal.Value +// interface Decimal.Config +// +// Example (alternative syntax commented-out): +// +// import {Decimal} from "decimal.js" +// //import Decimal from "decimal.js" +// +// let r: Decimal.Rounding = Decimal.ROUND_UP; +// let c: Decimal.Configuration = {precision: 4, rounding: r}; +// Decimal.set(c); +// let v: Decimal.Value = '12345.6789'; +// let d: Decimal = new Decimal(v); +// //let d: Decimal.Instance = new Decimal(v); +// +// The use of compiler option `--strictNullChecks` is recommended. + +export default Decimal; + +export namespace Decimal { + export type Constructor = typeof Decimal; + export type Instance = Decimal; + export type Rounding = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8; + export type Modulo = Rounding | 9; + export type Value = string | number | bigint | Decimal; + + // http://mikemcl.github.io/decimal.js/#constructor-properties + export interface Config { + precision?: number; + rounding?: Rounding; + toExpNeg?: number; + toExpPos?: number; + minE?: number; + maxE?: number; + crypto?: boolean; + modulo?: Modulo; + defaults?: boolean; + } +} + +export declare class Decimal { + readonly d: number[]; + readonly e: number; + readonly s: number; + + constructor(n: Decimal.Value); + + absoluteValue(): Decimal; + abs(): Decimal; + + ceil(): Decimal; + + clampedTo(min: Decimal.Value, max: Decimal.Value): Decimal; + clamp(min: Decimal.Value, max: Decimal.Value): Decimal; + + comparedTo(n: Decimal.Value): number; + cmp(n: Decimal.Value): number; + + cosine(): Decimal; + cos(): Decimal; + + cubeRoot(): Decimal; + cbrt(): Decimal; + + decimalPlaces(): number; + dp(): number; + + dividedBy(n: Decimal.Value): Decimal; + div(n: Decimal.Value): Decimal; + + dividedToIntegerBy(n: Decimal.Value): Decimal; + divToInt(n: Decimal.Value): Decimal; + + equals(n: Decimal.Value): boolean; + eq(n: Decimal.Value): boolean; + + floor(): Decimal; + + greaterThan(n: Decimal.Value): boolean; + gt(n: Decimal.Value): boolean; + + greaterThanOrEqualTo(n: Decimal.Value): boolean; + gte(n: Decimal.Value): boolean; + + hyperbolicCosine(): Decimal; + cosh(): Decimal; + + hyperbolicSine(): Decimal; + sinh(): Decimal; + + hyperbolicTangent(): Decimal; + tanh(): Decimal; + + inverseCosine(): Decimal; + acos(): Decimal; + + inverseHyperbolicCosine(): Decimal; + acosh(): Decimal; + + inverseHyperbolicSine(): Decimal; + asinh(): Decimal; + + inverseHyperbolicTangent(): Decimal; + atanh(): Decimal; + + inverseSine(): Decimal; + asin(): Decimal; + + inverseTangent(): Decimal; + atan(): Decimal; + + isFinite(): boolean; + + isInteger(): boolean; + isInt(): boolean; + + isNaN(): boolean; + + isNegative(): boolean; + isNeg(): boolean; + + isPositive(): boolean; + isPos(): boolean; + + isZero(): boolean; + + lessThan(n: Decimal.Value): boolean; + lt(n: Decimal.Value): boolean; + + lessThanOrEqualTo(n: Decimal.Value): boolean; + lte(n: Decimal.Value): boolean; + + logarithm(n?: Decimal.Value): Decimal; + log(n?: Decimal.Value): Decimal; + + minus(n: Decimal.Value): Decimal; + sub(n: Decimal.Value): Decimal; + + modulo(n: Decimal.Value): Decimal; + mod(n: Decimal.Value): Decimal; + + naturalExponential(): Decimal; + exp(): Decimal; + + naturalLogarithm(): Decimal; + ln(): Decimal; + + negated(): Decimal; + neg(): Decimal; + + plus(n: Decimal.Value): Decimal; + add(n: Decimal.Value): Decimal; + + precision(includeZeros?: boolean): number; + sd(includeZeros?: boolean): number; + + round(): Decimal; + + sine() : Decimal; + sin() : Decimal; + + squareRoot(): Decimal; + sqrt(): Decimal; + + tangent() : Decimal; + tan() : Decimal; + + times(n: Decimal.Value): Decimal; + mul(n: Decimal.Value) : Decimal; + + toBinary(significantDigits?: number): string; + toBinary(significantDigits: number, rounding: Decimal.Rounding): string; + + toDecimalPlaces(decimalPlaces?: number): Decimal; + toDecimalPlaces(decimalPlaces: number, rounding: Decimal.Rounding): Decimal; + toDP(decimalPlaces?: number): Decimal; + toDP(decimalPlaces: number, rounding: Decimal.Rounding): Decimal; + + toExponential(decimalPlaces?: number): string; + toExponential(decimalPlaces: number, rounding: Decimal.Rounding): string; + + toFixed(decimalPlaces?: number): string; + toFixed(decimalPlaces: number, rounding: Decimal.Rounding): string; + + toFraction(max_denominator?: Decimal.Value): Decimal[]; + + toHexadecimal(significantDigits?: number): string; + toHexadecimal(significantDigits: number, rounding: Decimal.Rounding): string; + toHex(significantDigits?: number): string; + toHex(significantDigits: number, rounding?: Decimal.Rounding): string; + + toJSON(): string; + + toNearest(n: Decimal.Value, rounding?: Decimal.Rounding): Decimal; + + toNumber(): number; + + toOctal(significantDigits?: number): string; + toOctal(significantDigits: number, rounding: Decimal.Rounding): string; + + toPower(n: Decimal.Value): Decimal; + pow(n: Decimal.Value): Decimal; + + toPrecision(significantDigits?: number): string; + toPrecision(significantDigits: number, rounding: Decimal.Rounding): string; + + toSignificantDigits(significantDigits?: number): Decimal; + toSignificantDigits(significantDigits: number, rounding: Decimal.Rounding): Decimal; + toSD(significantDigits?: number): Decimal; + toSD(significantDigits: number, rounding: Decimal.Rounding): Decimal; + + toString(): string; + + truncated(): Decimal; + trunc(): Decimal; + + valueOf(): string; + + static abs(n: Decimal.Value): Decimal; + static acos(n: Decimal.Value): Decimal; + static acosh(n: Decimal.Value): Decimal; + static add(x: Decimal.Value, y: Decimal.Value): Decimal; + static asin(n: Decimal.Value): Decimal; + static asinh(n: Decimal.Value): Decimal; + static atan(n: Decimal.Value): Decimal; + static atanh(n: Decimal.Value): Decimal; + static atan2(y: Decimal.Value, x: Decimal.Value): Decimal; + static cbrt(n: Decimal.Value): Decimal; + static ceil(n: Decimal.Value): Decimal; + static clamp(n: Decimal.Value, min: Decimal.Value, max: Decimal.Value): Decimal; + static clone(object?: Decimal.Config): Decimal.Constructor; + static config(object: Decimal.Config): Decimal.Constructor; + static cos(n: Decimal.Value): Decimal; + static cosh(n: Decimal.Value): Decimal; + static div(x: Decimal.Value, y: Decimal.Value): Decimal; + static exp(n: Decimal.Value): Decimal; + static floor(n: Decimal.Value): Decimal; + static hypot(...n: Decimal.Value[]): Decimal; + static isDecimal(object: any): object is Decimal; + static ln(n: Decimal.Value): Decimal; + static log(n: Decimal.Value, base?: Decimal.Value): Decimal; + static log2(n: Decimal.Value): Decimal; + static log10(n: Decimal.Value): Decimal; + static max(...n: Decimal.Value[]): Decimal; + static min(...n: Decimal.Value[]): Decimal; + static mod(x: Decimal.Value, y: Decimal.Value): Decimal; + static mul(x: Decimal.Value, y: Decimal.Value): Decimal; + static noConflict(): Decimal.Constructor; // Browser only + static pow(base: Decimal.Value, exponent: Decimal.Value): Decimal; + static random(significantDigits?: number): Decimal; + static round(n: Decimal.Value): Decimal; + static set(object: Decimal.Config): Decimal.Constructor; + static sign(n: Decimal.Value): number; + static sin(n: Decimal.Value): Decimal; + static sinh(n: Decimal.Value): Decimal; + static sqrt(n: Decimal.Value): Decimal; + static sub(x: Decimal.Value, y: Decimal.Value): Decimal; + static sum(...n: Decimal.Value[]): Decimal; + static tan(n: Decimal.Value): Decimal; + static tanh(n: Decimal.Value): Decimal; + static trunc(n: Decimal.Value): Decimal; + + static readonly default?: Decimal.Constructor; + static readonly Decimal?: Decimal.Constructor; + + static readonly precision: number; + static readonly rounding: Decimal.Rounding; + static readonly toExpNeg: number; + static readonly toExpPos: number; + static readonly minE: number; + static readonly maxE: number; + static readonly crypto: boolean; + static readonly modulo: Decimal.Modulo; + + static readonly ROUND_UP: 0; + static readonly ROUND_DOWN: 1; + static readonly ROUND_CEIL: 2; + static readonly ROUND_FLOOR: 3; + static readonly ROUND_HALF_UP: 4; + static readonly ROUND_HALF_DOWN: 5; + static readonly ROUND_HALF_EVEN: 6; + static readonly ROUND_HALF_CEIL: 7; + static readonly ROUND_HALF_FLOOR: 8; + static readonly EUCLID: 9; +} + +export declare function Decimal(n: Decimal.Value): Decimal; diff --git a/node_modules/decimal.js/decimal.js b/node_modules/decimal.js/decimal.js index f7ecafb5..23295c6a 100644 --- a/node_modules/decimal.js/decimal.js +++ b/node_modules/decimal.js/decimal.js @@ -1,4951 +1,4951 @@ -;(function (globalScope) { - 'use strict'; - - - /*! - * decimal.js v10.6.0 - * An arbitrary-precision Decimal type for JavaScript. - * https://github.com/MikeMcl/decimal.js - * Copyright (c) 2025 Michael Mclaughlin - * MIT Licence - */ - - - // ----------------------------------- EDITABLE DEFAULTS ------------------------------------ // - - - // The maximum exponent magnitude. - // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`. - var EXP_LIMIT = 9e15, // 0 to 9e15 - - // The limit on the value of `precision`, and on the value of the first argument to - // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`. - MAX_DIGITS = 1e9, // 0 to 1e9 - - // Base conversion alphabet. - NUMERALS = '0123456789abcdef', - - // The natural logarithm of 10 (1025 digits). - LN10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058', - - // Pi (1025 digits). - PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789', - - - // The initial configuration properties of the Decimal constructor. - DEFAULTS = { - - // These values must be integers within the stated ranges (inclusive). - // Most of these values can be changed at run-time using the `Decimal.config` method. - - // The maximum number of significant digits of the result of a calculation or base conversion. - // E.g. `Decimal.config({ precision: 20 });` - precision: 20, // 1 to MAX_DIGITS - - // The rounding mode used when rounding to `precision`. - // - // ROUND_UP 0 Away from zero. - // ROUND_DOWN 1 Towards zero. - // ROUND_CEIL 2 Towards +Infinity. - // ROUND_FLOOR 3 Towards -Infinity. - // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up. - // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down. - // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour. - // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity. - // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity. - // - // E.g. - // `Decimal.rounding = 4;` - // `Decimal.rounding = Decimal.ROUND_HALF_UP;` - rounding: 4, // 0 to 8 - - // The modulo mode used when calculating the modulus: a mod n. - // The quotient (q = a / n) is calculated according to the corresponding rounding mode. - // The remainder (r) is calculated as: r = a - n * q. - // - // UP 0 The remainder is positive if the dividend is negative, else is negative. - // DOWN 1 The remainder has the same sign as the dividend (JavaScript %). - // FLOOR 3 The remainder has the same sign as the divisor (Python %). - // HALF_EVEN 6 The IEEE 754 remainder function. - // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive. - // - // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian - // division (9) are commonly used for the modulus operation. The other rounding modes can also - // be used, but they may not give useful results. - modulo: 1, // 0 to 9 - - // The exponent value at and beneath which `toString` returns exponential notation. - // JavaScript numbers: -7 - toExpNeg: -7, // 0 to -EXP_LIMIT - - // The exponent value at and above which `toString` returns exponential notation. - // JavaScript numbers: 21 - toExpPos: 21, // 0 to EXP_LIMIT - - // The minimum exponent value, beneath which underflow to zero occurs. - // JavaScript numbers: -324 (5e-324) - minE: -EXP_LIMIT, // -1 to -EXP_LIMIT - - // The maximum exponent value, above which overflow to Infinity occurs. - // JavaScript numbers: 308 (1.7976931348623157e+308) - maxE: EXP_LIMIT, // 1 to EXP_LIMIT - - // Whether to use cryptographically-secure random number generation, if available. - crypto: false // true/false - }, - - - // ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- // - - - Decimal, inexact, noConflict, quadrant, - external = true, - - decimalError = '[DecimalError] ', - invalidArgument = decimalError + 'Invalid argument: ', - precisionLimitExceeded = decimalError + 'Precision limit exceeded', - cryptoUnavailable = decimalError + 'crypto unavailable', - tag = '[object Decimal]', - - mathfloor = Math.floor, - mathpow = Math.pow, - - isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i, - isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i, - isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, - isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, - - BASE = 1e7, - LOG_BASE = 7, - MAX_SAFE_INTEGER = 9007199254740991, - - LN10_PRECISION = LN10.length - 1, - PI_PRECISION = PI.length - 1, - - // Decimal.prototype object - P = { toStringTag: tag }; - - - // Decimal prototype methods - - - /* - * absoluteValue abs - * ceil - * clampedTo clamp - * comparedTo cmp - * cosine cos - * cubeRoot cbrt - * decimalPlaces dp - * dividedBy div - * dividedToIntegerBy divToInt - * equals eq - * floor - * greaterThan gt - * greaterThanOrEqualTo gte - * hyperbolicCosine cosh - * hyperbolicSine sinh - * hyperbolicTangent tanh - * inverseCosine acos - * inverseHyperbolicCosine acosh - * inverseHyperbolicSine asinh - * inverseHyperbolicTangent atanh - * inverseSine asin - * inverseTangent atan - * isFinite - * isInteger isInt - * isNaN - * isNegative isNeg - * isPositive isPos - * isZero - * lessThan lt - * lessThanOrEqualTo lte - * logarithm log - * [maximum] [max] - * [minimum] [min] - * minus sub - * modulo mod - * naturalExponential exp - * naturalLogarithm ln - * negated neg - * plus add - * precision sd - * round - * sine sin - * squareRoot sqrt - * tangent tan - * times mul - * toBinary - * toDecimalPlaces toDP - * toExponential - * toFixed - * toFraction - * toHexadecimal toHex - * toNearest - * toNumber - * toOctal - * toPower pow - * toPrecision - * toSignificantDigits toSD - * toString - * truncated trunc - * valueOf toJSON - */ - - - /* - * Return a new Decimal whose value is the absolute value of this Decimal. - * - */ - P.absoluteValue = P.abs = function () { - var x = new this.constructor(this); - if (x.s < 0) x.s = 1; - return finalise(x); - }; - - - /* - * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the - * direction of positive Infinity. - * - */ - P.ceil = function () { - return finalise(new this.constructor(this), this.e + 1, 2); - }; - - - /* - * Return a new Decimal whose value is the value of this Decimal clamped to the range - * delineated by `min` and `max`. - * - * min {number|string|bigint|Decimal} - * max {number|string|bigint|Decimal} - * - */ - P.clampedTo = P.clamp = function (min, max) { - var k, - x = this, - Ctor = x.constructor; - min = new Ctor(min); - max = new Ctor(max); - if (!min.s || !max.s) return new Ctor(NaN); - if (min.gt(max)) throw Error(invalidArgument + max); - k = x.cmp(min); - return k < 0 ? min : x.cmp(max) > 0 ? max : new Ctor(x); - }; - - - /* - * Return - * 1 if the value of this Decimal is greater than the value of `y`, - * -1 if the value of this Decimal is less than the value of `y`, - * 0 if they have the same value, - * NaN if the value of either Decimal is NaN. - * - */ - P.comparedTo = P.cmp = function (y) { - var i, j, xdL, ydL, - x = this, - xd = x.d, - yd = (y = new x.constructor(y)).d, - xs = x.s, - ys = y.s; - - // Either NaN or ±Infinity? - if (!xd || !yd) { - return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1; - } - - // Either zero? - if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0; - - // Signs differ? - if (xs !== ys) return xs; - - // Compare exponents. - if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1; - - xdL = xd.length; - ydL = yd.length; - - // Compare digit by digit. - for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) { - if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1; - } - - // Compare lengths. - return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1; - }; - - - /* - * Return a new Decimal whose value is the cosine of the value in radians of this Decimal. - * - * Domain: [-Infinity, Infinity] - * Range: [-1, 1] - * - * cos(0) = 1 - * cos(-0) = 1 - * cos(Infinity) = NaN - * cos(-Infinity) = NaN - * cos(NaN) = NaN - * - */ - P.cosine = P.cos = function () { - var pr, rm, - x = this, - Ctor = x.constructor; - - if (!x.d) return new Ctor(NaN); - - // cos(0) = cos(-0) = 1 - if (!x.d[0]) return new Ctor(1); - - pr = Ctor.precision; - rm = Ctor.rounding; - Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE; - Ctor.rounding = 1; - - x = cosine(Ctor, toLessThanHalfPi(Ctor, x)); - - Ctor.precision = pr; - Ctor.rounding = rm; - - return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true); - }; - - - /* - * - * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to - * `precision` significant digits using rounding mode `rounding`. - * - * cbrt(0) = 0 - * cbrt(-0) = -0 - * cbrt(1) = 1 - * cbrt(-1) = -1 - * cbrt(N) = N - * cbrt(-I) = -I - * cbrt(I) = I - * - * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3)) - * - */ - P.cubeRoot = P.cbrt = function () { - var e, m, n, r, rep, s, sd, t, t3, t3plusx, - x = this, - Ctor = x.constructor; - - if (!x.isFinite() || x.isZero()) return new Ctor(x); - external = false; - - // Initial estimate. - s = x.s * mathpow(x.s * x, 1 / 3); - - // Math.cbrt underflow/overflow? - // Pass x to Math.pow as integer, then adjust the exponent of the result. - if (!s || Math.abs(s) == 1 / 0) { - n = digitsToString(x.d); - e = x.e; - - // Adjust n exponent so it is a multiple of 3 away from x exponent. - if (s = (e - n.length + 1) % 3) n += (s == 1 || s == -2 ? '0' : '00'); - s = mathpow(n, 1 / 3); - - // Rarely, e may be one less than the result exponent value. - e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2)); - - if (s == 1 / 0) { - n = '5e' + e; - } else { - n = s.toExponential(); - n = n.slice(0, n.indexOf('e') + 1) + e; - } - - r = new Ctor(n); - r.s = x.s; - } else { - r = new Ctor(s.toString()); - } - - sd = (e = Ctor.precision) + 3; - - // Halley's method. - // TODO? Compare Newton's method. - for (;;) { - t = r; - t3 = t.times(t).times(t); - t3plusx = t3.plus(x); - r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1); - - // TODO? Replace with for-loop and checkRoundingDigits. - if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) { - n = n.slice(sd - 3, sd + 1); - - // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999 - // , i.e. approaching a rounding boundary, continue the iteration. - if (n == '9999' || !rep && n == '4999') { - - // On the first iteration only, check to see if rounding up gives the exact result as the - // nines may infinitely repeat. - if (!rep) { - finalise(t, e + 1, 0); - - if (t.times(t).times(t).eq(x)) { - r = t; - break; - } - } - - sd += 4; - rep = 1; - } else { - - // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result. - // If not, then there are further digits and m will be truthy. - if (!+n || !+n.slice(1) && n.charAt(0) == '5') { - - // Truncate to the first rounding digit. - finalise(r, e + 1, 1); - m = !r.times(r).times(r).eq(x); - } - - break; - } - } - } - - external = true; - - return finalise(r, e, Ctor.rounding, m); - }; - - - /* - * Return the number of decimal places of the value of this Decimal. - * - */ - P.decimalPlaces = P.dp = function () { - var w, - d = this.d, - n = NaN; - - if (d) { - w = d.length - 1; - n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE; - - // Subtract the number of trailing zeros of the last word. - w = d[w]; - if (w) for (; w % 10 == 0; w /= 10) n--; - if (n < 0) n = 0; - } - - return n; - }; - - - /* - * n / 0 = I - * n / N = N - * n / I = 0 - * 0 / n = 0 - * 0 / 0 = N - * 0 / N = N - * 0 / I = 0 - * N / n = N - * N / 0 = N - * N / N = N - * N / I = N - * I / n = I - * I / 0 = I - * I / N = N - * I / I = N - * - * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to - * `precision` significant digits using rounding mode `rounding`. - * - */ - P.dividedBy = P.div = function (y) { - return divide(this, new this.constructor(y)); - }; - - - /* - * Return a new Decimal whose value is the integer part of dividing the value of this Decimal - * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`. - * - */ - P.dividedToIntegerBy = P.divToInt = function (y) { - var x = this, - Ctor = x.constructor; - return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding); - }; - - - /* - * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false. - * - */ - P.equals = P.eq = function (y) { - return this.cmp(y) === 0; - }; - - - /* - * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the - * direction of negative Infinity. - * - */ - P.floor = function () { - return finalise(new this.constructor(this), this.e + 1, 3); - }; - - - /* - * Return true if the value of this Decimal is greater than the value of `y`, otherwise return - * false. - * - */ - P.greaterThan = P.gt = function (y) { - return this.cmp(y) > 0; - }; - - - /* - * Return true if the value of this Decimal is greater than or equal to the value of `y`, - * otherwise return false. - * - */ - P.greaterThanOrEqualTo = P.gte = function (y) { - var k = this.cmp(y); - return k == 1 || k === 0; - }; - - - /* - * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this - * Decimal. - * - * Domain: [-Infinity, Infinity] - * Range: [1, Infinity] - * - * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ... - * - * cosh(0) = 1 - * cosh(-0) = 1 - * cosh(Infinity) = Infinity - * cosh(-Infinity) = Infinity - * cosh(NaN) = NaN - * - * x time taken (ms) result - * 1000 9 9.8503555700852349694e+433 - * 10000 25 4.4034091128314607936e+4342 - * 100000 171 1.4033316802130615897e+43429 - * 1000000 3817 1.5166076984010437725e+434294 - * 10000000 abandoned after 2 minute wait - * - * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x)) - * - */ - P.hyperbolicCosine = P.cosh = function () { - var k, n, pr, rm, len, - x = this, - Ctor = x.constructor, - one = new Ctor(1); - - if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN); - if (x.isZero()) return one; - - pr = Ctor.precision; - rm = Ctor.rounding; - Ctor.precision = pr + Math.max(x.e, x.sd()) + 4; - Ctor.rounding = 1; - len = x.d.length; - - // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1 - // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4)) - - // Estimate the optimum number of times to use the argument reduction. - // TODO? Estimation reused from cosine() and may not be optimal here. - if (len < 32) { - k = Math.ceil(len / 3); - n = (1 / tinyPow(4, k)).toString(); - } else { - k = 16; - n = '2.3283064365386962890625e-10'; - } - - x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true); - - // Reverse argument reduction - var cosh2_x, - i = k, - d8 = new Ctor(8); - for (; i--;) { - cosh2_x = x.times(x); - x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8)))); - } - - return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true); - }; - - - /* - * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this - * Decimal. - * - * Domain: [-Infinity, Infinity] - * Range: [-Infinity, Infinity] - * - * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ... - * - * sinh(0) = 0 - * sinh(-0) = -0 - * sinh(Infinity) = Infinity - * sinh(-Infinity) = -Infinity - * sinh(NaN) = NaN - * - * x time taken (ms) - * 10 2 ms - * 100 5 ms - * 1000 14 ms - * 10000 82 ms - * 100000 886 ms 1.4033316802130615897e+43429 - * 200000 2613 ms - * 300000 5407 ms - * 400000 8824 ms - * 500000 13026 ms 8.7080643612718084129e+217146 - * 1000000 48543 ms - * - * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x)) - * - */ - P.hyperbolicSine = P.sinh = function () { - var k, pr, rm, len, - x = this, - Ctor = x.constructor; - - if (!x.isFinite() || x.isZero()) return new Ctor(x); - - pr = Ctor.precision; - rm = Ctor.rounding; - Ctor.precision = pr + Math.max(x.e, x.sd()) + 4; - Ctor.rounding = 1; - len = x.d.length; - - if (len < 3) { - x = taylorSeries(Ctor, 2, x, x, true); - } else { - - // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x)) - // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3)) - // 3 multiplications and 1 addition - - // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x))) - // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5))) - // 4 multiplications and 2 additions - - // Estimate the optimum number of times to use the argument reduction. - k = 1.4 * Math.sqrt(len); - k = k > 16 ? 16 : k | 0; - - x = x.times(1 / tinyPow(5, k)); - x = taylorSeries(Ctor, 2, x, x, true); - - // Reverse argument reduction - var sinh2_x, - d5 = new Ctor(5), - d16 = new Ctor(16), - d20 = new Ctor(20); - for (; k--;) { - sinh2_x = x.times(x); - x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20)))); - } - } - - Ctor.precision = pr; - Ctor.rounding = rm; - - return finalise(x, pr, rm, true); - }; - - - /* - * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this - * Decimal. - * - * Domain: [-Infinity, Infinity] - * Range: [-1, 1] - * - * tanh(x) = sinh(x) / cosh(x) - * - * tanh(0) = 0 - * tanh(-0) = -0 - * tanh(Infinity) = 1 - * tanh(-Infinity) = -1 - * tanh(NaN) = NaN - * - */ - P.hyperbolicTangent = P.tanh = function () { - var pr, rm, - x = this, - Ctor = x.constructor; - - if (!x.isFinite()) return new Ctor(x.s); - if (x.isZero()) return new Ctor(x); - - pr = Ctor.precision; - rm = Ctor.rounding; - Ctor.precision = pr + 7; - Ctor.rounding = 1; - - return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm); - }; - - - /* - * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of - * this Decimal. - * - * Domain: [-1, 1] - * Range: [0, pi] - * - * acos(x) = pi/2 - asin(x) - * - * acos(0) = pi/2 - * acos(-0) = pi/2 - * acos(1) = 0 - * acos(-1) = pi - * acos(1/2) = pi/3 - * acos(-1/2) = 2*pi/3 - * acos(|x| > 1) = NaN - * acos(NaN) = NaN - * - */ - P.inverseCosine = P.acos = function () { - var x = this, - Ctor = x.constructor, - k = x.abs().cmp(1), - pr = Ctor.precision, - rm = Ctor.rounding; - - if (k !== -1) { - return k === 0 - // |x| is 1 - ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0) - // |x| > 1 or x is NaN - : new Ctor(NaN); - } - - if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5); - - // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3 - - Ctor.precision = pr + 6; - Ctor.rounding = 1; - - // See https://github.com/MikeMcl/decimal.js/pull/217 - x = new Ctor(1).minus(x).div(x.plus(1)).sqrt().atan(); - - Ctor.precision = pr; - Ctor.rounding = rm; - - return x.times(2); - }; - - - /* - * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the - * value of this Decimal. - * - * Domain: [1, Infinity] - * Range: [0, Infinity] - * - * acosh(x) = ln(x + sqrt(x^2 - 1)) - * - * acosh(x < 1) = NaN - * acosh(NaN) = NaN - * acosh(Infinity) = Infinity - * acosh(-Infinity) = NaN - * acosh(0) = NaN - * acosh(-0) = NaN - * acosh(1) = 0 - * acosh(-1) = NaN - * - */ - P.inverseHyperbolicCosine = P.acosh = function () { - var pr, rm, - x = this, - Ctor = x.constructor; - - if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN); - if (!x.isFinite()) return new Ctor(x); - - pr = Ctor.precision; - rm = Ctor.rounding; - Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4; - Ctor.rounding = 1; - external = false; - - x = x.times(x).minus(1).sqrt().plus(x); - - external = true; - Ctor.precision = pr; - Ctor.rounding = rm; - - return x.ln(); - }; - - - /* - * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value - * of this Decimal. - * - * Domain: [-Infinity, Infinity] - * Range: [-Infinity, Infinity] - * - * asinh(x) = ln(x + sqrt(x^2 + 1)) - * - * asinh(NaN) = NaN - * asinh(Infinity) = Infinity - * asinh(-Infinity) = -Infinity - * asinh(0) = 0 - * asinh(-0) = -0 - * - */ - P.inverseHyperbolicSine = P.asinh = function () { - var pr, rm, - x = this, - Ctor = x.constructor; - - if (!x.isFinite() || x.isZero()) return new Ctor(x); - - pr = Ctor.precision; - rm = Ctor.rounding; - Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6; - Ctor.rounding = 1; - external = false; - - x = x.times(x).plus(1).sqrt().plus(x); - - external = true; - Ctor.precision = pr; - Ctor.rounding = rm; - - return x.ln(); - }; - - - /* - * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the - * value of this Decimal. - * - * Domain: [-1, 1] - * Range: [-Infinity, Infinity] - * - * atanh(x) = 0.5 * ln((1 + x) / (1 - x)) - * - * atanh(|x| > 1) = NaN - * atanh(NaN) = NaN - * atanh(Infinity) = NaN - * atanh(-Infinity) = NaN - * atanh(0) = 0 - * atanh(-0) = -0 - * atanh(1) = Infinity - * atanh(-1) = -Infinity - * - */ - P.inverseHyperbolicTangent = P.atanh = function () { - var pr, rm, wpr, xsd, - x = this, - Ctor = x.constructor; - - if (!x.isFinite()) return new Ctor(NaN); - if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN); - - pr = Ctor.precision; - rm = Ctor.rounding; - xsd = x.sd(); - - if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true); - - Ctor.precision = wpr = xsd - x.e; - - x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1); - - Ctor.precision = pr + 4; - Ctor.rounding = 1; - - x = x.ln(); - - Ctor.precision = pr; - Ctor.rounding = rm; - - return x.times(0.5); - }; - - - /* - * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this - * Decimal. - * - * Domain: [-Infinity, Infinity] - * Range: [-pi/2, pi/2] - * - * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2))) - * - * asin(0) = 0 - * asin(-0) = -0 - * asin(1/2) = pi/6 - * asin(-1/2) = -pi/6 - * asin(1) = pi/2 - * asin(-1) = -pi/2 - * asin(|x| > 1) = NaN - * asin(NaN) = NaN - * - * TODO? Compare performance of Taylor series. - * - */ - P.inverseSine = P.asin = function () { - var halfPi, k, - pr, rm, - x = this, - Ctor = x.constructor; - - if (x.isZero()) return new Ctor(x); - - k = x.abs().cmp(1); - pr = Ctor.precision; - rm = Ctor.rounding; - - if (k !== -1) { - - // |x| is 1 - if (k === 0) { - halfPi = getPi(Ctor, pr + 4, rm).times(0.5); - halfPi.s = x.s; - return halfPi; - } - - // |x| > 1 or x is NaN - return new Ctor(NaN); - } - - // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6 - - Ctor.precision = pr + 6; - Ctor.rounding = 1; - - x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan(); - - Ctor.precision = pr; - Ctor.rounding = rm; - - return x.times(2); - }; - - - /* - * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value - * of this Decimal. - * - * Domain: [-Infinity, Infinity] - * Range: [-pi/2, pi/2] - * - * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ... - * - * atan(0) = 0 - * atan(-0) = -0 - * atan(1) = pi/4 - * atan(-1) = -pi/4 - * atan(Infinity) = pi/2 - * atan(-Infinity) = -pi/2 - * atan(NaN) = NaN - * - */ - P.inverseTangent = P.atan = function () { - var i, j, k, n, px, t, r, wpr, x2, - x = this, - Ctor = x.constructor, - pr = Ctor.precision, - rm = Ctor.rounding; - - if (!x.isFinite()) { - if (!x.s) return new Ctor(NaN); - if (pr + 4 <= PI_PRECISION) { - r = getPi(Ctor, pr + 4, rm).times(0.5); - r.s = x.s; - return r; - } - } else if (x.isZero()) { - return new Ctor(x); - } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) { - r = getPi(Ctor, pr + 4, rm).times(0.25); - r.s = x.s; - return r; - } - - Ctor.precision = wpr = pr + 10; - Ctor.rounding = 1; - - // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x); - - // Argument reduction - // Ensure |x| < 0.42 - // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2))) - - k = Math.min(28, wpr / LOG_BASE + 2 | 0); - - for (i = k; i; --i) x = x.div(x.times(x).plus(1).sqrt().plus(1)); - - external = false; - - j = Math.ceil(wpr / LOG_BASE); - n = 1; - x2 = x.times(x); - r = new Ctor(x); - px = x; - - // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ... - for (; i !== -1;) { - px = px.times(x2); - t = r.minus(px.div(n += 2)); - - px = px.times(x2); - r = t.plus(px.div(n += 2)); - - if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;); - } - - if (k) r = r.times(2 << (k - 1)); - - external = true; - - return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true); - }; - - - /* - * Return true if the value of this Decimal is a finite number, otherwise return false. - * - */ - P.isFinite = function () { - return !!this.d; - }; - - - /* - * Return true if the value of this Decimal is an integer, otherwise return false. - * - */ - P.isInteger = P.isInt = function () { - return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2; - }; - - - /* - * Return true if the value of this Decimal is NaN, otherwise return false. - * - */ - P.isNaN = function () { - return !this.s; - }; - - - /* - * Return true if the value of this Decimal is negative, otherwise return false. - * - */ - P.isNegative = P.isNeg = function () { - return this.s < 0; - }; - - - /* - * Return true if the value of this Decimal is positive, otherwise return false. - * - */ - P.isPositive = P.isPos = function () { - return this.s > 0; - }; - - - /* - * Return true if the value of this Decimal is 0 or -0, otherwise return false. - * - */ - P.isZero = function () { - return !!this.d && this.d[0] === 0; - }; - - - /* - * Return true if the value of this Decimal is less than `y`, otherwise return false. - * - */ - P.lessThan = P.lt = function (y) { - return this.cmp(y) < 0; - }; - - - /* - * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false. - * - */ - P.lessThanOrEqualTo = P.lte = function (y) { - return this.cmp(y) < 1; - }; - - - /* - * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - * If no base is specified, return log[10](arg). - * - * log[base](arg) = ln(arg) / ln(base) - * - * The result will always be correctly rounded if the base of the log is 10, and 'almost always' - * otherwise: - * - * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen - * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error - * between the result and the correctly rounded result will be one ulp (unit in the last place). - * - * log[-b](a) = NaN - * log[0](a) = NaN - * log[1](a) = NaN - * log[NaN](a) = NaN - * log[Infinity](a) = NaN - * log[b](0) = -Infinity - * log[b](-0) = -Infinity - * log[b](-a) = NaN - * log[b](1) = 0 - * log[b](Infinity) = Infinity - * log[b](NaN) = NaN - * - * [base] {number|string|bigint|Decimal} The base of the logarithm. - * - */ - P.logarithm = P.log = function (base) { - var isBase10, d, denominator, k, inf, num, sd, r, - arg = this, - Ctor = arg.constructor, - pr = Ctor.precision, - rm = Ctor.rounding, - guard = 5; - - // Default base is 10. - if (base == null) { - base = new Ctor(10); - isBase10 = true; - } else { - base = new Ctor(base); - d = base.d; - - // Return NaN if base is negative, or non-finite, or is 0 or 1. - if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN); - - isBase10 = base.eq(10); - } - - d = arg.d; - - // Is arg negative, non-finite, 0 or 1? - if (arg.s < 0 || !d || !d[0] || arg.eq(1)) { - return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0); - } - - // The result will have a non-terminating decimal expansion if base is 10 and arg is not an - // integer power of 10. - if (isBase10) { - if (d.length > 1) { - inf = true; - } else { - for (k = d[0]; k % 10 === 0;) k /= 10; - inf = k !== 1; - } - } - - external = false; - sd = pr + guard; - num = naturalLogarithm(arg, sd); - denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd); - - // The result will have 5 rounding digits. - r = divide(num, denominator, sd, 1); - - // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000, - // calculate 10 further digits. - // - // If the result is known to have an infinite decimal expansion, repeat this until it is clear - // that the result is above or below the boundary. Otherwise, if after calculating the 10 - // further digits, the last 14 are nines, round up and assume the result is exact. - // Also assume the result is exact if the last 14 are zero. - // - // Example of a result that will be incorrectly rounded: - // log[1048576](4503599627370502) = 2.60000000000000009610279511444746... - // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it - // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so - // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal - // place is still 2.6. - if (checkRoundingDigits(r.d, k = pr, rm)) { - - do { - sd += 10; - num = naturalLogarithm(arg, sd); - denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd); - r = divide(num, denominator, sd, 1); - - if (!inf) { - - // Check for 14 nines from the 2nd rounding digit, as the first may be 4. - if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) { - r = finalise(r, pr + 1, 0); - } - - break; - } - } while (checkRoundingDigits(r.d, k += 10, rm)); - } - - external = true; - - return finalise(r, pr, rm); - }; - - - /* - * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal. - * - * arguments {number|string|bigint|Decimal} - * - P.max = function () { - Array.prototype.push.call(arguments, this); - return maxOrMin(this.constructor, arguments, -1); - }; - */ - - - /* - * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal. - * - * arguments {number|string|bigint|Decimal} - * - P.min = function () { - Array.prototype.push.call(arguments, this); - return maxOrMin(this.constructor, arguments, 1); - }; - */ - - - /* - * n - 0 = n - * n - N = N - * n - I = -I - * 0 - n = -n - * 0 - 0 = 0 - * 0 - N = N - * 0 - I = -I - * N - n = N - * N - 0 = N - * N - N = N - * N - I = N - * I - n = I - * I - 0 = I - * I - N = N - * I - I = N - * - * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - */ - P.minus = P.sub = function (y) { - var d, e, i, j, k, len, pr, rm, xd, xe, xLTy, yd, - x = this, - Ctor = x.constructor; - - y = new Ctor(y); - - // If either is not finite... - if (!x.d || !y.d) { - - // Return NaN if either is NaN. - if (!x.s || !y.s) y = new Ctor(NaN); - - // Return y negated if x is finite and y is ±Infinity. - else if (x.d) y.s = -y.s; - - // Return x if y is finite and x is ±Infinity. - // Return x if both are ±Infinity with different signs. - // Return NaN if both are ±Infinity with the same sign. - else y = new Ctor(y.d || x.s !== y.s ? x : NaN); - - return y; - } - - // If signs differ... - if (x.s != y.s) { - y.s = -y.s; - return x.plus(y); - } - - xd = x.d; - yd = y.d; - pr = Ctor.precision; - rm = Ctor.rounding; - - // If either is zero... - if (!xd[0] || !yd[0]) { - - // Return y negated if x is zero and y is non-zero. - if (yd[0]) y.s = -y.s; - - // Return x if y is zero and x is non-zero. - else if (xd[0]) y = new Ctor(x); - - // Return zero if both are zero. - // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity. - else return new Ctor(rm === 3 ? -0 : 0); - - return external ? finalise(y, pr, rm) : y; - } - - // x and y are finite, non-zero numbers with the same sign. - - // Calculate base 1e7 exponents. - e = mathfloor(y.e / LOG_BASE); - xe = mathfloor(x.e / LOG_BASE); - - xd = xd.slice(); - k = xe - e; - - // If base 1e7 exponents differ... - if (k) { - xLTy = k < 0; - - if (xLTy) { - d = xd; - k = -k; - len = yd.length; - } else { - d = yd; - e = xe; - len = xd.length; - } - - // Numbers with massively different exponents would result in a very high number of - // zeros needing to be prepended, but this can be avoided while still ensuring correct - // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`. - i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2; - - if (k > i) { - k = i; - d.length = 1; - } - - // Prepend zeros to equalise exponents. - d.reverse(); - for (i = k; i--;) d.push(0); - d.reverse(); - - // Base 1e7 exponents equal. - } else { - - // Check digits to determine which is the bigger number. - - i = xd.length; - len = yd.length; - xLTy = i < len; - if (xLTy) len = i; - - for (i = 0; i < len; i++) { - if (xd[i] != yd[i]) { - xLTy = xd[i] < yd[i]; - break; - } - } - - k = 0; - } - - if (xLTy) { - d = xd; - xd = yd; - yd = d; - y.s = -y.s; - } - - len = xd.length; - - // Append zeros to `xd` if shorter. - // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length. - for (i = yd.length - len; i > 0; --i) xd[len++] = 0; - - // Subtract yd from xd. - for (i = yd.length; i > k;) { - - if (xd[--i] < yd[i]) { - for (j = i; j && xd[--j] === 0;) xd[j] = BASE - 1; - --xd[j]; - xd[i] += BASE; - } - - xd[i] -= yd[i]; - } - - // Remove trailing zeros. - for (; xd[--len] === 0;) xd.pop(); - - // Remove leading zeros and adjust exponent accordingly. - for (; xd[0] === 0; xd.shift()) --e; - - // Zero? - if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0); - - y.d = xd; - y.e = getBase10Exponent(xd, e); - - return external ? finalise(y, pr, rm) : y; - }; - - - /* - * n % 0 = N - * n % N = N - * n % I = n - * 0 % n = 0 - * -0 % n = -0 - * 0 % 0 = N - * 0 % N = N - * 0 % I = 0 - * N % n = N - * N % 0 = N - * N % N = N - * N % I = N - * I % n = N - * I % 0 = N - * I % N = N - * I % I = N - * - * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to - * `precision` significant digits using rounding mode `rounding`. - * - * The result depends on the modulo mode. - * - */ - P.modulo = P.mod = function (y) { - var q, - x = this, - Ctor = x.constructor; - - y = new Ctor(y); - - // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0. - if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN); - - // Return x if y is ±Infinity or x is ±0. - if (!y.d || x.d && !x.d[0]) { - return finalise(new Ctor(x), Ctor.precision, Ctor.rounding); - } - - // Prevent rounding of intermediate calculations. - external = false; - - if (Ctor.modulo == 9) { - - // Euclidian division: q = sign(y) * floor(x / abs(y)) - // result = x - q * y where 0 <= result < abs(y) - q = divide(x, y.abs(), 0, 3, 1); - q.s *= y.s; - } else { - q = divide(x, y, 0, Ctor.modulo, 1); - } - - q = q.times(y); - - external = true; - - return x.minus(q); - }; - - - /* - * Return a new Decimal whose value is the natural exponential of the value of this Decimal, - * i.e. the base e raised to the power the value of this Decimal, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - */ - P.naturalExponential = P.exp = function () { - return naturalExponential(this); - }; - - - /* - * Return a new Decimal whose value is the natural logarithm of the value of this Decimal, - * rounded to `precision` significant digits using rounding mode `rounding`. - * - */ - P.naturalLogarithm = P.ln = function () { - return naturalLogarithm(this); - }; - - - /* - * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by - * -1. - * - */ - P.negated = P.neg = function () { - var x = new this.constructor(this); - x.s = -x.s; - return finalise(x); - }; - - - /* - * n + 0 = n - * n + N = N - * n + I = I - * 0 + n = n - * 0 + 0 = 0 - * 0 + N = N - * 0 + I = I - * N + n = N - * N + 0 = N - * N + N = N - * N + I = N - * I + n = I - * I + 0 = I - * I + N = N - * I + I = I - * - * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - */ - P.plus = P.add = function (y) { - var carry, d, e, i, k, len, pr, rm, xd, yd, - x = this, - Ctor = x.constructor; - - y = new Ctor(y); - - // If either is not finite... - if (!x.d || !y.d) { - - // Return NaN if either is NaN. - if (!x.s || !y.s) y = new Ctor(NaN); - - // Return x if y is finite and x is ±Infinity. - // Return x if both are ±Infinity with the same sign. - // Return NaN if both are ±Infinity with different signs. - // Return y if x is finite and y is ±Infinity. - else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN); - - return y; - } - - // If signs differ... - if (x.s != y.s) { - y.s = -y.s; - return x.minus(y); - } - - xd = x.d; - yd = y.d; - pr = Ctor.precision; - rm = Ctor.rounding; - - // If either is zero... - if (!xd[0] || !yd[0]) { - - // Return x if y is zero. - // Return y if y is non-zero. - if (!yd[0]) y = new Ctor(x); - - return external ? finalise(y, pr, rm) : y; - } - - // x and y are finite, non-zero numbers with the same sign. - - // Calculate base 1e7 exponents. - k = mathfloor(x.e / LOG_BASE); - e = mathfloor(y.e / LOG_BASE); - - xd = xd.slice(); - i = k - e; - - // If base 1e7 exponents differ... - if (i) { - - if (i < 0) { - d = xd; - i = -i; - len = yd.length; - } else { - d = yd; - e = k; - len = xd.length; - } - - // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1. - k = Math.ceil(pr / LOG_BASE); - len = k > len ? k + 1 : len + 1; - - if (i > len) { - i = len; - d.length = 1; - } - - // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts. - d.reverse(); - for (; i--;) d.push(0); - d.reverse(); - } - - len = xd.length; - i = yd.length; - - // If yd is longer than xd, swap xd and yd so xd points to the longer array. - if (len - i < 0) { - i = len; - d = yd; - yd = xd; - xd = d; - } - - // Only start adding at yd.length - 1 as the further digits of xd can be left as they are. - for (carry = 0; i;) { - carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0; - xd[i] %= BASE; - } - - if (carry) { - xd.unshift(carry); - ++e; - } - - // Remove trailing zeros. - // No need to check for zero, as +x + +y != 0 && -x + -y != 0 - for (len = xd.length; xd[--len] == 0;) xd.pop(); - - y.d = xd; - y.e = getBase10Exponent(xd, e); - - return external ? finalise(y, pr, rm) : y; - }; - - - /* - * Return the number of significant digits of the value of this Decimal. - * - * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0. - * - */ - P.precision = P.sd = function (z) { - var k, - x = this; - - if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z); - - if (x.d) { - k = getPrecision(x.d); - if (z && x.e + 1 > k) k = x.e + 1; - } else { - k = NaN; - } - - return k; - }; - - - /* - * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using - * rounding mode `rounding`. - * - */ - P.round = function () { - var x = this, - Ctor = x.constructor; - - return finalise(new Ctor(x), x.e + 1, Ctor.rounding); - }; - - - /* - * Return a new Decimal whose value is the sine of the value in radians of this Decimal. - * - * Domain: [-Infinity, Infinity] - * Range: [-1, 1] - * - * sin(x) = x - x^3/3! + x^5/5! - ... - * - * sin(0) = 0 - * sin(-0) = -0 - * sin(Infinity) = NaN - * sin(-Infinity) = NaN - * sin(NaN) = NaN - * - */ - P.sine = P.sin = function () { - var pr, rm, - x = this, - Ctor = x.constructor; - - if (!x.isFinite()) return new Ctor(NaN); - if (x.isZero()) return new Ctor(x); - - pr = Ctor.precision; - rm = Ctor.rounding; - Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE; - Ctor.rounding = 1; - - x = sine(Ctor, toLessThanHalfPi(Ctor, x)); - - Ctor.precision = pr; - Ctor.rounding = rm; - - return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true); - }; - - - /* - * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - * sqrt(-n) = N - * sqrt(N) = N - * sqrt(-I) = N - * sqrt(I) = I - * sqrt(0) = 0 - * sqrt(-0) = -0 - * - */ - P.squareRoot = P.sqrt = function () { - var m, n, sd, r, rep, t, - x = this, - d = x.d, - e = x.e, - s = x.s, - Ctor = x.constructor; - - // Negative/NaN/Infinity/zero? - if (s !== 1 || !d || !d[0]) { - return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0); - } - - external = false; - - // Initial estimate. - s = Math.sqrt(+x); - - // Math.sqrt underflow/overflow? - // Pass x to Math.sqrt as integer, then adjust the exponent of the result. - if (s == 0 || s == 1 / 0) { - n = digitsToString(d); - - if ((n.length + e) % 2 == 0) n += '0'; - s = Math.sqrt(n); - e = mathfloor((e + 1) / 2) - (e < 0 || e % 2); - - if (s == 1 / 0) { - n = '5e' + e; - } else { - n = s.toExponential(); - n = n.slice(0, n.indexOf('e') + 1) + e; - } - - r = new Ctor(n); - } else { - r = new Ctor(s.toString()); - } - - sd = (e = Ctor.precision) + 3; - - // Newton-Raphson iteration. - for (;;) { - t = r; - r = t.plus(divide(x, t, sd + 2, 1)).times(0.5); - - // TODO? Replace with for-loop and checkRoundingDigits. - if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) { - n = n.slice(sd - 3, sd + 1); - - // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or - // 4999, i.e. approaching a rounding boundary, continue the iteration. - if (n == '9999' || !rep && n == '4999') { - - // On the first iteration only, check to see if rounding up gives the exact result as the - // nines may infinitely repeat. - if (!rep) { - finalise(t, e + 1, 0); - - if (t.times(t).eq(x)) { - r = t; - break; - } - } - - sd += 4; - rep = 1; - } else { - - // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result. - // If not, then there are further digits and m will be truthy. - if (!+n || !+n.slice(1) && n.charAt(0) == '5') { - - // Truncate to the first rounding digit. - finalise(r, e + 1, 1); - m = !r.times(r).eq(x); - } - - break; - } - } - } - - external = true; - - return finalise(r, e, Ctor.rounding, m); - }; - - - /* - * Return a new Decimal whose value is the tangent of the value in radians of this Decimal. - * - * Domain: [-Infinity, Infinity] - * Range: [-Infinity, Infinity] - * - * tan(0) = 0 - * tan(-0) = -0 - * tan(Infinity) = NaN - * tan(-Infinity) = NaN - * tan(NaN) = NaN - * - */ - P.tangent = P.tan = function () { - var pr, rm, - x = this, - Ctor = x.constructor; - - if (!x.isFinite()) return new Ctor(NaN); - if (x.isZero()) return new Ctor(x); - - pr = Ctor.precision; - rm = Ctor.rounding; - Ctor.precision = pr + 10; - Ctor.rounding = 1; - - x = x.sin(); - x.s = 1; - x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0); - - Ctor.precision = pr; - Ctor.rounding = rm; - - return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true); - }; - - - /* - * n * 0 = 0 - * n * N = N - * n * I = I - * 0 * n = 0 - * 0 * 0 = 0 - * 0 * N = N - * 0 * I = N - * N * n = N - * N * 0 = N - * N * N = N - * N * I = N - * I * n = I - * I * 0 = N - * I * N = N - * I * I = I - * - * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant - * digits using rounding mode `rounding`. - * - */ - P.times = P.mul = function (y) { - var carry, e, i, k, r, rL, t, xdL, ydL, - x = this, - Ctor = x.constructor, - xd = x.d, - yd = (y = new Ctor(y)).d; - - y.s *= x.s; - - // If either is NaN, ±Infinity or ±0... - if (!xd || !xd[0] || !yd || !yd[0]) { - - return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd - - // Return NaN if either is NaN. - // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity. - ? NaN - - // Return ±Infinity if either is ±Infinity. - // Return ±0 if either is ±0. - : !xd || !yd ? y.s / 0 : y.s * 0); - } - - e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE); - xdL = xd.length; - ydL = yd.length; - - // Ensure xd points to the longer array. - if (xdL < ydL) { - r = xd; - xd = yd; - yd = r; - rL = xdL; - xdL = ydL; - ydL = rL; - } - - // Initialise the result array with zeros. - r = []; - rL = xdL + ydL; - for (i = rL; i--;) r.push(0); - - // Multiply! - for (i = ydL; --i >= 0;) { - carry = 0; - for (k = xdL + i; k > i;) { - t = r[k] + yd[i] * xd[k - i - 1] + carry; - r[k--] = t % BASE | 0; - carry = t / BASE | 0; - } - - r[k] = (r[k] + carry) % BASE | 0; - } - - // Remove trailing zeros. - for (; !r[--rL];) r.pop(); - - if (carry) ++e; - else r.shift(); - - y.d = r; - y.e = getBase10Exponent(r, e); - - return external ? finalise(y, Ctor.precision, Ctor.rounding) : y; - }; - - - /* - * Return a string representing the value of this Decimal in base 2, round to `sd` significant - * digits using rounding mode `rm`. - * - * If the optional `sd` argument is present then return binary exponential notation. - * - * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - */ - P.toBinary = function (sd, rm) { - return toStringBinary(this, 2, sd, rm); - }; - - - /* - * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp` - * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted. - * - * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal. - * - * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - */ - P.toDecimalPlaces = P.toDP = function (dp, rm) { - var x = this, - Ctor = x.constructor; - - x = new Ctor(x); - if (dp === void 0) return x; - - checkInt32(dp, 0, MAX_DIGITS); - - if (rm === void 0) rm = Ctor.rounding; - else checkInt32(rm, 0, 8); - - return finalise(x, dp + x.e + 1, rm); - }; - - - /* - * Return a string representing the value of this Decimal in exponential notation rounded to - * `dp` fixed decimal places using rounding mode `rounding`. - * - * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - */ - P.toExponential = function (dp, rm) { - var str, - x = this, - Ctor = x.constructor; - - if (dp === void 0) { - str = finiteToString(x, true); - } else { - checkInt32(dp, 0, MAX_DIGITS); - - if (rm === void 0) rm = Ctor.rounding; - else checkInt32(rm, 0, 8); - - x = finalise(new Ctor(x), dp + 1, rm); - str = finiteToString(x, true, dp + 1); - } - - return x.isNeg() && !x.isZero() ? '-' + str : str; - }; - - - /* - * Return a string representing the value of this Decimal in normal (fixed-point) notation to - * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is - * omitted. - * - * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'. - * - * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'. - * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'. - * (-0).toFixed(3) is '0.000'. - * (-0.5).toFixed(0) is '-0'. - * - */ - P.toFixed = function (dp, rm) { - var str, y, - x = this, - Ctor = x.constructor; - - if (dp === void 0) { - str = finiteToString(x); - } else { - checkInt32(dp, 0, MAX_DIGITS); - - if (rm === void 0) rm = Ctor.rounding; - else checkInt32(rm, 0, 8); - - y = finalise(new Ctor(x), dp + x.e + 1, rm); - str = finiteToString(y, false, dp + y.e + 1); - } - - // To determine whether to add the minus sign look at the value before it was rounded, - // i.e. look at `x` rather than `y`. - return x.isNeg() && !x.isZero() ? '-' + str : str; - }; - - - /* - * Return an array representing the value of this Decimal as a simple fraction with an integer - * numerator and an integer denominator. - * - * The denominator will be a positive non-zero value less than or equal to the specified maximum - * denominator. If a maximum denominator is not specified, the denominator will be the lowest - * value necessary to represent the number exactly. - * - * [maxD] {number|string|bigint|Decimal} Maximum denominator. Integer >= 1 and < Infinity. - * - */ - P.toFraction = function (maxD) { - var d, d0, d1, d2, e, k, n, n0, n1, pr, q, r, - x = this, - xd = x.d, - Ctor = x.constructor; - - if (!xd) return new Ctor(x); - - n1 = d0 = new Ctor(1); - d1 = n0 = new Ctor(0); - - d = new Ctor(d1); - e = d.e = getPrecision(xd) - x.e - 1; - k = e % LOG_BASE; - d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k); - - if (maxD == null) { - - // d is 10**e, the minimum max-denominator needed. - maxD = e > 0 ? d : n1; - } else { - n = new Ctor(maxD); - if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n); - maxD = n.gt(d) ? (e > 0 ? d : n1) : n; - } - - external = false; - n = new Ctor(digitsToString(xd)); - pr = Ctor.precision; - Ctor.precision = e = xd.length * LOG_BASE * 2; - - for (;;) { - q = divide(n, d, 0, 1, 1); - d2 = d0.plus(q.times(d1)); - if (d2.cmp(maxD) == 1) break; - d0 = d1; - d1 = d2; - d2 = n1; - n1 = n0.plus(q.times(d2)); - n0 = d2; - d2 = d; - d = n.minus(q.times(d2)); - n = d2; - } - - d2 = divide(maxD.minus(d0), d1, 0, 1, 1); - n0 = n0.plus(d2.times(n1)); - d0 = d0.plus(d2.times(d1)); - n0.s = n1.s = x.s; - - // Determine which fraction is closer to x, n0/d0 or n1/d1? - r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1 - ? [n1, d1] : [n0, d0]; - - Ctor.precision = pr; - external = true; - - return r; - }; - - - /* - * Return a string representing the value of this Decimal in base 16, round to `sd` significant - * digits using rounding mode `rm`. - * - * If the optional `sd` argument is present then return binary exponential notation. - * - * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - */ - P.toHexadecimal = P.toHex = function (sd, rm) { - return toStringBinary(this, 16, sd, rm); - }; - - - /* - * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding - * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal. - * - * The return value will always have the same sign as this Decimal, unless either this Decimal - * or `y` is NaN, in which case the return value will be also be NaN. - * - * The return value is not affected by the value of `precision`. - * - * y {number|string|bigint|Decimal} The magnitude to round to a multiple of. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * 'toNearest() rounding mode not an integer: {rm}' - * 'toNearest() rounding mode out of range: {rm}' - * - */ - P.toNearest = function (y, rm) { - var x = this, - Ctor = x.constructor; - - x = new Ctor(x); - - if (y == null) { - - // If x is not finite, return x. - if (!x.d) return x; - - y = new Ctor(1); - rm = Ctor.rounding; - } else { - y = new Ctor(y); - if (rm === void 0) { - rm = Ctor.rounding; - } else { - checkInt32(rm, 0, 8); - } - - // If x is not finite, return x if y is not NaN, else NaN. - if (!x.d) return y.s ? x : y; - - // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN. - if (!y.d) { - if (y.s) y.s = x.s; - return y; - } - } - - // If y is not zero, calculate the nearest multiple of y to x. - if (y.d[0]) { - external = false; - x = divide(x, y, 0, rm, 1).times(y); - external = true; - finalise(x); - - // If y is zero, return zero with the sign of x. - } else { - y.s = x.s; - x = y; - } - - return x; - }; - - - /* - * Return the value of this Decimal converted to a number primitive. - * Zero keeps its sign. - * - */ - P.toNumber = function () { - return +this; - }; - - - /* - * Return a string representing the value of this Decimal in base 8, round to `sd` significant - * digits using rounding mode `rm`. - * - * If the optional `sd` argument is present then return binary exponential notation. - * - * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - */ - P.toOctal = function (sd, rm) { - return toStringBinary(this, 8, sd, rm); - }; - - - /* - * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded - * to `precision` significant digits using rounding mode `rounding`. - * - * ECMAScript compliant. - * - * pow(x, NaN) = NaN - * pow(x, ±0) = 1 - - * pow(NaN, non-zero) = NaN - * pow(abs(x) > 1, +Infinity) = +Infinity - * pow(abs(x) > 1, -Infinity) = +0 - * pow(abs(x) == 1, ±Infinity) = NaN - * pow(abs(x) < 1, +Infinity) = +0 - * pow(abs(x) < 1, -Infinity) = +Infinity - * pow(+Infinity, y > 0) = +Infinity - * pow(+Infinity, y < 0) = +0 - * pow(-Infinity, odd integer > 0) = -Infinity - * pow(-Infinity, even integer > 0) = +Infinity - * pow(-Infinity, odd integer < 0) = -0 - * pow(-Infinity, even integer < 0) = +0 - * pow(+0, y > 0) = +0 - * pow(+0, y < 0) = +Infinity - * pow(-0, odd integer > 0) = -0 - * pow(-0, even integer > 0) = +0 - * pow(-0, odd integer < 0) = -Infinity - * pow(-0, even integer < 0) = +Infinity - * pow(finite x < 0, finite non-integer) = NaN - * - * For non-integer or very large exponents pow(x, y) is calculated using - * - * x^y = exp(y*ln(x)) - * - * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the - * probability of an incorrectly rounded result - * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14 - * i.e. 1 in 250,000,000,000,000 - * - * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place). - * - * y {number|string|bigint|Decimal} The power to which to raise this Decimal. - * - */ - P.toPower = P.pow = function (y) { - var e, k, pr, r, rm, s, - x = this, - Ctor = x.constructor, - yn = +(y = new Ctor(y)); - - // Either ±Infinity, NaN or ±0? - if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn)); - - x = new Ctor(x); - - if (x.eq(1)) return x; - - pr = Ctor.precision; - rm = Ctor.rounding; - - if (y.eq(1)) return finalise(x, pr, rm); - - // y exponent - e = mathfloor(y.e / LOG_BASE); - - // If y is a small integer use the 'exponentiation by squaring' algorithm. - if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) { - r = intPow(Ctor, x, k, pr); - return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm); - } - - s = x.s; - - // if x is negative - if (s < 0) { - - // if y is not an integer - if (e < y.d.length - 1) return new Ctor(NaN); - - // Result is positive if x is negative and the last digit of integer y is even. - if ((y.d[e] & 1) == 0) s = 1; - - // if x.eq(-1) - if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) { - x.s = s; - return x; - } - } - - // Estimate result exponent. - // x^y = 10^e, where e = y * log10(x) - // log10(x) = log10(x_significand) + x_exponent - // log10(x_significand) = ln(x_significand) / ln(10) - k = mathpow(+x, yn); - e = k == 0 || !isFinite(k) - ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1)) - : new Ctor(k + '').e; - - // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1. - - // Overflow/underflow? - if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0); - - external = false; - Ctor.rounding = x.s = 1; - - // Estimate the extra guard digits needed to ensure five correct rounding digits from - // naturalLogarithm(x). Example of failure without these extra digits (precision: 10): - // new Decimal(2.32456).pow('2087987436534566.46411') - // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815 - k = Math.min(12, (e + '').length); - - // r = x^y = exp(y*ln(x)) - r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr); - - // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40) - if (r.d) { - - // Truncate to the required precision plus five rounding digits. - r = finalise(r, pr + 5, 1); - - // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate - // the result. - if (checkRoundingDigits(r.d, pr, rm)) { - e = pr + 10; - - // Truncate to the increased precision plus five rounding digits. - r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1); - - // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9). - if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) { - r = finalise(r, pr + 1, 0); - } - } - } - - r.s = s; - external = true; - Ctor.rounding = rm; - - return finalise(r, pr, rm); - }; - - - /* - * Return a string representing the value of this Decimal rounded to `sd` significant digits - * using rounding mode `rounding`. - * - * Return exponential notation if `sd` is less than the number of digits necessary to represent - * the integer part of the value in normal notation. - * - * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - */ - P.toPrecision = function (sd, rm) { - var str, - x = this, - Ctor = x.constructor; - - if (sd === void 0) { - str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); - } else { - checkInt32(sd, 1, MAX_DIGITS); - - if (rm === void 0) rm = Ctor.rounding; - else checkInt32(rm, 0, 8); - - x = finalise(new Ctor(x), sd, rm); - str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd); - } - - return x.isNeg() && !x.isZero() ? '-' + str : str; - }; - - - /* - * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd` - * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if - * omitted. - * - * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * 'toSD() digits out of range: {sd}' - * 'toSD() digits not an integer: {sd}' - * 'toSD() rounding mode not an integer: {rm}' - * 'toSD() rounding mode out of range: {rm}' - * - */ - P.toSignificantDigits = P.toSD = function (sd, rm) { - var x = this, - Ctor = x.constructor; - - if (sd === void 0) { - sd = Ctor.precision; - rm = Ctor.rounding; - } else { - checkInt32(sd, 1, MAX_DIGITS); - - if (rm === void 0) rm = Ctor.rounding; - else checkInt32(rm, 0, 8); - } - - return finalise(new Ctor(x), sd, rm); - }; - - - /* - * Return a string representing the value of this Decimal. - * - * Return exponential notation if this Decimal has a positive exponent equal to or greater than - * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`. - * - */ - P.toString = function () { - var x = this, - Ctor = x.constructor, - str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); - - return x.isNeg() && !x.isZero() ? '-' + str : str; - }; - - - /* - * Return a new Decimal whose value is the value of this Decimal truncated to a whole number. - * - */ - P.truncated = P.trunc = function () { - return finalise(new this.constructor(this), this.e + 1, 1); - }; - - - /* - * Return a string representing the value of this Decimal. - * Unlike `toString`, negative zero will include the minus sign. - * - */ - P.valueOf = P.toJSON = function () { - var x = this, - Ctor = x.constructor, - str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); - - return x.isNeg() ? '-' + str : str; - }; - - - // Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers. - - - /* - * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower, - * finiteToString, naturalExponential, naturalLogarithm - * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest, - * P.toPrecision, P.toSignificantDigits, toStringBinary, random - * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm - * convertBase toStringBinary, parseOther - * cos P.cos - * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy, - * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction, - * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm, - * taylorSeries, atan2, parseOther - * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh, - * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus, - * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot, - * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed, - * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits, - * P.truncated, divide, getLn10, getPi, naturalExponential, - * naturalLogarithm, ceil, floor, round, trunc - * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf, - * toStringBinary - * getBase10Exponent P.minus, P.plus, P.times, parseOther - * getLn10 P.logarithm, naturalLogarithm - * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2 - * getPrecision P.precision, P.toFraction - * getZeroString digitsToString, finiteToString - * intPow P.toPower, parseOther - * isOdd toLessThanHalfPi - * maxOrMin max, min - * naturalExponential P.naturalExponential, P.toPower - * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm, - * P.toPower, naturalExponential - * nonFiniteToString finiteToString, toStringBinary - * parseDecimal Decimal - * parseOther Decimal - * sin P.sin - * taylorSeries P.cosh, P.sinh, cos, sin - * toLessThanHalfPi P.cos, P.sin - * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal - * truncate intPow - * - * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi, - * naturalLogarithm, config, parseOther, random, Decimal - */ - - - function digitsToString(d) { - var i, k, ws, - indexOfLastWord = d.length - 1, - str = '', - w = d[0]; - - if (indexOfLastWord > 0) { - str += w; - for (i = 1; i < indexOfLastWord; i++) { - ws = d[i] + ''; - k = LOG_BASE - ws.length; - if (k) str += getZeroString(k); - str += ws; - } - - w = d[i]; - ws = w + ''; - k = LOG_BASE - ws.length; - if (k) str += getZeroString(k); - } else if (w === 0) { - return '0'; - } - - // Remove trailing zeros of last w. - for (; w % 10 === 0;) w /= 10; - - return str + w; - } - - - function checkInt32(i, min, max) { - if (i !== ~~i || i < min || i > max) { - throw Error(invalidArgument + i); - } - } - - - /* - * Check 5 rounding digits if `repeating` is null, 4 otherwise. - * `repeating == null` if caller is `log` or `pow`, - * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`. - */ - function checkRoundingDigits(d, i, rm, repeating) { - var di, k, r, rd; - - // Get the length of the first word of the array d. - for (k = d[0]; k >= 10; k /= 10) --i; - - // Is the rounding digit in the first word of d? - if (--i < 0) { - i += LOG_BASE; - di = 0; - } else { - di = Math.ceil((i + 1) / LOG_BASE); - i %= LOG_BASE; - } - - // i is the index (0 - 6) of the rounding digit. - // E.g. if within the word 3487563 the first rounding digit is 5, - // then i = 4, k = 1000, rd = 3487563 % 1000 = 563 - k = mathpow(10, LOG_BASE - i); - rd = d[di] % k | 0; - - if (repeating == null) { - if (i < 3) { - if (i == 0) rd = rd / 100 | 0; - else if (i == 1) rd = rd / 10 | 0; - r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0; - } else { - r = (rm < 4 && rd + 1 == k || rm > 3 && rd + 1 == k / 2) && - (d[di + 1] / k / 100 | 0) == mathpow(10, i - 2) - 1 || - (rd == k / 2 || rd == 0) && (d[di + 1] / k / 100 | 0) == 0; - } - } else { - if (i < 4) { - if (i == 0) rd = rd / 1000 | 0; - else if (i == 1) rd = rd / 100 | 0; - else if (i == 2) rd = rd / 10 | 0; - r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999; - } else { - r = ((repeating || rm < 4) && rd + 1 == k || - (!repeating && rm > 3) && rd + 1 == k / 2) && - (d[di + 1] / k / 1000 | 0) == mathpow(10, i - 3) - 1; - } - } - - return r; - } - - - // Convert string of `baseIn` to an array of numbers of `baseOut`. - // Eg. convertBase('255', 10, 16) returns [15, 15]. - // Eg. convertBase('ff', 16, 10) returns [2, 5, 5]. - function convertBase(str, baseIn, baseOut) { - var j, - arr = [0], - arrL, - i = 0, - strL = str.length; - - for (; i < strL;) { - for (arrL = arr.length; arrL--;) arr[arrL] *= baseIn; - arr[0] += NUMERALS.indexOf(str.charAt(i++)); - for (j = 0; j < arr.length; j++) { - if (arr[j] > baseOut - 1) { - if (arr[j + 1] === void 0) arr[j + 1] = 0; - arr[j + 1] += arr[j] / baseOut | 0; - arr[j] %= baseOut; - } - } - } - - return arr.reverse(); - } - - - /* - * cos(x) = 1 - x^2/2! + x^4/4! - ... - * |x| < pi/2 - * - */ - function cosine(Ctor, x) { - var k, len, y; - - if (x.isZero()) return x; - - // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1 - // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1 - - // Estimate the optimum number of times to use the argument reduction. - len = x.d.length; - if (len < 32) { - k = Math.ceil(len / 3); - y = (1 / tinyPow(4, k)).toString(); - } else { - k = 16; - y = '2.3283064365386962890625e-10'; - } - - Ctor.precision += k; - - x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1)); - - // Reverse argument reduction - for (var i = k; i--;) { - var cos2x = x.times(x); - x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1); - } - - Ctor.precision -= k; - - return x; - } - - - /* - * Perform division in the specified base. - */ - var divide = (function () { - - // Assumes non-zero x and k, and hence non-zero result. - function multiplyInteger(x, k, base) { - var temp, - carry = 0, - i = x.length; - - for (x = x.slice(); i--;) { - temp = x[i] * k + carry; - x[i] = temp % base | 0; - carry = temp / base | 0; - } - - if (carry) x.unshift(carry); - - return x; - } - - function compare(a, b, aL, bL) { - var i, r; - - if (aL != bL) { - r = aL > bL ? 1 : -1; - } else { - for (i = r = 0; i < aL; i++) { - if (a[i] != b[i]) { - r = a[i] > b[i] ? 1 : -1; - break; - } - } - } - - return r; - } - - function subtract(a, b, aL, base) { - var i = 0; - - // Subtract b from a. - for (; aL--;) { - a[aL] -= i; - i = a[aL] < b[aL] ? 1 : 0; - a[aL] = i * base + a[aL] - b[aL]; - } - - // Remove leading zeros. - for (; !a[0] && a.length > 1;) a.shift(); - } - - return function (x, y, pr, rm, dp, base) { - var cmp, e, i, k, logBase, more, prod, prodL, q, qd, rem, remL, rem0, sd, t, xi, xL, yd0, - yL, yz, - Ctor = x.constructor, - sign = x.s == y.s ? 1 : -1, - xd = x.d, - yd = y.d; - - // Either NaN, Infinity or 0? - if (!xd || !xd[0] || !yd || !yd[0]) { - - return new Ctor(// Return NaN if either NaN, or both Infinity or 0. - !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN : - - // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0. - xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0); - } - - if (base) { - logBase = 1; - e = x.e - y.e; - } else { - base = BASE; - logBase = LOG_BASE; - e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase); - } - - yL = yd.length; - xL = xd.length; - q = new Ctor(sign); - qd = q.d = []; - - // Result exponent may be one less than e. - // The digit array of a Decimal from toStringBinary may have trailing zeros. - for (i = 0; yd[i] == (xd[i] || 0); i++); - - if (yd[i] > (xd[i] || 0)) e--; - - if (pr == null) { - sd = pr = Ctor.precision; - rm = Ctor.rounding; - } else if (dp) { - sd = pr + (x.e - y.e) + 1; - } else { - sd = pr; - } - - if (sd < 0) { - qd.push(1); - more = true; - } else { - - // Convert precision in number of base 10 digits to base 1e7 digits. - sd = sd / logBase + 2 | 0; - i = 0; - - // divisor < 1e7 - if (yL == 1) { - k = 0; - yd = yd[0]; - sd++; - - // k is the carry. - for (; (i < xL || k) && sd--; i++) { - t = k * base + (xd[i] || 0); - qd[i] = t / yd | 0; - k = t % yd | 0; - } - - more = k || i < xL; - - // divisor >= 1e7 - } else { - - // Normalise xd and yd so highest order digit of yd is >= base/2 - k = base / (yd[0] + 1) | 0; - - if (k > 1) { - yd = multiplyInteger(yd, k, base); - xd = multiplyInteger(xd, k, base); - yL = yd.length; - xL = xd.length; - } - - xi = yL; - rem = xd.slice(0, yL); - remL = rem.length; - - // Add zeros to make remainder as long as divisor. - for (; remL < yL;) rem[remL++] = 0; - - yz = yd.slice(); - yz.unshift(0); - yd0 = yd[0]; - - if (yd[1] >= base / 2) ++yd0; - - do { - k = 0; - - // Compare divisor and remainder. - cmp = compare(yd, rem, yL, remL); - - // If divisor < remainder. - if (cmp < 0) { - - // Calculate trial digit, k. - rem0 = rem[0]; - if (yL != remL) rem0 = rem0 * base + (rem[1] || 0); - - // k will be how many times the divisor goes into the current remainder. - k = rem0 / yd0 | 0; - - // Algorithm: - // 1. product = divisor * trial digit (k) - // 2. if product > remainder: product -= divisor, k-- - // 3. remainder -= product - // 4. if product was < remainder at 2: - // 5. compare new remainder and divisor - // 6. If remainder > divisor: remainder -= divisor, k++ - - if (k > 1) { - if (k >= base) k = base - 1; - - // product = divisor * trial digit. - prod = multiplyInteger(yd, k, base); - prodL = prod.length; - remL = rem.length; - - // Compare product and remainder. - cmp = compare(prod, rem, prodL, remL); - - // product > remainder. - if (cmp == 1) { - k--; - - // Subtract divisor from product. - subtract(prod, yL < prodL ? yz : yd, prodL, base); - } - } else { - - // cmp is -1. - // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1 - // to avoid it. If k is 1 there is a need to compare yd and rem again below. - if (k == 0) cmp = k = 1; - prod = yd.slice(); - } - - prodL = prod.length; - if (prodL < remL) prod.unshift(0); - - // Subtract product from remainder. - subtract(rem, prod, remL, base); - - // If product was < previous remainder. - if (cmp == -1) { - remL = rem.length; - - // Compare divisor and new remainder. - cmp = compare(yd, rem, yL, remL); - - // If divisor < new remainder, subtract divisor from remainder. - if (cmp < 1) { - k++; - - // Subtract divisor from remainder. - subtract(rem, yL < remL ? yz : yd, remL, base); - } - } - - remL = rem.length; - } else if (cmp === 0) { - k++; - rem = [0]; - } // if cmp === 1, k will be 0 - - // Add the next digit, k, to the result array. - qd[i++] = k; - - // Update the remainder. - if (cmp && rem[0]) { - rem[remL++] = xd[xi] || 0; - } else { - rem = [xd[xi]]; - remL = 1; - } - - } while ((xi++ < xL || rem[0] !== void 0) && sd--); - - more = rem[0] !== void 0; - } - - // Leading zero? - if (!qd[0]) qd.shift(); - } - - // logBase is 1 when divide is being used for base conversion. - if (logBase == 1) { - q.e = e; - inexact = more; - } else { - - // To calculate q.e, first get the number of digits of qd[0]. - for (i = 1, k = qd[0]; k >= 10; k /= 10) i++; - q.e = i + e * logBase - 1; - - finalise(q, dp ? pr + q.e + 1 : pr, rm, more); - } - - return q; - }; - })(); - - - /* - * Round `x` to `sd` significant digits using rounding mode `rm`. - * Check for over/under-flow. - */ - function finalise(x, sd, rm, isTruncated) { - var digits, i, j, k, rd, roundUp, w, xd, xdi, - Ctor = x.constructor; - - // Don't round if sd is null or undefined. - out: if (sd != null) { - xd = x.d; - - // Infinity/NaN. - if (!xd) return x; - - // rd: the rounding digit, i.e. the digit after the digit that may be rounded up. - // w: the word of xd containing rd, a base 1e7 number. - // xdi: the index of w within xd. - // digits: the number of digits of w. - // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if - // they had leading zeros) - // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero). - - // Get the length of the first word of the digits array xd. - for (digits = 1, k = xd[0]; k >= 10; k /= 10) digits++; - i = sd - digits; - - // Is the rounding digit in the first word of xd? - if (i < 0) { - i += LOG_BASE; - j = sd; - w = xd[xdi = 0]; - - // Get the rounding digit at index j of w. - rd = w / mathpow(10, digits - j - 1) % 10 | 0; - } else { - xdi = Math.ceil((i + 1) / LOG_BASE); - k = xd.length; - if (xdi >= k) { - if (isTruncated) { - - // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`. - for (; k++ <= xdi;) xd.push(0); - w = rd = 0; - digits = 1; - i %= LOG_BASE; - j = i - LOG_BASE + 1; - } else { - break out; - } - } else { - w = k = xd[xdi]; - - // Get the number of digits of w. - for (digits = 1; k >= 10; k /= 10) digits++; - - // Get the index of rd within w. - i %= LOG_BASE; - - // Get the index of rd within w, adjusted for leading zeros. - // The number of leading zeros of w is given by LOG_BASE - digits. - j = i - LOG_BASE + digits; - - // Get the rounding digit at index j of w. - rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0; - } - } - - // Are there any non-zero digits after the rounding digit? - isTruncated = isTruncated || sd < 0 || - xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1)); - - // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right - // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression - // will give 714. - - roundUp = rm < 4 - ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) - : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 && - - // Check whether the digit to the left of the rounding digit is odd. - ((i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10) & 1 || - rm == (x.s < 0 ? 8 : 7)); - - if (sd < 1 || !xd[0]) { - xd.length = 0; - if (roundUp) { - - // Convert sd to decimal places. - sd -= x.e + 1; - - // 1, 0.1, 0.01, 0.001, 0.0001 etc. - xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE); - x.e = -sd || 0; - } else { - - // Zero. - xd[0] = x.e = 0; - } - - return x; - } - - // Remove excess digits. - if (i == 0) { - xd.length = xdi; - k = 1; - xdi--; - } else { - xd.length = xdi + 1; - k = mathpow(10, LOG_BASE - i); - - // E.g. 56700 becomes 56000 if 7 is the rounding digit. - // j > 0 means i > number of leading zeros of w. - xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0; - } - - if (roundUp) { - for (;;) { - - // Is the digit to be rounded up in the first word of xd? - if (xdi == 0) { - - // i will be the length of xd[0] before k is added. - for (i = 1, j = xd[0]; j >= 10; j /= 10) i++; - j = xd[0] += k; - for (k = 1; j >= 10; j /= 10) k++; - - // if i != k the length has increased. - if (i != k) { - x.e++; - if (xd[0] == BASE) xd[0] = 1; - } - - break; - } else { - xd[xdi] += k; - if (xd[xdi] != BASE) break; - xd[xdi--] = 0; - k = 1; - } - } - } - - // Remove trailing zeros. - for (i = xd.length; xd[--i] === 0;) xd.pop(); - } - - if (external) { - - // Overflow? - if (x.e > Ctor.maxE) { - - // Infinity. - x.d = null; - x.e = NaN; - - // Underflow? - } else if (x.e < Ctor.minE) { - - // Zero. - x.e = 0; - x.d = [0]; - // Ctor.underflow = true; - } // else Ctor.underflow = false; - } - - return x; - } - - - function finiteToString(x, isExp, sd) { - if (!x.isFinite()) return nonFiniteToString(x); - var k, - e = x.e, - str = digitsToString(x.d), - len = str.length; - - if (isExp) { - if (sd && (k = sd - len) > 0) { - str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k); - } else if (len > 1) { - str = str.charAt(0) + '.' + str.slice(1); - } - - str = str + (x.e < 0 ? 'e' : 'e+') + x.e; - } else if (e < 0) { - str = '0.' + getZeroString(-e - 1) + str; - if (sd && (k = sd - len) > 0) str += getZeroString(k); - } else if (e >= len) { - str += getZeroString(e + 1 - len); - if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k); - } else { - if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k); - if (sd && (k = sd - len) > 0) { - if (e + 1 === len) str += '.'; - str += getZeroString(k); - } - } - - return str; - } - - - // Calculate the base 10 exponent from the base 1e7 exponent. - function getBase10Exponent(digits, e) { - var w = digits[0]; - - // Add the number of digits of the first word of the digits array. - for ( e *= LOG_BASE; w >= 10; w /= 10) e++; - return e; - } - - - function getLn10(Ctor, sd, pr) { - if (sd > LN10_PRECISION) { - - // Reset global state in case the exception is caught. - external = true; - if (pr) Ctor.precision = pr; - throw Error(precisionLimitExceeded); - } - return finalise(new Ctor(LN10), sd, 1, true); - } - - - function getPi(Ctor, sd, rm) { - if (sd > PI_PRECISION) throw Error(precisionLimitExceeded); - return finalise(new Ctor(PI), sd, rm, true); - } - - - function getPrecision(digits) { - var w = digits.length - 1, - len = w * LOG_BASE + 1; - - w = digits[w]; - - // If non-zero... - if (w) { - - // Subtract the number of trailing zeros of the last word. - for (; w % 10 == 0; w /= 10) len--; - - // Add the number of digits of the first word. - for (w = digits[0]; w >= 10; w /= 10) len++; - } - - return len; - } - - - function getZeroString(k) { - var zs = ''; - for (; k--;) zs += '0'; - return zs; - } - - - /* - * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an - * integer of type number. - * - * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`. - * - */ - function intPow(Ctor, x, n, pr) { - var isTruncated, - r = new Ctor(1), - - // Max n of 9007199254740991 takes 53 loop iterations. - // Maximum digits array length; leaves [28, 34] guard digits. - k = Math.ceil(pr / LOG_BASE + 4); - - external = false; - - for (;;) { - if (n % 2) { - r = r.times(x); - if (truncate(r.d, k)) isTruncated = true; - } - - n = mathfloor(n / 2); - if (n === 0) { - - // To ensure correct rounding when r.d is truncated, increment the last word if it is zero. - n = r.d.length - 1; - if (isTruncated && r.d[n] === 0) ++r.d[n]; - break; - } - - x = x.times(x); - truncate(x.d, k); - } - - external = true; - - return r; - } - - - function isOdd(n) { - return n.d[n.d.length - 1] & 1; - } - - - /* - * Handle `max` (`n` is -1) and `min` (`n` is 1). - */ - function maxOrMin(Ctor, args, n) { - var k, y, - x = new Ctor(args[0]), - i = 0; - - for (; ++i < args.length;) { - y = new Ctor(args[i]); - - // NaN? - if (!y.s) { - x = y; - break; - } - - k = x.cmp(y); - - if (k === n || k === 0 && x.s === n) { - x = y; - } - } - - return x; - } - - - /* - * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant - * digits. - * - * Taylor/Maclaurin series. - * - * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ... - * - * Argument reduction: - * Repeat x = x / 32, k += 5, until |x| < 0.1 - * exp(x) = exp(x / 2^k)^(2^k) - * - * Previously, the argument was initially reduced by - * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10) - * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was - * found to be slower than just dividing repeatedly by 32 as above. - * - * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000 - * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000 - * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324) - * - * exp(Infinity) = Infinity - * exp(-Infinity) = 0 - * exp(NaN) = NaN - * exp(±0) = 1 - * - * exp(x) is non-terminating for any finite, non-zero x. - * - * The result will always be correctly rounded. - * - */ - function naturalExponential(x, sd) { - var denominator, guard, j, pow, sum, t, wpr, - rep = 0, - i = 0, - k = 0, - Ctor = x.constructor, - rm = Ctor.rounding, - pr = Ctor.precision; - - // 0/NaN/Infinity? - if (!x.d || !x.d[0] || x.e > 17) { - - return new Ctor(x.d - ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0 - : x.s ? x.s < 0 ? 0 : x : 0 / 0); - } - - if (sd == null) { - external = false; - wpr = pr; - } else { - wpr = sd; - } - - t = new Ctor(0.03125); - - // while abs(x) >= 0.1 - while (x.e > -2) { - - // x = x / 2^5 - x = x.times(t); - k += 5; - } - - // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision - // necessary to ensure the first 4 rounding digits are correct. - guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0; - wpr += guard; - denominator = pow = sum = new Ctor(1); - Ctor.precision = wpr; - - for (;;) { - pow = finalise(pow.times(x), wpr, 1); - denominator = denominator.times(++i); - t = sum.plus(divide(pow, denominator, wpr, 1)); - - if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) { - j = k; - while (j--) sum = finalise(sum.times(sum), wpr, 1); - - // Check to see if the first 4 rounding digits are [49]999. - // If so, repeat the summation with a higher precision, otherwise - // e.g. with precision: 18, rounding: 1 - // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123) - // `wpr - guard` is the index of first rounding digit. - if (sd == null) { - - if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) { - Ctor.precision = wpr += 10; - denominator = pow = t = new Ctor(1); - i = 0; - rep++; - } else { - return finalise(sum, Ctor.precision = pr, rm, external = true); - } - } else { - Ctor.precision = pr; - return sum; - } - } - - sum = t; - } - } - - - /* - * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant - * digits. - * - * ln(-n) = NaN - * ln(0) = -Infinity - * ln(-0) = -Infinity - * ln(1) = 0 - * ln(Infinity) = Infinity - * ln(-Infinity) = NaN - * ln(NaN) = NaN - * - * ln(n) (n != 1) is non-terminating. - * - */ - function naturalLogarithm(y, sd) { - var c, c0, denominator, e, numerator, rep, sum, t, wpr, x1, x2, - n = 1, - guard = 10, - x = y, - xd = x.d, - Ctor = x.constructor, - rm = Ctor.rounding, - pr = Ctor.precision; - - // Is x negative or Infinity, NaN, 0 or 1? - if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) { - return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x); - } - - if (sd == null) { - external = false; - wpr = pr; - } else { - wpr = sd; - } - - Ctor.precision = wpr += guard; - c = digitsToString(xd); - c0 = c.charAt(0); - - if (Math.abs(e = x.e) < 1.5e15) { - - // Argument reduction. - // The series converges faster the closer the argument is to 1, so using - // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b - // multiply the argument by itself until the leading digits of the significand are 7, 8, 9, - // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can - // later be divided by this number, then separate out the power of 10 using - // ln(a*10^b) = ln(a) + b*ln(10). - - // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14). - //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) { - // max n is 6 (gives 0.7 - 1.3) - while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) { - x = x.times(y); - c = digitsToString(x.d); - c0 = c.charAt(0); - n++; - } - - e = x.e; - - if (c0 > 1) { - x = new Ctor('0.' + c); - e++; - } else { - x = new Ctor(c0 + '.' + c.slice(1)); - } - } else { - - // The argument reduction method above may result in overflow if the argument y is a massive - // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this - // function using ln(x*10^e) = ln(x) + e*ln(10). - t = getLn10(Ctor, wpr + 2, pr).times(e + ''); - x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t); - Ctor.precision = pr; - - return sd == null ? finalise(x, pr, rm, external = true) : x; - } - - // x1 is x reduced to a value near 1. - x1 = x; - - // Taylor series. - // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...) - // where x = (y - 1)/(y + 1) (|x| < 1) - sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1); - x2 = finalise(x.times(x), wpr, 1); - denominator = 3; - - for (;;) { - numerator = finalise(numerator.times(x2), wpr, 1); - t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1)); - - if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) { - sum = sum.times(2); - - // Reverse the argument reduction. Check that e is not 0 because, besides preventing an - // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0. - if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + '')); - sum = divide(sum, new Ctor(n), wpr, 1); - - // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has - // been repeated previously) and the first 4 rounding digits 9999? - // If so, restart the summation with a higher precision, otherwise - // e.g. with precision: 12, rounding: 1 - // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463. - // `wpr - guard` is the index of first rounding digit. - if (sd == null) { - if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) { - Ctor.precision = wpr += guard; - t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1); - x2 = finalise(x.times(x), wpr, 1); - denominator = rep = 1; - } else { - return finalise(sum, Ctor.precision = pr, rm, external = true); - } - } else { - Ctor.precision = pr; - return sum; - } - } - - sum = t; - denominator += 2; - } - } - - - // ±Infinity, NaN. - function nonFiniteToString(x) { - // Unsigned. - return String(x.s * x.s / 0); - } - - - /* - * Parse the value of a new Decimal `x` from string `str`. - */ - function parseDecimal(x, str) { - var e, i, len; - - // TODO BigInt str: no need to check for decimal point, exponential form or leading zeros. - - // Decimal point? - if ((e = str.indexOf('.')) > -1) str = str.replace('.', ''); - - // Exponential form? - if ((i = str.search(/e/i)) > 0) { - - // Determine exponent. - if (e < 0) e = i; - e += +str.slice(i + 1); - str = str.substring(0, i); - } else if (e < 0) { - - // Integer. - e = str.length; - } - - // Determine leading zeros. - for (i = 0; str.charCodeAt(i) === 48; i++); - - // Determine trailing zeros. - for (len = str.length; str.charCodeAt(len - 1) === 48; --len); - str = str.slice(i, len); - - if (str) { - len -= i; - x.e = e = e - i - 1; - x.d = []; - - // Transform base - - // e is the base 10 exponent. - // i is where to slice str to get the first word of the digits array. - i = (e + 1) % LOG_BASE; - if (e < 0) i += LOG_BASE; - - if (i < len) { - if (i) x.d.push(+str.slice(0, i)); - for (len -= LOG_BASE; i < len;) x.d.push(+str.slice(i, i += LOG_BASE)); - str = str.slice(i); - i = LOG_BASE - str.length; - } else { - i -= len; - } - - for (; i--;) str += '0'; - x.d.push(+str); - - if (external) { - - // Overflow? - if (x.e > x.constructor.maxE) { - - // Infinity. - x.d = null; - x.e = NaN; - - // Underflow? - } else if (x.e < x.constructor.minE) { - - // Zero. - x.e = 0; - x.d = [0]; - // x.constructor.underflow = true; - } // else x.constructor.underflow = false; - } - } else { - - // Zero. - x.e = 0; - x.d = [0]; - } - - return x; - } - - - /* - * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value. - */ - function parseOther(x, str) { - var base, Ctor, divisor, i, isFloat, len, p, xd, xe; - - if (str.indexOf('_') > -1) { - str = str.replace(/(\d)_(?=\d)/g, '$1'); - if (isDecimal.test(str)) return parseDecimal(x, str); - } else if (str === 'Infinity' || str === 'NaN') { - if (!+str) x.s = NaN; - x.e = NaN; - x.d = null; - return x; - } - - if (isHex.test(str)) { - base = 16; - str = str.toLowerCase(); - } else if (isBinary.test(str)) { - base = 2; - } else if (isOctal.test(str)) { - base = 8; - } else { - throw Error(invalidArgument + str); - } - - // Is there a binary exponent part? - i = str.search(/p/i); - - if (i > 0) { - p = +str.slice(i + 1); - str = str.substring(2, i); - } else { - str = str.slice(2); - } - - // Convert `str` as an integer then divide the result by `base` raised to a power such that the - // fraction part will be restored. - i = str.indexOf('.'); - isFloat = i >= 0; - Ctor = x.constructor; - - if (isFloat) { - str = str.replace('.', ''); - len = str.length; - i = len - i; - - // log[10](16) = 1.2041... , log[10](88) = 1.9444.... - divisor = intPow(Ctor, new Ctor(base), i, i * 2); - } - - xd = convertBase(str, base, BASE); - xe = xd.length - 1; - - // Remove trailing zeros. - for (i = xe; xd[i] === 0; --i) xd.pop(); - if (i < 0) return new Ctor(x.s * 0); - x.e = getBase10Exponent(xd, xe); - x.d = xd; - external = false; - - // At what precision to perform the division to ensure exact conversion? - // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount) - // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412 - // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits. - // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount - // Therefore using 4 * the number of digits of str will always be enough. - if (isFloat) x = divide(x, divisor, len * 4); - - // Multiply by the binary exponent part if present. - if (p) x = x.times(Math.abs(p) < 54 ? mathpow(2, p) : Decimal.pow(2, p)); - external = true; - - return x; - } - - - /* - * sin(x) = x - x^3/3! + x^5/5! - ... - * |x| < pi/2 - * - */ - function sine(Ctor, x) { - var k, - len = x.d.length; - - if (len < 3) { - return x.isZero() ? x : taylorSeries(Ctor, 2, x, x); - } - - // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x) - // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5) - // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20)) - - // Estimate the optimum number of times to use the argument reduction. - k = 1.4 * Math.sqrt(len); - k = k > 16 ? 16 : k | 0; - - x = x.times(1 / tinyPow(5, k)); - x = taylorSeries(Ctor, 2, x, x); - - // Reverse argument reduction - var sin2_x, - d5 = new Ctor(5), - d16 = new Ctor(16), - d20 = new Ctor(20); - for (; k--;) { - sin2_x = x.times(x); - x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20)))); - } - - return x; - } - - - // Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`. - function taylorSeries(Ctor, n, x, y, isHyperbolic) { - var j, t, u, x2, - i = 1, - pr = Ctor.precision, - k = Math.ceil(pr / LOG_BASE); - - external = false; - x2 = x.times(x); - u = new Ctor(y); - - for (;;) { - t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1); - u = isHyperbolic ? y.plus(t) : y.minus(t); - y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1); - t = u.plus(y); - - if (t.d[k] !== void 0) { - for (j = k; t.d[j] === u.d[j] && j--;); - if (j == -1) break; - } - - j = u; - u = y; - y = t; - t = j; - i++; - } - - external = true; - t.d.length = k + 1; - - return t; - } - - - // Exponent e must be positive and non-zero. - function tinyPow(b, e) { - var n = b; - while (--e) n *= b; - return n; - } - - - // Return the absolute value of `x` reduced to less than or equal to half pi. - function toLessThanHalfPi(Ctor, x) { - var t, - isNeg = x.s < 0, - pi = getPi(Ctor, Ctor.precision, 1), - halfPi = pi.times(0.5); - - x = x.abs(); - - if (x.lte(halfPi)) { - quadrant = isNeg ? 4 : 1; - return x; - } - - t = x.divToInt(pi); - - if (t.isZero()) { - quadrant = isNeg ? 3 : 2; - } else { - x = x.minus(t.times(pi)); - - // 0 <= x < pi - if (x.lte(halfPi)) { - quadrant = isOdd(t) ? (isNeg ? 2 : 3) : (isNeg ? 4 : 1); - return x; - } - - quadrant = isOdd(t) ? (isNeg ? 1 : 4) : (isNeg ? 3 : 2); - } - - return x.minus(pi).abs(); - } - - - /* - * Return the value of Decimal `x` as a string in base `baseOut`. - * - * If the optional `sd` argument is present include a binary exponent suffix. - */ - function toStringBinary(x, baseOut, sd, rm) { - var base, e, i, k, len, roundUp, str, xd, y, - Ctor = x.constructor, - isExp = sd !== void 0; - - if (isExp) { - checkInt32(sd, 1, MAX_DIGITS); - if (rm === void 0) rm = Ctor.rounding; - else checkInt32(rm, 0, 8); - } else { - sd = Ctor.precision; - rm = Ctor.rounding; - } - - if (!x.isFinite()) { - str = nonFiniteToString(x); - } else { - str = finiteToString(x); - i = str.indexOf('.'); - - // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required: - // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10)) - // minBinaryExponent = floor(decimalExponent * log[2](10)) - // log[2](10) = 3.321928094887362347870319429489390175864 - - if (isExp) { - base = 2; - if (baseOut == 16) { - sd = sd * 4 - 3; - } else if (baseOut == 8) { - sd = sd * 3 - 2; - } - } else { - base = baseOut; - } - - // Convert the number as an integer then divide the result by its base raised to a power such - // that the fraction part will be restored. - - // Non-integer. - if (i >= 0) { - str = str.replace('.', ''); - y = new Ctor(1); - y.e = str.length - i; - y.d = convertBase(finiteToString(y), 10, base); - y.e = y.d.length; - } - - xd = convertBase(str, 10, base); - e = len = xd.length; - - // Remove trailing zeros. - for (; xd[--len] == 0;) xd.pop(); - - if (!xd[0]) { - str = isExp ? '0p+0' : '0'; - } else { - if (i < 0) { - e--; - } else { - x = new Ctor(x); - x.d = xd; - x.e = e; - x = divide(x, y, sd, rm, 0, base); - xd = x.d; - e = x.e; - roundUp = inexact; - } - - // The rounding digit, i.e. the digit after the digit that may be rounded up. - i = xd[sd]; - k = base / 2; - roundUp = roundUp || xd[sd + 1] !== void 0; - - roundUp = rm < 4 - ? (i !== void 0 || roundUp) && (rm === 0 || rm === (x.s < 0 ? 3 : 2)) - : i > k || i === k && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 || - rm === (x.s < 0 ? 8 : 7)); - - xd.length = sd; - - if (roundUp) { - - // Rounding up may mean the previous digit has to be rounded up and so on. - for (; ++xd[--sd] > base - 1;) { - xd[sd] = 0; - if (!sd) { - ++e; - xd.unshift(1); - } - } - } - - // Determine trailing zeros. - for (len = xd.length; !xd[len - 1]; --len); - - // E.g. [4, 11, 15] becomes 4bf. - for (i = 0, str = ''; i < len; i++) str += NUMERALS.charAt(xd[i]); - - // Add binary exponent suffix? - if (isExp) { - if (len > 1) { - if (baseOut == 16 || baseOut == 8) { - i = baseOut == 16 ? 4 : 3; - for (--len; len % i; len++) str += '0'; - xd = convertBase(str, base, baseOut); - for (len = xd.length; !xd[len - 1]; --len); - - // xd[0] will always be be 1 - for (i = 1, str = '1.'; i < len; i++) str += NUMERALS.charAt(xd[i]); - } else { - str = str.charAt(0) + '.' + str.slice(1); - } - } - - str = str + (e < 0 ? 'p' : 'p+') + e; - } else if (e < 0) { - for (; ++e;) str = '0' + str; - str = '0.' + str; - } else { - if (++e > len) for (e -= len; e-- ;) str += '0'; - else if (e < len) str = str.slice(0, e) + '.' + str.slice(e); - } - } - - str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str; - } - - return x.s < 0 ? '-' + str : str; - } - - - // Does not strip trailing zeros. - function truncate(arr, len) { - if (arr.length > len) { - arr.length = len; - return true; - } - } - - - // Decimal methods - - - /* - * abs - * acos - * acosh - * add - * asin - * asinh - * atan - * atanh - * atan2 - * cbrt - * ceil - * clamp - * clone - * config - * cos - * cosh - * div - * exp - * floor - * hypot - * ln - * log - * log2 - * log10 - * max - * min - * mod - * mul - * pow - * random - * round - * set - * sign - * sin - * sinh - * sqrt - * sub - * sum - * tan - * tanh - * trunc - */ - - - /* - * Return a new Decimal whose value is the absolute value of `x`. - * - * x {number|string|bigint|Decimal} - * - */ - function abs(x) { - return new this(x).abs(); - } - - - /* - * Return a new Decimal whose value is the arccosine in radians of `x`. - * - * x {number|string|bigint|Decimal} - * - */ - function acos(x) { - return new this(x).acos(); - } - - - /* - * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to - * `precision` significant digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} A value in radians. - * - */ - function acosh(x) { - return new this(x).acosh(); - } - - - /* - * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant - * digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} - * y {number|string|bigint|Decimal} - * - */ - function add(x, y) { - return new this(x).plus(y); - } - - - /* - * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} - * - */ - function asin(x) { - return new this(x).asin(); - } - - - /* - * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to - * `precision` significant digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} A value in radians. - * - */ - function asinh(x) { - return new this(x).asinh(); - } - - - /* - * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} - * - */ - function atan(x) { - return new this(x).atan(); - } - - - /* - * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to - * `precision` significant digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} A value in radians. - * - */ - function atanh(x) { - return new this(x).atanh(); - } - - - /* - * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi - * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`. - * - * Domain: [-Infinity, Infinity] - * Range: [-pi, pi] - * - * y {number|string|bigint|Decimal} The y-coordinate. - * x {number|string|bigint|Decimal} The x-coordinate. - * - * atan2(±0, -0) = ±pi - * atan2(±0, +0) = ±0 - * atan2(±0, -x) = ±pi for x > 0 - * atan2(±0, x) = ±0 for x > 0 - * atan2(-y, ±0) = -pi/2 for y > 0 - * atan2(y, ±0) = pi/2 for y > 0 - * atan2(±y, -Infinity) = ±pi for finite y > 0 - * atan2(±y, +Infinity) = ±0 for finite y > 0 - * atan2(±Infinity, x) = ±pi/2 for finite x - * atan2(±Infinity, -Infinity) = ±3*pi/4 - * atan2(±Infinity, +Infinity) = ±pi/4 - * atan2(NaN, x) = NaN - * atan2(y, NaN) = NaN - * - */ - function atan2(y, x) { - y = new this(y); - x = new this(x); - var r, - pr = this.precision, - rm = this.rounding, - wpr = pr + 4; - - // Either NaN - if (!y.s || !x.s) { - r = new this(NaN); - - // Both ±Infinity - } else if (!y.d && !x.d) { - r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75); - r.s = y.s; - - // x is ±Infinity or y is ±0 - } else if (!x.d || y.isZero()) { - r = x.s < 0 ? getPi(this, pr, rm) : new this(0); - r.s = y.s; - - // y is ±Infinity or x is ±0 - } else if (!y.d || x.isZero()) { - r = getPi(this, wpr, 1).times(0.5); - r.s = y.s; - - // Both non-zero and finite - } else if (x.s < 0) { - this.precision = wpr; - this.rounding = 1; - r = this.atan(divide(y, x, wpr, 1)); - x = getPi(this, wpr, 1); - this.precision = pr; - this.rounding = rm; - r = y.s < 0 ? r.minus(x) : r.plus(x); - } else { - r = this.atan(divide(y, x, wpr, 1)); - } - - return r; - } - - - /* - * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant - * digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} - * - */ - function cbrt(x) { - return new this(x).cbrt(); - } - - - /* - * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`. - * - * x {number|string|bigint|Decimal} - * - */ - function ceil(x) { - return finalise(x = new this(x), x.e + 1, 2); - } - - - /* - * Return a new Decimal whose value is `x` clamped to the range delineated by `min` and `max`. - * - * x {number|string|bigint|Decimal} - * min {number|string|bigint|Decimal} - * max {number|string|bigint|Decimal} - * - */ - function clamp(x, min, max) { - return new this(x).clamp(min, max); - } - - - /* - * Configure global settings for a Decimal constructor. - * - * `obj` is an object with one or more of the following properties, - * - * precision {number} - * rounding {number} - * toExpNeg {number} - * toExpPos {number} - * maxE {number} - * minE {number} - * modulo {number} - * crypto {boolean|number} - * defaults {true} - * - * E.g. Decimal.config({ precision: 20, rounding: 4 }) - * - */ - function config(obj) { - if (!obj || typeof obj !== 'object') throw Error(decimalError + 'Object expected'); - var i, p, v, - useDefaults = obj.defaults === true, - ps = [ - 'precision', 1, MAX_DIGITS, - 'rounding', 0, 8, - 'toExpNeg', -EXP_LIMIT, 0, - 'toExpPos', 0, EXP_LIMIT, - 'maxE', 0, EXP_LIMIT, - 'minE', -EXP_LIMIT, 0, - 'modulo', 0, 9 - ]; - - for (i = 0; i < ps.length; i += 3) { - if (p = ps[i], useDefaults) this[p] = DEFAULTS[p]; - if ((v = obj[p]) !== void 0) { - if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v; - else throw Error(invalidArgument + p + ': ' + v); - } - } - - if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p]; - if ((v = obj[p]) !== void 0) { - if (v === true || v === false || v === 0 || v === 1) { - if (v) { - if (typeof crypto != 'undefined' && crypto && - (crypto.getRandomValues || crypto.randomBytes)) { - this[p] = true; - } else { - throw Error(cryptoUnavailable); - } - } else { - this[p] = false; - } - } else { - throw Error(invalidArgument + p + ': ' + v); - } - } - - return this; - } - - - /* - * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant - * digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} A value in radians. - * - */ - function cos(x) { - return new this(x).cos(); - } - - - /* - * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision - * significant digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} A value in radians. - * - */ - function cosh(x) { - return new this(x).cosh(); - } - - - /* - * Create and return a Decimal constructor with the same configuration properties as this Decimal - * constructor. - * - */ - function clone(obj) { - var i, p, ps; - - /* - * The Decimal constructor and exported function. - * Return a new Decimal instance. - * - * v {number|string|bigint|Decimal} A numeric value. - * - */ - function Decimal(v) { - var e, i, t, - x = this; - - // Decimal called without new. - if (!(x instanceof Decimal)) return new Decimal(v); - - // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor - // which points to Object. - x.constructor = Decimal; - - if (isDecimalInstance(v)) { - x.s = v.s; - - if (external) { - if (!v.d || v.e > Decimal.maxE) { - - // Infinity. - x.e = NaN; - x.d = null; - } else if (v.e < Decimal.minE) { - - // Zero. - x.e = 0; - x.d = [0]; - } else { - x.e = v.e; - x.d = v.d.slice(); - } - } else { - x.e = v.e; - x.d = v.d ? v.d.slice() : v.d; - } - - return; - } - - t = typeof v; - - if (t === 'number') { - if (v === 0) { - x.s = 1 / v < 0 ? -1 : 1; - x.e = 0; - x.d = [0]; - return; - } - - if (v < 0) { - v = -v; - x.s = -1; - } else { - x.s = 1; - } - - // Fast path for small integers. - if (v === ~~v && v < 1e7) { - for (e = 0, i = v; i >= 10; i /= 10) e++; - - if (external) { - if (e > Decimal.maxE) { - x.e = NaN; - x.d = null; - } else if (e < Decimal.minE) { - x.e = 0; - x.d = [0]; - } else { - x.e = e; - x.d = [v]; - } - } else { - x.e = e; - x.d = [v]; - } - - return; - } - - // Infinity or NaN? - if (v * 0 !== 0) { - if (!v) x.s = NaN; - x.e = NaN; - x.d = null; - return; - } - - return parseDecimal(x, v.toString()); - } - - if (t === 'string') { - if ((i = v.charCodeAt(0)) === 45) { // minus sign - v = v.slice(1); - x.s = -1; - } else { - if (i === 43) v = v.slice(1); // plus sign - x.s = 1; - } - - return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v); - } - - if (t === 'bigint') { - if (v < 0) { - v = -v; - x.s = -1; - } else { - x.s = 1; - } - - return parseDecimal(x, v.toString()); - } - - throw Error(invalidArgument + v); - } - - Decimal.prototype = P; - - Decimal.ROUND_UP = 0; - Decimal.ROUND_DOWN = 1; - Decimal.ROUND_CEIL = 2; - Decimal.ROUND_FLOOR = 3; - Decimal.ROUND_HALF_UP = 4; - Decimal.ROUND_HALF_DOWN = 5; - Decimal.ROUND_HALF_EVEN = 6; - Decimal.ROUND_HALF_CEIL = 7; - Decimal.ROUND_HALF_FLOOR = 8; - Decimal.EUCLID = 9; - - Decimal.config = Decimal.set = config; - Decimal.clone = clone; - Decimal.isDecimal = isDecimalInstance; - - Decimal.abs = abs; - Decimal.acos = acos; - Decimal.acosh = acosh; // ES6 - Decimal.add = add; - Decimal.asin = asin; - Decimal.asinh = asinh; // ES6 - Decimal.atan = atan; - Decimal.atanh = atanh; // ES6 - Decimal.atan2 = atan2; - Decimal.cbrt = cbrt; // ES6 - Decimal.ceil = ceil; - Decimal.clamp = clamp; - Decimal.cos = cos; - Decimal.cosh = cosh; // ES6 - Decimal.div = div; - Decimal.exp = exp; - Decimal.floor = floor; - Decimal.hypot = hypot; // ES6 - Decimal.ln = ln; - Decimal.log = log; - Decimal.log10 = log10; // ES6 - Decimal.log2 = log2; // ES6 - Decimal.max = max; - Decimal.min = min; - Decimal.mod = mod; - Decimal.mul = mul; - Decimal.pow = pow; - Decimal.random = random; - Decimal.round = round; - Decimal.sign = sign; // ES6 - Decimal.sin = sin; - Decimal.sinh = sinh; // ES6 - Decimal.sqrt = sqrt; - Decimal.sub = sub; - Decimal.sum = sum; - Decimal.tan = tan; - Decimal.tanh = tanh; // ES6 - Decimal.trunc = trunc; // ES6 - - if (obj === void 0) obj = {}; - if (obj) { - if (obj.defaults !== true) { - ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto']; - for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p]; - } - } - - Decimal.config(obj); - - return Decimal; - } - - - /* - * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant - * digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} - * y {number|string|bigint|Decimal} - * - */ - function div(x, y) { - return new this(x).div(y); - } - - - /* - * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} The power to which to raise the base of the natural log. - * - */ - function exp(x) { - return new this(x).exp(); - } - - - /* - * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`. - * - * x {number|string|bigint|Decimal} - * - */ - function floor(x) { - return finalise(x = new this(x), x.e + 1, 3); - } - - - /* - * Return a new Decimal whose value is the square root of the sum of the squares of the arguments, - * rounded to `precision` significant digits using rounding mode `rounding`. - * - * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...) - * - * arguments {number|string|bigint|Decimal} - * - */ - function hypot() { - var i, n, - t = new this(0); - - external = false; - - for (i = 0; i < arguments.length;) { - n = new this(arguments[i++]); - if (!n.d) { - if (n.s) { - external = true; - return new this(1 / 0); - } - t = n; - } else if (t.d) { - t = t.plus(n.times(n)); - } - } - - external = true; - - return t.sqrt(); - } - - - /* - * Return true if object is a Decimal instance (where Decimal is any Decimal constructor), - * otherwise return false. - * - */ - function isDecimalInstance(obj) { - return obj instanceof Decimal || obj && obj.toStringTag === tag || false; - } - - - /* - * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} - * - */ - function ln(x) { - return new this(x).ln(); - } - - - /* - * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base - * is specified, rounded to `precision` significant digits using rounding mode `rounding`. - * - * log[y](x) - * - * x {number|string|bigint|Decimal} The argument of the logarithm. - * y {number|string|bigint|Decimal} The base of the logarithm. - * - */ - function log(x, y) { - return new this(x).log(y); - } - - - /* - * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} - * - */ - function log2(x) { - return new this(x).log(2); - } - - - /* - * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} - * - */ - function log10(x) { - return new this(x).log(10); - } - - - /* - * Return a new Decimal whose value is the maximum of the arguments. - * - * arguments {number|string|bigint|Decimal} - * - */ - function max() { - return maxOrMin(this, arguments, -1); - } - - - /* - * Return a new Decimal whose value is the minimum of the arguments. - * - * arguments {number|string|bigint|Decimal} - * - */ - function min() { - return maxOrMin(this, arguments, 1); - } - - - /* - * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits - * using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} - * y {number|string|bigint|Decimal} - * - */ - function mod(x, y) { - return new this(x).mod(y); - } - - - /* - * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant - * digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} - * y {number|string|bigint|Decimal} - * - */ - function mul(x, y) { - return new this(x).mul(y); - } - - - /* - * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision - * significant digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} The base. - * y {number|string|bigint|Decimal} The exponent. - * - */ - function pow(x, y) { - return new this(x).pow(y); - } - - - /* - * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with - * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros - * are produced). - * - * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive. - * - */ - function random(sd) { - var d, e, k, n, - i = 0, - r = new this(1), - rd = []; - - if (sd === void 0) sd = this.precision; - else checkInt32(sd, 1, MAX_DIGITS); - - k = Math.ceil(sd / LOG_BASE); - - if (!this.crypto) { - for (; i < k;) rd[i++] = Math.random() * 1e7 | 0; - - // Browsers supporting crypto.getRandomValues. - } else if (crypto.getRandomValues) { - d = crypto.getRandomValues(new Uint32Array(k)); - - for (; i < k;) { - n = d[i]; - - // 0 <= n < 4294967296 - // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865). - if (n >= 4.29e9) { - d[i] = crypto.getRandomValues(new Uint32Array(1))[0]; - } else { - - // 0 <= n <= 4289999999 - // 0 <= (n % 1e7) <= 9999999 - rd[i++] = n % 1e7; - } - } - - // Node.js supporting crypto.randomBytes. - } else if (crypto.randomBytes) { - - // buffer - d = crypto.randomBytes(k *= 4); - - for (; i < k;) { - - // 0 <= n < 2147483648 - n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24); - - // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286). - if (n >= 2.14e9) { - crypto.randomBytes(4).copy(d, i); - } else { - - // 0 <= n <= 2139999999 - // 0 <= (n % 1e7) <= 9999999 - rd.push(n % 1e7); - i += 4; - } - } - - i = k / 4; - } else { - throw Error(cryptoUnavailable); - } - - k = rd[--i]; - sd %= LOG_BASE; - - // Convert trailing digits to zeros according to sd. - if (k && sd) { - n = mathpow(10, LOG_BASE - sd); - rd[i] = (k / n | 0) * n; - } - - // Remove trailing words which are zero. - for (; rd[i] === 0; i--) rd.pop(); - - // Zero? - if (i < 0) { - e = 0; - rd = [0]; - } else { - e = -1; - - // Remove leading words which are zero and adjust exponent accordingly. - for (; rd[0] === 0; e -= LOG_BASE) rd.shift(); - - // Count the digits of the first word of rd to determine leading zeros. - for (k = 1, n = rd[0]; n >= 10; n /= 10) k++; - - // Adjust the exponent for leading zeros of the first word of rd. - if (k < LOG_BASE) e -= LOG_BASE - k; - } - - r.e = e; - r.d = rd; - - return r; - } - - - /* - * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`. - * - * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL). - * - * x {number|string|bigint|Decimal} - * - */ - function round(x) { - return finalise(x = new this(x), x.e + 1, this.rounding); - } - - - /* - * Return - * 1 if x > 0, - * -1 if x < 0, - * 0 if x is 0, - * -0 if x is -0, - * NaN otherwise - * - * x {number|string|bigint|Decimal} - * - */ - function sign(x) { - x = new this(x); - return x.d ? (x.d[0] ? x.s : 0 * x.s) : x.s || NaN; - } - - - /* - * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits - * using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} A value in radians. - * - */ - function sin(x) { - return new this(x).sin(); - } - - - /* - * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} A value in radians. - * - */ - function sinh(x) { - return new this(x).sinh(); - } - - - /* - * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant - * digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} - * - */ - function sqrt(x) { - return new this(x).sqrt(); - } - - - /* - * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits - * using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} - * y {number|string|bigint|Decimal} - * - */ - function sub(x, y) { - return new this(x).sub(y); - } - - - /* - * Return a new Decimal whose value is the sum of the arguments, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - * Only the result is rounded, not the intermediate calculations. - * - * arguments {number|string|bigint|Decimal} - * - */ - function sum() { - var i = 0, - args = arguments, - x = new this(args[i]); - - external = false; - for (; x.s && ++i < args.length;) x = x.plus(args[i]); - external = true; - - return finalise(x, this.precision, this.rounding); - } - - - /* - * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant - * digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} A value in radians. - * - */ - function tan(x) { - return new this(x).tan(); - } - - - /* - * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} A value in radians. - * - */ - function tanh(x) { - return new this(x).tanh(); - } - - - /* - * Return a new Decimal whose value is `x` truncated to an integer. - * - * x {number|string|bigint|Decimal} - * - */ - function trunc(x) { - return finalise(x = new this(x), x.e + 1, 1); - } - - - // Create and configure initial Decimal constructor. - Decimal = clone(DEFAULTS); - Decimal.prototype.constructor = Decimal; - Decimal['default'] = Decimal.Decimal = Decimal; - - // Create the internal constants from their string values. - LN10 = new Decimal(LN10); - PI = new Decimal(PI); - - - // Export. - - - // AMD. - if (typeof define == 'function' && define.amd) { - define(function () { - return Decimal; - }); - - // Node and other environments that support module.exports. - } else if (typeof module != 'undefined' && module.exports) { - if (typeof Symbol == 'function' && typeof Symbol.iterator == 'symbol') { - P[Symbol['for']('nodejs.util.inspect.custom')] = P.toString; - P[Symbol.toStringTag] = 'Decimal'; - } - - module.exports = Decimal; - - // Browser. - } else { - if (!globalScope) { - globalScope = typeof self != 'undefined' && self && self.self == self ? self : window; - } - - noConflict = globalScope.Decimal; - Decimal.noConflict = function () { - globalScope.Decimal = noConflict; - return Decimal; - }; - - globalScope.Decimal = Decimal; - } -})(this); +;(function (globalScope) { + 'use strict'; + + + /*! + * decimal.js v10.6.0 + * An arbitrary-precision Decimal type for JavaScript. + * https://github.com/MikeMcl/decimal.js + * Copyright (c) 2025 Michael Mclaughlin + * MIT Licence + */ + + + // ----------------------------------- EDITABLE DEFAULTS ------------------------------------ // + + + // The maximum exponent magnitude. + // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`. + var EXP_LIMIT = 9e15, // 0 to 9e15 + + // The limit on the value of `precision`, and on the value of the first argument to + // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`. + MAX_DIGITS = 1e9, // 0 to 1e9 + + // Base conversion alphabet. + NUMERALS = '0123456789abcdef', + + // The natural logarithm of 10 (1025 digits). + LN10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058', + + // Pi (1025 digits). + PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789', + + + // The initial configuration properties of the Decimal constructor. + DEFAULTS = { + + // These values must be integers within the stated ranges (inclusive). + // Most of these values can be changed at run-time using the `Decimal.config` method. + + // The maximum number of significant digits of the result of a calculation or base conversion. + // E.g. `Decimal.config({ precision: 20 });` + precision: 20, // 1 to MAX_DIGITS + + // The rounding mode used when rounding to `precision`. + // + // ROUND_UP 0 Away from zero. + // ROUND_DOWN 1 Towards zero. + // ROUND_CEIL 2 Towards +Infinity. + // ROUND_FLOOR 3 Towards -Infinity. + // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up. + // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down. + // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour. + // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity. + // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity. + // + // E.g. + // `Decimal.rounding = 4;` + // `Decimal.rounding = Decimal.ROUND_HALF_UP;` + rounding: 4, // 0 to 8 + + // The modulo mode used when calculating the modulus: a mod n. + // The quotient (q = a / n) is calculated according to the corresponding rounding mode. + // The remainder (r) is calculated as: r = a - n * q. + // + // UP 0 The remainder is positive if the dividend is negative, else is negative. + // DOWN 1 The remainder has the same sign as the dividend (JavaScript %). + // FLOOR 3 The remainder has the same sign as the divisor (Python %). + // HALF_EVEN 6 The IEEE 754 remainder function. + // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive. + // + // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian + // division (9) are commonly used for the modulus operation. The other rounding modes can also + // be used, but they may not give useful results. + modulo: 1, // 0 to 9 + + // The exponent value at and beneath which `toString` returns exponential notation. + // JavaScript numbers: -7 + toExpNeg: -7, // 0 to -EXP_LIMIT + + // The exponent value at and above which `toString` returns exponential notation. + // JavaScript numbers: 21 + toExpPos: 21, // 0 to EXP_LIMIT + + // The minimum exponent value, beneath which underflow to zero occurs. + // JavaScript numbers: -324 (5e-324) + minE: -EXP_LIMIT, // -1 to -EXP_LIMIT + + // The maximum exponent value, above which overflow to Infinity occurs. + // JavaScript numbers: 308 (1.7976931348623157e+308) + maxE: EXP_LIMIT, // 1 to EXP_LIMIT + + // Whether to use cryptographically-secure random number generation, if available. + crypto: false // true/false + }, + + + // ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- // + + + Decimal, inexact, noConflict, quadrant, + external = true, + + decimalError = '[DecimalError] ', + invalidArgument = decimalError + 'Invalid argument: ', + precisionLimitExceeded = decimalError + 'Precision limit exceeded', + cryptoUnavailable = decimalError + 'crypto unavailable', + tag = '[object Decimal]', + + mathfloor = Math.floor, + mathpow = Math.pow, + + isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i, + isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i, + isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, + isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, + + BASE = 1e7, + LOG_BASE = 7, + MAX_SAFE_INTEGER = 9007199254740991, + + LN10_PRECISION = LN10.length - 1, + PI_PRECISION = PI.length - 1, + + // Decimal.prototype object + P = { toStringTag: tag }; + + + // Decimal prototype methods + + + /* + * absoluteValue abs + * ceil + * clampedTo clamp + * comparedTo cmp + * cosine cos + * cubeRoot cbrt + * decimalPlaces dp + * dividedBy div + * dividedToIntegerBy divToInt + * equals eq + * floor + * greaterThan gt + * greaterThanOrEqualTo gte + * hyperbolicCosine cosh + * hyperbolicSine sinh + * hyperbolicTangent tanh + * inverseCosine acos + * inverseHyperbolicCosine acosh + * inverseHyperbolicSine asinh + * inverseHyperbolicTangent atanh + * inverseSine asin + * inverseTangent atan + * isFinite + * isInteger isInt + * isNaN + * isNegative isNeg + * isPositive isPos + * isZero + * lessThan lt + * lessThanOrEqualTo lte + * logarithm log + * [maximum] [max] + * [minimum] [min] + * minus sub + * modulo mod + * naturalExponential exp + * naturalLogarithm ln + * negated neg + * plus add + * precision sd + * round + * sine sin + * squareRoot sqrt + * tangent tan + * times mul + * toBinary + * toDecimalPlaces toDP + * toExponential + * toFixed + * toFraction + * toHexadecimal toHex + * toNearest + * toNumber + * toOctal + * toPower pow + * toPrecision + * toSignificantDigits toSD + * toString + * truncated trunc + * valueOf toJSON + */ + + + /* + * Return a new Decimal whose value is the absolute value of this Decimal. + * + */ + P.absoluteValue = P.abs = function () { + var x = new this.constructor(this); + if (x.s < 0) x.s = 1; + return finalise(x); + }; + + + /* + * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the + * direction of positive Infinity. + * + */ + P.ceil = function () { + return finalise(new this.constructor(this), this.e + 1, 2); + }; + + + /* + * Return a new Decimal whose value is the value of this Decimal clamped to the range + * delineated by `min` and `max`. + * + * min {number|string|bigint|Decimal} + * max {number|string|bigint|Decimal} + * + */ + P.clampedTo = P.clamp = function (min, max) { + var k, + x = this, + Ctor = x.constructor; + min = new Ctor(min); + max = new Ctor(max); + if (!min.s || !max.s) return new Ctor(NaN); + if (min.gt(max)) throw Error(invalidArgument + max); + k = x.cmp(min); + return k < 0 ? min : x.cmp(max) > 0 ? max : new Ctor(x); + }; + + + /* + * Return + * 1 if the value of this Decimal is greater than the value of `y`, + * -1 if the value of this Decimal is less than the value of `y`, + * 0 if they have the same value, + * NaN if the value of either Decimal is NaN. + * + */ + P.comparedTo = P.cmp = function (y) { + var i, j, xdL, ydL, + x = this, + xd = x.d, + yd = (y = new x.constructor(y)).d, + xs = x.s, + ys = y.s; + + // Either NaN or ±Infinity? + if (!xd || !yd) { + return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1; + } + + // Either zero? + if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0; + + // Signs differ? + if (xs !== ys) return xs; + + // Compare exponents. + if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1; + + xdL = xd.length; + ydL = yd.length; + + // Compare digit by digit. + for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) { + if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1; + } + + // Compare lengths. + return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1; + }; + + + /* + * Return a new Decimal whose value is the cosine of the value in radians of this Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [-1, 1] + * + * cos(0) = 1 + * cos(-0) = 1 + * cos(Infinity) = NaN + * cos(-Infinity) = NaN + * cos(NaN) = NaN + * + */ + P.cosine = P.cos = function () { + var pr, rm, + x = this, + Ctor = x.constructor; + + if (!x.d) return new Ctor(NaN); + + // cos(0) = cos(-0) = 1 + if (!x.d[0]) return new Ctor(1); + + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE; + Ctor.rounding = 1; + + x = cosine(Ctor, toLessThanHalfPi(Ctor, x)); + + Ctor.precision = pr; + Ctor.rounding = rm; + + return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true); + }; + + + /* + * + * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to + * `precision` significant digits using rounding mode `rounding`. + * + * cbrt(0) = 0 + * cbrt(-0) = -0 + * cbrt(1) = 1 + * cbrt(-1) = -1 + * cbrt(N) = N + * cbrt(-I) = -I + * cbrt(I) = I + * + * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3)) + * + */ + P.cubeRoot = P.cbrt = function () { + var e, m, n, r, rep, s, sd, t, t3, t3plusx, + x = this, + Ctor = x.constructor; + + if (!x.isFinite() || x.isZero()) return new Ctor(x); + external = false; + + // Initial estimate. + s = x.s * mathpow(x.s * x, 1 / 3); + + // Math.cbrt underflow/overflow? + // Pass x to Math.pow as integer, then adjust the exponent of the result. + if (!s || Math.abs(s) == 1 / 0) { + n = digitsToString(x.d); + e = x.e; + + // Adjust n exponent so it is a multiple of 3 away from x exponent. + if (s = (e - n.length + 1) % 3) n += (s == 1 || s == -2 ? '0' : '00'); + s = mathpow(n, 1 / 3); + + // Rarely, e may be one less than the result exponent value. + e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2)); + + if (s == 1 / 0) { + n = '5e' + e; + } else { + n = s.toExponential(); + n = n.slice(0, n.indexOf('e') + 1) + e; + } + + r = new Ctor(n); + r.s = x.s; + } else { + r = new Ctor(s.toString()); + } + + sd = (e = Ctor.precision) + 3; + + // Halley's method. + // TODO? Compare Newton's method. + for (;;) { + t = r; + t3 = t.times(t).times(t); + t3plusx = t3.plus(x); + r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1); + + // TODO? Replace with for-loop and checkRoundingDigits. + if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) { + n = n.slice(sd - 3, sd + 1); + + // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999 + // , i.e. approaching a rounding boundary, continue the iteration. + if (n == '9999' || !rep && n == '4999') { + + // On the first iteration only, check to see if rounding up gives the exact result as the + // nines may infinitely repeat. + if (!rep) { + finalise(t, e + 1, 0); + + if (t.times(t).times(t).eq(x)) { + r = t; + break; + } + } + + sd += 4; + rep = 1; + } else { + + // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result. + // If not, then there are further digits and m will be truthy. + if (!+n || !+n.slice(1) && n.charAt(0) == '5') { + + // Truncate to the first rounding digit. + finalise(r, e + 1, 1); + m = !r.times(r).times(r).eq(x); + } + + break; + } + } + } + + external = true; + + return finalise(r, e, Ctor.rounding, m); + }; + + + /* + * Return the number of decimal places of the value of this Decimal. + * + */ + P.decimalPlaces = P.dp = function () { + var w, + d = this.d, + n = NaN; + + if (d) { + w = d.length - 1; + n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE; + + // Subtract the number of trailing zeros of the last word. + w = d[w]; + if (w) for (; w % 10 == 0; w /= 10) n--; + if (n < 0) n = 0; + } + + return n; + }; + + + /* + * n / 0 = I + * n / N = N + * n / I = 0 + * 0 / n = 0 + * 0 / 0 = N + * 0 / N = N + * 0 / I = 0 + * N / n = N + * N / 0 = N + * N / N = N + * N / I = N + * I / n = I + * I / 0 = I + * I / N = N + * I / I = N + * + * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to + * `precision` significant digits using rounding mode `rounding`. + * + */ + P.dividedBy = P.div = function (y) { + return divide(this, new this.constructor(y)); + }; + + + /* + * Return a new Decimal whose value is the integer part of dividing the value of this Decimal + * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`. + * + */ + P.dividedToIntegerBy = P.divToInt = function (y) { + var x = this, + Ctor = x.constructor; + return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding); + }; + + + /* + * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false. + * + */ + P.equals = P.eq = function (y) { + return this.cmp(y) === 0; + }; + + + /* + * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the + * direction of negative Infinity. + * + */ + P.floor = function () { + return finalise(new this.constructor(this), this.e + 1, 3); + }; + + + /* + * Return true if the value of this Decimal is greater than the value of `y`, otherwise return + * false. + * + */ + P.greaterThan = P.gt = function (y) { + return this.cmp(y) > 0; + }; + + + /* + * Return true if the value of this Decimal is greater than or equal to the value of `y`, + * otherwise return false. + * + */ + P.greaterThanOrEqualTo = P.gte = function (y) { + var k = this.cmp(y); + return k == 1 || k === 0; + }; + + + /* + * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this + * Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [1, Infinity] + * + * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ... + * + * cosh(0) = 1 + * cosh(-0) = 1 + * cosh(Infinity) = Infinity + * cosh(-Infinity) = Infinity + * cosh(NaN) = NaN + * + * x time taken (ms) result + * 1000 9 9.8503555700852349694e+433 + * 10000 25 4.4034091128314607936e+4342 + * 100000 171 1.4033316802130615897e+43429 + * 1000000 3817 1.5166076984010437725e+434294 + * 10000000 abandoned after 2 minute wait + * + * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x)) + * + */ + P.hyperbolicCosine = P.cosh = function () { + var k, n, pr, rm, len, + x = this, + Ctor = x.constructor, + one = new Ctor(1); + + if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN); + if (x.isZero()) return one; + + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(x.e, x.sd()) + 4; + Ctor.rounding = 1; + len = x.d.length; + + // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1 + // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4)) + + // Estimate the optimum number of times to use the argument reduction. + // TODO? Estimation reused from cosine() and may not be optimal here. + if (len < 32) { + k = Math.ceil(len / 3); + n = (1 / tinyPow(4, k)).toString(); + } else { + k = 16; + n = '2.3283064365386962890625e-10'; + } + + x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true); + + // Reverse argument reduction + var cosh2_x, + i = k, + d8 = new Ctor(8); + for (; i--;) { + cosh2_x = x.times(x); + x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8)))); + } + + return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true); + }; + + + /* + * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this + * Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [-Infinity, Infinity] + * + * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ... + * + * sinh(0) = 0 + * sinh(-0) = -0 + * sinh(Infinity) = Infinity + * sinh(-Infinity) = -Infinity + * sinh(NaN) = NaN + * + * x time taken (ms) + * 10 2 ms + * 100 5 ms + * 1000 14 ms + * 10000 82 ms + * 100000 886 ms 1.4033316802130615897e+43429 + * 200000 2613 ms + * 300000 5407 ms + * 400000 8824 ms + * 500000 13026 ms 8.7080643612718084129e+217146 + * 1000000 48543 ms + * + * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x)) + * + */ + P.hyperbolicSine = P.sinh = function () { + var k, pr, rm, len, + x = this, + Ctor = x.constructor; + + if (!x.isFinite() || x.isZero()) return new Ctor(x); + + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(x.e, x.sd()) + 4; + Ctor.rounding = 1; + len = x.d.length; + + if (len < 3) { + x = taylorSeries(Ctor, 2, x, x, true); + } else { + + // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x)) + // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3)) + // 3 multiplications and 1 addition + + // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x))) + // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5))) + // 4 multiplications and 2 additions + + // Estimate the optimum number of times to use the argument reduction. + k = 1.4 * Math.sqrt(len); + k = k > 16 ? 16 : k | 0; + + x = x.times(1 / tinyPow(5, k)); + x = taylorSeries(Ctor, 2, x, x, true); + + // Reverse argument reduction + var sinh2_x, + d5 = new Ctor(5), + d16 = new Ctor(16), + d20 = new Ctor(20); + for (; k--;) { + sinh2_x = x.times(x); + x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20)))); + } + } + + Ctor.precision = pr; + Ctor.rounding = rm; + + return finalise(x, pr, rm, true); + }; + + + /* + * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this + * Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [-1, 1] + * + * tanh(x) = sinh(x) / cosh(x) + * + * tanh(0) = 0 + * tanh(-0) = -0 + * tanh(Infinity) = 1 + * tanh(-Infinity) = -1 + * tanh(NaN) = NaN + * + */ + P.hyperbolicTangent = P.tanh = function () { + var pr, rm, + x = this, + Ctor = x.constructor; + + if (!x.isFinite()) return new Ctor(x.s); + if (x.isZero()) return new Ctor(x); + + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + 7; + Ctor.rounding = 1; + + return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm); + }; + + + /* + * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of + * this Decimal. + * + * Domain: [-1, 1] + * Range: [0, pi] + * + * acos(x) = pi/2 - asin(x) + * + * acos(0) = pi/2 + * acos(-0) = pi/2 + * acos(1) = 0 + * acos(-1) = pi + * acos(1/2) = pi/3 + * acos(-1/2) = 2*pi/3 + * acos(|x| > 1) = NaN + * acos(NaN) = NaN + * + */ + P.inverseCosine = P.acos = function () { + var x = this, + Ctor = x.constructor, + k = x.abs().cmp(1), + pr = Ctor.precision, + rm = Ctor.rounding; + + if (k !== -1) { + return k === 0 + // |x| is 1 + ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0) + // |x| > 1 or x is NaN + : new Ctor(NaN); + } + + if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5); + + // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3 + + Ctor.precision = pr + 6; + Ctor.rounding = 1; + + // See https://github.com/MikeMcl/decimal.js/pull/217 + x = new Ctor(1).minus(x).div(x.plus(1)).sqrt().atan(); + + Ctor.precision = pr; + Ctor.rounding = rm; + + return x.times(2); + }; + + + /* + * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the + * value of this Decimal. + * + * Domain: [1, Infinity] + * Range: [0, Infinity] + * + * acosh(x) = ln(x + sqrt(x^2 - 1)) + * + * acosh(x < 1) = NaN + * acosh(NaN) = NaN + * acosh(Infinity) = Infinity + * acosh(-Infinity) = NaN + * acosh(0) = NaN + * acosh(-0) = NaN + * acosh(1) = 0 + * acosh(-1) = NaN + * + */ + P.inverseHyperbolicCosine = P.acosh = function () { + var pr, rm, + x = this, + Ctor = x.constructor; + + if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN); + if (!x.isFinite()) return new Ctor(x); + + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4; + Ctor.rounding = 1; + external = false; + + x = x.times(x).minus(1).sqrt().plus(x); + + external = true; + Ctor.precision = pr; + Ctor.rounding = rm; + + return x.ln(); + }; + + + /* + * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value + * of this Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [-Infinity, Infinity] + * + * asinh(x) = ln(x + sqrt(x^2 + 1)) + * + * asinh(NaN) = NaN + * asinh(Infinity) = Infinity + * asinh(-Infinity) = -Infinity + * asinh(0) = 0 + * asinh(-0) = -0 + * + */ + P.inverseHyperbolicSine = P.asinh = function () { + var pr, rm, + x = this, + Ctor = x.constructor; + + if (!x.isFinite() || x.isZero()) return new Ctor(x); + + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6; + Ctor.rounding = 1; + external = false; + + x = x.times(x).plus(1).sqrt().plus(x); + + external = true; + Ctor.precision = pr; + Ctor.rounding = rm; + + return x.ln(); + }; + + + /* + * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the + * value of this Decimal. + * + * Domain: [-1, 1] + * Range: [-Infinity, Infinity] + * + * atanh(x) = 0.5 * ln((1 + x) / (1 - x)) + * + * atanh(|x| > 1) = NaN + * atanh(NaN) = NaN + * atanh(Infinity) = NaN + * atanh(-Infinity) = NaN + * atanh(0) = 0 + * atanh(-0) = -0 + * atanh(1) = Infinity + * atanh(-1) = -Infinity + * + */ + P.inverseHyperbolicTangent = P.atanh = function () { + var pr, rm, wpr, xsd, + x = this, + Ctor = x.constructor; + + if (!x.isFinite()) return new Ctor(NaN); + if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN); + + pr = Ctor.precision; + rm = Ctor.rounding; + xsd = x.sd(); + + if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true); + + Ctor.precision = wpr = xsd - x.e; + + x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1); + + Ctor.precision = pr + 4; + Ctor.rounding = 1; + + x = x.ln(); + + Ctor.precision = pr; + Ctor.rounding = rm; + + return x.times(0.5); + }; + + + /* + * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this + * Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [-pi/2, pi/2] + * + * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2))) + * + * asin(0) = 0 + * asin(-0) = -0 + * asin(1/2) = pi/6 + * asin(-1/2) = -pi/6 + * asin(1) = pi/2 + * asin(-1) = -pi/2 + * asin(|x| > 1) = NaN + * asin(NaN) = NaN + * + * TODO? Compare performance of Taylor series. + * + */ + P.inverseSine = P.asin = function () { + var halfPi, k, + pr, rm, + x = this, + Ctor = x.constructor; + + if (x.isZero()) return new Ctor(x); + + k = x.abs().cmp(1); + pr = Ctor.precision; + rm = Ctor.rounding; + + if (k !== -1) { + + // |x| is 1 + if (k === 0) { + halfPi = getPi(Ctor, pr + 4, rm).times(0.5); + halfPi.s = x.s; + return halfPi; + } + + // |x| > 1 or x is NaN + return new Ctor(NaN); + } + + // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6 + + Ctor.precision = pr + 6; + Ctor.rounding = 1; + + x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan(); + + Ctor.precision = pr; + Ctor.rounding = rm; + + return x.times(2); + }; + + + /* + * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value + * of this Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [-pi/2, pi/2] + * + * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ... + * + * atan(0) = 0 + * atan(-0) = -0 + * atan(1) = pi/4 + * atan(-1) = -pi/4 + * atan(Infinity) = pi/2 + * atan(-Infinity) = -pi/2 + * atan(NaN) = NaN + * + */ + P.inverseTangent = P.atan = function () { + var i, j, k, n, px, t, r, wpr, x2, + x = this, + Ctor = x.constructor, + pr = Ctor.precision, + rm = Ctor.rounding; + + if (!x.isFinite()) { + if (!x.s) return new Ctor(NaN); + if (pr + 4 <= PI_PRECISION) { + r = getPi(Ctor, pr + 4, rm).times(0.5); + r.s = x.s; + return r; + } + } else if (x.isZero()) { + return new Ctor(x); + } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) { + r = getPi(Ctor, pr + 4, rm).times(0.25); + r.s = x.s; + return r; + } + + Ctor.precision = wpr = pr + 10; + Ctor.rounding = 1; + + // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x); + + // Argument reduction + // Ensure |x| < 0.42 + // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2))) + + k = Math.min(28, wpr / LOG_BASE + 2 | 0); + + for (i = k; i; --i) x = x.div(x.times(x).plus(1).sqrt().plus(1)); + + external = false; + + j = Math.ceil(wpr / LOG_BASE); + n = 1; + x2 = x.times(x); + r = new Ctor(x); + px = x; + + // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ... + for (; i !== -1;) { + px = px.times(x2); + t = r.minus(px.div(n += 2)); + + px = px.times(x2); + r = t.plus(px.div(n += 2)); + + if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;); + } + + if (k) r = r.times(2 << (k - 1)); + + external = true; + + return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true); + }; + + + /* + * Return true if the value of this Decimal is a finite number, otherwise return false. + * + */ + P.isFinite = function () { + return !!this.d; + }; + + + /* + * Return true if the value of this Decimal is an integer, otherwise return false. + * + */ + P.isInteger = P.isInt = function () { + return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2; + }; + + + /* + * Return true if the value of this Decimal is NaN, otherwise return false. + * + */ + P.isNaN = function () { + return !this.s; + }; + + + /* + * Return true if the value of this Decimal is negative, otherwise return false. + * + */ + P.isNegative = P.isNeg = function () { + return this.s < 0; + }; + + + /* + * Return true if the value of this Decimal is positive, otherwise return false. + * + */ + P.isPositive = P.isPos = function () { + return this.s > 0; + }; + + + /* + * Return true if the value of this Decimal is 0 or -0, otherwise return false. + * + */ + P.isZero = function () { + return !!this.d && this.d[0] === 0; + }; + + + /* + * Return true if the value of this Decimal is less than `y`, otherwise return false. + * + */ + P.lessThan = P.lt = function (y) { + return this.cmp(y) < 0; + }; + + + /* + * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false. + * + */ + P.lessThanOrEqualTo = P.lte = function (y) { + return this.cmp(y) < 1; + }; + + + /* + * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * If no base is specified, return log[10](arg). + * + * log[base](arg) = ln(arg) / ln(base) + * + * The result will always be correctly rounded if the base of the log is 10, and 'almost always' + * otherwise: + * + * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen + * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error + * between the result and the correctly rounded result will be one ulp (unit in the last place). + * + * log[-b](a) = NaN + * log[0](a) = NaN + * log[1](a) = NaN + * log[NaN](a) = NaN + * log[Infinity](a) = NaN + * log[b](0) = -Infinity + * log[b](-0) = -Infinity + * log[b](-a) = NaN + * log[b](1) = 0 + * log[b](Infinity) = Infinity + * log[b](NaN) = NaN + * + * [base] {number|string|bigint|Decimal} The base of the logarithm. + * + */ + P.logarithm = P.log = function (base) { + var isBase10, d, denominator, k, inf, num, sd, r, + arg = this, + Ctor = arg.constructor, + pr = Ctor.precision, + rm = Ctor.rounding, + guard = 5; + + // Default base is 10. + if (base == null) { + base = new Ctor(10); + isBase10 = true; + } else { + base = new Ctor(base); + d = base.d; + + // Return NaN if base is negative, or non-finite, or is 0 or 1. + if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN); + + isBase10 = base.eq(10); + } + + d = arg.d; + + // Is arg negative, non-finite, 0 or 1? + if (arg.s < 0 || !d || !d[0] || arg.eq(1)) { + return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0); + } + + // The result will have a non-terminating decimal expansion if base is 10 and arg is not an + // integer power of 10. + if (isBase10) { + if (d.length > 1) { + inf = true; + } else { + for (k = d[0]; k % 10 === 0;) k /= 10; + inf = k !== 1; + } + } + + external = false; + sd = pr + guard; + num = naturalLogarithm(arg, sd); + denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd); + + // The result will have 5 rounding digits. + r = divide(num, denominator, sd, 1); + + // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000, + // calculate 10 further digits. + // + // If the result is known to have an infinite decimal expansion, repeat this until it is clear + // that the result is above or below the boundary. Otherwise, if after calculating the 10 + // further digits, the last 14 are nines, round up and assume the result is exact. + // Also assume the result is exact if the last 14 are zero. + // + // Example of a result that will be incorrectly rounded: + // log[1048576](4503599627370502) = 2.60000000000000009610279511444746... + // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it + // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so + // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal + // place is still 2.6. + if (checkRoundingDigits(r.d, k = pr, rm)) { + + do { + sd += 10; + num = naturalLogarithm(arg, sd); + denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd); + r = divide(num, denominator, sd, 1); + + if (!inf) { + + // Check for 14 nines from the 2nd rounding digit, as the first may be 4. + if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) { + r = finalise(r, pr + 1, 0); + } + + break; + } + } while (checkRoundingDigits(r.d, k += 10, rm)); + } + + external = true; + + return finalise(r, pr, rm); + }; + + + /* + * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal. + * + * arguments {number|string|bigint|Decimal} + * + P.max = function () { + Array.prototype.push.call(arguments, this); + return maxOrMin(this.constructor, arguments, -1); + }; + */ + + + /* + * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal. + * + * arguments {number|string|bigint|Decimal} + * + P.min = function () { + Array.prototype.push.call(arguments, this); + return maxOrMin(this.constructor, arguments, 1); + }; + */ + + + /* + * n - 0 = n + * n - N = N + * n - I = -I + * 0 - n = -n + * 0 - 0 = 0 + * 0 - N = N + * 0 - I = -I + * N - n = N + * N - 0 = N + * N - N = N + * N - I = N + * I - n = I + * I - 0 = I + * I - N = N + * I - I = N + * + * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + */ + P.minus = P.sub = function (y) { + var d, e, i, j, k, len, pr, rm, xd, xe, xLTy, yd, + x = this, + Ctor = x.constructor; + + y = new Ctor(y); + + // If either is not finite... + if (!x.d || !y.d) { + + // Return NaN if either is NaN. + if (!x.s || !y.s) y = new Ctor(NaN); + + // Return y negated if x is finite and y is ±Infinity. + else if (x.d) y.s = -y.s; + + // Return x if y is finite and x is ±Infinity. + // Return x if both are ±Infinity with different signs. + // Return NaN if both are ±Infinity with the same sign. + else y = new Ctor(y.d || x.s !== y.s ? x : NaN); + + return y; + } + + // If signs differ... + if (x.s != y.s) { + y.s = -y.s; + return x.plus(y); + } + + xd = x.d; + yd = y.d; + pr = Ctor.precision; + rm = Ctor.rounding; + + // If either is zero... + if (!xd[0] || !yd[0]) { + + // Return y negated if x is zero and y is non-zero. + if (yd[0]) y.s = -y.s; + + // Return x if y is zero and x is non-zero. + else if (xd[0]) y = new Ctor(x); + + // Return zero if both are zero. + // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity. + else return new Ctor(rm === 3 ? -0 : 0); + + return external ? finalise(y, pr, rm) : y; + } + + // x and y are finite, non-zero numbers with the same sign. + + // Calculate base 1e7 exponents. + e = mathfloor(y.e / LOG_BASE); + xe = mathfloor(x.e / LOG_BASE); + + xd = xd.slice(); + k = xe - e; + + // If base 1e7 exponents differ... + if (k) { + xLTy = k < 0; + + if (xLTy) { + d = xd; + k = -k; + len = yd.length; + } else { + d = yd; + e = xe; + len = xd.length; + } + + // Numbers with massively different exponents would result in a very high number of + // zeros needing to be prepended, but this can be avoided while still ensuring correct + // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`. + i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2; + + if (k > i) { + k = i; + d.length = 1; + } + + // Prepend zeros to equalise exponents. + d.reverse(); + for (i = k; i--;) d.push(0); + d.reverse(); + + // Base 1e7 exponents equal. + } else { + + // Check digits to determine which is the bigger number. + + i = xd.length; + len = yd.length; + xLTy = i < len; + if (xLTy) len = i; + + for (i = 0; i < len; i++) { + if (xd[i] != yd[i]) { + xLTy = xd[i] < yd[i]; + break; + } + } + + k = 0; + } + + if (xLTy) { + d = xd; + xd = yd; + yd = d; + y.s = -y.s; + } + + len = xd.length; + + // Append zeros to `xd` if shorter. + // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length. + for (i = yd.length - len; i > 0; --i) xd[len++] = 0; + + // Subtract yd from xd. + for (i = yd.length; i > k;) { + + if (xd[--i] < yd[i]) { + for (j = i; j && xd[--j] === 0;) xd[j] = BASE - 1; + --xd[j]; + xd[i] += BASE; + } + + xd[i] -= yd[i]; + } + + // Remove trailing zeros. + for (; xd[--len] === 0;) xd.pop(); + + // Remove leading zeros and adjust exponent accordingly. + for (; xd[0] === 0; xd.shift()) --e; + + // Zero? + if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0); + + y.d = xd; + y.e = getBase10Exponent(xd, e); + + return external ? finalise(y, pr, rm) : y; + }; + + + /* + * n % 0 = N + * n % N = N + * n % I = n + * 0 % n = 0 + * -0 % n = -0 + * 0 % 0 = N + * 0 % N = N + * 0 % I = 0 + * N % n = N + * N % 0 = N + * N % N = N + * N % I = N + * I % n = N + * I % 0 = N + * I % N = N + * I % I = N + * + * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to + * `precision` significant digits using rounding mode `rounding`. + * + * The result depends on the modulo mode. + * + */ + P.modulo = P.mod = function (y) { + var q, + x = this, + Ctor = x.constructor; + + y = new Ctor(y); + + // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0. + if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN); + + // Return x if y is ±Infinity or x is ±0. + if (!y.d || x.d && !x.d[0]) { + return finalise(new Ctor(x), Ctor.precision, Ctor.rounding); + } + + // Prevent rounding of intermediate calculations. + external = false; + + if (Ctor.modulo == 9) { + + // Euclidian division: q = sign(y) * floor(x / abs(y)) + // result = x - q * y where 0 <= result < abs(y) + q = divide(x, y.abs(), 0, 3, 1); + q.s *= y.s; + } else { + q = divide(x, y, 0, Ctor.modulo, 1); + } + + q = q.times(y); + + external = true; + + return x.minus(q); + }; + + + /* + * Return a new Decimal whose value is the natural exponential of the value of this Decimal, + * i.e. the base e raised to the power the value of this Decimal, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + */ + P.naturalExponential = P.exp = function () { + return naturalExponential(this); + }; + + + /* + * Return a new Decimal whose value is the natural logarithm of the value of this Decimal, + * rounded to `precision` significant digits using rounding mode `rounding`. + * + */ + P.naturalLogarithm = P.ln = function () { + return naturalLogarithm(this); + }; + + + /* + * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by + * -1. + * + */ + P.negated = P.neg = function () { + var x = new this.constructor(this); + x.s = -x.s; + return finalise(x); + }; + + + /* + * n + 0 = n + * n + N = N + * n + I = I + * 0 + n = n + * 0 + 0 = 0 + * 0 + N = N + * 0 + I = I + * N + n = N + * N + 0 = N + * N + N = N + * N + I = N + * I + n = I + * I + 0 = I + * I + N = N + * I + I = I + * + * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + */ + P.plus = P.add = function (y) { + var carry, d, e, i, k, len, pr, rm, xd, yd, + x = this, + Ctor = x.constructor; + + y = new Ctor(y); + + // If either is not finite... + if (!x.d || !y.d) { + + // Return NaN if either is NaN. + if (!x.s || !y.s) y = new Ctor(NaN); + + // Return x if y is finite and x is ±Infinity. + // Return x if both are ±Infinity with the same sign. + // Return NaN if both are ±Infinity with different signs. + // Return y if x is finite and y is ±Infinity. + else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN); + + return y; + } + + // If signs differ... + if (x.s != y.s) { + y.s = -y.s; + return x.minus(y); + } + + xd = x.d; + yd = y.d; + pr = Ctor.precision; + rm = Ctor.rounding; + + // If either is zero... + if (!xd[0] || !yd[0]) { + + // Return x if y is zero. + // Return y if y is non-zero. + if (!yd[0]) y = new Ctor(x); + + return external ? finalise(y, pr, rm) : y; + } + + // x and y are finite, non-zero numbers with the same sign. + + // Calculate base 1e7 exponents. + k = mathfloor(x.e / LOG_BASE); + e = mathfloor(y.e / LOG_BASE); + + xd = xd.slice(); + i = k - e; + + // If base 1e7 exponents differ... + if (i) { + + if (i < 0) { + d = xd; + i = -i; + len = yd.length; + } else { + d = yd; + e = k; + len = xd.length; + } + + // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1. + k = Math.ceil(pr / LOG_BASE); + len = k > len ? k + 1 : len + 1; + + if (i > len) { + i = len; + d.length = 1; + } + + // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts. + d.reverse(); + for (; i--;) d.push(0); + d.reverse(); + } + + len = xd.length; + i = yd.length; + + // If yd is longer than xd, swap xd and yd so xd points to the longer array. + if (len - i < 0) { + i = len; + d = yd; + yd = xd; + xd = d; + } + + // Only start adding at yd.length - 1 as the further digits of xd can be left as they are. + for (carry = 0; i;) { + carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0; + xd[i] %= BASE; + } + + if (carry) { + xd.unshift(carry); + ++e; + } + + // Remove trailing zeros. + // No need to check for zero, as +x + +y != 0 && -x + -y != 0 + for (len = xd.length; xd[--len] == 0;) xd.pop(); + + y.d = xd; + y.e = getBase10Exponent(xd, e); + + return external ? finalise(y, pr, rm) : y; + }; + + + /* + * Return the number of significant digits of the value of this Decimal. + * + * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0. + * + */ + P.precision = P.sd = function (z) { + var k, + x = this; + + if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z); + + if (x.d) { + k = getPrecision(x.d); + if (z && x.e + 1 > k) k = x.e + 1; + } else { + k = NaN; + } + + return k; + }; + + + /* + * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using + * rounding mode `rounding`. + * + */ + P.round = function () { + var x = this, + Ctor = x.constructor; + + return finalise(new Ctor(x), x.e + 1, Ctor.rounding); + }; + + + /* + * Return a new Decimal whose value is the sine of the value in radians of this Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [-1, 1] + * + * sin(x) = x - x^3/3! + x^5/5! - ... + * + * sin(0) = 0 + * sin(-0) = -0 + * sin(Infinity) = NaN + * sin(-Infinity) = NaN + * sin(NaN) = NaN + * + */ + P.sine = P.sin = function () { + var pr, rm, + x = this, + Ctor = x.constructor; + + if (!x.isFinite()) return new Ctor(NaN); + if (x.isZero()) return new Ctor(x); + + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE; + Ctor.rounding = 1; + + x = sine(Ctor, toLessThanHalfPi(Ctor, x)); + + Ctor.precision = pr; + Ctor.rounding = rm; + + return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true); + }; + + + /* + * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * sqrt(-n) = N + * sqrt(N) = N + * sqrt(-I) = N + * sqrt(I) = I + * sqrt(0) = 0 + * sqrt(-0) = -0 + * + */ + P.squareRoot = P.sqrt = function () { + var m, n, sd, r, rep, t, + x = this, + d = x.d, + e = x.e, + s = x.s, + Ctor = x.constructor; + + // Negative/NaN/Infinity/zero? + if (s !== 1 || !d || !d[0]) { + return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0); + } + + external = false; + + // Initial estimate. + s = Math.sqrt(+x); + + // Math.sqrt underflow/overflow? + // Pass x to Math.sqrt as integer, then adjust the exponent of the result. + if (s == 0 || s == 1 / 0) { + n = digitsToString(d); + + if ((n.length + e) % 2 == 0) n += '0'; + s = Math.sqrt(n); + e = mathfloor((e + 1) / 2) - (e < 0 || e % 2); + + if (s == 1 / 0) { + n = '5e' + e; + } else { + n = s.toExponential(); + n = n.slice(0, n.indexOf('e') + 1) + e; + } + + r = new Ctor(n); + } else { + r = new Ctor(s.toString()); + } + + sd = (e = Ctor.precision) + 3; + + // Newton-Raphson iteration. + for (;;) { + t = r; + r = t.plus(divide(x, t, sd + 2, 1)).times(0.5); + + // TODO? Replace with for-loop and checkRoundingDigits. + if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) { + n = n.slice(sd - 3, sd + 1); + + // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or + // 4999, i.e. approaching a rounding boundary, continue the iteration. + if (n == '9999' || !rep && n == '4999') { + + // On the first iteration only, check to see if rounding up gives the exact result as the + // nines may infinitely repeat. + if (!rep) { + finalise(t, e + 1, 0); + + if (t.times(t).eq(x)) { + r = t; + break; + } + } + + sd += 4; + rep = 1; + } else { + + // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result. + // If not, then there are further digits and m will be truthy. + if (!+n || !+n.slice(1) && n.charAt(0) == '5') { + + // Truncate to the first rounding digit. + finalise(r, e + 1, 1); + m = !r.times(r).eq(x); + } + + break; + } + } + } + + external = true; + + return finalise(r, e, Ctor.rounding, m); + }; + + + /* + * Return a new Decimal whose value is the tangent of the value in radians of this Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [-Infinity, Infinity] + * + * tan(0) = 0 + * tan(-0) = -0 + * tan(Infinity) = NaN + * tan(-Infinity) = NaN + * tan(NaN) = NaN + * + */ + P.tangent = P.tan = function () { + var pr, rm, + x = this, + Ctor = x.constructor; + + if (!x.isFinite()) return new Ctor(NaN); + if (x.isZero()) return new Ctor(x); + + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + 10; + Ctor.rounding = 1; + + x = x.sin(); + x.s = 1; + x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0); + + Ctor.precision = pr; + Ctor.rounding = rm; + + return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true); + }; + + + /* + * n * 0 = 0 + * n * N = N + * n * I = I + * 0 * n = 0 + * 0 * 0 = 0 + * 0 * N = N + * 0 * I = N + * N * n = N + * N * 0 = N + * N * N = N + * N * I = N + * I * n = I + * I * 0 = N + * I * N = N + * I * I = I + * + * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant + * digits using rounding mode `rounding`. + * + */ + P.times = P.mul = function (y) { + var carry, e, i, k, r, rL, t, xdL, ydL, + x = this, + Ctor = x.constructor, + xd = x.d, + yd = (y = new Ctor(y)).d; + + y.s *= x.s; + + // If either is NaN, ±Infinity or ±0... + if (!xd || !xd[0] || !yd || !yd[0]) { + + return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd + + // Return NaN if either is NaN. + // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity. + ? NaN + + // Return ±Infinity if either is ±Infinity. + // Return ±0 if either is ±0. + : !xd || !yd ? y.s / 0 : y.s * 0); + } + + e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE); + xdL = xd.length; + ydL = yd.length; + + // Ensure xd points to the longer array. + if (xdL < ydL) { + r = xd; + xd = yd; + yd = r; + rL = xdL; + xdL = ydL; + ydL = rL; + } + + // Initialise the result array with zeros. + r = []; + rL = xdL + ydL; + for (i = rL; i--;) r.push(0); + + // Multiply! + for (i = ydL; --i >= 0;) { + carry = 0; + for (k = xdL + i; k > i;) { + t = r[k] + yd[i] * xd[k - i - 1] + carry; + r[k--] = t % BASE | 0; + carry = t / BASE | 0; + } + + r[k] = (r[k] + carry) % BASE | 0; + } + + // Remove trailing zeros. + for (; !r[--rL];) r.pop(); + + if (carry) ++e; + else r.shift(); + + y.d = r; + y.e = getBase10Exponent(r, e); + + return external ? finalise(y, Ctor.precision, Ctor.rounding) : y; + }; + + + /* + * Return a string representing the value of this Decimal in base 2, round to `sd` significant + * digits using rounding mode `rm`. + * + * If the optional `sd` argument is present then return binary exponential notation. + * + * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + */ + P.toBinary = function (sd, rm) { + return toStringBinary(this, 2, sd, rm); + }; + + + /* + * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp` + * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted. + * + * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal. + * + * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + */ + P.toDecimalPlaces = P.toDP = function (dp, rm) { + var x = this, + Ctor = x.constructor; + + x = new Ctor(x); + if (dp === void 0) return x; + + checkInt32(dp, 0, MAX_DIGITS); + + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + + return finalise(x, dp + x.e + 1, rm); + }; + + + /* + * Return a string representing the value of this Decimal in exponential notation rounded to + * `dp` fixed decimal places using rounding mode `rounding`. + * + * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + */ + P.toExponential = function (dp, rm) { + var str, + x = this, + Ctor = x.constructor; + + if (dp === void 0) { + str = finiteToString(x, true); + } else { + checkInt32(dp, 0, MAX_DIGITS); + + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + + x = finalise(new Ctor(x), dp + 1, rm); + str = finiteToString(x, true, dp + 1); + } + + return x.isNeg() && !x.isZero() ? '-' + str : str; + }; + + + /* + * Return a string representing the value of this Decimal in normal (fixed-point) notation to + * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is + * omitted. + * + * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'. + * + * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'. + * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'. + * (-0).toFixed(3) is '0.000'. + * (-0.5).toFixed(0) is '-0'. + * + */ + P.toFixed = function (dp, rm) { + var str, y, + x = this, + Ctor = x.constructor; + + if (dp === void 0) { + str = finiteToString(x); + } else { + checkInt32(dp, 0, MAX_DIGITS); + + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + + y = finalise(new Ctor(x), dp + x.e + 1, rm); + str = finiteToString(y, false, dp + y.e + 1); + } + + // To determine whether to add the minus sign look at the value before it was rounded, + // i.e. look at `x` rather than `y`. + return x.isNeg() && !x.isZero() ? '-' + str : str; + }; + + + /* + * Return an array representing the value of this Decimal as a simple fraction with an integer + * numerator and an integer denominator. + * + * The denominator will be a positive non-zero value less than or equal to the specified maximum + * denominator. If a maximum denominator is not specified, the denominator will be the lowest + * value necessary to represent the number exactly. + * + * [maxD] {number|string|bigint|Decimal} Maximum denominator. Integer >= 1 and < Infinity. + * + */ + P.toFraction = function (maxD) { + var d, d0, d1, d2, e, k, n, n0, n1, pr, q, r, + x = this, + xd = x.d, + Ctor = x.constructor; + + if (!xd) return new Ctor(x); + + n1 = d0 = new Ctor(1); + d1 = n0 = new Ctor(0); + + d = new Ctor(d1); + e = d.e = getPrecision(xd) - x.e - 1; + k = e % LOG_BASE; + d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k); + + if (maxD == null) { + + // d is 10**e, the minimum max-denominator needed. + maxD = e > 0 ? d : n1; + } else { + n = new Ctor(maxD); + if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n); + maxD = n.gt(d) ? (e > 0 ? d : n1) : n; + } + + external = false; + n = new Ctor(digitsToString(xd)); + pr = Ctor.precision; + Ctor.precision = e = xd.length * LOG_BASE * 2; + + for (;;) { + q = divide(n, d, 0, 1, 1); + d2 = d0.plus(q.times(d1)); + if (d2.cmp(maxD) == 1) break; + d0 = d1; + d1 = d2; + d2 = n1; + n1 = n0.plus(q.times(d2)); + n0 = d2; + d2 = d; + d = n.minus(q.times(d2)); + n = d2; + } + + d2 = divide(maxD.minus(d0), d1, 0, 1, 1); + n0 = n0.plus(d2.times(n1)); + d0 = d0.plus(d2.times(d1)); + n0.s = n1.s = x.s; + + // Determine which fraction is closer to x, n0/d0 or n1/d1? + r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1 + ? [n1, d1] : [n0, d0]; + + Ctor.precision = pr; + external = true; + + return r; + }; + + + /* + * Return a string representing the value of this Decimal in base 16, round to `sd` significant + * digits using rounding mode `rm`. + * + * If the optional `sd` argument is present then return binary exponential notation. + * + * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + */ + P.toHexadecimal = P.toHex = function (sd, rm) { + return toStringBinary(this, 16, sd, rm); + }; + + + /* + * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding + * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal. + * + * The return value will always have the same sign as this Decimal, unless either this Decimal + * or `y` is NaN, in which case the return value will be also be NaN. + * + * The return value is not affected by the value of `precision`. + * + * y {number|string|bigint|Decimal} The magnitude to round to a multiple of. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * 'toNearest() rounding mode not an integer: {rm}' + * 'toNearest() rounding mode out of range: {rm}' + * + */ + P.toNearest = function (y, rm) { + var x = this, + Ctor = x.constructor; + + x = new Ctor(x); + + if (y == null) { + + // If x is not finite, return x. + if (!x.d) return x; + + y = new Ctor(1); + rm = Ctor.rounding; + } else { + y = new Ctor(y); + if (rm === void 0) { + rm = Ctor.rounding; + } else { + checkInt32(rm, 0, 8); + } + + // If x is not finite, return x if y is not NaN, else NaN. + if (!x.d) return y.s ? x : y; + + // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN. + if (!y.d) { + if (y.s) y.s = x.s; + return y; + } + } + + // If y is not zero, calculate the nearest multiple of y to x. + if (y.d[0]) { + external = false; + x = divide(x, y, 0, rm, 1).times(y); + external = true; + finalise(x); + + // If y is zero, return zero with the sign of x. + } else { + y.s = x.s; + x = y; + } + + return x; + }; + + + /* + * Return the value of this Decimal converted to a number primitive. + * Zero keeps its sign. + * + */ + P.toNumber = function () { + return +this; + }; + + + /* + * Return a string representing the value of this Decimal in base 8, round to `sd` significant + * digits using rounding mode `rm`. + * + * If the optional `sd` argument is present then return binary exponential notation. + * + * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + */ + P.toOctal = function (sd, rm) { + return toStringBinary(this, 8, sd, rm); + }; + + + /* + * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded + * to `precision` significant digits using rounding mode `rounding`. + * + * ECMAScript compliant. + * + * pow(x, NaN) = NaN + * pow(x, ±0) = 1 + + * pow(NaN, non-zero) = NaN + * pow(abs(x) > 1, +Infinity) = +Infinity + * pow(abs(x) > 1, -Infinity) = +0 + * pow(abs(x) == 1, ±Infinity) = NaN + * pow(abs(x) < 1, +Infinity) = +0 + * pow(abs(x) < 1, -Infinity) = +Infinity + * pow(+Infinity, y > 0) = +Infinity + * pow(+Infinity, y < 0) = +0 + * pow(-Infinity, odd integer > 0) = -Infinity + * pow(-Infinity, even integer > 0) = +Infinity + * pow(-Infinity, odd integer < 0) = -0 + * pow(-Infinity, even integer < 0) = +0 + * pow(+0, y > 0) = +0 + * pow(+0, y < 0) = +Infinity + * pow(-0, odd integer > 0) = -0 + * pow(-0, even integer > 0) = +0 + * pow(-0, odd integer < 0) = -Infinity + * pow(-0, even integer < 0) = +Infinity + * pow(finite x < 0, finite non-integer) = NaN + * + * For non-integer or very large exponents pow(x, y) is calculated using + * + * x^y = exp(y*ln(x)) + * + * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the + * probability of an incorrectly rounded result + * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14 + * i.e. 1 in 250,000,000,000,000 + * + * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place). + * + * y {number|string|bigint|Decimal} The power to which to raise this Decimal. + * + */ + P.toPower = P.pow = function (y) { + var e, k, pr, r, rm, s, + x = this, + Ctor = x.constructor, + yn = +(y = new Ctor(y)); + + // Either ±Infinity, NaN or ±0? + if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn)); + + x = new Ctor(x); + + if (x.eq(1)) return x; + + pr = Ctor.precision; + rm = Ctor.rounding; + + if (y.eq(1)) return finalise(x, pr, rm); + + // y exponent + e = mathfloor(y.e / LOG_BASE); + + // If y is a small integer use the 'exponentiation by squaring' algorithm. + if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) { + r = intPow(Ctor, x, k, pr); + return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm); + } + + s = x.s; + + // if x is negative + if (s < 0) { + + // if y is not an integer + if (e < y.d.length - 1) return new Ctor(NaN); + + // Result is positive if x is negative and the last digit of integer y is even. + if ((y.d[e] & 1) == 0) s = 1; + + // if x.eq(-1) + if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) { + x.s = s; + return x; + } + } + + // Estimate result exponent. + // x^y = 10^e, where e = y * log10(x) + // log10(x) = log10(x_significand) + x_exponent + // log10(x_significand) = ln(x_significand) / ln(10) + k = mathpow(+x, yn); + e = k == 0 || !isFinite(k) + ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1)) + : new Ctor(k + '').e; + + // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1. + + // Overflow/underflow? + if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0); + + external = false; + Ctor.rounding = x.s = 1; + + // Estimate the extra guard digits needed to ensure five correct rounding digits from + // naturalLogarithm(x). Example of failure without these extra digits (precision: 10): + // new Decimal(2.32456).pow('2087987436534566.46411') + // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815 + k = Math.min(12, (e + '').length); + + // r = x^y = exp(y*ln(x)) + r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr); + + // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40) + if (r.d) { + + // Truncate to the required precision plus five rounding digits. + r = finalise(r, pr + 5, 1); + + // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate + // the result. + if (checkRoundingDigits(r.d, pr, rm)) { + e = pr + 10; + + // Truncate to the increased precision plus five rounding digits. + r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1); + + // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9). + if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) { + r = finalise(r, pr + 1, 0); + } + } + } + + r.s = s; + external = true; + Ctor.rounding = rm; + + return finalise(r, pr, rm); + }; + + + /* + * Return a string representing the value of this Decimal rounded to `sd` significant digits + * using rounding mode `rounding`. + * + * Return exponential notation if `sd` is less than the number of digits necessary to represent + * the integer part of the value in normal notation. + * + * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + */ + P.toPrecision = function (sd, rm) { + var str, + x = this, + Ctor = x.constructor; + + if (sd === void 0) { + str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); + } else { + checkInt32(sd, 1, MAX_DIGITS); + + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + + x = finalise(new Ctor(x), sd, rm); + str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd); + } + + return x.isNeg() && !x.isZero() ? '-' + str : str; + }; + + + /* + * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd` + * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if + * omitted. + * + * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * 'toSD() digits out of range: {sd}' + * 'toSD() digits not an integer: {sd}' + * 'toSD() rounding mode not an integer: {rm}' + * 'toSD() rounding mode out of range: {rm}' + * + */ + P.toSignificantDigits = P.toSD = function (sd, rm) { + var x = this, + Ctor = x.constructor; + + if (sd === void 0) { + sd = Ctor.precision; + rm = Ctor.rounding; + } else { + checkInt32(sd, 1, MAX_DIGITS); + + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + } + + return finalise(new Ctor(x), sd, rm); + }; + + + /* + * Return a string representing the value of this Decimal. + * + * Return exponential notation if this Decimal has a positive exponent equal to or greater than + * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`. + * + */ + P.toString = function () { + var x = this, + Ctor = x.constructor, + str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); + + return x.isNeg() && !x.isZero() ? '-' + str : str; + }; + + + /* + * Return a new Decimal whose value is the value of this Decimal truncated to a whole number. + * + */ + P.truncated = P.trunc = function () { + return finalise(new this.constructor(this), this.e + 1, 1); + }; + + + /* + * Return a string representing the value of this Decimal. + * Unlike `toString`, negative zero will include the minus sign. + * + */ + P.valueOf = P.toJSON = function () { + var x = this, + Ctor = x.constructor, + str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); + + return x.isNeg() ? '-' + str : str; + }; + + + // Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers. + + + /* + * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower, + * finiteToString, naturalExponential, naturalLogarithm + * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest, + * P.toPrecision, P.toSignificantDigits, toStringBinary, random + * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm + * convertBase toStringBinary, parseOther + * cos P.cos + * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy, + * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction, + * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm, + * taylorSeries, atan2, parseOther + * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh, + * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus, + * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot, + * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed, + * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits, + * P.truncated, divide, getLn10, getPi, naturalExponential, + * naturalLogarithm, ceil, floor, round, trunc + * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf, + * toStringBinary + * getBase10Exponent P.minus, P.plus, P.times, parseOther + * getLn10 P.logarithm, naturalLogarithm + * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2 + * getPrecision P.precision, P.toFraction + * getZeroString digitsToString, finiteToString + * intPow P.toPower, parseOther + * isOdd toLessThanHalfPi + * maxOrMin max, min + * naturalExponential P.naturalExponential, P.toPower + * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm, + * P.toPower, naturalExponential + * nonFiniteToString finiteToString, toStringBinary + * parseDecimal Decimal + * parseOther Decimal + * sin P.sin + * taylorSeries P.cosh, P.sinh, cos, sin + * toLessThanHalfPi P.cos, P.sin + * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal + * truncate intPow + * + * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi, + * naturalLogarithm, config, parseOther, random, Decimal + */ + + + function digitsToString(d) { + var i, k, ws, + indexOfLastWord = d.length - 1, + str = '', + w = d[0]; + + if (indexOfLastWord > 0) { + str += w; + for (i = 1; i < indexOfLastWord; i++) { + ws = d[i] + ''; + k = LOG_BASE - ws.length; + if (k) str += getZeroString(k); + str += ws; + } + + w = d[i]; + ws = w + ''; + k = LOG_BASE - ws.length; + if (k) str += getZeroString(k); + } else if (w === 0) { + return '0'; + } + + // Remove trailing zeros of last w. + for (; w % 10 === 0;) w /= 10; + + return str + w; + } + + + function checkInt32(i, min, max) { + if (i !== ~~i || i < min || i > max) { + throw Error(invalidArgument + i); + } + } + + + /* + * Check 5 rounding digits if `repeating` is null, 4 otherwise. + * `repeating == null` if caller is `log` or `pow`, + * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`. + */ + function checkRoundingDigits(d, i, rm, repeating) { + var di, k, r, rd; + + // Get the length of the first word of the array d. + for (k = d[0]; k >= 10; k /= 10) --i; + + // Is the rounding digit in the first word of d? + if (--i < 0) { + i += LOG_BASE; + di = 0; + } else { + di = Math.ceil((i + 1) / LOG_BASE); + i %= LOG_BASE; + } + + // i is the index (0 - 6) of the rounding digit. + // E.g. if within the word 3487563 the first rounding digit is 5, + // then i = 4, k = 1000, rd = 3487563 % 1000 = 563 + k = mathpow(10, LOG_BASE - i); + rd = d[di] % k | 0; + + if (repeating == null) { + if (i < 3) { + if (i == 0) rd = rd / 100 | 0; + else if (i == 1) rd = rd / 10 | 0; + r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0; + } else { + r = (rm < 4 && rd + 1 == k || rm > 3 && rd + 1 == k / 2) && + (d[di + 1] / k / 100 | 0) == mathpow(10, i - 2) - 1 || + (rd == k / 2 || rd == 0) && (d[di + 1] / k / 100 | 0) == 0; + } + } else { + if (i < 4) { + if (i == 0) rd = rd / 1000 | 0; + else if (i == 1) rd = rd / 100 | 0; + else if (i == 2) rd = rd / 10 | 0; + r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999; + } else { + r = ((repeating || rm < 4) && rd + 1 == k || + (!repeating && rm > 3) && rd + 1 == k / 2) && + (d[di + 1] / k / 1000 | 0) == mathpow(10, i - 3) - 1; + } + } + + return r; + } + + + // Convert string of `baseIn` to an array of numbers of `baseOut`. + // Eg. convertBase('255', 10, 16) returns [15, 15]. + // Eg. convertBase('ff', 16, 10) returns [2, 5, 5]. + function convertBase(str, baseIn, baseOut) { + var j, + arr = [0], + arrL, + i = 0, + strL = str.length; + + for (; i < strL;) { + for (arrL = arr.length; arrL--;) arr[arrL] *= baseIn; + arr[0] += NUMERALS.indexOf(str.charAt(i++)); + for (j = 0; j < arr.length; j++) { + if (arr[j] > baseOut - 1) { + if (arr[j + 1] === void 0) arr[j + 1] = 0; + arr[j + 1] += arr[j] / baseOut | 0; + arr[j] %= baseOut; + } + } + } + + return arr.reverse(); + } + + + /* + * cos(x) = 1 - x^2/2! + x^4/4! - ... + * |x| < pi/2 + * + */ + function cosine(Ctor, x) { + var k, len, y; + + if (x.isZero()) return x; + + // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1 + // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1 + + // Estimate the optimum number of times to use the argument reduction. + len = x.d.length; + if (len < 32) { + k = Math.ceil(len / 3); + y = (1 / tinyPow(4, k)).toString(); + } else { + k = 16; + y = '2.3283064365386962890625e-10'; + } + + Ctor.precision += k; + + x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1)); + + // Reverse argument reduction + for (var i = k; i--;) { + var cos2x = x.times(x); + x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1); + } + + Ctor.precision -= k; + + return x; + } + + + /* + * Perform division in the specified base. + */ + var divide = (function () { + + // Assumes non-zero x and k, and hence non-zero result. + function multiplyInteger(x, k, base) { + var temp, + carry = 0, + i = x.length; + + for (x = x.slice(); i--;) { + temp = x[i] * k + carry; + x[i] = temp % base | 0; + carry = temp / base | 0; + } + + if (carry) x.unshift(carry); + + return x; + } + + function compare(a, b, aL, bL) { + var i, r; + + if (aL != bL) { + r = aL > bL ? 1 : -1; + } else { + for (i = r = 0; i < aL; i++) { + if (a[i] != b[i]) { + r = a[i] > b[i] ? 1 : -1; + break; + } + } + } + + return r; + } + + function subtract(a, b, aL, base) { + var i = 0; + + // Subtract b from a. + for (; aL--;) { + a[aL] -= i; + i = a[aL] < b[aL] ? 1 : 0; + a[aL] = i * base + a[aL] - b[aL]; + } + + // Remove leading zeros. + for (; !a[0] && a.length > 1;) a.shift(); + } + + return function (x, y, pr, rm, dp, base) { + var cmp, e, i, k, logBase, more, prod, prodL, q, qd, rem, remL, rem0, sd, t, xi, xL, yd0, + yL, yz, + Ctor = x.constructor, + sign = x.s == y.s ? 1 : -1, + xd = x.d, + yd = y.d; + + // Either NaN, Infinity or 0? + if (!xd || !xd[0] || !yd || !yd[0]) { + + return new Ctor(// Return NaN if either NaN, or both Infinity or 0. + !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN : + + // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0. + xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0); + } + + if (base) { + logBase = 1; + e = x.e - y.e; + } else { + base = BASE; + logBase = LOG_BASE; + e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase); + } + + yL = yd.length; + xL = xd.length; + q = new Ctor(sign); + qd = q.d = []; + + // Result exponent may be one less than e. + // The digit array of a Decimal from toStringBinary may have trailing zeros. + for (i = 0; yd[i] == (xd[i] || 0); i++); + + if (yd[i] > (xd[i] || 0)) e--; + + if (pr == null) { + sd = pr = Ctor.precision; + rm = Ctor.rounding; + } else if (dp) { + sd = pr + (x.e - y.e) + 1; + } else { + sd = pr; + } + + if (sd < 0) { + qd.push(1); + more = true; + } else { + + // Convert precision in number of base 10 digits to base 1e7 digits. + sd = sd / logBase + 2 | 0; + i = 0; + + // divisor < 1e7 + if (yL == 1) { + k = 0; + yd = yd[0]; + sd++; + + // k is the carry. + for (; (i < xL || k) && sd--; i++) { + t = k * base + (xd[i] || 0); + qd[i] = t / yd | 0; + k = t % yd | 0; + } + + more = k || i < xL; + + // divisor >= 1e7 + } else { + + // Normalise xd and yd so highest order digit of yd is >= base/2 + k = base / (yd[0] + 1) | 0; + + if (k > 1) { + yd = multiplyInteger(yd, k, base); + xd = multiplyInteger(xd, k, base); + yL = yd.length; + xL = xd.length; + } + + xi = yL; + rem = xd.slice(0, yL); + remL = rem.length; + + // Add zeros to make remainder as long as divisor. + for (; remL < yL;) rem[remL++] = 0; + + yz = yd.slice(); + yz.unshift(0); + yd0 = yd[0]; + + if (yd[1] >= base / 2) ++yd0; + + do { + k = 0; + + // Compare divisor and remainder. + cmp = compare(yd, rem, yL, remL); + + // If divisor < remainder. + if (cmp < 0) { + + // Calculate trial digit, k. + rem0 = rem[0]; + if (yL != remL) rem0 = rem0 * base + (rem[1] || 0); + + // k will be how many times the divisor goes into the current remainder. + k = rem0 / yd0 | 0; + + // Algorithm: + // 1. product = divisor * trial digit (k) + // 2. if product > remainder: product -= divisor, k-- + // 3. remainder -= product + // 4. if product was < remainder at 2: + // 5. compare new remainder and divisor + // 6. If remainder > divisor: remainder -= divisor, k++ + + if (k > 1) { + if (k >= base) k = base - 1; + + // product = divisor * trial digit. + prod = multiplyInteger(yd, k, base); + prodL = prod.length; + remL = rem.length; + + // Compare product and remainder. + cmp = compare(prod, rem, prodL, remL); + + // product > remainder. + if (cmp == 1) { + k--; + + // Subtract divisor from product. + subtract(prod, yL < prodL ? yz : yd, prodL, base); + } + } else { + + // cmp is -1. + // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1 + // to avoid it. If k is 1 there is a need to compare yd and rem again below. + if (k == 0) cmp = k = 1; + prod = yd.slice(); + } + + prodL = prod.length; + if (prodL < remL) prod.unshift(0); + + // Subtract product from remainder. + subtract(rem, prod, remL, base); + + // If product was < previous remainder. + if (cmp == -1) { + remL = rem.length; + + // Compare divisor and new remainder. + cmp = compare(yd, rem, yL, remL); + + // If divisor < new remainder, subtract divisor from remainder. + if (cmp < 1) { + k++; + + // Subtract divisor from remainder. + subtract(rem, yL < remL ? yz : yd, remL, base); + } + } + + remL = rem.length; + } else if (cmp === 0) { + k++; + rem = [0]; + } // if cmp === 1, k will be 0 + + // Add the next digit, k, to the result array. + qd[i++] = k; + + // Update the remainder. + if (cmp && rem[0]) { + rem[remL++] = xd[xi] || 0; + } else { + rem = [xd[xi]]; + remL = 1; + } + + } while ((xi++ < xL || rem[0] !== void 0) && sd--); + + more = rem[0] !== void 0; + } + + // Leading zero? + if (!qd[0]) qd.shift(); + } + + // logBase is 1 when divide is being used for base conversion. + if (logBase == 1) { + q.e = e; + inexact = more; + } else { + + // To calculate q.e, first get the number of digits of qd[0]. + for (i = 1, k = qd[0]; k >= 10; k /= 10) i++; + q.e = i + e * logBase - 1; + + finalise(q, dp ? pr + q.e + 1 : pr, rm, more); + } + + return q; + }; + })(); + + + /* + * Round `x` to `sd` significant digits using rounding mode `rm`. + * Check for over/under-flow. + */ + function finalise(x, sd, rm, isTruncated) { + var digits, i, j, k, rd, roundUp, w, xd, xdi, + Ctor = x.constructor; + + // Don't round if sd is null or undefined. + out: if (sd != null) { + xd = x.d; + + // Infinity/NaN. + if (!xd) return x; + + // rd: the rounding digit, i.e. the digit after the digit that may be rounded up. + // w: the word of xd containing rd, a base 1e7 number. + // xdi: the index of w within xd. + // digits: the number of digits of w. + // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if + // they had leading zeros) + // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero). + + // Get the length of the first word of the digits array xd. + for (digits = 1, k = xd[0]; k >= 10; k /= 10) digits++; + i = sd - digits; + + // Is the rounding digit in the first word of xd? + if (i < 0) { + i += LOG_BASE; + j = sd; + w = xd[xdi = 0]; + + // Get the rounding digit at index j of w. + rd = w / mathpow(10, digits - j - 1) % 10 | 0; + } else { + xdi = Math.ceil((i + 1) / LOG_BASE); + k = xd.length; + if (xdi >= k) { + if (isTruncated) { + + // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`. + for (; k++ <= xdi;) xd.push(0); + w = rd = 0; + digits = 1; + i %= LOG_BASE; + j = i - LOG_BASE + 1; + } else { + break out; + } + } else { + w = k = xd[xdi]; + + // Get the number of digits of w. + for (digits = 1; k >= 10; k /= 10) digits++; + + // Get the index of rd within w. + i %= LOG_BASE; + + // Get the index of rd within w, adjusted for leading zeros. + // The number of leading zeros of w is given by LOG_BASE - digits. + j = i - LOG_BASE + digits; + + // Get the rounding digit at index j of w. + rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0; + } + } + + // Are there any non-zero digits after the rounding digit? + isTruncated = isTruncated || sd < 0 || + xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1)); + + // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right + // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression + // will give 714. + + roundUp = rm < 4 + ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) + : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 && + + // Check whether the digit to the left of the rounding digit is odd. + ((i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10) & 1 || + rm == (x.s < 0 ? 8 : 7)); + + if (sd < 1 || !xd[0]) { + xd.length = 0; + if (roundUp) { + + // Convert sd to decimal places. + sd -= x.e + 1; + + // 1, 0.1, 0.01, 0.001, 0.0001 etc. + xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE); + x.e = -sd || 0; + } else { + + // Zero. + xd[0] = x.e = 0; + } + + return x; + } + + // Remove excess digits. + if (i == 0) { + xd.length = xdi; + k = 1; + xdi--; + } else { + xd.length = xdi + 1; + k = mathpow(10, LOG_BASE - i); + + // E.g. 56700 becomes 56000 if 7 is the rounding digit. + // j > 0 means i > number of leading zeros of w. + xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0; + } + + if (roundUp) { + for (;;) { + + // Is the digit to be rounded up in the first word of xd? + if (xdi == 0) { + + // i will be the length of xd[0] before k is added. + for (i = 1, j = xd[0]; j >= 10; j /= 10) i++; + j = xd[0] += k; + for (k = 1; j >= 10; j /= 10) k++; + + // if i != k the length has increased. + if (i != k) { + x.e++; + if (xd[0] == BASE) xd[0] = 1; + } + + break; + } else { + xd[xdi] += k; + if (xd[xdi] != BASE) break; + xd[xdi--] = 0; + k = 1; + } + } + } + + // Remove trailing zeros. + for (i = xd.length; xd[--i] === 0;) xd.pop(); + } + + if (external) { + + // Overflow? + if (x.e > Ctor.maxE) { + + // Infinity. + x.d = null; + x.e = NaN; + + // Underflow? + } else if (x.e < Ctor.minE) { + + // Zero. + x.e = 0; + x.d = [0]; + // Ctor.underflow = true; + } // else Ctor.underflow = false; + } + + return x; + } + + + function finiteToString(x, isExp, sd) { + if (!x.isFinite()) return nonFiniteToString(x); + var k, + e = x.e, + str = digitsToString(x.d), + len = str.length; + + if (isExp) { + if (sd && (k = sd - len) > 0) { + str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k); + } else if (len > 1) { + str = str.charAt(0) + '.' + str.slice(1); + } + + str = str + (x.e < 0 ? 'e' : 'e+') + x.e; + } else if (e < 0) { + str = '0.' + getZeroString(-e - 1) + str; + if (sd && (k = sd - len) > 0) str += getZeroString(k); + } else if (e >= len) { + str += getZeroString(e + 1 - len); + if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k); + } else { + if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k); + if (sd && (k = sd - len) > 0) { + if (e + 1 === len) str += '.'; + str += getZeroString(k); + } + } + + return str; + } + + + // Calculate the base 10 exponent from the base 1e7 exponent. + function getBase10Exponent(digits, e) { + var w = digits[0]; + + // Add the number of digits of the first word of the digits array. + for ( e *= LOG_BASE; w >= 10; w /= 10) e++; + return e; + } + + + function getLn10(Ctor, sd, pr) { + if (sd > LN10_PRECISION) { + + // Reset global state in case the exception is caught. + external = true; + if (pr) Ctor.precision = pr; + throw Error(precisionLimitExceeded); + } + return finalise(new Ctor(LN10), sd, 1, true); + } + + + function getPi(Ctor, sd, rm) { + if (sd > PI_PRECISION) throw Error(precisionLimitExceeded); + return finalise(new Ctor(PI), sd, rm, true); + } + + + function getPrecision(digits) { + var w = digits.length - 1, + len = w * LOG_BASE + 1; + + w = digits[w]; + + // If non-zero... + if (w) { + + // Subtract the number of trailing zeros of the last word. + for (; w % 10 == 0; w /= 10) len--; + + // Add the number of digits of the first word. + for (w = digits[0]; w >= 10; w /= 10) len++; + } + + return len; + } + + + function getZeroString(k) { + var zs = ''; + for (; k--;) zs += '0'; + return zs; + } + + + /* + * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an + * integer of type number. + * + * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`. + * + */ + function intPow(Ctor, x, n, pr) { + var isTruncated, + r = new Ctor(1), + + // Max n of 9007199254740991 takes 53 loop iterations. + // Maximum digits array length; leaves [28, 34] guard digits. + k = Math.ceil(pr / LOG_BASE + 4); + + external = false; + + for (;;) { + if (n % 2) { + r = r.times(x); + if (truncate(r.d, k)) isTruncated = true; + } + + n = mathfloor(n / 2); + if (n === 0) { + + // To ensure correct rounding when r.d is truncated, increment the last word if it is zero. + n = r.d.length - 1; + if (isTruncated && r.d[n] === 0) ++r.d[n]; + break; + } + + x = x.times(x); + truncate(x.d, k); + } + + external = true; + + return r; + } + + + function isOdd(n) { + return n.d[n.d.length - 1] & 1; + } + + + /* + * Handle `max` (`n` is -1) and `min` (`n` is 1). + */ + function maxOrMin(Ctor, args, n) { + var k, y, + x = new Ctor(args[0]), + i = 0; + + for (; ++i < args.length;) { + y = new Ctor(args[i]); + + // NaN? + if (!y.s) { + x = y; + break; + } + + k = x.cmp(y); + + if (k === n || k === 0 && x.s === n) { + x = y; + } + } + + return x; + } + + + /* + * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant + * digits. + * + * Taylor/Maclaurin series. + * + * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ... + * + * Argument reduction: + * Repeat x = x / 32, k += 5, until |x| < 0.1 + * exp(x) = exp(x / 2^k)^(2^k) + * + * Previously, the argument was initially reduced by + * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10) + * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was + * found to be slower than just dividing repeatedly by 32 as above. + * + * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000 + * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000 + * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324) + * + * exp(Infinity) = Infinity + * exp(-Infinity) = 0 + * exp(NaN) = NaN + * exp(±0) = 1 + * + * exp(x) is non-terminating for any finite, non-zero x. + * + * The result will always be correctly rounded. + * + */ + function naturalExponential(x, sd) { + var denominator, guard, j, pow, sum, t, wpr, + rep = 0, + i = 0, + k = 0, + Ctor = x.constructor, + rm = Ctor.rounding, + pr = Ctor.precision; + + // 0/NaN/Infinity? + if (!x.d || !x.d[0] || x.e > 17) { + + return new Ctor(x.d + ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0 + : x.s ? x.s < 0 ? 0 : x : 0 / 0); + } + + if (sd == null) { + external = false; + wpr = pr; + } else { + wpr = sd; + } + + t = new Ctor(0.03125); + + // while abs(x) >= 0.1 + while (x.e > -2) { + + // x = x / 2^5 + x = x.times(t); + k += 5; + } + + // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision + // necessary to ensure the first 4 rounding digits are correct. + guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0; + wpr += guard; + denominator = pow = sum = new Ctor(1); + Ctor.precision = wpr; + + for (;;) { + pow = finalise(pow.times(x), wpr, 1); + denominator = denominator.times(++i); + t = sum.plus(divide(pow, denominator, wpr, 1)); + + if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) { + j = k; + while (j--) sum = finalise(sum.times(sum), wpr, 1); + + // Check to see if the first 4 rounding digits are [49]999. + // If so, repeat the summation with a higher precision, otherwise + // e.g. with precision: 18, rounding: 1 + // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123) + // `wpr - guard` is the index of first rounding digit. + if (sd == null) { + + if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) { + Ctor.precision = wpr += 10; + denominator = pow = t = new Ctor(1); + i = 0; + rep++; + } else { + return finalise(sum, Ctor.precision = pr, rm, external = true); + } + } else { + Ctor.precision = pr; + return sum; + } + } + + sum = t; + } + } + + + /* + * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant + * digits. + * + * ln(-n) = NaN + * ln(0) = -Infinity + * ln(-0) = -Infinity + * ln(1) = 0 + * ln(Infinity) = Infinity + * ln(-Infinity) = NaN + * ln(NaN) = NaN + * + * ln(n) (n != 1) is non-terminating. + * + */ + function naturalLogarithm(y, sd) { + var c, c0, denominator, e, numerator, rep, sum, t, wpr, x1, x2, + n = 1, + guard = 10, + x = y, + xd = x.d, + Ctor = x.constructor, + rm = Ctor.rounding, + pr = Ctor.precision; + + // Is x negative or Infinity, NaN, 0 or 1? + if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) { + return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x); + } + + if (sd == null) { + external = false; + wpr = pr; + } else { + wpr = sd; + } + + Ctor.precision = wpr += guard; + c = digitsToString(xd); + c0 = c.charAt(0); + + if (Math.abs(e = x.e) < 1.5e15) { + + // Argument reduction. + // The series converges faster the closer the argument is to 1, so using + // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b + // multiply the argument by itself until the leading digits of the significand are 7, 8, 9, + // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can + // later be divided by this number, then separate out the power of 10 using + // ln(a*10^b) = ln(a) + b*ln(10). + + // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14). + //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) { + // max n is 6 (gives 0.7 - 1.3) + while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) { + x = x.times(y); + c = digitsToString(x.d); + c0 = c.charAt(0); + n++; + } + + e = x.e; + + if (c0 > 1) { + x = new Ctor('0.' + c); + e++; + } else { + x = new Ctor(c0 + '.' + c.slice(1)); + } + } else { + + // The argument reduction method above may result in overflow if the argument y is a massive + // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this + // function using ln(x*10^e) = ln(x) + e*ln(10). + t = getLn10(Ctor, wpr + 2, pr).times(e + ''); + x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t); + Ctor.precision = pr; + + return sd == null ? finalise(x, pr, rm, external = true) : x; + } + + // x1 is x reduced to a value near 1. + x1 = x; + + // Taylor series. + // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...) + // where x = (y - 1)/(y + 1) (|x| < 1) + sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1); + x2 = finalise(x.times(x), wpr, 1); + denominator = 3; + + for (;;) { + numerator = finalise(numerator.times(x2), wpr, 1); + t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1)); + + if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) { + sum = sum.times(2); + + // Reverse the argument reduction. Check that e is not 0 because, besides preventing an + // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0. + if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + '')); + sum = divide(sum, new Ctor(n), wpr, 1); + + // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has + // been repeated previously) and the first 4 rounding digits 9999? + // If so, restart the summation with a higher precision, otherwise + // e.g. with precision: 12, rounding: 1 + // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463. + // `wpr - guard` is the index of first rounding digit. + if (sd == null) { + if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) { + Ctor.precision = wpr += guard; + t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1); + x2 = finalise(x.times(x), wpr, 1); + denominator = rep = 1; + } else { + return finalise(sum, Ctor.precision = pr, rm, external = true); + } + } else { + Ctor.precision = pr; + return sum; + } + } + + sum = t; + denominator += 2; + } + } + + + // ±Infinity, NaN. + function nonFiniteToString(x) { + // Unsigned. + return String(x.s * x.s / 0); + } + + + /* + * Parse the value of a new Decimal `x` from string `str`. + */ + function parseDecimal(x, str) { + var e, i, len; + + // TODO BigInt str: no need to check for decimal point, exponential form or leading zeros. + + // Decimal point? + if ((e = str.indexOf('.')) > -1) str = str.replace('.', ''); + + // Exponential form? + if ((i = str.search(/e/i)) > 0) { + + // Determine exponent. + if (e < 0) e = i; + e += +str.slice(i + 1); + str = str.substring(0, i); + } else if (e < 0) { + + // Integer. + e = str.length; + } + + // Determine leading zeros. + for (i = 0; str.charCodeAt(i) === 48; i++); + + // Determine trailing zeros. + for (len = str.length; str.charCodeAt(len - 1) === 48; --len); + str = str.slice(i, len); + + if (str) { + len -= i; + x.e = e = e - i - 1; + x.d = []; + + // Transform base + + // e is the base 10 exponent. + // i is where to slice str to get the first word of the digits array. + i = (e + 1) % LOG_BASE; + if (e < 0) i += LOG_BASE; + + if (i < len) { + if (i) x.d.push(+str.slice(0, i)); + for (len -= LOG_BASE; i < len;) x.d.push(+str.slice(i, i += LOG_BASE)); + str = str.slice(i); + i = LOG_BASE - str.length; + } else { + i -= len; + } + + for (; i--;) str += '0'; + x.d.push(+str); + + if (external) { + + // Overflow? + if (x.e > x.constructor.maxE) { + + // Infinity. + x.d = null; + x.e = NaN; + + // Underflow? + } else if (x.e < x.constructor.minE) { + + // Zero. + x.e = 0; + x.d = [0]; + // x.constructor.underflow = true; + } // else x.constructor.underflow = false; + } + } else { + + // Zero. + x.e = 0; + x.d = [0]; + } + + return x; + } + + + /* + * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value. + */ + function parseOther(x, str) { + var base, Ctor, divisor, i, isFloat, len, p, xd, xe; + + if (str.indexOf('_') > -1) { + str = str.replace(/(\d)_(?=\d)/g, '$1'); + if (isDecimal.test(str)) return parseDecimal(x, str); + } else if (str === 'Infinity' || str === 'NaN') { + if (!+str) x.s = NaN; + x.e = NaN; + x.d = null; + return x; + } + + if (isHex.test(str)) { + base = 16; + str = str.toLowerCase(); + } else if (isBinary.test(str)) { + base = 2; + } else if (isOctal.test(str)) { + base = 8; + } else { + throw Error(invalidArgument + str); + } + + // Is there a binary exponent part? + i = str.search(/p/i); + + if (i > 0) { + p = +str.slice(i + 1); + str = str.substring(2, i); + } else { + str = str.slice(2); + } + + // Convert `str` as an integer then divide the result by `base` raised to a power such that the + // fraction part will be restored. + i = str.indexOf('.'); + isFloat = i >= 0; + Ctor = x.constructor; + + if (isFloat) { + str = str.replace('.', ''); + len = str.length; + i = len - i; + + // log[10](16) = 1.2041... , log[10](88) = 1.9444.... + divisor = intPow(Ctor, new Ctor(base), i, i * 2); + } + + xd = convertBase(str, base, BASE); + xe = xd.length - 1; + + // Remove trailing zeros. + for (i = xe; xd[i] === 0; --i) xd.pop(); + if (i < 0) return new Ctor(x.s * 0); + x.e = getBase10Exponent(xd, xe); + x.d = xd; + external = false; + + // At what precision to perform the division to ensure exact conversion? + // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount) + // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412 + // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits. + // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount + // Therefore using 4 * the number of digits of str will always be enough. + if (isFloat) x = divide(x, divisor, len * 4); + + // Multiply by the binary exponent part if present. + if (p) x = x.times(Math.abs(p) < 54 ? mathpow(2, p) : Decimal.pow(2, p)); + external = true; + + return x; + } + + + /* + * sin(x) = x - x^3/3! + x^5/5! - ... + * |x| < pi/2 + * + */ + function sine(Ctor, x) { + var k, + len = x.d.length; + + if (len < 3) { + return x.isZero() ? x : taylorSeries(Ctor, 2, x, x); + } + + // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x) + // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5) + // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20)) + + // Estimate the optimum number of times to use the argument reduction. + k = 1.4 * Math.sqrt(len); + k = k > 16 ? 16 : k | 0; + + x = x.times(1 / tinyPow(5, k)); + x = taylorSeries(Ctor, 2, x, x); + + // Reverse argument reduction + var sin2_x, + d5 = new Ctor(5), + d16 = new Ctor(16), + d20 = new Ctor(20); + for (; k--;) { + sin2_x = x.times(x); + x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20)))); + } + + return x; + } + + + // Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`. + function taylorSeries(Ctor, n, x, y, isHyperbolic) { + var j, t, u, x2, + i = 1, + pr = Ctor.precision, + k = Math.ceil(pr / LOG_BASE); + + external = false; + x2 = x.times(x); + u = new Ctor(y); + + for (;;) { + t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1); + u = isHyperbolic ? y.plus(t) : y.minus(t); + y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1); + t = u.plus(y); + + if (t.d[k] !== void 0) { + for (j = k; t.d[j] === u.d[j] && j--;); + if (j == -1) break; + } + + j = u; + u = y; + y = t; + t = j; + i++; + } + + external = true; + t.d.length = k + 1; + + return t; + } + + + // Exponent e must be positive and non-zero. + function tinyPow(b, e) { + var n = b; + while (--e) n *= b; + return n; + } + + + // Return the absolute value of `x` reduced to less than or equal to half pi. + function toLessThanHalfPi(Ctor, x) { + var t, + isNeg = x.s < 0, + pi = getPi(Ctor, Ctor.precision, 1), + halfPi = pi.times(0.5); + + x = x.abs(); + + if (x.lte(halfPi)) { + quadrant = isNeg ? 4 : 1; + return x; + } + + t = x.divToInt(pi); + + if (t.isZero()) { + quadrant = isNeg ? 3 : 2; + } else { + x = x.minus(t.times(pi)); + + // 0 <= x < pi + if (x.lte(halfPi)) { + quadrant = isOdd(t) ? (isNeg ? 2 : 3) : (isNeg ? 4 : 1); + return x; + } + + quadrant = isOdd(t) ? (isNeg ? 1 : 4) : (isNeg ? 3 : 2); + } + + return x.minus(pi).abs(); + } + + + /* + * Return the value of Decimal `x` as a string in base `baseOut`. + * + * If the optional `sd` argument is present include a binary exponent suffix. + */ + function toStringBinary(x, baseOut, sd, rm) { + var base, e, i, k, len, roundUp, str, xd, y, + Ctor = x.constructor, + isExp = sd !== void 0; + + if (isExp) { + checkInt32(sd, 1, MAX_DIGITS); + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + } else { + sd = Ctor.precision; + rm = Ctor.rounding; + } + + if (!x.isFinite()) { + str = nonFiniteToString(x); + } else { + str = finiteToString(x); + i = str.indexOf('.'); + + // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required: + // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10)) + // minBinaryExponent = floor(decimalExponent * log[2](10)) + // log[2](10) = 3.321928094887362347870319429489390175864 + + if (isExp) { + base = 2; + if (baseOut == 16) { + sd = sd * 4 - 3; + } else if (baseOut == 8) { + sd = sd * 3 - 2; + } + } else { + base = baseOut; + } + + // Convert the number as an integer then divide the result by its base raised to a power such + // that the fraction part will be restored. + + // Non-integer. + if (i >= 0) { + str = str.replace('.', ''); + y = new Ctor(1); + y.e = str.length - i; + y.d = convertBase(finiteToString(y), 10, base); + y.e = y.d.length; + } + + xd = convertBase(str, 10, base); + e = len = xd.length; + + // Remove trailing zeros. + for (; xd[--len] == 0;) xd.pop(); + + if (!xd[0]) { + str = isExp ? '0p+0' : '0'; + } else { + if (i < 0) { + e--; + } else { + x = new Ctor(x); + x.d = xd; + x.e = e; + x = divide(x, y, sd, rm, 0, base); + xd = x.d; + e = x.e; + roundUp = inexact; + } + + // The rounding digit, i.e. the digit after the digit that may be rounded up. + i = xd[sd]; + k = base / 2; + roundUp = roundUp || xd[sd + 1] !== void 0; + + roundUp = rm < 4 + ? (i !== void 0 || roundUp) && (rm === 0 || rm === (x.s < 0 ? 3 : 2)) + : i > k || i === k && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 || + rm === (x.s < 0 ? 8 : 7)); + + xd.length = sd; + + if (roundUp) { + + // Rounding up may mean the previous digit has to be rounded up and so on. + for (; ++xd[--sd] > base - 1;) { + xd[sd] = 0; + if (!sd) { + ++e; + xd.unshift(1); + } + } + } + + // Determine trailing zeros. + for (len = xd.length; !xd[len - 1]; --len); + + // E.g. [4, 11, 15] becomes 4bf. + for (i = 0, str = ''; i < len; i++) str += NUMERALS.charAt(xd[i]); + + // Add binary exponent suffix? + if (isExp) { + if (len > 1) { + if (baseOut == 16 || baseOut == 8) { + i = baseOut == 16 ? 4 : 3; + for (--len; len % i; len++) str += '0'; + xd = convertBase(str, base, baseOut); + for (len = xd.length; !xd[len - 1]; --len); + + // xd[0] will always be be 1 + for (i = 1, str = '1.'; i < len; i++) str += NUMERALS.charAt(xd[i]); + } else { + str = str.charAt(0) + '.' + str.slice(1); + } + } + + str = str + (e < 0 ? 'p' : 'p+') + e; + } else if (e < 0) { + for (; ++e;) str = '0' + str; + str = '0.' + str; + } else { + if (++e > len) for (e -= len; e-- ;) str += '0'; + else if (e < len) str = str.slice(0, e) + '.' + str.slice(e); + } + } + + str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str; + } + + return x.s < 0 ? '-' + str : str; + } + + + // Does not strip trailing zeros. + function truncate(arr, len) { + if (arr.length > len) { + arr.length = len; + return true; + } + } + + + // Decimal methods + + + /* + * abs + * acos + * acosh + * add + * asin + * asinh + * atan + * atanh + * atan2 + * cbrt + * ceil + * clamp + * clone + * config + * cos + * cosh + * div + * exp + * floor + * hypot + * ln + * log + * log2 + * log10 + * max + * min + * mod + * mul + * pow + * random + * round + * set + * sign + * sin + * sinh + * sqrt + * sub + * sum + * tan + * tanh + * trunc + */ + + + /* + * Return a new Decimal whose value is the absolute value of `x`. + * + * x {number|string|bigint|Decimal} + * + */ + function abs(x) { + return new this(x).abs(); + } + + + /* + * Return a new Decimal whose value is the arccosine in radians of `x`. + * + * x {number|string|bigint|Decimal} + * + */ + function acos(x) { + return new this(x).acos(); + } + + + /* + * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to + * `precision` significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ + function acosh(x) { + return new this(x).acosh(); + } + + + /* + * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant + * digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * y {number|string|bigint|Decimal} + * + */ + function add(x, y) { + return new this(x).plus(y); + } + + + /* + * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * + */ + function asin(x) { + return new this(x).asin(); + } + + + /* + * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to + * `precision` significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ + function asinh(x) { + return new this(x).asinh(); + } + + + /* + * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * + */ + function atan(x) { + return new this(x).atan(); + } + + + /* + * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to + * `precision` significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ + function atanh(x) { + return new this(x).atanh(); + } + + + /* + * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi + * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`. + * + * Domain: [-Infinity, Infinity] + * Range: [-pi, pi] + * + * y {number|string|bigint|Decimal} The y-coordinate. + * x {number|string|bigint|Decimal} The x-coordinate. + * + * atan2(±0, -0) = ±pi + * atan2(±0, +0) = ±0 + * atan2(±0, -x) = ±pi for x > 0 + * atan2(±0, x) = ±0 for x > 0 + * atan2(-y, ±0) = -pi/2 for y > 0 + * atan2(y, ±0) = pi/2 for y > 0 + * atan2(±y, -Infinity) = ±pi for finite y > 0 + * atan2(±y, +Infinity) = ±0 for finite y > 0 + * atan2(±Infinity, x) = ±pi/2 for finite x + * atan2(±Infinity, -Infinity) = ±3*pi/4 + * atan2(±Infinity, +Infinity) = ±pi/4 + * atan2(NaN, x) = NaN + * atan2(y, NaN) = NaN + * + */ + function atan2(y, x) { + y = new this(y); + x = new this(x); + var r, + pr = this.precision, + rm = this.rounding, + wpr = pr + 4; + + // Either NaN + if (!y.s || !x.s) { + r = new this(NaN); + + // Both ±Infinity + } else if (!y.d && !x.d) { + r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75); + r.s = y.s; + + // x is ±Infinity or y is ±0 + } else if (!x.d || y.isZero()) { + r = x.s < 0 ? getPi(this, pr, rm) : new this(0); + r.s = y.s; + + // y is ±Infinity or x is ±0 + } else if (!y.d || x.isZero()) { + r = getPi(this, wpr, 1).times(0.5); + r.s = y.s; + + // Both non-zero and finite + } else if (x.s < 0) { + this.precision = wpr; + this.rounding = 1; + r = this.atan(divide(y, x, wpr, 1)); + x = getPi(this, wpr, 1); + this.precision = pr; + this.rounding = rm; + r = y.s < 0 ? r.minus(x) : r.plus(x); + } else { + r = this.atan(divide(y, x, wpr, 1)); + } + + return r; + } + + + /* + * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant + * digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * + */ + function cbrt(x) { + return new this(x).cbrt(); + } + + + /* + * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`. + * + * x {number|string|bigint|Decimal} + * + */ + function ceil(x) { + return finalise(x = new this(x), x.e + 1, 2); + } + + + /* + * Return a new Decimal whose value is `x` clamped to the range delineated by `min` and `max`. + * + * x {number|string|bigint|Decimal} + * min {number|string|bigint|Decimal} + * max {number|string|bigint|Decimal} + * + */ + function clamp(x, min, max) { + return new this(x).clamp(min, max); + } + + + /* + * Configure global settings for a Decimal constructor. + * + * `obj` is an object with one or more of the following properties, + * + * precision {number} + * rounding {number} + * toExpNeg {number} + * toExpPos {number} + * maxE {number} + * minE {number} + * modulo {number} + * crypto {boolean|number} + * defaults {true} + * + * E.g. Decimal.config({ precision: 20, rounding: 4 }) + * + */ + function config(obj) { + if (!obj || typeof obj !== 'object') throw Error(decimalError + 'Object expected'); + var i, p, v, + useDefaults = obj.defaults === true, + ps = [ + 'precision', 1, MAX_DIGITS, + 'rounding', 0, 8, + 'toExpNeg', -EXP_LIMIT, 0, + 'toExpPos', 0, EXP_LIMIT, + 'maxE', 0, EXP_LIMIT, + 'minE', -EXP_LIMIT, 0, + 'modulo', 0, 9 + ]; + + for (i = 0; i < ps.length; i += 3) { + if (p = ps[i], useDefaults) this[p] = DEFAULTS[p]; + if ((v = obj[p]) !== void 0) { + if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v; + else throw Error(invalidArgument + p + ': ' + v); + } + } + + if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p]; + if ((v = obj[p]) !== void 0) { + if (v === true || v === false || v === 0 || v === 1) { + if (v) { + if (typeof crypto != 'undefined' && crypto && + (crypto.getRandomValues || crypto.randomBytes)) { + this[p] = true; + } else { + throw Error(cryptoUnavailable); + } + } else { + this[p] = false; + } + } else { + throw Error(invalidArgument + p + ': ' + v); + } + } + + return this; + } + + + /* + * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant + * digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ + function cos(x) { + return new this(x).cos(); + } + + + /* + * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ + function cosh(x) { + return new this(x).cosh(); + } + + + /* + * Create and return a Decimal constructor with the same configuration properties as this Decimal + * constructor. + * + */ + function clone(obj) { + var i, p, ps; + + /* + * The Decimal constructor and exported function. + * Return a new Decimal instance. + * + * v {number|string|bigint|Decimal} A numeric value. + * + */ + function Decimal(v) { + var e, i, t, + x = this; + + // Decimal called without new. + if (!(x instanceof Decimal)) return new Decimal(v); + + // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor + // which points to Object. + x.constructor = Decimal; + + if (isDecimalInstance(v)) { + x.s = v.s; + + if (external) { + if (!v.d || v.e > Decimal.maxE) { + + // Infinity. + x.e = NaN; + x.d = null; + } else if (v.e < Decimal.minE) { + + // Zero. + x.e = 0; + x.d = [0]; + } else { + x.e = v.e; + x.d = v.d.slice(); + } + } else { + x.e = v.e; + x.d = v.d ? v.d.slice() : v.d; + } + + return; + } + + t = typeof v; + + if (t === 'number') { + if (v === 0) { + x.s = 1 / v < 0 ? -1 : 1; + x.e = 0; + x.d = [0]; + return; + } + + if (v < 0) { + v = -v; + x.s = -1; + } else { + x.s = 1; + } + + // Fast path for small integers. + if (v === ~~v && v < 1e7) { + for (e = 0, i = v; i >= 10; i /= 10) e++; + + if (external) { + if (e > Decimal.maxE) { + x.e = NaN; + x.d = null; + } else if (e < Decimal.minE) { + x.e = 0; + x.d = [0]; + } else { + x.e = e; + x.d = [v]; + } + } else { + x.e = e; + x.d = [v]; + } + + return; + } + + // Infinity or NaN? + if (v * 0 !== 0) { + if (!v) x.s = NaN; + x.e = NaN; + x.d = null; + return; + } + + return parseDecimal(x, v.toString()); + } + + if (t === 'string') { + if ((i = v.charCodeAt(0)) === 45) { // minus sign + v = v.slice(1); + x.s = -1; + } else { + if (i === 43) v = v.slice(1); // plus sign + x.s = 1; + } + + return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v); + } + + if (t === 'bigint') { + if (v < 0) { + v = -v; + x.s = -1; + } else { + x.s = 1; + } + + return parseDecimal(x, v.toString()); + } + + throw Error(invalidArgument + v); + } + + Decimal.prototype = P; + + Decimal.ROUND_UP = 0; + Decimal.ROUND_DOWN = 1; + Decimal.ROUND_CEIL = 2; + Decimal.ROUND_FLOOR = 3; + Decimal.ROUND_HALF_UP = 4; + Decimal.ROUND_HALF_DOWN = 5; + Decimal.ROUND_HALF_EVEN = 6; + Decimal.ROUND_HALF_CEIL = 7; + Decimal.ROUND_HALF_FLOOR = 8; + Decimal.EUCLID = 9; + + Decimal.config = Decimal.set = config; + Decimal.clone = clone; + Decimal.isDecimal = isDecimalInstance; + + Decimal.abs = abs; + Decimal.acos = acos; + Decimal.acosh = acosh; // ES6 + Decimal.add = add; + Decimal.asin = asin; + Decimal.asinh = asinh; // ES6 + Decimal.atan = atan; + Decimal.atanh = atanh; // ES6 + Decimal.atan2 = atan2; + Decimal.cbrt = cbrt; // ES6 + Decimal.ceil = ceil; + Decimal.clamp = clamp; + Decimal.cos = cos; + Decimal.cosh = cosh; // ES6 + Decimal.div = div; + Decimal.exp = exp; + Decimal.floor = floor; + Decimal.hypot = hypot; // ES6 + Decimal.ln = ln; + Decimal.log = log; + Decimal.log10 = log10; // ES6 + Decimal.log2 = log2; // ES6 + Decimal.max = max; + Decimal.min = min; + Decimal.mod = mod; + Decimal.mul = mul; + Decimal.pow = pow; + Decimal.random = random; + Decimal.round = round; + Decimal.sign = sign; // ES6 + Decimal.sin = sin; + Decimal.sinh = sinh; // ES6 + Decimal.sqrt = sqrt; + Decimal.sub = sub; + Decimal.sum = sum; + Decimal.tan = tan; + Decimal.tanh = tanh; // ES6 + Decimal.trunc = trunc; // ES6 + + if (obj === void 0) obj = {}; + if (obj) { + if (obj.defaults !== true) { + ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto']; + for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p]; + } + } + + Decimal.config(obj); + + return Decimal; + } + + + /* + * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant + * digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * y {number|string|bigint|Decimal} + * + */ + function div(x, y) { + return new this(x).div(y); + } + + + /* + * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} The power to which to raise the base of the natural log. + * + */ + function exp(x) { + return new this(x).exp(); + } + + + /* + * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`. + * + * x {number|string|bigint|Decimal} + * + */ + function floor(x) { + return finalise(x = new this(x), x.e + 1, 3); + } + + + /* + * Return a new Decimal whose value is the square root of the sum of the squares of the arguments, + * rounded to `precision` significant digits using rounding mode `rounding`. + * + * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...) + * + * arguments {number|string|bigint|Decimal} + * + */ + function hypot() { + var i, n, + t = new this(0); + + external = false; + + for (i = 0; i < arguments.length;) { + n = new this(arguments[i++]); + if (!n.d) { + if (n.s) { + external = true; + return new this(1 / 0); + } + t = n; + } else if (t.d) { + t = t.plus(n.times(n)); + } + } + + external = true; + + return t.sqrt(); + } + + + /* + * Return true if object is a Decimal instance (where Decimal is any Decimal constructor), + * otherwise return false. + * + */ + function isDecimalInstance(obj) { + return obj instanceof Decimal || obj && obj.toStringTag === tag || false; + } + + + /* + * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * + */ + function ln(x) { + return new this(x).ln(); + } + + + /* + * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base + * is specified, rounded to `precision` significant digits using rounding mode `rounding`. + * + * log[y](x) + * + * x {number|string|bigint|Decimal} The argument of the logarithm. + * y {number|string|bigint|Decimal} The base of the logarithm. + * + */ + function log(x, y) { + return new this(x).log(y); + } + + + /* + * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * + */ + function log2(x) { + return new this(x).log(2); + } + + + /* + * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * + */ + function log10(x) { + return new this(x).log(10); + } + + + /* + * Return a new Decimal whose value is the maximum of the arguments. + * + * arguments {number|string|bigint|Decimal} + * + */ + function max() { + return maxOrMin(this, arguments, -1); + } + + + /* + * Return a new Decimal whose value is the minimum of the arguments. + * + * arguments {number|string|bigint|Decimal} + * + */ + function min() { + return maxOrMin(this, arguments, 1); + } + + + /* + * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits + * using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * y {number|string|bigint|Decimal} + * + */ + function mod(x, y) { + return new this(x).mod(y); + } + + + /* + * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant + * digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * y {number|string|bigint|Decimal} + * + */ + function mul(x, y) { + return new this(x).mul(y); + } + + + /* + * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} The base. + * y {number|string|bigint|Decimal} The exponent. + * + */ + function pow(x, y) { + return new this(x).pow(y); + } + + + /* + * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with + * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros + * are produced). + * + * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive. + * + */ + function random(sd) { + var d, e, k, n, + i = 0, + r = new this(1), + rd = []; + + if (sd === void 0) sd = this.precision; + else checkInt32(sd, 1, MAX_DIGITS); + + k = Math.ceil(sd / LOG_BASE); + + if (!this.crypto) { + for (; i < k;) rd[i++] = Math.random() * 1e7 | 0; + + // Browsers supporting crypto.getRandomValues. + } else if (crypto.getRandomValues) { + d = crypto.getRandomValues(new Uint32Array(k)); + + for (; i < k;) { + n = d[i]; + + // 0 <= n < 4294967296 + // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865). + if (n >= 4.29e9) { + d[i] = crypto.getRandomValues(new Uint32Array(1))[0]; + } else { + + // 0 <= n <= 4289999999 + // 0 <= (n % 1e7) <= 9999999 + rd[i++] = n % 1e7; + } + } + + // Node.js supporting crypto.randomBytes. + } else if (crypto.randomBytes) { + + // buffer + d = crypto.randomBytes(k *= 4); + + for (; i < k;) { + + // 0 <= n < 2147483648 + n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24); + + // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286). + if (n >= 2.14e9) { + crypto.randomBytes(4).copy(d, i); + } else { + + // 0 <= n <= 2139999999 + // 0 <= (n % 1e7) <= 9999999 + rd.push(n % 1e7); + i += 4; + } + } + + i = k / 4; + } else { + throw Error(cryptoUnavailable); + } + + k = rd[--i]; + sd %= LOG_BASE; + + // Convert trailing digits to zeros according to sd. + if (k && sd) { + n = mathpow(10, LOG_BASE - sd); + rd[i] = (k / n | 0) * n; + } + + // Remove trailing words which are zero. + for (; rd[i] === 0; i--) rd.pop(); + + // Zero? + if (i < 0) { + e = 0; + rd = [0]; + } else { + e = -1; + + // Remove leading words which are zero and adjust exponent accordingly. + for (; rd[0] === 0; e -= LOG_BASE) rd.shift(); + + // Count the digits of the first word of rd to determine leading zeros. + for (k = 1, n = rd[0]; n >= 10; n /= 10) k++; + + // Adjust the exponent for leading zeros of the first word of rd. + if (k < LOG_BASE) e -= LOG_BASE - k; + } + + r.e = e; + r.d = rd; + + return r; + } + + + /* + * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`. + * + * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL). + * + * x {number|string|bigint|Decimal} + * + */ + function round(x) { + return finalise(x = new this(x), x.e + 1, this.rounding); + } + + + /* + * Return + * 1 if x > 0, + * -1 if x < 0, + * 0 if x is 0, + * -0 if x is -0, + * NaN otherwise + * + * x {number|string|bigint|Decimal} + * + */ + function sign(x) { + x = new this(x); + return x.d ? (x.d[0] ? x.s : 0 * x.s) : x.s || NaN; + } + + + /* + * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits + * using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ + function sin(x) { + return new this(x).sin(); + } + + + /* + * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ + function sinh(x) { + return new this(x).sinh(); + } + + + /* + * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant + * digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * + */ + function sqrt(x) { + return new this(x).sqrt(); + } + + + /* + * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits + * using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * y {number|string|bigint|Decimal} + * + */ + function sub(x, y) { + return new this(x).sub(y); + } + + + /* + * Return a new Decimal whose value is the sum of the arguments, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * Only the result is rounded, not the intermediate calculations. + * + * arguments {number|string|bigint|Decimal} + * + */ + function sum() { + var i = 0, + args = arguments, + x = new this(args[i]); + + external = false; + for (; x.s && ++i < args.length;) x = x.plus(args[i]); + external = true; + + return finalise(x, this.precision, this.rounding); + } + + + /* + * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant + * digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ + function tan(x) { + return new this(x).tan(); + } + + + /* + * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ + function tanh(x) { + return new this(x).tanh(); + } + + + /* + * Return a new Decimal whose value is `x` truncated to an integer. + * + * x {number|string|bigint|Decimal} + * + */ + function trunc(x) { + return finalise(x = new this(x), x.e + 1, 1); + } + + + // Create and configure initial Decimal constructor. + Decimal = clone(DEFAULTS); + Decimal.prototype.constructor = Decimal; + Decimal['default'] = Decimal.Decimal = Decimal; + + // Create the internal constants from their string values. + LN10 = new Decimal(LN10); + PI = new Decimal(PI); + + + // Export. + + + // AMD. + if (typeof define == 'function' && define.amd) { + define(function () { + return Decimal; + }); + + // Node and other environments that support module.exports. + } else if (typeof module != 'undefined' && module.exports) { + if (typeof Symbol == 'function' && typeof Symbol.iterator == 'symbol') { + P[Symbol['for']('nodejs.util.inspect.custom')] = P.toString; + P[Symbol.toStringTag] = 'Decimal'; + } + + module.exports = Decimal; + + // Browser. + } else { + if (!globalScope) { + globalScope = typeof self != 'undefined' && self && self.self == self ? self : window; + } + + noConflict = globalScope.Decimal; + Decimal.noConflict = function () { + globalScope.Decimal = noConflict; + return Decimal; + }; + + globalScope.Decimal = Decimal; + } +})(this); diff --git a/node_modules/decimal.js/decimal.mjs b/node_modules/decimal.js/decimal.mjs index 18dc6409..71ed02eb 100644 --- a/node_modules/decimal.js/decimal.mjs +++ b/node_modules/decimal.js/decimal.mjs @@ -1,4914 +1,4914 @@ -/*! - * decimal.js v10.6.0 - * An arbitrary-precision Decimal type for JavaScript. - * https://github.com/MikeMcl/decimal.js - * Copyright (c) 2025 Michael Mclaughlin - * MIT Licence - */ - - -// ----------------------------------- EDITABLE DEFAULTS ------------------------------------ // - - - // The maximum exponent magnitude. - // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`. -var EXP_LIMIT = 9e15, // 0 to 9e15 - - // The limit on the value of `precision`, and on the value of the first argument to - // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`. - MAX_DIGITS = 1e9, // 0 to 1e9 - - // Base conversion alphabet. - NUMERALS = '0123456789abcdef', - - // The natural logarithm of 10 (1025 digits). - LN10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058', - - // Pi (1025 digits). - PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789', - - - // The initial configuration properties of the Decimal constructor. - DEFAULTS = { - - // These values must be integers within the stated ranges (inclusive). - // Most of these values can be changed at run-time using the `Decimal.config` method. - - // The maximum number of significant digits of the result of a calculation or base conversion. - // E.g. `Decimal.config({ precision: 20 });` - precision: 20, // 1 to MAX_DIGITS - - // The rounding mode used when rounding to `precision`. - // - // ROUND_UP 0 Away from zero. - // ROUND_DOWN 1 Towards zero. - // ROUND_CEIL 2 Towards +Infinity. - // ROUND_FLOOR 3 Towards -Infinity. - // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up. - // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down. - // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour. - // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity. - // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity. - // - // E.g. - // `Decimal.rounding = 4;` - // `Decimal.rounding = Decimal.ROUND_HALF_UP;` - rounding: 4, // 0 to 8 - - // The modulo mode used when calculating the modulus: a mod n. - // The quotient (q = a / n) is calculated according to the corresponding rounding mode. - // The remainder (r) is calculated as: r = a - n * q. - // - // UP 0 The remainder is positive if the dividend is negative, else is negative. - // DOWN 1 The remainder has the same sign as the dividend (JavaScript %). - // FLOOR 3 The remainder has the same sign as the divisor (Python %). - // HALF_EVEN 6 The IEEE 754 remainder function. - // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive. - // - // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian - // division (9) are commonly used for the modulus operation. The other rounding modes can also - // be used, but they may not give useful results. - modulo: 1, // 0 to 9 - - // The exponent value at and beneath which `toString` returns exponential notation. - // JavaScript numbers: -7 - toExpNeg: -7, // 0 to -EXP_LIMIT - - // The exponent value at and above which `toString` returns exponential notation. - // JavaScript numbers: 21 - toExpPos: 21, // 0 to EXP_LIMIT - - // The minimum exponent value, beneath which underflow to zero occurs. - // JavaScript numbers: -324 (5e-324) - minE: -EXP_LIMIT, // -1 to -EXP_LIMIT - - // The maximum exponent value, above which overflow to Infinity occurs. - // JavaScript numbers: 308 (1.7976931348623157e+308) - maxE: EXP_LIMIT, // 1 to EXP_LIMIT - - // Whether to use cryptographically-secure random number generation, if available. - crypto: false // true/false - }, - - -// ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- // - - - inexact, quadrant, - external = true, - - decimalError = '[DecimalError] ', - invalidArgument = decimalError + 'Invalid argument: ', - precisionLimitExceeded = decimalError + 'Precision limit exceeded', - cryptoUnavailable = decimalError + 'crypto unavailable', - tag = '[object Decimal]', - - mathfloor = Math.floor, - mathpow = Math.pow, - - isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i, - isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i, - isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, - isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, - - BASE = 1e7, - LOG_BASE = 7, - MAX_SAFE_INTEGER = 9007199254740991, - - LN10_PRECISION = LN10.length - 1, - PI_PRECISION = PI.length - 1, - - // Decimal.prototype object - P = { toStringTag: tag }; - - -// Decimal prototype methods - - -/* - * absoluteValue abs - * ceil - * clampedTo clamp - * comparedTo cmp - * cosine cos - * cubeRoot cbrt - * decimalPlaces dp - * dividedBy div - * dividedToIntegerBy divToInt - * equals eq - * floor - * greaterThan gt - * greaterThanOrEqualTo gte - * hyperbolicCosine cosh - * hyperbolicSine sinh - * hyperbolicTangent tanh - * inverseCosine acos - * inverseHyperbolicCosine acosh - * inverseHyperbolicSine asinh - * inverseHyperbolicTangent atanh - * inverseSine asin - * inverseTangent atan - * isFinite - * isInteger isInt - * isNaN - * isNegative isNeg - * isPositive isPos - * isZero - * lessThan lt - * lessThanOrEqualTo lte - * logarithm log - * [maximum] [max] - * [minimum] [min] - * minus sub - * modulo mod - * naturalExponential exp - * naturalLogarithm ln - * negated neg - * plus add - * precision sd - * round - * sine sin - * squareRoot sqrt - * tangent tan - * times mul - * toBinary - * toDecimalPlaces toDP - * toExponential - * toFixed - * toFraction - * toHexadecimal toHex - * toNearest - * toNumber - * toOctal - * toPower pow - * toPrecision - * toSignificantDigits toSD - * toString - * truncated trunc - * valueOf toJSON - */ - - -/* - * Return a new Decimal whose value is the absolute value of this Decimal. - * - */ -P.absoluteValue = P.abs = function () { - var x = new this.constructor(this); - if (x.s < 0) x.s = 1; - return finalise(x); -}; - - -/* - * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the - * direction of positive Infinity. - * - */ -P.ceil = function () { - return finalise(new this.constructor(this), this.e + 1, 2); -}; - - -/* - * Return a new Decimal whose value is the value of this Decimal clamped to the range - * delineated by `min` and `max`. - * - * min {number|string|bigint|Decimal} - * max {number|string|bigint|Decimal} - * - */ -P.clampedTo = P.clamp = function (min, max) { - var k, - x = this, - Ctor = x.constructor; - min = new Ctor(min); - max = new Ctor(max); - if (!min.s || !max.s) return new Ctor(NaN); - if (min.gt(max)) throw Error(invalidArgument + max); - k = x.cmp(min); - return k < 0 ? min : x.cmp(max) > 0 ? max : new Ctor(x); -}; - - -/* - * Return - * 1 if the value of this Decimal is greater than the value of `y`, - * -1 if the value of this Decimal is less than the value of `y`, - * 0 if they have the same value, - * NaN if the value of either Decimal is NaN. - * - */ -P.comparedTo = P.cmp = function (y) { - var i, j, xdL, ydL, - x = this, - xd = x.d, - yd = (y = new x.constructor(y)).d, - xs = x.s, - ys = y.s; - - // Either NaN or ±Infinity? - if (!xd || !yd) { - return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1; - } - - // Either zero? - if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0; - - // Signs differ? - if (xs !== ys) return xs; - - // Compare exponents. - if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1; - - xdL = xd.length; - ydL = yd.length; - - // Compare digit by digit. - for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) { - if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1; - } - - // Compare lengths. - return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1; -}; - - -/* - * Return a new Decimal whose value is the cosine of the value in radians of this Decimal. - * - * Domain: [-Infinity, Infinity] - * Range: [-1, 1] - * - * cos(0) = 1 - * cos(-0) = 1 - * cos(Infinity) = NaN - * cos(-Infinity) = NaN - * cos(NaN) = NaN - * - */ -P.cosine = P.cos = function () { - var pr, rm, - x = this, - Ctor = x.constructor; - - if (!x.d) return new Ctor(NaN); - - // cos(0) = cos(-0) = 1 - if (!x.d[0]) return new Ctor(1); - - pr = Ctor.precision; - rm = Ctor.rounding; - Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE; - Ctor.rounding = 1; - - x = cosine(Ctor, toLessThanHalfPi(Ctor, x)); - - Ctor.precision = pr; - Ctor.rounding = rm; - - return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true); -}; - - -/* - * - * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to - * `precision` significant digits using rounding mode `rounding`. - * - * cbrt(0) = 0 - * cbrt(-0) = -0 - * cbrt(1) = 1 - * cbrt(-1) = -1 - * cbrt(N) = N - * cbrt(-I) = -I - * cbrt(I) = I - * - * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3)) - * - */ -P.cubeRoot = P.cbrt = function () { - var e, m, n, r, rep, s, sd, t, t3, t3plusx, - x = this, - Ctor = x.constructor; - - if (!x.isFinite() || x.isZero()) return new Ctor(x); - external = false; - - // Initial estimate. - s = x.s * mathpow(x.s * x, 1 / 3); - - // Math.cbrt underflow/overflow? - // Pass x to Math.pow as integer, then adjust the exponent of the result. - if (!s || Math.abs(s) == 1 / 0) { - n = digitsToString(x.d); - e = x.e; - - // Adjust n exponent so it is a multiple of 3 away from x exponent. - if (s = (e - n.length + 1) % 3) n += (s == 1 || s == -2 ? '0' : '00'); - s = mathpow(n, 1 / 3); - - // Rarely, e may be one less than the result exponent value. - e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2)); - - if (s == 1 / 0) { - n = '5e' + e; - } else { - n = s.toExponential(); - n = n.slice(0, n.indexOf('e') + 1) + e; - } - - r = new Ctor(n); - r.s = x.s; - } else { - r = new Ctor(s.toString()); - } - - sd = (e = Ctor.precision) + 3; - - // Halley's method. - // TODO? Compare Newton's method. - for (;;) { - t = r; - t3 = t.times(t).times(t); - t3plusx = t3.plus(x); - r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1); - - // TODO? Replace with for-loop and checkRoundingDigits. - if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) { - n = n.slice(sd - 3, sd + 1); - - // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999 - // , i.e. approaching a rounding boundary, continue the iteration. - if (n == '9999' || !rep && n == '4999') { - - // On the first iteration only, check to see if rounding up gives the exact result as the - // nines may infinitely repeat. - if (!rep) { - finalise(t, e + 1, 0); - - if (t.times(t).times(t).eq(x)) { - r = t; - break; - } - } - - sd += 4; - rep = 1; - } else { - - // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result. - // If not, then there are further digits and m will be truthy. - if (!+n || !+n.slice(1) && n.charAt(0) == '5') { - - // Truncate to the first rounding digit. - finalise(r, e + 1, 1); - m = !r.times(r).times(r).eq(x); - } - - break; - } - } - } - - external = true; - - return finalise(r, e, Ctor.rounding, m); -}; - - -/* - * Return the number of decimal places of the value of this Decimal. - * - */ -P.decimalPlaces = P.dp = function () { - var w, - d = this.d, - n = NaN; - - if (d) { - w = d.length - 1; - n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE; - - // Subtract the number of trailing zeros of the last word. - w = d[w]; - if (w) for (; w % 10 == 0; w /= 10) n--; - if (n < 0) n = 0; - } - - return n; -}; - - -/* - * n / 0 = I - * n / N = N - * n / I = 0 - * 0 / n = 0 - * 0 / 0 = N - * 0 / N = N - * 0 / I = 0 - * N / n = N - * N / 0 = N - * N / N = N - * N / I = N - * I / n = I - * I / 0 = I - * I / N = N - * I / I = N - * - * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to - * `precision` significant digits using rounding mode `rounding`. - * - */ -P.dividedBy = P.div = function (y) { - return divide(this, new this.constructor(y)); -}; - - -/* - * Return a new Decimal whose value is the integer part of dividing the value of this Decimal - * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`. - * - */ -P.dividedToIntegerBy = P.divToInt = function (y) { - var x = this, - Ctor = x.constructor; - return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding); -}; - - -/* - * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false. - * - */ -P.equals = P.eq = function (y) { - return this.cmp(y) === 0; -}; - - -/* - * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the - * direction of negative Infinity. - * - */ -P.floor = function () { - return finalise(new this.constructor(this), this.e + 1, 3); -}; - - -/* - * Return true if the value of this Decimal is greater than the value of `y`, otherwise return - * false. - * - */ -P.greaterThan = P.gt = function (y) { - return this.cmp(y) > 0; -}; - - -/* - * Return true if the value of this Decimal is greater than or equal to the value of `y`, - * otherwise return false. - * - */ -P.greaterThanOrEqualTo = P.gte = function (y) { - var k = this.cmp(y); - return k == 1 || k === 0; -}; - - -/* - * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this - * Decimal. - * - * Domain: [-Infinity, Infinity] - * Range: [1, Infinity] - * - * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ... - * - * cosh(0) = 1 - * cosh(-0) = 1 - * cosh(Infinity) = Infinity - * cosh(-Infinity) = Infinity - * cosh(NaN) = NaN - * - * x time taken (ms) result - * 1000 9 9.8503555700852349694e+433 - * 10000 25 4.4034091128314607936e+4342 - * 100000 171 1.4033316802130615897e+43429 - * 1000000 3817 1.5166076984010437725e+434294 - * 10000000 abandoned after 2 minute wait - * - * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x)) - * - */ -P.hyperbolicCosine = P.cosh = function () { - var k, n, pr, rm, len, - x = this, - Ctor = x.constructor, - one = new Ctor(1); - - if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN); - if (x.isZero()) return one; - - pr = Ctor.precision; - rm = Ctor.rounding; - Ctor.precision = pr + Math.max(x.e, x.sd()) + 4; - Ctor.rounding = 1; - len = x.d.length; - - // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1 - // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4)) - - // Estimate the optimum number of times to use the argument reduction. - // TODO? Estimation reused from cosine() and may not be optimal here. - if (len < 32) { - k = Math.ceil(len / 3); - n = (1 / tinyPow(4, k)).toString(); - } else { - k = 16; - n = '2.3283064365386962890625e-10'; - } - - x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true); - - // Reverse argument reduction - var cosh2_x, - i = k, - d8 = new Ctor(8); - for (; i--;) { - cosh2_x = x.times(x); - x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8)))); - } - - return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true); -}; - - -/* - * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this - * Decimal. - * - * Domain: [-Infinity, Infinity] - * Range: [-Infinity, Infinity] - * - * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ... - * - * sinh(0) = 0 - * sinh(-0) = -0 - * sinh(Infinity) = Infinity - * sinh(-Infinity) = -Infinity - * sinh(NaN) = NaN - * - * x time taken (ms) - * 10 2 ms - * 100 5 ms - * 1000 14 ms - * 10000 82 ms - * 100000 886 ms 1.4033316802130615897e+43429 - * 200000 2613 ms - * 300000 5407 ms - * 400000 8824 ms - * 500000 13026 ms 8.7080643612718084129e+217146 - * 1000000 48543 ms - * - * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x)) - * - */ -P.hyperbolicSine = P.sinh = function () { - var k, pr, rm, len, - x = this, - Ctor = x.constructor; - - if (!x.isFinite() || x.isZero()) return new Ctor(x); - - pr = Ctor.precision; - rm = Ctor.rounding; - Ctor.precision = pr + Math.max(x.e, x.sd()) + 4; - Ctor.rounding = 1; - len = x.d.length; - - if (len < 3) { - x = taylorSeries(Ctor, 2, x, x, true); - } else { - - // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x)) - // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3)) - // 3 multiplications and 1 addition - - // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x))) - // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5))) - // 4 multiplications and 2 additions - - // Estimate the optimum number of times to use the argument reduction. - k = 1.4 * Math.sqrt(len); - k = k > 16 ? 16 : k | 0; - - x = x.times(1 / tinyPow(5, k)); - x = taylorSeries(Ctor, 2, x, x, true); - - // Reverse argument reduction - var sinh2_x, - d5 = new Ctor(5), - d16 = new Ctor(16), - d20 = new Ctor(20); - for (; k--;) { - sinh2_x = x.times(x); - x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20)))); - } - } - - Ctor.precision = pr; - Ctor.rounding = rm; - - return finalise(x, pr, rm, true); -}; - - -/* - * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this - * Decimal. - * - * Domain: [-Infinity, Infinity] - * Range: [-1, 1] - * - * tanh(x) = sinh(x) / cosh(x) - * - * tanh(0) = 0 - * tanh(-0) = -0 - * tanh(Infinity) = 1 - * tanh(-Infinity) = -1 - * tanh(NaN) = NaN - * - */ -P.hyperbolicTangent = P.tanh = function () { - var pr, rm, - x = this, - Ctor = x.constructor; - - if (!x.isFinite()) return new Ctor(x.s); - if (x.isZero()) return new Ctor(x); - - pr = Ctor.precision; - rm = Ctor.rounding; - Ctor.precision = pr + 7; - Ctor.rounding = 1; - - return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm); -}; - - -/* - * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of - * this Decimal. - * - * Domain: [-1, 1] - * Range: [0, pi] - * - * acos(x) = pi/2 - asin(x) - * - * acos(0) = pi/2 - * acos(-0) = pi/2 - * acos(1) = 0 - * acos(-1) = pi - * acos(1/2) = pi/3 - * acos(-1/2) = 2*pi/3 - * acos(|x| > 1) = NaN - * acos(NaN) = NaN - * - */ -P.inverseCosine = P.acos = function () { - var x = this, - Ctor = x.constructor, - k = x.abs().cmp(1), - pr = Ctor.precision, - rm = Ctor.rounding; - - if (k !== -1) { - return k === 0 - // |x| is 1 - ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0) - // |x| > 1 or x is NaN - : new Ctor(NaN); - } - - if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5); - - // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3 - - Ctor.precision = pr + 6; - Ctor.rounding = 1; - - // See https://github.com/MikeMcl/decimal.js/pull/217 - x = new Ctor(1).minus(x).div(x.plus(1)).sqrt().atan(); - - Ctor.precision = pr; - Ctor.rounding = rm; - - return x.times(2); -}; - - -/* - * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the - * value of this Decimal. - * - * Domain: [1, Infinity] - * Range: [0, Infinity] - * - * acosh(x) = ln(x + sqrt(x^2 - 1)) - * - * acosh(x < 1) = NaN - * acosh(NaN) = NaN - * acosh(Infinity) = Infinity - * acosh(-Infinity) = NaN - * acosh(0) = NaN - * acosh(-0) = NaN - * acosh(1) = 0 - * acosh(-1) = NaN - * - */ -P.inverseHyperbolicCosine = P.acosh = function () { - var pr, rm, - x = this, - Ctor = x.constructor; - - if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN); - if (!x.isFinite()) return new Ctor(x); - - pr = Ctor.precision; - rm = Ctor.rounding; - Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4; - Ctor.rounding = 1; - external = false; - - x = x.times(x).minus(1).sqrt().plus(x); - - external = true; - Ctor.precision = pr; - Ctor.rounding = rm; - - return x.ln(); -}; - - -/* - * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value - * of this Decimal. - * - * Domain: [-Infinity, Infinity] - * Range: [-Infinity, Infinity] - * - * asinh(x) = ln(x + sqrt(x^2 + 1)) - * - * asinh(NaN) = NaN - * asinh(Infinity) = Infinity - * asinh(-Infinity) = -Infinity - * asinh(0) = 0 - * asinh(-0) = -0 - * - */ -P.inverseHyperbolicSine = P.asinh = function () { - var pr, rm, - x = this, - Ctor = x.constructor; - - if (!x.isFinite() || x.isZero()) return new Ctor(x); - - pr = Ctor.precision; - rm = Ctor.rounding; - Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6; - Ctor.rounding = 1; - external = false; - - x = x.times(x).plus(1).sqrt().plus(x); - - external = true; - Ctor.precision = pr; - Ctor.rounding = rm; - - return x.ln(); -}; - - -/* - * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the - * value of this Decimal. - * - * Domain: [-1, 1] - * Range: [-Infinity, Infinity] - * - * atanh(x) = 0.5 * ln((1 + x) / (1 - x)) - * - * atanh(|x| > 1) = NaN - * atanh(NaN) = NaN - * atanh(Infinity) = NaN - * atanh(-Infinity) = NaN - * atanh(0) = 0 - * atanh(-0) = -0 - * atanh(1) = Infinity - * atanh(-1) = -Infinity - * - */ -P.inverseHyperbolicTangent = P.atanh = function () { - var pr, rm, wpr, xsd, - x = this, - Ctor = x.constructor; - - if (!x.isFinite()) return new Ctor(NaN); - if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN); - - pr = Ctor.precision; - rm = Ctor.rounding; - xsd = x.sd(); - - if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true); - - Ctor.precision = wpr = xsd - x.e; - - x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1); - - Ctor.precision = pr + 4; - Ctor.rounding = 1; - - x = x.ln(); - - Ctor.precision = pr; - Ctor.rounding = rm; - - return x.times(0.5); -}; - - -/* - * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this - * Decimal. - * - * Domain: [-Infinity, Infinity] - * Range: [-pi/2, pi/2] - * - * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2))) - * - * asin(0) = 0 - * asin(-0) = -0 - * asin(1/2) = pi/6 - * asin(-1/2) = -pi/6 - * asin(1) = pi/2 - * asin(-1) = -pi/2 - * asin(|x| > 1) = NaN - * asin(NaN) = NaN - * - * TODO? Compare performance of Taylor series. - * - */ -P.inverseSine = P.asin = function () { - var halfPi, k, - pr, rm, - x = this, - Ctor = x.constructor; - - if (x.isZero()) return new Ctor(x); - - k = x.abs().cmp(1); - pr = Ctor.precision; - rm = Ctor.rounding; - - if (k !== -1) { - - // |x| is 1 - if (k === 0) { - halfPi = getPi(Ctor, pr + 4, rm).times(0.5); - halfPi.s = x.s; - return halfPi; - } - - // |x| > 1 or x is NaN - return new Ctor(NaN); - } - - // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6 - - Ctor.precision = pr + 6; - Ctor.rounding = 1; - - x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan(); - - Ctor.precision = pr; - Ctor.rounding = rm; - - return x.times(2); -}; - - -/* - * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value - * of this Decimal. - * - * Domain: [-Infinity, Infinity] - * Range: [-pi/2, pi/2] - * - * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ... - * - * atan(0) = 0 - * atan(-0) = -0 - * atan(1) = pi/4 - * atan(-1) = -pi/4 - * atan(Infinity) = pi/2 - * atan(-Infinity) = -pi/2 - * atan(NaN) = NaN - * - */ -P.inverseTangent = P.atan = function () { - var i, j, k, n, px, t, r, wpr, x2, - x = this, - Ctor = x.constructor, - pr = Ctor.precision, - rm = Ctor.rounding; - - if (!x.isFinite()) { - if (!x.s) return new Ctor(NaN); - if (pr + 4 <= PI_PRECISION) { - r = getPi(Ctor, pr + 4, rm).times(0.5); - r.s = x.s; - return r; - } - } else if (x.isZero()) { - return new Ctor(x); - } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) { - r = getPi(Ctor, pr + 4, rm).times(0.25); - r.s = x.s; - return r; - } - - Ctor.precision = wpr = pr + 10; - Ctor.rounding = 1; - - // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x); - - // Argument reduction - // Ensure |x| < 0.42 - // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2))) - - k = Math.min(28, wpr / LOG_BASE + 2 | 0); - - for (i = k; i; --i) x = x.div(x.times(x).plus(1).sqrt().plus(1)); - - external = false; - - j = Math.ceil(wpr / LOG_BASE); - n = 1; - x2 = x.times(x); - r = new Ctor(x); - px = x; - - // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ... - for (; i !== -1;) { - px = px.times(x2); - t = r.minus(px.div(n += 2)); - - px = px.times(x2); - r = t.plus(px.div(n += 2)); - - if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;); - } - - if (k) r = r.times(2 << (k - 1)); - - external = true; - - return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true); -}; - - -/* - * Return true if the value of this Decimal is a finite number, otherwise return false. - * - */ -P.isFinite = function () { - return !!this.d; -}; - - -/* - * Return true if the value of this Decimal is an integer, otherwise return false. - * - */ -P.isInteger = P.isInt = function () { - return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2; -}; - - -/* - * Return true if the value of this Decimal is NaN, otherwise return false. - * - */ -P.isNaN = function () { - return !this.s; -}; - - -/* - * Return true if the value of this Decimal is negative, otherwise return false. - * - */ -P.isNegative = P.isNeg = function () { - return this.s < 0; -}; - - -/* - * Return true if the value of this Decimal is positive, otherwise return false. - * - */ -P.isPositive = P.isPos = function () { - return this.s > 0; -}; - - -/* - * Return true if the value of this Decimal is 0 or -0, otherwise return false. - * - */ -P.isZero = function () { - return !!this.d && this.d[0] === 0; -}; - - -/* - * Return true if the value of this Decimal is less than `y`, otherwise return false. - * - */ -P.lessThan = P.lt = function (y) { - return this.cmp(y) < 0; -}; - - -/* - * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false. - * - */ -P.lessThanOrEqualTo = P.lte = function (y) { - return this.cmp(y) < 1; -}; - - -/* - * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - * If no base is specified, return log[10](arg). - * - * log[base](arg) = ln(arg) / ln(base) - * - * The result will always be correctly rounded if the base of the log is 10, and 'almost always' - * otherwise: - * - * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen - * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error - * between the result and the correctly rounded result will be one ulp (unit in the last place). - * - * log[-b](a) = NaN - * log[0](a) = NaN - * log[1](a) = NaN - * log[NaN](a) = NaN - * log[Infinity](a) = NaN - * log[b](0) = -Infinity - * log[b](-0) = -Infinity - * log[b](-a) = NaN - * log[b](1) = 0 - * log[b](Infinity) = Infinity - * log[b](NaN) = NaN - * - * [base] {number|string|bigint|Decimal} The base of the logarithm. - * - */ -P.logarithm = P.log = function (base) { - var isBase10, d, denominator, k, inf, num, sd, r, - arg = this, - Ctor = arg.constructor, - pr = Ctor.precision, - rm = Ctor.rounding, - guard = 5; - - // Default base is 10. - if (base == null) { - base = new Ctor(10); - isBase10 = true; - } else { - base = new Ctor(base); - d = base.d; - - // Return NaN if base is negative, or non-finite, or is 0 or 1. - if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN); - - isBase10 = base.eq(10); - } - - d = arg.d; - - // Is arg negative, non-finite, 0 or 1? - if (arg.s < 0 || !d || !d[0] || arg.eq(1)) { - return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0); - } - - // The result will have a non-terminating decimal expansion if base is 10 and arg is not an - // integer power of 10. - if (isBase10) { - if (d.length > 1) { - inf = true; - } else { - for (k = d[0]; k % 10 === 0;) k /= 10; - inf = k !== 1; - } - } - - external = false; - sd = pr + guard; - num = naturalLogarithm(arg, sd); - denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd); - - // The result will have 5 rounding digits. - r = divide(num, denominator, sd, 1); - - // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000, - // calculate 10 further digits. - // - // If the result is known to have an infinite decimal expansion, repeat this until it is clear - // that the result is above or below the boundary. Otherwise, if after calculating the 10 - // further digits, the last 14 are nines, round up and assume the result is exact. - // Also assume the result is exact if the last 14 are zero. - // - // Example of a result that will be incorrectly rounded: - // log[1048576](4503599627370502) = 2.60000000000000009610279511444746... - // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it - // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so - // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal - // place is still 2.6. - if (checkRoundingDigits(r.d, k = pr, rm)) { - - do { - sd += 10; - num = naturalLogarithm(arg, sd); - denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd); - r = divide(num, denominator, sd, 1); - - if (!inf) { - - // Check for 14 nines from the 2nd rounding digit, as the first may be 4. - if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) { - r = finalise(r, pr + 1, 0); - } - - break; - } - } while (checkRoundingDigits(r.d, k += 10, rm)); - } - - external = true; - - return finalise(r, pr, rm); -}; - - -/* - * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal. - * - * arguments {number|string|bigint|Decimal} - * -P.max = function () { - Array.prototype.push.call(arguments, this); - return maxOrMin(this.constructor, arguments, -1); -}; - */ - - -/* - * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal. - * - * arguments {number|string|bigint|Decimal} - * -P.min = function () { - Array.prototype.push.call(arguments, this); - return maxOrMin(this.constructor, arguments, 1); -}; - */ - - -/* - * n - 0 = n - * n - N = N - * n - I = -I - * 0 - n = -n - * 0 - 0 = 0 - * 0 - N = N - * 0 - I = -I - * N - n = N - * N - 0 = N - * N - N = N - * N - I = N - * I - n = I - * I - 0 = I - * I - N = N - * I - I = N - * - * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - */ -P.minus = P.sub = function (y) { - var d, e, i, j, k, len, pr, rm, xd, xe, xLTy, yd, - x = this, - Ctor = x.constructor; - - y = new Ctor(y); - - // If either is not finite... - if (!x.d || !y.d) { - - // Return NaN if either is NaN. - if (!x.s || !y.s) y = new Ctor(NaN); - - // Return y negated if x is finite and y is ±Infinity. - else if (x.d) y.s = -y.s; - - // Return x if y is finite and x is ±Infinity. - // Return x if both are ±Infinity with different signs. - // Return NaN if both are ±Infinity with the same sign. - else y = new Ctor(y.d || x.s !== y.s ? x : NaN); - - return y; - } - - // If signs differ... - if (x.s != y.s) { - y.s = -y.s; - return x.plus(y); - } - - xd = x.d; - yd = y.d; - pr = Ctor.precision; - rm = Ctor.rounding; - - // If either is zero... - if (!xd[0] || !yd[0]) { - - // Return y negated if x is zero and y is non-zero. - if (yd[0]) y.s = -y.s; - - // Return x if y is zero and x is non-zero. - else if (xd[0]) y = new Ctor(x); - - // Return zero if both are zero. - // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity. - else return new Ctor(rm === 3 ? -0 : 0); - - return external ? finalise(y, pr, rm) : y; - } - - // x and y are finite, non-zero numbers with the same sign. - - // Calculate base 1e7 exponents. - e = mathfloor(y.e / LOG_BASE); - xe = mathfloor(x.e / LOG_BASE); - - xd = xd.slice(); - k = xe - e; - - // If base 1e7 exponents differ... - if (k) { - xLTy = k < 0; - - if (xLTy) { - d = xd; - k = -k; - len = yd.length; - } else { - d = yd; - e = xe; - len = xd.length; - } - - // Numbers with massively different exponents would result in a very high number of - // zeros needing to be prepended, but this can be avoided while still ensuring correct - // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`. - i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2; - - if (k > i) { - k = i; - d.length = 1; - } - - // Prepend zeros to equalise exponents. - d.reverse(); - for (i = k; i--;) d.push(0); - d.reverse(); - - // Base 1e7 exponents equal. - } else { - - // Check digits to determine which is the bigger number. - - i = xd.length; - len = yd.length; - xLTy = i < len; - if (xLTy) len = i; - - for (i = 0; i < len; i++) { - if (xd[i] != yd[i]) { - xLTy = xd[i] < yd[i]; - break; - } - } - - k = 0; - } - - if (xLTy) { - d = xd; - xd = yd; - yd = d; - y.s = -y.s; - } - - len = xd.length; - - // Append zeros to `xd` if shorter. - // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length. - for (i = yd.length - len; i > 0; --i) xd[len++] = 0; - - // Subtract yd from xd. - for (i = yd.length; i > k;) { - - if (xd[--i] < yd[i]) { - for (j = i; j && xd[--j] === 0;) xd[j] = BASE - 1; - --xd[j]; - xd[i] += BASE; - } - - xd[i] -= yd[i]; - } - - // Remove trailing zeros. - for (; xd[--len] === 0;) xd.pop(); - - // Remove leading zeros and adjust exponent accordingly. - for (; xd[0] === 0; xd.shift()) --e; - - // Zero? - if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0); - - y.d = xd; - y.e = getBase10Exponent(xd, e); - - return external ? finalise(y, pr, rm) : y; -}; - - -/* - * n % 0 = N - * n % N = N - * n % I = n - * 0 % n = 0 - * -0 % n = -0 - * 0 % 0 = N - * 0 % N = N - * 0 % I = 0 - * N % n = N - * N % 0 = N - * N % N = N - * N % I = N - * I % n = N - * I % 0 = N - * I % N = N - * I % I = N - * - * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to - * `precision` significant digits using rounding mode `rounding`. - * - * The result depends on the modulo mode. - * - */ -P.modulo = P.mod = function (y) { - var q, - x = this, - Ctor = x.constructor; - - y = new Ctor(y); - - // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0. - if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN); - - // Return x if y is ±Infinity or x is ±0. - if (!y.d || x.d && !x.d[0]) { - return finalise(new Ctor(x), Ctor.precision, Ctor.rounding); - } - - // Prevent rounding of intermediate calculations. - external = false; - - if (Ctor.modulo == 9) { - - // Euclidian division: q = sign(y) * floor(x / abs(y)) - // result = x - q * y where 0 <= result < abs(y) - q = divide(x, y.abs(), 0, 3, 1); - q.s *= y.s; - } else { - q = divide(x, y, 0, Ctor.modulo, 1); - } - - q = q.times(y); - - external = true; - - return x.minus(q); -}; - - -/* - * Return a new Decimal whose value is the natural exponential of the value of this Decimal, - * i.e. the base e raised to the power the value of this Decimal, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - */ -P.naturalExponential = P.exp = function () { - return naturalExponential(this); -}; - - -/* - * Return a new Decimal whose value is the natural logarithm of the value of this Decimal, - * rounded to `precision` significant digits using rounding mode `rounding`. - * - */ -P.naturalLogarithm = P.ln = function () { - return naturalLogarithm(this); -}; - - -/* - * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by - * -1. - * - */ -P.negated = P.neg = function () { - var x = new this.constructor(this); - x.s = -x.s; - return finalise(x); -}; - - -/* - * n + 0 = n - * n + N = N - * n + I = I - * 0 + n = n - * 0 + 0 = 0 - * 0 + N = N - * 0 + I = I - * N + n = N - * N + 0 = N - * N + N = N - * N + I = N - * I + n = I - * I + 0 = I - * I + N = N - * I + I = I - * - * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - */ -P.plus = P.add = function (y) { - var carry, d, e, i, k, len, pr, rm, xd, yd, - x = this, - Ctor = x.constructor; - - y = new Ctor(y); - - // If either is not finite... - if (!x.d || !y.d) { - - // Return NaN if either is NaN. - if (!x.s || !y.s) y = new Ctor(NaN); - - // Return x if y is finite and x is ±Infinity. - // Return x if both are ±Infinity with the same sign. - // Return NaN if both are ±Infinity with different signs. - // Return y if x is finite and y is ±Infinity. - else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN); - - return y; - } - - // If signs differ... - if (x.s != y.s) { - y.s = -y.s; - return x.minus(y); - } - - xd = x.d; - yd = y.d; - pr = Ctor.precision; - rm = Ctor.rounding; - - // If either is zero... - if (!xd[0] || !yd[0]) { - - // Return x if y is zero. - // Return y if y is non-zero. - if (!yd[0]) y = new Ctor(x); - - return external ? finalise(y, pr, rm) : y; - } - - // x and y are finite, non-zero numbers with the same sign. - - // Calculate base 1e7 exponents. - k = mathfloor(x.e / LOG_BASE); - e = mathfloor(y.e / LOG_BASE); - - xd = xd.slice(); - i = k - e; - - // If base 1e7 exponents differ... - if (i) { - - if (i < 0) { - d = xd; - i = -i; - len = yd.length; - } else { - d = yd; - e = k; - len = xd.length; - } - - // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1. - k = Math.ceil(pr / LOG_BASE); - len = k > len ? k + 1 : len + 1; - - if (i > len) { - i = len; - d.length = 1; - } - - // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts. - d.reverse(); - for (; i--;) d.push(0); - d.reverse(); - } - - len = xd.length; - i = yd.length; - - // If yd is longer than xd, swap xd and yd so xd points to the longer array. - if (len - i < 0) { - i = len; - d = yd; - yd = xd; - xd = d; - } - - // Only start adding at yd.length - 1 as the further digits of xd can be left as they are. - for (carry = 0; i;) { - carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0; - xd[i] %= BASE; - } - - if (carry) { - xd.unshift(carry); - ++e; - } - - // Remove trailing zeros. - // No need to check for zero, as +x + +y != 0 && -x + -y != 0 - for (len = xd.length; xd[--len] == 0;) xd.pop(); - - y.d = xd; - y.e = getBase10Exponent(xd, e); - - return external ? finalise(y, pr, rm) : y; -}; - - -/* - * Return the number of significant digits of the value of this Decimal. - * - * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0. - * - */ -P.precision = P.sd = function (z) { - var k, - x = this; - - if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z); - - if (x.d) { - k = getPrecision(x.d); - if (z && x.e + 1 > k) k = x.e + 1; - } else { - k = NaN; - } - - return k; -}; - - -/* - * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using - * rounding mode `rounding`. - * - */ -P.round = function () { - var x = this, - Ctor = x.constructor; - - return finalise(new Ctor(x), x.e + 1, Ctor.rounding); -}; - - -/* - * Return a new Decimal whose value is the sine of the value in radians of this Decimal. - * - * Domain: [-Infinity, Infinity] - * Range: [-1, 1] - * - * sin(x) = x - x^3/3! + x^5/5! - ... - * - * sin(0) = 0 - * sin(-0) = -0 - * sin(Infinity) = NaN - * sin(-Infinity) = NaN - * sin(NaN) = NaN - * - */ -P.sine = P.sin = function () { - var pr, rm, - x = this, - Ctor = x.constructor; - - if (!x.isFinite()) return new Ctor(NaN); - if (x.isZero()) return new Ctor(x); - - pr = Ctor.precision; - rm = Ctor.rounding; - Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE; - Ctor.rounding = 1; - - x = sine(Ctor, toLessThanHalfPi(Ctor, x)); - - Ctor.precision = pr; - Ctor.rounding = rm; - - return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true); -}; - - -/* - * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - * sqrt(-n) = N - * sqrt(N) = N - * sqrt(-I) = N - * sqrt(I) = I - * sqrt(0) = 0 - * sqrt(-0) = -0 - * - */ -P.squareRoot = P.sqrt = function () { - var m, n, sd, r, rep, t, - x = this, - d = x.d, - e = x.e, - s = x.s, - Ctor = x.constructor; - - // Negative/NaN/Infinity/zero? - if (s !== 1 || !d || !d[0]) { - return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0); - } - - external = false; - - // Initial estimate. - s = Math.sqrt(+x); - - // Math.sqrt underflow/overflow? - // Pass x to Math.sqrt as integer, then adjust the exponent of the result. - if (s == 0 || s == 1 / 0) { - n = digitsToString(d); - - if ((n.length + e) % 2 == 0) n += '0'; - s = Math.sqrt(n); - e = mathfloor((e + 1) / 2) - (e < 0 || e % 2); - - if (s == 1 / 0) { - n = '5e' + e; - } else { - n = s.toExponential(); - n = n.slice(0, n.indexOf('e') + 1) + e; - } - - r = new Ctor(n); - } else { - r = new Ctor(s.toString()); - } - - sd = (e = Ctor.precision) + 3; - - // Newton-Raphson iteration. - for (;;) { - t = r; - r = t.plus(divide(x, t, sd + 2, 1)).times(0.5); - - // TODO? Replace with for-loop and checkRoundingDigits. - if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) { - n = n.slice(sd - 3, sd + 1); - - // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or - // 4999, i.e. approaching a rounding boundary, continue the iteration. - if (n == '9999' || !rep && n == '4999') { - - // On the first iteration only, check to see if rounding up gives the exact result as the - // nines may infinitely repeat. - if (!rep) { - finalise(t, e + 1, 0); - - if (t.times(t).eq(x)) { - r = t; - break; - } - } - - sd += 4; - rep = 1; - } else { - - // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result. - // If not, then there are further digits and m will be truthy. - if (!+n || !+n.slice(1) && n.charAt(0) == '5') { - - // Truncate to the first rounding digit. - finalise(r, e + 1, 1); - m = !r.times(r).eq(x); - } - - break; - } - } - } - - external = true; - - return finalise(r, e, Ctor.rounding, m); -}; - - -/* - * Return a new Decimal whose value is the tangent of the value in radians of this Decimal. - * - * Domain: [-Infinity, Infinity] - * Range: [-Infinity, Infinity] - * - * tan(0) = 0 - * tan(-0) = -0 - * tan(Infinity) = NaN - * tan(-Infinity) = NaN - * tan(NaN) = NaN - * - */ -P.tangent = P.tan = function () { - var pr, rm, - x = this, - Ctor = x.constructor; - - if (!x.isFinite()) return new Ctor(NaN); - if (x.isZero()) return new Ctor(x); - - pr = Ctor.precision; - rm = Ctor.rounding; - Ctor.precision = pr + 10; - Ctor.rounding = 1; - - x = x.sin(); - x.s = 1; - x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0); - - Ctor.precision = pr; - Ctor.rounding = rm; - - return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true); -}; - - -/* - * n * 0 = 0 - * n * N = N - * n * I = I - * 0 * n = 0 - * 0 * 0 = 0 - * 0 * N = N - * 0 * I = N - * N * n = N - * N * 0 = N - * N * N = N - * N * I = N - * I * n = I - * I * 0 = N - * I * N = N - * I * I = I - * - * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant - * digits using rounding mode `rounding`. - * - */ -P.times = P.mul = function (y) { - var carry, e, i, k, r, rL, t, xdL, ydL, - x = this, - Ctor = x.constructor, - xd = x.d, - yd = (y = new Ctor(y)).d; - - y.s *= x.s; - - // If either is NaN, ±Infinity or ±0... - if (!xd || !xd[0] || !yd || !yd[0]) { - - return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd - - // Return NaN if either is NaN. - // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity. - ? NaN - - // Return ±Infinity if either is ±Infinity. - // Return ±0 if either is ±0. - : !xd || !yd ? y.s / 0 : y.s * 0); - } - - e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE); - xdL = xd.length; - ydL = yd.length; - - // Ensure xd points to the longer array. - if (xdL < ydL) { - r = xd; - xd = yd; - yd = r; - rL = xdL; - xdL = ydL; - ydL = rL; - } - - // Initialise the result array with zeros. - r = []; - rL = xdL + ydL; - for (i = rL; i--;) r.push(0); - - // Multiply! - for (i = ydL; --i >= 0;) { - carry = 0; - for (k = xdL + i; k > i;) { - t = r[k] + yd[i] * xd[k - i - 1] + carry; - r[k--] = t % BASE | 0; - carry = t / BASE | 0; - } - - r[k] = (r[k] + carry) % BASE | 0; - } - - // Remove trailing zeros. - for (; !r[--rL];) r.pop(); - - if (carry) ++e; - else r.shift(); - - y.d = r; - y.e = getBase10Exponent(r, e); - - return external ? finalise(y, Ctor.precision, Ctor.rounding) : y; -}; - - -/* - * Return a string representing the value of this Decimal in base 2, round to `sd` significant - * digits using rounding mode `rm`. - * - * If the optional `sd` argument is present then return binary exponential notation. - * - * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - */ -P.toBinary = function (sd, rm) { - return toStringBinary(this, 2, sd, rm); -}; - - -/* - * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp` - * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted. - * - * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal. - * - * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - */ -P.toDecimalPlaces = P.toDP = function (dp, rm) { - var x = this, - Ctor = x.constructor; - - x = new Ctor(x); - if (dp === void 0) return x; - - checkInt32(dp, 0, MAX_DIGITS); - - if (rm === void 0) rm = Ctor.rounding; - else checkInt32(rm, 0, 8); - - return finalise(x, dp + x.e + 1, rm); -}; - - -/* - * Return a string representing the value of this Decimal in exponential notation rounded to - * `dp` fixed decimal places using rounding mode `rounding`. - * - * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - */ -P.toExponential = function (dp, rm) { - var str, - x = this, - Ctor = x.constructor; - - if (dp === void 0) { - str = finiteToString(x, true); - } else { - checkInt32(dp, 0, MAX_DIGITS); - - if (rm === void 0) rm = Ctor.rounding; - else checkInt32(rm, 0, 8); - - x = finalise(new Ctor(x), dp + 1, rm); - str = finiteToString(x, true, dp + 1); - } - - return x.isNeg() && !x.isZero() ? '-' + str : str; -}; - - -/* - * Return a string representing the value of this Decimal in normal (fixed-point) notation to - * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is - * omitted. - * - * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'. - * - * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'. - * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'. - * (-0).toFixed(3) is '0.000'. - * (-0.5).toFixed(0) is '-0'. - * - */ -P.toFixed = function (dp, rm) { - var str, y, - x = this, - Ctor = x.constructor; - - if (dp === void 0) { - str = finiteToString(x); - } else { - checkInt32(dp, 0, MAX_DIGITS); - - if (rm === void 0) rm = Ctor.rounding; - else checkInt32(rm, 0, 8); - - y = finalise(new Ctor(x), dp + x.e + 1, rm); - str = finiteToString(y, false, dp + y.e + 1); - } - - // To determine whether to add the minus sign look at the value before it was rounded, - // i.e. look at `x` rather than `y`. - return x.isNeg() && !x.isZero() ? '-' + str : str; -}; - - -/* - * Return an array representing the value of this Decimal as a simple fraction with an integer - * numerator and an integer denominator. - * - * The denominator will be a positive non-zero value less than or equal to the specified maximum - * denominator. If a maximum denominator is not specified, the denominator will be the lowest - * value necessary to represent the number exactly. - * - * [maxD] {number|string|bigint|Decimal} Maximum denominator. Integer >= 1 and < Infinity. - * - */ -P.toFraction = function (maxD) { - var d, d0, d1, d2, e, k, n, n0, n1, pr, q, r, - x = this, - xd = x.d, - Ctor = x.constructor; - - if (!xd) return new Ctor(x); - - n1 = d0 = new Ctor(1); - d1 = n0 = new Ctor(0); - - d = new Ctor(d1); - e = d.e = getPrecision(xd) - x.e - 1; - k = e % LOG_BASE; - d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k); - - if (maxD == null) { - - // d is 10**e, the minimum max-denominator needed. - maxD = e > 0 ? d : n1; - } else { - n = new Ctor(maxD); - if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n); - maxD = n.gt(d) ? (e > 0 ? d : n1) : n; - } - - external = false; - n = new Ctor(digitsToString(xd)); - pr = Ctor.precision; - Ctor.precision = e = xd.length * LOG_BASE * 2; - - for (;;) { - q = divide(n, d, 0, 1, 1); - d2 = d0.plus(q.times(d1)); - if (d2.cmp(maxD) == 1) break; - d0 = d1; - d1 = d2; - d2 = n1; - n1 = n0.plus(q.times(d2)); - n0 = d2; - d2 = d; - d = n.minus(q.times(d2)); - n = d2; - } - - d2 = divide(maxD.minus(d0), d1, 0, 1, 1); - n0 = n0.plus(d2.times(n1)); - d0 = d0.plus(d2.times(d1)); - n0.s = n1.s = x.s; - - // Determine which fraction is closer to x, n0/d0 or n1/d1? - r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1 - ? [n1, d1] : [n0, d0]; - - Ctor.precision = pr; - external = true; - - return r; -}; - - -/* - * Return a string representing the value of this Decimal in base 16, round to `sd` significant - * digits using rounding mode `rm`. - * - * If the optional `sd` argument is present then return binary exponential notation. - * - * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - */ -P.toHexadecimal = P.toHex = function (sd, rm) { - return toStringBinary(this, 16, sd, rm); -}; - - -/* - * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding - * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal. - * - * The return value will always have the same sign as this Decimal, unless either this Decimal - * or `y` is NaN, in which case the return value will be also be NaN. - * - * The return value is not affected by the value of `precision`. - * - * y {number|string|bigint|Decimal} The magnitude to round to a multiple of. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * 'toNearest() rounding mode not an integer: {rm}' - * 'toNearest() rounding mode out of range: {rm}' - * - */ -P.toNearest = function (y, rm) { - var x = this, - Ctor = x.constructor; - - x = new Ctor(x); - - if (y == null) { - - // If x is not finite, return x. - if (!x.d) return x; - - y = new Ctor(1); - rm = Ctor.rounding; - } else { - y = new Ctor(y); - if (rm === void 0) { - rm = Ctor.rounding; - } else { - checkInt32(rm, 0, 8); - } - - // If x is not finite, return x if y is not NaN, else NaN. - if (!x.d) return y.s ? x : y; - - // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN. - if (!y.d) { - if (y.s) y.s = x.s; - return y; - } - } - - // If y is not zero, calculate the nearest multiple of y to x. - if (y.d[0]) { - external = false; - x = divide(x, y, 0, rm, 1).times(y); - external = true; - finalise(x); - - // If y is zero, return zero with the sign of x. - } else { - y.s = x.s; - x = y; - } - - return x; -}; - - -/* - * Return the value of this Decimal converted to a number primitive. - * Zero keeps its sign. - * - */ -P.toNumber = function () { - return +this; -}; - - -/* - * Return a string representing the value of this Decimal in base 8, round to `sd` significant - * digits using rounding mode `rm`. - * - * If the optional `sd` argument is present then return binary exponential notation. - * - * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - */ -P.toOctal = function (sd, rm) { - return toStringBinary(this, 8, sd, rm); -}; - - -/* - * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded - * to `precision` significant digits using rounding mode `rounding`. - * - * ECMAScript compliant. - * - * pow(x, NaN) = NaN - * pow(x, ±0) = 1 - - * pow(NaN, non-zero) = NaN - * pow(abs(x) > 1, +Infinity) = +Infinity - * pow(abs(x) > 1, -Infinity) = +0 - * pow(abs(x) == 1, ±Infinity) = NaN - * pow(abs(x) < 1, +Infinity) = +0 - * pow(abs(x) < 1, -Infinity) = +Infinity - * pow(+Infinity, y > 0) = +Infinity - * pow(+Infinity, y < 0) = +0 - * pow(-Infinity, odd integer > 0) = -Infinity - * pow(-Infinity, even integer > 0) = +Infinity - * pow(-Infinity, odd integer < 0) = -0 - * pow(-Infinity, even integer < 0) = +0 - * pow(+0, y > 0) = +0 - * pow(+0, y < 0) = +Infinity - * pow(-0, odd integer > 0) = -0 - * pow(-0, even integer > 0) = +0 - * pow(-0, odd integer < 0) = -Infinity - * pow(-0, even integer < 0) = +Infinity - * pow(finite x < 0, finite non-integer) = NaN - * - * For non-integer or very large exponents pow(x, y) is calculated using - * - * x^y = exp(y*ln(x)) - * - * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the - * probability of an incorrectly rounded result - * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14 - * i.e. 1 in 250,000,000,000,000 - * - * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place). - * - * y {number|string|bigint|Decimal} The power to which to raise this Decimal. - * - */ -P.toPower = P.pow = function (y) { - var e, k, pr, r, rm, s, - x = this, - Ctor = x.constructor, - yn = +(y = new Ctor(y)); - - // Either ±Infinity, NaN or ±0? - if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn)); - - x = new Ctor(x); - - if (x.eq(1)) return x; - - pr = Ctor.precision; - rm = Ctor.rounding; - - if (y.eq(1)) return finalise(x, pr, rm); - - // y exponent - e = mathfloor(y.e / LOG_BASE); - - // If y is a small integer use the 'exponentiation by squaring' algorithm. - if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) { - r = intPow(Ctor, x, k, pr); - return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm); - } - - s = x.s; - - // if x is negative - if (s < 0) { - - // if y is not an integer - if (e < y.d.length - 1) return new Ctor(NaN); - - // Result is positive if x is negative and the last digit of integer y is even. - if ((y.d[e] & 1) == 0) s = 1; - - // if x.eq(-1) - if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) { - x.s = s; - return x; - } - } - - // Estimate result exponent. - // x^y = 10^e, where e = y * log10(x) - // log10(x) = log10(x_significand) + x_exponent - // log10(x_significand) = ln(x_significand) / ln(10) - k = mathpow(+x, yn); - e = k == 0 || !isFinite(k) - ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1)) - : new Ctor(k + '').e; - - // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1. - - // Overflow/underflow? - if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0); - - external = false; - Ctor.rounding = x.s = 1; - - // Estimate the extra guard digits needed to ensure five correct rounding digits from - // naturalLogarithm(x). Example of failure without these extra digits (precision: 10): - // new Decimal(2.32456).pow('2087987436534566.46411') - // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815 - k = Math.min(12, (e + '').length); - - // r = x^y = exp(y*ln(x)) - r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr); - - // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40) - if (r.d) { - - // Truncate to the required precision plus five rounding digits. - r = finalise(r, pr + 5, 1); - - // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate - // the result. - if (checkRoundingDigits(r.d, pr, rm)) { - e = pr + 10; - - // Truncate to the increased precision plus five rounding digits. - r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1); - - // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9). - if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) { - r = finalise(r, pr + 1, 0); - } - } - } - - r.s = s; - external = true; - Ctor.rounding = rm; - - return finalise(r, pr, rm); -}; - - -/* - * Return a string representing the value of this Decimal rounded to `sd` significant digits - * using rounding mode `rounding`. - * - * Return exponential notation if `sd` is less than the number of digits necessary to represent - * the integer part of the value in normal notation. - * - * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - */ -P.toPrecision = function (sd, rm) { - var str, - x = this, - Ctor = x.constructor; - - if (sd === void 0) { - str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); - } else { - checkInt32(sd, 1, MAX_DIGITS); - - if (rm === void 0) rm = Ctor.rounding; - else checkInt32(rm, 0, 8); - - x = finalise(new Ctor(x), sd, rm); - str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd); - } - - return x.isNeg() && !x.isZero() ? '-' + str : str; -}; - - -/* - * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd` - * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if - * omitted. - * - * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * 'toSD() digits out of range: {sd}' - * 'toSD() digits not an integer: {sd}' - * 'toSD() rounding mode not an integer: {rm}' - * 'toSD() rounding mode out of range: {rm}' - * - */ -P.toSignificantDigits = P.toSD = function (sd, rm) { - var x = this, - Ctor = x.constructor; - - if (sd === void 0) { - sd = Ctor.precision; - rm = Ctor.rounding; - } else { - checkInt32(sd, 1, MAX_DIGITS); - - if (rm === void 0) rm = Ctor.rounding; - else checkInt32(rm, 0, 8); - } - - return finalise(new Ctor(x), sd, rm); -}; - - -/* - * Return a string representing the value of this Decimal. - * - * Return exponential notation if this Decimal has a positive exponent equal to or greater than - * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`. - * - */ -P.toString = function () { - var x = this, - Ctor = x.constructor, - str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); - - return x.isNeg() && !x.isZero() ? '-' + str : str; -}; - - -/* - * Return a new Decimal whose value is the value of this Decimal truncated to a whole number. - * - */ -P.truncated = P.trunc = function () { - return finalise(new this.constructor(this), this.e + 1, 1); -}; - - -/* - * Return a string representing the value of this Decimal. - * Unlike `toString`, negative zero will include the minus sign. - * - */ -P.valueOf = P.toJSON = function () { - var x = this, - Ctor = x.constructor, - str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); - - return x.isNeg() ? '-' + str : str; -}; - - -// Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers. - - -/* - * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower, - * finiteToString, naturalExponential, naturalLogarithm - * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest, - * P.toPrecision, P.toSignificantDigits, toStringBinary, random - * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm - * convertBase toStringBinary, parseOther - * cos P.cos - * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy, - * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction, - * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm, - * taylorSeries, atan2, parseOther - * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh, - * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus, - * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot, - * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed, - * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits, - * P.truncated, divide, getLn10, getPi, naturalExponential, - * naturalLogarithm, ceil, floor, round, trunc - * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf, - * toStringBinary - * getBase10Exponent P.minus, P.plus, P.times, parseOther - * getLn10 P.logarithm, naturalLogarithm - * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2 - * getPrecision P.precision, P.toFraction - * getZeroString digitsToString, finiteToString - * intPow P.toPower, parseOther - * isOdd toLessThanHalfPi - * maxOrMin max, min - * naturalExponential P.naturalExponential, P.toPower - * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm, - * P.toPower, naturalExponential - * nonFiniteToString finiteToString, toStringBinary - * parseDecimal Decimal - * parseOther Decimal - * sin P.sin - * taylorSeries P.cosh, P.sinh, cos, sin - * toLessThanHalfPi P.cos, P.sin - * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal - * truncate intPow - * - * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi, - * naturalLogarithm, config, parseOther, random, Decimal - */ - - -function digitsToString(d) { - var i, k, ws, - indexOfLastWord = d.length - 1, - str = '', - w = d[0]; - - if (indexOfLastWord > 0) { - str += w; - for (i = 1; i < indexOfLastWord; i++) { - ws = d[i] + ''; - k = LOG_BASE - ws.length; - if (k) str += getZeroString(k); - str += ws; - } - - w = d[i]; - ws = w + ''; - k = LOG_BASE - ws.length; - if (k) str += getZeroString(k); - } else if (w === 0) { - return '0'; - } - - // Remove trailing zeros of last w. - for (; w % 10 === 0;) w /= 10; - - return str + w; -} - - -function checkInt32(i, min, max) { - if (i !== ~~i || i < min || i > max) { - throw Error(invalidArgument + i); - } -} - - -/* - * Check 5 rounding digits if `repeating` is null, 4 otherwise. - * `repeating == null` if caller is `log` or `pow`, - * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`. - */ -function checkRoundingDigits(d, i, rm, repeating) { - var di, k, r, rd; - - // Get the length of the first word of the array d. - for (k = d[0]; k >= 10; k /= 10) --i; - - // Is the rounding digit in the first word of d? - if (--i < 0) { - i += LOG_BASE; - di = 0; - } else { - di = Math.ceil((i + 1) / LOG_BASE); - i %= LOG_BASE; - } - - // i is the index (0 - 6) of the rounding digit. - // E.g. if within the word 3487563 the first rounding digit is 5, - // then i = 4, k = 1000, rd = 3487563 % 1000 = 563 - k = mathpow(10, LOG_BASE - i); - rd = d[di] % k | 0; - - if (repeating == null) { - if (i < 3) { - if (i == 0) rd = rd / 100 | 0; - else if (i == 1) rd = rd / 10 | 0; - r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0; - } else { - r = (rm < 4 && rd + 1 == k || rm > 3 && rd + 1 == k / 2) && - (d[di + 1] / k / 100 | 0) == mathpow(10, i - 2) - 1 || - (rd == k / 2 || rd == 0) && (d[di + 1] / k / 100 | 0) == 0; - } - } else { - if (i < 4) { - if (i == 0) rd = rd / 1000 | 0; - else if (i == 1) rd = rd / 100 | 0; - else if (i == 2) rd = rd / 10 | 0; - r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999; - } else { - r = ((repeating || rm < 4) && rd + 1 == k || - (!repeating && rm > 3) && rd + 1 == k / 2) && - (d[di + 1] / k / 1000 | 0) == mathpow(10, i - 3) - 1; - } - } - - return r; -} - - -// Convert string of `baseIn` to an array of numbers of `baseOut`. -// Eg. convertBase('255', 10, 16) returns [15, 15]. -// Eg. convertBase('ff', 16, 10) returns [2, 5, 5]. -function convertBase(str, baseIn, baseOut) { - var j, - arr = [0], - arrL, - i = 0, - strL = str.length; - - for (; i < strL;) { - for (arrL = arr.length; arrL--;) arr[arrL] *= baseIn; - arr[0] += NUMERALS.indexOf(str.charAt(i++)); - for (j = 0; j < arr.length; j++) { - if (arr[j] > baseOut - 1) { - if (arr[j + 1] === void 0) arr[j + 1] = 0; - arr[j + 1] += arr[j] / baseOut | 0; - arr[j] %= baseOut; - } - } - } - - return arr.reverse(); -} - - -/* - * cos(x) = 1 - x^2/2! + x^4/4! - ... - * |x| < pi/2 - * - */ -function cosine(Ctor, x) { - var k, len, y; - - if (x.isZero()) return x; - - // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1 - // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1 - - // Estimate the optimum number of times to use the argument reduction. - len = x.d.length; - if (len < 32) { - k = Math.ceil(len / 3); - y = (1 / tinyPow(4, k)).toString(); - } else { - k = 16; - y = '2.3283064365386962890625e-10'; - } - - Ctor.precision += k; - - x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1)); - - // Reverse argument reduction - for (var i = k; i--;) { - var cos2x = x.times(x); - x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1); - } - - Ctor.precision -= k; - - return x; -} - - -/* - * Perform division in the specified base. - */ -var divide = (function () { - - // Assumes non-zero x and k, and hence non-zero result. - function multiplyInteger(x, k, base) { - var temp, - carry = 0, - i = x.length; - - for (x = x.slice(); i--;) { - temp = x[i] * k + carry; - x[i] = temp % base | 0; - carry = temp / base | 0; - } - - if (carry) x.unshift(carry); - - return x; - } - - function compare(a, b, aL, bL) { - var i, r; - - if (aL != bL) { - r = aL > bL ? 1 : -1; - } else { - for (i = r = 0; i < aL; i++) { - if (a[i] != b[i]) { - r = a[i] > b[i] ? 1 : -1; - break; - } - } - } - - return r; - } - - function subtract(a, b, aL, base) { - var i = 0; - - // Subtract b from a. - for (; aL--;) { - a[aL] -= i; - i = a[aL] < b[aL] ? 1 : 0; - a[aL] = i * base + a[aL] - b[aL]; - } - - // Remove leading zeros. - for (; !a[0] && a.length > 1;) a.shift(); - } - - return function (x, y, pr, rm, dp, base) { - var cmp, e, i, k, logBase, more, prod, prodL, q, qd, rem, remL, rem0, sd, t, xi, xL, yd0, - yL, yz, - Ctor = x.constructor, - sign = x.s == y.s ? 1 : -1, - xd = x.d, - yd = y.d; - - // Either NaN, Infinity or 0? - if (!xd || !xd[0] || !yd || !yd[0]) { - - return new Ctor(// Return NaN if either NaN, or both Infinity or 0. - !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN : - - // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0. - xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0); - } - - if (base) { - logBase = 1; - e = x.e - y.e; - } else { - base = BASE; - logBase = LOG_BASE; - e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase); - } - - yL = yd.length; - xL = xd.length; - q = new Ctor(sign); - qd = q.d = []; - - // Result exponent may be one less than e. - // The digit array of a Decimal from toStringBinary may have trailing zeros. - for (i = 0; yd[i] == (xd[i] || 0); i++); - - if (yd[i] > (xd[i] || 0)) e--; - - if (pr == null) { - sd = pr = Ctor.precision; - rm = Ctor.rounding; - } else if (dp) { - sd = pr + (x.e - y.e) + 1; - } else { - sd = pr; - } - - if (sd < 0) { - qd.push(1); - more = true; - } else { - - // Convert precision in number of base 10 digits to base 1e7 digits. - sd = sd / logBase + 2 | 0; - i = 0; - - // divisor < 1e7 - if (yL == 1) { - k = 0; - yd = yd[0]; - sd++; - - // k is the carry. - for (; (i < xL || k) && sd--; i++) { - t = k * base + (xd[i] || 0); - qd[i] = t / yd | 0; - k = t % yd | 0; - } - - more = k || i < xL; - - // divisor >= 1e7 - } else { - - // Normalise xd and yd so highest order digit of yd is >= base/2 - k = base / (yd[0] + 1) | 0; - - if (k > 1) { - yd = multiplyInteger(yd, k, base); - xd = multiplyInteger(xd, k, base); - yL = yd.length; - xL = xd.length; - } - - xi = yL; - rem = xd.slice(0, yL); - remL = rem.length; - - // Add zeros to make remainder as long as divisor. - for (; remL < yL;) rem[remL++] = 0; - - yz = yd.slice(); - yz.unshift(0); - yd0 = yd[0]; - - if (yd[1] >= base / 2) ++yd0; - - do { - k = 0; - - // Compare divisor and remainder. - cmp = compare(yd, rem, yL, remL); - - // If divisor < remainder. - if (cmp < 0) { - - // Calculate trial digit, k. - rem0 = rem[0]; - if (yL != remL) rem0 = rem0 * base + (rem[1] || 0); - - // k will be how many times the divisor goes into the current remainder. - k = rem0 / yd0 | 0; - - // Algorithm: - // 1. product = divisor * trial digit (k) - // 2. if product > remainder: product -= divisor, k-- - // 3. remainder -= product - // 4. if product was < remainder at 2: - // 5. compare new remainder and divisor - // 6. If remainder > divisor: remainder -= divisor, k++ - - if (k > 1) { - if (k >= base) k = base - 1; - - // product = divisor * trial digit. - prod = multiplyInteger(yd, k, base); - prodL = prod.length; - remL = rem.length; - - // Compare product and remainder. - cmp = compare(prod, rem, prodL, remL); - - // product > remainder. - if (cmp == 1) { - k--; - - // Subtract divisor from product. - subtract(prod, yL < prodL ? yz : yd, prodL, base); - } - } else { - - // cmp is -1. - // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1 - // to avoid it. If k is 1 there is a need to compare yd and rem again below. - if (k == 0) cmp = k = 1; - prod = yd.slice(); - } - - prodL = prod.length; - if (prodL < remL) prod.unshift(0); - - // Subtract product from remainder. - subtract(rem, prod, remL, base); - - // If product was < previous remainder. - if (cmp == -1) { - remL = rem.length; - - // Compare divisor and new remainder. - cmp = compare(yd, rem, yL, remL); - - // If divisor < new remainder, subtract divisor from remainder. - if (cmp < 1) { - k++; - - // Subtract divisor from remainder. - subtract(rem, yL < remL ? yz : yd, remL, base); - } - } - - remL = rem.length; - } else if (cmp === 0) { - k++; - rem = [0]; - } // if cmp === 1, k will be 0 - - // Add the next digit, k, to the result array. - qd[i++] = k; - - // Update the remainder. - if (cmp && rem[0]) { - rem[remL++] = xd[xi] || 0; - } else { - rem = [xd[xi]]; - remL = 1; - } - - } while ((xi++ < xL || rem[0] !== void 0) && sd--); - - more = rem[0] !== void 0; - } - - // Leading zero? - if (!qd[0]) qd.shift(); - } - - // logBase is 1 when divide is being used for base conversion. - if (logBase == 1) { - q.e = e; - inexact = more; - } else { - - // To calculate q.e, first get the number of digits of qd[0]. - for (i = 1, k = qd[0]; k >= 10; k /= 10) i++; - q.e = i + e * logBase - 1; - - finalise(q, dp ? pr + q.e + 1 : pr, rm, more); - } - - return q; - }; -})(); - - -/* - * Round `x` to `sd` significant digits using rounding mode `rm`. - * Check for over/under-flow. - */ - function finalise(x, sd, rm, isTruncated) { - var digits, i, j, k, rd, roundUp, w, xd, xdi, - Ctor = x.constructor; - - // Don't round if sd is null or undefined. - out: if (sd != null) { - xd = x.d; - - // Infinity/NaN. - if (!xd) return x; - - // rd: the rounding digit, i.e. the digit after the digit that may be rounded up. - // w: the word of xd containing rd, a base 1e7 number. - // xdi: the index of w within xd. - // digits: the number of digits of w. - // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if - // they had leading zeros) - // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero). - - // Get the length of the first word of the digits array xd. - for (digits = 1, k = xd[0]; k >= 10; k /= 10) digits++; - i = sd - digits; - - // Is the rounding digit in the first word of xd? - if (i < 0) { - i += LOG_BASE; - j = sd; - w = xd[xdi = 0]; - - // Get the rounding digit at index j of w. - rd = w / mathpow(10, digits - j - 1) % 10 | 0; - } else { - xdi = Math.ceil((i + 1) / LOG_BASE); - k = xd.length; - if (xdi >= k) { - if (isTruncated) { - - // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`. - for (; k++ <= xdi;) xd.push(0); - w = rd = 0; - digits = 1; - i %= LOG_BASE; - j = i - LOG_BASE + 1; - } else { - break out; - } - } else { - w = k = xd[xdi]; - - // Get the number of digits of w. - for (digits = 1; k >= 10; k /= 10) digits++; - - // Get the index of rd within w. - i %= LOG_BASE; - - // Get the index of rd within w, adjusted for leading zeros. - // The number of leading zeros of w is given by LOG_BASE - digits. - j = i - LOG_BASE + digits; - - // Get the rounding digit at index j of w. - rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0; - } - } - - // Are there any non-zero digits after the rounding digit? - isTruncated = isTruncated || sd < 0 || - xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1)); - - // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right - // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression - // will give 714. - - roundUp = rm < 4 - ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) - : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 && - - // Check whether the digit to the left of the rounding digit is odd. - ((i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10) & 1 || - rm == (x.s < 0 ? 8 : 7)); - - if (sd < 1 || !xd[0]) { - xd.length = 0; - if (roundUp) { - - // Convert sd to decimal places. - sd -= x.e + 1; - - // 1, 0.1, 0.01, 0.001, 0.0001 etc. - xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE); - x.e = -sd || 0; - } else { - - // Zero. - xd[0] = x.e = 0; - } - - return x; - } - - // Remove excess digits. - if (i == 0) { - xd.length = xdi; - k = 1; - xdi--; - } else { - xd.length = xdi + 1; - k = mathpow(10, LOG_BASE - i); - - // E.g. 56700 becomes 56000 if 7 is the rounding digit. - // j > 0 means i > number of leading zeros of w. - xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0; - } - - if (roundUp) { - for (;;) { - - // Is the digit to be rounded up in the first word of xd? - if (xdi == 0) { - - // i will be the length of xd[0] before k is added. - for (i = 1, j = xd[0]; j >= 10; j /= 10) i++; - j = xd[0] += k; - for (k = 1; j >= 10; j /= 10) k++; - - // if i != k the length has increased. - if (i != k) { - x.e++; - if (xd[0] == BASE) xd[0] = 1; - } - - break; - } else { - xd[xdi] += k; - if (xd[xdi] != BASE) break; - xd[xdi--] = 0; - k = 1; - } - } - } - - // Remove trailing zeros. - for (i = xd.length; xd[--i] === 0;) xd.pop(); - } - - if (external) { - - // Overflow? - if (x.e > Ctor.maxE) { - - // Infinity. - x.d = null; - x.e = NaN; - - // Underflow? - } else if (x.e < Ctor.minE) { - - // Zero. - x.e = 0; - x.d = [0]; - // Ctor.underflow = true; - } // else Ctor.underflow = false; - } - - return x; -} - - -function finiteToString(x, isExp, sd) { - if (!x.isFinite()) return nonFiniteToString(x); - var k, - e = x.e, - str = digitsToString(x.d), - len = str.length; - - if (isExp) { - if (sd && (k = sd - len) > 0) { - str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k); - } else if (len > 1) { - str = str.charAt(0) + '.' + str.slice(1); - } - - str = str + (x.e < 0 ? 'e' : 'e+') + x.e; - } else if (e < 0) { - str = '0.' + getZeroString(-e - 1) + str; - if (sd && (k = sd - len) > 0) str += getZeroString(k); - } else if (e >= len) { - str += getZeroString(e + 1 - len); - if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k); - } else { - if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k); - if (sd && (k = sd - len) > 0) { - if (e + 1 === len) str += '.'; - str += getZeroString(k); - } - } - - return str; -} - - -// Calculate the base 10 exponent from the base 1e7 exponent. -function getBase10Exponent(digits, e) { - var w = digits[0]; - - // Add the number of digits of the first word of the digits array. - for ( e *= LOG_BASE; w >= 10; w /= 10) e++; - return e; -} - - -function getLn10(Ctor, sd, pr) { - if (sd > LN10_PRECISION) { - - // Reset global state in case the exception is caught. - external = true; - if (pr) Ctor.precision = pr; - throw Error(precisionLimitExceeded); - } - return finalise(new Ctor(LN10), sd, 1, true); -} - - -function getPi(Ctor, sd, rm) { - if (sd > PI_PRECISION) throw Error(precisionLimitExceeded); - return finalise(new Ctor(PI), sd, rm, true); -} - - -function getPrecision(digits) { - var w = digits.length - 1, - len = w * LOG_BASE + 1; - - w = digits[w]; - - // If non-zero... - if (w) { - - // Subtract the number of trailing zeros of the last word. - for (; w % 10 == 0; w /= 10) len--; - - // Add the number of digits of the first word. - for (w = digits[0]; w >= 10; w /= 10) len++; - } - - return len; -} - - -function getZeroString(k) { - var zs = ''; - for (; k--;) zs += '0'; - return zs; -} - - -/* - * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an - * integer of type number. - * - * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`. - * - */ -function intPow(Ctor, x, n, pr) { - var isTruncated, - r = new Ctor(1), - - // Max n of 9007199254740991 takes 53 loop iterations. - // Maximum digits array length; leaves [28, 34] guard digits. - k = Math.ceil(pr / LOG_BASE + 4); - - external = false; - - for (;;) { - if (n % 2) { - r = r.times(x); - if (truncate(r.d, k)) isTruncated = true; - } - - n = mathfloor(n / 2); - if (n === 0) { - - // To ensure correct rounding when r.d is truncated, increment the last word if it is zero. - n = r.d.length - 1; - if (isTruncated && r.d[n] === 0) ++r.d[n]; - break; - } - - x = x.times(x); - truncate(x.d, k); - } - - external = true; - - return r; -} - - -function isOdd(n) { - return n.d[n.d.length - 1] & 1; -} - - -/* - * Handle `max` (`n` is -1) and `min` (`n` is 1). - */ -function maxOrMin(Ctor, args, n) { - var k, y, - x = new Ctor(args[0]), - i = 0; - - for (; ++i < args.length;) { - y = new Ctor(args[i]); - - // NaN? - if (!y.s) { - x = y; - break; - } - - k = x.cmp(y); - - if (k === n || k === 0 && x.s === n) { - x = y; - } - } - - return x; -} - - -/* - * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant - * digits. - * - * Taylor/Maclaurin series. - * - * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ... - * - * Argument reduction: - * Repeat x = x / 32, k += 5, until |x| < 0.1 - * exp(x) = exp(x / 2^k)^(2^k) - * - * Previously, the argument was initially reduced by - * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10) - * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was - * found to be slower than just dividing repeatedly by 32 as above. - * - * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000 - * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000 - * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324) - * - * exp(Infinity) = Infinity - * exp(-Infinity) = 0 - * exp(NaN) = NaN - * exp(±0) = 1 - * - * exp(x) is non-terminating for any finite, non-zero x. - * - * The result will always be correctly rounded. - * - */ -function naturalExponential(x, sd) { - var denominator, guard, j, pow, sum, t, wpr, - rep = 0, - i = 0, - k = 0, - Ctor = x.constructor, - rm = Ctor.rounding, - pr = Ctor.precision; - - // 0/NaN/Infinity? - if (!x.d || !x.d[0] || x.e > 17) { - - return new Ctor(x.d - ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0 - : x.s ? x.s < 0 ? 0 : x : 0 / 0); - } - - if (sd == null) { - external = false; - wpr = pr; - } else { - wpr = sd; - } - - t = new Ctor(0.03125); - - // while abs(x) >= 0.1 - while (x.e > -2) { - - // x = x / 2^5 - x = x.times(t); - k += 5; - } - - // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision - // necessary to ensure the first 4 rounding digits are correct. - guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0; - wpr += guard; - denominator = pow = sum = new Ctor(1); - Ctor.precision = wpr; - - for (;;) { - pow = finalise(pow.times(x), wpr, 1); - denominator = denominator.times(++i); - t = sum.plus(divide(pow, denominator, wpr, 1)); - - if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) { - j = k; - while (j--) sum = finalise(sum.times(sum), wpr, 1); - - // Check to see if the first 4 rounding digits are [49]999. - // If so, repeat the summation with a higher precision, otherwise - // e.g. with precision: 18, rounding: 1 - // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123) - // `wpr - guard` is the index of first rounding digit. - if (sd == null) { - - if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) { - Ctor.precision = wpr += 10; - denominator = pow = t = new Ctor(1); - i = 0; - rep++; - } else { - return finalise(sum, Ctor.precision = pr, rm, external = true); - } - } else { - Ctor.precision = pr; - return sum; - } - } - - sum = t; - } -} - - -/* - * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant - * digits. - * - * ln(-n) = NaN - * ln(0) = -Infinity - * ln(-0) = -Infinity - * ln(1) = 0 - * ln(Infinity) = Infinity - * ln(-Infinity) = NaN - * ln(NaN) = NaN - * - * ln(n) (n != 1) is non-terminating. - * - */ -function naturalLogarithm(y, sd) { - var c, c0, denominator, e, numerator, rep, sum, t, wpr, x1, x2, - n = 1, - guard = 10, - x = y, - xd = x.d, - Ctor = x.constructor, - rm = Ctor.rounding, - pr = Ctor.precision; - - // Is x negative or Infinity, NaN, 0 or 1? - if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) { - return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x); - } - - if (sd == null) { - external = false; - wpr = pr; - } else { - wpr = sd; - } - - Ctor.precision = wpr += guard; - c = digitsToString(xd); - c0 = c.charAt(0); - - if (Math.abs(e = x.e) < 1.5e15) { - - // Argument reduction. - // The series converges faster the closer the argument is to 1, so using - // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b - // multiply the argument by itself until the leading digits of the significand are 7, 8, 9, - // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can - // later be divided by this number, then separate out the power of 10 using - // ln(a*10^b) = ln(a) + b*ln(10). - - // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14). - //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) { - // max n is 6 (gives 0.7 - 1.3) - while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) { - x = x.times(y); - c = digitsToString(x.d); - c0 = c.charAt(0); - n++; - } - - e = x.e; - - if (c0 > 1) { - x = new Ctor('0.' + c); - e++; - } else { - x = new Ctor(c0 + '.' + c.slice(1)); - } - } else { - - // The argument reduction method above may result in overflow if the argument y is a massive - // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this - // function using ln(x*10^e) = ln(x) + e*ln(10). - t = getLn10(Ctor, wpr + 2, pr).times(e + ''); - x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t); - Ctor.precision = pr; - - return sd == null ? finalise(x, pr, rm, external = true) : x; - } - - // x1 is x reduced to a value near 1. - x1 = x; - - // Taylor series. - // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...) - // where x = (y - 1)/(y + 1) (|x| < 1) - sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1); - x2 = finalise(x.times(x), wpr, 1); - denominator = 3; - - for (;;) { - numerator = finalise(numerator.times(x2), wpr, 1); - t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1)); - - if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) { - sum = sum.times(2); - - // Reverse the argument reduction. Check that e is not 0 because, besides preventing an - // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0. - if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + '')); - sum = divide(sum, new Ctor(n), wpr, 1); - - // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has - // been repeated previously) and the first 4 rounding digits 9999? - // If so, restart the summation with a higher precision, otherwise - // e.g. with precision: 12, rounding: 1 - // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463. - // `wpr - guard` is the index of first rounding digit. - if (sd == null) { - if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) { - Ctor.precision = wpr += guard; - t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1); - x2 = finalise(x.times(x), wpr, 1); - denominator = rep = 1; - } else { - return finalise(sum, Ctor.precision = pr, rm, external = true); - } - } else { - Ctor.precision = pr; - return sum; - } - } - - sum = t; - denominator += 2; - } -} - - -// ±Infinity, NaN. -function nonFiniteToString(x) { - // Unsigned. - return String(x.s * x.s / 0); -} - - -/* - * Parse the value of a new Decimal `x` from string `str`. - */ -function parseDecimal(x, str) { - var e, i, len; - - // TODO BigInt str: no need to check for decimal point, exponential form or leading zeros. - // Decimal point? - if ((e = str.indexOf('.')) > -1) str = str.replace('.', ''); - - // Exponential form? - if ((i = str.search(/e/i)) > 0) { - - // Determine exponent. - if (e < 0) e = i; - e += +str.slice(i + 1); - str = str.substring(0, i); - } else if (e < 0) { - - // Integer. - e = str.length; - } - - // Determine leading zeros. - for (i = 0; str.charCodeAt(i) === 48; i++); - - // Determine trailing zeros. - for (len = str.length; str.charCodeAt(len - 1) === 48; --len); - str = str.slice(i, len); - - if (str) { - len -= i; - x.e = e = e - i - 1; - x.d = []; - - // Transform base - - // e is the base 10 exponent. - // i is where to slice str to get the first word of the digits array. - i = (e + 1) % LOG_BASE; - if (e < 0) i += LOG_BASE; - - if (i < len) { - if (i) x.d.push(+str.slice(0, i)); - for (len -= LOG_BASE; i < len;) x.d.push(+str.slice(i, i += LOG_BASE)); - str = str.slice(i); - i = LOG_BASE - str.length; - } else { - i -= len; - } - - for (; i--;) str += '0'; - x.d.push(+str); - - if (external) { - - // Overflow? - if (x.e > x.constructor.maxE) { - - // Infinity. - x.d = null; - x.e = NaN; - - // Underflow? - } else if (x.e < x.constructor.minE) { - - // Zero. - x.e = 0; - x.d = [0]; - // x.constructor.underflow = true; - } // else x.constructor.underflow = false; - } - } else { - - // Zero. - x.e = 0; - x.d = [0]; - } - - return x; -} - - -/* - * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value. - */ -function parseOther(x, str) { - var base, Ctor, divisor, i, isFloat, len, p, xd, xe; - - if (str.indexOf('_') > -1) { - str = str.replace(/(\d)_(?=\d)/g, '$1'); - if (isDecimal.test(str)) return parseDecimal(x, str); - } else if (str === 'Infinity' || str === 'NaN') { - if (!+str) x.s = NaN; - x.e = NaN; - x.d = null; - return x; - } - - if (isHex.test(str)) { - base = 16; - str = str.toLowerCase(); - } else if (isBinary.test(str)) { - base = 2; - } else if (isOctal.test(str)) { - base = 8; - } else { - throw Error(invalidArgument + str); - } - - // Is there a binary exponent part? - i = str.search(/p/i); - - if (i > 0) { - p = +str.slice(i + 1); - str = str.substring(2, i); - } else { - str = str.slice(2); - } - - // Convert `str` as an integer then divide the result by `base` raised to a power such that the - // fraction part will be restored. - i = str.indexOf('.'); - isFloat = i >= 0; - Ctor = x.constructor; - - if (isFloat) { - str = str.replace('.', ''); - len = str.length; - i = len - i; - - // log[10](16) = 1.2041... , log[10](88) = 1.9444.... - divisor = intPow(Ctor, new Ctor(base), i, i * 2); - } - - xd = convertBase(str, base, BASE); - xe = xd.length - 1; - - // Remove trailing zeros. - for (i = xe; xd[i] === 0; --i) xd.pop(); - if (i < 0) return new Ctor(x.s * 0); - x.e = getBase10Exponent(xd, xe); - x.d = xd; - external = false; - - // At what precision to perform the division to ensure exact conversion? - // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount) - // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412 - // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits. - // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount - // Therefore using 4 * the number of digits of str will always be enough. - if (isFloat) x = divide(x, divisor, len * 4); - - // Multiply by the binary exponent part if present. - if (p) x = x.times(Math.abs(p) < 54 ? mathpow(2, p) : Decimal.pow(2, p)); - external = true; - - return x; -} - - -/* - * sin(x) = x - x^3/3! + x^5/5! - ... - * |x| < pi/2 - * - */ -function sine(Ctor, x) { - var k, - len = x.d.length; - - if (len < 3) { - return x.isZero() ? x : taylorSeries(Ctor, 2, x, x); - } - - // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x) - // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5) - // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20)) - - // Estimate the optimum number of times to use the argument reduction. - k = 1.4 * Math.sqrt(len); - k = k > 16 ? 16 : k | 0; - - x = x.times(1 / tinyPow(5, k)); - x = taylorSeries(Ctor, 2, x, x); - - // Reverse argument reduction - var sin2_x, - d5 = new Ctor(5), - d16 = new Ctor(16), - d20 = new Ctor(20); - for (; k--;) { - sin2_x = x.times(x); - x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20)))); - } - - return x; -} - - -// Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`. -function taylorSeries(Ctor, n, x, y, isHyperbolic) { - var j, t, u, x2, - i = 1, - pr = Ctor.precision, - k = Math.ceil(pr / LOG_BASE); - - external = false; - x2 = x.times(x); - u = new Ctor(y); - - for (;;) { - t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1); - u = isHyperbolic ? y.plus(t) : y.minus(t); - y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1); - t = u.plus(y); - - if (t.d[k] !== void 0) { - for (j = k; t.d[j] === u.d[j] && j--;); - if (j == -1) break; - } - - j = u; - u = y; - y = t; - t = j; - i++; - } - - external = true; - t.d.length = k + 1; - - return t; -} - - -// Exponent e must be positive and non-zero. -function tinyPow(b, e) { - var n = b; - while (--e) n *= b; - return n; -} - - -// Return the absolute value of `x` reduced to less than or equal to half pi. -function toLessThanHalfPi(Ctor, x) { - var t, - isNeg = x.s < 0, - pi = getPi(Ctor, Ctor.precision, 1), - halfPi = pi.times(0.5); - - x = x.abs(); - - if (x.lte(halfPi)) { - quadrant = isNeg ? 4 : 1; - return x; - } - - t = x.divToInt(pi); - - if (t.isZero()) { - quadrant = isNeg ? 3 : 2; - } else { - x = x.minus(t.times(pi)); - - // 0 <= x < pi - if (x.lte(halfPi)) { - quadrant = isOdd(t) ? (isNeg ? 2 : 3) : (isNeg ? 4 : 1); - return x; - } - - quadrant = isOdd(t) ? (isNeg ? 1 : 4) : (isNeg ? 3 : 2); - } - - return x.minus(pi).abs(); -} - - -/* - * Return the value of Decimal `x` as a string in base `baseOut`. - * - * If the optional `sd` argument is present include a binary exponent suffix. - */ -function toStringBinary(x, baseOut, sd, rm) { - var base, e, i, k, len, roundUp, str, xd, y, - Ctor = x.constructor, - isExp = sd !== void 0; - - if (isExp) { - checkInt32(sd, 1, MAX_DIGITS); - if (rm === void 0) rm = Ctor.rounding; - else checkInt32(rm, 0, 8); - } else { - sd = Ctor.precision; - rm = Ctor.rounding; - } - - if (!x.isFinite()) { - str = nonFiniteToString(x); - } else { - str = finiteToString(x); - i = str.indexOf('.'); - - // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required: - // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10)) - // minBinaryExponent = floor(decimalExponent * log[2](10)) - // log[2](10) = 3.321928094887362347870319429489390175864 - - if (isExp) { - base = 2; - if (baseOut == 16) { - sd = sd * 4 - 3; - } else if (baseOut == 8) { - sd = sd * 3 - 2; - } - } else { - base = baseOut; - } - - // Convert the number as an integer then divide the result by its base raised to a power such - // that the fraction part will be restored. - - // Non-integer. - if (i >= 0) { - str = str.replace('.', ''); - y = new Ctor(1); - y.e = str.length - i; - y.d = convertBase(finiteToString(y), 10, base); - y.e = y.d.length; - } - - xd = convertBase(str, 10, base); - e = len = xd.length; - - // Remove trailing zeros. - for (; xd[--len] == 0;) xd.pop(); - - if (!xd[0]) { - str = isExp ? '0p+0' : '0'; - } else { - if (i < 0) { - e--; - } else { - x = new Ctor(x); - x.d = xd; - x.e = e; - x = divide(x, y, sd, rm, 0, base); - xd = x.d; - e = x.e; - roundUp = inexact; - } - - // The rounding digit, i.e. the digit after the digit that may be rounded up. - i = xd[sd]; - k = base / 2; - roundUp = roundUp || xd[sd + 1] !== void 0; - - roundUp = rm < 4 - ? (i !== void 0 || roundUp) && (rm === 0 || rm === (x.s < 0 ? 3 : 2)) - : i > k || i === k && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 || - rm === (x.s < 0 ? 8 : 7)); - - xd.length = sd; - - if (roundUp) { - - // Rounding up may mean the previous digit has to be rounded up and so on. - for (; ++xd[--sd] > base - 1;) { - xd[sd] = 0; - if (!sd) { - ++e; - xd.unshift(1); - } - } - } - - // Determine trailing zeros. - for (len = xd.length; !xd[len - 1]; --len); - - // E.g. [4, 11, 15] becomes 4bf. - for (i = 0, str = ''; i < len; i++) str += NUMERALS.charAt(xd[i]); - - // Add binary exponent suffix? - if (isExp) { - if (len > 1) { - if (baseOut == 16 || baseOut == 8) { - i = baseOut == 16 ? 4 : 3; - for (--len; len % i; len++) str += '0'; - xd = convertBase(str, base, baseOut); - for (len = xd.length; !xd[len - 1]; --len); - - // xd[0] will always be be 1 - for (i = 1, str = '1.'; i < len; i++) str += NUMERALS.charAt(xd[i]); - } else { - str = str.charAt(0) + '.' + str.slice(1); - } - } - - str = str + (e < 0 ? 'p' : 'p+') + e; - } else if (e < 0) { - for (; ++e;) str = '0' + str; - str = '0.' + str; - } else { - if (++e > len) for (e -= len; e-- ;) str += '0'; - else if (e < len) str = str.slice(0, e) + '.' + str.slice(e); - } - } - - str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str; - } - - return x.s < 0 ? '-' + str : str; -} - - -// Does not strip trailing zeros. -function truncate(arr, len) { - if (arr.length > len) { - arr.length = len; - return true; - } -} - - -// Decimal methods - - -/* - * abs - * acos - * acosh - * add - * asin - * asinh - * atan - * atanh - * atan2 - * cbrt - * ceil - * clamp - * clone - * config - * cos - * cosh - * div - * exp - * floor - * hypot - * ln - * log - * log2 - * log10 - * max - * min - * mod - * mul - * pow - * random - * round - * set - * sign - * sin - * sinh - * sqrt - * sub - * sum - * tan - * tanh - * trunc - */ - - -/* - * Return a new Decimal whose value is the absolute value of `x`. - * - * x {number|string|bigint|Decimal} - * - */ -function abs(x) { - return new this(x).abs(); -} - - -/* - * Return a new Decimal whose value is the arccosine in radians of `x`. - * - * x {number|string|bigint|Decimal} - * - */ -function acos(x) { - return new this(x).acos(); -} - - -/* - * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to - * `precision` significant digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} A value in radians. - * - */ -function acosh(x) { - return new this(x).acosh(); -} - - -/* - * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant - * digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} - * y {number|string|bigint|Decimal} - * - */ -function add(x, y) { - return new this(x).plus(y); -} - - -/* - * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} - * - */ -function asin(x) { - return new this(x).asin(); -} - - -/* - * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to - * `precision` significant digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} A value in radians. - * - */ -function asinh(x) { - return new this(x).asinh(); -} - - -/* - * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} - * - */ -function atan(x) { - return new this(x).atan(); -} - - -/* - * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to - * `precision` significant digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} A value in radians. - * - */ -function atanh(x) { - return new this(x).atanh(); -} - - -/* - * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi - * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`. - * - * Domain: [-Infinity, Infinity] - * Range: [-pi, pi] - * - * y {number|string|bigint|Decimal} The y-coordinate. - * x {number|string|bigint|Decimal} The x-coordinate. - * - * atan2(±0, -0) = ±pi - * atan2(±0, +0) = ±0 - * atan2(±0, -x) = ±pi for x > 0 - * atan2(±0, x) = ±0 for x > 0 - * atan2(-y, ±0) = -pi/2 for y > 0 - * atan2(y, ±0) = pi/2 for y > 0 - * atan2(±y, -Infinity) = ±pi for finite y > 0 - * atan2(±y, +Infinity) = ±0 for finite y > 0 - * atan2(±Infinity, x) = ±pi/2 for finite x - * atan2(±Infinity, -Infinity) = ±3*pi/4 - * atan2(±Infinity, +Infinity) = ±pi/4 - * atan2(NaN, x) = NaN - * atan2(y, NaN) = NaN - * - */ -function atan2(y, x) { - y = new this(y); - x = new this(x); - var r, - pr = this.precision, - rm = this.rounding, - wpr = pr + 4; - - // Either NaN - if (!y.s || !x.s) { - r = new this(NaN); - - // Both ±Infinity - } else if (!y.d && !x.d) { - r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75); - r.s = y.s; - - // x is ±Infinity or y is ±0 - } else if (!x.d || y.isZero()) { - r = x.s < 0 ? getPi(this, pr, rm) : new this(0); - r.s = y.s; - - // y is ±Infinity or x is ±0 - } else if (!y.d || x.isZero()) { - r = getPi(this, wpr, 1).times(0.5); - r.s = y.s; - - // Both non-zero and finite - } else if (x.s < 0) { - this.precision = wpr; - this.rounding = 1; - r = this.atan(divide(y, x, wpr, 1)); - x = getPi(this, wpr, 1); - this.precision = pr; - this.rounding = rm; - r = y.s < 0 ? r.minus(x) : r.plus(x); - } else { - r = this.atan(divide(y, x, wpr, 1)); - } - - return r; -} - - -/* - * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant - * digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} - * - */ -function cbrt(x) { - return new this(x).cbrt(); -} - - -/* - * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`. - * - * x {number|string|bigint|Decimal} - * - */ -function ceil(x) { - return finalise(x = new this(x), x.e + 1, 2); -} - - -/* - * Return a new Decimal whose value is `x` clamped to the range delineated by `min` and `max`. - * - * x {number|string|bigint|Decimal} - * min {number|string|bigint|Decimal} - * max {number|string|bigint|Decimal} - * - */ -function clamp(x, min, max) { - return new this(x).clamp(min, max); -} - - -/* - * Configure global settings for a Decimal constructor. - * - * `obj` is an object with one or more of the following properties, - * - * precision {number} - * rounding {number} - * toExpNeg {number} - * toExpPos {number} - * maxE {number} - * minE {number} - * modulo {number} - * crypto {boolean|number} - * defaults {true} - * - * E.g. Decimal.config({ precision: 20, rounding: 4 }) - * - */ -function config(obj) { - if (!obj || typeof obj !== 'object') throw Error(decimalError + 'Object expected'); - var i, p, v, - useDefaults = obj.defaults === true, - ps = [ - 'precision', 1, MAX_DIGITS, - 'rounding', 0, 8, - 'toExpNeg', -EXP_LIMIT, 0, - 'toExpPos', 0, EXP_LIMIT, - 'maxE', 0, EXP_LIMIT, - 'minE', -EXP_LIMIT, 0, - 'modulo', 0, 9 - ]; - - for (i = 0; i < ps.length; i += 3) { - if (p = ps[i], useDefaults) this[p] = DEFAULTS[p]; - if ((v = obj[p]) !== void 0) { - if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v; - else throw Error(invalidArgument + p + ': ' + v); - } - } - - if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p]; - if ((v = obj[p]) !== void 0) { - if (v === true || v === false || v === 0 || v === 1) { - if (v) { - if (typeof crypto != 'undefined' && crypto && - (crypto.getRandomValues || crypto.randomBytes)) { - this[p] = true; - } else { - throw Error(cryptoUnavailable); - } - } else { - this[p] = false; - } - } else { - throw Error(invalidArgument + p + ': ' + v); - } - } - - return this; -} - - -/* - * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant - * digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} A value in radians. - * - */ -function cos(x) { - return new this(x).cos(); -} - - -/* - * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision - * significant digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} A value in radians. - * - */ -function cosh(x) { - return new this(x).cosh(); -} - - -/* - * Create and return a Decimal constructor with the same configuration properties as this Decimal - * constructor. - * - */ -function clone(obj) { - var i, p, ps; - - /* - * The Decimal constructor and exported function. - * Return a new Decimal instance. - * - * v {number|string|bigint|Decimal} A numeric value. - * - */ - function Decimal(v) { - var e, i, t, - x = this; - - // Decimal called without new. - if (!(x instanceof Decimal)) return new Decimal(v); - - // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor - // which points to Object. - x.constructor = Decimal; - - if (isDecimalInstance(v)) { - x.s = v.s; - - if (external) { - if (!v.d || v.e > Decimal.maxE) { - - // Infinity. - x.e = NaN; - x.d = null; - } else if (v.e < Decimal.minE) { - - // Zero. - x.e = 0; - x.d = [0]; - } else { - x.e = v.e; - x.d = v.d.slice(); - } - } else { - x.e = v.e; - x.d = v.d ? v.d.slice() : v.d; - } - - return; - } - - t = typeof v; - - if (t === 'number') { - if (v === 0) { - x.s = 1 / v < 0 ? -1 : 1; - x.e = 0; - x.d = [0]; - return; - } - - if (v < 0) { - v = -v; - x.s = -1; - } else { - x.s = 1; - } - - // Fast path for small integers. - if (v === ~~v && v < 1e7) { - for (e = 0, i = v; i >= 10; i /= 10) e++; - - if (external) { - if (e > Decimal.maxE) { - x.e = NaN; - x.d = null; - } else if (e < Decimal.minE) { - x.e = 0; - x.d = [0]; - } else { - x.e = e; - x.d = [v]; - } - } else { - x.e = e; - x.d = [v]; - } - - return; - } - - // Infinity or NaN? - if (v * 0 !== 0) { - if (!v) x.s = NaN; - x.e = NaN; - x.d = null; - return; - } - - return parseDecimal(x, v.toString()); - } - - if (t === 'string') { - if ((i = v.charCodeAt(0)) === 45) { // minus sign - v = v.slice(1); - x.s = -1; - } else { - if (i === 43) v = v.slice(1); // plus sign - x.s = 1; - } - - return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v); - } - - if (t === 'bigint') { - if (v < 0) { - v = -v; - x.s = -1; - } else { - x.s = 1; - } - - return parseDecimal(x, v.toString()); - } - - throw Error(invalidArgument + v); - } - - Decimal.prototype = P; - - Decimal.ROUND_UP = 0; - Decimal.ROUND_DOWN = 1; - Decimal.ROUND_CEIL = 2; - Decimal.ROUND_FLOOR = 3; - Decimal.ROUND_HALF_UP = 4; - Decimal.ROUND_HALF_DOWN = 5; - Decimal.ROUND_HALF_EVEN = 6; - Decimal.ROUND_HALF_CEIL = 7; - Decimal.ROUND_HALF_FLOOR = 8; - Decimal.EUCLID = 9; - - Decimal.config = Decimal.set = config; - Decimal.clone = clone; - Decimal.isDecimal = isDecimalInstance; - - Decimal.abs = abs; - Decimal.acos = acos; - Decimal.acosh = acosh; // ES6 - Decimal.add = add; - Decimal.asin = asin; - Decimal.asinh = asinh; // ES6 - Decimal.atan = atan; - Decimal.atanh = atanh; // ES6 - Decimal.atan2 = atan2; - Decimal.cbrt = cbrt; // ES6 - Decimal.ceil = ceil; - Decimal.clamp = clamp; - Decimal.cos = cos; - Decimal.cosh = cosh; // ES6 - Decimal.div = div; - Decimal.exp = exp; - Decimal.floor = floor; - Decimal.hypot = hypot; // ES6 - Decimal.ln = ln; - Decimal.log = log; - Decimal.log10 = log10; // ES6 - Decimal.log2 = log2; // ES6 - Decimal.max = max; - Decimal.min = min; - Decimal.mod = mod; - Decimal.mul = mul; - Decimal.pow = pow; - Decimal.random = random; - Decimal.round = round; - Decimal.sign = sign; // ES6 - Decimal.sin = sin; - Decimal.sinh = sinh; // ES6 - Decimal.sqrt = sqrt; - Decimal.sub = sub; - Decimal.sum = sum; - Decimal.tan = tan; - Decimal.tanh = tanh; // ES6 - Decimal.trunc = trunc; // ES6 - - if (obj === void 0) obj = {}; - if (obj) { - if (obj.defaults !== true) { - ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto']; - for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p]; - } - } - - Decimal.config(obj); - - return Decimal; -} - - -/* - * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant - * digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} - * y {number|string|bigint|Decimal} - * - */ -function div(x, y) { - return new this(x).div(y); -} - - -/* - * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} The power to which to raise the base of the natural log. - * - */ -function exp(x) { - return new this(x).exp(); -} - - -/* - * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`. - * - * x {number|string|bigint|Decimal} - * - */ -function floor(x) { - return finalise(x = new this(x), x.e + 1, 3); -} - - -/* - * Return a new Decimal whose value is the square root of the sum of the squares of the arguments, - * rounded to `precision` significant digits using rounding mode `rounding`. - * - * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...) - * - * arguments {number|string|bigint|Decimal} - * - */ -function hypot() { - var i, n, - t = new this(0); - - external = false; - - for (i = 0; i < arguments.length;) { - n = new this(arguments[i++]); - if (!n.d) { - if (n.s) { - external = true; - return new this(1 / 0); - } - t = n; - } else if (t.d) { - t = t.plus(n.times(n)); - } - } - - external = true; - - return t.sqrt(); -} - - -/* - * Return true if object is a Decimal instance (where Decimal is any Decimal constructor), - * otherwise return false. - * - */ -function isDecimalInstance(obj) { - return obj instanceof Decimal || obj && obj.toStringTag === tag || false; -} - - -/* - * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} - * - */ -function ln(x) { - return new this(x).ln(); -} - - -/* - * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base - * is specified, rounded to `precision` significant digits using rounding mode `rounding`. - * - * log[y](x) - * - * x {number|string|bigint|Decimal} The argument of the logarithm. - * y {number|string|bigint|Decimal} The base of the logarithm. - * - */ -function log(x, y) { - return new this(x).log(y); -} - - -/* - * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} - * - */ -function log2(x) { - return new this(x).log(2); -} - - -/* - * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} - * - */ -function log10(x) { - return new this(x).log(10); -} - - -/* - * Return a new Decimal whose value is the maximum of the arguments. - * - * arguments {number|string|bigint|Decimal} - * - */ -function max() { - return maxOrMin(this, arguments, -1); -} - - -/* - * Return a new Decimal whose value is the minimum of the arguments. - * - * arguments {number|string|bigint|Decimal} - * - */ -function min() { - return maxOrMin(this, arguments, 1); -} - - -/* - * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits - * using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} - * y {number|string|bigint|Decimal} - * - */ -function mod(x, y) { - return new this(x).mod(y); -} - - -/* - * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant - * digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} - * y {number|string|bigint|Decimal} - * - */ -function mul(x, y) { - return new this(x).mul(y); -} - - -/* - * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision - * significant digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} The base. - * y {number|string|bigint|Decimal} The exponent. - * - */ -function pow(x, y) { - return new this(x).pow(y); -} - - -/* - * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with - * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros - * are produced). - * - * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive. - * - */ -function random(sd) { - var d, e, k, n, - i = 0, - r = new this(1), - rd = []; - - if (sd === void 0) sd = this.precision; - else checkInt32(sd, 1, MAX_DIGITS); - - k = Math.ceil(sd / LOG_BASE); - - if (!this.crypto) { - for (; i < k;) rd[i++] = Math.random() * 1e7 | 0; - - // Browsers supporting crypto.getRandomValues. - } else if (crypto.getRandomValues) { - d = crypto.getRandomValues(new Uint32Array(k)); - - for (; i < k;) { - n = d[i]; - - // 0 <= n < 4294967296 - // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865). - if (n >= 4.29e9) { - d[i] = crypto.getRandomValues(new Uint32Array(1))[0]; - } else { - - // 0 <= n <= 4289999999 - // 0 <= (n % 1e7) <= 9999999 - rd[i++] = n % 1e7; - } - } - - // Node.js supporting crypto.randomBytes. - } else if (crypto.randomBytes) { - - // buffer - d = crypto.randomBytes(k *= 4); - - for (; i < k;) { - - // 0 <= n < 2147483648 - n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24); - - // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286). - if (n >= 2.14e9) { - crypto.randomBytes(4).copy(d, i); - } else { - - // 0 <= n <= 2139999999 - // 0 <= (n % 1e7) <= 9999999 - rd.push(n % 1e7); - i += 4; - } - } - - i = k / 4; - } else { - throw Error(cryptoUnavailable); - } - - k = rd[--i]; - sd %= LOG_BASE; - - // Convert trailing digits to zeros according to sd. - if (k && sd) { - n = mathpow(10, LOG_BASE - sd); - rd[i] = (k / n | 0) * n; - } - - // Remove trailing words which are zero. - for (; rd[i] === 0; i--) rd.pop(); - - // Zero? - if (i < 0) { - e = 0; - rd = [0]; - } else { - e = -1; - - // Remove leading words which are zero and adjust exponent accordingly. - for (; rd[0] === 0; e -= LOG_BASE) rd.shift(); - - // Count the digits of the first word of rd to determine leading zeros. - for (k = 1, n = rd[0]; n >= 10; n /= 10) k++; - - // Adjust the exponent for leading zeros of the first word of rd. - if (k < LOG_BASE) e -= LOG_BASE - k; - } - - r.e = e; - r.d = rd; - - return r; -} - - -/* - * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`. - * - * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL). - * - * x {number|string|bigint|Decimal} - * - */ -function round(x) { - return finalise(x = new this(x), x.e + 1, this.rounding); -} - - -/* - * Return - * 1 if x > 0, - * -1 if x < 0, - * 0 if x is 0, - * -0 if x is -0, - * NaN otherwise - * - * x {number|string|bigint|Decimal} - * - */ -function sign(x) { - x = new this(x); - return x.d ? (x.d[0] ? x.s : 0 * x.s) : x.s || NaN; -} - - -/* - * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits - * using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} A value in radians. - * - */ -function sin(x) { - return new this(x).sin(); -} - - -/* - * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} A value in radians. - * - */ -function sinh(x) { - return new this(x).sinh(); -} - - -/* - * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant - * digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} - * - */ -function sqrt(x) { - return new this(x).sqrt(); -} - - -/* - * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits - * using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} - * y {number|string|bigint|Decimal} - * - */ -function sub(x, y) { - return new this(x).sub(y); -} - - -/* - * Return a new Decimal whose value is the sum of the arguments, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - * Only the result is rounded, not the intermediate calculations. - * - * arguments {number|string|bigint|Decimal} - * - */ -function sum() { - var i = 0, - args = arguments, - x = new this(args[i]); - - external = false; - for (; x.s && ++i < args.length;) x = x.plus(args[i]); - external = true; - - return finalise(x, this.precision, this.rounding); -} - - -/* - * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant - * digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} A value in radians. - * - */ -function tan(x) { - return new this(x).tan(); -} - - -/* - * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision` - * significant digits using rounding mode `rounding`. - * - * x {number|string|bigint|Decimal} A value in radians. - * - */ -function tanh(x) { - return new this(x).tanh(); -} - - -/* - * Return a new Decimal whose value is `x` truncated to an integer. - * - * x {number|string|bigint|Decimal} - * - */ -function trunc(x) { - return finalise(x = new this(x), x.e + 1, 1); -} - - -P[Symbol.for('nodejs.util.inspect.custom')] = P.toString; -P[Symbol.toStringTag] = 'Decimal'; - -// Create and configure initial Decimal constructor. -export var Decimal = P.constructor = clone(DEFAULTS); - -// Create the internal constants from their string values. -LN10 = new Decimal(LN10); -PI = new Decimal(PI); - -export default Decimal; +/*! + * decimal.js v10.6.0 + * An arbitrary-precision Decimal type for JavaScript. + * https://github.com/MikeMcl/decimal.js + * Copyright (c) 2025 Michael Mclaughlin + * MIT Licence + */ + + +// ----------------------------------- EDITABLE DEFAULTS ------------------------------------ // + + + // The maximum exponent magnitude. + // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`. +var EXP_LIMIT = 9e15, // 0 to 9e15 + + // The limit on the value of `precision`, and on the value of the first argument to + // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`. + MAX_DIGITS = 1e9, // 0 to 1e9 + + // Base conversion alphabet. + NUMERALS = '0123456789abcdef', + + // The natural logarithm of 10 (1025 digits). + LN10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058', + + // Pi (1025 digits). + PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789', + + + // The initial configuration properties of the Decimal constructor. + DEFAULTS = { + + // These values must be integers within the stated ranges (inclusive). + // Most of these values can be changed at run-time using the `Decimal.config` method. + + // The maximum number of significant digits of the result of a calculation or base conversion. + // E.g. `Decimal.config({ precision: 20 });` + precision: 20, // 1 to MAX_DIGITS + + // The rounding mode used when rounding to `precision`. + // + // ROUND_UP 0 Away from zero. + // ROUND_DOWN 1 Towards zero. + // ROUND_CEIL 2 Towards +Infinity. + // ROUND_FLOOR 3 Towards -Infinity. + // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up. + // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down. + // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour. + // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity. + // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity. + // + // E.g. + // `Decimal.rounding = 4;` + // `Decimal.rounding = Decimal.ROUND_HALF_UP;` + rounding: 4, // 0 to 8 + + // The modulo mode used when calculating the modulus: a mod n. + // The quotient (q = a / n) is calculated according to the corresponding rounding mode. + // The remainder (r) is calculated as: r = a - n * q. + // + // UP 0 The remainder is positive if the dividend is negative, else is negative. + // DOWN 1 The remainder has the same sign as the dividend (JavaScript %). + // FLOOR 3 The remainder has the same sign as the divisor (Python %). + // HALF_EVEN 6 The IEEE 754 remainder function. + // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive. + // + // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian + // division (9) are commonly used for the modulus operation. The other rounding modes can also + // be used, but they may not give useful results. + modulo: 1, // 0 to 9 + + // The exponent value at and beneath which `toString` returns exponential notation. + // JavaScript numbers: -7 + toExpNeg: -7, // 0 to -EXP_LIMIT + + // The exponent value at and above which `toString` returns exponential notation. + // JavaScript numbers: 21 + toExpPos: 21, // 0 to EXP_LIMIT + + // The minimum exponent value, beneath which underflow to zero occurs. + // JavaScript numbers: -324 (5e-324) + minE: -EXP_LIMIT, // -1 to -EXP_LIMIT + + // The maximum exponent value, above which overflow to Infinity occurs. + // JavaScript numbers: 308 (1.7976931348623157e+308) + maxE: EXP_LIMIT, // 1 to EXP_LIMIT + + // Whether to use cryptographically-secure random number generation, if available. + crypto: false // true/false + }, + + +// ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- // + + + inexact, quadrant, + external = true, + + decimalError = '[DecimalError] ', + invalidArgument = decimalError + 'Invalid argument: ', + precisionLimitExceeded = decimalError + 'Precision limit exceeded', + cryptoUnavailable = decimalError + 'crypto unavailable', + tag = '[object Decimal]', + + mathfloor = Math.floor, + mathpow = Math.pow, + + isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i, + isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i, + isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, + isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, + + BASE = 1e7, + LOG_BASE = 7, + MAX_SAFE_INTEGER = 9007199254740991, + + LN10_PRECISION = LN10.length - 1, + PI_PRECISION = PI.length - 1, + + // Decimal.prototype object + P = { toStringTag: tag }; + + +// Decimal prototype methods + + +/* + * absoluteValue abs + * ceil + * clampedTo clamp + * comparedTo cmp + * cosine cos + * cubeRoot cbrt + * decimalPlaces dp + * dividedBy div + * dividedToIntegerBy divToInt + * equals eq + * floor + * greaterThan gt + * greaterThanOrEqualTo gte + * hyperbolicCosine cosh + * hyperbolicSine sinh + * hyperbolicTangent tanh + * inverseCosine acos + * inverseHyperbolicCosine acosh + * inverseHyperbolicSine asinh + * inverseHyperbolicTangent atanh + * inverseSine asin + * inverseTangent atan + * isFinite + * isInteger isInt + * isNaN + * isNegative isNeg + * isPositive isPos + * isZero + * lessThan lt + * lessThanOrEqualTo lte + * logarithm log + * [maximum] [max] + * [minimum] [min] + * minus sub + * modulo mod + * naturalExponential exp + * naturalLogarithm ln + * negated neg + * plus add + * precision sd + * round + * sine sin + * squareRoot sqrt + * tangent tan + * times mul + * toBinary + * toDecimalPlaces toDP + * toExponential + * toFixed + * toFraction + * toHexadecimal toHex + * toNearest + * toNumber + * toOctal + * toPower pow + * toPrecision + * toSignificantDigits toSD + * toString + * truncated trunc + * valueOf toJSON + */ + + +/* + * Return a new Decimal whose value is the absolute value of this Decimal. + * + */ +P.absoluteValue = P.abs = function () { + var x = new this.constructor(this); + if (x.s < 0) x.s = 1; + return finalise(x); +}; + + +/* + * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the + * direction of positive Infinity. + * + */ +P.ceil = function () { + return finalise(new this.constructor(this), this.e + 1, 2); +}; + + +/* + * Return a new Decimal whose value is the value of this Decimal clamped to the range + * delineated by `min` and `max`. + * + * min {number|string|bigint|Decimal} + * max {number|string|bigint|Decimal} + * + */ +P.clampedTo = P.clamp = function (min, max) { + var k, + x = this, + Ctor = x.constructor; + min = new Ctor(min); + max = new Ctor(max); + if (!min.s || !max.s) return new Ctor(NaN); + if (min.gt(max)) throw Error(invalidArgument + max); + k = x.cmp(min); + return k < 0 ? min : x.cmp(max) > 0 ? max : new Ctor(x); +}; + + +/* + * Return + * 1 if the value of this Decimal is greater than the value of `y`, + * -1 if the value of this Decimal is less than the value of `y`, + * 0 if they have the same value, + * NaN if the value of either Decimal is NaN. + * + */ +P.comparedTo = P.cmp = function (y) { + var i, j, xdL, ydL, + x = this, + xd = x.d, + yd = (y = new x.constructor(y)).d, + xs = x.s, + ys = y.s; + + // Either NaN or ±Infinity? + if (!xd || !yd) { + return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1; + } + + // Either zero? + if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0; + + // Signs differ? + if (xs !== ys) return xs; + + // Compare exponents. + if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1; + + xdL = xd.length; + ydL = yd.length; + + // Compare digit by digit. + for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) { + if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1; + } + + // Compare lengths. + return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1; +}; + + +/* + * Return a new Decimal whose value is the cosine of the value in radians of this Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [-1, 1] + * + * cos(0) = 1 + * cos(-0) = 1 + * cos(Infinity) = NaN + * cos(-Infinity) = NaN + * cos(NaN) = NaN + * + */ +P.cosine = P.cos = function () { + var pr, rm, + x = this, + Ctor = x.constructor; + + if (!x.d) return new Ctor(NaN); + + // cos(0) = cos(-0) = 1 + if (!x.d[0]) return new Ctor(1); + + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE; + Ctor.rounding = 1; + + x = cosine(Ctor, toLessThanHalfPi(Ctor, x)); + + Ctor.precision = pr; + Ctor.rounding = rm; + + return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true); +}; + + +/* + * + * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to + * `precision` significant digits using rounding mode `rounding`. + * + * cbrt(0) = 0 + * cbrt(-0) = -0 + * cbrt(1) = 1 + * cbrt(-1) = -1 + * cbrt(N) = N + * cbrt(-I) = -I + * cbrt(I) = I + * + * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3)) + * + */ +P.cubeRoot = P.cbrt = function () { + var e, m, n, r, rep, s, sd, t, t3, t3plusx, + x = this, + Ctor = x.constructor; + + if (!x.isFinite() || x.isZero()) return new Ctor(x); + external = false; + + // Initial estimate. + s = x.s * mathpow(x.s * x, 1 / 3); + + // Math.cbrt underflow/overflow? + // Pass x to Math.pow as integer, then adjust the exponent of the result. + if (!s || Math.abs(s) == 1 / 0) { + n = digitsToString(x.d); + e = x.e; + + // Adjust n exponent so it is a multiple of 3 away from x exponent. + if (s = (e - n.length + 1) % 3) n += (s == 1 || s == -2 ? '0' : '00'); + s = mathpow(n, 1 / 3); + + // Rarely, e may be one less than the result exponent value. + e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2)); + + if (s == 1 / 0) { + n = '5e' + e; + } else { + n = s.toExponential(); + n = n.slice(0, n.indexOf('e') + 1) + e; + } + + r = new Ctor(n); + r.s = x.s; + } else { + r = new Ctor(s.toString()); + } + + sd = (e = Ctor.precision) + 3; + + // Halley's method. + // TODO? Compare Newton's method. + for (;;) { + t = r; + t3 = t.times(t).times(t); + t3plusx = t3.plus(x); + r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1); + + // TODO? Replace with for-loop and checkRoundingDigits. + if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) { + n = n.slice(sd - 3, sd + 1); + + // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999 + // , i.e. approaching a rounding boundary, continue the iteration. + if (n == '9999' || !rep && n == '4999') { + + // On the first iteration only, check to see if rounding up gives the exact result as the + // nines may infinitely repeat. + if (!rep) { + finalise(t, e + 1, 0); + + if (t.times(t).times(t).eq(x)) { + r = t; + break; + } + } + + sd += 4; + rep = 1; + } else { + + // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result. + // If not, then there are further digits and m will be truthy. + if (!+n || !+n.slice(1) && n.charAt(0) == '5') { + + // Truncate to the first rounding digit. + finalise(r, e + 1, 1); + m = !r.times(r).times(r).eq(x); + } + + break; + } + } + } + + external = true; + + return finalise(r, e, Ctor.rounding, m); +}; + + +/* + * Return the number of decimal places of the value of this Decimal. + * + */ +P.decimalPlaces = P.dp = function () { + var w, + d = this.d, + n = NaN; + + if (d) { + w = d.length - 1; + n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE; + + // Subtract the number of trailing zeros of the last word. + w = d[w]; + if (w) for (; w % 10 == 0; w /= 10) n--; + if (n < 0) n = 0; + } + + return n; +}; + + +/* + * n / 0 = I + * n / N = N + * n / I = 0 + * 0 / n = 0 + * 0 / 0 = N + * 0 / N = N + * 0 / I = 0 + * N / n = N + * N / 0 = N + * N / N = N + * N / I = N + * I / n = I + * I / 0 = I + * I / N = N + * I / I = N + * + * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to + * `precision` significant digits using rounding mode `rounding`. + * + */ +P.dividedBy = P.div = function (y) { + return divide(this, new this.constructor(y)); +}; + + +/* + * Return a new Decimal whose value is the integer part of dividing the value of this Decimal + * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`. + * + */ +P.dividedToIntegerBy = P.divToInt = function (y) { + var x = this, + Ctor = x.constructor; + return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding); +}; + + +/* + * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false. + * + */ +P.equals = P.eq = function (y) { + return this.cmp(y) === 0; +}; + + +/* + * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the + * direction of negative Infinity. + * + */ +P.floor = function () { + return finalise(new this.constructor(this), this.e + 1, 3); +}; + + +/* + * Return true if the value of this Decimal is greater than the value of `y`, otherwise return + * false. + * + */ +P.greaterThan = P.gt = function (y) { + return this.cmp(y) > 0; +}; + + +/* + * Return true if the value of this Decimal is greater than or equal to the value of `y`, + * otherwise return false. + * + */ +P.greaterThanOrEqualTo = P.gte = function (y) { + var k = this.cmp(y); + return k == 1 || k === 0; +}; + + +/* + * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this + * Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [1, Infinity] + * + * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ... + * + * cosh(0) = 1 + * cosh(-0) = 1 + * cosh(Infinity) = Infinity + * cosh(-Infinity) = Infinity + * cosh(NaN) = NaN + * + * x time taken (ms) result + * 1000 9 9.8503555700852349694e+433 + * 10000 25 4.4034091128314607936e+4342 + * 100000 171 1.4033316802130615897e+43429 + * 1000000 3817 1.5166076984010437725e+434294 + * 10000000 abandoned after 2 minute wait + * + * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x)) + * + */ +P.hyperbolicCosine = P.cosh = function () { + var k, n, pr, rm, len, + x = this, + Ctor = x.constructor, + one = new Ctor(1); + + if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN); + if (x.isZero()) return one; + + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(x.e, x.sd()) + 4; + Ctor.rounding = 1; + len = x.d.length; + + // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1 + // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4)) + + // Estimate the optimum number of times to use the argument reduction. + // TODO? Estimation reused from cosine() and may not be optimal here. + if (len < 32) { + k = Math.ceil(len / 3); + n = (1 / tinyPow(4, k)).toString(); + } else { + k = 16; + n = '2.3283064365386962890625e-10'; + } + + x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true); + + // Reverse argument reduction + var cosh2_x, + i = k, + d8 = new Ctor(8); + for (; i--;) { + cosh2_x = x.times(x); + x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8)))); + } + + return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true); +}; + + +/* + * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this + * Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [-Infinity, Infinity] + * + * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ... + * + * sinh(0) = 0 + * sinh(-0) = -0 + * sinh(Infinity) = Infinity + * sinh(-Infinity) = -Infinity + * sinh(NaN) = NaN + * + * x time taken (ms) + * 10 2 ms + * 100 5 ms + * 1000 14 ms + * 10000 82 ms + * 100000 886 ms 1.4033316802130615897e+43429 + * 200000 2613 ms + * 300000 5407 ms + * 400000 8824 ms + * 500000 13026 ms 8.7080643612718084129e+217146 + * 1000000 48543 ms + * + * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x)) + * + */ +P.hyperbolicSine = P.sinh = function () { + var k, pr, rm, len, + x = this, + Ctor = x.constructor; + + if (!x.isFinite() || x.isZero()) return new Ctor(x); + + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(x.e, x.sd()) + 4; + Ctor.rounding = 1; + len = x.d.length; + + if (len < 3) { + x = taylorSeries(Ctor, 2, x, x, true); + } else { + + // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x)) + // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3)) + // 3 multiplications and 1 addition + + // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x))) + // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5))) + // 4 multiplications and 2 additions + + // Estimate the optimum number of times to use the argument reduction. + k = 1.4 * Math.sqrt(len); + k = k > 16 ? 16 : k | 0; + + x = x.times(1 / tinyPow(5, k)); + x = taylorSeries(Ctor, 2, x, x, true); + + // Reverse argument reduction + var sinh2_x, + d5 = new Ctor(5), + d16 = new Ctor(16), + d20 = new Ctor(20); + for (; k--;) { + sinh2_x = x.times(x); + x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20)))); + } + } + + Ctor.precision = pr; + Ctor.rounding = rm; + + return finalise(x, pr, rm, true); +}; + + +/* + * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this + * Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [-1, 1] + * + * tanh(x) = sinh(x) / cosh(x) + * + * tanh(0) = 0 + * tanh(-0) = -0 + * tanh(Infinity) = 1 + * tanh(-Infinity) = -1 + * tanh(NaN) = NaN + * + */ +P.hyperbolicTangent = P.tanh = function () { + var pr, rm, + x = this, + Ctor = x.constructor; + + if (!x.isFinite()) return new Ctor(x.s); + if (x.isZero()) return new Ctor(x); + + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + 7; + Ctor.rounding = 1; + + return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm); +}; + + +/* + * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of + * this Decimal. + * + * Domain: [-1, 1] + * Range: [0, pi] + * + * acos(x) = pi/2 - asin(x) + * + * acos(0) = pi/2 + * acos(-0) = pi/2 + * acos(1) = 0 + * acos(-1) = pi + * acos(1/2) = pi/3 + * acos(-1/2) = 2*pi/3 + * acos(|x| > 1) = NaN + * acos(NaN) = NaN + * + */ +P.inverseCosine = P.acos = function () { + var x = this, + Ctor = x.constructor, + k = x.abs().cmp(1), + pr = Ctor.precision, + rm = Ctor.rounding; + + if (k !== -1) { + return k === 0 + // |x| is 1 + ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0) + // |x| > 1 or x is NaN + : new Ctor(NaN); + } + + if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5); + + // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3 + + Ctor.precision = pr + 6; + Ctor.rounding = 1; + + // See https://github.com/MikeMcl/decimal.js/pull/217 + x = new Ctor(1).minus(x).div(x.plus(1)).sqrt().atan(); + + Ctor.precision = pr; + Ctor.rounding = rm; + + return x.times(2); +}; + + +/* + * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the + * value of this Decimal. + * + * Domain: [1, Infinity] + * Range: [0, Infinity] + * + * acosh(x) = ln(x + sqrt(x^2 - 1)) + * + * acosh(x < 1) = NaN + * acosh(NaN) = NaN + * acosh(Infinity) = Infinity + * acosh(-Infinity) = NaN + * acosh(0) = NaN + * acosh(-0) = NaN + * acosh(1) = 0 + * acosh(-1) = NaN + * + */ +P.inverseHyperbolicCosine = P.acosh = function () { + var pr, rm, + x = this, + Ctor = x.constructor; + + if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN); + if (!x.isFinite()) return new Ctor(x); + + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4; + Ctor.rounding = 1; + external = false; + + x = x.times(x).minus(1).sqrt().plus(x); + + external = true; + Ctor.precision = pr; + Ctor.rounding = rm; + + return x.ln(); +}; + + +/* + * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value + * of this Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [-Infinity, Infinity] + * + * asinh(x) = ln(x + sqrt(x^2 + 1)) + * + * asinh(NaN) = NaN + * asinh(Infinity) = Infinity + * asinh(-Infinity) = -Infinity + * asinh(0) = 0 + * asinh(-0) = -0 + * + */ +P.inverseHyperbolicSine = P.asinh = function () { + var pr, rm, + x = this, + Ctor = x.constructor; + + if (!x.isFinite() || x.isZero()) return new Ctor(x); + + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6; + Ctor.rounding = 1; + external = false; + + x = x.times(x).plus(1).sqrt().plus(x); + + external = true; + Ctor.precision = pr; + Ctor.rounding = rm; + + return x.ln(); +}; + + +/* + * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the + * value of this Decimal. + * + * Domain: [-1, 1] + * Range: [-Infinity, Infinity] + * + * atanh(x) = 0.5 * ln((1 + x) / (1 - x)) + * + * atanh(|x| > 1) = NaN + * atanh(NaN) = NaN + * atanh(Infinity) = NaN + * atanh(-Infinity) = NaN + * atanh(0) = 0 + * atanh(-0) = -0 + * atanh(1) = Infinity + * atanh(-1) = -Infinity + * + */ +P.inverseHyperbolicTangent = P.atanh = function () { + var pr, rm, wpr, xsd, + x = this, + Ctor = x.constructor; + + if (!x.isFinite()) return new Ctor(NaN); + if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN); + + pr = Ctor.precision; + rm = Ctor.rounding; + xsd = x.sd(); + + if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true); + + Ctor.precision = wpr = xsd - x.e; + + x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1); + + Ctor.precision = pr + 4; + Ctor.rounding = 1; + + x = x.ln(); + + Ctor.precision = pr; + Ctor.rounding = rm; + + return x.times(0.5); +}; + + +/* + * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this + * Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [-pi/2, pi/2] + * + * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2))) + * + * asin(0) = 0 + * asin(-0) = -0 + * asin(1/2) = pi/6 + * asin(-1/2) = -pi/6 + * asin(1) = pi/2 + * asin(-1) = -pi/2 + * asin(|x| > 1) = NaN + * asin(NaN) = NaN + * + * TODO? Compare performance of Taylor series. + * + */ +P.inverseSine = P.asin = function () { + var halfPi, k, + pr, rm, + x = this, + Ctor = x.constructor; + + if (x.isZero()) return new Ctor(x); + + k = x.abs().cmp(1); + pr = Ctor.precision; + rm = Ctor.rounding; + + if (k !== -1) { + + // |x| is 1 + if (k === 0) { + halfPi = getPi(Ctor, pr + 4, rm).times(0.5); + halfPi.s = x.s; + return halfPi; + } + + // |x| > 1 or x is NaN + return new Ctor(NaN); + } + + // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6 + + Ctor.precision = pr + 6; + Ctor.rounding = 1; + + x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan(); + + Ctor.precision = pr; + Ctor.rounding = rm; + + return x.times(2); +}; + + +/* + * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value + * of this Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [-pi/2, pi/2] + * + * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ... + * + * atan(0) = 0 + * atan(-0) = -0 + * atan(1) = pi/4 + * atan(-1) = -pi/4 + * atan(Infinity) = pi/2 + * atan(-Infinity) = -pi/2 + * atan(NaN) = NaN + * + */ +P.inverseTangent = P.atan = function () { + var i, j, k, n, px, t, r, wpr, x2, + x = this, + Ctor = x.constructor, + pr = Ctor.precision, + rm = Ctor.rounding; + + if (!x.isFinite()) { + if (!x.s) return new Ctor(NaN); + if (pr + 4 <= PI_PRECISION) { + r = getPi(Ctor, pr + 4, rm).times(0.5); + r.s = x.s; + return r; + } + } else if (x.isZero()) { + return new Ctor(x); + } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) { + r = getPi(Ctor, pr + 4, rm).times(0.25); + r.s = x.s; + return r; + } + + Ctor.precision = wpr = pr + 10; + Ctor.rounding = 1; + + // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x); + + // Argument reduction + // Ensure |x| < 0.42 + // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2))) + + k = Math.min(28, wpr / LOG_BASE + 2 | 0); + + for (i = k; i; --i) x = x.div(x.times(x).plus(1).sqrt().plus(1)); + + external = false; + + j = Math.ceil(wpr / LOG_BASE); + n = 1; + x2 = x.times(x); + r = new Ctor(x); + px = x; + + // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ... + for (; i !== -1;) { + px = px.times(x2); + t = r.minus(px.div(n += 2)); + + px = px.times(x2); + r = t.plus(px.div(n += 2)); + + if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;); + } + + if (k) r = r.times(2 << (k - 1)); + + external = true; + + return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true); +}; + + +/* + * Return true if the value of this Decimal is a finite number, otherwise return false. + * + */ +P.isFinite = function () { + return !!this.d; +}; + + +/* + * Return true if the value of this Decimal is an integer, otherwise return false. + * + */ +P.isInteger = P.isInt = function () { + return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2; +}; + + +/* + * Return true if the value of this Decimal is NaN, otherwise return false. + * + */ +P.isNaN = function () { + return !this.s; +}; + + +/* + * Return true if the value of this Decimal is negative, otherwise return false. + * + */ +P.isNegative = P.isNeg = function () { + return this.s < 0; +}; + + +/* + * Return true if the value of this Decimal is positive, otherwise return false. + * + */ +P.isPositive = P.isPos = function () { + return this.s > 0; +}; + + +/* + * Return true if the value of this Decimal is 0 or -0, otherwise return false. + * + */ +P.isZero = function () { + return !!this.d && this.d[0] === 0; +}; + + +/* + * Return true if the value of this Decimal is less than `y`, otherwise return false. + * + */ +P.lessThan = P.lt = function (y) { + return this.cmp(y) < 0; +}; + + +/* + * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false. + * + */ +P.lessThanOrEqualTo = P.lte = function (y) { + return this.cmp(y) < 1; +}; + + +/* + * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * If no base is specified, return log[10](arg). + * + * log[base](arg) = ln(arg) / ln(base) + * + * The result will always be correctly rounded if the base of the log is 10, and 'almost always' + * otherwise: + * + * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen + * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error + * between the result and the correctly rounded result will be one ulp (unit in the last place). + * + * log[-b](a) = NaN + * log[0](a) = NaN + * log[1](a) = NaN + * log[NaN](a) = NaN + * log[Infinity](a) = NaN + * log[b](0) = -Infinity + * log[b](-0) = -Infinity + * log[b](-a) = NaN + * log[b](1) = 0 + * log[b](Infinity) = Infinity + * log[b](NaN) = NaN + * + * [base] {number|string|bigint|Decimal} The base of the logarithm. + * + */ +P.logarithm = P.log = function (base) { + var isBase10, d, denominator, k, inf, num, sd, r, + arg = this, + Ctor = arg.constructor, + pr = Ctor.precision, + rm = Ctor.rounding, + guard = 5; + + // Default base is 10. + if (base == null) { + base = new Ctor(10); + isBase10 = true; + } else { + base = new Ctor(base); + d = base.d; + + // Return NaN if base is negative, or non-finite, or is 0 or 1. + if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN); + + isBase10 = base.eq(10); + } + + d = arg.d; + + // Is arg negative, non-finite, 0 or 1? + if (arg.s < 0 || !d || !d[0] || arg.eq(1)) { + return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0); + } + + // The result will have a non-terminating decimal expansion if base is 10 and arg is not an + // integer power of 10. + if (isBase10) { + if (d.length > 1) { + inf = true; + } else { + for (k = d[0]; k % 10 === 0;) k /= 10; + inf = k !== 1; + } + } + + external = false; + sd = pr + guard; + num = naturalLogarithm(arg, sd); + denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd); + + // The result will have 5 rounding digits. + r = divide(num, denominator, sd, 1); + + // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000, + // calculate 10 further digits. + // + // If the result is known to have an infinite decimal expansion, repeat this until it is clear + // that the result is above or below the boundary. Otherwise, if after calculating the 10 + // further digits, the last 14 are nines, round up and assume the result is exact. + // Also assume the result is exact if the last 14 are zero. + // + // Example of a result that will be incorrectly rounded: + // log[1048576](4503599627370502) = 2.60000000000000009610279511444746... + // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it + // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so + // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal + // place is still 2.6. + if (checkRoundingDigits(r.d, k = pr, rm)) { + + do { + sd += 10; + num = naturalLogarithm(arg, sd); + denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd); + r = divide(num, denominator, sd, 1); + + if (!inf) { + + // Check for 14 nines from the 2nd rounding digit, as the first may be 4. + if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) { + r = finalise(r, pr + 1, 0); + } + + break; + } + } while (checkRoundingDigits(r.d, k += 10, rm)); + } + + external = true; + + return finalise(r, pr, rm); +}; + + +/* + * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal. + * + * arguments {number|string|bigint|Decimal} + * +P.max = function () { + Array.prototype.push.call(arguments, this); + return maxOrMin(this.constructor, arguments, -1); +}; + */ + + +/* + * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal. + * + * arguments {number|string|bigint|Decimal} + * +P.min = function () { + Array.prototype.push.call(arguments, this); + return maxOrMin(this.constructor, arguments, 1); +}; + */ + + +/* + * n - 0 = n + * n - N = N + * n - I = -I + * 0 - n = -n + * 0 - 0 = 0 + * 0 - N = N + * 0 - I = -I + * N - n = N + * N - 0 = N + * N - N = N + * N - I = N + * I - n = I + * I - 0 = I + * I - N = N + * I - I = N + * + * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + */ +P.minus = P.sub = function (y) { + var d, e, i, j, k, len, pr, rm, xd, xe, xLTy, yd, + x = this, + Ctor = x.constructor; + + y = new Ctor(y); + + // If either is not finite... + if (!x.d || !y.d) { + + // Return NaN if either is NaN. + if (!x.s || !y.s) y = new Ctor(NaN); + + // Return y negated if x is finite and y is ±Infinity. + else if (x.d) y.s = -y.s; + + // Return x if y is finite and x is ±Infinity. + // Return x if both are ±Infinity with different signs. + // Return NaN if both are ±Infinity with the same sign. + else y = new Ctor(y.d || x.s !== y.s ? x : NaN); + + return y; + } + + // If signs differ... + if (x.s != y.s) { + y.s = -y.s; + return x.plus(y); + } + + xd = x.d; + yd = y.d; + pr = Ctor.precision; + rm = Ctor.rounding; + + // If either is zero... + if (!xd[0] || !yd[0]) { + + // Return y negated if x is zero and y is non-zero. + if (yd[0]) y.s = -y.s; + + // Return x if y is zero and x is non-zero. + else if (xd[0]) y = new Ctor(x); + + // Return zero if both are zero. + // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity. + else return new Ctor(rm === 3 ? -0 : 0); + + return external ? finalise(y, pr, rm) : y; + } + + // x and y are finite, non-zero numbers with the same sign. + + // Calculate base 1e7 exponents. + e = mathfloor(y.e / LOG_BASE); + xe = mathfloor(x.e / LOG_BASE); + + xd = xd.slice(); + k = xe - e; + + // If base 1e7 exponents differ... + if (k) { + xLTy = k < 0; + + if (xLTy) { + d = xd; + k = -k; + len = yd.length; + } else { + d = yd; + e = xe; + len = xd.length; + } + + // Numbers with massively different exponents would result in a very high number of + // zeros needing to be prepended, but this can be avoided while still ensuring correct + // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`. + i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2; + + if (k > i) { + k = i; + d.length = 1; + } + + // Prepend zeros to equalise exponents. + d.reverse(); + for (i = k; i--;) d.push(0); + d.reverse(); + + // Base 1e7 exponents equal. + } else { + + // Check digits to determine which is the bigger number. + + i = xd.length; + len = yd.length; + xLTy = i < len; + if (xLTy) len = i; + + for (i = 0; i < len; i++) { + if (xd[i] != yd[i]) { + xLTy = xd[i] < yd[i]; + break; + } + } + + k = 0; + } + + if (xLTy) { + d = xd; + xd = yd; + yd = d; + y.s = -y.s; + } + + len = xd.length; + + // Append zeros to `xd` if shorter. + // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length. + for (i = yd.length - len; i > 0; --i) xd[len++] = 0; + + // Subtract yd from xd. + for (i = yd.length; i > k;) { + + if (xd[--i] < yd[i]) { + for (j = i; j && xd[--j] === 0;) xd[j] = BASE - 1; + --xd[j]; + xd[i] += BASE; + } + + xd[i] -= yd[i]; + } + + // Remove trailing zeros. + for (; xd[--len] === 0;) xd.pop(); + + // Remove leading zeros and adjust exponent accordingly. + for (; xd[0] === 0; xd.shift()) --e; + + // Zero? + if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0); + + y.d = xd; + y.e = getBase10Exponent(xd, e); + + return external ? finalise(y, pr, rm) : y; +}; + + +/* + * n % 0 = N + * n % N = N + * n % I = n + * 0 % n = 0 + * -0 % n = -0 + * 0 % 0 = N + * 0 % N = N + * 0 % I = 0 + * N % n = N + * N % 0 = N + * N % N = N + * N % I = N + * I % n = N + * I % 0 = N + * I % N = N + * I % I = N + * + * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to + * `precision` significant digits using rounding mode `rounding`. + * + * The result depends on the modulo mode. + * + */ +P.modulo = P.mod = function (y) { + var q, + x = this, + Ctor = x.constructor; + + y = new Ctor(y); + + // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0. + if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN); + + // Return x if y is ±Infinity or x is ±0. + if (!y.d || x.d && !x.d[0]) { + return finalise(new Ctor(x), Ctor.precision, Ctor.rounding); + } + + // Prevent rounding of intermediate calculations. + external = false; + + if (Ctor.modulo == 9) { + + // Euclidian division: q = sign(y) * floor(x / abs(y)) + // result = x - q * y where 0 <= result < abs(y) + q = divide(x, y.abs(), 0, 3, 1); + q.s *= y.s; + } else { + q = divide(x, y, 0, Ctor.modulo, 1); + } + + q = q.times(y); + + external = true; + + return x.minus(q); +}; + + +/* + * Return a new Decimal whose value is the natural exponential of the value of this Decimal, + * i.e. the base e raised to the power the value of this Decimal, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + */ +P.naturalExponential = P.exp = function () { + return naturalExponential(this); +}; + + +/* + * Return a new Decimal whose value is the natural logarithm of the value of this Decimal, + * rounded to `precision` significant digits using rounding mode `rounding`. + * + */ +P.naturalLogarithm = P.ln = function () { + return naturalLogarithm(this); +}; + + +/* + * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by + * -1. + * + */ +P.negated = P.neg = function () { + var x = new this.constructor(this); + x.s = -x.s; + return finalise(x); +}; + + +/* + * n + 0 = n + * n + N = N + * n + I = I + * 0 + n = n + * 0 + 0 = 0 + * 0 + N = N + * 0 + I = I + * N + n = N + * N + 0 = N + * N + N = N + * N + I = N + * I + n = I + * I + 0 = I + * I + N = N + * I + I = I + * + * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + */ +P.plus = P.add = function (y) { + var carry, d, e, i, k, len, pr, rm, xd, yd, + x = this, + Ctor = x.constructor; + + y = new Ctor(y); + + // If either is not finite... + if (!x.d || !y.d) { + + // Return NaN if either is NaN. + if (!x.s || !y.s) y = new Ctor(NaN); + + // Return x if y is finite and x is ±Infinity. + // Return x if both are ±Infinity with the same sign. + // Return NaN if both are ±Infinity with different signs. + // Return y if x is finite and y is ±Infinity. + else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN); + + return y; + } + + // If signs differ... + if (x.s != y.s) { + y.s = -y.s; + return x.minus(y); + } + + xd = x.d; + yd = y.d; + pr = Ctor.precision; + rm = Ctor.rounding; + + // If either is zero... + if (!xd[0] || !yd[0]) { + + // Return x if y is zero. + // Return y if y is non-zero. + if (!yd[0]) y = new Ctor(x); + + return external ? finalise(y, pr, rm) : y; + } + + // x and y are finite, non-zero numbers with the same sign. + + // Calculate base 1e7 exponents. + k = mathfloor(x.e / LOG_BASE); + e = mathfloor(y.e / LOG_BASE); + + xd = xd.slice(); + i = k - e; + + // If base 1e7 exponents differ... + if (i) { + + if (i < 0) { + d = xd; + i = -i; + len = yd.length; + } else { + d = yd; + e = k; + len = xd.length; + } + + // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1. + k = Math.ceil(pr / LOG_BASE); + len = k > len ? k + 1 : len + 1; + + if (i > len) { + i = len; + d.length = 1; + } + + // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts. + d.reverse(); + for (; i--;) d.push(0); + d.reverse(); + } + + len = xd.length; + i = yd.length; + + // If yd is longer than xd, swap xd and yd so xd points to the longer array. + if (len - i < 0) { + i = len; + d = yd; + yd = xd; + xd = d; + } + + // Only start adding at yd.length - 1 as the further digits of xd can be left as they are. + for (carry = 0; i;) { + carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0; + xd[i] %= BASE; + } + + if (carry) { + xd.unshift(carry); + ++e; + } + + // Remove trailing zeros. + // No need to check for zero, as +x + +y != 0 && -x + -y != 0 + for (len = xd.length; xd[--len] == 0;) xd.pop(); + + y.d = xd; + y.e = getBase10Exponent(xd, e); + + return external ? finalise(y, pr, rm) : y; +}; + + +/* + * Return the number of significant digits of the value of this Decimal. + * + * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0. + * + */ +P.precision = P.sd = function (z) { + var k, + x = this; + + if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z); + + if (x.d) { + k = getPrecision(x.d); + if (z && x.e + 1 > k) k = x.e + 1; + } else { + k = NaN; + } + + return k; +}; + + +/* + * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using + * rounding mode `rounding`. + * + */ +P.round = function () { + var x = this, + Ctor = x.constructor; + + return finalise(new Ctor(x), x.e + 1, Ctor.rounding); +}; + + +/* + * Return a new Decimal whose value is the sine of the value in radians of this Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [-1, 1] + * + * sin(x) = x - x^3/3! + x^5/5! - ... + * + * sin(0) = 0 + * sin(-0) = -0 + * sin(Infinity) = NaN + * sin(-Infinity) = NaN + * sin(NaN) = NaN + * + */ +P.sine = P.sin = function () { + var pr, rm, + x = this, + Ctor = x.constructor; + + if (!x.isFinite()) return new Ctor(NaN); + if (x.isZero()) return new Ctor(x); + + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE; + Ctor.rounding = 1; + + x = sine(Ctor, toLessThanHalfPi(Ctor, x)); + + Ctor.precision = pr; + Ctor.rounding = rm; + + return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true); +}; + + +/* + * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * sqrt(-n) = N + * sqrt(N) = N + * sqrt(-I) = N + * sqrt(I) = I + * sqrt(0) = 0 + * sqrt(-0) = -0 + * + */ +P.squareRoot = P.sqrt = function () { + var m, n, sd, r, rep, t, + x = this, + d = x.d, + e = x.e, + s = x.s, + Ctor = x.constructor; + + // Negative/NaN/Infinity/zero? + if (s !== 1 || !d || !d[0]) { + return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0); + } + + external = false; + + // Initial estimate. + s = Math.sqrt(+x); + + // Math.sqrt underflow/overflow? + // Pass x to Math.sqrt as integer, then adjust the exponent of the result. + if (s == 0 || s == 1 / 0) { + n = digitsToString(d); + + if ((n.length + e) % 2 == 0) n += '0'; + s = Math.sqrt(n); + e = mathfloor((e + 1) / 2) - (e < 0 || e % 2); + + if (s == 1 / 0) { + n = '5e' + e; + } else { + n = s.toExponential(); + n = n.slice(0, n.indexOf('e') + 1) + e; + } + + r = new Ctor(n); + } else { + r = new Ctor(s.toString()); + } + + sd = (e = Ctor.precision) + 3; + + // Newton-Raphson iteration. + for (;;) { + t = r; + r = t.plus(divide(x, t, sd + 2, 1)).times(0.5); + + // TODO? Replace with for-loop and checkRoundingDigits. + if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) { + n = n.slice(sd - 3, sd + 1); + + // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or + // 4999, i.e. approaching a rounding boundary, continue the iteration. + if (n == '9999' || !rep && n == '4999') { + + // On the first iteration only, check to see if rounding up gives the exact result as the + // nines may infinitely repeat. + if (!rep) { + finalise(t, e + 1, 0); + + if (t.times(t).eq(x)) { + r = t; + break; + } + } + + sd += 4; + rep = 1; + } else { + + // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result. + // If not, then there are further digits and m will be truthy. + if (!+n || !+n.slice(1) && n.charAt(0) == '5') { + + // Truncate to the first rounding digit. + finalise(r, e + 1, 1); + m = !r.times(r).eq(x); + } + + break; + } + } + } + + external = true; + + return finalise(r, e, Ctor.rounding, m); +}; + + +/* + * Return a new Decimal whose value is the tangent of the value in radians of this Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [-Infinity, Infinity] + * + * tan(0) = 0 + * tan(-0) = -0 + * tan(Infinity) = NaN + * tan(-Infinity) = NaN + * tan(NaN) = NaN + * + */ +P.tangent = P.tan = function () { + var pr, rm, + x = this, + Ctor = x.constructor; + + if (!x.isFinite()) return new Ctor(NaN); + if (x.isZero()) return new Ctor(x); + + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + 10; + Ctor.rounding = 1; + + x = x.sin(); + x.s = 1; + x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0); + + Ctor.precision = pr; + Ctor.rounding = rm; + + return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true); +}; + + +/* + * n * 0 = 0 + * n * N = N + * n * I = I + * 0 * n = 0 + * 0 * 0 = 0 + * 0 * N = N + * 0 * I = N + * N * n = N + * N * 0 = N + * N * N = N + * N * I = N + * I * n = I + * I * 0 = N + * I * N = N + * I * I = I + * + * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant + * digits using rounding mode `rounding`. + * + */ +P.times = P.mul = function (y) { + var carry, e, i, k, r, rL, t, xdL, ydL, + x = this, + Ctor = x.constructor, + xd = x.d, + yd = (y = new Ctor(y)).d; + + y.s *= x.s; + + // If either is NaN, ±Infinity or ±0... + if (!xd || !xd[0] || !yd || !yd[0]) { + + return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd + + // Return NaN if either is NaN. + // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity. + ? NaN + + // Return ±Infinity if either is ±Infinity. + // Return ±0 if either is ±0. + : !xd || !yd ? y.s / 0 : y.s * 0); + } + + e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE); + xdL = xd.length; + ydL = yd.length; + + // Ensure xd points to the longer array. + if (xdL < ydL) { + r = xd; + xd = yd; + yd = r; + rL = xdL; + xdL = ydL; + ydL = rL; + } + + // Initialise the result array with zeros. + r = []; + rL = xdL + ydL; + for (i = rL; i--;) r.push(0); + + // Multiply! + for (i = ydL; --i >= 0;) { + carry = 0; + for (k = xdL + i; k > i;) { + t = r[k] + yd[i] * xd[k - i - 1] + carry; + r[k--] = t % BASE | 0; + carry = t / BASE | 0; + } + + r[k] = (r[k] + carry) % BASE | 0; + } + + // Remove trailing zeros. + for (; !r[--rL];) r.pop(); + + if (carry) ++e; + else r.shift(); + + y.d = r; + y.e = getBase10Exponent(r, e); + + return external ? finalise(y, Ctor.precision, Ctor.rounding) : y; +}; + + +/* + * Return a string representing the value of this Decimal in base 2, round to `sd` significant + * digits using rounding mode `rm`. + * + * If the optional `sd` argument is present then return binary exponential notation. + * + * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + */ +P.toBinary = function (sd, rm) { + return toStringBinary(this, 2, sd, rm); +}; + + +/* + * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp` + * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted. + * + * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal. + * + * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + */ +P.toDecimalPlaces = P.toDP = function (dp, rm) { + var x = this, + Ctor = x.constructor; + + x = new Ctor(x); + if (dp === void 0) return x; + + checkInt32(dp, 0, MAX_DIGITS); + + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + + return finalise(x, dp + x.e + 1, rm); +}; + + +/* + * Return a string representing the value of this Decimal in exponential notation rounded to + * `dp` fixed decimal places using rounding mode `rounding`. + * + * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + */ +P.toExponential = function (dp, rm) { + var str, + x = this, + Ctor = x.constructor; + + if (dp === void 0) { + str = finiteToString(x, true); + } else { + checkInt32(dp, 0, MAX_DIGITS); + + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + + x = finalise(new Ctor(x), dp + 1, rm); + str = finiteToString(x, true, dp + 1); + } + + return x.isNeg() && !x.isZero() ? '-' + str : str; +}; + + +/* + * Return a string representing the value of this Decimal in normal (fixed-point) notation to + * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is + * omitted. + * + * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'. + * + * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'. + * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'. + * (-0).toFixed(3) is '0.000'. + * (-0.5).toFixed(0) is '-0'. + * + */ +P.toFixed = function (dp, rm) { + var str, y, + x = this, + Ctor = x.constructor; + + if (dp === void 0) { + str = finiteToString(x); + } else { + checkInt32(dp, 0, MAX_DIGITS); + + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + + y = finalise(new Ctor(x), dp + x.e + 1, rm); + str = finiteToString(y, false, dp + y.e + 1); + } + + // To determine whether to add the minus sign look at the value before it was rounded, + // i.e. look at `x` rather than `y`. + return x.isNeg() && !x.isZero() ? '-' + str : str; +}; + + +/* + * Return an array representing the value of this Decimal as a simple fraction with an integer + * numerator and an integer denominator. + * + * The denominator will be a positive non-zero value less than or equal to the specified maximum + * denominator. If a maximum denominator is not specified, the denominator will be the lowest + * value necessary to represent the number exactly. + * + * [maxD] {number|string|bigint|Decimal} Maximum denominator. Integer >= 1 and < Infinity. + * + */ +P.toFraction = function (maxD) { + var d, d0, d1, d2, e, k, n, n0, n1, pr, q, r, + x = this, + xd = x.d, + Ctor = x.constructor; + + if (!xd) return new Ctor(x); + + n1 = d0 = new Ctor(1); + d1 = n0 = new Ctor(0); + + d = new Ctor(d1); + e = d.e = getPrecision(xd) - x.e - 1; + k = e % LOG_BASE; + d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k); + + if (maxD == null) { + + // d is 10**e, the minimum max-denominator needed. + maxD = e > 0 ? d : n1; + } else { + n = new Ctor(maxD); + if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n); + maxD = n.gt(d) ? (e > 0 ? d : n1) : n; + } + + external = false; + n = new Ctor(digitsToString(xd)); + pr = Ctor.precision; + Ctor.precision = e = xd.length * LOG_BASE * 2; + + for (;;) { + q = divide(n, d, 0, 1, 1); + d2 = d0.plus(q.times(d1)); + if (d2.cmp(maxD) == 1) break; + d0 = d1; + d1 = d2; + d2 = n1; + n1 = n0.plus(q.times(d2)); + n0 = d2; + d2 = d; + d = n.minus(q.times(d2)); + n = d2; + } + + d2 = divide(maxD.minus(d0), d1, 0, 1, 1); + n0 = n0.plus(d2.times(n1)); + d0 = d0.plus(d2.times(d1)); + n0.s = n1.s = x.s; + + // Determine which fraction is closer to x, n0/d0 or n1/d1? + r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1 + ? [n1, d1] : [n0, d0]; + + Ctor.precision = pr; + external = true; + + return r; +}; + + +/* + * Return a string representing the value of this Decimal in base 16, round to `sd` significant + * digits using rounding mode `rm`. + * + * If the optional `sd` argument is present then return binary exponential notation. + * + * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + */ +P.toHexadecimal = P.toHex = function (sd, rm) { + return toStringBinary(this, 16, sd, rm); +}; + + +/* + * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding + * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal. + * + * The return value will always have the same sign as this Decimal, unless either this Decimal + * or `y` is NaN, in which case the return value will be also be NaN. + * + * The return value is not affected by the value of `precision`. + * + * y {number|string|bigint|Decimal} The magnitude to round to a multiple of. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * 'toNearest() rounding mode not an integer: {rm}' + * 'toNearest() rounding mode out of range: {rm}' + * + */ +P.toNearest = function (y, rm) { + var x = this, + Ctor = x.constructor; + + x = new Ctor(x); + + if (y == null) { + + // If x is not finite, return x. + if (!x.d) return x; + + y = new Ctor(1); + rm = Ctor.rounding; + } else { + y = new Ctor(y); + if (rm === void 0) { + rm = Ctor.rounding; + } else { + checkInt32(rm, 0, 8); + } + + // If x is not finite, return x if y is not NaN, else NaN. + if (!x.d) return y.s ? x : y; + + // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN. + if (!y.d) { + if (y.s) y.s = x.s; + return y; + } + } + + // If y is not zero, calculate the nearest multiple of y to x. + if (y.d[0]) { + external = false; + x = divide(x, y, 0, rm, 1).times(y); + external = true; + finalise(x); + + // If y is zero, return zero with the sign of x. + } else { + y.s = x.s; + x = y; + } + + return x; +}; + + +/* + * Return the value of this Decimal converted to a number primitive. + * Zero keeps its sign. + * + */ +P.toNumber = function () { + return +this; +}; + + +/* + * Return a string representing the value of this Decimal in base 8, round to `sd` significant + * digits using rounding mode `rm`. + * + * If the optional `sd` argument is present then return binary exponential notation. + * + * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + */ +P.toOctal = function (sd, rm) { + return toStringBinary(this, 8, sd, rm); +}; + + +/* + * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded + * to `precision` significant digits using rounding mode `rounding`. + * + * ECMAScript compliant. + * + * pow(x, NaN) = NaN + * pow(x, ±0) = 1 + + * pow(NaN, non-zero) = NaN + * pow(abs(x) > 1, +Infinity) = +Infinity + * pow(abs(x) > 1, -Infinity) = +0 + * pow(abs(x) == 1, ±Infinity) = NaN + * pow(abs(x) < 1, +Infinity) = +0 + * pow(abs(x) < 1, -Infinity) = +Infinity + * pow(+Infinity, y > 0) = +Infinity + * pow(+Infinity, y < 0) = +0 + * pow(-Infinity, odd integer > 0) = -Infinity + * pow(-Infinity, even integer > 0) = +Infinity + * pow(-Infinity, odd integer < 0) = -0 + * pow(-Infinity, even integer < 0) = +0 + * pow(+0, y > 0) = +0 + * pow(+0, y < 0) = +Infinity + * pow(-0, odd integer > 0) = -0 + * pow(-0, even integer > 0) = +0 + * pow(-0, odd integer < 0) = -Infinity + * pow(-0, even integer < 0) = +Infinity + * pow(finite x < 0, finite non-integer) = NaN + * + * For non-integer or very large exponents pow(x, y) is calculated using + * + * x^y = exp(y*ln(x)) + * + * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the + * probability of an incorrectly rounded result + * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14 + * i.e. 1 in 250,000,000,000,000 + * + * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place). + * + * y {number|string|bigint|Decimal} The power to which to raise this Decimal. + * + */ +P.toPower = P.pow = function (y) { + var e, k, pr, r, rm, s, + x = this, + Ctor = x.constructor, + yn = +(y = new Ctor(y)); + + // Either ±Infinity, NaN or ±0? + if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn)); + + x = new Ctor(x); + + if (x.eq(1)) return x; + + pr = Ctor.precision; + rm = Ctor.rounding; + + if (y.eq(1)) return finalise(x, pr, rm); + + // y exponent + e = mathfloor(y.e / LOG_BASE); + + // If y is a small integer use the 'exponentiation by squaring' algorithm. + if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) { + r = intPow(Ctor, x, k, pr); + return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm); + } + + s = x.s; + + // if x is negative + if (s < 0) { + + // if y is not an integer + if (e < y.d.length - 1) return new Ctor(NaN); + + // Result is positive if x is negative and the last digit of integer y is even. + if ((y.d[e] & 1) == 0) s = 1; + + // if x.eq(-1) + if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) { + x.s = s; + return x; + } + } + + // Estimate result exponent. + // x^y = 10^e, where e = y * log10(x) + // log10(x) = log10(x_significand) + x_exponent + // log10(x_significand) = ln(x_significand) / ln(10) + k = mathpow(+x, yn); + e = k == 0 || !isFinite(k) + ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1)) + : new Ctor(k + '').e; + + // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1. + + // Overflow/underflow? + if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0); + + external = false; + Ctor.rounding = x.s = 1; + + // Estimate the extra guard digits needed to ensure five correct rounding digits from + // naturalLogarithm(x). Example of failure without these extra digits (precision: 10): + // new Decimal(2.32456).pow('2087987436534566.46411') + // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815 + k = Math.min(12, (e + '').length); + + // r = x^y = exp(y*ln(x)) + r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr); + + // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40) + if (r.d) { + + // Truncate to the required precision plus five rounding digits. + r = finalise(r, pr + 5, 1); + + // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate + // the result. + if (checkRoundingDigits(r.d, pr, rm)) { + e = pr + 10; + + // Truncate to the increased precision plus five rounding digits. + r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1); + + // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9). + if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) { + r = finalise(r, pr + 1, 0); + } + } + } + + r.s = s; + external = true; + Ctor.rounding = rm; + + return finalise(r, pr, rm); +}; + + +/* + * Return a string representing the value of this Decimal rounded to `sd` significant digits + * using rounding mode `rounding`. + * + * Return exponential notation if `sd` is less than the number of digits necessary to represent + * the integer part of the value in normal notation. + * + * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + */ +P.toPrecision = function (sd, rm) { + var str, + x = this, + Ctor = x.constructor; + + if (sd === void 0) { + str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); + } else { + checkInt32(sd, 1, MAX_DIGITS); + + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + + x = finalise(new Ctor(x), sd, rm); + str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd); + } + + return x.isNeg() && !x.isZero() ? '-' + str : str; +}; + + +/* + * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd` + * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if + * omitted. + * + * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * 'toSD() digits out of range: {sd}' + * 'toSD() digits not an integer: {sd}' + * 'toSD() rounding mode not an integer: {rm}' + * 'toSD() rounding mode out of range: {rm}' + * + */ +P.toSignificantDigits = P.toSD = function (sd, rm) { + var x = this, + Ctor = x.constructor; + + if (sd === void 0) { + sd = Ctor.precision; + rm = Ctor.rounding; + } else { + checkInt32(sd, 1, MAX_DIGITS); + + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + } + + return finalise(new Ctor(x), sd, rm); +}; + + +/* + * Return a string representing the value of this Decimal. + * + * Return exponential notation if this Decimal has a positive exponent equal to or greater than + * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`. + * + */ +P.toString = function () { + var x = this, + Ctor = x.constructor, + str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); + + return x.isNeg() && !x.isZero() ? '-' + str : str; +}; + + +/* + * Return a new Decimal whose value is the value of this Decimal truncated to a whole number. + * + */ +P.truncated = P.trunc = function () { + return finalise(new this.constructor(this), this.e + 1, 1); +}; + + +/* + * Return a string representing the value of this Decimal. + * Unlike `toString`, negative zero will include the minus sign. + * + */ +P.valueOf = P.toJSON = function () { + var x = this, + Ctor = x.constructor, + str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); + + return x.isNeg() ? '-' + str : str; +}; + + +// Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers. + + +/* + * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower, + * finiteToString, naturalExponential, naturalLogarithm + * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest, + * P.toPrecision, P.toSignificantDigits, toStringBinary, random + * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm + * convertBase toStringBinary, parseOther + * cos P.cos + * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy, + * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction, + * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm, + * taylorSeries, atan2, parseOther + * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh, + * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus, + * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot, + * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed, + * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits, + * P.truncated, divide, getLn10, getPi, naturalExponential, + * naturalLogarithm, ceil, floor, round, trunc + * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf, + * toStringBinary + * getBase10Exponent P.minus, P.plus, P.times, parseOther + * getLn10 P.logarithm, naturalLogarithm + * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2 + * getPrecision P.precision, P.toFraction + * getZeroString digitsToString, finiteToString + * intPow P.toPower, parseOther + * isOdd toLessThanHalfPi + * maxOrMin max, min + * naturalExponential P.naturalExponential, P.toPower + * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm, + * P.toPower, naturalExponential + * nonFiniteToString finiteToString, toStringBinary + * parseDecimal Decimal + * parseOther Decimal + * sin P.sin + * taylorSeries P.cosh, P.sinh, cos, sin + * toLessThanHalfPi P.cos, P.sin + * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal + * truncate intPow + * + * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi, + * naturalLogarithm, config, parseOther, random, Decimal + */ + + +function digitsToString(d) { + var i, k, ws, + indexOfLastWord = d.length - 1, + str = '', + w = d[0]; + + if (indexOfLastWord > 0) { + str += w; + for (i = 1; i < indexOfLastWord; i++) { + ws = d[i] + ''; + k = LOG_BASE - ws.length; + if (k) str += getZeroString(k); + str += ws; + } + + w = d[i]; + ws = w + ''; + k = LOG_BASE - ws.length; + if (k) str += getZeroString(k); + } else if (w === 0) { + return '0'; + } + + // Remove trailing zeros of last w. + for (; w % 10 === 0;) w /= 10; + + return str + w; +} + + +function checkInt32(i, min, max) { + if (i !== ~~i || i < min || i > max) { + throw Error(invalidArgument + i); + } +} + + +/* + * Check 5 rounding digits if `repeating` is null, 4 otherwise. + * `repeating == null` if caller is `log` or `pow`, + * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`. + */ +function checkRoundingDigits(d, i, rm, repeating) { + var di, k, r, rd; + + // Get the length of the first word of the array d. + for (k = d[0]; k >= 10; k /= 10) --i; + + // Is the rounding digit in the first word of d? + if (--i < 0) { + i += LOG_BASE; + di = 0; + } else { + di = Math.ceil((i + 1) / LOG_BASE); + i %= LOG_BASE; + } + + // i is the index (0 - 6) of the rounding digit. + // E.g. if within the word 3487563 the first rounding digit is 5, + // then i = 4, k = 1000, rd = 3487563 % 1000 = 563 + k = mathpow(10, LOG_BASE - i); + rd = d[di] % k | 0; + + if (repeating == null) { + if (i < 3) { + if (i == 0) rd = rd / 100 | 0; + else if (i == 1) rd = rd / 10 | 0; + r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0; + } else { + r = (rm < 4 && rd + 1 == k || rm > 3 && rd + 1 == k / 2) && + (d[di + 1] / k / 100 | 0) == mathpow(10, i - 2) - 1 || + (rd == k / 2 || rd == 0) && (d[di + 1] / k / 100 | 0) == 0; + } + } else { + if (i < 4) { + if (i == 0) rd = rd / 1000 | 0; + else if (i == 1) rd = rd / 100 | 0; + else if (i == 2) rd = rd / 10 | 0; + r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999; + } else { + r = ((repeating || rm < 4) && rd + 1 == k || + (!repeating && rm > 3) && rd + 1 == k / 2) && + (d[di + 1] / k / 1000 | 0) == mathpow(10, i - 3) - 1; + } + } + + return r; +} + + +// Convert string of `baseIn` to an array of numbers of `baseOut`. +// Eg. convertBase('255', 10, 16) returns [15, 15]. +// Eg. convertBase('ff', 16, 10) returns [2, 5, 5]. +function convertBase(str, baseIn, baseOut) { + var j, + arr = [0], + arrL, + i = 0, + strL = str.length; + + for (; i < strL;) { + for (arrL = arr.length; arrL--;) arr[arrL] *= baseIn; + arr[0] += NUMERALS.indexOf(str.charAt(i++)); + for (j = 0; j < arr.length; j++) { + if (arr[j] > baseOut - 1) { + if (arr[j + 1] === void 0) arr[j + 1] = 0; + arr[j + 1] += arr[j] / baseOut | 0; + arr[j] %= baseOut; + } + } + } + + return arr.reverse(); +} + + +/* + * cos(x) = 1 - x^2/2! + x^4/4! - ... + * |x| < pi/2 + * + */ +function cosine(Ctor, x) { + var k, len, y; + + if (x.isZero()) return x; + + // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1 + // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1 + + // Estimate the optimum number of times to use the argument reduction. + len = x.d.length; + if (len < 32) { + k = Math.ceil(len / 3); + y = (1 / tinyPow(4, k)).toString(); + } else { + k = 16; + y = '2.3283064365386962890625e-10'; + } + + Ctor.precision += k; + + x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1)); + + // Reverse argument reduction + for (var i = k; i--;) { + var cos2x = x.times(x); + x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1); + } + + Ctor.precision -= k; + + return x; +} + + +/* + * Perform division in the specified base. + */ +var divide = (function () { + + // Assumes non-zero x and k, and hence non-zero result. + function multiplyInteger(x, k, base) { + var temp, + carry = 0, + i = x.length; + + for (x = x.slice(); i--;) { + temp = x[i] * k + carry; + x[i] = temp % base | 0; + carry = temp / base | 0; + } + + if (carry) x.unshift(carry); + + return x; + } + + function compare(a, b, aL, bL) { + var i, r; + + if (aL != bL) { + r = aL > bL ? 1 : -1; + } else { + for (i = r = 0; i < aL; i++) { + if (a[i] != b[i]) { + r = a[i] > b[i] ? 1 : -1; + break; + } + } + } + + return r; + } + + function subtract(a, b, aL, base) { + var i = 0; + + // Subtract b from a. + for (; aL--;) { + a[aL] -= i; + i = a[aL] < b[aL] ? 1 : 0; + a[aL] = i * base + a[aL] - b[aL]; + } + + // Remove leading zeros. + for (; !a[0] && a.length > 1;) a.shift(); + } + + return function (x, y, pr, rm, dp, base) { + var cmp, e, i, k, logBase, more, prod, prodL, q, qd, rem, remL, rem0, sd, t, xi, xL, yd0, + yL, yz, + Ctor = x.constructor, + sign = x.s == y.s ? 1 : -1, + xd = x.d, + yd = y.d; + + // Either NaN, Infinity or 0? + if (!xd || !xd[0] || !yd || !yd[0]) { + + return new Ctor(// Return NaN if either NaN, or both Infinity or 0. + !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN : + + // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0. + xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0); + } + + if (base) { + logBase = 1; + e = x.e - y.e; + } else { + base = BASE; + logBase = LOG_BASE; + e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase); + } + + yL = yd.length; + xL = xd.length; + q = new Ctor(sign); + qd = q.d = []; + + // Result exponent may be one less than e. + // The digit array of a Decimal from toStringBinary may have trailing zeros. + for (i = 0; yd[i] == (xd[i] || 0); i++); + + if (yd[i] > (xd[i] || 0)) e--; + + if (pr == null) { + sd = pr = Ctor.precision; + rm = Ctor.rounding; + } else if (dp) { + sd = pr + (x.e - y.e) + 1; + } else { + sd = pr; + } + + if (sd < 0) { + qd.push(1); + more = true; + } else { + + // Convert precision in number of base 10 digits to base 1e7 digits. + sd = sd / logBase + 2 | 0; + i = 0; + + // divisor < 1e7 + if (yL == 1) { + k = 0; + yd = yd[0]; + sd++; + + // k is the carry. + for (; (i < xL || k) && sd--; i++) { + t = k * base + (xd[i] || 0); + qd[i] = t / yd | 0; + k = t % yd | 0; + } + + more = k || i < xL; + + // divisor >= 1e7 + } else { + + // Normalise xd and yd so highest order digit of yd is >= base/2 + k = base / (yd[0] + 1) | 0; + + if (k > 1) { + yd = multiplyInteger(yd, k, base); + xd = multiplyInteger(xd, k, base); + yL = yd.length; + xL = xd.length; + } + + xi = yL; + rem = xd.slice(0, yL); + remL = rem.length; + + // Add zeros to make remainder as long as divisor. + for (; remL < yL;) rem[remL++] = 0; + + yz = yd.slice(); + yz.unshift(0); + yd0 = yd[0]; + + if (yd[1] >= base / 2) ++yd0; + + do { + k = 0; + + // Compare divisor and remainder. + cmp = compare(yd, rem, yL, remL); + + // If divisor < remainder. + if (cmp < 0) { + + // Calculate trial digit, k. + rem0 = rem[0]; + if (yL != remL) rem0 = rem0 * base + (rem[1] || 0); + + // k will be how many times the divisor goes into the current remainder. + k = rem0 / yd0 | 0; + + // Algorithm: + // 1. product = divisor * trial digit (k) + // 2. if product > remainder: product -= divisor, k-- + // 3. remainder -= product + // 4. if product was < remainder at 2: + // 5. compare new remainder and divisor + // 6. If remainder > divisor: remainder -= divisor, k++ + + if (k > 1) { + if (k >= base) k = base - 1; + + // product = divisor * trial digit. + prod = multiplyInteger(yd, k, base); + prodL = prod.length; + remL = rem.length; + + // Compare product and remainder. + cmp = compare(prod, rem, prodL, remL); + + // product > remainder. + if (cmp == 1) { + k--; + + // Subtract divisor from product. + subtract(prod, yL < prodL ? yz : yd, prodL, base); + } + } else { + + // cmp is -1. + // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1 + // to avoid it. If k is 1 there is a need to compare yd and rem again below. + if (k == 0) cmp = k = 1; + prod = yd.slice(); + } + + prodL = prod.length; + if (prodL < remL) prod.unshift(0); + + // Subtract product from remainder. + subtract(rem, prod, remL, base); + + // If product was < previous remainder. + if (cmp == -1) { + remL = rem.length; + + // Compare divisor and new remainder. + cmp = compare(yd, rem, yL, remL); + + // If divisor < new remainder, subtract divisor from remainder. + if (cmp < 1) { + k++; + + // Subtract divisor from remainder. + subtract(rem, yL < remL ? yz : yd, remL, base); + } + } + + remL = rem.length; + } else if (cmp === 0) { + k++; + rem = [0]; + } // if cmp === 1, k will be 0 + + // Add the next digit, k, to the result array. + qd[i++] = k; + + // Update the remainder. + if (cmp && rem[0]) { + rem[remL++] = xd[xi] || 0; + } else { + rem = [xd[xi]]; + remL = 1; + } + + } while ((xi++ < xL || rem[0] !== void 0) && sd--); + + more = rem[0] !== void 0; + } + + // Leading zero? + if (!qd[0]) qd.shift(); + } + + // logBase is 1 when divide is being used for base conversion. + if (logBase == 1) { + q.e = e; + inexact = more; + } else { + + // To calculate q.e, first get the number of digits of qd[0]. + for (i = 1, k = qd[0]; k >= 10; k /= 10) i++; + q.e = i + e * logBase - 1; + + finalise(q, dp ? pr + q.e + 1 : pr, rm, more); + } + + return q; + }; +})(); + + +/* + * Round `x` to `sd` significant digits using rounding mode `rm`. + * Check for over/under-flow. + */ + function finalise(x, sd, rm, isTruncated) { + var digits, i, j, k, rd, roundUp, w, xd, xdi, + Ctor = x.constructor; + + // Don't round if sd is null or undefined. + out: if (sd != null) { + xd = x.d; + + // Infinity/NaN. + if (!xd) return x; + + // rd: the rounding digit, i.e. the digit after the digit that may be rounded up. + // w: the word of xd containing rd, a base 1e7 number. + // xdi: the index of w within xd. + // digits: the number of digits of w. + // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if + // they had leading zeros) + // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero). + + // Get the length of the first word of the digits array xd. + for (digits = 1, k = xd[0]; k >= 10; k /= 10) digits++; + i = sd - digits; + + // Is the rounding digit in the first word of xd? + if (i < 0) { + i += LOG_BASE; + j = sd; + w = xd[xdi = 0]; + + // Get the rounding digit at index j of w. + rd = w / mathpow(10, digits - j - 1) % 10 | 0; + } else { + xdi = Math.ceil((i + 1) / LOG_BASE); + k = xd.length; + if (xdi >= k) { + if (isTruncated) { + + // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`. + for (; k++ <= xdi;) xd.push(0); + w = rd = 0; + digits = 1; + i %= LOG_BASE; + j = i - LOG_BASE + 1; + } else { + break out; + } + } else { + w = k = xd[xdi]; + + // Get the number of digits of w. + for (digits = 1; k >= 10; k /= 10) digits++; + + // Get the index of rd within w. + i %= LOG_BASE; + + // Get the index of rd within w, adjusted for leading zeros. + // The number of leading zeros of w is given by LOG_BASE - digits. + j = i - LOG_BASE + digits; + + // Get the rounding digit at index j of w. + rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0; + } + } + + // Are there any non-zero digits after the rounding digit? + isTruncated = isTruncated || sd < 0 || + xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1)); + + // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right + // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression + // will give 714. + + roundUp = rm < 4 + ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) + : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 && + + // Check whether the digit to the left of the rounding digit is odd. + ((i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10) & 1 || + rm == (x.s < 0 ? 8 : 7)); + + if (sd < 1 || !xd[0]) { + xd.length = 0; + if (roundUp) { + + // Convert sd to decimal places. + sd -= x.e + 1; + + // 1, 0.1, 0.01, 0.001, 0.0001 etc. + xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE); + x.e = -sd || 0; + } else { + + // Zero. + xd[0] = x.e = 0; + } + + return x; + } + + // Remove excess digits. + if (i == 0) { + xd.length = xdi; + k = 1; + xdi--; + } else { + xd.length = xdi + 1; + k = mathpow(10, LOG_BASE - i); + + // E.g. 56700 becomes 56000 if 7 is the rounding digit. + // j > 0 means i > number of leading zeros of w. + xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0; + } + + if (roundUp) { + for (;;) { + + // Is the digit to be rounded up in the first word of xd? + if (xdi == 0) { + + // i will be the length of xd[0] before k is added. + for (i = 1, j = xd[0]; j >= 10; j /= 10) i++; + j = xd[0] += k; + for (k = 1; j >= 10; j /= 10) k++; + + // if i != k the length has increased. + if (i != k) { + x.e++; + if (xd[0] == BASE) xd[0] = 1; + } + + break; + } else { + xd[xdi] += k; + if (xd[xdi] != BASE) break; + xd[xdi--] = 0; + k = 1; + } + } + } + + // Remove trailing zeros. + for (i = xd.length; xd[--i] === 0;) xd.pop(); + } + + if (external) { + + // Overflow? + if (x.e > Ctor.maxE) { + + // Infinity. + x.d = null; + x.e = NaN; + + // Underflow? + } else if (x.e < Ctor.minE) { + + // Zero. + x.e = 0; + x.d = [0]; + // Ctor.underflow = true; + } // else Ctor.underflow = false; + } + + return x; +} + + +function finiteToString(x, isExp, sd) { + if (!x.isFinite()) return nonFiniteToString(x); + var k, + e = x.e, + str = digitsToString(x.d), + len = str.length; + + if (isExp) { + if (sd && (k = sd - len) > 0) { + str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k); + } else if (len > 1) { + str = str.charAt(0) + '.' + str.slice(1); + } + + str = str + (x.e < 0 ? 'e' : 'e+') + x.e; + } else if (e < 0) { + str = '0.' + getZeroString(-e - 1) + str; + if (sd && (k = sd - len) > 0) str += getZeroString(k); + } else if (e >= len) { + str += getZeroString(e + 1 - len); + if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k); + } else { + if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k); + if (sd && (k = sd - len) > 0) { + if (e + 1 === len) str += '.'; + str += getZeroString(k); + } + } + + return str; +} + + +// Calculate the base 10 exponent from the base 1e7 exponent. +function getBase10Exponent(digits, e) { + var w = digits[0]; + + // Add the number of digits of the first word of the digits array. + for ( e *= LOG_BASE; w >= 10; w /= 10) e++; + return e; +} + + +function getLn10(Ctor, sd, pr) { + if (sd > LN10_PRECISION) { + + // Reset global state in case the exception is caught. + external = true; + if (pr) Ctor.precision = pr; + throw Error(precisionLimitExceeded); + } + return finalise(new Ctor(LN10), sd, 1, true); +} + + +function getPi(Ctor, sd, rm) { + if (sd > PI_PRECISION) throw Error(precisionLimitExceeded); + return finalise(new Ctor(PI), sd, rm, true); +} + + +function getPrecision(digits) { + var w = digits.length - 1, + len = w * LOG_BASE + 1; + + w = digits[w]; + + // If non-zero... + if (w) { + + // Subtract the number of trailing zeros of the last word. + for (; w % 10 == 0; w /= 10) len--; + + // Add the number of digits of the first word. + for (w = digits[0]; w >= 10; w /= 10) len++; + } + + return len; +} + + +function getZeroString(k) { + var zs = ''; + for (; k--;) zs += '0'; + return zs; +} + + +/* + * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an + * integer of type number. + * + * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`. + * + */ +function intPow(Ctor, x, n, pr) { + var isTruncated, + r = new Ctor(1), + + // Max n of 9007199254740991 takes 53 loop iterations. + // Maximum digits array length; leaves [28, 34] guard digits. + k = Math.ceil(pr / LOG_BASE + 4); + + external = false; + + for (;;) { + if (n % 2) { + r = r.times(x); + if (truncate(r.d, k)) isTruncated = true; + } + + n = mathfloor(n / 2); + if (n === 0) { + + // To ensure correct rounding when r.d is truncated, increment the last word if it is zero. + n = r.d.length - 1; + if (isTruncated && r.d[n] === 0) ++r.d[n]; + break; + } + + x = x.times(x); + truncate(x.d, k); + } + + external = true; + + return r; +} + + +function isOdd(n) { + return n.d[n.d.length - 1] & 1; +} + + +/* + * Handle `max` (`n` is -1) and `min` (`n` is 1). + */ +function maxOrMin(Ctor, args, n) { + var k, y, + x = new Ctor(args[0]), + i = 0; + + for (; ++i < args.length;) { + y = new Ctor(args[i]); + + // NaN? + if (!y.s) { + x = y; + break; + } + + k = x.cmp(y); + + if (k === n || k === 0 && x.s === n) { + x = y; + } + } + + return x; +} + + +/* + * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant + * digits. + * + * Taylor/Maclaurin series. + * + * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ... + * + * Argument reduction: + * Repeat x = x / 32, k += 5, until |x| < 0.1 + * exp(x) = exp(x / 2^k)^(2^k) + * + * Previously, the argument was initially reduced by + * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10) + * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was + * found to be slower than just dividing repeatedly by 32 as above. + * + * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000 + * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000 + * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324) + * + * exp(Infinity) = Infinity + * exp(-Infinity) = 0 + * exp(NaN) = NaN + * exp(±0) = 1 + * + * exp(x) is non-terminating for any finite, non-zero x. + * + * The result will always be correctly rounded. + * + */ +function naturalExponential(x, sd) { + var denominator, guard, j, pow, sum, t, wpr, + rep = 0, + i = 0, + k = 0, + Ctor = x.constructor, + rm = Ctor.rounding, + pr = Ctor.precision; + + // 0/NaN/Infinity? + if (!x.d || !x.d[0] || x.e > 17) { + + return new Ctor(x.d + ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0 + : x.s ? x.s < 0 ? 0 : x : 0 / 0); + } + + if (sd == null) { + external = false; + wpr = pr; + } else { + wpr = sd; + } + + t = new Ctor(0.03125); + + // while abs(x) >= 0.1 + while (x.e > -2) { + + // x = x / 2^5 + x = x.times(t); + k += 5; + } + + // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision + // necessary to ensure the first 4 rounding digits are correct. + guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0; + wpr += guard; + denominator = pow = sum = new Ctor(1); + Ctor.precision = wpr; + + for (;;) { + pow = finalise(pow.times(x), wpr, 1); + denominator = denominator.times(++i); + t = sum.plus(divide(pow, denominator, wpr, 1)); + + if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) { + j = k; + while (j--) sum = finalise(sum.times(sum), wpr, 1); + + // Check to see if the first 4 rounding digits are [49]999. + // If so, repeat the summation with a higher precision, otherwise + // e.g. with precision: 18, rounding: 1 + // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123) + // `wpr - guard` is the index of first rounding digit. + if (sd == null) { + + if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) { + Ctor.precision = wpr += 10; + denominator = pow = t = new Ctor(1); + i = 0; + rep++; + } else { + return finalise(sum, Ctor.precision = pr, rm, external = true); + } + } else { + Ctor.precision = pr; + return sum; + } + } + + sum = t; + } +} + + +/* + * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant + * digits. + * + * ln(-n) = NaN + * ln(0) = -Infinity + * ln(-0) = -Infinity + * ln(1) = 0 + * ln(Infinity) = Infinity + * ln(-Infinity) = NaN + * ln(NaN) = NaN + * + * ln(n) (n != 1) is non-terminating. + * + */ +function naturalLogarithm(y, sd) { + var c, c0, denominator, e, numerator, rep, sum, t, wpr, x1, x2, + n = 1, + guard = 10, + x = y, + xd = x.d, + Ctor = x.constructor, + rm = Ctor.rounding, + pr = Ctor.precision; + + // Is x negative or Infinity, NaN, 0 or 1? + if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) { + return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x); + } + + if (sd == null) { + external = false; + wpr = pr; + } else { + wpr = sd; + } + + Ctor.precision = wpr += guard; + c = digitsToString(xd); + c0 = c.charAt(0); + + if (Math.abs(e = x.e) < 1.5e15) { + + // Argument reduction. + // The series converges faster the closer the argument is to 1, so using + // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b + // multiply the argument by itself until the leading digits of the significand are 7, 8, 9, + // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can + // later be divided by this number, then separate out the power of 10 using + // ln(a*10^b) = ln(a) + b*ln(10). + + // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14). + //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) { + // max n is 6 (gives 0.7 - 1.3) + while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) { + x = x.times(y); + c = digitsToString(x.d); + c0 = c.charAt(0); + n++; + } + + e = x.e; + + if (c0 > 1) { + x = new Ctor('0.' + c); + e++; + } else { + x = new Ctor(c0 + '.' + c.slice(1)); + } + } else { + + // The argument reduction method above may result in overflow if the argument y is a massive + // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this + // function using ln(x*10^e) = ln(x) + e*ln(10). + t = getLn10(Ctor, wpr + 2, pr).times(e + ''); + x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t); + Ctor.precision = pr; + + return sd == null ? finalise(x, pr, rm, external = true) : x; + } + + // x1 is x reduced to a value near 1. + x1 = x; + + // Taylor series. + // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...) + // where x = (y - 1)/(y + 1) (|x| < 1) + sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1); + x2 = finalise(x.times(x), wpr, 1); + denominator = 3; + + for (;;) { + numerator = finalise(numerator.times(x2), wpr, 1); + t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1)); + + if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) { + sum = sum.times(2); + + // Reverse the argument reduction. Check that e is not 0 because, besides preventing an + // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0. + if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + '')); + sum = divide(sum, new Ctor(n), wpr, 1); + + // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has + // been repeated previously) and the first 4 rounding digits 9999? + // If so, restart the summation with a higher precision, otherwise + // e.g. with precision: 12, rounding: 1 + // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463. + // `wpr - guard` is the index of first rounding digit. + if (sd == null) { + if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) { + Ctor.precision = wpr += guard; + t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1); + x2 = finalise(x.times(x), wpr, 1); + denominator = rep = 1; + } else { + return finalise(sum, Ctor.precision = pr, rm, external = true); + } + } else { + Ctor.precision = pr; + return sum; + } + } + + sum = t; + denominator += 2; + } +} + + +// ±Infinity, NaN. +function nonFiniteToString(x) { + // Unsigned. + return String(x.s * x.s / 0); +} + + +/* + * Parse the value of a new Decimal `x` from string `str`. + */ +function parseDecimal(x, str) { + var e, i, len; + + // TODO BigInt str: no need to check for decimal point, exponential form or leading zeros. + // Decimal point? + if ((e = str.indexOf('.')) > -1) str = str.replace('.', ''); + + // Exponential form? + if ((i = str.search(/e/i)) > 0) { + + // Determine exponent. + if (e < 0) e = i; + e += +str.slice(i + 1); + str = str.substring(0, i); + } else if (e < 0) { + + // Integer. + e = str.length; + } + + // Determine leading zeros. + for (i = 0; str.charCodeAt(i) === 48; i++); + + // Determine trailing zeros. + for (len = str.length; str.charCodeAt(len - 1) === 48; --len); + str = str.slice(i, len); + + if (str) { + len -= i; + x.e = e = e - i - 1; + x.d = []; + + // Transform base + + // e is the base 10 exponent. + // i is where to slice str to get the first word of the digits array. + i = (e + 1) % LOG_BASE; + if (e < 0) i += LOG_BASE; + + if (i < len) { + if (i) x.d.push(+str.slice(0, i)); + for (len -= LOG_BASE; i < len;) x.d.push(+str.slice(i, i += LOG_BASE)); + str = str.slice(i); + i = LOG_BASE - str.length; + } else { + i -= len; + } + + for (; i--;) str += '0'; + x.d.push(+str); + + if (external) { + + // Overflow? + if (x.e > x.constructor.maxE) { + + // Infinity. + x.d = null; + x.e = NaN; + + // Underflow? + } else if (x.e < x.constructor.minE) { + + // Zero. + x.e = 0; + x.d = [0]; + // x.constructor.underflow = true; + } // else x.constructor.underflow = false; + } + } else { + + // Zero. + x.e = 0; + x.d = [0]; + } + + return x; +} + + +/* + * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value. + */ +function parseOther(x, str) { + var base, Ctor, divisor, i, isFloat, len, p, xd, xe; + + if (str.indexOf('_') > -1) { + str = str.replace(/(\d)_(?=\d)/g, '$1'); + if (isDecimal.test(str)) return parseDecimal(x, str); + } else if (str === 'Infinity' || str === 'NaN') { + if (!+str) x.s = NaN; + x.e = NaN; + x.d = null; + return x; + } + + if (isHex.test(str)) { + base = 16; + str = str.toLowerCase(); + } else if (isBinary.test(str)) { + base = 2; + } else if (isOctal.test(str)) { + base = 8; + } else { + throw Error(invalidArgument + str); + } + + // Is there a binary exponent part? + i = str.search(/p/i); + + if (i > 0) { + p = +str.slice(i + 1); + str = str.substring(2, i); + } else { + str = str.slice(2); + } + + // Convert `str` as an integer then divide the result by `base` raised to a power such that the + // fraction part will be restored. + i = str.indexOf('.'); + isFloat = i >= 0; + Ctor = x.constructor; + + if (isFloat) { + str = str.replace('.', ''); + len = str.length; + i = len - i; + + // log[10](16) = 1.2041... , log[10](88) = 1.9444.... + divisor = intPow(Ctor, new Ctor(base), i, i * 2); + } + + xd = convertBase(str, base, BASE); + xe = xd.length - 1; + + // Remove trailing zeros. + for (i = xe; xd[i] === 0; --i) xd.pop(); + if (i < 0) return new Ctor(x.s * 0); + x.e = getBase10Exponent(xd, xe); + x.d = xd; + external = false; + + // At what precision to perform the division to ensure exact conversion? + // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount) + // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412 + // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits. + // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount + // Therefore using 4 * the number of digits of str will always be enough. + if (isFloat) x = divide(x, divisor, len * 4); + + // Multiply by the binary exponent part if present. + if (p) x = x.times(Math.abs(p) < 54 ? mathpow(2, p) : Decimal.pow(2, p)); + external = true; + + return x; +} + + +/* + * sin(x) = x - x^3/3! + x^5/5! - ... + * |x| < pi/2 + * + */ +function sine(Ctor, x) { + var k, + len = x.d.length; + + if (len < 3) { + return x.isZero() ? x : taylorSeries(Ctor, 2, x, x); + } + + // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x) + // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5) + // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20)) + + // Estimate the optimum number of times to use the argument reduction. + k = 1.4 * Math.sqrt(len); + k = k > 16 ? 16 : k | 0; + + x = x.times(1 / tinyPow(5, k)); + x = taylorSeries(Ctor, 2, x, x); + + // Reverse argument reduction + var sin2_x, + d5 = new Ctor(5), + d16 = new Ctor(16), + d20 = new Ctor(20); + for (; k--;) { + sin2_x = x.times(x); + x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20)))); + } + + return x; +} + + +// Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`. +function taylorSeries(Ctor, n, x, y, isHyperbolic) { + var j, t, u, x2, + i = 1, + pr = Ctor.precision, + k = Math.ceil(pr / LOG_BASE); + + external = false; + x2 = x.times(x); + u = new Ctor(y); + + for (;;) { + t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1); + u = isHyperbolic ? y.plus(t) : y.minus(t); + y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1); + t = u.plus(y); + + if (t.d[k] !== void 0) { + for (j = k; t.d[j] === u.d[j] && j--;); + if (j == -1) break; + } + + j = u; + u = y; + y = t; + t = j; + i++; + } + + external = true; + t.d.length = k + 1; + + return t; +} + + +// Exponent e must be positive and non-zero. +function tinyPow(b, e) { + var n = b; + while (--e) n *= b; + return n; +} + + +// Return the absolute value of `x` reduced to less than or equal to half pi. +function toLessThanHalfPi(Ctor, x) { + var t, + isNeg = x.s < 0, + pi = getPi(Ctor, Ctor.precision, 1), + halfPi = pi.times(0.5); + + x = x.abs(); + + if (x.lte(halfPi)) { + quadrant = isNeg ? 4 : 1; + return x; + } + + t = x.divToInt(pi); + + if (t.isZero()) { + quadrant = isNeg ? 3 : 2; + } else { + x = x.minus(t.times(pi)); + + // 0 <= x < pi + if (x.lte(halfPi)) { + quadrant = isOdd(t) ? (isNeg ? 2 : 3) : (isNeg ? 4 : 1); + return x; + } + + quadrant = isOdd(t) ? (isNeg ? 1 : 4) : (isNeg ? 3 : 2); + } + + return x.minus(pi).abs(); +} + + +/* + * Return the value of Decimal `x` as a string in base `baseOut`. + * + * If the optional `sd` argument is present include a binary exponent suffix. + */ +function toStringBinary(x, baseOut, sd, rm) { + var base, e, i, k, len, roundUp, str, xd, y, + Ctor = x.constructor, + isExp = sd !== void 0; + + if (isExp) { + checkInt32(sd, 1, MAX_DIGITS); + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + } else { + sd = Ctor.precision; + rm = Ctor.rounding; + } + + if (!x.isFinite()) { + str = nonFiniteToString(x); + } else { + str = finiteToString(x); + i = str.indexOf('.'); + + // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required: + // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10)) + // minBinaryExponent = floor(decimalExponent * log[2](10)) + // log[2](10) = 3.321928094887362347870319429489390175864 + + if (isExp) { + base = 2; + if (baseOut == 16) { + sd = sd * 4 - 3; + } else if (baseOut == 8) { + sd = sd * 3 - 2; + } + } else { + base = baseOut; + } + + // Convert the number as an integer then divide the result by its base raised to a power such + // that the fraction part will be restored. + + // Non-integer. + if (i >= 0) { + str = str.replace('.', ''); + y = new Ctor(1); + y.e = str.length - i; + y.d = convertBase(finiteToString(y), 10, base); + y.e = y.d.length; + } + + xd = convertBase(str, 10, base); + e = len = xd.length; + + // Remove trailing zeros. + for (; xd[--len] == 0;) xd.pop(); + + if (!xd[0]) { + str = isExp ? '0p+0' : '0'; + } else { + if (i < 0) { + e--; + } else { + x = new Ctor(x); + x.d = xd; + x.e = e; + x = divide(x, y, sd, rm, 0, base); + xd = x.d; + e = x.e; + roundUp = inexact; + } + + // The rounding digit, i.e. the digit after the digit that may be rounded up. + i = xd[sd]; + k = base / 2; + roundUp = roundUp || xd[sd + 1] !== void 0; + + roundUp = rm < 4 + ? (i !== void 0 || roundUp) && (rm === 0 || rm === (x.s < 0 ? 3 : 2)) + : i > k || i === k && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 || + rm === (x.s < 0 ? 8 : 7)); + + xd.length = sd; + + if (roundUp) { + + // Rounding up may mean the previous digit has to be rounded up and so on. + for (; ++xd[--sd] > base - 1;) { + xd[sd] = 0; + if (!sd) { + ++e; + xd.unshift(1); + } + } + } + + // Determine trailing zeros. + for (len = xd.length; !xd[len - 1]; --len); + + // E.g. [4, 11, 15] becomes 4bf. + for (i = 0, str = ''; i < len; i++) str += NUMERALS.charAt(xd[i]); + + // Add binary exponent suffix? + if (isExp) { + if (len > 1) { + if (baseOut == 16 || baseOut == 8) { + i = baseOut == 16 ? 4 : 3; + for (--len; len % i; len++) str += '0'; + xd = convertBase(str, base, baseOut); + for (len = xd.length; !xd[len - 1]; --len); + + // xd[0] will always be be 1 + for (i = 1, str = '1.'; i < len; i++) str += NUMERALS.charAt(xd[i]); + } else { + str = str.charAt(0) + '.' + str.slice(1); + } + } + + str = str + (e < 0 ? 'p' : 'p+') + e; + } else if (e < 0) { + for (; ++e;) str = '0' + str; + str = '0.' + str; + } else { + if (++e > len) for (e -= len; e-- ;) str += '0'; + else if (e < len) str = str.slice(0, e) + '.' + str.slice(e); + } + } + + str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str; + } + + return x.s < 0 ? '-' + str : str; +} + + +// Does not strip trailing zeros. +function truncate(arr, len) { + if (arr.length > len) { + arr.length = len; + return true; + } +} + + +// Decimal methods + + +/* + * abs + * acos + * acosh + * add + * asin + * asinh + * atan + * atanh + * atan2 + * cbrt + * ceil + * clamp + * clone + * config + * cos + * cosh + * div + * exp + * floor + * hypot + * ln + * log + * log2 + * log10 + * max + * min + * mod + * mul + * pow + * random + * round + * set + * sign + * sin + * sinh + * sqrt + * sub + * sum + * tan + * tanh + * trunc + */ + + +/* + * Return a new Decimal whose value is the absolute value of `x`. + * + * x {number|string|bigint|Decimal} + * + */ +function abs(x) { + return new this(x).abs(); +} + + +/* + * Return a new Decimal whose value is the arccosine in radians of `x`. + * + * x {number|string|bigint|Decimal} + * + */ +function acos(x) { + return new this(x).acos(); +} + + +/* + * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to + * `precision` significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ +function acosh(x) { + return new this(x).acosh(); +} + + +/* + * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant + * digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * y {number|string|bigint|Decimal} + * + */ +function add(x, y) { + return new this(x).plus(y); +} + + +/* + * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * + */ +function asin(x) { + return new this(x).asin(); +} + + +/* + * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to + * `precision` significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ +function asinh(x) { + return new this(x).asinh(); +} + + +/* + * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * + */ +function atan(x) { + return new this(x).atan(); +} + + +/* + * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to + * `precision` significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ +function atanh(x) { + return new this(x).atanh(); +} + + +/* + * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi + * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`. + * + * Domain: [-Infinity, Infinity] + * Range: [-pi, pi] + * + * y {number|string|bigint|Decimal} The y-coordinate. + * x {number|string|bigint|Decimal} The x-coordinate. + * + * atan2(±0, -0) = ±pi + * atan2(±0, +0) = ±0 + * atan2(±0, -x) = ±pi for x > 0 + * atan2(±0, x) = ±0 for x > 0 + * atan2(-y, ±0) = -pi/2 for y > 0 + * atan2(y, ±0) = pi/2 for y > 0 + * atan2(±y, -Infinity) = ±pi for finite y > 0 + * atan2(±y, +Infinity) = ±0 for finite y > 0 + * atan2(±Infinity, x) = ±pi/2 for finite x + * atan2(±Infinity, -Infinity) = ±3*pi/4 + * atan2(±Infinity, +Infinity) = ±pi/4 + * atan2(NaN, x) = NaN + * atan2(y, NaN) = NaN + * + */ +function atan2(y, x) { + y = new this(y); + x = new this(x); + var r, + pr = this.precision, + rm = this.rounding, + wpr = pr + 4; + + // Either NaN + if (!y.s || !x.s) { + r = new this(NaN); + + // Both ±Infinity + } else if (!y.d && !x.d) { + r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75); + r.s = y.s; + + // x is ±Infinity or y is ±0 + } else if (!x.d || y.isZero()) { + r = x.s < 0 ? getPi(this, pr, rm) : new this(0); + r.s = y.s; + + // y is ±Infinity or x is ±0 + } else if (!y.d || x.isZero()) { + r = getPi(this, wpr, 1).times(0.5); + r.s = y.s; + + // Both non-zero and finite + } else if (x.s < 0) { + this.precision = wpr; + this.rounding = 1; + r = this.atan(divide(y, x, wpr, 1)); + x = getPi(this, wpr, 1); + this.precision = pr; + this.rounding = rm; + r = y.s < 0 ? r.minus(x) : r.plus(x); + } else { + r = this.atan(divide(y, x, wpr, 1)); + } + + return r; +} + + +/* + * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant + * digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * + */ +function cbrt(x) { + return new this(x).cbrt(); +} + + +/* + * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`. + * + * x {number|string|bigint|Decimal} + * + */ +function ceil(x) { + return finalise(x = new this(x), x.e + 1, 2); +} + + +/* + * Return a new Decimal whose value is `x` clamped to the range delineated by `min` and `max`. + * + * x {number|string|bigint|Decimal} + * min {number|string|bigint|Decimal} + * max {number|string|bigint|Decimal} + * + */ +function clamp(x, min, max) { + return new this(x).clamp(min, max); +} + + +/* + * Configure global settings for a Decimal constructor. + * + * `obj` is an object with one or more of the following properties, + * + * precision {number} + * rounding {number} + * toExpNeg {number} + * toExpPos {number} + * maxE {number} + * minE {number} + * modulo {number} + * crypto {boolean|number} + * defaults {true} + * + * E.g. Decimal.config({ precision: 20, rounding: 4 }) + * + */ +function config(obj) { + if (!obj || typeof obj !== 'object') throw Error(decimalError + 'Object expected'); + var i, p, v, + useDefaults = obj.defaults === true, + ps = [ + 'precision', 1, MAX_DIGITS, + 'rounding', 0, 8, + 'toExpNeg', -EXP_LIMIT, 0, + 'toExpPos', 0, EXP_LIMIT, + 'maxE', 0, EXP_LIMIT, + 'minE', -EXP_LIMIT, 0, + 'modulo', 0, 9 + ]; + + for (i = 0; i < ps.length; i += 3) { + if (p = ps[i], useDefaults) this[p] = DEFAULTS[p]; + if ((v = obj[p]) !== void 0) { + if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v; + else throw Error(invalidArgument + p + ': ' + v); + } + } + + if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p]; + if ((v = obj[p]) !== void 0) { + if (v === true || v === false || v === 0 || v === 1) { + if (v) { + if (typeof crypto != 'undefined' && crypto && + (crypto.getRandomValues || crypto.randomBytes)) { + this[p] = true; + } else { + throw Error(cryptoUnavailable); + } + } else { + this[p] = false; + } + } else { + throw Error(invalidArgument + p + ': ' + v); + } + } + + return this; +} + + +/* + * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant + * digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ +function cos(x) { + return new this(x).cos(); +} + + +/* + * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ +function cosh(x) { + return new this(x).cosh(); +} + + +/* + * Create and return a Decimal constructor with the same configuration properties as this Decimal + * constructor. + * + */ +function clone(obj) { + var i, p, ps; + + /* + * The Decimal constructor and exported function. + * Return a new Decimal instance. + * + * v {number|string|bigint|Decimal} A numeric value. + * + */ + function Decimal(v) { + var e, i, t, + x = this; + + // Decimal called without new. + if (!(x instanceof Decimal)) return new Decimal(v); + + // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor + // which points to Object. + x.constructor = Decimal; + + if (isDecimalInstance(v)) { + x.s = v.s; + + if (external) { + if (!v.d || v.e > Decimal.maxE) { + + // Infinity. + x.e = NaN; + x.d = null; + } else if (v.e < Decimal.minE) { + + // Zero. + x.e = 0; + x.d = [0]; + } else { + x.e = v.e; + x.d = v.d.slice(); + } + } else { + x.e = v.e; + x.d = v.d ? v.d.slice() : v.d; + } + + return; + } + + t = typeof v; + + if (t === 'number') { + if (v === 0) { + x.s = 1 / v < 0 ? -1 : 1; + x.e = 0; + x.d = [0]; + return; + } + + if (v < 0) { + v = -v; + x.s = -1; + } else { + x.s = 1; + } + + // Fast path for small integers. + if (v === ~~v && v < 1e7) { + for (e = 0, i = v; i >= 10; i /= 10) e++; + + if (external) { + if (e > Decimal.maxE) { + x.e = NaN; + x.d = null; + } else if (e < Decimal.minE) { + x.e = 0; + x.d = [0]; + } else { + x.e = e; + x.d = [v]; + } + } else { + x.e = e; + x.d = [v]; + } + + return; + } + + // Infinity or NaN? + if (v * 0 !== 0) { + if (!v) x.s = NaN; + x.e = NaN; + x.d = null; + return; + } + + return parseDecimal(x, v.toString()); + } + + if (t === 'string') { + if ((i = v.charCodeAt(0)) === 45) { // minus sign + v = v.slice(1); + x.s = -1; + } else { + if (i === 43) v = v.slice(1); // plus sign + x.s = 1; + } + + return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v); + } + + if (t === 'bigint') { + if (v < 0) { + v = -v; + x.s = -1; + } else { + x.s = 1; + } + + return parseDecimal(x, v.toString()); + } + + throw Error(invalidArgument + v); + } + + Decimal.prototype = P; + + Decimal.ROUND_UP = 0; + Decimal.ROUND_DOWN = 1; + Decimal.ROUND_CEIL = 2; + Decimal.ROUND_FLOOR = 3; + Decimal.ROUND_HALF_UP = 4; + Decimal.ROUND_HALF_DOWN = 5; + Decimal.ROUND_HALF_EVEN = 6; + Decimal.ROUND_HALF_CEIL = 7; + Decimal.ROUND_HALF_FLOOR = 8; + Decimal.EUCLID = 9; + + Decimal.config = Decimal.set = config; + Decimal.clone = clone; + Decimal.isDecimal = isDecimalInstance; + + Decimal.abs = abs; + Decimal.acos = acos; + Decimal.acosh = acosh; // ES6 + Decimal.add = add; + Decimal.asin = asin; + Decimal.asinh = asinh; // ES6 + Decimal.atan = atan; + Decimal.atanh = atanh; // ES6 + Decimal.atan2 = atan2; + Decimal.cbrt = cbrt; // ES6 + Decimal.ceil = ceil; + Decimal.clamp = clamp; + Decimal.cos = cos; + Decimal.cosh = cosh; // ES6 + Decimal.div = div; + Decimal.exp = exp; + Decimal.floor = floor; + Decimal.hypot = hypot; // ES6 + Decimal.ln = ln; + Decimal.log = log; + Decimal.log10 = log10; // ES6 + Decimal.log2 = log2; // ES6 + Decimal.max = max; + Decimal.min = min; + Decimal.mod = mod; + Decimal.mul = mul; + Decimal.pow = pow; + Decimal.random = random; + Decimal.round = round; + Decimal.sign = sign; // ES6 + Decimal.sin = sin; + Decimal.sinh = sinh; // ES6 + Decimal.sqrt = sqrt; + Decimal.sub = sub; + Decimal.sum = sum; + Decimal.tan = tan; + Decimal.tanh = tanh; // ES6 + Decimal.trunc = trunc; // ES6 + + if (obj === void 0) obj = {}; + if (obj) { + if (obj.defaults !== true) { + ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto']; + for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p]; + } + } + + Decimal.config(obj); + + return Decimal; +} + + +/* + * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant + * digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * y {number|string|bigint|Decimal} + * + */ +function div(x, y) { + return new this(x).div(y); +} + + +/* + * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} The power to which to raise the base of the natural log. + * + */ +function exp(x) { + return new this(x).exp(); +} + + +/* + * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`. + * + * x {number|string|bigint|Decimal} + * + */ +function floor(x) { + return finalise(x = new this(x), x.e + 1, 3); +} + + +/* + * Return a new Decimal whose value is the square root of the sum of the squares of the arguments, + * rounded to `precision` significant digits using rounding mode `rounding`. + * + * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...) + * + * arguments {number|string|bigint|Decimal} + * + */ +function hypot() { + var i, n, + t = new this(0); + + external = false; + + for (i = 0; i < arguments.length;) { + n = new this(arguments[i++]); + if (!n.d) { + if (n.s) { + external = true; + return new this(1 / 0); + } + t = n; + } else if (t.d) { + t = t.plus(n.times(n)); + } + } + + external = true; + + return t.sqrt(); +} + + +/* + * Return true if object is a Decimal instance (where Decimal is any Decimal constructor), + * otherwise return false. + * + */ +function isDecimalInstance(obj) { + return obj instanceof Decimal || obj && obj.toStringTag === tag || false; +} + + +/* + * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * + */ +function ln(x) { + return new this(x).ln(); +} + + +/* + * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base + * is specified, rounded to `precision` significant digits using rounding mode `rounding`. + * + * log[y](x) + * + * x {number|string|bigint|Decimal} The argument of the logarithm. + * y {number|string|bigint|Decimal} The base of the logarithm. + * + */ +function log(x, y) { + return new this(x).log(y); +} + + +/* + * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * + */ +function log2(x) { + return new this(x).log(2); +} + + +/* + * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * + */ +function log10(x) { + return new this(x).log(10); +} + + +/* + * Return a new Decimal whose value is the maximum of the arguments. + * + * arguments {number|string|bigint|Decimal} + * + */ +function max() { + return maxOrMin(this, arguments, -1); +} + + +/* + * Return a new Decimal whose value is the minimum of the arguments. + * + * arguments {number|string|bigint|Decimal} + * + */ +function min() { + return maxOrMin(this, arguments, 1); +} + + +/* + * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits + * using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * y {number|string|bigint|Decimal} + * + */ +function mod(x, y) { + return new this(x).mod(y); +} + + +/* + * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant + * digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * y {number|string|bigint|Decimal} + * + */ +function mul(x, y) { + return new this(x).mul(y); +} + + +/* + * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} The base. + * y {number|string|bigint|Decimal} The exponent. + * + */ +function pow(x, y) { + return new this(x).pow(y); +} + + +/* + * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with + * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros + * are produced). + * + * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive. + * + */ +function random(sd) { + var d, e, k, n, + i = 0, + r = new this(1), + rd = []; + + if (sd === void 0) sd = this.precision; + else checkInt32(sd, 1, MAX_DIGITS); + + k = Math.ceil(sd / LOG_BASE); + + if (!this.crypto) { + for (; i < k;) rd[i++] = Math.random() * 1e7 | 0; + + // Browsers supporting crypto.getRandomValues. + } else if (crypto.getRandomValues) { + d = crypto.getRandomValues(new Uint32Array(k)); + + for (; i < k;) { + n = d[i]; + + // 0 <= n < 4294967296 + // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865). + if (n >= 4.29e9) { + d[i] = crypto.getRandomValues(new Uint32Array(1))[0]; + } else { + + // 0 <= n <= 4289999999 + // 0 <= (n % 1e7) <= 9999999 + rd[i++] = n % 1e7; + } + } + + // Node.js supporting crypto.randomBytes. + } else if (crypto.randomBytes) { + + // buffer + d = crypto.randomBytes(k *= 4); + + for (; i < k;) { + + // 0 <= n < 2147483648 + n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24); + + // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286). + if (n >= 2.14e9) { + crypto.randomBytes(4).copy(d, i); + } else { + + // 0 <= n <= 2139999999 + // 0 <= (n % 1e7) <= 9999999 + rd.push(n % 1e7); + i += 4; + } + } + + i = k / 4; + } else { + throw Error(cryptoUnavailable); + } + + k = rd[--i]; + sd %= LOG_BASE; + + // Convert trailing digits to zeros according to sd. + if (k && sd) { + n = mathpow(10, LOG_BASE - sd); + rd[i] = (k / n | 0) * n; + } + + // Remove trailing words which are zero. + for (; rd[i] === 0; i--) rd.pop(); + + // Zero? + if (i < 0) { + e = 0; + rd = [0]; + } else { + e = -1; + + // Remove leading words which are zero and adjust exponent accordingly. + for (; rd[0] === 0; e -= LOG_BASE) rd.shift(); + + // Count the digits of the first word of rd to determine leading zeros. + for (k = 1, n = rd[0]; n >= 10; n /= 10) k++; + + // Adjust the exponent for leading zeros of the first word of rd. + if (k < LOG_BASE) e -= LOG_BASE - k; + } + + r.e = e; + r.d = rd; + + return r; +} + + +/* + * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`. + * + * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL). + * + * x {number|string|bigint|Decimal} + * + */ +function round(x) { + return finalise(x = new this(x), x.e + 1, this.rounding); +} + + +/* + * Return + * 1 if x > 0, + * -1 if x < 0, + * 0 if x is 0, + * -0 if x is -0, + * NaN otherwise + * + * x {number|string|bigint|Decimal} + * + */ +function sign(x) { + x = new this(x); + return x.d ? (x.d[0] ? x.s : 0 * x.s) : x.s || NaN; +} + + +/* + * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits + * using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ +function sin(x) { + return new this(x).sin(); +} + + +/* + * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ +function sinh(x) { + return new this(x).sinh(); +} + + +/* + * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant + * digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * + */ +function sqrt(x) { + return new this(x).sqrt(); +} + + +/* + * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits + * using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * y {number|string|bigint|Decimal} + * + */ +function sub(x, y) { + return new this(x).sub(y); +} + + +/* + * Return a new Decimal whose value is the sum of the arguments, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * Only the result is rounded, not the intermediate calculations. + * + * arguments {number|string|bigint|Decimal} + * + */ +function sum() { + var i = 0, + args = arguments, + x = new this(args[i]); + + external = false; + for (; x.s && ++i < args.length;) x = x.plus(args[i]); + external = true; + + return finalise(x, this.precision, this.rounding); +} + + +/* + * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant + * digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ +function tan(x) { + return new this(x).tan(); +} + + +/* + * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ +function tanh(x) { + return new this(x).tanh(); +} + + +/* + * Return a new Decimal whose value is `x` truncated to an integer. + * + * x {number|string|bigint|Decimal} + * + */ +function trunc(x) { + return finalise(x = new this(x), x.e + 1, 1); +} + + +P[Symbol.for('nodejs.util.inspect.custom')] = P.toString; +P[Symbol.toStringTag] = 'Decimal'; + +// Create and configure initial Decimal constructor. +export var Decimal = P.constructor = clone(DEFAULTS); + +// Create the internal constants from their string values. +LN10 = new Decimal(LN10); +PI = new Decimal(PI); + +export default Decimal; diff --git a/node_modules/decimal.js/package.json b/node_modules/decimal.js/package.json index 4f84301a..601307dc 100644 --- a/node_modules/decimal.js/package.json +++ b/node_modules/decimal.js/package.json @@ -1,55 +1,55 @@ -{ - "name": "decimal.js", - "description": "An arbitrary-precision Decimal type for JavaScript.", - "version": "10.6.0", - "keywords": [ - "arbitrary", - "precision", - "arithmetic", - "big", - "number", - "decimal", - "float", - "biginteger", - "bigdecimal", - "bignumber", - "bigint", - "bignum" - ], - "repository" : { - "type": "git", - "url": "https://github.com/MikeMcl/decimal.js.git" - }, - "main": "decimal", - "module": "decimal.mjs", - "browser": "decimal.js", - "exports": { - ".": { - "types": "./decimal.d.ts", - "import": "./decimal.mjs", - "require": "./decimal.js" - }, - "./decimal.mjs": "./decimal.mjs", - "./decimal.js": "./decimal.js", - "./package.json": "./package.json", - "./decimal": { - "types": "./decimal.d.ts", - "import": "./decimal.mjs", - "require": "./decimal.js" - } - }, - "author": { - "name": "Michael Mclaughlin", - "email": "M8ch88l@gmail.com" - }, - "license": "MIT", - "scripts": { - "test": "node ./test/test.js" - }, - "types": "decimal.d.ts", - "files": [ - "decimal.js", - "decimal.mjs", - "decimal.d.ts" - ] -} +{ + "name": "decimal.js", + "description": "An arbitrary-precision Decimal type for JavaScript.", + "version": "10.6.0", + "keywords": [ + "arbitrary", + "precision", + "arithmetic", + "big", + "number", + "decimal", + "float", + "biginteger", + "bigdecimal", + "bignumber", + "bigint", + "bignum" + ], + "repository" : { + "type": "git", + "url": "https://github.com/MikeMcl/decimal.js.git" + }, + "main": "decimal", + "module": "decimal.mjs", + "browser": "decimal.js", + "exports": { + ".": { + "types": "./decimal.d.ts", + "import": "./decimal.mjs", + "require": "./decimal.js" + }, + "./decimal.mjs": "./decimal.mjs", + "./decimal.js": "./decimal.js", + "./package.json": "./package.json", + "./decimal": { + "types": "./decimal.d.ts", + "import": "./decimal.mjs", + "require": "./decimal.js" + } + }, + "author": { + "name": "Michael Mclaughlin", + "email": "M8ch88l@gmail.com" + }, + "license": "MIT", + "scripts": { + "test": "node ./test/test.js" + }, + "types": "decimal.d.ts", + "files": [ + "decimal.js", + "decimal.mjs", + "decimal.d.ts" + ] +} diff --git a/node_modules/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js b/node_modules/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js index 99dd5950..ec5280fe 100644 --- a/node_modules/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js +++ b/node_modules/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js @@ -17386,34 +17386,34 @@ function requireLib () { var libExports = requireLib(); -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global Reflect, Promise */ - - -function __classPrivateFieldGet(receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -} - -function __classPrivateFieldSet(receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global Reflect, Promise */ + + +function __classPrivateFieldGet(receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +} + +function __classPrivateFieldSet(receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; } var _OkImpl_val, _ErrImpl_val; @@ -26765,156 +26765,156 @@ var hasRequiredColorName; function requireColorName () { if (hasRequiredColorName) return colorName; hasRequiredColorName = 1; - - colorName = { - "aliceblue": [240, 248, 255], - "antiquewhite": [250, 235, 215], - "aqua": [0, 255, 255], - "aquamarine": [127, 255, 212], - "azure": [240, 255, 255], - "beige": [245, 245, 220], - "bisque": [255, 228, 196], - "black": [0, 0, 0], - "blanchedalmond": [255, 235, 205], - "blue": [0, 0, 255], - "blueviolet": [138, 43, 226], - "brown": [165, 42, 42], - "burlywood": [222, 184, 135], - "cadetblue": [95, 158, 160], - "chartreuse": [127, 255, 0], - "chocolate": [210, 105, 30], - "coral": [255, 127, 80], - "cornflowerblue": [100, 149, 237], - "cornsilk": [255, 248, 220], - "crimson": [220, 20, 60], - "cyan": [0, 255, 255], - "darkblue": [0, 0, 139], - "darkcyan": [0, 139, 139], - "darkgoldenrod": [184, 134, 11], - "darkgray": [169, 169, 169], - "darkgreen": [0, 100, 0], - "darkgrey": [169, 169, 169], - "darkkhaki": [189, 183, 107], - "darkmagenta": [139, 0, 139], - "darkolivegreen": [85, 107, 47], - "darkorange": [255, 140, 0], - "darkorchid": [153, 50, 204], - "darkred": [139, 0, 0], - "darksalmon": [233, 150, 122], - "darkseagreen": [143, 188, 143], - "darkslateblue": [72, 61, 139], - "darkslategray": [47, 79, 79], - "darkslategrey": [47, 79, 79], - "darkturquoise": [0, 206, 209], - "darkviolet": [148, 0, 211], - "deeppink": [255, 20, 147], - "deepskyblue": [0, 191, 255], - "dimgray": [105, 105, 105], - "dimgrey": [105, 105, 105], - "dodgerblue": [30, 144, 255], - "firebrick": [178, 34, 34], - "floralwhite": [255, 250, 240], - "forestgreen": [34, 139, 34], - "fuchsia": [255, 0, 255], - "gainsboro": [220, 220, 220], - "ghostwhite": [248, 248, 255], - "gold": [255, 215, 0], - "goldenrod": [218, 165, 32], - "gray": [128, 128, 128], - "green": [0, 128, 0], - "greenyellow": [173, 255, 47], - "grey": [128, 128, 128], - "honeydew": [240, 255, 240], - "hotpink": [255, 105, 180], - "indianred": [205, 92, 92], - "indigo": [75, 0, 130], - "ivory": [255, 255, 240], - "khaki": [240, 230, 140], - "lavender": [230, 230, 250], - "lavenderblush": [255, 240, 245], - "lawngreen": [124, 252, 0], - "lemonchiffon": [255, 250, 205], - "lightblue": [173, 216, 230], - "lightcoral": [240, 128, 128], - "lightcyan": [224, 255, 255], - "lightgoldenrodyellow": [250, 250, 210], - "lightgray": [211, 211, 211], - "lightgreen": [144, 238, 144], - "lightgrey": [211, 211, 211], - "lightpink": [255, 182, 193], - "lightsalmon": [255, 160, 122], - "lightseagreen": [32, 178, 170], - "lightskyblue": [135, 206, 250], - "lightslategray": [119, 136, 153], - "lightslategrey": [119, 136, 153], - "lightsteelblue": [176, 196, 222], - "lightyellow": [255, 255, 224], - "lime": [0, 255, 0], - "limegreen": [50, 205, 50], - "linen": [250, 240, 230], - "magenta": [255, 0, 255], - "maroon": [128, 0, 0], - "mediumaquamarine": [102, 205, 170], - "mediumblue": [0, 0, 205], - "mediumorchid": [186, 85, 211], - "mediumpurple": [147, 112, 219], - "mediumseagreen": [60, 179, 113], - "mediumslateblue": [123, 104, 238], - "mediumspringgreen": [0, 250, 154], - "mediumturquoise": [72, 209, 204], - "mediumvioletred": [199, 21, 133], - "midnightblue": [25, 25, 112], - "mintcream": [245, 255, 250], - "mistyrose": [255, 228, 225], - "moccasin": [255, 228, 181], - "navajowhite": [255, 222, 173], - "navy": [0, 0, 128], - "oldlace": [253, 245, 230], - "olive": [128, 128, 0], - "olivedrab": [107, 142, 35], - "orange": [255, 165, 0], - "orangered": [255, 69, 0], - "orchid": [218, 112, 214], - "palegoldenrod": [238, 232, 170], - "palegreen": [152, 251, 152], - "paleturquoise": [175, 238, 238], - "palevioletred": [219, 112, 147], - "papayawhip": [255, 239, 213], - "peachpuff": [255, 218, 185], - "peru": [205, 133, 63], - "pink": [255, 192, 203], - "plum": [221, 160, 221], - "powderblue": [176, 224, 230], - "purple": [128, 0, 128], - "rebeccapurple": [102, 51, 153], - "red": [255, 0, 0], - "rosybrown": [188, 143, 143], - "royalblue": [65, 105, 225], - "saddlebrown": [139, 69, 19], - "salmon": [250, 128, 114], - "sandybrown": [244, 164, 96], - "seagreen": [46, 139, 87], - "seashell": [255, 245, 238], - "sienna": [160, 82, 45], - "silver": [192, 192, 192], - "skyblue": [135, 206, 235], - "slateblue": [106, 90, 205], - "slategray": [112, 128, 144], - "slategrey": [112, 128, 144], - "snow": [255, 250, 250], - "springgreen": [0, 255, 127], - "steelblue": [70, 130, 180], - "tan": [210, 180, 140], - "teal": [0, 128, 128], - "thistle": [216, 191, 216], - "tomato": [255, 99, 71], - "turquoise": [64, 224, 208], - "violet": [238, 130, 238], - "wheat": [245, 222, 179], - "white": [255, 255, 255], - "whitesmoke": [245, 245, 245], - "yellow": [255, 255, 0], - "yellowgreen": [154, 205, 50] + + colorName = { + "aliceblue": [240, 248, 255], + "antiquewhite": [250, 235, 215], + "aqua": [0, 255, 255], + "aquamarine": [127, 255, 212], + "azure": [240, 255, 255], + "beige": [245, 245, 220], + "bisque": [255, 228, 196], + "black": [0, 0, 0], + "blanchedalmond": [255, 235, 205], + "blue": [0, 0, 255], + "blueviolet": [138, 43, 226], + "brown": [165, 42, 42], + "burlywood": [222, 184, 135], + "cadetblue": [95, 158, 160], + "chartreuse": [127, 255, 0], + "chocolate": [210, 105, 30], + "coral": [255, 127, 80], + "cornflowerblue": [100, 149, 237], + "cornsilk": [255, 248, 220], + "crimson": [220, 20, 60], + "cyan": [0, 255, 255], + "darkblue": [0, 0, 139], + "darkcyan": [0, 139, 139], + "darkgoldenrod": [184, 134, 11], + "darkgray": [169, 169, 169], + "darkgreen": [0, 100, 0], + "darkgrey": [169, 169, 169], + "darkkhaki": [189, 183, 107], + "darkmagenta": [139, 0, 139], + "darkolivegreen": [85, 107, 47], + "darkorange": [255, 140, 0], + "darkorchid": [153, 50, 204], + "darkred": [139, 0, 0], + "darksalmon": [233, 150, 122], + "darkseagreen": [143, 188, 143], + "darkslateblue": [72, 61, 139], + "darkslategray": [47, 79, 79], + "darkslategrey": [47, 79, 79], + "darkturquoise": [0, 206, 209], + "darkviolet": [148, 0, 211], + "deeppink": [255, 20, 147], + "deepskyblue": [0, 191, 255], + "dimgray": [105, 105, 105], + "dimgrey": [105, 105, 105], + "dodgerblue": [30, 144, 255], + "firebrick": [178, 34, 34], + "floralwhite": [255, 250, 240], + "forestgreen": [34, 139, 34], + "fuchsia": [255, 0, 255], + "gainsboro": [220, 220, 220], + "ghostwhite": [248, 248, 255], + "gold": [255, 215, 0], + "goldenrod": [218, 165, 32], + "gray": [128, 128, 128], + "green": [0, 128, 0], + "greenyellow": [173, 255, 47], + "grey": [128, 128, 128], + "honeydew": [240, 255, 240], + "hotpink": [255, 105, 180], + "indianred": [205, 92, 92], + "indigo": [75, 0, 130], + "ivory": [255, 255, 240], + "khaki": [240, 230, 140], + "lavender": [230, 230, 250], + "lavenderblush": [255, 240, 245], + "lawngreen": [124, 252, 0], + "lemonchiffon": [255, 250, 205], + "lightblue": [173, 216, 230], + "lightcoral": [240, 128, 128], + "lightcyan": [224, 255, 255], + "lightgoldenrodyellow": [250, 250, 210], + "lightgray": [211, 211, 211], + "lightgreen": [144, 238, 144], + "lightgrey": [211, 211, 211], + "lightpink": [255, 182, 193], + "lightsalmon": [255, 160, 122], + "lightseagreen": [32, 178, 170], + "lightskyblue": [135, 206, 250], + "lightslategray": [119, 136, 153], + "lightslategrey": [119, 136, 153], + "lightsteelblue": [176, 196, 222], + "lightyellow": [255, 255, 224], + "lime": [0, 255, 0], + "limegreen": [50, 205, 50], + "linen": [250, 240, 230], + "magenta": [255, 0, 255], + "maroon": [128, 0, 0], + "mediumaquamarine": [102, 205, 170], + "mediumblue": [0, 0, 205], + "mediumorchid": [186, 85, 211], + "mediumpurple": [147, 112, 219], + "mediumseagreen": [60, 179, 113], + "mediumslateblue": [123, 104, 238], + "mediumspringgreen": [0, 250, 154], + "mediumturquoise": [72, 209, 204], + "mediumvioletred": [199, 21, 133], + "midnightblue": [25, 25, 112], + "mintcream": [245, 255, 250], + "mistyrose": [255, 228, 225], + "moccasin": [255, 228, 181], + "navajowhite": [255, 222, 173], + "navy": [0, 0, 128], + "oldlace": [253, 245, 230], + "olive": [128, 128, 0], + "olivedrab": [107, 142, 35], + "orange": [255, 165, 0], + "orangered": [255, 69, 0], + "orchid": [218, 112, 214], + "palegoldenrod": [238, 232, 170], + "palegreen": [152, 251, 152], + "paleturquoise": [175, 238, 238], + "palevioletred": [219, 112, 147], + "papayawhip": [255, 239, 213], + "peachpuff": [255, 218, 185], + "peru": [205, 133, 63], + "pink": [255, 192, 203], + "plum": [221, 160, 221], + "powderblue": [176, 224, 230], + "purple": [128, 0, 128], + "rebeccapurple": [102, 51, 153], + "red": [255, 0, 0], + "rosybrown": [188, 143, 143], + "royalblue": [65, 105, 225], + "saddlebrown": [139, 69, 19], + "salmon": [250, 128, 114], + "sandybrown": [244, 164, 96], + "seagreen": [46, 139, 87], + "seashell": [255, 245, 238], + "sienna": [160, 82, 45], + "silver": [192, 192, 192], + "skyblue": [135, 206, 235], + "slateblue": [106, 90, 205], + "slategray": [112, 128, 144], + "slategrey": [112, 128, 144], + "snow": [255, 250, 250], + "springgreen": [0, 255, 127], + "steelblue": [70, 130, 180], + "tan": [210, 180, 140], + "teal": [0, 128, 128], + "thistle": [216, 191, 216], + "tomato": [255, 99, 71], + "turquoise": [64, 224, 208], + "violet": [238, 130, 238], + "wheat": [245, 222, 179], + "white": [255, 255, 255], + "whitesmoke": [245, 245, 245], + "yellow": [255, 255, 0], + "yellowgreen": [154, 205, 50] }; return colorName; } diff --git a/node_modules/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js b/node_modules/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js index 72e896e3..df27c171 100644 --- a/node_modules/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js +++ b/node_modules/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js @@ -17377,34 +17377,34 @@ function requireLib () { var libExports = requireLib(); -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global Reflect, Promise */ - - -function __classPrivateFieldGet(receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -} - -function __classPrivateFieldSet(receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global Reflect, Promise */ + + +function __classPrivateFieldGet(receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +} + +function __classPrivateFieldSet(receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; } var _OkImpl_val, _ErrImpl_val; @@ -26756,156 +26756,156 @@ var hasRequiredColorName; function requireColorName () { if (hasRequiredColorName) return colorName; hasRequiredColorName = 1; - - colorName = { - "aliceblue": [240, 248, 255], - "antiquewhite": [250, 235, 215], - "aqua": [0, 255, 255], - "aquamarine": [127, 255, 212], - "azure": [240, 255, 255], - "beige": [245, 245, 220], - "bisque": [255, 228, 196], - "black": [0, 0, 0], - "blanchedalmond": [255, 235, 205], - "blue": [0, 0, 255], - "blueviolet": [138, 43, 226], - "brown": [165, 42, 42], - "burlywood": [222, 184, 135], - "cadetblue": [95, 158, 160], - "chartreuse": [127, 255, 0], - "chocolate": [210, 105, 30], - "coral": [255, 127, 80], - "cornflowerblue": [100, 149, 237], - "cornsilk": [255, 248, 220], - "crimson": [220, 20, 60], - "cyan": [0, 255, 255], - "darkblue": [0, 0, 139], - "darkcyan": [0, 139, 139], - "darkgoldenrod": [184, 134, 11], - "darkgray": [169, 169, 169], - "darkgreen": [0, 100, 0], - "darkgrey": [169, 169, 169], - "darkkhaki": [189, 183, 107], - "darkmagenta": [139, 0, 139], - "darkolivegreen": [85, 107, 47], - "darkorange": [255, 140, 0], - "darkorchid": [153, 50, 204], - "darkred": [139, 0, 0], - "darksalmon": [233, 150, 122], - "darkseagreen": [143, 188, 143], - "darkslateblue": [72, 61, 139], - "darkslategray": [47, 79, 79], - "darkslategrey": [47, 79, 79], - "darkturquoise": [0, 206, 209], - "darkviolet": [148, 0, 211], - "deeppink": [255, 20, 147], - "deepskyblue": [0, 191, 255], - "dimgray": [105, 105, 105], - "dimgrey": [105, 105, 105], - "dodgerblue": [30, 144, 255], - "firebrick": [178, 34, 34], - "floralwhite": [255, 250, 240], - "forestgreen": [34, 139, 34], - "fuchsia": [255, 0, 255], - "gainsboro": [220, 220, 220], - "ghostwhite": [248, 248, 255], - "gold": [255, 215, 0], - "goldenrod": [218, 165, 32], - "gray": [128, 128, 128], - "green": [0, 128, 0], - "greenyellow": [173, 255, 47], - "grey": [128, 128, 128], - "honeydew": [240, 255, 240], - "hotpink": [255, 105, 180], - "indianred": [205, 92, 92], - "indigo": [75, 0, 130], - "ivory": [255, 255, 240], - "khaki": [240, 230, 140], - "lavender": [230, 230, 250], - "lavenderblush": [255, 240, 245], - "lawngreen": [124, 252, 0], - "lemonchiffon": [255, 250, 205], - "lightblue": [173, 216, 230], - "lightcoral": [240, 128, 128], - "lightcyan": [224, 255, 255], - "lightgoldenrodyellow": [250, 250, 210], - "lightgray": [211, 211, 211], - "lightgreen": [144, 238, 144], - "lightgrey": [211, 211, 211], - "lightpink": [255, 182, 193], - "lightsalmon": [255, 160, 122], - "lightseagreen": [32, 178, 170], - "lightskyblue": [135, 206, 250], - "lightslategray": [119, 136, 153], - "lightslategrey": [119, 136, 153], - "lightsteelblue": [176, 196, 222], - "lightyellow": [255, 255, 224], - "lime": [0, 255, 0], - "limegreen": [50, 205, 50], - "linen": [250, 240, 230], - "magenta": [255, 0, 255], - "maroon": [128, 0, 0], - "mediumaquamarine": [102, 205, 170], - "mediumblue": [0, 0, 205], - "mediumorchid": [186, 85, 211], - "mediumpurple": [147, 112, 219], - "mediumseagreen": [60, 179, 113], - "mediumslateblue": [123, 104, 238], - "mediumspringgreen": [0, 250, 154], - "mediumturquoise": [72, 209, 204], - "mediumvioletred": [199, 21, 133], - "midnightblue": [25, 25, 112], - "mintcream": [245, 255, 250], - "mistyrose": [255, 228, 225], - "moccasin": [255, 228, 181], - "navajowhite": [255, 222, 173], - "navy": [0, 0, 128], - "oldlace": [253, 245, 230], - "olive": [128, 128, 0], - "olivedrab": [107, 142, 35], - "orange": [255, 165, 0], - "orangered": [255, 69, 0], - "orchid": [218, 112, 214], - "palegoldenrod": [238, 232, 170], - "palegreen": [152, 251, 152], - "paleturquoise": [175, 238, 238], - "palevioletred": [219, 112, 147], - "papayawhip": [255, 239, 213], - "peachpuff": [255, 218, 185], - "peru": [205, 133, 63], - "pink": [255, 192, 203], - "plum": [221, 160, 221], - "powderblue": [176, 224, 230], - "purple": [128, 0, 128], - "rebeccapurple": [102, 51, 153], - "red": [255, 0, 0], - "rosybrown": [188, 143, 143], - "royalblue": [65, 105, 225], - "saddlebrown": [139, 69, 19], - "salmon": [250, 128, 114], - "sandybrown": [244, 164, 96], - "seagreen": [46, 139, 87], - "seashell": [255, 245, 238], - "sienna": [160, 82, 45], - "silver": [192, 192, 192], - "skyblue": [135, 206, 235], - "slateblue": [106, 90, 205], - "slategray": [112, 128, 144], - "slategrey": [112, 128, 144], - "snow": [255, 250, 250], - "springgreen": [0, 255, 127], - "steelblue": [70, 130, 180], - "tan": [210, 180, 140], - "teal": [0, 128, 128], - "thistle": [216, 191, 216], - "tomato": [255, 99, 71], - "turquoise": [64, 224, 208], - "violet": [238, 130, 238], - "wheat": [245, 222, 179], - "white": [255, 255, 255], - "whitesmoke": [245, 245, 245], - "yellow": [255, 255, 0], - "yellowgreen": [154, 205, 50] + + colorName = { + "aliceblue": [240, 248, 255], + "antiquewhite": [250, 235, 215], + "aqua": [0, 255, 255], + "aquamarine": [127, 255, 212], + "azure": [240, 255, 255], + "beige": [245, 245, 220], + "bisque": [255, 228, 196], + "black": [0, 0, 0], + "blanchedalmond": [255, 235, 205], + "blue": [0, 0, 255], + "blueviolet": [138, 43, 226], + "brown": [165, 42, 42], + "burlywood": [222, 184, 135], + "cadetblue": [95, 158, 160], + "chartreuse": [127, 255, 0], + "chocolate": [210, 105, 30], + "coral": [255, 127, 80], + "cornflowerblue": [100, 149, 237], + "cornsilk": [255, 248, 220], + "crimson": [220, 20, 60], + "cyan": [0, 255, 255], + "darkblue": [0, 0, 139], + "darkcyan": [0, 139, 139], + "darkgoldenrod": [184, 134, 11], + "darkgray": [169, 169, 169], + "darkgreen": [0, 100, 0], + "darkgrey": [169, 169, 169], + "darkkhaki": [189, 183, 107], + "darkmagenta": [139, 0, 139], + "darkolivegreen": [85, 107, 47], + "darkorange": [255, 140, 0], + "darkorchid": [153, 50, 204], + "darkred": [139, 0, 0], + "darksalmon": [233, 150, 122], + "darkseagreen": [143, 188, 143], + "darkslateblue": [72, 61, 139], + "darkslategray": [47, 79, 79], + "darkslategrey": [47, 79, 79], + "darkturquoise": [0, 206, 209], + "darkviolet": [148, 0, 211], + "deeppink": [255, 20, 147], + "deepskyblue": [0, 191, 255], + "dimgray": [105, 105, 105], + "dimgrey": [105, 105, 105], + "dodgerblue": [30, 144, 255], + "firebrick": [178, 34, 34], + "floralwhite": [255, 250, 240], + "forestgreen": [34, 139, 34], + "fuchsia": [255, 0, 255], + "gainsboro": [220, 220, 220], + "ghostwhite": [248, 248, 255], + "gold": [255, 215, 0], + "goldenrod": [218, 165, 32], + "gray": [128, 128, 128], + "green": [0, 128, 0], + "greenyellow": [173, 255, 47], + "grey": [128, 128, 128], + "honeydew": [240, 255, 240], + "hotpink": [255, 105, 180], + "indianred": [205, 92, 92], + "indigo": [75, 0, 130], + "ivory": [255, 255, 240], + "khaki": [240, 230, 140], + "lavender": [230, 230, 250], + "lavenderblush": [255, 240, 245], + "lawngreen": [124, 252, 0], + "lemonchiffon": [255, 250, 205], + "lightblue": [173, 216, 230], + "lightcoral": [240, 128, 128], + "lightcyan": [224, 255, 255], + "lightgoldenrodyellow": [250, 250, 210], + "lightgray": [211, 211, 211], + "lightgreen": [144, 238, 144], + "lightgrey": [211, 211, 211], + "lightpink": [255, 182, 193], + "lightsalmon": [255, 160, 122], + "lightseagreen": [32, 178, 170], + "lightskyblue": [135, 206, 250], + "lightslategray": [119, 136, 153], + "lightslategrey": [119, 136, 153], + "lightsteelblue": [176, 196, 222], + "lightyellow": [255, 255, 224], + "lime": [0, 255, 0], + "limegreen": [50, 205, 50], + "linen": [250, 240, 230], + "magenta": [255, 0, 255], + "maroon": [128, 0, 0], + "mediumaquamarine": [102, 205, 170], + "mediumblue": [0, 0, 205], + "mediumorchid": [186, 85, 211], + "mediumpurple": [147, 112, 219], + "mediumseagreen": [60, 179, 113], + "mediumslateblue": [123, 104, 238], + "mediumspringgreen": [0, 250, 154], + "mediumturquoise": [72, 209, 204], + "mediumvioletred": [199, 21, 133], + "midnightblue": [25, 25, 112], + "mintcream": [245, 255, 250], + "mistyrose": [255, 228, 225], + "moccasin": [255, 228, 181], + "navajowhite": [255, 222, 173], + "navy": [0, 0, 128], + "oldlace": [253, 245, 230], + "olive": [128, 128, 0], + "olivedrab": [107, 142, 35], + "orange": [255, 165, 0], + "orangered": [255, 69, 0], + "orchid": [218, 112, 214], + "palegoldenrod": [238, 232, 170], + "palegreen": [152, 251, 152], + "paleturquoise": [175, 238, 238], + "palevioletred": [219, 112, 147], + "papayawhip": [255, 239, 213], + "peachpuff": [255, 218, 185], + "peru": [205, 133, 63], + "pink": [255, 192, 203], + "plum": [221, 160, 221], + "powderblue": [176, 224, 230], + "purple": [128, 0, 128], + "rebeccapurple": [102, 51, 153], + "red": [255, 0, 0], + "rosybrown": [188, 143, 143], + "royalblue": [65, 105, 225], + "saddlebrown": [139, 69, 19], + "salmon": [250, 128, 114], + "sandybrown": [244, 164, 96], + "seagreen": [46, 139, 87], + "seashell": [255, 245, 238], + "sienna": [160, 82, 45], + "silver": [192, 192, 192], + "skyblue": [135, 206, 235], + "slateblue": [106, 90, 205], + "slategray": [112, 128, 144], + "slategrey": [112, 128, 144], + "snow": [255, 250, 250], + "springgreen": [0, 255, 127], + "steelblue": [70, 130, 180], + "tan": [210, 180, 140], + "teal": [0, 128, 128], + "thistle": [216, 191, 216], + "tomato": [255, 99, 71], + "turquoise": [64, 224, 208], + "violet": [238, 130, 238], + "wheat": [245, 222, 179], + "white": [255, 255, 255], + "whitesmoke": [245, 245, 245], + "yellow": [255, 255, 0], + "yellowgreen": [154, 205, 50] }; return colorName; } diff --git a/node_modules/hash-wasm/dist/index.esm.js b/node_modules/hash-wasm/dist/index.esm.js index 69c6925e..b1b5d4e7 100644 --- a/node_modules/hash-wasm/dist/index.esm.js +++ b/node_modules/hash-wasm/dist/index.esm.js @@ -13,36 +13,36 @@ var wasmJson$l = { hash: hash$l }; -/****************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global Reflect, Promise, SuppressedError, Symbol, Iterator */ - - -function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} - -typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { - var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global Reflect, Promise, SuppressedError, Symbol, Iterator */ + + +function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} + +typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; class Mutex { diff --git a/node_modules/hash-wasm/dist/index.umd.js b/node_modules/hash-wasm/dist/index.umd.js index dbd7ecf1..2e38daf1 100644 --- a/node_modules/hash-wasm/dist/index.umd.js +++ b/node_modules/hash-wasm/dist/index.umd.js @@ -19,36 +19,36 @@ hash: hash$l }; - /****************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ - - - function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - } - - typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { - var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; + /****************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */ + /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ + + + function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + } + + typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; class Mutex { diff --git a/node_modules/hash-wasm/src/blake2b.c b/node_modules/hash-wasm/src/blake2b.c index 4b37641d..c30f78e8 100644 --- a/node_modules/hash-wasm/src/blake2b.c +++ b/node_modules/hash-wasm/src/blake2b.c @@ -1,298 +1,298 @@ -/* - BLAKE2 reference source code package - reference C implementations - Copyright 2012, Samuel Neves . You may use this under the - terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at - your option. The terms of these licenses can be found at: - - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0 - - OpenSSL license : https://www.openssl.org/source/license.html - - Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0 - - More information about the BLAKE2 hash function can be found at - https://blake2.net. - - Modified for hash-wasm by Dani Biró -*/ - -#define WITH_BUFFER -#include "hash-wasm.h" - -#define BLAKE2_PACKED(x) x __attribute__((packed)) - -enum blake2b_constant { - BLAKE2B_BLOCKBYTES = 128, - BLAKE2B_OUTBYTES = 64, - BLAKE2B_KEYBYTES = 64, - BLAKE2B_SALTBYTES = 16, - BLAKE2B_PERSONALBYTES = 16 -}; - -typedef struct blake2b_state__ { - uint64_t h[8]; - uint64_t t[2]; - uint64_t f[2]; - uint8_t buf[BLAKE2B_BLOCKBYTES]; - int buflen; - int outlen; - uint8_t last_node; -} blake2b_state; - -blake2b_state S[1]; - -BLAKE2_PACKED(struct blake2b_param__ { - uint8_t digest_length; /* 1 */ - uint8_t key_length; /* 2 */ - uint8_t fanout; /* 3 */ - uint8_t depth; /* 4 */ - uint32_t leaf_length; /* 8 */ - uint32_t node_offset; /* 12 */ - uint32_t xof_length; /* 16 */ - uint8_t node_depth; /* 17 */ - uint8_t inner_length; /* 18 */ - uint8_t reserved[14]; /* 32 */ - uint8_t salt[BLAKE2B_SALTBYTES]; /* 48 */ - uint8_t personal[BLAKE2B_PERSONALBYTES]; /* 64 */ -}); - -typedef struct blake2b_param__ blake2b_param; - -blake2b_param P[1]; - -static __inline__ uint64_t load64(const void *src) { - return *(uint64_t *)src; -} - -static __inline__ void store64(void *dst, uint64_t w) { - *(uint64_t *)dst = w; -} - -static __inline__ uint64_t rotr64(const uint64_t w, const unsigned c) { - return (w >> c) | (w << (64 - c)); -} - -static const uint64_t blake2b_IV[8] = { - 0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL, - 0x3c6ef372fe94f82bULL, 0xa54ff53a5f1d36f1ULL, - 0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL, - 0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL -}; - -static const uint8_t blake2b_sigma[12][16] = { - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, - { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 }, - { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 }, - { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 }, - { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 }, - { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 }, - { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 }, - { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 }, - { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 }, - { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, - { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } -}; - -static __inline__ void blake2b_set_lastnode() { S->f[1] = (uint64_t)-1; } - -/* Some helper functions, not necessarily useful */ -static __inline__ int blake2b_is_lastblock() { return S->f[0] != 0; } - -static __inline__ void blake2b_set_lastblock() { - if (S->last_node) blake2b_set_lastnode(); - - S->f[0] = (uint64_t)-1; -} - -static __inline__ void blake2b_increment_counter(const uint64_t inc) { - S->t[0] += inc; - S->t[1] += (S->t[0] < inc); -} - -#define G(r, i, a, b, c, d) \ - do { \ - a = a + b + m[blake2b_sigma[r][2 * i + 0]]; \ - d = rotr64(d ^ a, 32); \ - c = c + d; \ - b = rotr64(b ^ c, 24); \ - a = a + b + m[blake2b_sigma[r][2 * i + 1]]; \ - d = rotr64(d ^ a, 16); \ - c = c + d; \ - b = rotr64(b ^ c, 63); \ - } while (0) - -static void round(uint32_t r, uint64_t m[16], uint64_t v[16]) { - G(r, 0, v[0], v[4], v[8], v[12]); - G(r, 1, v[1], v[5], v[9], v[13]); - G(r, 2, v[2], v[6], v[10], v[14]); - G(r, 3, v[3], v[7], v[11], v[15]); - G(r, 4, v[0], v[5], v[10], v[15]); - G(r, 5, v[1], v[6], v[11], v[12]); - G(r, 6, v[2], v[7], v[8], v[13]); - G(r, 7, v[3], v[4], v[9], v[14]); -}; - -static void blake2b_compress(const uint8_t block[BLAKE2B_BLOCKBYTES]) { - uint64_t m[16]; - uint64_t v[16]; - - #pragma clang loop unroll(full) - for (int i = 0; i < 16; ++i) { - m[i] = load64(block + i * sizeof(m[i])); - } - - #pragma clang loop unroll(full) - for (int i = 0; i < 8; ++i) { - v[i] = S->h[i]; - } - - v[8] = blake2b_IV[0]; - v[9] = blake2b_IV[1]; - v[10] = blake2b_IV[2]; - v[11] = blake2b_IV[3]; - v[12] = blake2b_IV[4] ^ S->t[0]; - v[13] = blake2b_IV[5] ^ S->t[1]; - v[14] = blake2b_IV[6] ^ S->f[0]; - v[15] = blake2b_IV[7] ^ S->f[1]; - - #pragma clang loop unroll(full) - for (int i = 0; i < 12; ++i) { - round(i, m, v); - } - - #pragma clang loop unroll(full) - for (int i = 0; i < 8; ++i) { - S->h[i] = S->h[i] ^ v[i] ^ v[i + 8]; - } -} - -#undef G - -void blake2b_update(const void *pin, int inlen) { - const unsigned char *in = (const unsigned char *)pin; - if (inlen > 0) { - int left = S->buflen; - int fill = BLAKE2B_BLOCKBYTES - left; - if (inlen > fill) { - S->buflen = 0; - /* Fill buffer */ - for (uint8_t i = 0; i < fill; i++) { - S->buf[left + i] = in[i]; - } - blake2b_increment_counter(BLAKE2B_BLOCKBYTES); - blake2b_compress(S->buf); /* Compress */ - in += fill; - inlen -= fill; - while (inlen > BLAKE2B_BLOCKBYTES) { - blake2b_increment_counter(BLAKE2B_BLOCKBYTES); - blake2b_compress(in); - in += BLAKE2B_BLOCKBYTES; - inlen -= BLAKE2B_BLOCKBYTES; - } - } - for (uint8_t i = 0; i < inlen; i++) { - S->buf[S->buflen + i] = in[i]; - } - S->buflen += inlen; - } -} - -WASM_EXPORT -void Hash_Final() { - int outlen = S->outlen; - uint8_t buffer[BLAKE2B_OUTBYTES] = {0}; - - if (blake2b_is_lastblock()) { - return; - } - - blake2b_increment_counter(S->buflen); - blake2b_set_lastblock(); - for (int i = 0; i < BLAKE2B_BLOCKBYTES - S->buflen; i++) { /* Padding */ - (S->buf + S->buflen)[i] = 0; - } - blake2b_compress(S->buf); - - for (int i = 0; i < 8; ++i) { - /* Output full hash to temp buffer */ - store64(buffer + sizeof(S->h[i]) * i, S->h[i]); - } - - for (uint8_t i = 0; i < S->outlen; i++) { - main_buffer[i] = buffer[i]; - } -} - -static void blake2b_init0() { - memset(S, 0, sizeof(blake2b_state)); - - for (int i = 0; i < 8; ++i) { - S->h[i] = blake2b_IV[i]; - } -} - -/* init xors IV with input parameter block */ -void blake2b_init_param() { - const uint8_t *p = (const uint8_t *)(P); - int i; - - blake2b_init0(); - - /* IV XOR ParamBlock */ - for (i = 0; i < 8; ++i) { - S->h[i] ^= load64(p + sizeof(S->h[i]) * i); - } - - S->outlen = P->digest_length; -} - -void blake2b_init_key(int outlen, const uint8_t *key, int keylen) { - P->digest_length = (uint8_t)outlen; - P->key_length = (uint8_t)keylen; - P->fanout = 1; - P->depth = 1; - // P->leaf_length = 0; - // P->node_offset = 0; - // P->xof_length = 0; - // P->node_depth = 0; - // P->inner_length = 0; - // memset(P->reserved, 0, sizeof(P->reserved)); - // memset(P->salt, 0, sizeof(P->salt)); - // memset(P->personal, 0, sizeof(P->personal)); - - blake2b_init_param(); - - if (keylen > 0) { - uint8_t block[BLAKE2B_BLOCKBYTES]; - memset128(block, 0); - for (uint8_t i = 0; i < keylen; i++) { - block[i] = key[i]; - } - blake2b_update(block, BLAKE2B_BLOCKBYTES); - } -} - -WASM_EXPORT -void Hash_Init(uint32_t bits) { - int outlen = bits & 0xFFFF; - int keylen = bits >> 16; - blake2b_init_key(outlen / 8, main_buffer, keylen); -} - -WASM_EXPORT -void Hash_Update(uint32_t size) { - blake2b_update(main_buffer, size); -} - -WASM_EXPORT -const uint32_t STATE_SIZE = sizeof(S); - -WASM_EXPORT -uint8_t* Hash_GetState() { - return (uint8_t*) S; -} - -WASM_EXPORT -void Hash_Calculate(uint32_t length, uint32_t initParam) { - Hash_Init(initParam); - Hash_Update(length); - Hash_Final(); -} +/* + BLAKE2 reference source code package - reference C implementations + Copyright 2012, Samuel Neves . You may use this under the + terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at + your option. The terms of these licenses can be found at: + - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0 + - OpenSSL license : https://www.openssl.org/source/license.html + - Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0 + + More information about the BLAKE2 hash function can be found at + https://blake2.net. + + Modified for hash-wasm by Dani Biró +*/ + +#define WITH_BUFFER +#include "hash-wasm.h" + +#define BLAKE2_PACKED(x) x __attribute__((packed)) + +enum blake2b_constant { + BLAKE2B_BLOCKBYTES = 128, + BLAKE2B_OUTBYTES = 64, + BLAKE2B_KEYBYTES = 64, + BLAKE2B_SALTBYTES = 16, + BLAKE2B_PERSONALBYTES = 16 +}; + +typedef struct blake2b_state__ { + uint64_t h[8]; + uint64_t t[2]; + uint64_t f[2]; + uint8_t buf[BLAKE2B_BLOCKBYTES]; + int buflen; + int outlen; + uint8_t last_node; +} blake2b_state; + +blake2b_state S[1]; + +BLAKE2_PACKED(struct blake2b_param__ { + uint8_t digest_length; /* 1 */ + uint8_t key_length; /* 2 */ + uint8_t fanout; /* 3 */ + uint8_t depth; /* 4 */ + uint32_t leaf_length; /* 8 */ + uint32_t node_offset; /* 12 */ + uint32_t xof_length; /* 16 */ + uint8_t node_depth; /* 17 */ + uint8_t inner_length; /* 18 */ + uint8_t reserved[14]; /* 32 */ + uint8_t salt[BLAKE2B_SALTBYTES]; /* 48 */ + uint8_t personal[BLAKE2B_PERSONALBYTES]; /* 64 */ +}); + +typedef struct blake2b_param__ blake2b_param; + +blake2b_param P[1]; + +static __inline__ uint64_t load64(const void *src) { + return *(uint64_t *)src; +} + +static __inline__ void store64(void *dst, uint64_t w) { + *(uint64_t *)dst = w; +} + +static __inline__ uint64_t rotr64(const uint64_t w, const unsigned c) { + return (w >> c) | (w << (64 - c)); +} + +static const uint64_t blake2b_IV[8] = { + 0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL, + 0x3c6ef372fe94f82bULL, 0xa54ff53a5f1d36f1ULL, + 0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL, + 0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL +}; + +static const uint8_t blake2b_sigma[12][16] = { + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, + { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 }, + { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 }, + { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 }, + { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 }, + { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 }, + { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 }, + { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 }, + { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 }, + { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, + { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } +}; + +static __inline__ void blake2b_set_lastnode() { S->f[1] = (uint64_t)-1; } + +/* Some helper functions, not necessarily useful */ +static __inline__ int blake2b_is_lastblock() { return S->f[0] != 0; } + +static __inline__ void blake2b_set_lastblock() { + if (S->last_node) blake2b_set_lastnode(); + + S->f[0] = (uint64_t)-1; +} + +static __inline__ void blake2b_increment_counter(const uint64_t inc) { + S->t[0] += inc; + S->t[1] += (S->t[0] < inc); +} + +#define G(r, i, a, b, c, d) \ + do { \ + a = a + b + m[blake2b_sigma[r][2 * i + 0]]; \ + d = rotr64(d ^ a, 32); \ + c = c + d; \ + b = rotr64(b ^ c, 24); \ + a = a + b + m[blake2b_sigma[r][2 * i + 1]]; \ + d = rotr64(d ^ a, 16); \ + c = c + d; \ + b = rotr64(b ^ c, 63); \ + } while (0) + +static void round(uint32_t r, uint64_t m[16], uint64_t v[16]) { + G(r, 0, v[0], v[4], v[8], v[12]); + G(r, 1, v[1], v[5], v[9], v[13]); + G(r, 2, v[2], v[6], v[10], v[14]); + G(r, 3, v[3], v[7], v[11], v[15]); + G(r, 4, v[0], v[5], v[10], v[15]); + G(r, 5, v[1], v[6], v[11], v[12]); + G(r, 6, v[2], v[7], v[8], v[13]); + G(r, 7, v[3], v[4], v[9], v[14]); +}; + +static void blake2b_compress(const uint8_t block[BLAKE2B_BLOCKBYTES]) { + uint64_t m[16]; + uint64_t v[16]; + + #pragma clang loop unroll(full) + for (int i = 0; i < 16; ++i) { + m[i] = load64(block + i * sizeof(m[i])); + } + + #pragma clang loop unroll(full) + for (int i = 0; i < 8; ++i) { + v[i] = S->h[i]; + } + + v[8] = blake2b_IV[0]; + v[9] = blake2b_IV[1]; + v[10] = blake2b_IV[2]; + v[11] = blake2b_IV[3]; + v[12] = blake2b_IV[4] ^ S->t[0]; + v[13] = blake2b_IV[5] ^ S->t[1]; + v[14] = blake2b_IV[6] ^ S->f[0]; + v[15] = blake2b_IV[7] ^ S->f[1]; + + #pragma clang loop unroll(full) + for (int i = 0; i < 12; ++i) { + round(i, m, v); + } + + #pragma clang loop unroll(full) + for (int i = 0; i < 8; ++i) { + S->h[i] = S->h[i] ^ v[i] ^ v[i + 8]; + } +} + +#undef G + +void blake2b_update(const void *pin, int inlen) { + const unsigned char *in = (const unsigned char *)pin; + if (inlen > 0) { + int left = S->buflen; + int fill = BLAKE2B_BLOCKBYTES - left; + if (inlen > fill) { + S->buflen = 0; + /* Fill buffer */ + for (uint8_t i = 0; i < fill; i++) { + S->buf[left + i] = in[i]; + } + blake2b_increment_counter(BLAKE2B_BLOCKBYTES); + blake2b_compress(S->buf); /* Compress */ + in += fill; + inlen -= fill; + while (inlen > BLAKE2B_BLOCKBYTES) { + blake2b_increment_counter(BLAKE2B_BLOCKBYTES); + blake2b_compress(in); + in += BLAKE2B_BLOCKBYTES; + inlen -= BLAKE2B_BLOCKBYTES; + } + } + for (uint8_t i = 0; i < inlen; i++) { + S->buf[S->buflen + i] = in[i]; + } + S->buflen += inlen; + } +} + +WASM_EXPORT +void Hash_Final() { + int outlen = S->outlen; + uint8_t buffer[BLAKE2B_OUTBYTES] = {0}; + + if (blake2b_is_lastblock()) { + return; + } + + blake2b_increment_counter(S->buflen); + blake2b_set_lastblock(); + for (int i = 0; i < BLAKE2B_BLOCKBYTES - S->buflen; i++) { /* Padding */ + (S->buf + S->buflen)[i] = 0; + } + blake2b_compress(S->buf); + + for (int i = 0; i < 8; ++i) { + /* Output full hash to temp buffer */ + store64(buffer + sizeof(S->h[i]) * i, S->h[i]); + } + + for (uint8_t i = 0; i < S->outlen; i++) { + main_buffer[i] = buffer[i]; + } +} + +static void blake2b_init0() { + memset(S, 0, sizeof(blake2b_state)); + + for (int i = 0; i < 8; ++i) { + S->h[i] = blake2b_IV[i]; + } +} + +/* init xors IV with input parameter block */ +void blake2b_init_param() { + const uint8_t *p = (const uint8_t *)(P); + int i; + + blake2b_init0(); + + /* IV XOR ParamBlock */ + for (i = 0; i < 8; ++i) { + S->h[i] ^= load64(p + sizeof(S->h[i]) * i); + } + + S->outlen = P->digest_length; +} + +void blake2b_init_key(int outlen, const uint8_t *key, int keylen) { + P->digest_length = (uint8_t)outlen; + P->key_length = (uint8_t)keylen; + P->fanout = 1; + P->depth = 1; + // P->leaf_length = 0; + // P->node_offset = 0; + // P->xof_length = 0; + // P->node_depth = 0; + // P->inner_length = 0; + // memset(P->reserved, 0, sizeof(P->reserved)); + // memset(P->salt, 0, sizeof(P->salt)); + // memset(P->personal, 0, sizeof(P->personal)); + + blake2b_init_param(); + + if (keylen > 0) { + uint8_t block[BLAKE2B_BLOCKBYTES]; + memset128(block, 0); + for (uint8_t i = 0; i < keylen; i++) { + block[i] = key[i]; + } + blake2b_update(block, BLAKE2B_BLOCKBYTES); + } +} + +WASM_EXPORT +void Hash_Init(uint32_t bits) { + int outlen = bits & 0xFFFF; + int keylen = bits >> 16; + blake2b_init_key(outlen / 8, main_buffer, keylen); +} + +WASM_EXPORT +void Hash_Update(uint32_t size) { + blake2b_update(main_buffer, size); +} + +WASM_EXPORT +const uint32_t STATE_SIZE = sizeof(S); + +WASM_EXPORT +uint8_t* Hash_GetState() { + return (uint8_t*) S; +} + +WASM_EXPORT +void Hash_Calculate(uint32_t length, uint32_t initParam) { + Hash_Init(initParam); + Hash_Update(length); + Hash_Final(); +} diff --git a/node_modules/qrcode/lib/core/error-correction-code.js b/node_modules/qrcode/lib/core/error-correction-code.js index 5f2fcebb..7a4aeae9 100755 --- a/node_modules/qrcode/lib/core/error-correction-code.js +++ b/node_modules/qrcode/lib/core/error-correction-code.js @@ -1,135 +1,135 @@ -const ECLevel = require('./error-correction-level') - -const EC_BLOCKS_TABLE = [ -// L M Q H - 1, 1, 1, 1, - 1, 1, 1, 1, - 1, 1, 2, 2, - 1, 2, 2, 4, - 1, 2, 4, 4, - 2, 4, 4, 4, - 2, 4, 6, 5, - 2, 4, 6, 6, - 2, 5, 8, 8, - 4, 5, 8, 8, - 4, 5, 8, 11, - 4, 8, 10, 11, - 4, 9, 12, 16, - 4, 9, 16, 16, - 6, 10, 12, 18, - 6, 10, 17, 16, - 6, 11, 16, 19, - 6, 13, 18, 21, - 7, 14, 21, 25, - 8, 16, 20, 25, - 8, 17, 23, 25, - 9, 17, 23, 34, - 9, 18, 25, 30, - 10, 20, 27, 32, - 12, 21, 29, 35, - 12, 23, 34, 37, - 12, 25, 34, 40, - 13, 26, 35, 42, - 14, 28, 38, 45, - 15, 29, 40, 48, - 16, 31, 43, 51, - 17, 33, 45, 54, - 18, 35, 48, 57, - 19, 37, 51, 60, - 19, 38, 53, 63, - 20, 40, 56, 66, - 21, 43, 59, 70, - 22, 45, 62, 74, - 24, 47, 65, 77, - 25, 49, 68, 81 -] - -const EC_CODEWORDS_TABLE = [ -// L M Q H - 7, 10, 13, 17, - 10, 16, 22, 28, - 15, 26, 36, 44, - 20, 36, 52, 64, - 26, 48, 72, 88, - 36, 64, 96, 112, - 40, 72, 108, 130, - 48, 88, 132, 156, - 60, 110, 160, 192, - 72, 130, 192, 224, - 80, 150, 224, 264, - 96, 176, 260, 308, - 104, 198, 288, 352, - 120, 216, 320, 384, - 132, 240, 360, 432, - 144, 280, 408, 480, - 168, 308, 448, 532, - 180, 338, 504, 588, - 196, 364, 546, 650, - 224, 416, 600, 700, - 224, 442, 644, 750, - 252, 476, 690, 816, - 270, 504, 750, 900, - 300, 560, 810, 960, - 312, 588, 870, 1050, - 336, 644, 952, 1110, - 360, 700, 1020, 1200, - 390, 728, 1050, 1260, - 420, 784, 1140, 1350, - 450, 812, 1200, 1440, - 480, 868, 1290, 1530, - 510, 924, 1350, 1620, - 540, 980, 1440, 1710, - 570, 1036, 1530, 1800, - 570, 1064, 1590, 1890, - 600, 1120, 1680, 1980, - 630, 1204, 1770, 2100, - 660, 1260, 1860, 2220, - 720, 1316, 1950, 2310, - 750, 1372, 2040, 2430 -] - -/** - * Returns the number of error correction block that the QR Code should contain - * for the specified version and error correction level. - * - * @param {Number} version QR Code version - * @param {Number} errorCorrectionLevel Error correction level - * @return {Number} Number of error correction blocks - */ -exports.getBlocksCount = function getBlocksCount (version, errorCorrectionLevel) { - switch (errorCorrectionLevel) { - case ECLevel.L: - return EC_BLOCKS_TABLE[(version - 1) * 4 + 0] - case ECLevel.M: - return EC_BLOCKS_TABLE[(version - 1) * 4 + 1] - case ECLevel.Q: - return EC_BLOCKS_TABLE[(version - 1) * 4 + 2] - case ECLevel.H: - return EC_BLOCKS_TABLE[(version - 1) * 4 + 3] - default: - return undefined - } -} - -/** - * Returns the number of error correction codewords to use for the specified - * version and error correction level. - * - * @param {Number} version QR Code version - * @param {Number} errorCorrectionLevel Error correction level - * @return {Number} Number of error correction codewords - */ -exports.getTotalCodewordsCount = function getTotalCodewordsCount (version, errorCorrectionLevel) { - switch (errorCorrectionLevel) { - case ECLevel.L: - return EC_CODEWORDS_TABLE[(version - 1) * 4 + 0] - case ECLevel.M: - return EC_CODEWORDS_TABLE[(version - 1) * 4 + 1] - case ECLevel.Q: - return EC_CODEWORDS_TABLE[(version - 1) * 4 + 2] - case ECLevel.H: - return EC_CODEWORDS_TABLE[(version - 1) * 4 + 3] - default: - return undefined - } -} +const ECLevel = require('./error-correction-level') + +const EC_BLOCKS_TABLE = [ +// L M Q H + 1, 1, 1, 1, + 1, 1, 1, 1, + 1, 1, 2, 2, + 1, 2, 2, 4, + 1, 2, 4, 4, + 2, 4, 4, 4, + 2, 4, 6, 5, + 2, 4, 6, 6, + 2, 5, 8, 8, + 4, 5, 8, 8, + 4, 5, 8, 11, + 4, 8, 10, 11, + 4, 9, 12, 16, + 4, 9, 16, 16, + 6, 10, 12, 18, + 6, 10, 17, 16, + 6, 11, 16, 19, + 6, 13, 18, 21, + 7, 14, 21, 25, + 8, 16, 20, 25, + 8, 17, 23, 25, + 9, 17, 23, 34, + 9, 18, 25, 30, + 10, 20, 27, 32, + 12, 21, 29, 35, + 12, 23, 34, 37, + 12, 25, 34, 40, + 13, 26, 35, 42, + 14, 28, 38, 45, + 15, 29, 40, 48, + 16, 31, 43, 51, + 17, 33, 45, 54, + 18, 35, 48, 57, + 19, 37, 51, 60, + 19, 38, 53, 63, + 20, 40, 56, 66, + 21, 43, 59, 70, + 22, 45, 62, 74, + 24, 47, 65, 77, + 25, 49, 68, 81 +] + +const EC_CODEWORDS_TABLE = [ +// L M Q H + 7, 10, 13, 17, + 10, 16, 22, 28, + 15, 26, 36, 44, + 20, 36, 52, 64, + 26, 48, 72, 88, + 36, 64, 96, 112, + 40, 72, 108, 130, + 48, 88, 132, 156, + 60, 110, 160, 192, + 72, 130, 192, 224, + 80, 150, 224, 264, + 96, 176, 260, 308, + 104, 198, 288, 352, + 120, 216, 320, 384, + 132, 240, 360, 432, + 144, 280, 408, 480, + 168, 308, 448, 532, + 180, 338, 504, 588, + 196, 364, 546, 650, + 224, 416, 600, 700, + 224, 442, 644, 750, + 252, 476, 690, 816, + 270, 504, 750, 900, + 300, 560, 810, 960, + 312, 588, 870, 1050, + 336, 644, 952, 1110, + 360, 700, 1020, 1200, + 390, 728, 1050, 1260, + 420, 784, 1140, 1350, + 450, 812, 1200, 1440, + 480, 868, 1290, 1530, + 510, 924, 1350, 1620, + 540, 980, 1440, 1710, + 570, 1036, 1530, 1800, + 570, 1064, 1590, 1890, + 600, 1120, 1680, 1980, + 630, 1204, 1770, 2100, + 660, 1260, 1860, 2220, + 720, 1316, 1950, 2310, + 750, 1372, 2040, 2430 +] + +/** + * Returns the number of error correction block that the QR Code should contain + * for the specified version and error correction level. + * + * @param {Number} version QR Code version + * @param {Number} errorCorrectionLevel Error correction level + * @return {Number} Number of error correction blocks + */ +exports.getBlocksCount = function getBlocksCount (version, errorCorrectionLevel) { + switch (errorCorrectionLevel) { + case ECLevel.L: + return EC_BLOCKS_TABLE[(version - 1) * 4 + 0] + case ECLevel.M: + return EC_BLOCKS_TABLE[(version - 1) * 4 + 1] + case ECLevel.Q: + return EC_BLOCKS_TABLE[(version - 1) * 4 + 2] + case ECLevel.H: + return EC_BLOCKS_TABLE[(version - 1) * 4 + 3] + default: + return undefined + } +} + +/** + * Returns the number of error correction codewords to use for the specified + * version and error correction level. + * + * @param {Number} version QR Code version + * @param {Number} errorCorrectionLevel Error correction level + * @return {Number} Number of error correction codewords + */ +exports.getTotalCodewordsCount = function getTotalCodewordsCount (version, errorCorrectionLevel) { + switch (errorCorrectionLevel) { + case ECLevel.L: + return EC_CODEWORDS_TABLE[(version - 1) * 4 + 0] + case ECLevel.M: + return EC_CODEWORDS_TABLE[(version - 1) * 4 + 1] + case ECLevel.Q: + return EC_CODEWORDS_TABLE[(version - 1) * 4 + 2] + case ECLevel.H: + return EC_CODEWORDS_TABLE[(version - 1) * 4 + 3] + default: + return undefined + } +} diff --git a/node_modules/typescript/LICENSE.txt b/node_modules/typescript/LICENSE.txt index edc24fd6..8746124b 100644 --- a/node_modules/typescript/LICENSE.txt +++ b/node_modules/typescript/LICENSE.txt @@ -1,55 +1,55 @@ -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of this License; and - -You must cause any modified files to carry prominent notices stating that You changed the files; and - -You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - -If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS +Apache License + +Version 2.0, January 2004 + +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of this License; and + +You must cause any modified files to carry prominent notices stating that You changed the files; and + +You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + +If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS diff --git a/node_modules/typescript/README.md b/node_modules/typescript/README.md index 2f3ce939..b6505f73 100644 --- a/node_modules/typescript/README.md +++ b/node_modules/typescript/README.md @@ -1,50 +1,50 @@ - -# TypeScript - -[![CI](https://github.com/microsoft/TypeScript/actions/workflows/ci.yml/badge.svg)](https://github.com/microsoft/TypeScript/actions/workflows/ci.yml) -[![npm version](https://badge.fury.io/js/typescript.svg)](https://www.npmjs.com/package/typescript) -[![Downloads](https://img.shields.io/npm/dm/typescript.svg)](https://www.npmjs.com/package/typescript) -[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/microsoft/TypeScript/badge)](https://securityscorecards.dev/viewer/?uri=github.com/microsoft/TypeScript) - - -[TypeScript](https://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types to JavaScript that support tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](https://www.typescriptlang.org/play/), and stay up to date via [our blog](https://blogs.msdn.microsoft.com/typescript) and [Twitter account](https://twitter.com/typescript). - -Find others who are using TypeScript at [our community page](https://www.typescriptlang.org/community/). - -## Installing - -For the latest stable version: - -```bash -npm install -D typescript -``` - -For our nightly builds: - -```bash -npm install -D typescript@next -``` - -## Contribute - -There are many ways to [contribute](https://github.com/microsoft/TypeScript/blob/main/CONTRIBUTING.md) to TypeScript. -* [Submit bugs](https://github.com/microsoft/TypeScript/issues) and help us verify fixes as they are checked in. -* Review the [source code changes](https://github.com/microsoft/TypeScript/pulls). -* Engage with other TypeScript users and developers on [StackOverflow](https://stackoverflow.com/questions/tagged/typescript). -* Help each other in the [TypeScript Community Discord](https://discord.gg/typescript). -* Join the [#typescript](https://twitter.com/search?q=%23TypeScript) discussion on Twitter. -* [Contribute bug fixes](https://github.com/microsoft/TypeScript/blob/main/CONTRIBUTING.md). - -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see -the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) -with any additional questions or comments. - -## Documentation - -* [TypeScript in 5 minutes](https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes.html) -* [Programming handbook](https://www.typescriptlang.org/docs/handbook/intro.html) -* [Homepage](https://www.typescriptlang.org/) - -## Roadmap - -For details on our planned features and future direction, please refer to our [roadmap](https://github.com/microsoft/TypeScript/wiki/Roadmap). + +# TypeScript + +[![CI](https://github.com/microsoft/TypeScript/actions/workflows/ci.yml/badge.svg)](https://github.com/microsoft/TypeScript/actions/workflows/ci.yml) +[![npm version](https://badge.fury.io/js/typescript.svg)](https://www.npmjs.com/package/typescript) +[![Downloads](https://img.shields.io/npm/dm/typescript.svg)](https://www.npmjs.com/package/typescript) +[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/microsoft/TypeScript/badge)](https://securityscorecards.dev/viewer/?uri=github.com/microsoft/TypeScript) + + +[TypeScript](https://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types to JavaScript that support tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](https://www.typescriptlang.org/play/), and stay up to date via [our blog](https://blogs.msdn.microsoft.com/typescript) and [Twitter account](https://twitter.com/typescript). + +Find others who are using TypeScript at [our community page](https://www.typescriptlang.org/community/). + +## Installing + +For the latest stable version: + +```bash +npm install -D typescript +``` + +For our nightly builds: + +```bash +npm install -D typescript@next +``` + +## Contribute + +There are many ways to [contribute](https://github.com/microsoft/TypeScript/blob/main/CONTRIBUTING.md) to TypeScript. +* [Submit bugs](https://github.com/microsoft/TypeScript/issues) and help us verify fixes as they are checked in. +* Review the [source code changes](https://github.com/microsoft/TypeScript/pulls). +* Engage with other TypeScript users and developers on [StackOverflow](https://stackoverflow.com/questions/tagged/typescript). +* Help each other in the [TypeScript Community Discord](https://discord.gg/typescript). +* Join the [#typescript](https://twitter.com/search?q=%23TypeScript) discussion on Twitter. +* [Contribute bug fixes](https://github.com/microsoft/TypeScript/blob/main/CONTRIBUTING.md). + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see +the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) +with any additional questions or comments. + +## Documentation + +* [TypeScript in 5 minutes](https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes.html) +* [Programming handbook](https://www.typescriptlang.org/docs/handbook/intro.html) +* [Homepage](https://www.typescriptlang.org/) + +## Roadmap + +For details on our planned features and future direction, please refer to our [roadmap](https://github.com/microsoft/TypeScript/wiki/Roadmap). diff --git a/node_modules/typescript/ThirdPartyNoticeText.txt b/node_modules/typescript/ThirdPartyNoticeText.txt index b6707461..a857fb3c 100644 --- a/node_modules/typescript/ThirdPartyNoticeText.txt +++ b/node_modules/typescript/ThirdPartyNoticeText.txt @@ -1,193 +1,193 @@ -/*!----------------- TypeScript ThirdPartyNotices ------------------------------------------------------- - -The TypeScript software incorporates third party material from the projects listed below. The original copyright notice and the license under which Microsoft received such third party material are set forth below. Microsoft reserves all other rights not expressly granted, whether by implication, estoppel or otherwise. - ---------------------------------------------- -Third Party Code Components --------------------------------------------- - -------------------- DefinitelyTyped -------------------- -This file is based on or incorporates material from the projects listed below (collectively "Third Party Code"). Microsoft is not the original author of the Third Party Code. The original copyright notice and the license, under which Microsoft received such Third Party Code, are set forth below. Such licenses and notices are provided for informational purposes only. Microsoft, not the third party, licenses the Third Party Code to you under the terms set forth in the EULA for the Microsoft Product. Microsoft reserves all other rights not expressly granted under this agreement, whether by implication, estoppel or otherwise. -DefinitelyTyped -This project is licensed under the MIT license. Copyrights are respective of each contributor listed at the beginning of each definition file. Provided for Informational Purposes Only - -MIT License -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------------------------------------------------------- - -------------------- Unicode -------------------- -UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE - -Unicode Data Files include all data files under the directories -http://www.unicode.org/Public/, http://www.unicode.org/reports/, -http://www.unicode.org/cldr/data/, http://source.icu-project.org/repos/icu/, and -http://www.unicode.org/utility/trac/browser/. - -Unicode Data Files do not include PDF online code charts under the -directory http://www.unicode.org/Public/. - -Software includes any source code published in the Unicode Standard -or under the directories -http://www.unicode.org/Public/, http://www.unicode.org/reports/, -http://www.unicode.org/cldr/data/, http://source.icu-project.org/repos/icu/, and -http://www.unicode.org/utility/trac/browser/. - -NOTICE TO USER: Carefully read the following legal agreement. -BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S -DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), -YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE -TERMS AND CONDITIONS OF THIS AGREEMENT. -IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE -THE DATA FILES OR SOFTWARE. - -COPYRIGHT AND PERMISSION NOTICE - -Copyright (c) 1991-2017 Unicode, Inc. All rights reserved. -Distributed under the Terms of Use in http://www.unicode.org/copyright.html. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of the Unicode data files and any associated documentation -(the "Data Files") or Unicode software and any associated documentation -(the "Software") to deal in the Data Files or Software -without restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, and/or sell copies of -the Data Files or Software, and to permit persons to whom the Data Files -or Software are furnished to do so, provided that either -(a) this copyright and permission notice appear with all copies -of the Data Files or Software, or -(b) this copyright and permission notice appear in associated -Documentation. - -THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT OF THIRD PARTY RIGHTS. -IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS -NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL -DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THE DATA FILES OR SOFTWARE. - -Except as contained in this notice, the name of a copyright holder -shall not be used in advertising or otherwise to promote the sale, -use or other dealings in these Data Files or Software without prior -written authorization of the copyright holder. -------------------------------------------------------------------------------------- - --------------------Document Object Model----------------------------- -DOM - -W3C License -This work is being provided by the copyright holders under the following license. -By obtaining and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions. -Permission to copy, modify, and distribute this work, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following -on ALL copies of the work or portions thereof, including modifications: -* The full text of this NOTICE in a location viewable to users of the redistributed or derivative work. -* Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software and Document Short Notice should be included. -* Notice of any changes or modifications, through a copyright statement on the new code or document such as "This software or document includes material copied from or derived -from [title and URI of the W3C document]. Copyright © [YEAR] W3C® (MIT, ERCIM, Keio, Beihang)." -Disclaimers -THIS WORK IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR -FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENT WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. -COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENT. -The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the work without specific, written prior permission. -Title to copyright in this work will at all times remain with copyright holders. - ---------- - -DOM -Copyright © 2018 WHATWG (Apple, Google, Mozilla, Microsoft). This work is licensed under a Creative Commons Attribution 4.0 International License: Attribution 4.0 International -======================================================================= -Creative Commons Corporation ("Creative Commons") is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an "as-is" basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible. Using Creative Commons Public Licenses Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses. Considerations for licensors: Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC- licensed material, or material used under an exception or limitation to copyright. More considerations for licensors: - -wiki.creativecommons.org/Considerations_for_licensors Considerations for the public: By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor's permission is not necessary for any reason--for example, because of any applicable exception or limitation to copyright--then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. More_considerations for the public: wiki.creativecommons.org/Considerations_for_licensees ======================================================================= -Creative Commons Attribution 4.0 International Public License By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. Section 1 -- Definitions. a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. c. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. d. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. e. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. f. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. g. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. h. Licensor means the individual(s) or entity(ies) granting rights under this Public License. i. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. j. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. k. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. Section 2 -- Scope. a. License grant. 1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: a. reproduce and Share the Licensed Material, in whole or in part; and b. produce, reproduce, and Share Adapted Material. 2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. 3. Term. The term of this Public License is specified in Section 6(a). 4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a) (4) never produces Adapted Material. 5. Downstream recipients. a. Offer from the Licensor -- Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. b. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. 6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). b. Other rights. 1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. 2. Patent and trademark rights are not licensed under this Public License. 3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties. Section 3 -- License Conditions. Your exercise of the Licensed Rights is expressly made subject to the following conditions. a. Attribution. 1. If You Share the Licensed Material (including in modified form), You must: a. retain the following if it is supplied by the Licensor with the Licensed Material: i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); ii. a copyright notice; iii. a notice that refers to this Public License; iv. a notice that refers to the disclaimer of warranties; v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable; b. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and c. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. 2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. 3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. 4. If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License. Section 4 -- Sui Generis Database Rights. Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database; b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. Section 5 -- Disclaimer of Warranties and Limitation of Liability. a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. Section 6 -- Term and Termination. a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: 1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or 2. upon express reinstatement by the Licensor. For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. c. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License. Section 7 -- Other Terms and Conditions. a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. Section 8 -- Interpretation. a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. ======================================================================= Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the "Licensor." Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark "Creative Commons" or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses. Creative Commons may be contacted at creativecommons.org. - --------------------------------------------------------------------------------- - -----------------------Web Background Synchronization------------------------------ - -Web Background Synchronization Specification -Portions of spec © by W3C - -W3C Community Final Specification Agreement -To secure commitments from participants for the full text of a Community or Business Group Report, the group may call for voluntary commitments to the following terms; a "summary" is -available. See also the related "W3C Community Contributor License Agreement". -1. The Purpose of this Agreement. -This Agreement sets forth the terms under which I make certain copyright and patent rights available to you for your implementation of the Specification. -Any other capitalized terms not specifically defined herein have the same meaning as those terms have in the "W3C Patent Policy", and if not defined there, in the "W3C Process Document". -2. Copyrights. -2.1. Copyright Grant. I grant to you a perpetual (for the duration of the applicable copyright), worldwide, non-exclusive, no-charge, royalty-free, copyright license, without any obligation for accounting to me, to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, distribute, and implement the Specification to the full extent of my copyright interest in the Specification. -2.2. Attribution. As a condition of the copyright grant, you must include an attribution to the Specification in any derivative work you make based on the Specification. That attribution must include, at minimum, the Specification name and version number. -3. Patents. -3.1. Patent Licensing Commitment. I agree to license my Essential Claims under the W3C Community RF Licensing Requirements. This requirement includes Essential Claims that I own and any that I have the right to license without obligation of payment or other consideration to an unrelated third party. W3C Community RF Licensing Requirements obligations made concerning the Specification and described in this policy are binding on me for the life of the patents in question and encumber the patents containing Essential Claims, regardless of changes in participation status or W3C Membership. I also agree to license my Essential Claims under the W3C Community RF Licensing Requirements in derivative works of the Specification so long as all normative portions of the Specification are maintained and that this licensing commitment does not extend to any portion of the derivative work that was not included in the Specification. -3.2. Optional, Additional Patent Grant. In addition to the provisions of Section 3.1, I may also, at my option, make certain intellectual property rights infringed by implementations of the Specification, including Essential Claims, available by providing those terms via the W3C Web site. -4. No Other Rights. Except as specifically set forth in this Agreement, no other express or implied patent, trademark, copyright, or other property rights are granted under this Agreement, including by implication, waiver, or estoppel. -5. Antitrust Compliance. I acknowledge that I may compete with other participants, that I am under no obligation to implement the Specification, that each participant is free to develop competing technologies and standards, and that each party is free to license its patent rights to third parties, including for the purpose of enabling competing technologies and standards. -6. Non-Circumvention. I agree that I will not intentionally take or willfully assist any third party to take any action for the purpose of circumventing my obligations under this Agreement. -7. Transition to W3C Recommendation Track. The Specification developed by the Project may transition to the W3C Recommendation Track. The W3C Team is responsible for notifying me that a Corresponding Working Group has been chartered. I have no obligation to join the Corresponding Working Group. If the Specification developed by the Project transitions to the W3C Recommendation Track, the following terms apply: -7.1. If I join the Corresponding Working Group. If I join the Corresponding Working Group, I will be subject to all W3C rules, obligations, licensing commitments, and policies that govern that Corresponding Working Group. -7.2. If I Do Not Join the Corresponding Working Group. -7.2.1. Licensing Obligations to Resulting Specification. If I do not join the Corresponding Working Group, I agree to offer patent licenses according to the W3C Royalty-Free licensing requirements described in Section 5 of the W3C Patent Policy for the portions of the Specification included in the resulting Recommendation. This licensing commitment does not extend to any portion of an implementation of the Recommendation that was not included in the Specification. This licensing commitment may not be revoked but may be modified through the exclusion process defined in Section 4 of the W3C Patent Policy. I am not required to join the Corresponding Working Group to exclude patents from the W3C Royalty-Free licensing commitment, but must otherwise follow the normal exclusion procedures defined by the W3C Patent Policy. The W3C Team will notify me of any Call for Exclusion in the Corresponding Working Group as set forth in Section 4.5 of the W3C Patent Policy. -7.2.2. No Disclosure Obligation. If I do not join the Corresponding Working Group, I have no patent disclosure obligations outside of those set forth in Section 6 of the W3C Patent Policy. -8. Conflict of Interest. I will disclose significant relationships when those relationships might reasonably be perceived as creating a conflict of interest with my role. I will notify W3C of any change in my affiliation using W3C-provided mechanisms. -9. Representations, Warranties and Disclaimers. I represent and warrant that I am legally entitled to grant the rights and promises set forth in this Agreement. IN ALL OTHER RESPECTS THE SPECIFICATION IS PROVIDED “AS IS.” The entire risk as to implementing or otherwise using the Specification is assumed by the implementer and user. Except as stated herein, I expressly disclaim any warranties (express, implied, or otherwise), including implied warranties of merchantability, non-infringement, fitness for a particular purpose, or title, related to the Specification. IN NO EVENT WILL ANY PARTY BE LIABLE TO ANY OTHER PARTY FOR LOST PROFITS OR ANY FORM OF INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER FROM ANY CAUSES OF ACTION OF ANY KIND WITH RESPECT TO THIS AGREEMENT, WHETHER BASED ON BREACH OF CONTRACT, TORT (INCLUDING NEGLIGENCE), OR OTHERWISE, AND WHETHER OR NOT THE OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. All of my obligations under Section 3 regarding the transfer, successors in interest, or assignment of Granted Claims will be satisfied if I notify the transferee or assignee of any patent that I know contains Granted Claims of the obligations under Section 3. Nothing in this Agreement requires me to undertake a patent search. -10. Definitions. -10.1. Agreement. “Agreement” means this W3C Community Final Specification Agreement. -10.2. Corresponding Working Group. “Corresponding Working Group” is a W3C Working Group that is chartered to develop a Recommendation, as defined in the W3C Process Document, that takes the Specification as an input. -10.3. Essential Claims. “Essential Claims” shall mean all claims in any patent or patent application in any jurisdiction in the world that would necessarily be infringed by implementation of the Specification. A claim is necessarily infringed hereunder only when it is not possible to avoid infringing it because there is no non-infringing alternative for implementing the normative portions of the Specification. Existence of a non-infringing alternative shall be judged based on the state of the art at the time of the publication of the Specification. The following are expressly excluded from and shall not be deemed to constitute Essential Claims: -10.3.1. any claims other than as set forth above even if contained in the same patent as Essential Claims; and -10.3.2. claims which would be infringed only by: -portions of an implementation that are not specified in the normative portions of the Specification, or -enabling technologies that may be necessary to make or use any product or portion thereof that complies with the Specification and are not themselves expressly set forth in the Specification (e.g., semiconductor manufacturing technology, compiler technology, object-oriented technology, basic operating system technology, and the like); or -the implementation of technology developed elsewhere and merely incorporated by reference in the body of the Specification. -10.3.3. design patents and design registrations. -For purposes of this definition, the normative portions of the Specification shall be deemed to include only architectural and interoperability requirements. Optional features in the RFC 2119 sense are considered normative unless they are specifically identified as informative. Implementation examples or any other material that merely illustrate the requirements of the Specification are informative, rather than normative. -10.4. I, Me, or My. “I,” “me,” or “my” refers to the signatory. -10.5 Project. “Project” means the W3C Community Group or Business Group for which I executed this Agreement. -10.6. Specification. “Specification” means the Specification identified by the Project as the target of this agreement in a call for Final Specification Commitments. W3C shall provide the authoritative mechanisms for the identification of this Specification. -10.7. W3C Community RF Licensing Requirements. “W3C Community RF Licensing Requirements” license shall mean a non-assignable, non-sublicensable license to make, have made, use, sell, have sold, offer to sell, import, and distribute and dispose of implementations of the Specification that: -10.7.1. shall be available to all, worldwide, whether or not they are W3C Members; -10.7.2. shall extend to all Essential Claims owned or controlled by me; -10.7.3. may be limited to implementations of the Specification, and to what is required by the Specification; -10.7.4. may be conditioned on a grant of a reciprocal RF license (as defined in this policy) to all Essential Claims owned or controlled by the licensee. A reciprocal license may be required to be available to all, and a reciprocal license may itself be conditioned on a further reciprocal license from all. -10.7.5. may not be conditioned on payment of royalties, fees or other consideration; -10.7.6. may be suspended with respect to any licensee when licensor issued by licensee for infringement of claims essential to implement the Specification or any W3C Recommendation; -10.7.7. may not impose any further conditions or restrictions on the use of any technology, intellectual property rights, or other restrictions on behavior of the licensee, but may include reasonable, customary terms relating to operation or maintenance of the license relationship such as the following: choice of law and dispute resolution; -10.7.8. shall not be considered accepted by an implementer who manifests an intent not to accept the terms of the W3C Community RF Licensing Requirements license as offered by the licensor. -10.7.9. The RF license conforming to the requirements in this policy shall be made available by the licensor as long as the Specification is in effect. The term of such license shall be for the life of the patents in question. -I am encouraged to provide a contact from which licensing information can be obtained and other relevant licensing information. Any such information will be made publicly available. -10.8. You or Your. “You,” “you,” or “your” means any person or entity who exercises copyright or patent rights granted under this Agreement, and any person that person or entity controls. - -------------------------------------------------------------------------------------- - -------------------- WebGL ----------------------------- -Copyright (c) 2018 The Khronos Group Inc. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and/or associated documentation files (the -"Materials"), to deal in the Materials without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Materials, and to -permit persons to whom the Materials are furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Materials. - -THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. ------------------------------------------------------- - -------------- End of ThirdPartyNotices ------------------------------------------- */ - +/*!----------------- TypeScript ThirdPartyNotices ------------------------------------------------------- + +The TypeScript software incorporates third party material from the projects listed below. The original copyright notice and the license under which Microsoft received such third party material are set forth below. Microsoft reserves all other rights not expressly granted, whether by implication, estoppel or otherwise. + +--------------------------------------------- +Third Party Code Components +-------------------------------------------- + +------------------- DefinitelyTyped -------------------- +This file is based on or incorporates material from the projects listed below (collectively "Third Party Code"). Microsoft is not the original author of the Third Party Code. The original copyright notice and the license, under which Microsoft received such Third Party Code, are set forth below. Such licenses and notices are provided for informational purposes only. Microsoft, not the third party, licenses the Third Party Code to you under the terms set forth in the EULA for the Microsoft Product. Microsoft reserves all other rights not expressly granted under this agreement, whether by implication, estoppel or otherwise. +DefinitelyTyped +This project is licensed under the MIT license. Copyrights are respective of each contributor listed at the beginning of each definition file. Provided for Informational Purposes Only + +MIT License +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-------------------------------------------------------------------------------------- + +------------------- Unicode -------------------- +UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE + +Unicode Data Files include all data files under the directories +http://www.unicode.org/Public/, http://www.unicode.org/reports/, +http://www.unicode.org/cldr/data/, http://source.icu-project.org/repos/icu/, and +http://www.unicode.org/utility/trac/browser/. + +Unicode Data Files do not include PDF online code charts under the +directory http://www.unicode.org/Public/. + +Software includes any source code published in the Unicode Standard +or under the directories +http://www.unicode.org/Public/, http://www.unicode.org/reports/, +http://www.unicode.org/cldr/data/, http://source.icu-project.org/repos/icu/, and +http://www.unicode.org/utility/trac/browser/. + +NOTICE TO USER: Carefully read the following legal agreement. +BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S +DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), +YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE +TERMS AND CONDITIONS OF THIS AGREEMENT. +IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE +THE DATA FILES OR SOFTWARE. + +COPYRIGHT AND PERMISSION NOTICE + +Copyright (c) 1991-2017 Unicode, Inc. All rights reserved. +Distributed under the Terms of Use in http://www.unicode.org/copyright.html. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Unicode data files and any associated documentation +(the "Data Files") or Unicode software and any associated documentation +(the "Software") to deal in the Data Files or Software +without restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, and/or sell copies of +the Data Files or Software, and to permit persons to whom the Data Files +or Software are furnished to do so, provided that either +(a) this copyright and permission notice appear with all copies +of the Data Files or Software, or +(b) this copyright and permission notice appear in associated +Documentation. + +THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT OF THIRD PARTY RIGHTS. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS +NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL +DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THE DATA FILES OR SOFTWARE. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, +use or other dealings in these Data Files or Software without prior +written authorization of the copyright holder. +------------------------------------------------------------------------------------- + +-------------------Document Object Model----------------------------- +DOM + +W3C License +This work is being provided by the copyright holders under the following license. +By obtaining and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions. +Permission to copy, modify, and distribute this work, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following +on ALL copies of the work or portions thereof, including modifications: +* The full text of this NOTICE in a location viewable to users of the redistributed or derivative work. +* Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software and Document Short Notice should be included. +* Notice of any changes or modifications, through a copyright statement on the new code or document such as "This software or document includes material copied from or derived +from [title and URI of the W3C document]. Copyright © [YEAR] W3C® (MIT, ERCIM, Keio, Beihang)." +Disclaimers +THIS WORK IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR +FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENT WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. +COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENT. +The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the work without specific, written prior permission. +Title to copyright in this work will at all times remain with copyright holders. + +--------- + +DOM +Copyright © 2018 WHATWG (Apple, Google, Mozilla, Microsoft). This work is licensed under a Creative Commons Attribution 4.0 International License: Attribution 4.0 International +======================================================================= +Creative Commons Corporation ("Creative Commons") is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an "as-is" basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible. Using Creative Commons Public Licenses Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses. Considerations for licensors: Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC- licensed material, or material used under an exception or limitation to copyright. More considerations for licensors: + +wiki.creativecommons.org/Considerations_for_licensors Considerations for the public: By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor's permission is not necessary for any reason--for example, because of any applicable exception or limitation to copyright--then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. More_considerations for the public: wiki.creativecommons.org/Considerations_for_licensees ======================================================================= +Creative Commons Attribution 4.0 International Public License By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. Section 1 -- Definitions. a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. c. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. d. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. e. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. f. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. g. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. h. Licensor means the individual(s) or entity(ies) granting rights under this Public License. i. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. j. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. k. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. Section 2 -- Scope. a. License grant. 1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: a. reproduce and Share the Licensed Material, in whole or in part; and b. produce, reproduce, and Share Adapted Material. 2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. 3. Term. The term of this Public License is specified in Section 6(a). 4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a) (4) never produces Adapted Material. 5. Downstream recipients. a. Offer from the Licensor -- Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. b. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. 6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). b. Other rights. 1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. 2. Patent and trademark rights are not licensed under this Public License. 3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties. Section 3 -- License Conditions. Your exercise of the Licensed Rights is expressly made subject to the following conditions. a. Attribution. 1. If You Share the Licensed Material (including in modified form), You must: a. retain the following if it is supplied by the Licensor with the Licensed Material: i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); ii. a copyright notice; iii. a notice that refers to this Public License; iv. a notice that refers to the disclaimer of warranties; v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable; b. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and c. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. 2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. 3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. 4. If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License. Section 4 -- Sui Generis Database Rights. Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database; b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. Section 5 -- Disclaimer of Warranties and Limitation of Liability. a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. Section 6 -- Term and Termination. a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: 1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or 2. upon express reinstatement by the Licensor. For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. c. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License. Section 7 -- Other Terms and Conditions. a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. Section 8 -- Interpretation. a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. ======================================================================= Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the "Licensor." Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark "Creative Commons" or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses. Creative Commons may be contacted at creativecommons.org. + +-------------------------------------------------------------------------------- + +----------------------Web Background Synchronization------------------------------ + +Web Background Synchronization Specification +Portions of spec © by W3C + +W3C Community Final Specification Agreement +To secure commitments from participants for the full text of a Community or Business Group Report, the group may call for voluntary commitments to the following terms; a "summary" is +available. See also the related "W3C Community Contributor License Agreement". +1. The Purpose of this Agreement. +This Agreement sets forth the terms under which I make certain copyright and patent rights available to you for your implementation of the Specification. +Any other capitalized terms not specifically defined herein have the same meaning as those terms have in the "W3C Patent Policy", and if not defined there, in the "W3C Process Document". +2. Copyrights. +2.1. Copyright Grant. I grant to you a perpetual (for the duration of the applicable copyright), worldwide, non-exclusive, no-charge, royalty-free, copyright license, without any obligation for accounting to me, to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, distribute, and implement the Specification to the full extent of my copyright interest in the Specification. +2.2. Attribution. As a condition of the copyright grant, you must include an attribution to the Specification in any derivative work you make based on the Specification. That attribution must include, at minimum, the Specification name and version number. +3. Patents. +3.1. Patent Licensing Commitment. I agree to license my Essential Claims under the W3C Community RF Licensing Requirements. This requirement includes Essential Claims that I own and any that I have the right to license without obligation of payment or other consideration to an unrelated third party. W3C Community RF Licensing Requirements obligations made concerning the Specification and described in this policy are binding on me for the life of the patents in question and encumber the patents containing Essential Claims, regardless of changes in participation status or W3C Membership. I also agree to license my Essential Claims under the W3C Community RF Licensing Requirements in derivative works of the Specification so long as all normative portions of the Specification are maintained and that this licensing commitment does not extend to any portion of the derivative work that was not included in the Specification. +3.2. Optional, Additional Patent Grant. In addition to the provisions of Section 3.1, I may also, at my option, make certain intellectual property rights infringed by implementations of the Specification, including Essential Claims, available by providing those terms via the W3C Web site. +4. No Other Rights. Except as specifically set forth in this Agreement, no other express or implied patent, trademark, copyright, or other property rights are granted under this Agreement, including by implication, waiver, or estoppel. +5. Antitrust Compliance. I acknowledge that I may compete with other participants, that I am under no obligation to implement the Specification, that each participant is free to develop competing technologies and standards, and that each party is free to license its patent rights to third parties, including for the purpose of enabling competing technologies and standards. +6. Non-Circumvention. I agree that I will not intentionally take or willfully assist any third party to take any action for the purpose of circumventing my obligations under this Agreement. +7. Transition to W3C Recommendation Track. The Specification developed by the Project may transition to the W3C Recommendation Track. The W3C Team is responsible for notifying me that a Corresponding Working Group has been chartered. I have no obligation to join the Corresponding Working Group. If the Specification developed by the Project transitions to the W3C Recommendation Track, the following terms apply: +7.1. If I join the Corresponding Working Group. If I join the Corresponding Working Group, I will be subject to all W3C rules, obligations, licensing commitments, and policies that govern that Corresponding Working Group. +7.2. If I Do Not Join the Corresponding Working Group. +7.2.1. Licensing Obligations to Resulting Specification. If I do not join the Corresponding Working Group, I agree to offer patent licenses according to the W3C Royalty-Free licensing requirements described in Section 5 of the W3C Patent Policy for the portions of the Specification included in the resulting Recommendation. This licensing commitment does not extend to any portion of an implementation of the Recommendation that was not included in the Specification. This licensing commitment may not be revoked but may be modified through the exclusion process defined in Section 4 of the W3C Patent Policy. I am not required to join the Corresponding Working Group to exclude patents from the W3C Royalty-Free licensing commitment, but must otherwise follow the normal exclusion procedures defined by the W3C Patent Policy. The W3C Team will notify me of any Call for Exclusion in the Corresponding Working Group as set forth in Section 4.5 of the W3C Patent Policy. +7.2.2. No Disclosure Obligation. If I do not join the Corresponding Working Group, I have no patent disclosure obligations outside of those set forth in Section 6 of the W3C Patent Policy. +8. Conflict of Interest. I will disclose significant relationships when those relationships might reasonably be perceived as creating a conflict of interest with my role. I will notify W3C of any change in my affiliation using W3C-provided mechanisms. +9. Representations, Warranties and Disclaimers. I represent and warrant that I am legally entitled to grant the rights and promises set forth in this Agreement. IN ALL OTHER RESPECTS THE SPECIFICATION IS PROVIDED “AS IS.” The entire risk as to implementing or otherwise using the Specification is assumed by the implementer and user. Except as stated herein, I expressly disclaim any warranties (express, implied, or otherwise), including implied warranties of merchantability, non-infringement, fitness for a particular purpose, or title, related to the Specification. IN NO EVENT WILL ANY PARTY BE LIABLE TO ANY OTHER PARTY FOR LOST PROFITS OR ANY FORM OF INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER FROM ANY CAUSES OF ACTION OF ANY KIND WITH RESPECT TO THIS AGREEMENT, WHETHER BASED ON BREACH OF CONTRACT, TORT (INCLUDING NEGLIGENCE), OR OTHERWISE, AND WHETHER OR NOT THE OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. All of my obligations under Section 3 regarding the transfer, successors in interest, or assignment of Granted Claims will be satisfied if I notify the transferee or assignee of any patent that I know contains Granted Claims of the obligations under Section 3. Nothing in this Agreement requires me to undertake a patent search. +10. Definitions. +10.1. Agreement. “Agreement” means this W3C Community Final Specification Agreement. +10.2. Corresponding Working Group. “Corresponding Working Group” is a W3C Working Group that is chartered to develop a Recommendation, as defined in the W3C Process Document, that takes the Specification as an input. +10.3. Essential Claims. “Essential Claims” shall mean all claims in any patent or patent application in any jurisdiction in the world that would necessarily be infringed by implementation of the Specification. A claim is necessarily infringed hereunder only when it is not possible to avoid infringing it because there is no non-infringing alternative for implementing the normative portions of the Specification. Existence of a non-infringing alternative shall be judged based on the state of the art at the time of the publication of the Specification. The following are expressly excluded from and shall not be deemed to constitute Essential Claims: +10.3.1. any claims other than as set forth above even if contained in the same patent as Essential Claims; and +10.3.2. claims which would be infringed only by: +portions of an implementation that are not specified in the normative portions of the Specification, or +enabling technologies that may be necessary to make or use any product or portion thereof that complies with the Specification and are not themselves expressly set forth in the Specification (e.g., semiconductor manufacturing technology, compiler technology, object-oriented technology, basic operating system technology, and the like); or +the implementation of technology developed elsewhere and merely incorporated by reference in the body of the Specification. +10.3.3. design patents and design registrations. +For purposes of this definition, the normative portions of the Specification shall be deemed to include only architectural and interoperability requirements. Optional features in the RFC 2119 sense are considered normative unless they are specifically identified as informative. Implementation examples or any other material that merely illustrate the requirements of the Specification are informative, rather than normative. +10.4. I, Me, or My. “I,” “me,” or “my” refers to the signatory. +10.5 Project. “Project” means the W3C Community Group or Business Group for which I executed this Agreement. +10.6. Specification. “Specification” means the Specification identified by the Project as the target of this agreement in a call for Final Specification Commitments. W3C shall provide the authoritative mechanisms for the identification of this Specification. +10.7. W3C Community RF Licensing Requirements. “W3C Community RF Licensing Requirements” license shall mean a non-assignable, non-sublicensable license to make, have made, use, sell, have sold, offer to sell, import, and distribute and dispose of implementations of the Specification that: +10.7.1. shall be available to all, worldwide, whether or not they are W3C Members; +10.7.2. shall extend to all Essential Claims owned or controlled by me; +10.7.3. may be limited to implementations of the Specification, and to what is required by the Specification; +10.7.4. may be conditioned on a grant of a reciprocal RF license (as defined in this policy) to all Essential Claims owned or controlled by the licensee. A reciprocal license may be required to be available to all, and a reciprocal license may itself be conditioned on a further reciprocal license from all. +10.7.5. may not be conditioned on payment of royalties, fees or other consideration; +10.7.6. may be suspended with respect to any licensee when licensor issued by licensee for infringement of claims essential to implement the Specification or any W3C Recommendation; +10.7.7. may not impose any further conditions or restrictions on the use of any technology, intellectual property rights, or other restrictions on behavior of the licensee, but may include reasonable, customary terms relating to operation or maintenance of the license relationship such as the following: choice of law and dispute resolution; +10.7.8. shall not be considered accepted by an implementer who manifests an intent not to accept the terms of the W3C Community RF Licensing Requirements license as offered by the licensor. +10.7.9. The RF license conforming to the requirements in this policy shall be made available by the licensor as long as the Specification is in effect. The term of such license shall be for the life of the patents in question. +I am encouraged to provide a contact from which licensing information can be obtained and other relevant licensing information. Any such information will be made publicly available. +10.8. You or Your. “You,” “you,” or “your” means any person or entity who exercises copyright or patent rights granted under this Agreement, and any person that person or entity controls. + +------------------------------------------------------------------------------------- + +------------------- WebGL ----------------------------- +Copyright (c) 2018 The Khronos Group Inc. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and/or associated documentation files (the +"Materials"), to deal in the Materials without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Materials, and to +permit persons to whom the Materials are furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Materials. + +THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +------------------------------------------------------ + +------------- End of ThirdPartyNotices ------------------------------------------- */ + diff --git a/public/sw.js b/public/sw.js index ade0d1e4..1cf30d48 100644 --- a/public/sw.js +++ b/public/sw.js @@ -9,7 +9,7 @@ // Update this version string manually to keep the app + cache versions in sync. // The value is forwarded to the UI via the service worker "SW_ACTIVATED" message. -const APP_VERSION = "30.0.4"; // update on release +const APP_VERSION = "30.0.5"; // update on release const VERSION = new URL(self.location.href).searchParams.get("v") || APP_VERSION; // derived from build const PREFIX = "PHINETWORK"; const PRECACHE = `${PREFIX}-precache-${VERSION}`; diff --git a/src/version.ts b/src/version.ts index 863b6ce5..5f3443df 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1,7 +1,7 @@ // src/version.ts // Shared PWA version constants so the app shell, SW registration, and UI stay in sync. -export const BASE_APP_VERSION = "30.0.4"; // Canonical offline/PWA version +export const BASE_APP_VERSION = "30.0.5"; // Canonical offline/PWA version export const SW_VERSION_EVENT = "kairos:sw-version"; export const DEFAULT_APP_VERSION = BASE_APP_VERSION; // Keep in sync with public/sw.js const ENV_APP_VERSION = From 72b67ed96c53b822d34ed5aabefee02482730462 Mon Sep 17 00:00:00 2001 From: Kojib <123880127+kojibai@users.noreply.github.com> Date: Mon, 22 Dec 2025 20:45:40 -0500 Subject: [PATCH 02/10] Delete package-lock.json --- package-lock.json | 4880 --------------------------------------------- 1 file changed, 4880 deletions(-) delete mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 6749aeb5..00000000 --- a/package-lock.json +++ /dev/null @@ -1,4880 +0,0 @@ -{ - "name": "verify-kai", - "version": "0.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "verify-kai", - "version": "0.0.0", - "dependencies": { - "@react-three/drei": "^10.7.7", - "@react-three/fiber": "^9.4.0", - "@stripe/react-stripe-js": "^5.4.1", - "@stripe/stripe-js": "^8.5.3", - "blakejs": "^1.2.1", - "buffer": "^6.0.3", - "decimal.js": "^10.6.0", - "fast-xml-parser": "^5.3.2", - "fflate": "^0.8.2", - "framer-motion": "^12.23.25", - "hash-wasm": "^4.12.0", - "html2canvas": "^1.4.1", - "jszip": "^3.10.1", - "lucide-react": "^0.554.0", - "pako": "^2.1.0", - "peerjs": "^1.5.5", - "qrcode": "^1.5.4", - "qrcode-generator": "^2.0.4", - "react": "^19.2.0", - "react-dom": "^19.2.0", - "react-qr-code": "^2.0.18", - "react-router-dom": "^7.9.6", - "recharts": "^3.4.1", - "three": "^0.181.2" - }, - "devDependencies": { - "@eslint/js": "^9.39.1", - "@types/jszip": "^3.4.0", - "@types/node": "^24.10.1", - "@types/pako": "^2.0.4", - "@types/peerjs": "^0.0.30", - "@types/qrcode": "^1.5.6", - "@types/qrcode-generator": "^0.0.16", - "@types/react": "^19.2.2", - "@types/react-dom": "^19.2.2", - "@types/react-router-dom": "^5.3.3", - "@vitejs/plugin-react": "^5.1.0", - "eslint": "^9.39.1", - "eslint-plugin-react-hooks": "^7.0.1", - "eslint-plugin-react-refresh": "^0.4.24", - "globals": "^16.5.0", - "typescript": "~5.9.3", - "typescript-eslint": "^8.46.3", - "vite": "npm:rolldown-vite@7.2.2" - } - }, - "node_modules/@babel/code-frame": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", - "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-validator-identifier": "^7.27.1", - "js-tokens": "^4.0.0", - "picocolors": "^1.1.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/compat-data": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.28.5.tgz", - "integrity": "sha512-6uFXyCayocRbqhZOB+6XcuZbkMNimwfVGFji8CTZnCzOHVGvDqzvitu1re2AU5LROliz7eQPhB8CpAMvnx9EjA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/core": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.5.tgz", - "integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.27.1", - "@babel/generator": "^7.28.5", - "@babel/helper-compilation-targets": "^7.27.2", - "@babel/helper-module-transforms": "^7.28.3", - "@babel/helpers": "^7.28.4", - "@babel/parser": "^7.28.5", - "@babel/template": "^7.27.2", - "@babel/traverse": "^7.28.5", - "@babel/types": "^7.28.5", - "@jridgewell/remapping": "^2.3.5", - "convert-source-map": "^2.0.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.2.3", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/babel" - } - }, - "node_modules/@babel/generator": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.28.5.tgz", - "integrity": "sha512-3EwLFhZ38J4VyIP6WNtt2kUdW9dokXA9Cr4IVIFHuCpZ3H8/YFOl5JjZHisrn1fATPBmKKqXzDFvh9fUwHz6CQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.28.5", - "@babel/types": "^7.28.5", - "@jridgewell/gen-mapping": "^0.3.12", - "@jridgewell/trace-mapping": "^0.3.28", - "jsesc": "^3.0.2" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-compilation-targets": { - "version": "7.27.2", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.2.tgz", - "integrity": "sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/compat-data": "^7.27.2", - "@babel/helper-validator-option": "^7.27.1", - "browserslist": "^4.24.0", - "lru-cache": "^5.1.1", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-globals": { - "version": "7.28.0", - "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz", - "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-imports": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.27.1.tgz", - "integrity": "sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/traverse": "^7.27.1", - "@babel/types": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-transforms": { - "version": "7.28.3", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.3.tgz", - "integrity": "sha512-gytXUbs8k2sXS9PnQptz5o0QnpLL51SwASIORY6XaBKF88nsOT0Zw9szLqlSGQDP/4TljBAD5y98p2U1fqkdsw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-module-imports": "^7.27.1", - "@babel/helper-validator-identifier": "^7.27.1", - "@babel/traverse": "^7.28.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-plugin-utils": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.27.1.tgz", - "integrity": "sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-string-parser": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", - "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", - "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-option": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz", - "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helpers": { - "version": "7.28.4", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.28.4.tgz", - "integrity": "sha512-HFN59MmQXGHVyYadKLVumYsA9dBFun/ldYxipEjzA4196jpLZd8UjEEBLkbEkvfYreDqJhZxYAWFPtrfhNpj4w==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/template": "^7.27.2", - "@babel/types": "^7.28.4" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/parser": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.5.tgz", - "integrity": "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.28.5" - }, - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/plugin-transform-react-jsx-self": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.27.1.tgz", - "integrity": "sha512-6UzkCs+ejGdZ5mFFC/OCUrv028ab2fp1znZmCZjAOBKiBK2jXD1O+BPSfX8X2qjJ75fZBMSnQn3Rq2mrBJK2mw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-react-jsx-source": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.27.1.tgz", - "integrity": "sha512-zbwoTsBruTeKB9hSq73ha66iFeJHuaFkUbwvqElnygoNbj/jHRsSeokowZFN3CZ64IvEqcmmkVe89OPXc7ldAw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/runtime": { - "version": "7.28.4", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.4.tgz", - "integrity": "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ==", - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/template": { - "version": "7.27.2", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.2.tgz", - "integrity": "sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.27.1", - "@babel/parser": "^7.27.2", - "@babel/types": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/traverse": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.28.5.tgz", - "integrity": "sha512-TCCj4t55U90khlYkVV/0TfkJkAkUg3jZFA3Neb7unZT8CPok7iiRfaX0F+WnqWqt7OxhOn0uBKXCw4lbL8W0aQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.27.1", - "@babel/generator": "^7.28.5", - "@babel/helper-globals": "^7.28.0", - "@babel/parser": "^7.28.5", - "@babel/template": "^7.27.2", - "@babel/types": "^7.28.5", - "debug": "^4.3.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/types": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.5.tgz", - "integrity": "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-string-parser": "^7.27.1", - "@babel/helper-validator-identifier": "^7.28.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@dimforge/rapier3d-compat": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/@dimforge/rapier3d-compat/-/rapier3d-compat-0.12.0.tgz", - "integrity": "sha512-uekIGetywIgopfD97oDL5PfeezkFpNhwlzlaEYNOA0N6ghdsOvh/HYjSMek5Q2O1PYvRSDFcqFVJl4r4ZBwOow==", - "license": "Apache-2.0" - }, - "node_modules/@emnapi/core": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.7.1.tgz", - "integrity": "sha512-o1uhUASyo921r2XtHYOHy7gdkGLge8ghBEQHMWmyJFoXlpU58kIrhhN3w26lpQb6dspetweapMn2CSNwQ8I4wg==", - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "@emnapi/wasi-threads": "1.1.0", - "tslib": "^2.4.0" - } - }, - "node_modules/@emnapi/runtime": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.7.1.tgz", - "integrity": "sha512-PVtJr5CmLwYAU9PZDMITZoR5iAOShYREoR45EyyLrbntV50mdePTgUn4AmOw90Ifcj+x2kRjdzr1HP3RrNiHGA==", - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "tslib": "^2.4.0" - } - }, - "node_modules/@emnapi/wasi-threads": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.1.0.tgz", - "integrity": "sha512-WI0DdZ8xFSbgMjR1sFsKABJ/C5OnRrjT06JXbZKexJGrDuPTzZdDYfFlsgcCXCyf+suG5QU2e/y1Wo2V/OapLQ==", - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "tslib": "^2.4.0" - } - }, - "node_modules/@eslint-community/eslint-utils": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.0.tgz", - "integrity": "sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g==", - "dev": true, - "license": "MIT", - "dependencies": { - "eslint-visitor-keys": "^3.4.3" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - }, - "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" - } - }, - "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", - "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@eslint-community/regexpp": { - "version": "4.12.2", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", - "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^12.0.0 || ^14.0.0 || >=16.0.0" - } - }, - "node_modules/@eslint/config-array": { - "version": "0.21.1", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.1.tgz", - "integrity": "sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@eslint/object-schema": "^2.1.7", - "debug": "^4.3.1", - "minimatch": "^3.1.2" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/config-helpers": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz", - "integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@eslint/core": "^0.17.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/core": { - "version": "0.17.0", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz", - "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@types/json-schema": "^7.0.15" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/eslintrc": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.3.tgz", - "integrity": "sha512-Kr+LPIUVKz2qkx1HAMH8q1q6azbqBAsXJUxBl/ODDuVPX45Z9DfwB8tPjTi6nNZ8BuM3nbJxC5zCAg5elnBUTQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^10.0.1", - "globals": "^14.0.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.1", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@eslint/eslintrc/node_modules/globals": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", - "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@eslint/js": { - "version": "9.39.2", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.2.tgz", - "integrity": "sha512-q1mjIoW1VX4IvSocvM/vbTiveKC4k9eLrajNEuSsmjymSDEbpGddtpfOoN7YGAqBK3NG+uqo8ia4PDTt8buCYA==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://eslint.org/donate" - } - }, - "node_modules/@eslint/object-schema": { - "version": "2.1.7", - "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.7.tgz", - "integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/plugin-kit": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.4.1.tgz", - "integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@eslint/core": "^0.17.0", - "levn": "^0.4.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@humanfs/core": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", - "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=18.18.0" - } - }, - "node_modules/@humanfs/node": { - "version": "0.16.7", - "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.7.tgz", - "integrity": "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@humanfs/core": "^0.19.1", - "@humanwhocodes/retry": "^0.4.0" - }, - "engines": { - "node": ">=18.18.0" - } - }, - "node_modules/@humanwhocodes/module-importer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", - "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=12.22" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, - "node_modules/@humanwhocodes/retry": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", - "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=18.18" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.13", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", - "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.0", - "@jridgewell/trace-mapping": "^0.3.24" - } - }, - "node_modules/@jridgewell/remapping": { - "version": "2.3.5", - "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", - "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.24" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", - "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", - "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", - "dev": true, - "license": "MIT" - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.31", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", - "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" - } - }, - "node_modules/@mediapipe/tasks-vision": { - "version": "0.10.17", - "resolved": "https://registry.npmjs.org/@mediapipe/tasks-vision/-/tasks-vision-0.10.17.tgz", - "integrity": "sha512-CZWV/q6TTe8ta61cZXjfnnHsfWIdFhms03M9T7Cnd5y2mdpylJM0rF1qRq+wsQVRMLz1OYPVEBU9ph2Bx8cxrg==", - "license": "Apache-2.0" - }, - "node_modules/@monogrid/gainmap-js": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/@monogrid/gainmap-js/-/gainmap-js-3.4.0.tgz", - "integrity": "sha512-2Z0FATFHaoYJ8b+Y4y4Hgfn3FRFwuU5zRrk+9dFWp4uGAdHGqVEdP7HP+gLA3X469KXHmfupJaUbKo1b/aDKIg==", - "license": "MIT", - "dependencies": { - "promise-worker-transferable": "^1.0.4" - }, - "peerDependencies": { - "three": ">= 0.159.0" - } - }, - "node_modules/@msgpack/msgpack": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/@msgpack/msgpack/-/msgpack-2.8.0.tgz", - "integrity": "sha512-h9u4u/jiIRKbq25PM+zymTyW6bhTzELvOoUd+AvYriWOAKpLGnIamaET3pnHYoI5iYphAHBI4ayx0MehR+VVPQ==", - "license": "ISC", - "engines": { - "node": ">= 10" - } - }, - "node_modules/@napi-rs/wasm-runtime": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.0.tgz", - "integrity": "sha512-Fq6DJW+Bb5jaWE69/qOE0D1TUN9+6uWhCeZpdnSBk14pjLcCWR7Q8n49PTSPHazM37JqrsdpEthXy2xn6jWWiA==", - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "@emnapi/core": "^1.7.1", - "@emnapi/runtime": "^1.7.1", - "@tybys/wasm-util": "^0.10.1" - } - }, - "node_modules/@oxc-project/runtime": { - "version": "0.96.0", - "resolved": "https://registry.npmjs.org/@oxc-project/runtime/-/runtime-0.96.0.tgz", - "integrity": "sha512-34lh4o9CcSw09Hx6fKihPu85+m+4pmDlkXwJrLvN5nMq5JrcGhhihVM415zDqT8j8IixO1PYYdQZRN4SwQCncg==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@oxc-project/types": { - "version": "0.96.0", - "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.96.0.tgz", - "integrity": "sha512-r/xkmoXA0xEpU6UGtn18CNVjXH6erU3KCpCDbpLmbVxBFor1U9MqN5Z2uMmCHJuXjJzlnDR+hWY+yPoLo8oHDw==", - "dev": true, - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/Boshen" - } - }, - "node_modules/@react-three/drei": { - "version": "10.7.7", - "resolved": "https://registry.npmjs.org/@react-three/drei/-/drei-10.7.7.tgz", - "integrity": "sha512-ff+J5iloR0k4tC++QtD/j9u3w5fzfgFAWDtAGQah9pF2B1YgOq/5JxqY0/aVoQG5r3xSZz0cv5tk2YuBob4xEQ==", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.26.0", - "@mediapipe/tasks-vision": "0.10.17", - "@monogrid/gainmap-js": "^3.0.6", - "@use-gesture/react": "^10.3.1", - "camera-controls": "^3.1.0", - "cross-env": "^7.0.3", - "detect-gpu": "^5.0.56", - "glsl-noise": "^0.0.0", - "hls.js": "^1.5.17", - "maath": "^0.10.8", - "meshline": "^3.3.1", - "stats-gl": "^2.2.8", - "stats.js": "^0.17.0", - "suspend-react": "^0.1.3", - "three-mesh-bvh": "^0.8.3", - "three-stdlib": "^2.35.6", - "troika-three-text": "^0.52.4", - "tunnel-rat": "^0.1.2", - "use-sync-external-store": "^1.4.0", - "utility-types": "^3.11.0", - "zustand": "^5.0.1" - }, - "peerDependencies": { - "@react-three/fiber": "^9.0.0", - "react": "^19", - "react-dom": "^19", - "three": ">=0.159" - }, - "peerDependenciesMeta": { - "react-dom": { - "optional": true - } - } - }, - "node_modules/@react-three/fiber": { - "version": "9.4.2", - "resolved": "https://registry.npmjs.org/@react-three/fiber/-/fiber-9.4.2.tgz", - "integrity": "sha512-H4B4+FDNHpvIb4FmphH4ubxOfX5bxmfOw0+3pkQwR9u9wFiyMS7wUDkNn0m4RqQuiLWeia9jfN1eBvtyAVGEog==", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.17.8", - "@types/react-reconciler": "^0.32.0", - "@types/webxr": "*", - "base64-js": "^1.5.1", - "buffer": "^6.0.3", - "its-fine": "^2.0.0", - "react-reconciler": "^0.31.0", - "react-use-measure": "^2.1.7", - "scheduler": "^0.25.0", - "suspend-react": "^0.1.3", - "use-sync-external-store": "^1.4.0", - "zustand": "^5.0.3" - }, - "peerDependencies": { - "expo": ">=43.0", - "expo-asset": ">=8.4", - "expo-file-system": ">=11.0", - "expo-gl": ">=11.0", - "react": "^19.0.0", - "react-dom": "^19.0.0", - "react-native": ">=0.78", - "three": ">=0.156" - }, - "peerDependenciesMeta": { - "expo": { - "optional": true - }, - "expo-asset": { - "optional": true - }, - "expo-file-system": { - "optional": true - }, - "expo-gl": { - "optional": true - }, - "react-dom": { - "optional": true - }, - "react-native": { - "optional": true - } - } - }, - "node_modules/@reduxjs/toolkit": { - "version": "2.11.2", - "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.11.2.tgz", - "integrity": "sha512-Kd6kAHTA6/nUpp8mySPqj3en3dm0tdMIgbttnQ1xFMVpufoj+ADi8pXLBsd4xzTRHQa7t/Jv8W5UnCuW4kuWMQ==", - "license": "MIT", - "dependencies": { - "@standard-schema/spec": "^1.0.0", - "@standard-schema/utils": "^0.3.0", - "immer": "^11.0.0", - "redux": "^5.0.1", - "redux-thunk": "^3.1.0", - "reselect": "^5.1.0" - }, - "peerDependencies": { - "react": "^16.9.0 || ^17.0.0 || ^18 || ^19", - "react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0" - }, - "peerDependenciesMeta": { - "react": { - "optional": true - }, - "react-redux": { - "optional": true - } - } - }, - "node_modules/@reduxjs/toolkit/node_modules/immer": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/immer/-/immer-11.1.0.tgz", - "integrity": "sha512-dlzb07f5LDY+tzs+iLCSXV2yuhaYfezqyZQc+n6baLECWkOMEWxkECAOnXL0ba7lsA25fM9b2jtzpu/uxo1a7g==", - "license": "MIT", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/immer" - } - }, - "node_modules/@rolldown/binding-android-arm64": { - "version": "1.0.0-beta.47", - "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.0.0-beta.47.tgz", - "integrity": "sha512-vPP9/MZzESh9QtmvQYojXP/midjgkkc1E4AdnPPAzQXo668ncHJcVLKjJKzoBdsQmaIvNjrMdsCwES8vTQHRQw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-darwin-arm64": { - "version": "1.0.0-beta.47", - "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.0.0-beta.47.tgz", - "integrity": "sha512-Lc3nrkxeaDVCVl8qR3qoxh6ltDZfkQ98j5vwIr5ALPkgjZtDK4BGCrrBoLpGVMg+csWcaqUbwbKwH5yvVa0oOw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-darwin-x64": { - "version": "1.0.0-beta.47", - "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.0.0-beta.47.tgz", - "integrity": "sha512-eBYxQDwP0O33plqNVqOtUHqRiSYVneAknviM5XMawke3mwMuVlAsohtOqEjbCEl/Loi/FWdVeks5WkqAkzkYWQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-freebsd-x64": { - "version": "1.0.0-beta.47", - "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.0.0-beta.47.tgz", - "integrity": "sha512-Ns+kgp2+1Iq/44bY/Z30DETUSiHY7ZuqaOgD5bHVW++8vme9rdiWsN4yG4rRPXkdgzjvQ9TDHmZZKfY4/G11AA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-linux-arm-gnueabihf": { - "version": "1.0.0-beta.47", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.0.0-beta.47.tgz", - "integrity": "sha512-4PecgWCJhTA2EFOlptYJiNyVP2MrVP4cWdndpOu3WmXqWqZUmSubhb4YUAIxAxnXATlGjC1WjxNPhV7ZllNgdA==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-linux-arm64-gnu": { - "version": "1.0.0-beta.47", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.0.0-beta.47.tgz", - "integrity": "sha512-CyIunZ6D9U9Xg94roQI1INt/bLkOpPsZjZZkiaAZ0r6uccQdICmC99M9RUPlMLw/qg4yEWLlQhG73W/mG437NA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-linux-arm64-musl": { - "version": "1.0.0-beta.47", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.0.0-beta.47.tgz", - "integrity": "sha512-doozc/Goe7qRCSnzfJbFINTHsMktqmZQmweull6hsZZ9sjNWQ6BWQnbvOlfZJe4xE5NxM1NhPnY5Giqnl3ZrYQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-linux-x64-gnu": { - "version": "1.0.0-beta.47", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.0.0-beta.47.tgz", - "integrity": "sha512-fodvSMf6Aqwa0wEUSTPewmmZOD44rc5Tpr5p9NkwQ6W1SSpUKzD3SwpJIgANDOhwiYhDuiIaYPGB7Ujkx1q0UQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-linux-x64-musl": { - "version": "1.0.0-beta.47", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.0.0-beta.47.tgz", - "integrity": "sha512-Rxm5hYc0mGjwLh5sjlGmMygxAaV2gnsx7CNm2lsb47oyt5UQyPDZf3GP/ct8BEcwuikdqzsrrlIp8+kCSvMFNQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-openharmony-arm64": { - "version": "1.0.0-beta.47", - "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.0.0-beta.47.tgz", - "integrity": "sha512-YakuVe+Gc87jjxazBL34hbr8RJpRuFBhun7NEqoChVDlH5FLhLXjAPHqZd990TVGVNkemourf817Z8u2fONS8w==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-wasm32-wasi": { - "version": "1.0.0-beta.47", - "resolved": "https://registry.npmjs.org/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.0.0-beta.47.tgz", - "integrity": "sha512-ak2GvTFQz3UAOw8cuQq8pWE+TNygQB6O47rMhvevvTzETh7VkHRFtRUwJynX5hwzFvQMP6G0az5JrBGuwaMwYQ==", - "cpu": [ - "wasm32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "@napi-rs/wasm-runtime": "^1.0.7" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/@rolldown/binding-win32-arm64-msvc": { - "version": "1.0.0-beta.47", - "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.0.0-beta.47.tgz", - "integrity": "sha512-o5BpmBnXU+Cj+9+ndMcdKjhZlPb79dVPBZnWwMnI4RlNSSq5yOvFZqvfPYbyacvnW03Na4n5XXQAPhu3RydZ0w==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-win32-ia32-msvc": { - "version": "1.0.0-beta.47", - "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-1.0.0-beta.47.tgz", - "integrity": "sha512-FVOmfyYehNE92IfC9Kgs913UerDog2M1m+FADJypKz0gmRg3UyTt4o1cZMCAl7MiR89JpM9jegNO1nXuP1w1vw==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-win32-x64-msvc": { - "version": "1.0.0-beta.47", - "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.0.0-beta.47.tgz", - "integrity": "sha512-by/70F13IUE101Bat0oeH8miwWX5mhMFPk1yjCdxoTNHTyTdLgb0THNaebRM6AP7Kz+O3O2qx87sruYuF5UxHg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/pluginutils": { - "version": "1.0.0-beta.53", - "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.53.tgz", - "integrity": "sha512-vENRlFU4YbrwVqNDZ7fLvy+JR1CRkyr01jhSiDpE1u6py3OMzQfztQU2jxykW3ALNxO4kSlqIDeYyD0Y9RcQeQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/@standard-schema/spec": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", - "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", - "license": "MIT" - }, - "node_modules/@standard-schema/utils": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@standard-schema/utils/-/utils-0.3.0.tgz", - "integrity": "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g==", - "license": "MIT" - }, - "node_modules/@stripe/react-stripe-js": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/@stripe/react-stripe-js/-/react-stripe-js-5.4.1.tgz", - "integrity": "sha512-ipeYcAHa4EPmjwfv0lFE+YDVkOQ0TMKkFWamW+BqmnSkEln/hO8rmxGPPWcd9WjqABx6Ro8Xg4pAS7evCcR9cw==", - "license": "MIT", - "dependencies": { - "prop-types": "^15.7.2" - }, - "peerDependencies": { - "@stripe/stripe-js": ">=8.0.0 <9.0.0", - "react": ">=16.8.0 <20.0.0", - "react-dom": ">=16.8.0 <20.0.0" - } - }, - "node_modules/@stripe/stripe-js": { - "version": "8.6.0", - "resolved": "https://registry.npmjs.org/@stripe/stripe-js/-/stripe-js-8.6.0.tgz", - "integrity": "sha512-EB0/GGgs4hfezzkiMkinlRgWtjz8fSdwVQhwYS7Sg/RQrSvuNOz+ssPjD+lAzqaYTCB0zlbrt0fcqVziLJrufQ==", - "license": "MIT", - "engines": { - "node": ">=12.16" - } - }, - "node_modules/@tweenjs/tween.js": { - "version": "23.1.3", - "resolved": "https://registry.npmjs.org/@tweenjs/tween.js/-/tween.js-23.1.3.tgz", - "integrity": "sha512-vJmvvwFxYuGnF2axRtPYocag6Clbb5YS7kLL+SO/TeVFzHqDIWrNKYtcsPMibjDx9O+bu+psAy9NKfWklassUA==", - "license": "MIT" - }, - "node_modules/@tybys/wasm-util": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.1.tgz", - "integrity": "sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==", - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "tslib": "^2.4.0" - } - }, - "node_modules/@types/babel__core": { - "version": "7.20.5", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", - "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.20.7", - "@babel/types": "^7.20.7", - "@types/babel__generator": "*", - "@types/babel__template": "*", - "@types/babel__traverse": "*" - } - }, - "node_modules/@types/babel__generator": { - "version": "7.27.0", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz", - "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__template": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", - "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__traverse": { - "version": "7.28.0", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz", - "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.28.2" - } - }, - "node_modules/@types/d3-array": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/@types/d3-array/-/d3-array-3.2.2.tgz", - "integrity": "sha512-hOLWVbm7uRza0BYXpIIW5pxfrKe0W+D5lrFiAEYR+pb6w3N2SwSMaJbXdUfSEv+dT4MfHBLtn5js0LAWaO6otw==", - "license": "MIT" - }, - "node_modules/@types/d3-color": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.3.tgz", - "integrity": "sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==", - "license": "MIT" - }, - "node_modules/@types/d3-ease": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@types/d3-ease/-/d3-ease-3.0.2.tgz", - "integrity": "sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA==", - "license": "MIT" - }, - "node_modules/@types/d3-interpolate": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-3.0.4.tgz", - "integrity": "sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA==", - "license": "MIT", - "dependencies": { - "@types/d3-color": "*" - } - }, - "node_modules/@types/d3-path": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.1.1.tgz", - "integrity": "sha512-VMZBYyQvbGmWyWVea0EHs/BwLgxc+MKi1zLDCONksozI4YJMcTt8ZEuIR4Sb1MMTE8MMW49v0IwI5+b7RmfWlg==", - "license": "MIT" - }, - "node_modules/@types/d3-scale": { - "version": "4.0.9", - "resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.9.tgz", - "integrity": "sha512-dLmtwB8zkAeO/juAMfnV+sItKjlsw2lKdZVVy6LRr0cBmegxSABiLEpGVmSJJ8O08i4+sGR6qQtb6WtuwJdvVw==", - "license": "MIT", - "dependencies": { - "@types/d3-time": "*" - } - }, - "node_modules/@types/d3-shape": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-3.1.7.tgz", - "integrity": "sha512-VLvUQ33C+3J+8p+Daf+nYSOsjB4GXp19/S/aGo60m9h1v6XaxjiT82lKVWJCfzhtuZ3yD7i/TPeC/fuKLLOSmg==", - "license": "MIT", - "dependencies": { - "@types/d3-path": "*" - } - }, - "node_modules/@types/d3-time": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.4.tgz", - "integrity": "sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g==", - "license": "MIT" - }, - "node_modules/@types/d3-timer": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-3.0.2.tgz", - "integrity": "sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw==", - "license": "MIT" - }, - "node_modules/@types/draco3d": { - "version": "1.4.10", - "resolved": "https://registry.npmjs.org/@types/draco3d/-/draco3d-1.4.10.tgz", - "integrity": "sha512-AX22jp8Y7wwaBgAixaSvkoG4M/+PlAcm3Qs4OW8yT9DM4xUpWKeFhLueTAyZF39pviAdcDdeJoACapiAceqNcw==", - "license": "MIT" - }, - "node_modules/@types/estree": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", - "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/history": { - "version": "4.7.11", - "resolved": "https://registry.npmjs.org/@types/history/-/history-4.7.11.tgz", - "integrity": "sha512-qjDJRrmvBMiTx+jyLxvLfJU7UznFuokDv4f3WRuriHKERccVpFU+8XMQUAbDzoiJCsmexxRExQeMwwCdamSKDA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/json-schema": { - "version": "7.0.15", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", - "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/jszip": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/@types/jszip/-/jszip-3.4.0.tgz", - "integrity": "sha512-GFHqtQQP3R4NNuvZH3hNCYD0NbyBZ42bkN7kO3NDrU/SnvIZWMS8Bp38XCsRKBT5BXvgm0y1zqpZWp/ZkRzBzg==", - "dev": true, - "license": "MIT", - "dependencies": { - "jszip": "*" - } - }, - "node_modules/@types/node": { - "version": "24.10.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.4.tgz", - "integrity": "sha512-vnDVpYPMzs4wunl27jHrfmwojOGKya0xyM3sH+UE5iv5uPS6vX7UIoh6m+vQc5LGBq52HBKPIn/zcSZVzeDEZg==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~7.16.0" - } - }, - "node_modules/@types/offscreencanvas": { - "version": "2019.7.3", - "resolved": "https://registry.npmjs.org/@types/offscreencanvas/-/offscreencanvas-2019.7.3.tgz", - "integrity": "sha512-ieXiYmgSRXUDeOntE1InxjWyvEelZGP63M+cGuquuRLuIKKT1osnkXjxev9B7d1nXSug5vpunx+gNlbVxMlC9A==", - "license": "MIT" - }, - "node_modules/@types/pako": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@types/pako/-/pako-2.0.4.tgz", - "integrity": "sha512-VWDCbrLeVXJM9fihYodcLiIv0ku+AlOa/TQ1SvYOaBuyrSKgEcro95LJyIsJ4vSo6BXIxOKxiJAat04CmST9Fw==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/peerjs": { - "version": "0.0.30", - "resolved": "https://registry.npmjs.org/@types/peerjs/-/peerjs-0.0.30.tgz", - "integrity": "sha512-yaWnpWhbf6qV3bJFRK3NLY3oX34J7/JMAXYahRNLSeDODCC/pHxF/9wSc3GtpA9DQF7dpeejDPkCdUp9knxVHg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/webrtc": "*" - } - }, - "node_modules/@types/qrcode": { - "version": "1.5.6", - "resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.5.6.tgz", - "integrity": "sha512-te7NQcV2BOvdj2b1hCAHzAoMNuj65kNBMz0KBaxM6c3VGBOhU0dURQKOtH8CFNI/dsKkwlv32p26qYQTWoB5bw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/qrcode-generator": { - "version": "0.0.16", - "resolved": "https://registry.npmjs.org/@types/qrcode-generator/-/qrcode-generator-0.0.16.tgz", - "integrity": "sha512-i+wPpeHH64qJHUIz51+tPq5FRkgMxE9/uhDE5eSlj3qujIjHm3U1wHfy8nMD/m1VKaXHO/uDjHamPVz2Fr4IPA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/react": { - "version": "19.2.7", - "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.7.tgz", - "integrity": "sha512-MWtvHrGZLFttgeEj28VXHxpmwYbor/ATPYbBfSFZEIRK0ecCFLl2Qo55z52Hss+UV9CRN7trSeq1zbgx7YDWWg==", - "license": "MIT", - "dependencies": { - "csstype": "^3.2.2" - } - }, - "node_modules/@types/react-dom": { - "version": "19.2.3", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.3.tgz", - "integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "@types/react": "^19.2.0" - } - }, - "node_modules/@types/react-reconciler": { - "version": "0.32.3", - "resolved": "https://registry.npmjs.org/@types/react-reconciler/-/react-reconciler-0.32.3.tgz", - "integrity": "sha512-cMi5ZrLG7UtbL7LTK6hq9w/EZIRk4Mf1Z5qHoI+qBh7/WkYkFXQ7gOto2yfUvPzF5ERMAhaXS5eTQ2SAnHjLzA==", - "license": "MIT", - "peerDependencies": { - "@types/react": "*" - } - }, - "node_modules/@types/react-router": { - "version": "5.1.20", - "resolved": "https://registry.npmjs.org/@types/react-router/-/react-router-5.1.20.tgz", - "integrity": "sha512-jGjmu/ZqS7FjSH6owMcD5qpq19+1RS9DeVRqfl1FeBMxTDQAGwlMWOcs52NDoXaNKyG3d1cYQFMs9rCrb88o9Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/history": "^4.7.11", - "@types/react": "*" - } - }, - "node_modules/@types/react-router-dom": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/@types/react-router-dom/-/react-router-dom-5.3.3.tgz", - "integrity": "sha512-kpqnYK4wcdm5UaWI3fLcELopqLrHgLqNsdpHauzlQktfkHL3npOSwtj1Uz9oKBAzs7lFtVkV8j83voAz2D8fhw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/history": "^4.7.11", - "@types/react": "*", - "@types/react-router": "*" - } - }, - "node_modules/@types/stats.js": { - "version": "0.17.4", - "resolved": "https://registry.npmjs.org/@types/stats.js/-/stats.js-0.17.4.tgz", - "integrity": "sha512-jIBvWWShCvlBqBNIZt0KAshWpvSjhkwkEu4ZUcASoAvhmrgAUI2t1dXrjSL4xXVLB4FznPrIsX3nKXFl/Dt4vA==", - "license": "MIT" - }, - "node_modules/@types/three": { - "version": "0.182.0", - "resolved": "https://registry.npmjs.org/@types/three/-/three-0.182.0.tgz", - "integrity": "sha512-WByN9V3Sbwbe2OkWuSGyoqQO8Du6yhYaXtXLoA5FkKTUJorZ+yOHBZ35zUUPQXlAKABZmbYp5oAqpA4RBjtJ/Q==", - "license": "MIT", - "dependencies": { - "@dimforge/rapier3d-compat": "~0.12.0", - "@tweenjs/tween.js": "~23.1.3", - "@types/stats.js": "*", - "@types/webxr": ">=0.5.17", - "@webgpu/types": "*", - "fflate": "~0.8.2", - "meshoptimizer": "~0.22.0" - } - }, - "node_modules/@types/use-sync-external-store": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.6.tgz", - "integrity": "sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg==", - "license": "MIT" - }, - "node_modules/@types/webrtc": { - "version": "0.0.47", - "resolved": "https://registry.npmjs.org/@types/webrtc/-/webrtc-0.0.47.tgz", - "integrity": "sha512-l4G2skp32Q7ENiocokNhIHG6dKfws9ALJ04zW+ZZ97LMe6G+yqs/E8qsJLZJELGcdUDgEWvi2jg7KSP5TpJxeg==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/webxr": { - "version": "0.5.24", - "resolved": "https://registry.npmjs.org/@types/webxr/-/webxr-0.5.24.tgz", - "integrity": "sha512-h8fgEd/DpoS9CBrjEQXR+dIDraopAEfu4wYVNY2tEPwk60stPWhvZMf4Foo5FakuQ7HFZoa8WceaWFervK2Ovg==", - "license": "MIT" - }, - "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.50.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.50.1.tgz", - "integrity": "sha512-PKhLGDq3JAg0Jk/aK890knnqduuI/Qj+udH7wCf0217IGi4gt+acgCyPVe79qoT+qKUvHMDQkwJeKW9fwl8Cyw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.50.1", - "@typescript-eslint/type-utils": "8.50.1", - "@typescript-eslint/utils": "8.50.1", - "@typescript-eslint/visitor-keys": "8.50.1", - "ignore": "^7.0.0", - "natural-compare": "^1.4.0", - "ts-api-utils": "^2.1.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "@typescript-eslint/parser": "^8.50.1", - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <6.0.0" - } - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", - "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4" - } - }, - "node_modules/@typescript-eslint/parser": { - "version": "8.50.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.50.1.tgz", - "integrity": "sha512-hM5faZwg7aVNa819m/5r7D0h0c9yC4DUlWAOvHAtISdFTc8xB86VmX5Xqabrama3wIPJ/q9RbGS1worb6JfnMg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/scope-manager": "8.50.1", - "@typescript-eslint/types": "8.50.1", - "@typescript-eslint/typescript-estree": "8.50.1", - "@typescript-eslint/visitor-keys": "8.50.1", - "debug": "^4.3.4" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <6.0.0" - } - }, - "node_modules/@typescript-eslint/project-service": { - "version": "8.50.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.50.1.tgz", - "integrity": "sha512-E1ur1MCVf+YiP89+o4Les/oBAVzmSbeRB0MQLfSlYtbWU17HPxZ6Bhs5iYmKZRALvEuBoXIZMOIRRc/P++Ortg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/tsconfig-utils": "^8.50.1", - "@typescript-eslint/types": "^8.50.1", - "debug": "^4.3.4" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "typescript": ">=4.8.4 <6.0.0" - } - }, - "node_modules/@typescript-eslint/scope-manager": { - "version": "8.50.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.50.1.tgz", - "integrity": "sha512-mfRx06Myt3T4vuoHaKi8ZWNTPdzKPNBhiblze5N50//TSHOAQQevl/aolqA/BcqqbJ88GUnLqjjcBc8EWdBcVw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/types": "8.50.1", - "@typescript-eslint/visitor-keys": "8.50.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/tsconfig-utils": { - "version": "8.50.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.50.1.tgz", - "integrity": "sha512-ooHmotT/lCWLXi55G4mvaUF60aJa012QzvLK0Y+Mp4WdSt17QhMhWOaBWeGTFVkb2gDgBe19Cxy1elPXylslDw==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "typescript": ">=4.8.4 <6.0.0" - } - }, - "node_modules/@typescript-eslint/type-utils": { - "version": "8.50.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.50.1.tgz", - "integrity": "sha512-7J3bf022QZE42tYMO6SL+6lTPKFk/WphhRPe9Tw/el+cEwzLz1Jjz2PX3GtGQVxooLDKeMVmMt7fWpYRdG5Etg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/types": "8.50.1", - "@typescript-eslint/typescript-estree": "8.50.1", - "@typescript-eslint/utils": "8.50.1", - "debug": "^4.3.4", - "ts-api-utils": "^2.1.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <6.0.0" - } - }, - "node_modules/@typescript-eslint/types": { - "version": "8.50.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.50.1.tgz", - "integrity": "sha512-v5lFIS2feTkNyMhd7AucE/9j/4V9v5iIbpVRncjk/K0sQ6Sb+Np9fgYS/63n6nwqahHQvbmujeBL7mp07Q9mlA==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.50.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.50.1.tgz", - "integrity": "sha512-woHPdW+0gj53aM+cxchymJCrh0cyS7BTIdcDxWUNsclr9VDkOSbqC13juHzxOmQ22dDkMZEpZB+3X1WpUvzgVQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/project-service": "8.50.1", - "@typescript-eslint/tsconfig-utils": "8.50.1", - "@typescript-eslint/types": "8.50.1", - "@typescript-eslint/visitor-keys": "8.50.1", - "debug": "^4.3.4", - "minimatch": "^9.0.4", - "semver": "^7.6.0", - "tinyglobby": "^0.2.15", - "ts-api-utils": "^2.1.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "typescript": ">=4.8.4 <6.0.0" - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", - "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { - "version": "7.7.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", - "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@typescript-eslint/utils": { - "version": "8.50.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.50.1.tgz", - "integrity": "sha512-lCLp8H1T9T7gPbEuJSnHwnSuO9mDf8mfK/Nion5mZmiEaQD9sWf9W4dfeFqRyqRjF06/kBuTmAqcs9sewM2NbQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@eslint-community/eslint-utils": "^4.7.0", - "@typescript-eslint/scope-manager": "8.50.1", - "@typescript-eslint/types": "8.50.1", - "@typescript-eslint/typescript-estree": "8.50.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <6.0.0" - } - }, - "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.50.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.50.1.tgz", - "integrity": "sha512-IrDKrw7pCRUR94zeuCSUWQ+w8JEf5ZX5jl/e6AHGSLi1/zIr0lgutfn/7JpfCey+urpgQEdrZVYzCaVVKiTwhQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/types": "8.50.1", - "eslint-visitor-keys": "^4.2.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@use-gesture/core": { - "version": "10.3.1", - "resolved": "https://registry.npmjs.org/@use-gesture/core/-/core-10.3.1.tgz", - "integrity": "sha512-WcINiDt8WjqBdUXye25anHiNxPc0VOrlT8F6LLkU6cycrOGUDyY/yyFmsg3k8i5OLvv25llc0QC45GhR/C8llw==", - "license": "MIT" - }, - "node_modules/@use-gesture/react": { - "version": "10.3.1", - "resolved": "https://registry.npmjs.org/@use-gesture/react/-/react-10.3.1.tgz", - "integrity": "sha512-Yy19y6O2GJq8f7CHf7L0nxL8bf4PZCPaVOCgJrusOeFHY1LvHgYXnmnXg6N5iwAnbgbZCDjo60SiM6IPJi9C5g==", - "license": "MIT", - "dependencies": { - "@use-gesture/core": "10.3.1" - }, - "peerDependencies": { - "react": ">= 16.8.0" - } - }, - "node_modules/@vitejs/plugin-react": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-5.1.2.tgz", - "integrity": "sha512-EcA07pHJouywpzsoTUqNh5NwGayl2PPVEJKUSinGGSxFGYn+shYbqMGBg6FXDqgXum9Ou/ecb+411ssw8HImJQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/core": "^7.28.5", - "@babel/plugin-transform-react-jsx-self": "^7.27.1", - "@babel/plugin-transform-react-jsx-source": "^7.27.1", - "@rolldown/pluginutils": "1.0.0-beta.53", - "@types/babel__core": "^7.20.5", - "react-refresh": "^0.18.0" - }, - "engines": { - "node": "^20.19.0 || >=22.12.0" - }, - "peerDependencies": { - "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" - } - }, - "node_modules/@webgpu/types": { - "version": "0.1.68", - "resolved": "https://registry.npmjs.org/@webgpu/types/-/types-0.1.68.tgz", - "integrity": "sha512-3ab1B59Ojb6RwjOspYLsTpCzbNB3ZaamIAxBMmvnNkiDoLTZUOBXZ9p5nAYVEkQlDdf6qAZWi1pqj9+ypiqznA==", - "license": "BSD-3-Clause" - }, - "node_modules/acorn": { - "version": "8.15.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", - "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", - "dev": true, - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-jsx": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, - "node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true, - "license": "Python-2.0" - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true, - "license": "MIT" - }, - "node_modules/base64-arraybuffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz", - "integrity": "sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==", - "license": "MIT", - "engines": { - "node": ">= 0.6.0" - } - }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/baseline-browser-mapping": { - "version": "2.9.11", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.11.tgz", - "integrity": "sha512-Sg0xJUNDU1sJNGdfGWhVHX0kkZ+HWcvmVymJbj6NSgZZmW/8S9Y2HQ5euytnIgakgxN6papOAWiwDo1ctFDcoQ==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "baseline-browser-mapping": "dist/cli.js" - } - }, - "node_modules/bidi-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/bidi-js/-/bidi-js-1.0.3.tgz", - "integrity": "sha512-RKshQI1R3YQ+n9YJz2QQ147P66ELpa1FQEg20Dk8oW9t2KgLbpDLLp9aGZ7y8WHSshDknG0bknqGw5/tyCs5tw==", - "license": "MIT", - "dependencies": { - "require-from-string": "^2.0.2" - } - }, - "node_modules/blakejs": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", - "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==", - "license": "MIT" - }, - "node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/browserslist": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.1.tgz", - "integrity": "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "baseline-browser-mapping": "^2.9.0", - "caniuse-lite": "^1.0.30001759", - "electron-to-chromium": "^1.5.263", - "node-releases": "^2.0.27", - "update-browserslist-db": "^1.2.0" - }, - "bin": { - "browserslist": "cli.js" - }, - "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - } - }, - "node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "node_modules/callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/camera-controls": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/camera-controls/-/camera-controls-3.1.2.tgz", - "integrity": "sha512-xkxfpG2ECZ6Ww5/9+kf4mfg1VEYAoe9aDSY+IwF0UEs7qEzwy0aVRfs2grImIECs/PoBtWFrh7RXsQkwG922JA==", - "license": "MIT", - "engines": { - "node": ">=22.0.0", - "npm": ">=10.5.1" - }, - "peerDependencies": { - "three": ">=0.126.1" - } - }, - "node_modules/caniuse-lite": { - "version": "1.0.30001761", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001761.tgz", - "integrity": "sha512-JF9ptu1vP2coz98+5051jZ4PwQgd2ni8A+gYSN7EA7dPKIMf0pDlSUxhdmVOaV3/fYK5uWBkgSXJaRLr4+3A6g==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "CC-BY-4.0" - }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/cliui": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", - "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", - "license": "ISC", - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" - } - }, - "node_modules/clsx": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", - "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "license": "MIT" - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true, - "license": "MIT" - }, - "node_modules/convert-source-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", - "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", - "dev": true, - "license": "MIT" - }, - "node_modules/cookie": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz", - "integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==", - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/core-util-is": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", - "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", - "license": "MIT" - }, - "node_modules/cross-env": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", - "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", - "license": "MIT", - "dependencies": { - "cross-spawn": "^7.0.1" - }, - "bin": { - "cross-env": "src/bin/cross-env.js", - "cross-env-shell": "src/bin/cross-env-shell.js" - }, - "engines": { - "node": ">=10.14", - "npm": ">=6", - "yarn": ">=1" - } - }, - "node_modules/cross-spawn": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", - "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", - "license": "MIT", - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/css-line-break": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/css-line-break/-/css-line-break-2.1.0.tgz", - "integrity": "sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==", - "license": "MIT", - "dependencies": { - "utrie": "^1.0.2" - } - }, - "node_modules/csstype": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", - "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", - "license": "MIT" - }, - "node_modules/d3-array": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz", - "integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==", - "license": "ISC", - "dependencies": { - "internmap": "1 - 2" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/d3-color": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz", - "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==", - "license": "ISC", - "engines": { - "node": ">=12" - } - }, - "node_modules/d3-ease": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz", - "integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==", - "license": "BSD-3-Clause", - "engines": { - "node": ">=12" - } - }, - "node_modules/d3-format": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.0.tgz", - "integrity": "sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==", - "license": "ISC", - "engines": { - "node": ">=12" - } - }, - "node_modules/d3-interpolate": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz", - "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==", - "license": "ISC", - "dependencies": { - "d3-color": "1 - 3" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/d3-path": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz", - "integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==", - "license": "ISC", - "engines": { - "node": ">=12" - } - }, - "node_modules/d3-scale": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz", - "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==", - "license": "ISC", - "dependencies": { - "d3-array": "2.10.0 - 3", - "d3-format": "1 - 3", - "d3-interpolate": "1.2.0 - 3", - "d3-time": "2.1.1 - 3", - "d3-time-format": "2 - 4" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/d3-shape": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz", - "integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==", - "license": "ISC", - "dependencies": { - "d3-path": "^3.1.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/d3-time": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz", - "integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==", - "license": "ISC", - "dependencies": { - "d3-array": "2 - 3" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/d3-time-format": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz", - "integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==", - "license": "ISC", - "dependencies": { - "d3-time": "1 - 3" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/d3-timer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz", - "integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==", - "license": "ISC", - "engines": { - "node": ">=12" - } - }, - "node_modules/debug": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", - "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/decimal.js": { - "version": "10.6.0", - "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", - "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==", - "license": "MIT" - }, - "node_modules/decimal.js-light": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/decimal.js-light/-/decimal.js-light-2.5.1.tgz", - "integrity": "sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg==", - "license": "MIT" - }, - "node_modules/deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/detect-gpu": { - "version": "5.0.70", - "resolved": "https://registry.npmjs.org/detect-gpu/-/detect-gpu-5.0.70.tgz", - "integrity": "sha512-bqerEP1Ese6nt3rFkwPnGbsUF9a4q+gMmpTVVOEzoCyeCc+y7/RvJnQZJx1JwhgQI5Ntg0Kgat8Uu7XpBqnz1w==", - "license": "MIT", - "dependencies": { - "webgl-constants": "^1.1.1" - } - }, - "node_modules/detect-libc": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", - "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=8" - } - }, - "node_modules/dijkstrajs": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.3.tgz", - "integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==", - "license": "MIT" - }, - "node_modules/draco3d": { - "version": "1.5.7", - "resolved": "https://registry.npmjs.org/draco3d/-/draco3d-1.5.7.tgz", - "integrity": "sha512-m6WCKt/erDXcw+70IJXnG7M3awwQPAsZvJGX5zY7beBqpELw6RDGkYVU0W43AFxye4pDZ5i2Lbyc/NNGqwjUVQ==", - "license": "Apache-2.0" - }, - "node_modules/electron-to-chromium": { - "version": "1.5.267", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.267.tgz", - "integrity": "sha512-0Drusm6MVRXSOJpGbaSVgcQsuB4hEkMpHXaVstcPmhu5LIedxs1xNK/nIxmQIU/RPC0+1/o0AVZfBTkTNJOdUw==", - "dev": true, - "license": "ISC" - }, - "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "license": "MIT" - }, - "node_modules/es-toolkit": { - "version": "1.43.0", - "resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.43.0.tgz", - "integrity": "sha512-SKCT8AsWvYzBBuUqMk4NPwFlSdqLpJwmy6AP322ERn8W2YLIB6JBXnwMI2Qsh2gfphT3q7EKAxKb23cvFHFwKA==", - "license": "MIT", - "workspaces": [ - "docs", - "benchmarks" - ] - }, - "node_modules/escalade": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", - "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint": { - "version": "9.39.2", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.2.tgz", - "integrity": "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@eslint-community/eslint-utils": "^4.8.0", - "@eslint-community/regexpp": "^4.12.1", - "@eslint/config-array": "^0.21.1", - "@eslint/config-helpers": "^0.4.2", - "@eslint/core": "^0.17.0", - "@eslint/eslintrc": "^3.3.1", - "@eslint/js": "9.39.2", - "@eslint/plugin-kit": "^0.4.1", - "@humanfs/node": "^0.16.6", - "@humanwhocodes/module-importer": "^1.0.1", - "@humanwhocodes/retry": "^0.4.2", - "@types/estree": "^1.0.6", - "ajv": "^6.12.4", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.6", - "debug": "^4.3.2", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^8.4.0", - "eslint-visitor-keys": "^4.2.1", - "espree": "^10.4.0", - "esquery": "^1.5.0", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^8.0.0", - "find-up": "^5.0.0", - "glob-parent": "^6.0.2", - "ignore": "^5.2.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.3" - }, - "bin": { - "eslint": "bin/eslint.js" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://eslint.org/donate" - }, - "peerDependencies": { - "jiti": "*" - }, - "peerDependenciesMeta": { - "jiti": { - "optional": true - } - } - }, - "node_modules/eslint-plugin-react-hooks": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-7.0.1.tgz", - "integrity": "sha512-O0d0m04evaNzEPoSW+59Mezf8Qt0InfgGIBJnpC0h3NH/WjUAR7BIKUfysC6todmtiZ/A0oUVS8Gce0WhBrHsA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/core": "^7.24.4", - "@babel/parser": "^7.24.4", - "hermes-parser": "^0.25.1", - "zod": "^3.25.0 || ^4.0.0", - "zod-validation-error": "^3.5.0 || ^4.0.0" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0" - } - }, - "node_modules/eslint-plugin-react-refresh": { - "version": "0.4.26", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.26.tgz", - "integrity": "sha512-1RETEylht2O6FM/MvgnyvT+8K21wLqDNg4qD51Zj3guhjt433XbnnkVttHMyaVyAFD03QSV4LPS5iE3VQmO7XQ==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "eslint": ">=8.40" - } - }, - "node_modules/eslint-scope": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", - "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint-visitor-keys": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", - "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/espree": { - "version": "10.4.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", - "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "acorn": "^8.15.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^4.2.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/esquery": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", - "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "estraverse": "^5.1.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "estraverse": "^5.2.0" - }, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=4.0" - } - }, - "node_modules/esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/eventemitter3": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", - "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", - "license": "MIT" - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true, - "license": "MIT" - }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true, - "license": "MIT" - }, - "node_modules/fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", - "dev": true, - "license": "MIT" - }, - "node_modules/fast-xml-parser": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.3.3.tgz", - "integrity": "sha512-2O3dkPAAC6JavuMm8+4+pgTk+5hoAs+CjZ+sWcQLkX9+/tHRuTkQh/Oaifr8qDmZ8iEHb771Ea6G8CdwkrgvYA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/NaturalIntelligence" - } - ], - "license": "MIT", - "dependencies": { - "strnum": "^2.1.0" - }, - "bin": { - "fxparser": "src/cli/cli.js" - } - }, - "node_modules/fdir": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", - "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } - } - }, - "node_modules/fflate": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.2.tgz", - "integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==", - "license": "MIT" - }, - "node_modules/file-entry-cache": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", - "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "flat-cache": "^4.0.0" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/flat-cache": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", - "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", - "dev": true, - "license": "MIT", - "dependencies": { - "flatted": "^3.2.9", - "keyv": "^4.5.4" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/flatted": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", - "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", - "dev": true, - "license": "ISC" - }, - "node_modules/framer-motion": { - "version": "12.23.26", - "resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-12.23.26.tgz", - "integrity": "sha512-cPcIhgR42xBn1Uj+PzOyheMtZ73H927+uWPDVhUMqxy8UHt6Okavb6xIz9J/phFUHUj0OncR6UvMfJTXoc/LKA==", - "license": "MIT", - "dependencies": { - "motion-dom": "^12.23.23", - "motion-utils": "^12.23.6", - "tslib": "^2.4.0" - }, - "peerDependencies": { - "@emotion/is-prop-valid": "*", - "react": "^18.0.0 || ^19.0.0", - "react-dom": "^18.0.0 || ^19.0.0" - }, - "peerDependenciesMeta": { - "@emotion/is-prop-valid": { - "optional": true - }, - "react": { - "optional": true - }, - "react-dom": { - "optional": true - } - } - }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/gensync": { - "version": "1.0.0-beta.2", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", - "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "license": "ISC", - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.3" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/globals": { - "version": "16.5.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-16.5.0.tgz", - "integrity": "sha512-c/c15i26VrJ4IRt5Z89DnIzCGDn9EcebibhAOjw5ibqEHsE1wLUgkPn9RDmNcUKyU87GeaL633nyJ+pplFR2ZQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/glsl-noise": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/glsl-noise/-/glsl-noise-0.0.0.tgz", - "integrity": "sha512-b/ZCF6amfAUb7dJM/MxRs7AetQEahYzJ8PtgfrmEdtw6uyGOr+ZSGtgjFm6mfsBkxJ4d2W7kg+Nlqzqvn3Bc0w==", - "license": "MIT" - }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/hash-wasm": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/hash-wasm/-/hash-wasm-4.12.0.tgz", - "integrity": "sha512-+/2B2rYLb48I/evdOIhP+K/DD2ca2fgBjp6O+GBEnCDk2e4rpeXIK8GvIyRPjTezgmWn9gmKwkQjjx6BtqDHVQ==", - "license": "MIT" - }, - "node_modules/hermes-estree": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/hermes-estree/-/hermes-estree-0.25.1.tgz", - "integrity": "sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw==", - "dev": true, - "license": "MIT" - }, - "node_modules/hermes-parser": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/hermes-parser/-/hermes-parser-0.25.1.tgz", - "integrity": "sha512-6pEjquH3rqaI6cYAXYPcz9MS4rY6R4ngRgrgfDshRptUZIc3lw0MCIJIGDj9++mfySOuPTHB4nrSW99BCvOPIA==", - "dev": true, - "license": "MIT", - "dependencies": { - "hermes-estree": "0.25.1" - } - }, - "node_modules/hls.js": { - "version": "1.6.15", - "resolved": "https://registry.npmjs.org/hls.js/-/hls.js-1.6.15.tgz", - "integrity": "sha512-E3a5VwgXimGHwpRGV+WxRTKeSp2DW5DI5MWv34ulL3t5UNmyJWCQ1KmLEHbYzcfThfXG8amBL+fCYPneGHC4VA==", - "license": "Apache-2.0" - }, - "node_modules/html2canvas": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/html2canvas/-/html2canvas-1.4.1.tgz", - "integrity": "sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==", - "license": "MIT", - "dependencies": { - "css-line-break": "^2.1.0", - "text-segmentation": "^1.0.3" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "BSD-3-Clause" - }, - "node_modules/ignore": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", - "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4" - } - }, - "node_modules/immediate": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", - "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==", - "license": "MIT" - }, - "node_modules/immer": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/immer/-/immer-10.2.0.tgz", - "integrity": "sha512-d/+XTN3zfODyjr89gM3mPq1WNX2B8pYsu7eORitdwyA2sBubnTl3laYlBk4sXY5FUa5qTZGBDPJICVbvqzjlbw==", - "license": "MIT", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/immer" - } - }, - "node_modules/import-fresh": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", - "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8.19" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "license": "ISC" - }, - "node_modules/internmap": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz", - "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==", - "license": "ISC", - "engines": { - "node": ">=12" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-promise": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz", - "integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==", - "license": "MIT" - }, - "node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", - "license": "MIT" - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "license": "ISC" - }, - "node_modules/its-fine": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/its-fine/-/its-fine-2.0.0.tgz", - "integrity": "sha512-KLViCmWx94zOvpLwSlsx6yOCeMhZYaxrJV87Po5k/FoZzcPSahvK5qJ7fYhS61sZi5ikmh2S3Hz55A2l3U69ng==", - "license": "MIT", - "dependencies": { - "@types/react-reconciler": "^0.28.9" - }, - "peerDependencies": { - "react": "^19.0.0" - } - }, - "node_modules/its-fine/node_modules/@types/react-reconciler": { - "version": "0.28.9", - "resolved": "https://registry.npmjs.org/@types/react-reconciler/-/react-reconciler-0.28.9.tgz", - "integrity": "sha512-HHM3nxyUZ3zAylX8ZEyrDNd2XZOnQ0D5XfunJF5FLQnZbHHYq4UWvW1QfelQNXv1ICNkwYhfxjwfnqivYB6bFg==", - "license": "MIT", - "peerDependencies": { - "@types/react": "*" - } - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "license": "MIT" - }, - "node_modules/js-yaml": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", - "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", - "dev": true, - "license": "MIT", - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/jsesc": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", - "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", - "dev": true, - "license": "MIT", - "bin": { - "jsesc": "bin/jsesc" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/json-buffer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", - "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true, - "license": "MIT" - }, - "node_modules/json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", - "dev": true, - "license": "MIT" - }, - "node_modules/json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "dev": true, - "license": "MIT", - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/jszip": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz", - "integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==", - "license": "(MIT OR GPL-3.0-or-later)", - "dependencies": { - "lie": "~3.3.0", - "pako": "~1.0.2", - "readable-stream": "~2.3.6", - "setimmediate": "^1.0.5" - } - }, - "node_modules/jszip/node_modules/pako": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", - "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", - "license": "(MIT AND Zlib)" - }, - "node_modules/keyv": { - "version": "4.5.4", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", - "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", - "dev": true, - "license": "MIT", - "dependencies": { - "json-buffer": "3.0.1" - } - }, - "node_modules/levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/lie": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", - "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", - "license": "MIT", - "dependencies": { - "immediate": "~3.0.5" - } - }, - "node_modules/lightningcss": { - "version": "1.30.2", - "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.30.2.tgz", - "integrity": "sha512-utfs7Pr5uJyyvDETitgsaqSyjCb2qNRAtuqUeWIAKztsOYdcACf2KtARYXg2pSvhkt+9NfoaNY7fxjl6nuMjIQ==", - "dev": true, - "license": "MPL-2.0", - "dependencies": { - "detect-libc": "^2.0.3" - }, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - }, - "optionalDependencies": { - "lightningcss-android-arm64": "1.30.2", - "lightningcss-darwin-arm64": "1.30.2", - "lightningcss-darwin-x64": "1.30.2", - "lightningcss-freebsd-x64": "1.30.2", - "lightningcss-linux-arm-gnueabihf": "1.30.2", - "lightningcss-linux-arm64-gnu": "1.30.2", - "lightningcss-linux-arm64-musl": "1.30.2", - "lightningcss-linux-x64-gnu": "1.30.2", - "lightningcss-linux-x64-musl": "1.30.2", - "lightningcss-win32-arm64-msvc": "1.30.2", - "lightningcss-win32-x64-msvc": "1.30.2" - } - }, - "node_modules/lightningcss-android-arm64": { - "version": "1.30.2", - "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.30.2.tgz", - "integrity": "sha512-BH9sEdOCahSgmkVhBLeU7Hc9DWeZ1Eb6wNS6Da8igvUwAe0sqROHddIlvU06q3WyXVEOYDZ6ykBZQnjTbmo4+A==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MPL-2.0", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-darwin-arm64": { - "version": "1.30.2", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.30.2.tgz", - "integrity": "sha512-ylTcDJBN3Hp21TdhRT5zBOIi73P6/W0qwvlFEk22fkdXchtNTOU4Qc37SkzV+EKYxLouZ6M4LG9NfZ1qkhhBWA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MPL-2.0", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-darwin-x64": { - "version": "1.30.2", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.30.2.tgz", - "integrity": "sha512-oBZgKchomuDYxr7ilwLcyms6BCyLn0z8J0+ZZmfpjwg9fRVZIR5/GMXd7r9RH94iDhld3UmSjBM6nXWM2TfZTQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MPL-2.0", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-freebsd-x64": { - "version": "1.30.2", - "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.30.2.tgz", - "integrity": "sha512-c2bH6xTrf4BDpK8MoGG4Bd6zAMZDAXS569UxCAGcA7IKbHNMlhGQ89eRmvpIUGfKWNVdbhSbkQaWhEoMGmGslA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MPL-2.0", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm-gnueabihf": { - "version": "1.30.2", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.30.2.tgz", - "integrity": "sha512-eVdpxh4wYcm0PofJIZVuYuLiqBIakQ9uFZmipf6LF/HRj5Bgm0eb3qL/mr1smyXIS1twwOxNWndd8z0E374hiA==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MPL-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm64-gnu": { - "version": "1.30.2", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.30.2.tgz", - "integrity": "sha512-UK65WJAbwIJbiBFXpxrbTNArtfuznvxAJw4Q2ZGlU8kPeDIWEX1dg3rn2veBVUylA2Ezg89ktszWbaQnxD/e3A==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MPL-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm64-musl": { - "version": "1.30.2", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.30.2.tgz", - "integrity": "sha512-5Vh9dGeblpTxWHpOx8iauV02popZDsCYMPIgiuw97OJ5uaDsL86cnqSFs5LZkG3ghHoX5isLgWzMs+eD1YzrnA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MPL-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-x64-gnu": { - "version": "1.30.2", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.30.2.tgz", - "integrity": "sha512-Cfd46gdmj1vQ+lR6VRTTadNHu6ALuw2pKR9lYq4FnhvgBc4zWY1EtZcAc6EffShbb1MFrIPfLDXD6Xprbnni4w==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MPL-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-x64-musl": { - "version": "1.30.2", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.30.2.tgz", - "integrity": "sha512-XJaLUUFXb6/QG2lGIW6aIk6jKdtjtcffUT0NKvIqhSBY3hh9Ch+1LCeH80dR9q9LBjG3ewbDjnumefsLsP6aiA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MPL-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-win32-arm64-msvc": { - "version": "1.30.2", - "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.30.2.tgz", - "integrity": "sha512-FZn+vaj7zLv//D/192WFFVA0RgHawIcHqLX9xuWiQt7P0PtdFEVaxgF9rjM/IRYHQXNnk61/H/gb2Ei+kUQ4xQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MPL-2.0", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-win32-x64-msvc": { - "version": "1.30.2", - "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.30.2.tgz", - "integrity": "sha512-5g1yc73p+iAkid5phb4oVFMB45417DkRevRbt/El/gKXJk4jid+vPFF/AXbxn05Aky8PapwzZrdJShv5C0avjw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MPL-2.0", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "license": "MIT", - "dependencies": { - "js-tokens": "^3.0.0 || ^4.0.0" - }, - "bin": { - "loose-envify": "cli.js" - } - }, - "node_modules/lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^3.0.2" - } - }, - "node_modules/lucide-react": { - "version": "0.554.0", - "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.554.0.tgz", - "integrity": "sha512-St+z29uthEJVx0Is7ellNkgTEhaeSoA42I7JjOCBCrc5X6LYMGSv0P/2uS5HDLTExP5tpiqRD2PyUEOS6s9UXA==", - "license": "ISC", - "peerDependencies": { - "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" - } - }, - "node_modules/maath": { - "version": "0.10.8", - "resolved": "https://registry.npmjs.org/maath/-/maath-0.10.8.tgz", - "integrity": "sha512-tRvbDF0Pgqz+9XUa4jjfgAQ8/aPKmQdWXilFu2tMy4GWj4NOsx99HlULO4IeREfbO3a0sA145DZYyvXPkybm0g==", - "license": "MIT", - "peerDependencies": { - "@types/three": ">=0.134.0", - "three": ">=0.134.0" - } - }, - "node_modules/meshline": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/meshline/-/meshline-3.3.1.tgz", - "integrity": "sha512-/TQj+JdZkeSUOl5Mk2J7eLcYTLiQm2IDzmlSvYm7ov15anEcDJ92GHqqazxTSreeNgfnYu24kiEvvv0WlbCdFQ==", - "license": "MIT", - "peerDependencies": { - "three": ">=0.137" - } - }, - "node_modules/meshoptimizer": { - "version": "0.22.0", - "resolved": "https://registry.npmjs.org/meshoptimizer/-/meshoptimizer-0.22.0.tgz", - "integrity": "sha512-IebiK79sqIy+E4EgOr+CAw+Ke8hAspXKzBd0JdgEmPHiAwmvEj2S4h1rfvo+o/BnfEYd/jAOg5IeeIjzlzSnDg==", - "license": "MIT" - }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/motion-dom": { - "version": "12.23.23", - "resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-12.23.23.tgz", - "integrity": "sha512-n5yolOs0TQQBRUFImrRfs/+6X4p3Q4n1dUEqt/H58Vx7OW6RF+foWEgmTVDhIWJIMXOuNNL0apKH2S16en9eiA==", - "license": "MIT", - "dependencies": { - "motion-utils": "^12.23.6" - } - }, - "node_modules/motion-utils": { - "version": "12.23.6", - "resolved": "https://registry.npmjs.org/motion-utils/-/motion-utils-12.23.6.tgz", - "integrity": "sha512-eAWoPgr4eFEOFfg2WjIsMoqJTW6Z8MTUCgn/GZ3VRpClWBdnbjryiA3ZSNLyxCTmCQx4RmYX6jX1iWHbenUPNQ==", - "license": "MIT" - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true, - "license": "MIT" - }, - "node_modules/nanoid": { - "version": "3.3.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", - "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", - "dev": true, - "license": "MIT" - }, - "node_modules/node-releases": { - "version": "2.0.27", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz", - "integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==", - "dev": true, - "license": "MIT" - }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/optionator": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", - "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", - "dev": true, - "license": "MIT", - "dependencies": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.5" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/pako": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz", - "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==", - "license": "(MIT AND Zlib)" - }, - "node_modules/parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, - "license": "MIT", - "dependencies": { - "callsites": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/peerjs": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/peerjs/-/peerjs-1.5.5.tgz", - "integrity": "sha512-viMUCPDL6CSfOu0ZqVcFqbWRXNHIbv2lPqNbrBIjbFYrflebOjItJ4hPfhjnuUCstqciHVu9vVJ7jFqqKi/EuQ==", - "license": "MIT", - "dependencies": { - "@msgpack/msgpack": "^2.8.0", - "eventemitter3": "^4.0.7", - "peerjs-js-binarypack": "^2.1.0", - "webrtc-adapter": "^9.0.0" - }, - "engines": { - "node": ">= 14" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/peer" - } - }, - "node_modules/peerjs-js-binarypack": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/peerjs-js-binarypack/-/peerjs-js-binarypack-2.1.0.tgz", - "integrity": "sha512-YIwCC+pTzp3Bi8jPI9UFKO0t0SLo6xALnHkiNt/iUFmUUZG0fEEmEyFKvjsDKweiFitzHRyhuh6NvyJZ4nNxMg==", - "license": "MIT", - "engines": { - "node": ">= 14.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/peer" - } - }, - "node_modules/picocolors": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", - "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "dev": true, - "license": "ISC" - }, - "node_modules/picomatch": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", - "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/pngjs": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz", - "integrity": "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==", - "license": "MIT", - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/postcss": { - "version": "8.5.6", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", - "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "nanoid": "^3.3.11", - "picocolors": "^1.1.1", - "source-map-js": "^1.2.1" - }, - "engines": { - "node": "^10 || ^12 || >=14" - } - }, - "node_modules/potpack": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/potpack/-/potpack-1.0.2.tgz", - "integrity": "sha512-choctRBIV9EMT9WGAZHn3V7t0Z2pMQyl0EZE6pFc/6ml3ssw7Dlf/oAOvFwjm1HVsqfQN8GfeFyJ+d8tRzqueQ==", - "license": "ISC" - }, - "node_modules/prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "license": "MIT" - }, - "node_modules/promise-worker-transferable": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/promise-worker-transferable/-/promise-worker-transferable-1.0.4.tgz", - "integrity": "sha512-bN+0ehEnrXfxV2ZQvU2PetO0n4gqBD4ulq3MI1WOPLgr7/Mg9yRQkX5+0v1vagr74ZTsl7XtzlaYDo2EuCeYJw==", - "license": "Apache-2.0", - "dependencies": { - "is-promise": "^2.1.0", - "lie": "^3.0.2" - } - }, - "node_modules/prop-types": { - "version": "15.8.1", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", - "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", - "license": "MIT", - "dependencies": { - "loose-envify": "^1.4.0", - "object-assign": "^4.1.1", - "react-is": "^16.13.1" - } - }, - "node_modules/prop-types/node_modules/react-is": { - "version": "16.13.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", - "license": "MIT" - }, - "node_modules/punycode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/qr.js": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/qr.js/-/qr.js-0.0.0.tgz", - "integrity": "sha512-c4iYnWb+k2E+vYpRimHqSu575b1/wKl4XFeJGpFmrJQz5I88v9aY2czh7s0w36srfCM1sXgC/xpoJz5dJfq+OQ==", - "license": "MIT" - }, - "node_modules/qrcode": { - "version": "1.5.4", - "resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.4.tgz", - "integrity": "sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg==", - "license": "MIT", - "dependencies": { - "dijkstrajs": "^1.0.1", - "pngjs": "^5.0.0", - "yargs": "^15.3.1" - }, - "bin": { - "qrcode": "bin/qrcode" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/qrcode-generator": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/qrcode-generator/-/qrcode-generator-2.0.4.tgz", - "integrity": "sha512-mZSiP6RnbHl4xL2Ap5HfkjLnmxfKcPWpWe/c+5XxCuetEenqmNFf1FH/ftXPCtFG5/TDobjsjz6sSNL0Sr8Z9g==", - "license": "MIT" - }, - "node_modules/react": { - "version": "19.2.3", - "resolved": "https://registry.npmjs.org/react/-/react-19.2.3.tgz", - "integrity": "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react-dom": { - "version": "19.2.3", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.3.tgz", - "integrity": "sha512-yELu4WmLPw5Mr/lmeEpox5rw3RETacE++JgHqQzd2dg+YbJuat3jH4ingc+WPZhxaoFzdv9y33G+F7Nl5O0GBg==", - "license": "MIT", - "dependencies": { - "scheduler": "^0.27.0" - }, - "peerDependencies": { - "react": "^19.2.3" - } - }, - "node_modules/react-dom/node_modules/scheduler": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", - "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==", - "license": "MIT" - }, - "node_modules/react-is": { - "version": "19.2.3", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-19.2.3.tgz", - "integrity": "sha512-qJNJfu81ByyabuG7hPFEbXqNcWSU3+eVus+KJs+0ncpGfMyYdvSmxiJxbWR65lYi1I+/0HBcliO029gc4F+PnA==", - "license": "MIT", - "peer": true - }, - "node_modules/react-qr-code": { - "version": "2.0.18", - "resolved": "https://registry.npmjs.org/react-qr-code/-/react-qr-code-2.0.18.tgz", - "integrity": "sha512-v1Jqz7urLMhkO6jkgJuBYhnqvXagzceg3qJUWayuCK/c6LTIonpWbwxR1f1APGd4xrW/QcQEovNrAojbUz65Tg==", - "license": "MIT", - "dependencies": { - "prop-types": "^15.8.1", - "qr.js": "0.0.0" - }, - "peerDependencies": { - "react": "*" - } - }, - "node_modules/react-reconciler": { - "version": "0.31.0", - "resolved": "https://registry.npmjs.org/react-reconciler/-/react-reconciler-0.31.0.tgz", - "integrity": "sha512-7Ob7Z+URmesIsIVRjnLoDGwBEG/tVitidU0nMsqX/eeJaLY89RISO/10ERe0MqmzuKUUB1rmY+h1itMbUHg9BQ==", - "license": "MIT", - "dependencies": { - "scheduler": "^0.25.0" - }, - "engines": { - "node": ">=0.10.0" - }, - "peerDependencies": { - "react": "^19.0.0" - } - }, - "node_modules/react-redux": { - "version": "9.2.0", - "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.2.0.tgz", - "integrity": "sha512-ROY9fvHhwOD9ySfrF0wmvu//bKCQ6AeZZq1nJNtbDC+kk5DuSuNX/n6YWYF/SYy7bSba4D4FSz8DJeKY/S/r+g==", - "license": "MIT", - "dependencies": { - "@types/use-sync-external-store": "^0.0.6", - "use-sync-external-store": "^1.4.0" - }, - "peerDependencies": { - "@types/react": "^18.2.25 || ^19", - "react": "^18.0 || ^19", - "redux": "^5.0.0" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "redux": { - "optional": true - } - } - }, - "node_modules/react-refresh": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.18.0.tgz", - "integrity": "sha512-QgT5//D3jfjJb6Gsjxv0Slpj23ip+HtOpnNgnb2S5zU3CB26G/IDPGoy4RJB42wzFE46DRsstbW6tKHoKbhAxw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react-router": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.11.0.tgz", - "integrity": "sha512-uI4JkMmjbWCZc01WVP2cH7ZfSzH91JAZUDd7/nIprDgWxBV1TkkmLToFh7EbMTcMak8URFRa2YoBL/W8GWnCTQ==", - "license": "MIT", - "dependencies": { - "cookie": "^1.0.1", - "set-cookie-parser": "^2.6.0" - }, - "engines": { - "node": ">=20.0.0" - }, - "peerDependencies": { - "react": ">=18", - "react-dom": ">=18" - }, - "peerDependenciesMeta": { - "react-dom": { - "optional": true - } - } - }, - "node_modules/react-router-dom": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.11.0.tgz", - "integrity": "sha512-e49Ir/kMGRzFOOrYQBdoitq3ULigw4lKbAyKusnvtDu2t4dBX4AGYPrzNvorXmVuOyeakai6FUPW5MmibvVG8g==", - "license": "MIT", - "dependencies": { - "react-router": "7.11.0" - }, - "engines": { - "node": ">=20.0.0" - }, - "peerDependencies": { - "react": ">=18", - "react-dom": ">=18" - } - }, - "node_modules/react-use-measure": { - "version": "2.1.7", - "resolved": "https://registry.npmjs.org/react-use-measure/-/react-use-measure-2.1.7.tgz", - "integrity": "sha512-KrvcAo13I/60HpwGO5jpW7E9DfusKyLPLvuHlUyP5zqnmAPhNc6qTRjUQrdTADl0lpPpDVU2/Gg51UlOGHXbdg==", - "license": "MIT", - "peerDependencies": { - "react": ">=16.13", - "react-dom": ">=16.13" - }, - "peerDependenciesMeta": { - "react-dom": { - "optional": true - } - } - }, - "node_modules/readable-stream": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", - "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", - "license": "MIT", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/recharts": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/recharts/-/recharts-3.6.0.tgz", - "integrity": "sha512-L5bjxvQRAe26RlToBAziKUB7whaGKEwD3znoM6fz3DrTowCIC/FnJYnuq1GEzB8Zv2kdTfaxQfi5GoH0tBinyg==", - "license": "MIT", - "workspaces": [ - "www" - ], - "dependencies": { - "@reduxjs/toolkit": "1.x.x || 2.x.x", - "clsx": "^2.1.1", - "decimal.js-light": "^2.5.1", - "es-toolkit": "^1.39.3", - "eventemitter3": "^5.0.1", - "immer": "^10.1.1", - "react-redux": "8.x.x || 9.x.x", - "reselect": "5.1.1", - "tiny-invariant": "^1.3.3", - "use-sync-external-store": "^1.2.2", - "victory-vendor": "^37.0.2" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", - "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", - "react-is": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" - } - }, - "node_modules/recharts/node_modules/eventemitter3": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", - "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", - "license": "MIT" - }, - "node_modules/redux": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz", - "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==", - "license": "MIT" - }, - "node_modules/redux-thunk": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-3.1.0.tgz", - "integrity": "sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==", - "license": "MIT", - "peerDependencies": { - "redux": "^5.0.0" - } - }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", - "license": "ISC" - }, - "node_modules/reselect": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/reselect/-/reselect-5.1.1.tgz", - "integrity": "sha512-K/BG6eIky/SBpzfHZv/dd+9JBFiS4SWV7FIujVyJRux6e45+73RaUHXLmIR1f7WOMaQ0U1km6qwklRQxpJJY0w==", - "license": "MIT" - }, - "node_modules/resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/rolldown": { - "version": "1.0.0-beta.47", - "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.0.0-beta.47.tgz", - "integrity": "sha512-Mid74GckX1OeFAOYz9KuXeWYhq3xkXbMziYIC+ULVdUzPTG9y70OBSBQDQn9hQP8u/AfhuYw1R0BSg15nBI4Dg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@oxc-project/types": "=0.96.0", - "@rolldown/pluginutils": "1.0.0-beta.47" - }, - "bin": { - "rolldown": "bin/cli.mjs" - }, - "engines": { - "node": "^20.19.0 || >=22.12.0" - }, - "optionalDependencies": { - "@rolldown/binding-android-arm64": "1.0.0-beta.47", - "@rolldown/binding-darwin-arm64": "1.0.0-beta.47", - "@rolldown/binding-darwin-x64": "1.0.0-beta.47", - "@rolldown/binding-freebsd-x64": "1.0.0-beta.47", - "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-beta.47", - "@rolldown/binding-linux-arm64-gnu": "1.0.0-beta.47", - "@rolldown/binding-linux-arm64-musl": "1.0.0-beta.47", - "@rolldown/binding-linux-x64-gnu": "1.0.0-beta.47", - "@rolldown/binding-linux-x64-musl": "1.0.0-beta.47", - "@rolldown/binding-openharmony-arm64": "1.0.0-beta.47", - "@rolldown/binding-wasm32-wasi": "1.0.0-beta.47", - "@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.47", - "@rolldown/binding-win32-ia32-msvc": "1.0.0-beta.47", - "@rolldown/binding-win32-x64-msvc": "1.0.0-beta.47" - } - }, - "node_modules/rolldown/node_modules/@rolldown/pluginutils": { - "version": "1.0.0-beta.47", - "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.47.tgz", - "integrity": "sha512-8QagwMH3kNCuzD8EWL8R2YPW5e4OrHNSAHRFDdmFqEwEaD/KcNKjVoumo+gP2vW5eKB2UPbM6vTYiGZX0ixLnw==", - "dev": true, - "license": "MIT" - }, - "node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "license": "MIT" - }, - "node_modules/scheduler": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.25.0.tgz", - "integrity": "sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA==", - "license": "MIT" - }, - "node_modules/sdp": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/sdp/-/sdp-3.2.1.tgz", - "integrity": "sha512-lwsAIzOPlH8/7IIjjz3K0zYBk7aBVVcvjMwt3M4fLxpjMYyy7i3I97SLHebgn4YBjirkzfp3RvRDWSKsh/+WFw==", - "license": "MIT" - }, - "node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", - "license": "ISC" - }, - "node_modules/set-cookie-parser": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.2.tgz", - "integrity": "sha512-oeM1lpU/UvhTxw+g3cIfxXHyJRc/uidd3yK1P242gzHds0udQBYzs3y8j4gCCW+ZJ7ad0yctld8RYO+bdurlvw==", - "license": "MIT" - }, - "node_modules/setimmediate": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", - "license": "MIT" - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "license": "MIT", - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/source-map-js": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", - "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/stats-gl": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/stats-gl/-/stats-gl-2.4.2.tgz", - "integrity": "sha512-g5O9B0hm9CvnM36+v7SFl39T7hmAlv541tU81ME8YeSb3i1CIP5/QdDeSB3A0la0bKNHpxpwxOVRo2wFTYEosQ==", - "license": "MIT", - "dependencies": { - "@types/three": "*", - "three": "^0.170.0" - }, - "peerDependencies": { - "@types/three": "*", - "three": "*" - } - }, - "node_modules/stats-gl/node_modules/three": { - "version": "0.170.0", - "resolved": "https://registry.npmjs.org/three/-/three-0.170.0.tgz", - "integrity": "sha512-FQK+LEpYc0fBD+J8g6oSEyyNzjp+Q7Ks1C568WWaoMRLW+TkNNWmenWeGgJjV105Gd+p/2ql1ZcjYvNiPZBhuQ==", - "license": "MIT" - }, - "node_modules/stats.js": { - "version": "0.17.0", - "resolved": "https://registry.npmjs.org/stats.js/-/stats.js-0.17.0.tgz", - "integrity": "sha512-hNKz8phvYLPEcRkeG1rsGmV5ChMjKDAWU7/OJJdDErPBNChQXxCo3WZurGpnWc6gZhAzEPFad1aVgyOANH1sMw==", - "license": "MIT" - }, - "node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/strnum": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/strnum/-/strnum-2.1.2.tgz", - "integrity": "sha512-l63NF9y/cLROq/yqKXSLtcMeeyOfnSQlfMSlzFt/K73oIaD8DGaQWd7Z34X9GPiKqP5rbSh84Hl4bOlLcjiSrQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/NaturalIntelligence" - } - ], - "license": "MIT" - }, - "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/suspend-react": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/suspend-react/-/suspend-react-0.1.3.tgz", - "integrity": "sha512-aqldKgX9aZqpoDp3e8/BZ8Dm7x1pJl+qI3ZKxDN0i/IQTWUwBx/ManmlVJ3wowqbno6c2bmiIfs+Um6LbsjJyQ==", - "license": "MIT", - "peerDependencies": { - "react": ">=17.0" - } - }, - "node_modules/text-segmentation": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/text-segmentation/-/text-segmentation-1.0.3.tgz", - "integrity": "sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==", - "license": "MIT", - "dependencies": { - "utrie": "^1.0.2" - } - }, - "node_modules/three": { - "version": "0.181.2", - "resolved": "https://registry.npmjs.org/three/-/three-0.181.2.tgz", - "integrity": "sha512-k/CjiZ80bYss6Qs7/ex1TBlPD11whT9oKfT8oTGiHa34W4JRd1NiH/Tr1DbHWQ2/vMUypxksLnF2CfmlmM5XFQ==", - "license": "MIT" - }, - "node_modules/three-mesh-bvh": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/three-mesh-bvh/-/three-mesh-bvh-0.8.3.tgz", - "integrity": "sha512-4G5lBaF+g2auKX3P0yqx+MJC6oVt6sB5k+CchS6Ob0qvH0YIhuUk1eYr7ktsIpY+albCqE80/FVQGV190PmiAg==", - "license": "MIT", - "peerDependencies": { - "three": ">= 0.159.0" - } - }, - "node_modules/three-stdlib": { - "version": "2.36.1", - "resolved": "https://registry.npmjs.org/three-stdlib/-/three-stdlib-2.36.1.tgz", - "integrity": "sha512-XyGQrFmNQ5O/IoKm556ftwKsBg11TIb301MB5dWNicziQBEs2g3gtOYIf7pFiLa0zI2gUwhtCjv9fmjnxKZ1Cg==", - "license": "MIT", - "dependencies": { - "@types/draco3d": "^1.4.0", - "@types/offscreencanvas": "^2019.6.4", - "@types/webxr": "^0.5.2", - "draco3d": "^1.4.1", - "fflate": "^0.6.9", - "potpack": "^1.0.1" - }, - "peerDependencies": { - "three": ">=0.128.0" - } - }, - "node_modules/three-stdlib/node_modules/fflate": { - "version": "0.6.10", - "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.6.10.tgz", - "integrity": "sha512-IQrh3lEPM93wVCEczc9SaAOvkmcoQn/G8Bo1e8ZPlY3X3bnAxWaBdvTdvM1hP62iZp0BXWDy4vTAy4fF0+Dlpg==", - "license": "MIT" - }, - "node_modules/tiny-invariant": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz", - "integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==", - "license": "MIT" - }, - "node_modules/tinyglobby": { - "version": "0.2.15", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", - "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "fdir": "^6.5.0", - "picomatch": "^4.0.3" - }, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/SuperchupuDev" - } - }, - "node_modules/troika-three-text": { - "version": "0.52.4", - "resolved": "https://registry.npmjs.org/troika-three-text/-/troika-three-text-0.52.4.tgz", - "integrity": "sha512-V50EwcYGruV5rUZ9F4aNsrytGdKcXKALjEtQXIOBfhVoZU9VAqZNIoGQ3TMiooVqFAbR1w15T+f+8gkzoFzawg==", - "license": "MIT", - "dependencies": { - "bidi-js": "^1.0.2", - "troika-three-utils": "^0.52.4", - "troika-worker-utils": "^0.52.0", - "webgl-sdf-generator": "1.1.1" - }, - "peerDependencies": { - "three": ">=0.125.0" - } - }, - "node_modules/troika-three-utils": { - "version": "0.52.4", - "resolved": "https://registry.npmjs.org/troika-three-utils/-/troika-three-utils-0.52.4.tgz", - "integrity": "sha512-NORAStSVa/BDiG52Mfudk4j1FG4jC4ILutB3foPnfGbOeIs9+G5vZLa0pnmnaftZUGm4UwSoqEpWdqvC7zms3A==", - "license": "MIT", - "peerDependencies": { - "three": ">=0.125.0" - } - }, - "node_modules/troika-worker-utils": { - "version": "0.52.0", - "resolved": "https://registry.npmjs.org/troika-worker-utils/-/troika-worker-utils-0.52.0.tgz", - "integrity": "sha512-W1CpvTHykaPH5brv5VHLfQo9D1OYuo0cSBEUQFFT/nBUzM8iD6Lq2/tgG/f1OelbAS1WtaTPQzE5uM49egnngw==", - "license": "MIT" - }, - "node_modules/ts-api-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz", - "integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18.12" - }, - "peerDependencies": { - "typescript": ">=4.8.4" - } - }, - "node_modules/tslib": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", - "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", - "license": "0BSD" - }, - "node_modules/tunnel-rat": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/tunnel-rat/-/tunnel-rat-0.1.2.tgz", - "integrity": "sha512-lR5VHmkPhzdhrM092lI2nACsLO4QubF0/yoOhzX7c+wIpbN1GjHNzCc91QlpxBi+cnx8vVJ+Ur6vL5cEoQPFpQ==", - "license": "MIT", - "dependencies": { - "zustand": "^4.3.2" - } - }, - "node_modules/tunnel-rat/node_modules/zustand": { - "version": "4.5.7", - "resolved": "https://registry.npmjs.org/zustand/-/zustand-4.5.7.tgz", - "integrity": "sha512-CHOUy7mu3lbD6o6LJLfllpjkzhHXSBlX8B9+qPddUsIfeF5S/UZ5q0kmCsnRqT1UHFQZchNFDDzMbQsuesHWlw==", - "license": "MIT", - "dependencies": { - "use-sync-external-store": "^1.2.2" - }, - "engines": { - "node": ">=12.7.0" - }, - "peerDependencies": { - "@types/react": ">=16.8", - "immer": ">=9.0.6", - "react": ">=16.8" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "immer": { - "optional": true - }, - "react": { - "optional": true - } - } - }, - "node_modules/type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dev": true, - "license": "MIT", - "dependencies": { - "prelude-ls": "^1.2.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/typescript-eslint": { - "version": "8.50.1", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.50.1.tgz", - "integrity": "sha512-ytTHO+SoYSbhAH9CrYnMhiLx8To6PSSvqnvXyPUgPETCvB6eBKmTI9w6XMPS3HsBRGkwTVBX+urA8dYQx6bHfQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/eslint-plugin": "8.50.1", - "@typescript-eslint/parser": "8.50.1", - "@typescript-eslint/typescript-estree": "8.50.1", - "@typescript-eslint/utils": "8.50.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <6.0.0" - } - }, - "node_modules/undici-types": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", - "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", - "dev": true, - "license": "MIT" - }, - "node_modules/update-browserslist-db": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", - "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "escalade": "^3.2.0", - "picocolors": "^1.1.1" - }, - "bin": { - "update-browserslist-db": "cli.js" - }, - "peerDependencies": { - "browserslist": ">= 4.21.0" - } - }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/use-sync-external-store": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.6.0.tgz", - "integrity": "sha512-Pp6GSwGP/NrPIrxVFAIkOQeyw8lFenOHijQWkUTrDvrF4ALqylP2C/KCkeS9dpUM3KvYRQhna5vt7IL95+ZQ9w==", - "license": "MIT", - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" - } - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "license": "MIT" - }, - "node_modules/utility-types": { - "version": "3.11.0", - "resolved": "https://registry.npmjs.org/utility-types/-/utility-types-3.11.0.tgz", - "integrity": "sha512-6Z7Ma2aVEWisaL6TvBCy7P8rm2LQoPv6dJ7ecIaIixHcwfbJ0x7mWdbcwlIM5IGQxPZSFYeqRCqlOOeKoJYMkw==", - "license": "MIT", - "engines": { - "node": ">= 4" - } - }, - "node_modules/utrie": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/utrie/-/utrie-1.0.2.tgz", - "integrity": "sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==", - "license": "MIT", - "dependencies": { - "base64-arraybuffer": "^1.0.2" - } - }, - "node_modules/victory-vendor": { - "version": "37.3.6", - "resolved": "https://registry.npmjs.org/victory-vendor/-/victory-vendor-37.3.6.tgz", - "integrity": "sha512-SbPDPdDBYp+5MJHhBCAyI7wKM3d5ivekigc2Dk2s7pgbZ9wIgIBYGVw4zGHBml/qTFbexrofXW6Gu4noGxrOwQ==", - "license": "MIT AND ISC", - "dependencies": { - "@types/d3-array": "^3.0.3", - "@types/d3-ease": "^3.0.0", - "@types/d3-interpolate": "^3.0.1", - "@types/d3-scale": "^4.0.2", - "@types/d3-shape": "^3.1.0", - "@types/d3-time": "^3.0.0", - "@types/d3-timer": "^3.0.0", - "d3-array": "^3.1.6", - "d3-ease": "^3.0.1", - "d3-interpolate": "^3.0.1", - "d3-scale": "^4.0.2", - "d3-shape": "^3.1.0", - "d3-time": "^3.0.0", - "d3-timer": "^3.0.1" - } - }, - "node_modules/vite": { - "name": "rolldown-vite", - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/rolldown-vite/-/rolldown-vite-7.2.2.tgz", - "integrity": "sha512-Fl3ZdmJhDMJGcqrr342pPVrhugXdOcuNBRBauz4S7QGSRXbQy7y8q5QYJtgkcrG8XjY0EENSZeTk58c3m20FxA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@oxc-project/runtime": "0.96.0", - "fdir": "^6.5.0", - "lightningcss": "^1.30.2", - "picomatch": "^4.0.3", - "postcss": "^8.5.6", - "rolldown": "1.0.0-beta.47", - "tinyglobby": "^0.2.15" - }, - "bin": { - "vite": "bin/vite.js" - }, - "engines": { - "node": "^20.19.0 || >=22.12.0" - }, - "funding": { - "url": "https://github.com/vitejs/vite?sponsor=1" - }, - "optionalDependencies": { - "fsevents": "~2.3.3" - }, - "peerDependencies": { - "@types/node": "^20.19.0 || >=22.12.0", - "esbuild": "^0.25.0", - "jiti": ">=1.21.0", - "less": "^4.0.0", - "sass": "^1.70.0", - "sass-embedded": "^1.70.0", - "stylus": ">=0.54.8", - "sugarss": "^5.0.0", - "terser": "^5.16.0", - "tsx": "^4.8.1", - "yaml": "^2.4.2" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - }, - "esbuild": { - "optional": true - }, - "jiti": { - "optional": true - }, - "less": { - "optional": true - }, - "sass": { - "optional": true - }, - "sass-embedded": { - "optional": true - }, - "stylus": { - "optional": true - }, - "sugarss": { - "optional": true - }, - "terser": { - "optional": true - }, - "tsx": { - "optional": true - }, - "yaml": { - "optional": true - } - } - }, - "node_modules/webgl-constants": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/webgl-constants/-/webgl-constants-1.1.1.tgz", - "integrity": "sha512-LkBXKjU5r9vAW7Gcu3T5u+5cvSvh5WwINdr0C+9jpzVB41cjQAP5ePArDtk/WHYdVj0GefCgM73BA7FlIiNtdg==" - }, - "node_modules/webgl-sdf-generator": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/webgl-sdf-generator/-/webgl-sdf-generator-1.1.1.tgz", - "integrity": "sha512-9Z0JcMTFxeE+b2x1LJTdnaT8rT8aEp7MVxkNwoycNmJWwPdzoXzMh0BjJSh/AEFP+KPYZUli814h8bJZFIZ2jA==", - "license": "MIT" - }, - "node_modules/webrtc-adapter": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/webrtc-adapter/-/webrtc-adapter-9.0.3.tgz", - "integrity": "sha512-5fALBcroIl31OeXAdd1YUntxiZl1eHlZZWzNg3U4Fn+J9/cGL3eT80YlrsWGvj2ojuz1rZr2OXkgCzIxAZ7vRQ==", - "license": "BSD-3-Clause", - "dependencies": { - "sdp": "^3.2.0" - }, - "engines": { - "node": ">=6.0.0", - "npm": ">=3.10.0" - } - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/which-module": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz", - "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==", - "license": "ISC" - }, - "node_modules/word-wrap": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", - "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/wrap-ansi": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", - "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/y18n": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", - "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", - "license": "ISC" - }, - "node_modules/yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true, - "license": "ISC" - }, - "node_modules/yargs": { - "version": "15.4.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", - "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", - "license": "MIT", - "dependencies": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^18.1.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/yargs-parser": { - "version": "18.1.3", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", - "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", - "license": "ISC", - "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/yargs/node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "license": "MIT", - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/yargs/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "license": "MIT", - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/yargs/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "license": "MIT", - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/yargs/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "license": "MIT", - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/zod": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/zod/-/zod-4.2.1.tgz", - "integrity": "sha512-0wZ1IRqGGhMP76gLqz8EyfBXKk0J2qo2+H3fi4mcUP/KtTocoX08nmIAHl1Z2kJIZbZee8KOpBCSNPRgauucjw==", - "dev": true, - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/colinhacks" - } - }, - "node_modules/zod-validation-error": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-4.0.2.tgz", - "integrity": "sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18.0.0" - }, - "peerDependencies": { - "zod": "^3.25.0 || ^4.0.0" - } - }, - "node_modules/zustand": { - "version": "5.0.9", - "resolved": "https://registry.npmjs.org/zustand/-/zustand-5.0.9.tgz", - "integrity": "sha512-ALBtUj0AfjJt3uNRQoL1tL2tMvj6Gp/6e39dnfT6uzpelGru8v1tPOGBzayOWbPJvujM8JojDk3E1LxeFisBNg==", - "license": "MIT", - "engines": { - "node": ">=12.20.0" - }, - "peerDependencies": { - "@types/react": ">=18.0.0", - "immer": ">=9.0.6", - "react": ">=18.0.0", - "use-sync-external-store": ">=1.2.0" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "immer": { - "optional": true - }, - "react": { - "optional": true - }, - "use-sync-external-store": { - "optional": true - } - } - } - } -} From b7842ae990ab26dea8c11cb1d657dd3f32ceab33 Mon Sep 17 00:00:00 2001 From: Kojib <123880127+kojibai@users.noreply.github.com> Date: Mon, 22 Dec 2025 20:46:02 -0500 Subject: [PATCH 03/10] Delete package.json --- package.json | 62 ---------------------------------------------------- 1 file changed, 62 deletions(-) delete mode 100644 package.json diff --git a/package.json b/package.json deleted file mode 100644 index dc3e1b24..00000000 --- a/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "name": "verify-kai", - "private": true, - "version": "0.0.0", - "type": "module", - "scripts": { - "dev": "vite", - "build": "tsc -b && vite build", - "lint": "eslint .", - "preview": "vite preview", - "test": "node --test" - }, - "dependencies": { - "@react-three/drei": "^10.7.7", - "@react-three/fiber": "^9.4.0", - "@stripe/react-stripe-js": "^5.4.1", - "@stripe/stripe-js": "^8.5.3", - "blakejs": "^1.2.1", - "buffer": "^6.0.3", - "decimal.js": "^10.6.0", - "fast-xml-parser": "^5.3.2", - "fflate": "^0.8.2", - "framer-motion": "^12.23.25", - "hash-wasm": "^4.12.0", - "html2canvas": "^1.4.1", - "jszip": "^3.10.1", - "lucide-react": "^0.554.0", - "pako": "^2.1.0", - "peerjs": "^1.5.5", - "qrcode": "^1.5.4", - "qrcode-generator": "^2.0.4", - "react": "^19.2.0", - "react-dom": "^19.2.0", - "react-qr-code": "^2.0.18", - "react-router-dom": "^7.9.6", - "recharts": "^3.4.1", - "three": "^0.181.2" - }, - "devDependencies": { - "@eslint/js": "^9.39.1", - "@types/jszip": "^3.4.0", - "@types/node": "^24.10.1", - "@types/pako": "^2.0.4", - "@types/peerjs": "^0.0.30", - "@types/qrcode": "^1.5.6", - "@types/qrcode-generator": "^0.0.16", - "@types/react": "^19.2.2", - "@types/react-dom": "^19.2.2", - "@types/react-router-dom": "^5.3.3", - "@vitejs/plugin-react": "^5.1.0", - "eslint": "^9.39.1", - "eslint-plugin-react-hooks": "^7.0.1", - "eslint-plugin-react-refresh": "^0.4.24", - "globals": "^16.5.0", - "typescript": "~5.9.3", - "typescript-eslint": "^8.46.3", - "vite": "npm:rolldown-vite@7.2.2" - }, - "overrides": { - "vite": "npm:rolldown-vite@7.2.2" - } -} From 7227c45f80f731e741e97a43ef40adb5e85b4d20 Mon Sep 17 00:00:00 2001 From: Kojib <123880127+kojibai@users.noreply.github.com> Date: Mon, 22 Dec 2025 20:47:52 -0500 Subject: [PATCH 04/10] Add files via upload --- package-lock.json | 4880 +++++++++++++++++++++++++++++++++++++++++++++ package.json | 62 + 2 files changed, 4942 insertions(+) create mode 100644 package-lock.json create mode 100644 package.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..6749aeb5 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,4880 @@ +{ + "name": "verify-kai", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "verify-kai", + "version": "0.0.0", + "dependencies": { + "@react-three/drei": "^10.7.7", + "@react-three/fiber": "^9.4.0", + "@stripe/react-stripe-js": "^5.4.1", + "@stripe/stripe-js": "^8.5.3", + "blakejs": "^1.2.1", + "buffer": "^6.0.3", + "decimal.js": "^10.6.0", + "fast-xml-parser": "^5.3.2", + "fflate": "^0.8.2", + "framer-motion": "^12.23.25", + "hash-wasm": "^4.12.0", + "html2canvas": "^1.4.1", + "jszip": "^3.10.1", + "lucide-react": "^0.554.0", + "pako": "^2.1.0", + "peerjs": "^1.5.5", + "qrcode": "^1.5.4", + "qrcode-generator": "^2.0.4", + "react": "^19.2.0", + "react-dom": "^19.2.0", + "react-qr-code": "^2.0.18", + "react-router-dom": "^7.9.6", + "recharts": "^3.4.1", + "three": "^0.181.2" + }, + "devDependencies": { + "@eslint/js": "^9.39.1", + "@types/jszip": "^3.4.0", + "@types/node": "^24.10.1", + "@types/pako": "^2.0.4", + "@types/peerjs": "^0.0.30", + "@types/qrcode": "^1.5.6", + "@types/qrcode-generator": "^0.0.16", + "@types/react": "^19.2.2", + "@types/react-dom": "^19.2.2", + "@types/react-router-dom": "^5.3.3", + "@vitejs/plugin-react": "^5.1.0", + "eslint": "^9.39.1", + "eslint-plugin-react-hooks": "^7.0.1", + "eslint-plugin-react-refresh": "^0.4.24", + "globals": "^16.5.0", + "typescript": "~5.9.3", + "typescript-eslint": "^8.46.3", + "vite": "npm:rolldown-vite@7.2.2" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", + "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.27.1", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.28.5.tgz", + "integrity": "sha512-6uFXyCayocRbqhZOB+6XcuZbkMNimwfVGFji8CTZnCzOHVGvDqzvitu1re2AU5LROliz7eQPhB8CpAMvnx9EjA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.5.tgz", + "integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.27.1", + "@babel/generator": "^7.28.5", + "@babel/helper-compilation-targets": "^7.27.2", + "@babel/helper-module-transforms": "^7.28.3", + "@babel/helpers": "^7.28.4", + "@babel/parser": "^7.28.5", + "@babel/template": "^7.27.2", + "@babel/traverse": "^7.28.5", + "@babel/types": "^7.28.5", + "@jridgewell/remapping": "^2.3.5", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.28.5.tgz", + "integrity": "sha512-3EwLFhZ38J4VyIP6WNtt2kUdW9dokXA9Cr4IVIFHuCpZ3H8/YFOl5JjZHisrn1fATPBmKKqXzDFvh9fUwHz6CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.28.5", + "@babel/types": "^7.28.5", + "@jridgewell/gen-mapping": "^0.3.12", + "@jridgewell/trace-mapping": "^0.3.28", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.27.2", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.2.tgz", + "integrity": "sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.27.2", + "@babel/helper-validator-option": "^7.27.1", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-globals": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz", + "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.27.1.tgz", + "integrity": "sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.27.1", + "@babel/types": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.28.3", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.3.tgz", + "integrity": "sha512-gytXUbs8k2sXS9PnQptz5o0QnpLL51SwASIORY6XaBKF88nsOT0Zw9szLqlSGQDP/4TljBAD5y98p2U1fqkdsw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.27.1", + "@babel/helper-validator-identifier": "^7.27.1", + "@babel/traverse": "^7.28.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.27.1.tgz", + "integrity": "sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", + "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", + "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz", + "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.28.4", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.28.4.tgz", + "integrity": "sha512-HFN59MmQXGHVyYadKLVumYsA9dBFun/ldYxipEjzA4196jpLZd8UjEEBLkbEkvfYreDqJhZxYAWFPtrfhNpj4w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.27.2", + "@babel/types": "^7.28.4" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.5.tgz", + "integrity": "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.28.5" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-self": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.27.1.tgz", + "integrity": "sha512-6UzkCs+ejGdZ5mFFC/OCUrv028ab2fp1znZmCZjAOBKiBK2jXD1O+BPSfX8X2qjJ75fZBMSnQn3Rq2mrBJK2mw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-source": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.27.1.tgz", + "integrity": "sha512-zbwoTsBruTeKB9hSq73ha66iFeJHuaFkUbwvqElnygoNbj/jHRsSeokowZFN3CZ64IvEqcmmkVe89OPXc7ldAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/runtime": { + "version": "7.28.4", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.4.tgz", + "integrity": "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/template": { + "version": "7.27.2", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.2.tgz", + "integrity": "sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.27.1", + "@babel/parser": "^7.27.2", + "@babel/types": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.28.5.tgz", + "integrity": "sha512-TCCj4t55U90khlYkVV/0TfkJkAkUg3jZFA3Neb7unZT8CPok7iiRfaX0F+WnqWqt7OxhOn0uBKXCw4lbL8W0aQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.27.1", + "@babel/generator": "^7.28.5", + "@babel/helper-globals": "^7.28.0", + "@babel/parser": "^7.28.5", + "@babel/template": "^7.27.2", + "@babel/types": "^7.28.5", + "debug": "^4.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.5.tgz", + "integrity": "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.27.1", + "@babel/helper-validator-identifier": "^7.28.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@dimforge/rapier3d-compat": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@dimforge/rapier3d-compat/-/rapier3d-compat-0.12.0.tgz", + "integrity": "sha512-uekIGetywIgopfD97oDL5PfeezkFpNhwlzlaEYNOA0N6ghdsOvh/HYjSMek5Q2O1PYvRSDFcqFVJl4r4ZBwOow==", + "license": "Apache-2.0" + }, + "node_modules/@emnapi/core": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.7.1.tgz", + "integrity": "sha512-o1uhUASyo921r2XtHYOHy7gdkGLge8ghBEQHMWmyJFoXlpU58kIrhhN3w26lpQb6dspetweapMn2CSNwQ8I4wg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "1.1.0", + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.7.1.tgz", + "integrity": "sha512-PVtJr5CmLwYAU9PZDMITZoR5iAOShYREoR45EyyLrbntV50mdePTgUn4AmOw90Ifcj+x2kRjdzr1HP3RrNiHGA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/wasi-threads": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.1.0.tgz", + "integrity": "sha512-WI0DdZ8xFSbgMjR1sFsKABJ/C5OnRrjT06JXbZKexJGrDuPTzZdDYfFlsgcCXCyf+suG5QU2e/y1Wo2V/OapLQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.0.tgz", + "integrity": "sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.1.tgz", + "integrity": "sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^2.1.7", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/config-helpers": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz", + "integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.17.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/core": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz", + "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.3.tgz", + "integrity": "sha512-Kr+LPIUVKz2qkx1HAMH8q1q6azbqBAsXJUxBl/ODDuVPX45Z9DfwB8tPjTi6nNZ8BuM3nbJxC5zCAg5elnBUTQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.1", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/js": { + "version": "9.39.2", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.2.tgz", + "integrity": "sha512-q1mjIoW1VX4IvSocvM/vbTiveKC4k9eLrajNEuSsmjymSDEbpGddtpfOoN7YGAqBK3NG+uqo8ia4PDTt8buCYA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + } + }, + "node_modules/@eslint/object-schema": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.7.tgz", + "integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.4.1.tgz", + "integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.17.0", + "levn": "^0.4.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@humanfs/core": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.7", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.7.tgz", + "integrity": "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.4.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", + "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@mediapipe/tasks-vision": { + "version": "0.10.17", + "resolved": "https://registry.npmjs.org/@mediapipe/tasks-vision/-/tasks-vision-0.10.17.tgz", + "integrity": "sha512-CZWV/q6TTe8ta61cZXjfnnHsfWIdFhms03M9T7Cnd5y2mdpylJM0rF1qRq+wsQVRMLz1OYPVEBU9ph2Bx8cxrg==", + "license": "Apache-2.0" + }, + "node_modules/@monogrid/gainmap-js": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@monogrid/gainmap-js/-/gainmap-js-3.4.0.tgz", + "integrity": "sha512-2Z0FATFHaoYJ8b+Y4y4Hgfn3FRFwuU5zRrk+9dFWp4uGAdHGqVEdP7HP+gLA3X469KXHmfupJaUbKo1b/aDKIg==", + "license": "MIT", + "dependencies": { + "promise-worker-transferable": "^1.0.4" + }, + "peerDependencies": { + "three": ">= 0.159.0" + } + }, + "node_modules/@msgpack/msgpack": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/@msgpack/msgpack/-/msgpack-2.8.0.tgz", + "integrity": "sha512-h9u4u/jiIRKbq25PM+zymTyW6bhTzELvOoUd+AvYriWOAKpLGnIamaET3pnHYoI5iYphAHBI4ayx0MehR+VVPQ==", + "license": "ISC", + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/wasm-runtime": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.0.tgz", + "integrity": "sha512-Fq6DJW+Bb5jaWE69/qOE0D1TUN9+6uWhCeZpdnSBk14pjLcCWR7Q8n49PTSPHazM37JqrsdpEthXy2xn6jWWiA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "^1.7.1", + "@emnapi/runtime": "^1.7.1", + "@tybys/wasm-util": "^0.10.1" + } + }, + "node_modules/@oxc-project/runtime": { + "version": "0.96.0", + "resolved": "https://registry.npmjs.org/@oxc-project/runtime/-/runtime-0.96.0.tgz", + "integrity": "sha512-34lh4o9CcSw09Hx6fKihPu85+m+4pmDlkXwJrLvN5nMq5JrcGhhihVM415zDqT8j8IixO1PYYdQZRN4SwQCncg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-project/types": { + "version": "0.96.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.96.0.tgz", + "integrity": "sha512-r/xkmoXA0xEpU6UGtn18CNVjXH6erU3KCpCDbpLmbVxBFor1U9MqN5Z2uMmCHJuXjJzlnDR+hWY+yPoLo8oHDw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/Boshen" + } + }, + "node_modules/@react-three/drei": { + "version": "10.7.7", + "resolved": "https://registry.npmjs.org/@react-three/drei/-/drei-10.7.7.tgz", + "integrity": "sha512-ff+J5iloR0k4tC++QtD/j9u3w5fzfgFAWDtAGQah9pF2B1YgOq/5JxqY0/aVoQG5r3xSZz0cv5tk2YuBob4xEQ==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.26.0", + "@mediapipe/tasks-vision": "0.10.17", + "@monogrid/gainmap-js": "^3.0.6", + "@use-gesture/react": "^10.3.1", + "camera-controls": "^3.1.0", + "cross-env": "^7.0.3", + "detect-gpu": "^5.0.56", + "glsl-noise": "^0.0.0", + "hls.js": "^1.5.17", + "maath": "^0.10.8", + "meshline": "^3.3.1", + "stats-gl": "^2.2.8", + "stats.js": "^0.17.0", + "suspend-react": "^0.1.3", + "three-mesh-bvh": "^0.8.3", + "three-stdlib": "^2.35.6", + "troika-three-text": "^0.52.4", + "tunnel-rat": "^0.1.2", + "use-sync-external-store": "^1.4.0", + "utility-types": "^3.11.0", + "zustand": "^5.0.1" + }, + "peerDependencies": { + "@react-three/fiber": "^9.0.0", + "react": "^19", + "react-dom": "^19", + "three": ">=0.159" + }, + "peerDependenciesMeta": { + "react-dom": { + "optional": true + } + } + }, + "node_modules/@react-three/fiber": { + "version": "9.4.2", + "resolved": "https://registry.npmjs.org/@react-three/fiber/-/fiber-9.4.2.tgz", + "integrity": "sha512-H4B4+FDNHpvIb4FmphH4ubxOfX5bxmfOw0+3pkQwR9u9wFiyMS7wUDkNn0m4RqQuiLWeia9jfN1eBvtyAVGEog==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@types/react-reconciler": "^0.32.0", + "@types/webxr": "*", + "base64-js": "^1.5.1", + "buffer": "^6.0.3", + "its-fine": "^2.0.0", + "react-reconciler": "^0.31.0", + "react-use-measure": "^2.1.7", + "scheduler": "^0.25.0", + "suspend-react": "^0.1.3", + "use-sync-external-store": "^1.4.0", + "zustand": "^5.0.3" + }, + "peerDependencies": { + "expo": ">=43.0", + "expo-asset": ">=8.4", + "expo-file-system": ">=11.0", + "expo-gl": ">=11.0", + "react": "^19.0.0", + "react-dom": "^19.0.0", + "react-native": ">=0.78", + "three": ">=0.156" + }, + "peerDependenciesMeta": { + "expo": { + "optional": true + }, + "expo-asset": { + "optional": true + }, + "expo-file-system": { + "optional": true + }, + "expo-gl": { + "optional": true + }, + "react-dom": { + "optional": true + }, + "react-native": { + "optional": true + } + } + }, + "node_modules/@reduxjs/toolkit": { + "version": "2.11.2", + "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.11.2.tgz", + "integrity": "sha512-Kd6kAHTA6/nUpp8mySPqj3en3dm0tdMIgbttnQ1xFMVpufoj+ADi8pXLBsd4xzTRHQa7t/Jv8W5UnCuW4kuWMQ==", + "license": "MIT", + "dependencies": { + "@standard-schema/spec": "^1.0.0", + "@standard-schema/utils": "^0.3.0", + "immer": "^11.0.0", + "redux": "^5.0.1", + "redux-thunk": "^3.1.0", + "reselect": "^5.1.0" + }, + "peerDependencies": { + "react": "^16.9.0 || ^17.0.0 || ^18 || ^19", + "react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + }, + "react-redux": { + "optional": true + } + } + }, + "node_modules/@reduxjs/toolkit/node_modules/immer": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/immer/-/immer-11.1.0.tgz", + "integrity": "sha512-dlzb07f5LDY+tzs+iLCSXV2yuhaYfezqyZQc+n6baLECWkOMEWxkECAOnXL0ba7lsA25fM9b2jtzpu/uxo1a7g==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/immer" + } + }, + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.0.0-beta.47", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.0.0-beta.47.tgz", + "integrity": "sha512-vPP9/MZzESh9QtmvQYojXP/midjgkkc1E4AdnPPAzQXo668ncHJcVLKjJKzoBdsQmaIvNjrMdsCwES8vTQHRQw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-arm64": { + "version": "1.0.0-beta.47", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.0.0-beta.47.tgz", + "integrity": "sha512-Lc3nrkxeaDVCVl8qR3qoxh6ltDZfkQ98j5vwIr5ALPkgjZtDK4BGCrrBoLpGVMg+csWcaqUbwbKwH5yvVa0oOw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-x64": { + "version": "1.0.0-beta.47", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.0.0-beta.47.tgz", + "integrity": "sha512-eBYxQDwP0O33plqNVqOtUHqRiSYVneAknviM5XMawke3mwMuVlAsohtOqEjbCEl/Loi/FWdVeks5WkqAkzkYWQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-freebsd-x64": { + "version": "1.0.0-beta.47", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.0.0-beta.47.tgz", + "integrity": "sha512-Ns+kgp2+1Iq/44bY/Z30DETUSiHY7ZuqaOgD5bHVW++8vme9rdiWsN4yG4rRPXkdgzjvQ9TDHmZZKfY4/G11AA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.0.0-beta.47", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.0.0-beta.47.tgz", + "integrity": "sha512-4PecgWCJhTA2EFOlptYJiNyVP2MrVP4cWdndpOu3WmXqWqZUmSubhb4YUAIxAxnXATlGjC1WjxNPhV7ZllNgdA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-gnu": { + "version": "1.0.0-beta.47", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.0.0-beta.47.tgz", + "integrity": "sha512-CyIunZ6D9U9Xg94roQI1INt/bLkOpPsZjZZkiaAZ0r6uccQdICmC99M9RUPlMLw/qg4yEWLlQhG73W/mG437NA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-musl": { + "version": "1.0.0-beta.47", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.0.0-beta.47.tgz", + "integrity": "sha512-doozc/Goe7qRCSnzfJbFINTHsMktqmZQmweull6hsZZ9sjNWQ6BWQnbvOlfZJe4xE5NxM1NhPnY5Giqnl3ZrYQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-gnu": { + "version": "1.0.0-beta.47", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.0.0-beta.47.tgz", + "integrity": "sha512-fodvSMf6Aqwa0wEUSTPewmmZOD44rc5Tpr5p9NkwQ6W1SSpUKzD3SwpJIgANDOhwiYhDuiIaYPGB7Ujkx1q0UQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-musl": { + "version": "1.0.0-beta.47", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.0.0-beta.47.tgz", + "integrity": "sha512-Rxm5hYc0mGjwLh5sjlGmMygxAaV2gnsx7CNm2lsb47oyt5UQyPDZf3GP/ct8BEcwuikdqzsrrlIp8+kCSvMFNQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-openharmony-arm64": { + "version": "1.0.0-beta.47", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.0.0-beta.47.tgz", + "integrity": "sha512-YakuVe+Gc87jjxazBL34hbr8RJpRuFBhun7NEqoChVDlH5FLhLXjAPHqZd990TVGVNkemourf817Z8u2fONS8w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-wasm32-wasi": { + "version": "1.0.0-beta.47", + "resolved": "https://registry.npmjs.org/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.0.0-beta.47.tgz", + "integrity": "sha512-ak2GvTFQz3UAOw8cuQq8pWE+TNygQB6O47rMhvevvTzETh7VkHRFtRUwJynX5hwzFvQMP6G0az5JrBGuwaMwYQ==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@napi-rs/wasm-runtime": "^1.0.7" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.0.0-beta.47", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.0.0-beta.47.tgz", + "integrity": "sha512-o5BpmBnXU+Cj+9+ndMcdKjhZlPb79dVPBZnWwMnI4RlNSSq5yOvFZqvfPYbyacvnW03Na4n5XXQAPhu3RydZ0w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-ia32-msvc": { + "version": "1.0.0-beta.47", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-1.0.0-beta.47.tgz", + "integrity": "sha512-FVOmfyYehNE92IfC9Kgs913UerDog2M1m+FADJypKz0gmRg3UyTt4o1cZMCAl7MiR89JpM9jegNO1nXuP1w1vw==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-x64-msvc": { + "version": "1.0.0-beta.47", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.0.0-beta.47.tgz", + "integrity": "sha512-by/70F13IUE101Bat0oeH8miwWX5mhMFPk1yjCdxoTNHTyTdLgb0THNaebRM6AP7Kz+O3O2qx87sruYuF5UxHg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.53.tgz", + "integrity": "sha512-vENRlFU4YbrwVqNDZ7fLvy+JR1CRkyr01jhSiDpE1u6py3OMzQfztQU2jxykW3ALNxO4kSlqIDeYyD0Y9RcQeQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@standard-schema/spec": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", + "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", + "license": "MIT" + }, + "node_modules/@standard-schema/utils": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@standard-schema/utils/-/utils-0.3.0.tgz", + "integrity": "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g==", + "license": "MIT" + }, + "node_modules/@stripe/react-stripe-js": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/@stripe/react-stripe-js/-/react-stripe-js-5.4.1.tgz", + "integrity": "sha512-ipeYcAHa4EPmjwfv0lFE+YDVkOQ0TMKkFWamW+BqmnSkEln/hO8rmxGPPWcd9WjqABx6Ro8Xg4pAS7evCcR9cw==", + "license": "MIT", + "dependencies": { + "prop-types": "^15.7.2" + }, + "peerDependencies": { + "@stripe/stripe-js": ">=8.0.0 <9.0.0", + "react": ">=16.8.0 <20.0.0", + "react-dom": ">=16.8.0 <20.0.0" + } + }, + "node_modules/@stripe/stripe-js": { + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/@stripe/stripe-js/-/stripe-js-8.6.0.tgz", + "integrity": "sha512-EB0/GGgs4hfezzkiMkinlRgWtjz8fSdwVQhwYS7Sg/RQrSvuNOz+ssPjD+lAzqaYTCB0zlbrt0fcqVziLJrufQ==", + "license": "MIT", + "engines": { + "node": ">=12.16" + } + }, + "node_modules/@tweenjs/tween.js": { + "version": "23.1.3", + "resolved": "https://registry.npmjs.org/@tweenjs/tween.js/-/tween.js-23.1.3.tgz", + "integrity": "sha512-vJmvvwFxYuGnF2axRtPYocag6Clbb5YS7kLL+SO/TeVFzHqDIWrNKYtcsPMibjDx9O+bu+psAy9NKfWklassUA==", + "license": "MIT" + }, + "node_modules/@tybys/wasm-util": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.1.tgz", + "integrity": "sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@types/babel__core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz", + "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz", + "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.28.2" + } + }, + "node_modules/@types/d3-array": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@types/d3-array/-/d3-array-3.2.2.tgz", + "integrity": "sha512-hOLWVbm7uRza0BYXpIIW5pxfrKe0W+D5lrFiAEYR+pb6w3N2SwSMaJbXdUfSEv+dT4MfHBLtn5js0LAWaO6otw==", + "license": "MIT" + }, + "node_modules/@types/d3-color": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.3.tgz", + "integrity": "sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==", + "license": "MIT" + }, + "node_modules/@types/d3-ease": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-ease/-/d3-ease-3.0.2.tgz", + "integrity": "sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA==", + "license": "MIT" + }, + "node_modules/@types/d3-interpolate": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-3.0.4.tgz", + "integrity": "sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA==", + "license": "MIT", + "dependencies": { + "@types/d3-color": "*" + } + }, + "node_modules/@types/d3-path": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.1.1.tgz", + "integrity": "sha512-VMZBYyQvbGmWyWVea0EHs/BwLgxc+MKi1zLDCONksozI4YJMcTt8ZEuIR4Sb1MMTE8MMW49v0IwI5+b7RmfWlg==", + "license": "MIT" + }, + "node_modules/@types/d3-scale": { + "version": "4.0.9", + "resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.9.tgz", + "integrity": "sha512-dLmtwB8zkAeO/juAMfnV+sItKjlsw2lKdZVVy6LRr0cBmegxSABiLEpGVmSJJ8O08i4+sGR6qQtb6WtuwJdvVw==", + "license": "MIT", + "dependencies": { + "@types/d3-time": "*" + } + }, + "node_modules/@types/d3-shape": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-3.1.7.tgz", + "integrity": "sha512-VLvUQ33C+3J+8p+Daf+nYSOsjB4GXp19/S/aGo60m9h1v6XaxjiT82lKVWJCfzhtuZ3yD7i/TPeC/fuKLLOSmg==", + "license": "MIT", + "dependencies": { + "@types/d3-path": "*" + } + }, + "node_modules/@types/d3-time": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.4.tgz", + "integrity": "sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g==", + "license": "MIT" + }, + "node_modules/@types/d3-timer": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-3.0.2.tgz", + "integrity": "sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw==", + "license": "MIT" + }, + "node_modules/@types/draco3d": { + "version": "1.4.10", + "resolved": "https://registry.npmjs.org/@types/draco3d/-/draco3d-1.4.10.tgz", + "integrity": "sha512-AX22jp8Y7wwaBgAixaSvkoG4M/+PlAcm3Qs4OW8yT9DM4xUpWKeFhLueTAyZF39pviAdcDdeJoACapiAceqNcw==", + "license": "MIT" + }, + "node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/history": { + "version": "4.7.11", + "resolved": "https://registry.npmjs.org/@types/history/-/history-4.7.11.tgz", + "integrity": "sha512-qjDJRrmvBMiTx+jyLxvLfJU7UznFuokDv4f3WRuriHKERccVpFU+8XMQUAbDzoiJCsmexxRExQeMwwCdamSKDA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/jszip": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@types/jszip/-/jszip-3.4.0.tgz", + "integrity": "sha512-GFHqtQQP3R4NNuvZH3hNCYD0NbyBZ42bkN7kO3NDrU/SnvIZWMS8Bp38XCsRKBT5BXvgm0y1zqpZWp/ZkRzBzg==", + "dev": true, + "license": "MIT", + "dependencies": { + "jszip": "*" + } + }, + "node_modules/@types/node": { + "version": "24.10.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.4.tgz", + "integrity": "sha512-vnDVpYPMzs4wunl27jHrfmwojOGKya0xyM3sH+UE5iv5uPS6vX7UIoh6m+vQc5LGBq52HBKPIn/zcSZVzeDEZg==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~7.16.0" + } + }, + "node_modules/@types/offscreencanvas": { + "version": "2019.7.3", + "resolved": "https://registry.npmjs.org/@types/offscreencanvas/-/offscreencanvas-2019.7.3.tgz", + "integrity": "sha512-ieXiYmgSRXUDeOntE1InxjWyvEelZGP63M+cGuquuRLuIKKT1osnkXjxev9B7d1nXSug5vpunx+gNlbVxMlC9A==", + "license": "MIT" + }, + "node_modules/@types/pako": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/pako/-/pako-2.0.4.tgz", + "integrity": "sha512-VWDCbrLeVXJM9fihYodcLiIv0ku+AlOa/TQ1SvYOaBuyrSKgEcro95LJyIsJ4vSo6BXIxOKxiJAat04CmST9Fw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/peerjs": { + "version": "0.0.30", + "resolved": "https://registry.npmjs.org/@types/peerjs/-/peerjs-0.0.30.tgz", + "integrity": "sha512-yaWnpWhbf6qV3bJFRK3NLY3oX34J7/JMAXYahRNLSeDODCC/pHxF/9wSc3GtpA9DQF7dpeejDPkCdUp9knxVHg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/webrtc": "*" + } + }, + "node_modules/@types/qrcode": { + "version": "1.5.6", + "resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.5.6.tgz", + "integrity": "sha512-te7NQcV2BOvdj2b1hCAHzAoMNuj65kNBMz0KBaxM6c3VGBOhU0dURQKOtH8CFNI/dsKkwlv32p26qYQTWoB5bw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/qrcode-generator": { + "version": "0.0.16", + "resolved": "https://registry.npmjs.org/@types/qrcode-generator/-/qrcode-generator-0.0.16.tgz", + "integrity": "sha512-i+wPpeHH64qJHUIz51+tPq5FRkgMxE9/uhDE5eSlj3qujIjHm3U1wHfy8nMD/m1VKaXHO/uDjHamPVz2Fr4IPA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/react": { + "version": "19.2.7", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.7.tgz", + "integrity": "sha512-MWtvHrGZLFttgeEj28VXHxpmwYbor/ATPYbBfSFZEIRK0ecCFLl2Qo55z52Hss+UV9CRN7trSeq1zbgx7YDWWg==", + "license": "MIT", + "dependencies": { + "csstype": "^3.2.2" + } + }, + "node_modules/@types/react-dom": { + "version": "19.2.3", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.3.tgz", + "integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@types/react": "^19.2.0" + } + }, + "node_modules/@types/react-reconciler": { + "version": "0.32.3", + "resolved": "https://registry.npmjs.org/@types/react-reconciler/-/react-reconciler-0.32.3.tgz", + "integrity": "sha512-cMi5ZrLG7UtbL7LTK6hq9w/EZIRk4Mf1Z5qHoI+qBh7/WkYkFXQ7gOto2yfUvPzF5ERMAhaXS5eTQ2SAnHjLzA==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*" + } + }, + "node_modules/@types/react-router": { + "version": "5.1.20", + "resolved": "https://registry.npmjs.org/@types/react-router/-/react-router-5.1.20.tgz", + "integrity": "sha512-jGjmu/ZqS7FjSH6owMcD5qpq19+1RS9DeVRqfl1FeBMxTDQAGwlMWOcs52NDoXaNKyG3d1cYQFMs9rCrb88o9Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/history": "^4.7.11", + "@types/react": "*" + } + }, + "node_modules/@types/react-router-dom": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/@types/react-router-dom/-/react-router-dom-5.3.3.tgz", + "integrity": "sha512-kpqnYK4wcdm5UaWI3fLcELopqLrHgLqNsdpHauzlQktfkHL3npOSwtj1Uz9oKBAzs7lFtVkV8j83voAz2D8fhw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/history": "^4.7.11", + "@types/react": "*", + "@types/react-router": "*" + } + }, + "node_modules/@types/stats.js": { + "version": "0.17.4", + "resolved": "https://registry.npmjs.org/@types/stats.js/-/stats.js-0.17.4.tgz", + "integrity": "sha512-jIBvWWShCvlBqBNIZt0KAshWpvSjhkwkEu4ZUcASoAvhmrgAUI2t1dXrjSL4xXVLB4FznPrIsX3nKXFl/Dt4vA==", + "license": "MIT" + }, + "node_modules/@types/three": { + "version": "0.182.0", + "resolved": "https://registry.npmjs.org/@types/three/-/three-0.182.0.tgz", + "integrity": "sha512-WByN9V3Sbwbe2OkWuSGyoqQO8Du6yhYaXtXLoA5FkKTUJorZ+yOHBZ35zUUPQXlAKABZmbYp5oAqpA4RBjtJ/Q==", + "license": "MIT", + "dependencies": { + "@dimforge/rapier3d-compat": "~0.12.0", + "@tweenjs/tween.js": "~23.1.3", + "@types/stats.js": "*", + "@types/webxr": ">=0.5.17", + "@webgpu/types": "*", + "fflate": "~0.8.2", + "meshoptimizer": "~0.22.0" + } + }, + "node_modules/@types/use-sync-external-store": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.6.tgz", + "integrity": "sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg==", + "license": "MIT" + }, + "node_modules/@types/webrtc": { + "version": "0.0.47", + "resolved": "https://registry.npmjs.org/@types/webrtc/-/webrtc-0.0.47.tgz", + "integrity": "sha512-l4G2skp32Q7ENiocokNhIHG6dKfws9ALJ04zW+ZZ97LMe6G+yqs/E8qsJLZJELGcdUDgEWvi2jg7KSP5TpJxeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/webxr": { + "version": "0.5.24", + "resolved": "https://registry.npmjs.org/@types/webxr/-/webxr-0.5.24.tgz", + "integrity": "sha512-h8fgEd/DpoS9CBrjEQXR+dIDraopAEfu4wYVNY2tEPwk60stPWhvZMf4Foo5FakuQ7HFZoa8WceaWFervK2Ovg==", + "license": "MIT" + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.50.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.50.1.tgz", + "integrity": "sha512-PKhLGDq3JAg0Jk/aK890knnqduuI/Qj+udH7wCf0217IGi4gt+acgCyPVe79qoT+qKUvHMDQkwJeKW9fwl8Cyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "8.50.1", + "@typescript-eslint/type-utils": "8.50.1", + "@typescript-eslint/utils": "8.50.1", + "@typescript-eslint/visitor-keys": "8.50.1", + "ignore": "^7.0.0", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.50.1", + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", + "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.50.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.50.1.tgz", + "integrity": "sha512-hM5faZwg7aVNa819m/5r7D0h0c9yC4DUlWAOvHAtISdFTc8xB86VmX5Xqabrama3wIPJ/q9RbGS1worb6JfnMg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/scope-manager": "8.50.1", + "@typescript-eslint/types": "8.50.1", + "@typescript-eslint/typescript-estree": "8.50.1", + "@typescript-eslint/visitor-keys": "8.50.1", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/project-service": { + "version": "8.50.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.50.1.tgz", + "integrity": "sha512-E1ur1MCVf+YiP89+o4Les/oBAVzmSbeRB0MQLfSlYtbWU17HPxZ6Bhs5iYmKZRALvEuBoXIZMOIRRc/P++Ortg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/tsconfig-utils": "^8.50.1", + "@typescript-eslint/types": "^8.50.1", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.50.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.50.1.tgz", + "integrity": "sha512-mfRx06Myt3T4vuoHaKi8ZWNTPdzKPNBhiblze5N50//TSHOAQQevl/aolqA/BcqqbJ88GUnLqjjcBc8EWdBcVw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.50.1", + "@typescript-eslint/visitor-keys": "8.50.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.50.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.50.1.tgz", + "integrity": "sha512-ooHmotT/lCWLXi55G4mvaUF60aJa012QzvLK0Y+Mp4WdSt17QhMhWOaBWeGTFVkb2gDgBe19Cxy1elPXylslDw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.50.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.50.1.tgz", + "integrity": "sha512-7J3bf022QZE42tYMO6SL+6lTPKFk/WphhRPe9Tw/el+cEwzLz1Jjz2PX3GtGQVxooLDKeMVmMt7fWpYRdG5Etg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.50.1", + "@typescript-eslint/typescript-estree": "8.50.1", + "@typescript-eslint/utils": "8.50.1", + "debug": "^4.3.4", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.50.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.50.1.tgz", + "integrity": "sha512-v5lFIS2feTkNyMhd7AucE/9j/4V9v5iIbpVRncjk/K0sQ6Sb+Np9fgYS/63n6nwqahHQvbmujeBL7mp07Q9mlA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.50.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.50.1.tgz", + "integrity": "sha512-woHPdW+0gj53aM+cxchymJCrh0cyS7BTIdcDxWUNsclr9VDkOSbqC13juHzxOmQ22dDkMZEpZB+3X1WpUvzgVQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/project-service": "8.50.1", + "@typescript-eslint/tsconfig-utils": "8.50.1", + "@typescript-eslint/types": "8.50.1", + "@typescript-eslint/visitor-keys": "8.50.1", + "debug": "^4.3.4", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "tinyglobby": "^0.2.15", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.7.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", + "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.50.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.50.1.tgz", + "integrity": "sha512-lCLp8H1T9T7gPbEuJSnHwnSuO9mDf8mfK/Nion5mZmiEaQD9sWf9W4dfeFqRyqRjF06/kBuTmAqcs9sewM2NbQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.7.0", + "@typescript-eslint/scope-manager": "8.50.1", + "@typescript-eslint/types": "8.50.1", + "@typescript-eslint/typescript-estree": "8.50.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.50.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.50.1.tgz", + "integrity": "sha512-IrDKrw7pCRUR94zeuCSUWQ+w8JEf5ZX5jl/e6AHGSLi1/zIr0lgutfn/7JpfCey+urpgQEdrZVYzCaVVKiTwhQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.50.1", + "eslint-visitor-keys": "^4.2.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@use-gesture/core": { + "version": "10.3.1", + "resolved": "https://registry.npmjs.org/@use-gesture/core/-/core-10.3.1.tgz", + "integrity": "sha512-WcINiDt8WjqBdUXye25anHiNxPc0VOrlT8F6LLkU6cycrOGUDyY/yyFmsg3k8i5OLvv25llc0QC45GhR/C8llw==", + "license": "MIT" + }, + "node_modules/@use-gesture/react": { + "version": "10.3.1", + "resolved": "https://registry.npmjs.org/@use-gesture/react/-/react-10.3.1.tgz", + "integrity": "sha512-Yy19y6O2GJq8f7CHf7L0nxL8bf4PZCPaVOCgJrusOeFHY1LvHgYXnmnXg6N5iwAnbgbZCDjo60SiM6IPJi9C5g==", + "license": "MIT", + "dependencies": { + "@use-gesture/core": "10.3.1" + }, + "peerDependencies": { + "react": ">= 16.8.0" + } + }, + "node_modules/@vitejs/plugin-react": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-5.1.2.tgz", + "integrity": "sha512-EcA07pHJouywpzsoTUqNh5NwGayl2PPVEJKUSinGGSxFGYn+shYbqMGBg6FXDqgXum9Ou/ecb+411ssw8HImJQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.28.5", + "@babel/plugin-transform-react-jsx-self": "^7.27.1", + "@babel/plugin-transform-react-jsx-source": "^7.27.1", + "@rolldown/pluginutils": "1.0.0-beta.53", + "@types/babel__core": "^7.20.5", + "react-refresh": "^0.18.0" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "peerDependencies": { + "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" + } + }, + "node_modules/@webgpu/types": { + "version": "0.1.68", + "resolved": "https://registry.npmjs.org/@webgpu/types/-/types-0.1.68.tgz", + "integrity": "sha512-3ab1B59Ojb6RwjOspYLsTpCzbNB3ZaamIAxBMmvnNkiDoLTZUOBXZ9p5nAYVEkQlDdf6qAZWi1pqj9+ypiqznA==", + "license": "BSD-3-Clause" + }, + "node_modules/acorn": { + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/base64-arraybuffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz", + "integrity": "sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/baseline-browser-mapping": { + "version": "2.9.11", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.11.tgz", + "integrity": "sha512-Sg0xJUNDU1sJNGdfGWhVHX0kkZ+HWcvmVymJbj6NSgZZmW/8S9Y2HQ5euytnIgakgxN6papOAWiwDo1ctFDcoQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "baseline-browser-mapping": "dist/cli.js" + } + }, + "node_modules/bidi-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/bidi-js/-/bidi-js-1.0.3.tgz", + "integrity": "sha512-RKshQI1R3YQ+n9YJz2QQ147P66ELpa1FQEg20Dk8oW9t2KgLbpDLLp9aGZ7y8WHSshDknG0bknqGw5/tyCs5tw==", + "license": "MIT", + "dependencies": { + "require-from-string": "^2.0.2" + } + }, + "node_modules/blakejs": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", + "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==", + "license": "MIT" + }, + "node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/browserslist": { + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.1.tgz", + "integrity": "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "baseline-browser-mapping": "^2.9.0", + "caniuse-lite": "^1.0.30001759", + "electron-to-chromium": "^1.5.263", + "node-releases": "^2.0.27", + "update-browserslist-db": "^1.2.0" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/camera-controls": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/camera-controls/-/camera-controls-3.1.2.tgz", + "integrity": "sha512-xkxfpG2ECZ6Ww5/9+kf4mfg1VEYAoe9aDSY+IwF0UEs7qEzwy0aVRfs2grImIECs/PoBtWFrh7RXsQkwG922JA==", + "license": "MIT", + "engines": { + "node": ">=22.0.0", + "npm": ">=10.5.1" + }, + "peerDependencies": { + "three": ">=0.126.1" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001761", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001761.tgz", + "integrity": "sha512-JF9ptu1vP2coz98+5051jZ4PwQgd2ni8A+gYSN7EA7dPKIMf0pDlSUxhdmVOaV3/fYK5uWBkgSXJaRLr4+3A6g==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "node_modules/clsx": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", + "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, + "node_modules/cookie": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz", + "integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "license": "MIT" + }, + "node_modules/cross-env": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", + "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.1" + }, + "bin": { + "cross-env": "src/bin/cross-env.js", + "cross-env-shell": "src/bin/cross-env-shell.js" + }, + "engines": { + "node": ">=10.14", + "npm": ">=6", + "yarn": ">=1" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/css-line-break": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/css-line-break/-/css-line-break-2.1.0.tgz", + "integrity": "sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==", + "license": "MIT", + "dependencies": { + "utrie": "^1.0.2" + } + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "license": "MIT" + }, + "node_modules/d3-array": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz", + "integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==", + "license": "ISC", + "dependencies": { + "internmap": "1 - 2" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-color": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz", + "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-ease": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz", + "integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-format": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.0.tgz", + "integrity": "sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-interpolate": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz", + "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==", + "license": "ISC", + "dependencies": { + "d3-color": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-path": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz", + "integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-scale": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz", + "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==", + "license": "ISC", + "dependencies": { + "d3-array": "2.10.0 - 3", + "d3-format": "1 - 3", + "d3-interpolate": "1.2.0 - 3", + "d3-time": "2.1.1 - 3", + "d3-time-format": "2 - 4" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-shape": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz", + "integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==", + "license": "ISC", + "dependencies": { + "d3-path": "^3.1.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz", + "integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==", + "license": "ISC", + "dependencies": { + "d3-array": "2 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time-format": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz", + "integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==", + "license": "ISC", + "dependencies": { + "d3-time": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-timer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz", + "integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decimal.js": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", + "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==", + "license": "MIT" + }, + "node_modules/decimal.js-light": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/decimal.js-light/-/decimal.js-light-2.5.1.tgz", + "integrity": "sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg==", + "license": "MIT" + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/detect-gpu": { + "version": "5.0.70", + "resolved": "https://registry.npmjs.org/detect-gpu/-/detect-gpu-5.0.70.tgz", + "integrity": "sha512-bqerEP1Ese6nt3rFkwPnGbsUF9a4q+gMmpTVVOEzoCyeCc+y7/RvJnQZJx1JwhgQI5Ntg0Kgat8Uu7XpBqnz1w==", + "license": "MIT", + "dependencies": { + "webgl-constants": "^1.1.1" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/dijkstrajs": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.3.tgz", + "integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==", + "license": "MIT" + }, + "node_modules/draco3d": { + "version": "1.5.7", + "resolved": "https://registry.npmjs.org/draco3d/-/draco3d-1.5.7.tgz", + "integrity": "sha512-m6WCKt/erDXcw+70IJXnG7M3awwQPAsZvJGX5zY7beBqpELw6RDGkYVU0W43AFxye4pDZ5i2Lbyc/NNGqwjUVQ==", + "license": "Apache-2.0" + }, + "node_modules/electron-to-chromium": { + "version": "1.5.267", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.267.tgz", + "integrity": "sha512-0Drusm6MVRXSOJpGbaSVgcQsuB4hEkMpHXaVstcPmhu5LIedxs1xNK/nIxmQIU/RPC0+1/o0AVZfBTkTNJOdUw==", + "dev": true, + "license": "ISC" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/es-toolkit": { + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.43.0.tgz", + "integrity": "sha512-SKCT8AsWvYzBBuUqMk4NPwFlSdqLpJwmy6AP322ERn8W2YLIB6JBXnwMI2Qsh2gfphT3q7EKAxKb23cvFHFwKA==", + "license": "MIT", + "workspaces": [ + "docs", + "benchmarks" + ] + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "9.39.2", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.2.tgz", + "integrity": "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.21.1", + "@eslint/config-helpers": "^0.4.2", + "@eslint/core": "^0.17.0", + "@eslint/eslintrc": "^3.3.1", + "@eslint/js": "9.39.2", + "@eslint/plugin-kit": "^0.4.1", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^8.4.0", + "eslint-visitor-keys": "^4.2.1", + "espree": "^10.4.0", + "esquery": "^1.5.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-plugin-react-hooks": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-7.0.1.tgz", + "integrity": "sha512-O0d0m04evaNzEPoSW+59Mezf8Qt0InfgGIBJnpC0h3NH/WjUAR7BIKUfysC6todmtiZ/A0oUVS8Gce0WhBrHsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.24.4", + "@babel/parser": "^7.24.4", + "hermes-parser": "^0.25.1", + "zod": "^3.25.0 || ^4.0.0", + "zod-validation-error": "^3.5.0 || ^4.0.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0" + } + }, + "node_modules/eslint-plugin-react-refresh": { + "version": "0.4.26", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.26.tgz", + "integrity": "sha512-1RETEylht2O6FM/MvgnyvT+8K21wLqDNg4qD51Zj3guhjt433XbnnkVttHMyaVyAFD03QSV4LPS5iE3VQmO7XQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "eslint": ">=8.40" + } + }, + "node_modules/eslint-scope": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", + "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", + "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.15.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.2.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "license": "MIT" + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-xml-parser": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.3.3.tgz", + "integrity": "sha512-2O3dkPAAC6JavuMm8+4+pgTk+5hoAs+CjZ+sWcQLkX9+/tHRuTkQh/Oaifr8qDmZ8iEHb771Ea6G8CdwkrgvYA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT", + "dependencies": { + "strnum": "^2.1.0" + }, + "bin": { + "fxparser": "src/cli/cli.js" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fflate": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.2.tgz", + "integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==", + "license": "MIT" + }, + "node_modules/file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/flatted": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", + "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", + "dev": true, + "license": "ISC" + }, + "node_modules/framer-motion": { + "version": "12.23.26", + "resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-12.23.26.tgz", + "integrity": "sha512-cPcIhgR42xBn1Uj+PzOyheMtZ73H927+uWPDVhUMqxy8UHt6Okavb6xIz9J/phFUHUj0OncR6UvMfJTXoc/LKA==", + "license": "MIT", + "dependencies": { + "motion-dom": "^12.23.23", + "motion-utils": "^12.23.6", + "tslib": "^2.4.0" + }, + "peerDependencies": { + "@emotion/is-prop-valid": "*", + "react": "^18.0.0 || ^19.0.0", + "react-dom": "^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@emotion/is-prop-valid": { + "optional": true + }, + "react": { + "optional": true + }, + "react-dom": { + "optional": true + } + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "16.5.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-16.5.0.tgz", + "integrity": "sha512-c/c15i26VrJ4IRt5Z89DnIzCGDn9EcebibhAOjw5ibqEHsE1wLUgkPn9RDmNcUKyU87GeaL633nyJ+pplFR2ZQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/glsl-noise": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/glsl-noise/-/glsl-noise-0.0.0.tgz", + "integrity": "sha512-b/ZCF6amfAUb7dJM/MxRs7AetQEahYzJ8PtgfrmEdtw6uyGOr+ZSGtgjFm6mfsBkxJ4d2W7kg+Nlqzqvn3Bc0w==", + "license": "MIT" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/hash-wasm": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/hash-wasm/-/hash-wasm-4.12.0.tgz", + "integrity": "sha512-+/2B2rYLb48I/evdOIhP+K/DD2ca2fgBjp6O+GBEnCDk2e4rpeXIK8GvIyRPjTezgmWn9gmKwkQjjx6BtqDHVQ==", + "license": "MIT" + }, + "node_modules/hermes-estree": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/hermes-estree/-/hermes-estree-0.25.1.tgz", + "integrity": "sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw==", + "dev": true, + "license": "MIT" + }, + "node_modules/hermes-parser": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/hermes-parser/-/hermes-parser-0.25.1.tgz", + "integrity": "sha512-6pEjquH3rqaI6cYAXYPcz9MS4rY6R4ngRgrgfDshRptUZIc3lw0MCIJIGDj9++mfySOuPTHB4nrSW99BCvOPIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hermes-estree": "0.25.1" + } + }, + "node_modules/hls.js": { + "version": "1.6.15", + "resolved": "https://registry.npmjs.org/hls.js/-/hls.js-1.6.15.tgz", + "integrity": "sha512-E3a5VwgXimGHwpRGV+WxRTKeSp2DW5DI5MWv34ulL3t5UNmyJWCQ1KmLEHbYzcfThfXG8amBL+fCYPneGHC4VA==", + "license": "Apache-2.0" + }, + "node_modules/html2canvas": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/html2canvas/-/html2canvas-1.4.1.tgz", + "integrity": "sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==", + "license": "MIT", + "dependencies": { + "css-line-break": "^2.1.0", + "text-segmentation": "^1.0.3" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==", + "license": "MIT" + }, + "node_modules/immer": { + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/immer/-/immer-10.2.0.tgz", + "integrity": "sha512-d/+XTN3zfODyjr89gM3mPq1WNX2B8pYsu7eORitdwyA2sBubnTl3laYlBk4sXY5FUa5qTZGBDPJICVbvqzjlbw==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/immer" + } + }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/internmap": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz", + "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-promise": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz", + "integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==", + "license": "MIT" + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "license": "MIT" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "license": "ISC" + }, + "node_modules/its-fine": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/its-fine/-/its-fine-2.0.0.tgz", + "integrity": "sha512-KLViCmWx94zOvpLwSlsx6yOCeMhZYaxrJV87Po5k/FoZzcPSahvK5qJ7fYhS61sZi5ikmh2S3Hz55A2l3U69ng==", + "license": "MIT", + "dependencies": { + "@types/react-reconciler": "^0.28.9" + }, + "peerDependencies": { + "react": "^19.0.0" + } + }, + "node_modules/its-fine/node_modules/@types/react-reconciler": { + "version": "0.28.9", + "resolved": "https://registry.npmjs.org/@types/react-reconciler/-/react-reconciler-0.28.9.tgz", + "integrity": "sha512-HHM3nxyUZ3zAylX8ZEyrDNd2XZOnQ0D5XfunJF5FLQnZbHHYq4UWvW1QfelQNXv1ICNkwYhfxjwfnqivYB6bFg==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "license": "MIT" + }, + "node_modules/js-yaml": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", + "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jszip": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz", + "integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==", + "license": "(MIT OR GPL-3.0-or-later)", + "dependencies": { + "lie": "~3.3.0", + "pako": "~1.0.2", + "readable-stream": "~2.3.6", + "setimmediate": "^1.0.5" + } + }, + "node_modules/jszip/node_modules/pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", + "license": "(MIT AND Zlib)" + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/lie": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", + "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", + "license": "MIT", + "dependencies": { + "immediate": "~3.0.5" + } + }, + "node_modules/lightningcss": { + "version": "1.30.2", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.30.2.tgz", + "integrity": "sha512-utfs7Pr5uJyyvDETitgsaqSyjCb2qNRAtuqUeWIAKztsOYdcACf2KtARYXg2pSvhkt+9NfoaNY7fxjl6nuMjIQ==", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "detect-libc": "^2.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-android-arm64": "1.30.2", + "lightningcss-darwin-arm64": "1.30.2", + "lightningcss-darwin-x64": "1.30.2", + "lightningcss-freebsd-x64": "1.30.2", + "lightningcss-linux-arm-gnueabihf": "1.30.2", + "lightningcss-linux-arm64-gnu": "1.30.2", + "lightningcss-linux-arm64-musl": "1.30.2", + "lightningcss-linux-x64-gnu": "1.30.2", + "lightningcss-linux-x64-musl": "1.30.2", + "lightningcss-win32-arm64-msvc": "1.30.2", + "lightningcss-win32-x64-msvc": "1.30.2" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.30.2", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.30.2.tgz", + "integrity": "sha512-BH9sEdOCahSgmkVhBLeU7Hc9DWeZ1Eb6wNS6Da8igvUwAe0sqROHddIlvU06q3WyXVEOYDZ6ykBZQnjTbmo4+A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.30.2", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.30.2.tgz", + "integrity": "sha512-ylTcDJBN3Hp21TdhRT5zBOIi73P6/W0qwvlFEk22fkdXchtNTOU4Qc37SkzV+EKYxLouZ6M4LG9NfZ1qkhhBWA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-x64": { + "version": "1.30.2", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.30.2.tgz", + "integrity": "sha512-oBZgKchomuDYxr7ilwLcyms6BCyLn0z8J0+ZZmfpjwg9fRVZIR5/GMXd7r9RH94iDhld3UmSjBM6nXWM2TfZTQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.30.2", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.30.2.tgz", + "integrity": "sha512-c2bH6xTrf4BDpK8MoGG4Bd6zAMZDAXS569UxCAGcA7IKbHNMlhGQ89eRmvpIUGfKWNVdbhSbkQaWhEoMGmGslA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.30.2", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.30.2.tgz", + "integrity": "sha512-eVdpxh4wYcm0PofJIZVuYuLiqBIakQ9uFZmipf6LF/HRj5Bgm0eb3qL/mr1smyXIS1twwOxNWndd8z0E374hiA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.30.2", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.30.2.tgz", + "integrity": "sha512-UK65WJAbwIJbiBFXpxrbTNArtfuznvxAJw4Q2ZGlU8kPeDIWEX1dg3rn2veBVUylA2Ezg89ktszWbaQnxD/e3A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.30.2", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.30.2.tgz", + "integrity": "sha512-5Vh9dGeblpTxWHpOx8iauV02popZDsCYMPIgiuw97OJ5uaDsL86cnqSFs5LZkG3ghHoX5isLgWzMs+eD1YzrnA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.30.2", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.30.2.tgz", + "integrity": "sha512-Cfd46gdmj1vQ+lR6VRTTadNHu6ALuw2pKR9lYq4FnhvgBc4zWY1EtZcAc6EffShbb1MFrIPfLDXD6Xprbnni4w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.30.2", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.30.2.tgz", + "integrity": "sha512-XJaLUUFXb6/QG2lGIW6aIk6jKdtjtcffUT0NKvIqhSBY3hh9Ch+1LCeH80dR9q9LBjG3ewbDjnumefsLsP6aiA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.30.2", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.30.2.tgz", + "integrity": "sha512-FZn+vaj7zLv//D/192WFFVA0RgHawIcHqLX9xuWiQt7P0PtdFEVaxgF9rjM/IRYHQXNnk61/H/gb2Ei+kUQ4xQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.30.2", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.30.2.tgz", + "integrity": "sha512-5g1yc73p+iAkid5phb4oVFMB45417DkRevRbt/El/gKXJk4jid+vPFF/AXbxn05Aky8PapwzZrdJShv5C0avjw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "license": "MIT", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/lucide-react": { + "version": "0.554.0", + "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.554.0.tgz", + "integrity": "sha512-St+z29uthEJVx0Is7ellNkgTEhaeSoA42I7JjOCBCrc5X6LYMGSv0P/2uS5HDLTExP5tpiqRD2PyUEOS6s9UXA==", + "license": "ISC", + "peerDependencies": { + "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/maath": { + "version": "0.10.8", + "resolved": "https://registry.npmjs.org/maath/-/maath-0.10.8.tgz", + "integrity": "sha512-tRvbDF0Pgqz+9XUa4jjfgAQ8/aPKmQdWXilFu2tMy4GWj4NOsx99HlULO4IeREfbO3a0sA145DZYyvXPkybm0g==", + "license": "MIT", + "peerDependencies": { + "@types/three": ">=0.134.0", + "three": ">=0.134.0" + } + }, + "node_modules/meshline": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/meshline/-/meshline-3.3.1.tgz", + "integrity": "sha512-/TQj+JdZkeSUOl5Mk2J7eLcYTLiQm2IDzmlSvYm7ov15anEcDJ92GHqqazxTSreeNgfnYu24kiEvvv0WlbCdFQ==", + "license": "MIT", + "peerDependencies": { + "three": ">=0.137" + } + }, + "node_modules/meshoptimizer": { + "version": "0.22.0", + "resolved": "https://registry.npmjs.org/meshoptimizer/-/meshoptimizer-0.22.0.tgz", + "integrity": "sha512-IebiK79sqIy+E4EgOr+CAw+Ke8hAspXKzBd0JdgEmPHiAwmvEj2S4h1rfvo+o/BnfEYd/jAOg5IeeIjzlzSnDg==", + "license": "MIT" + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/motion-dom": { + "version": "12.23.23", + "resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-12.23.23.tgz", + "integrity": "sha512-n5yolOs0TQQBRUFImrRfs/+6X4p3Q4n1dUEqt/H58Vx7OW6RF+foWEgmTVDhIWJIMXOuNNL0apKH2S16en9eiA==", + "license": "MIT", + "dependencies": { + "motion-utils": "^12.23.6" + } + }, + "node_modules/motion-utils": { + "version": "12.23.6", + "resolved": "https://registry.npmjs.org/motion-utils/-/motion-utils-12.23.6.tgz", + "integrity": "sha512-eAWoPgr4eFEOFfg2WjIsMoqJTW6Z8MTUCgn/GZ3VRpClWBdnbjryiA3ZSNLyxCTmCQx4RmYX6jX1iWHbenUPNQ==", + "license": "MIT" + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-releases": { + "version": "2.0.27", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz", + "integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/pako": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz", + "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==", + "license": "(MIT AND Zlib)" + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/peerjs": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/peerjs/-/peerjs-1.5.5.tgz", + "integrity": "sha512-viMUCPDL6CSfOu0ZqVcFqbWRXNHIbv2lPqNbrBIjbFYrflebOjItJ4hPfhjnuUCstqciHVu9vVJ7jFqqKi/EuQ==", + "license": "MIT", + "dependencies": { + "@msgpack/msgpack": "^2.8.0", + "eventemitter3": "^4.0.7", + "peerjs-js-binarypack": "^2.1.0", + "webrtc-adapter": "^9.0.0" + }, + "engines": { + "node": ">= 14" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/peer" + } + }, + "node_modules/peerjs-js-binarypack": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/peerjs-js-binarypack/-/peerjs-js-binarypack-2.1.0.tgz", + "integrity": "sha512-YIwCC+pTzp3Bi8jPI9UFKO0t0SLo6xALnHkiNt/iUFmUUZG0fEEmEyFKvjsDKweiFitzHRyhuh6NvyJZ4nNxMg==", + "license": "MIT", + "engines": { + "node": ">= 14.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/peer" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pngjs": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz", + "integrity": "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==", + "license": "MIT", + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/postcss": { + "version": "8.5.6", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", + "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.11", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/potpack": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/potpack/-/potpack-1.0.2.tgz", + "integrity": "sha512-choctRBIV9EMT9WGAZHn3V7t0Z2pMQyl0EZE6pFc/6ml3ssw7Dlf/oAOvFwjm1HVsqfQN8GfeFyJ+d8tRzqueQ==", + "license": "ISC" + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "license": "MIT" + }, + "node_modules/promise-worker-transferable": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/promise-worker-transferable/-/promise-worker-transferable-1.0.4.tgz", + "integrity": "sha512-bN+0ehEnrXfxV2ZQvU2PetO0n4gqBD4ulq3MI1WOPLgr7/Mg9yRQkX5+0v1vagr74ZTsl7XtzlaYDo2EuCeYJw==", + "license": "Apache-2.0", + "dependencies": { + "is-promise": "^2.1.0", + "lie": "^3.0.2" + } + }, + "node_modules/prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + }, + "node_modules/prop-types/node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "license": "MIT" + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/qr.js": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/qr.js/-/qr.js-0.0.0.tgz", + "integrity": "sha512-c4iYnWb+k2E+vYpRimHqSu575b1/wKl4XFeJGpFmrJQz5I88v9aY2czh7s0w36srfCM1sXgC/xpoJz5dJfq+OQ==", + "license": "MIT" + }, + "node_modules/qrcode": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.4.tgz", + "integrity": "sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg==", + "license": "MIT", + "dependencies": { + "dijkstrajs": "^1.0.1", + "pngjs": "^5.0.0", + "yargs": "^15.3.1" + }, + "bin": { + "qrcode": "bin/qrcode" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/qrcode-generator": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/qrcode-generator/-/qrcode-generator-2.0.4.tgz", + "integrity": "sha512-mZSiP6RnbHl4xL2Ap5HfkjLnmxfKcPWpWe/c+5XxCuetEenqmNFf1FH/ftXPCtFG5/TDobjsjz6sSNL0Sr8Z9g==", + "license": "MIT" + }, + "node_modules/react": { + "version": "19.2.3", + "resolved": "https://registry.npmjs.org/react/-/react-19.2.3.tgz", + "integrity": "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "19.2.3", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.3.tgz", + "integrity": "sha512-yELu4WmLPw5Mr/lmeEpox5rw3RETacE++JgHqQzd2dg+YbJuat3jH4ingc+WPZhxaoFzdv9y33G+F7Nl5O0GBg==", + "license": "MIT", + "dependencies": { + "scheduler": "^0.27.0" + }, + "peerDependencies": { + "react": "^19.2.3" + } + }, + "node_modules/react-dom/node_modules/scheduler": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", + "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==", + "license": "MIT" + }, + "node_modules/react-is": { + "version": "19.2.3", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-19.2.3.tgz", + "integrity": "sha512-qJNJfu81ByyabuG7hPFEbXqNcWSU3+eVus+KJs+0ncpGfMyYdvSmxiJxbWR65lYi1I+/0HBcliO029gc4F+PnA==", + "license": "MIT", + "peer": true + }, + "node_modules/react-qr-code": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/react-qr-code/-/react-qr-code-2.0.18.tgz", + "integrity": "sha512-v1Jqz7urLMhkO6jkgJuBYhnqvXagzceg3qJUWayuCK/c6LTIonpWbwxR1f1APGd4xrW/QcQEovNrAojbUz65Tg==", + "license": "MIT", + "dependencies": { + "prop-types": "^15.8.1", + "qr.js": "0.0.0" + }, + "peerDependencies": { + "react": "*" + } + }, + "node_modules/react-reconciler": { + "version": "0.31.0", + "resolved": "https://registry.npmjs.org/react-reconciler/-/react-reconciler-0.31.0.tgz", + "integrity": "sha512-7Ob7Z+URmesIsIVRjnLoDGwBEG/tVitidU0nMsqX/eeJaLY89RISO/10ERe0MqmzuKUUB1rmY+h1itMbUHg9BQ==", + "license": "MIT", + "dependencies": { + "scheduler": "^0.25.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "peerDependencies": { + "react": "^19.0.0" + } + }, + "node_modules/react-redux": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.2.0.tgz", + "integrity": "sha512-ROY9fvHhwOD9ySfrF0wmvu//bKCQ6AeZZq1nJNtbDC+kk5DuSuNX/n6YWYF/SYy7bSba4D4FSz8DJeKY/S/r+g==", + "license": "MIT", + "dependencies": { + "@types/use-sync-external-store": "^0.0.6", + "use-sync-external-store": "^1.4.0" + }, + "peerDependencies": { + "@types/react": "^18.2.25 || ^19", + "react": "^18.0 || ^19", + "redux": "^5.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "redux": { + "optional": true + } + } + }, + "node_modules/react-refresh": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.18.0.tgz", + "integrity": "sha512-QgT5//D3jfjJb6Gsjxv0Slpj23ip+HtOpnNgnb2S5zU3CB26G/IDPGoy4RJB42wzFE46DRsstbW6tKHoKbhAxw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-router": { + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.11.0.tgz", + "integrity": "sha512-uI4JkMmjbWCZc01WVP2cH7ZfSzH91JAZUDd7/nIprDgWxBV1TkkmLToFh7EbMTcMak8URFRa2YoBL/W8GWnCTQ==", + "license": "MIT", + "dependencies": { + "cookie": "^1.0.1", + "set-cookie-parser": "^2.6.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "react": ">=18", + "react-dom": ">=18" + }, + "peerDependenciesMeta": { + "react-dom": { + "optional": true + } + } + }, + "node_modules/react-router-dom": { + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.11.0.tgz", + "integrity": "sha512-e49Ir/kMGRzFOOrYQBdoitq3ULigw4lKbAyKusnvtDu2t4dBX4AGYPrzNvorXmVuOyeakai6FUPW5MmibvVG8g==", + "license": "MIT", + "dependencies": { + "react-router": "7.11.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "react": ">=18", + "react-dom": ">=18" + } + }, + "node_modules/react-use-measure": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/react-use-measure/-/react-use-measure-2.1.7.tgz", + "integrity": "sha512-KrvcAo13I/60HpwGO5jpW7E9DfusKyLPLvuHlUyP5zqnmAPhNc6qTRjUQrdTADl0lpPpDVU2/Gg51UlOGHXbdg==", + "license": "MIT", + "peerDependencies": { + "react": ">=16.13", + "react-dom": ">=16.13" + }, + "peerDependenciesMeta": { + "react-dom": { + "optional": true + } + } + }, + "node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/recharts": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/recharts/-/recharts-3.6.0.tgz", + "integrity": "sha512-L5bjxvQRAe26RlToBAziKUB7whaGKEwD3znoM6fz3DrTowCIC/FnJYnuq1GEzB8Zv2kdTfaxQfi5GoH0tBinyg==", + "license": "MIT", + "workspaces": [ + "www" + ], + "dependencies": { + "@reduxjs/toolkit": "1.x.x || 2.x.x", + "clsx": "^2.1.1", + "decimal.js-light": "^2.5.1", + "es-toolkit": "^1.39.3", + "eventemitter3": "^5.0.1", + "immer": "^10.1.1", + "react-redux": "8.x.x || 9.x.x", + "reselect": "5.1.1", + "tiny-invariant": "^1.3.3", + "use-sync-external-store": "^1.2.2", + "victory-vendor": "^37.0.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-is": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/recharts/node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "license": "MIT" + }, + "node_modules/redux": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz", + "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==", + "license": "MIT" + }, + "node_modules/redux-thunk": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-3.1.0.tgz", + "integrity": "sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==", + "license": "MIT", + "peerDependencies": { + "redux": "^5.0.0" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "license": "ISC" + }, + "node_modules/reselect": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/reselect/-/reselect-5.1.1.tgz", + "integrity": "sha512-K/BG6eIky/SBpzfHZv/dd+9JBFiS4SWV7FIujVyJRux6e45+73RaUHXLmIR1f7WOMaQ0U1km6qwklRQxpJJY0w==", + "license": "MIT" + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/rolldown": { + "version": "1.0.0-beta.47", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.0.0-beta.47.tgz", + "integrity": "sha512-Mid74GckX1OeFAOYz9KuXeWYhq3xkXbMziYIC+ULVdUzPTG9y70OBSBQDQn9hQP8u/AfhuYw1R0BSg15nBI4Dg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@oxc-project/types": "=0.96.0", + "@rolldown/pluginutils": "1.0.0-beta.47" + }, + "bin": { + "rolldown": "bin/cli.mjs" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "optionalDependencies": { + "@rolldown/binding-android-arm64": "1.0.0-beta.47", + "@rolldown/binding-darwin-arm64": "1.0.0-beta.47", + "@rolldown/binding-darwin-x64": "1.0.0-beta.47", + "@rolldown/binding-freebsd-x64": "1.0.0-beta.47", + "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-beta.47", + "@rolldown/binding-linux-arm64-gnu": "1.0.0-beta.47", + "@rolldown/binding-linux-arm64-musl": "1.0.0-beta.47", + "@rolldown/binding-linux-x64-gnu": "1.0.0-beta.47", + "@rolldown/binding-linux-x64-musl": "1.0.0-beta.47", + "@rolldown/binding-openharmony-arm64": "1.0.0-beta.47", + "@rolldown/binding-wasm32-wasi": "1.0.0-beta.47", + "@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.47", + "@rolldown/binding-win32-ia32-msvc": "1.0.0-beta.47", + "@rolldown/binding-win32-x64-msvc": "1.0.0-beta.47" + } + }, + "node_modules/rolldown/node_modules/@rolldown/pluginutils": { + "version": "1.0.0-beta.47", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.47.tgz", + "integrity": "sha512-8QagwMH3kNCuzD8EWL8R2YPW5e4OrHNSAHRFDdmFqEwEaD/KcNKjVoumo+gP2vW5eKB2UPbM6vTYiGZX0ixLnw==", + "dev": true, + "license": "MIT" + }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT" + }, + "node_modules/scheduler": { + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.25.0.tgz", + "integrity": "sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA==", + "license": "MIT" + }, + "node_modules/sdp": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/sdp/-/sdp-3.2.1.tgz", + "integrity": "sha512-lwsAIzOPlH8/7IIjjz3K0zYBk7aBVVcvjMwt3M4fLxpjMYyy7i3I97SLHebgn4YBjirkzfp3RvRDWSKsh/+WFw==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", + "license": "ISC" + }, + "node_modules/set-cookie-parser": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.2.tgz", + "integrity": "sha512-oeM1lpU/UvhTxw+g3cIfxXHyJRc/uidd3yK1P242gzHds0udQBYzs3y8j4gCCW+ZJ7ad0yctld8RYO+bdurlvw==", + "license": "MIT" + }, + "node_modules/setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", + "license": "MIT" + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/stats-gl": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/stats-gl/-/stats-gl-2.4.2.tgz", + "integrity": "sha512-g5O9B0hm9CvnM36+v7SFl39T7hmAlv541tU81ME8YeSb3i1CIP5/QdDeSB3A0la0bKNHpxpwxOVRo2wFTYEosQ==", + "license": "MIT", + "dependencies": { + "@types/three": "*", + "three": "^0.170.0" + }, + "peerDependencies": { + "@types/three": "*", + "three": "*" + } + }, + "node_modules/stats-gl/node_modules/three": { + "version": "0.170.0", + "resolved": "https://registry.npmjs.org/three/-/three-0.170.0.tgz", + "integrity": "sha512-FQK+LEpYc0fBD+J8g6oSEyyNzjp+Q7Ks1C568WWaoMRLW+TkNNWmenWeGgJjV105Gd+p/2ql1ZcjYvNiPZBhuQ==", + "license": "MIT" + }, + "node_modules/stats.js": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/stats.js/-/stats.js-0.17.0.tgz", + "integrity": "sha512-hNKz8phvYLPEcRkeG1rsGmV5ChMjKDAWU7/OJJdDErPBNChQXxCo3WZurGpnWc6gZhAzEPFad1aVgyOANH1sMw==", + "license": "MIT" + }, + "node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strnum": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/strnum/-/strnum-2.1.2.tgz", + "integrity": "sha512-l63NF9y/cLROq/yqKXSLtcMeeyOfnSQlfMSlzFt/K73oIaD8DGaQWd7Z34X9GPiKqP5rbSh84Hl4bOlLcjiSrQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT" + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/suspend-react": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/suspend-react/-/suspend-react-0.1.3.tgz", + "integrity": "sha512-aqldKgX9aZqpoDp3e8/BZ8Dm7x1pJl+qI3ZKxDN0i/IQTWUwBx/ManmlVJ3wowqbno6c2bmiIfs+Um6LbsjJyQ==", + "license": "MIT", + "peerDependencies": { + "react": ">=17.0" + } + }, + "node_modules/text-segmentation": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/text-segmentation/-/text-segmentation-1.0.3.tgz", + "integrity": "sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==", + "license": "MIT", + "dependencies": { + "utrie": "^1.0.2" + } + }, + "node_modules/three": { + "version": "0.181.2", + "resolved": "https://registry.npmjs.org/three/-/three-0.181.2.tgz", + "integrity": "sha512-k/CjiZ80bYss6Qs7/ex1TBlPD11whT9oKfT8oTGiHa34W4JRd1NiH/Tr1DbHWQ2/vMUypxksLnF2CfmlmM5XFQ==", + "license": "MIT" + }, + "node_modules/three-mesh-bvh": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/three-mesh-bvh/-/three-mesh-bvh-0.8.3.tgz", + "integrity": "sha512-4G5lBaF+g2auKX3P0yqx+MJC6oVt6sB5k+CchS6Ob0qvH0YIhuUk1eYr7ktsIpY+albCqE80/FVQGV190PmiAg==", + "license": "MIT", + "peerDependencies": { + "three": ">= 0.159.0" + } + }, + "node_modules/three-stdlib": { + "version": "2.36.1", + "resolved": "https://registry.npmjs.org/three-stdlib/-/three-stdlib-2.36.1.tgz", + "integrity": "sha512-XyGQrFmNQ5O/IoKm556ftwKsBg11TIb301MB5dWNicziQBEs2g3gtOYIf7pFiLa0zI2gUwhtCjv9fmjnxKZ1Cg==", + "license": "MIT", + "dependencies": { + "@types/draco3d": "^1.4.0", + "@types/offscreencanvas": "^2019.6.4", + "@types/webxr": "^0.5.2", + "draco3d": "^1.4.1", + "fflate": "^0.6.9", + "potpack": "^1.0.1" + }, + "peerDependencies": { + "three": ">=0.128.0" + } + }, + "node_modules/three-stdlib/node_modules/fflate": { + "version": "0.6.10", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.6.10.tgz", + "integrity": "sha512-IQrh3lEPM93wVCEczc9SaAOvkmcoQn/G8Bo1e8ZPlY3X3bnAxWaBdvTdvM1hP62iZp0BXWDy4vTAy4fF0+Dlpg==", + "license": "MIT" + }, + "node_modules/tiny-invariant": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz", + "integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==", + "license": "MIT" + }, + "node_modules/tinyglobby": { + "version": "0.2.15", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", + "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.3" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/troika-three-text": { + "version": "0.52.4", + "resolved": "https://registry.npmjs.org/troika-three-text/-/troika-three-text-0.52.4.tgz", + "integrity": "sha512-V50EwcYGruV5rUZ9F4aNsrytGdKcXKALjEtQXIOBfhVoZU9VAqZNIoGQ3TMiooVqFAbR1w15T+f+8gkzoFzawg==", + "license": "MIT", + "dependencies": { + "bidi-js": "^1.0.2", + "troika-three-utils": "^0.52.4", + "troika-worker-utils": "^0.52.0", + "webgl-sdf-generator": "1.1.1" + }, + "peerDependencies": { + "three": ">=0.125.0" + } + }, + "node_modules/troika-three-utils": { + "version": "0.52.4", + "resolved": "https://registry.npmjs.org/troika-three-utils/-/troika-three-utils-0.52.4.tgz", + "integrity": "sha512-NORAStSVa/BDiG52Mfudk4j1FG4jC4ILutB3foPnfGbOeIs9+G5vZLa0pnmnaftZUGm4UwSoqEpWdqvC7zms3A==", + "license": "MIT", + "peerDependencies": { + "three": ">=0.125.0" + } + }, + "node_modules/troika-worker-utils": { + "version": "0.52.0", + "resolved": "https://registry.npmjs.org/troika-worker-utils/-/troika-worker-utils-0.52.0.tgz", + "integrity": "sha512-W1CpvTHykaPH5brv5VHLfQo9D1OYuo0cSBEUQFFT/nBUzM8iD6Lq2/tgG/f1OelbAS1WtaTPQzE5uM49egnngw==", + "license": "MIT" + }, + "node_modules/ts-api-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz", + "integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, + "node_modules/tunnel-rat": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/tunnel-rat/-/tunnel-rat-0.1.2.tgz", + "integrity": "sha512-lR5VHmkPhzdhrM092lI2nACsLO4QubF0/yoOhzX7c+wIpbN1GjHNzCc91QlpxBi+cnx8vVJ+Ur6vL5cEoQPFpQ==", + "license": "MIT", + "dependencies": { + "zustand": "^4.3.2" + } + }, + "node_modules/tunnel-rat/node_modules/zustand": { + "version": "4.5.7", + "resolved": "https://registry.npmjs.org/zustand/-/zustand-4.5.7.tgz", + "integrity": "sha512-CHOUy7mu3lbD6o6LJLfllpjkzhHXSBlX8B9+qPddUsIfeF5S/UZ5q0kmCsnRqT1UHFQZchNFDDzMbQsuesHWlw==", + "license": "MIT", + "dependencies": { + "use-sync-external-store": "^1.2.2" + }, + "engines": { + "node": ">=12.7.0" + }, + "peerDependencies": { + "@types/react": ">=16.8", + "immer": ">=9.0.6", + "react": ">=16.8" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "immer": { + "optional": true + }, + "react": { + "optional": true + } + } + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/typescript-eslint": { + "version": "8.50.1", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.50.1.tgz", + "integrity": "sha512-ytTHO+SoYSbhAH9CrYnMhiLx8To6PSSvqnvXyPUgPETCvB6eBKmTI9w6XMPS3HsBRGkwTVBX+urA8dYQx6bHfQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.50.1", + "@typescript-eslint/parser": "8.50.1", + "@typescript-eslint/typescript-estree": "8.50.1", + "@typescript-eslint/utils": "8.50.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/undici-types": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", + "dev": true, + "license": "MIT" + }, + "node_modules/update-browserslist-db": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", + "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/use-sync-external-store": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.6.0.tgz", + "integrity": "sha512-Pp6GSwGP/NrPIrxVFAIkOQeyw8lFenOHijQWkUTrDvrF4ALqylP2C/KCkeS9dpUM3KvYRQhna5vt7IL95+ZQ9w==", + "license": "MIT", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" + }, + "node_modules/utility-types": { + "version": "3.11.0", + "resolved": "https://registry.npmjs.org/utility-types/-/utility-types-3.11.0.tgz", + "integrity": "sha512-6Z7Ma2aVEWisaL6TvBCy7P8rm2LQoPv6dJ7ecIaIixHcwfbJ0x7mWdbcwlIM5IGQxPZSFYeqRCqlOOeKoJYMkw==", + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/utrie": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/utrie/-/utrie-1.0.2.tgz", + "integrity": "sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==", + "license": "MIT", + "dependencies": { + "base64-arraybuffer": "^1.0.2" + } + }, + "node_modules/victory-vendor": { + "version": "37.3.6", + "resolved": "https://registry.npmjs.org/victory-vendor/-/victory-vendor-37.3.6.tgz", + "integrity": "sha512-SbPDPdDBYp+5MJHhBCAyI7wKM3d5ivekigc2Dk2s7pgbZ9wIgIBYGVw4zGHBml/qTFbexrofXW6Gu4noGxrOwQ==", + "license": "MIT AND ISC", + "dependencies": { + "@types/d3-array": "^3.0.3", + "@types/d3-ease": "^3.0.0", + "@types/d3-interpolate": "^3.0.1", + "@types/d3-scale": "^4.0.2", + "@types/d3-shape": "^3.1.0", + "@types/d3-time": "^3.0.0", + "@types/d3-timer": "^3.0.0", + "d3-array": "^3.1.6", + "d3-ease": "^3.0.1", + "d3-interpolate": "^3.0.1", + "d3-scale": "^4.0.2", + "d3-shape": "^3.1.0", + "d3-time": "^3.0.0", + "d3-timer": "^3.0.1" + } + }, + "node_modules/vite": { + "name": "rolldown-vite", + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/rolldown-vite/-/rolldown-vite-7.2.2.tgz", + "integrity": "sha512-Fl3ZdmJhDMJGcqrr342pPVrhugXdOcuNBRBauz4S7QGSRXbQy7y8q5QYJtgkcrG8XjY0EENSZeTk58c3m20FxA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@oxc-project/runtime": "0.96.0", + "fdir": "^6.5.0", + "lightningcss": "^1.30.2", + "picomatch": "^4.0.3", + "postcss": "^8.5.6", + "rolldown": "1.0.0-beta.47", + "tinyglobby": "^0.2.15" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "esbuild": "^0.25.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/webgl-constants": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/webgl-constants/-/webgl-constants-1.1.1.tgz", + "integrity": "sha512-LkBXKjU5r9vAW7Gcu3T5u+5cvSvh5WwINdr0C+9jpzVB41cjQAP5ePArDtk/WHYdVj0GefCgM73BA7FlIiNtdg==" + }, + "node_modules/webgl-sdf-generator": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/webgl-sdf-generator/-/webgl-sdf-generator-1.1.1.tgz", + "integrity": "sha512-9Z0JcMTFxeE+b2x1LJTdnaT8rT8aEp7MVxkNwoycNmJWwPdzoXzMh0BjJSh/AEFP+KPYZUli814h8bJZFIZ2jA==", + "license": "MIT" + }, + "node_modules/webrtc-adapter": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/webrtc-adapter/-/webrtc-adapter-9.0.3.tgz", + "integrity": "sha512-5fALBcroIl31OeXAdd1YUntxiZl1eHlZZWzNg3U4Fn+J9/cGL3eT80YlrsWGvj2ojuz1rZr2OXkgCzIxAZ7vRQ==", + "license": "BSD-3-Clause", + "dependencies": { + "sdp": "^3.2.0" + }, + "engines": { + "node": ">=6.0.0", + "npm": ">=3.10.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-module": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz", + "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==", + "license": "ISC" + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/y18n": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", + "license": "ISC" + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true, + "license": "ISC" + }, + "node_modules/yargs": { + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "license": "MIT", + "dependencies": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "license": "ISC", + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/yargs/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/yargs/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/zod": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.2.1.tgz", + "integrity": "sha512-0wZ1IRqGGhMP76gLqz8EyfBXKk0J2qo2+H3fi4mcUP/KtTocoX08nmIAHl1Z2kJIZbZee8KOpBCSNPRgauucjw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "node_modules/zod-validation-error": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-4.0.2.tgz", + "integrity": "sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.0.0" + }, + "peerDependencies": { + "zod": "^3.25.0 || ^4.0.0" + } + }, + "node_modules/zustand": { + "version": "5.0.9", + "resolved": "https://registry.npmjs.org/zustand/-/zustand-5.0.9.tgz", + "integrity": "sha512-ALBtUj0AfjJt3uNRQoL1tL2tMvj6Gp/6e39dnfT6uzpelGru8v1tPOGBzayOWbPJvujM8JojDk3E1LxeFisBNg==", + "license": "MIT", + "engines": { + "node": ">=12.20.0" + }, + "peerDependencies": { + "@types/react": ">=18.0.0", + "immer": ">=9.0.6", + "react": ">=18.0.0", + "use-sync-external-store": ">=1.2.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "immer": { + "optional": true + }, + "react": { + "optional": true + }, + "use-sync-external-store": { + "optional": true + } + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 00000000..dc3e1b24 --- /dev/null +++ b/package.json @@ -0,0 +1,62 @@ +{ + "name": "verify-kai", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc -b && vite build", + "lint": "eslint .", + "preview": "vite preview", + "test": "node --test" + }, + "dependencies": { + "@react-three/drei": "^10.7.7", + "@react-three/fiber": "^9.4.0", + "@stripe/react-stripe-js": "^5.4.1", + "@stripe/stripe-js": "^8.5.3", + "blakejs": "^1.2.1", + "buffer": "^6.0.3", + "decimal.js": "^10.6.0", + "fast-xml-parser": "^5.3.2", + "fflate": "^0.8.2", + "framer-motion": "^12.23.25", + "hash-wasm": "^4.12.0", + "html2canvas": "^1.4.1", + "jszip": "^3.10.1", + "lucide-react": "^0.554.0", + "pako": "^2.1.0", + "peerjs": "^1.5.5", + "qrcode": "^1.5.4", + "qrcode-generator": "^2.0.4", + "react": "^19.2.0", + "react-dom": "^19.2.0", + "react-qr-code": "^2.0.18", + "react-router-dom": "^7.9.6", + "recharts": "^3.4.1", + "three": "^0.181.2" + }, + "devDependencies": { + "@eslint/js": "^9.39.1", + "@types/jszip": "^3.4.0", + "@types/node": "^24.10.1", + "@types/pako": "^2.0.4", + "@types/peerjs": "^0.0.30", + "@types/qrcode": "^1.5.6", + "@types/qrcode-generator": "^0.0.16", + "@types/react": "^19.2.2", + "@types/react-dom": "^19.2.2", + "@types/react-router-dom": "^5.3.3", + "@vitejs/plugin-react": "^5.1.0", + "eslint": "^9.39.1", + "eslint-plugin-react-hooks": "^7.0.1", + "eslint-plugin-react-refresh": "^0.4.24", + "globals": "^16.5.0", + "typescript": "~5.9.3", + "typescript-eslint": "^8.46.3", + "vite": "npm:rolldown-vite@7.2.2" + }, + "overrides": { + "vite": "npm:rolldown-vite@7.2.2" + } +} From 1141f4047090fa386c273a48a569e77a20d5b8db Mon Sep 17 00:00:00 2001 From: Kojib Date: Mon, 22 Dec 2025 20:55:54 -0500 Subject: [PATCH 05/10] v30.0.6 --- ...k-DTPPu1Hz.js => EternalKlock-CQhocjA8.js} | 2 +- dist/assets/EternalKlock-C_k79TSi.js | 1 + dist/assets/EternalKlock-D-hEMVRl.js | 1 - ..._aGu.js => HomePriceChartCard-ByTYxBSg.js} | 2 +- ...alms-CxldGmng.js => KaiRealms-B1Voo2dF.js} | 4 +- ...hApp-BMb9vr72.js => KaiVohApp-D1B_NOm4.js} | 2 +- ...al-Bbtn2GfV.js => KaiVohModal-DDDGepBu.js} | 4 +- ...{PShort-Bmqr2bV5.js => PShort-Dw69zn4D.js} | 2 +- ...otOOPRg.js => SealMomentModal-QiuZkGMx.js} | 2 +- ...fkVeGy.js => SigilAuthContext-X_86kcI6.js} | 2 +- ...e0ykb.js => SigilAuthProvider-Cr2YGy0y.js} | 2 +- ...-YG_XvkA-.js => SigilExplorer-C1I-xwZr.js} | 2 +- ...-DGJJwxYi.js => SigilFeedPage-omgaBu1a.js} | 2 +- ...dal-B4XBfcke.js => SigilModal-B_GantjI.js} | 2 +- dist/assets/SigilModal-BvJNBKka.js | 1 - dist/assets/SigilModal-DgAEuxv4.js | 1 + ...Page-DF86EQ7y.js => SigilPage-DOXmbUVe.js} | 6 +- dist/assets/SigilStreamRoot-BUh8LwJG.js | 1 - ...0R_paBX.js => SigilStreamRoot-DGHasm9l.js} | 2 +- dist/assets/SigilStreamRoot-hPwX5VmF.js | 1 + ...-Dr7oGdbu.js => VerifierFrame-DkyrPdnF.js} | 2 +- ...age-B34sC8R1.js => VerifyPage-BoLb2QzD.js} | 2 +- .../__vite-browser-external-CUSLmM9D.js | 1 - .../__vite-browser-external-CekNgi1j.js | 1 + ...undler-H_464dRi.js => bundler-IMYm8BQv.js} | 2 +- dist/assets/html2canvas-2MVuntwP.js | 1 - ...as-CgVfYVZf.js => html2canvas-DXJRNlB-.js} | 2 +- dist/assets/html2canvas-qXP-r0eN.js | 1 + .../{index-CcPm2yTY.js => index-BWApiWDT.js} | 8 +- dist/assets/jszip.min-BlBKh1bQ.js | 1 - dist/assets/jszip.min-OPHeGHZp.js | 1 + ...pes-CQ3MXKCa.js => prop-types-B3eCNXus.js} | 2 +- ...-NyXrDYsE.js => sigilRegistry-TxCi76Aa.js} | 2 +- ...ilUrl-w0EYDFh2.js => sigilUrl-rhYoayXy.js} | 2 +- ...ils-BWqerTXt.js => sigilUtils-u_f46p8-.js} | 2 +- ...vgMeta-BqZogknt.js => svgMeta-CqOhEmuY.js} | 2 +- ...vgMeta-ADMUtfmL.js => svgMeta-DRLQd2cj.js} | 2 +- ...s-BuTJ0eyZ.js => useFastPress-C6nRe_12.js} | 2 +- ...K.js => usernameClaimRegistry-CU2B_ZCP.js} | 2 +- dist/assets/{x-B0A9hqeh.js => x-Bw0a6Rv2.js} | 2 +- dist/index.html | 2 +- dist/sw.js | 2 +- node_modules/.package-lock.json | 59 +- node_modules/@types/history/DOMUtils.d.ts | 17 - .../@types/history/ExecutionEnvironment.d.ts | 1 - node_modules/@types/history/LICENSE | 21 - .../@types/history/LocationUtils.d.ts | 9 - node_modules/@types/history/PathUtils.d.ts | 9 - node_modules/@types/history/README.md | 16 - .../@types/history/createBrowserHistory.d.ts | 11 - .../@types/history/createHashHistory.d.ts | 12 - .../@types/history/createMemoryHistory.d.ts | 19 - .../history/createTransitionManager.d.ts | 20 - node_modules/@types/history/index.d.ts | 95 -- node_modules/@types/history/package.json | 40 - node_modules/@types/node/README.md | 4 +- node_modules/@types/node/assert.d.ts | 57 +- node_modules/@types/node/assert/strict.d.ts | 4 +- node_modules/@types/node/async_hooks.d.ts | 30 +- node_modules/@types/node/buffer.d.ts | 2 +- node_modules/@types/node/child_process.d.ts | 4 +- node_modules/@types/node/cluster.d.ts | 30 +- .../@types/node/compatibility/iterators.d.ts | 1 - node_modules/@types/node/console.d.ts | 37 +- node_modules/@types/node/crypto.d.ts | 1254 +++-------------- node_modules/@types/node/dgram.d.ts | 2 +- .../@types/node/diagnostics_channel.d.ts | 4 +- node_modules/@types/node/dns.d.ts | 34 +- node_modules/@types/node/dns/promises.d.ts | 2 +- node_modules/@types/node/domain.d.ts | 2 +- node_modules/@types/node/events.d.ts | 2 +- node_modules/@types/node/fs.d.ts | 275 +--- node_modules/@types/node/fs/promises.d.ts | 24 +- node_modules/@types/node/globals.d.ts | 6 +- .../@types/node/globals.typedarray.d.ts | 3 - node_modules/@types/node/http.d.ts | 53 +- node_modules/@types/node/http2.d.ts | 192 +-- node_modules/@types/node/https.d.ts | 2 +- node_modules/@types/node/index.d.ts | 14 +- node_modules/@types/node/inspector.d.ts | 36 +- .../@types/node/inspector.generated.d.ts | 181 --- node_modules/@types/node/module.d.ts | 39 +- node_modules/@types/node/net.d.ts | 11 +- node_modules/@types/node/os.d.ts | 17 +- node_modules/@types/node/package.json | 16 +- node_modules/@types/node/path.d.ts | 2 +- node_modules/@types/node/perf_hooks.d.ts | 30 +- node_modules/@types/node/process.d.ts | 15 +- node_modules/@types/node/punycode.d.ts | 2 +- node_modules/@types/node/querystring.d.ts | 2 +- node_modules/@types/node/readline.d.ts | 26 +- node_modules/@types/node/repl.d.ts | 36 +- node_modules/@types/node/sea.d.ts | 11 +- node_modules/@types/node/sqlite.d.ts | 252 +--- node_modules/@types/node/stream.d.ts | 49 +- node_modules/@types/node/stream/web.d.ts | 61 +- node_modules/@types/node/string_decoder.d.ts | 2 +- node_modules/@types/node/test.d.ts | 211 +-- node_modules/@types/node/timers.d.ts | 4 +- node_modules/@types/node/timers/promises.d.ts | 2 +- node_modules/@types/node/tls.d.ts | 52 +- node_modules/@types/node/trace_events.d.ts | 12 +- .../ts5.6/compatibility/float16array.d.ts | 71 - .../@types/node/ts5.6/globals.typedarray.d.ts | 2 - node_modules/@types/node/ts5.6/index.d.ts | 16 +- .../ts5.7/compatibility/float16array.d.ts | 72 - node_modules/@types/node/ts5.7/index.d.ts | 103 -- node_modules/@types/node/tty.d.ts | 2 +- node_modules/@types/node/url.d.ts | 125 +- node_modules/@types/node/util.d.ts | 319 ++++- node_modules/@types/node/v8.d.ts | 38 +- node_modules/@types/node/vm.d.ts | 298 +--- node_modules/@types/node/wasi.d.ts | 23 +- .../@types/node/web-globals/crypto.d.ts | 32 - .../@types/node/web-globals/fetch.d.ts | 4 - .../@types/node/web-globals/navigator.d.ts | 3 - .../@types/node/web-globals/streams.d.ts | 22 - node_modules/@types/node/worker_threads.d.ts | 122 +- node_modules/@types/node/zlib.d.ts | 14 +- node_modules/@types/react-router-dom/LICENSE | 21 - .../@types/react-router-dom/README.md | 16 - .../@types/react-router-dom/index.d.ts | 98 -- .../@types/react-router-dom/package.json | 59 - node_modules/@types/react-router/LICENSE | 21 - node_modules/@types/react-router/README.md | 16 - node_modules/@types/react-router/index.d.ts | 198 --- node_modules/@types/react-router/package.json | 130 -- .../@types/react-router/ts4.6/index.d.ts | 173 --- node_modules/undici-types/agent.d.ts | 23 +- node_modules/undici-types/api.d.ts | 48 +- node_modules/undici-types/balanced-pool.d.ts | 22 +- .../undici-types/cache-interceptor.d.ts | 172 --- node_modules/undici-types/client-stats.d.ts | 15 - node_modules/undici-types/client.d.ts | 36 +- node_modules/undici-types/cookies.d.ts | 2 - .../undici-types/diagnostics-channel.d.ts | 28 +- node_modules/undici-types/dispatcher.d.ts | 218 ++- .../undici-types/env-http-proxy-agent.d.ts | 7 +- node_modules/undici-types/errors.d.ts | 120 +- node_modules/undici-types/eventsource.d.ts | 13 +- node_modules/undici-types/fetch.d.ts | 34 +- node_modules/undici-types/formdata.d.ts | 14 +- .../undici-types/global-dispatcher.d.ts | 8 +- node_modules/undici-types/global-origin.d.ts | 10 +- node_modules/undici-types/h2c-client.d.ts | 73 - node_modules/undici-types/handlers.d.ts | 16 +- node_modules/undici-types/header.d.ts | 158 +-- node_modules/undici-types/index.d.ts | 103 +- node_modules/undici-types/interceptors.d.ts | 38 +- node_modules/undici-types/mock-agent.d.ts | 54 +- .../undici-types/mock-call-history.d.ts | 111 -- node_modules/undici-types/mock-client.d.ts | 10 +- node_modules/undici-types/mock-errors.d.ts | 6 +- .../undici-types/mock-interceptor.d.ts | 41 +- node_modules/undici-types/mock-pool.d.ts | 10 +- node_modules/undici-types/package.json | 2 +- node_modules/undici-types/patch.d.ts | 4 + node_modules/undici-types/pool-stats.d.ts | 16 +- node_modules/undici-types/pool.d.ts | 26 +- node_modules/undici-types/proxy-agent.d.ts | 9 +- node_modules/undici-types/readable.d.ts | 33 +- node_modules/undici-types/retry-agent.d.ts | 2 +- node_modules/undici-types/retry-handler.d.ts | 29 +- node_modules/undici-types/snapshot-agent.d.ts | 109 -- node_modules/undici-types/util.d.ts | 6 +- node_modules/undici-types/utility.d.ts | 7 - node_modules/undici-types/webidl.d.ts | 171 +-- node_modules/undici-types/websocket.d.ts | 40 +- package-lock.json | 47 +- package.json | 3 +- public/sw.js | 2 +- src/version.ts | 2 +- 172 files changed, 1541 insertions(+), 5877 deletions(-) rename dist/assets/{EternalKlock-DTPPu1Hz.js => EternalKlock-CQhocjA8.js} (99%) create mode 100644 dist/assets/EternalKlock-C_k79TSi.js delete mode 100644 dist/assets/EternalKlock-D-hEMVRl.js rename dist/assets/{HomePriceChartCard-CG0g_aGu.js => HomePriceChartCard-ByTYxBSg.js} (99%) rename dist/assets/{KaiRealms-CxldGmng.js => KaiRealms-B1Voo2dF.js} (99%) rename dist/assets/{KaiVohApp-BMb9vr72.js => KaiVohApp-D1B_NOm4.js} (99%) rename dist/assets/{KaiVohModal-Bbtn2GfV.js => KaiVohModal-DDDGepBu.js} (91%) rename dist/assets/{PShort-Bmqr2bV5.js => PShort-Dw69zn4D.js} (94%) rename dist/assets/{SealMomentModal-BotOOPRg.js => SealMomentModal-QiuZkGMx.js} (99%) rename dist/assets/{SigilAuthContext-CZfkVeGy.js => SigilAuthContext-X_86kcI6.js} (73%) rename dist/assets/{SigilAuthProvider-Crre0ykb.js => SigilAuthProvider-Cr2YGy0y.js} (91%) rename dist/assets/{SigilExplorer-YG_XvkA-.js => SigilExplorer-C1I-xwZr.js} (99%) rename dist/assets/{SigilFeedPage-DGJJwxYi.js => SigilFeedPage-omgaBu1a.js} (93%) rename dist/assets/{SigilModal-B4XBfcke.js => SigilModal-B_GantjI.js} (99%) delete mode 100644 dist/assets/SigilModal-BvJNBKka.js create mode 100644 dist/assets/SigilModal-DgAEuxv4.js rename dist/assets/{SigilPage-DF86EQ7y.js => SigilPage-DOXmbUVe.js} (99%) delete mode 100644 dist/assets/SigilStreamRoot-BUh8LwJG.js rename dist/assets/{SigilStreamRoot-D0R_paBX.js => SigilStreamRoot-DGHasm9l.js} (99%) create mode 100644 dist/assets/SigilStreamRoot-hPwX5VmF.js rename dist/assets/{VerifierFrame-Dr7oGdbu.js => VerifierFrame-DkyrPdnF.js} (99%) rename dist/assets/{VerifyPage-B34sC8R1.js => VerifyPage-BoLb2QzD.js} (97%) delete mode 100644 dist/assets/__vite-browser-external-CUSLmM9D.js create mode 100644 dist/assets/__vite-browser-external-CekNgi1j.js rename dist/assets/{bundler-H_464dRi.js => bundler-IMYm8BQv.js} (99%) delete mode 100644 dist/assets/html2canvas-2MVuntwP.js rename dist/assets/{html2canvas-CgVfYVZf.js => html2canvas-DXJRNlB-.js} (99%) create mode 100644 dist/assets/html2canvas-qXP-r0eN.js rename dist/assets/{index-CcPm2yTY.js => index-BWApiWDT.js} (99%) delete mode 100644 dist/assets/jszip.min-BlBKh1bQ.js create mode 100644 dist/assets/jszip.min-OPHeGHZp.js rename dist/assets/{prop-types-CQ3MXKCa.js => prop-types-B3eCNXus.js} (92%) rename dist/assets/{sigilRegistry-NyXrDYsE.js => sigilRegistry-TxCi76Aa.js} (99%) rename dist/assets/{sigilUrl-w0EYDFh2.js => sigilUrl-rhYoayXy.js} (75%) rename dist/assets/{sigilUtils-BWqerTXt.js => sigilUtils-u_f46p8-.js} (89%) rename dist/assets/{svgMeta-BqZogknt.js => svgMeta-CqOhEmuY.js} (98%) rename dist/assets/{svgMeta-ADMUtfmL.js => svgMeta-DRLQd2cj.js} (79%) rename dist/assets/{useFastPress-BuTJ0eyZ.js => useFastPress-C6nRe_12.js} (80%) rename dist/assets/{usernameClaimRegistry-_VlzEwdK.js => usernameClaimRegistry-CU2B_ZCP.js} (98%) rename dist/assets/{x-B0A9hqeh.js => x-Bw0a6Rv2.js} (55%) delete mode 100755 node_modules/@types/history/DOMUtils.d.ts delete mode 100755 node_modules/@types/history/ExecutionEnvironment.d.ts delete mode 100755 node_modules/@types/history/LICENSE delete mode 100755 node_modules/@types/history/LocationUtils.d.ts delete mode 100755 node_modules/@types/history/PathUtils.d.ts delete mode 100755 node_modules/@types/history/README.md delete mode 100755 node_modules/@types/history/createBrowserHistory.d.ts delete mode 100755 node_modules/@types/history/createHashHistory.d.ts delete mode 100755 node_modules/@types/history/createMemoryHistory.d.ts delete mode 100755 node_modules/@types/history/createTransitionManager.d.ts delete mode 100755 node_modules/@types/history/index.d.ts delete mode 100755 node_modules/@types/history/package.json delete mode 100644 node_modules/@types/node/ts5.6/compatibility/float16array.d.ts delete mode 100644 node_modules/@types/node/ts5.7/compatibility/float16array.d.ts delete mode 100644 node_modules/@types/node/ts5.7/index.d.ts delete mode 100644 node_modules/@types/node/web-globals/crypto.d.ts delete mode 100644 node_modules/@types/node/web-globals/streams.d.ts delete mode 100755 node_modules/@types/react-router-dom/LICENSE delete mode 100755 node_modules/@types/react-router-dom/README.md delete mode 100755 node_modules/@types/react-router-dom/index.d.ts delete mode 100755 node_modules/@types/react-router-dom/package.json delete mode 100755 node_modules/@types/react-router/LICENSE delete mode 100755 node_modules/@types/react-router/README.md delete mode 100755 node_modules/@types/react-router/index.d.ts delete mode 100755 node_modules/@types/react-router/package.json delete mode 100755 node_modules/@types/react-router/ts4.6/index.d.ts delete mode 100644 node_modules/undici-types/cache-interceptor.d.ts delete mode 100644 node_modules/undici-types/client-stats.d.ts delete mode 100644 node_modules/undici-types/h2c-client.d.ts delete mode 100644 node_modules/undici-types/mock-call-history.d.ts delete mode 100644 node_modules/undici-types/snapshot-agent.d.ts delete mode 100644 node_modules/undici-types/utility.d.ts diff --git a/dist/assets/EternalKlock-DTPPu1Hz.js b/dist/assets/EternalKlock-CQhocjA8.js similarity index 99% rename from dist/assets/EternalKlock-DTPPu1Hz.js rename to dist/assets/EternalKlock-CQhocjA8.js index ac93a071..89f66865 100644 --- a/dist/assets/EternalKlock-DTPPu1Hz.js +++ b/dist/assets/EternalKlock-CQhocjA8.js @@ -1,4 +1,4 @@ -import{C as e,Dn as t,On as n,Tn as r,_ as i,a,an as o,c as s,g as c,h as l,i as u,jn as d,kn as f,l as p,ln as m,mn as h,o as g,p as _,pn as v,tn as y,u as b,v as x,w as S,wn as C,x as w,y as T}from"./index-CcPm2yTY.js";import{t as E}from"./SigilModal-B4XBfcke.js";const D=17491.270421,O=[`Ignition Ark`,`Integration Ark`,`Harmonization Ark`,`Reflektion Ark`,`Purifikation Ark`,`Dream Ark`],k={"Ignition Ark":`#ff1559`,"Integration Ark":`#ff6d00`,"Harmonization Ark":`#ffd900`,"Reflektion Ark":`#00ff66`,"Purifikation Ark":`#05e6ff`,"Dream Ark":`#c300ff`},A={"Ignition Ark":`Ignite`,"Integration Ark":`Integrate`,"Harmonization Ark":`Harmony`,"Reflektion Ark":`Reflekt`,"Purifikation Ark":`Purify`,"Dream Ark":`Dream`},j=D/36,ee=j/44,te=3+Math.sqrt(5);Math.round(te*1e3),1/te;var M=d(r(),1),N=d(y(),1),P=120,F=P/2,I=22,L=4.5,ne=2,R=F-.5,re=F-ne,z=36,B=-3,V=3,ie=re-2,ae=(I+L+R)/2-4,oe=e=>e*Math.PI/180,se=e=>e.toLowerCase().replace(/\s+/g,`-`);function ce(e,t,n){let r=parseInt(e.slice(1),16),i=parseInt(t.slice(1),16),a=r>>16,o=r>>8&255,s=r&255,c=i>>16,l=i>>8&255,u=i&255;return`rgb(${Math.round(a+(c-a)*n)},${Math.round(o+(l-o)*n)},${Math.round(s+(u-s)*n)})`}var le=(e,t,n)=>Math.max(t,Math.min(n,e)),H=e=>{if(!e)return;let t=e.match(/(\d{2})$/);if(!t)return;let n=parseInt(t[1],10);if(Number.isFinite(n))return le(n,0,43)},U=({hue:e,pulse:t,kaiPulseEternal:n,harmonicDayPercent:r,microCyclePercent:i,dayLabel:a,monthLabel:o,monthDay:s,glowPulse:c=!0,pulseIntervalSec:l=te,rimFlash:u=!1,rotationOverride:d,solarSpiralStepString:f,solarSpiralStep:p,eternalBeatIndex:m,eternalStepIndex:h})=>{(0,M.useEffect)(()=>{typeof document<`u`&&document.documentElement.style.setProperty(`--cycle`,`${l}s`)},[l]);let g=`${l}s`,_=(n%D+D)%D,v=Number.isFinite(t)?t:_,y=v/D,b=Number.isFinite(r)?r:y*100,x=(v-Math.floor(v/j)*j)%ee/ee,S=Number.isFinite(i)?i:x*100,C=(v%D+D)%D,w=C/D,T=Math.floor(w*36)%36,E=(T+.5)/36*360,ne=typeof d==`number`?d:E,U=360/O.length,W=Math.floor(ne/U)%O.length,ue=(W+1)%O.length,de=(ne-W*U+360)%360,fe=Math.min(1,de/U),pe=k[O[W]],me=k[O[ue]],he=ce(pe,me,fe),ge=2*Math.PI*re,_e=ge*(1-b/100),ve=-(S/100)*l,ye=v,be=[`Aethon`,`Virelai`,`Solari`,`Amarin`,`Kaelus`,`Umbriel`,`Noctura`,`Liora`].indexOf(o)+1,xe=be>0?be:1,Se=F-14,Ce=F,we=F+14,Te=F+28,Ee=Math.floor(_/j)%36,De=Number.isFinite(m)?le(m,0,35):Ee,Oe=_-De*j,ke=Oe/j,Ae=Math.floor(Oe/ee)%44,je=Number.isFinite(h)?le(h,0,43):Ae,Me=je.toString().padStart(2,`0`),Ne=(De+.5)/36*360,Pe=`hsl(${T/36*360}, 100%, 50%)`,Fe=`#ebfdff`,Ie=1.6,Le=R-(I+L)+.5,Re=F-(I+L),ze=Le*ke,Be=Re-ze,Ve=.82,He=F-(I+L)-Le*Ve,Ue=F,We=He+6,Ge=(0,M.useId)().replace(/[^a-zA-Z0-9_-]/g,``)||`klock`,Ke=Me,qe=De.toString().padStart(2,`0`),Je=Math.floor(_),Ye=Oe-je*ee,Xe=Math.max(0,Math.min(1,Ye/ee))*100,Ze=`#00faff`,Qe=`#ff6d00`,$e=((C-T*j)%j+j)%j,et=Math.floor($e/ee)%44,tt=Number.isFinite(p?.stepIndex)?le(p.stepIndex,0,43):void 0,nt=H(f),rt=(tt??nt??et).toString().padStart(2,`0`),it=F-(I+L)-Le*Ve,at=F;return(0,N.jsx)(`div`,{className:`kai-klock-shell`,style:{"--hue":e,"--arc":pe,"--cycle":g,width:`100%`,aspectRatio:`1 / 1`,overflow:`hidden`},children:(0,N.jsxs)(`svg`,{className:`kai-svg`,viewBox:`0 0 ${P} ${P}`,width:`100%`,height:`100%`,preserveAspectRatio:`xMidYMid meet`,role:`img`,children:[(0,N.jsx)(`circle`,{cx:F,cy:F,r:R,className:`rim-ring ${u?`rim-flash`:``}`}),(0,N.jsx)(`circle`,{cx:F,cy:F,r:re,className:`day-progress`,strokeDasharray:ge,strokeDashoffset:_e}),Array.from({length:36}).map((e,t)=>{let n=oe(t*(360/z)-90),r=(t+B+z)%z/z;return(0,N.jsx)(`text`,{x:F+ie*Math.cos(n),y:F+ie*Math.sin(n)+V/2,className:`beat-number`,textAnchor:`middle`,fontSize:V,style:{fill:`hsl(${r*360},100%,50%)`},children:t},t)}),(0,N.jsx)(`circle`,{cx:F,cy:F,r:I+L,className:`inner-halo`}),(0,N.jsx)(`g`,{className:`orb-spin`,style:{animationDelay:`${ve}s`},children:(0,N.jsx)(`circle`,{cx:F,cy:F-(I+L),r:3.6,className:`micro-orb orb-glow`})}),(0,N.jsxs)(`g`,{style:{transform:`rotate(${ne}deg)`,transformOrigin:`${F}px ${F}px`,transition:`transform 1s ease-out`},children:[(0,N.jsx)(`rect`,{x:F-1,y:F-(I+L)-(R-(I+L)),width:2,height:R-(I+L),rx:1,className:`needle`,style:{fill:he}}),(0,N.jsxs)(`g`,{className:`solar-hand-label-wrap`,style:{transform:`rotate(${-ne}deg)`,transformOrigin:`${at}px ${it}px`},children:[(0,N.jsx)(`text`,{x:at,y:it-3.6,textAnchor:`middle`,dominantBaseline:`central`,fontSize:3,fontWeight:900,style:{fill:Qe,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.65)`,strokeWidth:.8,filter:`drop-shadow(0 0 2px ${Qe})`},children:`☀`}),(0,N.jsx)(`text`,{x:at-2.2,y:it,textAnchor:`middle`,dominantBaseline:`central`,className:`solar-hand-label-digit`,fontSize:4.4,fontWeight:900,style:{fill:Qe,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.65)`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px ${Qe}) drop-shadow(0 0 5px ${Qe})`},children:rt[0]}),(0,N.jsx)(`text`,{x:at+2.2,y:it,textAnchor:`middle`,dominantBaseline:`central`,className:`solar-hand-label-digit`,fontSize:4.4,fontWeight:900,style:{fill:Qe,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.65)`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px ${Qe}) drop-shadow(0 0 5px ${Qe})`},children:rt[1]})]})]}),(0,N.jsxs)(`g`,{className:`eternal-hand-group`,style:{transform:`rotate(${Ne}deg)`,transformOrigin:`${F}px ${F}px`,transition:`transform 0.6s cubic-bezier(.22,.61,.36,1)`},children:[(0,N.jsx)(`rect`,{x:F-Ie/2,y:F-(I+L)-Le,width:Ie,height:Le,rx:Ie/1.5,className:`eternal-hand`,style:{fill:`transparent`,stroke:`#bff7ff`,strokeWidth:.7,filter:`drop-shadow(0 0 2px #eaffff) drop-shadow(0 0 6px #d9fbff)`,mixBlendMode:`screen`}}),(0,N.jsx)(`defs`,{children:(0,N.jsxs)(`linearGradient`,{id:`eternalFill-${Ge}`,x1:`0`,y1:`1`,x2:`0`,y2:`0`,children:[(0,N.jsx)(`stop`,{offset:`0%`,stopColor:Fe,stopOpacity:.15}),(0,N.jsx)(`stop`,{offset:`100%`,stopColor:Fe,stopOpacity:.95})]})}),(0,N.jsx)(`rect`,{x:F-Ie/2,y:Be,width:Ie,height:Math.max(0,ze),rx:Ie/2,className:`eternal-hand-fill`,style:{fill:`url(#eternalFill-${Ge})`,filter:`drop-shadow(0 0 3px #eaffff) drop-shadow(0 0 6px #eaffff)`,mixBlendMode:`screen`}}),(0,N.jsx)(`circle`,{cx:F,cy:F-(I+L)-Le-.8,r:1.35,className:`eternal-hand-tip`,style:{fill:`#ffffff`,filter:`drop-shadow(0 0 4px #eaffff) drop-shadow(0 0 8px #eaffff)`,mixBlendMode:`screen`}}),(0,N.jsxs)(`g`,{className:`eternal-hand-label-wrap`,style:{transform:`rotate(${-Ne}deg)`,transformOrigin:`${Ue}px ${He}px`},children:[(0,N.jsx)(`text`,{x:Ue-2.2,y:He,textAnchor:`middle`,dominantBaseline:`central`,className:`eternal-hand-label-digit`,fontSize:4.4,fontWeight:900,style:{fill:`#e8feff`,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.45)`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px #eaffff) drop-shadow(0 0 5px #c8fbff)`},children:Me[0]}),(0,N.jsx)(`text`,{x:Ue+2.2,y:He,textAnchor:`middle`,dominantBaseline:`central`,className:`eternal-hand-label-digit`,fontSize:4.4,fontWeight:900,style:{fill:`#e8feff`,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.45)`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px #eaffff) drop-shadow(0 0 5px #c8fbff)`},children:Me[1]})]}),(0,N.jsx)(`g`,{transform:`rotate(${-Ne} ${Ue} ${We})`,children:(0,N.jsx)(`text`,{x:Ue,y:We,textAnchor:`middle`,dominantBaseline:`central`,className:`eternal-hand-percent`,fontSize:3.2,fontWeight:800,style:{fill:`#dafeff`,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.4)`,strokeWidth:.7,letterSpacing:`0.25px`,filter:`drop-shadow(0 0 2px #eaffff)`}})})]}),(0,N.jsx)(`text`,{x:F,y:F-15,className:`center-sub`,textAnchor:`middle`,fontSize:6,fontWeight:800,style:{fill:Ze,paintOrder:`stroke`,stroke:`#000`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px ${Ze}) drop-shadow(0 0 6px ${Ze})`},children:Je}),(0,N.jsxs)(`text`,{x:F,y:F-3,className:`center-pulse ${c?`pulse-flash`:``}`,textAnchor:`middle`,children:[qe,`:`,Ke]},`et-${ye}`),(0,N.jsx)(`text`,{x:F,y:F+8,className:`center-day day-${se(a)}`,textAnchor:`middle`,children:a}),(0,N.jsx)(`text`,{x:F,y:F+18,className:`center-month month-${se(o)}`,textAnchor:`middle`,children:o}),(0,N.jsx)(`text`,{x:F,y:Te+8,className:`eternal-pulse`,textAnchor:`middle`,children:n}),(0,N.jsx)(`text`,{x:Se,y:Te,className:`step-percent`,textAnchor:`middle`,fontSize:5.5,fill:Pe,fontWeight:800,style:{filter:`drop-shadow(0 0 2px ${Pe}) drop-shadow(0 0 5px #00faff)`,letterSpacing:`0.25px`},children:`${Xe.toFixed(1)}%`}),(0,N.jsx)(`text`,{x:Ce,y:Te,className:`day-of-month day-${se(a)}`,textAnchor:`middle`,children:s}),(0,N.jsx)(`text`,{x:we,y:Te,className:`day-of-month month-${se(o)}`,textAnchor:`middle`,children:xe}),O.map((e,t)=>{let n=oe(t*(360/O.length)-90),r=F+ae*Math.cos(n),i=F+ae*Math.sin(n)+(t===3?7:3);return(0,N.jsxs)(M.Fragment,{children:[(0,N.jsx)(`text`,{x:r,y:i,className:`arc-label arc-${se(e.split(` `)[0])} ${t===W?`active`:``}`,textAnchor:`middle`,children:A[e]}),e===`Ignition Ark`&&f&&(0,N.jsx)(`text`,{x:r,y:i+8,textAnchor:`middle`,dominantBaseline:`hanging`,fontSize:10,fill:`#00faff`,fontWeight:900,style:{filter:`drop-shadow(0 0 2px #00faff) drop-shadow(0 0 4px #00faff) drop-shadow(0 0 8px #00faff)`,paintOrder:`stroke`,stroke:`#000`,strokeWidth:1,vectorEffect:`non-scaling-stroke`,letterSpacing:`0.5px`},children:f})]},e)})]})})},W=Date.UTC(2024,4,10,6,45,41,888),ue=3+Math.sqrt(5),de=ue*1e3,fe=1000000n,pe=17491270421n,me=11000000n,he=(pe+18n)/36n,ge=[`Solhara`,`Aquaris`,`Flamora`,`Verdari`,`Sonari`,`Kaelith`],_e={Solhara:`Root`,Aquaris:`Sacral`,Flamora:`Solar Plexus`,Verdari:`Heart`,Sonari:`Throat`,Kaelith:`Crown`},ve=(e,t)=>(e%t+t)%t;function ye(e,t){let n=e/t,r=e%t;return r!==0n&&r>0n!=t>0n?n-1n:n}function be(e){if(!Number.isFinite(e))return 0n;let t=e<0?-1:1,n=Math.abs(e),r=Math.trunc(n),i=n-r;return i<.5?BigInt(t*r):i>.5?BigInt(t*(r+1)):BigInt(t*(r%2==0?r:r+1))}function xe(e){return be((e.getTime()-W)/1e3/ue*1e6)}function Se(e){let t=xe(e),n=ve(t,pe),r=ye(t,pe),i=Number(ye(n,he)),a=n-BigInt(i)*he,o=a-a/me*me,s=Number(o)/Number(me);return{pulse:Number(ye(t,fe)),beat:i,stepPct:s,chakraDay:_e[ge[Number(ve(r,6n))]]}}var Ce=()=>performance.timeOrigin+performance.now(),we=e=>{let t=e-W;return W+Math.ceil(t/de)*de},Te=()=>{let[e,t]=(0,M.useState)(0),[n,r]=(0,M.useState)(0),[i,a]=(0,M.useState)(0),[o,s]=(0,M.useState)(`Root`),[c,l]=(0,M.useState)(!1),[u]=(0,M.useState)(()=>`btn-${Math.random().toString(36).slice(2)}`),d=c?`sigil-open`:`sigil-closed`,f=(0,M.useRef)(null),p=(0,M.useRef)(null),m=(0,M.useRef)(0),h=(0,M.useCallback)(()=>{let{pulse:e,beat:n,stepPct:i,chakraDay:o}=Se(new Date);t(e),r(n),a(i),s(o)},[]),g=()=>{p.current!==null&&(clearTimeout(p.current),p.current=null)},_=(0,M.useCallback)(()=>{g();let e=Ce();m.current=we(e);let t=()=>{let e=Ce(),n=Math.floor((e-m.current)/de),r=Math.max(0,n)+1;for(let e=0;e(h(),_(),()=>g()),[h,_]),(0,M.useEffect)(()=>{let e=()=>{document.visibilityState===`visible`&&_()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[_]),(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`button`,{className:`sigil-button`,title:`View & save this sigil`,onClick:()=>l(!0),"data-chakra":o,"aria-label":`Open Kairos Sigil`,children:(0,N.jsxs)(`span`,{className:`sigil-thumb`,"aria-hidden":`true`,inert:!0,children:[(0,N.jsx)(S,{ref:f,pulse:e,beat:n,stepPct:i,chakraDay:o,size:40,hashMode:`deterministic`,origin:u,onReady:n=>{n&&typeof n.pulse==`number`&&n.pulse!==e&&t(n.pulse)}},d),(0,N.jsx)(`span`,{className:`sigil-shield`,"aria-hidden":`true`})]})}),c&&(0,N.jsx)(E,{initialPulse:e,onClose:()=>l(!1)})]})},Ee=(0,M.createContext)({});function De(e){let t=(0,M.useRef)(null);return t.current===null&&(t.current=e()),t.current}var Oe=typeof window<`u`,ke=Oe?M.useLayoutEffect:M.useEffect,Ae=(0,M.createContext)(null);function je(e,t){e.indexOf(t)===-1&&e.push(t)}function Me(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var Ne=(e,t,n)=>n>t?t:n/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Ie(e){return typeof e==`object`&&!!e}var Le=e=>/^0[^.\s]+$/u.test(e);function Re(e){let t;return()=>(t===void 0&&(t=e()),t)}var ze=e=>e,Be=(e,t)=>n=>t(e(n)),Ve=(...e)=>e.reduce(Be),He=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},Ue=class{constructor(){this.subscriptions=[]}add(e){return je(this.subscriptions,e),()=>Me(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;ie*1e3,Ge=e=>e/1e3;function Ke(e,t){return t?e*(1e3/t):0}var qe=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Je=1e-7,Ye=12;function Xe(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=qe(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>Je&&++sXe(t,0,1,e,n);return e=>e===0||e===1?e:qe(i(e),t,r)}var Qe=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,$e=e=>t=>1-e(1-t),et=Ze(.33,1.53,.69,.99),tt=$e(et),nt=Qe(tt),rt=e=>(e*=2)<1?.5*tt(e):.5*(2-2**(-10*(e-1))),it=e=>1-Math.sin(Math.acos(e)),at=$e(it),ot=Qe(it),st=Ze(.42,0,1,1),ct=Ze(0,0,.58,1),lt=Ze(.42,0,.58,1),ut=e=>Array.isArray(e)&&typeof e[0]!=`number`,dt=e=>Array.isArray(e)&&typeof e[0]==`number`,ft={linear:ze,easeIn:st,easeInOut:lt,easeOut:ct,circIn:it,circInOut:ot,circOut:at,backIn:tt,backInOut:nt,backOut:et,anticipate:rt},pt=e=>typeof e==`string`,mt=e=>{if(dt(e)){e.length;let[t,n,r,i]=e;return Ze(t,n,r,i)}else if(pt(e))return ft[e],`${e}`,ft[e];return e},ht=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],gt={value:null,addProjectionMetrics:null};function _t(e,t){let n=new Set,r=new Set,i=!1,a=!1,o=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1},c=0;function l(t){o.has(t)&&(u.schedule(t),e()),c++,t(s)}let u={schedule:(e,t=!1,a=!1)=>{let s=a&&i?n:r;return t&&o.add(e),s.has(e)||s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(s=e,i){a=!0;return}i=!0,[n,r]=[r,n],n.forEach(l),t&>.value&>.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var vt=40;function yt(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=ht.reduce((e,n)=>(e[n]=_t(a,t?n:void 0),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=Pe.useManualTiming?i.timestamp:performance.now();n=!1,Pe.useManualTiming||(i.delta=r?1e3/60:Math.max(Math.min(a-i.timestamp,vt),1)),i.timestamp=a,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:ht.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t(St===void 0&&wt.set(K.isProcessing||Pe.useManualTiming?K.timestamp:performance.now()),St),set:e=>{St=e,queueMicrotask(Ct)}},Tt={layout:0,mainThread:0,waapi:0},Et=e=>t=>typeof t==`string`&&t.startsWith(e),Dt=Et(`--`),Ot=Et(`var(--`),kt=e=>Ot(e)?At.test(e.split(`/*`)[0].trim()):!1,At=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,jt={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},Mt={...jt,transform:e=>Ne(0,1,e)},Nt={...jt,default:1},Pt=e=>Math.round(e*1e5)/1e5,Ft=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function It(e){return e==null}var Lt=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Rt=(e,t)=>n=>!!(typeof n==`string`&&Lt.test(n)&&n.startsWith(e)||t&&!It(n)&&Object.prototype.hasOwnProperty.call(n,t)),zt=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(Ft);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},Bt=e=>Ne(0,255,e),Vt={...jt,transform:e=>Math.round(Bt(e))},Ht={test:Rt(`rgb`,`red`),parse:zt(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+Vt.transform(e)+`, `+Vt.transform(t)+`, `+Vt.transform(n)+`, `+Pt(Mt.transform(r))+`)`};function Ut(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var Wt={test:Rt(`#`),parse:Ut,transform:Ht.transform},Gt=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Kt=Gt(`deg`),qt=Gt(`%`),q=Gt(`px`),Jt=Gt(`vh`),Yt=Gt(`vw`),Xt=(()=>({...qt,parse:e=>qt.parse(e)/100,transform:e=>qt.transform(e*100)}))(),Zt={test:Rt(`hsl`,`hue`),parse:zt(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+qt.transform(Pt(t))+`, `+qt.transform(Pt(n))+`, `+Pt(Mt.transform(r))+`)`},J={test:e=>Ht.test(e)||Wt.test(e)||Zt.test(e),parse:e=>Ht.test(e)?Ht.parse(e):Zt.test(e)?Zt.parse(e):Wt.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?Ht.transform(e):Zt.transform(e),getAnimatableNone:e=>{let t=J.parse(e);return t.alpha=0,J.transform(t)}},Qt=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function $t(e){return isNaN(e)&&typeof e==`string`&&(e.match(Ft)?.length||0)+(e.match(Qt)?.length||0)>0}var en=`number`,tn=`color`,nn=`var`,rn=`var(`,an="${}",on=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function sn(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(on,e=>(J.test(e)?(r.color.push(a),i.push(tn),n.push(J.parse(e))):e.startsWith(rn)?(r.var.push(a),i.push(nn),n.push(e)):(r.number.push(a),i.push(en),n.push(parseFloat(e))),++a,an)).split(an),indexes:r,types:i}}function cn(e){return sn(e).values}function ln(e){let{split:t,types:n}=sn(e),r=t.length;return e=>{let i=``;for(let a=0;atypeof e==`number`?0:J.test(e)?J.getAnimatableNone(e):e;function dn(e){let t=cn(e);return ln(e)(t.map(un))}var fn={test:$t,parse:cn,createTransformer:ln,getAnimatableNone:dn};function pn(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function mn({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=pn(s,r,e+1/3),a=pn(s,r,e),o=pn(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function hn(e,t){return n=>n>0?t:e}var Y=(e,t,n)=>e+(t-e)*n,gn=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},_n=[Wt,Ht,Zt],vn=e=>_n.find(t=>t.test(e));function yn(e){let t=vn(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===Zt&&(n=mn(n)),n}var bn=(e,t)=>{let n=yn(e),r=yn(t);if(!n||!r)return hn(e,t);let i={...n};return e=>(i.red=gn(n.red,r.red,e),i.green=gn(n.green,r.green,e),i.blue=gn(n.blue,r.blue,e),i.alpha=Y(n.alpha,r.alpha,e),Ht.transform(i))},xn=new Set([`none`,`hidden`]);function Sn(e,t){return xn.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Cn(e,t){return n=>Y(e,t,n)}function wn(e){return typeof e==`number`?Cn:typeof e==`string`?kt(e)?hn:J.test(e)?bn:On:Array.isArray(e)?Tn:typeof e==`object`?J.test(e)?bn:En:hn}function Tn(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>wn(e)(e,t[n]));return e=>{for(let t=0;t{for(let t in r)n[t]=r[t](e);return n}}function Dn(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i{let n=fn.createTransformer(t),r=sn(e),i=sn(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?xn.has(e)&&!i.values.length||xn.has(t)&&!r.values.length?Sn(e,t):Ve(Tn(Dn(r,i),i.values),n):(`${e}${t}`,hn(e,t))};function kn(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?Y(e,t,n):wn(e)(e,t)}var An=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>G.update(t,e),stop:()=>bt(t),now:()=>K.isProcessing?K.timestamp:wt.now()}},jn=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t=2e4?1/0:t}function Pn(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(Nn(r),Mn);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:Ge(i)}}var Fn=5;function In(e,t,n){let r=Math.max(t-Fn,0);return Ke(n-e(r),t-r)}var X={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Ln=.001;function Rn({duration:e=X.duration,bounce:t=X.bounce,velocity:n=X.velocity,mass:r=X.mass}){let i,a;X.maxDuration;let o=1-t;o=Ne(X.minDamping,X.maxDamping,o),e=Ne(X.minDuration,X.maxDuration,Ge(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=Vn(t,o),c=Math.exp(-i);return Ln-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=Vn(t**2,o);return(-i(t)+Ln>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-Ln+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=Bn(i,a,s);if(e=We(e),isNaN(c))return{stiffness:X.stiffness,damping:X.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var zn=12;function Bn(e,t,n){let r=n;for(let n=1;ne[t]!==void 0)}function Gn(e){let t={velocity:X.velocity,stiffness:X.stiffness,damping:X.damping,mass:X.mass,isResolvedFromDuration:!1,...e};if(!Wn(e,Un)&&Wn(e,Hn))if(e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*Ne(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:X.mass,stiffness:i,damping:a}}else{let n=Rn(e);t={...t,...n,mass:X.mass},t.isResolvedFromDuration=!0}return t}function Kn(e=X.visualDuration,t=X.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=Gn({...n,velocity:-Ge(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=Ge(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?X.restSpeed.granular:X.restSpeed.default,i||=v?X.restDelta.granular:X.restDelta.default;let y;if(h<1){let e=Vn(_,h);y=t=>o-Math.exp(-h*_*t)*((m+h*_*g)/e*Math.sin(e*t)+g*Math.cos(e*t))}else if(h===1)y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e}}let b={calculatedDuration:p&&d||null,next:e=>{let t=y(e);if(p)s.done=e>=d;else{let n=e===0?m:0;h<1&&(n=e===0?We(m):In(y,e,t));let a=Math.abs(n)<=r,c=Math.abs(o-t)<=i;s.done=a&&c}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(Nn(b),Mn),t=jn(t=>b.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return b}Kn.applyToOptions=e=>{let t=Pn(e,100,Kn);return e.ease=t.ease,e.duration=We(t.duration),e.type=`keyframes`,e};function qn({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&ec,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=Kn({keyframes:[f.value,m(f.value)],velocity:In(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function Jn(e,t,n){let r=[],i=n||Pe.mix||kn,a=e.length-1;for(let n=0;nt[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=Jn(t,r,i),c=s.length,l=n=>{if(o&&n1)for(;rl(Ne(e[0],e[a-1],t)):l}function Xn(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=He(0,t,r);e.push(Y(n,1,i))}}function Zn(e){let t=[0];return Xn(t,e.length-1),t}function Qn(e,t){return e.map(e=>e*t)}function $n(e,t){return e.map(()=>t||lt).splice(0,e.length-1)}function er({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=ut(r)?r.map(mt):mt(r),a={done:!1,value:t[0]},o=Yn(Qn(n&&n.length===t.length?n:Zn(t),e),t,{ease:Array.isArray(i)?i:$n(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var tr=e=>e!==null;function nr(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(tr),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var rr={decay:qn,inertia:qn,tween:er,keyframes:er,spring:Kn};function ir(e){typeof e.type==`string`&&(e.type=rr[e.type])}var ar=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},or=e=>e/100,sr=class extends ar{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==wt.now()&&this.tick(wt.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},Tt.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;ir(e);let{type:t=er,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||er;s!==er&&typeof o[0]!=`number`&&(this.mixKeyframes=Ve(or,kn(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=Nn(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=Ne(0,1,n)*o}let b=_?{done:!1,value:l[0]}:y.next(v);i&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==qn&&(b.value=nr(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return Ge(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Ge(e)}get time(){return Ge(this.currentTime)}set time(e){e=We(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(wt.now());let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=Ge(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=An,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(wt.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null,Tt.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function cr(e){for(let t=1;te*180/Math.PI,ur=e=>fr(lr(Math.atan2(e[1],e[0]))),dr={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:ur,rotateZ:ur,skewX:e=>lr(Math.atan(e[1])),skewY:e=>lr(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},fr=e=>(e%=360,e<0&&(e+=360),e),pr=ur,mr=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),hr=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),gr={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:mr,scaleY:hr,scale:e=>(mr(e)+hr(e))/2,rotateX:e=>fr(lr(Math.atan2(e[6],e[5]))),rotateY:e=>fr(lr(Math.atan2(-e[2],e[0]))),rotateZ:pr,rotate:pr,skewX:e=>lr(Math.atan(e[4])),skewY:e=>lr(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function _r(e){return e.includes(`scale`)?1:0}function vr(e,t){if(!e||e===`none`)return _r(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=gr,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=dr,i=t}if(!i)return _r(t);let a=r[t],o=i[1].split(`,`).map(br);return typeof a==`function`?a(o):o[a]}var yr=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return vr(n,t)};function br(e){return parseFloat(e.trim())}var xr=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],Sr=(()=>new Set(xr))(),Cr=e=>e===jt||e===q,wr=new Set([`x`,`y`,`z`]),Tr=xr.filter(e=>!wr.has(e));function Er(e){let t=[];return Tr.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith(`scale`)?1:0))}),t}var Dr={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>vr(t,`x`),y:(e,{transform:t})=>vr(t,`y`)};Dr.translateX=Dr.x,Dr.translateY=Dr.y;var Or=new Set,kr=!1,Ar=!1,jr=!1;function Mr(){if(Ar){let e=Array.from(Or).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=Er(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}Ar=!1,kr=!1,Or.forEach(e=>e.complete(jr)),Or.clear()}function Nr(){Or.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Ar=!0)})}function Pr(){jr=!0,Nr(),Mr(),jr=!1}var Fr=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(Or.add(this),kr||(kr=!0,G.read(Nr),G.resolveKeyframes(Mr))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}cr(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Or.delete(this)}cancel(){this.state===`scheduled`&&(Or.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},Ir=e=>e.startsWith(`--`);function Lr(e,t,n){Ir(t)?e.style.setProperty(t,n):e.style[t]=n}var Rr=Re(()=>window.ScrollTimeline!==void 0),zr={};function Br(e,t){let n=Re(e);return()=>zr[t]??n()}var Vr=Br(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),Hr=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Ur={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:Hr([0,.65,.55,1]),circOut:Hr([.55,0,1,.45]),backIn:Hr([.31,.01,.66,-.59]),backOut:Hr([.33,1.53,.69,.99])};function Wr(e,t){if(e)return typeof e==`function`?Vr()?jn(e,t):`ease-out`:dt(e)?Hr(e):Array.isArray(e)?e.map(e=>Wr(e,t)||Ur.easeOut):Ur[e]}function Gr(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=Wr(s,i);Array.isArray(d)&&(u.easing=d),gt.value&&Tt.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return gt.value&&p.finished.finally(()=>{Tt.waapi--}),p}function Kr(e){return typeof e==`function`&&`applyToOptions`in e}function qr({type:e,...t}){return Kr(e)&&Vr()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var Jr=class extends ar{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=qr(e);this.animation=Gr(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=nr(r,this.options,o,this.speed);this.updateMotionValue?this.updateMotionValue(e):Lr(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return Ge(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Ge(e)}get time(){return Ge(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=We(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&Rr()?(this.animation.timeline=e,ze):t(this)}},Yr={anticipate:rt,backInOut:nt,circInOut:ot};function Xr(e){return e in Yr}function Zr(e){typeof e.ease==`string`&&Xr(e.ease)&&(e.ease=Yr[e.ease])}var Qr=10,$r=class extends Jr{constructor(e){Zr(e),ir(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new sr({...a,autoplay:!1}),s=We(this.finishedTime??this.time);t.setWithVelocity(o.sample(s-Qr).value,o.sample(s).value,Qr),o.stop()}},ei=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(fn.test(e)||e===`0`)&&!e.startsWith(`url(`));function ti(e){let t=e[0];if(e.length===1)return!0;for(let n=0;nObject.hasOwnProperty.call(Element.prototype,`animate`));function oi(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:s,transformTemplate:c}=t.owner.getProps();return ai()&&n&&ii.has(n)&&(n!==`transform`||!c)&&!s&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var si=40,ci=class extends ar{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=wt.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u};this.keyframeResolver=new(l?.KeyframeResolver||Fr)(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=wt.now(),ni(e,i,a,o)||((Pe.instantAnimations||!s)&&l?.(nr(e,n,t)),e[0]=e[e.length-1],ri(n),n.repeat=0);let u={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>si?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},d=!c&&oi(u)?new $r({...u,element:u.motionValue.owner.current}):new sr(u);d.finished.then(()=>this.notifyFinished()).catch(ze),this.pendingTimeline&&=(this.stopTimeline=d.attachTimeline(this.pendingTimeline),void 0),this._animation=d}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Pr()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}},li=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function ui(e){let t=li.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function di(e,t,n=1){`${e}`;let[r,i]=ui(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return Fe(e)?parseFloat(e):e}return kt(i)?di(i,t,n+1):i}function fi(e,t){return e?.[t]??e?.default??e}var pi=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...xr]),mi={test:e=>e===`auto`,parse:e=>e},hi=e=>t=>t.test(e),gi=[jt,q,qt,Kt,Yt,Jt,mi],_i=e=>gi.find(hi(e));function vi(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||Le(e)}var yi=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function bi(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(Ft)||[];if(!r)return e;let i=n.replace(r,``),a=yi.has(t)?1:0;return r!==n&&(a*=100),t+`(`+a+i+`)`}var xi=/\b([a-z-]*)\(.*?\)/gu,Si={...fn,getAnimatableNone:e=>{let t=e.match(xi);return t?t.map(bi).join(` `):e}},Ci={...jt,transform:Math.round},wi={borderWidth:q,borderTopWidth:q,borderRightWidth:q,borderBottomWidth:q,borderLeftWidth:q,borderRadius:q,radius:q,borderTopLeftRadius:q,borderTopRightRadius:q,borderBottomRightRadius:q,borderBottomLeftRadius:q,width:q,maxWidth:q,height:q,maxHeight:q,top:q,right:q,bottom:q,left:q,padding:q,paddingTop:q,paddingRight:q,paddingBottom:q,paddingLeft:q,margin:q,marginTop:q,marginRight:q,marginBottom:q,marginLeft:q,backgroundPositionX:q,backgroundPositionY:q,rotate:Kt,rotateX:Kt,rotateY:Kt,rotateZ:Kt,scale:Nt,scaleX:Nt,scaleY:Nt,scaleZ:Nt,skew:Kt,skewX:Kt,skewY:Kt,distance:q,translateX:q,translateY:q,translateZ:q,x:q,y:q,z:q,perspective:q,transformPerspective:q,opacity:Mt,originX:Xt,originY:Xt,originZ:q,zIndex:Ci,fillOpacity:Mt,strokeOpacity:Mt,numOctaves:Ci},Ti={...wi,color:J,backgroundColor:J,outlineColor:J,fill:J,stroke:J,borderColor:J,borderTopColor:J,borderRightColor:J,borderBottomColor:J,borderLeftColor:J,filter:Si,WebkitFilter:Si},Ei=e=>Ti[e];function Di(e,t){let n=Ei(e);return n!==Si&&(n=fn),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var Oi=new Set([`auto`,`none`,`0`]);function ki(e,t,n){let r=0,i;for(;r{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}};function ji(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}var Mi=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function Ni(e){return Ie(e)&&`offsetHeight`in e}var Pi=30,Fi=e=>!isNaN(parseFloat(e)),Ii={current:void 0},Li=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=wt.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=wt.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Fi(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new Ue);let n=this.events[e].add(t);return e===`change`?()=>{n(),G.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return Ii.current&&Ii.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=wt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Pi)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,Pi);return Ke(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Ri(e,t){return new Li(e,t)}var{schedule:zi,cancel:Bi}=yt(queueMicrotask,!1),Vi={x:!1,y:!1};function Hi(){return Vi.x||Vi.y}function Ui(e){return e===`x`||e===`y`?Vi[e]?null:(Vi[e]=!0,()=>{Vi[e]=!1}):Vi.x||Vi.y?null:(Vi.x=Vi.y=!0,()=>{Vi.x=Vi.y=!1})}function Wi(e,t){let n=ji(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function Gi(e){return!(e.pointerType===`touch`||Hi())}function Ki(e,t,n={}){let[r,i,a]=Wi(e,n),o=e=>{if(!Gi(e))return;let{target:n}=e,r=t(n,e);if(typeof r!=`function`||!n)return;let a=e=>{Gi(e)&&(r(e),n.removeEventListener(`pointerleave`,a))};n.addEventListener(`pointerleave`,a,i)};return r.forEach(e=>{e.addEventListener(`pointerenter`,o,i)}),a}var qi=(e,t)=>t?e===t?!0:qi(e,t.parentElement):!1,Ji=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,Yi=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function Xi(e){return Yi.has(e.tagName)||e.tabIndex!==-1}var Zi=new WeakSet;function Qi(e){return t=>{t.key===`Enter`&&e(t)}}function $i(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var ea=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=Qi(()=>{if(Zi.has(n))return;$i(n,`down`);let e=Qi(()=>{$i(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>$i(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function ta(e){return Ji(e)&&!Hi()}function na(e,t,n={}){let[r,i,a]=Wi(e,n),o=e=>{let r=e.currentTarget;if(!ta(e))return;Zi.add(r);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),Zi.has(r)&&Zi.delete(r),ta(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||qi(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),Ni(e)&&(e.addEventListener(`focus`,e=>ea(e,i)),!Xi(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function ra(e){return Ie(e)&&`ownerSVGElement`in e}function ia(e){return ra(e)&&e.tagName===`svg`}var aa=e=>!!(e&&e.getVelocity),oa=[...gi,J,fn],sa=e=>oa.find(hi(e)),ca=(0,M.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function la(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function ua(...e){return t=>{let n=!1,r=e.map(e=>{let r=la(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t{let{width:e,height:c,top:l,left:u,right:d}=o.current;if(t||!a.current||!e||!c)return;let f=n===`left`?`left: ${u}`:`right: ${d}`;a.current.dataset.motionPopId=i;let p=document.createElement(`style`);s&&(p.nonce=s);let m=r??document.head;return m.appendChild(p),p.sheet&&p.sheet.insertRule(` +import{C as e,Dn as t,On as n,Tn as r,_ as i,a,an as o,c as s,g as c,h as l,i as u,jn as d,kn as f,l as p,ln as m,mn as h,o as g,p as _,pn as v,tn as y,u as b,v as x,w as S,wn as C,x as w,y as T}from"./index-BWApiWDT.js";import{t as E}from"./SigilModal-B_GantjI.js";const D=17491.270421,O=[`Ignition Ark`,`Integration Ark`,`Harmonization Ark`,`Reflektion Ark`,`Purifikation Ark`,`Dream Ark`],k={"Ignition Ark":`#ff1559`,"Integration Ark":`#ff6d00`,"Harmonization Ark":`#ffd900`,"Reflektion Ark":`#00ff66`,"Purifikation Ark":`#05e6ff`,"Dream Ark":`#c300ff`},A={"Ignition Ark":`Ignite`,"Integration Ark":`Integrate`,"Harmonization Ark":`Harmony`,"Reflektion Ark":`Reflekt`,"Purifikation Ark":`Purify`,"Dream Ark":`Dream`},j=D/36,ee=j/44,te=3+Math.sqrt(5);Math.round(te*1e3),1/te;var M=d(r(),1),N=d(y(),1),P=120,F=P/2,I=22,L=4.5,ne=2,R=F-.5,re=F-ne,z=36,B=-3,V=3,ie=re-2,ae=(I+L+R)/2-4,oe=e=>e*Math.PI/180,se=e=>e.toLowerCase().replace(/\s+/g,`-`);function ce(e,t,n){let r=parseInt(e.slice(1),16),i=parseInt(t.slice(1),16),a=r>>16,o=r>>8&255,s=r&255,c=i>>16,l=i>>8&255,u=i&255;return`rgb(${Math.round(a+(c-a)*n)},${Math.round(o+(l-o)*n)},${Math.round(s+(u-s)*n)})`}var le=(e,t,n)=>Math.max(t,Math.min(n,e)),H=e=>{if(!e)return;let t=e.match(/(\d{2})$/);if(!t)return;let n=parseInt(t[1],10);if(Number.isFinite(n))return le(n,0,43)},U=({hue:e,pulse:t,kaiPulseEternal:n,harmonicDayPercent:r,microCyclePercent:i,dayLabel:a,monthLabel:o,monthDay:s,glowPulse:c=!0,pulseIntervalSec:l=te,rimFlash:u=!1,rotationOverride:d,solarSpiralStepString:f,solarSpiralStep:p,eternalBeatIndex:m,eternalStepIndex:h})=>{(0,M.useEffect)(()=>{typeof document<`u`&&document.documentElement.style.setProperty(`--cycle`,`${l}s`)},[l]);let g=`${l}s`,_=(n%D+D)%D,v=Number.isFinite(t)?t:_,y=v/D,b=Number.isFinite(r)?r:y*100,x=(v-Math.floor(v/j)*j)%ee/ee,S=Number.isFinite(i)?i:x*100,C=(v%D+D)%D,w=C/D,T=Math.floor(w*36)%36,E=(T+.5)/36*360,ne=typeof d==`number`?d:E,U=360/O.length,W=Math.floor(ne/U)%O.length,ue=(W+1)%O.length,de=(ne-W*U+360)%360,fe=Math.min(1,de/U),pe=k[O[W]],me=k[O[ue]],he=ce(pe,me,fe),ge=2*Math.PI*re,_e=ge*(1-b/100),ve=-(S/100)*l,ye=v,be=[`Aethon`,`Virelai`,`Solari`,`Amarin`,`Kaelus`,`Umbriel`,`Noctura`,`Liora`].indexOf(o)+1,xe=be>0?be:1,Se=F-14,Ce=F,we=F+14,Te=F+28,Ee=Math.floor(_/j)%36,De=Number.isFinite(m)?le(m,0,35):Ee,Oe=_-De*j,ke=Oe/j,Ae=Math.floor(Oe/ee)%44,je=Number.isFinite(h)?le(h,0,43):Ae,Me=je.toString().padStart(2,`0`),Ne=(De+.5)/36*360,Pe=`hsl(${T/36*360}, 100%, 50%)`,Fe=`#ebfdff`,Ie=1.6,Le=R-(I+L)+.5,Re=F-(I+L),ze=Le*ke,Be=Re-ze,Ve=.82,He=F-(I+L)-Le*Ve,Ue=F,We=He+6,Ge=(0,M.useId)().replace(/[^a-zA-Z0-9_-]/g,``)||`klock`,Ke=Me,qe=De.toString().padStart(2,`0`),Je=Math.floor(_),Ye=Oe-je*ee,Xe=Math.max(0,Math.min(1,Ye/ee))*100,Ze=`#00faff`,Qe=`#ff6d00`,$e=((C-T*j)%j+j)%j,et=Math.floor($e/ee)%44,tt=Number.isFinite(p?.stepIndex)?le(p.stepIndex,0,43):void 0,nt=H(f),rt=(tt??nt??et).toString().padStart(2,`0`),it=F-(I+L)-Le*Ve,at=F;return(0,N.jsx)(`div`,{className:`kai-klock-shell`,style:{"--hue":e,"--arc":pe,"--cycle":g,width:`100%`,aspectRatio:`1 / 1`,overflow:`hidden`},children:(0,N.jsxs)(`svg`,{className:`kai-svg`,viewBox:`0 0 ${P} ${P}`,width:`100%`,height:`100%`,preserveAspectRatio:`xMidYMid meet`,role:`img`,children:[(0,N.jsx)(`circle`,{cx:F,cy:F,r:R,className:`rim-ring ${u?`rim-flash`:``}`}),(0,N.jsx)(`circle`,{cx:F,cy:F,r:re,className:`day-progress`,strokeDasharray:ge,strokeDashoffset:_e}),Array.from({length:36}).map((e,t)=>{let n=oe(t*(360/z)-90),r=(t+B+z)%z/z;return(0,N.jsx)(`text`,{x:F+ie*Math.cos(n),y:F+ie*Math.sin(n)+V/2,className:`beat-number`,textAnchor:`middle`,fontSize:V,style:{fill:`hsl(${r*360},100%,50%)`},children:t},t)}),(0,N.jsx)(`circle`,{cx:F,cy:F,r:I+L,className:`inner-halo`}),(0,N.jsx)(`g`,{className:`orb-spin`,style:{animationDelay:`${ve}s`},children:(0,N.jsx)(`circle`,{cx:F,cy:F-(I+L),r:3.6,className:`micro-orb orb-glow`})}),(0,N.jsxs)(`g`,{style:{transform:`rotate(${ne}deg)`,transformOrigin:`${F}px ${F}px`,transition:`transform 1s ease-out`},children:[(0,N.jsx)(`rect`,{x:F-1,y:F-(I+L)-(R-(I+L)),width:2,height:R-(I+L),rx:1,className:`needle`,style:{fill:he}}),(0,N.jsxs)(`g`,{className:`solar-hand-label-wrap`,style:{transform:`rotate(${-ne}deg)`,transformOrigin:`${at}px ${it}px`},children:[(0,N.jsx)(`text`,{x:at,y:it-3.6,textAnchor:`middle`,dominantBaseline:`central`,fontSize:3,fontWeight:900,style:{fill:Qe,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.65)`,strokeWidth:.8,filter:`drop-shadow(0 0 2px ${Qe})`},children:`☀`}),(0,N.jsx)(`text`,{x:at-2.2,y:it,textAnchor:`middle`,dominantBaseline:`central`,className:`solar-hand-label-digit`,fontSize:4.4,fontWeight:900,style:{fill:Qe,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.65)`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px ${Qe}) drop-shadow(0 0 5px ${Qe})`},children:rt[0]}),(0,N.jsx)(`text`,{x:at+2.2,y:it,textAnchor:`middle`,dominantBaseline:`central`,className:`solar-hand-label-digit`,fontSize:4.4,fontWeight:900,style:{fill:Qe,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.65)`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px ${Qe}) drop-shadow(0 0 5px ${Qe})`},children:rt[1]})]})]}),(0,N.jsxs)(`g`,{className:`eternal-hand-group`,style:{transform:`rotate(${Ne}deg)`,transformOrigin:`${F}px ${F}px`,transition:`transform 0.6s cubic-bezier(.22,.61,.36,1)`},children:[(0,N.jsx)(`rect`,{x:F-Ie/2,y:F-(I+L)-Le,width:Ie,height:Le,rx:Ie/1.5,className:`eternal-hand`,style:{fill:`transparent`,stroke:`#bff7ff`,strokeWidth:.7,filter:`drop-shadow(0 0 2px #eaffff) drop-shadow(0 0 6px #d9fbff)`,mixBlendMode:`screen`}}),(0,N.jsx)(`defs`,{children:(0,N.jsxs)(`linearGradient`,{id:`eternalFill-${Ge}`,x1:`0`,y1:`1`,x2:`0`,y2:`0`,children:[(0,N.jsx)(`stop`,{offset:`0%`,stopColor:Fe,stopOpacity:.15}),(0,N.jsx)(`stop`,{offset:`100%`,stopColor:Fe,stopOpacity:.95})]})}),(0,N.jsx)(`rect`,{x:F-Ie/2,y:Be,width:Ie,height:Math.max(0,ze),rx:Ie/2,className:`eternal-hand-fill`,style:{fill:`url(#eternalFill-${Ge})`,filter:`drop-shadow(0 0 3px #eaffff) drop-shadow(0 0 6px #eaffff)`,mixBlendMode:`screen`}}),(0,N.jsx)(`circle`,{cx:F,cy:F-(I+L)-Le-.8,r:1.35,className:`eternal-hand-tip`,style:{fill:`#ffffff`,filter:`drop-shadow(0 0 4px #eaffff) drop-shadow(0 0 8px #eaffff)`,mixBlendMode:`screen`}}),(0,N.jsxs)(`g`,{className:`eternal-hand-label-wrap`,style:{transform:`rotate(${-Ne}deg)`,transformOrigin:`${Ue}px ${He}px`},children:[(0,N.jsx)(`text`,{x:Ue-2.2,y:He,textAnchor:`middle`,dominantBaseline:`central`,className:`eternal-hand-label-digit`,fontSize:4.4,fontWeight:900,style:{fill:`#e8feff`,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.45)`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px #eaffff) drop-shadow(0 0 5px #c8fbff)`},children:Me[0]}),(0,N.jsx)(`text`,{x:Ue+2.2,y:He,textAnchor:`middle`,dominantBaseline:`central`,className:`eternal-hand-label-digit`,fontSize:4.4,fontWeight:900,style:{fill:`#e8feff`,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.45)`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px #eaffff) drop-shadow(0 0 5px #c8fbff)`},children:Me[1]})]}),(0,N.jsx)(`g`,{transform:`rotate(${-Ne} ${Ue} ${We})`,children:(0,N.jsx)(`text`,{x:Ue,y:We,textAnchor:`middle`,dominantBaseline:`central`,className:`eternal-hand-percent`,fontSize:3.2,fontWeight:800,style:{fill:`#dafeff`,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.4)`,strokeWidth:.7,letterSpacing:`0.25px`,filter:`drop-shadow(0 0 2px #eaffff)`}})})]}),(0,N.jsx)(`text`,{x:F,y:F-15,className:`center-sub`,textAnchor:`middle`,fontSize:6,fontWeight:800,style:{fill:Ze,paintOrder:`stroke`,stroke:`#000`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px ${Ze}) drop-shadow(0 0 6px ${Ze})`},children:Je}),(0,N.jsxs)(`text`,{x:F,y:F-3,className:`center-pulse ${c?`pulse-flash`:``}`,textAnchor:`middle`,children:[qe,`:`,Ke]},`et-${ye}`),(0,N.jsx)(`text`,{x:F,y:F+8,className:`center-day day-${se(a)}`,textAnchor:`middle`,children:a}),(0,N.jsx)(`text`,{x:F,y:F+18,className:`center-month month-${se(o)}`,textAnchor:`middle`,children:o}),(0,N.jsx)(`text`,{x:F,y:Te+8,className:`eternal-pulse`,textAnchor:`middle`,children:n}),(0,N.jsx)(`text`,{x:Se,y:Te,className:`step-percent`,textAnchor:`middle`,fontSize:5.5,fill:Pe,fontWeight:800,style:{filter:`drop-shadow(0 0 2px ${Pe}) drop-shadow(0 0 5px #00faff)`,letterSpacing:`0.25px`},children:`${Xe.toFixed(1)}%`}),(0,N.jsx)(`text`,{x:Ce,y:Te,className:`day-of-month day-${se(a)}`,textAnchor:`middle`,children:s}),(0,N.jsx)(`text`,{x:we,y:Te,className:`day-of-month month-${se(o)}`,textAnchor:`middle`,children:xe}),O.map((e,t)=>{let n=oe(t*(360/O.length)-90),r=F+ae*Math.cos(n),i=F+ae*Math.sin(n)+(t===3?7:3);return(0,N.jsxs)(M.Fragment,{children:[(0,N.jsx)(`text`,{x:r,y:i,className:`arc-label arc-${se(e.split(` `)[0])} ${t===W?`active`:``}`,textAnchor:`middle`,children:A[e]}),e===`Ignition Ark`&&f&&(0,N.jsx)(`text`,{x:r,y:i+8,textAnchor:`middle`,dominantBaseline:`hanging`,fontSize:10,fill:`#00faff`,fontWeight:900,style:{filter:`drop-shadow(0 0 2px #00faff) drop-shadow(0 0 4px #00faff) drop-shadow(0 0 8px #00faff)`,paintOrder:`stroke`,stroke:`#000`,strokeWidth:1,vectorEffect:`non-scaling-stroke`,letterSpacing:`0.5px`},children:f})]},e)})]})})},W=Date.UTC(2024,4,10,6,45,41,888),ue=3+Math.sqrt(5),de=ue*1e3,fe=1000000n,pe=17491270421n,me=11000000n,he=(pe+18n)/36n,ge=[`Solhara`,`Aquaris`,`Flamora`,`Verdari`,`Sonari`,`Kaelith`],_e={Solhara:`Root`,Aquaris:`Sacral`,Flamora:`Solar Plexus`,Verdari:`Heart`,Sonari:`Throat`,Kaelith:`Crown`},ve=(e,t)=>(e%t+t)%t;function ye(e,t){let n=e/t,r=e%t;return r!==0n&&r>0n!=t>0n?n-1n:n}function be(e){if(!Number.isFinite(e))return 0n;let t=e<0?-1:1,n=Math.abs(e),r=Math.trunc(n),i=n-r;return i<.5?BigInt(t*r):i>.5?BigInt(t*(r+1)):BigInt(t*(r%2==0?r:r+1))}function xe(e){return be((e.getTime()-W)/1e3/ue*1e6)}function Se(e){let t=xe(e),n=ve(t,pe),r=ye(t,pe),i=Number(ye(n,he)),a=n-BigInt(i)*he,o=a-a/me*me,s=Number(o)/Number(me);return{pulse:Number(ye(t,fe)),beat:i,stepPct:s,chakraDay:_e[ge[Number(ve(r,6n))]]}}var Ce=()=>performance.timeOrigin+performance.now(),we=e=>{let t=e-W;return W+Math.ceil(t/de)*de},Te=()=>{let[e,t]=(0,M.useState)(0),[n,r]=(0,M.useState)(0),[i,a]=(0,M.useState)(0),[o,s]=(0,M.useState)(`Root`),[c,l]=(0,M.useState)(!1),[u]=(0,M.useState)(()=>`btn-${Math.random().toString(36).slice(2)}`),d=c?`sigil-open`:`sigil-closed`,f=(0,M.useRef)(null),p=(0,M.useRef)(null),m=(0,M.useRef)(0),h=(0,M.useCallback)(()=>{let{pulse:e,beat:n,stepPct:i,chakraDay:o}=Se(new Date);t(e),r(n),a(i),s(o)},[]),g=()=>{p.current!==null&&(clearTimeout(p.current),p.current=null)},_=(0,M.useCallback)(()=>{g();let e=Ce();m.current=we(e);let t=()=>{let e=Ce(),n=Math.floor((e-m.current)/de),r=Math.max(0,n)+1;for(let e=0;e(h(),_(),()=>g()),[h,_]),(0,M.useEffect)(()=>{let e=()=>{document.visibilityState===`visible`&&_()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[_]),(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`button`,{className:`sigil-button`,title:`View & save this sigil`,onClick:()=>l(!0),"data-chakra":o,"aria-label":`Open Kairos Sigil`,children:(0,N.jsxs)(`span`,{className:`sigil-thumb`,"aria-hidden":`true`,inert:!0,children:[(0,N.jsx)(S,{ref:f,pulse:e,beat:n,stepPct:i,chakraDay:o,size:40,hashMode:`deterministic`,origin:u,onReady:n=>{n&&typeof n.pulse==`number`&&n.pulse!==e&&t(n.pulse)}},d),(0,N.jsx)(`span`,{className:`sigil-shield`,"aria-hidden":`true`})]})}),c&&(0,N.jsx)(E,{initialPulse:e,onClose:()=>l(!1)})]})},Ee=(0,M.createContext)({});function De(e){let t=(0,M.useRef)(null);return t.current===null&&(t.current=e()),t.current}var Oe=typeof window<`u`,ke=Oe?M.useLayoutEffect:M.useEffect,Ae=(0,M.createContext)(null);function je(e,t){e.indexOf(t)===-1&&e.push(t)}function Me(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var Ne=(e,t,n)=>n>t?t:n/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Ie(e){return typeof e==`object`&&!!e}var Le=e=>/^0[^.\s]+$/u.test(e);function Re(e){let t;return()=>(t===void 0&&(t=e()),t)}var ze=e=>e,Be=(e,t)=>n=>t(e(n)),Ve=(...e)=>e.reduce(Be),He=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},Ue=class{constructor(){this.subscriptions=[]}add(e){return je(this.subscriptions,e),()=>Me(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;ie*1e3,Ge=e=>e/1e3;function Ke(e,t){return t?e*(1e3/t):0}var qe=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Je=1e-7,Ye=12;function Xe(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=qe(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>Je&&++sXe(t,0,1,e,n);return e=>e===0||e===1?e:qe(i(e),t,r)}var Qe=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,$e=e=>t=>1-e(1-t),et=Ze(.33,1.53,.69,.99),tt=$e(et),nt=Qe(tt),rt=e=>(e*=2)<1?.5*tt(e):.5*(2-2**(-10*(e-1))),it=e=>1-Math.sin(Math.acos(e)),at=$e(it),ot=Qe(it),st=Ze(.42,0,1,1),ct=Ze(0,0,.58,1),lt=Ze(.42,0,.58,1),ut=e=>Array.isArray(e)&&typeof e[0]!=`number`,dt=e=>Array.isArray(e)&&typeof e[0]==`number`,ft={linear:ze,easeIn:st,easeInOut:lt,easeOut:ct,circIn:it,circInOut:ot,circOut:at,backIn:tt,backInOut:nt,backOut:et,anticipate:rt},pt=e=>typeof e==`string`,mt=e=>{if(dt(e)){e.length;let[t,n,r,i]=e;return Ze(t,n,r,i)}else if(pt(e))return ft[e],`${e}`,ft[e];return e},ht=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],gt={value:null,addProjectionMetrics:null};function _t(e,t){let n=new Set,r=new Set,i=!1,a=!1,o=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1},c=0;function l(t){o.has(t)&&(u.schedule(t),e()),c++,t(s)}let u={schedule:(e,t=!1,a=!1)=>{let s=a&&i?n:r;return t&&o.add(e),s.has(e)||s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(s=e,i){a=!0;return}i=!0,[n,r]=[r,n],n.forEach(l),t&>.value&>.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var vt=40;function yt(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=ht.reduce((e,n)=>(e[n]=_t(a,t?n:void 0),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=Pe.useManualTiming?i.timestamp:performance.now();n=!1,Pe.useManualTiming||(i.delta=r?1e3/60:Math.max(Math.min(a-i.timestamp,vt),1)),i.timestamp=a,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:ht.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t(St===void 0&&wt.set(K.isProcessing||Pe.useManualTiming?K.timestamp:performance.now()),St),set:e=>{St=e,queueMicrotask(Ct)}},Tt={layout:0,mainThread:0,waapi:0},Et=e=>t=>typeof t==`string`&&t.startsWith(e),Dt=Et(`--`),Ot=Et(`var(--`),kt=e=>Ot(e)?At.test(e.split(`/*`)[0].trim()):!1,At=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,jt={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},Mt={...jt,transform:e=>Ne(0,1,e)},Nt={...jt,default:1},Pt=e=>Math.round(e*1e5)/1e5,Ft=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function It(e){return e==null}var Lt=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Rt=(e,t)=>n=>!!(typeof n==`string`&&Lt.test(n)&&n.startsWith(e)||t&&!It(n)&&Object.prototype.hasOwnProperty.call(n,t)),zt=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(Ft);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},Bt=e=>Ne(0,255,e),Vt={...jt,transform:e=>Math.round(Bt(e))},Ht={test:Rt(`rgb`,`red`),parse:zt(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+Vt.transform(e)+`, `+Vt.transform(t)+`, `+Vt.transform(n)+`, `+Pt(Mt.transform(r))+`)`};function Ut(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var Wt={test:Rt(`#`),parse:Ut,transform:Ht.transform},Gt=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Kt=Gt(`deg`),qt=Gt(`%`),q=Gt(`px`),Jt=Gt(`vh`),Yt=Gt(`vw`),Xt=(()=>({...qt,parse:e=>qt.parse(e)/100,transform:e=>qt.transform(e*100)}))(),Zt={test:Rt(`hsl`,`hue`),parse:zt(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+qt.transform(Pt(t))+`, `+qt.transform(Pt(n))+`, `+Pt(Mt.transform(r))+`)`},J={test:e=>Ht.test(e)||Wt.test(e)||Zt.test(e),parse:e=>Ht.test(e)?Ht.parse(e):Zt.test(e)?Zt.parse(e):Wt.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?Ht.transform(e):Zt.transform(e),getAnimatableNone:e=>{let t=J.parse(e);return t.alpha=0,J.transform(t)}},Qt=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function $t(e){return isNaN(e)&&typeof e==`string`&&(e.match(Ft)?.length||0)+(e.match(Qt)?.length||0)>0}var en=`number`,tn=`color`,nn=`var`,rn=`var(`,an="${}",on=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function sn(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(on,e=>(J.test(e)?(r.color.push(a),i.push(tn),n.push(J.parse(e))):e.startsWith(rn)?(r.var.push(a),i.push(nn),n.push(e)):(r.number.push(a),i.push(en),n.push(parseFloat(e))),++a,an)).split(an),indexes:r,types:i}}function cn(e){return sn(e).values}function ln(e){let{split:t,types:n}=sn(e),r=t.length;return e=>{let i=``;for(let a=0;atypeof e==`number`?0:J.test(e)?J.getAnimatableNone(e):e;function dn(e){let t=cn(e);return ln(e)(t.map(un))}var fn={test:$t,parse:cn,createTransformer:ln,getAnimatableNone:dn};function pn(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function mn({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=pn(s,r,e+1/3),a=pn(s,r,e),o=pn(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function hn(e,t){return n=>n>0?t:e}var Y=(e,t,n)=>e+(t-e)*n,gn=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},_n=[Wt,Ht,Zt],vn=e=>_n.find(t=>t.test(e));function yn(e){let t=vn(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===Zt&&(n=mn(n)),n}var bn=(e,t)=>{let n=yn(e),r=yn(t);if(!n||!r)return hn(e,t);let i={...n};return e=>(i.red=gn(n.red,r.red,e),i.green=gn(n.green,r.green,e),i.blue=gn(n.blue,r.blue,e),i.alpha=Y(n.alpha,r.alpha,e),Ht.transform(i))},xn=new Set([`none`,`hidden`]);function Sn(e,t){return xn.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Cn(e,t){return n=>Y(e,t,n)}function wn(e){return typeof e==`number`?Cn:typeof e==`string`?kt(e)?hn:J.test(e)?bn:On:Array.isArray(e)?Tn:typeof e==`object`?J.test(e)?bn:En:hn}function Tn(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>wn(e)(e,t[n]));return e=>{for(let t=0;t{for(let t in r)n[t]=r[t](e);return n}}function Dn(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i{let n=fn.createTransformer(t),r=sn(e),i=sn(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?xn.has(e)&&!i.values.length||xn.has(t)&&!r.values.length?Sn(e,t):Ve(Tn(Dn(r,i),i.values),n):(`${e}${t}`,hn(e,t))};function kn(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?Y(e,t,n):wn(e)(e,t)}var An=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>G.update(t,e),stop:()=>bt(t),now:()=>K.isProcessing?K.timestamp:wt.now()}},jn=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t=2e4?1/0:t}function Pn(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(Nn(r),Mn);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:Ge(i)}}var Fn=5;function In(e,t,n){let r=Math.max(t-Fn,0);return Ke(n-e(r),t-r)}var X={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Ln=.001;function Rn({duration:e=X.duration,bounce:t=X.bounce,velocity:n=X.velocity,mass:r=X.mass}){let i,a;X.maxDuration;let o=1-t;o=Ne(X.minDamping,X.maxDamping,o),e=Ne(X.minDuration,X.maxDuration,Ge(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=Vn(t,o),c=Math.exp(-i);return Ln-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=Vn(t**2,o);return(-i(t)+Ln>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-Ln+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=Bn(i,a,s);if(e=We(e),isNaN(c))return{stiffness:X.stiffness,damping:X.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var zn=12;function Bn(e,t,n){let r=n;for(let n=1;ne[t]!==void 0)}function Gn(e){let t={velocity:X.velocity,stiffness:X.stiffness,damping:X.damping,mass:X.mass,isResolvedFromDuration:!1,...e};if(!Wn(e,Un)&&Wn(e,Hn))if(e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*Ne(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:X.mass,stiffness:i,damping:a}}else{let n=Rn(e);t={...t,...n,mass:X.mass},t.isResolvedFromDuration=!0}return t}function Kn(e=X.visualDuration,t=X.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=Gn({...n,velocity:-Ge(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=Ge(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?X.restSpeed.granular:X.restSpeed.default,i||=v?X.restDelta.granular:X.restDelta.default;let y;if(h<1){let e=Vn(_,h);y=t=>o-Math.exp(-h*_*t)*((m+h*_*g)/e*Math.sin(e*t)+g*Math.cos(e*t))}else if(h===1)y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e}}let b={calculatedDuration:p&&d||null,next:e=>{let t=y(e);if(p)s.done=e>=d;else{let n=e===0?m:0;h<1&&(n=e===0?We(m):In(y,e,t));let a=Math.abs(n)<=r,c=Math.abs(o-t)<=i;s.done=a&&c}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(Nn(b),Mn),t=jn(t=>b.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return b}Kn.applyToOptions=e=>{let t=Pn(e,100,Kn);return e.ease=t.ease,e.duration=We(t.duration),e.type=`keyframes`,e};function qn({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&ec,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=Kn({keyframes:[f.value,m(f.value)],velocity:In(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function Jn(e,t,n){let r=[],i=n||Pe.mix||kn,a=e.length-1;for(let n=0;nt[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=Jn(t,r,i),c=s.length,l=n=>{if(o&&n1)for(;rl(Ne(e[0],e[a-1],t)):l}function Xn(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=He(0,t,r);e.push(Y(n,1,i))}}function Zn(e){let t=[0];return Xn(t,e.length-1),t}function Qn(e,t){return e.map(e=>e*t)}function $n(e,t){return e.map(()=>t||lt).splice(0,e.length-1)}function er({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=ut(r)?r.map(mt):mt(r),a={done:!1,value:t[0]},o=Yn(Qn(n&&n.length===t.length?n:Zn(t),e),t,{ease:Array.isArray(i)?i:$n(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var tr=e=>e!==null;function nr(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(tr),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var rr={decay:qn,inertia:qn,tween:er,keyframes:er,spring:Kn};function ir(e){typeof e.type==`string`&&(e.type=rr[e.type])}var ar=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},or=e=>e/100,sr=class extends ar{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==wt.now()&&this.tick(wt.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},Tt.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;ir(e);let{type:t=er,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||er;s!==er&&typeof o[0]!=`number`&&(this.mixKeyframes=Ve(or,kn(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=Nn(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=Ne(0,1,n)*o}let b=_?{done:!1,value:l[0]}:y.next(v);i&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==qn&&(b.value=nr(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return Ge(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Ge(e)}get time(){return Ge(this.currentTime)}set time(e){e=We(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(wt.now());let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=Ge(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=An,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(wt.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null,Tt.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function cr(e){for(let t=1;te*180/Math.PI,ur=e=>fr(lr(Math.atan2(e[1],e[0]))),dr={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:ur,rotateZ:ur,skewX:e=>lr(Math.atan(e[1])),skewY:e=>lr(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},fr=e=>(e%=360,e<0&&(e+=360),e),pr=ur,mr=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),hr=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),gr={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:mr,scaleY:hr,scale:e=>(mr(e)+hr(e))/2,rotateX:e=>fr(lr(Math.atan2(e[6],e[5]))),rotateY:e=>fr(lr(Math.atan2(-e[2],e[0]))),rotateZ:pr,rotate:pr,skewX:e=>lr(Math.atan(e[4])),skewY:e=>lr(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function _r(e){return e.includes(`scale`)?1:0}function vr(e,t){if(!e||e===`none`)return _r(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=gr,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=dr,i=t}if(!i)return _r(t);let a=r[t],o=i[1].split(`,`).map(br);return typeof a==`function`?a(o):o[a]}var yr=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return vr(n,t)};function br(e){return parseFloat(e.trim())}var xr=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],Sr=(()=>new Set(xr))(),Cr=e=>e===jt||e===q,wr=new Set([`x`,`y`,`z`]),Tr=xr.filter(e=>!wr.has(e));function Er(e){let t=[];return Tr.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith(`scale`)?1:0))}),t}var Dr={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>vr(t,`x`),y:(e,{transform:t})=>vr(t,`y`)};Dr.translateX=Dr.x,Dr.translateY=Dr.y;var Or=new Set,kr=!1,Ar=!1,jr=!1;function Mr(){if(Ar){let e=Array.from(Or).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=Er(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}Ar=!1,kr=!1,Or.forEach(e=>e.complete(jr)),Or.clear()}function Nr(){Or.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Ar=!0)})}function Pr(){jr=!0,Nr(),Mr(),jr=!1}var Fr=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(Or.add(this),kr||(kr=!0,G.read(Nr),G.resolveKeyframes(Mr))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}cr(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Or.delete(this)}cancel(){this.state===`scheduled`&&(Or.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},Ir=e=>e.startsWith(`--`);function Lr(e,t,n){Ir(t)?e.style.setProperty(t,n):e.style[t]=n}var Rr=Re(()=>window.ScrollTimeline!==void 0),zr={};function Br(e,t){let n=Re(e);return()=>zr[t]??n()}var Vr=Br(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),Hr=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Ur={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:Hr([0,.65,.55,1]),circOut:Hr([.55,0,1,.45]),backIn:Hr([.31,.01,.66,-.59]),backOut:Hr([.33,1.53,.69,.99])};function Wr(e,t){if(e)return typeof e==`function`?Vr()?jn(e,t):`ease-out`:dt(e)?Hr(e):Array.isArray(e)?e.map(e=>Wr(e,t)||Ur.easeOut):Ur[e]}function Gr(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=Wr(s,i);Array.isArray(d)&&(u.easing=d),gt.value&&Tt.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return gt.value&&p.finished.finally(()=>{Tt.waapi--}),p}function Kr(e){return typeof e==`function`&&`applyToOptions`in e}function qr({type:e,...t}){return Kr(e)&&Vr()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var Jr=class extends ar{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=qr(e);this.animation=Gr(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=nr(r,this.options,o,this.speed);this.updateMotionValue?this.updateMotionValue(e):Lr(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return Ge(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Ge(e)}get time(){return Ge(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=We(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&Rr()?(this.animation.timeline=e,ze):t(this)}},Yr={anticipate:rt,backInOut:nt,circInOut:ot};function Xr(e){return e in Yr}function Zr(e){typeof e.ease==`string`&&Xr(e.ease)&&(e.ease=Yr[e.ease])}var Qr=10,$r=class extends Jr{constructor(e){Zr(e),ir(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new sr({...a,autoplay:!1}),s=We(this.finishedTime??this.time);t.setWithVelocity(o.sample(s-Qr).value,o.sample(s).value,Qr),o.stop()}},ei=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(fn.test(e)||e===`0`)&&!e.startsWith(`url(`));function ti(e){let t=e[0];if(e.length===1)return!0;for(let n=0;nObject.hasOwnProperty.call(Element.prototype,`animate`));function oi(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:s,transformTemplate:c}=t.owner.getProps();return ai()&&n&&ii.has(n)&&(n!==`transform`||!c)&&!s&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var si=40,ci=class extends ar{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=wt.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u};this.keyframeResolver=new(l?.KeyframeResolver||Fr)(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=wt.now(),ni(e,i,a,o)||((Pe.instantAnimations||!s)&&l?.(nr(e,n,t)),e[0]=e[e.length-1],ri(n),n.repeat=0);let u={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>si?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},d=!c&&oi(u)?new $r({...u,element:u.motionValue.owner.current}):new sr(u);d.finished.then(()=>this.notifyFinished()).catch(ze),this.pendingTimeline&&=(this.stopTimeline=d.attachTimeline(this.pendingTimeline),void 0),this._animation=d}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Pr()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}},li=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function ui(e){let t=li.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function di(e,t,n=1){`${e}`;let[r,i]=ui(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return Fe(e)?parseFloat(e):e}return kt(i)?di(i,t,n+1):i}function fi(e,t){return e?.[t]??e?.default??e}var pi=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...xr]),mi={test:e=>e===`auto`,parse:e=>e},hi=e=>t=>t.test(e),gi=[jt,q,qt,Kt,Yt,Jt,mi],_i=e=>gi.find(hi(e));function vi(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||Le(e)}var yi=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function bi(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(Ft)||[];if(!r)return e;let i=n.replace(r,``),a=yi.has(t)?1:0;return r!==n&&(a*=100),t+`(`+a+i+`)`}var xi=/\b([a-z-]*)\(.*?\)/gu,Si={...fn,getAnimatableNone:e=>{let t=e.match(xi);return t?t.map(bi).join(` `):e}},Ci={...jt,transform:Math.round},wi={borderWidth:q,borderTopWidth:q,borderRightWidth:q,borderBottomWidth:q,borderLeftWidth:q,borderRadius:q,radius:q,borderTopLeftRadius:q,borderTopRightRadius:q,borderBottomRightRadius:q,borderBottomLeftRadius:q,width:q,maxWidth:q,height:q,maxHeight:q,top:q,right:q,bottom:q,left:q,padding:q,paddingTop:q,paddingRight:q,paddingBottom:q,paddingLeft:q,margin:q,marginTop:q,marginRight:q,marginBottom:q,marginLeft:q,backgroundPositionX:q,backgroundPositionY:q,rotate:Kt,rotateX:Kt,rotateY:Kt,rotateZ:Kt,scale:Nt,scaleX:Nt,scaleY:Nt,scaleZ:Nt,skew:Kt,skewX:Kt,skewY:Kt,distance:q,translateX:q,translateY:q,translateZ:q,x:q,y:q,z:q,perspective:q,transformPerspective:q,opacity:Mt,originX:Xt,originY:Xt,originZ:q,zIndex:Ci,fillOpacity:Mt,strokeOpacity:Mt,numOctaves:Ci},Ti={...wi,color:J,backgroundColor:J,outlineColor:J,fill:J,stroke:J,borderColor:J,borderTopColor:J,borderRightColor:J,borderBottomColor:J,borderLeftColor:J,filter:Si,WebkitFilter:Si},Ei=e=>Ti[e];function Di(e,t){let n=Ei(e);return n!==Si&&(n=fn),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var Oi=new Set([`auto`,`none`,`0`]);function ki(e,t,n){let r=0,i;for(;r{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}};function ji(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}var Mi=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function Ni(e){return Ie(e)&&`offsetHeight`in e}var Pi=30,Fi=e=>!isNaN(parseFloat(e)),Ii={current:void 0},Li=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=wt.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=wt.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Fi(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new Ue);let n=this.events[e].add(t);return e===`change`?()=>{n(),G.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return Ii.current&&Ii.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=wt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Pi)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,Pi);return Ke(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Ri(e,t){return new Li(e,t)}var{schedule:zi,cancel:Bi}=yt(queueMicrotask,!1),Vi={x:!1,y:!1};function Hi(){return Vi.x||Vi.y}function Ui(e){return e===`x`||e===`y`?Vi[e]?null:(Vi[e]=!0,()=>{Vi[e]=!1}):Vi.x||Vi.y?null:(Vi.x=Vi.y=!0,()=>{Vi.x=Vi.y=!1})}function Wi(e,t){let n=ji(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function Gi(e){return!(e.pointerType===`touch`||Hi())}function Ki(e,t,n={}){let[r,i,a]=Wi(e,n),o=e=>{if(!Gi(e))return;let{target:n}=e,r=t(n,e);if(typeof r!=`function`||!n)return;let a=e=>{Gi(e)&&(r(e),n.removeEventListener(`pointerleave`,a))};n.addEventListener(`pointerleave`,a,i)};return r.forEach(e=>{e.addEventListener(`pointerenter`,o,i)}),a}var qi=(e,t)=>t?e===t?!0:qi(e,t.parentElement):!1,Ji=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,Yi=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function Xi(e){return Yi.has(e.tagName)||e.tabIndex!==-1}var Zi=new WeakSet;function Qi(e){return t=>{t.key===`Enter`&&e(t)}}function $i(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var ea=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=Qi(()=>{if(Zi.has(n))return;$i(n,`down`);let e=Qi(()=>{$i(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>$i(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function ta(e){return Ji(e)&&!Hi()}function na(e,t,n={}){let[r,i,a]=Wi(e,n),o=e=>{let r=e.currentTarget;if(!ta(e))return;Zi.add(r);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),Zi.has(r)&&Zi.delete(r),ta(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||qi(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),Ni(e)&&(e.addEventListener(`focus`,e=>ea(e,i)),!Xi(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function ra(e){return Ie(e)&&`ownerSVGElement`in e}function ia(e){return ra(e)&&e.tagName===`svg`}var aa=e=>!!(e&&e.getVelocity),oa=[...gi,J,fn],sa=e=>oa.find(hi(e)),ca=(0,M.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function la(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function ua(...e){return t=>{let n=!1,r=e.map(e=>{let r=la(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t{let{width:e,height:c,top:l,left:u,right:d}=o.current;if(t||!a.current||!e||!c)return;let f=n===`left`?`left: ${u}`:`right: ${d}`;a.current.dataset.motionPopId=i;let p=document.createElement(`style`);s&&(p.nonce=s);let m=r??document.head;return m.appendChild(p),p.sheet&&p.sheet.insertRule(` [data-motion-pop-id="${i}"] { position: absolute !important; width: ${e}px !important; diff --git a/dist/assets/EternalKlock-C_k79TSi.js b/dist/assets/EternalKlock-C_k79TSi.js new file mode 100644 index 00000000..754415a7 --- /dev/null +++ b/dist/assets/EternalKlock-C_k79TSi.js @@ -0,0 +1 @@ +import"./html2canvas-DXJRNlB-.js";import{n as e,t}from"./EternalKlock-CQhocjA8.js";import"./SigilModal-B_GantjI.js";import"./SealMomentModal-QiuZkGMx.js";export{t as EternalKlock,e as default}; \ No newline at end of file diff --git a/dist/assets/EternalKlock-D-hEMVRl.js b/dist/assets/EternalKlock-D-hEMVRl.js deleted file mode 100644 index 4fe9e917..00000000 --- a/dist/assets/EternalKlock-D-hEMVRl.js +++ /dev/null @@ -1 +0,0 @@ -import"./html2canvas-CgVfYVZf.js";import{n as e,t}from"./EternalKlock-DTPPu1Hz.js";import"./SigilModal-B4XBfcke.js";import"./SealMomentModal-BotOOPRg.js";export{t as EternalKlock,e as default}; \ No newline at end of file diff --git a/dist/assets/HomePriceChartCard-CG0g_aGu.js b/dist/assets/HomePriceChartCard-ByTYxBSg.js similarity index 99% rename from dist/assets/HomePriceChartCard-CG0g_aGu.js rename to dist/assets/HomePriceChartCard-ByTYxBSg.js index 7edda898..77dd59a2 100644 --- a/dist/assets/HomePriceChartCard-CG0g_aGu.js +++ b/dist/assets/HomePriceChartCard-ByTYxBSg.js @@ -1,4 +1,4 @@ -import{Tn as e,an as t,bt as n,jn as r,ln as i,tn as a,yt as o}from"./index-CcPm2yTY.js";import{t as s}from"./prop-types-CQ3MXKCa.js";var c=r(e(),1),l=`clover`,u=function(e){return e===3?`v3`:e},d=`https://js.stripe.com`,f=`${d}/${l}/stripe.js`,p=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,ee=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/,m=`loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used`,h=function(e){return p.test(e)||ee.test(e)},g=function(){for(var e=document.querySelectorAll(`script[src^="${d}"]`),t=0;t element.`);return r.appendChild(n),n},te=function(e,t){!e||!e._registerWrapper||e._registerWrapper({name:`stripe-js`,version:`8.6.0`,startTime:t})},v=null,y=null,b=null,x=function(e){return function(t){e(Error(`Failed to load Stripe.js`,{cause:t}))}},S=function(e,t){return function(){window.Stripe?e(window.Stripe):t(Error(`Stripe.js not available`))}},C=function(e){return v===null?(v=new Promise(function(t,n){if(typeof window>`u`||typeof document>`u`){t(null);return}if(window.Stripe&&e&&console.warn(m),window.Stripe){t(window.Stripe);return}try{var r=g();if(r&&e)console.warn(m);else if(!r)r=_(e);else if(r&&b!==null&&y!==null){var i;r.removeEventListener(`load`,b),r.removeEventListener(`error`,y),(i=r.parentNode)==null||i.removeChild(r),r=_(e)}b=S(t,n),y=x(n),r.addEventListener(`load`,b),r.addEventListener(`error`,y)}catch(e){n(e);return}}),v.catch(function(e){return v=null,Promise.reject(e)})):v},w=function(e,t,n){if(e===null)return null;var r=t[0].match(/^pk_test/),i=u(e.version),a=l;r&&i!==a&&console.warn(`Stripe.js@${i} was loaded on the page, but @stripe/stripe-js@8.6.0 expected Stripe.js@${a}. This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning`);var o=e.apply(void 0,t);return te(o,n),o},T,E=!1,D=function(){return T||(T=C(null).catch(function(e){return T=null,Promise.reject(e)}),T)};Promise.resolve().then(function(){return D()}).catch(function(e){E||console.warn(e)});var O=function(){var e=[...arguments];E=!0;var t=Date.now();return D().then(function(n){return w(n,e,t)})},k=r(s(),1);function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function j(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function re(e,t){if(e==null)return{};var n=ne(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ie(e,t){return P(e)||ae(e,t)||F(e,t)||oe()}function P(e){if(Array.isArray(e))return e}function ae(e,t){var n=e&&(typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`]);if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function F(e,t){if(e){if(typeof e==`string`)return I(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return I(e,t)}}function I(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n element.`);return r.appendChild(n),n},te=function(e,t){!e||!e._registerWrapper||e._registerWrapper({name:`stripe-js`,version:`8.6.0`,startTime:t})},v=null,y=null,b=null,x=function(e){return function(t){e(Error(`Failed to load Stripe.js`,{cause:t}))}},S=function(e,t){return function(){window.Stripe?e(window.Stripe):t(Error(`Stripe.js not available`))}},C=function(e){return v===null?(v=new Promise(function(t,n){if(typeof window>`u`||typeof document>`u`){t(null);return}if(window.Stripe&&e&&console.warn(m),window.Stripe){t(window.Stripe);return}try{var r=g();if(r&&e)console.warn(m);else if(!r)r=_(e);else if(r&&b!==null&&y!==null){var i;r.removeEventListener(`load`,b),r.removeEventListener(`error`,y),(i=r.parentNode)==null||i.removeChild(r),r=_(e)}b=S(t,n),y=x(n),r.addEventListener(`load`,b),r.addEventListener(`error`,y)}catch(e){n(e);return}}),v.catch(function(e){return v=null,Promise.reject(e)})):v},w=function(e,t,n){if(e===null)return null;var r=t[0].match(/^pk_test/),i=u(e.version),a=l;r&&i!==a&&console.warn(`Stripe.js@${i} was loaded on the page, but @stripe/stripe-js@8.6.0 expected Stripe.js@${a}. This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning`);var o=e.apply(void 0,t);return te(o,n),o},T,E=!1,D=function(){return T||(T=C(null).catch(function(e){return T=null,Promise.reject(e)}),T)};Promise.resolve().then(function(){return D()}).catch(function(e){E||console.warn(e)});var O=function(){var e=[...arguments];E=!0;var t=Date.now();return D().then(function(n){return w(n,e,t)})},k=r(s(),1);function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function j(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function re(e,t){if(e==null)return{};var n=ne(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ie(e,t){return P(e)||ae(e,t)||F(e,t)||oe()}function P(e){if(Array.isArray(e))return e}function ae(e,t){var n=e&&(typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`]);if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function F(e,t){if(e){if(typeof e==`string`)return I(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return I(e,t)}}function I(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n1&&arguments[1]!==void 0?arguments[1]:ue;if(e===null||V(e))return e;throw Error(t)},U=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ue;if(B(e))return{tag:`async`,stripePromise:Promise.resolve(e).then(function(e){return H(e,t)})};var n=H(e,t);return n===null?{tag:`empty`}:{tag:`sync`,stripe:n}},W=function(e){!e||!e._registerWrapper||!e.registerAppInfo||(e._registerWrapper({name:`react-stripe-js`,version:`5.4.1`}),e.registerAppInfo({name:`react-stripe-js`,version:`5.4.1`,url:`https://stripe.com/docs/stripe-js/react`}))},G=c.createContext(null);G.displayName=`ElementsContext`;var de=function(e,t){if(!e)throw Error(`Could not find Elements context; You need to wrap the part of your app that ${t} in an provider.`);return e},K=function(e){var t=e.stripe,n=e.options,r=e.children,i=c.useMemo(function(){return U(t)},[t]),a=ie(c.useState(function(){return{stripe:i.tag===`sync`?i.stripe:null,elements:i.tag===`sync`?i.stripe.elements(n):null}}),2),o=a[0],s=a[1];c.useEffect(function(){var e=!0,t=function(e){s(function(t){return t.stripe?t:{stripe:e,elements:e.elements(n)}})};return i.tag===`async`&&!o.stripe?i.stripePromise.then(function(n){n&&e&&t(n)}):i.tag===`sync`&&!o.stripe&&t(i.stripe),function(){e=!1}},[i,o,n]);var l=R(t);c.useEffect(function(){l!==null&&l!==t&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")},[l,t]);var u=R(n);return c.useEffect(function(){if(o.elements){var e=le(n,u,[`clientSecret`,`fonts`]);e&&o.elements.update(e)}},[n,u,o.elements]),c.useEffect(function(){W(o.stripe)},[o.stripe]),c.createElement(G.Provider,{value:o},r)};K.propTypes={stripe:k.default.any,options:k.default.object};var fe=function(e){return de(c.useContext(G),e)},pe=function(){return fe(`calls useElements()`).elements},me=function(e){var t=e.children;return t(fe(`mounts `))};me.propTypes={children:k.default.func.isRequired};var q=c.createContext(null);q.displayName=`CheckoutContext`,k.default.any,k.default.shape({clientSecret:k.default.oneOfType([k.default.string,k.default.instanceOf(Promise)]).isRequired,elementsOptions:k.default.object}).isRequired;var J=function(e){var t=c.useContext(q),n=c.useContext(G);if(t){if(n)throw Error(`You cannot wrap the part of your app that ${e} in both and providers.`);return t}else return de(n,e)},Y=[`mode`],he=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},X=function(e,t){var n=`${he(e)}Element`,r=t?function(e){J(`mounts <${n}>`);var t=e.id,r=e.className;return c.createElement(`div`,{id:t,className:r})}:function(t){var r=t.id,i=t.className,a=t.options,o=a===void 0?{}:a,s=t.onBlur,l=t.onFocus,u=t.onReady,d=t.onChange,f=t.onEscape,p=t.onClick,ee=t.onLoadError,m=t.onLoaderStart,h=t.onNetworksChange,g=t.onConfirm,_=t.onCancel,te=t.onShippingAddressChange,v=t.onShippingRateChange,y=t.onSavedPaymentMethodRemove,b=t.onSavedPaymentMethodUpdate,x=J(`mounts <${n}>`),S=`elements`in x?x.elements:null,C=`checkoutState`in x?x.checkoutState:null,w=C?.type===`success`||C?.type===`loading`?C.sdk:null,T=ie(c.useState(null),2),E=T[0],D=T[1],O=c.useRef(null),k=c.useRef(null);L(E,`blur`,s),L(E,`focus`,l),L(E,`escape`,f),L(E,`click`,p),L(E,`loaderror`,ee),L(E,`loaderstart`,m),L(E,`networkschange`,h),L(E,`confirm`,g),L(E,`cancel`,_),L(E,`shippingaddresschange`,te),L(E,`shippingratechange`,v),L(E,`savedpaymentmethodremove`,y),L(E,`savedpaymentmethodupdate`,b),L(E,`change`,d);var A;u&&(A=e===`expressCheckout`?u:function(){u(E)}),L(E,`ready`,A),c.useLayoutEffect(function(){if(O.current===null&&k.current!==null&&(S||w)){var t=null;if(w)switch(e){case`paymentForm`:t=w.createPaymentFormElement();break;case`payment`:t=w.createPaymentElement(o);break;case`address`:if(`mode`in o){var r=o.mode,i=re(o,Y);if(r===`shipping`)t=w.createShippingAddressElement(i);else if(r===`billing`)t=w.createBillingAddressElement(i);else throw Error(`Invalid options.mode. mode must be 'billing' or 'shipping'.`)}else throw Error(`You must supply options.mode. mode must be 'billing' or 'shipping'.`);break;case`expressCheckout`:t=w.createExpressCheckoutElement(o);break;case`currencySelector`:t=w.createCurrencySelectorElement();break;case`taxId`:t=w.createTaxIdElement(o);break;default:throw Error(`Invalid Element type ${n}. You must use either the , , , or .`)}else S&&(t=S.create(e,o));O.current=t,D(t),t&&t.mount(k.current)}},[S,w,o]);var j=R(o);return c.useEffect(function(){if(O.current){var e=le(o,j,[`paymentRequest`]);e&&`update`in O.current&&O.current.update(e)}},[o,j]),c.useLayoutEffect(function(){return function(){if(O.current&&typeof O.current.destroy==`function`)try{O.current.destroy(),O.current=null}catch{}}},[]),c.createElement(`div`,{id:r,className:i,ref:k})};return r.propTypes={id:k.default.string,className:k.default.string,onChange:k.default.func,onBlur:k.default.func,onFocus:k.default.func,onReady:k.default.func,onEscape:k.default.func,onClick:k.default.func,onLoadError:k.default.func,onLoaderStart:k.default.func,onNetworksChange:k.default.func,onConfirm:k.default.func,onCancel:k.default.func,onShippingAddressChange:k.default.func,onShippingRateChange:k.default.func,onSavedPaymentMethodRemove:k.default.func,onSavedPaymentMethodUpdate:k.default.func,options:k.default.object},r.displayName=n,r.__elementType=e,r},Z=typeof window>`u`,ge=c.createContext(null);ge.displayName=`EmbeddedCheckoutProviderContext`;var _e=function(){return J(`calls useStripe()`).stripe};X(`auBankAccount`,Z),X(`card`,Z),X(`cardNumber`,Z),X(`cardExpiry`,Z),X(`cardCvc`,Z),X(`iban`,Z);var ve=X(`payment`,Z);X(`expressCheckout`,Z),X(`paymentRequestButton`,Z),X(`linkAuthentication`,Z),X(`address`,Z),X(`shippingAddress`,Z),X(`paymentMethodMessaging`,Z),X(`taxId`,Z);var Q=r(a(),1),ye=i,$=e=>globalThis[e],be=()=>{let e=$(`kaiPulseNowBridge`)??$(`kaiPulseNow`);return typeof e==`function`?e():(performance.timeOrigin+performance.now()-t)/i},xe=(e,t,n)=>Math.max(t,Math.min(n,e)),Se=e=>Math.round(e*100)/100,Ce=e=>e.toLocaleString(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2}),we=(e,t)=>{let n=(1+Math.sqrt(5))/2,r=Math.sin(2*Math.PI*e/44)*.85,i=Math.sin(2*Math.PI*n*e)*.42,a=Math.sin(2*Math.PI*(n-1)*e)*.28,o=Math.sin(e*.1618)*.35;return Se(t+r+i+a+o)},Te=e=>xe(.35+.65*Math.abs(Math.sin(2*Math.PI*e/11)),0,1),Ee=Object.freeze([]),De=Object.freeze([]),Oe=` .kai-price-wrap { font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Apple Color Emoji","Segoe UI Emoji"; color: #e7fbf7; } .kai-price-chart { display:block; width:100%; height:auto; } diff --git a/dist/assets/KaiRealms-CxldGmng.js b/dist/assets/KaiRealms-B1Voo2dF.js similarity index 99% rename from dist/assets/KaiRealms-CxldGmng.js rename to dist/assets/KaiRealms-B1Voo2dF.js index 6909593b..11ceeb89 100644 --- a/dist/assets/KaiRealms-CxldGmng.js +++ b/dist/assets/KaiRealms-B1Voo2dF.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/bundler-H_464dRi.js","assets/index-CcPm2yTY.js","assets/index-BmaJNTKf.css"])))=>i.map(i=>d[i]); -import{t as e}from"./x-B0A9hqeh.js";import{Bt as t,Ht as n,Sn as r,Tn as i,an as a,jn as o,ln as s,mn as c,t as l,tn as u}from"./index-CcPm2yTY.js";var d=o(i(),1);function f(e){return typeof e==`string`?e.toLowerCase():``}function p(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function m(e){return typeof e==`string`&&e.length>0}function h(e){return typeof e==`number`&&Number.isFinite(e)}function g(e){if(typeof e!=`object`||!e)throw Error(`Malformed sigil metadata.`);let t=e;for(let e of[`pulse`,`beat`,`stepIndex`,`chakraDay`])if(!p(t,e))throw Error(`Missing Kai field: ${e}`);if(!p(t,`kaiSignature`))throw Error(`Invalid Kai Signature — tampered or unsigned sigil.`);if(!h(t.pulse))throw Error(`Invalid field: pulse`);if(!h(t.beat))throw Error(`Invalid field: beat`);if(!h(t.stepIndex))throw Error(`Invalid field: stepIndex`);if(!m(t.chakraDay))throw Error(`Invalid field: chakraDay`);if(!m(t.kaiSignature))throw Error(`Invalid field: kaiSignature`)}function _(e){try{let t=new DOMParser().parseFromString(e,`image/svg+xml`),n=Array.from(t.getElementsByTagName(`metadata`)),r=[`valuation`,`ledger`,`dht`,`source`];for(let e of n){let t=e.getAttribute(`id`)??``;if(r.some(e=>t.includes(e)))continue;let n=(e.textContent??``).trim();if(!n)continue;let i=n.replace(/^$/,``);try{let e=JSON.parse(i);if(typeof e==`object`&&e&&p(e,`pulse`)&&p(e,`beat`)&&p(e,`stepIndex`)&&p(e,`chakraDay`)&&p(e,`kaiSignature`))return e}catch{}}return null}catch{return null}}async function v(e){let r=await e.text(),{meta:i,contextOk:a,typeOk:o}=await l(e),s=i&&p(i,`kaiSignature`)&&p(i,`pulse`)?i:_(r);if(!s||!a||!o)throw Error(`Invalid glyph or missing metadata.`);g(s);let c=s,u=await t(c);if(!u||f(u)!==f(c.kaiSignature))throw Error(`Invalid Kai Signature — tampered or unsigned sigil.`);let d=await n(c.kaiSignature);if(typeof c.userPhiKey==`string`){if(f(c.userPhiKey)!==f(d))throw Error(`Φ-Key mismatch — identity invalid.`)}else c.userPhiKey=d;return{svgText:r,meta:c,phiKey:d}}var y=o(u(),1),b=`.svg,image/svg+xml`,x=({onEnter:e})=>{let t=(0,d.useRef)(null),[n,r]=(0,d.useState)(!1),[i,a]=(0,d.useState)(!1),[o,s]=(0,d.useState)(``),[c,l]=(0,d.useState)(null),u=(0,d.useId)(),f=(0,d.useId)(),p=(0,d.useId)(),m=()=>{t.current&&(t.current.value=``)},h=(0,d.useCallback)(async t=>{l(null),s(t.name),a(!0);try{if(!(t.type===`image/svg+xml`||t.name.toLowerCase().endsWith(`.svg`)))throw Error(`Please upload a valid Kai Sigil (.svg).`);e(await v(t))}catch(e){l(e instanceof Error?e.message:`Invalid glyph or missing metadata.`)}finally{a(!1),m()}},[e]),g=(0,d.useCallback)(async e=>{let t=e.target.files?.[0];t&&await h(t)},[h]),_=(0,d.useCallback)(async e=>{e.preventDefault(),e.stopPropagation(),r(!1);let t=e.dataTransfer.files?.[0];t&&await h(t)},[h]),x=e=>{e.preventDefault(),e.dataTransfer.dropEffect=`copy`,n||r(!0)},S=e=>{e.currentTarget.contains(e.relatedTarget)||r(!1)},C=()=>t.current?.click(),w=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),C())};return(0,y.jsxs)(`section`,{className:`portal-card glass-omni`,"aria-labelledby":u,"aria-describedby":f,children:[(0,y.jsx)(`div`,{className:`breath-ring breath-ring--outer`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`breath-ring breath-ring--inner`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`phi-grid`,"aria-hidden":!0}),(0,y.jsx)(`h1`,{id:u,className:`sr-only`,children:`Drop your Kai Sigil`}),(0,y.jsxs)(`div`,{className:`portal-body`,children:[(0,y.jsxs)(`div`,{className:`dropzone ${n?`dropzone--active`:``} ${i?`dropzone--busy`:``}`,role:`button`,tabIndex:0,onKeyDown:w,onClick:C,onDrop:_,onDragOver:x,onDragLeave:S,"aria-busy":i,"aria-describedby":`${f}${c?` ${p}`:``}`,children:[(0,y.jsxs)(`div`,{className:`dropzone-ornament`,"aria-hidden":!0,children:[(0,y.jsx)(`div`,{className:`ornament-ring ornament-ring--outer`}),(0,y.jsx)(`div`,{className:`ornament-ring ornament-ring--inner`}),(0,y.jsx)(`div`,{className:`ornament-core`})]}),(0,y.jsx)(`div`,{className:`dropzone-icon`,"aria-hidden":!0,children:(0,y.jsxs)(`svg`,{width:`44`,height:`44`,viewBox:`0 0 44 44`,children:[(0,y.jsx)(`defs`,{children:(0,y.jsxs)(`linearGradient`,{id:`dzG`,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,y.jsx)(`stop`,{offset:`0%`,stopColor:`#00ffd0`}),(0,y.jsx)(`stop`,{offset:`100%`,stopColor:`#8a2be2`})]})}),(0,y.jsx)(`circle`,{cx:`22`,cy:`22`,r:`20`,fill:`none`,stroke:`url(#dzG)`,strokeWidth:`1.5`}),(0,y.jsx)(`path`,{d:`M22 12 L22 30 M14 20 L22 12 L30 20`,stroke:`url(#dzG)`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`})]})}),(0,y.jsxs)(`div`,{className:`dropzone-text`,children:[(0,y.jsx)(`div`,{className:`dz-title`,children:`Inhale your Kai Sigil`}),(0,y.jsxs)(`div`,{id:f,className:`dz-hint`,children:[`Breath-minted `,(0,y.jsx)(`strong`,{children:`Φkey`}),` only. Drag & drop.`]}),o&&!i&&!c?(0,y.jsxs)(`div`,{className:`dz-file`,children:[`Selected: `,o]}):null,i?(0,y.jsxs)(`div`,{className:`dz-progress`,children:[(0,y.jsx)(`div`,{className:`dz-spinner`}),(0,y.jsx)(`span`,{children:`Verifying…`})]}):null]}),(0,y.jsx)(`input`,{ref:t,type:`file`,accept:b,onChange:g,tabIndex:-1,"aria-hidden":!0,className:`dz-input`})]}),c?(0,y.jsx)(`div`,{id:p,className:`portal-error`,role:`alert`,"aria-live":`polite`,children:c}):null,(0,y.jsx)(`p`,{className:`portal-note`,children:`Your sigil is verified by breath. No drift. Only truth.`})]}),(0,y.jsx)(`span`,{className:`sr-only`,children:`Kai Realms sigil gate ready.`})]})},S=typeof window<`u`,C=11n,w=44n,T=36n;function E(e){let t=BigInt(a),n=BigInt(s),r=(e>t?e-t:0n)/n,i=r/C%w,o=r/(C*w)%T;return{pulseIndex:Number(r),stepIndex:Number(i),beatIndex:Number(o)}}function D(e){let t=BigInt(a),n=BigInt(s);return t+((e>t?e-t:0n)/n+1n)*n}function ee(e){let t=(0,d.useRef)(null),n=(0,d.useRef)(e);n.current=e,(0,d.useEffect)(()=>{if(!S)return;let e=null,r=!1,i=()=>{if(r)return;let a=c(),{pulseIndex:o,stepIndex:s,beatIndex:l}=E(a);o!==t.current&&(n.current.onPulse?.(o),o%Number(C)===0&&n.current.onStep?.(s),o%Number(C*w)===0&&n.current.onBeat?.(l),t.current=o);let u=D(a),d=u>a?u-a:0n,f=Number(d);e=window.setTimeout(i,f)};return i(),()=>{r=!0,e!==null&&window.clearTimeout(e)}},[])}var O={Root:`#FF0033`,Sacral:`#FF8000`,Solar:`#FFD700`,Heart:`#00FF99`,Throat:`#33CCFF`,ThirdEye:`#9933FF`,Crown:`#AA00FF`};function k(e,t,n,r,i){e.save(),e.translate(n,r);let{chakraDay:a,pulse:o}=t.meta,s=O[a]??`#00FFFF`;e.beginPath(),e.arc(0,0,i+4,0,Math.PI*2),e.fillStyle=s,e.shadowColor=s,e.shadowBlur=15,e.fill(),e.beginPath(),e.arc(0,0,i,0,Math.PI*2),e.fillStyle=`#000012`,e.fill();let c=i+o%11*1.5;e.beginPath(),e.arc(0,0,c,0,Math.PI*2),e.strokeStyle=`${s}AA`,e.lineWidth=1.5,e.stroke(),e.restore()}function A(e){return typeof e==`object`&&!!e}function j(e){if(typeof e==`bigint`)return e;if(typeof e==`number`&&Number.isFinite(e)&&Number.isSafeInteger(e))return BigInt(e);if(typeof e==`string`)try{return BigInt(e)}catch{return null}return null}var M=`kai:game:focus`,N=typeof window<`u`;function P(){if(!N||typeof BroadcastChannel>`u`)return null;try{return new BroadcastChannel(`kai-realms-game-focus`)}catch{return null}}function te(e){let t={id:e,ts:c()};if(N)try{window.dispatchEvent(new CustomEvent(M,{detail:t}))}catch{}let n=P();if(n)try{n.postMessage({type:M,detail:{id:t.id,ts:t.ts.toString()}})}catch{}finally{try{n.close()}catch{}}}function F(e){if(!A(e))return null;let t=e.id,n=j(e.ts);return typeof t!=`string`||n===null?null:{id:t,ts:n}}function ne(e){let t=t=>{let n=F(t?.detail);n&&e(n)};N&&window.addEventListener(M,t);let n=P(),r=t=>{let n=t?.data;if(!A(n)||n.type!==M)return;let r=F(n.detail);r&&e(r)};if(n)try{n.addEventListener(`message`,r)}catch{}return()=>{if(N&&window.removeEventListener(M,t),n)try{n.removeEventListener(`message`,r)}catch{}finally{try{n.close()}catch{}}}}function re(e){let[t,n]=(0,d.useState)(!1),r=(0,d.useRef)(0n);return(0,d.useEffect)(()=>ne(t=>{n(t.id!==e),r.current=t.ts}),[e]),{paused:t,takeFocus:(0,d.useCallback)(()=>{te(e),n(!1)},[e])}}var I=5236,L=.085,R=1,ie=60,ae=6.1,oe=5.6,se=.1,ce=1.6,le=10,ue=50,de=150,fe=10,pe=Math.floor(I*1.25),me=.145,he=2.618,ge=I,z=I,_e=1e3,ve=.12,B=44,ye=.618,be=.35,xe=3,Se=`600 12px ui-sans-serif,system-ui,-apple-system`,V={up:{x:0,y:-1},down:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0},none:{x:0,y:0}},H={up:`down`,down:`up`,left:`right`,right:`left`,none:`none`};function Ce(e,t,n){return e+(t-e)*n}function U(e,t){return(e-t+I)%I/I}function we(e){let t=Math.sin(Math.PI*e);return .78+.44*(t*t)}function Te(e){let t=e.toLowerCase();return t===`arrowup`||t===`w`?`up`:t===`arrowdown`||t===`s`?`down`:t===`arrowleft`||t===`a`?`left`:t===`arrowright`||t===`d`?`right`:`none`}function W(e,t,n){let r=Math.round(n),i=Math.round(t);return r<0||r>=e.length||i<0||i>=e[0].length?!1:e[r][i]!==1}function G(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function K(e,t){let n=e.x-t.x,r=e.y-t.y;return n*n+r*r}function Ee(){let e=Array.from({length:23},()=>Array(27).fill(1));((t,n,r,i)=>{for(let a=n;a0&&a<22&&n>0&&n<26&&(e[a][n]=0)})(1,1,25,21);for(let t=2;t<25;t++)e[5][t]=1,e[17][t]=1;for(let t=2;t<21;t++)e[t][4]=1,e[t][22]=1;for(let t=6;t<21;t++)e[11][t]=0;for(let t=4;t<19;t++)e[t][13]=0;for(let t=1;t<22;t++)for(let n=1;n<26;n++)e[t][n]===0&&(e[t][n]=2);for(let t of[{x:6,y:6},{x:20,y:6},{x:6,y:16},{x:20,y:16}])e[t.y][t.x]=3;for(let t of[{x:2,y:2},{x:24,y:2},{x:2,y:20},{x:24,y:20}])e[t.y]?.[t.x]!==1&&(e[t.y][t.x]=4);return e}function De(e){return{pos:{x:e.x,y:e.y},dir:`left`,next:`left`,speed:ae}}function q(e,t,n){return{pos:{x:e.x,y:e.y},dir:`left`,speed:oe,scatterTarget:n,mode:`chase`,frightUntil:0,color:t}}function Oe(e){let t=0;for(let n=0;n=.1||i>=.1)return!1;let a=0;return[`up`,`down`,`left`,`right`].forEach(t=>{W(e,n.x+V[t].x,n.y+V[t].y)&&a++}),a>=3}function Me(e,t){if(t.next===`none`||t.next===t.dir)return;if(t.next===H[t.dir]){t.dir=t.next;return}let n=G(t.pos),r=Math.abs(t.pos.x-n.x),i=Math.abs(t.pos.y-n.y);r>=.12||i>=.12||W(e,n.x+V[t.next].x,n.y+V[t.next].y)&&(t.pos.x=n.x,t.pos.y=n.y,t.dir=t.next)}function Ne(e,t,n,r,i){if(n===`none`)return;let a=V[n],o=t.x+a.x*r*i,s=t.y+a.y*r*i,c=e[0].length;if(o<-1){t.x=c+1;return}if(o>c+1){t.x=-1;return}if(W(e,Math.round(o),Math.round(s)))t.x=o,t.y=s;else{let e=G(t);t.x=e.x,t.y=e.y}}function Pe(e,t,n,r){let i=[`up`,`left`,`down`,`right`],a=n,o=1/0;for(let s of i){if(s===H[n])continue;let i=Math.round(t.x)+V[s].x,c=Math.round(t.y)+V[s].y;if(!W(e,i,c))continue;let l=K({x:i,y:c},r);l{let r=(0,d.useRef)(null),i=(0,d.useRef)(null),{paused:a,takeFocus:o}=re(`KaiMaze`),[s,c]=(0,d.useState)({w:0,h:0});(0,d.useEffect)(()=>{let e=r.current;if(!e)return;let t=new ResizeObserver(e=>{for(let t of e){let e=t.contentRect;c({w:e.width,h:e.height})}});return t.observe(e),()=>t.disconnect()},[]);let[l,u]=(0,d.useState)(e);(0,d.useEffect)(()=>u(e),[e]);let[f,p]=(0,d.useState)(()=>ke(1,performance.now())),m=(0,d.useRef)(performance.now()),[h,g]=(0,d.useState)(()=>{if(typeof window>`u`)return!1;let e=window.matchMedia?.(`(pointer: coarse)`)?.matches??!1,t=window.matchMedia?.(`(max-width: 900px)`)?.matches??!1;return e||t});(0,d.useEffect)(()=>{if(typeof window>`u`)return;let e=window.matchMedia(`(pointer: coarse)`),t=window.matchMedia(`(max-width: 900px)`),n=()=>g(e.matches||t.matches);return e.addEventListener?.(`change`,n),t.addEventListener?.(`change`,n),()=>{e.removeEventListener?.(`change`,n),t.removeEventListener?.(`change`,n)}},[]);let _=(0,d.useMemo)(()=>e=>Math.floor(_e*(1+ve*(e-1))),[]),v=(0,d.useMemo)(()=>h&&!f.over,[h,f.over]),b=(0,d.useMemo)(()=>(h?`Tap/Swipe or D-pad`:`←↑→↓ / WASD`)+` · B/Space to Channel on ⟐ · Esc to exit`,[h]);(0,d.useEffect)(()=>{if(R>0&&l>=R){let e=l-R;u(e),t(e),o()}},[]);let x=()=>{p(e=>e.channelingUntil?{...e,channelingUntil:0}:e)};(0,d.useEffect)(()=>{let e=e=>{let t=e.key.toLowerCase(),r=Te(t);r!==`none`&&(x(),e.preventDefault(),o(),p(e=>({...e,player:{...e.player,next:r}}))),(t===`b`||t===` `)&&f.onAltar&&f.channelingUntil===0&&(o(),p(e=>({...e,channelingUntil:performance.now()+z}))),t===`escape`&&n&&n(),t===`r`&&f.over&&(o(),p(ke(1,performance.now())),m.current=performance.now())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,f.over,f.onAltar,f.channelingUntil]);let S=e=>{x(),o(),p(t=>({...t,player:{...t.player,next:e}}))},C=()=>{f.onAltar&&f.channelingUntil===0&&(o(),p(e=>({...e,channelingUntil:performance.now()+z})))};(0,d.useEffect)(()=>{let e=0,n=performance.now(),r=(e,n)=>{if(n.channelingUntil===0||!n.onAltar||e0){let e=Math.floor(a*r),i=Math.max(0,n.bankable-e),o=l+a;return u(o),t(o),{...n,scorePhi:n.scorePhi+a,bankable:i,points:i,kaiCharge:Math.max(0,Math.floor(n.kaiCharge*.5)),channelingUntil:0}}return{...n,channelingUntil:0}},i=()=>{e=requestAnimationFrame(i);let o=performance.now(),s=Math.min(1/ie,(o-n)/1e3);n=o,!a&&p(e=>{if(e.over)return e;let n=structuredClone(e);if(o>=n.cycle.nextSwitchAt){let e=n.cycle.phase===`chase`?`scatter`:`chase`;n.cycle={phase:e,nextSwitchAt:o+Ae(n.level,e)};for(let t of n.ghosts)t.mode!==`fright`&&(t.mode=e)}let i=U(o,m.current),a=we(i),c=Math.min(1+n.streak*se,ce),d=Math.min(1+n.streak*me,he),f=n.channelingUntil>0?0:n.player.speed*a*c;Me(n.grid,n.player),Ne(n.grid,n.player.pos,n.player.dir,f,s);let p=G(n.player.pos);n.onAltar=n.grid[p.y]?.[p.x]===4;let h=n.grid[p.y]?.[p.x]??1;if((h===2||h===3)&&n.channelingUntil===0){let e=Math.abs(i-.5)<=L,t=h===2?le:ue;if(e&&(t+=fe,n.kaiCharge=Math.min(B,n.kaiCharge+1)),t=Math.floor(t*d),n.points+=t,n.bankable=n.points,n.streak+=1,n.streak>n.bestStreak&&(n.bestStreak=n.streak),n.comboUntil=o+pe,n.grid[p.y][p.x]=0,n.pellets=Math.max(0,n.pellets-1),h===3){m.current=o;let e=Math.max(ge*Math.max(.55,1-(n.level-1)*.08),I*.5);for(let t of n.ghosts)t.mode=`fright`,t.frightUntil=o+e}}n.comboUntil>0&&o>n.comboUntil&&(n.streak=Math.max(0,Math.floor(n.streak*.5)),n.comboUntil=0);for(let e of n.ghosts){e.mode===`fright`&&o>=e.frightUntil&&(e.mode=n.cycle.phase);let t=G(n.player.pos);if(je(n.grid,e.pos))if(e.mode===`scatter`)e.dir=Pe(n.grid,e.pos,e.dir,e.scatterTarget);else if(e.mode===`fright`){let r=G(e.pos),i=[`up`,`down`,`left`,`right`],a=e.dir,o=-1/0;for(let s of i){if(s===H[e.dir])continue;let i=r.x+V[s].x,c=r.y+V[s].y;if(!W(n.grid,i,c))continue;let l=K({x:i,y:c},t);l>o&&(o=l,a=s)}e.dir=a}else{let r={x:t.x+V[n.player.dir].x*2,y:t.y+V[n.player.dir].y*2};e.dir=Pe(n.grid,e.pos,e.dir,r)}let r=e.mode===`fright`?Ce(.6,.8,Math.sin(i*Math.PI)):a,c=e.speed*r;if(c*=1.06**(n.level-1),Ne(n.grid,e.pos,e.dir,c,s),K(n.player.pos,e.pos)<.4)if(e.mode===`fright`&&n.channelingUntil===0){let t=Math.floor(de*d);n.points+=t,n.bankable=n.points,n.streak+=1,n.streak>n.bestStreak&&(n.bestStreak=n.streak),n.comboUntil=o+pe,e.pos={...e.scatterTarget},e.dir=`left`,e.mode=`scatter`,e.frightUntil=0}else if(--n.lives,n.streak=0,n.comboUntil=0,n.points=Math.max(0,Math.floor(n.points*(1-be))),n.bankable=n.points,n.channelingUntil=0,n.lives<=0)n.alive=!1,n.over=!0;else{let e={x:Math.floor(n.grid[0].length/2),y:n.grid.length-4};n.player.pos={...e},n.player.dir=`left`,n.player.next=`left`;for(let e of n.ghosts)e.mode=`scatter`;m.current=o}}if(n.pellets<=0&&!n.over){let e=_(n.level),r=Math.floor(n.bankable*.2/e);if(r>0){let i=r*e,a=Math.max(0,n.bankable-i),o=l+r;u(o),t(o),n.scorePhi+=r,n.bankable=a,n.points=a}let i=ke(n.level+1,o);i.scorePhi=n.scorePhi,i.lives=Math.max(1,n.lives),i.bestStreak=Math.max(n.bestStreak,n.streak),i.player.speed=n.player.speed*1.06;for(let e of i.ghosts)e.speed*=1.06;return m.current=o,i}return n=r(o,n),n})};return e=requestAnimationFrame(i),()=>cancelAnimationFrame(e)},[t,l,a,_]),(0,d.useEffect)(()=>{let e=0,t=()=>{e=requestAnimationFrame(t);let n=i.current,o=r.current;if(!n||!o)return;let c=n.getContext(`2d`);if(!c)return;let u=Math.max(0,s.w),d=Math.max(0,s.h);if(u===0||d===0)return;let p=Math.min(2,window.devicePixelRatio||1);(n.width!==Math.floor(u*p)||n.height!==Math.floor(d*p))&&(n.width=Math.floor(u*p),n.height=Math.floor(d*p),n.style.width=`${u}px`,n.style.height=`${d}px`),c.setTransform(p,0,0,p,0,0);let h=f.grid.length,g=f.grid[0].length,_=Math.floor(Math.min(u/g,d/h)),v=_*g,y=_*h,b=Math.floor((u-v)/2),x=Math.floor((d-y)/2),S=c.createLinearGradient(0,0,0,d);S.addColorStop(0,`#07071a`),S.addColorStop(1,`#0c1231`),c.fillStyle=S,c.fillRect(0,0,u,d),Be(c,u,d);for(let e=0;e0&&f.onAltar){let e=1-Math.max(0,f.channelingUntil-w)/z,t=u/2;c.strokeStyle=`rgba(0,255,208,0.9)`,c.lineWidth=4,c.globalAlpha=.9,c.beginPath(),c.arc(t,34,16,-Math.PI/2,-Math.PI/2+e*Math.PI*2),c.stroke(),c.globalAlpha=1,c.font=`700 12px ui-sans-serif,system-ui,-apple-system`,c.fillText(`Channeling…`,t+16+8,38)}if(a&&!f.over){c.fillStyle=`rgba(0,0,0,0.35)`,c.fillRect(0,0,u,d),c.fillStyle=`#fff`,c.font=`700 16px ui-sans-serif,system-ui,-apple-system`;let e=`Paused — another Realm is active`;c.fillText(e,(u-c.measureText(e).width)/2,d/2)}if(f.over){c.fillStyle=`rgba(0,0,0,0.55)`,c.fillRect(0,0,u,d),c.fillStyle=`#fff`,c.font=`700 20px ui-sans-serif,system-ui,-apple-system`;let e=`Game Over — Press R to restart`;c.fillText(e,(u-c.measureText(e).width)/2,d/2)}};return e=requestAnimationFrame(t),()=>cancelAnimationFrame(e)},[f,l,s,a]);let w=f.onAltar&&f.channelingUntil===0;return(0,y.jsxs)(`div`,{className:`km-wrap`,role:`group`,"aria-label":`Kai-Maze`,onPointerDown:()=>o(),onTouchStart:()=>o(),onMouseDown:()=>o(),children:[(0,y.jsxs)(`div`,{className:`km-header`,children:[(0,y.jsx)(`div`,{className:`km-title`,children:`🌀 Kai-Maze`}),(0,y.jsx)(`div`,{className:`km-sub`,children:`Score on pulse, risk your points, then ⟐ channel to mint Φ.`})]}),(0,y.jsxs)(`div`,{className:`km-stage`,ref:r,children:[(0,y.jsx)(`canvas`,{ref:i,className:`km-canvas`}),v&&(0,y.jsxs)(`div`,{className:`km-dpad`,style:{position:`absolute`,left:12,bottom:12,width:132,height:132,display:`grid`,gridTemplateColumns:`repeat(3, 1fr)`,gridTemplateRows:`repeat(3, 1fr)`,gap:6,touchAction:`none`,userSelect:`none`,zIndex:4},"aria-label":`Directional pad`,children:[(0,y.jsx)(`div`,{}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:J,"aria-label":`Move up`,onPointerDown:e=>{e.preventDefault(),S(`up`)},children:`▲`}),(0,y.jsx)(`div`,{}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:J,"aria-label":`Move left`,onPointerDown:e=>{e.preventDefault(),S(`left`)},children:`◀`}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:{...J,opacity:.9},"aria-label":`Hold to Channel (if on altar)`,onPointerDown:e=>{e.preventDefault(),C()},title:`Channel one breath to convert points → Φ`,children:`⟐`}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:J,"aria-label":`Move right`,onPointerDown:e=>{e.preventDefault(),S(`right`)},children:`▶`}),(0,y.jsx)(`div`,{}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:J,"aria-label":`Move down`,onPointerDown:e=>{e.preventDefault(),S(`down`)},children:`▼`}),(0,y.jsx)(`div`,{})]}),w&&(0,y.jsx)(`button`,{className:`km-chan-btn`,onClick:()=>{o(),p(e=>e.channelingUntil?e:{...e,channelingUntil:performance.now()+z})},"aria-label":`Channel points into Phi`,title:`Channel one breath to convert points → Φ`,children:`⟐ CHANNEL`}),f.channelingUntil>0&&(0,y.jsx)(`button`,{className:`km-chan-cancel`,onClick:()=>{o(),p(e=>({...e,channelingUntil:0}))},"aria-label":`Cancel channeling`,title:`Cancel`,children:`Cancel`})]}),(0,y.jsxs)(`div`,{className:`km-footer`,children:[(0,y.jsx)(`button`,{className:`km-btn`,onClick:n,title:`Back`,children:`Back`}),(0,y.jsx)(`div`,{className:`km-hint`,children:b})]})]})};function Ie(e,t,n,r,i){e.save(),e.fillStyle=i,e.beginPath(),e.arc(t,n,r,0,Math.PI*2),e.fill(),e.strokeStyle=`rgba(255,255,255,0.35)`,e.lineWidth=1.25,e.stroke(),e.restore()}function Le(e,t,n,r,i){e.save(),e.fillStyle=i,e.beginPath(),e.arc(t,n,r,Math.PI,0),e.lineTo(t+r,n+r*.85),e.lineTo(t-r,n+r*.85),e.closePath(),e.fill(),e.fillStyle=`#fff`,e.beginPath(),e.arc(t-r*.35,n-r*.15,r*.16,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(t+r*.35,n-r*.15,r*.16,0,Math.PI*2),e.fill(),e.fillStyle=`rgba(0,0,0,0.7)`,e.beginPath(),e.arc(t-r*.3,n-r*.15,r*.08,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(t+r*.3,n-r*.15,r*.08,0,Math.PI*2),e.fill(),e.restore()}function Re(e,t,n){let r=Math.min(460,Math.max(220,t*.5)),i=t/2,a=r/2;e.save(),e.globalAlpha=.35,e.strokeStyle=`rgba(0,255,208,.6)`,e.lineWidth=2,e.beginPath(),e.moveTo(i-a,20),e.lineTo(i+a,20),e.stroke();let o=ze(r*L*2);e.globalAlpha=.2,e.fillStyle=`#ffd36e`,e.fillRect(i-o,17,o*2,6),e.globalAlpha=.9,e.fillStyle=`#00ffd0`;let s=i-a+n*r;e.beginPath(),e.arc(s,20,4,0,Math.PI*2),e.fill(),e.restore()}function ze(e){return e/2}function Be(e,t,n){e.save(),e.globalAlpha=.08,e.strokeStyle=`rgba(255,255,255,0.15)`,e.lineWidth=1;let r=t/2,i=n/2,a=(1+Math.sqrt(5))/2,o=4;for(let s=0;s<8;s++){let s=Math.min(t,n)/o;e.beginPath(),e.arc(r,i,s,-Math.PI/2,Math.PI),e.stroke(),o*=a}e.restore()}var J={background:`linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04))`,border:`1px solid rgba(255,255,255,0.25)`,borderRadius:10,color:`rgba(255,255,255,0.9)`,fontSize:18,lineHeight:1,padding:0,display:`flex`,alignItems:`center`,justifyContent:`center`,minWidth:36,minHeight:36,touchAction:`none`};(()=>{let e=Array.from({length:31},()=>Array.from({length:28},()=>2));for(let t=0;t<28;t++)e[0][t]=1,e[30][t]=1;for(let t=0;t<31;t++)e[t][0]=1,e[t][27]=1;for(let t=4;t<24;t+=6)for(let n=4;n<27;n+=6)e[n][t]=1,e[n][t+1]=1,e[n+1][t]=1,e[n+1][t+1]=1;for(let t=2;t<26;t++)e[15][t]=0;e[1][1]=3,e[1][26]=3,e[29][1]=3,e[29][26]=3;for(let t=2;t<29;t++)e[t][14]=0;for(let t=2;t<26;t++)e[11][t]=0;return e})();var Ve=5236,Y=3,He=Y*2,Ue=2,We=.15,Ge=220,Ke=60,qe=20;function Je(e){return(Math.imul(e^2654435769,2654435761)>>>0)%1e5/1e5}function Ye(e,t){let n=Math.abs(e-t)%360;return n>180&&(n=360-n),n}var Xe=({currentPhi:e,onPhiChange:t})=>{let[n,r]=(0,d.useState)(`forge`),[i,a]=(0,d.useState)(null),[o,s]=(0,d.useState)(performance.now()),[c,l]=(0,d.useState)(0),[u,f]=(0,d.useState)(!1),[p,m]=(0,d.useState)(null),[h,g]=(0,d.useState)(0);ee({onPulse:e=>{a(e),s(performance.now()),m(e=>e&&{...e,delta:e.delta})}}),(0,d.useEffect)(()=>{if(n!==`forge`)return;let e=0,t=!0,r=()=>{if(!t)return;let n=performance.now();l(Math.max(0,n-o)%Ve/Ve*360%360),e=requestAnimationFrame(r)};return e=requestAnimationFrame(r),()=>{t=!1,cancelAnimationFrame(e)}},[o,n]);let _=(0,d.useMemo)(()=>{let e=i??0,t=Math.floor(Je(e)*360),n=Ke+(e%2==0?qe:0)-Math.min(20,Math.floor(h*6));return{centerDeg:t,halfWidthDeg:Math.max(10,n/2)}},[i,h]),v=(0,d.useMemo)(()=>n===`forge`&&!u&&e>=Y&&i!==null,[n,u,e,i]),b=(0,d.useCallback)(e=>{let t=He,n=1+h*We,r=e?Ue:1;return Math.floor(t*n*r)},[h]),x=(0,d.useCallback)(()=>{if(!v)return;let n=e-Y;t(n),f(!0),m(null);let r=Ye(c,_.centerDeg),i=Math.max(4,_.halfWidthDeg*.25),a=r<=_.halfWidthDeg,o=a&&r<=i;window.setTimeout(()=>{if(a){let e=b(o);t(n+e),g(e=>e+1),m({kind:o?`crit`:`hit`,delta:e})}else g(0),m({kind:`miss`,delta:-Y});f(!1)},650)},[v,e,t,c,_.centerDeg,_.halfWidthDeg,b]);return(0,d.useEffect)(()=>{if(n!==`forge`)return;let e=e=>{let t=e.key.toLowerCase();(t===` `||t===`enter`)&&(e.preventDefault(),x())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,x]),(0,y.jsx)(`div`,{className:`pf-wrap`,role:`group`,"aria-label":`Pulse Forge`,children:n===`forge`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`pf-header`,children:[(0,y.jsx)(`div`,{className:`pf-title`,children:`⚒️ Pulse Forge`}),(0,y.jsx)(`div`,{className:`pf-sub`,children:`Time your lock to the target arc. Breathe, focus, forge.`}),(0,y.jsx)(`div`,{style:{marginLeft:`auto`,display:`flex`,gap:8},children:(0,y.jsx)(`button`,{type:`button`,className:`pf-lock-btn`,onClick:()=>r(`maze`),title:`Switch to Kai-Maze`,children:`Play Kai-Maze`})})]}),(0,y.jsxs)(`div`,{className:`pf-board`,children:[(0,y.jsxs)(`div`,{className:`pf-dial`,style:{width:Ge,height:Ge},children:[(0,y.jsx)(`div`,{className:`pf-arc`,style:{"--arc-center":`${_.centerDeg}deg`,"--arc-half":`${_.halfWidthDeg}deg`},"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`pf-marker ${u?`pf-marker--lock`:``}`,style:{transform:`rotate(${c}deg)`},"aria-hidden":!0,children:(0,y.jsx)(`div`,{className:`pf-marker-head`})}),(0,y.jsx)(`div`,{className:`pf-rim`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`pf-ticks`,"aria-hidden":!0,children:Array.from({length:12}).map((e,t)=>(0,y.jsx)(`span`,{style:{transform:`rotate(${t*30}deg)`}},t))})]}),(0,y.jsxs)(`div`,{className:`pf-hud`,children:[(0,y.jsxs)(`div`,{className:`pf-chip`,title:`Your Φ`,children:[(0,y.jsx)(`span`,{className:`pf-chip__label`,children:`Φ`}),(0,y.jsx)(`span`,{className:`pf-chip__val`,children:e})]}),(0,y.jsxs)(`div`,{className:`pf-chip`,title:`Streak`,children:[(0,y.jsx)(`span`,{className:`pf-chip__label`,children:`Streak`}),(0,y.jsx)(`span`,{className:`pf-chip__val`,children:h})]}),(0,y.jsxs)(`div`,{className:`pf-chip`,title:`Pulse`,children:[(0,y.jsx)(`span`,{className:`pf-chip__label`,children:`Pulse`}),(0,y.jsx)(`span`,{className:`pf-chip__val`,children:i??`—`})]})]})]}),(0,y.jsxs)(`div`,{className:`pf-cta`,children:[(0,y.jsx)(`button`,{className:`pf-lock-btn`,onClick:x,disabled:!v,"aria-disabled":!v,title:v?`Press Space/Enter to Lock`:`Insufficient Φ or syncing…`,children:u?`Locking…`:`Lock (−${Y} Φ)`}),(0,y.jsxs)(`div`,{className:`pf-hint`,children:[`Press `,(0,y.jsx)(`kbd`,{children:`Space`}),` or `,(0,y.jsx)(`kbd`,{children:`Enter`}),` at the right moment. Even pulses widen the target.`]})]}),p&&(0,y.jsxs)(`div`,{className:`pf-result pf-result--${p.kind}`,role:`status`,"aria-live":`polite`,children:[p.kind===`hit`&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:`pf-result__emoji`,children:`✅`}),(0,y.jsxs)(`span`,{className:`pf-result__text`,children:[`Resonant lock! +`,p.delta,` Φ`]})]}),p.kind===`crit`&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:`pf-result__emoji`,children:`💥`}),(0,y.jsxs)(`span`,{className:`pf-result__text`,children:[`Perfect lock! +`,p.delta,` Φ`]})]}),p.kind===`miss`&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:`pf-result__emoji`,children:`❌`}),(0,y.jsx)(`span`,{className:`pf-result__text`,children:`Miss — breathe again.`})]})]})]}):(0,y.jsx)(Fe,{currentPhi:e,onPhiChange:t,onExit:()=>r(`forge`)})})};function Ze(){return`kai-${Math.random().toString(36).slice(2,8)}`}function Qe(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.x==`number`&&typeof t.pulseIndex==`number`&&typeof t.chakraDay==`string`&&typeof t.glyph==`object`&&t.glyph!==null}var $e=null;async function et(){return $e||($e=(await r(()=>import(`./bundler-H_464dRi.js`),__vite__mapDeps([0,1,2]))).default,$e)}function tt(e){let[t]=(0,d.useState)(()=>e??Ze()),[n,r]=(0,d.useState)([]),[i,a]=(0,d.useState)([]),o=(0,d.useRef)(null),s=(0,d.useRef)({}),c=(0,d.useCallback)((e,t)=>{if(!Qe(t))return;let n={...t,id:e,glyph:t.glyph};a(t=>{let r=t.findIndex(t=>t.id===e);if(r>=0){let e=[...t];return e[r]=n,e}return[...t,n]})},[]),l=(0,d.useCallback)((e,t)=>{Qe(e)&&c(t,e)},[c]);return(0,d.useEffect)(()=>{let e=!1;return(async()=>{let n=await et();if(e)return;let i=new n(t);o.current=i,i.on(`open`,()=>{r(e=>e)}),i.on(`connection`,e=>{s.current[e.peer]=e,r(t=>Array.from(new Set([...t,e.peer]))),e.on(`data`,t=>{l(t,e.peer)}),e.on(`close`,()=>{delete s.current[e.peer],r(t=>t.filter(t=>t!==e.peer)),a(t=>t.filter(t=>t.id!==e.peer))})})})().catch(e=>{console.error(`[KaiRealms] Peer init failed:`,e)}),()=>{e=!0;try{o.current?.destroy()}catch(e){console.warn(`[KaiRealms] Peer destroy failed:`,e)}o.current=null,s.current={},r([]),a([])}},[t,l]),{sessionId:t,peers:n,sendState:(0,d.useCallback)(e=>{let t=Object.values(s.current);for(let n of t)n.open&&n.send(e)},[]),remoteStates:i}}var nt=800,rt=500,it=nt/rt,X=28,Z=10,at=360,ot=10,Q=5236,st=.08,ct=22,lt=90,ut=80,dt=2,ft=4,pt=10,mt=3,ht=1,gt=3,_t=1,vt=1,$=(e,t,n)=>en?n:e,yt=({glyphData:e,onExit:t})=>{let n=(0,d.useRef)(null),r=(0,d.useRef)(null),i=(0,d.useRef)(null),[a,o]=(0,d.useState)({w:nt,h:rt}),s=(0,d.useRef)(a);(0,d.useEffect)(()=>{s.current=a},[a]);let[c,l]=(0,d.useState)(0),[u,f]=(0,d.useState)(0),[p,m]=(0,d.useState)(!1),[h,g]=(0,d.useState)(mt),[_,v]=(0,d.useState)(0),[b,x]=(0,d.useState)(0),[S,C]=(0,d.useState)(!1),w=(0,d.useRef)(performance.now()),{sendState:T,remoteStates:E}=tt(),D=(0,d.useRef)([]);(0,d.useEffect)(()=>{D.current=E??[]},[E]);let O=(0,d.useRef)(nt/2),k=(0,d.useRef)([]),A=(0,d.useRef)({}),j=(0,d.useRef)(null),M=(0,d.useRef)(null),N=(0,d.useRef)(null),P=(0,d.useRef)(0),te=(0,d.useRef)(0),F=(0,d.useRef)(null);(0,d.useEffect)(()=>{let e=n.current;if(!e)return;let t=new ResizeObserver(e=>{let t=e[0].contentRect,n=Math.max(320,Math.min(960,t.width));o({w:n,h:Math.round(n/it)})});return t.observe(e),()=>t.disconnect()},[]),(0,d.useEffect)(()=>{let e=r.current;if(!e)return;let t=e.getContext(`2d`);if(!t)return;let n=Math.min(2,window.devicePixelRatio||1);e.style.width=`${a.w}px`,e.style.height=`${a.h}px`,e.width=Math.floor(a.w*n),e.height=Math.floor(a.h*n),t.setTransform(n,0,0,n,0,0),i.current=t,O.current=$(O.current,X,a.w-X)},[a]),(0,d.useEffect)(()=>{let e=e=>{A.current[e.key]=!0,e.key.toLowerCase()===`p`&&m(e=>!e),e.key.toLowerCase()===`r`&&S&&R()},t=e=>{A.current[e.key]=!1};return window.addEventListener(`keydown`,e),window.addEventListener(`keyup`,t),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`keyup`,t)}},[S]),(0,d.useEffect)(()=>{let e=r.current;if(!e)return;let t=t=>{let n=e.getBoundingClientRect();return $((t-n.left)/n.width*s.current.w,X,s.current.w-X)},n=!1,i=e=>{n=!0,O.current=t(e.clientX)},a=e=>{n&&(O.current=t(e.clientX))},o=()=>{n=!1};return e.addEventListener(`pointerdown`,i),e.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o),()=>{e.removeEventListener(`pointerdown`,i),e.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o)}},[]);let ne=e=>Math.max(0,e-w.current)%Q/Q,re=e=>{let t=Math.sin(Math.PI*e);return .65+.7*(t*t)},I=e=>{let{w:t}=s.current,n=performance.now(),r=Math.random()*(t-2*Z)+Z,i=-Z*2,a=(Math.random()-.5)*40,o=(e===`gold`?ut:lt)+_*(pt*.2),c={id:`${e}-${n}-${Math.floor(Math.random()*1e6)}`,x:r,y:i,vx:a,baseVy:o,kind:e,bornAt:n},l=k.current.slice(-(ct-1));l.push(c),k.current=l};ee({onPulse:e=>{f(e),w.current=performance.now(),te.current+=1;for(let e=0;e{let n=N.current,r=O.current,i=u;if(!n||Math.abs(n.x-r)>=1||n.pulseIndex!==i||t-P.current>1e3/ot){N.current={x:r,pulseIndex:i},P.current=t;try{T({id:`you`,x:r,pulseIndex:i,chakraDay:e.meta.chakraDay,glyph:e})}catch{}}};(0,d.useEffect)(()=>{let t=r.current,n=i.current;if(!t||!n)return;let a=!0,o=t=>{if(!a)return;j.current=requestAnimationFrame(o);let r=M.current??t,i=Math.min(.05,(t-r)/1e3);M.current=t;let{w:c,h:u}=s.current,d=u-X-10;if(!p&&!S){let e=A.current,n=!!(e.ArrowLeft||e.a||e.A),r=!!(e.ArrowRight||e.d||e.D);n&&(O.current=$(O.current-at*i,X,c-X)),r&&(O.current=$(O.current+at*i,X,c-X));let a=O.current,o=performance.now(),s=ne(o),f=re(s),p=[],m=0,h=0,y=0;for(let e=0;ec-Z&&(t.x=c-Z,t.vx=-Math.abs(t.vx)*.9);let r=t.x-a,l=t.y-d;if(Math.hypot(r,l)u+Z){y+=1;continue}p.push(t)}if(m>0||h>0){let e=m+h;l(t=>t+e),v(e=>{let t=e+1;return x(e=>t>e?t:e),t})}y>0&&(l(e=>Math.max(0,e-ht*y)),v(0),g(e=>{let t=Math.max(0,e-y);return t===0&&C(!0),t})),k.current=p,L(t)}bt(n,e,O.current,d,p||S,k.current,D.current,s.current,w.current,F.current)};return j.current=requestAnimationFrame(o),()=>{a=!1,j.current!==null&&cancelAnimationFrame(j.current),j.current=null,M.current=null}},[e,p,S,a.w,a.h]);let R=()=>{k.current=[],g(mt),v(0),x(e=>e),C(!1)},ie=(0,d.useMemo)(()=>({pulse:u,chakraDay:e?.meta?.chakraDay??`—`}),[u,e?.meta?.chakraDay]);return(0,y.jsxs)(`div`,{className:`realm-wrap`,ref:n,children:[(0,y.jsxs)(`div`,{className:`realm-hud`,children:[(0,y.jsxs)(`div`,{className:`hud-chip hud-chip--score`,title:`Banked Φ`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Φ`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:c})]}),(0,y.jsxs)(`div`,{className:`hud-chip`,title:`Streak`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Streak`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:_})]}),(0,y.jsxs)(`div`,{className:`hud-chip`,title:`Lives`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Lives`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:h})]}),(0,y.jsxs)(`div`,{className:`hud-chip`,title:`Current Pulse`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Pulse`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:ie.pulse})]}),(0,y.jsxs)(`div`,{className:`hud-chip`,title:`Chakra Day`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Day`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:ie.chakraDay})]}),(0,y.jsx)(`button`,{className:`hud-button`,onClick:()=>m(e=>!e),"aria-pressed":p,title:`Pause (P)`,children:p?`Resume`:`Pause`})]}),(0,y.jsxs)(`div`,{className:`realm-canvas-wrap`,children:[(0,y.jsx)(`canvas`,{ref:r,className:`realm-canvas`,"aria-label":`Kai Realms Canvas`}),(p||S)&&(0,y.jsx)(`div`,{className:`realm-pause-overlay`,"aria-hidden":!0,children:(0,y.jsxs)(`div`,{className:`pause-card`,children:[(0,y.jsx)(`div`,{className:`pause-title`,children:S?`Game Over`:`Paused`}),(0,y.jsx)(`div`,{className:`pause-sub`,children:S?(0,y.jsxs)(y.Fragment,{children:[`Best Streak: `,(0,y.jsx)(`strong`,{children:b}),` — Press `,(0,y.jsx)(`kbd`,{children:`R`}),` to Restart`]}):(0,y.jsxs)(y.Fragment,{children:[`Press `,(0,y.jsx)(`kbd`,{children:`P`}),` or click Resume`]})}),S&&(0,y.jsx)(`button`,{className:`hud-button`,onClick:R,style:{marginTop:12},children:`Restart`})]})})]}),(0,y.jsx)(Xe,{currentPhi:c,onPhiChange:e=>l(e)}),(0,y.jsx)(`button`,{className:`exit-button`,onClick:t,children:`Exit Realm`})]})};function bt(e,t,n,r,i,a,o,s,c,l){let{w:u,h:d}=s,f=e.createLinearGradient(0,0,0,d);f.addColorStop(0,`#020211`),f.addColorStop(1,`#0b0f2a`),e.fillStyle=f,e.fillRect(0,0,u,d),e.save(),e.globalAlpha=.12;for(let t=0;t<40;t++){let n=t*197%u+t%3,r=t*127%d+t*11%7;e.fillStyle=`white`,e.fillRect(n,r,2,2)}e.restore(),xt(e,u,Math.max(36,Math.round(d*.06)),c);for(let t=0;t{let[n,r]=(0,d.useState)(null),i=(0,d.useRef)(null),a=(0,d.useRef)(null),o=(0,d.useCallback)(e=>r(e),[]),s=(0,d.useCallback)(()=>{r(null),t?.()},[t]);(0,d.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t?.()};return document.addEventListener(`keydown`,e),a.current?.focus(),()=>document.removeEventListener(`keydown`,e)},[t]),(0,d.useEffect)(()=>{let e=i.current;if(!e)return;let t=e=>e.stopPropagation();return e.addEventListener(`wheel`,t,{passive:!0}),()=>e.removeEventListener(`wheel`,t)},[]);let c=()=>t?.(),l=e=>e.stopPropagation();return(0,y.jsxs)(`div`,{className:`realms-backdrop realms-veil`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`kai-realms-title`,onMouseDown:c,children:[(0,y.jsx)(`div`,{className:`realms-stars`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`realms-halo realms-halo--1`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`realms-halo realms-halo--2`,"aria-hidden":!0}),(0,y.jsxs)(`div`,{ref:i,className:`realms-container glass-omni`,onMouseDown:l,role:`document`,children:[(0,y.jsx)(`div`,{className:`breath-ring breath-ring--outer`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`breath-ring breath-ring--inner`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`phi-grid`,"aria-hidden":!0}),(0,y.jsxs)(`header`,{className:`realms-header`,children:[(0,y.jsx)(`button`,{ref:a,type:`button`,className:`realms-close auric-btn`,"aria-label":`Close Kai Realms`,onClick:e=>{e.stopPropagation(),t?.()},onMouseDown:e=>e.stopPropagation(),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),t?.())},children:(0,y.jsx)(e,{size:20,"aria-hidden":!0})}),(0,y.jsx)(`div`,{className:`header-seals`,"aria-hidden":!0,children:(0,y.jsxs)(`div`,{className:`seal-emblem`,children:[(0,y.jsx)(`div`,{className:`seal-ring`}),(0,y.jsx)(`div`,{className:`seal-ring seal-ring--inner`}),(0,y.jsx)(`div`,{className:`seal-core`})]})}),(0,y.jsx)(`h2`,{id:`kai-realms-title`,className:`sr-only`,children:`Kai Realms — Sigil Gate`})]}),(0,y.jsx)(`main`,{className:`realms-body`,children:n?(0,y.jsx)(`div`,{className:`realm-stage`,children:(0,y.jsx)(yt,{glyphData:n,onExit:s})}):(0,y.jsx)(`div`,{className:`portal-stage`,children:(0,y.jsx)(x,{onEnter:o})})}),(0,y.jsx)(`footer`,{className:`realms-footer`,"aria-hidden":!0,children:(0,y.jsx)(`div`,{className:`footer-center`,style:{margin:`0 auto`},children:(0,y.jsx)(wt,{})})})]})]})};function wt(){return(0,y.jsxs)(`svg`,{className:`seal-coin`,width:`56`,height:`56`,viewBox:`0 0 56 56`,"aria-hidden":!0,children:[(0,y.jsxs)(`defs`,{children:[(0,y.jsxs)(`radialGradient`,{id:`coinGlowRealms`,cx:`50%`,cy:`50%`,r:`50%`,children:[(0,y.jsx)(`stop`,{offset:`0%`,stopColor:`#ffffff`,stopOpacity:`0.9`}),(0,y.jsx)(`stop`,{offset:`40%`,stopColor:`#ffd86b`,stopOpacity:`0.75`}),(0,y.jsx)(`stop`,{offset:`100%`,stopColor:`#ffd86b`,stopOpacity:`0.15`})]}),(0,y.jsxs)(`linearGradient`,{id:`coinEdgeRealms`,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,y.jsx)(`stop`,{offset:`0%`,stopColor:`#00ffd0`,stopOpacity:`0.8`}),(0,y.jsx)(`stop`,{offset:`100%`,stopColor:`#8a2be2`,stopOpacity:`0.8`})]})]}),(0,y.jsx)(`circle`,{cx:`28`,cy:`28`,r:`26`,fill:`url(#coinGlowRealms)`,stroke:`url(#coinEdgeRealms)`,strokeWidth:`1.5`}),(0,y.jsxs)(`g`,{className:`seal-coin__rotor`,children:[(0,y.jsx)(`circle`,{cx:`28`,cy:`28`,r:`18`,fill:`none`,stroke:`url(#coinEdgeRealms)`,strokeWidth:`1.25`}),(0,y.jsxs)(`g`,{stroke:`rgba(255,255,255,0.35)`,strokeWidth:`0.6`,children:[(0,y.jsx)(`line`,{x1:`28`,y1:`10`,x2:`28`,y2:`46`}),(0,y.jsx)(`line`,{x1:`10`,y1:`28`,x2:`46`,y2:`28`}),(0,y.jsx)(`line`,{x1:`15`,y1:`15`,x2:`41`,y2:`41`}),(0,y.jsx)(`line`,{x1:`41`,y1:`15`,x2:`15`,y2:`41`})]})]}),(0,y.jsx)(`circle`,{className:`seal-coin__core`,cx:`28`,cy:`28`,r:`6.5`})]})}export{Ct as default}; \ No newline at end of file +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/bundler-IMYm8BQv.js","assets/index-BWApiWDT.js","assets/index-BmaJNTKf.css"])))=>i.map(i=>d[i]); +import{t as e}from"./x-Bw0a6Rv2.js";import{Bt as t,Ht as n,Sn as r,Tn as i,an as a,jn as o,ln as s,mn as c,t as l,tn as u}from"./index-BWApiWDT.js";var d=o(i(),1);function f(e){return typeof e==`string`?e.toLowerCase():``}function p(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function m(e){return typeof e==`string`&&e.length>0}function h(e){return typeof e==`number`&&Number.isFinite(e)}function g(e){if(typeof e!=`object`||!e)throw Error(`Malformed sigil metadata.`);let t=e;for(let e of[`pulse`,`beat`,`stepIndex`,`chakraDay`])if(!p(t,e))throw Error(`Missing Kai field: ${e}`);if(!p(t,`kaiSignature`))throw Error(`Invalid Kai Signature — tampered or unsigned sigil.`);if(!h(t.pulse))throw Error(`Invalid field: pulse`);if(!h(t.beat))throw Error(`Invalid field: beat`);if(!h(t.stepIndex))throw Error(`Invalid field: stepIndex`);if(!m(t.chakraDay))throw Error(`Invalid field: chakraDay`);if(!m(t.kaiSignature))throw Error(`Invalid field: kaiSignature`)}function _(e){try{let t=new DOMParser().parseFromString(e,`image/svg+xml`),n=Array.from(t.getElementsByTagName(`metadata`)),r=[`valuation`,`ledger`,`dht`,`source`];for(let e of n){let t=e.getAttribute(`id`)??``;if(r.some(e=>t.includes(e)))continue;let n=(e.textContent??``).trim();if(!n)continue;let i=n.replace(/^$/,``);try{let e=JSON.parse(i);if(typeof e==`object`&&e&&p(e,`pulse`)&&p(e,`beat`)&&p(e,`stepIndex`)&&p(e,`chakraDay`)&&p(e,`kaiSignature`))return e}catch{}}return null}catch{return null}}async function v(e){let r=await e.text(),{meta:i,contextOk:a,typeOk:o}=await l(e),s=i&&p(i,`kaiSignature`)&&p(i,`pulse`)?i:_(r);if(!s||!a||!o)throw Error(`Invalid glyph or missing metadata.`);g(s);let c=s,u=await t(c);if(!u||f(u)!==f(c.kaiSignature))throw Error(`Invalid Kai Signature — tampered or unsigned sigil.`);let d=await n(c.kaiSignature);if(typeof c.userPhiKey==`string`){if(f(c.userPhiKey)!==f(d))throw Error(`Φ-Key mismatch — identity invalid.`)}else c.userPhiKey=d;return{svgText:r,meta:c,phiKey:d}}var y=o(u(),1),b=`.svg,image/svg+xml`,x=({onEnter:e})=>{let t=(0,d.useRef)(null),[n,r]=(0,d.useState)(!1),[i,a]=(0,d.useState)(!1),[o,s]=(0,d.useState)(``),[c,l]=(0,d.useState)(null),u=(0,d.useId)(),f=(0,d.useId)(),p=(0,d.useId)(),m=()=>{t.current&&(t.current.value=``)},h=(0,d.useCallback)(async t=>{l(null),s(t.name),a(!0);try{if(!(t.type===`image/svg+xml`||t.name.toLowerCase().endsWith(`.svg`)))throw Error(`Please upload a valid Kai Sigil (.svg).`);e(await v(t))}catch(e){l(e instanceof Error?e.message:`Invalid glyph or missing metadata.`)}finally{a(!1),m()}},[e]),g=(0,d.useCallback)(async e=>{let t=e.target.files?.[0];t&&await h(t)},[h]),_=(0,d.useCallback)(async e=>{e.preventDefault(),e.stopPropagation(),r(!1);let t=e.dataTransfer.files?.[0];t&&await h(t)},[h]),x=e=>{e.preventDefault(),e.dataTransfer.dropEffect=`copy`,n||r(!0)},S=e=>{e.currentTarget.contains(e.relatedTarget)||r(!1)},C=()=>t.current?.click(),w=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),C())};return(0,y.jsxs)(`section`,{className:`portal-card glass-omni`,"aria-labelledby":u,"aria-describedby":f,children:[(0,y.jsx)(`div`,{className:`breath-ring breath-ring--outer`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`breath-ring breath-ring--inner`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`phi-grid`,"aria-hidden":!0}),(0,y.jsx)(`h1`,{id:u,className:`sr-only`,children:`Drop your Kai Sigil`}),(0,y.jsxs)(`div`,{className:`portal-body`,children:[(0,y.jsxs)(`div`,{className:`dropzone ${n?`dropzone--active`:``} ${i?`dropzone--busy`:``}`,role:`button`,tabIndex:0,onKeyDown:w,onClick:C,onDrop:_,onDragOver:x,onDragLeave:S,"aria-busy":i,"aria-describedby":`${f}${c?` ${p}`:``}`,children:[(0,y.jsxs)(`div`,{className:`dropzone-ornament`,"aria-hidden":!0,children:[(0,y.jsx)(`div`,{className:`ornament-ring ornament-ring--outer`}),(0,y.jsx)(`div`,{className:`ornament-ring ornament-ring--inner`}),(0,y.jsx)(`div`,{className:`ornament-core`})]}),(0,y.jsx)(`div`,{className:`dropzone-icon`,"aria-hidden":!0,children:(0,y.jsxs)(`svg`,{width:`44`,height:`44`,viewBox:`0 0 44 44`,children:[(0,y.jsx)(`defs`,{children:(0,y.jsxs)(`linearGradient`,{id:`dzG`,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,y.jsx)(`stop`,{offset:`0%`,stopColor:`#00ffd0`}),(0,y.jsx)(`stop`,{offset:`100%`,stopColor:`#8a2be2`})]})}),(0,y.jsx)(`circle`,{cx:`22`,cy:`22`,r:`20`,fill:`none`,stroke:`url(#dzG)`,strokeWidth:`1.5`}),(0,y.jsx)(`path`,{d:`M22 12 L22 30 M14 20 L22 12 L30 20`,stroke:`url(#dzG)`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`})]})}),(0,y.jsxs)(`div`,{className:`dropzone-text`,children:[(0,y.jsx)(`div`,{className:`dz-title`,children:`Inhale your Kai Sigil`}),(0,y.jsxs)(`div`,{id:f,className:`dz-hint`,children:[`Breath-minted `,(0,y.jsx)(`strong`,{children:`Φkey`}),` only. Drag & drop.`]}),o&&!i&&!c?(0,y.jsxs)(`div`,{className:`dz-file`,children:[`Selected: `,o]}):null,i?(0,y.jsxs)(`div`,{className:`dz-progress`,children:[(0,y.jsx)(`div`,{className:`dz-spinner`}),(0,y.jsx)(`span`,{children:`Verifying…`})]}):null]}),(0,y.jsx)(`input`,{ref:t,type:`file`,accept:b,onChange:g,tabIndex:-1,"aria-hidden":!0,className:`dz-input`})]}),c?(0,y.jsx)(`div`,{id:p,className:`portal-error`,role:`alert`,"aria-live":`polite`,children:c}):null,(0,y.jsx)(`p`,{className:`portal-note`,children:`Your sigil is verified by breath. No drift. Only truth.`})]}),(0,y.jsx)(`span`,{className:`sr-only`,children:`Kai Realms sigil gate ready.`})]})},S=typeof window<`u`,C=11n,w=44n,T=36n;function E(e){let t=BigInt(a),n=BigInt(s),r=(e>t?e-t:0n)/n,i=r/C%w,o=r/(C*w)%T;return{pulseIndex:Number(r),stepIndex:Number(i),beatIndex:Number(o)}}function D(e){let t=BigInt(a),n=BigInt(s);return t+((e>t?e-t:0n)/n+1n)*n}function ee(e){let t=(0,d.useRef)(null),n=(0,d.useRef)(e);n.current=e,(0,d.useEffect)(()=>{if(!S)return;let e=null,r=!1,i=()=>{if(r)return;let a=c(),{pulseIndex:o,stepIndex:s,beatIndex:l}=E(a);o!==t.current&&(n.current.onPulse?.(o),o%Number(C)===0&&n.current.onStep?.(s),o%Number(C*w)===0&&n.current.onBeat?.(l),t.current=o);let u=D(a),d=u>a?u-a:0n,f=Number(d);e=window.setTimeout(i,f)};return i(),()=>{r=!0,e!==null&&window.clearTimeout(e)}},[])}var O={Root:`#FF0033`,Sacral:`#FF8000`,Solar:`#FFD700`,Heart:`#00FF99`,Throat:`#33CCFF`,ThirdEye:`#9933FF`,Crown:`#AA00FF`};function k(e,t,n,r,i){e.save(),e.translate(n,r);let{chakraDay:a,pulse:o}=t.meta,s=O[a]??`#00FFFF`;e.beginPath(),e.arc(0,0,i+4,0,Math.PI*2),e.fillStyle=s,e.shadowColor=s,e.shadowBlur=15,e.fill(),e.beginPath(),e.arc(0,0,i,0,Math.PI*2),e.fillStyle=`#000012`,e.fill();let c=i+o%11*1.5;e.beginPath(),e.arc(0,0,c,0,Math.PI*2),e.strokeStyle=`${s}AA`,e.lineWidth=1.5,e.stroke(),e.restore()}function A(e){return typeof e==`object`&&!!e}function j(e){if(typeof e==`bigint`)return e;if(typeof e==`number`&&Number.isFinite(e)&&Number.isSafeInteger(e))return BigInt(e);if(typeof e==`string`)try{return BigInt(e)}catch{return null}return null}var M=`kai:game:focus`,N=typeof window<`u`;function P(){if(!N||typeof BroadcastChannel>`u`)return null;try{return new BroadcastChannel(`kai-realms-game-focus`)}catch{return null}}function te(e){let t={id:e,ts:c()};if(N)try{window.dispatchEvent(new CustomEvent(M,{detail:t}))}catch{}let n=P();if(n)try{n.postMessage({type:M,detail:{id:t.id,ts:t.ts.toString()}})}catch{}finally{try{n.close()}catch{}}}function F(e){if(!A(e))return null;let t=e.id,n=j(e.ts);return typeof t!=`string`||n===null?null:{id:t,ts:n}}function ne(e){let t=t=>{let n=F(t?.detail);n&&e(n)};N&&window.addEventListener(M,t);let n=P(),r=t=>{let n=t?.data;if(!A(n)||n.type!==M)return;let r=F(n.detail);r&&e(r)};if(n)try{n.addEventListener(`message`,r)}catch{}return()=>{if(N&&window.removeEventListener(M,t),n)try{n.removeEventListener(`message`,r)}catch{}finally{try{n.close()}catch{}}}}function re(e){let[t,n]=(0,d.useState)(!1),r=(0,d.useRef)(0n);return(0,d.useEffect)(()=>ne(t=>{n(t.id!==e),r.current=t.ts}),[e]),{paused:t,takeFocus:(0,d.useCallback)(()=>{te(e),n(!1)},[e])}}var I=5236,L=.085,R=1,ie=60,ae=6.1,oe=5.6,se=.1,ce=1.6,le=10,ue=50,de=150,fe=10,pe=Math.floor(I*1.25),me=.145,he=2.618,ge=I,z=I,_e=1e3,ve=.12,B=44,ye=.618,be=.35,xe=3,Se=`600 12px ui-sans-serif,system-ui,-apple-system`,V={up:{x:0,y:-1},down:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0},none:{x:0,y:0}},H={up:`down`,down:`up`,left:`right`,right:`left`,none:`none`};function Ce(e,t,n){return e+(t-e)*n}function U(e,t){return(e-t+I)%I/I}function we(e){let t=Math.sin(Math.PI*e);return .78+.44*(t*t)}function Te(e){let t=e.toLowerCase();return t===`arrowup`||t===`w`?`up`:t===`arrowdown`||t===`s`?`down`:t===`arrowleft`||t===`a`?`left`:t===`arrowright`||t===`d`?`right`:`none`}function W(e,t,n){let r=Math.round(n),i=Math.round(t);return r<0||r>=e.length||i<0||i>=e[0].length?!1:e[r][i]!==1}function G(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function K(e,t){let n=e.x-t.x,r=e.y-t.y;return n*n+r*r}function Ee(){let e=Array.from({length:23},()=>Array(27).fill(1));((t,n,r,i)=>{for(let a=n;a0&&a<22&&n>0&&n<26&&(e[a][n]=0)})(1,1,25,21);for(let t=2;t<25;t++)e[5][t]=1,e[17][t]=1;for(let t=2;t<21;t++)e[t][4]=1,e[t][22]=1;for(let t=6;t<21;t++)e[11][t]=0;for(let t=4;t<19;t++)e[t][13]=0;for(let t=1;t<22;t++)for(let n=1;n<26;n++)e[t][n]===0&&(e[t][n]=2);for(let t of[{x:6,y:6},{x:20,y:6},{x:6,y:16},{x:20,y:16}])e[t.y][t.x]=3;for(let t of[{x:2,y:2},{x:24,y:2},{x:2,y:20},{x:24,y:20}])e[t.y]?.[t.x]!==1&&(e[t.y][t.x]=4);return e}function De(e){return{pos:{x:e.x,y:e.y},dir:`left`,next:`left`,speed:ae}}function q(e,t,n){return{pos:{x:e.x,y:e.y},dir:`left`,speed:oe,scatterTarget:n,mode:`chase`,frightUntil:0,color:t}}function Oe(e){let t=0;for(let n=0;n=.1||i>=.1)return!1;let a=0;return[`up`,`down`,`left`,`right`].forEach(t=>{W(e,n.x+V[t].x,n.y+V[t].y)&&a++}),a>=3}function Me(e,t){if(t.next===`none`||t.next===t.dir)return;if(t.next===H[t.dir]){t.dir=t.next;return}let n=G(t.pos),r=Math.abs(t.pos.x-n.x),i=Math.abs(t.pos.y-n.y);r>=.12||i>=.12||W(e,n.x+V[t.next].x,n.y+V[t.next].y)&&(t.pos.x=n.x,t.pos.y=n.y,t.dir=t.next)}function Ne(e,t,n,r,i){if(n===`none`)return;let a=V[n],o=t.x+a.x*r*i,s=t.y+a.y*r*i,c=e[0].length;if(o<-1){t.x=c+1;return}if(o>c+1){t.x=-1;return}if(W(e,Math.round(o),Math.round(s)))t.x=o,t.y=s;else{let e=G(t);t.x=e.x,t.y=e.y}}function Pe(e,t,n,r){let i=[`up`,`left`,`down`,`right`],a=n,o=1/0;for(let s of i){if(s===H[n])continue;let i=Math.round(t.x)+V[s].x,c=Math.round(t.y)+V[s].y;if(!W(e,i,c))continue;let l=K({x:i,y:c},r);l{let r=(0,d.useRef)(null),i=(0,d.useRef)(null),{paused:a,takeFocus:o}=re(`KaiMaze`),[s,c]=(0,d.useState)({w:0,h:0});(0,d.useEffect)(()=>{let e=r.current;if(!e)return;let t=new ResizeObserver(e=>{for(let t of e){let e=t.contentRect;c({w:e.width,h:e.height})}});return t.observe(e),()=>t.disconnect()},[]);let[l,u]=(0,d.useState)(e);(0,d.useEffect)(()=>u(e),[e]);let[f,p]=(0,d.useState)(()=>ke(1,performance.now())),m=(0,d.useRef)(performance.now()),[h,g]=(0,d.useState)(()=>{if(typeof window>`u`)return!1;let e=window.matchMedia?.(`(pointer: coarse)`)?.matches??!1,t=window.matchMedia?.(`(max-width: 900px)`)?.matches??!1;return e||t});(0,d.useEffect)(()=>{if(typeof window>`u`)return;let e=window.matchMedia(`(pointer: coarse)`),t=window.matchMedia(`(max-width: 900px)`),n=()=>g(e.matches||t.matches);return e.addEventListener?.(`change`,n),t.addEventListener?.(`change`,n),()=>{e.removeEventListener?.(`change`,n),t.removeEventListener?.(`change`,n)}},[]);let _=(0,d.useMemo)(()=>e=>Math.floor(_e*(1+ve*(e-1))),[]),v=(0,d.useMemo)(()=>h&&!f.over,[h,f.over]),b=(0,d.useMemo)(()=>(h?`Tap/Swipe or D-pad`:`←↑→↓ / WASD`)+` · B/Space to Channel on ⟐ · Esc to exit`,[h]);(0,d.useEffect)(()=>{if(R>0&&l>=R){let e=l-R;u(e),t(e),o()}},[]);let x=()=>{p(e=>e.channelingUntil?{...e,channelingUntil:0}:e)};(0,d.useEffect)(()=>{let e=e=>{let t=e.key.toLowerCase(),r=Te(t);r!==`none`&&(x(),e.preventDefault(),o(),p(e=>({...e,player:{...e.player,next:r}}))),(t===`b`||t===` `)&&f.onAltar&&f.channelingUntil===0&&(o(),p(e=>({...e,channelingUntil:performance.now()+z}))),t===`escape`&&n&&n(),t===`r`&&f.over&&(o(),p(ke(1,performance.now())),m.current=performance.now())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,f.over,f.onAltar,f.channelingUntil]);let S=e=>{x(),o(),p(t=>({...t,player:{...t.player,next:e}}))},C=()=>{f.onAltar&&f.channelingUntil===0&&(o(),p(e=>({...e,channelingUntil:performance.now()+z})))};(0,d.useEffect)(()=>{let e=0,n=performance.now(),r=(e,n)=>{if(n.channelingUntil===0||!n.onAltar||e0){let e=Math.floor(a*r),i=Math.max(0,n.bankable-e),o=l+a;return u(o),t(o),{...n,scorePhi:n.scorePhi+a,bankable:i,points:i,kaiCharge:Math.max(0,Math.floor(n.kaiCharge*.5)),channelingUntil:0}}return{...n,channelingUntil:0}},i=()=>{e=requestAnimationFrame(i);let o=performance.now(),s=Math.min(1/ie,(o-n)/1e3);n=o,!a&&p(e=>{if(e.over)return e;let n=structuredClone(e);if(o>=n.cycle.nextSwitchAt){let e=n.cycle.phase===`chase`?`scatter`:`chase`;n.cycle={phase:e,nextSwitchAt:o+Ae(n.level,e)};for(let t of n.ghosts)t.mode!==`fright`&&(t.mode=e)}let i=U(o,m.current),a=we(i),c=Math.min(1+n.streak*se,ce),d=Math.min(1+n.streak*me,he),f=n.channelingUntil>0?0:n.player.speed*a*c;Me(n.grid,n.player),Ne(n.grid,n.player.pos,n.player.dir,f,s);let p=G(n.player.pos);n.onAltar=n.grid[p.y]?.[p.x]===4;let h=n.grid[p.y]?.[p.x]??1;if((h===2||h===3)&&n.channelingUntil===0){let e=Math.abs(i-.5)<=L,t=h===2?le:ue;if(e&&(t+=fe,n.kaiCharge=Math.min(B,n.kaiCharge+1)),t=Math.floor(t*d),n.points+=t,n.bankable=n.points,n.streak+=1,n.streak>n.bestStreak&&(n.bestStreak=n.streak),n.comboUntil=o+pe,n.grid[p.y][p.x]=0,n.pellets=Math.max(0,n.pellets-1),h===3){m.current=o;let e=Math.max(ge*Math.max(.55,1-(n.level-1)*.08),I*.5);for(let t of n.ghosts)t.mode=`fright`,t.frightUntil=o+e}}n.comboUntil>0&&o>n.comboUntil&&(n.streak=Math.max(0,Math.floor(n.streak*.5)),n.comboUntil=0);for(let e of n.ghosts){e.mode===`fright`&&o>=e.frightUntil&&(e.mode=n.cycle.phase);let t=G(n.player.pos);if(je(n.grid,e.pos))if(e.mode===`scatter`)e.dir=Pe(n.grid,e.pos,e.dir,e.scatterTarget);else if(e.mode===`fright`){let r=G(e.pos),i=[`up`,`down`,`left`,`right`],a=e.dir,o=-1/0;for(let s of i){if(s===H[e.dir])continue;let i=r.x+V[s].x,c=r.y+V[s].y;if(!W(n.grid,i,c))continue;let l=K({x:i,y:c},t);l>o&&(o=l,a=s)}e.dir=a}else{let r={x:t.x+V[n.player.dir].x*2,y:t.y+V[n.player.dir].y*2};e.dir=Pe(n.grid,e.pos,e.dir,r)}let r=e.mode===`fright`?Ce(.6,.8,Math.sin(i*Math.PI)):a,c=e.speed*r;if(c*=1.06**(n.level-1),Ne(n.grid,e.pos,e.dir,c,s),K(n.player.pos,e.pos)<.4)if(e.mode===`fright`&&n.channelingUntil===0){let t=Math.floor(de*d);n.points+=t,n.bankable=n.points,n.streak+=1,n.streak>n.bestStreak&&(n.bestStreak=n.streak),n.comboUntil=o+pe,e.pos={...e.scatterTarget},e.dir=`left`,e.mode=`scatter`,e.frightUntil=0}else if(--n.lives,n.streak=0,n.comboUntil=0,n.points=Math.max(0,Math.floor(n.points*(1-be))),n.bankable=n.points,n.channelingUntil=0,n.lives<=0)n.alive=!1,n.over=!0;else{let e={x:Math.floor(n.grid[0].length/2),y:n.grid.length-4};n.player.pos={...e},n.player.dir=`left`,n.player.next=`left`;for(let e of n.ghosts)e.mode=`scatter`;m.current=o}}if(n.pellets<=0&&!n.over){let e=_(n.level),r=Math.floor(n.bankable*.2/e);if(r>0){let i=r*e,a=Math.max(0,n.bankable-i),o=l+r;u(o),t(o),n.scorePhi+=r,n.bankable=a,n.points=a}let i=ke(n.level+1,o);i.scorePhi=n.scorePhi,i.lives=Math.max(1,n.lives),i.bestStreak=Math.max(n.bestStreak,n.streak),i.player.speed=n.player.speed*1.06;for(let e of i.ghosts)e.speed*=1.06;return m.current=o,i}return n=r(o,n),n})};return e=requestAnimationFrame(i),()=>cancelAnimationFrame(e)},[t,l,a,_]),(0,d.useEffect)(()=>{let e=0,t=()=>{e=requestAnimationFrame(t);let n=i.current,o=r.current;if(!n||!o)return;let c=n.getContext(`2d`);if(!c)return;let u=Math.max(0,s.w),d=Math.max(0,s.h);if(u===0||d===0)return;let p=Math.min(2,window.devicePixelRatio||1);(n.width!==Math.floor(u*p)||n.height!==Math.floor(d*p))&&(n.width=Math.floor(u*p),n.height=Math.floor(d*p),n.style.width=`${u}px`,n.style.height=`${d}px`),c.setTransform(p,0,0,p,0,0);let h=f.grid.length,g=f.grid[0].length,_=Math.floor(Math.min(u/g,d/h)),v=_*g,y=_*h,b=Math.floor((u-v)/2),x=Math.floor((d-y)/2),S=c.createLinearGradient(0,0,0,d);S.addColorStop(0,`#07071a`),S.addColorStop(1,`#0c1231`),c.fillStyle=S,c.fillRect(0,0,u,d),Be(c,u,d);for(let e=0;e0&&f.onAltar){let e=1-Math.max(0,f.channelingUntil-w)/z,t=u/2;c.strokeStyle=`rgba(0,255,208,0.9)`,c.lineWidth=4,c.globalAlpha=.9,c.beginPath(),c.arc(t,34,16,-Math.PI/2,-Math.PI/2+e*Math.PI*2),c.stroke(),c.globalAlpha=1,c.font=`700 12px ui-sans-serif,system-ui,-apple-system`,c.fillText(`Channeling…`,t+16+8,38)}if(a&&!f.over){c.fillStyle=`rgba(0,0,0,0.35)`,c.fillRect(0,0,u,d),c.fillStyle=`#fff`,c.font=`700 16px ui-sans-serif,system-ui,-apple-system`;let e=`Paused — another Realm is active`;c.fillText(e,(u-c.measureText(e).width)/2,d/2)}if(f.over){c.fillStyle=`rgba(0,0,0,0.55)`,c.fillRect(0,0,u,d),c.fillStyle=`#fff`,c.font=`700 20px ui-sans-serif,system-ui,-apple-system`;let e=`Game Over — Press R to restart`;c.fillText(e,(u-c.measureText(e).width)/2,d/2)}};return e=requestAnimationFrame(t),()=>cancelAnimationFrame(e)},[f,l,s,a]);let w=f.onAltar&&f.channelingUntil===0;return(0,y.jsxs)(`div`,{className:`km-wrap`,role:`group`,"aria-label":`Kai-Maze`,onPointerDown:()=>o(),onTouchStart:()=>o(),onMouseDown:()=>o(),children:[(0,y.jsxs)(`div`,{className:`km-header`,children:[(0,y.jsx)(`div`,{className:`km-title`,children:`🌀 Kai-Maze`}),(0,y.jsx)(`div`,{className:`km-sub`,children:`Score on pulse, risk your points, then ⟐ channel to mint Φ.`})]}),(0,y.jsxs)(`div`,{className:`km-stage`,ref:r,children:[(0,y.jsx)(`canvas`,{ref:i,className:`km-canvas`}),v&&(0,y.jsxs)(`div`,{className:`km-dpad`,style:{position:`absolute`,left:12,bottom:12,width:132,height:132,display:`grid`,gridTemplateColumns:`repeat(3, 1fr)`,gridTemplateRows:`repeat(3, 1fr)`,gap:6,touchAction:`none`,userSelect:`none`,zIndex:4},"aria-label":`Directional pad`,children:[(0,y.jsx)(`div`,{}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:J,"aria-label":`Move up`,onPointerDown:e=>{e.preventDefault(),S(`up`)},children:`▲`}),(0,y.jsx)(`div`,{}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:J,"aria-label":`Move left`,onPointerDown:e=>{e.preventDefault(),S(`left`)},children:`◀`}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:{...J,opacity:.9},"aria-label":`Hold to Channel (if on altar)`,onPointerDown:e=>{e.preventDefault(),C()},title:`Channel one breath to convert points → Φ`,children:`⟐`}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:J,"aria-label":`Move right`,onPointerDown:e=>{e.preventDefault(),S(`right`)},children:`▶`}),(0,y.jsx)(`div`,{}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:J,"aria-label":`Move down`,onPointerDown:e=>{e.preventDefault(),S(`down`)},children:`▼`}),(0,y.jsx)(`div`,{})]}),w&&(0,y.jsx)(`button`,{className:`km-chan-btn`,onClick:()=>{o(),p(e=>e.channelingUntil?e:{...e,channelingUntil:performance.now()+z})},"aria-label":`Channel points into Phi`,title:`Channel one breath to convert points → Φ`,children:`⟐ CHANNEL`}),f.channelingUntil>0&&(0,y.jsx)(`button`,{className:`km-chan-cancel`,onClick:()=>{o(),p(e=>({...e,channelingUntil:0}))},"aria-label":`Cancel channeling`,title:`Cancel`,children:`Cancel`})]}),(0,y.jsxs)(`div`,{className:`km-footer`,children:[(0,y.jsx)(`button`,{className:`km-btn`,onClick:n,title:`Back`,children:`Back`}),(0,y.jsx)(`div`,{className:`km-hint`,children:b})]})]})};function Ie(e,t,n,r,i){e.save(),e.fillStyle=i,e.beginPath(),e.arc(t,n,r,0,Math.PI*2),e.fill(),e.strokeStyle=`rgba(255,255,255,0.35)`,e.lineWidth=1.25,e.stroke(),e.restore()}function Le(e,t,n,r,i){e.save(),e.fillStyle=i,e.beginPath(),e.arc(t,n,r,Math.PI,0),e.lineTo(t+r,n+r*.85),e.lineTo(t-r,n+r*.85),e.closePath(),e.fill(),e.fillStyle=`#fff`,e.beginPath(),e.arc(t-r*.35,n-r*.15,r*.16,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(t+r*.35,n-r*.15,r*.16,0,Math.PI*2),e.fill(),e.fillStyle=`rgba(0,0,0,0.7)`,e.beginPath(),e.arc(t-r*.3,n-r*.15,r*.08,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(t+r*.3,n-r*.15,r*.08,0,Math.PI*2),e.fill(),e.restore()}function Re(e,t,n){let r=Math.min(460,Math.max(220,t*.5)),i=t/2,a=r/2;e.save(),e.globalAlpha=.35,e.strokeStyle=`rgba(0,255,208,.6)`,e.lineWidth=2,e.beginPath(),e.moveTo(i-a,20),e.lineTo(i+a,20),e.stroke();let o=ze(r*L*2);e.globalAlpha=.2,e.fillStyle=`#ffd36e`,e.fillRect(i-o,17,o*2,6),e.globalAlpha=.9,e.fillStyle=`#00ffd0`;let s=i-a+n*r;e.beginPath(),e.arc(s,20,4,0,Math.PI*2),e.fill(),e.restore()}function ze(e){return e/2}function Be(e,t,n){e.save(),e.globalAlpha=.08,e.strokeStyle=`rgba(255,255,255,0.15)`,e.lineWidth=1;let r=t/2,i=n/2,a=(1+Math.sqrt(5))/2,o=4;for(let s=0;s<8;s++){let s=Math.min(t,n)/o;e.beginPath(),e.arc(r,i,s,-Math.PI/2,Math.PI),e.stroke(),o*=a}e.restore()}var J={background:`linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04))`,border:`1px solid rgba(255,255,255,0.25)`,borderRadius:10,color:`rgba(255,255,255,0.9)`,fontSize:18,lineHeight:1,padding:0,display:`flex`,alignItems:`center`,justifyContent:`center`,minWidth:36,minHeight:36,touchAction:`none`};(()=>{let e=Array.from({length:31},()=>Array.from({length:28},()=>2));for(let t=0;t<28;t++)e[0][t]=1,e[30][t]=1;for(let t=0;t<31;t++)e[t][0]=1,e[t][27]=1;for(let t=4;t<24;t+=6)for(let n=4;n<27;n+=6)e[n][t]=1,e[n][t+1]=1,e[n+1][t]=1,e[n+1][t+1]=1;for(let t=2;t<26;t++)e[15][t]=0;e[1][1]=3,e[1][26]=3,e[29][1]=3,e[29][26]=3;for(let t=2;t<29;t++)e[t][14]=0;for(let t=2;t<26;t++)e[11][t]=0;return e})();var Ve=5236,Y=3,He=Y*2,Ue=2,We=.15,Ge=220,Ke=60,qe=20;function Je(e){return(Math.imul(e^2654435769,2654435761)>>>0)%1e5/1e5}function Ye(e,t){let n=Math.abs(e-t)%360;return n>180&&(n=360-n),n}var Xe=({currentPhi:e,onPhiChange:t})=>{let[n,r]=(0,d.useState)(`forge`),[i,a]=(0,d.useState)(null),[o,s]=(0,d.useState)(performance.now()),[c,l]=(0,d.useState)(0),[u,f]=(0,d.useState)(!1),[p,m]=(0,d.useState)(null),[h,g]=(0,d.useState)(0);ee({onPulse:e=>{a(e),s(performance.now()),m(e=>e&&{...e,delta:e.delta})}}),(0,d.useEffect)(()=>{if(n!==`forge`)return;let e=0,t=!0,r=()=>{if(!t)return;let n=performance.now();l(Math.max(0,n-o)%Ve/Ve*360%360),e=requestAnimationFrame(r)};return e=requestAnimationFrame(r),()=>{t=!1,cancelAnimationFrame(e)}},[o,n]);let _=(0,d.useMemo)(()=>{let e=i??0,t=Math.floor(Je(e)*360),n=Ke+(e%2==0?qe:0)-Math.min(20,Math.floor(h*6));return{centerDeg:t,halfWidthDeg:Math.max(10,n/2)}},[i,h]),v=(0,d.useMemo)(()=>n===`forge`&&!u&&e>=Y&&i!==null,[n,u,e,i]),b=(0,d.useCallback)(e=>{let t=He,n=1+h*We,r=e?Ue:1;return Math.floor(t*n*r)},[h]),x=(0,d.useCallback)(()=>{if(!v)return;let n=e-Y;t(n),f(!0),m(null);let r=Ye(c,_.centerDeg),i=Math.max(4,_.halfWidthDeg*.25),a=r<=_.halfWidthDeg,o=a&&r<=i;window.setTimeout(()=>{if(a){let e=b(o);t(n+e),g(e=>e+1),m({kind:o?`crit`:`hit`,delta:e})}else g(0),m({kind:`miss`,delta:-Y});f(!1)},650)},[v,e,t,c,_.centerDeg,_.halfWidthDeg,b]);return(0,d.useEffect)(()=>{if(n!==`forge`)return;let e=e=>{let t=e.key.toLowerCase();(t===` `||t===`enter`)&&(e.preventDefault(),x())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,x]),(0,y.jsx)(`div`,{className:`pf-wrap`,role:`group`,"aria-label":`Pulse Forge`,children:n===`forge`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`pf-header`,children:[(0,y.jsx)(`div`,{className:`pf-title`,children:`⚒️ Pulse Forge`}),(0,y.jsx)(`div`,{className:`pf-sub`,children:`Time your lock to the target arc. Breathe, focus, forge.`}),(0,y.jsx)(`div`,{style:{marginLeft:`auto`,display:`flex`,gap:8},children:(0,y.jsx)(`button`,{type:`button`,className:`pf-lock-btn`,onClick:()=>r(`maze`),title:`Switch to Kai-Maze`,children:`Play Kai-Maze`})})]}),(0,y.jsxs)(`div`,{className:`pf-board`,children:[(0,y.jsxs)(`div`,{className:`pf-dial`,style:{width:Ge,height:Ge},children:[(0,y.jsx)(`div`,{className:`pf-arc`,style:{"--arc-center":`${_.centerDeg}deg`,"--arc-half":`${_.halfWidthDeg}deg`},"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`pf-marker ${u?`pf-marker--lock`:``}`,style:{transform:`rotate(${c}deg)`},"aria-hidden":!0,children:(0,y.jsx)(`div`,{className:`pf-marker-head`})}),(0,y.jsx)(`div`,{className:`pf-rim`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`pf-ticks`,"aria-hidden":!0,children:Array.from({length:12}).map((e,t)=>(0,y.jsx)(`span`,{style:{transform:`rotate(${t*30}deg)`}},t))})]}),(0,y.jsxs)(`div`,{className:`pf-hud`,children:[(0,y.jsxs)(`div`,{className:`pf-chip`,title:`Your Φ`,children:[(0,y.jsx)(`span`,{className:`pf-chip__label`,children:`Φ`}),(0,y.jsx)(`span`,{className:`pf-chip__val`,children:e})]}),(0,y.jsxs)(`div`,{className:`pf-chip`,title:`Streak`,children:[(0,y.jsx)(`span`,{className:`pf-chip__label`,children:`Streak`}),(0,y.jsx)(`span`,{className:`pf-chip__val`,children:h})]}),(0,y.jsxs)(`div`,{className:`pf-chip`,title:`Pulse`,children:[(0,y.jsx)(`span`,{className:`pf-chip__label`,children:`Pulse`}),(0,y.jsx)(`span`,{className:`pf-chip__val`,children:i??`—`})]})]})]}),(0,y.jsxs)(`div`,{className:`pf-cta`,children:[(0,y.jsx)(`button`,{className:`pf-lock-btn`,onClick:x,disabled:!v,"aria-disabled":!v,title:v?`Press Space/Enter to Lock`:`Insufficient Φ or syncing…`,children:u?`Locking…`:`Lock (−${Y} Φ)`}),(0,y.jsxs)(`div`,{className:`pf-hint`,children:[`Press `,(0,y.jsx)(`kbd`,{children:`Space`}),` or `,(0,y.jsx)(`kbd`,{children:`Enter`}),` at the right moment. Even pulses widen the target.`]})]}),p&&(0,y.jsxs)(`div`,{className:`pf-result pf-result--${p.kind}`,role:`status`,"aria-live":`polite`,children:[p.kind===`hit`&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:`pf-result__emoji`,children:`✅`}),(0,y.jsxs)(`span`,{className:`pf-result__text`,children:[`Resonant lock! +`,p.delta,` Φ`]})]}),p.kind===`crit`&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:`pf-result__emoji`,children:`💥`}),(0,y.jsxs)(`span`,{className:`pf-result__text`,children:[`Perfect lock! +`,p.delta,` Φ`]})]}),p.kind===`miss`&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:`pf-result__emoji`,children:`❌`}),(0,y.jsx)(`span`,{className:`pf-result__text`,children:`Miss — breathe again.`})]})]})]}):(0,y.jsx)(Fe,{currentPhi:e,onPhiChange:t,onExit:()=>r(`forge`)})})};function Ze(){return`kai-${Math.random().toString(36).slice(2,8)}`}function Qe(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.x==`number`&&typeof t.pulseIndex==`number`&&typeof t.chakraDay==`string`&&typeof t.glyph==`object`&&t.glyph!==null}var $e=null;async function et(){return $e||($e=(await r(()=>import(`./bundler-IMYm8BQv.js`),__vite__mapDeps([0,1,2]))).default,$e)}function tt(e){let[t]=(0,d.useState)(()=>e??Ze()),[n,r]=(0,d.useState)([]),[i,a]=(0,d.useState)([]),o=(0,d.useRef)(null),s=(0,d.useRef)({}),c=(0,d.useCallback)((e,t)=>{if(!Qe(t))return;let n={...t,id:e,glyph:t.glyph};a(t=>{let r=t.findIndex(t=>t.id===e);if(r>=0){let e=[...t];return e[r]=n,e}return[...t,n]})},[]),l=(0,d.useCallback)((e,t)=>{Qe(e)&&c(t,e)},[c]);return(0,d.useEffect)(()=>{let e=!1;return(async()=>{let n=await et();if(e)return;let i=new n(t);o.current=i,i.on(`open`,()=>{r(e=>e)}),i.on(`connection`,e=>{s.current[e.peer]=e,r(t=>Array.from(new Set([...t,e.peer]))),e.on(`data`,t=>{l(t,e.peer)}),e.on(`close`,()=>{delete s.current[e.peer],r(t=>t.filter(t=>t!==e.peer)),a(t=>t.filter(t=>t.id!==e.peer))})})})().catch(e=>{console.error(`[KaiRealms] Peer init failed:`,e)}),()=>{e=!0;try{o.current?.destroy()}catch(e){console.warn(`[KaiRealms] Peer destroy failed:`,e)}o.current=null,s.current={},r([]),a([])}},[t,l]),{sessionId:t,peers:n,sendState:(0,d.useCallback)(e=>{let t=Object.values(s.current);for(let n of t)n.open&&n.send(e)},[]),remoteStates:i}}var nt=800,rt=500,it=nt/rt,X=28,Z=10,at=360,ot=10,Q=5236,st=.08,ct=22,lt=90,ut=80,dt=2,ft=4,pt=10,mt=3,ht=1,gt=3,_t=1,vt=1,$=(e,t,n)=>en?n:e,yt=({glyphData:e,onExit:t})=>{let n=(0,d.useRef)(null),r=(0,d.useRef)(null),i=(0,d.useRef)(null),[a,o]=(0,d.useState)({w:nt,h:rt}),s=(0,d.useRef)(a);(0,d.useEffect)(()=>{s.current=a},[a]);let[c,l]=(0,d.useState)(0),[u,f]=(0,d.useState)(0),[p,m]=(0,d.useState)(!1),[h,g]=(0,d.useState)(mt),[_,v]=(0,d.useState)(0),[b,x]=(0,d.useState)(0),[S,C]=(0,d.useState)(!1),w=(0,d.useRef)(performance.now()),{sendState:T,remoteStates:E}=tt(),D=(0,d.useRef)([]);(0,d.useEffect)(()=>{D.current=E??[]},[E]);let O=(0,d.useRef)(nt/2),k=(0,d.useRef)([]),A=(0,d.useRef)({}),j=(0,d.useRef)(null),M=(0,d.useRef)(null),N=(0,d.useRef)(null),P=(0,d.useRef)(0),te=(0,d.useRef)(0),F=(0,d.useRef)(null);(0,d.useEffect)(()=>{let e=n.current;if(!e)return;let t=new ResizeObserver(e=>{let t=e[0].contentRect,n=Math.max(320,Math.min(960,t.width));o({w:n,h:Math.round(n/it)})});return t.observe(e),()=>t.disconnect()},[]),(0,d.useEffect)(()=>{let e=r.current;if(!e)return;let t=e.getContext(`2d`);if(!t)return;let n=Math.min(2,window.devicePixelRatio||1);e.style.width=`${a.w}px`,e.style.height=`${a.h}px`,e.width=Math.floor(a.w*n),e.height=Math.floor(a.h*n),t.setTransform(n,0,0,n,0,0),i.current=t,O.current=$(O.current,X,a.w-X)},[a]),(0,d.useEffect)(()=>{let e=e=>{A.current[e.key]=!0,e.key.toLowerCase()===`p`&&m(e=>!e),e.key.toLowerCase()===`r`&&S&&R()},t=e=>{A.current[e.key]=!1};return window.addEventListener(`keydown`,e),window.addEventListener(`keyup`,t),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`keyup`,t)}},[S]),(0,d.useEffect)(()=>{let e=r.current;if(!e)return;let t=t=>{let n=e.getBoundingClientRect();return $((t-n.left)/n.width*s.current.w,X,s.current.w-X)},n=!1,i=e=>{n=!0,O.current=t(e.clientX)},a=e=>{n&&(O.current=t(e.clientX))},o=()=>{n=!1};return e.addEventListener(`pointerdown`,i),e.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o),()=>{e.removeEventListener(`pointerdown`,i),e.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o)}},[]);let ne=e=>Math.max(0,e-w.current)%Q/Q,re=e=>{let t=Math.sin(Math.PI*e);return .65+.7*(t*t)},I=e=>{let{w:t}=s.current,n=performance.now(),r=Math.random()*(t-2*Z)+Z,i=-Z*2,a=(Math.random()-.5)*40,o=(e===`gold`?ut:lt)+_*(pt*.2),c={id:`${e}-${n}-${Math.floor(Math.random()*1e6)}`,x:r,y:i,vx:a,baseVy:o,kind:e,bornAt:n},l=k.current.slice(-(ct-1));l.push(c),k.current=l};ee({onPulse:e=>{f(e),w.current=performance.now(),te.current+=1;for(let e=0;e{let n=N.current,r=O.current,i=u;if(!n||Math.abs(n.x-r)>=1||n.pulseIndex!==i||t-P.current>1e3/ot){N.current={x:r,pulseIndex:i},P.current=t;try{T({id:`you`,x:r,pulseIndex:i,chakraDay:e.meta.chakraDay,glyph:e})}catch{}}};(0,d.useEffect)(()=>{let t=r.current,n=i.current;if(!t||!n)return;let a=!0,o=t=>{if(!a)return;j.current=requestAnimationFrame(o);let r=M.current??t,i=Math.min(.05,(t-r)/1e3);M.current=t;let{w:c,h:u}=s.current,d=u-X-10;if(!p&&!S){let e=A.current,n=!!(e.ArrowLeft||e.a||e.A),r=!!(e.ArrowRight||e.d||e.D);n&&(O.current=$(O.current-at*i,X,c-X)),r&&(O.current=$(O.current+at*i,X,c-X));let a=O.current,o=performance.now(),s=ne(o),f=re(s),p=[],m=0,h=0,y=0;for(let e=0;ec-Z&&(t.x=c-Z,t.vx=-Math.abs(t.vx)*.9);let r=t.x-a,l=t.y-d;if(Math.hypot(r,l)u+Z){y+=1;continue}p.push(t)}if(m>0||h>0){let e=m+h;l(t=>t+e),v(e=>{let t=e+1;return x(e=>t>e?t:e),t})}y>0&&(l(e=>Math.max(0,e-ht*y)),v(0),g(e=>{let t=Math.max(0,e-y);return t===0&&C(!0),t})),k.current=p,L(t)}bt(n,e,O.current,d,p||S,k.current,D.current,s.current,w.current,F.current)};return j.current=requestAnimationFrame(o),()=>{a=!1,j.current!==null&&cancelAnimationFrame(j.current),j.current=null,M.current=null}},[e,p,S,a.w,a.h]);let R=()=>{k.current=[],g(mt),v(0),x(e=>e),C(!1)},ie=(0,d.useMemo)(()=>({pulse:u,chakraDay:e?.meta?.chakraDay??`—`}),[u,e?.meta?.chakraDay]);return(0,y.jsxs)(`div`,{className:`realm-wrap`,ref:n,children:[(0,y.jsxs)(`div`,{className:`realm-hud`,children:[(0,y.jsxs)(`div`,{className:`hud-chip hud-chip--score`,title:`Banked Φ`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Φ`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:c})]}),(0,y.jsxs)(`div`,{className:`hud-chip`,title:`Streak`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Streak`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:_})]}),(0,y.jsxs)(`div`,{className:`hud-chip`,title:`Lives`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Lives`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:h})]}),(0,y.jsxs)(`div`,{className:`hud-chip`,title:`Current Pulse`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Pulse`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:ie.pulse})]}),(0,y.jsxs)(`div`,{className:`hud-chip`,title:`Chakra Day`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Day`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:ie.chakraDay})]}),(0,y.jsx)(`button`,{className:`hud-button`,onClick:()=>m(e=>!e),"aria-pressed":p,title:`Pause (P)`,children:p?`Resume`:`Pause`})]}),(0,y.jsxs)(`div`,{className:`realm-canvas-wrap`,children:[(0,y.jsx)(`canvas`,{ref:r,className:`realm-canvas`,"aria-label":`Kai Realms Canvas`}),(p||S)&&(0,y.jsx)(`div`,{className:`realm-pause-overlay`,"aria-hidden":!0,children:(0,y.jsxs)(`div`,{className:`pause-card`,children:[(0,y.jsx)(`div`,{className:`pause-title`,children:S?`Game Over`:`Paused`}),(0,y.jsx)(`div`,{className:`pause-sub`,children:S?(0,y.jsxs)(y.Fragment,{children:[`Best Streak: `,(0,y.jsx)(`strong`,{children:b}),` — Press `,(0,y.jsx)(`kbd`,{children:`R`}),` to Restart`]}):(0,y.jsxs)(y.Fragment,{children:[`Press `,(0,y.jsx)(`kbd`,{children:`P`}),` or click Resume`]})}),S&&(0,y.jsx)(`button`,{className:`hud-button`,onClick:R,style:{marginTop:12},children:`Restart`})]})})]}),(0,y.jsx)(Xe,{currentPhi:c,onPhiChange:e=>l(e)}),(0,y.jsx)(`button`,{className:`exit-button`,onClick:t,children:`Exit Realm`})]})};function bt(e,t,n,r,i,a,o,s,c,l){let{w:u,h:d}=s,f=e.createLinearGradient(0,0,0,d);f.addColorStop(0,`#020211`),f.addColorStop(1,`#0b0f2a`),e.fillStyle=f,e.fillRect(0,0,u,d),e.save(),e.globalAlpha=.12;for(let t=0;t<40;t++){let n=t*197%u+t%3,r=t*127%d+t*11%7;e.fillStyle=`white`,e.fillRect(n,r,2,2)}e.restore(),xt(e,u,Math.max(36,Math.round(d*.06)),c);for(let t=0;t{let[n,r]=(0,d.useState)(null),i=(0,d.useRef)(null),a=(0,d.useRef)(null),o=(0,d.useCallback)(e=>r(e),[]),s=(0,d.useCallback)(()=>{r(null),t?.()},[t]);(0,d.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t?.()};return document.addEventListener(`keydown`,e),a.current?.focus(),()=>document.removeEventListener(`keydown`,e)},[t]),(0,d.useEffect)(()=>{let e=i.current;if(!e)return;let t=e=>e.stopPropagation();return e.addEventListener(`wheel`,t,{passive:!0}),()=>e.removeEventListener(`wheel`,t)},[]);let c=()=>t?.(),l=e=>e.stopPropagation();return(0,y.jsxs)(`div`,{className:`realms-backdrop realms-veil`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`kai-realms-title`,onMouseDown:c,children:[(0,y.jsx)(`div`,{className:`realms-stars`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`realms-halo realms-halo--1`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`realms-halo realms-halo--2`,"aria-hidden":!0}),(0,y.jsxs)(`div`,{ref:i,className:`realms-container glass-omni`,onMouseDown:l,role:`document`,children:[(0,y.jsx)(`div`,{className:`breath-ring breath-ring--outer`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`breath-ring breath-ring--inner`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`phi-grid`,"aria-hidden":!0}),(0,y.jsxs)(`header`,{className:`realms-header`,children:[(0,y.jsx)(`button`,{ref:a,type:`button`,className:`realms-close auric-btn`,"aria-label":`Close Kai Realms`,onClick:e=>{e.stopPropagation(),t?.()},onMouseDown:e=>e.stopPropagation(),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),t?.())},children:(0,y.jsx)(e,{size:20,"aria-hidden":!0})}),(0,y.jsx)(`div`,{className:`header-seals`,"aria-hidden":!0,children:(0,y.jsxs)(`div`,{className:`seal-emblem`,children:[(0,y.jsx)(`div`,{className:`seal-ring`}),(0,y.jsx)(`div`,{className:`seal-ring seal-ring--inner`}),(0,y.jsx)(`div`,{className:`seal-core`})]})}),(0,y.jsx)(`h2`,{id:`kai-realms-title`,className:`sr-only`,children:`Kai Realms — Sigil Gate`})]}),(0,y.jsx)(`main`,{className:`realms-body`,children:n?(0,y.jsx)(`div`,{className:`realm-stage`,children:(0,y.jsx)(yt,{glyphData:n,onExit:s})}):(0,y.jsx)(`div`,{className:`portal-stage`,children:(0,y.jsx)(x,{onEnter:o})})}),(0,y.jsx)(`footer`,{className:`realms-footer`,"aria-hidden":!0,children:(0,y.jsx)(`div`,{className:`footer-center`,style:{margin:`0 auto`},children:(0,y.jsx)(wt,{})})})]})]})};function wt(){return(0,y.jsxs)(`svg`,{className:`seal-coin`,width:`56`,height:`56`,viewBox:`0 0 56 56`,"aria-hidden":!0,children:[(0,y.jsxs)(`defs`,{children:[(0,y.jsxs)(`radialGradient`,{id:`coinGlowRealms`,cx:`50%`,cy:`50%`,r:`50%`,children:[(0,y.jsx)(`stop`,{offset:`0%`,stopColor:`#ffffff`,stopOpacity:`0.9`}),(0,y.jsx)(`stop`,{offset:`40%`,stopColor:`#ffd86b`,stopOpacity:`0.75`}),(0,y.jsx)(`stop`,{offset:`100%`,stopColor:`#ffd86b`,stopOpacity:`0.15`})]}),(0,y.jsxs)(`linearGradient`,{id:`coinEdgeRealms`,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,y.jsx)(`stop`,{offset:`0%`,stopColor:`#00ffd0`,stopOpacity:`0.8`}),(0,y.jsx)(`stop`,{offset:`100%`,stopColor:`#8a2be2`,stopOpacity:`0.8`})]})]}),(0,y.jsx)(`circle`,{cx:`28`,cy:`28`,r:`26`,fill:`url(#coinGlowRealms)`,stroke:`url(#coinEdgeRealms)`,strokeWidth:`1.5`}),(0,y.jsxs)(`g`,{className:`seal-coin__rotor`,children:[(0,y.jsx)(`circle`,{cx:`28`,cy:`28`,r:`18`,fill:`none`,stroke:`url(#coinEdgeRealms)`,strokeWidth:`1.25`}),(0,y.jsxs)(`g`,{stroke:`rgba(255,255,255,0.35)`,strokeWidth:`0.6`,children:[(0,y.jsx)(`line`,{x1:`28`,y1:`10`,x2:`28`,y2:`46`}),(0,y.jsx)(`line`,{x1:`10`,y1:`28`,x2:`46`,y2:`28`}),(0,y.jsx)(`line`,{x1:`15`,y1:`15`,x2:`41`,y2:`41`}),(0,y.jsx)(`line`,{x1:`41`,y1:`15`,x2:`15`,y2:`41`})]})]}),(0,y.jsx)(`circle`,{className:`seal-coin__core`,cx:`28`,cy:`28`,r:`6.5`})]})}export{Ct as default}; \ No newline at end of file diff --git a/dist/assets/KaiVohApp-BMb9vr72.js b/dist/assets/KaiVohApp-D1B_NOm4.js similarity index 99% rename from dist/assets/KaiVohApp-BMb9vr72.js rename to dist/assets/KaiVohApp-D1B_NOm4.js index c737c533..90842efa 100644 --- a/dist/assets/KaiVohApp-BMb9vr72.js +++ b/dist/assets/KaiVohApp-D1B_NOm4.js @@ -1,4 +1,4 @@ -import{$ as e,$t as t,A as n,D as r,E as i,En as a,F as o,Ht as s,K as c,M as l,N as u,O as d,P as f,Q as p,T as m,Tn as h,Z as g,_n as _,at as v,ct as y,dt as b,en as x,fn as ee,ft as S,gn as C,ht as w,j as T,jn as E,k as D,ln as O,lt as te,mn as k,nt as ne,ot as re,pn as A,pt as j,st as ie,tn as M,un as ae,ut as oe}from"./index-CcPm2yTY.js";import"./prop-types-CQ3MXKCa.js";import{n as se}from"./SigilAuthContext-CZfkVeGy.js";import{n as N,t as P}from"./sigilRegistry-NyXrDYsE.js";import{i as ce,r as le}from"./postSeal-ClZBwRbf.js";import{a as F,i as I,n as L,r as R,t as z}from"./VerifierFrame-Dr7oGdbu.js";var B=E(h(),1);const ue=(0,B.createContext)(void 0);var V=E(M(),1);function de({children:e}){let[t,n]=(0,B.useState)(null),r=(0,B.useMemo)(()=>({session:t,setSession:e=>n(e),clearSession:()=>n(null)}),[t]);return(0,V.jsx)(ue.Provider,{value:r,children:e})}function H(){let e=(0,B.useContext)(ue);if(!e)throw Error(`useSession must be used within a SessionProvider`);return e}var U=[`video/webm;codecs=vp9,opus`,`video/webm;codecs=vp8,opus`,`video/webm`,`video/mp4;codecs=h264,aac`,`video/mp4`],fe=typeof window<`u`&&`MediaRecorder`in window;async function pe(e){let t=await crypto.subtle.digest(`SHA-256`,e),n=new Uint8Array(t),r=``;for(let e=0;eW(),[]);function ne(){let e=typeof performance<`u`?performance:null,t=(e&&typeof e.timeOrigin==`number`?e.timeOrigin:NaN)+(e?e.now():NaN);return Number.isFinite(t)?Math.floor(t):Date.now()}(0,B.useEffect)(()=>{if(t)return(async()=>{s(null),l(!0);try{await re()}catch(e){s(e instanceof Error?e.message:`Failed to access camera.`)}finally{l(!1)}})(),()=>{A()}},[t,u,f]),(0,B.useEffect)(()=>{t&&j().catch(()=>_(!1))},[t,u]);async function re(){A();let e={audio:{echoCancellation:!0,noiseSuppression:!0},video:{facingMode:u,width:{ideal:1080},height:{ideal:1920},frameRate:{ideal:30,max:60}}},t=await navigator.mediaDevices.getUserMedia(e);C.current=t,w.current&&(w.current.srcObject=t,w.current.muted=!0,await w.current.play().catch(()=>{})),await ie(m&&g)}function A(){if(P(!0),w.current&&(w.current.pause(),w.current.srcObject=null),C.current)for(let e of C.current.getTracks())e.stop();C.current=null,h(!1),y(!1),x(0),S(0),O.current!==null&&(cancelAnimationFrame(O.current),O.current=null)}async function j(){let e=C.current;if(!e){_(!1);return}let[t]=e.getVideoTracks();if(!t){_(!1);return}let n=t.getCapabilities?.()??{};_(!!(typeof n.torch==`boolean`&&n.torch)&&u===`environment`)}async function ie(e){let t=C.current;if(!t)return;let[n]=t.getVideoTracks();if(!(!n||!n.applyConstraints))try{g&&u===`environment`&&await n.applyConstraints({advanced:[{torch:e}]})}catch{}}function M(){d(e=>e===`user`?`environment`:`user`)}function ae(){p(e=>!e)}async function oe(){if(!g)return;let e=!m;h(e),await ie(e)}function se(){if(!v)return;let e=performance.now()-D.current;if(S(e),x(Math.min(1,e/i)),e>=i){P(!1);return}O.current=requestAnimationFrame(se)}function N(){if(!fe){s(`MediaRecorder is not supported on this browser.`);return}if(v)return;s(null);let e=C.current;if(!e){s(`No camera stream.`);return}for(let t of e.getAudioTracks())t.enabled=!f;let t=te??``,n;try{n=t?new MediaRecorder(e,{mimeType:t,videoBitsPerSecond:35e5}):new MediaRecorder(e)}catch{n=new MediaRecorder(e)}T.current=n,E.current=[],n.ondataavailable=e=>{e.data&&e.data.size>0&&E.current.push(e.data)},n.onstop=()=>{ce()},n.start(250),y(!0),D.current=performance.now(),O.current=requestAnimationFrame(se)}function P(e){if(!v)return;let t=T.current;if(t){try{t.state!==`inactive`&&t.stop()}catch{}y(!1),O.current!==null&&(cancelAnimationFrame(O.current),O.current=null),e&&(E.current=[],x(0),S(0))}}async function ce(){let e=E.current;if(E.current=[],!e.length)return;let t=Math.max(0,Math.min(i,performance.now()-D.current)),n=T.current?.mimeType||te||`video/webm`,a=new Blob(e,{type:n}),o=ne(),s=k(BigInt(o)),{width:c,height:l,thumbnailDataUrl:u}=await le(a),d=await pe(await a.arrayBuffer()),f=`story_${s.toString()}.${n.includes(`mp4`)?`mp4`:`webm`}`;r({blob:a,file:new File([a],f,{type:n,lastModified:o}),mimeType:n,durationMs:t,width:c,height:l,thumbnailDataUrl:u,sha256:d,createdAt:o})}async function le(e){let t=URL.createObjectURL(e);try{let e=document.createElement(`video`);e.src=t,e.muted=!0,await e.play().catch(()=>void 0),await new Promise(t=>{let n=()=>{e.pause(),e.currentTime=0},r=()=>{n(),t()};e.onloadeddata=r,setTimeout(r,250)});let n=e.videoWidth||1080,r=e.videoHeight||1920,i=document.createElement(`canvas`);i.width=n,i.height=r;let a=i.getContext(`2d`);return a&&a.drawImage(e,0,0,n,r),{width:n,height:r,thumbnailDataUrl:i.toDataURL(`image/png`,.9)}}finally{URL.revokeObjectURL(t)}}function F(){v||N()}function I(){v&&P(!1)}function L(){v?P(!1):N()}return t?(0,V.jsxs)(`div`,{className:`story-rec-overlay`,role:`dialog`,"aria-modal":`true`,"aria-label":`Story recorder`,children:[(0,V.jsx)(`div`,{className:`story-rec-video-wrap`,children:(0,V.jsx)(`video`,{ref:w,className:`story-rec-video ${u===`user`?`mirror`:``}`,playsInline:!0})}),(0,V.jsxs)(`div`,{className:`story-rec-topbar`,children:[(0,V.jsx)(`button`,{type:`button`,className:`story-btn top left`,"aria-label":`Close`,onClick:()=>{A(),n()},children:`✕`}),(0,V.jsx)(`div`,{className:`story-top-center`,children:(0,V.jsxs)(`div`,{className:`story-timer mono`,children:[he(ee),` / `,he(i)]})}),(0,V.jsxs)(`div`,{className:`story-top-actions`,children:[(0,V.jsx)(`button`,{type:`button`,className:`story-btn ${f?`active`:``}`,"aria-pressed":f,"aria-label":f?`Unmute microphone`:`Mute microphone`,onClick:ae,title:f?`Unmute mic`:`Mute mic`,children:f?`🔇`:`🎙️`}),(0,V.jsx)(`button`,{type:`button`,className:`story-btn ${u===`environment`&&g?``:`disabled`}`,disabled:!(u===`environment`&&g),onClick:()=>void oe(),"aria-label":`Toggle torch`,title:g?m?`Torch on`:`Torch off`:`Torch not supported`,children:m?`🔦`:`💡`}),(0,V.jsx)(`button`,{type:`button`,className:`story-btn`,"aria-label":`Flip camera`,onClick:M,title:`Flip camera`,children:`🔁`})]})]}),(0,V.jsxs)(`div`,{className:`story-rec-bottombar`,children:[(0,V.jsx)(`div`,{className:`record-wrap`,children:(0,V.jsxs)(`button`,{type:`button`,className:`record-btn ${v?`recording`:``}`,"aria-pressed":v,"aria-label":v?`Stop recording`:`Start recording`,onClick:L,onPointerDown:F,onPointerUp:I,onPointerLeave:I,children:[(0,V.jsx)(`span`,{className:`progress-ring`,style:{background:`conic-gradient(currentColor ${b*360}deg, transparent 0)`}}),(0,V.jsx)(`span`,{className:`dot`})]})}),o&&(0,V.jsx)(`div`,{className:`story-rec-error`,children:o}),c&&(0,V.jsx)(`div`,{className:`story-rec-hint`,children:`Initializing camera…`})]})]}):null}function he(e){let t=Math.floor(e/1e3);return`${Math.floor(t/60).toString().padStart(2,`0`)}:${(t%60).toString().padStart(2,`0`)}`}var G={phiKey:[`userPhiKey`,`phiKey`,`phikey`,`ΦKey`,`walletPhiKey`],kaiSig:[`kaiSignature`,`kaiSig`,`ksig`,`ΣSig`,`sig`,`signature`],sigilId:[`sigilId`,`sigilID`,`glyphId`,`glyphID`,`sigil_id`,`glyph_id`],url:[`sigilActionUrl`,`sigilUrl`,`actionUrl`,`url`,`claimedUrl`,`loginUrl`,`sourceUrl`,`originUrl`,`link`,`href`]};function ge(e){if(typeof e!=`string`||!e.trim())return!1;try{let t=new URL(e,globalThis.location?.origin??`https://example.org`);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}}function K(e,t){if(typeof e!=`object`||!e)return;let n=e;for(let e of t){let t=n[e];if(typeof t==`string`&&t.trim())return t.trim()}let r=n.meta;if(typeof r==`object`&&r){let e=r;for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim())return t.trim()}}}function _e(e){return e.replace(/^$/,``).trim()}function ve(e){let t=e.trim();if(!t)return;try{let e=JSON.parse(t);if(typeof e==`object`&&e)return e}catch{}let n=t.match(/\{[\s\S]*\}/);if(n)try{let e=JSON.parse(n[0]);if(typeof e==`object`&&e)return e}catch{}}function ye(e,t){let n=RegExp(`${t}"?\\s*[:=]\\s*"?([^"\\n\\r<>{}]+)"?`,`i`),r=e.match(n);if(r)return(r[1]??``).trim()||void 0}function be(e){let t={};for(let n of G.phiKey){let r=ye(e,n);if(r){t.userPhiKey=r;break}}for(let n of G.kaiSig){let r=ye(e,n);if(r){t.kaiSignature=r;break}}for(let n of G.sigilId){let r=ye(e,n);if(r){t.sigilId=r;break}}for(let n of G.url){let r=ye(e,n);if(r&&ge(r))return t.actionUrl=r,t}let n=e.match(/https?:\/\/[^\s"'<>)#]+/i);return n&&ge(n[0])&&(t.actionUrl=n[0]),t}function xe(e,t){return{userPhiKey:e.userPhiKey??t.userPhiKey,kaiSignature:e.kaiSignature??t.kaiSignature,sigilId:e.sigilId??t.sigilId,actionUrl:e.actionUrl??t.actionUrl,meta:e.meta??t.meta}}function Se(e){let t=(e??``).trim();if(!t)return{};try{let e=new DOMParser().parseFromString(t,`image/svg+xml`),n=e.getElementsByTagName(`parsererror`);if(n&&n.length>0)return be(t);let r=e.documentElement,i={};if(r&&r.attributes)for(let e of Array.from(r.attributes))i[e.name]=e.value;let a={userPhiKey:K(i,G.phiKey),kaiSignature:K(i,G.kaiSig),sigilId:K(i,G.sigilId),actionUrl:(()=>{let e=K(i,G.url);return e&&ge(e)?e:void 0})(),meta:void 0},o=Array.from(e.getElementsByTagName(`metadata`));for(let e of o){let t=_e((e.textContent??``).trim());if(!t)continue;let n=ve(t);if(n){let e={userPhiKey:K(n,G.phiKey),kaiSignature:K(n,G.kaiSig),sigilId:K(n,G.sigilId),actionUrl:(()=>{let e=K(n,G.url);return e&&ge(e)?e:void 0})(),meta:n};if(a=xe(a,e),a.userPhiKey&&a.kaiSignature)return a}else a=xe(a,be(t))}for(let t of Array.from(e.getElementsByTagName(`desc`))){let e=_e((t.textContent??``).trim());if(!e)continue;let n=ve(e);if(n){let e={userPhiKey:K(n,G.phiKey),kaiSignature:K(n,G.kaiSig),sigilId:K(n,G.sigilId),actionUrl:(()=>{let e=K(n,G.url);return e&&ge(e)?e:void 0})(),meta:n};a=xe(a,e)}else a=xe(a,be(e));if(a.userPhiKey&&a.kaiSignature)return a}for(let t of Array.from(e.getElementsByTagName(`a`))){let e=t.getAttribute(`href`)||t.getAttribute(`xlink:href`);if(e&&ge(e)){a.actionUrl=a.actionUrl??e;break}}return(!a.userPhiKey||!a.kaiSignature)&&(a=xe(a,be(t))),a}catch{return be(t)}}var Ce=new TextEncoder;function q(){if(typeof crypto>`u`||!crypto.subtle)throw Error(`WebCrypto subtle unavailable`);return crypto.subtle}function we(e){if(e.buffer instanceof ArrayBuffer)return e;let t=new Uint8Array(e.byteLength);return t.set(e),t}function J(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`).trim();if(!/^[A-Za-z0-9+/]*={0,2}$/.test(t))throw Error(`Invalid base64/base64url`);let n=(4-t.length%4)%4,r=t+`=`.repeat(n),i=new Int16Array(128).fill(-1);for(let e=0;e<64;e++)i[`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.charCodeAt(e)]=e;let a=Math.floor(r.length*3/4)-(r.endsWith(`==`)?2:r.endsWith(`=`)?1:0),o=new Uint8Array(a),s=0;for(let e=0;e>>16&255),s>>8&255),s>>18&63]+t[r>>>12&63]+t[r>>>6&63]+t[r&63])}let a=r-i;if(a===1){let r=e[i]<<16;n.push(t[r>>>18&63]+t[r>>>12&63]+`==`)}else if(a===2){let r=e[i]<<16|e[i+1]<<8;n.push(t[r>>>18&63]+t[r>>>12&63]+t[r>>>6&63]+`=`)}return n.join(``).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function Ee(e){let t=e.trim().toLowerCase();if(!/^[0-9a-f]+$/.test(t)||t.length%2!=0)throw Error(`Invalid hex`);let n=new Uint8Array(t.length/2);for(let e=0;e=32&&t.length%2==0&&/^[0-9a-fA-F]+$/.test(t)}function Y(e){let t=e.trim();return t.length>=16&&/^[A-Za-z0-9\-_]+$/.test(t)}function Oe(e){let t=e.trim();if(!t)throw Error(`Empty kaiSignature`);if(De(t))return Ee(t);if(Y(t))try{return J(t)}catch{}return we(Ce.encode(t))}async function ke(e){let t=q(),n=await t.importKey(`raw`,e.ikm,{name:`HKDF`},!1,[`deriveBits`]),r=await t.deriveBits({name:`HKDF`,hash:`SHA-256`,salt:e.salt,info:e.info},n,e.bits);return new Uint8Array(r)}async function Ae(e){let t=we(Oe(e.baseKaiSignature)),n=we(J(e.salt_b64url)),r=(e.context??`KaiVoh.deriveKaiSignature.v1`).trim();return await ke({ikm:t,salt:n,info:we(Ce.encode(r)),bits:256})}async function je(e){return Te(await Ae(e))}function Me(){return(0,V.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`ico`,"aria-hidden":`true`,focusable:`false`,children:[(0,V.jsx)(`rect`,{x:`3`,y:`6`,width:`14`,height:`12`,rx:`3`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,V.jsx)(`circle`,{cx:`10`,cy:`12`,r:`3`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,V.jsx)(`path`,{d:`M17 9l4-2v10l-4-2z`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,V.jsx)(`circle`,{cx:`18.5`,cy:`5.5`,r:`2.5`,fill:`currentColor`})]})}function Ne(){return(0,V.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`ico`,"aria-hidden":`true`,focusable:`false`,children:[(0,V.jsx)(`path`,{d:`M3 6h18M9 6V4h6v2M7 6l1 14h8l1-14`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,V.jsx)(`path`,{d:`M10 10v6M14 10v6`,stroke:`currentColor`,strokeWidth:`2`})]})}var Pe=6e3,Fe=1024,Ie=1024*Fe,Le=e=>e>=Ie?`${(e/Ie).toFixed(2)} MB`:e>=Fe?`${(e/Fe).toFixed(2)} KB`:`${e} B`,Re=(e,t=8,n=6)=>e.length<=t+n?e:`${e.slice(0,t)}…${e.slice(-n)}`,ze=e=>{if(typeof e!=`string`||!e)return!1;try{let t=new URL(e,globalThis.location?.origin??`https://example.org`);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}};function Be(e){try{let t=new URL(e,globalThis.location?.origin??`https://example.org`),n=new URLSearchParams(t.hash.replace(/^#/,``)).has(`t`),r=new URLSearchParams(t.search).has(`p`),i=t.pathname,a=/^\/(?:stream|feed)\/p\/[^/]+$/.test(i),o=/^\/p~[^/?#]+$/.test(i);return n||r||a||o}catch{return!1}}function Ve(e){let t=new Uint8Array(e),n=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,r=[],i=t.length,a=0;for(;a+2>>18&63]+n[e>>>12&63]+n[e>>>6&63]+n[e&63])}let o=i-a;if(o===1){let e=t[a]<<16;r.push(n[e>>>18&63]+n[e>>>12&63]+`==`)}else if(o===2){let e=t[a]<<16|t[a+1]<<8;r.push(n[e>>>18&63]+n[e>>>12&63]+n[e>>>6&63]+`=`)}return r.join(``).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function X(e,t){if(typeof e!=`object`||!e)return;let n=e,r=n[t];if(typeof r==`string`)return r;let i=n.meta;if(typeof i==`object`&&i){let e=i[t];if(typeof e==`string`)return e}}function He(e,t){if(typeof e!=`object`||!e)return;let n=e,r=n[t];if(typeof r==`number`&&Number.isFinite(r))return r;let i=n.meta;if(typeof i==`object`&&i){let e=i[t];if(typeof e==`number`&&Number.isFinite(e))return e}}function Ue(e,t){if(!e)return;let n=[`sigilActionUrl`,`sigilUrl`,`actionUrl`,`url`,`claimedUrl`,`loginUrl`,`sourceUrl`,`originUrl`,`link`,`href`];if(t)for(let e of n){let n=t[e];if(ze(n))return n}try{let t=new DOMParser().parseFromString(e,`image/svg+xml`);for(let e of Array.from(t.getElementsByTagName(`metadata`))){let t=(e.textContent??``).trim();if(!t)continue;let r=t.replace(/^$/,``);try{let e=JSON.parse(r);if(typeof e==`object`&&e)for(let t of n){let n=e[t];if(ze(n))return n}}catch{let e=r.match(/https?:\/\/[^\s"'<>)#]+/i);if(e&&ze(e[0]))return e[0]}}for(let e of Array.from(t.getElementsByTagName(`a`))){let t=e.getAttribute(`href`)||e.getAttribute(`xlink:href`);if(ze(t))return t}}catch{}}async function We(e,t,n={}){let r=n.cacheName??`sigil-attachments-v1`,i=(n.pathPrefix??`/att/`).replace(/\/+$/,``)+`/`;try{if(!(`caches`in globalThis)||typeof caches.open!=`function`)return;let n=await caches.open(r),a=`${i}${e}`;return await n.put(new Request(a,{method:`GET`}),new Response(t,{headers:{"Content-Type":t.type||`application/octet-stream`}})),a}catch{return}}function Ge(e){let t=Math.floor(e/1e3);return`${Math.floor(t/60).toString().padStart(2,`0`)}:${(t%60).toString().padStart(2,`0`)}`}function Ke(e){let t=e.indexOf(` +import{$ as e,$t as t,A as n,D as r,E as i,En as a,F as o,Ht as s,K as c,M as l,N as u,O as d,P as f,Q as p,T as m,Tn as h,Z as g,_n as _,at as v,ct as y,dt as b,en as x,fn as ee,ft as S,gn as C,ht as w,j as T,jn as E,k as D,ln as O,lt as te,mn as k,nt as ne,ot as re,pn as A,pt as j,st as ie,tn as M,un as ae,ut as oe}from"./index-BWApiWDT.js";import"./prop-types-B3eCNXus.js";import{n as se}from"./SigilAuthContext-X_86kcI6.js";import{n as N,t as P}from"./sigilRegistry-TxCi76Aa.js";import{i as ce,r as le}from"./postSeal-ClZBwRbf.js";import{a as F,i as I,n as L,r as R,t as z}from"./VerifierFrame-DkyrPdnF.js";var B=E(h(),1);const ue=(0,B.createContext)(void 0);var V=E(M(),1);function de({children:e}){let[t,n]=(0,B.useState)(null),r=(0,B.useMemo)(()=>({session:t,setSession:e=>n(e),clearSession:()=>n(null)}),[t]);return(0,V.jsx)(ue.Provider,{value:r,children:e})}function H(){let e=(0,B.useContext)(ue);if(!e)throw Error(`useSession must be used within a SessionProvider`);return e}var U=[`video/webm;codecs=vp9,opus`,`video/webm;codecs=vp8,opus`,`video/webm`,`video/mp4;codecs=h264,aac`,`video/mp4`],fe=typeof window<`u`&&`MediaRecorder`in window;async function pe(e){let t=await crypto.subtle.digest(`SHA-256`,e),n=new Uint8Array(t),r=``;for(let e=0;eW(),[]);function ne(){let e=typeof performance<`u`?performance:null,t=(e&&typeof e.timeOrigin==`number`?e.timeOrigin:NaN)+(e?e.now():NaN);return Number.isFinite(t)?Math.floor(t):Date.now()}(0,B.useEffect)(()=>{if(t)return(async()=>{s(null),l(!0);try{await re()}catch(e){s(e instanceof Error?e.message:`Failed to access camera.`)}finally{l(!1)}})(),()=>{A()}},[t,u,f]),(0,B.useEffect)(()=>{t&&j().catch(()=>_(!1))},[t,u]);async function re(){A();let e={audio:{echoCancellation:!0,noiseSuppression:!0},video:{facingMode:u,width:{ideal:1080},height:{ideal:1920},frameRate:{ideal:30,max:60}}},t=await navigator.mediaDevices.getUserMedia(e);C.current=t,w.current&&(w.current.srcObject=t,w.current.muted=!0,await w.current.play().catch(()=>{})),await ie(m&&g)}function A(){if(P(!0),w.current&&(w.current.pause(),w.current.srcObject=null),C.current)for(let e of C.current.getTracks())e.stop();C.current=null,h(!1),y(!1),x(0),S(0),O.current!==null&&(cancelAnimationFrame(O.current),O.current=null)}async function j(){let e=C.current;if(!e){_(!1);return}let[t]=e.getVideoTracks();if(!t){_(!1);return}let n=t.getCapabilities?.()??{};_(!!(typeof n.torch==`boolean`&&n.torch)&&u===`environment`)}async function ie(e){let t=C.current;if(!t)return;let[n]=t.getVideoTracks();if(!(!n||!n.applyConstraints))try{g&&u===`environment`&&await n.applyConstraints({advanced:[{torch:e}]})}catch{}}function M(){d(e=>e===`user`?`environment`:`user`)}function ae(){p(e=>!e)}async function oe(){if(!g)return;let e=!m;h(e),await ie(e)}function se(){if(!v)return;let e=performance.now()-D.current;if(S(e),x(Math.min(1,e/i)),e>=i){P(!1);return}O.current=requestAnimationFrame(se)}function N(){if(!fe){s(`MediaRecorder is not supported on this browser.`);return}if(v)return;s(null);let e=C.current;if(!e){s(`No camera stream.`);return}for(let t of e.getAudioTracks())t.enabled=!f;let t=te??``,n;try{n=t?new MediaRecorder(e,{mimeType:t,videoBitsPerSecond:35e5}):new MediaRecorder(e)}catch{n=new MediaRecorder(e)}T.current=n,E.current=[],n.ondataavailable=e=>{e.data&&e.data.size>0&&E.current.push(e.data)},n.onstop=()=>{ce()},n.start(250),y(!0),D.current=performance.now(),O.current=requestAnimationFrame(se)}function P(e){if(!v)return;let t=T.current;if(t){try{t.state!==`inactive`&&t.stop()}catch{}y(!1),O.current!==null&&(cancelAnimationFrame(O.current),O.current=null),e&&(E.current=[],x(0),S(0))}}async function ce(){let e=E.current;if(E.current=[],!e.length)return;let t=Math.max(0,Math.min(i,performance.now()-D.current)),n=T.current?.mimeType||te||`video/webm`,a=new Blob(e,{type:n}),o=ne(),s=k(BigInt(o)),{width:c,height:l,thumbnailDataUrl:u}=await le(a),d=await pe(await a.arrayBuffer()),f=`story_${s.toString()}.${n.includes(`mp4`)?`mp4`:`webm`}`;r({blob:a,file:new File([a],f,{type:n,lastModified:o}),mimeType:n,durationMs:t,width:c,height:l,thumbnailDataUrl:u,sha256:d,createdAt:o})}async function le(e){let t=URL.createObjectURL(e);try{let e=document.createElement(`video`);e.src=t,e.muted=!0,await e.play().catch(()=>void 0),await new Promise(t=>{let n=()=>{e.pause(),e.currentTime=0},r=()=>{n(),t()};e.onloadeddata=r,setTimeout(r,250)});let n=e.videoWidth||1080,r=e.videoHeight||1920,i=document.createElement(`canvas`);i.width=n,i.height=r;let a=i.getContext(`2d`);return a&&a.drawImage(e,0,0,n,r),{width:n,height:r,thumbnailDataUrl:i.toDataURL(`image/png`,.9)}}finally{URL.revokeObjectURL(t)}}function F(){v||N()}function I(){v&&P(!1)}function L(){v?P(!1):N()}return t?(0,V.jsxs)(`div`,{className:`story-rec-overlay`,role:`dialog`,"aria-modal":`true`,"aria-label":`Story recorder`,children:[(0,V.jsx)(`div`,{className:`story-rec-video-wrap`,children:(0,V.jsx)(`video`,{ref:w,className:`story-rec-video ${u===`user`?`mirror`:``}`,playsInline:!0})}),(0,V.jsxs)(`div`,{className:`story-rec-topbar`,children:[(0,V.jsx)(`button`,{type:`button`,className:`story-btn top left`,"aria-label":`Close`,onClick:()=>{A(),n()},children:`✕`}),(0,V.jsx)(`div`,{className:`story-top-center`,children:(0,V.jsxs)(`div`,{className:`story-timer mono`,children:[he(ee),` / `,he(i)]})}),(0,V.jsxs)(`div`,{className:`story-top-actions`,children:[(0,V.jsx)(`button`,{type:`button`,className:`story-btn ${f?`active`:``}`,"aria-pressed":f,"aria-label":f?`Unmute microphone`:`Mute microphone`,onClick:ae,title:f?`Unmute mic`:`Mute mic`,children:f?`🔇`:`🎙️`}),(0,V.jsx)(`button`,{type:`button`,className:`story-btn ${u===`environment`&&g?``:`disabled`}`,disabled:!(u===`environment`&&g),onClick:()=>void oe(),"aria-label":`Toggle torch`,title:g?m?`Torch on`:`Torch off`:`Torch not supported`,children:m?`🔦`:`💡`}),(0,V.jsx)(`button`,{type:`button`,className:`story-btn`,"aria-label":`Flip camera`,onClick:M,title:`Flip camera`,children:`🔁`})]})]}),(0,V.jsxs)(`div`,{className:`story-rec-bottombar`,children:[(0,V.jsx)(`div`,{className:`record-wrap`,children:(0,V.jsxs)(`button`,{type:`button`,className:`record-btn ${v?`recording`:``}`,"aria-pressed":v,"aria-label":v?`Stop recording`:`Start recording`,onClick:L,onPointerDown:F,onPointerUp:I,onPointerLeave:I,children:[(0,V.jsx)(`span`,{className:`progress-ring`,style:{background:`conic-gradient(currentColor ${b*360}deg, transparent 0)`}}),(0,V.jsx)(`span`,{className:`dot`})]})}),o&&(0,V.jsx)(`div`,{className:`story-rec-error`,children:o}),c&&(0,V.jsx)(`div`,{className:`story-rec-hint`,children:`Initializing camera…`})]})]}):null}function he(e){let t=Math.floor(e/1e3);return`${Math.floor(t/60).toString().padStart(2,`0`)}:${(t%60).toString().padStart(2,`0`)}`}var G={phiKey:[`userPhiKey`,`phiKey`,`phikey`,`ΦKey`,`walletPhiKey`],kaiSig:[`kaiSignature`,`kaiSig`,`ksig`,`ΣSig`,`sig`,`signature`],sigilId:[`sigilId`,`sigilID`,`glyphId`,`glyphID`,`sigil_id`,`glyph_id`],url:[`sigilActionUrl`,`sigilUrl`,`actionUrl`,`url`,`claimedUrl`,`loginUrl`,`sourceUrl`,`originUrl`,`link`,`href`]};function ge(e){if(typeof e!=`string`||!e.trim())return!1;try{let t=new URL(e,globalThis.location?.origin??`https://example.org`);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}}function K(e,t){if(typeof e!=`object`||!e)return;let n=e;for(let e of t){let t=n[e];if(typeof t==`string`&&t.trim())return t.trim()}let r=n.meta;if(typeof r==`object`&&r){let e=r;for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim())return t.trim()}}}function _e(e){return e.replace(/^$/,``).trim()}function ve(e){let t=e.trim();if(!t)return;try{let e=JSON.parse(t);if(typeof e==`object`&&e)return e}catch{}let n=t.match(/\{[\s\S]*\}/);if(n)try{let e=JSON.parse(n[0]);if(typeof e==`object`&&e)return e}catch{}}function ye(e,t){let n=RegExp(`${t}"?\\s*[:=]\\s*"?([^"\\n\\r<>{}]+)"?`,`i`),r=e.match(n);if(r)return(r[1]??``).trim()||void 0}function be(e){let t={};for(let n of G.phiKey){let r=ye(e,n);if(r){t.userPhiKey=r;break}}for(let n of G.kaiSig){let r=ye(e,n);if(r){t.kaiSignature=r;break}}for(let n of G.sigilId){let r=ye(e,n);if(r){t.sigilId=r;break}}for(let n of G.url){let r=ye(e,n);if(r&&ge(r))return t.actionUrl=r,t}let n=e.match(/https?:\/\/[^\s"'<>)#]+/i);return n&&ge(n[0])&&(t.actionUrl=n[0]),t}function xe(e,t){return{userPhiKey:e.userPhiKey??t.userPhiKey,kaiSignature:e.kaiSignature??t.kaiSignature,sigilId:e.sigilId??t.sigilId,actionUrl:e.actionUrl??t.actionUrl,meta:e.meta??t.meta}}function Se(e){let t=(e??``).trim();if(!t)return{};try{let e=new DOMParser().parseFromString(t,`image/svg+xml`),n=e.getElementsByTagName(`parsererror`);if(n&&n.length>0)return be(t);let r=e.documentElement,i={};if(r&&r.attributes)for(let e of Array.from(r.attributes))i[e.name]=e.value;let a={userPhiKey:K(i,G.phiKey),kaiSignature:K(i,G.kaiSig),sigilId:K(i,G.sigilId),actionUrl:(()=>{let e=K(i,G.url);return e&&ge(e)?e:void 0})(),meta:void 0},o=Array.from(e.getElementsByTagName(`metadata`));for(let e of o){let t=_e((e.textContent??``).trim());if(!t)continue;let n=ve(t);if(n){let e={userPhiKey:K(n,G.phiKey),kaiSignature:K(n,G.kaiSig),sigilId:K(n,G.sigilId),actionUrl:(()=>{let e=K(n,G.url);return e&&ge(e)?e:void 0})(),meta:n};if(a=xe(a,e),a.userPhiKey&&a.kaiSignature)return a}else a=xe(a,be(t))}for(let t of Array.from(e.getElementsByTagName(`desc`))){let e=_e((t.textContent??``).trim());if(!e)continue;let n=ve(e);if(n){let e={userPhiKey:K(n,G.phiKey),kaiSignature:K(n,G.kaiSig),sigilId:K(n,G.sigilId),actionUrl:(()=>{let e=K(n,G.url);return e&&ge(e)?e:void 0})(),meta:n};a=xe(a,e)}else a=xe(a,be(e));if(a.userPhiKey&&a.kaiSignature)return a}for(let t of Array.from(e.getElementsByTagName(`a`))){let e=t.getAttribute(`href`)||t.getAttribute(`xlink:href`);if(e&&ge(e)){a.actionUrl=a.actionUrl??e;break}}return(!a.userPhiKey||!a.kaiSignature)&&(a=xe(a,be(t))),a}catch{return be(t)}}var Ce=new TextEncoder;function q(){if(typeof crypto>`u`||!crypto.subtle)throw Error(`WebCrypto subtle unavailable`);return crypto.subtle}function we(e){if(e.buffer instanceof ArrayBuffer)return e;let t=new Uint8Array(e.byteLength);return t.set(e),t}function J(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`).trim();if(!/^[A-Za-z0-9+/]*={0,2}$/.test(t))throw Error(`Invalid base64/base64url`);let n=(4-t.length%4)%4,r=t+`=`.repeat(n),i=new Int16Array(128).fill(-1);for(let e=0;e<64;e++)i[`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.charCodeAt(e)]=e;let a=Math.floor(r.length*3/4)-(r.endsWith(`==`)?2:r.endsWith(`=`)?1:0),o=new Uint8Array(a),s=0;for(let e=0;e>>16&255),s>>8&255),s>>18&63]+t[r>>>12&63]+t[r>>>6&63]+t[r&63])}let a=r-i;if(a===1){let r=e[i]<<16;n.push(t[r>>>18&63]+t[r>>>12&63]+`==`)}else if(a===2){let r=e[i]<<16|e[i+1]<<8;n.push(t[r>>>18&63]+t[r>>>12&63]+t[r>>>6&63]+`=`)}return n.join(``).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function Ee(e){let t=e.trim().toLowerCase();if(!/^[0-9a-f]+$/.test(t)||t.length%2!=0)throw Error(`Invalid hex`);let n=new Uint8Array(t.length/2);for(let e=0;e=32&&t.length%2==0&&/^[0-9a-fA-F]+$/.test(t)}function Y(e){let t=e.trim();return t.length>=16&&/^[A-Za-z0-9\-_]+$/.test(t)}function Oe(e){let t=e.trim();if(!t)throw Error(`Empty kaiSignature`);if(De(t))return Ee(t);if(Y(t))try{return J(t)}catch{}return we(Ce.encode(t))}async function ke(e){let t=q(),n=await t.importKey(`raw`,e.ikm,{name:`HKDF`},!1,[`deriveBits`]),r=await t.deriveBits({name:`HKDF`,hash:`SHA-256`,salt:e.salt,info:e.info},n,e.bits);return new Uint8Array(r)}async function Ae(e){let t=we(Oe(e.baseKaiSignature)),n=we(J(e.salt_b64url)),r=(e.context??`KaiVoh.deriveKaiSignature.v1`).trim();return await ke({ikm:t,salt:n,info:we(Ce.encode(r)),bits:256})}async function je(e){return Te(await Ae(e))}function Me(){return(0,V.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`ico`,"aria-hidden":`true`,focusable:`false`,children:[(0,V.jsx)(`rect`,{x:`3`,y:`6`,width:`14`,height:`12`,rx:`3`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,V.jsx)(`circle`,{cx:`10`,cy:`12`,r:`3`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,V.jsx)(`path`,{d:`M17 9l4-2v10l-4-2z`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,V.jsx)(`circle`,{cx:`18.5`,cy:`5.5`,r:`2.5`,fill:`currentColor`})]})}function Ne(){return(0,V.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`ico`,"aria-hidden":`true`,focusable:`false`,children:[(0,V.jsx)(`path`,{d:`M3 6h18M9 6V4h6v2M7 6l1 14h8l1-14`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,V.jsx)(`path`,{d:`M10 10v6M14 10v6`,stroke:`currentColor`,strokeWidth:`2`})]})}var Pe=6e3,Fe=1024,Ie=1024*Fe,Le=e=>e>=Ie?`${(e/Ie).toFixed(2)} MB`:e>=Fe?`${(e/Fe).toFixed(2)} KB`:`${e} B`,Re=(e,t=8,n=6)=>e.length<=t+n?e:`${e.slice(0,t)}…${e.slice(-n)}`,ze=e=>{if(typeof e!=`string`||!e)return!1;try{let t=new URL(e,globalThis.location?.origin??`https://example.org`);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}};function Be(e){try{let t=new URL(e,globalThis.location?.origin??`https://example.org`),n=new URLSearchParams(t.hash.replace(/^#/,``)).has(`t`),r=new URLSearchParams(t.search).has(`p`),i=t.pathname,a=/^\/(?:stream|feed)\/p\/[^/]+$/.test(i),o=/^\/p~[^/?#]+$/.test(i);return n||r||a||o}catch{return!1}}function Ve(e){let t=new Uint8Array(e),n=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,r=[],i=t.length,a=0;for(;a+2>>18&63]+n[e>>>12&63]+n[e>>>6&63]+n[e&63])}let o=i-a;if(o===1){let e=t[a]<<16;r.push(n[e>>>18&63]+n[e>>>12&63]+`==`)}else if(o===2){let e=t[a]<<16|t[a+1]<<8;r.push(n[e>>>18&63]+n[e>>>12&63]+n[e>>>6&63]+`=`)}return r.join(``).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function X(e,t){if(typeof e!=`object`||!e)return;let n=e,r=n[t];if(typeof r==`string`)return r;let i=n.meta;if(typeof i==`object`&&i){let e=i[t];if(typeof e==`string`)return e}}function He(e,t){if(typeof e!=`object`||!e)return;let n=e,r=n[t];if(typeof r==`number`&&Number.isFinite(r))return r;let i=n.meta;if(typeof i==`object`&&i){let e=i[t];if(typeof e==`number`&&Number.isFinite(e))return e}}function Ue(e,t){if(!e)return;let n=[`sigilActionUrl`,`sigilUrl`,`actionUrl`,`url`,`claimedUrl`,`loginUrl`,`sourceUrl`,`originUrl`,`link`,`href`];if(t)for(let e of n){let n=t[e];if(ze(n))return n}try{let t=new DOMParser().parseFromString(e,`image/svg+xml`);for(let e of Array.from(t.getElementsByTagName(`metadata`))){let t=(e.textContent??``).trim();if(!t)continue;let r=t.replace(/^$/,``);try{let e=JSON.parse(r);if(typeof e==`object`&&e)for(let t of n){let n=e[t];if(ze(n))return n}}catch{let e=r.match(/https?:\/\/[^\s"'<>)#]+/i);if(e&&ze(e[0]))return e[0]}}for(let e of Array.from(t.getElementsByTagName(`a`))){let t=e.getAttribute(`href`)||e.getAttribute(`xlink:href`);if(ze(t))return t}}catch{}}async function We(e,t,n={}){let r=n.cacheName??`sigil-attachments-v1`,i=(n.pathPrefix??`/att/`).replace(/\/+$/,``)+`/`;try{if(!(`caches`in globalThis)||typeof caches.open!=`function`)return;let n=await caches.open(r),a=`${i}${e}`;return await n.put(new Request(a,{method:`GET`}),new Response(t,{headers:{"Content-Type":t.type||`application/octet-stream`}})),a}catch{return}}function Ge(e){let t=Math.floor(e/1e3);return`${Math.floor(t/60).toString().padStart(2,`0`)}:${(t%60).toString().padStart(2,`0`)}`}function Ke(e){let t=e.indexOf(` `);return t>=0?e.slice(0,t):e}function qe(e,t){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}var Je=()=>{let e=Number(k());if(!Number.isSafeInteger(e))throw Error(`kairosEpochNow out of safe integer range`);return e},Z=()=>typeof performance<`u`&&typeof performance.now==`function`?performance.now():Je(),Ye=async()=>{await new Promise(e=>requestAnimationFrame(()=>e()))},Xe=async(e,t,n)=>{let r=null,i=new Promise((e,i)=>{r=window.setTimeout(()=>i(Error(`${n} timed out`)),t)});try{return await Promise.race([e,i])}finally{r!==null&&window.clearTimeout(r)}},Ze=()=>{let e=typeof crypto<`u`?crypto:void 0;return e&&`randomUUID`in e&&typeof e.randomUUID==`function`?e.randomUUID():`${Math.floor(Z()).toString(36)}-${Math.random().toString(36).slice(2)}`},Q=null,$=new Map;function Qe(){if(Q)return Q;if(typeof window>`u`)throw Error(`encode worker unavailable (no window)`);if(typeof Worker>`u`)throw Error(`encode worker unavailable (Worker not supported)`);let e=new URL(`data:video/mp2t;base64,Ly8vIDxyZWZlcmVuY2UgbGliPSJ3ZWJ3b3JrZXIiIC8+CgppbXBvcnQgewogIGVuY29kZVRva2VuV2l0aEJ1ZGdldHMsCiAgdHlwZSBGZWVkUG9zdFBheWxvYWQsCn0gZnJvbSAiLi4vLi4vdXRpbHMvZmVlZFBheWxvYWQiOwoKdHlwZSBFbmNvZGVXb3JrZXJSZXF1ZXN0ID0gewogIGlkOiBzdHJpbmc7CiAgcGF5bG9hZDogRmVlZFBvc3RQYXlsb2FkOwp9OwoKdHlwZSBFbmNvZGVXb3JrZXJSZXNwb25zZSA9CiAgfCB7IGlkOiBzdHJpbmc7IG9rOiB0cnVlOyB0b2tlbjogc3RyaW5nOyB3aXRoaW5IYXJkOiBib29sZWFuOyBtczogbnVtYmVyIH0KICB8IHsgaWQ6IHN0cmluZzsgb2s6IGZhbHNlOyBlcnJvcjogc3RyaW5nOyBtczogbnVtYmVyIH07Cgpjb25zdCBub3cgPSAoKTogbnVtYmVyID0+CiAgc2VsZi5wZXJmb3JtYW5jZSAmJiB0eXBlb2Ygc2VsZi5wZXJmb3JtYW5jZS5ub3cgPT09ICJmdW5jdGlvbiIKICAgID8gc2VsZi5wZXJmb3JtYW5jZS5ub3coKQogICAgOiAwOwoKc2VsZi5vbm1lc3NhZ2UgPSAoZXY6IE1lc3NhZ2VFdmVudDxFbmNvZGVXb3JrZXJSZXF1ZXN0PikgPT4gewogIGNvbnN0IHQwID0gbm93KCk7CiAgY29uc3QgZGF0YSA9IGV2LmRhdGE7CgogIHRyeSB7CiAgICBjb25zdCBvdXQgPSBlbmNvZGVUb2tlbldpdGhCdWRnZXRzKGRhdGEucGF5bG9hZCk7CiAgICBjb25zdCBtc2c6IEVuY29kZVdvcmtlclJlc3BvbnNlID0gewogICAgICBpZDogZGF0YS5pZCwKICAgICAgb2s6IHRydWUsCiAgICAgIHRva2VuOiBvdXQudG9rZW4sCiAgICAgIHdpdGhpbkhhcmQ6IG91dC53aXRoaW5IYXJkLAogICAgICBtczogbm93KCkgLSB0MCwKICAgIH07CiAgICBzZWxmLnBvc3RNZXNzYWdlKG1zZyk7CiAgfSBjYXRjaCAoZSkgewogICAgY29uc3QgbXNnOiBFbmNvZGVXb3JrZXJSZXNwb25zZSA9IHsKICAgICAgaWQ6IGRhdGEuaWQsCiAgICAgIG9rOiBmYWxzZSwKICAgICAgZXJyb3I6IGUgaW5zdGFuY2VvZiBFcnJvciA/IGUubWVzc2FnZSA6IFN0cmluZyhlKSwKICAgICAgbXM6IG5vdygpIC0gdDAsCiAgICB9OwogICAgc2VsZi5wb3N0TWVzc2FnZShtc2cpOwogIH0KfTsK`,``+import.meta.url);return Q=new Worker(e,{type:`module`,name:`kaiVohEncodeWorker`}),Q.onmessage=e=>{let t=e.data,n=$.get(t.id);n&&($.delete(t.id),n(t))},Q.onerror=()=>{for(let[e,t]of $)t({id:e,ok:!1,error:`encode worker crashed`,ms:0});$.clear();try{Q?.terminate()}catch{}Q=null},Q}async function $e(e){let t=Qe(),n=Ze();return new Promise(r=>{$.set(n,r);let i={id:n,payload:e};t.postMessage(i)})}async function et(e){let t=Z(),n=()=>{try{let n=ne(e);return{id:Ze(),ok:!0,token:n.token,withinHard:n.withinHard,ms:Z()-t}}catch(e){return{id:Ze(),ok:!1,error:e instanceof Error?e.message:String(e),ms:Z()-t}}};try{let t=await $e(e);if(!t.ok){let e=n();return e.ok?e:t}return t}catch{return n()}}function tt({initialCaption:e=``,initialAuthor:t=``,onExhale:n}){let{auth:r}=se(),i=r.meta,[a,o]=(0,B.useState)(e),[s,l]=(0,B.useState)(t),[u,d]=(0,B.useState)(`text`),[f,m]=(0,B.useState)(`tsx`),[h,g]=(0,B.useState)(`code`),[x,ee]=(0,B.useState)(``),[C,T]=(0,B.useState)(``),[E,D]=(0,B.useState)(``),[O,k]=(0,B.useState)([]),[ne,A]=(0,B.useState)([]),[M,ae]=(0,B.useState)({version:1,totalBytes:0,inlinedBytes:0,items:[]}),N=(0,B.useRef)(M),[F,I]=(0,B.useState)(!1),[L,R]=(0,B.useState)(null),[z,ue]=(0,B.useState)(!1),[de,H]=(0,B.useState)(``),[U,fe]=(0,B.useState)(null),[pe,W]=(0,B.useState)(null),[he,G]=(0,B.useState)(null),[ge,K]=(0,B.useState)(!1),[_e,ve]=(0,B.useState)(``),[ye,be]=(0,B.useState)(0),[xe,Ce]=(0,B.useState)(`path`),[q,we]=(0,B.useState)(!1),[J,Te]=(0,B.useState)(`derived`),[Ee,De]=(0,B.useState)(``),[Y,Oe]=(0,B.useState)(()=>le(18)),[ke,Ae]=(0,B.useState)([]),[Fe,Ie]=(0,B.useState)(!1),Ze=(0,B.useRef)(null),Q=!!i;(0,B.useEffect)(()=>o(e),[e]),(0,B.useEffect)(()=>l(t),[t]),(0,B.useEffect)(()=>{N.current=M},[M]),(0,B.useEffect)(()=>()=>{L&&URL.revokeObjectURL(L.url)},[]);let $=(0,B.useMemo)(()=>X(i,`sigilActionUrl`)||X(i,`sigilUrl`)||X(i,`actionUrl`)||X(i,`url`)||X(i,`claimedUrl`)||X(i,`loginUrl`)||X(i,`sourceUrl`)||X(i,`originUrl`)||X(i,`link`)||X(i,`href`)||Ue(r.svgText,i??{})||(globalThis.location?.origin??`https://kaiklok.com`),[i,r.svgText]);(0,B.useEffect)(()=>{i&&(ee(X(i,`userPhiKey`)??``),T(X(i,`kaiSignature`)??``))},[i]),(0,B.useEffect)(()=>{q&&(Y.trim()||Oe(le(18)))},[q,Y]);let Qe=()=>{let e=E.trim();if(!ze(e)){G(`Invalid URL. Enter a full http(s) link.`);return}k(t=>[...t,j({url:e})]),D(``),G(null)},$e=e=>{k(t=>t.filter((t,n)=>n!==e))};function tt(e){let t=e,n=typeof t.webkitRelativePath==`string`?t.webkitRelativePath:``;return n.trim()?n:e.name}async function nt(e){let t=await e.arrayBuffer(),n=await crypto.subtle.digest(`SHA-256`,t),r=new Uint8Array(n),i=``;for(let e=0;e{let t=N.current.items.slice(),n=[];for(let r of e){let e=tt(r);if(q&&r.size>Pe){n.push(e);continue}if(r.size<=Pe){let n=await r.arrayBuffer();t.push(oe({name:e,type:r.type||`application/octet-stream`,size:r.size,data_b64url:Ve(n)}))}else{let n=await nt(r),i=await We(n,r,{cacheName:`sigil-attachments-v1`,pathPrefix:`/att/`});t.push(y({sha256:n,name:e,type:r.type||`application/octet-stream`,size:r.size,url:i}))}}return n.length>0&&G(`Private (Sealed) mode cannot include cache-backed large files. Skipped: ${n.slice(0,3).join(`, `)}${n.length>3?` (+${n.length-3} more)`:``}. Attach as a URL instead (Drive/S3/IPFS/etc), or keep files ≤ ${Le(Pe)}.`),v(t)},it=async e=>{if(!e.target.files)return;let t=Array.from(e.target.files);A(e=>[...e,...t]),ae(await rt(t))},at=async e=>{if(e.preventDefault(),e.stopPropagation(),!e.dataTransfer?.files?.length)return;let t=Array.from(e.dataTransfer.files);A(e=>[...e,...t]),ae(await rt(t))},ot=e=>{e.preventDefault(),e.stopPropagation()},st=()=>{A([]);let e={version:1,totalBytes:0,inlinedBytes:0,items:[]};ae(e),N.current=e};function ct(e){let[,t]=e.split(`,`,2);return t?Math.ceil(t.length*3/4):0}async function lt(e){if(q){G(`Private (Sealed) mode cannot include recorded stories (cache-backed video refs). Upload as a URL instead.`),I(!1);return}let t=await We(e.sha256,e.file,{cacheName:`sigil-attachments-v1`,pathPrefix:`/att/`}),n=y({sha256:e.sha256,name:e.file.name,type:e.mimeType||e.file.type||`video/webm`,size:e.file.size,url:t}),r=(e.thumbnailDataUrl.split(`,`,2)[1]??``).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``),i=oe({name:e.file.name.replace(/\.(webm|mp4)$/i,``)+`_thumb.png`,type:`image/png`,size:ct(e.thumbnailDataUrl),data_b64url:r});ae(v([...N.current.items,n,i])),L&&URL.revokeObjectURL(L.url),R({url:URL.createObjectURL(e.file),durationMs:e.durationMs}),I(!1)}let ut=a.trim(),dt=(0,B.useMemo)(()=>ut?u===`text`?S(ut):u===`md`?b(ut):u===`html`?te(ut,h):ie(ut,f.trim()||void 0):void 0,[ut,u,f,h]),ft=(0,B.useMemo)(()=>{if(!ut)return;let e=Ke(ut).trim();if(e){if(u===`code`){let t=f.trim();return qe(`${t?`code:${t}`:`code`} — ${e}`,220)}return qe(u===`md`?`md — ${e}`:u===`html`?`html — ${e}`:e,220)}},[ut,u,f]),pt=(0,B.useMemo)(()=>N.current.items.some(e=>e.kind===`file-ref`),[M]),mt=(0,B.useMemo)(()=>{if(!q)return ft;let e=Ee.trim();return e?qe(e,220):`Sealed Memory`},[q,ft,Ee]),ht=q&&J===`derived`&&Q&&!!C.trim(),gt=q&&J===`glyph`&&ke.length>0,_t=(0,B.useMemo)(()=>q?Q?J===`derived`?C.trim()?Y.trim()?(0,V.jsxs)(`div`,{className:`composer-hint`,children:[`Mode: `,(0,V.jsx)(`strong`,{children:`Derived Glyph Access`}),` • Any derivative glyph exported from this issuer glyph can unlock • Salt length`,` `,(0,V.jsx)(`strong`,{children:Y.trim().length})]}):(0,V.jsx)(`div`,{className:`composer-hint warn`,children:`Derivation salt missing — rotate to generate.`}):(0,V.jsx)(`div`,{className:`composer-hint warn`,children:`Derived access requires ΣSig (kaiSignature) present in your verified glyph.`}):ke.length===0?(0,V.jsx)(`div`,{className:`composer-hint warn`,children:`Mode: Specific Glyph Access requires at least one allowed glyph SVG uploaded.`}):(0,V.jsxs)(`div`,{className:`composer-hint`,children:[`Mode: `,(0,V.jsx)(`strong`,{children:`Specific Glyph Access`}),` • Allowed glyphs `,(0,V.jsx)(`strong`,{children:ke.length})]}):(0,V.jsx)(`div`,{className:`composer-hint warn`,children:`Private (Sealed) requires a verified glyph session.`}):null,[q,Q,J,C,Y,ke.length]),vt=async e=>{if(e.length===0)return;let t=[],n=[];for(let r of e)try{let e=Se(await r.text()),i=(e.userPhiKey??``).trim(),a=(e.kaiSignature??``).trim();if(!i||!a){n.push(r.name);continue}t.push({label:r.name,phiKey:i,kaiSignature:a,sigilId:(e.sigilId??``).trim()?(e.sigilId??``).trim():void 0})}catch{n.push(r.name)}t.length>0&&(Ae(e=>{let n=e.slice(),r=new Set(e.map(e=>`${e.phiKey}:${e.kaiSignature}`));for(let e of t){let t=`${e.phiKey}:${e.kaiSignature}`;r.has(t)||(r.add(t),n.push(e))}return n}),G(null)),n.length>0&&G(`Some glyph SVGs were missing ΦKey/ΣSig metadata and were not added: ${n.slice(0,3).join(`, `)}${n.length>3?` (+${n.length-3} more)`:``}.`)},yt=e=>{Ae(t=>t.filter((t,n)=>n!==e))},bt=async()=>{if(z)return;W(null),G(null),K(!1),ve(``),be(0),Ce(`path`),fe(null);let e=($||``).trim(),t=Be(e);if(t||G(`Proof of Breath™ URL not detected; using fallback. Link generation will still work.`),q){if([...N.current.items,...O].some(e=>e.kind===`file-ref`)){W(`Private (Sealed) mode cannot include cache-backed file refs. Keep files ≤ ${Le(Pe)} (inline) or attach public URLs.`);return}if(J===`derived`&&!ht){W(`Private (Sealed) → Derived mode requires a verified glyph with ΣSig (kaiSignature) present.`);return}if(J===`glyph`&&!gt){W(`Private (Sealed) → Specific Glyph mode requires at least one allowed glyph SVG uploaded.`);return}}let r,a;try{a=Je(),r=_(new Date(a)).pulse}catch{W(`Failed to compute Kai pulse.`);return}let o=Z();try{ue(!0),H(`paint`),await Ye(),await Ye(),H(`assemble`);let l=[...N.current.items,...O],u=l.length>0?v(l):void 0,d=t?e:void 0,f=d?c(d)??d:void 0,m=X(i,`sigilId`)||X(i,`sigilID`)||X(i,`glyphId`)||void 0,h=re({url:e,pulse:r,caption:mt,body:dt,author:s.trim()?s.trim():void 0,source:`manual`,sigilId:m,phiKey:Q&&x?x:void 0,kaiSignature:Q&&C?C:void 0,ts:a,attachments:u,parentUrl:d,originUrl:f});H(`prepare`);let g=Z(),_=await Xe(w(h,{cacheName:`sigil-attachments-v1`,pathPrefix:`/att/`}),2e4,`preparePayloadForLink`),y=Z()-g,b=_;if(q){let e={body:_.body??null,attachments:_.attachments??null},t;if(J===`derived`){let n=Y.trim()?Y.trim():le(18);n!==Y&&Oe(n),t=await ce({inner:e,teaser:mt??void 0,derived:{issuerKaiSignature:C,issuerPhiKey:x||void 0,salt_b64url:n}})}else{let n=ke.map(e=>({phiKey:e.phiKey,kaiSignature:e.kaiSignature,sigilId:e.sigilId}));t=await ce({inner:e,teaser:mt??void 0,allowGlyphs:n})}b={..._,body:void 0,attachments:void 0,seal:t}}H(`encode(worker)`);let ee=Z(),S=await Xe(et(b),3e4,`encodeTokenWithBudgets(worker)`),T=Z()-ee;if(!S.ok){fe({stage:`encode(worker)`,totalMs:Z()-o,prepareMs:y,encodeMs:S.ms,items:l.length,inlinedBytes:u?.inlinedBytes,totalBytes:u?.totalBytes,note:S.error}),W(`Token encode failed: ${S.error}. If you have a strict CSP, allow module workers from 'self' (worker-src 'self'). This build uses a real worker file (no blob workers).`);return}let{token:E,withinHard:D}=S;be(E.length);let te=globalThis.location?.origin??`https://kaiklok.com`,k=D?`${te}/stream/p/${encodeURIComponent(E)}`:`${te}/stream#t=${E}`;Ce(D?`path`:`hash`),E.length>3500?G(`Token exceeds hard path limit (${E.length.toLocaleString()} > ${p.toLocaleString()}). Using hash URL to avoid request-line limits.`):E.length>1800&&G(`Token is large (${E.length.toLocaleString()} chars). Prefer trimming inlined files or relying on external URLs.`),H(`register`),P(k),H(`clipboard`);try{await navigator.clipboard.writeText(k),K(!0)}catch{K(!1)}ve(k),fe({stage:`done`,totalMs:Z()-o,prepareMs:y,encodeMs:T,tokenLen:E.length,items:l.length,inlinedBytes:u?.inlinedBytes,totalBytes:u?.totalBytes}),n&&n({shareUrl:k,token:E,payload:b})}catch(e){let t=e instanceof Error?e.message:typeof e==`string`?e:`Failed to generate link.`;W(t),fe({stage:de||`unknown`,totalMs:Z()-o,note:t})}finally{H(``),ue(!1)}},xt=()=>{o(e||``),l(t||``),d(`text`),m(`tsx`),g(`code`),D(``),k([]),st(),W(null),G(null),K(!1),ve(``),be(0),Ce(`path`),H(``),fe(null),De(``),Ie(!1),L&&(URL.revokeObjectURL(L.url),R(null))},St=e=>t=>e(t.target.value),Ct=(0,B.useMemo)(()=>{if(!Q)return null;let e=He(i,`pulse`);return(0,V.jsxs)(`div`,{className:`id-banner`,role:`status`,"aria-live":`polite`,children:[(0,V.jsx)(`span`,{className:`id-dot`}),(0,V.jsxs)(`span`,{className:`id-text`,children:[`Verified by Sigil — ΦKey `,(0,V.jsx)(`strong`,{children:Re(x)}),` • `,`Last verified pulse `,(0,V.jsx)(`strong`,{children:e??`—`})]}),(0,V.jsxs)(`span`,{className:`id-sub mono`,children:[`ΣSig `,Re(C)]})]})},[Q,x,C,i]),wt=(0,B.useMemo)(()=>$?(0,V.jsxs)(`div`,{className:`composer`,children:[(0,V.jsx)(`label`,{className:`composer-label`,children:`Proof Of Breath™ URL`}),(0,V.jsxs)(`div`,{className:`composer-input-row`,children:[(0,V.jsx)(`input`,{className:`composer-input locked`,type:`url`,value:$,readOnly:!0}),(0,V.jsx)(`button`,{type:`button`,className:`composer-aux`,onClick:async()=>{try{await navigator.clipboard.writeText($),K(!0),window.setTimeout(()=>K(!1),1200)}catch{}},title:`Remember Proof Of Breath™ URL`,children:ge?`Remembered ✓`:`Remember`})]}),!Be($)&&(0,V.jsx)(`div`,{className:`composer-hint warn`,children:`No canonical stream token detected in the URL. Fallback will still produce a valid post.`})]}):null,[$,ge]),Tt=(0,V.jsxs)(`div`,{className:`composer`,children:[(0,V.jsx)(`label`,{className:`composer-label`,children:`Privacy Seal`}),(0,V.jsxs)(`div`,{className:`story-actions`,style:{alignItems:`center`,gap:10},children:[(0,V.jsx)(`button`,{type:`button`,className:`pill ${q?`prim`:`subtle`}`,onClick:()=>{we(e=>!e),W(null),G(null)},title:`Toggle Private (Sealed)`,children:q?`Private: ON`:`Private: OFF`}),q&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`button`,{type:`button`,className:`pill ${J===`derived`?`prim`:`subtle`}`,onClick:()=>Te(`derived`),title:`Derived glyph access`,children:`Derived`}),(0,V.jsx)(`button`,{type:`button`,className:`pill ${J===`glyph`?`prim`:`subtle`}`,onClick:()=>Te(`glyph`),title:`Specific glyph allowlist`,children:`Specific Glyph`}),(0,V.jsx)(`button`,{type:`button`,className:`pill ${Fe?`prim`:`subtle`}`,onClick:()=>Ie(e=>!e),title:`Show advanced sealing details`,children:`Advanced`})]})]}),q&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`composer-hint`,children:[`Private (Sealed) encrypts `,(0,V.jsx)(`span`,{className:`mono`,children:`body + seals`}),` inside the token. The outer post remains verifiable (ΦKey/ΣSig) but does not contain plaintext content.`]}),(0,V.jsxs)(`div`,{className:`composer`,style:{padding:0,marginTop:10},children:[(0,V.jsx)(`label`,{className:`composer-label`,children:`Public teaser (optional)`}),(0,V.jsx)(`input`,{className:`composer-input`,type:`text`,value:Ee,onChange:St(De),placeholder:`What should be visible without unlocking?`,maxLength:240}),(0,V.jsxs)(`div`,{className:`composer-hint`,children:[`If empty, the public message becomes `,(0,V.jsx)(`span`,{className:`mono`,children:`Sealed Memory`}),`.`]})]}),J===`derived`&&(0,V.jsxs)(`div`,{className:`composer`,style:{padding:0,marginTop:10},children:[(0,V.jsx)(`label`,{className:`composer-label`,children:`Derivation salt (for verifier export)`}),(0,V.jsxs)(`div`,{className:`composer-input-row`,children:[(0,V.jsx)(`input`,{className:`composer-input mono`,type:`text`,readOnly:!0,value:Y}),(0,V.jsx)(`button`,{type:`button`,className:`composer-aux`,onClick:()=>Oe(le(18)),title:`Rotate derivation salt`,children:`Rotate`}),(0,V.jsx)(`button`,{type:`button`,className:`composer-aux`,onClick:async()=>{try{await navigator.clipboard.writeText(Y),K(!0),window.setTimeout(()=>K(!1),900)}catch{}},title:`remember salt`,children:`Remember`})]}),Fe&&(0,V.jsx)(`div`,{className:`composer-hint mono`,style:{marginTop:8},children:Q&&C.trim()?(0,V.jsxs)(V.Fragment,{children:[`Derived ΣSig (b64url, post-scoped): `,(0,V.jsx)(`button`,{type:`button`,className:`pill subtle`,onClick:async()=>{try{let e=await je({baseKaiSignature:C,salt_b64url:Y});await navigator.clipboard.writeText(e),K(!0),window.setTimeout(()=>K(!1),900)}catch{}},title:`Copy derived signature`,children:`Remember derived ΣSig`}),(0,V.jsx)(`span`,{className:`dim`,style:{marginLeft:8},children:`(secret-equivalent; only for issuer export workflows)`})]}):`Derived preview unavailable (missing verified ΣSig).`})]}),J===`glyph`&&(0,V.jsxs)(`div`,{className:`composer`,style:{padding:0,marginTop:10},children:[(0,V.jsx)(`label`,{className:`composer-label`,children:`Allowed glyphs (upload SVG)`}),(0,V.jsxs)(`div`,{className:`story-actions`,style:{alignItems:`center`},children:[(0,V.jsxs)(`label`,{className:`pill`,children:[(0,V.jsx)(`input`,{type:`file`,accept:`.svg,image/svg+xml`,multiple:!0,className:`visually-hidden`,onChange:async e=>{let t=e.target.files?Array.from(e.target.files):[];e.currentTarget.value=``,t.length!==0&&await vt(t)}}),`Seal allowed glyphs…`]}),ke.length>0&&(0,V.jsx)(`button`,{type:`button`,className:`pill subtle`,onClick:()=>Ae([]),title:`Clear allowlist`,children:`Clear`})]}),ke.length>0&&(0,V.jsx)(`ul`,{className:`url-list`,style:{marginTop:10},children:ke.map((e,t)=>(0,V.jsxs)(`li`,{className:`url-item`,style:{alignItems:`center`},children:[(0,V.jsx)(`span`,{className:`badge`,children:`glyph`}),(0,V.jsx)(`span`,{className:`mono`,children:qe(e.label,36)}),(0,V.jsxs)(`span`,{className:`dim`,style:{marginLeft:10},children:[`ΦKey `,Re(e.phiKey,10,8)]}),(0,V.jsx)(`button`,{type:`button`,className:`pill danger`,onClick:()=>yt(t),title:`Remove glyph`,children:`✕`})]},`${e.phiKey}:${e.kaiSignature}:${t}`))}),(0,V.jsxs)(`div`,{className:`composer-hint`,style:{marginTop:8},children:[`This is `,(0,V.jsx)(`strong`,{children:`not`}),` pulse-locked — if a user possesses an allowed glyph (its ΣSig), they can unlock sealed posts across pulses.`]})]}),(0,V.jsxs)(`div`,{className:`composer-hint warn`,style:{marginTop:10},children:[`Private (Sealed) hard-guard: no cache-backed `,(0,V.jsx)(`span`,{className:`mono`,children:`file-ref`}),` attachments. Use URLs or keep files ≤`,` `,(0,V.jsx)(`strong`,{children:Le(Pe)}),`.`]}),_t]})]}),Et=(0,V.jsxs)(`div`,{className:`attachments`,children:[(0,V.jsx)(`h3`,{className:`attachments-title`,children:`Seals`}),(0,V.jsxs)(`div`,{className:`composer`,children:[(0,V.jsx)(`label`,{className:`composer-label`,children:`Seal a memory`}),(0,V.jsxs)(`div`,{className:`story-actions`,children:[(0,V.jsx)(`button`,{type:`button`,className:`pill prim icon-only${q?` disabled`:``}`,"aria-label":`Open Memory Recorder`,title:q?`Private mode: story capture is disabled (cache-backed)`:`Record story`,onClick:()=>{if(q){G(`Private (Sealed) mode disables story recording (cache-backed file refs). Add as URL instead.`);return}I(!0)},disabled:q,children:(0,V.jsx)(Me,{})}),L&&(0,V.jsxs)(`div`,{className:`story-preview`,children:[(0,V.jsx)(`video`,{src:L.url,playsInline:!0,controls:!0,className:`story-preview-video`}),(0,V.jsx)(`div`,{className:`story-preview-meta mono`,children:Ge(L.durationMs)}),(0,V.jsx)(`button`,{type:`button`,className:`pill danger icon-only`,onClick:()=>{URL.revokeObjectURL(L.url),R(null)},"aria-label":`Remove recorded preview`,title:`Remove preview`,children:(0,V.jsx)(Ne,{})})]})]})]}),(0,V.jsxs)(`div`,{className:`composer`,children:[(0,V.jsx)(`label`,{className:`composer-label`,children:`Seal any URL`}),(0,V.jsxs)(`div`,{className:`composer-input-row`,children:[(0,V.jsx)(`input`,{className:`composer-input`,type:`url`,placeholder:`https://example.com/docs/your-file.pdf`,value:E,onChange:St(D),autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1}),(0,V.jsx)(`button`,{type:`button`,className:`composer-aux`,onClick:Qe,title:`Add URL`,children:`Seal`})]}),O.length>0&&(0,V.jsx)(`ul`,{className:`url-list`,children:O.map((e,t)=>(0,V.jsxs)(`li`,{className:`url-item`,children:[(0,V.jsx)(`span`,{className:`mono`,children:Re(e.url,28,16)}),(0,V.jsx)(`button`,{type:`button`,className:`pill danger`,onClick:()=>$e(t),title:`Remove URL`,children:`✕`})]},`${e.url}-${t}`))})]}),(0,V.jsx)(`div`,{ref:Ze,className:`dropzone`,onDragOver:ot,onDrop:at,"aria-label":`Drop files or folders here`,children:(0,V.jsxs)(`div`,{className:`dropzone-inner`,children:[(0,V.jsx)(`div`,{className:`dz-title`,children:`Seal files or folders`}),(0,V.jsxs)(`div`,{className:`dz-sub`,children:[`Tiny files get inlined; large files become cache-backed refs.`,q?(0,V.jsxs)(V.Fragment,{children:[` `,(0,V.jsx)(`strong`,{children:`(Private mode skips large files.)`})]}):null]}),(0,V.jsxs)(`div`,{className:`dz-actions`,children:[(0,V.jsxs)(`label`,{className:`pill`,children:[(0,V.jsx)(`input`,{type:`file`,multiple:!0,onChange:it,className:`visually-hidden`}),`Inhale files…`]}),(0,V.jsxs)(`label`,{className:`pill`,children:[(0,V.jsx)(`input`,{type:`file`,multiple:!0,webkitdirectory:``,onChange:it,className:`visually-hidden`}),`Inhale folder…`]}),ne.length>0&&(0,V.jsx)(`button`,{type:`button`,className:`pill subtle`,onClick:st,children:`Reset`})]})]})}),M.items.length>0&&(0,V.jsxs)(`div`,{className:`file-summary`,children:[(0,V.jsxs)(`div`,{className:`composer-hint`,children:[`Items: `,(0,V.jsx)(`strong`,{children:M.items.length}),` • Files total: `,(0,V.jsx)(`strong`,{children:Le(M.totalBytes??0)}),` • Inlined:`,` `,(0,V.jsx)(`strong`,{children:Le(M.inlinedBytes??0)}),` (≤ `,Le(Pe),` each)`]}),(0,V.jsx)(`ul`,{className:`file-list`,children:M.items.map((e,t)=>{if(e.kind===`url`)return(0,V.jsx)(`li`,{className:`file-item`,children:(0,V.jsxs)(`div`,{className:`file-row`,children:[(0,V.jsx)(`span`,{className:`badge`,children:`url`}),(0,V.jsx)(`span`,{className:`mono`,children:Re(e.url,34,18)})]})},`url-${t}`);let n=e.name??`file-${t}`,r=e.kind===`file-inline`,i=`type`in e&&typeof e.type==`string`?e.type:`application/octet-stream`,a=`size`in e&&typeof e.size==`number`?e.size:0;return(0,V.jsx)(`li`,{className:`file-item`,children:(0,V.jsxs)(`div`,{className:`file-row`,children:[(0,V.jsx)(`span`,{className:`badge`,children:r?`inline`:`file`}),(0,V.jsx)(`span`,{className:`mono`,children:n}),(0,V.jsxs)(`span`,{className:`dim`,children:[i,` • `,Le(a)]})]})},`${n}-${t}`)})}),M.items.some(e=>e.kind===`file-ref`)&&(0,V.jsxs)(`div`,{className:`composer-hint ${q?`warn`:``}`,children:[`Large files are cached and referenced by SHA-256.`,q?` Private (Sealed) will refuse these — attach public URLs instead.`:` You can also host publicly and attach the public URL above.`]})]})]}),Dt=u===`code`?10:3,Ot=u===`code`?`Paste your code…`:u===`md`?`Write markdown…`:u===`html`?`Write HTML… (default renders as escaped code unless sanitized by the stream UI)`:`What Resonants About This Moment…`,kt=z||q&&J===`derived`&&!ht||q&&J===`glyph`&&!gt||q&&pt;return(0,V.jsxs)(`div`,{className:`social-connector-container`,children:[(0,V.jsx)(`h2`,{className:`social-connector-title`,children:`KaiVoh`}),(0,V.jsxs)(`p`,{className:`social-connector-sub`,children:[`Exhale a sealed `,(0,V.jsx)(`strong`,{children:`Memory Stream`}),`.`]}),Ct,wt,Tt,(0,V.jsxs)(`div`,{className:`composer`,children:[(0,V.jsx)(`label`,{className:`composer-label`,children:`Body Format`}),(0,V.jsxs)(`div`,{className:`story-actions`,children:[(0,V.jsx)(`button`,{type:`button`,className:`pill ${u===`text`?`prim`:`subtle`}`,onClick:()=>d(`text`),title:`Text`,children:`Text`}),(0,V.jsx)(`button`,{type:`button`,className:`pill ${u===`code`?`prim`:`subtle`}`,onClick:()=>d(`code`),title:`Code`,children:`Code`}),(0,V.jsx)(`button`,{type:`button`,className:`pill ${u===`md`?`prim`:`subtle`}`,onClick:()=>d(`md`),title:`Markdown`,children:`MD`}),(0,V.jsx)(`button`,{type:`button`,className:`pill ${u===`html`?`prim`:`subtle`}`,onClick:()=>d(`html`),title:`HTML`,children:`HTML`}),u===`code`&&(0,V.jsx)(`input`,{className:`composer-input`,style:{maxWidth:160},value:f,onChange:St(m),placeholder:`lang (tsx)`,"aria-label":`Code language`,autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1}),u===`html`&&(0,V.jsxs)(`button`,{type:`button`,className:`pill ${h===`code`?`prim`:`subtle`}`,onClick:()=>g(e=>e===`code`?`sanitized`:`code`),title:`HTML mode (stream decides how to render)`,children:[`mode:`,h]})]}),(0,V.jsxs)(`div`,{className:`composer-hint`,children:[`v2 posts include `,(0,V.jsx)(`span`,{className:`mono`,children:`body.kind`}),` so the stream can render code as code (escaped) instead of treating everything as plain text.`,q?(0,V.jsx)(V.Fragment,{children:` In Private mode, the body is sealed and not visible until unlocked.`}):null]})]}),(0,V.jsxs)(`div`,{className:`composer two`,children:[(0,V.jsxs)(`div`,{className:`field`,children:[(0,V.jsxs)(`label`,{htmlFor:`caption`,className:`composer-label`,children:[`Memory `,(0,V.jsx)(`span`,{className:`muted`,children:`(Body)`})]}),(0,V.jsx)(`textarea`,{id:`caption`,className:`composer-textarea${u===`code`?` mono`:``}`,rows:Dt,placeholder:Ot,value:a,onChange:St(o),spellCheck:u!==`code`})]}),(0,V.jsxs)(`div`,{className:`field`,children:[(0,V.jsxs)(`label`,{htmlFor:`author`,className:`composer-label`,children:[`Author Handle `,(0,V.jsx)(`span`,{className:`muted`,children:`(optional, e.g., @KaiRexKlok)`})]}),(0,V.jsx)(`input`,{id:`author`,className:`composer-input`,type:`text`,placeholder:`@handle`,value:s,onChange:St(l),autoCorrect:`off`,autoCapitalize:`none`})]})]}),Et,pe&&(0,V.jsx)(`div`,{className:`composer-error`,children:pe}),he&&!pe&&(0,V.jsx)(`div`,{className:`composer-warn`,children:he}),(z||U)&&(0,V.jsxs)(`div`,{className:`composer-hint mono`,"aria-live":`polite`,children:[z&&de?`stage: ${de}`:null,U?(0,V.jsxs)(V.Fragment,{children:[z&&de?` • `:null,`total ${Math.round(U.totalMs)}ms`,typeof U.prepareMs==`number`?` • prepare ${Math.round(U.prepareMs)}ms`:``,typeof U.encodeMs==`number`?` • encode ${Math.round(U.encodeMs)}ms`:``,typeof U.tokenLen==`number`?` • token ${U.tokenLen.toLocaleString()}`:``,typeof U.items==`number`?` • items ${U.items}`:``,typeof U.inlinedBytes==`number`?` • inlined ${Le(U.inlinedBytes)}`:``,typeof U.totalBytes==`number`?` • bytes ${Le(U.totalBytes)}`:``,U.note?` • note: ${U.note}`:``]}):null]}),(0,V.jsxs)(`div`,{className:`composer-actions`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:bt,className:`composer-submit`,disabled:kt,title:kt?`Fix sealing requirements / attachments to proceed`:`Exhale Stream`,children:z?`Exhaling…${de?` (${de})`:``}`:q?`Exhale Sealed Stream`:`Exhale Stream`}),(0,V.jsx)(`button`,{type:`button`,className:`composer-reset`,onClick:xt,children:`Reset`})]}),_e&&(0,V.jsxs)(`div`,{className:`composer-result`,children:[(0,V.jsx)(`label`,{htmlFor:`gen-url`,className:`composer-label`,children:`Your shareable link`}),(0,V.jsx)(`input`,{id:`gen-url`,className:`composer-input`,type:`text`,readOnly:!0,value:_e,onFocus:e=>e.currentTarget.select()}),(0,V.jsxs)(`div`,{className:`composer-actions`,children:[(0,V.jsx)(`button`,{type:`button`,className:`composer-copy`,onClick:async()=>{try{await navigator.clipboard.writeText(_e),K(!0)}catch{K(!1)}},children:ge?`Remembered ✓`:`Remember`}),(0,V.jsx)(`a`,{className:`composer-open`,href:_e,target:`_blank`,rel:`noopener noreferrer`,children:`Open in new tab →`})]}),(0,V.jsxs)(`p`,{className:`composer-hint`,children:[`Token length: `,(0,V.jsx)(`strong`,{children:ye.toLocaleString()}),` chars • URL mode:`,` `,(0,V.jsx)(`strong`,{children:xe===`path`?`path`:`hash`}),` • soft `,1800 .toLocaleString(),` • hard`,` `,3500 .toLocaleString(),q?(0,V.jsxs)(V.Fragment,{children:[` `,`• `,(0,V.jsx)(`strong`,{children:`sealed`})]}):null]})]}),(0,V.jsx)(me,{isOpen:F,onClose:()=>I(!1),onCaptured:lt,maxDurationMs:15e3,preferredFacingMode:`user`})]})}var nt=50*1024*1024,rt=10;function it(e){if(e===0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=1024,r=Math.floor(Math.log(e)/Math.log(n)),i=e/n**+r;return`${i.toFixed(i>=10?0:1)} ${t[r]}`}function at(e){let{type:t,name:n}=e,r=n.toLowerCase();return t.startsWith(`image/`)?`image`:t.startsWith(`video/`)?`video`:t.startsWith(`audio/`)?`audio`:t===`application/pdf`||t.startsWith(`text/`)||t.includes(`word`)||t.includes(`officedocument`)||t.includes(`spreadsheet`)||t.includes(`presentation`)?`document`:r.endsWith(`.zip`)||r.endsWith(`.rar`)||r.endsWith(`.7z`)||r.endsWith(`.tar`)||r.endsWith(`.gz`)?`archive`:`other`}var ot={image:`Image`,video:`Video`,audio:`Audio`,document:`Document`,archive:`Archive`,other:`File`};function st(e){return[e.name,e.size,e.lastModified,k(),Math.random().toString(36).slice(2,8)].join(`-`)}function ct(e){return e.length===0?null:(e.find(e=>e.kind===`image`||e.kind===`video`)??e[0])?.id??null}function lt(e){return`${e.name}:${e.size}:${e.lastModified}`}function ut({onReady:e}){let t=(0,B.useRef)(null),n=(0,B.useRef)(null),r=(0,B.useRef)(null),[i,a]=(0,B.useState)([]),[o,s]=(0,B.useState)(null),[c,l]=(0,B.useState)(null),[u,d]=(0,B.useState)(`file`),[f,p]=(0,B.useState)(``),[m,h]=(0,B.useState)(``),[g,_]=(0,B.useState)(`general`),[v,y]=(0,B.useState)(``),[b,x]=(0,B.useState)(``),[ee,S]=(0,B.useState)(``),[C,w]=(0,B.useState)(``),[T,E]=(0,B.useState)(``),[D,O]=(0,B.useState)(``),[te,k]=(0,B.useState)(!1),[ne,re]=(0,B.useState)(!1),[A,j]=(0,B.useState)(null),[ie,M]=(0,B.useState)(!1),[ae,oe]=(0,B.useState)(!1),se=1e3,N=i.length>0,P=g===`legal-contract`,ce=(0,B.useMemo)(()=>i.reduce((e,t)=>e+t.file.size,0),[i]),le=(0,B.useMemo)(()=>N?it(ce):`0 B`,[N,ce]),F=(0,B.useMemo)(()=>P?v.trim().length>0&&b.trim().length>0:!0,[P,v,b]),I=(0,B.useMemo)(()=>N?F?3:2:1,[N,F]),L=(0,B.useMemo)(()=>I===1?P?`Attach your agreement, annexes, and evidence`:`Attach the media or files you want to seal`:I===2?P?`Describe the agreement and parties`:`Add context: caption, link, and tags`:P?`Review and seal as a legal record`:`Review and seal to the KaiVoh stream`,[I,P]),R=(0,B.useCallback)(()=>{n.current&&=(URL.revokeObjectURL(n.current),null),r.current=null},[]);(0,B.useEffect)(()=>()=>{R()},[R]);let z=(0,B.useCallback)((e,t)=>{let i=t!==null&&e.some(e=>e.id===t)?t:ct(e);if(s(i),!i){c&&(R(),l(null)),u!==`file`&&d(`file`);return}let a=e.find(e=>e.id===i)??null;if(!a){c&&(R(),l(null)),u!==`file`&&d(`file`);return}if(a.kind===`image`||a.kind===`video`){let e=a.kind;u!==e&&d(e);let t=lt(a.file);if(!(i===o&&r.current===t&&typeof c==`string`&&c.length>0)){R();let e=URL.createObjectURL(a.file);n.current=e,r.current=t,l(e)}return}u!==`file`&&d(`file`),c&&(R(),l(null))},[R,o,u,c,s,d,l]),ue=(0,B.useCallback)(()=>{a([]),s(null),R(),l(null),d(`file`),p(``),h(``),_(`general`),y(``),x(``),S(``),w(``),E(``),O(``),k(!1),re(!1),j(null),oe(!1),t.current&&(t.current.value=``)},[R]),de=(0,B.useCallback)(e=>{let t=Array.isArray(e)?e:Array.from(e);if(t.length===0)return;let n=!1,r=!1,s=[...i];for(let e of t){if(s.length>=rt){r=!0;break}if(e.size>nt){n=!0;continue}if(s.some(t=>t.file.name===e.name&&t.file.size===e.size&&t.file.lastModified===e.lastModified))continue;let t=at(e),i={id:st(e),file:e,kind:t};s=[...s,i]}s.length===i.length&&!n?r||j(`No new files were added (duplicates or all invalid).`):j(null),n?j(`Some files were too large. Max individual file size is ${it(nt)}.`):r&&j(`You can attach up to ${rt} files per sealed post. Remove one to add another.`),a(s),z(s,o)},[i,o,z]),H=e=>{let t=e.target.files;!t||t.length===0||de(t)},U=e=>{e.preventDefault(),e.stopPropagation(),M(!1);let t=e.dataTransfer.files;!t||t.length===0||de(t)},fe=e=>{e.preventDefault(),e.stopPropagation()},pe=e=>{e.preventDefault(),e.stopPropagation(),M(!0)},W=e=>{e.preventDefault(),e.stopPropagation(),e.currentTarget===e.target&&M(!1)},me=()=>{t.current?.click()},he=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),me())},G=e=>{let t=i.filter(t=>t.id!==e);a(t),z(t,o===e?null:o)},ge=e=>{s(e),z(i,e)},K=()=>{if(!N){j(`Attach at least one file to seal.`);return}if(P&&!F){j(`Fill in the agreement title and counterparty to seal legally.`);return}let t=m.trim();if(t.length>0)try{new URL(t)}catch{j(`The link URL looks invalid. Please check it.`);return}let n=(o?i.find(e=>e.id===o):null)??i[0]??null;if(!n){j(`Something went wrong selecting the primary attachment.`);return}let r=f.trim(),a=P?{agreementTitle:v.trim()||void 0,counterpartyName:b.trim()||void 0,counterpartyEmail:ee.trim()||void 0,jurisdiction:C.trim()||void 0,effectiveDateIso:T||void 0,referenceCode:D.trim()||void 0,isConfidential:te,includesPersonalData:ne}:void 0;oe(!0),e({mediaType:n.kind===`image`||n.kind===`video`?n.kind:`file`,file:n.file,caption:r.length>0?r:void 0,attachments:i,mainAttachmentId:n.id,postKind:g,legalMeta:a,linkUrl:t.length>0?t:void 0})},_e=(0,B.useMemo)(()=>{if(!N)return null;let e=i.length;return`${e===1?`1 attached file`:`${e} attached files total`} • ${le}`},[i,N,le]);return(0,V.jsxs)(`div`,{className:`kv-post-composer flex flex-col items-center gap-4 p-6 w-full`,children:[(0,V.jsxs)(`div`,{className:`kv-post-header w-full max-w-xl flex flex-col gap-2`,children:[(0,V.jsxs)(`div`,{className:`kv-post-step-row flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`kv-post-step-badge`,children:[(0,V.jsx)(`span`,{className:`kv-post-step-number`,children:I}),(0,V.jsx)(`span`,{className:`kv-post-step-label`,children:L})]}),N&&(0,V.jsx)(`button`,{type:`button`,className:`kv-post-reset-btn`,onClick:ue,children:`Reset`})]}),(0,V.jsx)(`p`,{className:`kv-post-subtitle`,children:`Attach images, videos, PDFs, DOCX, ZIPs—anything you want sealed to your Kai-Signature. For contracts, add parties and jurisdiction so this becomes a usable, timestamped record.`}),(0,V.jsxs)(`div`,{className:`kv-post-kind-row flex flex-wrap items-center gap-3 mt-1`,children:[(0,V.jsx)(`label`,{className:`kv-post-kind-label`,htmlFor:`kv-post-kind`,children:`Intent`}),(0,V.jsxs)(`select`,{id:`kv-post-kind`,className:`kv-post-kind-select`,value:g,onChange:e=>_(e.target.value),children:[(0,V.jsx)(`option`,{value:`general`,children:`General post / media`}),(0,V.jsx)(`option`,{value:`legal-contract`,children:`Legal contract / agreement`}),(0,V.jsx)(`option`,{value:`evidence`,children:`Evidence / proof bundle`}),(0,V.jsx)(`option`,{value:`announcement`,children:`Public announcement / notice`}),(0,V.jsx)(`option`,{value:`private-note`,children:`Private note / internal record`})]})]})]}),A&&(0,V.jsx)(`div`,{className:`kv-post-error w-full max-w-xl`,role:`alert`,children:A}),(0,V.jsx)(`div`,{className:`w-full max-w-xl`,children:(0,V.jsx)(`div`,{className:[`kv-post-dropzone`,ie?`kv-post-dropzone--dragging`:``,N?`kv-post-dropzone--has-media`:``].join(` `).trim(),tabIndex:0,role:`button`,"aria-label":`Choose or drop files to attach`,onClick:me,onKeyDown:he,onDragOver:fe,onDragEnter:pe,onDragLeave:W,onDrop:U,children:(0,V.jsxs)(`div`,{className:`kv-post-dropzone-inner`,children:[(0,V.jsx)(`div`,{className:`kv-post-dropzone-icon`,children:N?`🔄`:ie?`🌀`:`📁`}),(0,V.jsxs)(`div`,{className:`kv-post-dropzone-text`,children:[(0,V.jsx)(`div`,{className:`kv-post-dropzone-title`,children:N?`Add or replace attached files`:`Tap or drop files to start`}),(0,V.jsx)(`div`,{className:`kv-post-dropzone-hint`,children:`Images, videos, PDFs, DOCX, ZIPs, audio, and more • Drag & drop or tap to choose`}),(0,V.jsxs)(`div`,{className:`kv-post-dropzone-meta`,children:[`Max `,rt,` files • `,it(nt),` per file`]})]})]})})}),N&&(0,V.jsxs)(`div`,{className:`kv-post-body w-full max-w-xl mt-2`,children:[c&&(0,V.jsxs)(`div`,{className:`kv-post-preview`,children:[u===`image`&&(0,V.jsx)(`img`,{src:c,alt:`Primary attachment preview`,className:`kv-post-preview-media`}),u===`video`&&(0,V.jsx)(`video`,{src:c,controls:!0,className:`kv-post-preview-media`})]}),(0,V.jsxs)(`div`,{className:`kv-post-attachments`,children:[(0,V.jsxs)(`div`,{className:`kv-post-attachments-header flex justify-between items-center`,children:[(0,V.jsx)(`div`,{className:`kv-post-attachments-title`,children:`Attachments`}),_e&&(0,V.jsx)(`div`,{className:`kv-post-attachments-summary`,children:_e})]}),(0,V.jsx)(`ul`,{className:`kv-post-attachments-list`,children:i.map(e=>{let t=e.id===o;return(0,V.jsxs)(`li`,{className:[`kv-post-attachment-item`,t?`kv-post-attachment-item--primary`:``].join(` `).trim(),children:[(0,V.jsxs)(`div`,{className:`kv-post-attachment-main`,children:[(0,V.jsx)(`div`,{className:`kv-post-attachment-name`,children:e.file.name}),(0,V.jsxs)(`div`,{className:`kv-post-attachment-meta`,children:[(0,V.jsxs)(`span`,{children:[ot[e.kind],` • `,it(e.file.size)]}),t&&(0,V.jsx)(`span`,{className:`kv-post-attachment-pill`,children:`Primary`})]})]}),(0,V.jsxs)(`div`,{className:`kv-post-attachment-actions`,children:[!t&&(0,V.jsx)(`button`,{type:`button`,className:`kv-post-attachment-btn`,onClick:()=>ge(e.id),children:`Set as primary`}),(0,V.jsx)(`button`,{type:`button`,className:`kv-post-attachment-btn kv-post-attachment-btn--danger`,onClick:()=>G(e.id),children:`Remove`})]})]},e.id)})})]}),(0,V.jsxs)(`div`,{className:`kv-post-caption-block mt-4`,children:[(0,V.jsx)(`label`,{htmlFor:`kv-post-caption`,className:`kv-post-caption-label`,children:`Caption / description (optional)`}),(0,V.jsx)(`textarea`,{id:`kv-post-caption`,placeholder:P?`Summarize what this agreement covers, key obligations, or why you are sealing it now…`:`Describe the moment, the pulse, or what this bundle of files represents…`,className:`kv-post-caption-textarea`,rows:3,maxLength:se,value:f,onChange:e=>p(e.target.value)}),(0,V.jsx)(`div`,{className:`kv-post-caption-footer`,children:(0,V.jsxs)(`span`,{className:`kv-post-caption-count`,children:[f.length,`/`,se]})})]}),(0,V.jsxs)(`div`,{className:`kv-post-link-block mt-4`,children:[(0,V.jsx)(`label`,{htmlFor:`kv-post-link`,className:`kv-post-link-label`,children:`Canonical URL (optional)`}),(0,V.jsx)(`input`,{id:`kv-post-link`,type:`url`,inputMode:`url`,placeholder:`https://… (DMS link, IPFS URL, external system reference)`,className:`kv-post-link-input`,value:m,onChange:e=>h(e.target.value)}),(0,V.jsx)(`p`,{className:`kv-post-link-hint`,children:`This can point to the master copy of the contract, folder, or evidence bundle. It will be sealed alongside the files.`})]}),g===`legal-contract`&&(0,V.jsxs)(`div`,{className:`kv-post-legal-block mt-6`,children:[(0,V.jsx)(`div`,{className:`kv-post-legal-header`,children:`Legal details for this agreement`}),(0,V.jsxs)(`div`,{className:`kv-post-legal-grid`,children:[(0,V.jsxs)(`div`,{className:`kv-post-legal-field`,children:[(0,V.jsxs)(`label`,{htmlFor:`kv-legal-title`,className:`kv-post-legal-label`,children:[`Agreement title `,(0,V.jsx)(`span`,{className:`kv-post-legal-required`,children:`*`})]}),(0,V.jsx)(`input`,{id:`kv-legal-title`,type:`text`,className:`kv-post-legal-input`,placeholder:`e.g. Master Services Agreement, NDA, Licensing Deal…`,value:v,onChange:e=>y(e.target.value)})]}),(0,V.jsxs)(`div`,{className:`kv-post-legal-field`,children:[(0,V.jsxs)(`label`,{htmlFor:`kv-legal-counterparty`,className:`kv-post-legal-label`,children:[`Counterparty name `,(0,V.jsx)(`span`,{className:`kv-post-legal-required`,children:`*`})]}),(0,V.jsx)(`input`,{id:`kv-legal-counterparty`,type:`text`,className:`kv-post-legal-input`,placeholder:`Person or organization`,value:b,onChange:e=>x(e.target.value)})]}),(0,V.jsxs)(`div`,{className:`kv-post-legal-field`,children:[(0,V.jsx)(`label`,{htmlFor:`kv-legal-email`,className:`kv-post-legal-label`,children:`Counterparty contact (optional)`}),(0,V.jsx)(`input`,{id:`kv-legal-email`,type:`email`,className:`kv-post-legal-input`,placeholder:`Email or contact handle`,value:ee,onChange:e=>S(e.target.value)})]}),(0,V.jsxs)(`div`,{className:`kv-post-legal-field`,children:[(0,V.jsx)(`label`,{htmlFor:`kv-legal-jurisdiction`,className:`kv-post-legal-label`,children:`Jurisdiction (optional)`}),(0,V.jsx)(`input`,{id:`kv-legal-jurisdiction`,type:`text`,className:`kv-post-legal-input`,placeholder:`e.g. Ontario, Canada • Delaware, USA • EU-wide…`,value:C,onChange:e=>w(e.target.value)})]}),(0,V.jsxs)(`div`,{className:`kv-post-legal-field`,children:[(0,V.jsx)(`label`,{htmlFor:`kv-legal-effective`,className:`kv-post-legal-label`,children:`Effective date (optional)`}),(0,V.jsx)(`input`,{id:`kv-legal-effective`,type:`date`,className:`kv-post-legal-input`,value:T,onChange:e=>E(e.target.value)})]}),(0,V.jsxs)(`div`,{className:`kv-post-legal-field`,children:[(0,V.jsx)(`label`,{htmlFor:`kv-legal-ref`,className:`kv-post-legal-label`,children:`Reference code (optional)`}),(0,V.jsx)(`input`,{id:`kv-legal-ref`,type:`text`,className:`kv-post-legal-input`,placeholder:`Internal ID, contract number, matter code…`,value:D,onChange:e=>O(e.target.value)})]})]}),(0,V.jsxs)(`div`,{className:`kv-post-legal-flags mt-3`,children:[(0,V.jsxs)(`label`,{className:`kv-post-legal-flag`,children:[(0,V.jsx)(`input`,{type:`checkbox`,checked:te,onChange:e=>k(e.target.checked)}),(0,V.jsx)(`span`,{children:`This agreement is confidential`})]}),(0,V.jsxs)(`label`,{className:`kv-post-legal-flag`,children:[(0,V.jsx)(`input`,{type:`checkbox`,checked:ne,onChange:e=>re(e.target.checked)}),(0,V.jsx)(`span`,{children:`This bundle includes personal data (names, addresses, IDs, etc.)`})]})]}),(0,V.jsx)(`p`,{className:`kv-post-legal-hint mt-2`,children:`These details are sealed as metadata with the files and time pulse, creating a clear, timestamped record of what was agreed and with whom. This does not replace legal advice—use it as a hardened, auditable trail around your contracts.`})]})]}),(0,V.jsx)(`div`,{className:`kv-post-actions w-full max-w-xl mt-4 flex justify-end`,children:(0,V.jsx)(`button`,{type:`button`,className:`kv-post-submit-btn`,onClick:K,disabled:!N||ae,children:ae?`Sealing…`:`Seal with Breath`})}),(0,V.jsx)(`input`,{id:`kv-post-file-input`,type:`file`,multiple:!0,accept:`*/*`,ref:t,onChange:H,className:`kv-post-file-input`})]})}var dt=a(((e,t)=>{var n=`Input must be an string, Buffer or Uint8Array`;function r(e){let t;if(e instanceof Uint8Array)t=e;else if(typeof e==`string`)t=new TextEncoder().encode(e);else throw Error(n);return t}function i(e){return Array.prototype.map.call(e,function(e){return(e<16?`0`:``)+e.toString(16)}).join(``)}function a(e){return(4294967296+e).toString(16).substring(1)}function o(e,t,n){let r=` `+e+` = `;for(let i=0;i{var n=dt();function r(e,t,n){let r=e[t]+e[n],i=e[t+1]+e[n+1];r>=4294967296&&i++,e[t]=r,e[t+1]=i}function i(e,t,n,r){let i=e[t]+n;n<0&&(i+=4294967296);let a=e[t+1]+r;i>=4294967296&&a++,e[t]=i,e[t+1]=a}function a(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function o(e,t,n,a,o,s){let c=u[o],d=u[o+1],f=u[s],p=u[s+1];r(l,e,t),i(l,e,c,d);let m=l[a]^l[e],h=l[a+1]^l[e+1];l[a]=h,l[a+1]=m,r(l,n,a),m=l[t]^l[n],h=l[t+1]^l[n+1],l[t]=m>>>24^h<<8,l[t+1]=h>>>24^m<<8,r(l,e,t),i(l,e,f,p),m=l[a]^l[e],h=l[a+1]^l[e+1],l[a]=m>>>16^h<<16,l[a+1]=h>>>16^m<<16,r(l,n,a),m=l[t]^l[n],h=l[t+1]^l[n+1],l[t]=h>>>31^m<<1,l[t+1]=m>>>31^h<<1}var s=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),c=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map(function(e){return e*2})),l=new Uint32Array(32),u=new Uint32Array(32);function d(e,t){let n=0;for(n=0;n<16;n++)l[n]=e.h[n],l[n+16]=s[n];for(l[24]^=e.t,l[25]^=e.t/4294967296,t&&(l[28]=~l[28],l[29]=~l[29]),n=0;n<32;n++)u[n]=a(e.b,4*n);for(n=0;n<12;n++)o(0,8,16,24,c[n*16+0],c[n*16+1]),o(2,10,18,26,c[n*16+2],c[n*16+3]),o(4,12,20,28,c[n*16+4],c[n*16+5]),o(6,14,22,30,c[n*16+6],c[n*16+7]),o(0,10,20,30,c[n*16+8],c[n*16+9]),o(2,12,22,24,c[n*16+10],c[n*16+11]),o(4,14,16,26,c[n*16+12],c[n*16+13]),o(6,8,18,28,c[n*16+14],c[n*16+15]);for(n=0;n<16;n++)e.h[n]=e.h[n]^l[n]^l[n+16]}var f=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function p(e,t,n,r){if(e===0||e>64)throw Error(`Illegal output length, expected 0 < length <= 64`);if(t&&t.length>64)throw Error(`Illegal key, expected Uint8Array with 0 < length <= 64`);if(n&&n.length!==16)throw Error(`Illegal salt, expected Uint8Array with length is 16`);if(r&&r.length!==16)throw Error(`Illegal personal, expected Uint8Array with length is 16`);let i={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:e};f.fill(0),f[0]=e,t&&(f[1]=t.length),f[2]=1,f[3]=1,n&&f.set(n,32),r&&f.set(r,48);for(let e=0;e<16;e++)i.h[e]=s[e]^a(f,e*4);return t&&(m(i,t),i.c=128),i}function m(e,t){for(let n=0;n>2]>>8*(n&3);return t}function g(e,t,r,i,a){r||=64,e=n.normalizeInput(e),i&&=n.normalizeInput(i),a&&=n.normalizeInput(a);let o=p(r,t,i,a);return m(o,e),h(o)}function _(e,t,r,i,a){let o=g(e,t,r,i,a);return n.toHex(o)}t.exports={blake2b:g,blake2bHex:_,blake2bInit:p,blake2bUpdate:m,blake2bFinal:h}})),pt=a(((e,t)=>{var n=dt();function r(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function i(e,t,n,r,i,o){c[e]=c[e]+c[t]+i,c[r]=a(c[r]^c[e],16),c[n]=c[n]+c[r],c[t]=a(c[t]^c[n],12),c[e]=c[e]+c[t]+o,c[r]=a(c[r]^c[e],8),c[n]=c[n]+c[r],c[t]=a(c[t]^c[n],7)}function a(e,t){return e>>>t^e<<32-t}var o=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),s=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),c=new Uint32Array(16),l=new Uint32Array(16);function u(e,t){let n=0;for(n=0;n<8;n++)c[n]=e.h[n],c[n+8]=o[n];for(c[12]^=e.t,c[13]^=e.t/4294967296,t&&(c[14]=~c[14]),n=0;n<16;n++)l[n]=r(e.b,4*n);for(n=0;n<10;n++)i(0,4,8,12,l[s[n*16+0]],l[s[n*16+1]]),i(1,5,9,13,l[s[n*16+2]],l[s[n*16+3]]),i(2,6,10,14,l[s[n*16+4]],l[s[n*16+5]]),i(3,7,11,15,l[s[n*16+6]],l[s[n*16+7]]),i(0,5,10,15,l[s[n*16+8]],l[s[n*16+9]]),i(1,6,11,12,l[s[n*16+10]],l[s[n*16+11]]),i(2,7,8,13,l[s[n*16+12]],l[s[n*16+13]]),i(3,4,9,14,l[s[n*16+14]],l[s[n*16+15]]);for(n=0;n<8;n++)e.h[n]^=c[n]^c[n+8]}function d(e,t){if(!(e>0&&e<=32))throw Error(`Incorrect output length, should be in [1, 32]`);let n=t?t.length:0;if(t&&!(n>0&&n<=32))throw Error(`Incorrect key length, should be in [1, 32]`);let r={h:new Uint32Array(o),b:new Uint8Array(64),c:0,t:0,outlen:e};return r.h[0]^=16842752^n<<8^e,n>0&&(f(r,t),r.c=64),r}function f(e,t){for(let n=0;n>2]>>8*(n&3)&255;return t}function m(e,t,r){r||=32,e=n.normalizeInput(e);let i=d(r,t);return f(i,e),p(i)}function h(e,t,r){let i=m(e,t,r);return n.toHex(i)}t.exports={blake2s:m,blake2sHex:h,blake2sInit:d,blake2sUpdate:f,blake2sFinal:p}})),mt=E(a(((e,t)=>{var n=ft(),r=pt();t.exports={blake2b:n.blake2b,blake2bHex:n.blake2bHex,blake2bInit:n.blake2bInit,blake2bUpdate:n.blake2bUpdate,blake2bFinal:n.blake2bFinal,blake2s:r.blake2s,blake2sHex:r.blake2sHex,blake2sInit:r.blake2sInit,blake2sUpdate:r.blake2sUpdate,blake2sFinal:r.blake2sFinal}}))(),1),ht=5236,gt=50;function _t(e){return e===`root`||e===`sacral`||e===`solar`||e===`heart`||e===`throat`||e===`thirdEye`||e===`crown`||e===`krown`}function vt({post:e,identityKaiSignature:t,userPhiKey:n,onSealComplete:r}){let[i,a]=(0,B.useState)(`idle`),[o,s]=(0,B.useState)(0),[c,l]=(0,B.useState)(null),u=(0,B.useRef)(null),d=(0,B.useRef)(!1),f=(0,B.useRef)(0),p=(0,B.useRef)(!0),m=(0,B.useMemo)(()=>ht*2,[]);(0,B.useEffect)(()=>(p.current=!0,()=>{p.current=!1,u.current!=null&&window.clearInterval(u.current)}),[]);let h=()=>{u.current!=null&&(window.clearInterval(u.current),u.current=null)},g=()=>{if(!d.current){if(!t.trim()){l(`Missing identityKaiSignature (session signature). Please re-login.`),a(`idle`),s(0);return}h(),l(null),a(`inhale`),s(0),d.current=!1,f.current=0,u.current=window.setInterval(()=>{f.current+=gt;let e=f.current;if(e{if(!d.current){d.current=!0;try{let i=t.trim();if(!i)throw Error(`Missing identityKaiSignature (session signature).`);let o=await ee(),s=Number(o.pulse??0),c=_t(o.chakraDay)?o.chakraDay:null,l=e.file?.name??`unknown`,u=mt.default.blake2bHex(`${l}-${s}`,void 0,16);if(r({pulse:s,kaiSignature:i,chakraDay:c,post:e,userPhiKey:n??null,kksNonce:u}),!p.current)return;a(`sealed`)}catch(e){d.current=!1;let t=e instanceof Error?e.message:`Failed to seal with live Kai pulse. Please try again.`;if(!p.current)return;l(t),a(`idle`),s(0)}}},v=(()=>{if(c)return`Error`;switch(i){case`idle`:return`Ready to Breathe`;case`inhale`:return`Inhale`;case`exhale`:return`Exhale`;case`sealed`:return`Sealed in Kairos`;default:return`Breath`}})(),y=Math.round(Math.min(o,.5)*200),b=Math.round(Math.max(o-.5,0)*200),x=(()=>{if(c)return c;switch(i){case`idle`:return`Tap begin, inhale as the orb expands, exhale as it returns to stillness. We’ll seal at the end of your exhale.`;case`inhale`:return`Inhale slowly… ${y}%`;case`exhale`:return`Exhale and let go… ${50+b}% — sealing this breath into KaiOS.`;case`sealed`:return`Sealed on a live Kai pulse. Advancing to embed…`;default:return``}})(),S=(()=>{if(c)return`⚠️`;switch(i){case`idle`:return`🌬`;case`inhale`:return`🫁`;case`exhale`:return`🌀`;case`sealed`:return`✨`;default:return`🌬`}})(),C=e.file?.name&&e.file.name.length>40?`${e.file.name.slice(0,22)}…${e.file.name.slice(-12)}`:e.file?.name??`Unnamed glyph`;return(0,V.jsxs)(`div`,{className:`kv-breath-root`,"data-phase":i,"aria-live":`polite`,children:[(0,V.jsxs)(`div`,{className:`kv-breath-meta`,children:[(0,V.jsxs)(`div`,{className:`kv-breath-meta-left`,children:[(0,V.jsx)(`span`,{className:`kv-breath-pill`,children:`Breath Seal • φ 5.236s`}),(0,V.jsx)(`span`,{className:`kv-breath-file`,title:e.file?.name,children:C})]}),(0,V.jsx)(`div`,{className:`kv-breath-meta-right`,children:(0,V.jsx)(`span`,{className:`kv-breath-tag`,children:`Live Kai Pulse`})})]}),(0,V.jsxs)(`div`,{className:`kv-breath-orb-row`,children:[(0,V.jsxs)(`div`,{className:`kv-breath-orb`,"aria-label":`Breath phase: ${v}`,children:[(0,V.jsx)(`div`,{className:`kv-breath-orb-inner`,children:(0,V.jsx)(`span`,{className:`kv-breath-orb-emoji`,children:S})}),(0,V.jsx)(`div`,{className:`kv-breath-orb-ring`,style:{"--kv-breath-progress":o}})]}),(0,V.jsxs)(`div`,{className:`kv-breath-status`,children:[(0,V.jsxs)(`div`,{className:`kv-breath-status-row`,children:[(0,V.jsx)(`span`,{className:`kv-breath-status-label`,children:v}),(0,V.jsxs)(`span`,{className:`kv-breath-status-percent`,children:[Math.round(o*100),`%`]})]}),(0,V.jsx)(`p`,{className:`kv-breath-status-text`,children:x}),(0,V.jsxs)(`div`,{className:`kv-breath-bars`,children:[(0,V.jsxs)(`div`,{className:`kv-breath-bar`,children:[(0,V.jsx)(`span`,{className:`kv-breath-bar-label`,children:`Inhale`}),(0,V.jsx)(`div`,{className:`kv-breath-bar-track`,"aria-hidden":`true`,children:(0,V.jsx)(`div`,{className:`kv-breath-bar-fill kv-breath-bar-fill--inhale`,style:{width:`${y}%`}})})]}),(0,V.jsxs)(`div`,{className:`kv-breath-bar`,children:[(0,V.jsx)(`span`,{className:`kv-breath-bar-label`,children:`Exhale`}),(0,V.jsx)(`div`,{className:`kv-breath-bar-track`,"aria-hidden":`true`,children:(0,V.jsx)(`div`,{className:`kv-breath-bar-fill kv-breath-bar-fill--exhale`,style:{width:`${b}%`}})})]})]})]})]}),(0,V.jsxs)(`div`,{className:`kv-breath-actions`,children:[i===`idle`&&!d.current&&!c&&(0,V.jsx)(`button`,{type:`button`,onClick:g,className:`kv-breath-btn kv-breath-btn-primary`,children:`Begin Breath`}),c&&i===`idle`&&(0,V.jsx)(`button`,{type:`button`,onClick:g,className:`kv-breath-btn kv-breath-btn-warning`,children:`Retry Breath Seal`}),i!==`idle`&&i!==`sealed`&&!c&&(0,V.jsx)(`button`,{type:`button`,className:`kv-breath-btn kv-breath-btn-ghost`,disabled:!0,children:`Sealing on this exhale…`}),i===`sealed`&&(0,V.jsx)(`div`,{className:`kv-breath-sealed-note`,children:`Sealed. The stream will remember this breath forever.`})]})]})}function yt(e){let t=e.trim();return(t.startsWith(`0x`)||t.startsWith(`0X`))&&(t=t.slice(2)),/^[0-9a-fA-F]+$/.test(t)&&(t=t.toLowerCase()),t}var bt=`http://www.w3.org/2000/svg`;async function xt(e){let t=typeof e==`string`?e:JSON.stringify(e),n=new TextEncoder().encode(t),r=await crypto.subtle.digest(`SHA-256`,n),i=new Uint8Array(r),a=``;for(let e=0;e0?s=o.item(0):(s=t.createElementNS(bt,`metadata`),a.appendChild(s)),s.textContent=JSON.stringify(i,null,2);let c=new XMLSerializer().serializeToString(t);return{type:`image`,content:new Blob([c],{type:`image/svg+xml`}),filename:`sigil-${r}.svg`,metadata:i}}return n.mediaType===`image`?{type:`image`,content:n.file,filename:n.file.name,metadata:i}:{type:`video`,content:n.file,filename:n.file.name,metadata:i}}function Tt(e){let{baseCaption:t,phiKey:n,kaiSignature:r,pulse:i,chakraDay:a,verifierUrl:o}=e,s=[];return t&&t.trim().length>0&&s.push(t.trim(),``),s.push(`—`),s.push(`Kai-Sigil Proof of Origin`),n&&s.push(`Φ-Key: ${n}`),r&&s.push(`Kai Signature: ${r}`),typeof i==`number`&&s.push(`Pulse: ${i}`),a&&s.push(`Chakra Day: ${a}`),o&&(s.push(``),s.push(`Verify this post: ${o}`)),s.join(` diff --git a/dist/assets/KaiVohModal-Bbtn2GfV.js b/dist/assets/KaiVohModal-DDDGepBu.js similarity index 91% rename from dist/assets/KaiVohModal-Bbtn2GfV.js rename to dist/assets/KaiVohModal-DDDGepBu.js index d4f009aa..01de619e 100644 --- a/dist/assets/KaiVohModal-Bbtn2GfV.js +++ b/dist/assets/KaiVohModal-DDDGepBu.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KaiVohApp-BMb9vr72.js","assets/index-CcPm2yTY.js","assets/index-BmaJNTKf.css","assets/prop-types-CQ3MXKCa.js","assets/VerifierFrame-Dr7oGdbu.js","assets/VerifierFrame-D0e_dB-R.css","assets/SigilAuthContext-CZfkVeGy.js","assets/sigilRegistry-NyXrDYsE.js","assets/sigilRegistry-Cw7cMZ5l.css","assets/postSeal-ClZBwRbf.js","assets/KaiVohApp-Brroi08x.css","assets/KaiRealms-CxldGmng.js","assets/x-B0A9hqeh.js","assets/KaiRealms-BZJvSAmB.css"])))=>i.map(i=>d[i]); -import{t as e}from"./x-B0A9hqeh.js";import{Sn as t,Tn as n,jn as r,tn as i,wn as a}from"./index-CcPm2yTY.js";import{t as o}from"./SigilAuthContext-CZfkVeGy.js";import{t as s}from"./SigilAuthProvider-Crre0ykb.js";var c=r(a(),1),l=r(n(),1),u=r(i(),1),d=class extends l.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[KaiVoh] render error:`,e,t)}render(){return this.state.error?(0,u.jsxs)(`div`,{style:{padding:`1rem`,textAlign:`center`},children:[(0,u.jsx)(`h2`,{style:{fontSize:18,fontWeight:600},children:`KaiVoh failed to load`}),(0,u.jsx)(`p`,{style:{opacity:.8,marginTop:8},children:this.state.error.message}),(0,u.jsxs)(`details`,{style:{opacity:.65,marginTop:12,textAlign:`left`},children:[(0,u.jsx)(`summary`,{children:`Details`}),(0,u.jsx)(`pre`,{style:{whiteSpace:`pre-wrap`},children:String(this.state.error.stack??``)})]})]}):this.props.children}};function f(){let e=(0,l.useContext)(o);if(!e)throw Error(`useSigilAuth must be used inside `);return e}var p=(0,l.lazy)(()=>t(()=>import(`./KaiVohApp-BMb9vr72.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]))),m=(0,l.lazy)(()=>t(()=>import(`./KaiRealms-CxldGmng.js`),__vite__mapDeps([11,1,2,12,13]))),h=(1+Math.sqrt(5))/2,g=5.236,_=610,v=377;function y({className:e}){let t=(0,l.useId)();return(0,u.jsxs)(`svg`,{className:e,width:_,height:v,viewBox:`0 0 ${_} ${v}`,"aria-hidden":`true`,children:[(0,u.jsx)(`defs`,{children:(0,u.jsxs)(`linearGradient`,{id:t,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,u.jsx)(`stop`,{offset:`0%`,stopColor:`currentColor`,stopOpacity:`0.0`}),(0,u.jsx)(`stop`,{offset:`40%`,stopColor:`currentColor`,stopOpacity:`0.5`}),(0,u.jsx)(`stop`,{offset:`100%`,stopColor:`currentColor`,stopOpacity:`0.0`})]})}),(0,u.jsxs)(`g`,{fill:`none`,stroke:`url(#${t})`,strokeWidth:`2`,children:[(0,u.jsx)(`path`,{d:`M377 0 A377 377 0 0 1 0 377`}),(0,u.jsx)(`path`,{d:`M233 0 A233 233 0 0 1 0 233`}),(0,u.jsx)(`path`,{d:`M144 0 A144 144 0 0 1 0 144`}),(0,u.jsx)(`path`,{d:`M89 0 A89 89 0 0 1 0 89`}),(0,u.jsx)(`path`,{d:`M55 0 A55 55 0 0 1 0 55`}),(0,u.jsx)(`path`,{d:`M34 0 A34 34 0 0 1 0 34`}),(0,u.jsx)(`path`,{d:`M21 0 A21 21 0 0 1 0 21`})]})]})}function b({className:e}){return(0,u.jsxs)(`div`,{className:`seal-emblem ${e??``}`,"aria-hidden":`true`,children:[(0,u.jsx)(`div`,{className:`seal-ring seal-ring--outer`}),(0,u.jsx)(`div`,{className:`seal-ring seal-ring--inner`}),(0,u.jsx)(`div`,{className:`seal-core`})]})}function x({className:e}){let{auth:t}=f(),n=t.meta;if(!n)return null;let r=[`Pulse: ${n.pulse}`,`Beat: ${n.beat}`,`Step: ${n.stepIndex}`,`Day: ${n.chakraDay}`];return n.sigilId&&r.push(`Sigil: ${n.sigilId}`),n.userPhiKey&&r.push(`PhiKey: ${n.userPhiKey}`),(0,u.jsxs)(`div`,{className:`sigil-auth-pill ${e??``}`,role:`status`,"aria-live":`polite`,title:r.join(` • `),style:{maxWidth:`100%`,overflowX:`auto`,whiteSpace:`nowrap`},children:[(0,u.jsx)(`span`,{className:`sigil-auth-pill__dot`,"aria-hidden":`true`}),(0,u.jsxs)(`span`,{className:`sigil-auth-pill__text mono`,children:[`Sealed • `,n.pulse,` • `,n.chakraDay,n.sigilId?` • ${n.sigilId}`:``]})]})}function S({open:t,onClose:n}){let r=(0,l.useRef)(null),i=(0,l.useRef)(null),a=(0,l.useRef)(0),[o,f]=(0,l.useState)(`voh`),[_,v]=(0,l.useState)(!1),S=(0,l.useCallback)(e=>{e===`realms`&&!_&&v(!0),f(e)},[_]);(0,l.useEffect)(()=>{if(!t)return;let e=document.body.style.overflow,n=document.documentElement.style.getPropertyValue(`overscroll-behavior`),o=document.body.style.getPropertyValue(`overscroll-behavior`),s=document.documentElement.style.overflow,c=document.body.style.height,l=document.documentElement.style.height,u=document.documentElement.style.touchAction,d=document.documentElement.style.getPropertyValue(`--kai-breath`),f=document.documentElement.style.getPropertyValue(`--kai-phi`);document.body.style.overflow=`hidden`,document.body.style.height=`100%`,document.documentElement.style.overflow=`hidden`,document.documentElement.style.height=`100%`,document.documentElement.style.setProperty(`overscroll-behavior`,`contain`),document.body.style.setProperty(`overscroll-behavior`,`contain`),document.documentElement.style.touchAction=`manipulation`,document.documentElement.style.setProperty(`--kai-breath`,`${g}s`),document.documentElement.style.setProperty(`--kai-phi`,`${h}`),r.current?.focus();let p=e=>{a.current=e.touches[0]?.clientY??0},m=e=>{if(e.touches.length!==1)return;let t=i.current;if(!t)return;let n=e.target;if(!(n&&t.contains(n))){e.preventDefault();return}let r=(e.touches[0]?.clientY??a.current)-a.current,o=t.scrollTop<=0,s=t.scrollTop+t.clientHeight>=t.scrollHeight;(o&&r>0||s&&r<0)&&e.preventDefault()};return window.addEventListener(`touchstart`,p,{passive:!0}),window.addEventListener(`touchmove`,m,{passive:!1}),()=>{window.removeEventListener(`touchstart`,p),window.removeEventListener(`touchmove`,m),document.body.style.overflow=e,document.body.style.height=c,n?document.documentElement.style.setProperty(`overscroll-behavior`,n):document.documentElement.style.removeProperty(`overscroll-behavior`),o?document.body.style.setProperty(`overscroll-behavior`,o):document.body.style.removeProperty(`overscroll-behavior`),document.documentElement.style.overflow=s,document.documentElement.style.height=l,document.documentElement.style.touchAction=u,d?document.documentElement.style.setProperty(`--kai-breath`,d):document.documentElement.style.removeProperty(`--kai-breath`),f?document.documentElement.style.setProperty(`--kai-phi`,f):document.documentElement.style.removeProperty(`--kai-phi`)}},[t,n]);let C=(0,l.useCallback)(e=>{e.stopPropagation(),n()},[n]),w=(0,l.useCallback)(e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),n())},[n]);return t?(0,c.createPortal)((0,u.jsxs)(`div`,{className:`kai-voh-modal-backdrop atlantean-veil`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`kaivoh-title`,"data-view":o,children:[(0,u.jsx)(`div`,{className:`atlantean-stars`,"aria-hidden":`true`}),(0,u.jsx)(`div`,{className:`atlantean-halo atlantean-halo--1`,"aria-hidden":`true`}),(0,u.jsx)(`div`,{className:`atlantean-halo atlantean-halo--2`,"aria-hidden":`true`}),(0,u.jsxs)(`div`,{className:`kai-voh-container kai-pulse-border glass-omni`,role:`document`,children:[(0,u.jsx)(`div`,{className:`breath-ring breath-ring--outer`,"aria-hidden":`true`}),(0,u.jsx)(`div`,{className:`breath-ring breath-ring--inner`,"aria-hidden":`true`}),(0,u.jsx)(`div`,{className:`phi-grid`,"aria-hidden":`true`}),(0,u.jsx)(y,{className:`phi-spiral phi-spiral--tl`}),(0,u.jsx)(y,{className:`phi-spiral phi-spiral--br`}),(0,u.jsxs)(s,{children:[o!==`realms`&&(0,u.jsx)(`button`,{ref:r,type:`button`,className:`kai-voh-close auric-btn`,"aria-label":`Close portal`,onPointerDown:C,onKeyDown:w,children:(0,u.jsx)(e,{size:22,"aria-hidden":`true`})}),o!==`realms`&&(0,u.jsx)(`div`,{className:`voh-top-orb`,"aria-hidden":`true`,children:(0,u.jsx)(b,{})}),(0,u.jsxs)(`div`,{className:`kai-voh-tabbar`,role:`tablist`,"aria-label":`Kai portal views`,children:[(0,u.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":o===`voh`,className:`kai-voh-tab auric-tab ${o===`voh`?`active`:``}`,onClick:()=>S(`voh`),children:[(0,u.jsx)(`span`,{className:`tab-glyph`,"aria-hidden":`true`,children:`🜂`}),` `,`Voh`]}),(0,u.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":o===`realms`,className:`kai-voh-tab auric-tab ${o===`realms`?`active`:``}`,onClick:()=>S(`realms`),children:[(0,u.jsx)(`span`,{className:`tab-glyph`,"aria-hidden":`true`,children:`⚚`}),` `,`Realms`]}),(0,u.jsx)(`div`,{className:`breath-meter`,"aria-hidden":`true`,children:(0,u.jsx)(`div`,{className:`breath-meter__dot`})}),(0,u.jsx)(x,{className:`sigil-auth-pill--tabbar`})]}),(0,u.jsxs)(`div`,{className:`kai-voh-body`,ref:i,children:[(0,u.jsx)(`h2`,{id:`kaivoh-title`,className:`sr-only`,children:`Kai Portal`}),(0,u.jsxs)(d,{children:[(0,u.jsx)(`section`,{className:`portal-pane`,style:{display:o===`voh`?`block`:`none`},"aria-hidden":o!==`voh`,children:(0,u.jsx)(l.Suspense,{fallback:(0,u.jsxs)(`div`,{className:`kai-voh-center`,children:[(0,u.jsx)(`div`,{className:`kai-voh-spinner`}),(0,u.jsx)(`div`,{children:`Summoning Voh…`})]}),children:(0,u.jsx)(p,{})})}),(0,u.jsx)(`section`,{className:`portal-pane`,style:{display:o===`realms`?`block`:`none`},"aria-hidden":o!==`realms`,children:_?(0,u.jsx)(l.Suspense,{fallback:(0,u.jsxs)(`div`,{className:`kai-voh-center`,children:[(0,u.jsx)(`div`,{className:`kai-voh-spinner`}),(0,u.jsx)(`div`,{children:`Opening Kai Realms…`})]}),children:(0,u.jsx)(m,{onClose:()=>S(`voh`)})}):null})]})]})]})]})]}),document.body):null}export{S as default}; \ No newline at end of file +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KaiVohApp-D1B_NOm4.js","assets/index-BWApiWDT.js","assets/index-BmaJNTKf.css","assets/prop-types-B3eCNXus.js","assets/VerifierFrame-DkyrPdnF.js","assets/VerifierFrame-D0e_dB-R.css","assets/SigilAuthContext-X_86kcI6.js","assets/sigilRegistry-TxCi76Aa.js","assets/sigilRegistry-Cw7cMZ5l.css","assets/postSeal-ClZBwRbf.js","assets/KaiVohApp-Brroi08x.css","assets/KaiRealms-B1Voo2dF.js","assets/x-Bw0a6Rv2.js","assets/KaiRealms-BZJvSAmB.css"])))=>i.map(i=>d[i]); +import{t as e}from"./x-Bw0a6Rv2.js";import{Sn as t,Tn as n,jn as r,tn as i,wn as a}from"./index-BWApiWDT.js";import{t as o}from"./SigilAuthContext-X_86kcI6.js";import{t as s}from"./SigilAuthProvider-Cr2YGy0y.js";var c=r(a(),1),l=r(n(),1),u=r(i(),1),d=class extends l.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[KaiVoh] render error:`,e,t)}render(){return this.state.error?(0,u.jsxs)(`div`,{style:{padding:`1rem`,textAlign:`center`},children:[(0,u.jsx)(`h2`,{style:{fontSize:18,fontWeight:600},children:`KaiVoh failed to load`}),(0,u.jsx)(`p`,{style:{opacity:.8,marginTop:8},children:this.state.error.message}),(0,u.jsxs)(`details`,{style:{opacity:.65,marginTop:12,textAlign:`left`},children:[(0,u.jsx)(`summary`,{children:`Details`}),(0,u.jsx)(`pre`,{style:{whiteSpace:`pre-wrap`},children:String(this.state.error.stack??``)})]})]}):this.props.children}};function f(){let e=(0,l.useContext)(o);if(!e)throw Error(`useSigilAuth must be used inside `);return e}var p=(0,l.lazy)(()=>t(()=>import(`./KaiVohApp-D1B_NOm4.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]))),m=(0,l.lazy)(()=>t(()=>import(`./KaiRealms-B1Voo2dF.js`),__vite__mapDeps([11,1,2,12,13]))),h=(1+Math.sqrt(5))/2,g=5.236,_=610,v=377;function y({className:e}){let t=(0,l.useId)();return(0,u.jsxs)(`svg`,{className:e,width:_,height:v,viewBox:`0 0 ${_} ${v}`,"aria-hidden":`true`,children:[(0,u.jsx)(`defs`,{children:(0,u.jsxs)(`linearGradient`,{id:t,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,u.jsx)(`stop`,{offset:`0%`,stopColor:`currentColor`,stopOpacity:`0.0`}),(0,u.jsx)(`stop`,{offset:`40%`,stopColor:`currentColor`,stopOpacity:`0.5`}),(0,u.jsx)(`stop`,{offset:`100%`,stopColor:`currentColor`,stopOpacity:`0.0`})]})}),(0,u.jsxs)(`g`,{fill:`none`,stroke:`url(#${t})`,strokeWidth:`2`,children:[(0,u.jsx)(`path`,{d:`M377 0 A377 377 0 0 1 0 377`}),(0,u.jsx)(`path`,{d:`M233 0 A233 233 0 0 1 0 233`}),(0,u.jsx)(`path`,{d:`M144 0 A144 144 0 0 1 0 144`}),(0,u.jsx)(`path`,{d:`M89 0 A89 89 0 0 1 0 89`}),(0,u.jsx)(`path`,{d:`M55 0 A55 55 0 0 1 0 55`}),(0,u.jsx)(`path`,{d:`M34 0 A34 34 0 0 1 0 34`}),(0,u.jsx)(`path`,{d:`M21 0 A21 21 0 0 1 0 21`})]})]})}function b({className:e}){return(0,u.jsxs)(`div`,{className:`seal-emblem ${e??``}`,"aria-hidden":`true`,children:[(0,u.jsx)(`div`,{className:`seal-ring seal-ring--outer`}),(0,u.jsx)(`div`,{className:`seal-ring seal-ring--inner`}),(0,u.jsx)(`div`,{className:`seal-core`})]})}function x({className:e}){let{auth:t}=f(),n=t.meta;if(!n)return null;let r=[`Pulse: ${n.pulse}`,`Beat: ${n.beat}`,`Step: ${n.stepIndex}`,`Day: ${n.chakraDay}`];return n.sigilId&&r.push(`Sigil: ${n.sigilId}`),n.userPhiKey&&r.push(`PhiKey: ${n.userPhiKey}`),(0,u.jsxs)(`div`,{className:`sigil-auth-pill ${e??``}`,role:`status`,"aria-live":`polite`,title:r.join(` • `),style:{maxWidth:`100%`,overflowX:`auto`,whiteSpace:`nowrap`},children:[(0,u.jsx)(`span`,{className:`sigil-auth-pill__dot`,"aria-hidden":`true`}),(0,u.jsxs)(`span`,{className:`sigil-auth-pill__text mono`,children:[`Sealed • `,n.pulse,` • `,n.chakraDay,n.sigilId?` • ${n.sigilId}`:``]})]})}function S({open:t,onClose:n}){let r=(0,l.useRef)(null),i=(0,l.useRef)(null),a=(0,l.useRef)(0),[o,f]=(0,l.useState)(`voh`),[_,v]=(0,l.useState)(!1),S=(0,l.useCallback)(e=>{e===`realms`&&!_&&v(!0),f(e)},[_]);(0,l.useEffect)(()=>{if(!t)return;let e=document.body.style.overflow,n=document.documentElement.style.getPropertyValue(`overscroll-behavior`),o=document.body.style.getPropertyValue(`overscroll-behavior`),s=document.documentElement.style.overflow,c=document.body.style.height,l=document.documentElement.style.height,u=document.documentElement.style.touchAction,d=document.documentElement.style.getPropertyValue(`--kai-breath`),f=document.documentElement.style.getPropertyValue(`--kai-phi`);document.body.style.overflow=`hidden`,document.body.style.height=`100%`,document.documentElement.style.overflow=`hidden`,document.documentElement.style.height=`100%`,document.documentElement.style.setProperty(`overscroll-behavior`,`contain`),document.body.style.setProperty(`overscroll-behavior`,`contain`),document.documentElement.style.touchAction=`manipulation`,document.documentElement.style.setProperty(`--kai-breath`,`${g}s`),document.documentElement.style.setProperty(`--kai-phi`,`${h}`),r.current?.focus();let p=e=>{a.current=e.touches[0]?.clientY??0},m=e=>{if(e.touches.length!==1)return;let t=i.current;if(!t)return;let n=e.target;if(!(n&&t.contains(n))){e.preventDefault();return}let r=(e.touches[0]?.clientY??a.current)-a.current,o=t.scrollTop<=0,s=t.scrollTop+t.clientHeight>=t.scrollHeight;(o&&r>0||s&&r<0)&&e.preventDefault()};return window.addEventListener(`touchstart`,p,{passive:!0}),window.addEventListener(`touchmove`,m,{passive:!1}),()=>{window.removeEventListener(`touchstart`,p),window.removeEventListener(`touchmove`,m),document.body.style.overflow=e,document.body.style.height=c,n?document.documentElement.style.setProperty(`overscroll-behavior`,n):document.documentElement.style.removeProperty(`overscroll-behavior`),o?document.body.style.setProperty(`overscroll-behavior`,o):document.body.style.removeProperty(`overscroll-behavior`),document.documentElement.style.overflow=s,document.documentElement.style.height=l,document.documentElement.style.touchAction=u,d?document.documentElement.style.setProperty(`--kai-breath`,d):document.documentElement.style.removeProperty(`--kai-breath`),f?document.documentElement.style.setProperty(`--kai-phi`,f):document.documentElement.style.removeProperty(`--kai-phi`)}},[t,n]);let C=(0,l.useCallback)(e=>{e.stopPropagation(),n()},[n]),w=(0,l.useCallback)(e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),n())},[n]);return t?(0,c.createPortal)((0,u.jsxs)(`div`,{className:`kai-voh-modal-backdrop atlantean-veil`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`kaivoh-title`,"data-view":o,children:[(0,u.jsx)(`div`,{className:`atlantean-stars`,"aria-hidden":`true`}),(0,u.jsx)(`div`,{className:`atlantean-halo atlantean-halo--1`,"aria-hidden":`true`}),(0,u.jsx)(`div`,{className:`atlantean-halo atlantean-halo--2`,"aria-hidden":`true`}),(0,u.jsxs)(`div`,{className:`kai-voh-container kai-pulse-border glass-omni`,role:`document`,children:[(0,u.jsx)(`div`,{className:`breath-ring breath-ring--outer`,"aria-hidden":`true`}),(0,u.jsx)(`div`,{className:`breath-ring breath-ring--inner`,"aria-hidden":`true`}),(0,u.jsx)(`div`,{className:`phi-grid`,"aria-hidden":`true`}),(0,u.jsx)(y,{className:`phi-spiral phi-spiral--tl`}),(0,u.jsx)(y,{className:`phi-spiral phi-spiral--br`}),(0,u.jsxs)(s,{children:[o!==`realms`&&(0,u.jsx)(`button`,{ref:r,type:`button`,className:`kai-voh-close auric-btn`,"aria-label":`Close portal`,onPointerDown:C,onKeyDown:w,children:(0,u.jsx)(e,{size:22,"aria-hidden":`true`})}),o!==`realms`&&(0,u.jsx)(`div`,{className:`voh-top-orb`,"aria-hidden":`true`,children:(0,u.jsx)(b,{})}),(0,u.jsxs)(`div`,{className:`kai-voh-tabbar`,role:`tablist`,"aria-label":`Kai portal views`,children:[(0,u.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":o===`voh`,className:`kai-voh-tab auric-tab ${o===`voh`?`active`:``}`,onClick:()=>S(`voh`),children:[(0,u.jsx)(`span`,{className:`tab-glyph`,"aria-hidden":`true`,children:`🜂`}),` `,`Voh`]}),(0,u.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":o===`realms`,className:`kai-voh-tab auric-tab ${o===`realms`?`active`:``}`,onClick:()=>S(`realms`),children:[(0,u.jsx)(`span`,{className:`tab-glyph`,"aria-hidden":`true`,children:`⚚`}),` `,`Realms`]}),(0,u.jsx)(`div`,{className:`breath-meter`,"aria-hidden":`true`,children:(0,u.jsx)(`div`,{className:`breath-meter__dot`})}),(0,u.jsx)(x,{className:`sigil-auth-pill--tabbar`})]}),(0,u.jsxs)(`div`,{className:`kai-voh-body`,ref:i,children:[(0,u.jsx)(`h2`,{id:`kaivoh-title`,className:`sr-only`,children:`Kai Portal`}),(0,u.jsxs)(d,{children:[(0,u.jsx)(`section`,{className:`portal-pane`,style:{display:o===`voh`?`block`:`none`},"aria-hidden":o!==`voh`,children:(0,u.jsx)(l.Suspense,{fallback:(0,u.jsxs)(`div`,{className:`kai-voh-center`,children:[(0,u.jsx)(`div`,{className:`kai-voh-spinner`}),(0,u.jsx)(`div`,{children:`Summoning Voh…`})]}),children:(0,u.jsx)(p,{})})}),(0,u.jsx)(`section`,{className:`portal-pane`,style:{display:o===`realms`?`block`:`none`},"aria-hidden":o!==`realms`,children:_?(0,u.jsx)(l.Suspense,{fallback:(0,u.jsxs)(`div`,{className:`kai-voh-center`,children:[(0,u.jsx)(`div`,{className:`kai-voh-spinner`}),(0,u.jsx)(`div`,{children:`Opening Kai Realms…`})]}),children:(0,u.jsx)(m,{onClose:()=>S(`voh`)})}):null})]})]})]})]})]}),document.body):null}export{S as default}; \ No newline at end of file diff --git a/dist/assets/PShort-Bmqr2bV5.js b/dist/assets/PShort-Dw69zn4D.js similarity index 94% rename from dist/assets/PShort-Bmqr2bV5.js rename to dist/assets/PShort-Dw69zn4D.js index c93ecc4a..c6f4b72b 100644 --- a/dist/assets/PShort-Bmqr2bV5.js +++ b/dist/assets/PShort-Dw69zn4D.js @@ -1 +1 @@ -import{Tn as e,bn as t,jn as n,tn as r,xn as i,yn as a}from"./index-CcPm2yTY.js";var o=n(e(),1),s=n(r(),1);function c(e){let t=e.trim();return t=t.replace(/[)\].,;:!?]+$/g,``),t=t.replace(/^[([{"'`]+/g,``),t.trim()}function l(e){let t=c(e);if(/%[0-9A-Fa-f]{2}/.test(t))try{t=decodeURIComponent(t)}catch{}return t.includes(` `)&&(t=t.replaceAll(` `,`+`)),t=t.replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/g,``),c(t)}function u(){let e=t(),n=a(),r=i();return(0,o.useEffect)(()=>{let t=typeof r.token==`string`?r.token:``,i=typeof r[`*`]==`string`?r[`*`]:``,a=t&&i?`${t}/${i}`:t||i,o=new URLSearchParams(n.search),s=new URLSearchParams(n.hash.startsWith(`#`)?n.hash.slice(1):n.hash),c=o.get(`t`)||o.get(`p`)||o.get(`token`)||s.get(`t`)||s.get(`p`)||s.get(`token`)||``,u=a||c;u&&e(`/p~${l(u)}`,{replace:!0})},[e,n.search,n.hash,r]),(0,s.jsxs)(`div`,{className:`notfound`,role:`region`,"aria-label":`Redirecting`,children:[(0,s.jsx)(`div`,{className:`notfound__title`,children:`Redirecting…`}),(0,s.jsx)(`div`,{className:`notfound__hint`,children:`Normalizing payload token.`})]})}export{u as default}; \ No newline at end of file +import{Tn as e,bn as t,jn as n,tn as r,xn as i,yn as a}from"./index-BWApiWDT.js";var o=n(e(),1),s=n(r(),1);function c(e){let t=e.trim();return t=t.replace(/[)\].,;:!?]+$/g,``),t=t.replace(/^[([{"'`]+/g,``),t.trim()}function l(e){let t=c(e);if(/%[0-9A-Fa-f]{2}/.test(t))try{t=decodeURIComponent(t)}catch{}return t.includes(` `)&&(t=t.replaceAll(` `,`+`)),t=t.replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/g,``),c(t)}function u(){let e=t(),n=a(),r=i();return(0,o.useEffect)(()=>{let t=typeof r.token==`string`?r.token:``,i=typeof r[`*`]==`string`?r[`*`]:``,a=t&&i?`${t}/${i}`:t||i,o=new URLSearchParams(n.search),s=new URLSearchParams(n.hash.startsWith(`#`)?n.hash.slice(1):n.hash),c=o.get(`t`)||o.get(`p`)||o.get(`token`)||s.get(`t`)||s.get(`p`)||s.get(`token`)||``,u=a||c;u&&e(`/p~${l(u)}`,{replace:!0})},[e,n.search,n.hash,r]),(0,s.jsxs)(`div`,{className:`notfound`,role:`region`,"aria-label":`Redirecting`,children:[(0,s.jsx)(`div`,{className:`notfound__title`,children:`Redirecting…`}),(0,s.jsx)(`div`,{className:`notfound__hint`,children:`Normalizing payload token.`})]})}export{u as default}; \ No newline at end of file diff --git a/dist/assets/SealMomentModal-BotOOPRg.js b/dist/assets/SealMomentModal-QiuZkGMx.js similarity index 99% rename from dist/assets/SealMomentModal-BotOOPRg.js rename to dist/assets/SealMomentModal-QiuZkGMx.js index a40ef13f..dba9a5e3 100644 --- a/dist/assets/SealMomentModal-BotOOPRg.js +++ b/dist/assets/SealMomentModal-QiuZkGMx.js @@ -1 +1 @@ -import{Tn as e,jn as t,tn as n,wn as r}from"./index-CcPm2yTY.js";var i=t(e(),1),a=t(r(),1),o=t(n(),1),s=`sigil:urls`;function c(e){if(!(typeof window>`u`))try{let t=window.localStorage.getItem(s),n=t?JSON.parse(t):[];n.includes(e)||(n.push(e),window.localStorage.setItem(s,JSON.stringify(n))),window.dispatchEvent(new CustomEvent(`sigil:url-registered`,{detail:{url:e}}))}catch{}}var l=({open:e,url:t,hash:n,onClose:r})=>{let s=(0,i.useRef)(null),l=(0,i.useRef)(null),m=(0,i.useRef)(null),[h,g]=(0,i.useState)(``),_=(0,i.useRef)(null);(0,i.useEffect)(()=>{if(!(!e||!t)&&_.current!==t){if(_.current=t,typeof window<`u`&&typeof window.__SIGIL__?.registerSigilUrl==`function`)try{window.__SIGIL__.registerSigilUrl(t)}catch{c(t)}else c(t);if(typeof window<`u`&&typeof window.__SIGIL__?.registerSend==`function`)try{window.__SIGIL__.registerSend({type:`sigil:mint`,url:t,hash:n})}catch{}}},[e,t,n]);let v=(0,i.useMemo)(()=>{if(typeof navigator>`u`)return!1;let e=navigator;return typeof e.share==`function`?t&&typeof e.canShare==`function`?e.canShare({url:t}):!0:!1},[t]),y=(0,i.useCallback)(e=>{let t=s.current;if(!t)return;let n=t.querySelectorAll([`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex='-1'])`].join(`,`));if(n.length===0)return;let r=n[0],i=n[n.length-1];!e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus())},[]);(0,i.useEffect)(()=>{if(!e)return;m.current=document.activeElement??null;let t=document.body.style.overflow;document.body.style.overflow=`hidden`;let n=window.setTimeout(()=>l.current?.focus({preventScroll:!0}),0),r=e=>{e.key===`Tab`&&y(e)};return document.addEventListener(`keydown`,r,!0),()=>{document.body.style.overflow=t,document.removeEventListener(`keydown`,r,!0),window.clearTimeout(n),m.current?.focus?.()}},[e,y]);let b=e=>{g(e),window.setTimeout(()=>g(``),900)},x=async(e,t)=>{try{if(typeof navigator>`u`)throw Error(`no navigator`);if(!navigator.clipboard?.writeText)throw Error(`no clipboard`);await navigator.clipboard.writeText(e),b(`${t} copied to clipboard`)}catch{b(`Could not copy ${t}`)}},S=async()=>{try{v&&typeof navigator<`u`?(await navigator.share?.({title:`Kairos Sigil-Glyph`,text:`Sealed Kairos Moment`,url:t}),b(`Share sheet opened`)):await x(t,`Link`)}catch{}},C=(0,i.useMemo)(()=>n?n.slice(0,16):`—`,[n]),w=e=>{e.preventDefault(),e.stopPropagation(),r?.()},T=e=>{e.target===e.currentTarget&&e.preventDefault()};return e?(0,a.createPortal)((0,o.jsxs)(`div`,{className:`seal-overlay`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`seal-title`,"aria-describedby":`seal-desc`,"data-state":`open`,onClick:e=>e.stopPropagation(),onPointerDown:T,children:[(0,o.jsx)(`div`,{className:`seal-veil`,"aria-hidden":`true`}),(0,o.jsxs)(`div`,{ref:s,className:`seal-card`,role:`document`,onClick:e=>e.stopPropagation(),children:[(0,o.jsx)(`div`,{className:`seal-ornament seal-ornament--tl`,"aria-hidden":`true`}),(0,o.jsx)(`div`,{className:`seal-ornament seal-ornament--tr`,"aria-hidden":`true`}),(0,o.jsx)(`div`,{className:`seal-ornament seal-ornament--bl`,"aria-hidden":`true`}),(0,o.jsx)(`div`,{className:`seal-ornament seal-ornament--br`,"aria-hidden":`true`}),(0,o.jsx)(`button`,{ref:l,className:`seal-close`,"aria-label":`Close`,onClick:w,type:`button`,children:(0,o.jsx)(u,{})}),(0,o.jsxs)(`header`,{className:`seal-header`,children:[(0,o.jsx)(`h3`,{id:`seal-title`,className:`seal-title`,children:`Moment Sealed`}),(0,o.jsx)(`p`,{id:`seal-desc`,className:`seal-subtitle`,children:`Your Kairos imprint is preserved. Proceed to the URL below to Inhale Claimed Ownership.`})]}),(0,o.jsxs)(`label`,{className:`field`,children:[(0,o.jsx)(`span`,{className:`field-label`,children:`Hash`}),(0,o.jsxs)(`div`,{className:`row`,children:[(0,o.jsx)(`code`,{className:`hash`,title:n||`—`,children:n?C:`—`}),(0,o.jsx)(`button`,{className:`icon-btn`,onClick:()=>x(n,`Hash`),disabled:!n,"aria-label":`Copy hash`,title:`Copy hash`,type:`button`,children:(0,o.jsx)(f,{})})]}),n&&(0,o.jsxs)(`p`,{className:`micro`,children:[`Full: `,(0,o.jsx)(`span`,{className:`mono`,children:n})]})]}),(0,o.jsxs)(`label`,{className:`field`,children:[(0,o.jsx)(`span`,{className:`field-label`,children:`URL`}),(0,o.jsxs)(`div`,{className:`row`,children:[(0,o.jsx)(`input`,{className:`url-input`,value:t,readOnly:!0,"aria-readonly":`true`,spellCheck:!1}),(0,o.jsx)(`button`,{className:`icon-btn`,onClick:()=>x(t,`Link`),disabled:!t,"aria-label":`Copy link`,title:`Copy link`,type:`button`,children:(0,o.jsx)(f,{})}),t&&(0,o.jsx)(`a`,{className:`open-link`,href:t,target:`_blank`,rel:`noopener`,"aria-label":`Open link in new tab`,title:`Open link`,children:(0,o.jsx)(p,{})})]})]}),(0,o.jsx)(`div`,{className:`cta-row`,children:(0,o.jsxs)(`button`,{className:`secondary cta`,onClick:S,type:`button`,children:[(0,o.jsx)(d,{}),(0,o.jsx)(`span`,{children:v?`Share`:`Remember Link`})]})}),(0,o.jsx)(`p`,{className:`fine`,children:`This moment is now sealed in time. Use the link above within the next 11 breaths to claim ownership & gain permanent access to this Kairos moment.`}),(0,o.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:h})]})]}),document.body):null},u=()=>(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`seal-close-ico`,children:[(0,o.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,opacity:`.35`}),(0,o.jsx)(`path`,{d:`M7 7l10 10M17 7L7 17`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`})]}),d=()=>(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,o.jsx)(`path`,{d:`M15 8a3 3 0 100-6 3 3 0 000 6zM6 14a3 3 0 100-6 3 3 0 000 6zm9 12a3 3 0 100-6 3 3 0 000 6z`,fill:`currentColor`}),(0,o.jsx)(`path`,{d:`M8.6 9.7l6.8-3.4M8.6 12.3l6.8 3.4`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`})]}),f=()=>(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,o.jsx)(`rect`,{x:`9`,y:`9`,width:`10`,height:`10`,rx:`2`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,o.jsx)(`rect`,{x:`5`,y:`5`,width:`10`,height:`10`,rx:`2`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`,opacity:`.5`})]}),p=()=>(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,o.jsx)(`path`,{d:`M10 14a5 5 0 007.07 0l1.41-1.41a5 5 0 00-7.07-7.07L10 6`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,o.jsx)(`path`,{d:`M14 10a5 5 0 00-7.07 0L5.5 11.43a5 5 0 007.07 7.07L14 18`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`})]}),m=l;export{m as t}; \ No newline at end of file +import{Tn as e,jn as t,tn as n,wn as r}from"./index-BWApiWDT.js";var i=t(e(),1),a=t(r(),1),o=t(n(),1),s=`sigil:urls`;function c(e){if(!(typeof window>`u`))try{let t=window.localStorage.getItem(s),n=t?JSON.parse(t):[];n.includes(e)||(n.push(e),window.localStorage.setItem(s,JSON.stringify(n))),window.dispatchEvent(new CustomEvent(`sigil:url-registered`,{detail:{url:e}}))}catch{}}var l=({open:e,url:t,hash:n,onClose:r})=>{let s=(0,i.useRef)(null),l=(0,i.useRef)(null),m=(0,i.useRef)(null),[h,g]=(0,i.useState)(``),_=(0,i.useRef)(null);(0,i.useEffect)(()=>{if(!(!e||!t)&&_.current!==t){if(_.current=t,typeof window<`u`&&typeof window.__SIGIL__?.registerSigilUrl==`function`)try{window.__SIGIL__.registerSigilUrl(t)}catch{c(t)}else c(t);if(typeof window<`u`&&typeof window.__SIGIL__?.registerSend==`function`)try{window.__SIGIL__.registerSend({type:`sigil:mint`,url:t,hash:n})}catch{}}},[e,t,n]);let v=(0,i.useMemo)(()=>{if(typeof navigator>`u`)return!1;let e=navigator;return typeof e.share==`function`?t&&typeof e.canShare==`function`?e.canShare({url:t}):!0:!1},[t]),y=(0,i.useCallback)(e=>{let t=s.current;if(!t)return;let n=t.querySelectorAll([`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex='-1'])`].join(`,`));if(n.length===0)return;let r=n[0],i=n[n.length-1];!e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus())},[]);(0,i.useEffect)(()=>{if(!e)return;m.current=document.activeElement??null;let t=document.body.style.overflow;document.body.style.overflow=`hidden`;let n=window.setTimeout(()=>l.current?.focus({preventScroll:!0}),0),r=e=>{e.key===`Tab`&&y(e)};return document.addEventListener(`keydown`,r,!0),()=>{document.body.style.overflow=t,document.removeEventListener(`keydown`,r,!0),window.clearTimeout(n),m.current?.focus?.()}},[e,y]);let b=e=>{g(e),window.setTimeout(()=>g(``),900)},x=async(e,t)=>{try{if(typeof navigator>`u`)throw Error(`no navigator`);if(!navigator.clipboard?.writeText)throw Error(`no clipboard`);await navigator.clipboard.writeText(e),b(`${t} copied to clipboard`)}catch{b(`Could not copy ${t}`)}},S=async()=>{try{v&&typeof navigator<`u`?(await navigator.share?.({title:`Kairos Sigil-Glyph`,text:`Sealed Kairos Moment`,url:t}),b(`Share sheet opened`)):await x(t,`Link`)}catch{}},C=(0,i.useMemo)(()=>n?n.slice(0,16):`—`,[n]),w=e=>{e.preventDefault(),e.stopPropagation(),r?.()},T=e=>{e.target===e.currentTarget&&e.preventDefault()};return e?(0,a.createPortal)((0,o.jsxs)(`div`,{className:`seal-overlay`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`seal-title`,"aria-describedby":`seal-desc`,"data-state":`open`,onClick:e=>e.stopPropagation(),onPointerDown:T,children:[(0,o.jsx)(`div`,{className:`seal-veil`,"aria-hidden":`true`}),(0,o.jsxs)(`div`,{ref:s,className:`seal-card`,role:`document`,onClick:e=>e.stopPropagation(),children:[(0,o.jsx)(`div`,{className:`seal-ornament seal-ornament--tl`,"aria-hidden":`true`}),(0,o.jsx)(`div`,{className:`seal-ornament seal-ornament--tr`,"aria-hidden":`true`}),(0,o.jsx)(`div`,{className:`seal-ornament seal-ornament--bl`,"aria-hidden":`true`}),(0,o.jsx)(`div`,{className:`seal-ornament seal-ornament--br`,"aria-hidden":`true`}),(0,o.jsx)(`button`,{ref:l,className:`seal-close`,"aria-label":`Close`,onClick:w,type:`button`,children:(0,o.jsx)(u,{})}),(0,o.jsxs)(`header`,{className:`seal-header`,children:[(0,o.jsx)(`h3`,{id:`seal-title`,className:`seal-title`,children:`Moment Sealed`}),(0,o.jsx)(`p`,{id:`seal-desc`,className:`seal-subtitle`,children:`Your Kairos imprint is preserved. Proceed to the URL below to Inhale Claimed Ownership.`})]}),(0,o.jsxs)(`label`,{className:`field`,children:[(0,o.jsx)(`span`,{className:`field-label`,children:`Hash`}),(0,o.jsxs)(`div`,{className:`row`,children:[(0,o.jsx)(`code`,{className:`hash`,title:n||`—`,children:n?C:`—`}),(0,o.jsx)(`button`,{className:`icon-btn`,onClick:()=>x(n,`Hash`),disabled:!n,"aria-label":`Copy hash`,title:`Copy hash`,type:`button`,children:(0,o.jsx)(f,{})})]}),n&&(0,o.jsxs)(`p`,{className:`micro`,children:[`Full: `,(0,o.jsx)(`span`,{className:`mono`,children:n})]})]}),(0,o.jsxs)(`label`,{className:`field`,children:[(0,o.jsx)(`span`,{className:`field-label`,children:`URL`}),(0,o.jsxs)(`div`,{className:`row`,children:[(0,o.jsx)(`input`,{className:`url-input`,value:t,readOnly:!0,"aria-readonly":`true`,spellCheck:!1}),(0,o.jsx)(`button`,{className:`icon-btn`,onClick:()=>x(t,`Link`),disabled:!t,"aria-label":`Copy link`,title:`Copy link`,type:`button`,children:(0,o.jsx)(f,{})}),t&&(0,o.jsx)(`a`,{className:`open-link`,href:t,target:`_blank`,rel:`noopener`,"aria-label":`Open link in new tab`,title:`Open link`,children:(0,o.jsx)(p,{})})]})]}),(0,o.jsx)(`div`,{className:`cta-row`,children:(0,o.jsxs)(`button`,{className:`secondary cta`,onClick:S,type:`button`,children:[(0,o.jsx)(d,{}),(0,o.jsx)(`span`,{children:v?`Share`:`Remember Link`})]})}),(0,o.jsx)(`p`,{className:`fine`,children:`This moment is now sealed in time. Use the link above within the next 11 breaths to claim ownership & gain permanent access to this Kairos moment.`}),(0,o.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:h})]})]}),document.body):null},u=()=>(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`seal-close-ico`,children:[(0,o.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,opacity:`.35`}),(0,o.jsx)(`path`,{d:`M7 7l10 10M17 7L7 17`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`})]}),d=()=>(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,o.jsx)(`path`,{d:`M15 8a3 3 0 100-6 3 3 0 000 6zM6 14a3 3 0 100-6 3 3 0 000 6zm9 12a3 3 0 100-6 3 3 0 000 6z`,fill:`currentColor`}),(0,o.jsx)(`path`,{d:`M8.6 9.7l6.8-3.4M8.6 12.3l6.8 3.4`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`})]}),f=()=>(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,o.jsx)(`rect`,{x:`9`,y:`9`,width:`10`,height:`10`,rx:`2`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,o.jsx)(`rect`,{x:`5`,y:`5`,width:`10`,height:`10`,rx:`2`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`,opacity:`.5`})]}),p=()=>(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,o.jsx)(`path`,{d:`M10 14a5 5 0 007.07 0l1.41-1.41a5 5 0 00-7.07-7.07L10 6`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,o.jsx)(`path`,{d:`M14 10a5 5 0 00-7.07 0L5.5 11.43a5 5 0 007.07 7.07L14 18`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`})]}),m=l;export{m as t}; \ No newline at end of file diff --git a/dist/assets/SigilAuthContext-CZfkVeGy.js b/dist/assets/SigilAuthContext-X_86kcI6.js similarity index 73% rename from dist/assets/SigilAuthContext-CZfkVeGy.js rename to dist/assets/SigilAuthContext-X_86kcI6.js index 22e669d7..8f4a2e3a 100644 --- a/dist/assets/SigilAuthContext-CZfkVeGy.js +++ b/dist/assets/SigilAuthContext-X_86kcI6.js @@ -1 +1 @@ -import{Tn as e,jn as t}from"./index-CcPm2yTY.js";var n=t(e(),1);const r=(0,n.createContext)(null);function i(){let e=(0,n.useContext)(r);if(!e)throw Error(`useSigilAuth must be used within .`);return e}export{i as n,r as t}; \ No newline at end of file +import{Tn as e,jn as t}from"./index-BWApiWDT.js";var n=t(e(),1);const r=(0,n.createContext)(null);function i(){let e=(0,n.useContext)(r);if(!e)throw Error(`useSigilAuth must be used within .`);return e}export{i as n,r as t}; \ No newline at end of file diff --git a/dist/assets/SigilAuthProvider-Crre0ykb.js b/dist/assets/SigilAuthProvider-Cr2YGy0y.js similarity index 91% rename from dist/assets/SigilAuthProvider-Crre0ykb.js rename to dist/assets/SigilAuthProvider-Cr2YGy0y.js index bbcac5cf..76b4a3c5 100644 --- a/dist/assets/SigilAuthProvider-Crre0ykb.js +++ b/dist/assets/SigilAuthProvider-Cr2YGy0y.js @@ -1 +1 @@ -import{Tn as e,jn as t,tn as n}from"./index-CcPm2yTY.js";import{t as r}from"./SigilAuthContext-CZfkVeGy.js";var i=t(e(),1),a=t(n(),1),o=`kai.sigilAuth.v1`,s={svgText:null,meta:null};function c(e){if(typeof e!=`object`||!e)return!1;let t=e;if(!(typeof t.pulse==`number`&&Number.isFinite(t.pulse)&&typeof t.beat==`number`&&Number.isFinite(t.beat)&&typeof t.stepIndex==`number`&&Number.isFinite(t.stepIndex)&&typeof t.chakraDay==`string`&&typeof t.kaiSignature==`string`))return!1;let n=e=>e===void 0||typeof e==`string`;return n(t.userPhiKey)&&n(t.sigilId)&&n(t.sigilActionUrl)}function l(e){if(typeof e!=`object`||!e)return!1;let t=e,n=t.svgText===null||typeof t.svgText==`string`,r=t.meta===null||typeof t.meta==`object`&&t.meta!==null&&c(t.meta);return n&&r}function u(){if(typeof window>`u`)return s;try{let e=window.localStorage.getItem(o);if(!e)return s;let t=JSON.parse(e);return l(t)?t:s}catch{return s}}function d(e){try{window.localStorage.setItem(o,JSON.stringify(e))}catch{}}function f(){try{window.localStorage.removeItem(o)}catch{}}function p({children:e}){let[t,n]=(0,i.useState)(()=>u()),c=(0,i.useCallback)((e,t)=>{let r={svgText:e,meta:t};n(r),typeof window<`u`&&d(r)},[]),l=(0,i.useCallback)(()=>{n(s),typeof window<`u`&&f()},[]);(0,i.useEffect)(()=>{let e=e=>{e.key===o&&n(u())};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]);let p=(0,i.useMemo)(()=>({auth:t,setAuth:c,clearAuth:l}),[t,c,l]);return(0,a.jsx)(r.Provider,{value:p,children:e})}export{p as t}; \ No newline at end of file +import{Tn as e,jn as t,tn as n}from"./index-BWApiWDT.js";import{t as r}from"./SigilAuthContext-X_86kcI6.js";var i=t(e(),1),a=t(n(),1),o=`kai.sigilAuth.v1`,s={svgText:null,meta:null};function c(e){if(typeof e!=`object`||!e)return!1;let t=e;if(!(typeof t.pulse==`number`&&Number.isFinite(t.pulse)&&typeof t.beat==`number`&&Number.isFinite(t.beat)&&typeof t.stepIndex==`number`&&Number.isFinite(t.stepIndex)&&typeof t.chakraDay==`string`&&typeof t.kaiSignature==`string`))return!1;let n=e=>e===void 0||typeof e==`string`;return n(t.userPhiKey)&&n(t.sigilId)&&n(t.sigilActionUrl)}function l(e){if(typeof e!=`object`||!e)return!1;let t=e,n=t.svgText===null||typeof t.svgText==`string`,r=t.meta===null||typeof t.meta==`object`&&t.meta!==null&&c(t.meta);return n&&r}function u(){if(typeof window>`u`)return s;try{let e=window.localStorage.getItem(o);if(!e)return s;let t=JSON.parse(e);return l(t)?t:s}catch{return s}}function d(e){try{window.localStorage.setItem(o,JSON.stringify(e))}catch{}}function f(){try{window.localStorage.removeItem(o)}catch{}}function p({children:e}){let[t,n]=(0,i.useState)(()=>u()),c=(0,i.useCallback)((e,t)=>{let r={svgText:e,meta:t};n(r),typeof window<`u`&&d(r)},[]),l=(0,i.useCallback)(()=>{n(s),typeof window<`u`&&f()},[]);(0,i.useEffect)(()=>{let e=e=>{e.key===o&&n(u())};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]);let p=(0,i.useMemo)(()=>({auth:t,setAuth:c,clearAuth:l}),[t,c,l]);return(0,a.jsx)(r.Provider,{value:p,children:e})}export{p as t}; \ No newline at end of file diff --git a/dist/assets/SigilExplorer-YG_XvkA-.js b/dist/assets/SigilExplorer-C1I-xwZr.js similarity index 99% rename from dist/assets/SigilExplorer-YG_XvkA-.js rename to dist/assets/SigilExplorer-C1I-xwZr.js index 46000f82..a4264bac 100644 --- a/dist/assets/SigilExplorer-YG_XvkA-.js +++ b/dist/assets/SigilExplorer-C1I-xwZr.js @@ -1,4 +1,4 @@ -import{K as e,Tn as t,W as n,X as r,gt as i,hn as a,jn as o,mn as s,nn as c,tn as l}from"./index-CcPm2yTY.js";import{a as u,n as d,o as f,r as p,t as m}from"./usernameClaimRegistry-_VlzEwdK.js";var h=o(t(),1),g=o(l(),1),_=`https://align.kaiklok.com`,v=`http://m.kai`,y={root:`#ff3b3b`,sacral:`#ff8a3d`,solar:`#ffd54a`,heart:`#3dff9a`,throat:`#46d3ff`,thirdEye:`#6b6cff`,crown:`#c18bff`};function b(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();return t?t.includes(`root`)?`root`:t.includes(`sacral`)?`sacral`:t.includes(`solar`)||t.includes(`plexus`)||t.includes(`sun`)?`solar`:t.includes(`heart`)?`heart`:t.includes(`throat`)?`throat`:t.includes(`third`)||t.includes(`eye`)||t.includes(`indigo`)?`thirdEye`:t.includes(`crown`)||t.includes(`krown`)||t.includes(`violet`)?`crown`:t===`1`?`root`:t===`2`?`sacral`:t===`3`?`solar`:t===`4`?`heart`:t===`5`?`throat`:t===`6`?`thirdEye`:t===`7`?`crown`:null:null}function ee(e){let t=b(e),n=t?y[t]:`var(--sx-accent)`;return{"--sx-chakra":n}}var te=`kai:sigils:v1`,ne=`sigil:urls`,re=`kai-sigil-registry`,x=512,S=`/phi.svg`,C=typeof window<`u`,w=C&&window.localStorage!==void 0,T=1000000n,E=8,ie=2e4;function ae(){let e=s(),t=a(e),n=(t/T+1n)*T-t,r=a(e+1n)-t,i=r>0n?r:191n,o=(n+i-1n)/i,c=Number(o);return Math.min(ie,Math.max(E,c))}var D=5e3,oe=24,se=200,O=180,ce=1200,le=12e3,k=`kai:inhaleQueue:v1`,A=`kai:urlHealth:v1`,ue=18,de=2200,fe=`sigil-explorer-prefetch-v1`,pe=4200,me=`https://phi.network`,he=520,ge=900,_e=80;function j(){let e=s(),t=BigInt(2**53-1),n=e<0n?0n:e>t?t:e;return Number(n)}function ve(e){if(!C)return e;let t=window;return typeof t.CSS?.escape==`function`?t.CSS.escape(e):e.replace(/[^a-zA-Z0-9_-]/gu,e=>`\\${e}`)}var M=_,N=v,ye=`/sigils/seal`,be=`/sigils/urls`,xe=`/sigils/inhale`,Se=`kai:lahmahtorBase:v1`,Ce=`kai:lahmahtorBackupDeadUntil:v1`,we=120*1e3,P=0;function Te(){if(!w)return;let e=localStorage.getItem(Ce);if(!e)return;let t=Number(e);Number.isFinite(t)&&t>0&&(P=t)}function Ee(){if(w)try{localStorage.setItem(Ce,String(P))}catch{}}function De(){return j()e!==N):e;let t=window.location.protocol===`https:`?e.filter(e=>e.startsWith(`https://`)):e;return De()?t.filter(e=>e!==N):t}function Ne(e){return e===0||e===404||e===408||e===429||e>=500}async function Pe(e,t){let n=Me(),r=null;for(let i of n){let n=e(i);try{let e=await fetch(n,t);if(r=e,e.ok||e.status===304)return i===N&&Oe(),F=i,je(),e;if(i===N&&Ne(e.status)&&ke(),!Ne(e.status))return e}catch{i===N&&ke();continue}}return r}async function Fe(e,t){let n=await Pe(e,t);if(!n)return{ok:!1,status:0};if(!n.ok)return{ok:!1,status:n.status};try{return{ok:!0,value:await n.json(),status:n.status}}catch{return{ok:!1,status:0}}}function I(){return C?window.location.origin:me}function L(e){try{let t=I(),n=new URL(e,t);return new URL(`${n.pathname}${n.search}${n.hash}`,t).toString()}catch{return e}}function Ie(e){try{let t=new URL(e,I()).pathname.match(/\/s\/([^/]+)/u);return t?.[1]?decodeURIComponent(t[1]):void 0}catch{return}}function R(e){try{return new URL(e,I()).pathname.toLowerCase().startsWith(`/p~`)}catch{return e.toLowerCase().includes(`/p~`)}}function Le(e){try{return decodeURIComponent(e)}catch{return e}}function Re(e){let t=e.trim();return t.length<16?!1:/^[A-Za-z0-9_-]+$/u.test(t)}function ze(e){let t=I();return new URL(`/stream/p/${e}`,t).toString()}function Be(e){let t=I(),n=new URL(`/stream`,t),r=new URLSearchParams;return r.set(`p`,e),n.hash=`#${r.toString()}`,n.toString()}function Ve(e){try{let t=I(),n=new URL(e,t),r=n.pathname.match(/\/stream\/p\/([^/]+)/u);if(!r?.[1])return e;let i=decodeURIComponent(r[1]),a=new URL(`/stream`,t);a.search=n.search;let o=n.hash.startsWith(`#`)?n.hash.slice(1):``,s=new URLSearchParams(o);return s.set(`p`,i),a.hash=`#${s.toString()}`,a.toString()}catch{return e}}function z(e){try{let t=new URL(e,I()),n=t.pathname,r=n.match(/\/stream\/p\/([^/]+)/u);if(r?.[1])return decodeURIComponent(r[1]);let i=n.match(/^\/p~([^/]+)/u);if(i?.[1])return decodeURIComponent(i[1]);let a=t.searchParams.get(`p`);if(a)return a;let o=t.hash.startsWith(`#`)?t.hash.slice(1):``;return new URLSearchParams(o).get(`p`)||void 0}catch{let t=e.toLowerCase().match(/\/p~([^/?#]+)/u);return t?.[1]?Le(t[1]):void 0}}function B(e){let t=L(e);if(R(t)){let e=z(t);return e?L(Be(e)):t}let n=Ve(t);return n===t?t:L(n)}function He(e){if(!C)return B(e);let t=B(e),n=window.location.origin;try{let e=new URL(t,n);return`${n}${e.pathname}${e.search}${e.hash}`}catch{let e=t.match(/^(?:https?:\/\/[^/]+)?(\/.*)$/i);return`${n}${(e?.[1]??t).startsWith(`/`)?e?.[1]??t:`/${e?.[1]??t}`}`}}function Ue(e,t=10){return e?e.length<=t*2+3?e:`${e.slice(0,t)}…${e.slice(-t)}`:`—`}function V(e,t){return(e.pulse??0)===(t.pulse??0)?(e.beat??0)===(t.beat??0)?(e.stepIndex??0)-(t.stepIndex??0):(e.beat??0)-(t.beat??0):(e.pulse??0)-(t.pulse??0)}function We(e){return e.toFixed(6).replace(/0+$/u,``).replace(/\.$/u,``)}function H(){return C?typeof navigator>`u`?!0:navigator.onLine:!1}function Ge(){return C&&typeof window.crypto?.randomUUID==`function`?window.crypto.randomUUID():Math.random().toString(16).slice(2)}function U(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ke(e,t){if(!U(e))return;let n=e[t];return typeof n==`string`&&n.trim()||void 0}async function qe(e){if(!C||!H())return;let t=new AbortController,n=window.setTimeout(()=>t.abort(),pe);try{let n=await fetch(e,{method:`GET`,cache:`force-cache`,signal:t.signal});if(n&&n.ok&&`caches`in window&&typeof caches.open==`function`)try{await(await caches.open(fe)).put(new Request(e),n.clone())}catch{}}catch{}finally{window.clearTimeout(n)}}var W=new Map;function Je(){if(!w)return;let e=localStorage.getItem(A);if(e)try{let t=JSON.parse(e);if(!U(t))return;W.clear();for(let[e,n]of Object.entries(t))(n===1||n===-1)&&W.set(L(e),n)}catch{}}function Ye(){if(!w)return;let e={};for(let[t,n]of W)e[t]=n;try{localStorage.setItem(A,JSON.stringify(e))}catch{}}function Xe(e,t){let n=L(e);return W.get(n)===t?!1:(W.set(n,t),Ye(),!0)}function Ze(e){let t=new URL(_).host,n=new URL(v).host,r=new URL(I()).host,i=new URL(me).host;return e===t||e===n||e===r||e===i}async function Qe(e){if(!C)return`unknown`;let t=B(e),n;try{if(n=new URL(t,I()),!Ze(n.host))return`unknown`;if(n.pathname.toLowerCase()===`/stream`)return`ok`}catch{return`unknown`}try{let e=new AbortController,t=window.setTimeout(()=>e.abort(),de),r=t=>fetch(n.toString(),{method:t,cache:`no-store`,signal:e.signal,redirect:`follow`,mode:`cors`}),i;try{i=await r(`HEAD`)}catch{i=await r(`GET`)}finally{window.clearTimeout(t)}return i.ok?`ok`:`bad`}catch{return`unknown`}}function $e(e){try{let t=new URL(e,I()),n=t.pathname.toLowerCase();if(n.includes(`/s/`))return`postS`;if(n.startsWith(`/p~`))return`streamP`;if(!n.includes(`/stream`))return`other`;if(n.includes(`/stream/p/`))return`streamP`;let r=t.searchParams.get(`t`);if(r&&r.trim())return`streamT`;let i=t.hash.startsWith(`#`)?t.hash.slice(1):``,a=new URLSearchParams(i),o=a.get(`t`);if(o&&o.trim()||n.includes(`/stream/t`))return`streamT`;let s=t.searchParams.get(`p`);if(s&&s.trim())return`streamQ`;let c=a.get(`p`);return c&&c.trim()?`streamQ`:`stream`}catch{let t=e.toLowerCase();return t.includes(`/s/`)?`postS`:t.includes(`/p~`)||t.includes(`/stream/p/`)?`streamP`:t.includes(`/stream/t`)||/[?&#]t=/.test(t)?`streamT`:t.includes(`/stream`)&&/[?&#]p=/.test(t)?`streamQ`:t.includes(`/stream`)?`stream`:`other`}}function et(e){let t=$e(e);return t===`postS`?`post`:t.startsWith(`stream`)?`stream`:`other`}function tt(e){let t=e;return typeof t.userPhiKey==`string`&&t.userPhiKey||typeof t.phiKey==`string`&&t.phiKey||typeof t.phikey==`string`&&t.phikey||``}function nt(e,t){let n=tt(t),r=Number.isFinite(t.pulse??NaN)?t.pulse:null;if(n&&r!=null)return`k:${n}|${r}`;let i=typeof t.kaiSignature==`string`?t.kaiSignature.trim():``;if(i)return`sig:${i}`;let a=z(e);if(a&&a.trim())return`tok:${a.trim()}`;let o=Ie(e)??``;return o?`h:${o}`:`u:${L(e)}`}function rt(e,t){let n=et(e),r=Ie(e)??``;if(n===`post`&&r)return`post:${r}`;let i=tt(t),a=Number.isFinite(t.pulse??NaN)?t.pulse:null;if(n===`stream`&&i&&a!=null)return`stream:${i}|${a}`;let o=typeof t.kaiSignature==`string`?t.kaiSignature.trim():``;if(o)return`${n}:sig:${o}`;let s=z(e);return s&&s.trim()?`${n}:tok:${s.trim()}`:`${n}:u:${L(e)}`}var it=e=>{let t=e.toLowerCase();if(!t.includes(`/stream`))return!1;let n=t.includes(`root=`)||t.includes(`&seg=`)||t.includes(`&add=`),r=t.includes(`/stream#`)||t.includes(`#v=`);return n&&r};function G(e,t){if(R(e))return-1e9;let n=e.toLowerCase(),r=$e(e),i=0;it(n)&&(i-=1e4),t===`post`?r===`postS`?i+=220:i-=25:t===`stream`?r===`streamT`?i+=220:r===`streamP`?i+=190:r===`streamQ`?i+=175:r===`stream`?i+=160:r===`postS`?i+=80:i-=25:(r===`postS`&&(i+=120),r===`streamT`&&(i+=125),r===`streamP`&&(i+=105),(r===`streamQ`||r===`stream`)&&(i+=95));let a=I().toLowerCase();n.startsWith(a)&&(i+=12),n.startsWith(_.toLowerCase())&&(i+=10),n.startsWith(v.toLowerCase())&&(i+=10);let o=W.get(L(e));return o===1&&(i+=200),o===-1&&(i-=200),i+=Math.max(0,20-Math.floor(e.length/40)),i}function at(e,t){let n=e.filter(e=>!R(e)),r=n.length>0?n:e;if(n.length===0&&e.length>0){let t=z(e[0]??``);if(t)return L(Be(t))}let i=r[0]??``,a=-1e9;for(let e of r){let n=G(e,t);(n>a||n===a&&e.length=1e-12)return e}}}function ut(){if(!w)return;let e=Array.from(K.keys());try{localStorage.setItem(te,JSON.stringify(e))}catch{}}function J(e,t){let n=L(e);dt(n,t);let r=K.get(n);if(!r)return K.set(n,t),!0;let i=r.parentUrl??``,a=r.originUrl??``,o=t.parentUrl??``,s=t.originUrl??``,c=i!==o||a!==s,l=Object.keys(r).length,u=Object.keys(t).length!==l,d=V(r,t)!==0;return c||u||d?(K.set(n,t),!0):!1}function dt(e,t){let n=t.feed;if(!n)return;let r=n.usernameClaim,i=r?f(r.payload?.normalized||r.payload?.username||``):``,a=f(n.author??``),o=i||a;if(!o||!r)return;let s=u(r.hash??``),c=r.url?.trim()||e;if(!s||!c)return;let l=r.payload;if(!l||l.kind!==`username_claim`)return;let p=f(l.normalized||l.username||``)||o;if(p!==o)return;let m=r.ownerHint??l.ownerHint??null;d({hash:s,url:L(c),payload:{...l,normalized:p},ownerHint:m})}function ft(e){let t=L(e),r=n(t);return r?J(t,ct(r,st(t))):!1}function pt(e,t){if(e.length===0)return!1;let n=L(e[0]),r=!1;r=ft(n)||r;{let e=K.get(n);if(e){let t={...e};t.originUrl||=n,r=J(n,t)||r}}for(let t=1;t{X=null,Q()},O))}function vt(e,t){let n=L(e),r={url:n,...t};Y.set(n,r),Z(),C&&(X!=null&&window.clearTimeout(X),X=window.setTimeout(()=>{X=null,Q()},O))}function yt(){for(let[e,t]of K){let n=L(e),r=t;Y.set(n,{url:n,...r})}Z()}async function Q(){if(C&&H()&&!mt&&Y.size!==0){mt=!0;try{let e=[],t=[];for(let[n,r]of Y)if(e.push(r),t.push(n),e.length>=se)break;let n=JSON.stringify(e),r=new Blob([n],{type:`application/json`}),i=new FormData;i.append(`file`,r,`sigils_${Ge()}.json`);let a=await Pe(e=>{let t=new URL(xe,e);return t.searchParams.set(`include_state`,`false`),t.searchParams.set(`include_urls`,`false`),t.toString()},{method:`POST`,body:i});if(!a||!a.ok)throw Error(`inhale failed: ${a?.status??0}`);try{await a.json()}catch{}for(let e of t)Y.delete(e);Z(),ht=0,Y.size>0&&(X=window.setTimeout(()=>{X=null,Q()},10))}catch{ht=Math.min(ht?ht*2:ce,le),X=window.setTimeout(()=>{X=null,Q()},ht)}finally{mt=!1}}}function $(e,t){let i=L(e),a=n(i);if(!a)return!1;let o=t?.includeAncestry??!0,s=t?.broadcast??!0,c=t?.persist??!0,l=t?.source??`local`,u=t?.enqueueToApi??l===`local`,d=!1,f=st(i);if(d=J(i,ct(a,f))||d,o&&f.chain.length>0){for(let e of f.chain)d=ft(e)||d;d=pt(f.chain,i)||d}if(o){let e=r(i);for(let t of e){let e=L(t),r=n(e);r&&(d=J(e,ct(r,st(e)))||d)}}if(d&&(c&&ut(),q&&s&&q.postMessage({type:`sigil:add`,url:i}),u)){let e=K.get(i);e&&vt(i,e)}return d}function bt(e){let t=[],n=[],r=e=>{let n=L(e);t.includes(n)||t.push(n)};if(Array.isArray(e)){for(let i of e){if(typeof i==`string`){i.trim()&&r(i.trim());continue}if(U(i)){let e=i.url;if(typeof e==`string`&&e.trim()){let r=L(e.trim());t.includes(r)||t.push(r),n.push({...i,url:r})}}}return{urls:t,rawKrystals:n}}if(U(e)){let i=e.urls;if(Array.isArray(i))for(let e of i)typeof e==`string`&&e.trim()&&r(e.trim());let a=e.url;if(typeof a==`string`&&a.trim()){let r=L(a.trim());t.includes(r)||t.push(r),n.push({...e,url:r})}return{urls:t,rawKrystals:n}}return{urls:t,rawKrystals:n}}function xt(e){for(let t of e){let e=L(t),r=K.get(e)??n(e);r&&vt(e,ct(r,st(e)))}Q()}function St(){if(!w)return!1;let e=e=>{if(!e)return!1;try{let t=JSON.parse(e);if(!Array.isArray(t))return!1;let n=!1;for(let e of t)typeof e==`string`&&$(e,{includeAncestry:!0,broadcast:!1,persist:!1,source:`hydrate`,enqueueToApi:!1})&&(n=!0);return n}catch{return!1}},t=e(localStorage.getItem(te)),n=e(localStorage.getItem(ne));return(t||n)&&ut(),t||n}async function Ct(e){let t=0,n,r;for(let i=0;i{let t=new URL(be,e);return t.searchParams.set(`offset`,String(a)),t.searchParams.set(`limit`,String(D)),t.toString()},{method:`GET`,signal:e,cache:`no-store`});if(!o.ok)break;n=o.value.state_seal,r=o.value.total;let s=o.value.urls;if(!Array.isArray(s)||s.length===0)break;for(let e of s){if(typeof e!=`string`)continue;let n=L(e);K.has(n)||$(n,{includeAncestry:!0,broadcast:!1,persist:!1,source:`remote`,enqueueToApi:!1})&&(t+=1)}if(s.length=r)break}return t>0&&ut(),{imported:t,remoteSeal:n,remoteTotal:r}}function wt(t){let n=new Map,r=new Map;for(let[e,i]of t){let t=L(e),a=et(t),o=rt(t,i),s=nt(t,i);n.set(t,o);let c=r.get(o);if(!c){r.set(o,{payload:i,urls:new Set([t]),kind:a,momentKey:s});continue}V(i,c.payload)>0&&(c.payload=i),c.urls.add(t);let l=c.momentKey,u=s;l.startsWith(`u:`)&&!u.startsWith(`u:`)&&(c.momentKey=u),l.startsWith(`h:`)&&(u.startsWith(`k:`)||u.startsWith(`sig:`)||u.startsWith(`tok:`))&&(c.momentKey=u)}let i=new Map;for(let[e,t]of r){let n=at(Array.from(t.urls),t.kind);i.set(e,{id:e,payload:t.payload,urls:t.urls,primaryUrl:n,kind:t.kind,momentKey:t.momentKey})}let a=new Map;for(let e of i.values()){let t=e.momentKey;a.has(t)||a.set(t,[]),a.get(t).push(e.id)}let o=new Map,s=new Map,c=new Map;for(let[e,t]of a){let n=t.map(e=>i.get(e)).filter(Boolean),r=n.filter(e=>e.kind===`post`),a;a=r.length>0?r.slice().sort((e,t)=>G(t.primaryUrl,`post`)-G(e.primaryUrl,`post`))[0]:n.slice().sort((e,t)=>G(t.primaryUrl,t.kind)-G(e.primaryUrl,e.kind))[0];let l=a?.id??t[0];o.set(e,l);for(let e of t)s.set(e,l);for(let e of t){let t=i.get(e);if(t)for(let e of t.urls)c.set(e,l)}}let l=new Map;for(let t of i.values()){let r=s.get(t.id)??t.id;if(t.id!==r)continue;let i=Ke(t.payload,`originUrl`),a=i?L(i):e(t.primaryUrl)??t.primaryUrl,o=n.get(a),u=c.get(a)??(o?s.get(o):void 0);l.set(r,u??r)}let u=new Map;for(let e of i.values()){let t=s.get(e.id)??e.id,r=l.get(t)??t,i;if(e.id!==t)i=t;else{let t=Ke(e.payload,`parentUrl`);if(t){let r=L(t),a=n.get(r),o=c.get(r)??(a?s.get(a):void 0);o&&o!==e.id&&(i=o)}}u.set(e.id,{id:e.id,payload:e.payload,urls:e.urls,primaryUrl:e.primaryUrl,kind:e.kind,momentKey:e.momentKey,parentId:i,originId:r,momentParentId:t})}return u}function Tt(e,t){let n=[];for(let[r,i]of t)i.parentId===e&&n.push(r);return n.sort((e,n)=>V(t.get(n).payload,t.get(e).payload)),n}function Et(e,t,n=new Set){let r=t.get(e);if(!r)return null;if(n.has(e))return{id:r.id,url:r.primaryUrl,urls:Array.from(r.urls),payload:r.payload,children:[]};n.add(e);let i=Tt(e,t).map(e=>Et(e,t,n)).filter(Boolean);return{id:r.id,url:r.primaryUrl,urls:Array.from(r.urls),payload:r.payload,children:i}}function Dt(e){let t=0,n=e.payload,r=e=>{t+=1,V(e.payload,n)>0&&(n=e.payload),e.children.forEach(r)};return r(e),{nodeCount:t,latest:n}}function Ot(e){let t=wt(e),n=new Map;for(let[e,r]of t){let t=r.originId;n.has(t)||n.set(t,[]),n.get(t).push(e)}let r=[];for(let e of n.keys()){let n=Et(e,t);if(!n)continue;let i=Dt(n);r.push({root:n,nodeCount:i.nodeCount,latest:i.latest})}return r.sort((e,t)=>{let n=V(t.latest,e.latest);return n===0?t.nodeCount===e.nodeCount?V(t.root.payload,e.root.payload):t.nodeCount-e.nodeCount:n}),r.map(e=>e.root)}function kt(e,t){let n=e.payload,r=[],i=new Set,a=lt(e.payload);a!==void 0&&r.push({label:`This glyph Φ`,value:`${We(a)} Φ`});let o=n.feed,s=typeof o?.author==`string`?o.author:typeof n.author==`string`?n.author:void 0,c=o?o.usernameClaim:void 0,l=c?f(c.payload?.normalized||c.payload?.username||``):``,u=f(s??``),d=l||u;if(d){let e=t[d],n=typeof s==`string`&&s.trim().length>0?s.trim():`@${d}`;e?(r.push({label:`Username (claimed)`,value:`${n} → glyph ${Ue(e.claimHash,10)}`}),r.push({label:`Claim glyph`,value:B(e.claimUrl)})):r.push({label:`Username`,value:n})}let p=(e,t)=>{let a=n[e];typeof a==`string`&&a.trim().length>0&&!i.has(e)&&(r.push({label:t,value:a.trim()}),i.add(e))};p(`userPhiKey`,`PhiKey`),p(`phiKey`,`PhiKey`),p(`phikey`,`PhiKey`),p(`kaiSignature`,`Kai Signature`);let m=n.parentUrl;typeof m==`string`&&m.length>0&&(r.push({label:`Parent URL`,value:B(m)}),i.add(`parentUrl`));let h=n.originUrl;typeof h==`string`&&h.length>0&&(r.push({label:`Origin URL`,value:B(h)}),i.add(`originUrl`));let g=n.label??n.title??n.type??n.note??n.description;typeof g==`string`&&g.trim().length>0&&r.push({label:`Label / Type`,value:g.trim()});for(let e of[`memoryUrl`,`memory_url`,`streamUrl`,`stream_url`,`feedUrl`,`feed_url`,`stream`]){let t=n[e];typeof t==`string`&&t.trim().length>0&&!i.has(e)&&(r.push({label:e,value:B(t.trim())}),i.add(e))}for(let[e,t]of Object.entries(n)){if(r.length>=12)break;if(i.has(e)||t==null)continue;let n=e.toLowerCase();if(!(n.includes(`stream`)||n.includes(`memory`)||n.includes(`feed`))||typeof t==`string`&&t.trim().length===0)continue;let a=typeof t==`string`?B(t.trim()):JSON.stringify(t);r.push({label:e,value:a})}r.push({label:`Primary URL`,value:B(e.url)});let _=e.urls.filter(e=>!R(e)).map(e=>B(e));return e.urls.length>1&&r.push({label:`URL variants`,value:_.length===0?`${e.urls.length} urls (kept in data; hidden from browser view)`:_.length<=3?_.join(` | `):`${e.urls.length} urls (kept in data; rendered once)`}),r}async function At(e){if(C){try{if(navigator.clipboard&&typeof navigator.clipboard.writeText==`function`){await navigator.clipboard.writeText(e);return}}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,`true`),t.style.position=`fixed`,t.style.left=`-9999px`,t.style.top=`-9999px`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t)}catch{}}}var jt=()=>(0,g.jsx)(`style`,{children:` +import{K as e,Tn as t,W as n,X as r,gt as i,hn as a,jn as o,mn as s,nn as c,tn as l}from"./index-BWApiWDT.js";import{a as u,n as d,o as f,r as p,t as m}from"./usernameClaimRegistry-CU2B_ZCP.js";var h=o(t(),1),g=o(l(),1),_=`https://align.kaiklok.com`,v=`http://m.kai`,y={root:`#ff3b3b`,sacral:`#ff8a3d`,solar:`#ffd54a`,heart:`#3dff9a`,throat:`#46d3ff`,thirdEye:`#6b6cff`,crown:`#c18bff`};function b(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();return t?t.includes(`root`)?`root`:t.includes(`sacral`)?`sacral`:t.includes(`solar`)||t.includes(`plexus`)||t.includes(`sun`)?`solar`:t.includes(`heart`)?`heart`:t.includes(`throat`)?`throat`:t.includes(`third`)||t.includes(`eye`)||t.includes(`indigo`)?`thirdEye`:t.includes(`crown`)||t.includes(`krown`)||t.includes(`violet`)?`crown`:t===`1`?`root`:t===`2`?`sacral`:t===`3`?`solar`:t===`4`?`heart`:t===`5`?`throat`:t===`6`?`thirdEye`:t===`7`?`crown`:null:null}function ee(e){let t=b(e),n=t?y[t]:`var(--sx-accent)`;return{"--sx-chakra":n}}var te=`kai:sigils:v1`,ne=`sigil:urls`,re=`kai-sigil-registry`,x=512,S=`/phi.svg`,C=typeof window<`u`,w=C&&window.localStorage!==void 0,T=1000000n,E=8,ie=2e4;function ae(){let e=s(),t=a(e),n=(t/T+1n)*T-t,r=a(e+1n)-t,i=r>0n?r:191n,o=(n+i-1n)/i,c=Number(o);return Math.min(ie,Math.max(E,c))}var D=5e3,oe=24,se=200,O=180,ce=1200,le=12e3,k=`kai:inhaleQueue:v1`,A=`kai:urlHealth:v1`,ue=18,de=2200,fe=`sigil-explorer-prefetch-v1`,pe=4200,me=`https://phi.network`,he=520,ge=900,_e=80;function j(){let e=s(),t=BigInt(2**53-1),n=e<0n?0n:e>t?t:e;return Number(n)}function ve(e){if(!C)return e;let t=window;return typeof t.CSS?.escape==`function`?t.CSS.escape(e):e.replace(/[^a-zA-Z0-9_-]/gu,e=>`\\${e}`)}var M=_,N=v,ye=`/sigils/seal`,be=`/sigils/urls`,xe=`/sigils/inhale`,Se=`kai:lahmahtorBase:v1`,Ce=`kai:lahmahtorBackupDeadUntil:v1`,we=120*1e3,P=0;function Te(){if(!w)return;let e=localStorage.getItem(Ce);if(!e)return;let t=Number(e);Number.isFinite(t)&&t>0&&(P=t)}function Ee(){if(w)try{localStorage.setItem(Ce,String(P))}catch{}}function De(){return j()e!==N):e;let t=window.location.protocol===`https:`?e.filter(e=>e.startsWith(`https://`)):e;return De()?t.filter(e=>e!==N):t}function Ne(e){return e===0||e===404||e===408||e===429||e>=500}async function Pe(e,t){let n=Me(),r=null;for(let i of n){let n=e(i);try{let e=await fetch(n,t);if(r=e,e.ok||e.status===304)return i===N&&Oe(),F=i,je(),e;if(i===N&&Ne(e.status)&&ke(),!Ne(e.status))return e}catch{i===N&&ke();continue}}return r}async function Fe(e,t){let n=await Pe(e,t);if(!n)return{ok:!1,status:0};if(!n.ok)return{ok:!1,status:n.status};try{return{ok:!0,value:await n.json(),status:n.status}}catch{return{ok:!1,status:0}}}function I(){return C?window.location.origin:me}function L(e){try{let t=I(),n=new URL(e,t);return new URL(`${n.pathname}${n.search}${n.hash}`,t).toString()}catch{return e}}function Ie(e){try{let t=new URL(e,I()).pathname.match(/\/s\/([^/]+)/u);return t?.[1]?decodeURIComponent(t[1]):void 0}catch{return}}function R(e){try{return new URL(e,I()).pathname.toLowerCase().startsWith(`/p~`)}catch{return e.toLowerCase().includes(`/p~`)}}function Le(e){try{return decodeURIComponent(e)}catch{return e}}function Re(e){let t=e.trim();return t.length<16?!1:/^[A-Za-z0-9_-]+$/u.test(t)}function ze(e){let t=I();return new URL(`/stream/p/${e}`,t).toString()}function Be(e){let t=I(),n=new URL(`/stream`,t),r=new URLSearchParams;return r.set(`p`,e),n.hash=`#${r.toString()}`,n.toString()}function Ve(e){try{let t=I(),n=new URL(e,t),r=n.pathname.match(/\/stream\/p\/([^/]+)/u);if(!r?.[1])return e;let i=decodeURIComponent(r[1]),a=new URL(`/stream`,t);a.search=n.search;let o=n.hash.startsWith(`#`)?n.hash.slice(1):``,s=new URLSearchParams(o);return s.set(`p`,i),a.hash=`#${s.toString()}`,a.toString()}catch{return e}}function z(e){try{let t=new URL(e,I()),n=t.pathname,r=n.match(/\/stream\/p\/([^/]+)/u);if(r?.[1])return decodeURIComponent(r[1]);let i=n.match(/^\/p~([^/]+)/u);if(i?.[1])return decodeURIComponent(i[1]);let a=t.searchParams.get(`p`);if(a)return a;let o=t.hash.startsWith(`#`)?t.hash.slice(1):``;return new URLSearchParams(o).get(`p`)||void 0}catch{let t=e.toLowerCase().match(/\/p~([^/?#]+)/u);return t?.[1]?Le(t[1]):void 0}}function B(e){let t=L(e);if(R(t)){let e=z(t);return e?L(Be(e)):t}let n=Ve(t);return n===t?t:L(n)}function He(e){if(!C)return B(e);let t=B(e),n=window.location.origin;try{let e=new URL(t,n);return`${n}${e.pathname}${e.search}${e.hash}`}catch{let e=t.match(/^(?:https?:\/\/[^/]+)?(\/.*)$/i);return`${n}${(e?.[1]??t).startsWith(`/`)?e?.[1]??t:`/${e?.[1]??t}`}`}}function Ue(e,t=10){return e?e.length<=t*2+3?e:`${e.slice(0,t)}…${e.slice(-t)}`:`—`}function V(e,t){return(e.pulse??0)===(t.pulse??0)?(e.beat??0)===(t.beat??0)?(e.stepIndex??0)-(t.stepIndex??0):(e.beat??0)-(t.beat??0):(e.pulse??0)-(t.pulse??0)}function We(e){return e.toFixed(6).replace(/0+$/u,``).replace(/\.$/u,``)}function H(){return C?typeof navigator>`u`?!0:navigator.onLine:!1}function Ge(){return C&&typeof window.crypto?.randomUUID==`function`?window.crypto.randomUUID():Math.random().toString(16).slice(2)}function U(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ke(e,t){if(!U(e))return;let n=e[t];return typeof n==`string`&&n.trim()||void 0}async function qe(e){if(!C||!H())return;let t=new AbortController,n=window.setTimeout(()=>t.abort(),pe);try{let n=await fetch(e,{method:`GET`,cache:`force-cache`,signal:t.signal});if(n&&n.ok&&`caches`in window&&typeof caches.open==`function`)try{await(await caches.open(fe)).put(new Request(e),n.clone())}catch{}}catch{}finally{window.clearTimeout(n)}}var W=new Map;function Je(){if(!w)return;let e=localStorage.getItem(A);if(e)try{let t=JSON.parse(e);if(!U(t))return;W.clear();for(let[e,n]of Object.entries(t))(n===1||n===-1)&&W.set(L(e),n)}catch{}}function Ye(){if(!w)return;let e={};for(let[t,n]of W)e[t]=n;try{localStorage.setItem(A,JSON.stringify(e))}catch{}}function Xe(e,t){let n=L(e);return W.get(n)===t?!1:(W.set(n,t),Ye(),!0)}function Ze(e){let t=new URL(_).host,n=new URL(v).host,r=new URL(I()).host,i=new URL(me).host;return e===t||e===n||e===r||e===i}async function Qe(e){if(!C)return`unknown`;let t=B(e),n;try{if(n=new URL(t,I()),!Ze(n.host))return`unknown`;if(n.pathname.toLowerCase()===`/stream`)return`ok`}catch{return`unknown`}try{let e=new AbortController,t=window.setTimeout(()=>e.abort(),de),r=t=>fetch(n.toString(),{method:t,cache:`no-store`,signal:e.signal,redirect:`follow`,mode:`cors`}),i;try{i=await r(`HEAD`)}catch{i=await r(`GET`)}finally{window.clearTimeout(t)}return i.ok?`ok`:`bad`}catch{return`unknown`}}function $e(e){try{let t=new URL(e,I()),n=t.pathname.toLowerCase();if(n.includes(`/s/`))return`postS`;if(n.startsWith(`/p~`))return`streamP`;if(!n.includes(`/stream`))return`other`;if(n.includes(`/stream/p/`))return`streamP`;let r=t.searchParams.get(`t`);if(r&&r.trim())return`streamT`;let i=t.hash.startsWith(`#`)?t.hash.slice(1):``,a=new URLSearchParams(i),o=a.get(`t`);if(o&&o.trim()||n.includes(`/stream/t`))return`streamT`;let s=t.searchParams.get(`p`);if(s&&s.trim())return`streamQ`;let c=a.get(`p`);return c&&c.trim()?`streamQ`:`stream`}catch{let t=e.toLowerCase();return t.includes(`/s/`)?`postS`:t.includes(`/p~`)||t.includes(`/stream/p/`)?`streamP`:t.includes(`/stream/t`)||/[?&#]t=/.test(t)?`streamT`:t.includes(`/stream`)&&/[?&#]p=/.test(t)?`streamQ`:t.includes(`/stream`)?`stream`:`other`}}function et(e){let t=$e(e);return t===`postS`?`post`:t.startsWith(`stream`)?`stream`:`other`}function tt(e){let t=e;return typeof t.userPhiKey==`string`&&t.userPhiKey||typeof t.phiKey==`string`&&t.phiKey||typeof t.phikey==`string`&&t.phikey||``}function nt(e,t){let n=tt(t),r=Number.isFinite(t.pulse??NaN)?t.pulse:null;if(n&&r!=null)return`k:${n}|${r}`;let i=typeof t.kaiSignature==`string`?t.kaiSignature.trim():``;if(i)return`sig:${i}`;let a=z(e);if(a&&a.trim())return`tok:${a.trim()}`;let o=Ie(e)??``;return o?`h:${o}`:`u:${L(e)}`}function rt(e,t){let n=et(e),r=Ie(e)??``;if(n===`post`&&r)return`post:${r}`;let i=tt(t),a=Number.isFinite(t.pulse??NaN)?t.pulse:null;if(n===`stream`&&i&&a!=null)return`stream:${i}|${a}`;let o=typeof t.kaiSignature==`string`?t.kaiSignature.trim():``;if(o)return`${n}:sig:${o}`;let s=z(e);return s&&s.trim()?`${n}:tok:${s.trim()}`:`${n}:u:${L(e)}`}var it=e=>{let t=e.toLowerCase();if(!t.includes(`/stream`))return!1;let n=t.includes(`root=`)||t.includes(`&seg=`)||t.includes(`&add=`),r=t.includes(`/stream#`)||t.includes(`#v=`);return n&&r};function G(e,t){if(R(e))return-1e9;let n=e.toLowerCase(),r=$e(e),i=0;it(n)&&(i-=1e4),t===`post`?r===`postS`?i+=220:i-=25:t===`stream`?r===`streamT`?i+=220:r===`streamP`?i+=190:r===`streamQ`?i+=175:r===`stream`?i+=160:r===`postS`?i+=80:i-=25:(r===`postS`&&(i+=120),r===`streamT`&&(i+=125),r===`streamP`&&(i+=105),(r===`streamQ`||r===`stream`)&&(i+=95));let a=I().toLowerCase();n.startsWith(a)&&(i+=12),n.startsWith(_.toLowerCase())&&(i+=10),n.startsWith(v.toLowerCase())&&(i+=10);let o=W.get(L(e));return o===1&&(i+=200),o===-1&&(i-=200),i+=Math.max(0,20-Math.floor(e.length/40)),i}function at(e,t){let n=e.filter(e=>!R(e)),r=n.length>0?n:e;if(n.length===0&&e.length>0){let t=z(e[0]??``);if(t)return L(Be(t))}let i=r[0]??``,a=-1e9;for(let e of r){let n=G(e,t);(n>a||n===a&&e.length=1e-12)return e}}}function ut(){if(!w)return;let e=Array.from(K.keys());try{localStorage.setItem(te,JSON.stringify(e))}catch{}}function J(e,t){let n=L(e);dt(n,t);let r=K.get(n);if(!r)return K.set(n,t),!0;let i=r.parentUrl??``,a=r.originUrl??``,o=t.parentUrl??``,s=t.originUrl??``,c=i!==o||a!==s,l=Object.keys(r).length,u=Object.keys(t).length!==l,d=V(r,t)!==0;return c||u||d?(K.set(n,t),!0):!1}function dt(e,t){let n=t.feed;if(!n)return;let r=n.usernameClaim,i=r?f(r.payload?.normalized||r.payload?.username||``):``,a=f(n.author??``),o=i||a;if(!o||!r)return;let s=u(r.hash??``),c=r.url?.trim()||e;if(!s||!c)return;let l=r.payload;if(!l||l.kind!==`username_claim`)return;let p=f(l.normalized||l.username||``)||o;if(p!==o)return;let m=r.ownerHint??l.ownerHint??null;d({hash:s,url:L(c),payload:{...l,normalized:p},ownerHint:m})}function ft(e){let t=L(e),r=n(t);return r?J(t,ct(r,st(t))):!1}function pt(e,t){if(e.length===0)return!1;let n=L(e[0]),r=!1;r=ft(n)||r;{let e=K.get(n);if(e){let t={...e};t.originUrl||=n,r=J(n,t)||r}}for(let t=1;t{X=null,Q()},O))}function vt(e,t){let n=L(e),r={url:n,...t};Y.set(n,r),Z(),C&&(X!=null&&window.clearTimeout(X),X=window.setTimeout(()=>{X=null,Q()},O))}function yt(){for(let[e,t]of K){let n=L(e),r=t;Y.set(n,{url:n,...r})}Z()}async function Q(){if(C&&H()&&!mt&&Y.size!==0){mt=!0;try{let e=[],t=[];for(let[n,r]of Y)if(e.push(r),t.push(n),e.length>=se)break;let n=JSON.stringify(e),r=new Blob([n],{type:`application/json`}),i=new FormData;i.append(`file`,r,`sigils_${Ge()}.json`);let a=await Pe(e=>{let t=new URL(xe,e);return t.searchParams.set(`include_state`,`false`),t.searchParams.set(`include_urls`,`false`),t.toString()},{method:`POST`,body:i});if(!a||!a.ok)throw Error(`inhale failed: ${a?.status??0}`);try{await a.json()}catch{}for(let e of t)Y.delete(e);Z(),ht=0,Y.size>0&&(X=window.setTimeout(()=>{X=null,Q()},10))}catch{ht=Math.min(ht?ht*2:ce,le),X=window.setTimeout(()=>{X=null,Q()},ht)}finally{mt=!1}}}function $(e,t){let i=L(e),a=n(i);if(!a)return!1;let o=t?.includeAncestry??!0,s=t?.broadcast??!0,c=t?.persist??!0,l=t?.source??`local`,u=t?.enqueueToApi??l===`local`,d=!1,f=st(i);if(d=J(i,ct(a,f))||d,o&&f.chain.length>0){for(let e of f.chain)d=ft(e)||d;d=pt(f.chain,i)||d}if(o){let e=r(i);for(let t of e){let e=L(t),r=n(e);r&&(d=J(e,ct(r,st(e)))||d)}}if(d&&(c&&ut(),q&&s&&q.postMessage({type:`sigil:add`,url:i}),u)){let e=K.get(i);e&&vt(i,e)}return d}function bt(e){let t=[],n=[],r=e=>{let n=L(e);t.includes(n)||t.push(n)};if(Array.isArray(e)){for(let i of e){if(typeof i==`string`){i.trim()&&r(i.trim());continue}if(U(i)){let e=i.url;if(typeof e==`string`&&e.trim()){let r=L(e.trim());t.includes(r)||t.push(r),n.push({...i,url:r})}}}return{urls:t,rawKrystals:n}}if(U(e)){let i=e.urls;if(Array.isArray(i))for(let e of i)typeof e==`string`&&e.trim()&&r(e.trim());let a=e.url;if(typeof a==`string`&&a.trim()){let r=L(a.trim());t.includes(r)||t.push(r),n.push({...e,url:r})}return{urls:t,rawKrystals:n}}return{urls:t,rawKrystals:n}}function xt(e){for(let t of e){let e=L(t),r=K.get(e)??n(e);r&&vt(e,ct(r,st(e)))}Q()}function St(){if(!w)return!1;let e=e=>{if(!e)return!1;try{let t=JSON.parse(e);if(!Array.isArray(t))return!1;let n=!1;for(let e of t)typeof e==`string`&&$(e,{includeAncestry:!0,broadcast:!1,persist:!1,source:`hydrate`,enqueueToApi:!1})&&(n=!0);return n}catch{return!1}},t=e(localStorage.getItem(te)),n=e(localStorage.getItem(ne));return(t||n)&&ut(),t||n}async function Ct(e){let t=0,n,r;for(let i=0;i{let t=new URL(be,e);return t.searchParams.set(`offset`,String(a)),t.searchParams.set(`limit`,String(D)),t.toString()},{method:`GET`,signal:e,cache:`no-store`});if(!o.ok)break;n=o.value.state_seal,r=o.value.total;let s=o.value.urls;if(!Array.isArray(s)||s.length===0)break;for(let e of s){if(typeof e!=`string`)continue;let n=L(e);K.has(n)||$(n,{includeAncestry:!0,broadcast:!1,persist:!1,source:`remote`,enqueueToApi:!1})&&(t+=1)}if(s.length=r)break}return t>0&&ut(),{imported:t,remoteSeal:n,remoteTotal:r}}function wt(t){let n=new Map,r=new Map;for(let[e,i]of t){let t=L(e),a=et(t),o=rt(t,i),s=nt(t,i);n.set(t,o);let c=r.get(o);if(!c){r.set(o,{payload:i,urls:new Set([t]),kind:a,momentKey:s});continue}V(i,c.payload)>0&&(c.payload=i),c.urls.add(t);let l=c.momentKey,u=s;l.startsWith(`u:`)&&!u.startsWith(`u:`)&&(c.momentKey=u),l.startsWith(`h:`)&&(u.startsWith(`k:`)||u.startsWith(`sig:`)||u.startsWith(`tok:`))&&(c.momentKey=u)}let i=new Map;for(let[e,t]of r){let n=at(Array.from(t.urls),t.kind);i.set(e,{id:e,payload:t.payload,urls:t.urls,primaryUrl:n,kind:t.kind,momentKey:t.momentKey})}let a=new Map;for(let e of i.values()){let t=e.momentKey;a.has(t)||a.set(t,[]),a.get(t).push(e.id)}let o=new Map,s=new Map,c=new Map;for(let[e,t]of a){let n=t.map(e=>i.get(e)).filter(Boolean),r=n.filter(e=>e.kind===`post`),a;a=r.length>0?r.slice().sort((e,t)=>G(t.primaryUrl,`post`)-G(e.primaryUrl,`post`))[0]:n.slice().sort((e,t)=>G(t.primaryUrl,t.kind)-G(e.primaryUrl,e.kind))[0];let l=a?.id??t[0];o.set(e,l);for(let e of t)s.set(e,l);for(let e of t){let t=i.get(e);if(t)for(let e of t.urls)c.set(e,l)}}let l=new Map;for(let t of i.values()){let r=s.get(t.id)??t.id;if(t.id!==r)continue;let i=Ke(t.payload,`originUrl`),a=i?L(i):e(t.primaryUrl)??t.primaryUrl,o=n.get(a),u=c.get(a)??(o?s.get(o):void 0);l.set(r,u??r)}let u=new Map;for(let e of i.values()){let t=s.get(e.id)??e.id,r=l.get(t)??t,i;if(e.id!==t)i=t;else{let t=Ke(e.payload,`parentUrl`);if(t){let r=L(t),a=n.get(r),o=c.get(r)??(a?s.get(a):void 0);o&&o!==e.id&&(i=o)}}u.set(e.id,{id:e.id,payload:e.payload,urls:e.urls,primaryUrl:e.primaryUrl,kind:e.kind,momentKey:e.momentKey,parentId:i,originId:r,momentParentId:t})}return u}function Tt(e,t){let n=[];for(let[r,i]of t)i.parentId===e&&n.push(r);return n.sort((e,n)=>V(t.get(n).payload,t.get(e).payload)),n}function Et(e,t,n=new Set){let r=t.get(e);if(!r)return null;if(n.has(e))return{id:r.id,url:r.primaryUrl,urls:Array.from(r.urls),payload:r.payload,children:[]};n.add(e);let i=Tt(e,t).map(e=>Et(e,t,n)).filter(Boolean);return{id:r.id,url:r.primaryUrl,urls:Array.from(r.urls),payload:r.payload,children:i}}function Dt(e){let t=0,n=e.payload,r=e=>{t+=1,V(e.payload,n)>0&&(n=e.payload),e.children.forEach(r)};return r(e),{nodeCount:t,latest:n}}function Ot(e){let t=wt(e),n=new Map;for(let[e,r]of t){let t=r.originId;n.has(t)||n.set(t,[]),n.get(t).push(e)}let r=[];for(let e of n.keys()){let n=Et(e,t);if(!n)continue;let i=Dt(n);r.push({root:n,nodeCount:i.nodeCount,latest:i.latest})}return r.sort((e,t)=>{let n=V(t.latest,e.latest);return n===0?t.nodeCount===e.nodeCount?V(t.root.payload,e.root.payload):t.nodeCount-e.nodeCount:n}),r.map(e=>e.root)}function kt(e,t){let n=e.payload,r=[],i=new Set,a=lt(e.payload);a!==void 0&&r.push({label:`This glyph Φ`,value:`${We(a)} Φ`});let o=n.feed,s=typeof o?.author==`string`?o.author:typeof n.author==`string`?n.author:void 0,c=o?o.usernameClaim:void 0,l=c?f(c.payload?.normalized||c.payload?.username||``):``,u=f(s??``),d=l||u;if(d){let e=t[d],n=typeof s==`string`&&s.trim().length>0?s.trim():`@${d}`;e?(r.push({label:`Username (claimed)`,value:`${n} → glyph ${Ue(e.claimHash,10)}`}),r.push({label:`Claim glyph`,value:B(e.claimUrl)})):r.push({label:`Username`,value:n})}let p=(e,t)=>{let a=n[e];typeof a==`string`&&a.trim().length>0&&!i.has(e)&&(r.push({label:t,value:a.trim()}),i.add(e))};p(`userPhiKey`,`PhiKey`),p(`phiKey`,`PhiKey`),p(`phikey`,`PhiKey`),p(`kaiSignature`,`Kai Signature`);let m=n.parentUrl;typeof m==`string`&&m.length>0&&(r.push({label:`Parent URL`,value:B(m)}),i.add(`parentUrl`));let h=n.originUrl;typeof h==`string`&&h.length>0&&(r.push({label:`Origin URL`,value:B(h)}),i.add(`originUrl`));let g=n.label??n.title??n.type??n.note??n.description;typeof g==`string`&&g.trim().length>0&&r.push({label:`Label / Type`,value:g.trim()});for(let e of[`memoryUrl`,`memory_url`,`streamUrl`,`stream_url`,`feedUrl`,`feed_url`,`stream`]){let t=n[e];typeof t==`string`&&t.trim().length>0&&!i.has(e)&&(r.push({label:e,value:B(t.trim())}),i.add(e))}for(let[e,t]of Object.entries(n)){if(r.length>=12)break;if(i.has(e)||t==null)continue;let n=e.toLowerCase();if(!(n.includes(`stream`)||n.includes(`memory`)||n.includes(`feed`))||typeof t==`string`&&t.trim().length===0)continue;let a=typeof t==`string`?B(t.trim()):JSON.stringify(t);r.push({label:e,value:a})}r.push({label:`Primary URL`,value:B(e.url)});let _=e.urls.filter(e=>!R(e)).map(e=>B(e));return e.urls.length>1&&r.push({label:`URL variants`,value:_.length===0?`${e.urls.length} urls (kept in data; hidden from browser view)`:_.length<=3?_.join(` | `):`${e.urls.length} urls (kept in data; rendered once)`}),r}async function At(e){if(C){try{if(navigator.clipboard&&typeof navigator.clipboard.writeText==`function`){await navigator.clipboard.writeText(e);return}}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,`true`),t.style.position=`fixed`,t.style.left=`-9999px`,t.style.top=`-9999px`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t)}catch{}}}var jt=()=>(0,g.jsx)(`style`,{children:` /* glyph mark */ .kx-glyph{ display:flex; diff --git a/dist/assets/SigilFeedPage-DGJJwxYi.js b/dist/assets/SigilFeedPage-omgaBu1a.js similarity index 93% rename from dist/assets/SigilFeedPage-DGJJwxYi.js rename to dist/assets/SigilFeedPage-omgaBu1a.js index 3fc26c69..181688bd 100644 --- a/dist/assets/SigilFeedPage-DGJJwxYi.js +++ b/dist/assets/SigilFeedPage-omgaBu1a.js @@ -1 +1 @@ -import{Tn as e,jn as t,mn as n,tn as r}from"./index-CcPm2yTY.js";import"./html2canvas-CgVfYVZf.js";import"./EternalKlock-DTPPu1Hz.js";import"./SigilModal-B4XBfcke.js";import"./SealMomentModal-BotOOPRg.js";import"./SigilAuthContext-CZfkVeGy.js";import"./sigilRegistry-NyXrDYsE.js";import"./SigilAuthProvider-Crre0ykb.js";import"./usernameClaimRegistry-_VlzEwdK.js";import{t as i}from"./SigilStreamRoot-D0R_paBX.js";import"./useFastPress-BuTJ0eyZ.js";e();var a=null,o=0n;function s(){if(typeof window>`u`)return null;let e=window;return e.AudioContext??e.webkitAudioContext??null}function c(){let e=s();return e?a||(a=new e,a):null}function l(){let e=c();e&&e.state!==`running`&&e.resume().catch(()=>{})}function u(){typeof navigator<`u`&&`vibrate`in navigator&&navigator.vibrate([8,13,21,34,55,89,55,34,21,13,8])}function d(e,t,n){let r=e.sampleRate,i=Math.max(1,Math.floor(r*t)),a=e.createBuffer(2,i,r);for(let e=0;e<2;e++){let t=a.getChannelData(e);for(let e=0;e{u(),y()},0))}function x(e){if(!e||!(e instanceof Element))return!1;let t=e.closest(`button.sf-btn, a.sf-btn`);return t?(t.textContent??``).trim().toLowerCase()===`remember`:!1}function S(){let e=()=>{l(),document.removeEventListener(`pointerdown`,e,!0),document.removeEventListener(`keydown`,e,!0),document.removeEventListener(`touchstart`,e,!0)};document.addEventListener(`pointerdown`,e,{capture:!0,passive:!0}),document.addEventListener(`keydown`,e,{capture:!0}),document.addEventListener(`touchstart`,e,{capture:!0,passive:!0})}function C(){typeof document>`u`||(S(),document.addEventListener(`click`,e=>{x(e.target)&&b()}))}typeof window<`u`&&(window.__kopy_feedback_installed__||(window.__kopy_feedback_installed__=!0,C()));var w=t(r(),1);function T(){return(0,w.jsx)(i,{})}export{T as default}; \ No newline at end of file +import{Tn as e,jn as t,mn as n,tn as r}from"./index-BWApiWDT.js";import"./html2canvas-DXJRNlB-.js";import"./EternalKlock-CQhocjA8.js";import"./SigilModal-B_GantjI.js";import"./SealMomentModal-QiuZkGMx.js";import"./SigilAuthContext-X_86kcI6.js";import"./sigilRegistry-TxCi76Aa.js";import"./SigilAuthProvider-Cr2YGy0y.js";import"./usernameClaimRegistry-CU2B_ZCP.js";import{t as i}from"./SigilStreamRoot-DGHasm9l.js";import"./useFastPress-C6nRe_12.js";e();var a=null,o=0n;function s(){if(typeof window>`u`)return null;let e=window;return e.AudioContext??e.webkitAudioContext??null}function c(){let e=s();return e?a||(a=new e,a):null}function l(){let e=c();e&&e.state!==`running`&&e.resume().catch(()=>{})}function u(){typeof navigator<`u`&&`vibrate`in navigator&&navigator.vibrate([8,13,21,34,55,89,55,34,21,13,8])}function d(e,t,n){let r=e.sampleRate,i=Math.max(1,Math.floor(r*t)),a=e.createBuffer(2,i,r);for(let e=0;e<2;e++){let t=a.getChannelData(e);for(let e=0;e{u(),y()},0))}function x(e){if(!e||!(e instanceof Element))return!1;let t=e.closest(`button.sf-btn, a.sf-btn`);return t?(t.textContent??``).trim().toLowerCase()===`remember`:!1}function S(){let e=()=>{l(),document.removeEventListener(`pointerdown`,e,!0),document.removeEventListener(`keydown`,e,!0),document.removeEventListener(`touchstart`,e,!0)};document.addEventListener(`pointerdown`,e,{capture:!0,passive:!0}),document.addEventListener(`keydown`,e,{capture:!0}),document.addEventListener(`touchstart`,e,{capture:!0,passive:!0})}function C(){typeof document>`u`||(S(),document.addEventListener(`click`,e=>{x(e.target)&&b()}))}typeof window<`u`&&(window.__kopy_feedback_installed__||(window.__kopy_feedback_installed__=!0,C()));var w=t(r(),1);function T(){return(0,w.jsx)(i,{})}export{T as default}; \ No newline at end of file diff --git a/dist/assets/SigilModal-B4XBfcke.js b/dist/assets/SigilModal-B_GantjI.js similarity index 99% rename from dist/assets/SigilModal-B4XBfcke.js rename to dist/assets/SigilModal-B_GantjI.js index fd9bd916..4d7d9af4 100644 --- a/dist/assets/SigilModal-B4XBfcke.js +++ b/dist/assets/SigilModal-B_GantjI.js @@ -1,4 +1,4 @@ -import{J as e,Tn as t,_t as n,an as r,jn as i,ln as a,mn as o,tn as s,w as c,wn as l}from"./index-CcPm2yTY.js";import{t as u}from"./html2canvas-CgVfYVZf.js";import{t as d}from"./SealMomentModal-BotOOPRg.js";var f=i(t(),1),p=i(s(),1),m=e=>Math.max(0,Math.min(100,e));function h(e,t){let n=(e??``).toLowerCase().trim();return/(reflekt|reflect|reflektion|reflection)/i.test(n)?`#22c55e`:/(purify|purification|purifikation)/i.test(n)?`#3b82f6`:/dream/i.test(n)?`#7c3aed`:/(ignite|ignition)/i.test(n)?`#ff3b30`:/(integrate|integration)/i.test(n)?`#ff8a00`:/(solar\s*plexus)/i.test(n)?`#ffd600`:t}var g=({dateISO:e,onDateChange:t,secondsLeft:n,eternalPercent:r,eternalColor:i=`#8beaff`,eternalArkLabel:a=`Eternal Ark`})=>{let o=(0,f.useMemo)(()=>m(r),[r]),s=(0,f.useMemo)(()=>h(a,i),[a,i]),c={"--eternal-bar":s,"--pulse":`var(--kai-pulse, var(--pulse-dur, 5236ms))`},l=(0,f.useMemo)(()=>({"--fill":(o/100).toFixed(6)}),[o]),u=(0,f.useRef)(null),d=(0,f.useRef)(void 0),g=(0,f.useRef)(null),_=(0,f.useRef)(null);return(0,f.useEffect)(()=>()=>{g.current!==null&&window.clearTimeout(g.current),_.current!==null&&window.cancelAnimationFrame(_.current),u.current&&u.current.classList.remove(`is-boom`),g.current=null,_.current=null},[]),(0,f.useEffect)(()=>{let e=typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(typeof n!=`number`||e){d.current=n;return}let t=u.current,r=d.current;t&&typeof r==`number`&&n-r>1.2&&(t.classList.remove(`is-boom`),_.current!==null&&window.cancelAnimationFrame(_.current),_.current=window.requestAnimationFrame(()=>{t.classList.add(`is-boom`)}),g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{t.classList.remove(`is-boom`),g.current=null},420)),d.current=n},[n]),(0,p.jsxs)(`div`,{className:`sigil-scope`,style:c,children:[(0,p.jsx)(`h3`,{className:`sigil-title`,children:`Kairos Sigil-Glyph Inhaler`}),(0,p.jsx)(`div`,{className:`sigil-ribbon`,"aria-hidden":`true`}),(0,p.jsx)(`div`,{className:`input-row sigil-row`,children:(0,p.jsxs)(`label`,{className:`sigil-label`,children:[(0,p.jsx)(`span`,{className:`sigil-label__text`,children:`Select moment:`}),`\xA0`,(0,p.jsx)(`input`,{className:`sigil-input`,type:`datetime-local`,value:e,onChange:t})]})}),(0,p.jsx)(`div`,{className:`sigil-bars`,role:`group`,"aria-label":`Day progress`,children:(0,p.jsxs)(`div`,{className:`sigil-bar`,children:[(0,p.jsxs)(`div`,{className:`sigil-bar__head`,children:[(0,p.jsxs)(`span`,{className:`sigil-bar__label`,children:[`Unfoldment`,a?` — ${a}`:``]}),(0,p.jsxs)(`span`,{className:`sigil-bar__pct`,"aria-hidden":`true`,children:[o.toFixed(2),`%`]})]}),(0,p.jsx)(`div`,{className:`sigil-bar__track`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":+o.toFixed(2),role:`progressbar`,"aria-label":`Eternal day ${a||``}`,children:(0,p.jsx)(`div`,{ref:u,className:`sigil-bar__fill sigil-bar__fill--eternal`,style:l})})]})}),(0,p.jsx)(`style`,{children:` +import{J as e,Tn as t,_t as n,an as r,jn as i,ln as a,mn as o,tn as s,w as c,wn as l}from"./index-BWApiWDT.js";import{t as u}from"./html2canvas-DXJRNlB-.js";import{t as d}from"./SealMomentModal-QiuZkGMx.js";var f=i(t(),1),p=i(s(),1),m=e=>Math.max(0,Math.min(100,e));function h(e,t){let n=(e??``).toLowerCase().trim();return/(reflekt|reflect|reflektion|reflection)/i.test(n)?`#22c55e`:/(purify|purification|purifikation)/i.test(n)?`#3b82f6`:/dream/i.test(n)?`#7c3aed`:/(ignite|ignition)/i.test(n)?`#ff3b30`:/(integrate|integration)/i.test(n)?`#ff8a00`:/(solar\s*plexus)/i.test(n)?`#ffd600`:t}var g=({dateISO:e,onDateChange:t,secondsLeft:n,eternalPercent:r,eternalColor:i=`#8beaff`,eternalArkLabel:a=`Eternal Ark`})=>{let o=(0,f.useMemo)(()=>m(r),[r]),s=(0,f.useMemo)(()=>h(a,i),[a,i]),c={"--eternal-bar":s,"--pulse":`var(--kai-pulse, var(--pulse-dur, 5236ms))`},l=(0,f.useMemo)(()=>({"--fill":(o/100).toFixed(6)}),[o]),u=(0,f.useRef)(null),d=(0,f.useRef)(void 0),g=(0,f.useRef)(null),_=(0,f.useRef)(null);return(0,f.useEffect)(()=>()=>{g.current!==null&&window.clearTimeout(g.current),_.current!==null&&window.cancelAnimationFrame(_.current),u.current&&u.current.classList.remove(`is-boom`),g.current=null,_.current=null},[]),(0,f.useEffect)(()=>{let e=typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(typeof n!=`number`||e){d.current=n;return}let t=u.current,r=d.current;t&&typeof r==`number`&&n-r>1.2&&(t.classList.remove(`is-boom`),_.current!==null&&window.cancelAnimationFrame(_.current),_.current=window.requestAnimationFrame(()=>{t.classList.add(`is-boom`)}),g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{t.classList.remove(`is-boom`),g.current=null},420)),d.current=n},[n]),(0,p.jsxs)(`div`,{className:`sigil-scope`,style:c,children:[(0,p.jsx)(`h3`,{className:`sigil-title`,children:`Kairos Sigil-Glyph Inhaler`}),(0,p.jsx)(`div`,{className:`sigil-ribbon`,"aria-hidden":`true`}),(0,p.jsx)(`div`,{className:`input-row sigil-row`,children:(0,p.jsxs)(`label`,{className:`sigil-label`,children:[(0,p.jsx)(`span`,{className:`sigil-label__text`,children:`Select moment:`}),`\xA0`,(0,p.jsx)(`input`,{className:`sigil-input`,type:`datetime-local`,value:e,onChange:t})]})}),(0,p.jsx)(`div`,{className:`sigil-bars`,role:`group`,"aria-label":`Day progress`,children:(0,p.jsxs)(`div`,{className:`sigil-bar`,children:[(0,p.jsxs)(`div`,{className:`sigil-bar__head`,children:[(0,p.jsxs)(`span`,{className:`sigil-bar__label`,children:[`Unfoldment`,a?` — ${a}`:``]}),(0,p.jsxs)(`span`,{className:`sigil-bar__pct`,"aria-hidden":`true`,children:[o.toFixed(2),`%`]})]}),(0,p.jsx)(`div`,{className:`sigil-bar__track`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":+o.toFixed(2),role:`progressbar`,"aria-label":`Eternal day ${a||``}`,children:(0,p.jsx)(`div`,{ref:u,className:`sigil-bar__fill sigil-bar__fill--eternal`,style:l})})]})}),(0,p.jsx)(`style`,{children:` .sigil-ribbon { height: 1px; margin: .35rem 0 .85rem 0; diff --git a/dist/assets/SigilModal-BvJNBKka.js b/dist/assets/SigilModal-BvJNBKka.js deleted file mode 100644 index 5ce485ae..00000000 --- a/dist/assets/SigilModal-BvJNBKka.js +++ /dev/null @@ -1 +0,0 @@ -import"./html2canvas-CgVfYVZf.js";import{t as e}from"./SigilModal-B4XBfcke.js";import"./SealMomentModal-BotOOPRg.js";export{e as default}; \ No newline at end of file diff --git a/dist/assets/SigilModal-DgAEuxv4.js b/dist/assets/SigilModal-DgAEuxv4.js new file mode 100644 index 00000000..75ad179c --- /dev/null +++ b/dist/assets/SigilModal-DgAEuxv4.js @@ -0,0 +1 @@ +import"./html2canvas-DXJRNlB-.js";import{t as e}from"./SigilModal-B_GantjI.js";import"./SealMomentModal-QiuZkGMx.js";export{e as default}; \ No newline at end of file diff --git a/dist/assets/SigilPage-DF86EQ7y.js b/dist/assets/SigilPage-DOXmbUVe.js similarity index 99% rename from dist/assets/SigilPage-DF86EQ7y.js rename to dist/assets/SigilPage-DOXmbUVe.js index 67ffd3d7..2e1cd086 100644 --- a/dist/assets/SigilPage-DF86EQ7y.js +++ b/dist/assets/SigilPage-DOXmbUVe.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/html2canvas-2MVuntwP.js","assets/html2canvas-CgVfYVZf.js","assets/index-CcPm2yTY.js","assets/index-BmaJNTKf.css","assets/svgMeta-ADMUtfmL.js","assets/svgMeta-BqZogknt.js"])))=>i.map(i=>d[i]); -import{An as e,At as t,B as n,Cn as r,Dt as i,En as a,Et as o,J as s,Mt as c,Nt as l,On as u,Ot as d,Pt as f,S as p,Sn as m,St as h,Tn as g,Tt as _,V as v,_ as y,_t as b,an as x,b as S,bn as C,bt as w,d as T,f as E,h as D,i as O,jn as k,jt as A,kt as j,m as M,mn as N,n as P,o as F,q as I,r as ee,s as L,tn as R,un as te,vn as z,w as ne,wn as re,wt as B,xn as ie,xt as ae,yn as oe,yt as se}from"./index-CcPm2yTY.js";import{t as ce}from"./html2canvas-CgVfYVZf.js";import{t as V}from"./SealMomentModal-BotOOPRg.js";import{t as le}from"./useFastPress-BuTJ0eyZ.js";import{a as H,d as ue,f as U,i as de,n as W,p as fe,r as G,s as pe,t as me,u as he}from"./svgMeta-BqZogknt.js";var ge=k(ce(),1),_e=k(re(),1),K=k(g(),1),q=k(R(),1);function ve(e){(0,K.useEffect)(()=>{let e=`sigilheader-authbadgefx-v3`;if(document.getElementById(e))return;let t=document.createElement(`style`);t.id=e,t.textContent=` +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/html2canvas-qXP-r0eN.js","assets/html2canvas-DXJRNlB-.js","assets/index-BWApiWDT.js","assets/index-BmaJNTKf.css","assets/svgMeta-DRLQd2cj.js","assets/svgMeta-CqOhEmuY.js"])))=>i.map(i=>d[i]); +import{An as e,At as t,B as n,Cn as r,Dt as i,En as a,Et as o,J as s,Mt as c,Nt as l,On as u,Ot as d,Pt as f,S as p,Sn as m,St as h,Tn as g,Tt as _,V as v,_ as y,_t as b,an as x,b as S,bn as C,bt as w,d as T,f as E,h as D,i as O,jn as k,jt as A,kt as j,m as M,mn as N,n as P,o as F,q as I,r as ee,s as L,tn as R,un as te,vn as z,w as ne,wn as re,wt as B,xn as ie,xt as ae,yn as oe,yt as se}from"./index-BWApiWDT.js";import{t as ce}from"./html2canvas-DXJRNlB-.js";import{t as V}from"./SealMomentModal-QiuZkGMx.js";import{t as le}from"./useFastPress-C6nRe_12.js";import{a as H,d as ue,f as U,i as de,n as W,p as fe,r as G,s as pe,t as me,u as he}from"./svgMeta-CqOhEmuY.js";var ge=k(ce(),1),_e=k(re(),1),K=k(g(),1),q=k(R(),1);function ve(e){(0,K.useEffect)(()=>{let e=`sigilheader-authbadgefx-v3`;if(document.getElementById(e))return;let t=document.createElement(`style`);t.id=e,t.textContent=` /* Shared tokens; Chakra accent flows from page */ .sp-header .auth-badge, .sp-header .link-badge { @@ -4724,7 +4724,7 @@ Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.expo The chosen QR Code version cannot contain this amount of data. Minimum version required to store current data is: `+c+`. `);let l=b(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),Yw=a((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||={};let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e=c&&n>=c&&e{var t=Yw();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o===void 0&&(!i||!i.getContext)&&(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i===void 0&&(!n||!n.getContext)&&(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),Zw=a((e=>{var t=Yw();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1`:``,d=``,f=`viewBox="0 0 `+l+` `+l+`"`,p=``+u+d+` -`;return typeof a==`function`&&a(null,p),p}})),Qw=k(a((e=>{var t=Tw(),n=Jw(),r=Xw(),i=Zw();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))(),1);const $w=1024,eT=2048,tT=1200;function nT(e,t){let n=e.querySelector(`defs`);n||(n=e.ownerDocument.createElementNS(me.SVG_NS,`defs`),e.insertBefore(n,e.firstChild));let r=`ep-neon-glow`;if(!e.querySelector(`#${r}`)){let t=e.ownerDocument.createElementNS(me.SVG_NS,`filter`);t.setAttribute(`id`,r),t.setAttribute(`x`,`-50%`),t.setAttribute(`y`,`-50%`),t.setAttribute(`width`,`200%`),t.setAttribute(`height`,`200%`);let i=e.ownerDocument.createElementNS(me.SVG_NS,`feGaussianBlur`);i.setAttribute(`stdDeviation`,`3`),i.setAttribute(`result`,`b1`);let a=e.ownerDocument.createElementNS(me.SVG_NS,`feGaussianBlur`);a.setAttribute(`in`,`SourceGraphic`),a.setAttribute(`stdDeviation`,`1.2`),a.setAttribute(`result`,`b2`);let o=e.ownerDocument.createElementNS(me.SVG_NS,`feMerge`),s=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);s.setAttribute(`in`,`b1`);let c=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);c.setAttribute(`in`,`b2`);let l=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);l.setAttribute(`in`,`SourceGraphic`),o.appendChild(s),o.appendChild(c),o.appendChild(l),t.appendChild(i),t.appendChild(a),t.appendChild(o),n.appendChild(t)}let i=`ep-gloss-gradient`;if(!e.querySelector(`#${i}`)){let t=e.ownerDocument.createElementNS(me.SVG_NS,`linearGradient`);t.setAttribute(`id`,i),t.setAttribute(`x1`,`0`),t.setAttribute(`y1`,`0`),t.setAttribute(`x2`,`0`),t.setAttribute(`y2`,`1`);let r=e.ownerDocument.createElementNS(me.SVG_NS,`stop`);r.setAttribute(`offset`,`0%`),r.setAttribute(`stop-color`,`rgba(255,255,255,0.15)`);let a=e.ownerDocument.createElementNS(me.SVG_NS,`stop`);a.setAttribute(`offset`,`100%`),a.setAttribute(`stop-color`,`rgba(255,255,255,0.05)`),t.appendChild(r),t.appendChild(a),n.appendChild(t)}let a=`ep-bar-outer-glow`;if(!e.querySelector(`#${a}`)){let r=e.ownerDocument.createElementNS(me.SVG_NS,`filter`);r.setAttribute(`id`,a),r.setAttribute(`x`,`-50%`),r.setAttribute(`y`,`-50%`),r.setAttribute(`width`,`200%`),r.setAttribute(`height`,`200%`);let i=e.ownerDocument.createElementNS(me.SVG_NS,`feFlood`);i.setAttribute(`flood-color`,t),i.setAttribute(`flood-opacity`,`0.5`),i.setAttribute(`result`,`c`);let o=e.ownerDocument.createElementNS(me.SVG_NS,`feComposite`);o.setAttribute(`in`,`c`),o.setAttribute(`in2`,`SourceAlpha`),o.setAttribute(`operator`,`in`),o.setAttribute(`result`,`glow`);let s=e.ownerDocument.createElementNS(me.SVG_NS,`feGaussianBlur`);s.setAttribute(`in`,`glow`),s.setAttribute(`stdDeviation`,`4`),s.setAttribute(`result`,`blurGlow`);let c=e.ownerDocument.createElementNS(me.SVG_NS,`feMerge`),l=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);l.setAttribute(`in`,`blurGlow`);let u=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);u.setAttribute(`in`,`SourceGraphic`),c.appendChild(l),c.appendChild(u),r.appendChild(i),r.appendChild(o),r.appendChild(s),r.appendChild(c),n.appendChild(r)}return{neonId:`ep-neon-glow`,glossId:`ep-gloss-gradient`,barGlowId:`ep-bar-outer-glow`}}async function rT(e,t){let{accent:n,qrUrl:r}=t,i=(e.getAttribute(`viewBox`)||`0 0 ${e.getAttribute(`width`)||1024} ${e.getAttribute(`height`)||1024}`).trim().split(/\s+/).map(Number),a=i[0]||0,o=i[1]||0,s=i[2]||1024,c=i[3]||1024,l=e.ownerDocument.createElementNS(me.SVG_NS,`g`);l.setAttribute(`data-export-qr`,`1`);let u=Math.min(s,c),d=Math.max(u*.035,18),f=Math.max(u*.1,96),p=await Qw.toDataURL(r,{margin:0,color:{dark:n,light:`#00000000`},scale:8}),m=e.ownerDocument.createElementNS(me.SVG_NS,`image`);m.setAttributeNS(me.XLINK_NS,`xlink:href`,p),m.setAttribute(`href`,p),m.setAttribute(`x`,String(a+d)),m.setAttribute(`y`,String(o+c-f-d)),m.setAttribute(`width`,String(f)),m.setAttribute(`height`,String(f)),m.setAttribute(`preserveAspectRatio`,`xMidYMid meet`),l.appendChild(m),e.appendChild(l)}async function iT(e,t=$w,n){let r=e.cloneNode(!0);if(de(r,t),H(r),G(r,n?.title||`Kairos Sigil-Glyph — Sealed Kairos Moment`,n?.desc||`Deterministic sigil-glyph with sovereign metadata.`),n?.metaOverride){let e=W(r);e.textContent=JSON.stringify(n.metaOverride)}if(r.querySelectorAll(`[data-export-qr="1"],[data-export-pulsebar="1"]`).forEach(e=>e.parentNode?.removeChild(e)),n?.addQR&&await rT(r,n.addQR),n?.addPulseBar){let{accent:e,pulseNumber:i}=n.addPulseBar,{barGlowId:a,neonId:o,glossId:s}=nT(r,e),c=(r.getAttribute(`viewBox`)||`0 0 ${t} ${t}`).split(/\s+/).map(Number),[l,u,d,f]=[c[0]||0,c[1]||0,c[2]||t,c[3]||t],p=r.ownerDocument.createElementNS(me.SVG_NS,`g`);p.setAttribute(`data-export-pulsebar`,`1`);let m=Math.min(d,f),h=Math.max(m*.035,18),g=Math.max(m*.34,320),_=Math.max(m*.085,96),v=Math.max(_*.22,18),y=l+d-g-h,b=u+f-_-h,x=r.ownerDocument.createElementNS(me.SVG_NS,`rect`);x.setAttribute(`x`,String(y)),x.setAttribute(`y`,String(b)),x.setAttribute(`rx`,String(v)),x.setAttribute(`ry`,String(v)),x.setAttribute(`width`,String(g)),x.setAttribute(`height`,String(_)),x.setAttribute(`fill`,`url(#${s})`),x.setAttribute(`stroke`,`rgba(255,255,255,0.16)`),x.setAttribute(`stroke-width`,String(Math.max(1.5,m*.0018))),x.setAttribute(`filter`,`url(#${a})`),p.appendChild(x);let S=r.ownerDocument.createElementNS(me.SVG_NS,`text`);S.setAttribute(`x`,String(y+g/2)),S.setAttribute(`y`,String(b+_/2+Math.max(6,_*.06))),S.setAttribute(`text-anchor`,`middle`),S.setAttribute(`dominant-baseline`,`middle`),S.setAttribute(`fill`,e),S.setAttribute(`filter`,`url(#${o})`),S.setAttribute(`font-weight`,`900`),S.setAttribute(`font-family`,`Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto, Helvetica Neue, Arial`),S.setAttribute(`font-size`,String(Math.floor(_*.46))),S.textContent=i.toLocaleString(),p.appendChild(S),r.appendChild(p)}let i=new XMLSerializer().serializeToString(r),a=i.startsWith(`\n${i}`;return new Blob([a],{type:`image/svg+xml;charset=utf-8`})}async function aT(e,t=$w){let n=URL.createObjectURL(e);try{let e=new Image;await new Promise((t,r)=>{e.onload=()=>t(),e.onerror=r,e.src=n});let r=document.createElement(`canvas`);r.width=t,r.height=t;let i=r.getContext(`2d`);if(!i)throw Error(`Canvas unsupported`);return i.drawImage(e,0,0,t,t),await new Promise((e,t)=>r.toBlob(n=>n?e(n):t(Error(`PNG encode failed`)),`image/png`))}finally{URL.revokeObjectURL(n)}}var oT=()=>{let e=N();return e<=0n?0:e>BigInt(2**53-1)?2**53-1:Number(e)};const sT=`sigil-debits-v1`,cT=(e,t)=>t?`sigil:debits:${e}:t:${t}`:`sigil:debits:${e}`,lT=(e,t)=>e===cT(t)||e.startsWith(`${cT(t)}:t:`),uT=(e,t)=>{let n=`sigil:debits:${t}`;if(e===n)return null;let r=`${n}:t:`;return e.startsWith(r)?e.slice(r.length):void 0};function dT(e){let t=new TextEncoder().encode(e),n=``;for(let e=0;e0&&typeof t.recipientPhiKey==`string`&&t.recipientPhiKey.length>0&&typeof t.amount==`number`&&Number.isFinite(t.amount)&&t.amount>0&&typeof t.timestamp==`number`&&Number.isFinite(t.timestamp)}function hT(e){if(!e)return null;try{let t=JSON.parse(fT(e));if(typeof t!=`object`||!t)return null;let n={},r=t;if(typeof r.originalAmount==`number`&&Number.isFinite(r.originalAmount)&&(n.originalAmount=r.originalAmount),Array.isArray(r.debits)){let e=[];for(let t of r.debits)mT(t)&&e.push(t);e.length&&(n.debits=e)}return n}catch{return null}}function gT(e,t){try{let n=new URL(window.location.href),r=typeof e.originalAmount==`number`&&Number.isFinite(e.originalAmount),i=Array.isArray(e.debits)&&e.debits.length>0;!r&&!i?n.searchParams.delete(`d`):n.searchParams.set(`d`,pT(e));let a=`${n.pathname}${n.search}${n.hash}`;t?.navigate?window.location.replace(a):window.history.replaceState(null,``,a)}catch{}}function _T(e,t){let n=(e||``).toLowerCase();if(!n)return null;try{let e=t?localStorage.getItem(cT(n,t)):null;if(e)return hT(e);let r=localStorage.getItem(cT(n));return r?hT(r):null}catch{return null}}function vT(e,t,n){let r=(e||``).toLowerCase();if(r)try{localStorage.setItem(cT(r,n??null),pT(t))}catch{}}function yT(e){let t=new Set,n=[];for(let r of e)!r||typeof r.nonce!=`string`||t.has(r.nonce)||(t.add(r.nonce),n.push(r));return n.sort((e,t)=>(e.timestamp||0)-(t.timestamp||0))}function bT(e,t){let n={},r=typeof e?.originalAmount==`number`?e.originalAmount:void 0,i=typeof t?.originalAmount==`number`?t.originalAmount:void 0;n.originalAmount=typeof r==`number`?r:typeof i==`number`?i:void 0;let a=Array.isArray(e?.debits)?e.debits:[],o=Array.isArray(t?.debits)?t.debits:[],s=yT([...a,...o]);return s.length&&(n.debits=s),n}function xT(e,t){let n=typeof e?.originalAmount==`number`&&Number.isFinite(e.originalAmount)?Number(e.originalAmount):NaN,r=typeof t?.originalAmount==`number`&&Number.isFinite(t.originalAmount)?Number(t.originalAmount):NaN,i=Number.isNaN(n)&&Number.isNaN(r)||Math.abs(n-r)<1e-12,a=new Set((Array.isArray(e?.debits)?e.debits:[]).map(e=>e?.nonce)),o=new Set((Array.isArray(t?.debits)?t.debits:[]).map(e=>e?.nonce));if(!i||a.size!==o.size)return!1;for(let e of a)if(!o.has(e))return!1;return!0}function ST(e,t,n,r){gT(e,{navigate:!!r?.navigate});let i=(t||``).toLowerCase();if(i&&(vT(i,e,n??null),r?.broadcast!==!1))try{let t=new BroadcastChannel(sT),r={type:`debits`,canonical:i,qs:pT(e),stamp:oT(),token:n??null};t.postMessage(r),t.close()}catch{}}function CT(e,t,n){let r=hT(t.get(`d`)),i=bT(n?_T(e,n):_T(e,null),r);return{merged:i,urlIsStale:!xT(i,r)}}function wT(e){try{let t=new URL(e,window.location.origin).pathname.match(/\/s\/([0-9a-fA-F]+)/);return t?t[1].toLowerCase():null}catch{return null}}function TT(e){if(typeof e==`string`)switch(e.trim().toLowerCase().replace(/\s+/g,` `)){case`root`:return`Root`;case`sacral`:return`Sacral`;case`solar plexus`:case`solarplexus`:return`Solar Plexus`;case`heart`:return`Heart`;case`throat`:return`Throat`;case`third eye`:case`thirdeye`:return`Third Eye`;case`crown`:return`Crown`;default:return}}function ET(e){return e===`breaths`||e===`steps`?e:void 0}var DT=e=>!!e&&typeof e==`object`,OT=e=>{if(!DT(e))return!1;let t=`u`in e&&`b`in e,n=`d`in e;return t||n},kT=e=>typeof e==`number`&&Number.isFinite(e)?e:void 0,AT=e=>typeof e==`string`&&e.trim()?e:void 0;function jT(e){if(!e)return{};try{let t=String(e).trim(),n=!1;/^c:/i.test(t)&&(t=t.slice(2),n=!0);let r=JSON.parse(fT(t));if(n||OT(r)){let e=r,t={},n=kT(e.u),i=kT(e.b),a=kT(e.d),o=kT(e.s),s=TT(e.c);return n!==void 0&&(t.pulse=n),i!==void 0&&(t.beat=i),a!==void 0&&(t.stepsPerBeat=a),o!==void 0&&(t.stepIndex=o),s!==void 0&&(t.chakraDay=s),t}if(DT(r)){let e=r,t={},n=kT(e.pulse),i=kT(e.beat),a=kT(e.stepsPerBeat),o=kT(e.stepIndex),s=TT(e.chakraDay),c=AT(e.canonicalHash),l=AT(e.kaiSignature),u=AT(e.userPhiKey),d=AT(e.transferNonce),f=kT(e.expiresAtPulse),p=ET(e.claimExtendUnit),m=kT(e.claimExtendAmount);return n!==void 0&&(t.pulse=n),i!==void 0&&(t.beat=i),a!==void 0&&(t.stepsPerBeat=a),o!==void 0&&(t.stepIndex=o),s!==void 0&&(t.chakraDay=s),c!==void 0&&(t.canonicalHash=c.toLowerCase()),l!==void 0&&(t.kaiSignature=l),u!==void 0&&(t.userPhiKey=u),d!==void 0&&(t.transferNonce=d),f!==void 0&&(t.expiresAtPulse=f),p!==void 0&&(t.claimExtendUnit=p),m!==void 0&&(t.claimExtendAmount=m),Array.isArray(e.lineage)&&(t.lineage=e.lineage),t}return{}}catch{return{}}}function MT(e,t){let n={...e};typeof t.expiresAtPulse==`number`&&(n.expiresAtPulse=t.expiresAtPulse),t.claimExtendUnit!=null&&(n.claimExtendUnit=t.claimExtendUnit),typeof t.claimExtendAmount==`number`&&(n.claimExtendAmount=t.claimExtendAmount),typeof t.pulse==`number`&&(n.pulse=t.pulse),typeof t.beat==`number`&&(n.beat=t.beat),typeof t.stepsPerBeat==`number`&&(n.stepsPerBeat=t.stepsPerBeat),t.chakraDay!==void 0&&(n.chakraDay=t.chakraDay),t.canonicalHash&&(n.canonicalHash=String(t.canonicalHash).toLowerCase()),t.kaiSignature&&(n.kaiSignature=t.kaiSignature),t.userPhiKey&&(n.userPhiKey=t.userPhiKey),t.transferNonce&&(n.transferNonce=t.transferNonce),Array.isArray(t.lineage)&&(n.lineage=t.lineage);let r=typeof n.stepsPerBeat==`number`&&Number.isFinite(n.stepsPerBeat)?n.stepsPerBeat:44,i=kT(t?.stepIndex),a=kT(n.stepIndex);return i===void 0?a===void 0?typeof n.pulse==`number`&&Number.isFinite(n.pulse)&&(n.stepIndex=p(n.pulse,r)):n.stepIndex=a:n.stepIndex=i,n}function NT(e,t){try{let n=new URL(e,window.location.origin),r=MT(jT(n.searchParams.get(`p`)),t);return r.canonicalHash&&=String(r.canonicalHash).toLowerCase(),n.searchParams.set(`p`,dT(JSON.stringify(r))),n.toString()}catch{return e}}function PT(e,t,n){let r=[e?.canonicalHash,t,n?.matchedHash];for(let e of r)if(typeof e==`string`&&e.trim())return e.toLowerCase();return null}function FT(e,t){return typeof e==`string`&&e.trim()?e:typeof t?.transferNonce==`string`&&t.transferNonce.trim()?t.transferNonce:null}async function IT(t){let{stageEl:n,payload:r,localHash:i,routeHash:a,qr:o,onToast:s}=t;if(!n)return s(`No stage found`);try{let t=(await m(async()=>{let{default:t}=await import(`./html2canvas-2MVuntwP.js`).then(e(1));return{default:t}},__vite__mapDeps([0,1,2,3]))).default,l=await t(n,{backgroundColor:null}),u=document.createElement(`canvas`);u.width=eT,u.height=eT;let d=u.getContext(`2d`);if(!d)throw Error(`No canvas context`);d.clearRect(0,0,u.width,u.height);let f=Math.floor(eT*.06),p=eT-f*2,h=eT-f*2,g=l.width,_=l.height,v=Math.min(p/g,h/_),y=Math.floor(g*v),b=Math.floor(_*v),x=Math.floor((eT-y)/2),S=Math.floor((eT-b)/2);d.drawImage(l,x,S,y,b);let C=r?.chakraDay??`Throat`,w=dC[C]?.accent||`#00FFD0`,T=kC(C,typeof r?.stepPct==`number`?r.stepPct:r?r.pulse%11/11:0,i||void 0),E=Math.max(eT*.33,720),D=Math.max(eT*.08,160),O=Math.max(D*.24,30),k=eT-E-f,A=eT-D-f;d.save(),d.shadowColor=w,d.shadowBlur=Math.max(18,Math.floor(eT*.012));let j=d.createLinearGradient(0,A,0,A+D);j.addColorStop(0,`rgba(255,255,255,0.16)`),j.addColorStop(1,`rgba(255,255,255,0.05)`),c(d,k,A,E,D,O),d.fillStyle=j,d.fill(),d.shadowBlur=0,d.lineWidth=Math.max(2,Math.floor(eT*.0016)),d.strokeStyle=`rgba(255,255,255,0.18)`,d.stroke();let M=(r?.pulse??0).toLocaleString();d.textBaseline=`alphabetic`,d.fillStyle=T,d.font=`900 ${Math.floor(D*.48)}px Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto, Helvetica Neue, Arial`,d.shadowColor=T,d.shadowBlur=Math.max(16,Math.floor(eT*.008));let N=d.measureText(M).width,P=Math.floor(k+E/2-N/2),F=Math.floor(A+D/2+D*.18);d.fillText(M,P,F),d.restore();let I=Math.floor(eT*.32),ee=Math.floor((eT-I)/2),L=Math.floor((eT-I)/2),R=LT({provided:o.url,payload:r,localHash:i,routeHash:a}),te=(0,ZC.renderToStaticMarkup)((0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 1000 1000`,children:(0,q.jsx)(ww,{uid:o.uid,url:R,size:800,phaseHue:o.hue,phaseColor:o.accent,animate:!1,pulseMs:5236})})),z=new Blob([te],{type:`image/svg+xml;charset=utf-8`}),ne=URL.createObjectURL(z);await new Promise((e,t)=>{let n=new Image;n.onload=()=>{try{d.drawImage(n,ee,L,I,I)}finally{URL.revokeObjectURL(ne),e()}},n.onerror=e=>{URL.revokeObjectURL(ne),t(e)},n.src=ne});let re=u.toDataURL(`image/png`),B=document.createElement(`a`);B.href=re,B.download=`sigil_poster_${(i||a||`mint`).slice(0,16)}.png`,document.body.appendChild(B),B.click(),B.remove(),s(`Public key PNG saved`)}catch(e){console.error(e),s(`Poster export failed`)}function c(e,t,n,r,i,a){e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath()}}function LT(e){let{provided:t,payload:n,localHash:r,routeHash:i}=e,a=t&&RT(t)?t:(typeof window<`u`?window.location.href:``)||``;if(!n)return a;try{let e=(n.canonicalHash||r||i||``).toLowerCase();if(!e)return a;let t=new URL(a,typeof window<`u`?window.location.origin:`https://local.test`);t.pathname=`/s/${e}`;let o=n.transferNonce||t.searchParams.get(`t`);o&&t.searchParams.set(`t`,o);let s=`${t.pathname}${t.search}${t.hash}`;return NT(s,n)||s}catch{return a}}function RT(e){try{let t=new URL(e,typeof window<`u`?window.location.origin:`https://local.test`);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function zT(e){let t=JSON.stringify(e);return btoa(unescape(encodeURIComponent(t))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function BT(e,t,n){let r=new URL(e,typeof window<`u`?window.location.origin:`http://localhost`);return r.searchParams.set(`p`,zT(t)),n&&r.searchParams.set(`t`,n),r.toString()}function VT(e){switch(String(e??``).trim().toLowerCase()){case`root`:return`Root`;case`sacral`:return`Sacral`;case`solar plexus`:case`solar_plexus`:case`solar-plexus`:return`Solar Plexus`;case`heart`:return`Heart`;case`throat`:return`Throat`;case`third eye`:case`third_eye`:case`third-eye`:return`Third Eye`;case`crown`:return`Crown`;default:return`Root`}}function HT(e,t){let n={pulse:e.pulse,beat:e.beat,chakraDay:VT(e.chakraDay),stepsPerBeat:e.stepsPerBeat??void 0,stepIndex:t,userPhiKey:e.userPhiKey??void 0,kaiSignature:e.kaiSignature??void 0,canonicalHash:e.canonicalHash??void 0,transferNonce:e.transferNonce??void 0,expiresAtPulse:e.expiresAtPulse??void 0,claimExtendUnit:e.claimExtendUnit??void 0,claimExtendAmount:e.claimExtendAmount??void 0,attachment:e.attachment??void 0,provenance:e.provenance??void 0};return Object.keys(n).forEach(e=>{n[e]===void 0&&delete n[e]}),n}function UT(e){return{pulse:e.pulse,beat:e.beat,stepIndex:e.stepIndex,chakraDay:VT(e.chakraDay),stepsPerBeat:e.stepsPerBeat??void 0,userPhiKey:e.userPhiKey??void 0,kaiSignature:e.kaiSignature??void 0}}function WT(e,t){e.setAttribute(`data-share-url`,t),e.querySelectorAll(`a`).forEach(e=>{e.setAttribute(`href`,t);try{e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,t)}catch{}});let n=/\bu=([^·\n\r]+?)(?=\s*·|$)/;e.querySelectorAll(`text`).forEach(e=>{let r=e.textContent||``;n.test(r)&&(e.textContent=r.replace(n,`u=${t}`))})}async function GT(e){let{expired:t,exporting:n,setExporting:r,svgEl:i,payload:a,isFutureSealed:o,linkStatus:c,setToast:l,expiryUnit:u,expiryAmount:d,localHash:f,routeHash:p,transferToken:h,getKaiPulseEternalInt:g,stepIndexFromPulse:_,STEPS_PER_BEAT:v}=e;if(t)return SC(l,`Seal window closed`);if(!n){if(!i)return SC(l,`No SVG found`);if(!a)return SC(l,`No payload`);if(o)return SC(l,`Opens after the moment—claim unlocks then`);if(c!==`active`)return SC(l,`Archived link — cannot claim from here`);try{r(!0);let e=`sigil_${(f||p||`mint`).slice(0,16)}`,t=a.stepsPerBeat??v,n=_(a.pulse,t),o=g(new Date),c=_(o,t),y=HT(a,n),b={...iC(a.userPhiKey||``,a.kaiSignature??void 0,y,`claim`,a.attachment?.name??void 0,o),stepIndex:n,atStepIndex:c},x={...a,exportedAtPulse:o,stepIndex:n,stepsPerBeat:t,provenance:[...a.provenance??[],b],claimExtendUnit:a.claimExtendUnit??u,claimExtendAmount:a.claimExtendAmount??d,canonicalHash:(f||a.canonicalHash||p||null)?.toString()??null},S=await FC(zC(x.pulse,x.beat,n,String(x.chakraDay??``),BC(HT(x,n)))),C=await RC(S),w={...x,kaiSignature:S,userPhiKey:x.userPhiKey||C},T=(f||p||``).toLowerCase(),E=UT({pulse:w.pulse,beat:w.beat,stepIndex:n,chakraDay:w.chakraDay??null,stepsPerBeat:t,userPhiKey:w.userPhiKey??null,kaiSignature:w.kaiSignature??null}),D=BT(s(T,E),E,w.transferNonce??h??void 0),{putMetadata:O}=await m(async()=>{let{putMetadata:e}=await import(`./svgMeta-ADMUtfmL.js`);return{putMetadata:e}},__vite__mapDeps([4,5,2,3])),k={...w,stepsPerBeat:t,shareUrl:D,fullUrl:D};O(i,k);try{i.setAttribute(`data-step-index`,String(n));let e=i.querySelector(`metadata#sigil-display`);e||(e=document.createElementNS(`http://www.w3.org/2000/svg`,`metadata`),e.setAttribute(`id`,`sigil-display`),e.setAttribute(`data-noncanonical`,`1`),i.appendChild(e)),e.textContent=JSON.stringify({stepIndex:n,stepsPerBeat:t})}catch{console.debug(`Display metadata write failed`)}KC(i,w.pulse,w.beat,n),UC(i),WT(i,D);let A=null,j=null;try{let e=new URL(D);A=e.searchParams.get(`p`),j=e.searchParams.get(`t`)}catch{console.debug(`URL parse failed`)}let M=await iT(i,$w,{metaOverride:k,addQR:!1,addPulseBar:!1,title:`Kairos Sigil-Glyph — Sealed KairosMoment`,desc:`Deterministic sigil-glyph with sovereign metadata. Exported as archived key.`}),N=await aT(M,$w),P=new(await(CC()));P.file(`${e}.svg`,M),P.file(`${e}.png`,N);let F={hash:f||p||``,canonicalHash:w.canonicalHash??null,pulse:w.pulse,beat:w.beat,stepIndex:n,atStepIndex:c,chakraDay:w.chakraDay??null,userPhiKey:w.userPhiKey??null,kaiSignature:w.kaiSignature??null,transferNonce:w.transferNonce??null,expiresAtPulse:w.expiresAtPulse??null,exportedAtPulse:w.exportedAtPulse??null,claimedAtPulse:o,overlays:{qr:!1,eternalPulseBar:!1},claimExtendUnit:w.claimExtendUnit??null,claimExtendAmount:w.claimExtendAmount??null,fullUrl:D,p:A,urlQuery:{p:A,t:j}};P.file(`${e}.manifest.json`,JSON.stringify(F,null,2));let I=await P.generateAsync({type:`blob`}),ee=URL.createObjectURL(I),L=document.createElement(`a`);L.href=ee,L.download=`${e}.zip`,document.body.appendChild(L),L.click(),L.remove(),requestAnimationFrame(()=>URL.revokeObjectURL(ee)),SC(l,`Access key generated`)}catch(e){console.error(e),SC(l,`Claim failed`)}finally{r(!1)}}}function KT(){return(0,K.useMemo)(()=>async e=>{let t=new TextEncoder().encode(e),n=await crypto.subtle.digest(`SHA-256`,t);return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,`0`)).join(``)},[])}function qT({payload:e,urlSearchParams:n,currentPulse:r}){let[a,s]=(0,K.useState)(null),[u,p]=(0,K.useState)(null),[m,g]=(0,K.useState)(null),v=(0,K.useRef)(null),y=(0,K.useRef)(null),b=KT(),x=n?.get(`vpol`)??``;(0,K.useEffect)(()=>{let t=!0;return(async()=>{if(!e||!Number.isFinite(r??NaN)){if(!t)return;s(e=>e===null?e:null),p(e=>e===null?e:null),g(e=>e===null?e:null),v.current=null,y.current=null;return}let{seal:n}=await ae({pulse:e.pulse,kaiPulse:e.pulse,beat:e.beat,stepIndex:e.stepIndex,stepsPerBeat:e.stepsPerBeat,seriesSize:e.seriesSize,quality:e.quality,creatorVerified:e.creatorVerified,creatorRep:e.creatorRep,frequencyHz:e.frequencyHz,chakraDay:e.chakraDay,chakraGate:e.chakraGate,transfers:e.transfers,cumulativeTransfers:e.cumulativeTransfers,segments:e.segments,segmentsMerkleRoot:e.segmentsMerkleRoot,transfersWindowRoot:e.transfersWindowRoot,ip:e.ip,kaiSignature:e.kaiSignature,userPhiKey:e.userPhiKey,valuationPolicyId:x||void 0},r,b);if(!t)return;y.current!==n.stamp&&(s(e=>e&&e.stamp===n.stamp?e:n),y.current=n.stamp);let i=n.valuePhi,a=v.current;a!==i&&(p(e=>e===i?e:i),a!=null&&Math.abs(i-a)>1e-9?g(e=>e===`up`&&i>a?e:i>a?`up`:`down`):g(e=>e===null?e:null),v.current=i)})(),()=>{t=!1}},[e,r,x,b]);let S=(0,K.useMemo)(()=>e?.pulse,[e]),C=(0,K.useMemo)(()=>Number.isFinite(S??NaN)?{score:j(S),lines:i(S)}:{score:null,lines:[]},[S]),w=(0,K.useMemo)(()=>{if(!Number.isFinite(S??NaN)||!Number.isFinite(r??NaN))return null;let t=a?.inputs?.pulsesPerBeat?Math.max(1,Math.round(a.inputs.pulsesPerBeat/11)):e?.stepsPerBeat??44,n=a?.inputs?.cadenceRegularity??1,i=a?.inputs?.resonancePhi??.5,s=e?.stepIndex;return o(S,r,{stepsPerBeat:t,cadenceRegularity:n,resonancePhi:i,stepIndexClaimOverride:s})},[S,r,a,e]),T=(0,K.useMemo)(()=>{let t=e?.transfers;return!t||!t.length?[`No closed transfers yet — lineage still forming.`]:_(t,{stepsPerBeat:e?.stepsPerBeat??44})},[e]);return{valSeal:a,livePrice:u,priceFlash:m,rarity:C,oscillation:w,lineageNarrative:T,trust:(0,K.useMemo)(()=>a?B(a.inputs):null,[a]),marketTier:(0,K.useMemo)(()=>Number.isFinite(S??NaN)?h(S,a??void 0):null,[S,a]),kairos:(0,K.useMemo)(()=>Number.isFinite(r??NaN)?{window:l(r,144,1,{stepsPerBeat:e?.stepsPerBeat??44})}:{window:[]},[r,e]),visuals:(0,K.useMemo)(()=>{if(!a||!Number.isFinite(S??NaN))return{spiralSVG:null,scrollSVG:null,scrollText:null,scrollHTML:null};let e=t(S),{scrollSVG:n,scrollText:r}=f(a,{title:`Kai-Sigil Valuation Scroll`});return{spiralSVG:e,scrollSVG:n,scrollText:r,scrollHTML:A(a,{title:`Kai-Sigil Valuation Scroll`})}},[a,S]),audio:(0,K.useMemo)(()=>{if(!Number.isFinite(S??NaN))return{dataURI:null,renderWav:void 0};let{dataURI:e}=c(S,2,44100,{stereo:!0});return{dataURI:e,renderWav:(e=2,t=44100,n)=>c(S,e,t,n)}},[S]),motifSimilarityWith:(0,K.useMemo)(()=>e=>!Number.isFinite(e??NaN)||!Number.isFinite(S??NaN)?null:d(S,e),[S]),helpers:(0,K.useMemo)(()=>({explainRarity:()=>C.lines,explainLineage:()=>T,scanKairos:(t,n,r=1,i)=>l(t,n,r,{stepsPerBeat:i??e?.stepsPerBeat??44}),makeScroll:e=>a?f(a,{title:e??`Kai-Sigil Valuation Scroll`}):null,makeScrollHTML:e=>a?A(a,{title:e}):null,makeSpiral:e=>Number.isFinite(e??S)?t(e??S):null}),[C.lines,T,e,a,S])}}function JT(e){let{stageId:t,payload:n,localHash:r,setOgImgUrl:i,setMeta:a,seoTitle:o,seoDesc:s}=e,c=!1,l=null,u=async()=>{let e=document.getElementById(t);if(!e||!n){i(null),a(`property`,`og:image`,``),a(`property`,`og:image:alt`,``),a(`property`,`og:image:width`,``),a(`property`,`og:image:height`,``),a(`name`,`twitter:image`,``);return}try{let t=n.chakraDay??`Throat`,l=dC[t]?.accent||`#00FFD0`,u=n.pulse||0,f=n.stepsPerBeat??44,p=Math.floor(n.pulse%(f*11)/11),m=kC(t,typeof n.stepPct==`number`?n.stepPct:n.pulse%11/11,r||void 0),h=`Pulse ${u.toLocaleString()} • Beat ${n.beat}/36 • Step ${p+1}/${f} • ${t}`,g=await(0,ge.default)(e),_=document.createElement(`canvas`);_.width=tT,_.height=630;let v=_.getContext(`2d`);if(!v)throw Error(`Canvas unsupported`);let y=v.createLinearGradient(0,0,tT,630);y.addColorStop(0,`rgba(0,0,0,0.92)`),y.addColorStop(1,`rgba(0,0,0,0.70)`),v.fillStyle=y,v.fillRect(0,0,tT,630),v.save(),v.globalCompositeOperation=`lighter`;let b=v.createRadialGradient(tT*.8,630*.2,20,tT*.8,630*.2,600);b.addColorStop(0,`${l}CC`),b.addColorStop(1,`rgba(0,0,0,0)`),v.fillStyle=b,v.beginPath(),v.arc(tT*.8,630*.2,600,0,Math.PI*2),v.fill(),v.restore();let x=Math.floor(tT*.52),S=Math.min(x/g.width,558/g.height),C=Math.floor(g.width*S),w=Math.floor(g.height*S),T=36+Math.floor((x-C)/2),E=36+Math.floor((558-w)/2);v.drawImage(g,T,E,C,w);let D=36+x+32,O=tT-D-36;v.fillStyle=`#EAFBFF`,v.font=`700 38px Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto`,v.fillText(`Kairos Sigil-Glyph — Sealed Kairos Moment`,D,94),v.fillStyle=`rgba(255,255,255,0.82)`,v.font=`400 24px Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto`,d(v,`“${o}” — ${s}`,D,136,O,30);let k=`${u.toLocaleString()}`;v.textBaseline=`alphabetic`,v.font=`900 120px Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto`,v.shadowColor=m,v.shadowBlur=20,v.fillStyle=m;let A=v.measureText(k).width,j=D+Math.floor((O-A)/2);v.fillText(k,j,554),v.shadowBlur=0;let M=_.toDataURL(`image/png`);if(c)return;i(M),a(`property`,`og:image`,M),a(`property`,`og:image:alt`,h),a(`property`,`og:image:type`,`image/png`),a(`property`,`og:image:width`,`1200`),a(`property`,`og:image:height`,`630`),a(`name`,`twitter:image`,M)}catch{if(c)return;i(null)}};return l=wC(()=>{c||u()}),()=>{c=!0,l!=null&&TC(l)};function d(e,t,n,r,i,a){let o=t.split(` `),s=``;for(let t=0;ti&&t>0?(e.fillText(s,n,r),s=o[t]+` `,r+=a):s=c}e.fillText(s.trim(),n,r)}}function YT(e){switch(String(e??``).trim().toLowerCase()){case`root`:case`earth`:case`earth gate`:return`Root`;case`sacral`:return`Sacral`;case`solar plexus`:case`solar_plexus`:case`solar-plexus`:return`Solar Plexus`;case`heart`:return`Heart`;case`throat`:return`Throat`;case`third eye`:case`third_eye`:case`third-eye`:return`Third Eye`;case`crown`:return`Crown`;default:return`Root`}}function XT(){return crypto.getRandomValues(new Uint32Array(4)).join(``)}function ZT(e){let{meta:t,stepIndex:n,stepsPerBeat:r}=e;return{pulse:t.pulse,beat:t.beat,stepIndex:n,chakraDay:YT(t.chakraDay),stepsPerBeat:r,userPhiKey:t.userPhiKey??void 0,kaiSignature:t.kaiSignature??void 0}}function QT(e,t,n){let r=e.stepIndex;return typeof r==`number`&&Number.isFinite(r)&&r>=0&&rNumber(N()/1000n),rE=e=>JSON.stringify({canonicalHash:e.canonicalHash,token:e.token,expiresAtPulse:e.expiresAtPulse,issuedAt:e.issuedAt,version:e.version},tE),iE=e=>btoa(String.fromCharCode(...e)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``);const aE=e=>iE(new TextEncoder().encode(rE(e)));async function oE(e){try{let t=await fetch(`/api/sign-claim`,{method:`POST`,headers:{"content-type":`text/plain;charset=UTF-8`},body:rE(e)});if(!t.ok)return null;let n=await t.json();return!n||!n.s||!n.kid?null:{r:n.r??aE(e),s:n.s,kid:n.kid}}catch{return null}}function sE(e,t,n,r){e.searchParams.set(`r`,t),e.searchParams.set(`s`,n),e.searchParams.set(`kid`,r)}function cE(e,t,n,r){pe(e,{registryClaim:aE(t),registrySig:n,registryKid:r})}function lE(e,t,n){return{canonicalHash:t.toLowerCase(),token:n,expiresAtPulse:e.expiresAtPulse??null,issuedAt:nE(),version:1}}function uE(){if(typeof window>`u`||typeof document>`u`){let e=()=>{},t=()=>{};return{openModal:t,closeModal:t,disable:e,teardown:e,destroy:e}}let e=document,t=e.body,n=[`.sp-breathproof__backdrop`,`.stargate-overlay`,`.valuechart-backdrop`,`.sp-modal`,`.ownership-overlay`],r={".sp-breathproof__backdrop":`.sp-breathproof`,".valuechart-backdrop":`.valuechart`,".ownership-overlay":`.ownership-panel`,".stargate-overlay":`.stargate-content, .stargate-frame, .stargate__content`,".sp-modal":`.sp-modal__content, .sp-modal__card, .sp-card`},i={capture:!0,passive:!1},a={capture:!0},o=0,s=0,c=0,l=``,u=``,d=``,f=``,p=``,m=()=>{o===0&&(s=window.scrollY||e.documentElement.scrollTop||0,c=window.scrollX||e.documentElement.scrollLeft||0,l=t.style.top,u=t.style.left,d=t.style.width,f=t.style.position,p=t.style.overflow,t.style.position=`fixed`,t.style.top=`-${s}px`,t.style.left=`-${c}px`,t.style.width=`100%`,t.style.overflow=`hidden`,t.classList.add(`modal-open`,`bp-open`)),o++},h=()=>{o=Math.max(0,o-1),!(o>0)&&(t.style.position=f,t.style.top=l,t.style.left=u,t.style.width=d,t.style.overflow=p,requestAnimationFrame(()=>{window.scrollTo(c,s)}),t.classList.remove(`modal-open`),t.classList.remove(`bp-open`))},g=e=>{if(!e)return!1;let t=window.getComputedStyle(e);return!(t.display===`none`||t.visibility===`hidden`||e.hasAttribute(`hidden`))},_=()=>{let t=[];return n.forEach(n=>{e.querySelectorAll(n).forEach(e=>{g(e)&&t.push(e)})}),t},v=t=>{if(!t)return null;let r=t;for(;r&&r!==e.documentElement;){for(let e of n)if(r.matches(e))return r;r=r.parentElement}return null},y=(e,t)=>{if(!e||!t)return!1;let i=n.find(t=>e.matches(t))||``,a=i?r[i]:``;return a&&e.querySelector(a)?!t.closest(a):t===e},b=()=>{_().length>0?m():h()},x=e=>{e&&(e.classList.add(`is-open`),e.removeAttribute(`hidden`),b())},S=e=>{e&&(e.classList.remove(`is-open`),e.setAttribute(`hidden`,``),b())},C=e=>{let t=e.target;if(!t)return;let n=t.closest(`.sp-breathproof__close, .stargate-exit, .sp-modal__close, .sealmoment__close, [data-modal-close], [data-dismiss="modal"], button[aria-label="Close"], button[aria-label="close"]`);if(n){let t=v(n);t&&(S(t),e.preventDefault(),e.stopPropagation());return}let r=v(t);if(r&&y(r,t)&&r.getAttribute(`data-backdrop-dismiss`)!==`false`){S(r),e.preventDefault(),e.stopPropagation();return}},w=e=>{if(_().length===0)return;let t=e.target;if(!t)return;let n=t.closest(`[data-scroll], .sp-breathproof, .valuechart, .ownership-panel, .sp-modal__content, .sp-card, .stargate-content`);if(!n){e.preventDefault(),e.stopPropagation();return}if(!(n.scrollHeight>n.clientHeight)){e.preventDefault(),e.stopPropagation();return}},T=e=>{if(e.key!==`Escape`)return;let t=_();if(t.length===0)return;let n=t[t.length-1];n.getAttribute(`data-escape-dismiss`)!==`false`&&(S(n),e.preventDefault(),e.stopPropagation())};e.addEventListener(`click`,C,i),e.addEventListener(`pointerup`,C,i),e.addEventListener(`touchend`,C,i),e.addEventListener(`touchmove`,w,i),e.addEventListener(`keydown`,T,i),b();let E=()=>{e.removeEventListener(`click`,C,a),e.removeEventListener(`pointerup`,C,a),e.removeEventListener(`touchend`,C,a),e.removeEventListener(`touchmove`,w,a),e.removeEventListener(`keydown`,T,a);try{o=1,h()}catch{}};return{openModal:x,closeModal:S,disable:E,teardown:E,destroy:E}}var dE=k(ce(),1),fE=1e-9,pE=`sigil-sendlock-v1`,mE=(e,t)=>`sigil:sendlock:${e}:t:${t}`,hE=3,gE={"--phi-url":`url(/assets/phi.svg)`},_E=e=>{try{return new URL(e,window.location.origin).toString()}catch{return e}},vE=(e,t,n)=>{let r=crypto.getRandomValues(new Uint32Array(4)).join(``);if(!e||!t)return{ok:!1,id:r};let i=mE(e.toLowerCase(),t);try{let a=localStorage.getItem(i),o=a?JSON.parse(a):null,s=!o||!Number.isFinite(o.atPulse)||n-o.atPulse>hE;if(!o||s){localStorage.setItem(i,JSON.stringify({id:r,atPulse:n}));try{let i=new BroadcastChannel(pE),a={type:`lock`,canonical:e.toLowerCase(),token:t,id:r,atPulse:n};i.postMessage(a),i.close()}catch{}return{ok:!0,id:r}}}catch{}return{ok:!1,id:r}},yE=(e,t,n,r)=>{if(!e||!t)return;let i=mE(e.toLowerCase(),t);try{let a=localStorage.getItem(i),o=a?JSON.parse(a):null;if(!o||o.id===n){localStorage.removeItem(i);try{let i=new BroadcastChannel(pE),a={type:`unlock`,canonical:e.toLowerCase(),token:t,id:n,atPulse:r};i.postMessage(a),i.close()}catch{}}}catch{}},bE=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.amount==`number`&&Number.isFinite(t.amount)&&t.amount>0&&typeof t.nonce==`string`&&t.nonce.length>0&&typeof t.timestamp==`number`&&Number.isFinite(t.timestamp)&&(typeof t.recipientPhiKey==`string`||t.recipientPhiKey===void 0)},xE=e=>{if(!Array.isArray(e))return 0;let t=0;for(let n of e)bE(n)&&(t+=n.amount);return t},SE=e=>[...e].sort((e,t)=>{let n=(e.timestamp||0)-(t.timestamp||0);return n===0?e.nonce.localeCompare(t.nonce):n}),CE=e=>{let t=new Set,n=[];for(let r of e)bE(r)&&(t.has(r.nonce)||(t.add(r.nonce),n.push(r)));return n},wE=e=>{let t=typeof e.originalAmount==`number`&&Number.isFinite(e.originalAmount)?e.originalAmount:NaN,n=SE(Array.isArray(e.debits)?CE(e.debits):[]);if(!Number.isFinite(t))return{originalAmount:e.originalAmount,debits:n.length?n:void 0};let r=[],i=0;for(let e of n)bE(e)&&i+e.amount<=t+fE&&(r.push(e),i+=e.amount);return{originalAmount:t,debits:r.length?r:void 0}},TE=1000000n,EE=91536000n,DE=17491270421n,OE=e=>e<0n?-e:e,kE=(e,t)=>{let n=e/t,r=e%t*2n;return rt?n+1n:n%2n==0n?n:n+1n},AE=(e,t)=>{if(t<=0n)throw Error(`divRoundTiesToEven: den must be > 0`);return e===0n?0n:(e<0n?-1n:1n)*kE(OE(e),t)},jE=e=>AE(e*EE,DE),ME=e=>{let t=jE(e);return BigInt(x)+t},NE=e=>AE((e-BigInt(x))*DE,EE),PE=()=>{let e=N();return Number(e/TE)},FE=()=>{let e=ME(N());return Number(e)},IE=e=>{let t=NE(BigInt(e.getTime()));return Number(t/TE)};function LE(){let[e,t]=(0,K.useState)(()=>PE()),[n,r]=(0,K.useState)(0);return(0,K.useEffect)(()=>{let e=!0,n=null,i=()=>{if(!e)return;let a=N(),o=Number(a/TE),s=a%TE,c=jE(s===0n?TE:TE-s),l=Number(c);t(o),r(l);let u=Math.max(1,Math.min(6e4,l));n=window.setTimeout(i,u)};return i(),()=>{e=!1,n!=null&&window.clearTimeout(n)}},[]),{pulse:e,msToNextPulse:n}}var RE=e=>e===`breaths`||e===`steps`,zE=`sigil-lineage-v1`,BE=(e,t)=>t?`sigil:desc:${e}:t:${t}`:`sigil:desc:${e}`,VE=`sigil-xfer-v1`,HE=e=>`sigil:rotated:${e}`,UE=(e,t)=>{Array.from(new Set(e.map(e=>e.toLowerCase()).filter(Boolean))).forEach(e=>{try{localStorage.setItem(HE(e),`${t}@${FE()}`)}catch{}try{let n=new BroadcastChannel(VE);n.postMessage({type:`rotated`,canonical:e,token:t}),n.close()}catch{}try{window.dispatchEvent(new CustomEvent(`sigil:transfer-rotated`,{detail:{canonical:e,token:t}}))}catch{}})};function WE(e,t){let n=(e||``).toLowerCase();if(!n||!t)return[];try{let e=localStorage.getItem(BE(n,t));if(!e)return[];let r=JSON.parse(e);return Array.isArray(r)?r:[]}catch{return[]}}function GE(e,t,n){let r=(e||``).toLowerCase();if(!(!r||!t))try{localStorage.setItem(BE(r,t),JSON.stringify(n||[]))}catch{}}function KE(e,t,n){try{let r=new BroadcastChannel(zE),i={type:`descendants`,canonical:e.toLowerCase(),token:t,list:n,stamp:FE()};r.postMessage(i),r.close()}catch{}}function qE(){let{hash:e}=ie(),t=oe(),r=C(),i=(e??``).toLowerCase(),a=(0,K.useMemo)(()=>new URLSearchParams(t.search),[t.search]),o=a.get(`t`),[s,c]=(0,K.useState)(`checking`),[l,u]=(0,K.useState)(`checking`),[d,f]=(0,K.useState)(!1),[m,h]=(0,K.useState)(`Awaiting Proof Of Breath™`),[g,_]=(0,K.useState)(``),[v,y]=(0,K.useState)(320),b=(0,K.useRef)(null),{payload:x,setPayload:E,loading:D,setLoading:O}=yC(t.search),k=x,{pulse:A,msToNextPulse:j}=LE(),[M,N]=(0,K.useState)(null),[P,F]=(0,K.useState)(null),[I,L]=(0,K.useState)(!1),[R,te]=(0,K.useState)(``),[z,re]=(0,K.useState)(``),[B,ae]=(0,K.useState)(`breaths`),[ce,H]=(0,K.useState)(44),[U,de]=(0,K.useState)(``),[W,G]=(0,K.useState)(!1),me=(0,K.useRef)(``),ge=(0,K.useMemo)(()=>i?`sigil:legacy-upgraded:${i}`:``,[i]),[be,xe]=(0,K.useState)(!1),[Se,Ce]=(0,K.useState)(!1);(0,K.useEffect)(()=>{if(ge)try{Ce(localStorage.getItem(ge)===`1`)}catch{}},[ge]);let we=(0,K.useCallback)(()=>{if(ge){try{localStorage.setItem(ge,`1`)}catch{}Ce(!0),SC(_,`Upgraded — legacy link locked`)}},[ge]),[Te,Ee]=(0,K.useState)(!1),[De,Oe]=(0,K.useState)(``),[ke,Ae]=(0,K.useState)(``),[je,Me]=(0,K.useState)(`checking`),[Ne,Pe]=(0,K.useState)(null);(0,K.useEffect)(()=>{let e=Array.from(new Set([k?.canonicalHash,i,U].filter(Boolean).map(e=>e.toLowerCase())));if(e.length===0)return;let t=()=>{let t=null;try{for(let n of e){let e=localStorage.getItem(HE(n)),r=e?String(e).split(`@`)[0]:null;if(r){t=r;break}}}catch{}Pe(t)};t();let n=null;try{n=new BroadcastChannel(VE),n.onmessage=t=>{let n=t.data;if(n?.type===`rotated`){let t=(n.canonical||``).toLowerCase();e.includes(t)&&Pe(n.token||null)}}}catch{}let r=n=>{if(n.key){for(let r of e)if(n.key===HE(r)){t();break}}};return window.addEventListener(`storage`,r,{passive:!0}),()=>{if(window.removeEventListener(`storage`,r),n&&typeof n.close==`function`)try{n.close()}catch{}}},[k?.canonicalHash,i,U]);let Fe=(0,K.useCallback)(async(e,t,n,r,i)=>{try{let a=lE(e,t,n),o=await oE(a);if(!o)return r;let s=new URL(r,window.location.origin);return sE(s,o.r,o.s,o.kid),i&&cE(i,a,o.s,o.kid),s.toString()}catch{return r}},[]);(0,K.useEffect)(()=>{let e=null;try{e=new BroadcastChannel(pE),e.onmessage=()=>{}}catch{}return()=>{if(e&&typeof e.close==`function`)try{e.close()}catch{}}},[]),(0,K.useEffect)(()=>{let e=uE();return()=>{e.destroy?.(),e.teardown?.(),e.disable?.()}},[]);let[Ie,Le]=(0,K.useState)(0),[Re,Ve]=(0,K.useState)(!1),[He,Ue]=(0,K.useState)(null),We=(0,K.useMemo)(()=>{let e=[k?.canonicalHash,U,M?.canonicalHash,He?.matchedHash].filter(Boolean).map(e=>e.toLowerCase());return Array.from(new Set(e))},[k?.canonicalHash,U,M?.canonicalHash,He]);(0,K.useLayoutEffect)(()=>{qC()},[]),(0,K.useEffect)(()=>{let e=dC[k?.chakraDay??`Throat`]??{hue:180,accent:`#00FFD0`},t=document.querySelector(`.sigilpage`);t&&(t.style.setProperty(`--crystal-hue`,String(e.hue)),t.style.setProperty(`--crystal-accent`,e.accent))},[k?.chakraDay]);let[Ge,Ke]=(0,K.useState)(null),{valSeal:qe,livePrice:Je,priceFlash:Ye}=qT({payload:k,urlSearchParams:a,currentPulse:A,routeHash:i}),Xe=a.get(`h`)??``;(0,K.useEffect)(()=>{if(!Xe){Ke(e=>e===null?e:null);return}try{let e=n(jC(Xe.trim()));Ke(t=>Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)}catch{Ke(e=>e===null?e:null)}},[Xe]);let Ze=(0,K.useCallback)((e,t)=>{let n=e.stepsPerBeat??44,r=t.stepsPerBeat??44,i=p(e.pulse,n),a=p(t.pulse,r);return e.pulse===t.pulse&&e.beat===t.beat&&i===a&&e.chakraDay===t.chakraDay},[]),Qe=(0,K.useMemo)(()=>typeof window<`u`?new URL(window.location.href).toString():`${`/s/${encodeURIComponent(e??``)}`}${t.search||``}${t.hash||``}`,[e,t.search,t.hash]),$e=(0,K.useMemo)(()=>e?e.slice(0,16):`—`,[e]),et=(0,K.useCallback)(async(e,t=`Copied`)=>{try{return await navigator.clipboard.writeText(e),SC(_,t),!0}catch{return SC(_,`Copy failed`),!1}},[]),tt=(0,K.useCallback)(async()=>{try{let e=navigator;typeof e?.share==`function`?(await e.share({title:`Kairos Sigil-glyph`,text:`Sealed Kairos Moment`,url:Qe}),SC(_,`Share sheet opened`)):await et(Qe,`Link copied`)}catch{}},[Qe,et]);(0,K.useEffect)(()=>{let e=FE(),t=(i||``).toLowerCase();if(Ie>e||!t||We.length===0)return;let n=We.includes(t),r=l,a=s;!n&&U&&t!==U&&!He||!n&&(He||je===`archived`)?r=`authentic`:(r=n?`authentic`:`forged`,s!==`verified`&&(a=n?`ok`:`mismatch`)),r!==l&&u(r),a!==s&&c(a)},[We,i,je,Ie,He,U,l,s]);let[nt,rt]=(0,K.useState)(null),it=(0,K.useDeferredValue)(k),at=(0,K.useMemo)(()=>{let t=it?.stepsPerBeat??44,n=it?p(it.pulse,t):0,r=it?.chakraDay??`Throat`,i=(it?.userPhiKey??``).slice(0,12),a=(it?.pulse??0).toLocaleString();return{title:`Kai Sigil — ${e?e.slice(0,16):`—`}`,desc:it?`Sealed Sigil-Glyph • Pulse ${a} • Beat ${it.beat}/36 • Step ${n+1}/${t} • ${r}${i?` • Owner ${i}…`:``}.`:`Sealed Sigil-Glyph`}},[it,e]),{series:ot}=QS();(0,K.useEffect)(()=>{let e=Qe;document.title=at.title;let t=lC(`canonical`);t.href=e,sC(`name`,`theme-color`,dC[k?.chakraDay??`Throat`]?.accent||`#00FFD0`),sC(`property`,`og:title`,at.title),sC(`property`,`og:description`,at.desc),sC(`property`,`og:type`,`website`),sC(`property`,`og:url`,e),sC(`name`,`twitter:card`,`summary_large_image`),sC(`name`,`twitter:title`,at.title),sC(`name`,`twitter:description`,at.desc),sC(`property`,`og:site_name`,`Kairos Harmonik Kingdom`);let n=k?.stepsPerBeat??44,r=k?p(k.pulse,n):0,i=k,a=k??{},o={"@context":`https://schema.org`,"@type":`VisualArtwork`,name:at.title,description:at.desc,url:e,image:nt||void 0,genre:`Sigil-Glyph`,identifier:[{"@type":`PropertyValue`,name:`pulse`,value:k?.pulse??null},{"@type":`PropertyValue`,name:`beat`,value:k?.beat??null},{"@type":`PropertyValue`,name:`stepIndex`,value:r},{"@type":`PropertyValue`,name:`stepsPerBeat`,value:n},{"@type":`PropertyValue`,name:`chakraDay`,value:k?.chakraDay??null},{"@type":`PropertyValue`,name:`userPhiKey`,value:k?.userPhiKey??null},{"@type":`PropertyValue`,name:`kaiSignature`,value:k?.kaiSignature??null},{"@type":`PropertyValue`,name:`canonicalHash`,value:(k?.canonicalHash??U)||null},{"@type":`PropertyValue`,name:`expiresAtPulse`,value:k?.expiresAtPulse??null},{"@type":`PropertyValue`,name:`transferNonce`,value:new URLSearchParams(location.search).get(`t`)??k?.transferNonce??null},{"@type":`PropertyValue`,name:`claimExtendUnit`,value:RE(a.claimExtendUnit)?a.claimExtendUnit:null},{"@type":`PropertyValue`,name:`claimExtendAmount`,value:a.claimExtendAmount??null},{"@type":`PropertyValue`,name:`historyLiteCount`,value:Ge?.length??0}].filter(e=>e.value!=null)};i?.lineage?.length&&o.identifier.push({"@type":`PropertyValue`,name:`lineageDepth`,value:i.lineage.length}),uC(`sigil-jsonld`,o)},[Qe,at.title,at.desc,k,nt,U,Ge?.length]),(0,K.useEffect)(()=>JT({stageId:`sigil-stage`,payload:k?{...k}:null,localHash:U,setOgImgUrl:rt,setMeta:sC,seoTitle:at.title,seoDesc:at.desc}),[k,U,v,at.title,at.desc]),(0,K.useLayoutEffect)(()=>(document.documentElement.classList.add(`sigil-scroll`),()=>document.documentElement.classList.remove(`sigil-scroll`)),[]),(0,K.useEffect)(()=>{let e=0,t=()=>{cancelAnimationFrame(e),e=requestAnimationFrame(()=>{let e=window.innerWidth,t=window.innerHeight,n=e<640?Math.max(220,Math.min(360,t*.48)):Math.max(160,Math.min(320,t*.35)),r=Math.max(160,Math.min(640,Math.min(e,t-n))),i=b.current?.clientWidth??e,a=Math.max(160,Math.min(640,i-24));y(Math.round(Math.min(r,a)))})},n=b.current??document.body,r=new ResizeObserver(()=>t());return r.observe(n),window.addEventListener(`resize`,t,{passive:!0}),t(),()=>{r.disconnect(),window.removeEventListener(`resize`,t),cancelAnimationFrame(e)}},[]),(0,K.useEffect)(()=>{D?(c(e=>e===`verified`?`verified`:`checking`),u(e=>e===`authentic`?`authentic`:`checking`),f(!1),h(`Awaiting Verifikation`)):k||(c(e=>e===`verified`?`verified`:i?`notfound`:`checking`),u(e=>e===`authentic`?`authentic`:i?`forged`:`checking`))},[D,k,i]);let st=e=>Array.isArray(e)?[...e].map(e=>({nonce:e.nonce,amount:Number.isFinite(e.amount)?Number(e.amount):0,recipient:e.recipientPhiKey??``,ts:e.timestamp??``})).sort((e,t)=>e.nonce.localeCompare(t.nonce)).map(e=>`${e.nonce}:${e.amount}:${e.recipient}:${e.ts}`).join(`|`):``;(0,K.useEffect)(()=>{let e=hT(a.get(`d`));if(!e)return;let t=PT(k??null,U,He),n=FT(o,k??null),r=wE(e);t&&vT(t,r,n);let i=typeof r.originalAmount==`number`?r.originalAmount:void 0,s=Array.isArray(r.debits)?r.debits:void 0;E(e=>{if(!e)return e;let t=e,n=(t.originalAmount??void 0)===i,r=st(t.debits)===st(s);if(n&&r)return e;let a={...e};return i!==void 0&&(a.originalAmount=i),s&&(a.debits=s,a.totalDebited=xE(s)),a})},[a,k,U,He,o,E]);let[ct,lt]=(0,K.useState)(!1);(0,K.useEffect)(()=>{let e=PT(k??null,U,He);if(!e)return;let t=FT(o,k??null),{merged:n,urlIsStale:r}=CT(e,a,t),i=wE(n);r&<(!0),ST(i,e,t,{broadcast:!1,navigate:r});let s=typeof i.originalAmount==`number`?i.originalAmount:void 0,c=Array.isArray(i.debits)?i.debits:void 0;E(e=>{if(!e)return e;let t=e,n=(t.originalAmount??void 0)===s,r=st(t.debits)===st(c);if(n&&r)return e;let i={...e};return s!==void 0&&(i.originalAmount=s),c&&(i.debits=c,i.totalDebited=xE(c)),i})},[k?.canonicalHash,U,He,a,o,E]),(0,K.useEffect)(()=>{if(!k?.canonicalHash)return;let e=k.canonicalHash.toLowerCase();if(i&&e&&e!==i&&je===`active`&&!He){let t=new URL(window.location.href);t.pathname=`/s/${e}`,r(`${t.pathname}${t.search}${t.hash}`,{replace:!0})}},[k?.canonicalHash,i,je,He,r]),(0,K.useEffect)(()=>{if(k&&!k.canonicalHash&&U&&i&&U!==i&&je===`active`&&!He){let e=new URL(window.location.href);e.pathname=`/s/${U}`,r(`${e.pathname}${e.search}${e.hash}`,{replace:!0})}},[k?.canonicalHash,U,i,je,He,r]),(0,K.useEffect)(()=>{let e=We;if(!e.length)return;let t=FT(o,k??null),n=(e,t)=>{let n={};typeof e?.originalAmount==`number`&&(n.originalAmount=e.originalAmount),n.originalAmount===void 0&&typeof t?.originalAmount==`number`&&(n.originalAmount=t.originalAmount);let r=Array.isArray(e?.debits)?e.debits:[],i=Array.isArray(t?.debits)?t.debits:[],a=CE([...r,...i]);return wE({originalAmount:n.originalAmount,debits:a})},r=(e,t)=>{let n=wE(e??{}),r=wE(t??{}),i=typeof n.originalAmount==`number`?n.originalAmount:NaN,a=typeof r.originalAmount==`number`?r.originalAmount:NaN,o=Number.isNaN(i)&&Number.isNaN(a)||Math.abs(i-a)e.nonce)),c=new Set((Array.isArray(r.debits)?r.debits:[]).map(e=>e.nonce));if(!o||s.size!==c.size)return!1;for(let e of s)if(!c.has(e))return!1;return!0},i=(i,a,o)=>{let s=i.toLowerCase();if(!e.includes(s))return;let c=t??null;if(c!==(o??null))return;let l=hT(a);if(!l)return;let u=hT(new URLSearchParams(window.location.search).get(`d`)),d=n(u,l);r(u,d)||(ST(d,s,c,{broadcast:!1}),E(e=>{if(!e)return e;let t={...e};return typeof d.originalAmount==`number`&&(t.originalAmount=d.originalAmount),Array.isArray(d.debits)&&(t.debits=d.debits,t.totalDebited=xE(d.debits)),t}))},a=null;try{a=new BroadcastChannel(sT),a.onmessage=e=>{let t=e.data;t?.type===`debits`&&t.canonical&&t.qs&&i(t.canonical,t.qs,t.token)}}catch{}let s=t=>{if(!(!t.key||typeof t.newValue!=`string`))for(let n of e){if(!lT(t.key,n))continue;let e=uT(t.key,n);i(n,t.newValue,e);break}};return window.addEventListener(`storage`,s,{passive:!0}),()=>{if(window.removeEventListener(`storage`,s),a&&typeof a.close==`function`)try{a.close()}catch{}}},[We,o,k,E]);let ut=(0,K.useMemo)(()=>k?typeof k.expiresAtPulse==`number`?k.expiresAtPulse:k.pulse+11:null,[k]),dt=(0,K.useMemo)(()=>A==null||ut==null?null:Math.max(0,ut-A),[A,ut]),pt=(0,K.useMemo)(()=>dt===0,[dt]),mt=(0,K.useMemo)(()=>A==null||!k?null:Math.max(0,k.pulse-A),[k,A]),ht=(0,K.useMemo)(()=>A==null||!k?!1:k.pulse>A,[k,A]),gt=k?.chakraDay??`Throat`,_t=k?.stepsPerBeat??44,vt=p(k?.pulse??0,_t),yt=typeof k?.stepPct==`number`?Math.max(0,Math.min(1,k.stepPct)):S(k?.pulse??0),bt=(0,K.useMemo)(()=>`hsl(${((dC[gt]?.hue??180)+(U&&/^[0-9a-f]+$/i.test(U)?parseInt(U.slice(-2),16)%12:0)*2.5)%360} 100% ${50+15*Math.sin(yt*2*Math.PI)}%)`,[gt,yt,U]),xt=dC[gt]?.hue??180,St=(0,K.useMemo)(()=>`qr-${(U||i||`seed`).slice(0,12)}-${gt}-${vt}`,[U,i,gt,vt]),[Ct,wt]=(0,K.useState)(!1),[Tt,Dt]=(0,K.useState)(null);(0,K.useEffect)(()=>{let e=!1;return(async()=>{try{if(!k){Dt(null);return}let t=k.stepsPerBeat??44,n=p(k.pulse,t),r=BC(k),i=zC(k.pulse,k.beat,n,String(k.chakraDay??``),r),a=await FC(i),o=await RC(a),s=typeof k.kaiSignature==`string`?k.kaiSignature.toLowerCase()===a.toLowerCase():!0,c=typeof k.userPhiKey==`string`?k.userPhiKey.toLowerCase()===o.toLowerCase():!0,l={pulse:k.pulse,beat:k.beat,stepsPerBeat:t,stepIndex:n,chakraDay:String(k.chakraDay??``),intention:r??null,sigmaString:i,sigmaHash:a,derivedPhiKey:o,payloadKaiSignature:k.kaiSignature??null,payloadUserPhiKey:k.userPhiKey??null,matches:{sigma:s,phi:c}};e||Dt(l)}catch{e||Dt(null)}})(),()=>{e=!0}},[k]);let Ot=le(()=>{IT({stageEl:document.getElementById(`sigil-stage`),payload:k,localHash:U,routeHash:i,qr:{uid:St,url:Qe,hue:xt,accent:bt},onToast:e=>SC(_,e)})}),[kt,At]=(0,K.useState)(!1),[jt,Mt]=(0,K.useState)(``),Nt=(0,K.useCallback)(async()=>{let e=b.current;e&&(Mt((await(0,dE.default)(e,{backgroundColor:null})).toDataURL(`image/png`)),At(!0),fC()||document.querySelector(`.stargate-overlay`)?.requestFullscreen?.().catch(()=>{}))},[]),Pt=(0,K.useCallback)(()=>{At(!1),document.fullscreenElement&&!fC()&&document.exitFullscreen?.().catch(()=>{})},[]),Ft=le(()=>{Nt()}),It=le(()=>{Pt()}),Lt=le(()=>wt(e=>!e)),Rt=le(()=>Ve(!0)),zt=(0,K.useCallback)(async e=>{let t=await e.arrayBuffer(),n=e.type||`application/octet-stream`,r=`data:${n};base64,${xC(t)}`;F({name:e.name,mime:n,size:e.size,dataUri:r}),SC(_,`Remembered ${e.name}`)},[]),Bt=(0,K.useCallback)((e,t)=>{let n=e.stepsPerBeat??44,r=p(e.pulse,n),a=(e.canonicalHash||U||``).toLowerCase(),o=e.claimExtendUnit,s=RE(o)?o:null,c=e.claimExtendAmount,l=typeof c==`number`?c:null,u=$T({pulse:e.pulse,beat:e.beat,chakraDay:e.chakraDay??`Root`,stepsPerBeat:n,stepIndex:r,userPhiKey:e.userPhiKey??null,kaiSignature:e.kaiSignature??null,canonicalHash:a,transferNonce:e.transferNonce??null,expiresAtPulse:e.expiresAtPulse??null,claimExtendUnit:s,claimExtendAmount:l},t,{localHash:U,routeHash:i,stepsPerBeat:44,stepIndexFromPulse:p})?.url||`/s/${a}`;try{let e=new URL(u,window.location.origin);e.pathname=`/s/${a}`;let t=new URLSearchParams(window.location.search).get(`d`);t&&e.searchParams.set(`d`,t),new URL(window.location.href).searchParams.forEach((t,n)=>{n!==`d`&&e.searchParams.set(n,e.searchParams.get(n)??t)}),u=e.toString()}catch{}let d=new URL(u,window.location.origin);d.pathname=`/s/${a}`,new URL(window.location.href).searchParams.forEach((e,t)=>{t!==`d`&&d.searchParams.set(t,d.searchParams.get(t)??e)});let f=wT(u)||a;return Oe(u),Ae(f),Ee(!0),u},[U,i]),Vt=(0,K.useCallback)((e,t,n=!0)=>{let a=e.stepsPerBeat??44,o=p(e.pulse,a),s=e.claimExtendUnit,c=RE(s)?s:`breaths`,l=e.claimExtendAmount,u=typeof l==`number`?l:11;return eE({pulse:e.pulse,beat:e.beat,chakraDay:e.chakraDay??`Root`,stepsPerBeat:a,stepIndex:o,userPhiKey:e.userPhiKey??null,kaiSignature:e.kaiSignature??null,canonicalHash:t,transferNonce:e.transferNonce??null,expiresAtPulse:e.expiresAtPulse??null,claimExtendUnit:c,claimExtendAmount:u},t,{localHash:U,routeHash:i,stepsPerBeat:44,stepIndexFromPulse:p,getKaiPulseEternalInt:IE,breathsToPulses:ue,shareTransferLink:$T,publishRotation:UE,navigate:e=>{if(n)try{r(e)}catch{try{window.location.href=e}catch{}}}})??null},[U,i,r]),Ht=(0,K.useCallback)(async e=>{if(f(!1),h(`Verifying…`),!(/image\/svg\+xml/i.test(e.type)||/\.svg$/i.test(e.name))){h(`Unsupported file. Upload an SVG sigil (.svg) only.`);return}let t=null;try{let{ok:n,errors:r,payload:i,meta:a}=he(await e.text());if(!n||!i){h(r[0]||`Invalid SVG.`);return}t=i,N(a||{})}catch{h(`Invalid or unreadable SVG uploaded.`);return}if(!k||!t){h(`Load or link a sigil first, then verify stewardship.`);return}if(!Ze(k,t)){h(`File does not match this sealed kairos moment.`),f(!1);return}if(t.canonicalHash){let e=t.canonicalHash.toLowerCase(),n=(U||``).toLowerCase(),r=(i||``).toLowerCase(),a=n&&e===n,o=r&&e===r;if(!a&&!o){h(`SVG canonicalHash doesn’t match this link’s hash.`),f(!1);return}if(o&&!a){Ue({reason:`svg.canonicalHash matched route (legacy)`,matchedHash:e}),u(`authentic`),c(`ok`),Me(`archived`),f(!0),h(`Stewardship verified (legacy SVG). Issuing modern link…`),n&&(Vt({...k},n,!0),h(`Legacy verified. Modern transfer link ready.`));return}}if(new Set([o??void 0,k.transferNonce??void 0,t.transferNonce??void 0,Ne??void 0].filter(e=>!!e)).size>1){h(`This is not the active transfer link for that Φkey.`),f(!1);return}f(!0),h(`Stewardship verified`)},[k,Ze,U,i,o,Ne,Vt]),Ut=le(async()=>{if(I)return;let e=b.current?.querySelector(`svg`),t=k??{},n=RE(t.claimExtendUnit)?t.claimExtendUnit:void 0,r=typeof t.claimExtendAmount==`number`?t.claimExtendAmount:null;await GT({expired:!!pt,exporting:I,setExporting:L,svgEl:e,payload:k?{pulse:k.pulse,beat:k.beat,chakraDay:k.chakraDay??null,stepsPerBeat:k.stepsPerBeat??void 0,stepIndex:k.stepIndex??null,exportedAtPulse:k.exportedAtPulse??null,canonicalHash:k.canonicalHash??null,userPhiKey:k.userPhiKey??null,kaiSignature:k.kaiSignature??null,transferNonce:k.transferNonce??null,expiresAtPulse:k.expiresAtPulse??null,claimExtendUnit:n,claimExtendAmount:r,attachment:k.attachment??null,provenance:k.provenance??null}:null,isFutureSealed:ht,linkStatus:je,setToast:e=>SC(_,e),expiryUnit:B,expiryAmount:ce,localHash:U,routeHash:i,transferToken:o??null,getKaiPulseEternalInt:IE,stepIndexFromPulse:p,STEPS_PER_BEAT:44})}),Wt=(0,K.useCallback)(e=>{let t=typeof e==`string`?e:e?.hash;if(!t)return;let n=t.toLowerCase();de(e=>e===n?e:n)},[]),Gt=D&&!k,Kt=s===`notfound`||s===`error`,qt=k?.pulse??0,Jt=k?.beat??0,Yt=((j??0)/1e3).toFixed(3),Xt=je===`archived`,Zt=d&&!Xt,Qt=(0,K.useMemo)(()=>l===`authentic`&&Xt&&!o&&!!i&&!!U&&i!==U,[l,Xt,o,i,U]);(0,K.useEffect)(()=>{if(!k||l!==`authentic`||s===`mismatch`||s===`error`||s===`notfound`)return;let e=!1;return(async()=>{try{let t=k.stepsPerBeat??44,n=p(k.pulse,t),r=BC(k),i=await FC(zC(k.pulse,k.beat,n,String(k.chakraDay??``),r)),a=typeof k.kaiSignature==`string`?k.kaiSignature.toLowerCase()===i.toLowerCase():!0,o=await RC(i),l=typeof k.userPhiKey==`string`?k.userPhiKey.toLowerCase()===o.toLowerCase():!0;!e&&a&&l&&s!==`verified`&&c(`verified`)}catch{}})(),()=>{e=!0}},[k,l,s,je]),(0,K.useEffect)(()=>{let e=(i||``).toLowerCase(),t=o||null,n=k?.transferNonce||null,r=!!t&&!!n&&t===n&&(ut==null||A==null||A{let e=!0;return(async()=>{if(!k){en(``),nn(``);return}let t=(k.canonicalHash||U||``).toLowerCase(),n=A||PE(),r=await JC(k,t,n,T(n),p(n,k.stepsPerBeat??44));e&&(en(r.ownerPhiKey),nn(r.kaiSig))})(),()=>{e=!1}},[k,U]);let rn=(0,K.useCallback)(async e=>{if(e?.preventDefault?.(),e?.stopPropagation?.(),!k||!U||ht||Xt)return;let t=(k.canonicalHash||U||``).toLowerCase(),n=A||PE(),r=await JC(k,t,n,T(n),p(n,k.stepsPerBeat??44));te(r.ownerPhiKey),re(r.kaiSig),setTimeout(()=>{try{sn()}catch{}},0)},[k,U,ht,Xt]),an=(0,K.useCallback)(e=>{let t=`/${e}`;try{window.location.assign(t)}catch{window.location.href=t}},[]),on=(0,K.useCallback)(async()=>{try{let e=await(await fetch(`/verifier.inline.html`,{cache:`no-store`})).text(),t=new Blob([e],{type:`text/html`}),n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=`verifier.html`,document.body.appendChild(n),n.click(),setTimeout(()=>{URL.revokeObjectURL(n.href),n.remove()},0),SC(_,`Downloading verifier…`)}catch{SC(_,`Download failed`)}},[]);({...Lt});let sn=(0,K.useCallback)(()=>{if(!k)return SC(_,`Nothing to mint`);let e=b.current?.querySelector(`svg`);if(!e)return SC(_,`No Φkey in frame`);if(!U)return SC(_,`Glyph hash not ready yet`);if(je!==`active`)return SC(_,`Archived link — cannot exhale from here`);if(ht)return SC(_,`Opens after the moment—claim unlocks then`);let t=rC(M??{},k.pulse),n=(R||k.userPhiKey||``).trim();if(!n)return SC(_,`Owner ΦKey required`);let r=Math.max(0,Math.floor(ce||0)),a=B===`breaths`?ue(r):fe(r),o=A||PE(),s=o+a,c=U.toLowerCase(),l=crypto.getRandomValues(new Uint32Array(4)).join(``),u=k.stepsPerBeat??44,d=p(k.pulse,u),f=p(o,u),m={...iC(n,z||k.kaiSignature,k,t.length?`transfer`:`mint`,(P??k.attachment)?.name,o),stepIndex:d,atStepIndex:f},h={...k,userPhiKey:n,kaiSignature:z||k.kaiSignature,stepsPerBeat:k.stepsPerBeat??44,attachment:P??k.attachment??void 0,expiresAtPulse:s,canonicalHash:c,transferNonce:l,claimExtendUnit:B,claimExtendAmount:r,provenance:[...t,m]};(async()=>{let t=await FC(zC(h.pulse,h.beat,d,String(h.chakraDay??``),BC(h))),n=await RC(t);h.kaiSignature=t,h.userPhiKey=h.userPhiKey||n;let r=Array.from(new Set([k.canonicalHash,i,U].filter(Boolean).map(e=>e.toLowerCase())));r.length&&UE(r,l),Me(`archived`),Le(FE()+250),pe(e,h),UC(e),E(h),N(h),SC(_,`Sealed & archived`);let a=Bt(h,l)||`/s/${c}`;a=await Fe(h,c,l,a,e),Oe(_E(a)),h.canonicalHash&&UE([h.canonicalHash.toLowerCase()],l),setTimeout(()=>Le(0),0)})()},[k,M,R,z,P,ce,B,U,i,je,ht,Bt]),cn=k,ln=(0,K.useMemo)(()=>xE(cn?.debits??[]),[cn?.debits]),un=(0,K.useMemo)(()=>{let e=(typeof cn?.originalAmount==`number`?cn.originalAmount:qe?.valuePhi??0)-ln;return e>0?e:0},[cn?.originalAmount,qe?.valuePhi,ln]),dn=(cn?.debits?.length??0)>0||typeof cn?.originalAmount==`number`,fn=(0,K.useMemo)(()=>dn?un:Je??qe?.valuePhi??0,[dn,un,Je,qe?.valuePhi]),pn=se,{usdPerPhi:mn,phiPerUsd:hn}=(0,K.useMemo)(()=>{try{let e=w({meta:k||{},nowPulse:A||A,usd:100,currentStreakDays:0,lifetimeUsdSoFar:0},pn);return{usdPerPhi:e.usdPerPhi??0,phiPerUsd:e.phiPerUsd??0}}catch{return{usdPerPhi:0,phiPerUsd:0}}},[k,A,pn]),gn=(fn??0)*(mn||0),_n=(0,K.useCallback)(async()=>{if(!k)return``;let e=k.stepsPerBeat??44,t=p(k.pulse,e);return await RC(k.kaiSignature??await FC(zC(k.pulse,k.beat,t,String(k.chakraDay??``),BC(k))))},[k]),[vn,yn]=(0,K.useState)([]),bn=(0,K.useCallback)(()=>{yn(WE(PT(k??null,U,He),FT(o,k??null)))},[k,U,He,o]);(0,K.useEffect)(()=>{bn();let e=null;try{e=new BroadcastChannel(zE),e.onmessage=e=>{let t=e.data;if(!t||t.type!==`descendants`)return;let n=PT(k??null,U,He),r=FT(o,k??null);!n||!r||t.canonical!==n.toLowerCase()||t.token!==r||Array.isArray(t.list)&&yn(t.list)}}catch{}let t=e=>{if(!e.key||!e.newValue)return;let t=PT(k??null,U,He),n=FT(o,k??null);if(!(!t||!n)&&e.key===BE(t,n))try{let t=JSON.parse(e.newValue||`[]`);Array.isArray(t)&&yn(t)}catch{}};return window.addEventListener(`storage`,t,{passive:!0}),()=>{if(e&&typeof e.close==`function`)try{e.close()}catch{}window.removeEventListener(`storage`,t)}},[k,U,He,o,bn]);let xn=(0,K.useCallback)(async(e,t)=>{if(!k)return null;let n=A||PE(),r=crypto.getRandomValues(new Uint32Array(4)).join(``),i=k.stepsPerBeat??44,a=p(k.pulse,i),s=(U||k.canonicalHash||``).toLowerCase(),c=t??FT(o,k??null),l=Array.isArray(k.lineage)?[...k.lineage]:[],u=(l[l.length-1]?.depth??0)+1,d={token:r,parentToken:c??null,amount:Number(e.toFixed(6)),timestamp:n,depth:u,senderPhiKey:k.userPhiKey??null},f={...k,userPhiKey:void 0,originalAmount:Number(e.toFixed(6)),mintedAtPulse:n,transferNonce:r,expiresAtPulse:n+(B===`breaths`?ue(ce):fe(ce)),claimExtendUnit:B,claimExtendAmount:ce,canonicalHash:s,lineage:[...l,d]},m=await FC(zC(f.pulse,f.beat,a,String(f.chakraDay??``),BC(f))),h=await RC(m);f.kaiSignature=m,f.userPhiKey=h;let g=Bt(f,r)||`/s/${s}`;try{let t=new URL(g,window.location.origin);t.pathname=`/s/${s}`,t.searchParams.set(`d`,pT({originalAmount:f.originalAmount}));let i=NT(t.toString(),f);i=await Fe(f,s,r,i);let a=wT(i)||s;vT(a,hT(new URL(i).searchParams.get(`d`))??{},r);let o=PT(k??null,U,He),l=c??null;if(o&&l){let t=[...WE(o,l),{token:r,parentToken:l,amount:Number(e.toFixed(6)),timestamp:n,depth:1,recipientPhiKey:f.userPhiKey}];GE(o,l,t),KE(o,l,t),yn(t)}return Oe(_E(i)),Ae(a),Ee(!0),i}catch{let e=NT(g||`/s/${s}`,f);return Oe(e),Ae(s),Ee(!0),e||null}},[k,B,ce,U,Bt,He,o]);(0,K.useEffect)(()=>{let e=e=>{if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase();return t===`input`||t===`textarea`||e.isContentEditable},t=t=>{if(t.defaultPrevented||e(t.target))return;let n=t.key.toLowerCase();t.metaKey||t.ctrlKey||t.altKey||(n===`s`?tt():n===`l`?et(Qe,`Link copied`):n===`h`?U&&et(U,`Hash copied`):n===`z`?Ut.onClick?.(new MouseEvent(`click`)):n===`p`?Ot.onClick?.(new MouseEvent(`click`)):n===`g`&&Nt())};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[tt,et,Qe,U,Ut,Ot,Nt]);let Sn=(0,K.useCallback)(e=>{let t=e?.silent??!0;if(!PT(k??null,U,He))return null;let n=FT(o,k??null);if(n)return n;n=crypto.getRandomValues(new Uint32Array(4)).join(``);try{let e=new URL(window.location.href);e.searchParams.set(`t`,n),t?window.history.replaceState(null,``,`${e.pathname}${e.search}${e.hash}`):r(`${e.pathname}${e.search}${e.hash}`,{replace:!0})}catch{}return E(e=>e&&{...e,transferNonce:n}),Me(`active`),n},[k,U,He,o,E,r,Me]),[Cn,wn]=(0,K.useState)(0),Tn=(0,K.useCallback)(async()=>{if(!Zt)return SC(_,`Verify Stewardship first`);if(!k)return SC(_,`No payload`);if(W)return;let e=A||PE(),t=Number(Cn)||0;if(t<=0)return SC(_,`Enter an amount > 0`);let n=PT(k??null,U,He),r=FT(o,k??null);if(r||=Sn({silent:!0})||null,!n||!r)return SC(_,`Link not initialized`);if(Ne&&Ne!==r)return SC(_,`Archived link — cannot exhale from here`);G(!0);let{ok:i,id:a}=vE(n,r,e);if(me.current=a,!i)return G(!1),SC(_,`Another exhale is in progress`);try{let{merged:e}=CT(n,new URLSearchParams(window.location.search),r),i=wE({originalAmount:typeof e.originalAmount==`number`?e.originalAmount:typeof k?.originalAmount==`number`?k.originalAmount:qe?.valuePhi??0,debits:Array.isArray(e.debits)?e.debits:[]});if(t>Math.max(0,(i.originalAmount??0)-xE(i.debits||[]))+fE)return SC(_,`Amount exceeds available`);let a=await _n();if(!a)return SC(_,`Could not derive Φkey`);let o={amount:Number(t.toFixed(6)),nonce:crypto.getRandomValues(new Uint32Array(4)).join(``),recipientPhiKey:a,timestamp:A||PE()};ST(wE({originalAmount:i.originalAmount,debits:[...i.debits??[],o]}),n,r,{broadcast:!0});let{merged:s}=CT(n,new URLSearchParams(window.location.search),r),c=wE(s);if(!(c.debits??[]).some(e=>e.nonce===o.nonce)){SC(_,`Exhale conflicted — try again`);return}E(e=>{if(!e)return e;let t={...e};return t.originalAmount=typeof c.originalAmount==`number`?c.originalAmount:typeof t.originalAmount==`number`?t.originalAmount:qe?.valuePhi??0,t.debits=Array.isArray(c.debits)?c.debits:[],t.totalDebited=xE(t.debits),t}),wn(0),SC(_,`Sent ${AC(o.amount)} Φ`),xn(o.amount,r)}finally{yE(n,r,me.current,A),G(!1)}},[Zt,k,k?.originalAmount,qe?.valuePhi,Cn,Ne,U,He,o,E,_n,xn,wn,W,Sn]),En=Ct||Re||kt||Te||be&&Qt;(0,K.useEffect)(()=>{let e=`bp-open`;return En?document.body.classList.add(e):document.body.classList.remove(e),()=>document.body.classList.remove(e)},[En]);let[Dn,On]=(0,K.useState)(!1),kn=(0,K.useCallback)(()=>{On(!0),window.setTimeout(()=>On(!1),2e3)},[]),An=le(()=>{et(U||``,`Hash copied`)}),jn=le(async()=>{await et(Qe,`Link copied`)&&kn()}),Mn=le(()=>{tt()}),Nn=(0,q.jsxs)(ye,{frameRef:b,children:[!Gt&&!Kt&&k&&(0,q.jsx)(`div`,{id:`sigil-stage`,style:{position:`relative`,width:v,height:v,margin:`0 auto`},children:(0,q.jsx)(ne,{pulse:qt,beat:Jt,stepPct:yt,chakraDay:gt,size:v,hashMode:`deterministic`,origin:``,onReady:Wt})}),Gt&&(0,q.jsx)(`div`,{className:`sp-skeleton`,"aria-hidden":`true`}),Kt&&(0,q.jsx)(`div`,{className:`sp-error`,children:s===`notfound`?`Waiting for SVG upload or ?p= payload.`:`Unable to load sigil.`})]}),Pn=k?.lineage??[],Fn=(0,K.useCallback)((e,t)=>{let n=e=>typeof e==`object`&&!!e,r=e=>{if(typeof t==`string`)return t;if(!n(e))return``;let r=typeof e.reason==`string`?e.reason:``,i=n(e.detail)?e.detail:null,a=i&&typeof i.reason==`string`?i.reason:``;return r||a||``},i=e=>{if(!n(e))return null;let t=e.target;return t instanceof HTMLElement?t:null},a=r(e),o=i(e),s=a===`closeClick`||a===`close-button`||a===`explicit`||a===`close`,c=!!o?.closest?.(`[data-modal-close],[data-close],.sealmoment__close,.sp-modal__close,button[aria-label="Close"],button[aria-label="close"],button[title="Close"]`);if(s||c||e==null&&t==null){Ee(!1),Oe(``),Ae(``);return}},[]);return(0,q.jsxs)(`main`,{className:`sigilpage`,role:`main`,"aria-label":`Kai Sigil Page`,"data-owner-verified":Zt,"data-archived":Xt,"data-old-link":ct?`true`:`false`,"data-version":`v48`,children:[(0,q.jsx)(`div`,{className:`sp-veil`,"aria-hidden":`true`}),(0,q.jsx)(`div`,{className:`sp-veil-stars`,"aria-hidden":`true`}),(0,q.jsx)(`div`,{className:`sp-viewport`,"aria-hidden":!1,children:(0,q.jsxs)(`section`,{className:`sp-shell`,"data-center":!0,children:[(0,q.jsx)(ve,{glyphAuth:l,linkStatus:je,isArchived:Xt,localHash:U,copyHashPress:An}),(l===`authentic`||s===`verified`)&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`style`,{children:` +`;return typeof a==`function`&&a(null,p),p}})),Qw=k(a((e=>{var t=Tw(),n=Jw(),r=Xw(),i=Zw();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))(),1);const $w=1024,eT=2048,tT=1200;function nT(e,t){let n=e.querySelector(`defs`);n||(n=e.ownerDocument.createElementNS(me.SVG_NS,`defs`),e.insertBefore(n,e.firstChild));let r=`ep-neon-glow`;if(!e.querySelector(`#${r}`)){let t=e.ownerDocument.createElementNS(me.SVG_NS,`filter`);t.setAttribute(`id`,r),t.setAttribute(`x`,`-50%`),t.setAttribute(`y`,`-50%`),t.setAttribute(`width`,`200%`),t.setAttribute(`height`,`200%`);let i=e.ownerDocument.createElementNS(me.SVG_NS,`feGaussianBlur`);i.setAttribute(`stdDeviation`,`3`),i.setAttribute(`result`,`b1`);let a=e.ownerDocument.createElementNS(me.SVG_NS,`feGaussianBlur`);a.setAttribute(`in`,`SourceGraphic`),a.setAttribute(`stdDeviation`,`1.2`),a.setAttribute(`result`,`b2`);let o=e.ownerDocument.createElementNS(me.SVG_NS,`feMerge`),s=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);s.setAttribute(`in`,`b1`);let c=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);c.setAttribute(`in`,`b2`);let l=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);l.setAttribute(`in`,`SourceGraphic`),o.appendChild(s),o.appendChild(c),o.appendChild(l),t.appendChild(i),t.appendChild(a),t.appendChild(o),n.appendChild(t)}let i=`ep-gloss-gradient`;if(!e.querySelector(`#${i}`)){let t=e.ownerDocument.createElementNS(me.SVG_NS,`linearGradient`);t.setAttribute(`id`,i),t.setAttribute(`x1`,`0`),t.setAttribute(`y1`,`0`),t.setAttribute(`x2`,`0`),t.setAttribute(`y2`,`1`);let r=e.ownerDocument.createElementNS(me.SVG_NS,`stop`);r.setAttribute(`offset`,`0%`),r.setAttribute(`stop-color`,`rgba(255,255,255,0.15)`);let a=e.ownerDocument.createElementNS(me.SVG_NS,`stop`);a.setAttribute(`offset`,`100%`),a.setAttribute(`stop-color`,`rgba(255,255,255,0.05)`),t.appendChild(r),t.appendChild(a),n.appendChild(t)}let a=`ep-bar-outer-glow`;if(!e.querySelector(`#${a}`)){let r=e.ownerDocument.createElementNS(me.SVG_NS,`filter`);r.setAttribute(`id`,a),r.setAttribute(`x`,`-50%`),r.setAttribute(`y`,`-50%`),r.setAttribute(`width`,`200%`),r.setAttribute(`height`,`200%`);let i=e.ownerDocument.createElementNS(me.SVG_NS,`feFlood`);i.setAttribute(`flood-color`,t),i.setAttribute(`flood-opacity`,`0.5`),i.setAttribute(`result`,`c`);let o=e.ownerDocument.createElementNS(me.SVG_NS,`feComposite`);o.setAttribute(`in`,`c`),o.setAttribute(`in2`,`SourceAlpha`),o.setAttribute(`operator`,`in`),o.setAttribute(`result`,`glow`);let s=e.ownerDocument.createElementNS(me.SVG_NS,`feGaussianBlur`);s.setAttribute(`in`,`glow`),s.setAttribute(`stdDeviation`,`4`),s.setAttribute(`result`,`blurGlow`);let c=e.ownerDocument.createElementNS(me.SVG_NS,`feMerge`),l=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);l.setAttribute(`in`,`blurGlow`);let u=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);u.setAttribute(`in`,`SourceGraphic`),c.appendChild(l),c.appendChild(u),r.appendChild(i),r.appendChild(o),r.appendChild(s),r.appendChild(c),n.appendChild(r)}return{neonId:`ep-neon-glow`,glossId:`ep-gloss-gradient`,barGlowId:`ep-bar-outer-glow`}}async function rT(e,t){let{accent:n,qrUrl:r}=t,i=(e.getAttribute(`viewBox`)||`0 0 ${e.getAttribute(`width`)||1024} ${e.getAttribute(`height`)||1024}`).trim().split(/\s+/).map(Number),a=i[0]||0,o=i[1]||0,s=i[2]||1024,c=i[3]||1024,l=e.ownerDocument.createElementNS(me.SVG_NS,`g`);l.setAttribute(`data-export-qr`,`1`);let u=Math.min(s,c),d=Math.max(u*.035,18),f=Math.max(u*.1,96),p=await Qw.toDataURL(r,{margin:0,color:{dark:n,light:`#00000000`},scale:8}),m=e.ownerDocument.createElementNS(me.SVG_NS,`image`);m.setAttributeNS(me.XLINK_NS,`xlink:href`,p),m.setAttribute(`href`,p),m.setAttribute(`x`,String(a+d)),m.setAttribute(`y`,String(o+c-f-d)),m.setAttribute(`width`,String(f)),m.setAttribute(`height`,String(f)),m.setAttribute(`preserveAspectRatio`,`xMidYMid meet`),l.appendChild(m),e.appendChild(l)}async function iT(e,t=$w,n){let r=e.cloneNode(!0);if(de(r,t),H(r),G(r,n?.title||`Kairos Sigil-Glyph — Sealed Kairos Moment`,n?.desc||`Deterministic sigil-glyph with sovereign metadata.`),n?.metaOverride){let e=W(r);e.textContent=JSON.stringify(n.metaOverride)}if(r.querySelectorAll(`[data-export-qr="1"],[data-export-pulsebar="1"]`).forEach(e=>e.parentNode?.removeChild(e)),n?.addQR&&await rT(r,n.addQR),n?.addPulseBar){let{accent:e,pulseNumber:i}=n.addPulseBar,{barGlowId:a,neonId:o,glossId:s}=nT(r,e),c=(r.getAttribute(`viewBox`)||`0 0 ${t} ${t}`).split(/\s+/).map(Number),[l,u,d,f]=[c[0]||0,c[1]||0,c[2]||t,c[3]||t],p=r.ownerDocument.createElementNS(me.SVG_NS,`g`);p.setAttribute(`data-export-pulsebar`,`1`);let m=Math.min(d,f),h=Math.max(m*.035,18),g=Math.max(m*.34,320),_=Math.max(m*.085,96),v=Math.max(_*.22,18),y=l+d-g-h,b=u+f-_-h,x=r.ownerDocument.createElementNS(me.SVG_NS,`rect`);x.setAttribute(`x`,String(y)),x.setAttribute(`y`,String(b)),x.setAttribute(`rx`,String(v)),x.setAttribute(`ry`,String(v)),x.setAttribute(`width`,String(g)),x.setAttribute(`height`,String(_)),x.setAttribute(`fill`,`url(#${s})`),x.setAttribute(`stroke`,`rgba(255,255,255,0.16)`),x.setAttribute(`stroke-width`,String(Math.max(1.5,m*.0018))),x.setAttribute(`filter`,`url(#${a})`),p.appendChild(x);let S=r.ownerDocument.createElementNS(me.SVG_NS,`text`);S.setAttribute(`x`,String(y+g/2)),S.setAttribute(`y`,String(b+_/2+Math.max(6,_*.06))),S.setAttribute(`text-anchor`,`middle`),S.setAttribute(`dominant-baseline`,`middle`),S.setAttribute(`fill`,e),S.setAttribute(`filter`,`url(#${o})`),S.setAttribute(`font-weight`,`900`),S.setAttribute(`font-family`,`Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto, Helvetica Neue, Arial`),S.setAttribute(`font-size`,String(Math.floor(_*.46))),S.textContent=i.toLocaleString(),p.appendChild(S),r.appendChild(p)}let i=new XMLSerializer().serializeToString(r),a=i.startsWith(`\n${i}`;return new Blob([a],{type:`image/svg+xml;charset=utf-8`})}async function aT(e,t=$w){let n=URL.createObjectURL(e);try{let e=new Image;await new Promise((t,r)=>{e.onload=()=>t(),e.onerror=r,e.src=n});let r=document.createElement(`canvas`);r.width=t,r.height=t;let i=r.getContext(`2d`);if(!i)throw Error(`Canvas unsupported`);return i.drawImage(e,0,0,t,t),await new Promise((e,t)=>r.toBlob(n=>n?e(n):t(Error(`PNG encode failed`)),`image/png`))}finally{URL.revokeObjectURL(n)}}var oT=()=>{let e=N();return e<=0n?0:e>BigInt(2**53-1)?2**53-1:Number(e)};const sT=`sigil-debits-v1`,cT=(e,t)=>t?`sigil:debits:${e}:t:${t}`:`sigil:debits:${e}`,lT=(e,t)=>e===cT(t)||e.startsWith(`${cT(t)}:t:`),uT=(e,t)=>{let n=`sigil:debits:${t}`;if(e===n)return null;let r=`${n}:t:`;return e.startsWith(r)?e.slice(r.length):void 0};function dT(e){let t=new TextEncoder().encode(e),n=``;for(let e=0;e0&&typeof t.recipientPhiKey==`string`&&t.recipientPhiKey.length>0&&typeof t.amount==`number`&&Number.isFinite(t.amount)&&t.amount>0&&typeof t.timestamp==`number`&&Number.isFinite(t.timestamp)}function hT(e){if(!e)return null;try{let t=JSON.parse(fT(e));if(typeof t!=`object`||!t)return null;let n={},r=t;if(typeof r.originalAmount==`number`&&Number.isFinite(r.originalAmount)&&(n.originalAmount=r.originalAmount),Array.isArray(r.debits)){let e=[];for(let t of r.debits)mT(t)&&e.push(t);e.length&&(n.debits=e)}return n}catch{return null}}function gT(e,t){try{let n=new URL(window.location.href),r=typeof e.originalAmount==`number`&&Number.isFinite(e.originalAmount),i=Array.isArray(e.debits)&&e.debits.length>0;!r&&!i?n.searchParams.delete(`d`):n.searchParams.set(`d`,pT(e));let a=`${n.pathname}${n.search}${n.hash}`;t?.navigate?window.location.replace(a):window.history.replaceState(null,``,a)}catch{}}function _T(e,t){let n=(e||``).toLowerCase();if(!n)return null;try{let e=t?localStorage.getItem(cT(n,t)):null;if(e)return hT(e);let r=localStorage.getItem(cT(n));return r?hT(r):null}catch{return null}}function vT(e,t,n){let r=(e||``).toLowerCase();if(r)try{localStorage.setItem(cT(r,n??null),pT(t))}catch{}}function yT(e){let t=new Set,n=[];for(let r of e)!r||typeof r.nonce!=`string`||t.has(r.nonce)||(t.add(r.nonce),n.push(r));return n.sort((e,t)=>(e.timestamp||0)-(t.timestamp||0))}function bT(e,t){let n={},r=typeof e?.originalAmount==`number`?e.originalAmount:void 0,i=typeof t?.originalAmount==`number`?t.originalAmount:void 0;n.originalAmount=typeof r==`number`?r:typeof i==`number`?i:void 0;let a=Array.isArray(e?.debits)?e.debits:[],o=Array.isArray(t?.debits)?t.debits:[],s=yT([...a,...o]);return s.length&&(n.debits=s),n}function xT(e,t){let n=typeof e?.originalAmount==`number`&&Number.isFinite(e.originalAmount)?Number(e.originalAmount):NaN,r=typeof t?.originalAmount==`number`&&Number.isFinite(t.originalAmount)?Number(t.originalAmount):NaN,i=Number.isNaN(n)&&Number.isNaN(r)||Math.abs(n-r)<1e-12,a=new Set((Array.isArray(e?.debits)?e.debits:[]).map(e=>e?.nonce)),o=new Set((Array.isArray(t?.debits)?t.debits:[]).map(e=>e?.nonce));if(!i||a.size!==o.size)return!1;for(let e of a)if(!o.has(e))return!1;return!0}function ST(e,t,n,r){gT(e,{navigate:!!r?.navigate});let i=(t||``).toLowerCase();if(i&&(vT(i,e,n??null),r?.broadcast!==!1))try{let t=new BroadcastChannel(sT),r={type:`debits`,canonical:i,qs:pT(e),stamp:oT(),token:n??null};t.postMessage(r),t.close()}catch{}}function CT(e,t,n){let r=hT(t.get(`d`)),i=bT(n?_T(e,n):_T(e,null),r);return{merged:i,urlIsStale:!xT(i,r)}}function wT(e){try{let t=new URL(e,window.location.origin).pathname.match(/\/s\/([0-9a-fA-F]+)/);return t?t[1].toLowerCase():null}catch{return null}}function TT(e){if(typeof e==`string`)switch(e.trim().toLowerCase().replace(/\s+/g,` `)){case`root`:return`Root`;case`sacral`:return`Sacral`;case`solar plexus`:case`solarplexus`:return`Solar Plexus`;case`heart`:return`Heart`;case`throat`:return`Throat`;case`third eye`:case`thirdeye`:return`Third Eye`;case`crown`:return`Crown`;default:return}}function ET(e){return e===`breaths`||e===`steps`?e:void 0}var DT=e=>!!e&&typeof e==`object`,OT=e=>{if(!DT(e))return!1;let t=`u`in e&&`b`in e,n=`d`in e;return t||n},kT=e=>typeof e==`number`&&Number.isFinite(e)?e:void 0,AT=e=>typeof e==`string`&&e.trim()?e:void 0;function jT(e){if(!e)return{};try{let t=String(e).trim(),n=!1;/^c:/i.test(t)&&(t=t.slice(2),n=!0);let r=JSON.parse(fT(t));if(n||OT(r)){let e=r,t={},n=kT(e.u),i=kT(e.b),a=kT(e.d),o=kT(e.s),s=TT(e.c);return n!==void 0&&(t.pulse=n),i!==void 0&&(t.beat=i),a!==void 0&&(t.stepsPerBeat=a),o!==void 0&&(t.stepIndex=o),s!==void 0&&(t.chakraDay=s),t}if(DT(r)){let e=r,t={},n=kT(e.pulse),i=kT(e.beat),a=kT(e.stepsPerBeat),o=kT(e.stepIndex),s=TT(e.chakraDay),c=AT(e.canonicalHash),l=AT(e.kaiSignature),u=AT(e.userPhiKey),d=AT(e.transferNonce),f=kT(e.expiresAtPulse),p=ET(e.claimExtendUnit),m=kT(e.claimExtendAmount);return n!==void 0&&(t.pulse=n),i!==void 0&&(t.beat=i),a!==void 0&&(t.stepsPerBeat=a),o!==void 0&&(t.stepIndex=o),s!==void 0&&(t.chakraDay=s),c!==void 0&&(t.canonicalHash=c.toLowerCase()),l!==void 0&&(t.kaiSignature=l),u!==void 0&&(t.userPhiKey=u),d!==void 0&&(t.transferNonce=d),f!==void 0&&(t.expiresAtPulse=f),p!==void 0&&(t.claimExtendUnit=p),m!==void 0&&(t.claimExtendAmount=m),Array.isArray(e.lineage)&&(t.lineage=e.lineage),t}return{}}catch{return{}}}function MT(e,t){let n={...e};typeof t.expiresAtPulse==`number`&&(n.expiresAtPulse=t.expiresAtPulse),t.claimExtendUnit!=null&&(n.claimExtendUnit=t.claimExtendUnit),typeof t.claimExtendAmount==`number`&&(n.claimExtendAmount=t.claimExtendAmount),typeof t.pulse==`number`&&(n.pulse=t.pulse),typeof t.beat==`number`&&(n.beat=t.beat),typeof t.stepsPerBeat==`number`&&(n.stepsPerBeat=t.stepsPerBeat),t.chakraDay!==void 0&&(n.chakraDay=t.chakraDay),t.canonicalHash&&(n.canonicalHash=String(t.canonicalHash).toLowerCase()),t.kaiSignature&&(n.kaiSignature=t.kaiSignature),t.userPhiKey&&(n.userPhiKey=t.userPhiKey),t.transferNonce&&(n.transferNonce=t.transferNonce),Array.isArray(t.lineage)&&(n.lineage=t.lineage);let r=typeof n.stepsPerBeat==`number`&&Number.isFinite(n.stepsPerBeat)?n.stepsPerBeat:44,i=kT(t?.stepIndex),a=kT(n.stepIndex);return i===void 0?a===void 0?typeof n.pulse==`number`&&Number.isFinite(n.pulse)&&(n.stepIndex=p(n.pulse,r)):n.stepIndex=a:n.stepIndex=i,n}function NT(e,t){try{let n=new URL(e,window.location.origin),r=MT(jT(n.searchParams.get(`p`)),t);return r.canonicalHash&&=String(r.canonicalHash).toLowerCase(),n.searchParams.set(`p`,dT(JSON.stringify(r))),n.toString()}catch{return e}}function PT(e,t,n){let r=[e?.canonicalHash,t,n?.matchedHash];for(let e of r)if(typeof e==`string`&&e.trim())return e.toLowerCase();return null}function FT(e,t){return typeof e==`string`&&e.trim()?e:typeof t?.transferNonce==`string`&&t.transferNonce.trim()?t.transferNonce:null}async function IT(t){let{stageEl:n,payload:r,localHash:i,routeHash:a,qr:o,onToast:s}=t;if(!n)return s(`No stage found`);try{let t=(await m(async()=>{let{default:t}=await import(`./html2canvas-qXP-r0eN.js`).then(e(1));return{default:t}},__vite__mapDeps([0,1,2,3]))).default,l=await t(n,{backgroundColor:null}),u=document.createElement(`canvas`);u.width=eT,u.height=eT;let d=u.getContext(`2d`);if(!d)throw Error(`No canvas context`);d.clearRect(0,0,u.width,u.height);let f=Math.floor(eT*.06),p=eT-f*2,h=eT-f*2,g=l.width,_=l.height,v=Math.min(p/g,h/_),y=Math.floor(g*v),b=Math.floor(_*v),x=Math.floor((eT-y)/2),S=Math.floor((eT-b)/2);d.drawImage(l,x,S,y,b);let C=r?.chakraDay??`Throat`,w=dC[C]?.accent||`#00FFD0`,T=kC(C,typeof r?.stepPct==`number`?r.stepPct:r?r.pulse%11/11:0,i||void 0),E=Math.max(eT*.33,720),D=Math.max(eT*.08,160),O=Math.max(D*.24,30),k=eT-E-f,A=eT-D-f;d.save(),d.shadowColor=w,d.shadowBlur=Math.max(18,Math.floor(eT*.012));let j=d.createLinearGradient(0,A,0,A+D);j.addColorStop(0,`rgba(255,255,255,0.16)`),j.addColorStop(1,`rgba(255,255,255,0.05)`),c(d,k,A,E,D,O),d.fillStyle=j,d.fill(),d.shadowBlur=0,d.lineWidth=Math.max(2,Math.floor(eT*.0016)),d.strokeStyle=`rgba(255,255,255,0.18)`,d.stroke();let M=(r?.pulse??0).toLocaleString();d.textBaseline=`alphabetic`,d.fillStyle=T,d.font=`900 ${Math.floor(D*.48)}px Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto, Helvetica Neue, Arial`,d.shadowColor=T,d.shadowBlur=Math.max(16,Math.floor(eT*.008));let N=d.measureText(M).width,P=Math.floor(k+E/2-N/2),F=Math.floor(A+D/2+D*.18);d.fillText(M,P,F),d.restore();let I=Math.floor(eT*.32),ee=Math.floor((eT-I)/2),L=Math.floor((eT-I)/2),R=LT({provided:o.url,payload:r,localHash:i,routeHash:a}),te=(0,ZC.renderToStaticMarkup)((0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 1000 1000`,children:(0,q.jsx)(ww,{uid:o.uid,url:R,size:800,phaseHue:o.hue,phaseColor:o.accent,animate:!1,pulseMs:5236})})),z=new Blob([te],{type:`image/svg+xml;charset=utf-8`}),ne=URL.createObjectURL(z);await new Promise((e,t)=>{let n=new Image;n.onload=()=>{try{d.drawImage(n,ee,L,I,I)}finally{URL.revokeObjectURL(ne),e()}},n.onerror=e=>{URL.revokeObjectURL(ne),t(e)},n.src=ne});let re=u.toDataURL(`image/png`),B=document.createElement(`a`);B.href=re,B.download=`sigil_poster_${(i||a||`mint`).slice(0,16)}.png`,document.body.appendChild(B),B.click(),B.remove(),s(`Public key PNG saved`)}catch(e){console.error(e),s(`Poster export failed`)}function c(e,t,n,r,i,a){e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath()}}function LT(e){let{provided:t,payload:n,localHash:r,routeHash:i}=e,a=t&&RT(t)?t:(typeof window<`u`?window.location.href:``)||``;if(!n)return a;try{let e=(n.canonicalHash||r||i||``).toLowerCase();if(!e)return a;let t=new URL(a,typeof window<`u`?window.location.origin:`https://local.test`);t.pathname=`/s/${e}`;let o=n.transferNonce||t.searchParams.get(`t`);o&&t.searchParams.set(`t`,o);let s=`${t.pathname}${t.search}${t.hash}`;return NT(s,n)||s}catch{return a}}function RT(e){try{let t=new URL(e,typeof window<`u`?window.location.origin:`https://local.test`);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function zT(e){let t=JSON.stringify(e);return btoa(unescape(encodeURIComponent(t))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function BT(e,t,n){let r=new URL(e,typeof window<`u`?window.location.origin:`http://localhost`);return r.searchParams.set(`p`,zT(t)),n&&r.searchParams.set(`t`,n),r.toString()}function VT(e){switch(String(e??``).trim().toLowerCase()){case`root`:return`Root`;case`sacral`:return`Sacral`;case`solar plexus`:case`solar_plexus`:case`solar-plexus`:return`Solar Plexus`;case`heart`:return`Heart`;case`throat`:return`Throat`;case`third eye`:case`third_eye`:case`third-eye`:return`Third Eye`;case`crown`:return`Crown`;default:return`Root`}}function HT(e,t){let n={pulse:e.pulse,beat:e.beat,chakraDay:VT(e.chakraDay),stepsPerBeat:e.stepsPerBeat??void 0,stepIndex:t,userPhiKey:e.userPhiKey??void 0,kaiSignature:e.kaiSignature??void 0,canonicalHash:e.canonicalHash??void 0,transferNonce:e.transferNonce??void 0,expiresAtPulse:e.expiresAtPulse??void 0,claimExtendUnit:e.claimExtendUnit??void 0,claimExtendAmount:e.claimExtendAmount??void 0,attachment:e.attachment??void 0,provenance:e.provenance??void 0};return Object.keys(n).forEach(e=>{n[e]===void 0&&delete n[e]}),n}function UT(e){return{pulse:e.pulse,beat:e.beat,stepIndex:e.stepIndex,chakraDay:VT(e.chakraDay),stepsPerBeat:e.stepsPerBeat??void 0,userPhiKey:e.userPhiKey??void 0,kaiSignature:e.kaiSignature??void 0}}function WT(e,t){e.setAttribute(`data-share-url`,t),e.querySelectorAll(`a`).forEach(e=>{e.setAttribute(`href`,t);try{e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,t)}catch{}});let n=/\bu=([^·\n\r]+?)(?=\s*·|$)/;e.querySelectorAll(`text`).forEach(e=>{let r=e.textContent||``;n.test(r)&&(e.textContent=r.replace(n,`u=${t}`))})}async function GT(e){let{expired:t,exporting:n,setExporting:r,svgEl:i,payload:a,isFutureSealed:o,linkStatus:c,setToast:l,expiryUnit:u,expiryAmount:d,localHash:f,routeHash:p,transferToken:h,getKaiPulseEternalInt:g,stepIndexFromPulse:_,STEPS_PER_BEAT:v}=e;if(t)return SC(l,`Seal window closed`);if(!n){if(!i)return SC(l,`No SVG found`);if(!a)return SC(l,`No payload`);if(o)return SC(l,`Opens after the moment—claim unlocks then`);if(c!==`active`)return SC(l,`Archived link — cannot claim from here`);try{r(!0);let e=`sigil_${(f||p||`mint`).slice(0,16)}`,t=a.stepsPerBeat??v,n=_(a.pulse,t),o=g(new Date),c=_(o,t),y=HT(a,n),b={...iC(a.userPhiKey||``,a.kaiSignature??void 0,y,`claim`,a.attachment?.name??void 0,o),stepIndex:n,atStepIndex:c},x={...a,exportedAtPulse:o,stepIndex:n,stepsPerBeat:t,provenance:[...a.provenance??[],b],claimExtendUnit:a.claimExtendUnit??u,claimExtendAmount:a.claimExtendAmount??d,canonicalHash:(f||a.canonicalHash||p||null)?.toString()??null},S=await FC(zC(x.pulse,x.beat,n,String(x.chakraDay??``),BC(HT(x,n)))),C=await RC(S),w={...x,kaiSignature:S,userPhiKey:x.userPhiKey||C},T=(f||p||``).toLowerCase(),E=UT({pulse:w.pulse,beat:w.beat,stepIndex:n,chakraDay:w.chakraDay??null,stepsPerBeat:t,userPhiKey:w.userPhiKey??null,kaiSignature:w.kaiSignature??null}),D=BT(s(T,E),E,w.transferNonce??h??void 0),{putMetadata:O}=await m(async()=>{let{putMetadata:e}=await import(`./svgMeta-DRLQd2cj.js`);return{putMetadata:e}},__vite__mapDeps([4,5,2,3])),k={...w,stepsPerBeat:t,shareUrl:D,fullUrl:D};O(i,k);try{i.setAttribute(`data-step-index`,String(n));let e=i.querySelector(`metadata#sigil-display`);e||(e=document.createElementNS(`http://www.w3.org/2000/svg`,`metadata`),e.setAttribute(`id`,`sigil-display`),e.setAttribute(`data-noncanonical`,`1`),i.appendChild(e)),e.textContent=JSON.stringify({stepIndex:n,stepsPerBeat:t})}catch{console.debug(`Display metadata write failed`)}KC(i,w.pulse,w.beat,n),UC(i),WT(i,D);let A=null,j=null;try{let e=new URL(D);A=e.searchParams.get(`p`),j=e.searchParams.get(`t`)}catch{console.debug(`URL parse failed`)}let M=await iT(i,$w,{metaOverride:k,addQR:!1,addPulseBar:!1,title:`Kairos Sigil-Glyph — Sealed KairosMoment`,desc:`Deterministic sigil-glyph with sovereign metadata. Exported as archived key.`}),N=await aT(M,$w),P=new(await(CC()));P.file(`${e}.svg`,M),P.file(`${e}.png`,N);let F={hash:f||p||``,canonicalHash:w.canonicalHash??null,pulse:w.pulse,beat:w.beat,stepIndex:n,atStepIndex:c,chakraDay:w.chakraDay??null,userPhiKey:w.userPhiKey??null,kaiSignature:w.kaiSignature??null,transferNonce:w.transferNonce??null,expiresAtPulse:w.expiresAtPulse??null,exportedAtPulse:w.exportedAtPulse??null,claimedAtPulse:o,overlays:{qr:!1,eternalPulseBar:!1},claimExtendUnit:w.claimExtendUnit??null,claimExtendAmount:w.claimExtendAmount??null,fullUrl:D,p:A,urlQuery:{p:A,t:j}};P.file(`${e}.manifest.json`,JSON.stringify(F,null,2));let I=await P.generateAsync({type:`blob`}),ee=URL.createObjectURL(I),L=document.createElement(`a`);L.href=ee,L.download=`${e}.zip`,document.body.appendChild(L),L.click(),L.remove(),requestAnimationFrame(()=>URL.revokeObjectURL(ee)),SC(l,`Access key generated`)}catch(e){console.error(e),SC(l,`Claim failed`)}finally{r(!1)}}}function KT(){return(0,K.useMemo)(()=>async e=>{let t=new TextEncoder().encode(e),n=await crypto.subtle.digest(`SHA-256`,t);return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,`0`)).join(``)},[])}function qT({payload:e,urlSearchParams:n,currentPulse:r}){let[a,s]=(0,K.useState)(null),[u,p]=(0,K.useState)(null),[m,g]=(0,K.useState)(null),v=(0,K.useRef)(null),y=(0,K.useRef)(null),b=KT(),x=n?.get(`vpol`)??``;(0,K.useEffect)(()=>{let t=!0;return(async()=>{if(!e||!Number.isFinite(r??NaN)){if(!t)return;s(e=>e===null?e:null),p(e=>e===null?e:null),g(e=>e===null?e:null),v.current=null,y.current=null;return}let{seal:n}=await ae({pulse:e.pulse,kaiPulse:e.pulse,beat:e.beat,stepIndex:e.stepIndex,stepsPerBeat:e.stepsPerBeat,seriesSize:e.seriesSize,quality:e.quality,creatorVerified:e.creatorVerified,creatorRep:e.creatorRep,frequencyHz:e.frequencyHz,chakraDay:e.chakraDay,chakraGate:e.chakraGate,transfers:e.transfers,cumulativeTransfers:e.cumulativeTransfers,segments:e.segments,segmentsMerkleRoot:e.segmentsMerkleRoot,transfersWindowRoot:e.transfersWindowRoot,ip:e.ip,kaiSignature:e.kaiSignature,userPhiKey:e.userPhiKey,valuationPolicyId:x||void 0},r,b);if(!t)return;y.current!==n.stamp&&(s(e=>e&&e.stamp===n.stamp?e:n),y.current=n.stamp);let i=n.valuePhi,a=v.current;a!==i&&(p(e=>e===i?e:i),a!=null&&Math.abs(i-a)>1e-9?g(e=>e===`up`&&i>a?e:i>a?`up`:`down`):g(e=>e===null?e:null),v.current=i)})(),()=>{t=!1}},[e,r,x,b]);let S=(0,K.useMemo)(()=>e?.pulse,[e]),C=(0,K.useMemo)(()=>Number.isFinite(S??NaN)?{score:j(S),lines:i(S)}:{score:null,lines:[]},[S]),w=(0,K.useMemo)(()=>{if(!Number.isFinite(S??NaN)||!Number.isFinite(r??NaN))return null;let t=a?.inputs?.pulsesPerBeat?Math.max(1,Math.round(a.inputs.pulsesPerBeat/11)):e?.stepsPerBeat??44,n=a?.inputs?.cadenceRegularity??1,i=a?.inputs?.resonancePhi??.5,s=e?.stepIndex;return o(S,r,{stepsPerBeat:t,cadenceRegularity:n,resonancePhi:i,stepIndexClaimOverride:s})},[S,r,a,e]),T=(0,K.useMemo)(()=>{let t=e?.transfers;return!t||!t.length?[`No closed transfers yet — lineage still forming.`]:_(t,{stepsPerBeat:e?.stepsPerBeat??44})},[e]);return{valSeal:a,livePrice:u,priceFlash:m,rarity:C,oscillation:w,lineageNarrative:T,trust:(0,K.useMemo)(()=>a?B(a.inputs):null,[a]),marketTier:(0,K.useMemo)(()=>Number.isFinite(S??NaN)?h(S,a??void 0):null,[S,a]),kairos:(0,K.useMemo)(()=>Number.isFinite(r??NaN)?{window:l(r,144,1,{stepsPerBeat:e?.stepsPerBeat??44})}:{window:[]},[r,e]),visuals:(0,K.useMemo)(()=>{if(!a||!Number.isFinite(S??NaN))return{spiralSVG:null,scrollSVG:null,scrollText:null,scrollHTML:null};let e=t(S),{scrollSVG:n,scrollText:r}=f(a,{title:`Kai-Sigil Valuation Scroll`});return{spiralSVG:e,scrollSVG:n,scrollText:r,scrollHTML:A(a,{title:`Kai-Sigil Valuation Scroll`})}},[a,S]),audio:(0,K.useMemo)(()=>{if(!Number.isFinite(S??NaN))return{dataURI:null,renderWav:void 0};let{dataURI:e}=c(S,2,44100,{stereo:!0});return{dataURI:e,renderWav:(e=2,t=44100,n)=>c(S,e,t,n)}},[S]),motifSimilarityWith:(0,K.useMemo)(()=>e=>!Number.isFinite(e??NaN)||!Number.isFinite(S??NaN)?null:d(S,e),[S]),helpers:(0,K.useMemo)(()=>({explainRarity:()=>C.lines,explainLineage:()=>T,scanKairos:(t,n,r=1,i)=>l(t,n,r,{stepsPerBeat:i??e?.stepsPerBeat??44}),makeScroll:e=>a?f(a,{title:e??`Kai-Sigil Valuation Scroll`}):null,makeScrollHTML:e=>a?A(a,{title:e}):null,makeSpiral:e=>Number.isFinite(e??S)?t(e??S):null}),[C.lines,T,e,a,S])}}function JT(e){let{stageId:t,payload:n,localHash:r,setOgImgUrl:i,setMeta:a,seoTitle:o,seoDesc:s}=e,c=!1,l=null,u=async()=>{let e=document.getElementById(t);if(!e||!n){i(null),a(`property`,`og:image`,``),a(`property`,`og:image:alt`,``),a(`property`,`og:image:width`,``),a(`property`,`og:image:height`,``),a(`name`,`twitter:image`,``);return}try{let t=n.chakraDay??`Throat`,l=dC[t]?.accent||`#00FFD0`,u=n.pulse||0,f=n.stepsPerBeat??44,p=Math.floor(n.pulse%(f*11)/11),m=kC(t,typeof n.stepPct==`number`?n.stepPct:n.pulse%11/11,r||void 0),h=`Pulse ${u.toLocaleString()} • Beat ${n.beat}/36 • Step ${p+1}/${f} • ${t}`,g=await(0,ge.default)(e),_=document.createElement(`canvas`);_.width=tT,_.height=630;let v=_.getContext(`2d`);if(!v)throw Error(`Canvas unsupported`);let y=v.createLinearGradient(0,0,tT,630);y.addColorStop(0,`rgba(0,0,0,0.92)`),y.addColorStop(1,`rgba(0,0,0,0.70)`),v.fillStyle=y,v.fillRect(0,0,tT,630),v.save(),v.globalCompositeOperation=`lighter`;let b=v.createRadialGradient(tT*.8,630*.2,20,tT*.8,630*.2,600);b.addColorStop(0,`${l}CC`),b.addColorStop(1,`rgba(0,0,0,0)`),v.fillStyle=b,v.beginPath(),v.arc(tT*.8,630*.2,600,0,Math.PI*2),v.fill(),v.restore();let x=Math.floor(tT*.52),S=Math.min(x/g.width,558/g.height),C=Math.floor(g.width*S),w=Math.floor(g.height*S),T=36+Math.floor((x-C)/2),E=36+Math.floor((558-w)/2);v.drawImage(g,T,E,C,w);let D=36+x+32,O=tT-D-36;v.fillStyle=`#EAFBFF`,v.font=`700 38px Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto`,v.fillText(`Kairos Sigil-Glyph — Sealed Kairos Moment`,D,94),v.fillStyle=`rgba(255,255,255,0.82)`,v.font=`400 24px Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto`,d(v,`“${o}” — ${s}`,D,136,O,30);let k=`${u.toLocaleString()}`;v.textBaseline=`alphabetic`,v.font=`900 120px Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto`,v.shadowColor=m,v.shadowBlur=20,v.fillStyle=m;let A=v.measureText(k).width,j=D+Math.floor((O-A)/2);v.fillText(k,j,554),v.shadowBlur=0;let M=_.toDataURL(`image/png`);if(c)return;i(M),a(`property`,`og:image`,M),a(`property`,`og:image:alt`,h),a(`property`,`og:image:type`,`image/png`),a(`property`,`og:image:width`,`1200`),a(`property`,`og:image:height`,`630`),a(`name`,`twitter:image`,M)}catch{if(c)return;i(null)}};return l=wC(()=>{c||u()}),()=>{c=!0,l!=null&&TC(l)};function d(e,t,n,r,i,a){let o=t.split(` `),s=``;for(let t=0;ti&&t>0?(e.fillText(s,n,r),s=o[t]+` `,r+=a):s=c}e.fillText(s.trim(),n,r)}}function YT(e){switch(String(e??``).trim().toLowerCase()){case`root`:case`earth`:case`earth gate`:return`Root`;case`sacral`:return`Sacral`;case`solar plexus`:case`solar_plexus`:case`solar-plexus`:return`Solar Plexus`;case`heart`:return`Heart`;case`throat`:return`Throat`;case`third eye`:case`third_eye`:case`third-eye`:return`Third Eye`;case`crown`:return`Crown`;default:return`Root`}}function XT(){return crypto.getRandomValues(new Uint32Array(4)).join(``)}function ZT(e){let{meta:t,stepIndex:n,stepsPerBeat:r}=e;return{pulse:t.pulse,beat:t.beat,stepIndex:n,chakraDay:YT(t.chakraDay),stepsPerBeat:r,userPhiKey:t.userPhiKey??void 0,kaiSignature:t.kaiSignature??void 0}}function QT(e,t,n){let r=e.stepIndex;return typeof r==`number`&&Number.isFinite(r)&&r>=0&&rNumber(N()/1000n),rE=e=>JSON.stringify({canonicalHash:e.canonicalHash,token:e.token,expiresAtPulse:e.expiresAtPulse,issuedAt:e.issuedAt,version:e.version},tE),iE=e=>btoa(String.fromCharCode(...e)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``);const aE=e=>iE(new TextEncoder().encode(rE(e)));async function oE(e){try{let t=await fetch(`/api/sign-claim`,{method:`POST`,headers:{"content-type":`text/plain;charset=UTF-8`},body:rE(e)});if(!t.ok)return null;let n=await t.json();return!n||!n.s||!n.kid?null:{r:n.r??aE(e),s:n.s,kid:n.kid}}catch{return null}}function sE(e,t,n,r){e.searchParams.set(`r`,t),e.searchParams.set(`s`,n),e.searchParams.set(`kid`,r)}function cE(e,t,n,r){pe(e,{registryClaim:aE(t),registrySig:n,registryKid:r})}function lE(e,t,n){return{canonicalHash:t.toLowerCase(),token:n,expiresAtPulse:e.expiresAtPulse??null,issuedAt:nE(),version:1}}function uE(){if(typeof window>`u`||typeof document>`u`){let e=()=>{},t=()=>{};return{openModal:t,closeModal:t,disable:e,teardown:e,destroy:e}}let e=document,t=e.body,n=[`.sp-breathproof__backdrop`,`.stargate-overlay`,`.valuechart-backdrop`,`.sp-modal`,`.ownership-overlay`],r={".sp-breathproof__backdrop":`.sp-breathproof`,".valuechart-backdrop":`.valuechart`,".ownership-overlay":`.ownership-panel`,".stargate-overlay":`.stargate-content, .stargate-frame, .stargate__content`,".sp-modal":`.sp-modal__content, .sp-modal__card, .sp-card`},i={capture:!0,passive:!1},a={capture:!0},o=0,s=0,c=0,l=``,u=``,d=``,f=``,p=``,m=()=>{o===0&&(s=window.scrollY||e.documentElement.scrollTop||0,c=window.scrollX||e.documentElement.scrollLeft||0,l=t.style.top,u=t.style.left,d=t.style.width,f=t.style.position,p=t.style.overflow,t.style.position=`fixed`,t.style.top=`-${s}px`,t.style.left=`-${c}px`,t.style.width=`100%`,t.style.overflow=`hidden`,t.classList.add(`modal-open`,`bp-open`)),o++},h=()=>{o=Math.max(0,o-1),!(o>0)&&(t.style.position=f,t.style.top=l,t.style.left=u,t.style.width=d,t.style.overflow=p,requestAnimationFrame(()=>{window.scrollTo(c,s)}),t.classList.remove(`modal-open`),t.classList.remove(`bp-open`))},g=e=>{if(!e)return!1;let t=window.getComputedStyle(e);return!(t.display===`none`||t.visibility===`hidden`||e.hasAttribute(`hidden`))},_=()=>{let t=[];return n.forEach(n=>{e.querySelectorAll(n).forEach(e=>{g(e)&&t.push(e)})}),t},v=t=>{if(!t)return null;let r=t;for(;r&&r!==e.documentElement;){for(let e of n)if(r.matches(e))return r;r=r.parentElement}return null},y=(e,t)=>{if(!e||!t)return!1;let i=n.find(t=>e.matches(t))||``,a=i?r[i]:``;return a&&e.querySelector(a)?!t.closest(a):t===e},b=()=>{_().length>0?m():h()},x=e=>{e&&(e.classList.add(`is-open`),e.removeAttribute(`hidden`),b())},S=e=>{e&&(e.classList.remove(`is-open`),e.setAttribute(`hidden`,``),b())},C=e=>{let t=e.target;if(!t)return;let n=t.closest(`.sp-breathproof__close, .stargate-exit, .sp-modal__close, .sealmoment__close, [data-modal-close], [data-dismiss="modal"], button[aria-label="Close"], button[aria-label="close"]`);if(n){let t=v(n);t&&(S(t),e.preventDefault(),e.stopPropagation());return}let r=v(t);if(r&&y(r,t)&&r.getAttribute(`data-backdrop-dismiss`)!==`false`){S(r),e.preventDefault(),e.stopPropagation();return}},w=e=>{if(_().length===0)return;let t=e.target;if(!t)return;let n=t.closest(`[data-scroll], .sp-breathproof, .valuechart, .ownership-panel, .sp-modal__content, .sp-card, .stargate-content`);if(!n){e.preventDefault(),e.stopPropagation();return}if(!(n.scrollHeight>n.clientHeight)){e.preventDefault(),e.stopPropagation();return}},T=e=>{if(e.key!==`Escape`)return;let t=_();if(t.length===0)return;let n=t[t.length-1];n.getAttribute(`data-escape-dismiss`)!==`false`&&(S(n),e.preventDefault(),e.stopPropagation())};e.addEventListener(`click`,C,i),e.addEventListener(`pointerup`,C,i),e.addEventListener(`touchend`,C,i),e.addEventListener(`touchmove`,w,i),e.addEventListener(`keydown`,T,i),b();let E=()=>{e.removeEventListener(`click`,C,a),e.removeEventListener(`pointerup`,C,a),e.removeEventListener(`touchend`,C,a),e.removeEventListener(`touchmove`,w,a),e.removeEventListener(`keydown`,T,a);try{o=1,h()}catch{}};return{openModal:x,closeModal:S,disable:E,teardown:E,destroy:E}}var dE=k(ce(),1),fE=1e-9,pE=`sigil-sendlock-v1`,mE=(e,t)=>`sigil:sendlock:${e}:t:${t}`,hE=3,gE={"--phi-url":`url(/assets/phi.svg)`},_E=e=>{try{return new URL(e,window.location.origin).toString()}catch{return e}},vE=(e,t,n)=>{let r=crypto.getRandomValues(new Uint32Array(4)).join(``);if(!e||!t)return{ok:!1,id:r};let i=mE(e.toLowerCase(),t);try{let a=localStorage.getItem(i),o=a?JSON.parse(a):null,s=!o||!Number.isFinite(o.atPulse)||n-o.atPulse>hE;if(!o||s){localStorage.setItem(i,JSON.stringify({id:r,atPulse:n}));try{let i=new BroadcastChannel(pE),a={type:`lock`,canonical:e.toLowerCase(),token:t,id:r,atPulse:n};i.postMessage(a),i.close()}catch{}return{ok:!0,id:r}}}catch{}return{ok:!1,id:r}},yE=(e,t,n,r)=>{if(!e||!t)return;let i=mE(e.toLowerCase(),t);try{let a=localStorage.getItem(i),o=a?JSON.parse(a):null;if(!o||o.id===n){localStorage.removeItem(i);try{let i=new BroadcastChannel(pE),a={type:`unlock`,canonical:e.toLowerCase(),token:t,id:n,atPulse:r};i.postMessage(a),i.close()}catch{}}}catch{}},bE=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.amount==`number`&&Number.isFinite(t.amount)&&t.amount>0&&typeof t.nonce==`string`&&t.nonce.length>0&&typeof t.timestamp==`number`&&Number.isFinite(t.timestamp)&&(typeof t.recipientPhiKey==`string`||t.recipientPhiKey===void 0)},xE=e=>{if(!Array.isArray(e))return 0;let t=0;for(let n of e)bE(n)&&(t+=n.amount);return t},SE=e=>[...e].sort((e,t)=>{let n=(e.timestamp||0)-(t.timestamp||0);return n===0?e.nonce.localeCompare(t.nonce):n}),CE=e=>{let t=new Set,n=[];for(let r of e)bE(r)&&(t.has(r.nonce)||(t.add(r.nonce),n.push(r)));return n},wE=e=>{let t=typeof e.originalAmount==`number`&&Number.isFinite(e.originalAmount)?e.originalAmount:NaN,n=SE(Array.isArray(e.debits)?CE(e.debits):[]);if(!Number.isFinite(t))return{originalAmount:e.originalAmount,debits:n.length?n:void 0};let r=[],i=0;for(let e of n)bE(e)&&i+e.amount<=t+fE&&(r.push(e),i+=e.amount);return{originalAmount:t,debits:r.length?r:void 0}},TE=1000000n,EE=91536000n,DE=17491270421n,OE=e=>e<0n?-e:e,kE=(e,t)=>{let n=e/t,r=e%t*2n;return rt?n+1n:n%2n==0n?n:n+1n},AE=(e,t)=>{if(t<=0n)throw Error(`divRoundTiesToEven: den must be > 0`);return e===0n?0n:(e<0n?-1n:1n)*kE(OE(e),t)},jE=e=>AE(e*EE,DE),ME=e=>{let t=jE(e);return BigInt(x)+t},NE=e=>AE((e-BigInt(x))*DE,EE),PE=()=>{let e=N();return Number(e/TE)},FE=()=>{let e=ME(N());return Number(e)},IE=e=>{let t=NE(BigInt(e.getTime()));return Number(t/TE)};function LE(){let[e,t]=(0,K.useState)(()=>PE()),[n,r]=(0,K.useState)(0);return(0,K.useEffect)(()=>{let e=!0,n=null,i=()=>{if(!e)return;let a=N(),o=Number(a/TE),s=a%TE,c=jE(s===0n?TE:TE-s),l=Number(c);t(o),r(l);let u=Math.max(1,Math.min(6e4,l));n=window.setTimeout(i,u)};return i(),()=>{e=!1,n!=null&&window.clearTimeout(n)}},[]),{pulse:e,msToNextPulse:n}}var RE=e=>e===`breaths`||e===`steps`,zE=`sigil-lineage-v1`,BE=(e,t)=>t?`sigil:desc:${e}:t:${t}`:`sigil:desc:${e}`,VE=`sigil-xfer-v1`,HE=e=>`sigil:rotated:${e}`,UE=(e,t)=>{Array.from(new Set(e.map(e=>e.toLowerCase()).filter(Boolean))).forEach(e=>{try{localStorage.setItem(HE(e),`${t}@${FE()}`)}catch{}try{let n=new BroadcastChannel(VE);n.postMessage({type:`rotated`,canonical:e,token:t}),n.close()}catch{}try{window.dispatchEvent(new CustomEvent(`sigil:transfer-rotated`,{detail:{canonical:e,token:t}}))}catch{}})};function WE(e,t){let n=(e||``).toLowerCase();if(!n||!t)return[];try{let e=localStorage.getItem(BE(n,t));if(!e)return[];let r=JSON.parse(e);return Array.isArray(r)?r:[]}catch{return[]}}function GE(e,t,n){let r=(e||``).toLowerCase();if(!(!r||!t))try{localStorage.setItem(BE(r,t),JSON.stringify(n||[]))}catch{}}function KE(e,t,n){try{let r=new BroadcastChannel(zE),i={type:`descendants`,canonical:e.toLowerCase(),token:t,list:n,stamp:FE()};r.postMessage(i),r.close()}catch{}}function qE(){let{hash:e}=ie(),t=oe(),r=C(),i=(e??``).toLowerCase(),a=(0,K.useMemo)(()=>new URLSearchParams(t.search),[t.search]),o=a.get(`t`),[s,c]=(0,K.useState)(`checking`),[l,u]=(0,K.useState)(`checking`),[d,f]=(0,K.useState)(!1),[m,h]=(0,K.useState)(`Awaiting Proof Of Breath™`),[g,_]=(0,K.useState)(``),[v,y]=(0,K.useState)(320),b=(0,K.useRef)(null),{payload:x,setPayload:E,loading:D,setLoading:O}=yC(t.search),k=x,{pulse:A,msToNextPulse:j}=LE(),[M,N]=(0,K.useState)(null),[P,F]=(0,K.useState)(null),[I,L]=(0,K.useState)(!1),[R,te]=(0,K.useState)(``),[z,re]=(0,K.useState)(``),[B,ae]=(0,K.useState)(`breaths`),[ce,H]=(0,K.useState)(44),[U,de]=(0,K.useState)(``),[W,G]=(0,K.useState)(!1),me=(0,K.useRef)(``),ge=(0,K.useMemo)(()=>i?`sigil:legacy-upgraded:${i}`:``,[i]),[be,xe]=(0,K.useState)(!1),[Se,Ce]=(0,K.useState)(!1);(0,K.useEffect)(()=>{if(ge)try{Ce(localStorage.getItem(ge)===`1`)}catch{}},[ge]);let we=(0,K.useCallback)(()=>{if(ge){try{localStorage.setItem(ge,`1`)}catch{}Ce(!0),SC(_,`Upgraded — legacy link locked`)}},[ge]),[Te,Ee]=(0,K.useState)(!1),[De,Oe]=(0,K.useState)(``),[ke,Ae]=(0,K.useState)(``),[je,Me]=(0,K.useState)(`checking`),[Ne,Pe]=(0,K.useState)(null);(0,K.useEffect)(()=>{let e=Array.from(new Set([k?.canonicalHash,i,U].filter(Boolean).map(e=>e.toLowerCase())));if(e.length===0)return;let t=()=>{let t=null;try{for(let n of e){let e=localStorage.getItem(HE(n)),r=e?String(e).split(`@`)[0]:null;if(r){t=r;break}}}catch{}Pe(t)};t();let n=null;try{n=new BroadcastChannel(VE),n.onmessage=t=>{let n=t.data;if(n?.type===`rotated`){let t=(n.canonical||``).toLowerCase();e.includes(t)&&Pe(n.token||null)}}}catch{}let r=n=>{if(n.key){for(let r of e)if(n.key===HE(r)){t();break}}};return window.addEventListener(`storage`,r,{passive:!0}),()=>{if(window.removeEventListener(`storage`,r),n&&typeof n.close==`function`)try{n.close()}catch{}}},[k?.canonicalHash,i,U]);let Fe=(0,K.useCallback)(async(e,t,n,r,i)=>{try{let a=lE(e,t,n),o=await oE(a);if(!o)return r;let s=new URL(r,window.location.origin);return sE(s,o.r,o.s,o.kid),i&&cE(i,a,o.s,o.kid),s.toString()}catch{return r}},[]);(0,K.useEffect)(()=>{let e=null;try{e=new BroadcastChannel(pE),e.onmessage=()=>{}}catch{}return()=>{if(e&&typeof e.close==`function`)try{e.close()}catch{}}},[]),(0,K.useEffect)(()=>{let e=uE();return()=>{e.destroy?.(),e.teardown?.(),e.disable?.()}},[]);let[Ie,Le]=(0,K.useState)(0),[Re,Ve]=(0,K.useState)(!1),[He,Ue]=(0,K.useState)(null),We=(0,K.useMemo)(()=>{let e=[k?.canonicalHash,U,M?.canonicalHash,He?.matchedHash].filter(Boolean).map(e=>e.toLowerCase());return Array.from(new Set(e))},[k?.canonicalHash,U,M?.canonicalHash,He]);(0,K.useLayoutEffect)(()=>{qC()},[]),(0,K.useEffect)(()=>{let e=dC[k?.chakraDay??`Throat`]??{hue:180,accent:`#00FFD0`},t=document.querySelector(`.sigilpage`);t&&(t.style.setProperty(`--crystal-hue`,String(e.hue)),t.style.setProperty(`--crystal-accent`,e.accent))},[k?.chakraDay]);let[Ge,Ke]=(0,K.useState)(null),{valSeal:qe,livePrice:Je,priceFlash:Ye}=qT({payload:k,urlSearchParams:a,currentPulse:A,routeHash:i}),Xe=a.get(`h`)??``;(0,K.useEffect)(()=>{if(!Xe){Ke(e=>e===null?e:null);return}try{let e=n(jC(Xe.trim()));Ke(t=>Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)}catch{Ke(e=>e===null?e:null)}},[Xe]);let Ze=(0,K.useCallback)((e,t)=>{let n=e.stepsPerBeat??44,r=t.stepsPerBeat??44,i=p(e.pulse,n),a=p(t.pulse,r);return e.pulse===t.pulse&&e.beat===t.beat&&i===a&&e.chakraDay===t.chakraDay},[]),Qe=(0,K.useMemo)(()=>typeof window<`u`?new URL(window.location.href).toString():`${`/s/${encodeURIComponent(e??``)}`}${t.search||``}${t.hash||``}`,[e,t.search,t.hash]),$e=(0,K.useMemo)(()=>e?e.slice(0,16):`—`,[e]),et=(0,K.useCallback)(async(e,t=`Copied`)=>{try{return await navigator.clipboard.writeText(e),SC(_,t),!0}catch{return SC(_,`Copy failed`),!1}},[]),tt=(0,K.useCallback)(async()=>{try{let e=navigator;typeof e?.share==`function`?(await e.share({title:`Kairos Sigil-glyph`,text:`Sealed Kairos Moment`,url:Qe}),SC(_,`Share sheet opened`)):await et(Qe,`Link copied`)}catch{}},[Qe,et]);(0,K.useEffect)(()=>{let e=FE(),t=(i||``).toLowerCase();if(Ie>e||!t||We.length===0)return;let n=We.includes(t),r=l,a=s;!n&&U&&t!==U&&!He||!n&&(He||je===`archived`)?r=`authentic`:(r=n?`authentic`:`forged`,s!==`verified`&&(a=n?`ok`:`mismatch`)),r!==l&&u(r),a!==s&&c(a)},[We,i,je,Ie,He,U,l,s]);let[nt,rt]=(0,K.useState)(null),it=(0,K.useDeferredValue)(k),at=(0,K.useMemo)(()=>{let t=it?.stepsPerBeat??44,n=it?p(it.pulse,t):0,r=it?.chakraDay??`Throat`,i=(it?.userPhiKey??``).slice(0,12),a=(it?.pulse??0).toLocaleString();return{title:`Kai Sigil — ${e?e.slice(0,16):`—`}`,desc:it?`Sealed Sigil-Glyph • Pulse ${a} • Beat ${it.beat}/36 • Step ${n+1}/${t} • ${r}${i?` • Owner ${i}…`:``}.`:`Sealed Sigil-Glyph`}},[it,e]),{series:ot}=QS();(0,K.useEffect)(()=>{let e=Qe;document.title=at.title;let t=lC(`canonical`);t.href=e,sC(`name`,`theme-color`,dC[k?.chakraDay??`Throat`]?.accent||`#00FFD0`),sC(`property`,`og:title`,at.title),sC(`property`,`og:description`,at.desc),sC(`property`,`og:type`,`website`),sC(`property`,`og:url`,e),sC(`name`,`twitter:card`,`summary_large_image`),sC(`name`,`twitter:title`,at.title),sC(`name`,`twitter:description`,at.desc),sC(`property`,`og:site_name`,`Kairos Harmonik Kingdom`);let n=k?.stepsPerBeat??44,r=k?p(k.pulse,n):0,i=k,a=k??{},o={"@context":`https://schema.org`,"@type":`VisualArtwork`,name:at.title,description:at.desc,url:e,image:nt||void 0,genre:`Sigil-Glyph`,identifier:[{"@type":`PropertyValue`,name:`pulse`,value:k?.pulse??null},{"@type":`PropertyValue`,name:`beat`,value:k?.beat??null},{"@type":`PropertyValue`,name:`stepIndex`,value:r},{"@type":`PropertyValue`,name:`stepsPerBeat`,value:n},{"@type":`PropertyValue`,name:`chakraDay`,value:k?.chakraDay??null},{"@type":`PropertyValue`,name:`userPhiKey`,value:k?.userPhiKey??null},{"@type":`PropertyValue`,name:`kaiSignature`,value:k?.kaiSignature??null},{"@type":`PropertyValue`,name:`canonicalHash`,value:(k?.canonicalHash??U)||null},{"@type":`PropertyValue`,name:`expiresAtPulse`,value:k?.expiresAtPulse??null},{"@type":`PropertyValue`,name:`transferNonce`,value:new URLSearchParams(location.search).get(`t`)??k?.transferNonce??null},{"@type":`PropertyValue`,name:`claimExtendUnit`,value:RE(a.claimExtendUnit)?a.claimExtendUnit:null},{"@type":`PropertyValue`,name:`claimExtendAmount`,value:a.claimExtendAmount??null},{"@type":`PropertyValue`,name:`historyLiteCount`,value:Ge?.length??0}].filter(e=>e.value!=null)};i?.lineage?.length&&o.identifier.push({"@type":`PropertyValue`,name:`lineageDepth`,value:i.lineage.length}),uC(`sigil-jsonld`,o)},[Qe,at.title,at.desc,k,nt,U,Ge?.length]),(0,K.useEffect)(()=>JT({stageId:`sigil-stage`,payload:k?{...k}:null,localHash:U,setOgImgUrl:rt,setMeta:sC,seoTitle:at.title,seoDesc:at.desc}),[k,U,v,at.title,at.desc]),(0,K.useLayoutEffect)(()=>(document.documentElement.classList.add(`sigil-scroll`),()=>document.documentElement.classList.remove(`sigil-scroll`)),[]),(0,K.useEffect)(()=>{let e=0,t=()=>{cancelAnimationFrame(e),e=requestAnimationFrame(()=>{let e=window.innerWidth,t=window.innerHeight,n=e<640?Math.max(220,Math.min(360,t*.48)):Math.max(160,Math.min(320,t*.35)),r=Math.max(160,Math.min(640,Math.min(e,t-n))),i=b.current?.clientWidth??e,a=Math.max(160,Math.min(640,i-24));y(Math.round(Math.min(r,a)))})},n=b.current??document.body,r=new ResizeObserver(()=>t());return r.observe(n),window.addEventListener(`resize`,t,{passive:!0}),t(),()=>{r.disconnect(),window.removeEventListener(`resize`,t),cancelAnimationFrame(e)}},[]),(0,K.useEffect)(()=>{D?(c(e=>e===`verified`?`verified`:`checking`),u(e=>e===`authentic`?`authentic`:`checking`),f(!1),h(`Awaiting Verifikation`)):k||(c(e=>e===`verified`?`verified`:i?`notfound`:`checking`),u(e=>e===`authentic`?`authentic`:i?`forged`:`checking`))},[D,k,i]);let st=e=>Array.isArray(e)?[...e].map(e=>({nonce:e.nonce,amount:Number.isFinite(e.amount)?Number(e.amount):0,recipient:e.recipientPhiKey??``,ts:e.timestamp??``})).sort((e,t)=>e.nonce.localeCompare(t.nonce)).map(e=>`${e.nonce}:${e.amount}:${e.recipient}:${e.ts}`).join(`|`):``;(0,K.useEffect)(()=>{let e=hT(a.get(`d`));if(!e)return;let t=PT(k??null,U,He),n=FT(o,k??null),r=wE(e);t&&vT(t,r,n);let i=typeof r.originalAmount==`number`?r.originalAmount:void 0,s=Array.isArray(r.debits)?r.debits:void 0;E(e=>{if(!e)return e;let t=e,n=(t.originalAmount??void 0)===i,r=st(t.debits)===st(s);if(n&&r)return e;let a={...e};return i!==void 0&&(a.originalAmount=i),s&&(a.debits=s,a.totalDebited=xE(s)),a})},[a,k,U,He,o,E]);let[ct,lt]=(0,K.useState)(!1);(0,K.useEffect)(()=>{let e=PT(k??null,U,He);if(!e)return;let t=FT(o,k??null),{merged:n,urlIsStale:r}=CT(e,a,t),i=wE(n);r&<(!0),ST(i,e,t,{broadcast:!1,navigate:r});let s=typeof i.originalAmount==`number`?i.originalAmount:void 0,c=Array.isArray(i.debits)?i.debits:void 0;E(e=>{if(!e)return e;let t=e,n=(t.originalAmount??void 0)===s,r=st(t.debits)===st(c);if(n&&r)return e;let i={...e};return s!==void 0&&(i.originalAmount=s),c&&(i.debits=c,i.totalDebited=xE(c)),i})},[k?.canonicalHash,U,He,a,o,E]),(0,K.useEffect)(()=>{if(!k?.canonicalHash)return;let e=k.canonicalHash.toLowerCase();if(i&&e&&e!==i&&je===`active`&&!He){let t=new URL(window.location.href);t.pathname=`/s/${e}`,r(`${t.pathname}${t.search}${t.hash}`,{replace:!0})}},[k?.canonicalHash,i,je,He,r]),(0,K.useEffect)(()=>{if(k&&!k.canonicalHash&&U&&i&&U!==i&&je===`active`&&!He){let e=new URL(window.location.href);e.pathname=`/s/${U}`,r(`${e.pathname}${e.search}${e.hash}`,{replace:!0})}},[k?.canonicalHash,U,i,je,He,r]),(0,K.useEffect)(()=>{let e=We;if(!e.length)return;let t=FT(o,k??null),n=(e,t)=>{let n={};typeof e?.originalAmount==`number`&&(n.originalAmount=e.originalAmount),n.originalAmount===void 0&&typeof t?.originalAmount==`number`&&(n.originalAmount=t.originalAmount);let r=Array.isArray(e?.debits)?e.debits:[],i=Array.isArray(t?.debits)?t.debits:[],a=CE([...r,...i]);return wE({originalAmount:n.originalAmount,debits:a})},r=(e,t)=>{let n=wE(e??{}),r=wE(t??{}),i=typeof n.originalAmount==`number`?n.originalAmount:NaN,a=typeof r.originalAmount==`number`?r.originalAmount:NaN,o=Number.isNaN(i)&&Number.isNaN(a)||Math.abs(i-a)e.nonce)),c=new Set((Array.isArray(r.debits)?r.debits:[]).map(e=>e.nonce));if(!o||s.size!==c.size)return!1;for(let e of s)if(!c.has(e))return!1;return!0},i=(i,a,o)=>{let s=i.toLowerCase();if(!e.includes(s))return;let c=t??null;if(c!==(o??null))return;let l=hT(a);if(!l)return;let u=hT(new URLSearchParams(window.location.search).get(`d`)),d=n(u,l);r(u,d)||(ST(d,s,c,{broadcast:!1}),E(e=>{if(!e)return e;let t={...e};return typeof d.originalAmount==`number`&&(t.originalAmount=d.originalAmount),Array.isArray(d.debits)&&(t.debits=d.debits,t.totalDebited=xE(d.debits)),t}))},a=null;try{a=new BroadcastChannel(sT),a.onmessage=e=>{let t=e.data;t?.type===`debits`&&t.canonical&&t.qs&&i(t.canonical,t.qs,t.token)}}catch{}let s=t=>{if(!(!t.key||typeof t.newValue!=`string`))for(let n of e){if(!lT(t.key,n))continue;let e=uT(t.key,n);i(n,t.newValue,e);break}};return window.addEventListener(`storage`,s,{passive:!0}),()=>{if(window.removeEventListener(`storage`,s),a&&typeof a.close==`function`)try{a.close()}catch{}}},[We,o,k,E]);let ut=(0,K.useMemo)(()=>k?typeof k.expiresAtPulse==`number`?k.expiresAtPulse:k.pulse+11:null,[k]),dt=(0,K.useMemo)(()=>A==null||ut==null?null:Math.max(0,ut-A),[A,ut]),pt=(0,K.useMemo)(()=>dt===0,[dt]),mt=(0,K.useMemo)(()=>A==null||!k?null:Math.max(0,k.pulse-A),[k,A]),ht=(0,K.useMemo)(()=>A==null||!k?!1:k.pulse>A,[k,A]),gt=k?.chakraDay??`Throat`,_t=k?.stepsPerBeat??44,vt=p(k?.pulse??0,_t),yt=typeof k?.stepPct==`number`?Math.max(0,Math.min(1,k.stepPct)):S(k?.pulse??0),bt=(0,K.useMemo)(()=>`hsl(${((dC[gt]?.hue??180)+(U&&/^[0-9a-f]+$/i.test(U)?parseInt(U.slice(-2),16)%12:0)*2.5)%360} 100% ${50+15*Math.sin(yt*2*Math.PI)}%)`,[gt,yt,U]),xt=dC[gt]?.hue??180,St=(0,K.useMemo)(()=>`qr-${(U||i||`seed`).slice(0,12)}-${gt}-${vt}`,[U,i,gt,vt]),[Ct,wt]=(0,K.useState)(!1),[Tt,Dt]=(0,K.useState)(null);(0,K.useEffect)(()=>{let e=!1;return(async()=>{try{if(!k){Dt(null);return}let t=k.stepsPerBeat??44,n=p(k.pulse,t),r=BC(k),i=zC(k.pulse,k.beat,n,String(k.chakraDay??``),r),a=await FC(i),o=await RC(a),s=typeof k.kaiSignature==`string`?k.kaiSignature.toLowerCase()===a.toLowerCase():!0,c=typeof k.userPhiKey==`string`?k.userPhiKey.toLowerCase()===o.toLowerCase():!0,l={pulse:k.pulse,beat:k.beat,stepsPerBeat:t,stepIndex:n,chakraDay:String(k.chakraDay??``),intention:r??null,sigmaString:i,sigmaHash:a,derivedPhiKey:o,payloadKaiSignature:k.kaiSignature??null,payloadUserPhiKey:k.userPhiKey??null,matches:{sigma:s,phi:c}};e||Dt(l)}catch{e||Dt(null)}})(),()=>{e=!0}},[k]);let Ot=le(()=>{IT({stageEl:document.getElementById(`sigil-stage`),payload:k,localHash:U,routeHash:i,qr:{uid:St,url:Qe,hue:xt,accent:bt},onToast:e=>SC(_,e)})}),[kt,At]=(0,K.useState)(!1),[jt,Mt]=(0,K.useState)(``),Nt=(0,K.useCallback)(async()=>{let e=b.current;e&&(Mt((await(0,dE.default)(e,{backgroundColor:null})).toDataURL(`image/png`)),At(!0),fC()||document.querySelector(`.stargate-overlay`)?.requestFullscreen?.().catch(()=>{}))},[]),Pt=(0,K.useCallback)(()=>{At(!1),document.fullscreenElement&&!fC()&&document.exitFullscreen?.().catch(()=>{})},[]),Ft=le(()=>{Nt()}),It=le(()=>{Pt()}),Lt=le(()=>wt(e=>!e)),Rt=le(()=>Ve(!0)),zt=(0,K.useCallback)(async e=>{let t=await e.arrayBuffer(),n=e.type||`application/octet-stream`,r=`data:${n};base64,${xC(t)}`;F({name:e.name,mime:n,size:e.size,dataUri:r}),SC(_,`Remembered ${e.name}`)},[]),Bt=(0,K.useCallback)((e,t)=>{let n=e.stepsPerBeat??44,r=p(e.pulse,n),a=(e.canonicalHash||U||``).toLowerCase(),o=e.claimExtendUnit,s=RE(o)?o:null,c=e.claimExtendAmount,l=typeof c==`number`?c:null,u=$T({pulse:e.pulse,beat:e.beat,chakraDay:e.chakraDay??`Root`,stepsPerBeat:n,stepIndex:r,userPhiKey:e.userPhiKey??null,kaiSignature:e.kaiSignature??null,canonicalHash:a,transferNonce:e.transferNonce??null,expiresAtPulse:e.expiresAtPulse??null,claimExtendUnit:s,claimExtendAmount:l},t,{localHash:U,routeHash:i,stepsPerBeat:44,stepIndexFromPulse:p})?.url||`/s/${a}`;try{let e=new URL(u,window.location.origin);e.pathname=`/s/${a}`;let t=new URLSearchParams(window.location.search).get(`d`);t&&e.searchParams.set(`d`,t),new URL(window.location.href).searchParams.forEach((t,n)=>{n!==`d`&&e.searchParams.set(n,e.searchParams.get(n)??t)}),u=e.toString()}catch{}let d=new URL(u,window.location.origin);d.pathname=`/s/${a}`,new URL(window.location.href).searchParams.forEach((e,t)=>{t!==`d`&&d.searchParams.set(t,d.searchParams.get(t)??e)});let f=wT(u)||a;return Oe(u),Ae(f),Ee(!0),u},[U,i]),Vt=(0,K.useCallback)((e,t,n=!0)=>{let a=e.stepsPerBeat??44,o=p(e.pulse,a),s=e.claimExtendUnit,c=RE(s)?s:`breaths`,l=e.claimExtendAmount,u=typeof l==`number`?l:11;return eE({pulse:e.pulse,beat:e.beat,chakraDay:e.chakraDay??`Root`,stepsPerBeat:a,stepIndex:o,userPhiKey:e.userPhiKey??null,kaiSignature:e.kaiSignature??null,canonicalHash:t,transferNonce:e.transferNonce??null,expiresAtPulse:e.expiresAtPulse??null,claimExtendUnit:c,claimExtendAmount:u},t,{localHash:U,routeHash:i,stepsPerBeat:44,stepIndexFromPulse:p,getKaiPulseEternalInt:IE,breathsToPulses:ue,shareTransferLink:$T,publishRotation:UE,navigate:e=>{if(n)try{r(e)}catch{try{window.location.href=e}catch{}}}})??null},[U,i,r]),Ht=(0,K.useCallback)(async e=>{if(f(!1),h(`Verifying…`),!(/image\/svg\+xml/i.test(e.type)||/\.svg$/i.test(e.name))){h(`Unsupported file. Upload an SVG sigil (.svg) only.`);return}let t=null;try{let{ok:n,errors:r,payload:i,meta:a}=he(await e.text());if(!n||!i){h(r[0]||`Invalid SVG.`);return}t=i,N(a||{})}catch{h(`Invalid or unreadable SVG uploaded.`);return}if(!k||!t){h(`Load or link a sigil first, then verify stewardship.`);return}if(!Ze(k,t)){h(`File does not match this sealed kairos moment.`),f(!1);return}if(t.canonicalHash){let e=t.canonicalHash.toLowerCase(),n=(U||``).toLowerCase(),r=(i||``).toLowerCase(),a=n&&e===n,o=r&&e===r;if(!a&&!o){h(`SVG canonicalHash doesn’t match this link’s hash.`),f(!1);return}if(o&&!a){Ue({reason:`svg.canonicalHash matched route (legacy)`,matchedHash:e}),u(`authentic`),c(`ok`),Me(`archived`),f(!0),h(`Stewardship verified (legacy SVG). Issuing modern link…`),n&&(Vt({...k},n,!0),h(`Legacy verified. Modern transfer link ready.`));return}}if(new Set([o??void 0,k.transferNonce??void 0,t.transferNonce??void 0,Ne??void 0].filter(e=>!!e)).size>1){h(`This is not the active transfer link for that Φkey.`),f(!1);return}f(!0),h(`Stewardship verified`)},[k,Ze,U,i,o,Ne,Vt]),Ut=le(async()=>{if(I)return;let e=b.current?.querySelector(`svg`),t=k??{},n=RE(t.claimExtendUnit)?t.claimExtendUnit:void 0,r=typeof t.claimExtendAmount==`number`?t.claimExtendAmount:null;await GT({expired:!!pt,exporting:I,setExporting:L,svgEl:e,payload:k?{pulse:k.pulse,beat:k.beat,chakraDay:k.chakraDay??null,stepsPerBeat:k.stepsPerBeat??void 0,stepIndex:k.stepIndex??null,exportedAtPulse:k.exportedAtPulse??null,canonicalHash:k.canonicalHash??null,userPhiKey:k.userPhiKey??null,kaiSignature:k.kaiSignature??null,transferNonce:k.transferNonce??null,expiresAtPulse:k.expiresAtPulse??null,claimExtendUnit:n,claimExtendAmount:r,attachment:k.attachment??null,provenance:k.provenance??null}:null,isFutureSealed:ht,linkStatus:je,setToast:e=>SC(_,e),expiryUnit:B,expiryAmount:ce,localHash:U,routeHash:i,transferToken:o??null,getKaiPulseEternalInt:IE,stepIndexFromPulse:p,STEPS_PER_BEAT:44})}),Wt=(0,K.useCallback)(e=>{let t=typeof e==`string`?e:e?.hash;if(!t)return;let n=t.toLowerCase();de(e=>e===n?e:n)},[]),Gt=D&&!k,Kt=s===`notfound`||s===`error`,qt=k?.pulse??0,Jt=k?.beat??0,Yt=((j??0)/1e3).toFixed(3),Xt=je===`archived`,Zt=d&&!Xt,Qt=(0,K.useMemo)(()=>l===`authentic`&&Xt&&!o&&!!i&&!!U&&i!==U,[l,Xt,o,i,U]);(0,K.useEffect)(()=>{if(!k||l!==`authentic`||s===`mismatch`||s===`error`||s===`notfound`)return;let e=!1;return(async()=>{try{let t=k.stepsPerBeat??44,n=p(k.pulse,t),r=BC(k),i=await FC(zC(k.pulse,k.beat,n,String(k.chakraDay??``),r)),a=typeof k.kaiSignature==`string`?k.kaiSignature.toLowerCase()===i.toLowerCase():!0,o=await RC(i),l=typeof k.userPhiKey==`string`?k.userPhiKey.toLowerCase()===o.toLowerCase():!0;!e&&a&&l&&s!==`verified`&&c(`verified`)}catch{}})(),()=>{e=!0}},[k,l,s,je]),(0,K.useEffect)(()=>{let e=(i||``).toLowerCase(),t=o||null,n=k?.transferNonce||null,r=!!t&&!!n&&t===n&&(ut==null||A==null||A{let e=!0;return(async()=>{if(!k){en(``),nn(``);return}let t=(k.canonicalHash||U||``).toLowerCase(),n=A||PE(),r=await JC(k,t,n,T(n),p(n,k.stepsPerBeat??44));e&&(en(r.ownerPhiKey),nn(r.kaiSig))})(),()=>{e=!1}},[k,U]);let rn=(0,K.useCallback)(async e=>{if(e?.preventDefault?.(),e?.stopPropagation?.(),!k||!U||ht||Xt)return;let t=(k.canonicalHash||U||``).toLowerCase(),n=A||PE(),r=await JC(k,t,n,T(n),p(n,k.stepsPerBeat??44));te(r.ownerPhiKey),re(r.kaiSig),setTimeout(()=>{try{sn()}catch{}},0)},[k,U,ht,Xt]),an=(0,K.useCallback)(e=>{let t=`/${e}`;try{window.location.assign(t)}catch{window.location.href=t}},[]),on=(0,K.useCallback)(async()=>{try{let e=await(await fetch(`/verifier.inline.html`,{cache:`no-store`})).text(),t=new Blob([e],{type:`text/html`}),n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=`verifier.html`,document.body.appendChild(n),n.click(),setTimeout(()=>{URL.revokeObjectURL(n.href),n.remove()},0),SC(_,`Downloading verifier…`)}catch{SC(_,`Download failed`)}},[]);({...Lt});let sn=(0,K.useCallback)(()=>{if(!k)return SC(_,`Nothing to mint`);let e=b.current?.querySelector(`svg`);if(!e)return SC(_,`No Φkey in frame`);if(!U)return SC(_,`Glyph hash not ready yet`);if(je!==`active`)return SC(_,`Archived link — cannot exhale from here`);if(ht)return SC(_,`Opens after the moment—claim unlocks then`);let t=rC(M??{},k.pulse),n=(R||k.userPhiKey||``).trim();if(!n)return SC(_,`Owner ΦKey required`);let r=Math.max(0,Math.floor(ce||0)),a=B===`breaths`?ue(r):fe(r),o=A||PE(),s=o+a,c=U.toLowerCase(),l=crypto.getRandomValues(new Uint32Array(4)).join(``),u=k.stepsPerBeat??44,d=p(k.pulse,u),f=p(o,u),m={...iC(n,z||k.kaiSignature,k,t.length?`transfer`:`mint`,(P??k.attachment)?.name,o),stepIndex:d,atStepIndex:f},h={...k,userPhiKey:n,kaiSignature:z||k.kaiSignature,stepsPerBeat:k.stepsPerBeat??44,attachment:P??k.attachment??void 0,expiresAtPulse:s,canonicalHash:c,transferNonce:l,claimExtendUnit:B,claimExtendAmount:r,provenance:[...t,m]};(async()=>{let t=await FC(zC(h.pulse,h.beat,d,String(h.chakraDay??``),BC(h))),n=await RC(t);h.kaiSignature=t,h.userPhiKey=h.userPhiKey||n;let r=Array.from(new Set([k.canonicalHash,i,U].filter(Boolean).map(e=>e.toLowerCase())));r.length&&UE(r,l),Me(`archived`),Le(FE()+250),pe(e,h),UC(e),E(h),N(h),SC(_,`Sealed & archived`);let a=Bt(h,l)||`/s/${c}`;a=await Fe(h,c,l,a,e),Oe(_E(a)),h.canonicalHash&&UE([h.canonicalHash.toLowerCase()],l),setTimeout(()=>Le(0),0)})()},[k,M,R,z,P,ce,B,U,i,je,ht,Bt]),cn=k,ln=(0,K.useMemo)(()=>xE(cn?.debits??[]),[cn?.debits]),un=(0,K.useMemo)(()=>{let e=(typeof cn?.originalAmount==`number`?cn.originalAmount:qe?.valuePhi??0)-ln;return e>0?e:0},[cn?.originalAmount,qe?.valuePhi,ln]),dn=(cn?.debits?.length??0)>0||typeof cn?.originalAmount==`number`,fn=(0,K.useMemo)(()=>dn?un:Je??qe?.valuePhi??0,[dn,un,Je,qe?.valuePhi]),pn=se,{usdPerPhi:mn,phiPerUsd:hn}=(0,K.useMemo)(()=>{try{let e=w({meta:k||{},nowPulse:A||A,usd:100,currentStreakDays:0,lifetimeUsdSoFar:0},pn);return{usdPerPhi:e.usdPerPhi??0,phiPerUsd:e.phiPerUsd??0}}catch{return{usdPerPhi:0,phiPerUsd:0}}},[k,A,pn]),gn=(fn??0)*(mn||0),_n=(0,K.useCallback)(async()=>{if(!k)return``;let e=k.stepsPerBeat??44,t=p(k.pulse,e);return await RC(k.kaiSignature??await FC(zC(k.pulse,k.beat,t,String(k.chakraDay??``),BC(k))))},[k]),[vn,yn]=(0,K.useState)([]),bn=(0,K.useCallback)(()=>{yn(WE(PT(k??null,U,He),FT(o,k??null)))},[k,U,He,o]);(0,K.useEffect)(()=>{bn();let e=null;try{e=new BroadcastChannel(zE),e.onmessage=e=>{let t=e.data;if(!t||t.type!==`descendants`)return;let n=PT(k??null,U,He),r=FT(o,k??null);!n||!r||t.canonical!==n.toLowerCase()||t.token!==r||Array.isArray(t.list)&&yn(t.list)}}catch{}let t=e=>{if(!e.key||!e.newValue)return;let t=PT(k??null,U,He),n=FT(o,k??null);if(!(!t||!n)&&e.key===BE(t,n))try{let t=JSON.parse(e.newValue||`[]`);Array.isArray(t)&&yn(t)}catch{}};return window.addEventListener(`storage`,t,{passive:!0}),()=>{if(e&&typeof e.close==`function`)try{e.close()}catch{}window.removeEventListener(`storage`,t)}},[k,U,He,o,bn]);let xn=(0,K.useCallback)(async(e,t)=>{if(!k)return null;let n=A||PE(),r=crypto.getRandomValues(new Uint32Array(4)).join(``),i=k.stepsPerBeat??44,a=p(k.pulse,i),s=(U||k.canonicalHash||``).toLowerCase(),c=t??FT(o,k??null),l=Array.isArray(k.lineage)?[...k.lineage]:[],u=(l[l.length-1]?.depth??0)+1,d={token:r,parentToken:c??null,amount:Number(e.toFixed(6)),timestamp:n,depth:u,senderPhiKey:k.userPhiKey??null},f={...k,userPhiKey:void 0,originalAmount:Number(e.toFixed(6)),mintedAtPulse:n,transferNonce:r,expiresAtPulse:n+(B===`breaths`?ue(ce):fe(ce)),claimExtendUnit:B,claimExtendAmount:ce,canonicalHash:s,lineage:[...l,d]},m=await FC(zC(f.pulse,f.beat,a,String(f.chakraDay??``),BC(f))),h=await RC(m);f.kaiSignature=m,f.userPhiKey=h;let g=Bt(f,r)||`/s/${s}`;try{let t=new URL(g,window.location.origin);t.pathname=`/s/${s}`,t.searchParams.set(`d`,pT({originalAmount:f.originalAmount}));let i=NT(t.toString(),f);i=await Fe(f,s,r,i);let a=wT(i)||s;vT(a,hT(new URL(i).searchParams.get(`d`))??{},r);let o=PT(k??null,U,He),l=c??null;if(o&&l){let t=[...WE(o,l),{token:r,parentToken:l,amount:Number(e.toFixed(6)),timestamp:n,depth:1,recipientPhiKey:f.userPhiKey}];GE(o,l,t),KE(o,l,t),yn(t)}return Oe(_E(i)),Ae(a),Ee(!0),i}catch{let e=NT(g||`/s/${s}`,f);return Oe(e),Ae(s),Ee(!0),e||null}},[k,B,ce,U,Bt,He,o]);(0,K.useEffect)(()=>{let e=e=>{if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase();return t===`input`||t===`textarea`||e.isContentEditable},t=t=>{if(t.defaultPrevented||e(t.target))return;let n=t.key.toLowerCase();t.metaKey||t.ctrlKey||t.altKey||(n===`s`?tt():n===`l`?et(Qe,`Link copied`):n===`h`?U&&et(U,`Hash copied`):n===`z`?Ut.onClick?.(new MouseEvent(`click`)):n===`p`?Ot.onClick?.(new MouseEvent(`click`)):n===`g`&&Nt())};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[tt,et,Qe,U,Ut,Ot,Nt]);let Sn=(0,K.useCallback)(e=>{let t=e?.silent??!0;if(!PT(k??null,U,He))return null;let n=FT(o,k??null);if(n)return n;n=crypto.getRandomValues(new Uint32Array(4)).join(``);try{let e=new URL(window.location.href);e.searchParams.set(`t`,n),t?window.history.replaceState(null,``,`${e.pathname}${e.search}${e.hash}`):r(`${e.pathname}${e.search}${e.hash}`,{replace:!0})}catch{}return E(e=>e&&{...e,transferNonce:n}),Me(`active`),n},[k,U,He,o,E,r,Me]),[Cn,wn]=(0,K.useState)(0),Tn=(0,K.useCallback)(async()=>{if(!Zt)return SC(_,`Verify Stewardship first`);if(!k)return SC(_,`No payload`);if(W)return;let e=A||PE(),t=Number(Cn)||0;if(t<=0)return SC(_,`Enter an amount > 0`);let n=PT(k??null,U,He),r=FT(o,k??null);if(r||=Sn({silent:!0})||null,!n||!r)return SC(_,`Link not initialized`);if(Ne&&Ne!==r)return SC(_,`Archived link — cannot exhale from here`);G(!0);let{ok:i,id:a}=vE(n,r,e);if(me.current=a,!i)return G(!1),SC(_,`Another exhale is in progress`);try{let{merged:e}=CT(n,new URLSearchParams(window.location.search),r),i=wE({originalAmount:typeof e.originalAmount==`number`?e.originalAmount:typeof k?.originalAmount==`number`?k.originalAmount:qe?.valuePhi??0,debits:Array.isArray(e.debits)?e.debits:[]});if(t>Math.max(0,(i.originalAmount??0)-xE(i.debits||[]))+fE)return SC(_,`Amount exceeds available`);let a=await _n();if(!a)return SC(_,`Could not derive Φkey`);let o={amount:Number(t.toFixed(6)),nonce:crypto.getRandomValues(new Uint32Array(4)).join(``),recipientPhiKey:a,timestamp:A||PE()};ST(wE({originalAmount:i.originalAmount,debits:[...i.debits??[],o]}),n,r,{broadcast:!0});let{merged:s}=CT(n,new URLSearchParams(window.location.search),r),c=wE(s);if(!(c.debits??[]).some(e=>e.nonce===o.nonce)){SC(_,`Exhale conflicted — try again`);return}E(e=>{if(!e)return e;let t={...e};return t.originalAmount=typeof c.originalAmount==`number`?c.originalAmount:typeof t.originalAmount==`number`?t.originalAmount:qe?.valuePhi??0,t.debits=Array.isArray(c.debits)?c.debits:[],t.totalDebited=xE(t.debits),t}),wn(0),SC(_,`Sent ${AC(o.amount)} Φ`),xn(o.amount,r)}finally{yE(n,r,me.current,A),G(!1)}},[Zt,k,k?.originalAmount,qe?.valuePhi,Cn,Ne,U,He,o,E,_n,xn,wn,W,Sn]),En=Ct||Re||kt||Te||be&&Qt;(0,K.useEffect)(()=>{let e=`bp-open`;return En?document.body.classList.add(e):document.body.classList.remove(e),()=>document.body.classList.remove(e)},[En]);let[Dn,On]=(0,K.useState)(!1),kn=(0,K.useCallback)(()=>{On(!0),window.setTimeout(()=>On(!1),2e3)},[]),An=le(()=>{et(U||``,`Hash copied`)}),jn=le(async()=>{await et(Qe,`Link copied`)&&kn()}),Mn=le(()=>{tt()}),Nn=(0,q.jsxs)(ye,{frameRef:b,children:[!Gt&&!Kt&&k&&(0,q.jsx)(`div`,{id:`sigil-stage`,style:{position:`relative`,width:v,height:v,margin:`0 auto`},children:(0,q.jsx)(ne,{pulse:qt,beat:Jt,stepPct:yt,chakraDay:gt,size:v,hashMode:`deterministic`,origin:``,onReady:Wt})}),Gt&&(0,q.jsx)(`div`,{className:`sp-skeleton`,"aria-hidden":`true`}),Kt&&(0,q.jsx)(`div`,{className:`sp-error`,children:s===`notfound`?`Waiting for SVG upload or ?p= payload.`:`Unable to load sigil.`})]}),Pn=k?.lineage??[],Fn=(0,K.useCallback)((e,t)=>{let n=e=>typeof e==`object`&&!!e,r=e=>{if(typeof t==`string`)return t;if(!n(e))return``;let r=typeof e.reason==`string`?e.reason:``,i=n(e.detail)?e.detail:null,a=i&&typeof i.reason==`string`?i.reason:``;return r||a||``},i=e=>{if(!n(e))return null;let t=e.target;return t instanceof HTMLElement?t:null},a=r(e),o=i(e),s=a===`closeClick`||a===`close-button`||a===`explicit`||a===`close`,c=!!o?.closest?.(`[data-modal-close],[data-close],.sealmoment__close,.sp-modal__close,button[aria-label="Close"],button[aria-label="close"],button[title="Close"]`);if(s||c||e==null&&t==null){Ee(!1),Oe(``),Ae(``);return}},[]);return(0,q.jsxs)(`main`,{className:`sigilpage`,role:`main`,"aria-label":`Kai Sigil Page`,"data-owner-verified":Zt,"data-archived":Xt,"data-old-link":ct?`true`:`false`,"data-version":`v48`,children:[(0,q.jsx)(`div`,{className:`sp-veil`,"aria-hidden":`true`}),(0,q.jsx)(`div`,{className:`sp-veil-stars`,"aria-hidden":`true`}),(0,q.jsx)(`div`,{className:`sp-viewport`,"aria-hidden":!1,children:(0,q.jsxs)(`section`,{className:`sp-shell`,"data-center":!0,children:[(0,q.jsx)(ve,{glyphAuth:l,linkStatus:je,isArchived:Xt,localHash:U,copyHashPress:An}),(l===`authentic`||s===`verified`)&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`style`,{children:` /* ===== Divine Authority Seal — Ultra-Sleek, Compact, Centered ===== */ .authority-seal{ --gold:#ffd76e; --mint:#00ffc6; --aqua:#8ab4ff; --ink:#061012; --glass:rgba(10,14,15,.86); diff --git a/dist/assets/SigilStreamRoot-BUh8LwJG.js b/dist/assets/SigilStreamRoot-BUh8LwJG.js deleted file mode 100644 index c1b98050..00000000 --- a/dist/assets/SigilStreamRoot-BUh8LwJG.js +++ /dev/null @@ -1 +0,0 @@ -import"./html2canvas-CgVfYVZf.js";import"./EternalKlock-DTPPu1Hz.js";import"./SigilModal-B4XBfcke.js";import"./SealMomentModal-BotOOPRg.js";import"./SigilAuthContext-CZfkVeGy.js";import"./sigilRegistry-NyXrDYsE.js";import"./SigilAuthProvider-Crre0ykb.js";import"./usernameClaimRegistry-_VlzEwdK.js";import{n as e,t}from"./SigilStreamRoot-D0R_paBX.js";import"./useFastPress-BuTJ0eyZ.js";export{t as SigilStreamRoot,e as default}; \ No newline at end of file diff --git a/dist/assets/SigilStreamRoot-D0R_paBX.js b/dist/assets/SigilStreamRoot-DGHasm9l.js similarity index 99% rename from dist/assets/SigilStreamRoot-D0R_paBX.js rename to dist/assets/SigilStreamRoot-DGHasm9l.js index 3bfa319a..f3232e38 100644 --- a/dist/assets/SigilStreamRoot-D0R_paBX.js +++ b/dist/assets/SigilStreamRoot-DGHasm9l.js @@ -1,5 +1,5 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/postSeal-D7PFnOMd.js","assets/postSeal-ClZBwRbf.js"])))=>i.map(i=>d[i]); -import{Q as e,Sn as t,Tn as n,at as r,bn as i,ct as a,dn as o,et as s,gn as c,gt as l,hn as u,in as d,it as f,jn as p,mn as m,on as h,ot as g,pt as _,rn as v,rt as y,sn as b,tn as x,tt as S,un as C,ut as w,vn as T,w as E,wn as D,yn as O}from"./index-CcPm2yTY.js";import{n as k}from"./EternalKlock-DTPPu1Hz.js";import{n as A}from"./SigilAuthContext-CZfkVeGy.js";import{n as ee,t as j}from"./sigilRegistry-NyXrDYsE.js";import{t as M}from"./SigilAuthProvider-Crre0ykb.js";import{a as te,i as N,n as ne,o as re,r as ie,t as ae}from"./usernameClaimRegistry-_VlzEwdK.js";import{t as oe}from"./useFastPress-BuTJ0eyZ.js";var P=p(n(),1);const se=(0,P.createContext)(null);function ce(){let e=(0,P.useContext)(se);if(!e)throw Error(`useToasts() must be used within `);return e}var F=p(x(),1);function le({children:e}){let[t,n]=(0,P.useState)([]),r=(0,P.useRef)(new Map),i=(0,P.useRef)(1),a=(0,P.useCallback)(e=>{let t=r.current.get(e);typeof t==`number`&&(window.clearTimeout(t),r.current.delete(e))},[]),o=(0,P.useCallback)(e=>{a(e),n(t=>t.filter(t=>t.id!==e))},[a]),s=(0,P.useCallback)((e,t)=>{let s=i.current++;n(n=>{let r=[{id:s,kind:e,text:t},...n],i=r.slice(0,3),o=r.slice(3);for(let e of o)a(e.id);return i});let c=window.setTimeout(()=>o(s),2600);r.current.set(s,c)},[a,o]),c=(0,P.useMemo)(()=>({push:s}),[s]);(0,P.useEffect)(()=>()=>{for(let e of r.current.values())window.clearTimeout(e);r.current.clear()},[]);let l=e=>{switch(e){case`success`:return`rgba(16,28,22,.88)`;case`warn`:return`rgba(28,24,12,.88)`;case`error`:return`rgba(36,16,16,.88)`;case`info`:default:return`rgba(12,18,28,.88)`}};return(0,F.jsxs)(se.Provider,{value:c,children:[e,(0,F.jsx)(`div`,{"aria-live":`polite`,"aria-atomic":`false`,style:{position:`fixed`,left:0,right:0,bottom:0,padding:`8px 12px`,display:`grid`,gap:8,zIndex:1e3,pointerEvents:`none`},children:t.map(e=>(0,F.jsx)(`div`,{role:`status`,style:{pointerEvents:`auto`,marginInline:`auto`,maxWidth:`min(720px, 100%)`,width:`100%`,background:l(e.kind),border:`1px solid rgba(255,255,255,.12)`,borderRadius:12,padding:`10px 12px`,color:`rgb(236,241,251)`,boxShadow:`0 8px 28px rgba(0,0,0,.35)`,backdropFilter:`blur(6px)`,fontVariantNumeric:`tabular-nums`},children:e.text},e.id))})]})}var I=le;function L(e){return String(e).padStart(2,`0`)}function R(e,t){let n=e%t;return n<0n?n+(t<0n?-t:t):n}function z(e,t){let n=e/t,r=e%t;return r!==0n&&r>0n!=t>0n?n-1n:n}function ue(e){if(!Number.isFinite(e))return 0n;let t=e<0?-1:1,n=Math.abs(e),r=Math.trunc(n),i=n-r;return i<.5?BigInt(t*r):i>.5?BigInt(t*(r+1)):BigInt(t*(r%2==0?r:r+1))}function B(e,t){try{let n=t instanceof Error?t.message:String(t);console.warn(`[SigilStream:${e}] ${n}`)}catch{}}function V(e){return typeof e==`object`&&!!e}function de(e){try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}}function H(e,t){if(!V(e))return;let n=e[t];if(typeof n==`string`)return n;let r=e.meta;if(V(r)){let e=r[t];if(typeof e==`string`)return e}}function fe(e){let t=e;if(V(t)&&`auth`in t&&(t=t.auth),V(t)){let e=t.meta,n=t.svgText;return{meta:V(e)?e:null,svgText:typeof n==`string`?n:null}}return{meta:null,svgText:null}}async function pe(){try{let e=await fetch(`/links.json`,{cache:`no-store`});if(!e.ok||!(e.headers.get(`content-type`)??``).toLowerCase().includes(`application/json`))return[];let t=await e.text(),n=JSON.parse(t);if(!Array.isArray(n))return[];let r=[];for(let e of n)V(e)&&typeof e.url==`string`&&e.url.trim().length&&r.push({url:e.url});return r}catch(e){return B(`loadLinksJson`,e),[]}}const U=`sf-links`;function W(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)&&t.every(e=>typeof e==`string`)?t:[]}catch(e){return B(`parseStringArray`,e),[]}}function G(e){try{if(typeof window>`u`)return;let t=W(localStorage.getItem(U)),n=e.filter(e=>typeof e==`string`&&e.trim().length);if(n.length===0)return;let r=new Set(t),i=n.filter(e=>!r.has(e));if(i.length===0)return;let a=[...i,...t];localStorage.setItem(U,JSON.stringify(a))}catch(e){B(`prependUniqueToStorage`,e)}}const me=(()=>{try{return((typeof window<`u`?window.__PSHORT__:void 0)?.trim()||(void 0)?.trim()||``).replace(/\s+/g,``)}catch(e){return B(`Resolve PSHORT`,e),``}})();function he(){try{if(me)return new URL(`/`,me)}catch(e){B(`Invalid PSHORT`,e)}let e=typeof window<`u`?window.location.href:`https://example.com`;return new URL(`/`,e)}function K(){let e=typeof window<`u`?window.location.href:`https://example.com`;return new URL(`/`,e)}function ge(e){try{let t=new URL(e);if(!(t.protocol===`https:`||t.protocol===`http:`))return!1;let n=t.pathname;if(n.startsWith(`/stream/p/`)||n.startsWith(`/p~`)&&n.length>3)return!0;if(n===`/p`){let e=t.hash.includes(`t=`),n=t.searchParams.has(`t`);return e||n}return t.search.includes(`p=`)}catch{return!1}}function _e(e){try{let t=he(),n=new URL(e,t),r=K();if(n.pathname.startsWith(`/p~`)&&n.pathname.length>3){r.pathname=`/stream/p/${n.pathname.slice(3)}`;let e=n.searchParams.get(`add`)||(n.hash.startsWith(`#add=`)?new URLSearchParams(n.hash.slice(1)).get(`add`):null);return e&&r.searchParams.set(`add`,ve(e)),r.toString()}if(n.pathname===`/p`){let t=n.hash.startsWith(`#`)?n.hash.slice(1):n.hash,i=new URLSearchParams(t),a=i.get(`t`),o=n.searchParams.get(`t`),s=a||o;if(!s)return e;r.pathname=`/stream/p/${s}`;let c=i.get(`add`),l=n.searchParams.get(`add`),u=c||l;return u&&r.searchParams.set(`add`,ve(u)),r.toString()}return e}catch(t){return B(`expandShortAliasToCanonical`,t),e}}function ve(e){let t=e.trim();if(!t)return t;try{if(t.startsWith(`/p~`))return _e(`${he().origin}${t}`);if(t.startsWith(`/p#t=`)||t.startsWith(`#t=`)||t.includes(`/p?t=`))return _e(t.startsWith(`#t=`)?`${he().origin}/p${t}`:t.startsWith(`/p`)?`${he().origin}${t}`:t);if(de(t)){let e=new URL(t);return e.pathname===`/p`||e.pathname.startsWith(`/p~`)?_e(t):t}return t}catch(e){return B(`normalizeAddParam`,e),t}}function ye(e){let t=K();return t.pathname=`/stream/p/${e}`.replace(/\/{2,}/g,`/`),t.search=``,t.hash=``,t.toString()}function be(e){let t=e.trim();if(t.startsWith(`#`)&&(t=t.slice(1)),t.length===3&&(t=t.split(``).map(e=>e+e).join(``)),t.length!==6)return null;let n=parseInt(t,16);return[n>>16&255,n>>8&255,n&255]}var xe=(e,t=0,n=255)=>Math.max(t,Math.min(n,e));function Se(e,t,n){return[xe(e[0]+(t[0]-e[0])*n),xe(e[1]+(t[1]-e[1])*n),xe(e[2]+(t[2]-e[2])*n)]}var Ce=e=>`${e[0]}, ${e[1]}, ${e[2]}`,we={root:`#FF3B3B`,sacral:`#FF8A33`,solar:`#FFD60A`,heart:`#22C55E`,throat:`#0EA5E9`,thirdEye:`#6366F1`,crown:`#C084FC`},Te=`crown`;function Ee(e){if(e==null)return null;let t;return t=typeof e==`number`?[`root`,`sacral`,`solar`,`heart`,`throat`,`thirdEye`,`crown`][Math.min(7,Math.max(1,e))-1]:e===`krown`?Te:e,be(we[t]??we.crown)}function De(e){let t=Ee(e);if(!t)return null;let n=[255,255,255],r=[255,215,128],i=Se(t,n,.28),a=Se(t,r,.42);return{s1:Ce(t),s2:Ce(i),s3:Ce(a)}}var Oe={s1:`154, 230, 255`,s2:`196, 181, 253`,s3:`255, 215, 128`};function ke(e,t){let n=De(e);if(n)return n;if(t?.primary){let e=be(t.primary)??be(`#9AE6FF`),n=t.secondary?be(t.secondary)??e:Se(e,[255,255,255],.28),r=[255,215,128],i=t.accent?be(t.accent)??r:Se(e,r,.45);return{s1:Ce(e),s2:Ce(n),s3:Ce(i)}}return Oe}function Ae(e){if(!e)return;let t=e.trim();if(t)return t.startsWith(`@`),t}function je({username:e,phiKey:t,kaiSignature:n,sigilColors:r,chakra:i}){let a=ke(i,r),o=Ae(e),s={"--sigil-1":a.s1,"--sigil-2":a.s2,"--sigil-3":a.s3},c=!o&&!t&&!n;return(0,F.jsx)(`div`,{className:`sf-identity`,style:s,...c?{"data-empty":``}:{},children:(0,F.jsxs)(`div`,{className:`sf-reply-id`,style:{rowGap:`.4rem`,columnGap:`.4rem`,display:`flex`,flexWrap:`wrap`},"aria-label":c?`No identity loaded`:`Identity chips`,children:[c&&(0,F.jsx)(`span`,{className:`sf-muted`,children:`No identity loaded this session.`}),o&&(0,F.jsxs)(`span`,{className:`sf-pill sf-pill--user`,title:`Username (session)`,children:[(0,F.jsx)(`strong`,{className:`sf-pill__label`,children:`User`}),`\xA0`,(0,F.jsx)(`span`,{className:`sf-key`,children:o})]}),t&&(0,F.jsxs)(`span`,{className:`sf-pill sf-pill--phikey`,title:`Your ΦKey (session)`,children:[(0,F.jsx)(`strong`,{className:`sf-pill__label`,children:`ΦKey`}),`\xA0`,(0,F.jsx)(`span`,{className:`sf-key`,children:t})]}),n&&(0,F.jsxs)(`span`,{className:`sf-pill sf-pill--ksig`,title:`Kai Signature (session)`,children:[(0,F.jsx)(`strong`,{className:`sf-pill__label`,children:`ΣSig`}),`\xA0`,(0,F.jsx)(`span`,{className:`sf-key`,children:n})]})]})})}var Me=[`sigilActionUrl`,`sigilUrl`,`actionUrl`,`claimedUrl`,`loginUrl`,`sourceUrl`,`originUrl`,`url`,`link`,`href`];function Ne(e){if(!e||!V(e))return[];let t=[],n=new Set;for(let r of Me){let i=H(e,r);if(typeof i!=`string`)continue;let a=i.trim();a&&(n.has(a)||(n.add(a),t.push(a)))}return t}function Pe(e){if(!e)return[];try{let t=e.match(/https?:\/\/[^\s"'<>)#]+/gi)??[],n=[],r=new Set;for(let e of t){let t=(e??``).trim();t&&(r.has(t)||(r.add(t),n.push(t)))}return n}catch{return[]}}function Fe(e){return/^https?:\/\//i.test((e??``).trim())}function Ie(e){try{return new URL(e)}catch{return null}}function Le(e){let t=(e??``).trim();if(!t)return``;let n=t;n=n.replace(/\/stream\/v=/gi,`/stream/t=`),n=n.replace(/\/stream\/v\//gi,`/stream/t/`),n=n.replace(/\/stream\/v(\?|&|#)/gi,`/stream/t$1`),n=n.replace(/([?&#])v=/gi,`$1t=`);let r=Ie(n);if(!r)return n.replace(/([?&#])v=/gi,`$1t=`);let i=r.searchParams,a=(i.get(`t`)??``).trim().length>0,o=(i.get(`v`)??``).trim();if(!a&&o&&i.set(`t`,o),i.delete(`v`),(i.get(`t`)??``).trim().length>0&&i.delete(`p`),r.hash&&r.hash.length>1){let e=r.hash.startsWith(`#`)?r.hash.slice(1):r.hash;if(e.includes(`=`)&&!e.startsWith(`/`)){let t=e.split(`&`).filter(Boolean),n=[],i=!1;for(let e of t){let t=e.indexOf(`=`);if(t<=0){n.push(e);continue}let r=e.slice(0,t),a=e.slice(t+1),o=r.toLowerCase();if(o===`v`){!i&&a.trim().length&&(n.push(`t=${a}`),i=!0);continue}o===`t`&&(i=!0),n.push(e)}if(i){let e=[];for(let t of n){let n=t.indexOf(`=`);(n>0?t.slice(0,n).toLowerCase():``)!==`p`&&e.push(t)}r.hash=e.length?`#${e.join(`&`)}`:``}else r.hash=n.length?`#${n.join(`&`)}`:``}else r.hash=r.hash.replace(/([?&#])v=/gi,`$1t=`)}return r.toString()}function Re(e){let t=(e??``).trim();if(!t)return-1;let n=t.toLowerCase(),r=0;return(/[?&#]v=/.test(n)||n.includes(`/stream/v`))&&(r-=1e4),(/[?&#]t=/.test(n)||n.includes(`/stream/t`)||n.includes(`stream/t=`))&&(r+=500),(/[?&#]p=/.test(n)||n.includes(`/stream/p`)||n.includes(`stream/p=`))&&(r+=280),ge(t)&&(r+=160),n.startsWith(`https://`)?r+=20:n.startsWith(`http://`)&&(r+=10),r+=Math.max(0,120-Math.min(120,Math.floor(t.length/6))),r}function ze(e){let t=``,n=-1;for(let r of e){let e=Le(r),i=Re(e);i>n&&(n=i,t=e)}return t}async function Be(e){let t=e??``;if(!t)return!1;try{if(typeof navigator<`u`&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(t),!0}catch{}try{let e=document.createElement(`textarea`);e.value=t,e.setAttribute(`readonly`,`true`),e.style.position=`fixed`,e.style.left=`-9999px`,e.style.top=`-9999px`,document.body.appendChild(e),e.select(),e.setSelectionRange(0,e.value.length);let n=document.execCommand(`copy`);return document.body.removeChild(e),n}catch{return!1}}function Ve({value:e,isCanonical:t}){let n=(0,P.useMemo)(()=>Ie(e),[e]),r=(0,P.useMemo)(()=>Fe(e)?e:``,[e]),[i,a]=(0,P.useState)(!1),[o,s]=(0,P.useState)(!1),c=(0,P.useRef)(null);(0,P.useEffect)(()=>()=>{c.current&&window.clearTimeout(c.current)},[]);let l=(0,P.useCallback)(e=>{c.current&&window.clearTimeout(c.current),a(e),s(!e),c.current=window.setTimeout(()=>{a(!1),s(!1),c.current=null},1400)},[]),u=(0,P.useCallback)(async()=>{l(await Be(e))},[l,e]),d=(0,P.useCallback)(e=>{let t=e.currentTarget;try{t.focus(),t.select(),t.setSelectionRange(0,t.value.length)}catch{}},[]),f=n?.host??``,p=n?`${n.hostname}${n.pathname}${n.search}${n.hash}`.replace(/\/{2,}/g,`/`):e;return(0,F.jsxs)(`div`,{className:`sf-reply-row sf-actionurl`,children:[(0,F.jsxs)(`div`,{className:`sf-actionurl__head`,children:[(0,F.jsxs)(`label`,{className:`sf-label sf-actionurl__label`,children:[`Proof of Breath™ `,(0,F.jsx)(`span`,{className:`sf-muted`,children:`(Sigil-Glyph)`})]}),(0,F.jsx)(`span`,{className:`sf-actionurl__pill ${t?`is-ok`:`is-warn`}`,children:t?`SIGNED`:`EXTERNAL`})]}),(0,F.jsxs)(`div`,{className:`sf-actionurl__field`,children:[(0,F.jsxs)(`div`,{className:`sf-actionurl__inputWrap`,children:[(0,F.jsx)(`input`,{className:`sf-input sf-input--locked sf-actionurl__input`,type:`url`,value:e,readOnly:!0,onClick:d,onFocus:d,"aria-label":`Proof of Breath™ Sigil-Glyph`}),(0,F.jsxs)(`div`,{className:`sf-actionurl__meta`,"aria-hidden":`true`,children:[f?(0,F.jsx)(`span`,{className:`sf-actionurl__host`,children:f}):(0,F.jsx)(`span`,{className:`sf-actionurl__host`,children:`URL`}),(0,F.jsx)(`span`,{className:`sf-actionurl__dot`,children:`•`}),(0,F.jsx)(`span`,{className:`sf-actionurl__pretty`,children:p})]})]}),(0,F.jsxs)(`div`,{className:`sf-actionurl__btns`,children:[(0,F.jsx)(`button`,{type:`button`,className:`sf-actionurl__btn ${i?`is-copied`:``} ${o?`is-fail`:``}`,onClick:u,"aria-live":`polite`,children:i?`✓ Remembered`:o?`Remember failed`:`Remember`}),r?(0,F.jsx)(`a`,{className:`sf-actionurl__btn sf-actionurl__btn--link`,href:r,target:`_blank`,rel:`noreferrer noopener`,"aria-label":`Open Proof of Breath URL in a new tab`,children:`↗`}):(0,F.jsx)(`button`,{type:`button`,className:`sf-actionurl__btn sf-actionurl__btn--disabled`,disabled:!0,children:`↗`})]})]}),!t&&(0,F.jsx)(`div`,{className:`sf-warn sf-actionurl__warn`,role:`status`,children:`Not recognized as a sealed Proof of Breath™ link; fallback rules may apply.`})]})}function He(){return(0,F.jsxs)(`div`,{className:`sf-reply-row sf-actionurl sf-actionurl--empty`,children:[(0,F.jsxs)(`div`,{className:`sf-actionurl__head`,children:[(0,F.jsxs)(`label`,{className:`sf-label sf-actionurl__label`,children:[`Proof of Breath™ `,(0,F.jsx)(`span`,{className:`sf-muted`,children:`(Sigil-Glyph)`})]}),(0,F.jsx)(`span`,{className:`sf-actionurl__pill is-warn`,children:`MISSING`})]}),(0,F.jsx)(`div`,{className:`sf-warn sf-actionurl__warn`,role:`status`,children:`No Proof of Breath™ sigil-glyph detected; a fallback will be used.`})]})}function Ue({meta:e,svgText:t}){let n=Ne(e),r=Pe(t),i=[...n,...r],a=i.length?ze(i):``,o=a.length>0&&ge(a);return{value:a,isCanonical:o,node:a?(0,F.jsx)(Ve,{value:a,isCanonical:o}):(0,F.jsx)(He,{})}}function We(e){let t=e.trim();if(!t)return null;let n=t.replace(/^(kai|sigil):\/\//i,`https://`);try{if(de(n))return n;if(/^[a-z0-9.-]+\.[a-z]{2,}(?:\/.*)?$/i.test(n))return`https://${n}`}catch{}return null}function Ge({onAdd:e,placeholder:t=`Paste any message (https://… or domain.tld)`,title:n=`Inhale a memory`}){let r=ce(),[i,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(null),c=(0,P.useCallback)(t=>{s(null);let n=We(t);if(!n){s(`Enter a valid URL (https://… or domain.tld).`);return}e(n),a(``),r.push(`success`,`Link inhaled.`)},[e,r]),l=(0,P.useCallback)(async()=>{s(null);try{let e=(await navigator.clipboard.readText()).trim();if(!e){s(`Memory is empty.`);return}let t=We(e);if(!t){s(`Memory does not contain a valid link.`);return}a(t),c(t)}catch{s(`Memory read is not permitted.`)}},[c]);return(0,F.jsxs)(`section`,{className:`sf-inhaler`,"aria-labelledby":`inhaler-title`,style:{marginTop:`1rem`},children:[(0,F.jsx)(`h2`,{id:`inhaler-title`,className:`sf-reply-title`,children:n}),(0,F.jsxs)(`div`,{className:`sf-reply-row`,style:{display:`grid`,gap:`.5rem`},children:[(0,F.jsx)(`input`,{className:`sf-input`,type:`url`,placeholder:t,value:i,onChange:e=>a(e.target.value),autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,inputMode:`url`,enterKeyHint:`go`,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),c(i))}}),(0,F.jsxs)(`div`,{className:`sf-reply-actions`,style:{gap:`.5rem`,display:`flex`,flexWrap:`wrap`},children:[(0,F.jsx)(`button`,{className:`sf-btn`,onClick:()=>c(i),children:`Inhale`}),(0,F.jsx)(`button`,{className:`sf-btn sf-btn--ghost`,onClick:l,children:`Inhale from memory`})]}),o&&(0,F.jsx)(`div`,{className:`sf-error`,role:`alert`,children:o})]})]})}const Ke=[`Solhara`,`Aquaris`,`Flamora`,`Verdari`,`Sonari`,`Kaelith`],qe={Solhara:`Root`,Aquaris:`Sacral`,Flamora:`Solar Plexus`,Verdari:`Heart`,Sonari:`Throat`,Kaelith:`Krown`},Je=[`Aethon`,`Virelai`,`Solari`,`Amarin`,`Kaelus`,`Umbriel`,`Noktura`,`Liora`],Ye=[`Awakening Flame`,`Flowing Heart`,`Radiant Will`,`Harmonic Voh`,`Inner Mirror`,`Dreamfire Memory`,`Krowned Light`],Xe=Date.UTC(2024,4,10,6,45,41,888),Ze=3+Math.sqrt(5),Qe=Ze*1e3,$e=1000000n,et=17491270421n,tt=11000000n,nt=(et+18n)/36n;function rt(e){return ue((e.getTime()-Xe)/1e3/Ze*1e6)}function it(e){let t=rt(e),n=R(t,et),r=z(t,et),i=Number(z(n,nt)),a=n-BigInt(i)*nt,o=Number(a/tt),s=Math.min(Math.max(o,0),43),c=a-BigInt(s)*tt,l=Number(c)/Number(tt),u=Number(z(t,$e)),d=Number(a/$e),f=Number(n/$e),p=Ke[Number(R(r,BigInt(6)))],m=qe[p],h=Number(r),g=(h%42+42)%42+1,_=(Math.floor(h/42)%8+8)%8,v=_+1,y=Je[_],b=Math.floor(h/336),x=Math.floor((g-1)/6),S=Ye[x];return{pulse:u,beat:i,step:s,stepPct:l,pulsesIntoBeat:d,pulsesIntoDay:f,harmonicDay:p,chakraDay:m,chakraStepString:`${i}:${L(s)}`,dayOfMonth:g,monthIndex0:_,monthIndex1:v,monthName:y,yearIndex:b,weekIndex:x,weekName:S,_pμ_in_day:n,_pμ_in_beat:a}}function at(e){try{let t=new URL(e).pathname.split(`/`).pop()||``,n=t.lastIndexOf(`.`);return n>=0?t.slice(n+1).toLowerCase():``}catch{return``}}function ot(e){return[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`bmp`].includes(e)}function st(e){return[`mp4`,`webm`,`ogg`,`ogv`,`mov`,`m4v`].includes(e)}function ct(e){return e===`pdf`}function lt(e){try{return new URL(e).host}catch{return``}}function ut(e){try{let t=new URL(e),n=t.host,r=t.pathname||``;r===`/`&&(r=``),r.endsWith(`/`)&&r.length>1&&(r=r.slice(0,-1));let i=t.search||``;return`${n}${r}${i}`}catch{return e.replace(/^https?:\/\//i,``).replace(/\/+$/g,``)}}function dt(e){try{let t=new URL(e);if(t.hostname.includes(`youtu.be`))return t.pathname.slice(1)||null;if(t.hostname.includes(`youtube.com`)){let e=t.searchParams.get(`v`);if(e)return e;let n=t.pathname.split(`/`).filter(Boolean),r=n.indexOf(`embed`);if(r>=0&&n[r+1])return n[r+1]}return null}catch{return null}}function ft(e){try{let t=new URL(e);return t.hostname.includes(`vimeo.com`)&&t.pathname.split(`/`).filter(Boolean).find(e=>/^\d+$/.test(e))||null}catch{return null}}function pt(e){try{let t=new URL(e);return t.hostname.includes(`spotify.com`)&&(t.pathname.startsWith(`/track/`)||t.pathname.startsWith(`/album/`)||t.pathname.startsWith(`/playlist/`))?`https://open.spotify.com/embed${t.pathname}${t.search}`:null}catch{return null}}function mt({host:e}){return(0,F.jsx)(`img`,{className:`sf-favicon`,src:`https://${e}/favicon.ico`,alt:``,width:16,height:16,loading:`eager`,decoding:`async`,onError:e=>{e.currentTarget.style.visibility=`hidden`}})}function ht(e){let{url:t,title:n,children:r}=e,i=lt(t),a=(n&&n.trim().length?n.trim():``)||ut(t);return(0,F.jsxs)(`div`,{className:`sf-att-card`,children:[(0,F.jsx)(`div`,{className:`sf-att-head`,children:(0,F.jsxs)(`a`,{className:`sf-att-head__hit`,href:t,target:`_blank`,rel:`noopener noreferrer`,title:t,children:[i?(0,F.jsx)(mt,{host:i}):(0,F.jsx)(`span`,{className:`sf-favicon sf-favicon--blank`,"aria-hidden":`true`}),(0,F.jsx)(`div`,{className:`sf-att-head__text`,children:(0,F.jsx)(`div`,{className:`sf-att-head__title`,children:a})}),(0,F.jsx)(`span`,{className:`sf-att-open`,"aria-hidden":`true`,children:`↗`})]})}),r?(0,F.jsx)(`div`,{className:`sf-att-body`,children:r}):null]})}function gt({src:e,title:t}){return(0,F.jsx)(`div`,{className:`sf-embed`,children:(0,F.jsx)(`iframe`,{className:`sf-embed__frame`,src:e,title:t,loading:`eager`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share`,allowFullScreen:!0,sandbox:`allow-same-origin allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox`})})}function _t({url:e,title:t}){return(0,F.jsx)(ht,{url:e,title:t})}function vt({url:e,title:t}){let n=dt(e);if(n)return(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(gt,{src:`https://www.youtube.com/embed/${n}`,title:t||`YouTube`})});let r=ft(e);if(r)return(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(gt,{src:`https://player.vimeo.com/video/${r}`,title:t||`Vimeo`})});let i=pt(e);if(i)return(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(gt,{src:i,title:t||`Spotify`})});let a=at(e);return ot(a)?(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(`div`,{className:`sf-media sf-media--image`,children:(0,F.jsx)(`img`,{className:`sf-media__img`,src:e,alt:t||`image`,loading:`eager`,decoding:`async`})})}):st(a)?(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(`div`,{className:`sf-media sf-media--video`,children:(0,F.jsx)(`video`,{className:`sf-media__video`,src:e,controls:!0,playsInline:!0,preload:`metadata`})})}):ct(a)?(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(`div`,{className:`sf-embed sf-embed--doc`,children:(0,F.jsx)(`iframe`,{className:`sf-embed__frame`,src:e,title:t||`Document`,loading:`eager`})})}):(0,F.jsx)(_t,{url:e,title:t})}function yt(e){let t=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`)),n=``;for(let r=0;r`data:${t};base64,${xt(e)}`;async function Ct(e){let t=typeof crypto<`u`&&crypto.subtle||typeof window<`u`&&window.crypto&&window.crypto.webkitSubtle;if(!t)throw Error(`WebCrypto.subtle is not available in this context.`);let n=await t.digest(`SHA-256`,e);return yt(new Uint8Array(n))}async function wt(e,t=524288){let n=[],r=0,i=0;for(let a of Array.from(e)){r+=a.size;try{let e=await a.arrayBuffer(),r=await Ct(e),o=a.type||`application/octet-stream`;if(a.size<=t){let t=bt(new Uint8Array(e)),s={kind:`file-inline`,name:a.name,type:o,size:a.size,sha256:r,data_b64url:t};i+=a.size,n.push(s)}else{let e={kind:`file-ref`,name:a.name,type:o,size:a.size,sha256:r};n.push(e)}}catch(e){B(`filesToManifest: read/hash failed`,e)}}return{version:1,totalBytes:r,inlinedBytes:i,items:n}}function Tt({n:e}){if(typeof e!=`number`||!Number.isFinite(e)||e<0)return(0,F.jsx)(F.Fragment,{children:`—`});let t=1024,n=t*1024,r=n*1024;return(0,F.jsx)(F.Fragment,{children:e>=r?`${(e/r).toFixed(2)} GB`:e>=n?`${(e/n).toFixed(2)} MB`:e>=t?`${(e/t).toFixed(2)} KB`:`${Math.round(e)} B`})}function Et({it:e}){let t=e.type||`application/octet-stream`,n=St(e.data_b64url,t),r=e.name||`file`;if(t.startsWith(`image/`))return(0,F.jsxs)(`div`,{className:`sf-media sf-media--image`,children:[(0,F.jsx)(`img`,{src:n,alt:r,loading:`eager`,decoding:`async`}),(0,F.jsxs)(`div`,{className:`sf-file-meta`,children:[(0,F.jsx)(`span`,{children:r}),(0,F.jsx)(`span`,{children:(0,F.jsx)(Tt,{n:e.size})})]}),(0,F.jsx)(`a`,{className:`sf-file-dl`,href:n,download:r,children:`Download`})]});if(t.startsWith(`video/`))return(0,F.jsxs)(`div`,{className:`sf-media sf-media--video`,children:[(0,F.jsx)(`video`,{src:n,controls:!0,playsInline:!0,preload:`metadata`}),(0,F.jsxs)(`div`,{className:`sf-file-meta`,children:[(0,F.jsx)(`span`,{children:r}),(0,F.jsx)(`span`,{children:(0,F.jsx)(Tt,{n:e.size})})]}),(0,F.jsx)(`a`,{className:`sf-file-dl`,href:n,download:r,children:`Download`})]});if(t.startsWith(`audio/`))return(0,F.jsxs)(`div`,{className:`sf-media sf-media--audio`,children:[(0,F.jsx)(`audio`,{src:n,controls:!0,preload:`metadata`}),(0,F.jsxs)(`div`,{className:`sf-file-meta`,children:[(0,F.jsx)(`span`,{children:r}),(0,F.jsx)(`span`,{children:(0,F.jsx)(Tt,{n:e.size})})]}),(0,F.jsx)(`a`,{className:`sf-file-dl`,href:n,download:r,children:`Download`})]});let i=t.startsWith(`text/`)||[`application/json`,`application/xml`,`application/svg+xml`].includes(t),a=null;if(i)try{a=atob(e.data_b64url.replace(/-/g,`+`).replace(/_/g,`/`)).slice(0,1200)}catch{a=null}return(0,F.jsxs)(`div`,{className:`sf-file`,children:[(0,F.jsxs)(`div`,{className:`sf-file-head`,children:[(0,F.jsx)(`div`,{className:`sf-file-name`,children:e.relPath||r}),(0,F.jsx)(`div`,{className:`sf-file-size`,children:(0,F.jsx)(Tt,{n:e.size})})]}),a&&(0,F.jsxs)(`pre`,{className:`sf-file-pre`,"aria-label":`${r} preview`,children:[a,a.length>=1200?` +import{Q as e,Sn as t,Tn as n,at as r,bn as i,ct as a,dn as o,et as s,gn as c,gt as l,hn as u,in as d,it as f,jn as p,mn as m,on as h,ot as g,pt as _,rn as v,rt as y,sn as b,tn as x,tt as S,un as C,ut as w,vn as T,w as E,wn as D,yn as O}from"./index-BWApiWDT.js";import{n as k}from"./EternalKlock-CQhocjA8.js";import{n as A}from"./SigilAuthContext-X_86kcI6.js";import{n as ee,t as j}from"./sigilRegistry-TxCi76Aa.js";import{t as M}from"./SigilAuthProvider-Cr2YGy0y.js";import{a as te,i as N,n as ne,o as re,r as ie,t as ae}from"./usernameClaimRegistry-CU2B_ZCP.js";import{t as oe}from"./useFastPress-C6nRe_12.js";var P=p(n(),1);const se=(0,P.createContext)(null);function ce(){let e=(0,P.useContext)(se);if(!e)throw Error(`useToasts() must be used within `);return e}var F=p(x(),1);function le({children:e}){let[t,n]=(0,P.useState)([]),r=(0,P.useRef)(new Map),i=(0,P.useRef)(1),a=(0,P.useCallback)(e=>{let t=r.current.get(e);typeof t==`number`&&(window.clearTimeout(t),r.current.delete(e))},[]),o=(0,P.useCallback)(e=>{a(e),n(t=>t.filter(t=>t.id!==e))},[a]),s=(0,P.useCallback)((e,t)=>{let s=i.current++;n(n=>{let r=[{id:s,kind:e,text:t},...n],i=r.slice(0,3),o=r.slice(3);for(let e of o)a(e.id);return i});let c=window.setTimeout(()=>o(s),2600);r.current.set(s,c)},[a,o]),c=(0,P.useMemo)(()=>({push:s}),[s]);(0,P.useEffect)(()=>()=>{for(let e of r.current.values())window.clearTimeout(e);r.current.clear()},[]);let l=e=>{switch(e){case`success`:return`rgba(16,28,22,.88)`;case`warn`:return`rgba(28,24,12,.88)`;case`error`:return`rgba(36,16,16,.88)`;case`info`:default:return`rgba(12,18,28,.88)`}};return(0,F.jsxs)(se.Provider,{value:c,children:[e,(0,F.jsx)(`div`,{"aria-live":`polite`,"aria-atomic":`false`,style:{position:`fixed`,left:0,right:0,bottom:0,padding:`8px 12px`,display:`grid`,gap:8,zIndex:1e3,pointerEvents:`none`},children:t.map(e=>(0,F.jsx)(`div`,{role:`status`,style:{pointerEvents:`auto`,marginInline:`auto`,maxWidth:`min(720px, 100%)`,width:`100%`,background:l(e.kind),border:`1px solid rgba(255,255,255,.12)`,borderRadius:12,padding:`10px 12px`,color:`rgb(236,241,251)`,boxShadow:`0 8px 28px rgba(0,0,0,.35)`,backdropFilter:`blur(6px)`,fontVariantNumeric:`tabular-nums`},children:e.text},e.id))})]})}var I=le;function L(e){return String(e).padStart(2,`0`)}function R(e,t){let n=e%t;return n<0n?n+(t<0n?-t:t):n}function z(e,t){let n=e/t,r=e%t;return r!==0n&&r>0n!=t>0n?n-1n:n}function ue(e){if(!Number.isFinite(e))return 0n;let t=e<0?-1:1,n=Math.abs(e),r=Math.trunc(n),i=n-r;return i<.5?BigInt(t*r):i>.5?BigInt(t*(r+1)):BigInt(t*(r%2==0?r:r+1))}function B(e,t){try{let n=t instanceof Error?t.message:String(t);console.warn(`[SigilStream:${e}] ${n}`)}catch{}}function V(e){return typeof e==`object`&&!!e}function de(e){try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}}function H(e,t){if(!V(e))return;let n=e[t];if(typeof n==`string`)return n;let r=e.meta;if(V(r)){let e=r[t];if(typeof e==`string`)return e}}function fe(e){let t=e;if(V(t)&&`auth`in t&&(t=t.auth),V(t)){let e=t.meta,n=t.svgText;return{meta:V(e)?e:null,svgText:typeof n==`string`?n:null}}return{meta:null,svgText:null}}async function pe(){try{let e=await fetch(`/links.json`,{cache:`no-store`});if(!e.ok||!(e.headers.get(`content-type`)??``).toLowerCase().includes(`application/json`))return[];let t=await e.text(),n=JSON.parse(t);if(!Array.isArray(n))return[];let r=[];for(let e of n)V(e)&&typeof e.url==`string`&&e.url.trim().length&&r.push({url:e.url});return r}catch(e){return B(`loadLinksJson`,e),[]}}const U=`sf-links`;function W(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)&&t.every(e=>typeof e==`string`)?t:[]}catch(e){return B(`parseStringArray`,e),[]}}function G(e){try{if(typeof window>`u`)return;let t=W(localStorage.getItem(U)),n=e.filter(e=>typeof e==`string`&&e.trim().length);if(n.length===0)return;let r=new Set(t),i=n.filter(e=>!r.has(e));if(i.length===0)return;let a=[...i,...t];localStorage.setItem(U,JSON.stringify(a))}catch(e){B(`prependUniqueToStorage`,e)}}const me=(()=>{try{return((typeof window<`u`?window.__PSHORT__:void 0)?.trim()||(void 0)?.trim()||``).replace(/\s+/g,``)}catch(e){return B(`Resolve PSHORT`,e),``}})();function he(){try{if(me)return new URL(`/`,me)}catch(e){B(`Invalid PSHORT`,e)}let e=typeof window<`u`?window.location.href:`https://example.com`;return new URL(`/`,e)}function K(){let e=typeof window<`u`?window.location.href:`https://example.com`;return new URL(`/`,e)}function ge(e){try{let t=new URL(e);if(!(t.protocol===`https:`||t.protocol===`http:`))return!1;let n=t.pathname;if(n.startsWith(`/stream/p/`)||n.startsWith(`/p~`)&&n.length>3)return!0;if(n===`/p`){let e=t.hash.includes(`t=`),n=t.searchParams.has(`t`);return e||n}return t.search.includes(`p=`)}catch{return!1}}function _e(e){try{let t=he(),n=new URL(e,t),r=K();if(n.pathname.startsWith(`/p~`)&&n.pathname.length>3){r.pathname=`/stream/p/${n.pathname.slice(3)}`;let e=n.searchParams.get(`add`)||(n.hash.startsWith(`#add=`)?new URLSearchParams(n.hash.slice(1)).get(`add`):null);return e&&r.searchParams.set(`add`,ve(e)),r.toString()}if(n.pathname===`/p`){let t=n.hash.startsWith(`#`)?n.hash.slice(1):n.hash,i=new URLSearchParams(t),a=i.get(`t`),o=n.searchParams.get(`t`),s=a||o;if(!s)return e;r.pathname=`/stream/p/${s}`;let c=i.get(`add`),l=n.searchParams.get(`add`),u=c||l;return u&&r.searchParams.set(`add`,ve(u)),r.toString()}return e}catch(t){return B(`expandShortAliasToCanonical`,t),e}}function ve(e){let t=e.trim();if(!t)return t;try{if(t.startsWith(`/p~`))return _e(`${he().origin}${t}`);if(t.startsWith(`/p#t=`)||t.startsWith(`#t=`)||t.includes(`/p?t=`))return _e(t.startsWith(`#t=`)?`${he().origin}/p${t}`:t.startsWith(`/p`)?`${he().origin}${t}`:t);if(de(t)){let e=new URL(t);return e.pathname===`/p`||e.pathname.startsWith(`/p~`)?_e(t):t}return t}catch(e){return B(`normalizeAddParam`,e),t}}function ye(e){let t=K();return t.pathname=`/stream/p/${e}`.replace(/\/{2,}/g,`/`),t.search=``,t.hash=``,t.toString()}function be(e){let t=e.trim();if(t.startsWith(`#`)&&(t=t.slice(1)),t.length===3&&(t=t.split(``).map(e=>e+e).join(``)),t.length!==6)return null;let n=parseInt(t,16);return[n>>16&255,n>>8&255,n&255]}var xe=(e,t=0,n=255)=>Math.max(t,Math.min(n,e));function Se(e,t,n){return[xe(e[0]+(t[0]-e[0])*n),xe(e[1]+(t[1]-e[1])*n),xe(e[2]+(t[2]-e[2])*n)]}var Ce=e=>`${e[0]}, ${e[1]}, ${e[2]}`,we={root:`#FF3B3B`,sacral:`#FF8A33`,solar:`#FFD60A`,heart:`#22C55E`,throat:`#0EA5E9`,thirdEye:`#6366F1`,crown:`#C084FC`},Te=`crown`;function Ee(e){if(e==null)return null;let t;return t=typeof e==`number`?[`root`,`sacral`,`solar`,`heart`,`throat`,`thirdEye`,`crown`][Math.min(7,Math.max(1,e))-1]:e===`krown`?Te:e,be(we[t]??we.crown)}function De(e){let t=Ee(e);if(!t)return null;let n=[255,255,255],r=[255,215,128],i=Se(t,n,.28),a=Se(t,r,.42);return{s1:Ce(t),s2:Ce(i),s3:Ce(a)}}var Oe={s1:`154, 230, 255`,s2:`196, 181, 253`,s3:`255, 215, 128`};function ke(e,t){let n=De(e);if(n)return n;if(t?.primary){let e=be(t.primary)??be(`#9AE6FF`),n=t.secondary?be(t.secondary)??e:Se(e,[255,255,255],.28),r=[255,215,128],i=t.accent?be(t.accent)??r:Se(e,r,.45);return{s1:Ce(e),s2:Ce(n),s3:Ce(i)}}return Oe}function Ae(e){if(!e)return;let t=e.trim();if(t)return t.startsWith(`@`),t}function je({username:e,phiKey:t,kaiSignature:n,sigilColors:r,chakra:i}){let a=ke(i,r),o=Ae(e),s={"--sigil-1":a.s1,"--sigil-2":a.s2,"--sigil-3":a.s3},c=!o&&!t&&!n;return(0,F.jsx)(`div`,{className:`sf-identity`,style:s,...c?{"data-empty":``}:{},children:(0,F.jsxs)(`div`,{className:`sf-reply-id`,style:{rowGap:`.4rem`,columnGap:`.4rem`,display:`flex`,flexWrap:`wrap`},"aria-label":c?`No identity loaded`:`Identity chips`,children:[c&&(0,F.jsx)(`span`,{className:`sf-muted`,children:`No identity loaded this session.`}),o&&(0,F.jsxs)(`span`,{className:`sf-pill sf-pill--user`,title:`Username (session)`,children:[(0,F.jsx)(`strong`,{className:`sf-pill__label`,children:`User`}),`\xA0`,(0,F.jsx)(`span`,{className:`sf-key`,children:o})]}),t&&(0,F.jsxs)(`span`,{className:`sf-pill sf-pill--phikey`,title:`Your ΦKey (session)`,children:[(0,F.jsx)(`strong`,{className:`sf-pill__label`,children:`ΦKey`}),`\xA0`,(0,F.jsx)(`span`,{className:`sf-key`,children:t})]}),n&&(0,F.jsxs)(`span`,{className:`sf-pill sf-pill--ksig`,title:`Kai Signature (session)`,children:[(0,F.jsx)(`strong`,{className:`sf-pill__label`,children:`ΣSig`}),`\xA0`,(0,F.jsx)(`span`,{className:`sf-key`,children:n})]})]})})}var Me=[`sigilActionUrl`,`sigilUrl`,`actionUrl`,`claimedUrl`,`loginUrl`,`sourceUrl`,`originUrl`,`url`,`link`,`href`];function Ne(e){if(!e||!V(e))return[];let t=[],n=new Set;for(let r of Me){let i=H(e,r);if(typeof i!=`string`)continue;let a=i.trim();a&&(n.has(a)||(n.add(a),t.push(a)))}return t}function Pe(e){if(!e)return[];try{let t=e.match(/https?:\/\/[^\s"'<>)#]+/gi)??[],n=[],r=new Set;for(let e of t){let t=(e??``).trim();t&&(r.has(t)||(r.add(t),n.push(t)))}return n}catch{return[]}}function Fe(e){return/^https?:\/\//i.test((e??``).trim())}function Ie(e){try{return new URL(e)}catch{return null}}function Le(e){let t=(e??``).trim();if(!t)return``;let n=t;n=n.replace(/\/stream\/v=/gi,`/stream/t=`),n=n.replace(/\/stream\/v\//gi,`/stream/t/`),n=n.replace(/\/stream\/v(\?|&|#)/gi,`/stream/t$1`),n=n.replace(/([?&#])v=/gi,`$1t=`);let r=Ie(n);if(!r)return n.replace(/([?&#])v=/gi,`$1t=`);let i=r.searchParams,a=(i.get(`t`)??``).trim().length>0,o=(i.get(`v`)??``).trim();if(!a&&o&&i.set(`t`,o),i.delete(`v`),(i.get(`t`)??``).trim().length>0&&i.delete(`p`),r.hash&&r.hash.length>1){let e=r.hash.startsWith(`#`)?r.hash.slice(1):r.hash;if(e.includes(`=`)&&!e.startsWith(`/`)){let t=e.split(`&`).filter(Boolean),n=[],i=!1;for(let e of t){let t=e.indexOf(`=`);if(t<=0){n.push(e);continue}let r=e.slice(0,t),a=e.slice(t+1),o=r.toLowerCase();if(o===`v`){!i&&a.trim().length&&(n.push(`t=${a}`),i=!0);continue}o===`t`&&(i=!0),n.push(e)}if(i){let e=[];for(let t of n){let n=t.indexOf(`=`);(n>0?t.slice(0,n).toLowerCase():``)!==`p`&&e.push(t)}r.hash=e.length?`#${e.join(`&`)}`:``}else r.hash=n.length?`#${n.join(`&`)}`:``}else r.hash=r.hash.replace(/([?&#])v=/gi,`$1t=`)}return r.toString()}function Re(e){let t=(e??``).trim();if(!t)return-1;let n=t.toLowerCase(),r=0;return(/[?&#]v=/.test(n)||n.includes(`/stream/v`))&&(r-=1e4),(/[?&#]t=/.test(n)||n.includes(`/stream/t`)||n.includes(`stream/t=`))&&(r+=500),(/[?&#]p=/.test(n)||n.includes(`/stream/p`)||n.includes(`stream/p=`))&&(r+=280),ge(t)&&(r+=160),n.startsWith(`https://`)?r+=20:n.startsWith(`http://`)&&(r+=10),r+=Math.max(0,120-Math.min(120,Math.floor(t.length/6))),r}function ze(e){let t=``,n=-1;for(let r of e){let e=Le(r),i=Re(e);i>n&&(n=i,t=e)}return t}async function Be(e){let t=e??``;if(!t)return!1;try{if(typeof navigator<`u`&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(t),!0}catch{}try{let e=document.createElement(`textarea`);e.value=t,e.setAttribute(`readonly`,`true`),e.style.position=`fixed`,e.style.left=`-9999px`,e.style.top=`-9999px`,document.body.appendChild(e),e.select(),e.setSelectionRange(0,e.value.length);let n=document.execCommand(`copy`);return document.body.removeChild(e),n}catch{return!1}}function Ve({value:e,isCanonical:t}){let n=(0,P.useMemo)(()=>Ie(e),[e]),r=(0,P.useMemo)(()=>Fe(e)?e:``,[e]),[i,a]=(0,P.useState)(!1),[o,s]=(0,P.useState)(!1),c=(0,P.useRef)(null);(0,P.useEffect)(()=>()=>{c.current&&window.clearTimeout(c.current)},[]);let l=(0,P.useCallback)(e=>{c.current&&window.clearTimeout(c.current),a(e),s(!e),c.current=window.setTimeout(()=>{a(!1),s(!1),c.current=null},1400)},[]),u=(0,P.useCallback)(async()=>{l(await Be(e))},[l,e]),d=(0,P.useCallback)(e=>{let t=e.currentTarget;try{t.focus(),t.select(),t.setSelectionRange(0,t.value.length)}catch{}},[]),f=n?.host??``,p=n?`${n.hostname}${n.pathname}${n.search}${n.hash}`.replace(/\/{2,}/g,`/`):e;return(0,F.jsxs)(`div`,{className:`sf-reply-row sf-actionurl`,children:[(0,F.jsxs)(`div`,{className:`sf-actionurl__head`,children:[(0,F.jsxs)(`label`,{className:`sf-label sf-actionurl__label`,children:[`Proof of Breath™ `,(0,F.jsx)(`span`,{className:`sf-muted`,children:`(Sigil-Glyph)`})]}),(0,F.jsx)(`span`,{className:`sf-actionurl__pill ${t?`is-ok`:`is-warn`}`,children:t?`SIGNED`:`EXTERNAL`})]}),(0,F.jsxs)(`div`,{className:`sf-actionurl__field`,children:[(0,F.jsxs)(`div`,{className:`sf-actionurl__inputWrap`,children:[(0,F.jsx)(`input`,{className:`sf-input sf-input--locked sf-actionurl__input`,type:`url`,value:e,readOnly:!0,onClick:d,onFocus:d,"aria-label":`Proof of Breath™ Sigil-Glyph`}),(0,F.jsxs)(`div`,{className:`sf-actionurl__meta`,"aria-hidden":`true`,children:[f?(0,F.jsx)(`span`,{className:`sf-actionurl__host`,children:f}):(0,F.jsx)(`span`,{className:`sf-actionurl__host`,children:`URL`}),(0,F.jsx)(`span`,{className:`sf-actionurl__dot`,children:`•`}),(0,F.jsx)(`span`,{className:`sf-actionurl__pretty`,children:p})]})]}),(0,F.jsxs)(`div`,{className:`sf-actionurl__btns`,children:[(0,F.jsx)(`button`,{type:`button`,className:`sf-actionurl__btn ${i?`is-copied`:``} ${o?`is-fail`:``}`,onClick:u,"aria-live":`polite`,children:i?`✓ Remembered`:o?`Remember failed`:`Remember`}),r?(0,F.jsx)(`a`,{className:`sf-actionurl__btn sf-actionurl__btn--link`,href:r,target:`_blank`,rel:`noreferrer noopener`,"aria-label":`Open Proof of Breath URL in a new tab`,children:`↗`}):(0,F.jsx)(`button`,{type:`button`,className:`sf-actionurl__btn sf-actionurl__btn--disabled`,disabled:!0,children:`↗`})]})]}),!t&&(0,F.jsx)(`div`,{className:`sf-warn sf-actionurl__warn`,role:`status`,children:`Not recognized as a sealed Proof of Breath™ link; fallback rules may apply.`})]})}function He(){return(0,F.jsxs)(`div`,{className:`sf-reply-row sf-actionurl sf-actionurl--empty`,children:[(0,F.jsxs)(`div`,{className:`sf-actionurl__head`,children:[(0,F.jsxs)(`label`,{className:`sf-label sf-actionurl__label`,children:[`Proof of Breath™ `,(0,F.jsx)(`span`,{className:`sf-muted`,children:`(Sigil-Glyph)`})]}),(0,F.jsx)(`span`,{className:`sf-actionurl__pill is-warn`,children:`MISSING`})]}),(0,F.jsx)(`div`,{className:`sf-warn sf-actionurl__warn`,role:`status`,children:`No Proof of Breath™ sigil-glyph detected; a fallback will be used.`})]})}function Ue({meta:e,svgText:t}){let n=Ne(e),r=Pe(t),i=[...n,...r],a=i.length?ze(i):``,o=a.length>0&&ge(a);return{value:a,isCanonical:o,node:a?(0,F.jsx)(Ve,{value:a,isCanonical:o}):(0,F.jsx)(He,{})}}function We(e){let t=e.trim();if(!t)return null;let n=t.replace(/^(kai|sigil):\/\//i,`https://`);try{if(de(n))return n;if(/^[a-z0-9.-]+\.[a-z]{2,}(?:\/.*)?$/i.test(n))return`https://${n}`}catch{}return null}function Ge({onAdd:e,placeholder:t=`Paste any message (https://… or domain.tld)`,title:n=`Inhale a memory`}){let r=ce(),[i,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(null),c=(0,P.useCallback)(t=>{s(null);let n=We(t);if(!n){s(`Enter a valid URL (https://… or domain.tld).`);return}e(n),a(``),r.push(`success`,`Link inhaled.`)},[e,r]),l=(0,P.useCallback)(async()=>{s(null);try{let e=(await navigator.clipboard.readText()).trim();if(!e){s(`Memory is empty.`);return}let t=We(e);if(!t){s(`Memory does not contain a valid link.`);return}a(t),c(t)}catch{s(`Memory read is not permitted.`)}},[c]);return(0,F.jsxs)(`section`,{className:`sf-inhaler`,"aria-labelledby":`inhaler-title`,style:{marginTop:`1rem`},children:[(0,F.jsx)(`h2`,{id:`inhaler-title`,className:`sf-reply-title`,children:n}),(0,F.jsxs)(`div`,{className:`sf-reply-row`,style:{display:`grid`,gap:`.5rem`},children:[(0,F.jsx)(`input`,{className:`sf-input`,type:`url`,placeholder:t,value:i,onChange:e=>a(e.target.value),autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,inputMode:`url`,enterKeyHint:`go`,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),c(i))}}),(0,F.jsxs)(`div`,{className:`sf-reply-actions`,style:{gap:`.5rem`,display:`flex`,flexWrap:`wrap`},children:[(0,F.jsx)(`button`,{className:`sf-btn`,onClick:()=>c(i),children:`Inhale`}),(0,F.jsx)(`button`,{className:`sf-btn sf-btn--ghost`,onClick:l,children:`Inhale from memory`})]}),o&&(0,F.jsx)(`div`,{className:`sf-error`,role:`alert`,children:o})]})]})}const Ke=[`Solhara`,`Aquaris`,`Flamora`,`Verdari`,`Sonari`,`Kaelith`],qe={Solhara:`Root`,Aquaris:`Sacral`,Flamora:`Solar Plexus`,Verdari:`Heart`,Sonari:`Throat`,Kaelith:`Krown`},Je=[`Aethon`,`Virelai`,`Solari`,`Amarin`,`Kaelus`,`Umbriel`,`Noktura`,`Liora`],Ye=[`Awakening Flame`,`Flowing Heart`,`Radiant Will`,`Harmonic Voh`,`Inner Mirror`,`Dreamfire Memory`,`Krowned Light`],Xe=Date.UTC(2024,4,10,6,45,41,888),Ze=3+Math.sqrt(5),Qe=Ze*1e3,$e=1000000n,et=17491270421n,tt=11000000n,nt=(et+18n)/36n;function rt(e){return ue((e.getTime()-Xe)/1e3/Ze*1e6)}function it(e){let t=rt(e),n=R(t,et),r=z(t,et),i=Number(z(n,nt)),a=n-BigInt(i)*nt,o=Number(a/tt),s=Math.min(Math.max(o,0),43),c=a-BigInt(s)*tt,l=Number(c)/Number(tt),u=Number(z(t,$e)),d=Number(a/$e),f=Number(n/$e),p=Ke[Number(R(r,BigInt(6)))],m=qe[p],h=Number(r),g=(h%42+42)%42+1,_=(Math.floor(h/42)%8+8)%8,v=_+1,y=Je[_],b=Math.floor(h/336),x=Math.floor((g-1)/6),S=Ye[x];return{pulse:u,beat:i,step:s,stepPct:l,pulsesIntoBeat:d,pulsesIntoDay:f,harmonicDay:p,chakraDay:m,chakraStepString:`${i}:${L(s)}`,dayOfMonth:g,monthIndex0:_,monthIndex1:v,monthName:y,yearIndex:b,weekIndex:x,weekName:S,_pμ_in_day:n,_pμ_in_beat:a}}function at(e){try{let t=new URL(e).pathname.split(`/`).pop()||``,n=t.lastIndexOf(`.`);return n>=0?t.slice(n+1).toLowerCase():``}catch{return``}}function ot(e){return[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`bmp`].includes(e)}function st(e){return[`mp4`,`webm`,`ogg`,`ogv`,`mov`,`m4v`].includes(e)}function ct(e){return e===`pdf`}function lt(e){try{return new URL(e).host}catch{return``}}function ut(e){try{let t=new URL(e),n=t.host,r=t.pathname||``;r===`/`&&(r=``),r.endsWith(`/`)&&r.length>1&&(r=r.slice(0,-1));let i=t.search||``;return`${n}${r}${i}`}catch{return e.replace(/^https?:\/\//i,``).replace(/\/+$/g,``)}}function dt(e){try{let t=new URL(e);if(t.hostname.includes(`youtu.be`))return t.pathname.slice(1)||null;if(t.hostname.includes(`youtube.com`)){let e=t.searchParams.get(`v`);if(e)return e;let n=t.pathname.split(`/`).filter(Boolean),r=n.indexOf(`embed`);if(r>=0&&n[r+1])return n[r+1]}return null}catch{return null}}function ft(e){try{let t=new URL(e);return t.hostname.includes(`vimeo.com`)&&t.pathname.split(`/`).filter(Boolean).find(e=>/^\d+$/.test(e))||null}catch{return null}}function pt(e){try{let t=new URL(e);return t.hostname.includes(`spotify.com`)&&(t.pathname.startsWith(`/track/`)||t.pathname.startsWith(`/album/`)||t.pathname.startsWith(`/playlist/`))?`https://open.spotify.com/embed${t.pathname}${t.search}`:null}catch{return null}}function mt({host:e}){return(0,F.jsx)(`img`,{className:`sf-favicon`,src:`https://${e}/favicon.ico`,alt:``,width:16,height:16,loading:`eager`,decoding:`async`,onError:e=>{e.currentTarget.style.visibility=`hidden`}})}function ht(e){let{url:t,title:n,children:r}=e,i=lt(t),a=(n&&n.trim().length?n.trim():``)||ut(t);return(0,F.jsxs)(`div`,{className:`sf-att-card`,children:[(0,F.jsx)(`div`,{className:`sf-att-head`,children:(0,F.jsxs)(`a`,{className:`sf-att-head__hit`,href:t,target:`_blank`,rel:`noopener noreferrer`,title:t,children:[i?(0,F.jsx)(mt,{host:i}):(0,F.jsx)(`span`,{className:`sf-favicon sf-favicon--blank`,"aria-hidden":`true`}),(0,F.jsx)(`div`,{className:`sf-att-head__text`,children:(0,F.jsx)(`div`,{className:`sf-att-head__title`,children:a})}),(0,F.jsx)(`span`,{className:`sf-att-open`,"aria-hidden":`true`,children:`↗`})]})}),r?(0,F.jsx)(`div`,{className:`sf-att-body`,children:r}):null]})}function gt({src:e,title:t}){return(0,F.jsx)(`div`,{className:`sf-embed`,children:(0,F.jsx)(`iframe`,{className:`sf-embed__frame`,src:e,title:t,loading:`eager`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share`,allowFullScreen:!0,sandbox:`allow-same-origin allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox`})})}function _t({url:e,title:t}){return(0,F.jsx)(ht,{url:e,title:t})}function vt({url:e,title:t}){let n=dt(e);if(n)return(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(gt,{src:`https://www.youtube.com/embed/${n}`,title:t||`YouTube`})});let r=ft(e);if(r)return(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(gt,{src:`https://player.vimeo.com/video/${r}`,title:t||`Vimeo`})});let i=pt(e);if(i)return(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(gt,{src:i,title:t||`Spotify`})});let a=at(e);return ot(a)?(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(`div`,{className:`sf-media sf-media--image`,children:(0,F.jsx)(`img`,{className:`sf-media__img`,src:e,alt:t||`image`,loading:`eager`,decoding:`async`})})}):st(a)?(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(`div`,{className:`sf-media sf-media--video`,children:(0,F.jsx)(`video`,{className:`sf-media__video`,src:e,controls:!0,playsInline:!0,preload:`metadata`})})}):ct(a)?(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(`div`,{className:`sf-embed sf-embed--doc`,children:(0,F.jsx)(`iframe`,{className:`sf-embed__frame`,src:e,title:t||`Document`,loading:`eager`})})}):(0,F.jsx)(_t,{url:e,title:t})}function yt(e){let t=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`)),n=``;for(let r=0;r`data:${t};base64,${xt(e)}`;async function Ct(e){let t=typeof crypto<`u`&&crypto.subtle||typeof window<`u`&&window.crypto&&window.crypto.webkitSubtle;if(!t)throw Error(`WebCrypto.subtle is not available in this context.`);let n=await t.digest(`SHA-256`,e);return yt(new Uint8Array(n))}async function wt(e,t=524288){let n=[],r=0,i=0;for(let a of Array.from(e)){r+=a.size;try{let e=await a.arrayBuffer(),r=await Ct(e),o=a.type||`application/octet-stream`;if(a.size<=t){let t=bt(new Uint8Array(e)),s={kind:`file-inline`,name:a.name,type:o,size:a.size,sha256:r,data_b64url:t};i+=a.size,n.push(s)}else{let e={kind:`file-ref`,name:a.name,type:o,size:a.size,sha256:r};n.push(e)}}catch(e){B(`filesToManifest: read/hash failed`,e)}}return{version:1,totalBytes:r,inlinedBytes:i,items:n}}function Tt({n:e}){if(typeof e!=`number`||!Number.isFinite(e)||e<0)return(0,F.jsx)(F.Fragment,{children:`—`});let t=1024,n=t*1024,r=n*1024;return(0,F.jsx)(F.Fragment,{children:e>=r?`${(e/r).toFixed(2)} GB`:e>=n?`${(e/n).toFixed(2)} MB`:e>=t?`${(e/t).toFixed(2)} KB`:`${Math.round(e)} B`})}function Et({it:e}){let t=e.type||`application/octet-stream`,n=St(e.data_b64url,t),r=e.name||`file`;if(t.startsWith(`image/`))return(0,F.jsxs)(`div`,{className:`sf-media sf-media--image`,children:[(0,F.jsx)(`img`,{src:n,alt:r,loading:`eager`,decoding:`async`}),(0,F.jsxs)(`div`,{className:`sf-file-meta`,children:[(0,F.jsx)(`span`,{children:r}),(0,F.jsx)(`span`,{children:(0,F.jsx)(Tt,{n:e.size})})]}),(0,F.jsx)(`a`,{className:`sf-file-dl`,href:n,download:r,children:`Download`})]});if(t.startsWith(`video/`))return(0,F.jsxs)(`div`,{className:`sf-media sf-media--video`,children:[(0,F.jsx)(`video`,{src:n,controls:!0,playsInline:!0,preload:`metadata`}),(0,F.jsxs)(`div`,{className:`sf-file-meta`,children:[(0,F.jsx)(`span`,{children:r}),(0,F.jsx)(`span`,{children:(0,F.jsx)(Tt,{n:e.size})})]}),(0,F.jsx)(`a`,{className:`sf-file-dl`,href:n,download:r,children:`Download`})]});if(t.startsWith(`audio/`))return(0,F.jsxs)(`div`,{className:`sf-media sf-media--audio`,children:[(0,F.jsx)(`audio`,{src:n,controls:!0,preload:`metadata`}),(0,F.jsxs)(`div`,{className:`sf-file-meta`,children:[(0,F.jsx)(`span`,{children:r}),(0,F.jsx)(`span`,{children:(0,F.jsx)(Tt,{n:e.size})})]}),(0,F.jsx)(`a`,{className:`sf-file-dl`,href:n,download:r,children:`Download`})]});let i=t.startsWith(`text/`)||[`application/json`,`application/xml`,`application/svg+xml`].includes(t),a=null;if(i)try{a=atob(e.data_b64url.replace(/-/g,`+`).replace(/_/g,`/`)).slice(0,1200)}catch{a=null}return(0,F.jsxs)(`div`,{className:`sf-file`,children:[(0,F.jsxs)(`div`,{className:`sf-file-head`,children:[(0,F.jsx)(`div`,{className:`sf-file-name`,children:e.relPath||r}),(0,F.jsx)(`div`,{className:`sf-file-size`,children:(0,F.jsx)(Tt,{n:e.size})})]}),a&&(0,F.jsxs)(`pre`,{className:`sf-file-pre`,"aria-label":`${r} preview`,children:[a,a.length>=1200?` … (truncated preview)`:``]}),(0,F.jsxs)(`div`,{className:`sf-file-foot`,children:[(0,F.jsxs)(`code`,{className:`sf-hash mono`,children:[`sha256:`,e.sha256]}),(0,F.jsx)(`a`,{className:`sf-file-dl`,href:n,download:r,children:`Download`})]})]})}function Dt({it:e}){let t=e.name||`file`;return(0,F.jsxs)(`div`,{className:`sf-fileref`,children:[(0,F.jsxs)(`div`,{className:`sf-file-head`,children:[(0,F.jsx)(`div`,{className:`sf-file-name`,children:e.relPath||t}),(0,F.jsx)(`div`,{className:`sf-file-size`,children:(0,F.jsx)(Tt,{n:e.size})})]}),(0,F.jsxs)(`div`,{className:`sf-file-foot`,children:[(0,F.jsx)(`div`,{className:`sf-file-type`,children:e.type||`application/octet-stream`}),(0,F.jsxs)(`code`,{className:`sf-hash mono`,children:[`sha256:`,e.sha256]})]}),(0,F.jsx)(`div`,{className:`sf-note`,children:`Large file not inlined. Host by hash anywhere and add the public URL as an attachment link.`})]})}function Ot({item:e}){return e.kind===`url`?(0,F.jsx)(vt,{url:e.url,title:e.title}):e.kind===`file-inline`?(0,F.jsx)(Et,{it:e}):(0,F.jsx)(Dt,{it:e})}function kt({manifest:e}){return e.items.length?(0,F.jsxs)(`section`,{className:`sf-attachments`,"aria-labelledby":`sf-att-title`,children:[(0,F.jsx)(`h3`,{id:`sf-att-title`,className:`sf-att-title`,children:`Attachments`}),(0,F.jsx)(`div`,{className:`sf-att-grid`,children:e.items.map((e,t)=>(0,F.jsx)(`div`,{className:`sf-att-item`,children:(0,F.jsx)(Ot,{item:e})},t))}),(0,F.jsxs)(`div`,{className:`sf-att-foot`,children:[(0,F.jsxs)(`span`,{children:[`Total:`,` `,(0,F.jsx)(`strong`,{children:(0,F.jsx)(Tt,{n:e.totalBytes})})]}),typeof e.inlinedBytes==`number`&&e.inlinedBytes>0&&(0,F.jsxs)(`span`,{children:[` `,`• Inlined:`,` `,(0,F.jsx)(`strong`,{children:(0,F.jsx)(Tt,{n:e.inlinedBytes})})]})]})]}):null}function At(e){let t=e.trim();if(!t)return null;if(/^(kai|sigil):\/\//i.test(t))return t.replace(/^(kai|sigil):\/\//i,`https://`);try{if(de(t))return t;if(/^[a-z0-9.-]+\.[a-z]{2,}(\/.*)?$/i.test(t))return`https://${t}`}catch{}return null}function jt(e,t){if(!t)return{next:e,error:`Missing URL.`};if(e.some(e=>e.url===t))return{next:e,error:`Link already added.`};let n={kind:`url`,url:t};return{next:[...e,n],added:n}}function Mt(e,t){return t<0||t>=e.length?e:[...e.slice(0,t),...e.slice(t+1)]}var Nt=512,Pt=`sigil:urls`,Ft=`sigil:feed`,It=`kai-sigil-registry`,Lt=`kai-feed-registry`;function Rt(e){try{return decodeURIComponent(e)}catch{return e}}function zt(e){let t=e.trim();return t.length<16?!1:/^[A-Za-z0-9_-]+$/u.test(t)}function Bt(e){let t=e.trim();if(!t)return``;try{return new URL(t,K().origin).toString()}catch{return t}}function Vt(e){let t=f(e);return t?`t:${t}`:null}function Ht(e){try{let t=new URL(e,K().origin),n=t.hash.startsWith(`#`)?t.hash.slice(1):``;return new URLSearchParams(n).getAll(`add`).length+t.searchParams.getAll(`add`).length}catch{return 0}}function Ut(e){return Ht(e)*1e5+e.length}function Wt(e,t){if(typeof window>`u`||window.localStorage===void 0)return{changed:!1,value:t};let n=Bt(t);if(!n)return{changed:!1,value:t};try{let t=window.localStorage.getItem(e),r=[];if(t){let e=JSON.parse(t);if(Array.isArray(e))for(let t of e)typeof t==`string`&&r.push(t)}let i=[],a=new Map,o=e=>Vt(e)??`u:${Bt(e)}`;for(let e of r){let t=Bt(e);if(!t)continue;let n=o(t),r=Ut(t);a.has(n)?r>a.get(n).score&&a.set(n,{url:t,score:r}):(a.set(n,{url:t,score:r}),i.push(n))}let s=o(n),c=Ut(n);a.has(s)?c>a.get(s).score&&a.set(s,{url:n,score:c}):(a.set(s,{url:n,score:c}),i.push(s));let l=[];for(let e of i){let t=a.get(e);t&&l.push(t.url)}let u=JSON.stringify(r),d=JSON.stringify(l);return u===d?{changed:!1,value:n}:(window.localStorage.setItem(e,d),{changed:!0,value:n})}catch{return{changed:!1,value:n}}}function Gt(e){if(!(typeof window>`u`)){try{window.__SIGIL__?.registerSigilUrl?.(e)}catch{}try{window.dispatchEvent(new CustomEvent(`sigil:url-registered`,{detail:{url:e}}))}catch{}try{if(`BroadcastChannel`in window){let t=new BroadcastChannel(It);t.postMessage({type:`sigil:add`,url:e}),t.close()}}catch{}}}function Kt(e){if(!(typeof window>`u`)){try{window.__FEED__?.registerFeedUrl?.(e)}catch{}try{window.dispatchEvent(new CustomEvent(`feed:url-registered`,{detail:{url:e}}))}catch{}try{if(`BroadcastChannel`in window){let t=new BroadcastChannel(Lt);t.postMessage({type:`feed:add`,url:e}),t.close()}}catch{}}}function qt(e){try{let t=new URL(e,K().origin),n=t.hash.startsWith(`#`)?t.hash.slice(1):``,r=new URLSearchParams(n),i=[...t.searchParams.getAll(`add`),...r.getAll(`add`)],a=[];for(let e of i){let t=Rt(String(e)).trim();if(t){if(t.startsWith(`j:`)&&t.length>10){a.includes(t)||a.push(t);continue}if(zt(t))try{let e=_e(ye(t));e&&!a.includes(e)&&a.push(e);continue}catch{}try{let e=_e(t);e&&!a.includes(e)&&a.push(e)}catch{}}}return a.slice(-Nt)}catch{return[]}}function Jt(e,t){let n=new URL(e,K().origin),r=n.hash.startsWith(`#`)?n.hash.slice(1):``,i=new URLSearchParams(r);i.delete(`add`);for(let e of t)i.append(`add`,e);n.search=``;let a=i.toString();return n.hash=a?`#${a}`:``,n.toString()}function Yt(e){return`${K().origin.replace(/\/+$/g,``)}/stream/p/${encodeURIComponent(e)}`}function Xt(e){try{let t=new URL(e,K().origin),n=t.hash.startsWith(`#`)?t.hash.slice(1):``,r=new URLSearchParams(n).get(`root`)??t.searchParams.get(`root`);if(!r)return null;let i=Rt(String(r)).trim();return i?i.startsWith(`j:`)&&i.length>10?i:/^[A-Za-z0-9_-]{16,}$/u.test(i)?`j:${i}`:null:null}catch{return null}}function Zt(){if(typeof window>`u`)return{replyToUrl:null,originUrl:null,addChain:[]};let e=window.location.href,t=qt(e),n=f(e)??y(window.location),r=n?(()=>{try{return _e(Yt(n))}catch{return Yt(n)}})():null,i=Xt(e),a=!r&&!i&&t.length?t[t.length-1]:null,o=r??i??a;return{replyToUrl:o,originUrl:t.length?t[0]:o,addChain:(a&&t.length?t.slice(0,-1):t.slice(0)).slice(-Nt)}}function Qt({meta:e,svgText:t,onUseDifferentKey:n,inlineLimitBytes:i=512*1024}){let o=ce(),{meta:c,svgText:u}=(0,P.useMemo)(()=>fe({meta:e,svgText:t}),[e,t]),d=(0,P.useMemo)(()=>c?H(c,`userPhiKey`):void 0,[c]),p=(0,P.useMemo)(()=>c?H(c,`kaiSignature`):void 0,[c]),{value:m}=Ue({meta:c,svgText:u}),[h,v]=(0,P.useState)(``),[b,x]=(0,P.useState)(``),[C,T]=(0,P.useState)(``),[E,D]=(0,P.useState)({version:1,totalBytes:0,inlinedBytes:0,items:[]}),[O,k]=(0,P.useState)(``),[A,ee]=(0,P.useState)([]),j=(0,P.useId)(),M=(0,P.useId)(),oe=(0,P.useRef)(null),se=(0,P.useRef)(null),[le,I]=(0,P.useState)(!1),[L,R]=(0,P.useState)(``),[z,ue]=(0,P.useState)(!1),[B,V]=(0,P.useState)(()=>ae()),[de,pe]=(0,P.useState)(null);(0,P.useEffect)(()=>{if(!(typeof window>`u`))try{let e=Zt();if(!e.replyToUrl)return;let t=f(e.replyToUrl)??y(window.location);if(!t)return;let n=s(t);n&&pe(n)}catch{}},[]);let U=(0,P.useMemo)(()=>{if(!de)return null;let e=de.body,t=de.caption??``;e&&(e.kind===`text`?t=e.text:e.kind===`md`?t=e.md:e.kind===`code`?t=e.code:e.kind===`html`&&(t=e.html));let n=t.trim();if(!n)return{author:de.author,url:de.url,snippet:`(Previous memory has no visible text content.)`};let r=n.length>280?`${n.slice(0,279)}…`:n;return{author:de.author,url:de.url,snippet:r}},[de]);(0,P.useEffect)(()=>{V(ae());let e=ie((e,t)=>{V(t=>({...t,[e.normalized]:e}))});return()=>e()},[]);let W=(0,P.useMemo)(()=>re(b),[b]),G=W?B[W]:void 0,me=(0,P.useMemo)(()=>te(C),[C]),he=(0,P.useMemo)(()=>W?G?G.claimHash===me||G.ownerHint&&d&&G.ownerHint===d?`Username claimed by you`:`Username claimed by another`:`Username available`:``,[G,me,W,d]),_e=(0,P.useCallback)(async e=>{let t=e.currentTarget.files;if(!(!t||t.length===0))try{let n=await wt(t,i);D(e=>({version:1,totalBytes:e.totalBytes+n.totalBytes,inlinedBytes:e.inlinedBytes+n.inlinedBytes,items:[...n.items,...e.items]})),e.currentTarget.value=``,o.push(`success`,`Attached.`)}catch(e){console.error(`[Composer] onPickFiles:`,e),o.push(`error`,`Attach failed.`)}},[i,o]),ve=(0,P.useCallback)(e=>{D(t=>{let n=[...t.items],r=n.splice(e,1)[0],i=r&&(r.kind===`file-inline`||r.kind===`file-ref`)?r.size??0:0,a=r&&r.kind===`file-inline`?r.size??0:0;return{version:1,totalBytes:Math.max(0,t.totalBytes-i),inlinedBytes:Math.max(0,t.inlinedBytes-a),items:n}})},[]),ye=e=>{let t=At(e);if(!t){o.push(`warn`,`Invalid URL. Use https://example.com`);return}let{next:n,added:r,error:i}=jt(A,t);if(i){o.push(`warn`,i);return}ee(n),k(``),r&&o.push(`success`,`Link added.`)},be=e=>{ee(t=>Mt(t,e))},xe=async()=>{if(!le){I(!0);try{let e=(m||``).trim();(!e||!ge(e))&&o.push(`info`,`No sigil URL detected; using fallback.`);let t=h.trim(),n=b.trim(),i=re(n),s=A.map(e=>_({url:e.url,title:e.title})),u=E.items.map(e=>e.kind===`file-ref`?a({sha256:e.sha256,name:e.name,type:e.type,size:e.size,url:void 0}):e.kind===`file-inline`?w({name:e.name,type:e.type,size:e.size,data_b64url:e.data_b64url,thumbnail_b64:void 0}):e),v=[...s,...u],y=v.length>0?r(v):void 0,x=it(new Date).pulse,C=t.length>0?{kind:`text`,text:t}:void 0,T;if(i)if(G){if(!me){o.push(`warn`,`Username is claimed. Provide your claim glyph token to seal.`);return}if(me!==G.claimHash){o.push(`warn`,`Claim glyph mismatch. Memory not sealed.`);return}T={hash:G.claimHash,url:G.claimUrl,payload:{kind:l,username:G.username,normalized:G.normalized,originHash:G.originHash,ownerHint:G.ownerHint??null},ownerHint:G.ownerHint??null}}else{if(!c||!p){o.push(`warn`,`Inhale your sigil to mint a username claim.`);return}let e=N({origin:{hash:p,pulseCreated:c?.pulse??x,pulseGenesis:c?.pulse??x,value:1,sentTo:[],receivedFrom:[],metadata:{kaiSignature:p,creator:d??void 0}},username:n,pulse:x,ownerHint:d??null}),t=e.metadata?.usernameClaim;if(t)T={hash:e.hash,payload:t,ownerHint:t.ownerHint??null};else{o.push(`warn`,`Could not mint username-claim glyph.`);return}}let D=Yt(S({...g({url:e||K().origin,pulse:x,caption:t||void 0,body:C,author:n||void 0,sigilId:void 0,phiKey:d??void 0,kaiSignature:p??void 0,parent:void 0,parentUrl:void 0,originUrl:void 0,ts:void 0,attachments:y,usernameClaim:T}),kind:`post`})),O=Zt(),k=[];for(let e of O.addChain){let t=f(e);t&&!k.includes(t)&&k.push(t)}let ee=O.replyToUrl?f(O.replyToUrl):null,j=[...k];ee&&!j.includes(ee)&&j.push(ee);let M=j.length?Jt(D,j.slice(-Nt)):D;if(T){let e=ne({...T,url:T.url??M});if(!e.accepted){o.push(`warn`,e.reason||`Unable to register username claim.`);return}V(e.registry)}await navigator.clipboard.writeText(M),o.push(`success`,`Link kopied. Kai-sealed.`),R(M);try{for(let e of j){let t=Wt(Pt,Yt(e));t.changed&&Gt(t.value)}let e=Wt(Pt,M);e.changed&&Gt(e.value);let t=Wt(Ft,M);t.changed&&Kt(t.value)}catch{}}catch(e){console.error(`[Composer] onGenerateReply:`,e),o.push(`error`,`Could not seal reply.`)}finally{I(!1)}}};return(0,F.jsxs)(`section`,{className:`sf-reply`,"aria-labelledby":`reply-title`,children:[U&&(0,F.jsxs)(`aside`,{className:`sf-reply-context`,"aria-label":`Replying to previous memory`,children:[(0,F.jsxs)(`div`,{className:`sf-reply-context-header`,children:[(0,F.jsx)(`span`,{className:`sf-pill`,children:`Replying to`}),U.author&&(0,F.jsx)(`span`,{className:`sf-reply-context-author`,children:U.author})]}),(0,F.jsx)(`p`,{className:`sf-reply-context-body`,children:U.snippet})]}),(0,F.jsxs)(`div`,{className:`sf-reply-row`,children:[(0,F.jsx)(`label`,{className:`sf-label`,children:`Attach`}),(0,F.jsxs)(`div`,{className:`sf-reply-row-inline`,children:[(0,F.jsx)(`label`,{className:`sf-btn`,htmlFor:M,children:`Record Memory`}),(0,F.jsx)(`label`,{className:`sf-btn sf-btn--ghost`,htmlFor:j,children:`Inhale files`})]}),(0,F.jsx)(`input`,{id:M,ref:se,type:`file`,accept:`image/*,video/*`,capture:`environment`,multiple:!0,onChange:_e,style:{position:`absolute`,opacity:0,pointerEvents:`none`}}),(0,F.jsx)(`input`,{id:j,ref:oe,type:`file`,accept:`image/*,video/*,audio/*,application/pdf,text/plain,application/json,application/xml,application/svg+xml`,multiple:!0,onChange:_e,style:{position:`absolute`,opacity:0,pointerEvents:`none`}}),E.items.length>0&&(0,F.jsx)(`div`,{className:`sf-att-grid`,children:E.items.map((e,t)=>(0,F.jsxs)(`div`,{className:`sf-att-item`,style:{position:`relative`},children:[(0,F.jsx)(Ot,{item:e}),(0,F.jsx)(`button`,{className:`sf-btn sf-btn--icon`,onClick:()=>ve(t),style:{position:`absolute`,top:8,right:8},type:`button`,"aria-label":`Remove attachment`,children:`✕`})]},`${e.kind}:${t}`))})]}),(0,F.jsxs)(`div`,{className:`sf-reply-row`,children:[(0,F.jsx)(`label`,{className:`sf-label`,children:`Add links`}),(0,F.jsxs)(`div`,{className:`sf-reply-row-inline`,children:[(0,F.jsx)(`input`,{className:`sf-input`,type:`url`,placeholder:`https://example.com`,value:O,onChange:e=>k(e.target.value)}),(0,F.jsx)(`button`,{className:`sf-btn`,onClick:()=>ye(O),type:`button`,children:`Add`})]}),A.length>0&&(0,F.jsx)(`div`,{className:`sf-att-grid`,children:A.map((e,t)=>(0,F.jsxs)(`div`,{className:`sf-att-item`,style:{position:`relative`},children:[(0,F.jsx)(Ot,{item:e}),(0,F.jsx)(`button`,{className:`sf-btn sf-btn--icon`,onClick:()=>be(t),style:{position:`absolute`,top:8,right:8},type:`button`,"aria-label":`Remove link`,children:`✕`})]},`${e.kind}:${e.url}:${t}`))})]}),(0,F.jsxs)(`div`,{className:`sf-reply-row`,children:[(0,F.jsx)(`label`,{className:`sf-label`,children:`Author`}),(0,F.jsx)(`input`,{className:`sf-input`,type:`text`,value:b,onChange:e=>x(e.target.value),placeholder:`@you`,"aria-describedby":he?`username-claim-status`:void 0}),he?(0,F.jsx)(`div`,{id:`username-claim-status`,className:`sf-sub`,role:`status`,"aria-live":`polite`,children:he}):null]}),W?(0,F.jsxs)(`div`,{className:`sf-reply-row`,children:[(0,F.jsx)(`label`,{className:`sf-label`,children:`Claim glyph`}),(0,F.jsx)(`input`,{className:`sf-input`,type:`text`,value:C,onChange:e=>T(e.target.value),placeholder:`Paste claim glyph hash or Memory Stream link`})]}):null,(0,F.jsxs)(`div`,{className:`sf-reply-row`,children:[(0,F.jsx)(`label`,{className:`sf-label`,children:`Memory`}),(0,F.jsx)(`textarea`,{className:`sf-textarea`,rows:3,value:h,onChange:e=>v(e.target.value),placeholder:`What do you want this moment to remember?`})]}),(0,F.jsxs)(`div`,{className:`sf-reply-actions`,children:[(0,F.jsx)(`button`,{className:`sf-btn`,onClick:()=>void xe(),disabled:le,type:`button`,children:le?`Sealing…`:`Exhale Reply`}),n&&(0,F.jsx)(`button`,{className:`sf-btn sf-btn--ghost`,onClick:n,type:`button`,children:`Use a different ΦKey`})]}),L&&(0,F.jsxs)(`div`,{className:`sf-reply-result`,children:[(0,F.jsx)(`label`,{className:`sf-label`,children:`Share this link`}),(0,F.jsx)(`input`,{className:`sf-input`,readOnly:!0,value:L,onFocus:e=>e.currentTarget.select()}),(0,F.jsxs)(`div`,{className:`sf-reply-actions`,children:[(0,F.jsx)(`a`,{className:`sf-link`,href:L,target:`_blank`,rel:`noreferrer`,children:`Open →`}),(0,F.jsx)(`button`,{className:`sf-btn`,type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(L),o.push(`success`,`Link remembered.`),ue(!0),window.setTimeout(()=>ue(!1),1200)}catch{o.push(`warn`,`Copy failed.`)}},children:z?`Remembered`:`Remember`})]})]})]})}var $t=()=>{let e=m();return e<=0n?0:e>BigInt(2**53-1)?2**53-1:Number(e)};function en(e){let[t,n]=(0,P.useState)(e?Ze:null),r=(0,P.useRef)(null),i=(0,P.useRef)(null),a=()=>{let e=$t()-Xe;i.current=Xe+Math.max(0,Math.ceil(e/Qe))*Qe};return(0,P.useEffect)(()=>{if(!e){r.current!=null&&window.cancelAnimationFrame(r.current),r.current=null,i.current=null,n(null);return}a();let t=()=>{let e=i.current;if(e==null)n(null);else{let t=$t();t>=e?(a(),n(0)):n((e-t)/1e3)}r.current=window.requestAnimationFrame(t)};r.current=window.requestAnimationFrame(t);let o=()=>{document.visibilityState===`visible`&&a()};return document.addEventListener(`visibilitychange`,o),()=>{r.current!=null&&window.cancelAnimationFrame(r.current),r.current=null,document.removeEventListener(`visibilitychange`,o)}},[e]),t}function tn(){let[e,t]=(0,P.useState)(()=>it(new Date($t()))),n=(0,P.useRef)(null),r=()=>{if(typeof document>`u`)return;let e=document.documentElement,t=(Qe-($t()-Xe)%Qe)%Qe;e.style.setProperty(`--pulse-dur`,`${Qe}ms`),e.style.setProperty(`--pulse-offset`,`-${Math.round(t)}ms`)},i=()=>{n.current!=null&&window.clearTimeout(n.current);let e=$t(),a=e-Xe,o=Xe+Math.max(0,Math.ceil(a/Qe))*Qe,s=Math.max(0,o-e);r(),n.current=window.setTimeout(()=>{t(it(new Date($t()))),i()},s)};return(0,P.useEffect)(()=>{i();let e=()=>{document.visibilityState===`visible`&&(t(it(new Date($t()))),i())};return document.addEventListener(`visibilitychange`,e),()=>{n.current!=null&&window.clearTimeout(n.current),n.current=null,document.removeEventListener(`visibilitychange`,e)}},[]),e}var nn=p(D(),1),rn=3+Math.sqrt(5);function an(e){return e<0?0:e>1?1:e}function on(e){if(!e)return rn;let t=window.getComputedStyle(e).getPropertyValue(`--pulse-dur`).trim(),n=Number.parseFloat(t);return Number.isFinite(n)&&n>0?n:rn}function sn(e){return e>0&&e<360?`nano`:e>0&&e<520?`tiny`:e>0&&e<760?`tight`:`wide`}function cn(e){switch(e){case`nano`:return .84;case`tiny`:return .9;case`tight`:return .95;default:return 1}}function ln(e){return e===`nano`?`stack`:`row`}function un(e){let[t,n]=P.useState(0);return P.useLayoutEffect(()=>{let t=e.current;if(!t)return;let r=()=>{n(Math.round(t.getBoundingClientRect().width))};if(r(),typeof ResizeObserver<`u`){let e=new ResizeObserver(()=>r());return e.observe(t),()=>e.disconnect()}let i=()=>r();return window.addEventListener(`resize`,i,{passive:!0}),()=>window.removeEventListener(`resize`,i)},[e]),t}var dn=[`Ignite`,`Integrate`,`Harmonize`,`Reflekt`,`Purify`,`Dream`];function fn(e){let t=Number.isFinite(e)?Math.floor(e):0;return dn[Math.max(0,Math.min(5,Math.floor(t/6)))]}var pn=(e,t)=>{let n=e%t;return n>=0n?n:n+t},mn=(e,t)=>{if(t===0n)throw Error(`Division by zero`);let n=e/t;return e%t===0n||e>=0n?n:n-1n},hn=e=>{let t=BigInt(2**53-1),n=BigInt(-(2**53-1));return e>t?2**53-1:er(!0),[]),a=P.useCallback(()=>r(!1),[]),o=P.useCallback(e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),r(!0))},[]),s=P.useRef(null),c=sn(un(s)),l=ln(c),u=c===`wide`||c===`tight`,[d,f]=P.useState(rn);P.useEffect(()=>{f(on(s.current))},[e.pulse]);let[p,m]=P.useState(!1),h=P.useRef(null);P.useEffect(()=>{let e=h.current;if(h.current=t,e!=null&&t!=null&&t>e+.25){m(!0);let e=window.setTimeout(()=>m(!1),180);return()=>window.clearTimeout(e)}},[t]);let g=`${e.beat}:${L(e.step)}`,_=P.useMemo(()=>t==null?0:an(1-t/d),[t,d]),v=t===null?`—`:t.toFixed(6),y=t===null?`—`:t.toFixed(6),b=String(e.harmonicDay),x=typeof e.beat==`number`?e.beat:Number.parseInt(String(e.beat),10)||0,S=typeof e.step==`number`?e.step:Number.parseInt(String(e.step),10)||0,C=fn(x),w=En[C]??`Heart`,T=typeof e.pulse==`number`?e.pulse:Number.parseInt(String(e.pulse),10)||0,E=P.useMemo(()=>gn(T),[T]),D=P.useMemo(()=>Cn(e.harmonicDay,E.day),[e.harmonicDay,E.day]),O=P.useMemo(()=>xn(E.month),[E.month]),k=P.useMemo(()=>Tn(E.month),[E.month]),A=`D${E.day}/M${E.month}/Y${E.year}`,ee=vn(D),j=vn(O),M=P.useMemo(()=>({"--kai-progress":_,"--kai-ui-scale":cn(c)}),[_,c]),te=1584,N=Math.max(0,Math.min(te-1,x*44+S))/te*100,ne=_*100,re=String(Math.round(x/36*360));P.useEffect(()=>{if(!n||typeof document>`u`)return;let e=document.documentElement.style.overflow;document.documentElement.style.overflow=`hidden`;let t=e=>{e.key===`Escape`&&a()};return window.addEventListener(`keydown`,t),()=>{document.documentElement.style.overflow=e,window.removeEventListener(`keydown`,t)}},[n,a]);let ie=(0,F.jsxs)(`div`,{className:`kai-status__countdown`,"aria-label":`Next pulse`,children:[(0,F.jsx)(`span`,{className:`kai-status__nLabel`,children:`NEXT`}),(0,F.jsxs)(`span`,{className:`kai-status__nVal`,title:v,"aria-label":`Next pulse in ${v} seconds`,children:[y,` `,(0,F.jsx)(`span`,{className:`kai-status__nUnit`,children:`s`})]})]}),ae=(0,F.jsxs)(`span`,{className:`kai-pill kai-pill--pulse`,title:`Pulse ${T}`,"aria-label":`Pulse ${T}`,"data-chakra":`Pulse`,children:[`☤KAI: `,(0,F.jsx)(`strong`,{className:`kai-pill__num`,children:T})]}),oe=(0,F.jsxs)(`span`,{className:`kai-pill kai-pill--dmy`,title:A,"aria-label":`Date ${A}`,children:[(0,F.jsxs)(`span`,{className:`kai-dmy__seg kai-dmy__seg--day`,"data-chakra":D,children:[`D`,(0,F.jsx)(`span`,{className:`kai-dmy__num`,children:E.day})]}),(0,F.jsx)(`span`,{className:`kai-dmy__sep`,children:`/`}),(0,F.jsxs)(`span`,{className:`kai-dmy__seg kai-dmy__seg--month`,"data-chakra":O,children:[`M`,(0,F.jsx)(`span`,{className:`kai-dmy__num`,children:E.month})]}),(0,F.jsx)(`span`,{className:`kai-dmy__sep`,children:`/`}),(0,F.jsxs)(`span`,{className:`kai-dmy__seg kai-dmy__seg--year`,"data-chakra":`Year`,children:[`Y`,(0,F.jsx)(`span`,{className:`kai-dmy__num`,children:E.year})]})]}),se=(0,F.jsx)(`span`,{className:`kai-pill kai-pill--day`,title:b,"aria-label":`Day ${b}`,"data-chakra":D,children:b}),ce=(0,F.jsx)(`span`,{className:`kai-pill kai-pill--dayChakra`,title:`Day chakra ${ee}`,"aria-label":`Day chakra ${ee}`,"data-chakra":D,children:ee}),le=(0,F.jsx)(`span`,{className:`kai-pill kai-pill--monthName`,title:k,"aria-label":`Month ${k}`,"data-chakra":O,children:k}),I=(0,F.jsx)(`span`,{className:`kai-pill kai-pill--monthChakra`,title:`Month chakra ${j}`,"aria-label":`Month chakra ${j}`,"data-chakra":O,children:j}),R=(0,F.jsx)(`span`,{className:`kai-pill kai-pill--ark`,title:C,"aria-label":`Ark ${C}`,"data-chakra":w,children:C}),z=n&&typeof document<`u`?(0,nn.createPortal)((0,F.jsxs)(`div`,{className:`kk-pop`,role:`dialog`,"aria-modal":`true`,"aria-label":`Kai-Klok`,children:[(0,F.jsx)(`button`,{type:`button`,className:`kk-pop__backdrop`,"aria-label":`Close Kai-Klok`,onClick:a}),(0,F.jsxs)(`div`,{className:`kk-pop__panel`,role:`document`,children:[(0,F.jsxs)(`div`,{className:`kk-pop__head`,children:[(0,F.jsx)(`div`,{className:`kk-pop__title`,children:`Kai-Klok`}),(0,F.jsx)(`button`,{type:`button`,className:`kk-pop__close`,onClick:a,"aria-label":`Close`,children:`✕`})]}),(0,F.jsxs)(`div`,{className:`kk-pop__meta`,"aria-label":`Kai summary`,children:[(0,F.jsx)(`span`,{className:`kk-pop__pill`,children:g}),(0,F.jsx)(`span`,{className:`kk-pop__pill`,children:A}),(0,F.jsx)(`span`,{className:`kk-pop__pill`,children:k}),(0,F.jsx)(`span`,{className:`kk-pop__pill`,children:C})]}),(0,F.jsx)(`div`,{className:`kk-pop__dial`,"aria-label":`Kai-Klok dial`,children:(0,F.jsx)(`div`,{className:`klock-stage`,"data-klock-stage":`1`,children:(0,F.jsx)(`div`,{className:`klock-stage__inner`,children:(0,F.jsx)(Dn,{hue:re,pulse:T,harmonicDayPercent:N,microCyclePercent:ne,dayLabel:b,monthLabel:k,monthDay:E.day,kaiPulseEternal:T,glowPulse:!0,pulseIntervalSec:d,rimFlash:p,solarSpiralStepString:`${L(x)}:${L(S)}`,eternalBeatIndex:x,eternalStepIndex:S})})})}),(0,F.jsx)(`div`,{className:`kk-pop__foot`,children:(0,F.jsx)(`span`,{className:`kk-pop__hint`,children:`Tap the Klok for more details or press x to return.`})})]})]}),document.body):null;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{ref:s,className:`kai-feed-status kai-feed-status--slim${p?` kai-feed-status--flash`:``}`,onClick:i,onKeyDown:o,tabIndex:0,role:`button`,"aria-haspopup":`dialog`,"aria-expanded":n,"aria-label":`Kai status (open Kai-Klok)`,"data-layout":c,"data-bottom":l,"data-kai-bsi":g,"data-kai-ark":C,"data-kai-dmy":A,"data-day-chakra":D,"data-month-chakra":O,"data-ark-chakra":w,"data-day-num":E.day,"data-month-num":E.month,"data-year-num":E.year,style:M,children:[(0,F.jsxs)(`div`,{className:`kai-status__top`,"aria-label":`Kai timeline (day row)`,children:[(0,F.jsxs)(`span`,{className:`kai-status__bsiWrap`,"aria-label":`Beat step ${g}`,children:[(0,F.jsx)(`span`,{className:`kai-status__kLabel`,"aria-hidden":`true`,children:`KAIROS`}),(0,F.jsx)(`span`,{className:`kai-status__bsi`,title:g,children:g})]}),oe,se,ce,u?ae:null]}),(0,F.jsxs)(`div`,{className:`kai-status__mid`,"aria-label":`Kai timeline (month/ark row)`,children:[le,I,R]}),(0,F.jsxs)(`div`,{className:`kai-status__bottom`,"aria-label":`Next pulse row`,children:[u?null:ae,ie]}),(0,F.jsxs)(`div`,{className:`kai-feed-status__bar`,"aria-hidden":`true`,children:[(0,F.jsx)(`div`,{className:`kai-feed-status__barFill`}),(0,F.jsx)(`div`,{className:`kai-feed-status__barSpark`})]})]}),z]})}function kn(e){return typeof e==`object`&&!!e}function q(e){return typeof e==`number`&&Number.isFinite(e)}function J(e){return typeof e==`string`}function An(e){if(!Array.isArray(e))return!1;for(let t of e)if(!J(t))return!1;return!0}function jn(e){let t=e.trim();return t=t.replace(/[)\].,;:!?]+$/g,``),t=t.replace(/^[([{"'`]+/g,``),t.trim()}function Mn(){let e=globalThis.location?.origin;return typeof e==`string`&&e.length>0?e:`https://phi.network`}function Nn(e){let t=jn(e);try{return new URL(t)}catch{}try{return new URL(t,Mn())}catch{return null}}function Pn(e){let t=jn(e);if(/%[0-9A-Fa-f]{2}/.test(t))try{t=decodeURIComponent(t)}catch(e){let t=e instanceof Error?e.message:`decodeURIComponent failed`;throw Error(t)}return t.includes(` `)&&(t=t.replaceAll(` `,`+`)),/[+/=]/.test(t)&&(t=t.replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/g,``)),jn(t)}function Fn(e){let t=e.startsWith(`j:`)||e.startsWith(`c:`)?e.slice(2):e;return/^[A-Za-z0-9_-]{16,}$/.test(t)}function In(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=t.length%4;return n===2?t+=`==`:n===3&&(t+=`=`),t}function Ln(e){let t=jn(e),n=In(t.startsWith(`j:`)||t.startsWith(`c:`)?t.slice(2):t),r=globalThis;if(typeof r.atob!=`function`)throw Error(`Base64 decode failure: atob() unavailable`);if(r.TextDecoder===void 0)throw Error(`Base64 decode failure: TextDecoder unavailable`);try{let e=r.atob(n),t=new Uint8Array(e.length);for(let n=0;n{if(!e)return;let t=Pn(e);Fn(t)&&(n.includes(t)||n.push(t))},i=jn(e);Fn(i)&&r(i);let a=Nn(i);if(!a)return n;r(Bn(a.hash));let o=a.hash&&a.hash.startsWith(`#`)?a.hash.slice(1):a.hash,s=new URLSearchParams(o),c=a.searchParams,l=[`p`,`t`,`token`,`capsule`];r(Vn(c,s,l));for(let e of l)r(s.get(e)),r(c.get(e));if(r(zn(a.pathname)),t<1){let e=[...c.getAll(`add`),...s.getAll(`add`)];for(let n of e){let e=jn(n);if(!e)continue;let i=e;if(/%[0-9A-Fa-f]{2}/.test(i))try{i=decodeURIComponent(i)}catch(e){let t=e instanceof Error?e.message:`decodeURIComponent(add) failed`;throw Error(t)}for(let e of Hn(i,t+1))r(e)}}return n}function Un(e){let t=jn(e);if(t.startsWith(`j:`)||t.startsWith(`c:`))return{rootRef:t,addRefs:[]};let n=Nn(t);if(!n)return{rootRef:null,addRefs:[]};let r=n.hash&&n.hash.startsWith(`#`)?n.hash.slice(1):n.hash,i=new URLSearchParams(r),a=n.searchParams,o=i.get(`root`)??a.get(`root`),s=i.get(`v`)??a.get(`v`),c=[...i.getAll(`add`),...a.getAll(`add`)].map(e=>jn(e)).filter(e=>e.length>0),l=o?jn(o):null;return{v:s?jn(s):void 0,rootRef:l,addRefs:c}}function Wn(e){if(kn(e)&&kn(e.capsule))return e.capsule;if(kn(e)&&kn(e.data)){let t=e.data;if(kn(t)&&kn(t.capsule))return t.capsule;if(kn(t)&&(`post`in t||`message`in t||`share`in t||`reaction`in t))return t}return kn(e)&&(`post`in e||`message`in e||`share`in e||`reaction`in e)||kn(e)&&(`pulse`in e||`u`in e||`kind`in e||`userId`in e||`userPhiKey`in e)?e:null}function Gn(e){let t=q(e.pulse)?e.pulse:q(e.u)?e.u:void 0,n=q(e.beat)?e.beat:q(e.b)?e.b:void 0,r=q(e.stepIndex)?e.stepIndex:q(e.s)?e.s:void 0,i=J(e.chakraDay)||q(e.chakraDay)?e.chakraDay:J(e.c)||q(e.c)?e.c:void 0;return{...e,pulse:t,beat:n,stepIndex:r,chakraDay:i}}function Kn(e){return Rn(Ln(jn(e)))}function qn(e,t){let n=Wn(e);if(!n)throw Error(`Invalid payload (missing capsule)`);let r=Gn(n),i=kn(e)?e:null,a=i&&kn(i.data)?i.data:null,o=Nn(t),s=(()=>{let e=i?.path;if(An(e))return e;let t=a?.path;return An(t)?t:o?o.pathname.split(`/`).filter(Boolean):[]})();return{url:t,appId:(i&&J(i.appId)?i.appId:void 0)??(a&&J(a.appId)?a.appId:void 0)??(s[0]===`s`&&s.length>=2?s[1]:void 0),userId:(i&&J(i.userId)?i.userId:void 0)??(a&&J(a.userId)?a.userId:void 0)??(J(r.userId)?r.userId:J(r.userPhiKey)?r.userPhiKey:void 0),kind:(i&&J(i.kind)?i.kind:void 0)??(a&&J(a.kind)?a.kind:void 0)??(J(r.kind)?r.kind:r.post?`post`:r.message?`message`:r.share?`share`:r.reaction?`reaction`:void 0),pulse:(i&&q(i.pulse)?i.pulse:void 0)??(a&&q(a.pulse)?a.pulse:void 0)??(q(r.pulse)?r.pulse:void 0),beat:(i&&q(i.beat)?i.beat:void 0)??(a&&q(a.beat)?a.beat:void 0)??(q(r.beat)?r.beat:void 0),stepIndex:(i&&q(i.stepIndex)?i.stepIndex:void 0)??(a&&q(a.stepIndex)?a.stepIndex:void 0)??(q(r.stepIndex)?r.stepIndex:void 0),chakraDay:(i&&(J(i.chakraDay)||q(i.chakraDay))?i.chakraDay:void 0)??(a&&(J(a.chakraDay)||q(a.chakraDay))?a.chakraDay:void 0)??(J(r.chakraDay)||q(r.chakraDay)?r.chakraDay:void 0),capsule:r,path:s}}function Jn(e){try{let t=jn(e),n=Un(t);if(n.rootRef){let t=qn(Kn(n.rootRef),e),r=[];for(let e of n.addRefs)if(!(!e.startsWith(`j:`)&&!e.startsWith(`c:`)))try{let t=Kn(e);r.push(qn(t,e))}catch{}return{ok:!0,data:{...t,url:e,stream:{v:n.v,rootRef:n.rootRef,addRefs:n.addRefs,addData:r}}}}let r=Hn(t)[0]??null;if(!r)return{ok:!1,error:`No capsule token found (expected /s/, /p~, /stream/p/, ?p=, #t=, #/p~, a raw token, or a Memory Stream with #root=j:).`};let i=Rn(Ln(r));if(!kn(i))return{ok:!1,error:`Payload is not an object`};let a=Gn(i),o=Nn(t),s=o?o.pathname.split(`/`).filter(Boolean):[],c=s[0]===`s`&&s.length>=2?s[1]:void 0,l=J(a.userId)?a.userId:J(a.userPhiKey)?a.userPhiKey:void 0,u=J(a.kind)?a.kind:a.post?`post`:a.message?`message`:a.share?`share`:a.reaction?`reaction`:void 0,d=s.length>=8?s[6]:void 0;return{ok:!0,data:{url:e,appId:c,userId:l,kind:u??d,pulse:a.pulse,beat:a.beat,stepIndex:a.stepIndex,chakraDay:a.chakraDay,capsule:a,path:s}}}catch(e){return{ok:!1,error:e instanceof Error?e.message:`Decode error`}}}const Yn=`/stream`,Xn=(()=>{if(typeof window>`u`)return Yn;let e=window.location?.origin;return!e||e===`null`?Yn:`${e.replace(/\/+$/g,``)}${Yn}`})();(()=>{if(typeof window>`u`)return`/s`;let e=window.location?.origin;return!e||e===`null`?`/s`:`${e.replace(/\/+$/g,``)}/s`})();function Zn(e){let t=String(e??``).trim();return t=t.replace(/[)\].,;:!?]+$/g,``),t=t.replace(/^[([{"'`]+/g,``),t.trim()}function Qn(e){let t=Zn(e);if(/%[0-9A-Fa-f]{2}/.test(t))try{t=decodeURIComponent(t)}catch{}return t.includes(` `)&&(t=t.replaceAll(` `,`+`)),/[+/=]/.test(t)&&(t=t.replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/g,``)),Zn(t)}function $n(e){let t=Qn(e);return`${Xn||`/stream`}#t=${encodeURIComponent(t)}`}function er(e){return $n(e)}var tr=(e,t=8,n=4)=>e.length<=t+n?e:`${e.slice(0,t)}…${e.slice(-n)}`,nr=e=>{if(e)try{return new URL(e).host}catch{return}},rr=e=>typeof e==`string`&&e.trim().length>0,ir=e=>String(e??``).toUpperCase(),Y=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function ar(e){let t=String(e??``),n=t.length;return{lines:t.length?t.split(/\r\n|\r|\n/).length:0,chars:n}}function or(e,t){let{lines:n,chars:r}=ar(e);return{shouldCollapse:n>(t===`code`?18:10)||r>(t===`code`?1400:700),lines:n,chars:r,maxHeightPx:t===`code`?320:240}}function sr(e){return e instanceof HTMLElement?!!e.closest(`a,button,input,textarea,select,summary,[role="button"],[role="link"],[data-no-open="true"]`):!1}var cr=`/stream`,lr=`/s`,ur=`2`,dr=12e4,X=`j:`,fr=`s:`;function Z(e){let t=e.trim();return t=t.replace(/[)\].,;:!?]+$/g,``),t=t.replace(/^[([{"'`]+/g,``),t.trim()}function pr(e){let t=Z(e);if(/%[0-9A-Fa-f]{2}/.test(t))try{t=decodeURIComponent(t)}catch{}return t.includes(` `)&&(t=t.replaceAll(` `,`+`)),/[+/=]/.test(t)&&(t=t.replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/g,``)),Z(t)}function mr(e){return/^[A-Za-z0-9_-]{16,}$/.test(e)}function hr(){let e=typeof Xn==`string`?Xn.trim():``;if(e)return e.replace(/\/+$/g,``).replace(/\/stream\/?$/g,``);if(typeof window>`u`)return``;let t=window.location?.origin;return t&&t!==`null`?t.replace(/\/+$/g,``):``}function gr(){return hr()||`https://x.invalid`}function _r(){let e=hr();return e?`${e}${cr}`:cr}function vr(){let e=hr();return e?`${e}${lr}`:lr}function yr(e){let t=e.trim();try{return new URL(t)}catch{try{return new URL(t,gr())}catch{return null}}}function br(e){let t=Z(e),n=yr(t),r=n?n.pathname:t;return/^\/s(?:\/|$)/.test(r)}function xr(e){{let t=e.match(/\/s\/([^/?#]+)/);if(t?.[1])return t[1]}{let t=e.match(/\/p(?:\u007e|%7[Ee])\/?([^/?#]+)/);if(t?.[1])return t[1]}{let t=e.match(/\/(?:stream|feed)\/p\/([^/?#]+)/);if(t?.[1])return t[1]}{let t=e.match(/\/p\/([^/?#]+)/);if(t?.[1])return t[1]}return null}function Sr(e,t=0){let n=[],r=e=>{if(!e)return;let t=pr(e);t&&mr(t)&&(n.includes(t)||n.push(t))},i=Z(e);mr(i)&&r(i);let a=yr(i);if(!a)return n;let o=a.hash&&a.hash.startsWith(`#`)?a.hash.slice(1):``,s=new URLSearchParams(o),c=a.searchParams;for(let e of[`t`,`p`,`token`,`capsule`])r(s.get(e)),r(c.get(e));let l=s.get(`v`),u=c.get(`v`);for(let e of[l,u]){if(!e)continue;let t=pr(e);/^\d{1,4}$/.test(t)||t!==ur&&r(t)}if(r(xr(a.pathname)),t<1){let e=[...c.getAll(`add`),...s.getAll(`add`)];for(let n of e){let e=Z(n);if(e){if(/%[0-9A-Fa-f]{2}/.test(e))try{e=decodeURIComponent(e)}catch{}for(let n of Sr(e,t+1))r(n)}}}return n}function Cr(e){let t=_r(),n=pr(e);return`${t}#t=${encodeURIComponent(n)}`}function wr(e){let t=Sr(Z(e))[0];return t?Cr(t):null}function Q(e){let t=Z(e),n=yr(t);if(n){let e=n.hash&&n.hash.startsWith(`#`)?n.hash.slice(1):``,t=new URLSearchParams(e),r=n.searchParams;if(t.get(`root`)||r.get(`root`)){let e=_r(),n=new URL(e||cr,gr()),i=new URLSearchParams;for(let[e,n]of t.entries())i.append(e,n);for(let[e,t]of r.entries())i.append(e,t);return n.hash=i.toString()?`#${i.toString()}`:``,n.search=``,n.toString()}}if(br(t))return t;let r=Sr(t)[0];return r?Cr(r):t}function Tr(e){let t=_r().replace(/\/stream\/?$/g,``),n=pr(e);return[n,`${t}/stream#t=${n}`,`${t}/stream?t=${n}`,`${t}/stream/t=${n}`,`${t}/p#t=${n}`,`${t}/p?t=${n}`,`${t}/stream/p/${n}`,`${t}/p#p=${n}`,`${t}/p?p=${n}`,`${t}/p#token=${n}`,`${t}/p?token=${n}`,`${t}/stream#v=${n}`,`${t}/stream?v=${n}`]}function Er(e){let t=new Set,n=e=>{let n=e.trim();if(!n||t.has(n))return null;t.add(n);let r=Jn(n);return r.ok?r:null},r=Z(e),i=n(r);if(i)return{decoded:i,resolvedUrl:Q(r)};let a=Sr(r);for(let e of a)for(let t of Tr(e)){let r=n(t);if(r)return{decoded:r,resolvedUrl:Cr(e)}}return{decoded:Jn(r),resolvedUrl:Q(r)}}function Dr(e){if(!Y(e))return null;let t=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==void 0,n=e=>t(e,`post`)||t(e,`message`)||t(e,`share`)||t(e,`reaction`),r=(e,n)=>{for(let r of[`post`,`message`,`share`,`reaction`])t(n,r)&&e[r]===void 0&&(e[r]=n[r])},i=e,a=Y(i.data)?i.data:null,o=n(i),s=!!a&&n(a),c=Y(i.capsule)?i.capsule:null,l=a&&Y(a.capsule)?a.capsule:null,u=c??l;if(u&&(o||s)){let e={...u};return s&&a&&r(e,a),o&&r(e,i),e}return u||(o?i:s&&a?a:i)}function Or(e){if(e===null)return null;if(typeof e==`number`)return Number.isFinite(e)?e:null;if(typeof e==`string`||typeof e==`boolean`)return e;if(typeof e==`bigint`)return e.toString();if(Array.isArray(e))return e.map(Or);if(e&&typeof e==`object`){let t=e,n=Object.keys(t).sort((e,t)=>e.localeCompare(t)),r={};for(let e of n)r[e]=Or(t[e]);return r}return null}function kr(e){let t=``,n=32768;for(let r=0;rFr(`leaf:${e}`));for(;t.length>1;){let e=[];for(let n=0;n0)return`p:${Math.floor(a)}`;let o=t.kaiSignature;if(typeof o==`string`&&o.trim())return`ks:${o.trim()}`}return`h:${Fr(JSON.stringify(Or(e)))}`}function Rr(e){return`${fr}${jr(JSON.stringify(Or(e)))}`}function zr(e){let t=Z(e),n=t.startsWith(fr)?t.slice(2):t;if(!/^[A-Za-z0-9_-]{16,}$/.test(n))return null;try{let e=Mr(n),t=JSON.parse(e);if(!t||typeof t!=`object`)return null;let r=t,i=r.v,a=r.id,o=r.m,s=r.n,c=r.a,l=r.r;return typeof i!=`string`||typeof a!=`string`||typeof o!=`string`||typeof s!=`number`||typeof c!=`number`||typeof l!=`string`?null:{v:i,id:a,m:o,n:s,a:c,r:l}}catch{return null}}var Br=(e,t)=>{let n=e%t;return n>=0n?n:n+t},Vr=(e,t)=>{if(t===0n)throw Error(`Division by zero`);let n=e/t;return e%t===0n||e>=0n?n:n-1n},Hr=e=>{let t=BigInt(2**53-1),n=BigInt(-(2**53-1));return e>t?2**53-1:eString(Math.max(0,Math.floor(e))).padStart(2,`0`);function qr(e,t,n,r,i,a){let o=Gr(t),s=`${Kr(t)}:${Kr(n)}`;return{arc:o,label:s,line:`☤KAI:${e} • ${s} D${Math.max(1,Math.floor(r))}/M${Math.max(1,Math.floor(i))}/Y${Math.floor(a)}`}}function Jr(e){let t=Math.max(0,Math.min(43,Math.floor(e)))/44;return t>=1?.999999999999:t}var Yr={Root:[255,88,88],Sacral:[255,146,88],"Solar Plexus":[255,215,128],Heart:[88,255,174],Throat:[42,197,255],"Third Eye":[164,126,255],Crown:[238,241,251],Krown:[238,241,251]};function Xr(e){if(e&&typeof e==`object`&&`source`in e){let t=e.source;return typeof t==`string`?t:void 0}}function Zr(e,t){if(e&&typeof e==`object`&&`kind`in e){let t=e.kind;if(typeof t==`string`&&t.trim().length>0)return t}return t}var Qr=256;function $r(e){let t=yr(Z(e));if(!t)return[];let n=t.hash&&t.hash.startsWith(`#`)?t.hash.slice(1):``,r=new URLSearchParams(n),i=t.searchParams,a=[...r.getAll(`add`),...i.getAll(`add`)],o=[];for(let e of a){let t=Z(e);if(!t)continue;if(/%[0-9A-Fa-f]{2}/.test(t))try{t=decodeURIComponent(t)}catch{}if(t.startsWith(X)&&t.length>10){o.push(t);continue}let n=Pr(t);if(n&&Dr(n)){let e=Z(t.startsWith(X)?t.slice(2):t);o.push(`${X}${e}`);continue}let r=Sr(t)[0];if(r){o.push(Cr(r));continue}if(br(t)){o.push(t);continue}o.push(Q(t))}return o.slice(-Qr)}function ei(e){let t=yr(Z(e));if(!t)return null;let n=t.hash&&t.hash.startsWith(`#`)?t.hash.slice(1):``,r=new URLSearchParams(n),i=t.searchParams,a=r.get(`root`)??i.get(`root`);if(!a)return null;if(a=Z(a),/%[0-9A-Fa-f]{2}/.test(a))try{a=decodeURIComponent(a)}catch{}if(a.startsWith(X))return a;let o=Pr(a);return o&&Dr(o)?`${X}${Z(a)}`:null}function ti(e){let t=yr(Z(e));if(!t)return null;let n=t.hash&&t.hash.startsWith(`#`)?t.hash.slice(1):``,r=new URLSearchParams(n),i=t.searchParams,a=r.get(`seg`)??i.get(`seg`);if(!a)return null;let o=Z(a);if(/%[0-9A-Fa-f]{2}/.test(o))try{o=decodeURIComponent(o)}catch{}return zr(o)}function ni(e){let t=Z(e);if(!t)return null;if(t.startsWith(X)||br(t))return t;{let e=yr(t);if(e){let n=e.hash&&e.hash.startsWith(`#`)?e.hash.slice(1):``,r=new URLSearchParams(n),i=e.searchParams;if(r.get(`root`)||i.get(`root`))return Q(t)}}let n=Sr(t)[0];return n?Cr(n):null}function ri(e){if(typeof e==`string`)return ni(e);if(e&&typeof e==`object`){let t=e;if(typeof t.url==`string`)return ni(t.url);if(typeof t.href==`string`)return ni(t.href)}return null}function ii(e,t=0){if(!e||typeof e!=`object`||Array.isArray(e)||t>4)return null;let n=e,r=n.skip;if(Array.isArray(r)&&typeof r[1]==`string`){let e=ni(r[1]);if(e)return e}for(let e of`prevUrl.prevURL.prev.prevId.prev_id.previousUrl.previousURL.previous.previousId.previous_id.parentUrl.parentURL.parent.parentId.parent_id.replyToUrl.replyToURL.replyTo.replyToId.replyTo_id.inReplyToUrl.inReplyToURL.inReplyTo.inReplyToId.inReplyTo_id.refUrl.ref_url.ref`.split(`.`)){let t=ri(n[e]);if(t)return t}for(let e of[`capsule`,`data`,`payload`]){let r=ii(n[e],t+1);if(r)return r}return null}function ai(e){let t=Math.max(0,Math.floor(e));if(t<=2)return t;let n=1,r=2;for(;;){let e=n+r;if(e>t)return r;n=r,r=e}}function oi(e,t){let n=_r(),r=new URL(n||cr,gr()),i=[e,...t],a=Ir(i),o={v:ur,id:`seg:${a}:${i.length}`,m:a,n:i.length,a:t.length,r:tr(e,8,6)},s=new URLSearchParams;s.set(`v`,ur),s.set(`root`,e),s.set(`seg`,Rr(o));for(let e of t)s.append(`add`,e);return r.hash=s.toString()?`#${s.toString()}`:``,r.search=``,{url:r.toString(),rootRef:e,adds:[...t],meta:o}}function si(e,t){let n=0,r=t.length;for(;n0?a:i)),s=t.length-o;return{keepFrom:s,kept:t.slice(s)}}function ci(e,t,n=0){if(n>64)return{primary:oi(e,[]),archives:[]};let r=oi(e,t);if(r.url.length<=dr)return{primary:r,archives:[]};let{keepFrom:i,kept:a}=si(e,t),o=oi(e,a);if(o.url.length>dr)return{primary:oi(e,[]),archives:[]};if(i<=0)return{primary:o,archives:[]};let s=t.slice(0,i),c=a[0];if(!c)return{primary:o,archives:[]};let l=ci(c,s,n+1);return{primary:o,archives:[l.primary,...l.archives]}}function li(e){let t=[],n=new Set;for(let r of e){let e=String(r??``).trim();e&&(n.has(e)||(n.add(e),t.push(e)))}return t}function ui(e){let t=0;for(let n of e)Z(n).startsWith(X)&&t++;return t}function di(e,t){let n=Z(e);if(t)return`k:${Lr(t)}`;if(n.startsWith(X)){let e=Pr(n);return e?`k:${Lr(e)}`:`k:${Fr(n)}`}let r=Sr(n)[0];return r?`t:${pr(r)}`:`u:${Q(n)}`}var fi=4096,pi=new Map,mi=0,hi=0,gi=!1,_i=new Set;function vi(){if(gi)return;gi=!0;let e=()=>{gi=!1,hi++;for(let e of _i)e()};typeof queueMicrotask==`function`?queueMicrotask(e):Promise.resolve().then(e)}function yi(e){return _i.add(e),()=>_i.delete(e)}function bi(){return hi}function xi(){return 0}function Si(e){let t=pi.get(e.key);if(!(t&&t.prevKey===e.prevKey&&t.payloadRef===e.payloadRef&&t.fallbackRef===e.fallbackRef))for(pi.has(e.key)&&pi.delete(e.key),pi.set(e.key,{...e,tick:++mi}),vi();pi.size>fi;){let e=pi.keys().next().value;if(!e)break;pi.delete(e),vi()}}function Ci(e,t){let n=[],r=new Set,i=pi.get(e)?.prevKey??null,a=0;for(;i&&atypeof e==`string`&&e.trim().toLowerCase()===`manual`,Oi=e=>{if(rr(e))return Di(e)?Ti:e};function ki(e,t=0){if(t>5)return!1;if(Di(e))return!0;if(Array.isArray(e)){for(let n of e)if(ki(n,t+1))return!0;return!1}if(e&&typeof e==`object`){let n=e;for(let e of Object.keys(n))if(ki(n[e],t+1))return!0}return!1}function Ai(e,t){if(!Y(e))return;let n=e[t];return typeof n==`string`&&n.trim()?n.trim():void 0}function ji(e,t){if(!Y(e))return[];let n=e[t];if(!Array.isArray(n))return[];let r=[];for(let e of n)typeof e==`string`&&e.trim()&&r.push(e.trim());return r}function Mi(e){if(!Y(e))return{};let t=Ai(e,`caption`),n=e.body;if(Y(n)){let e=Ai(n,`kind`),r=e===`text`||e===`md`||e===`code`||e===`html`?e:void 0;if(r===`text`)return{text:Ai(n,`text`)??t,kind:r};if(r===`md`)return{text:Ai(n,`md`)??t,kind:r};if(r===`code`)return{text:Ai(n,`code`)??t,kind:r};if(r===`html`)return{text:Ai(n,`html`)??t,kind:r}}return{text:t,kind:void 0}}function Ni(e){if(!Y(e))return[];let t=e.attachments;if(!Y(t))return[];let n=t.items;if(!Array.isArray(n))return[];let r=[];for(let e of n){if(!Y(e))continue;let t=Ai(e,`url`);if(t){r.push({url:t});continue}let n=Ai(e,`href`);n&&r.push({url:n})}return r}function Pi(e,t){let n=e??t;if(!n)return{};let{text:r,kind:i}=Mi(n),a=ji(n,`tags`),o=Ni(n),s=typeof r==`string`&&r.trim().length>0,c=o.length>0,l=a.length>0;return!s&&!c&&!l?{}:{post:{title:void 0,text:s?r:void 0,tags:l?a:void 0,media:c?o.map(e=>({kind:`url`,url:e.url})):void 0},bodyKind:i}}function Fi(e){if(typeof document>`u`)return!1;try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,`true`),t.style.position=`fixed`,t.style.left=`-9999px`,t.style.top=`0`,document.body.appendChild(t);let n=document.activeElement instanceof HTMLElement?document.activeElement:null;t.focus(),t.select();let r=document.execCommand(`copy`);return document.body.removeChild(t),n&&n.focus(),r}catch{return!1}}function Ii(e){if(typeof window>`u`)return null;let t=window.navigator;return t!==void 0&&t.clipboard!==void 0&&typeof t.clipboard.writeText==`function`&&window.isSecureContext?t.clipboard.writeText(e):null}function Li(e,t,n){if(Fi(e)){t();return}let r=Ii(e);if(r){t(),r.catch(e=>n(e));return}n()}var Ri=`sigil:urls`,zi=`sigil:feed`,Bi=`kai-sigil-registry`,Vi=`kai:sigils:v1`,Hi=`kai-feed-registry`,Ui=0,Wi=!1,Gi=new Set,Ki=!1,qi=null,Ji=null;function Yi(){if(Wi)return;Wi=!0;let e=()=>{Wi=!1,Ui++;for(let e of Gi)e()};typeof queueMicrotask==`function`?queueMicrotask(e):Promise.resolve().then(e)}function Xi(e){return Gi.add(e),()=>Gi.delete(e)}function Zi(){return Ui}function Qi(){return 0}function $i(e){let t=[];if(Array.isArray(e)){for(let n of e)typeof n==`string`&&n.trim()&&t.push(n.trim());return t}if(Y(e)){let n=e.urls;if(Array.isArray(n)){for(let e of n)typeof e==`string`&&e.trim()&&t.push(e.trim());return t}let r=Object.keys(e).filter(e=>e.startsWith(`http`)||e.startsWith(`/`)||e.includes(`/stream`)||e.includes(`/s/`));if(r.length)return r;for(let n of Object.values(e))Y(n)&&typeof n.url==`string`&&n.url.trim()&&t.push(n.url.trim());return t}return t}function ea(e){if(typeof window>`u`||window.localStorage===void 0)return[];let t=window.localStorage.getItem(e);if(!t)return[];try{return $i(JSON.parse(t))}catch{return[]}}function ta(e){let t=e.trim();if(!t)return``;try{return new URL(t,gr()).toString()}catch{return t}}function na(){let e=li([...ea(zi),...ea(Ri),...ea(Vi)]),t=[];for(let n of e){let e=ta(n);e&&t.push(e)}return li(t)}function ra(e){let t=Z(e);return t?t.startsWith(X)?oi(t,[]).url:wr(t)??Q(t):``}function ia(e){let t=li($r(e))[0]??e;return di(t,(t.startsWith(X)?Pr(t):null)??void 0)}function aa(e){let t=Z(e);if(!t)return null;if(t.startsWith(X))return Pr(t);let n=Er(t);return n.decoded.ok?n.decoded.data:null}function oa(e,t){let n=Z(e);if(!n)return e;let r=li($r(n));if(r.length>0)return r[0];let i=n,a=t===void 0?null:t;a||=aa(i);let o=new Set;for(let e=0;e<48;e++){let e=di(i,a??void 0);if(o.has(e))break;o.add(e);let t=a?ii(a):null;if(!t)return i;i=t,a=aa(i)}return i}function sa(e,t){let n=oa(e,t);return di(n,(n.startsWith(X)?Pr(n):aa(n))??void 0)}function ca(e){let t=Z(e);if(/^[0-9a-fA-F]{64}$/.test(t))try{return er(t.toLowerCase())}catch{}return`${vr()}/${encodeURIComponent(t)}`}function la(e,t){if(!Y(e))return null;for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim())return t.trim()}return null}function ua(e,t){let n=Z(e);if(br(n))return n;let r=la(t,[`sigilUrl`,`sigilURL`,`sigil_url`,`sigilHref`,`sigil_href`,`sUrl`,`s_url`,`s`])??null;if(r&&br(r))return Q(r);let i=la(t,[`id`,`contentId`,`cid`,`hash`,`contentHash`])??null;if(i&&/^[0-9a-fA-F]{64}$/.test(i))return ca(i);let a=Y(t)?t.sigilId:void 0;if(typeof a==`string`&&a.trim())return ca(a);let o=Sr(n)[0];return o?ca(o):null}function da(e,t){let n=oa(e,t),r=aa(n),i=ua(n,r?Dr(r):null);return i?Q(i):ra(n)}function fa(e){let t=yr(e);if(!t)return 0;let n=t.hash&&t.hash.startsWith(`#`)?t.hash.slice(1):``,r=new URLSearchParams(n),i=t.searchParams;return r.getAll(`add`).length+i.getAll(`add`).length}function pa(e){let t=fa(e),n=e.length;return t*1e5+n}function ma(e){let t=Sr(e)[0];if(t)return`t:${pr(t)}`;let n=ei(e);if(n){let e=Pr(n);return e?`r:${Lr(e)}`:`r:${Fr(n)}`}return`u:${Q(e)}`}function ha(e,t){if(typeof window>`u`||window.localStorage===void 0)return{changed:!1,added:!1,updated:!1,value:t};let n=ta(t);if(!n)return{changed:!1,added:!1,updated:!1,value:t};try{let t=window.localStorage.getItem(e),r=[];if(t){let e=JSON.parse(t);if(Array.isArray(e))for(let t of e)typeof t==`string`&&r.push(t)}let i=new Map,a=[];for(let e of r){let t=ta(e);if(!t)continue;let n=ma(t),r=pa(t),o=i.get(n);o?r>o.score&&i.set(n,{url:t,score:r,index:o.index}):(i.set(n,{url:t,score:r,index:a.length}),a.push(n))}let o=ma(n),s=pa(n),c=i.get(o),l=!1,u=!1;c?s>c.score&&(i.set(o,{url:n,score:s,index:c.index}),u=!0):(i.set(o,{url:n,score:s,index:a.length}),a.push(o),l=!0);let d=[];for(let e of a){let t=i.get(e);t&&d.push(t.url)}let f=JSON.stringify(r),p=JSON.stringify(d);return f===p?{changed:!1,added:l,updated:u,value:n}:(window.localStorage.setItem(e,p),{changed:!0,added:l,updated:u,value:n})}catch{return{changed:!1,added:!1,updated:!1,value:n}}}function ga(e){if(!(typeof window>`u`)){try{window.__SIGIL__?.registerSigilUrl?.(e)}catch{}try{window.dispatchEvent(new CustomEvent(`sigil:url-registered`,{detail:{url:e}}))}catch{}try{if(`BroadcastChannel`in window){let t=new BroadcastChannel(Bi);t.postMessage({type:`sigil:add`,url:e}),t.close()}}catch{}}}function _a(e){if(!(typeof window>`u`)){try{window.dispatchEvent(new CustomEvent(`sigil:feed-registered`,{detail:{url:e}}))}catch{}try{if(`BroadcastChannel`in window){let t=new BroadcastChannel(Hi);t.postMessage({type:`feed:add`,url:e}),t.close()}}catch{}}}function va(e){let t=0,n=e.toLowerCase();return br(e)&&(t+=5e6),(/[?&#]t=/.test(n)||n.includes(`/stream/t`))&&(t+=2e6),n.includes(`/stream/p/`)&&(t-=5e5),/[?&#]v=/.test(n)&&(t-=25e4),t+=pa(e),t}function ya(e,t){if(typeof window>`u`||window.localStorage===void 0)return;let n=ea(zi);if(!n.length)return;let r=[],i=null,a=-1/0;for(let t of n){let n=ta(t);if(!n)continue;if(sa(n)!==e){r.push(n);continue}let o=va(n);o>a&&(a=o,i=n)}if(t){let e=ta(t);if(e){let t=va(e);t>a&&(a=t,i=e)}}i&&r.push(i);let o=li(r);try{let e=window.localStorage.getItem(zi)??`[]`,t=JSON.stringify($i(JSON.parse(e))),n=JSON.stringify(o);t!==n&&window.localStorage.setItem(zi,n)}catch{}}function ba(){if(typeof window>`u`||Ki)return;Ki=!0;let e=e=>{let t=e.key??``;(t===Ri||t===zi||t===Vi)&&Yi()};try{window.addEventListener(`storage`,e)}catch{}try{`BroadcastChannel`in window&&(qi=new BroadcastChannel(Bi),qi.onmessage=e=>{let t=e.data,n=Y(t)&&typeof t.url==`string`?t.url:null;n&&(ha(Ri,n),Yi())},Ji=new BroadcastChannel(Hi),Ji.onmessage=e=>{let t=e.data,n=Y(t)&&typeof t.url==`string`?t.url:null;n&&(ha(zi,n),Yi())})}catch{}Yi()}function xa(e){return Y(e)&&typeof e.pulse==`number`&&Number.isFinite(e.pulse)?e.pulse:Y(e)&&Y(e.data)&&typeof e.data.pulse==`number`&&Number.isFinite(e.data.pulse)?e.data.pulse:0}function Sa(e){let t=Y(e)?e.appId:void 0;if(typeof t==`string`&&t.trim())return t;let n=Y(e)&&Y(e.data)?e.data.appId:void 0;if(typeof n==`string`&&n.trim())return n}function Ca(e){let t=Y(e)?e.userId:void 0;return t===void 0?Y(e)&&Y(e.data)?e.data.userId:void 0:t}function wa(e){let t=Z(e);if(t.startsWith(X)){let e=Pr(t);if(e){let n=t.startsWith(X)?t:`${X}${t}`;return{kind:`embedded`,rootRef:n,payload:e,openUrl:oi(n,[]).url}}}let n=ei(t);if(n){let e=Pr(n);if(e)return{kind:`embedded`,rootRef:n,payload:e,openUrl:oi(n,[]).url}}return{kind:`sigilUrl`,openUrl:Q(t)}}var Ta=({url:e,depth:t=0,seen:n=[],addChain:r,addIndex:i,threadMode:a=`thread`})=>{let[o,s]=(0,P.useState)(!1),[l,u]=(0,P.useState)(!1),[d,f]=(0,P.useState)(!1),p=(0,P.useSyncExternalStore)(yi,bi,xi),m=(0,P.useMemo)(()=>wa(e),[e]),h=(0,P.useMemo)(()=>Er(e),[e]),g=(0,P.useMemo)(()=>{if(m.kind===`embedded`){let e=m.payload,t=Dr(e);if(!t)return{ok:!1,openUrl:m.openUrl,error:`Invalid embedded payload (missing capsule).`};let n=xa(e),r=Sa(e),i=Ca(e);return{ok:!0,openUrl:m.openUrl,dataRaw:e,storePayload:e,pulse:n,appId:r,userId:i,capsule:t}}let t=h.decoded,n=Q(h.resolvedUrl||e);if(!t.ok)return{ok:!1,openUrl:n,error:(`error`in t?t.error:void 0)??`Decode failed.`};let r=t.data,i=Dr(r);if(!i)return{ok:!1,openUrl:n,error:`Decode ok, but capsule missing.`};let a=typeof t.data.pulse==`number`&&Number.isFinite(t.data.pulse)?t.data.pulse:xa(t.data),o=typeof t.data.appId==`string`&&t.data.appId?t.data.appId:Sa(t.data),s=t.data.userId??Ca(t.data);return{ok:!0,openUrl:n,dataRaw:r,storePayload:t.data,pulse:a,appId:o,userId:s,capsule:i}},[m,h.decoded,h.resolvedUrl,e]),_=g.ok,v=_?g:null,y=_?v.storePayload:null,b=_?v.capsule:null,x=(0,P.useMemo)(()=>ua(e,b),[e,b]),S=(0,P.useMemo)(()=>li(r?[...r]:$r(e)).slice(-Qr),[r,e]),C=(0,P.useMemo)(()=>typeof i==`number`&&Number.isFinite(i)?i:S.length-1,[i,S.length]),w=(0,P.useMemo)(()=>!S.length||C<0||C>=S.length?null:S[C]??null,[S,C]),T=(0,P.useMemo)(()=>_&&y?di(e,y):di(e),[_,y,e]),D=(0,P.useMemo)(()=>[...n,T],[n,T]),O=(0,P.useMemo)(()=>{if(t>=Qr)return null;let e=_?v.dataRaw??y:null,n=w??(e?ii(e):null);if(!n)return null;let r=di(n,(n.startsWith(X)?Pr(n):null)??void 0);return D.includes(r)?null:n},[w,t,D,_,v,y]),k=(0,P.useMemo)(()=>{if(!_||!y)return null;try{return Nr(y)}catch{return null}},[_,y]),A=(0,P.useMemo)(()=>S.length?li(S.slice(0,Math.max(0,C+1))).slice(-Qr):[],[S,C]);(0,P.useLayoutEffect)(()=>{if(!_)return;let e=k,t=Q(g.openUrl),n=null;if(O){let e=null;if(O.startsWith(X))e=Pr(O);else{let t=Er(O);t.decoded.ok&&(e=t.decoded.data)}n=di(O,e??void 0)}Si({key:T,prevKey:n,payloadRef:e??null,fallbackRef:t})},[_,g.openUrl,T,O,k]);let ee=(0,P.useSyncExternalStore)(Xi,Zi,Qi);(0,P.useEffect)(()=>{ba()},[]);let j=(0,P.useMemo)(()=>ia(ra(x??g.openUrl??e)),[x,g.openUrl,e]),M=(0,P.useMemo)(()=>{if(!_)return{origin:null,replies:[]};let t=ra(S.length>0?S[0]:x??e),n=ia(t),r=li([ra(e),ra(g.openUrl),...S.map(e=>ra(e)),...na()]).filter(Boolean),i=new Map,a=(e,t)=>{let n=0,r=e.toLowerCase();return t?br(e)?n+=260:n+=40:((/[?&#]t=/.test(r)||r.includes(`/stream/t`))&&(n+=240),r.includes(`/stream/p/`)&&(n-=25),/[?&#]v=/.test(r)&&(n-=20),br(e)&&(n-=40)),n+=Math.max(0,20-Math.floor(e.length/40)),n+=Math.min(2e5,pa(e)),n};for(let e of r){let t=ta(e);if(!t)continue;let r=ia(t);if(!r)continue;let o=li($r(t)),s=r===n;if(!s&&o.length>0){for(let e of o)if(ia(ra(e))===n){s=!0;break}}if(!s)continue;let c=Er(t),l=c.decoded.ok?xa(c.decoded.data):0,u=a(t,r===n),d=i.get(r);if(!d||u>d.score){let e=wr(t)??t;i.set(r,{url:e,score:u,pulse:l})}}let o=i.get(n)?.url??t,s={key:n,url:o,pulse:(()=>{let e=Er(o);return e.decoded.ok?xa(e.decoded.data):0})()},c=[];for(let[e,t]of i.entries())e!==n&&e!==j&&(br(t.url)||c.push({key:e,url:t.url,pulse:t.pulse}));return c.sort((e,t)=>(t.pulse??0)-(e.pulse??0)),{origin:s,replies:c}},[_,S,x,e,g.openUrl,j,ee]),te=(0,P.useCallback)(()=>{if(!_||!y)return{primary:{url:Q(g.openUrl),rootRef:``,adds:[],meta:{v:ur,id:`seg:none`,m:``,n:0,a:0,r:``}},archives:[]};let e=k??Nr(y),t=li(Ci(T,Qr)),n=li(A),r=ui(n),i=ui(t),a=r>i?n:rt.length?n:t.length>n.length?t:n,o=[];for(let e of a){let t=Z(e);if(!t)continue;if(t.startsWith(X)){o.push(t);continue}let n=Er(t),r=n.decoded.ok?n.decoded.data:null;if(r){let e=di(t,r),n=pi.get(e);if(n?.payloadRef){o.push(n.payloadRef);continue}try{o.push(Nr(r));continue}catch{}}o.push(Q(t))}return ci(e,li(o).slice(-Qr))},[_,y,g.openUrl,k,T,A]),N=(0,P.useMemo)(()=>te(),[te,p]),ne=N.primary.url,re=N.archives.length>0,ie=(0,P.useMemo)(()=>wr(e)??wr(g.openUrl),[e,g.openUrl]),ae=(0,P.useMemo)(()=>Pi(b,_?v.dataRaw:null),[b,_,v]),oe=!!O,se=(0,P.useMemo)(()=>{if(!_||!b)return!1;let e=b;return!!(e.post||e.message||e.share||e.reaction)},[_,b]),ce=(0,P.useMemo)(()=>{if(!_||!b)return!1;let e=b,t=Zr(v.dataRaw,``),n=(rr(e.source)?e.source:void 0)??Xr(v.dataRaw);return Di(t)||Di(n)||ki(e)},[_,b,v]),le=(0,P.useMemo)(()=>se||!!ae.post,[se,ae.post]),I=(0,P.useMemo)(()=>ce||le||oe,[ce,le,oe]),L=I;(0,P.useEffect)(()=>{if(typeof window>`u`||t!==0)return;ba();let n=wr(window.location.href)??ie??wr(g.openUrl)??ne??Q(e),r=li([n,...S.map(e=>ra(e)).filter(Boolean)]);for(let e of r){let t=ha(Ri,e);t.changed&&ga(t.value)}if(L){let e=_?v.dataRaw??y:void 0,t=da(n,e),r=ha(zi,t);r.changed&&_a(r.value),ya(sa(n,e),t)}Yi()},[t,e,g.openUrl,ie,ne,L,S,_,v,y]);let R=(0,P.useMemo)(()=>ie??ne,[ie,ne]),z=(0,P.useMemo)(()=>_?I?R:x??R:g.openUrl,[_,g.openUrl,I,R,x]),ue=(0,P.useMemo)(()=>z,[z]),B=(0,P.useCallback)(()=>{let e=te();return[e.primary.url,...e.archives.map(e=>e.url)].join(` `)},[te]),V=(0,P.useCallback)(()=>{Li(ue,()=>{s(!0),typeof window<`u`&&window.setTimeout(()=>s(!1),1100)},e=>{s(!1)})},[ue]),de=(0,P.useCallback)(()=>{Li(B(),()=>{u(!0),typeof window<`u`&&window.setTimeout(()=>u(!1),1100)},e=>{u(!1)})},[B]);if(!g.ok)return(0,F.jsxs)(`article`,{className:`fc fc--error`,role:`group`,"aria-label":`Invalid Sigil-Glyph`,children:[(0,F.jsx)(`div`,{className:`fc-crystal`,"aria-hidden":`true`}),(0,F.jsxs)(`div`,{className:`fc-shell`,children:[(0,F.jsx)(`header`,{className:`fc-head`,children:(0,F.jsxs)(`div`,{className:`fc-titleRow`,children:[(0,F.jsx)(`span`,{className:`fc-chip fc-chip--danger`,children:`INVALID`}),(0,F.jsx)(`span`,{className:`fc-muted`,children:`Sigil-Glyph capsule could not be resolved`})]})}),(0,F.jsx)(`div`,{className:`fc-error`,role:`alert`,children:g.error}),(0,F.jsxs)(`footer`,{className:`fc-actions`,role:`group`,"aria-label":`Actions`,children:[(0,F.jsx)(`a`,{className:`fc-btn`,href:z,target:`_blank`,rel:`noreferrer`,onClick:e=>e.stopPropagation(),title:`Open the best available href for this capsule`,children:`↗ Open`}),(0,F.jsx)(`button`,{className:`fc-btn`,type:`button`,onClick:V,"aria-pressed":o,"data-state":o?`remembered`:`idle`,title:`Copies the same href as Open for this block.`,children:o?`Remembered`:`Remember`})]})]})]});let H=v.capsule,fe=H.post,pe=H.message,U=H.share,W=H.reaction,G=fe??ae.post,me=typeof v.pulse==`number`&&Number.isFinite(v.pulse)?v.pulse:0,he=c(me),K=Math.max(0,Math.floor(he.beat)),ge=Math.max(0,Math.floor(he.stepIndex)),_e=Wr(he.chakraDay,he.chakraDay),ve=_e===`Crown`?`Krown`:String(_e),{day:ye,month:be,year:xe}=Ur(me),Se=G?`post`:pe?`message`:U?`share`:W?`reaction`:`sigil`,Ce=Zr(v.dataRaw,Se),we=String(Ce),Te=typeof v.appId==`string`&&v.appId?`app ${tr(v.appId,10,4)}`:void 0,Ee=v.userId!==void 0&&v.userId!==null?`user ${tr(String(v.userId),10,4)}`:void 0,De=rr(H.sigilId)?H.sigilId:void 0,Oe=rr(H.phiKey)?H.phiKey:void 0,ke=rr(H.kaiSignature),Ae=ke?`Signature present (Kai Signature)`:`Unsigned capsule`,je=rr(H.author)?H.author:void 0,Me=(rr(H.source)?H.source:void 0)??Xr(v.dataRaw),Ne=ir(I?Ti:Ei),Pe=I?Ti:Ei,Fe=Me?Di(Me)?ir(Ti):ir(Me):void 0,Ie=!!Fe&&Fe!==Ne,Le=Oi(G?.title),Re=Oi(G?.text),ze=Oi(pe?.text),Be=Oi(U?.note),Ve=qr(me,K,ge,ye,be,xe),He=Jr(ge),[Ue,We,Ge]=Yr[ve]??Yr.Crown??[238,241,251],Ke=(me%13+13)%13,qe={"--fc-accent-r":String(Ue),"--fc-accent-g":String(We),"--fc-accent-b":String(Ge),"--fc-pulse-dur":`5236ms`,"--fc-pulse-offset":`${-(Ke*120)}ms`,"--fc-thread-depth":String(t)},Je=I?`memory`:we,Ye=I?`↗ Proof of Memory™`:`↗ Proof of Breath™`,Xe=I?`Open ${Ti}`:`Open ${Ei}`,Ze=t===0&&a!==`self`,Qe=(Re??ze??Be??``)||``,$e=ae.bodyKind===`code`||ae.bodyKind===`html`?`code`:`text`,et=Qe?or(Qe,$e):null,tt=!!et?.shouldCollapse,nt=tt&&!d,rt=`fc-body-${Fr(T).slice(0,10)}`,it=e=>{e.preventDefault(),e.stopPropagation(),f(e=>!e)},at=e=>{if(!Ze&&!sr(e.target??null)){if(`key`in e){let t=e.key;if(t!==`Enter`&&t!==` `)return;e.preventDefault()}try{window.open(z,`_blank`,`noopener,noreferrer`)}catch{}}},ot=C-1;return(0,F.jsxs)(F.Fragment,{children:[a!==`self`&&O?(0,F.jsx)(Ta,{url:O,depth:t+1,seen:D,addChain:S,addIndex:ot,threadMode:a}):null,(0,F.jsxs)(`article`,{className:`fc fc--crystal ${ke?`fc--signed`:`fc--unsigned`} ${Ze?`fc--primary`:`fc--preview`}`,role:Ze?`article`:`link`,tabIndex:Ze?-1:0,onClick:at,onKeyDown:at,"aria-label":`${Pe} glyph`,"data-kind":Je,"data-chakra":ve,"data-signed":ke?`true`:`false`,"data-beat":Kr(K),"data-step":Kr(ge),"data-collapsed":nt?`true`:`false`,style:qe,children:[(0,F.jsx)(`div`,{className:`fc-crystal`,"aria-hidden":`true`}),(0,F.jsx)(`div`,{className:`fc-rim`,"aria-hidden":`true`}),(0,F.jsx)(`div`,{className:`fc-veil`,"aria-hidden":`true`}),(0,F.jsxs)(`div`,{className:`fc-shell`,children:[(0,F.jsx)(`aside`,{className:`fc-left`,"aria-label":I?Ti:Ei,children:(0,F.jsxs)(`div`,{className:`fc-sigilStage`,children:[(0,F.jsx)(`div`,{className:`fc-sigilGlass`,"aria-hidden":`true`}),(0,F.jsx)(`div`,{className:`fc-sigil`,"aria-label":I?Ti:Ei,children:(0,F.jsx)(E,{pulse:me,beat:K,stepPct:He,chakraDay:_e})}),(0,F.jsxs)(`div`,{className:`fc-stamp mono`,"aria-label":`Kai stamp`,children:[(0,F.jsx)(`span`,{className:`fc-stamp__pulse`,title:`Pulse`,children:me}),(0,F.jsx)(`span`,{className:`fc-stamp__sep`,children:`•`}),(0,F.jsx)(`span`,{className:`fc-stamp__bbss`,title:`Beat:Step (zero-based)`,children:Ve.label})]})]})}),(0,F.jsxs)(`section`,{className:`fc-right`,children:[(0,F.jsxs)(`header`,{className:`fc-head`,"aria-label":`Glyph metadata`,children:[(0,F.jsxs)(`div`,{className:`fc-metaRow`,children:[(0,F.jsx)(`span`,{className:`fc-chip fc-chip--kind`,title:I?`${Ti} • type: ${we}`:`${Ei} • type: ${we}`,children:Ne}),Te&&(0,F.jsx)(`span`,{className:`fc-chip`,children:Te}),Ee&&(0,F.jsx)(`span`,{className:`fc-chip`,children:Ee}),!I&&De?(0,F.jsxs)(`span`,{className:`fc-chip fc-chip--sigil`,title:`Sigil-Glyph: ${De}`,children:[`SIGIL-GLYPH `,tr(De,6,4)]}):null,Oe&&(0,F.jsxs)(`span`,{className:`fc-chip fc-chip--phikey`,title:`ΦKey: ${Oe}`,children:[`ΦKEY `,tr(Oe,6,4)]}),je&&(0,F.jsx)(`span`,{className:`fc-chip fc-chip--author`,title:`Author handle / origin`,children:je}),Ie&&Fe&&(0,F.jsx)(`span`,{className:`fc-chip fc-chip--source`,title:`Source`,children:Fe}),(0,F.jsx)(`span`,{className:`fc-chip fc-chip--chakra`,title:`Chakra day`,children:ve}),(0,F.jsx)(`span`,{className:`fc-sig ${ke?`fc-sig--ok`:`fc-sig--warn`}`,title:Ae,"aria-label":Ae,children:ke?`SIGNED`:`UNSIGNED`}),(()=>{let e=ti(ne);return e?(0,F.jsxs)(`span`,{className:`fc-chip`,title:`Merkle: ${e.m}`,children:[`SEG `,tr(e.id,10,6)]}):null})()]}),(0,F.jsxs)(`div`,{className:`fc-kaiRow`,"aria-label":`Kai meta`,children:[(0,F.jsx)(`span`,{className:`fc-kai mono`,title:`Kai meta line`,children:Ve.line}),(0,F.jsx)(`span`,{className:`fc-arc`,title:`Arc`,children:Ve.arc})]})]}),G&&(0,F.jsxs)(`section`,{className:`fc-bodywrap`,"aria-label":`Post body`,children:[rr(Le)&&(0,F.jsx)(`h3`,{className:`fc-title`,children:Le}),rr(Re)?(0,F.jsxs)(`div`,{className:`fc-collapse`,"data-open":d?`true`:`false`,children:[(0,F.jsx)(`div`,{id:rt,className:`fc-collapse__content`,style:{maxHeight:nt?`${et?.maxHeightPx??240}px`:`none`,overflow:nt?`hidden`:`visible`},children:ae.bodyKind===`code`||ae.bodyKind===`html`?(0,F.jsx)(`pre`,{className:`fc-body`,style:{whiteSpace:`pre-wrap`},children:Re}):(0,F.jsx)(`p`,{className:`fc-body`,children:Re})}),tt?(0,F.jsx)(`button`,{className:`fc-btn fc-btn--ghost fc-collapse__toggle`,type:`button`,onClick:it,"aria-expanded":d,"aria-controls":rt,"data-no-open":`true`,title:`Expand/collapse long content`,children:d?`Collapse`:`Expand${et?.lines?` • ${et.lines} lines`:``}`}):null]}):null,Array.isArray(G.tags)&&G.tags.length>0&&(0,F.jsx)(`div`,{className:`fc-tags`,"aria-label":`Tags`,children:G.tags.map(e=>(0,F.jsxs)(`span`,{className:`fc-tag`,children:[`#`,e]},e))}),Array.isArray(G.media)&&G.media.length>0&&(0,F.jsx)(`div`,{className:`fc-media`,"aria-label":`Attached media`,children:G.media.map(e=>{let t=`${e.kind}:${e.url}`,n=nr(e.url)??e.kind;return(0,F.jsx)(`a`,{className:`fc-btn fc-btn--ghost`,href:e.url,target:`_blank`,rel:`noreferrer`,title:e.url,onClick:e=>e.stopPropagation(),children:n},t)})})]}),pe&&(0,F.jsxs)(`section`,{className:`fc-bodywrap`,"aria-label":`Message body`,children:[(0,F.jsxs)(`h3`,{className:`fc-title`,children:[`Message → `,tr(String(pe.toUserId??`recipient`),10,4)]}),rr(ze)?(0,F.jsxs)(`div`,{className:`fc-collapse`,"data-open":d?`true`:`false`,children:[(0,F.jsx)(`div`,{id:`${rt}-m`,className:`fc-collapse__content`,style:{maxHeight:nt?`${et?.maxHeightPx??240}px`:`none`,overflow:nt?`hidden`:`visible`},children:(0,F.jsx)(`p`,{className:`fc-body`,children:ze})}),tt?(0,F.jsx)(`button`,{className:`fc-btn fc-btn--ghost fc-collapse__toggle`,type:`button`,onClick:it,"aria-expanded":d,"aria-controls":`${rt}-m`,"data-no-open":`true`,children:d?`Collapse`:`Expand`}):null]}):null]}),U&&(0,F.jsxs)(`section`,{className:`fc-bodywrap`,"aria-label":`Share body`,children:[(0,F.jsx)(`h3`,{className:`fc-title`,children:`Share`}),(0,F.jsx)(`a`,{className:`fc-link`,href:U.refUrl,target:`_blank`,rel:`noreferrer`,title:U.refUrl,onClick:e=>e.stopPropagation(),children:nr(U.refUrl)??U.refUrl}),rr(Be)?(0,F.jsxs)(`div`,{className:`fc-collapse`,"data-open":d?`true`:`false`,children:[(0,F.jsx)(`div`,{id:`${rt}-s`,className:`fc-collapse__content`,style:{maxHeight:nt?`${et?.maxHeightPx??240}px`:`none`,overflow:nt?`hidden`:`visible`},children:(0,F.jsx)(`p`,{className:`fc-body`,children:Be})}),tt?(0,F.jsx)(`button`,{className:`fc-btn fc-btn--ghost fc-collapse__toggle`,type:`button`,onClick:it,"aria-expanded":d,"aria-controls":`${rt}-s`,"data-no-open":`true`,children:d?`Collapse`:`Expand`}):null]}):null]}),W&&(0,F.jsxs)(`section`,{className:`fc-bodywrap`,"aria-label":`Reaction body`,children:[(0,F.jsx)(`h3`,{className:`fc-title`,children:`Reaction`}),(0,F.jsxs)(`div`,{className:`fc-body`,children:[rr(W.emoji)?W.emoji:`❤️`,typeof W.value==`number`?` × ${W.value}`:null]}),(0,F.jsx)(`a`,{className:`fc-link`,href:W.refUrl,target:`_blank`,rel:`noreferrer`,title:W.refUrl,onClick:e=>e.stopPropagation(),children:nr(W.refUrl)??W.refUrl})]}),!G&&!pe&&!U&&!W&&(0,F.jsx)(`section`,{className:`fc-bodywrap`,"aria-label":`Sigil body`,children:I&&re?(0,F.jsxs)(`div`,{className:`fc-muted`,style:{marginTop:8},children:[`Archive segments: `,N.archives.length,` (use `,(0,F.jsx)(`b`,{children:`Pack`}),` to copy them)`]}):null}),a!==`self`&&t===0?(0,F.jsxs)(`section`,{className:`fc-bodywrap`,"aria-label":`Thread`,children:[(0,F.jsx)(`h3`,{className:`fc-title`,children:`Thread`}),M.origin&&M.origin.key!==j?(0,F.jsxs)(`div`,{style:{marginTop:10},children:[(0,F.jsx)(`div`,{className:`fc-muted`,style:{marginBottom:10},children:`Origin`}),(0,F.jsx)(Ta,{url:M.origin.url,threadMode:`self`,depth:1,seen:[T]})]}):null,(0,F.jsxs)(`div`,{style:{marginTop:14},children:[(0,F.jsxs)(`div`,{className:`fc-muted`,style:{marginBottom:10},children:[`Replies (`,M.replies.length,`)`]}),M.replies.length?M.replies.map(e=>(0,F.jsx)(Ta,{url:e.url,threadMode:`self`,depth:1,seen:[T]},e.key)):(0,F.jsx)(`div`,{className:`fc-muted`,children:`No replies captured locally yet.`})]})]}):null,(0,F.jsxs)(`footer`,{className:`fc-actions`,role:`group`,"aria-label":`Actions`,children:[(0,F.jsx)(`a`,{className:`fc-btn`,href:z,target:`_blank`,rel:`noreferrer`,title:Xe,onClick:e=>e.stopPropagation(),children:Ye}),(0,F.jsx)(`button`,{className:`fc-btn`,type:`button`,onClick:e=>{e.stopPropagation(),V()},"aria-pressed":o,"data-state":o?`remembered`:`idle`,title:`Copies the same href as Open for this block. If overflow exists, use Pack.`,children:o?`Remembered`:`Remember`}),re?(0,F.jsx)(`button`,{className:`fc-btn`,type:`button`,onClick:e=>{e.stopPropagation(),de()},"aria-pressed":l,"data-state":l?`packed`:`idle`,title:`Copies the full segment pack (primary + archive segments) as newline-separated URLs.`,children:l?`Packed`:`Pack ${1+N.archives.length}`}):null,(0,F.jsx)(`span`,{className:`fc-live`,"aria-live":`polite`,children:o?`Inhaled to Memory`:l?`Packed to Memory`:``})]})]})]})]})]})},Ea=({url:e,threadMode:t=`thread`})=>{let n=(0,P.useMemo)(()=>ei(e),[e]),r=(0,P.useMemo)(()=>li($r(e)),[e]);return n?(0,F.jsx)(Ta,{url:n,threadMode:t,addChain:r,addIndex:r.length-1}):(0,F.jsx)(Ta,{url:e,threadMode:t})};function Da({urls:e}){return!e||e.length===0?(0,F.jsx)(`section`,{className:`sf-list`,children:(0,F.jsxs)(`div`,{className:`sf-empty`,children:[`No items yet. Paste a link above or open a `,(0,F.jsx)(`code`,{children:`/stream/p/`}),` link and reply to start a thread.`]})}):(0,F.jsx)(`section`,{className:`sf-list`,"aria-label":`Memory Stream`,children:e.map(e=>(0,F.jsx)(Ea,{url:e},e))})}function Oa(e){return V(e)&&e.kind===`url`&&typeof e.url==`string`&&(e.title===void 0||typeof e.title==`string`)}function ka(e){return V(e)&&e.kind===`file-inline`&&typeof e.data_b64url==`string`&&(e.name===void 0||typeof e.name==`string`)&&(e.type===void 0||typeof e.type==`string`)&&(e.size===void 0||typeof e.size==`number`)&&(e.sha256===void 0||typeof e.sha256==`string`)&&(e.thumbnail_b64===void 0||typeof e.thumbnail_b64==`string`)&&(e.relPath===void 0||typeof e.relPath==`string`)}function Aa(e){return V(e)&&e.kind===`file-ref`&&typeof e.sha256==`string`&&(e.name===void 0||typeof e.name==`string`)&&(e.type===void 0||typeof e.type==`string`)&&(e.size===void 0||typeof e.size==`number`)&&(e.url===void 0||typeof e.url==`string`)&&(e.relPath===void 0||typeof e.relPath==`string`)}function ja(e){return Oa(e)||ka(e)||Aa(e)}function Ma(e){return V(e)&&e.version===1&&typeof e.totalBytes==`number`&&typeof e.inlinedBytes==`number`&&Array.isArray(e.items)&&e.items.every(ja)}var Na=`Φ Memory added to PhiStream.`;function Pa(e){let t=(e||``).trim();return t?t.length<=140?t:`${t.slice(0,96)}:${t.slice(-32)}`:`root`}function Fa(e){return`sf.phistream.autoadd.notified:${Pa(e)}`}function Ia(){return typeof window<`u`&&typeof document<`u`}function La(e){let t=(e||``).trim();if(!t||!Ia())return null;try{if(t.startsWith(`/`)){let e=window.location?.origin??`https://kaiklok.com`,n=new URL(t,e);return n.protocol===`http:`||n.protocol===`https:`?n.toString():null}let e=new URL(t);return e.protocol===`http:`||e.protocol===`https:`?e.toString():null}catch{return null}}function Ra(){return W(localStorage.getItem(U))}function za(e){try{return Ra().includes(e)}catch{return!1}}function Ba(e){try{return sessionStorage.getItem(Fa(e))===`1`}catch{return!1}}function Va(e){try{sessionStorage.setItem(Fa(e),`1`)}catch{}}function Ha(e){let{token:t,payloadUrl:n,fallbackUrl:r,toast:i}=e;if(!Ia())return{ok:!1,added:!1,url:null,reason:`no_window`};let a=(n&&n.trim().length?n:r)??``;if(!a.trim())return{ok:!1,added:!1,url:null,reason:`no_url`};let o=La(a);if(!o)return{ok:!1,added:!1,url:null,reason:`invalid_url`};try{j(o)}catch{}let s=Ba(t);try{return za(o)?{ok:!0,added:!1,url:o,reason:`already_present`}:(G([o]),s?{ok:!0,added:!1,url:o,reason:`already_notified`}:(Va(t),i?.(`success`,Na),{ok:!0,added:!0,url:o,reason:`added`}))}catch{return{ok:!1,added:!1,url:null,reason:`storage_unavailable`}}}var Ua=17491.270421,Wa=36,Ga=44,Ka=Wa*Ga,qa=6,Ja=7,Ya=8,Xa=qa*Ja,Za=Xa*Ya;function Qa(e,t){let n=e%t;return n<0?n+t:n}function $a(e){return Number.isFinite(e)?e<0?0:e>1?1:e:0}function eo(e){return Number.isFinite(e)?e:0}function to(e){let t=eo(e);return Math.floor(t/Ua)}function no(e){let t=eo(e),n=(t-to(t)*Ua)%Ua,r=n<0?n+Ua:n;return r>=Ua?0:r}function ro(e){let t=$a(no(e)/Ua),n=Math.floor(t*Ka);return{beat:Math.floor(n/Ga),step:n%Ga}}function io(e){let t=to(e),n=Math.floor(t/Za),r=Qa(t,Za),i=Math.floor(r/Xa);return{d:r%Xa+1,m:i+1,y:n}}var ao=[`Solhara`,`Aquaris`,`Flamora`,`Verdari`,`Sonari`,`Kaelith`],oo=[`Root`,`Sacral`,`Solar`,`Heart`,`Throat`,`Third Eye`,`Crown`];function so(e){return ao[Qa(to(e),ao.length)]??`Kaelith`}function co(e){return oo[Qa(to(e),oo.length)]??`Crown`}var lo=[`Aethon`,`Virelai`,`Solari`,`Amarin`,`Kaelus`,`Umbriel`,`Noktura`,`Liora`];function uo(e){if(typeof window>`u`)return;let t=window.requestIdleCallback;if(typeof t==`function`){t(t=>{if(t.timeRemaining()<=0){e();return}e()});return}window.setTimeout(e,0)}function fo(e){let t=Qa(to(e),Za),n=Math.floor(t/Xa);return lo[n]??`Month ${n+1}`}function po(e){let t=e.trim();return t&&(/^caelith$/i.test(t)||/^kaelith$/i.test(t)?`Kaelith`:t.charAt(0).toUpperCase()+t.slice(1))}function mo(e){let t=e.trim();if(!t)return t;let n=t.toLowerCase();return n===`third-eye`||n===`third eye`||n===`ajna`?`Third Eye`:n===`solar plexus`||n===`solar-plexus`||n===`solar`?`Solar`:n===`root`?`Root`:n===`sacral`?`Sacral`:n===`heart`?`Heart`:n===`throat`?`Throat`:n===`crown`?`Krown`:t.charAt(0).toUpperCase()+t.slice(1)}function ho(e){let t=e.trim();return t&&(/^manual$/i.test(t)?`Proof of Memory™`:t.charAt(0).toUpperCase()+t.slice(1))}var go=Wa/6,_o=[`Ignite`,`Integrate`,`Harmonize`,`Reflekt`,`Purify`,`Dream`];function vo(e){let{beat:t}=ro(e),n=Math.floor(t/go);return n<0?0:n>=_o.length?_o.length-1:n}function yo(e){return _o[vo(e)]??`Dream`}function bo(e){let t=Number.isFinite(e)?Math.trunc(e):0;return String(t).padStart(2,`0`)}function xo(e){return e.length<=140?e:`${e.slice(0,96)}:${e.slice(-32)}`}function So(){let e=globalThis.location?.origin;return e&&typeof e==`string`&&e.length?e:`https://kaiklok.com`}function Co(e){let t=So().replace(/\/+$/,``);return e.length<=3500?`${t}/stream/p/${encodeURIComponent(e)}`:`${t}/stream#t=${e}`}function wo(e){return`${So().replace(/\/+$/,``)}/stream?p=${encodeURIComponent(e)}`}function To(e){return`${So().replace(/\/+$/,``)}/p~${e}`}function Eo(e){return e.length<=3500?To(e):wo(e)}function Do(e){let t=e.trim();try{let e=new URL(t),n=new URLSearchParams(e.hash.startsWith(`#`)?e.hash.slice(1):e.hash),r=new URLSearchParams(e.search),i=n.get(`t`)??n.get(`p`)??n.get(`token`)??r.get(`t`)??r.get(`p`)??r.get(`token`);i?t=i:/\/p~/.test(e.pathname)?t=e.pathname.split(`/p~`)[1]??t:/\/stream\/p\//.test(e.pathname)&&(t=e.pathname.split(`/stream/p/`)[1]??t)}catch{}if(/%[0-9A-Fa-f]{2}/.test(t))try{t=decodeURIComponent(t)}catch{}return t.includes(` `)&&(t=t.replaceAll(` `,`+`)),/[+/=]/.test(t)&&(t=t.replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/g,``)),t}function $(e){return/^[A-Za-z0-9_-]{16,}$/.test(e)}function Oo(e){let t=e.trim();try{return new URL(t)}catch{try{return new URL(t,So())}catch{return null}}}function ko(e){let t=e.trim();if(!t)return null;if($(t))return t;let n=Oo(t);if(!n)return null;let r=n.hash&&n.hash.startsWith(`#`)?n.hash.slice(1):``,i=new URLSearchParams(r),a=n.searchParams,o=i.get(`t`)??i.get(`p`)??i.get(`token`)??i.get(`capsule`)??a.get(`t`)??a.get(`p`)??a.get(`token`)??a.get(`capsule`);if(o&&o.trim().length)return o.trim();if(n.pathname.includes(`/p~`)){let e=n.pathname.indexOf(`/p~`),t=n.pathname.slice(e+3);if(t&&t.length)return t.startsWith(`/`)?t.slice(1):t}{let e=n.pathname.match(/\/stream\/p\/([^/?#]+)/);if(e?.[1])return e[1]}{let e=n.pathname.match(/\/p\/([^/?#]+)/);if(e?.[1])return e[1]}{let e=n.pathname.match(/\/s\/([^/?#]+)/);if(e?.[1])return e[1]}return null}function Ao(t){if(typeof window>`u`)return`/stream/p/${encodeURIComponent(t)}`;let n=new URLSearchParams(window.location.search),r=new URLSearchParams(window.location.hash.startsWith(`#`)?window.location.hash.slice(1):window.location.hash),i=[...n.getAll(`add`),...r.getAll(`add`)].map(ve).filter(e=>typeof e==`string`&&e.trim().length>0),a=[];for(let e of i){let t=jo(e);a.includes(t)||a.push(t)}let o=new URLSearchParams;for(let[e,t]of n.entries())e===`p`||e===`t`||e===`token`||e===`capsule`||e!==`add`&&o.append(e,t);for(let e of a)o.append(`add`,e);let s=new URLSearchParams;for(let[e,t]of r.entries())e===`p`||e===`t`||e===`token`||e===`capsule`||e!==`add`&&s.append(e,t);let c=t.length<=e,l=c?`/stream/p/${encodeURIComponent(t)}`:`/stream`,u=o.toString(),d=u.length?`?${u}`:``;if(c){let e=s.toString();return`${l}${d}${e.length?`#${e}`:``}`}let f=new URLSearchParams;f.set(`t`,t);for(let[e,t]of s.entries())f.append(e,t);return`${l}${d}#${f.toString()}`}function jo(e){let t=e.trim();if(!t)return t;let n=ko(t);if(!n){let e=Oo(t);return e?e.toString():t}return Co(Do(n))}function Mo(e,t){let n=new URL(e,So()),r=n.hash.startsWith(`#`)?n.hash.slice(1):n.hash,i=new URLSearchParams(r);i.delete(`add`);for(let e of t)i.append(`add`,e);n.search=``;let a=i.toString();return n.hash=a?`#${a}`:``,n.toString()}var No=`sf:memoryStream:v2`,Po=2e4,Fo=4096,Io=4096,Lo=2048;function Ro(){return{v:2,parentOf:{},childrenOf:{},pulseOf:{}}}function zo(){if(typeof window>`u`)return Ro();try{let e=window.localStorage.getItem(No);if(!e)return Ro();let t=JSON.parse(e);if(!V(t)||t.v!==2)return Ro();let n=V(t.parentOf)?t.parentOf:{},r=V(t.childrenOf)?t.childrenOf:{},i=V(t.pulseOf)?t.pulseOf:{},a=Ro();for(let[e,t]of Object.entries(n))typeof e==`string`&&typeof t==`string`&&$(e)&&$(t)&&(a.parentOf[e]=t);for(let[e,t]of Object.entries(r)){if(!$(e)||!Array.isArray(t))continue;let n=t.filter(e=>typeof e==`string`&&$(e));a.childrenOf[e]=Array.from(new Set(n)).slice(0,Fo)}for(let[e,t]of Object.entries(i))if($(e)){if(typeof t==`number`&&Number.isFinite(t))a.pulseOf[e]=t;else if(typeof t==`string`&&t.trim().length){let n=Number(t.trim());Number.isFinite(n)&&(a.pulseOf[e]=n)}}return a}catch{return Ro()}}function Bo(e){if(!(typeof window>`u`))try{window.localStorage.setItem(No,JSON.stringify(e))}catch(e){B(`ms2Save`,e)}}function Vo(e,t,n){let r=e.childrenOf[t]??[];if(r.includes(n))return!1;let i=[...r,n].slice(-Fo);return e.childrenOf[t]=i,!0}function Ho(e,t,n){return!$(t)||!$(n)||t===n||e.parentOf[t]===n?!1:(e.parentOf[t]=n,Vo(e,n,t),!0)}function Uo(e,t,n){return!$(t)||!Number.isFinite(n)||e.pulseOf[t]===n?!1:(e.pulseOf[t]=n,!0)}function Wo(e){let t=Oo(e);if(!t)return[];let n=t.hash&&t.hash.startsWith(`#`)?t.hash.slice(1):``,r=new URLSearchParams(n),i=[...t.searchParams.getAll(`add`),...r.getAll(`add`)];if(i.length===0)return[];let a=[];for(let e of i){let t=ve(e);if(!t||!t.trim().length)continue;let n=ko(t)??($(t)?t:null);if(!n)continue;let r=Do(n);$(r)&&(a.includes(r)||a.push(r))}return a}function Go(e,t){let n=ko(t);if(!n)return!1;let r=Do(n);if(!$(r))return!1;let i=Wo(t),a=i.length?i[i.length-1]:null,o=!1;if(a&&(o=Ho(e,r,a)||o),Object.keys(e.parentOf).length+Object.keys(e.childrenOf).length>Po){let t=Object.keys(e.childrenOf);for(let n=0;n{let r=e.pulseOf[t],i=e.pulseOf[n],a=typeof r==`number`&&Number.isFinite(r),o=typeof i==`number`&&Number.isFinite(i);return a&&o?r-i:a?-1:o?1:tn?1:0}),r}function Yo(e,t){let n=Co(t),r=qo(e,t);return r.length?Mo(n,r):n}function Xo(e){if(typeof document>`u`)return!1;try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,`true`),t.style.position=`fixed`,t.style.left=`-9999px`,t.style.top=`0`,document.body.appendChild(t);let n=document.activeElement instanceof HTMLElement?document.activeElement:null;t.focus(),t.select();let r=document.execCommand(`copy`);return document.body.removeChild(t),n&&n.focus(),r}catch{return!1}}function Zo(e){if(typeof window>`u`)return null;let t=window.navigator;return t!==void 0&&t.clipboard!==void 0&&typeof t.clipboard.writeText==`function`&&window.isSecureContext?t.clipboard.writeText(e):null}function Qo(e){return e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`"`,`"`).replaceAll(`'`,`'`)}function $o(e){try{let t=new DOMParser().parseFromString(e,`text/html`);return t.querySelectorAll(`script,style,iframe,object,embed`).forEach(e=>e.remove()),t.querySelectorAll(`*`).forEach(e=>{for(let t of Array.from(e.attributes)){let n=t.name.toLowerCase(),r=t.value;if(n.startsWith(`on`)){e.removeAttribute(t.name);continue}if(n===`href`||n===`src`){let n=r.trim().toLowerCase();(n.startsWith(`javascript:`)||n.startsWith(`data:`))&&e.removeAttribute(t.name)}}}),t.body.innerHTML}catch{return Qo(e)}}function es(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`?t.toString():null}catch{return null}}function ts(e){let t=Qo(e).replace(/```(\w+)?\n([\s\S]*?)```/g,(e,t,n)=>{let r=(t||``).trim();return`
${n}
`});return t=t.replace(/^####\s(.+)$/gm,`

$1

`),t=t.replace(/^###\s(.+)$/gm,`

$1

`),t=t.replace(/^##\s(.+)$/gm,`

$1

`),t=t.replace(/^#\s(.+)$/gm,`

$1

`),t=t.replace(/\*\*(.+?)\*\*/g,`$1`),t=t.replace(/\*(.+?)\*/g,`$1`),t=t.replace(/`([^`]+)`/g,`$1`),t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(e,t,n)=>{let r=es(n);return r?`${t}`:`${t} (${Qo(n)})`}),t=t.split(/\n{2,}/g).map(e=>{let t=e.trim();return t?t.startsWith(``)?t:`

${t.replace(/\n/g,`
`)}

`:``}).filter(Boolean).join(` `),t}function ns(e){let t=0,n=0;for(let r of e){if(r.kind===`file-inline`){typeof r.size==`number`&&Number.isFinite(r.size)&&r.size>=0&&(t+=r.size,n+=r.size);continue}if(r.kind===`file-ref`){typeof r.size==`number`&&Number.isFinite(r.size)&&r.size>=0&&(t+=r.size);continue}}return{total:t,inlined:n}}function rs(e){if(Ma(e))return e;if(!V(e))return null;let t=e.version,n=e.items;if(t!==1||!Array.isArray(n))return null;let r=n.filter(ja),i=ns(r);return{version:1,totalBytes:typeof e.totalBytes==`number`&&Number.isFinite(e.totalBytes)?e.totalBytes:i.total,inlinedBytes:typeof e.inlinedBytes==`number`&&Number.isFinite(e.inlinedBytes)?e.inlinedBytes:i.inlined,items:r}}function is({body:e,caption:t,isSealed:n}){let r=e??(!n&&t&&t.trim().length?{kind:`text`,text:t}:null);return r?r.kind===`text`?(0,F.jsxs)(`div`,{className:`sf-text`,children:[`— `,`"${r.text}"`]}):r.kind===`code`?(0,F.jsx)(`pre`,{className:`sf-code`,children:(0,F.jsx)(`code`,{children:r.code})}):r.kind===`md`?(0,F.jsx)(`div`,{className:`sf-md`,dangerouslySetInnerHTML:{__html:ts(r.md)}}):(r.mode??`code`)===`code`?(0,F.jsx)(`pre`,{className:`sf-code sf-code--html`,children:(0,F.jsx)(`code`,{children:r.html})}):(0,F.jsx)(`div`,{className:`sf-html`,dangerouslySetInnerHTML:{__html:$o(r.html)}}):(0,F.jsx)(F.Fragment,{})}function as(e,t){if(!e||typeof e!=`object`)return null;let n=e;for(let e of t){let t=n[e];if(typeof t==`string`&&t.trim().length)return t.trim()}return null}function os(e,t){if(!e||typeof e!=`object`)return null;let n=e[t];if(typeof n==`number`&&Number.isFinite(n))return n;if(typeof n==`string`&&n.trim().length){let e=Number(n.trim());return Number.isFinite(e)?e:null}return null}function ss(e){return Math.max(0,Math.min(255,Math.round(e)))}function cs(e){if(!V(e))return!1;let t=e.body,n=e.attachments,r=e.caption,i=t===void 0||V(t),a=r===void 0||typeof r==`string`,o=n===void 0||V(n)||Array.isArray(n);return i&&a&&o}function ls(e){return typeof e==`function`}function us(e){return V(e)&&e.ok===!0&&`inner`in e}function ds(e){let t=V(e)?e.seal:void 0;return t?as(t,[`teaser`,`preview`,`hint`,`caption`])??null:null}async function fs(e){let n=await t(()=>import(`./postSeal-D7PFnOMd.js`),__vite__mapDeps([0,1])),r=V(n)?n:{},i=r.openSealedEnvelope??r.openSealedPayload??r.unsealEnvelope??r.unsealPayload??r.unsealEnvelopeV1??null;if(!ls(i))throw Error(`postSeal module is missing an unseal function.`);if(((V(r)&&Object.entries(r).find(([,e])=>e===i)?.[0])??`unseal`)===`unsealEnvelopeV1`){let t=typeof e.meta==`object`&&e.meta!==null?H(e.meta,`kaiSignature`):void 0,n=typeof e.meta==`object`&&e.meta!==null?H(e.meta,`userPhiKey`):void 0;if(!t)throw Error(`Missing kaiSignature in meta (cannot unlock sealed envelope).`);let r=await Promise.resolve(i(e.seal,{kaiSignature:t,phiKey:n}));if(us(r)){let e=r.inner;if(!V(e))throw Error(`Unseal returned non-object inner payload.`);let t=e.body,n=e.attachments,i=e.caption,a={};return t!==void 0&&V(t)&&(a.body=t),n!==void 0&&(a.attachments=n),typeof i==`string`&&(a.caption=i),a}if(cs(r))return r;throw Error(`Unseal returned an unexpected shape.`)}let a=await Promise.resolve(i(e.seal,{meta:e.meta,svgText:e.svgText??void 0}));if(!cs(a))throw Error(`Unseal returned an unexpected shape.`);return a}function ps(e){let{token:t,payload:n,manifest:r,copied:i,onKopy:a,isSealed:o,unsealState:s,canUnseal:c,verifiedThisSession:l,hasComposerMeta:u,onVerifiedNow:d,onResetVerified:f,onUnseal:p,onForgetUnsealed:m,body:h,caption:g}=e,_=(0,P.useRef)(null),v=(0,P.useCallback)(()=>{let e=_.current;if(!e)return;try{e.scrollIntoView({behavior:`smooth`,block:`center`})}catch{}let t=e.querySelector(`input[type="file"]`);if(t){t.click();return}e.querySelector(`button`)?.click()},[]),y=s.status===`opening`?`UNSEALING…`:c?`UNSEAL`:l?u?`UNSEAL`:`RE-INHALE`:`🔐 Sealed`,b=(0,P.useCallback)(()=>{if(!c){v();return}p()},[c,p,v]),x=eo(n.pulse),{beat:S,step:C}=ro(x),{d:w,m:T,y:E}=io(x),D=fo(x),O=po(so(x)),k=yo(x),A=as(n,[`userPhiKey`,`phiKey`,`phikey`,`authorPhiKey`])??as(n.meta,[`userPhiKey`,`phiKey`,`phikey`])??``,M=ho(as(n,[`mode`,`source`,`origin`,`transport`])??as(n.meta,[`mode`,`source`,`origin`])??`Manual`);(0,P.useEffect)(()=>{try{j(Eo(t))}catch(e){B(`register share url (PayloadCard)`,e)}if(typeof n.url==`string`&&n.url.length)try{j(n.url)}catch(e){B(`register payload.url (PayloadCard)`,e)}},[t,n.url]);let te=o&&s.status!==`open`,N=(0,P.useMemo)(()=>o?ds(n):null,[o,n]),ne=o?(0,F.jsx)(`span`,{className:`sf-pill sf-pill--sealed`,title:`Private (Sealed)`,children:`🔒 SEALED`}):null;return(0,F.jsxs)(`section`,{className:`sf-payload`,role:`region`,"aria-label":`Loaded payload`,children:[(0,F.jsxs)(`div`,{className:`sf-payload-line sf-tags`,children:[(0,F.jsx)(`span`,{className:`sf-pill sf-pill--mode`,children:M||`Proof of Memory™`}),ne,A?(0,F.jsxs)(`span`,{className:`sf-pill sf-pill--phikey`,title:A,children:[`ΦKey `,(0,F.jsx)(`span`,{className:`sf-key`,children:A})]}):null]}),(0,F.jsxs)(`div`,{className:`sf-payload-core`,children:[(0,F.jsxs)(`span`,{children:[`☤Kai: `,x]}),(0,F.jsx)(`span`,{className:`sf-muted`,children:` · `}),(0,F.jsxs)(`span`,{className:`sf-kai-label`,children:[bo(S),`:`,bo(C),` — D`,w,`/M`,T,`/Y`,E,` · `,k]}),(0,F.jsx)(`span`,{className:`sf-muted`,children:` · `}),(0,F.jsxs)(`span`,{className:`sf-kai-label`,children:[O,` · `,D]})]}),o?(0,F.jsx)(`div`,{className:`sf-seal`,role:`group`,"aria-label":`Private sealed content`,children:s.status===`open`?(0,F.jsxs)(`div`,{className:`sf-seal__row`,children:[(0,F.jsx)(`span`,{className:`sf-seal__label`,children:`Unsealed`}),(0,F.jsx)(`button`,{type:`button`,className:`sf-seal__btn`,onClick:m,"aria-label":`Seal view`,children:`SEAL`})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`sf-seal__row`,children:[(0,F.jsx)(`span`,{className:`sf-seal__label`,children:`Private`}),(0,F.jsx)(`button`,{type:`button`,className:`sf-seal__btn`,onClick:b,disabled:s.status===`opening`,"aria-label":`Unseal private content`,children:y})]}),N?(0,F.jsx)(`div`,{className:`sf-seal__hint`,role:`note`,children:N}):null,(0,F.jsxs)(`div`,{ref:_,className:`sf-seal__gate`,role:`region`,"aria-label":`Unlock gate`,children:[l?u?c?null:(0,F.jsx)(`div`,{className:`sf-seal__hint`,role:`note`,children:`Inhale your ΦKey to unseal.`}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`sf-seal__hint`,role:`note`,children:`Verified session detected, but no sigil metadata is present. Re-inhale your glyph.`}),(0,F.jsx)(`div`,{className:`sf-seal__login`,"aria-label":`Glyph re-upload`,children:(0,F.jsx)(ee,{onVerified:d})}),(0,F.jsx)(`div`,{className:`sf-seal__row`,children:(0,F.jsx)(`button`,{type:`button`,className:`sf-seal__btn`,onClick:f,"aria-label":`Use a different key`,children:`USE DIFFERENT ΦKEY`})})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`sf-seal__hint`,role:`note`,children:`Inhale your ΦKey, then unseal.`}),(0,F.jsx)(`div`,{className:`sf-seal__login`,"aria-label":`Glyph upload`,children:(0,F.jsx)(ee,{onVerified:d})})]}),s.status===`error`?(0,F.jsx)(`div`,{className:`sf-seal__hint`,role:`note`,children:s.message}):null]})]})}):null,te?null:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(is,{body:h,caption:g,isSealed:!1}),r?(0,F.jsx)(kt,{manifest:r}):null]}),(0,F.jsx)(`div`,{className:`sf-reply-actions`,children:(0,F.jsx)(`button`,{type:`button`,className:`sf-kopyBtn`,onClick:a,disabled:i,"data-state":i?`copied`:`idle`,"aria-label":`Remember share link`,children:i?`REMEMBERED`:`REMEMBER`})})]})}function ms(){return(0,F.jsx)(I,{children:(0,F.jsx)(M,{children:(0,F.jsx)(hs,{})})})}function hs(){let e=ce(),t=O(),n=i(),r=oe(e=>{e.preventDefault(),n(`/keystream`)}),[a,o]=(0,P.useState)([]),c=(0,P.useRef)(new Set),l=(0,P.useRef)(zo()),u=(0,P.useRef)(new Set),[d,f]=(0,P.useState)(0),p=(0,P.useRef)(!1),m=(0,P.useCallback)((e,t)=>{uo(()=>{let t=l.current,n=!1;for(let r of e)!r||!r.trim().length||(n=Go(t,r)||n);n&&(Bo(t),f(e=>e+1))})},[]),h=(0,P.useCallback)(e=>{if(!p.current){p.current=!0;try{let t=new Set,n=e=>{if(!e)return;let n=Do(e);$(n)&&t.add(n)},r=l.current;for(let e of Object.keys(r.parentOf))n(e);for(let e of Object.keys(r.childrenOf)){n(e);for(let t of r.childrenOf[e]??[])n(t)}for(let e of Object.keys(r.pulseOf))n(e);for(let t of e){n(ko(t));for(let e of Wo(t))n(e)}let i=0;for(let e of t){if(i>=Lo)break;i+=1;let t=s(e);if(!t)continue;let n=t.usernameClaim;if(!n)continue;let r=te(n.hash??``),a=n.payload;if(!r||!a||a.kind!==`username_claim`)continue;let o=re(a.normalized||a.username||``),c=re(t.author??``),l=o||c;if(!l)continue;let u=n.url?.trim()||Co(e);if(!u)continue;let d=n.ownerHint??a.ownerHint??null;ne({hash:r,url:u,payload:{...a,normalized:o||l},ownerHint:d})}}catch(e){B(`rehydrate username claims`,e)}}},[]);(0,P.useEffect)(()=>{if(typeof window>`u`)return;let e=e=>{o(t=>{let n=new Set(t.map(({url:e})=>e)),r=[...t],i=[];for(let{url:t}of e){let e=t.trim();!e||n.has(e)||(n.add(e),r.push({url:e}),i.push(e))}if(i.length>0){for(let e of i)j(e);m(i),h(i)}return r})};uo(()=>{let t=W(localStorage.getItem(U));t.length&&e(t.map(e=>({url:e})))});let t=!1;return uo(()=>{(async()=>{try{let n=await pe();!t&&n.length&&e(n)}catch(e){B(`initial seed load`,e)}})().catch(e=>B(`initial seed load outer`,e))}),()=>{t=!0}},[m,h]),(0,P.useEffect)(()=>{if(!(typeof window>`u`))try{let e=new URLSearchParams(window.location.search),t=new URLSearchParams(window.location.hash.startsWith(`#`)?window.location.hash.slice(1):window.location.hash),n=[...e.getAll(`add`),...t.getAll(`add`)].map(ve).filter(e=>typeof e==`string`&&e.trim().length>0).map(jo);if(n.length===0)return;m([window.location.href,...n]),o(e=>{let t=new Set(e.map(e=>e.url)),r=n.filter(e=>!t.has(e));if(r.length){G(r);for(let e of r)j(e);return[...r.map(e=>({url:e})),...e]}return e})}catch(e){B(`add ingestion (location)`,e)}},[t.pathname,t.search,t.hash,m]),(0,P.useEffect)(()=>{typeof window>`u`||uo(()=>{let e=c.current,t=[],n=e=>{e.trim().length&&(t.includes(e)||t.push(e))};for(let t of a){let r=t.url;if(!r||e.has(r))continue;e.add(r);let i=Oo(r);if(!i)continue;let a=i.hash&&i.hash.startsWith(`#`)?i.hash.slice(1):``,o=new URLSearchParams(a),s=[...i.searchParams.getAll(`add`),...o.getAll(`add`)];if(s.length===0)continue;let c=s.map(ve).filter(e=>typeof e==`string`&&e.trim().length>0).map(jo);for(let e of c)n(e)}t.length!==0&&(m(t),o(e=>{let n=new Set(e.map(e=>e.url)),r=t.filter(e=>!n.has(e));if(!r.length)return e;try{G(r)}catch(e){B(`prependUniqueToStorage (infinite replies)`,e)}for(let e of r)try{j(e)}catch(e){B(`registerSigilUrl (infinite replies)`,e)}return[...r.map(e=>({url:e})),...e]}))})},[a,m]),(0,P.useEffect)(()=>{typeof window>`u`||uo(()=>{let e=u.current,t=[];for(let n of a){let r=n.url;if(!(!r||e.has(r))&&(e.add(r),t.push(r),t.length>=256))break}t.length&&m(t)})},[a,m]);let[g,_]=(0,P.useState)(null),[v,b]=(0,P.useState)(null),[x,S]=(0,P.useState)(null),C=(0,P.useRef)(null),[w,E]=(0,P.useState)({status:`none`});(0,P.useEffect)(()=>{if(!v){E({status:`none`});return}E(V(v)&&v.seal!==void 0?{status:`sealed`}:{status:`none`})},[v]);let D=(0,P.useCallback)(async()=>{if(typeof window>`u`)return;let t=y(),n=t?Do(t):null;if(n)try{let e=Ao(n);e!==`${window.location.pathname}${window.location.search}${window.location.hash}`&&window.history.replaceState(null,``,e)}catch(e){B(`canonicalizeLocationRel`,e)}if(_(n),!n){b(null),S(null),C.current=null;return}try{let e=Co(n),t=Eo(n);j(e),t!==e&&j(t)}catch(e){B(`register current stream url (pre-decode)`,e)}try{let e=Co(n);o(t=>{if(new Set(t.map(e=>e.url)).has(e))return t;try{G([e])}catch(e){B(`prependUniqueToStorage (visited stream)`,e)}try{j(e)}catch(e){B(`registerSigilUrl (visited stream)`,e)}return[{url:e},...t]}),m([window.location.href,e])}catch(e){B(`ms2 ingest visited stream`,e)}try{let r=await s(n)||(t&&t!==n?await s(t):null);if(!r){b(null),S(`Invalid or unreadable payload token.`);return}let i=r.usernameClaim,a=i?re(i.payload?.normalized||i.payload?.username||``):``,c=re(r.author??``),u=a||c;if(i){let e=te(i.hash??``),t=i.url?.trim()||Co(n);if(!e||!t){b(null),S(`Username claim missing glyph reference.`);return}if(!u){b(null),S(`Username claim missing normalized username.`);return}let r=ae()[u];if(r&&r.claimHash!==e){b(null),S(`Username claimed by another glyph.`);return}let a=i.payload;if(!a||a.kind!==`username_claim`){b(null),S(`Invalid username-claim payload.`);return}let o=re(a.normalized||a.username||``)||u;if(o!==u){b(null),S(`Username claim does not match author.`);return}let s=ne({hash:e,url:t,payload:{...a,normalized:o},ownerHint:i.ownerHint??a.ownerHint??null});if(!s.accepted){b(null),S(`Username claim rejected: ${s.reason??`unknown`}.`);return}}else if(u&&ae()[u]){b(null),S(`Claim glyph is required for this username.`);return}b(r),S(null);try{let e=l.current;Uo(e,n,eo(r.pulse))&&(Bo(e),f(e=>e+1))}catch(e){B(`ms2SetPulse`,e)}if(r.url&&typeof r.url==`string`&&r.url.length){if(C.current!==n){C.current=n;try{G([r.url])}catch(e){B(`prependUniqueToStorage (payload url)`,e)}let t=Ha({token:n,payloadUrl:r.url,toast:(t,n)=>e.push(t,n)});o(e=>new Set(e.map(e=>e.url)).has(r.url)?e:[{url:r.url},...e]),t.ok||B(`phistream auto-add`,t.reason)}else o(e=>new Set(e.map(e=>e.url)).has(r.url)?e:[{url:r.url},...e]);try{j(r.url)}catch(e){B(`register payload.url (post-decode)`,e)}}try{j(To(n))}catch(e){B(`register short alias url`,e)}}catch(e){B(`payload decode`,e),b(null),S(`Payload decode failed.`)}},[e,m]);(0,P.useEffect)(()=>{D()},[t.pathname,t.search,t.hash,D]);let k=(0,P.useMemo)(()=>{if(!v)return{weekday:void 0,chakra:void 0};let e=eo(v.pulse);return{weekday:po(so(e)),chakra:mo(co(e))}},[v]),M=(0,P.useMemo)(()=>`sf.verifiedSession:${xo(g??(typeof window<`u`?y():null)??`root`)}`,[g]),[N,ie]=(0,P.useState)(()=>{try{if(typeof window>`u`)return!1;let e=`sf.verifiedSession:${xo(y()||`root`)}`;return sessionStorage.getItem(e)===`1`}catch(e){return B(`sessionStorage.getItem (init)`,e),!1}});(0,P.useEffect)(()=>{try{if(typeof window>`u`)return;ie(sessionStorage.getItem(M)===`1`)}catch(e){B(`sessionStorage.getItem (sync)`,e),ie(!1)}},[M]);let se=()=>{ie(!0);try{sessionStorage.setItem(M,`1`)}catch(e){B(`sessionStorage.setItem`,e)}e.push(`success`,`ΦKey inhaled.`)},le=()=>{ie(!1);try{sessionStorage.removeItem(M)}catch(e){B(`sessionStorage.removeItem`,e)}},I=A(),L=(0,P.useMemo)(()=>fe(I),[I]),R=(0,P.useMemo)(()=>N?L.meta:null,[N,L.meta]),z=(0,P.useMemo)(()=>N?L.svgText:null,[N,L.svgText]),ue=(0,P.useMemo)(()=>R?H(R,`userPhiKey`):void 0,[R]),de=(0,P.useMemo)(()=>R?H(R,`kaiSignature`):void 0,[R]),me=(0,P.useMemo)(()=>{let e=os(R,`sigil_r`)??os(R,`sigilR`)??os(R,`tintR`)??null,t=os(R,`sigil_g`)??os(R,`sigilG`)??os(R,`tintG`)??null,n=os(R,`sigil_b`)??os(R,`sigilB`)??os(R,`tintB`)??null;if(e===null||t===null||n===null)return{};let r={};return r[`--sigil-r`]=String(ss(e)),r[`--sigil-g`]=String(ss(t)),r[`--sigil-b`]=String(ss(n)),r},[R]),he=e=>{o(t=>new Set(t.map(e=>e.url)).has(e)?t:(G([e]),j(e),m([e]),[{url:e},...t]))},K=(0,P.useMemo)(()=>v?V(v)&&v.seal!==void 0:!1,[v]),ge=(0,P.useMemo)(()=>!!(K&&N&&R),[K,N,R]),_e=(0,P.useCallback)(()=>{v&&(E(K?{status:`sealed`}:{status:`none`}),e.push(`success`,`Sealed`))},[v,K,e]),ye=(0,P.useCallback)(async()=>{if(!v)return;let t=v.seal;if(!t){E({status:`error`,message:`No seal present on this payload.`});return}if(!N||!R){E({status:`error`,message:`Inhale your ΦKey to unseal.`});return}E({status:`opening`});try{E({status:`open`,content:await fs({seal:t,meta:R,svgText:z??null})}),e.push(`success`,`Unsealed`)}catch(t){B(`unseal`,t),E({status:`error`,message:`Unseal failed. Wrong key, wrong seal, or missing postSeal implementation.`}),e.push(`warn`,`Unseal failed.`)}},[v,N,R,z,e]),be=(0,P.useMemo)(()=>K&&w.status!==`open`,[K,w.status]),xe=(0,P.useMemo)(()=>w.status===`open`?w.content.body:v?.body,[v,w]),Se=(0,P.useMemo)(()=>w.status===`open`?w.content.caption??v?.caption:v?.caption,[v,w]),Ce=(0,P.useMemo)(()=>w.status===`open`?w.content.attachments??v?.attachments:v?.attachments,[v,w]),we=(0,P.useMemo)(()=>Ce?rs(Ce):null,[Ce]),[Te,Ee]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>()=>{De.current!==null&&window.clearTimeout(De.current)},[]);let Oe=(0,P.useCallback)(()=>{let t=g??(typeof window<`u`?y():null),n=t?Do(t):null;if(!n)return;let r=Co(n),i=typeof window<`u`?Wo(window.location.href):[],a=i.length?Mo(r,i):r;if(Xo(a)){Ee(!0),De.current!==null&&window.clearTimeout(De.current),De.current=window.setTimeout(()=>Ee(!1),1200),e.push(`success`,`Remembered`);return}let o=Zo(a);if(o){Ee(!0),De.current!==null&&window.clearTimeout(De.current),De.current=window.setTimeout(()=>Ee(!1),1200),e.push(`success`,`Remembered`),o.catch(t=>{B(`kopy clipboard.writeText`,t),Ee(!1),e.push(`warn`,`Remember failed. Select the address bar.`)});return}e.push(`warn`,`Remember failed. Select the address bar.`)},[g,e]),ke=(0,P.useMemo)(()=>{if(!g)return[];let e=l.current;return Jo(e,g).map(t=>Yo(e,t))},[g,d]);(0,P.useEffect)(()=>{g&&ke.length!==0&&o(e=>{let t=new Set(e.map(e=>e.url)),n=ke.filter(e=>!t.has(e));if(!n.length)return e;try{G(n)}catch(e){B(`prependUniqueToStorage (thread hydrate)`,e)}for(let e of n)try{j(e)}catch(e){B(`registerSigilUrl (thread hydrate)`,e)}return[...n.map(e=>({url:e})),...e]})},[g,ke]);let Ae=(0,P.useMemo)(()=>{let e=a.map(e=>e.url);if(!g||ke.length===0)return e;let t=new Set,n=[];for(let e of ke)t.has(e)||(t.add(e),n.push(e));for(let r of e)t.has(r)||(t.add(r),n.push(r));return n},[a,g,ke]),Me=N&&(R||z)?Ue({meta:R,svgText:z||``}):null;return(0,F.jsxs)(`main`,{className:`sf`,"data-weekday":k.weekday,"data-chakra":k.chakra,style:me,children:[(0,F.jsxs)(`header`,{className:`sf-head`,role:`region`,"aria-labelledby":`glyph-stream-title`,children:[(0,F.jsx)(`nav`,{className:`sf-topnav`,"aria-label":`Back navigation`,children:(0,F.jsx)(T,{className:`sf-back`,to:`/keystream`,...r,children:`← Back to Keystream`})}),(0,F.jsx)(`h1`,{id:`glyph-stream-title`,children:`Memory Stream`}),(0,F.jsx)(On,{}),v&&g?(0,F.jsx)(ps,{token:g,payload:v,manifest:we,copied:Te,onKopy:Oe,isSealed:K,unsealState:w,canUnseal:ge,verifiedThisSession:N,hasComposerMeta:!!R,onVerifiedNow:se,onResetVerified:le,onUnseal:ye,onForgetUnsealed:_e,body:xe,caption:Se}):x?(0,F.jsx)(`div`,{className:`sf-error`,role:`alert`,children:x}):(0,F.jsxs)(`p`,{className:`sf-sub`,children:[`Open a payload link at `,(0,F.jsx)(`code`,{children:`/stream/p/`}),` (or `,(0,F.jsx)(`code`,{children:`/stream#t=`}),`). Replies are Kai-sealed and thread via `,(0,F.jsx)(`code`,{children:`#add=`}),`. Short alias accepted: `,(0,F.jsx)(`code`,{children:`/p~`}),` `,`(and legacy `,(0,F.jsx)(`code`,{children:`/p#t=`}),`, `,(0,F.jsx)(`code`,{children:`/p?t=`}),`, `,(0,F.jsx)(`code`,{children:`/stream?p=`}),`).`]}),!v&&(0,F.jsx)(`section`,{className:`sf-inhaler`,"aria-labelledby":`inhaler-title`,children:(0,F.jsx)(Ge,{onAdd:he})}),(0,F.jsx)(je,{phiKey:ue,kaiSignature:de}),Me?.node?(0,F.jsx)(`section`,{className:`sf-sigilWrap`,"aria-label":`Sigil stage`,children:(0,F.jsx)(`div`,{className:`sf-sigilWrap__inner`,children:Me.node})}):null,v&&!be?(0,F.jsxs)(`section`,{className:`sf-reply`,"aria-labelledby":`reply-title`,children:[(0,F.jsx)(`h2`,{id:`reply-title`,className:`sf-reply-title`,children:`Reply`}),N?R?(0,F.jsx)(Qt,{meta:R,svgText:z,onUseDifferentKey:le}):(0,F.jsx)(`div`,{className:`sf-error`,role:`alert`,children:`Verified, but no sigil metadata found. Re-inhale your glyph.`}):(0,F.jsxs)(`div`,{className:`sf-reply-login`,children:[(0,F.jsx)(`p`,{className:`sf-sub`,children:`Inhale ΦKey to resonate a reply.`}),(0,F.jsx)(ee,{onVerified:se})]})]}):null]}),(0,F.jsx)(`section`,{className:`sf-list`,children:Ae.length===0?(0,F.jsxs)(`div`,{className:`sf-empty`,children:[`No items yet. Paste a link above or open a `,(0,F.jsx)(`code`,{children:`/stream/p/`}),` link and reply to start a thread.`]}):(0,F.jsx)(Da,{urls:Ae})})]})}var gs=ms;export{gs as n,ms as t}; \ No newline at end of file diff --git a/dist/assets/SigilStreamRoot-hPwX5VmF.js b/dist/assets/SigilStreamRoot-hPwX5VmF.js new file mode 100644 index 00000000..5d55994d --- /dev/null +++ b/dist/assets/SigilStreamRoot-hPwX5VmF.js @@ -0,0 +1 @@ +import"./html2canvas-DXJRNlB-.js";import"./EternalKlock-CQhocjA8.js";import"./SigilModal-B_GantjI.js";import"./SealMomentModal-QiuZkGMx.js";import"./SigilAuthContext-X_86kcI6.js";import"./sigilRegistry-TxCi76Aa.js";import"./SigilAuthProvider-Cr2YGy0y.js";import"./usernameClaimRegistry-CU2B_ZCP.js";import{n as e,t}from"./SigilStreamRoot-DGHasm9l.js";import"./useFastPress-C6nRe_12.js";export{t as SigilStreamRoot,e as default}; \ No newline at end of file diff --git a/dist/assets/VerifierFrame-Dr7oGdbu.js b/dist/assets/VerifierFrame-DkyrPdnF.js similarity index 99% rename from dist/assets/VerifierFrame-Dr7oGdbu.js rename to dist/assets/VerifierFrame-DkyrPdnF.js index bedbefc2..9cdacde1 100644 --- a/dist/assets/VerifierFrame-Dr7oGdbu.js +++ b/dist/assets/VerifierFrame-DkyrPdnF.js @@ -1 +1 @@ -import{En as e,Tn as t,jn as n,pn as r,tn as i}from"./index-CcPm2yTY.js";import{t as a}from"./prop-types-CQ3MXKCa.js";function o(e){return e.replace(/^\/+|\/+$/g,``)}function s(){try{return`/`}catch{}return`/`}function c(){if(typeof window>`u`)return`/verify`;let e=window.location.origin,t=o(s());return`${e}${t.length>0?`/${t}`:``}/verify`}function l(e){let t=typeof e==`string`?e.trim():``,n=t.length>0?t:`unknown-signature`;return n.length>10?n.slice(0,10):n}function u(e,t){return`${e}-${l(t)}`}function d(e,t,n){return`${(n??c()).replace(/\/+$/,``)}/${encodeURIComponent(u(e,t))}`}var f={root:`Root`,sacral:`Sacral`,solar:`Solar Plexus`,solarp:`Solar Plexus`,solarplexus:`Solar Plexus`,heart:`Heart`,throat:`Throat`,thirdeye:`Third Eye`,crown:`Crown`,krown:`Crown`};function p(e){if(typeof e!=`string`)return;let t=e.trim();if(t)return f[t.toLowerCase().replace(/[\s_-]/g,``)]}function m(e){let t=``;for(let n of e)t+=n.toString(16).padStart(2,`0`);return t}async function h(e){if(typeof crypto>`u`||!crypto.subtle)throw Error(`crypto.subtle unavailable; cannot compute proofHash.`);let t=new TextEncoder().encode(e),n=await crypto.subtle.digest(`SHA-256`,t);return m(new Uint8Array(n))}function g(e){return JSON.stringify({v:e.v,pulse:e.pulse,chakraDay:e.chakraDay,kaiSignature:e.kaiSignature,phiKey:e.phiKey,verifierSlug:e.verifierSlug})}async function _(e){return await h(g(e))}var v=e(((e,t)=>{t.exports={L:1,M:0,Q:3,H:2}})),y=e(((e,t)=>{t.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}})),b=e(((e,t)=>{var n=y();function r(e){this.mode=n.MODE_8BIT_BYTE,this.data=e}r.prototype={getLength:function(e){return this.data.length},write:function(e){for(var t=0;t{var n=v();function r(e,t){this.totalCount=e,this.dataCount=t}r.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],r.getRSBlocks=function(e,t){var n=r.getRsBlockTable(e,t);if(n==null)throw Error(`bad rs block @ typeNumber:`+e+`/errorCorrectLevel:`+t);for(var i=n.length/3,a=[],o=0;o{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){var t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(var n=0;n>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),C=e(((e,t)=>{for(var n={glog:function(e){if(e<1)throw Error(`glog(`+e+`)`);return n.LOG_TABLE[e]},gexp:function(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return n.EXP_TABLE[e]},EXP_TABLE:Array(256),LOG_TABLE:Array(256)},r=0;r<8;r++)n.EXP_TABLE[r]=1<{var n=C();function r(e,t){if(e.length==null)throw Error(e.length+`/`+t);for(var n=0;n{var n=y(),r=w(),i=C(),a={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},o={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(e){for(var t=e<<10;o.getBCHDigit(t)-o.getBCHDigit(o.G15)>=0;)t^=o.G15<=0;)t^=o.G18<>>=1;return t},getPatternPosition:function(e){return o.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,n){switch(e){case a.PATTERN000:return(t+n)%2==0;case a.PATTERN001:return t%2==0;case a.PATTERN010:return n%3==0;case a.PATTERN011:return(t+n)%3==0;case a.PATTERN100:return(Math.floor(t/2)+Math.floor(n/3))%2==0;case a.PATTERN101:return t*n%2+t*n%3==0;case a.PATTERN110:return(t*n%2+t*n%3)%2==0;case a.PATTERN111:return(t*n%3+(t+n)%2)%2==0;default:throw Error(`bad maskPattern:`+e)}},getErrorCorrectPolynomial:function(e){for(var t=new r([1],0),n=0;n5&&(n+=3+a-5)}for(var r=0;r{var n=b(),r=x(),i=S(),a=T(),o=w();function s(e,t){this.typeNumber=e,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var c=s.prototype;c.addData=function(e){var t=new n(e);this.dataList.push(t),this.dataCache=null},c.isDark=function(e,t){if(e<0||this.moduleCount<=e||t<0||this.moduleCount<=t)throw Error(e+`,`+t);return this.modules[e][t]},c.getModuleCount=function(){return this.moduleCount},c.make=function(){if(this.typeNumber<1){var e=1;for(e=1;e<40;e++){for(var t=r.getRSBlocks(e,this.errorCorrectLevel),n=new i,o=0,s=0;s=7&&this.setupTypeNumber(e),this.dataCache??=s.createData(this.typeNumber,this.errorCorrectLevel,this.dataList),this.mapData(this.dataCache,t)},c.setupPositionProbePattern=function(e,t){for(var n=-1;n<=7;n++)if(!(e+n<=-1||this.moduleCount<=e+n))for(var r=-1;r<=7;r++)t+r<=-1||this.moduleCount<=t+r||(0<=n&&n<=6&&(r==0||r==6)||0<=r&&r<=6&&(n==0||n==6)||2<=n&&n<=4&&2<=r&&r<=4?this.modules[e+n][t+r]=!0:this.modules[e+n][t+r]=!1)},c.getBestMaskPattern=function(){for(var e=0,t=0,n=0;n<8;n++){this.makeImpl(!0,n);var r=a.getLostPoint(this);(n==0||e>r)&&(e=r,t=n)}return t},c.createMovieClip=function(e,t,n){var r=e.createEmptyMovieClip(t,n),i=1;this.make();for(var a=0;a>n&1)==1;this.modules[Math.floor(n/3)][n%3+this.moduleCount-8-3]=r}for(var n=0;n<18;n++){var r=!e&&(t>>n&1)==1;this.modules[n%3+this.moduleCount-8-3][Math.floor(n/3)]=r}},c.setupTypeInfo=function(e,t){for(var n=this.errorCorrectLevel<<3|t,r=a.getBCHTypeInfo(n),i=0;i<15;i++){var o=!e&&(r>>i&1)==1;i<6?this.modules[i][8]=o:i<8?this.modules[i+1][8]=o:this.modules[this.moduleCount-15+i][8]=o}for(var i=0;i<15;i++){var o=!e&&(r>>i&1)==1;i<8?this.modules[8][this.moduleCount-i-1]=o:i<9?this.modules[8][15-i-1+1]=o:this.modules[8][15-i-1]=o}this.modules[this.moduleCount-8][8]=!e},c.mapData=function(e,t){for(var n=-1,r=this.moduleCount-1,i=7,o=0,s=this.moduleCount-1;s>0;s-=2)for(s==6&&s--;;){for(var c=0;c<2;c++)if(this.modules[r][s-c]==null){var l=!1;o>>i&1)==1),a.getMask(t,r,s-c)&&(l=!l),this.modules[r][s-c]=l,i--,i==-1&&(o++,i=7)}if(r+=n,r<0||this.moduleCount<=r){r-=n,n=-n;break}}},s.PAD0=236,s.PAD1=17,s.createData=function(e,t,n){for(var o=r.getRSBlocks(e,t),c=new i,l=0;ld*8)throw Error(`code length overflow. (`+c.getLengthInBits()+`>`+d*8+`)`);for(c.getLengthInBits()+4<=d*8&&c.put(0,4);c.getLengthInBits()%8!=0;)c.putBit(!1);for(;!(c.getLengthInBits()>=d*8||(c.put(s.PAD0,8),c.getLengthInBits()>=d*8));)c.put(s.PAD1,8);return s.createBytes(c,o)},s.createBytes=function(e,t){for(var n=0,r=0,i=0,s=Array(t.length),c=Array(t.length),l=0;l=0?m.get(h):0}}for(var g=0,f=0;f{Object.defineProperty(e,`__esModule`,{value:!0});var n=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}var l={bgColor:r.default.oneOfType([r.default.object,r.default.string]).isRequired,bgD:r.default.string.isRequired,fgColor:r.default.oneOfType([r.default.object,r.default.string]).isRequired,fgD:r.default.string.isRequired,size:r.default.number.isRequired,title:r.default.string,viewBoxSize:r.default.number.isRequired,xmlns:r.default.string},u=(0,i.forwardRef)(function(e,t){var r=e.bgColor,i=e.bgD,a=e.fgD,s=e.fgColor,l=e.size,u=e.title,d=e.viewBoxSize,f=e.xmlns,p=f===void 0?`http://www.w3.org/2000/svg`:f,m=c(e,[`bgColor`,`bgD`,`fgD`,`fgColor`,`size`,`title`,`viewBoxSize`,`xmlns`]);return o.default.createElement(`svg`,n({},m,{height:l,ref:t,viewBox:`0 0 `+d+` `+d,width:l,xmlns:p}),u?o.default.createElement(`title`,null,u):null,o.default.createElement(`path`,{d:i,fill:r}),o.default.createElement(`path`,{d:a,fill:s}))});u.displayName=`QRCodeSvg`,u.propTypes=l,e.default=u})),O=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.QRCode=void 0;var n=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}var f={bgColor:r.default.oneOfType([r.default.object,r.default.string]),fgColor:r.default.oneOfType([r.default.object,r.default.string]),level:r.default.string,size:r.default.number,value:r.default.string.isRequired},p=(0,s.forwardRef)(function(e,t){var r=e.bgColor,a=r===void 0?`#FFFFFF`:r,s=e.fgColor,u=s===void 0?`#000000`:s,f=e.level,p=f===void 0?`L`:f,m=e.size,h=m===void 0?256:m,g=e.value,_=d(e,[`bgColor`,`fgColor`,`level`,`size`,`value`]),v=new o.default(-1,i.default[p]);v.addData(g),v.make();var y=v.modules;return c.default.createElement(l.default,n({},_,{bgColor:a,bgD:y.map(function(e,t){return e.map(function(e,n){return e?``:`M `+n+` `+t+` l 1 0 0 1 -1 0 Z`}).join(` `)}).join(` `),fgColor:u,fgD:y.map(function(e,t){return e.map(function(e,n){return e?`M `+n+` `+t+` l 1 0 0 1 -1 0 Z`:``}).join(` `)}).join(` `),ref:t,size:h,viewBoxSize:y.length}))});e.QRCode=p,p.displayName=`QRCode`,p.propTypes=f,e.default=p})),k=n(t(),1),A=n(O(),1),j=n(i(),1);function M(e){return typeof e==`object`&&!!e}function N(e){return typeof e==`function`}function P(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`bigint`){let t=BigInt(2**53-1),n=BigInt(-(2**53-1));return e>t||e0?n:null}function I(e){if(M(e)){let t=e.default;if(N(t))return t;let n=e.QRCode;if(N(n))return n}return N(e)?e:function({value:e}){return(0,j.jsx)(`div`,{className:`kv-verifier__qr-fallback`,"aria-label":`QR unavailable`,children:e})}}var L=I(A);function R(e,t=6,n=6){return e?e.length<=t+n+3?e:`${e.slice(0,t)}…${e.slice(-n)}`:``}function z(e,t=10,n=10){return e?e.length<=t+n+3?e:`${e.slice(0,t)}…${e.slice(-n)}`:``}function B(){let e=r;for(let t of[`kaiPulseNow`,`getKaiPulseNow`,`pulseNow`]){let n=e[t];if(N(n)){let e=F(P(n()));if(e)return e}}let t=e.kairosEpochNow,n=P(e.GENESIS_TS),i=P(e.PULSE_MS);if(N(t)&&n!==null&&i!==null&&Number.isFinite(i)&&i>0){let e=P(t());if(e!==null){let t=e-n;if(Number.isFinite(t)){let e=Math.floor(t/i)+1;return e>0?e:null}}}return null}function V(){let e=r,t=e.kairosEpochNow,n=P(e.GENESIS_TS),i=P(e.PULSE_MS);if(!N(t)||n===null||i===null||!(i>0))return null;let a=P(t());if(a===null)return null;let o=a-n;if(!Number.isFinite(o))return null;let s=n+(Math.max(0,Math.floor(o/i))+1)*i-a,c=Math.ceil(Math.max(25,Math.min(6e4,s)));return Number.isFinite(c)?c:null}function H(e){let[t,n]=(0,k.useState)(()=>B()??0);return(0,k.useEffect)(()=>{if(!e)return;let t=!1,r=null,i=()=>{if(t)return;let e=B();e&&e>0&&n(e);let a=V()??1e3;r=window.setTimeout(i,a)};return i(),()=>{t=!0,r!==null&&window.clearTimeout(r)}},[e]),t}function U({pulse:e,kaiSignature:t,phiKey:n,caption:r,chakraDay:i,compact:a=!1,verifierBaseUrl:o}){let[s,f]=(0,k.useState)(`idle`),[m,h]=(0,k.useState)(`idle`),[g,v]=(0,k.useState)(null),y=F(e),b=H(y===null),x=y??b,S=(0,k.useMemo)(()=>{let e=o??c(),r=String(e).replace(/\/+$/,``)||`/verify`,a=typeof t==`string`?t.trim():``,s=l(a),f=Number.isFinite(x)&&x>0?Math.floor(x):0,m=u(f,a),h=d(f,a,r),g=p(typeof i==`string`?i:String(i??``)),_=typeof n==`string`?n.trim():``;return{verifierUrl:h,verifierBaseUrl:r,verifierSlug:m,pulse:f,chakraDay:g,kaiSignature:a,kaiSignatureShort:s,phiKey:_,proofCapsule:f>0&&a.length>0&&_.length>0&&g?{v:`KPV-1`,pulse:f,chakraDay:g,kaiSignature:a,phiKey:_,verifierSlug:m}:null,proofHash:void 0}},[i,t,n,x,o]);(0,k.useEffect)(()=>{let e=!1;return(async()=>{if(!S.proofCapsule){v(null);return}try{let t=await _(S.proofCapsule);e||v(t)}catch{e||v(null)}})(),()=>{e=!0}},[S.proofCapsule]);let C=a?96:160,w=async()=>{if(typeof navigator>`u`||!navigator.clipboard){f(`error`);return}try{await navigator.clipboard.writeText(S.verifierUrl),f(`ok`),window.setTimeout(()=>f(`idle`),2e3)}catch{f(`error`)}},T=async()=>{if(typeof navigator>`u`||!navigator.clipboard){h(`error`);return}try{let e=g??void 0;!e&&S.proofCapsule&&(e=await _(S.proofCapsule),v(e));let t={...S,proofHash:e};await navigator.clipboard.writeText(JSON.stringify(t,null,2)),h(`ok`),window.setTimeout(()=>h(`idle`),2e3)}catch{h(`error`)}},E=a?`kv-verifier kv-verifier--compact`:`kv-verifier`,D=Number.isFinite(S.pulse)&&S.pulse>0?String(S.pulse):`—`,O=typeof r==`string`?r.trim():``,A=R(S.phiKey),M=g?z(g):`—`;return(0,j.jsxs)(`section`,{className:E,"aria-label":`Kai-Sigil verification frame`,"data-role":`verifier-frame`,children:[(0,j.jsx)(`div`,{className:`kv-verifier__qr-shell`,role:`img`,"aria-label":`QR code linking to Kai-Sigil verifier for pulse ${D} and signature ${S.kaiSignatureShort}`,children:(0,j.jsx)(`div`,{className:`kv-verifier__qr-inner`,children:(0,j.jsx)(L,{value:S.verifierUrl,size:C,bgColor:`#00000000`,fgColor:`#ffffff`})})}),(0,j.jsxs)(`div`,{className:`kv-verifier__content`,children:[(0,j.jsxs)(`header`,{className:`kv-verifier__header`,children:[(0,j.jsx)(`h3`,{className:`kv-verifier__title`,children:`Kai-Sigil Verifier`}),(0,j.jsx)(`p`,{className:`kv-verifier__subtitle`,children:`Scan or open the verifier link to confirm this post was sealed by this Φ-Key (KPV-1 payload-bound proof).`})]}),(0,j.jsxs)(`dl`,{className:`kv-verifier__meta`,children:[(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`🌀 Pulse`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value`,children:D})]}),(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`Kai Signature`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value kv-verifier__mono`,children:S.kaiSignatureShort})]}),(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`Φ-Key`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value kv-verifier__mono`,title:S.phiKey,children:A||`—`})]}),S.chakraDay?(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`🧬 Chakra Day`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value`,children:S.chakraDay})]}):null,(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`🔒 Proof Hash`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value kv-verifier__mono`,title:g??``,children:M})]})]}),O.length>0?(0,j.jsxs)(`p`,{className:`kv-verifier__caption`,"aria-label":`Post caption`,children:[`“`,O,`”`]}):null,(0,j.jsxs)(`div`,{className:`kv-verifier__actions`,children:[(0,j.jsx)(`a`,{href:S.verifierUrl,target:`_blank`,rel:`noopener noreferrer`,className:`kv-verifier__btn kv-verifier__btn--primary`,"data-role":`verifier-open-link`,children:`Open Verifier`}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>void w(),className:`kv-verifier__btn kv-verifier__btn--ghost`,"data-role":`verifier-copy-link`,children:s===`ok`?`Remembered!`:s===`error`?`Remember failed`:`Remember Link`}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>void T(),className:`kv-verifier__btn kv-verifier__btn--ghost`,"data-role":`verifier-copy-proof`,children:m===`ok`?`Proof Remembered!`:m===`error`?`Remember failed`:`Remember Proof`})]}),(0,j.jsxs)(`p`,{className:`kv-verifier__url`,"aria-label":`Verifier URL`,children:[(0,j.jsx)(`span`,{className:`kv-verifier__url-label`,children:`Verifier URL:`}),(0,j.jsx)(`span`,{className:`kv-verifier__url-value`,children:S.verifierUrl})]})]})]})}export{p as a,_ as i,u as n,d as r,U as t}; \ No newline at end of file +import{En as e,Tn as t,jn as n,pn as r,tn as i}from"./index-BWApiWDT.js";import{t as a}from"./prop-types-B3eCNXus.js";function o(e){return e.replace(/^\/+|\/+$/g,``)}function s(){try{return`/`}catch{}return`/`}function c(){if(typeof window>`u`)return`/verify`;let e=window.location.origin,t=o(s());return`${e}${t.length>0?`/${t}`:``}/verify`}function l(e){let t=typeof e==`string`?e.trim():``,n=t.length>0?t:`unknown-signature`;return n.length>10?n.slice(0,10):n}function u(e,t){return`${e}-${l(t)}`}function d(e,t,n){return`${(n??c()).replace(/\/+$/,``)}/${encodeURIComponent(u(e,t))}`}var f={root:`Root`,sacral:`Sacral`,solar:`Solar Plexus`,solarp:`Solar Plexus`,solarplexus:`Solar Plexus`,heart:`Heart`,throat:`Throat`,thirdeye:`Third Eye`,crown:`Crown`,krown:`Crown`};function p(e){if(typeof e!=`string`)return;let t=e.trim();if(t)return f[t.toLowerCase().replace(/[\s_-]/g,``)]}function m(e){let t=``;for(let n of e)t+=n.toString(16).padStart(2,`0`);return t}async function h(e){if(typeof crypto>`u`||!crypto.subtle)throw Error(`crypto.subtle unavailable; cannot compute proofHash.`);let t=new TextEncoder().encode(e),n=await crypto.subtle.digest(`SHA-256`,t);return m(new Uint8Array(n))}function g(e){return JSON.stringify({v:e.v,pulse:e.pulse,chakraDay:e.chakraDay,kaiSignature:e.kaiSignature,phiKey:e.phiKey,verifierSlug:e.verifierSlug})}async function _(e){return await h(g(e))}var v=e(((e,t)=>{t.exports={L:1,M:0,Q:3,H:2}})),y=e(((e,t)=>{t.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}})),b=e(((e,t)=>{var n=y();function r(e){this.mode=n.MODE_8BIT_BYTE,this.data=e}r.prototype={getLength:function(e){return this.data.length},write:function(e){for(var t=0;t{var n=v();function r(e,t){this.totalCount=e,this.dataCount=t}r.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],r.getRSBlocks=function(e,t){var n=r.getRsBlockTable(e,t);if(n==null)throw Error(`bad rs block @ typeNumber:`+e+`/errorCorrectLevel:`+t);for(var i=n.length/3,a=[],o=0;o{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){var t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(var n=0;n>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),C=e(((e,t)=>{for(var n={glog:function(e){if(e<1)throw Error(`glog(`+e+`)`);return n.LOG_TABLE[e]},gexp:function(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return n.EXP_TABLE[e]},EXP_TABLE:Array(256),LOG_TABLE:Array(256)},r=0;r<8;r++)n.EXP_TABLE[r]=1<{var n=C();function r(e,t){if(e.length==null)throw Error(e.length+`/`+t);for(var n=0;n{var n=y(),r=w(),i=C(),a={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},o={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(e){for(var t=e<<10;o.getBCHDigit(t)-o.getBCHDigit(o.G15)>=0;)t^=o.G15<=0;)t^=o.G18<>>=1;return t},getPatternPosition:function(e){return o.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,n){switch(e){case a.PATTERN000:return(t+n)%2==0;case a.PATTERN001:return t%2==0;case a.PATTERN010:return n%3==0;case a.PATTERN011:return(t+n)%3==0;case a.PATTERN100:return(Math.floor(t/2)+Math.floor(n/3))%2==0;case a.PATTERN101:return t*n%2+t*n%3==0;case a.PATTERN110:return(t*n%2+t*n%3)%2==0;case a.PATTERN111:return(t*n%3+(t+n)%2)%2==0;default:throw Error(`bad maskPattern:`+e)}},getErrorCorrectPolynomial:function(e){for(var t=new r([1],0),n=0;n5&&(n+=3+a-5)}for(var r=0;r{var n=b(),r=x(),i=S(),a=T(),o=w();function s(e,t){this.typeNumber=e,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var c=s.prototype;c.addData=function(e){var t=new n(e);this.dataList.push(t),this.dataCache=null},c.isDark=function(e,t){if(e<0||this.moduleCount<=e||t<0||this.moduleCount<=t)throw Error(e+`,`+t);return this.modules[e][t]},c.getModuleCount=function(){return this.moduleCount},c.make=function(){if(this.typeNumber<1){var e=1;for(e=1;e<40;e++){for(var t=r.getRSBlocks(e,this.errorCorrectLevel),n=new i,o=0,s=0;s=7&&this.setupTypeNumber(e),this.dataCache??=s.createData(this.typeNumber,this.errorCorrectLevel,this.dataList),this.mapData(this.dataCache,t)},c.setupPositionProbePattern=function(e,t){for(var n=-1;n<=7;n++)if(!(e+n<=-1||this.moduleCount<=e+n))for(var r=-1;r<=7;r++)t+r<=-1||this.moduleCount<=t+r||(0<=n&&n<=6&&(r==0||r==6)||0<=r&&r<=6&&(n==0||n==6)||2<=n&&n<=4&&2<=r&&r<=4?this.modules[e+n][t+r]=!0:this.modules[e+n][t+r]=!1)},c.getBestMaskPattern=function(){for(var e=0,t=0,n=0;n<8;n++){this.makeImpl(!0,n);var r=a.getLostPoint(this);(n==0||e>r)&&(e=r,t=n)}return t},c.createMovieClip=function(e,t,n){var r=e.createEmptyMovieClip(t,n),i=1;this.make();for(var a=0;a>n&1)==1;this.modules[Math.floor(n/3)][n%3+this.moduleCount-8-3]=r}for(var n=0;n<18;n++){var r=!e&&(t>>n&1)==1;this.modules[n%3+this.moduleCount-8-3][Math.floor(n/3)]=r}},c.setupTypeInfo=function(e,t){for(var n=this.errorCorrectLevel<<3|t,r=a.getBCHTypeInfo(n),i=0;i<15;i++){var o=!e&&(r>>i&1)==1;i<6?this.modules[i][8]=o:i<8?this.modules[i+1][8]=o:this.modules[this.moduleCount-15+i][8]=o}for(var i=0;i<15;i++){var o=!e&&(r>>i&1)==1;i<8?this.modules[8][this.moduleCount-i-1]=o:i<9?this.modules[8][15-i-1+1]=o:this.modules[8][15-i-1]=o}this.modules[this.moduleCount-8][8]=!e},c.mapData=function(e,t){for(var n=-1,r=this.moduleCount-1,i=7,o=0,s=this.moduleCount-1;s>0;s-=2)for(s==6&&s--;;){for(var c=0;c<2;c++)if(this.modules[r][s-c]==null){var l=!1;o>>i&1)==1),a.getMask(t,r,s-c)&&(l=!l),this.modules[r][s-c]=l,i--,i==-1&&(o++,i=7)}if(r+=n,r<0||this.moduleCount<=r){r-=n,n=-n;break}}},s.PAD0=236,s.PAD1=17,s.createData=function(e,t,n){for(var o=r.getRSBlocks(e,t),c=new i,l=0;ld*8)throw Error(`code length overflow. (`+c.getLengthInBits()+`>`+d*8+`)`);for(c.getLengthInBits()+4<=d*8&&c.put(0,4);c.getLengthInBits()%8!=0;)c.putBit(!1);for(;!(c.getLengthInBits()>=d*8||(c.put(s.PAD0,8),c.getLengthInBits()>=d*8));)c.put(s.PAD1,8);return s.createBytes(c,o)},s.createBytes=function(e,t){for(var n=0,r=0,i=0,s=Array(t.length),c=Array(t.length),l=0;l=0?m.get(h):0}}for(var g=0,f=0;f{Object.defineProperty(e,`__esModule`,{value:!0});var n=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}var l={bgColor:r.default.oneOfType([r.default.object,r.default.string]).isRequired,bgD:r.default.string.isRequired,fgColor:r.default.oneOfType([r.default.object,r.default.string]).isRequired,fgD:r.default.string.isRequired,size:r.default.number.isRequired,title:r.default.string,viewBoxSize:r.default.number.isRequired,xmlns:r.default.string},u=(0,i.forwardRef)(function(e,t){var r=e.bgColor,i=e.bgD,a=e.fgD,s=e.fgColor,l=e.size,u=e.title,d=e.viewBoxSize,f=e.xmlns,p=f===void 0?`http://www.w3.org/2000/svg`:f,m=c(e,[`bgColor`,`bgD`,`fgD`,`fgColor`,`size`,`title`,`viewBoxSize`,`xmlns`]);return o.default.createElement(`svg`,n({},m,{height:l,ref:t,viewBox:`0 0 `+d+` `+d,width:l,xmlns:p}),u?o.default.createElement(`title`,null,u):null,o.default.createElement(`path`,{d:i,fill:r}),o.default.createElement(`path`,{d:a,fill:s}))});u.displayName=`QRCodeSvg`,u.propTypes=l,e.default=u})),O=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.QRCode=void 0;var n=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}var f={bgColor:r.default.oneOfType([r.default.object,r.default.string]),fgColor:r.default.oneOfType([r.default.object,r.default.string]),level:r.default.string,size:r.default.number,value:r.default.string.isRequired},p=(0,s.forwardRef)(function(e,t){var r=e.bgColor,a=r===void 0?`#FFFFFF`:r,s=e.fgColor,u=s===void 0?`#000000`:s,f=e.level,p=f===void 0?`L`:f,m=e.size,h=m===void 0?256:m,g=e.value,_=d(e,[`bgColor`,`fgColor`,`level`,`size`,`value`]),v=new o.default(-1,i.default[p]);v.addData(g),v.make();var y=v.modules;return c.default.createElement(l.default,n({},_,{bgColor:a,bgD:y.map(function(e,t){return e.map(function(e,n){return e?``:`M `+n+` `+t+` l 1 0 0 1 -1 0 Z`}).join(` `)}).join(` `),fgColor:u,fgD:y.map(function(e,t){return e.map(function(e,n){return e?`M `+n+` `+t+` l 1 0 0 1 -1 0 Z`:``}).join(` `)}).join(` `),ref:t,size:h,viewBoxSize:y.length}))});e.QRCode=p,p.displayName=`QRCode`,p.propTypes=f,e.default=p})),k=n(t(),1),A=n(O(),1),j=n(i(),1);function M(e){return typeof e==`object`&&!!e}function N(e){return typeof e==`function`}function P(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`bigint`){let t=BigInt(2**53-1),n=BigInt(-(2**53-1));return e>t||e0?n:null}function I(e){if(M(e)){let t=e.default;if(N(t))return t;let n=e.QRCode;if(N(n))return n}return N(e)?e:function({value:e}){return(0,j.jsx)(`div`,{className:`kv-verifier__qr-fallback`,"aria-label":`QR unavailable`,children:e})}}var L=I(A);function R(e,t=6,n=6){return e?e.length<=t+n+3?e:`${e.slice(0,t)}…${e.slice(-n)}`:``}function z(e,t=10,n=10){return e?e.length<=t+n+3?e:`${e.slice(0,t)}…${e.slice(-n)}`:``}function B(){let e=r;for(let t of[`kaiPulseNow`,`getKaiPulseNow`,`pulseNow`]){let n=e[t];if(N(n)){let e=F(P(n()));if(e)return e}}let t=e.kairosEpochNow,n=P(e.GENESIS_TS),i=P(e.PULSE_MS);if(N(t)&&n!==null&&i!==null&&Number.isFinite(i)&&i>0){let e=P(t());if(e!==null){let t=e-n;if(Number.isFinite(t)){let e=Math.floor(t/i)+1;return e>0?e:null}}}return null}function V(){let e=r,t=e.kairosEpochNow,n=P(e.GENESIS_TS),i=P(e.PULSE_MS);if(!N(t)||n===null||i===null||!(i>0))return null;let a=P(t());if(a===null)return null;let o=a-n;if(!Number.isFinite(o))return null;let s=n+(Math.max(0,Math.floor(o/i))+1)*i-a,c=Math.ceil(Math.max(25,Math.min(6e4,s)));return Number.isFinite(c)?c:null}function H(e){let[t,n]=(0,k.useState)(()=>B()??0);return(0,k.useEffect)(()=>{if(!e)return;let t=!1,r=null,i=()=>{if(t)return;let e=B();e&&e>0&&n(e);let a=V()??1e3;r=window.setTimeout(i,a)};return i(),()=>{t=!0,r!==null&&window.clearTimeout(r)}},[e]),t}function U({pulse:e,kaiSignature:t,phiKey:n,caption:r,chakraDay:i,compact:a=!1,verifierBaseUrl:o}){let[s,f]=(0,k.useState)(`idle`),[m,h]=(0,k.useState)(`idle`),[g,v]=(0,k.useState)(null),y=F(e),b=H(y===null),x=y??b,S=(0,k.useMemo)(()=>{let e=o??c(),r=String(e).replace(/\/+$/,``)||`/verify`,a=typeof t==`string`?t.trim():``,s=l(a),f=Number.isFinite(x)&&x>0?Math.floor(x):0,m=u(f,a),h=d(f,a,r),g=p(typeof i==`string`?i:String(i??``)),_=typeof n==`string`?n.trim():``;return{verifierUrl:h,verifierBaseUrl:r,verifierSlug:m,pulse:f,chakraDay:g,kaiSignature:a,kaiSignatureShort:s,phiKey:_,proofCapsule:f>0&&a.length>0&&_.length>0&&g?{v:`KPV-1`,pulse:f,chakraDay:g,kaiSignature:a,phiKey:_,verifierSlug:m}:null,proofHash:void 0}},[i,t,n,x,o]);(0,k.useEffect)(()=>{let e=!1;return(async()=>{if(!S.proofCapsule){v(null);return}try{let t=await _(S.proofCapsule);e||v(t)}catch{e||v(null)}})(),()=>{e=!0}},[S.proofCapsule]);let C=a?96:160,w=async()=>{if(typeof navigator>`u`||!navigator.clipboard){f(`error`);return}try{await navigator.clipboard.writeText(S.verifierUrl),f(`ok`),window.setTimeout(()=>f(`idle`),2e3)}catch{f(`error`)}},T=async()=>{if(typeof navigator>`u`||!navigator.clipboard){h(`error`);return}try{let e=g??void 0;!e&&S.proofCapsule&&(e=await _(S.proofCapsule),v(e));let t={...S,proofHash:e};await navigator.clipboard.writeText(JSON.stringify(t,null,2)),h(`ok`),window.setTimeout(()=>h(`idle`),2e3)}catch{h(`error`)}},E=a?`kv-verifier kv-verifier--compact`:`kv-verifier`,D=Number.isFinite(S.pulse)&&S.pulse>0?String(S.pulse):`—`,O=typeof r==`string`?r.trim():``,A=R(S.phiKey),M=g?z(g):`—`;return(0,j.jsxs)(`section`,{className:E,"aria-label":`Kai-Sigil verification frame`,"data-role":`verifier-frame`,children:[(0,j.jsx)(`div`,{className:`kv-verifier__qr-shell`,role:`img`,"aria-label":`QR code linking to Kai-Sigil verifier for pulse ${D} and signature ${S.kaiSignatureShort}`,children:(0,j.jsx)(`div`,{className:`kv-verifier__qr-inner`,children:(0,j.jsx)(L,{value:S.verifierUrl,size:C,bgColor:`#00000000`,fgColor:`#ffffff`})})}),(0,j.jsxs)(`div`,{className:`kv-verifier__content`,children:[(0,j.jsxs)(`header`,{className:`kv-verifier__header`,children:[(0,j.jsx)(`h3`,{className:`kv-verifier__title`,children:`Kai-Sigil Verifier`}),(0,j.jsx)(`p`,{className:`kv-verifier__subtitle`,children:`Scan or open the verifier link to confirm this post was sealed by this Φ-Key (KPV-1 payload-bound proof).`})]}),(0,j.jsxs)(`dl`,{className:`kv-verifier__meta`,children:[(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`🌀 Pulse`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value`,children:D})]}),(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`Kai Signature`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value kv-verifier__mono`,children:S.kaiSignatureShort})]}),(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`Φ-Key`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value kv-verifier__mono`,title:S.phiKey,children:A||`—`})]}),S.chakraDay?(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`🧬 Chakra Day`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value`,children:S.chakraDay})]}):null,(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`🔒 Proof Hash`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value kv-verifier__mono`,title:g??``,children:M})]})]}),O.length>0?(0,j.jsxs)(`p`,{className:`kv-verifier__caption`,"aria-label":`Post caption`,children:[`“`,O,`”`]}):null,(0,j.jsxs)(`div`,{className:`kv-verifier__actions`,children:[(0,j.jsx)(`a`,{href:S.verifierUrl,target:`_blank`,rel:`noopener noreferrer`,className:`kv-verifier__btn kv-verifier__btn--primary`,"data-role":`verifier-open-link`,children:`Open Verifier`}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>void w(),className:`kv-verifier__btn kv-verifier__btn--ghost`,"data-role":`verifier-copy-link`,children:s===`ok`?`Remembered!`:s===`error`?`Remember failed`:`Remember Link`}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>void T(),className:`kv-verifier__btn kv-verifier__btn--ghost`,"data-role":`verifier-copy-proof`,children:m===`ok`?`Proof Remembered!`:m===`error`?`Remember failed`:`Remember Proof`})]}),(0,j.jsxs)(`p`,{className:`kv-verifier__url`,"aria-label":`Verifier URL`,children:[(0,j.jsx)(`span`,{className:`kv-verifier__url-label`,children:`Verifier URL:`}),(0,j.jsx)(`span`,{className:`kv-verifier__url-value`,children:S.verifierUrl})]})]})]})}export{p as a,_ as i,u as n,d as r,U as t}; \ No newline at end of file diff --git a/dist/assets/VerifyPage-B34sC8R1.js b/dist/assets/VerifyPage-BoLb2QzD.js similarity index 97% rename from dist/assets/VerifyPage-B34sC8R1.js rename to dist/assets/VerifyPage-BoLb2QzD.js index 771cac94..924f178e 100644 --- a/dist/assets/VerifyPage-B34sC8R1.js +++ b/dist/assets/VerifyPage-BoLb2QzD.js @@ -1 +1 @@ -import{Ht as e,Tn as t,jn as n,tn as r}from"./index-CcPm2yTY.js";import"./prop-types-CQ3MXKCa.js";import{t as i}from"./VerifierFrame-Dr7oGdbu.js";var a=n(t(),1),o=n(r(),1);function s(e){return typeof e==`object`&&!!e}function c(e){let t=decodeURIComponent(e||``).trim(),n=t.match(/^(\d+)-([A-Za-z0-9]+)$/);if(!n)return{raw:t,pulse:null,shortSig:null};let r=Number(n[1]);return{raw:t,pulse:Number.isFinite(r)&&r>0?r:null,shortSig:n[2]?String(n[2]):null}}function l(){if(typeof window>`u`)return``;let e=window.location.pathname||``,t=window.location.hash||``,n=e.match(/\/verify\/([^/?#]+)/);if(n&&n[1])return n[1];let r=t.match(/\/verify\/([^/?#]+)/);return r&&r[1]?r[1]:``}function u(e){let t=e.match(/]*>([\s\S]*?)<\/metadata>/i);return t?(t[1]??``).trim():null}function d(e){let t=e.trim();if(!t)return null;try{return JSON.parse(t)}catch{return null}}function f(e){if(!s(e))return{raw:e};let t=typeof e.kaiSignature==`string`?e.kaiSignature:void 0,n=typeof e.pulse==`number`&&Number.isFinite(e.pulse)?e.pulse:void 0,r=typeof e.chakraDay==`string`?e.chakraDay:void 0,i=typeof e.timestamp==`string`?e.timestamp:void 0,a=typeof e.phiKey==`string`?e.phiKey:void 0,o=typeof e.userPhiKey==`string`?e.userPhiKey:void 0;return{pulse:n,chakraDay:r,kaiSignature:t,phiKey:a&&!a.startsWith(`φK-`)?a:o,timestamp:i,verifierUrl:typeof e.verifierUrl==`string`?e.verifierUrl:void 0,raw:e}}function p(e){let t=u(e);if(t){let e=d(t);if(e)return f(e)}let n=e.indexOf(`"kaiSignature"`);if(n>=0){let t=e.slice(Math.max(0,n-800),Math.min(e.length,n+2e3)).match(/\{[\s\S]*\}/);if(t&&t[0]){let e=d(t[0]);if(e)return f(e)}}return{}}function m(e,t){return e.length<=t?e:e.slice(0,t)}async function h(e){return await new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(Error(`Failed to read file.`)),r.onload=()=>t(String(r.result??``)),r.readAsText(e)})}function g(){let t=(0,a.useMemo)(()=>l(),[]),n=(0,a.useMemo)(()=>c(t),[t]),[r,s]=(0,a.useState)(``),[u,d]=(0,a.useState)({status:`idle`}),[f,g]=(0,a.useState)(!1),_=(0,a.useMemo)(()=>({pulse:n.pulse??0,kaiSignature:n.shortSig??`unknown-signature`,phiKey:`—`}),[n.pulse,n.shortSig]),v=(0,a.useCallback)(async()=>{let t=r.trim();if(!t){d({status:`error`,message:`Paste the sealed SVG text or upload the sealed SVG file first.`,slug:n});return}g(!0);try{let r=p(t),i=(r.kaiSignature??``).trim();if(!i){d({status:`error`,message:`No kaiSignature found in the SVG metadata.`,slug:n,embedded:r});return}let a=await e(i),o=(r.phiKey??``).trim(),s=r.pulse,c={hasSignature:!0,slugPulseMatches:n.pulse==null||s==null?null:n.pulse===s,slugShortSigMatches:n.shortSig==null?null:n.shortSig===m(i,n.shortSig.length),derivedPhiKeyMatchesEmbedded:o.length===0?null:a===o};if(c.slugPulseMatches===!1||c.slugShortSigMatches===!1||c.derivedPhiKeyMatchesEmbedded===!1){d({status:`error`,message:`Verification failed: one or more checks did not match.`,slug:n,embedded:r,derivedPhiKey:a,checks:c});return}d({status:`ok`,slug:n,embedded:{...r,phiKey:o.length>0?o:a},derivedPhiKey:a,checks:c})}catch(e){d({status:`error`,message:e instanceof Error?e.message:`Verification failed.`,slug:n})}finally{g(!1)}},[n,r]),y=(0,a.useCallback)(async e=>{if(!e.name.toLowerCase().endsWith(`.svg`)){d({status:`error`,message:`Upload a sealed .svg (this verifier reads embedded JSON).`,slug:n});return}s(await h(e)),d({status:`idle`})},[n]);return(0,o.jsxs)(`div`,{className:`verify-page`,children:[(0,o.jsxs)(`header`,{className:`verify-hero`,children:[(0,o.jsx)(`h1`,{className:`verify-title`,children:`Kai-Sigil Verifier`}),(0,o.jsx)(`p`,{className:`verify-subtitle`,children:`Open a sealed memory and verify its human origin by Kai Signature → Φ-Key.`}),(0,o.jsxs)(`div`,{className:`verify-slug`,children:[(0,o.jsx)(`span`,{className:`verify-slug-label`,children:`Link:`}),(0,o.jsxs)(`code`,{className:`verify-slug-value`,children:[`/verify/`,n.raw||`—`]})]})]}),(0,o.jsxs)(`main`,{className:`verify-main`,children:[(0,o.jsxs)(`section`,{className:`verify-card`,children:[(0,o.jsx)(`h2`,{className:`verify-card-title`,children:`1) Provide the sealed post`}),(0,o.jsxs)(`div`,{className:`verify-upload-row`,children:[(0,o.jsxs)(`label`,{className:`verify-upload`,children:[(0,o.jsx)(`input`,{type:`file`,accept:`.svg,image/svg+xml`,onChange:e=>{let t=e.currentTarget.files?.[0];t&&y(t),e.currentTarget.value=``}}),`Upload sealed SVG`]}),(0,o.jsx)(`button`,{type:`button`,className:`verify-btn`,onClick:()=>void v(),disabled:f,children:f?`Verifying…`:`Verify`})]}),(0,o.jsx)(`textarea`,{className:`verify-textarea`,value:r,onChange:e=>s(e.currentTarget.value),placeholder:`Or paste the sealed SVG text here (must include {...} with kaiSignature + pulse + userPhiKey/phiKey).`,spellCheck:!1})]}),(0,o.jsxs)(`section`,{className:`verify-card`,children:[(0,o.jsx)(`h2`,{className:`verify-card-title`,children:`2) Proof capsule`}),u.status===`ok`?(0,o.jsx)(i,{pulse:u.embedded.pulse??n.pulse??0,kaiSignature:u.embedded.kaiSignature??n.shortSig??`unknown`,phiKey:u.derivedPhiKey,chakraDay:u.embedded.chakraDay,compact:!1}):(0,o.jsx)(i,{pulse:_.pulse,kaiSignature:_.kaiSignature,phiKey:_.phiKey,compact:!1}),(0,o.jsx)(`div`,{className:`verify-status`,children:u.status===`idle`?(0,o.jsx)(`p`,{className:`verify-muted`,children:`Upload/paste a sealed SVG, then click Verify.`}):u.status===`ok`?(0,o.jsxs)(`div`,{className:`verify-ok`,children:[(0,o.jsx)(`div`,{className:`verify-badge verify-badge--ok`,children:`Verified`}),(0,o.jsxs)(`p`,{className:`verify-line`,children:[`Sealed by Φ-Key: `,(0,o.jsx)(`code`,{children:u.derivedPhiKey})]}),(0,o.jsxs)(`ul`,{className:`verify-checks`,children:[(0,o.jsxs)(`li`,{children:[`slug pulse match:`,` `,(0,o.jsx)(`strong`,{children:u.checks.slugPulseMatches===null?`n/a`:String(u.checks.slugPulseMatches)})]}),(0,o.jsxs)(`li`,{children:[`slug shortSig match:`,` `,(0,o.jsx)(`strong`,{children:u.checks.slugShortSigMatches===null?`n/a`:String(u.checks.slugShortSigMatches)})]}),(0,o.jsxs)(`li`,{children:[`derived Φ-Key matches embedded:`,` `,(0,o.jsx)(`strong`,{children:u.checks.derivedPhiKeyMatchesEmbedded===null?`n/a (embed omitted phiKey)`:String(u.checks.derivedPhiKeyMatchesEmbedded)})]})]})]}):(0,o.jsxs)(`div`,{className:`verify-fail`,children:[(0,o.jsx)(`div`,{className:`verify-badge verify-badge--fail`,children:`Not verified`}),(0,o.jsx)(`p`,{className:`verify-line`,children:u.message}),u.checks?(0,o.jsxs)(`ul`,{className:`verify-checks`,children:[(0,o.jsxs)(`li`,{children:[`slug pulse match:`,` `,(0,o.jsx)(`strong`,{children:u.checks.slugPulseMatches===null?`n/a`:String(u.checks.slugPulseMatches)})]}),(0,o.jsxs)(`li`,{children:[`slug shortSig match:`,` `,(0,o.jsx)(`strong`,{children:u.checks.slugShortSigMatches===null?`n/a`:String(u.checks.slugShortSigMatches)})]}),(0,o.jsxs)(`li`,{children:[`derived Φ-Key matches embedded:`,` `,(0,o.jsx)(`strong`,{children:u.checks.derivedPhiKeyMatchesEmbedded===null?`n/a (embed omitted phiKey)`:String(u.checks.derivedPhiKeyMatchesEmbedded)})]})]}):null]})})]})]})]})}export{g as default}; \ No newline at end of file +import{Ht as e,Tn as t,jn as n,tn as r}from"./index-BWApiWDT.js";import"./prop-types-B3eCNXus.js";import{t as i}from"./VerifierFrame-DkyrPdnF.js";var a=n(t(),1),o=n(r(),1);function s(e){return typeof e==`object`&&!!e}function c(e){let t=decodeURIComponent(e||``).trim(),n=t.match(/^(\d+)-([A-Za-z0-9]+)$/);if(!n)return{raw:t,pulse:null,shortSig:null};let r=Number(n[1]);return{raw:t,pulse:Number.isFinite(r)&&r>0?r:null,shortSig:n[2]?String(n[2]):null}}function l(){if(typeof window>`u`)return``;let e=window.location.pathname||``,t=window.location.hash||``,n=e.match(/\/verify\/([^/?#]+)/);if(n&&n[1])return n[1];let r=t.match(/\/verify\/([^/?#]+)/);return r&&r[1]?r[1]:``}function u(e){let t=e.match(/]*>([\s\S]*?)<\/metadata>/i);return t?(t[1]??``).trim():null}function d(e){let t=e.trim();if(!t)return null;try{return JSON.parse(t)}catch{return null}}function f(e){if(!s(e))return{raw:e};let t=typeof e.kaiSignature==`string`?e.kaiSignature:void 0,n=typeof e.pulse==`number`&&Number.isFinite(e.pulse)?e.pulse:void 0,r=typeof e.chakraDay==`string`?e.chakraDay:void 0,i=typeof e.timestamp==`string`?e.timestamp:void 0,a=typeof e.phiKey==`string`?e.phiKey:void 0,o=typeof e.userPhiKey==`string`?e.userPhiKey:void 0;return{pulse:n,chakraDay:r,kaiSignature:t,phiKey:a&&!a.startsWith(`φK-`)?a:o,timestamp:i,verifierUrl:typeof e.verifierUrl==`string`?e.verifierUrl:void 0,raw:e}}function p(e){let t=u(e);if(t){let e=d(t);if(e)return f(e)}let n=e.indexOf(`"kaiSignature"`);if(n>=0){let t=e.slice(Math.max(0,n-800),Math.min(e.length,n+2e3)).match(/\{[\s\S]*\}/);if(t&&t[0]){let e=d(t[0]);if(e)return f(e)}}return{}}function m(e,t){return e.length<=t?e:e.slice(0,t)}async function h(e){return await new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(Error(`Failed to read file.`)),r.onload=()=>t(String(r.result??``)),r.readAsText(e)})}function g(){let t=(0,a.useMemo)(()=>l(),[]),n=(0,a.useMemo)(()=>c(t),[t]),[r,s]=(0,a.useState)(``),[u,d]=(0,a.useState)({status:`idle`}),[f,g]=(0,a.useState)(!1),_=(0,a.useMemo)(()=>({pulse:n.pulse??0,kaiSignature:n.shortSig??`unknown-signature`,phiKey:`—`}),[n.pulse,n.shortSig]),v=(0,a.useCallback)(async()=>{let t=r.trim();if(!t){d({status:`error`,message:`Paste the sealed SVG text or upload the sealed SVG file first.`,slug:n});return}g(!0);try{let r=p(t),i=(r.kaiSignature??``).trim();if(!i){d({status:`error`,message:`No kaiSignature found in the SVG metadata.`,slug:n,embedded:r});return}let a=await e(i),o=(r.phiKey??``).trim(),s=r.pulse,c={hasSignature:!0,slugPulseMatches:n.pulse==null||s==null?null:n.pulse===s,slugShortSigMatches:n.shortSig==null?null:n.shortSig===m(i,n.shortSig.length),derivedPhiKeyMatchesEmbedded:o.length===0?null:a===o};if(c.slugPulseMatches===!1||c.slugShortSigMatches===!1||c.derivedPhiKeyMatchesEmbedded===!1){d({status:`error`,message:`Verification failed: one or more checks did not match.`,slug:n,embedded:r,derivedPhiKey:a,checks:c});return}d({status:`ok`,slug:n,embedded:{...r,phiKey:o.length>0?o:a},derivedPhiKey:a,checks:c})}catch(e){d({status:`error`,message:e instanceof Error?e.message:`Verification failed.`,slug:n})}finally{g(!1)}},[n,r]),y=(0,a.useCallback)(async e=>{if(!e.name.toLowerCase().endsWith(`.svg`)){d({status:`error`,message:`Upload a sealed .svg (this verifier reads embedded JSON).`,slug:n});return}s(await h(e)),d({status:`idle`})},[n]);return(0,o.jsxs)(`div`,{className:`verify-page`,children:[(0,o.jsxs)(`header`,{className:`verify-hero`,children:[(0,o.jsx)(`h1`,{className:`verify-title`,children:`Kai-Sigil Verifier`}),(0,o.jsx)(`p`,{className:`verify-subtitle`,children:`Open a sealed memory and verify its human origin by Kai Signature → Φ-Key.`}),(0,o.jsxs)(`div`,{className:`verify-slug`,children:[(0,o.jsx)(`span`,{className:`verify-slug-label`,children:`Link:`}),(0,o.jsxs)(`code`,{className:`verify-slug-value`,children:[`/verify/`,n.raw||`—`]})]})]}),(0,o.jsxs)(`main`,{className:`verify-main`,children:[(0,o.jsxs)(`section`,{className:`verify-card`,children:[(0,o.jsx)(`h2`,{className:`verify-card-title`,children:`1) Provide the sealed post`}),(0,o.jsxs)(`div`,{className:`verify-upload-row`,children:[(0,o.jsxs)(`label`,{className:`verify-upload`,children:[(0,o.jsx)(`input`,{type:`file`,accept:`.svg,image/svg+xml`,onChange:e=>{let t=e.currentTarget.files?.[0];t&&y(t),e.currentTarget.value=``}}),`Upload sealed SVG`]}),(0,o.jsx)(`button`,{type:`button`,className:`verify-btn`,onClick:()=>void v(),disabled:f,children:f?`Verifying…`:`Verify`})]}),(0,o.jsx)(`textarea`,{className:`verify-textarea`,value:r,onChange:e=>s(e.currentTarget.value),placeholder:`Or paste the sealed SVG text here (must include {...} with kaiSignature + pulse + userPhiKey/phiKey).`,spellCheck:!1})]}),(0,o.jsxs)(`section`,{className:`verify-card`,children:[(0,o.jsx)(`h2`,{className:`verify-card-title`,children:`2) Proof capsule`}),u.status===`ok`?(0,o.jsx)(i,{pulse:u.embedded.pulse??n.pulse??0,kaiSignature:u.embedded.kaiSignature??n.shortSig??`unknown`,phiKey:u.derivedPhiKey,chakraDay:u.embedded.chakraDay,compact:!1}):(0,o.jsx)(i,{pulse:_.pulse,kaiSignature:_.kaiSignature,phiKey:_.phiKey,compact:!1}),(0,o.jsx)(`div`,{className:`verify-status`,children:u.status===`idle`?(0,o.jsx)(`p`,{className:`verify-muted`,children:`Upload/paste a sealed SVG, then click Verify.`}):u.status===`ok`?(0,o.jsxs)(`div`,{className:`verify-ok`,children:[(0,o.jsx)(`div`,{className:`verify-badge verify-badge--ok`,children:`Verified`}),(0,o.jsxs)(`p`,{className:`verify-line`,children:[`Sealed by Φ-Key: `,(0,o.jsx)(`code`,{children:u.derivedPhiKey})]}),(0,o.jsxs)(`ul`,{className:`verify-checks`,children:[(0,o.jsxs)(`li`,{children:[`slug pulse match:`,` `,(0,o.jsx)(`strong`,{children:u.checks.slugPulseMatches===null?`n/a`:String(u.checks.slugPulseMatches)})]}),(0,o.jsxs)(`li`,{children:[`slug shortSig match:`,` `,(0,o.jsx)(`strong`,{children:u.checks.slugShortSigMatches===null?`n/a`:String(u.checks.slugShortSigMatches)})]}),(0,o.jsxs)(`li`,{children:[`derived Φ-Key matches embedded:`,` `,(0,o.jsx)(`strong`,{children:u.checks.derivedPhiKeyMatchesEmbedded===null?`n/a (embed omitted phiKey)`:String(u.checks.derivedPhiKeyMatchesEmbedded)})]})]})]}):(0,o.jsxs)(`div`,{className:`verify-fail`,children:[(0,o.jsx)(`div`,{className:`verify-badge verify-badge--fail`,children:`Not verified`}),(0,o.jsx)(`p`,{className:`verify-line`,children:u.message}),u.checks?(0,o.jsxs)(`ul`,{className:`verify-checks`,children:[(0,o.jsxs)(`li`,{children:[`slug pulse match:`,` `,(0,o.jsx)(`strong`,{children:u.checks.slugPulseMatches===null?`n/a`:String(u.checks.slugPulseMatches)})]}),(0,o.jsxs)(`li`,{children:[`slug shortSig match:`,` `,(0,o.jsx)(`strong`,{children:u.checks.slugShortSigMatches===null?`n/a`:String(u.checks.slugShortSigMatches)})]}),(0,o.jsxs)(`li`,{children:[`derived Φ-Key matches embedded:`,` `,(0,o.jsx)(`strong`,{children:u.checks.derivedPhiKeyMatchesEmbedded===null?`n/a (embed omitted phiKey)`:String(u.checks.derivedPhiKeyMatchesEmbedded)})]})]}):null]})})]})]})]})}export{g as default}; \ No newline at end of file diff --git a/dist/assets/__vite-browser-external-CUSLmM9D.js b/dist/assets/__vite-browser-external-CUSLmM9D.js deleted file mode 100644 index 6c98a72d..00000000 --- a/dist/assets/__vite-browser-external-CUSLmM9D.js +++ /dev/null @@ -1 +0,0 @@ -import{En as e}from"./index-CcPm2yTY.js";var t=e(((e,t)=>{t.exports={}}));export default t(); \ No newline at end of file diff --git a/dist/assets/__vite-browser-external-CekNgi1j.js b/dist/assets/__vite-browser-external-CekNgi1j.js new file mode 100644 index 00000000..594b6580 --- /dev/null +++ b/dist/assets/__vite-browser-external-CekNgi1j.js @@ -0,0 +1 @@ +import{En as e}from"./index-BWApiWDT.js";var t=e(((e,t)=>{t.exports={}}));export default t(); \ No newline at end of file diff --git a/dist/assets/bundler-H_464dRi.js b/dist/assets/bundler-IMYm8BQv.js similarity index 99% rename from dist/assets/bundler-H_464dRi.js rename to dist/assets/bundler-IMYm8BQv.js index a671f61d..cc1131b2 100644 --- a/dist/assets/bundler-H_464dRi.js +++ b/dist/assets/bundler-IMYm8BQv.js @@ -1,4 +1,4 @@ -import{En as e,On as t,jn as n}from"./index-CcPm2yTY.js";var r=class{constructor(){this.encoder=new TextEncoder,this._pieces=[],this._parts=[]}append_buffer(e){this.flush(),this._parts.push(e)}append(e){this._pieces.push(e)}flush(){if(this._pieces.length>0){let e=new Uint8Array(this._pieces);this._parts.push(e),this._pieces=[]}}toArrayBuffer(){let e=[];for(let t of this._parts)e.push(t);return i(e).buffer}};function i(e){let t=0;for(let n of e)t+=n.byteLength;let n=new Uint8Array(t),r=0;for(let t of e){let e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);n.set(e,r),r+=t.byteLength}return n}function a(e){return new s(e).unpack()}function o(e){let t=new c,n=t.pack(e);return n instanceof Promise?n.then(()=>t.getBuffer()):t.getBuffer()}var s=class{constructor(e){this.index=0,this.dataBuffer=e,this.dataView=new Uint8Array(this.dataBuffer),this.length=this.dataBuffer.byteLength}unpack(){let e=this.unpack_uint8();if(e<128)return e;if((e^224)<32)return(e^224)-32;let t;if((t=e^160)<=15)return this.unpack_raw(t);if((t=e^176)<=15)return this.unpack_string(t);if((t=e^144)<=15)return this.unpack_array(t);if((t=e^128)<=15)return this.unpack_map(t);switch(e){case 192:return null;case 193:return;case 194:return!1;case 195:return!0;case 202:return this.unpack_float();case 203:return this.unpack_double();case 204:return this.unpack_uint8();case 205:return this.unpack_uint16();case 206:return this.unpack_uint32();case 207:return this.unpack_uint64();case 208:return this.unpack_int8();case 209:return this.unpack_int16();case 210:return this.unpack_int32();case 211:return this.unpack_int64();case 212:return;case 213:return;case 214:return;case 215:return;case 216:return t=this.unpack_uint16(),this.unpack_string(t);case 217:return t=this.unpack_uint32(),this.unpack_string(t);case 218:return t=this.unpack_uint16(),this.unpack_raw(t);case 219:return t=this.unpack_uint32(),this.unpack_raw(t);case 220:return t=this.unpack_uint16(),this.unpack_array(t);case 221:return t=this.unpack_uint32(),this.unpack_array(t);case 222:return t=this.unpack_uint16(),this.unpack_map(t);case 223:return t=this.unpack_uint32(),this.unpack_map(t)}}unpack_uint8(){let e=this.dataView[this.index]&255;return this.index++,e}unpack_uint16(){let e=this.read(2),t=(e[0]&255)*256+(e[1]&255);return this.index+=2,t}unpack_uint32(){let e=this.read(4),t=((e[0]*256+e[1])*256+e[2])*256+e[3];return this.index+=4,t}unpack_uint64(){let e=this.read(8),t=((((((e[0]*256+e[1])*256+e[2])*256+e[3])*256+e[4])*256+e[5])*256+e[6])*256+e[7];return this.index+=8,t}unpack_int8(){let e=this.unpack_uint8();return e<128?e:e-256}unpack_int16(){let e=this.unpack_uint16();return e<32768?e:e-65536}unpack_int32(){let e=this.unpack_uint32();return e<2**31?e:e-2**32}unpack_int64(){let e=this.unpack_uint64();return e<2**63?e:e-2**64}unpack_raw(e){if(this.length>31,n=(e>>23&255)-127,r=e&8388607|8388608;return(t===0?1:-1)*r*2**(n-23)}unpack_double(){let e=this.unpack_uint32(),t=this.unpack_uint32(),n=e>>31,r=(e>>20&2047)-1023,i=(e&1048575|1048576)*2**(r-20)+t*2**(r-52);return(n===0?1:-1)*i}read(e){let t=this.index;if(t+e<=this.length)return this.dataView.subarray(t,t+e);throw Error(`BinaryPackFailure: read index out of range`)}},c=class{getBuffer(){return this._bufferBuilder.toArrayBuffer()}pack(e){if(typeof e==`string`)this.pack_string(e);else if(typeof e==`number`)Math.floor(e)===e?this.pack_integer(e):this.pack_double(e);else if(typeof e==`boolean`)e===!0?this._bufferBuilder.append(195):e===!1&&this._bufferBuilder.append(194);else if(e===void 0)this._bufferBuilder.append(192);else if(typeof e==`object`)if(e===null)this._bufferBuilder.append(192);else{let t=e.constructor;if(e instanceof Array){let t=this.pack_array(e);if(t instanceof Promise)return t.then(()=>this._bufferBuilder.flush())}else if(e instanceof ArrayBuffer)this.pack_bin(new Uint8Array(e));else if(`BYTES_PER_ELEMENT`in e){let t=e;this.pack_bin(new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}else if(e instanceof Date)this.pack_string(e.toString());else if(e instanceof Blob)return e.arrayBuffer().then(e=>{this.pack_bin(new Uint8Array(e)),this._bufferBuilder.flush()});else if(t==Object||t.toString().startsWith(`class`)){let t=this.pack_object(e);if(t instanceof Promise)return t.then(()=>this._bufferBuilder.flush())}else throw Error(`Type "${t.toString()}" not yet supported`)}else throw Error(`Type "${typeof e}" not yet supported`);this._bufferBuilder.flush()}pack_bin(e){let t=e.length;if(t<=15)this.pack_uint8(160+t);else if(t<=65535)this._bufferBuilder.append(218),this.pack_uint16(t);else if(t<=4294967295)this._bufferBuilder.append(219),this.pack_uint32(t);else throw Error(`Invalid length`);this._bufferBuilder.append_buffer(e)}pack_string(e){let t=this._textEncoder.encode(e),n=t.length;if(n<=15)this.pack_uint8(176+n);else if(n<=65535)this._bufferBuilder.append(216),this.pack_uint16(n);else if(n<=4294967295)this._bufferBuilder.append(217),this.pack_uint32(n);else throw Error(`Invalid length`);this._bufferBuilder.append_buffer(t)}pack_array(e){let t=e.length;if(t<=15)this.pack_uint8(144+t);else if(t<=65535)this._bufferBuilder.append(220),this.pack_uint16(t);else if(t<=4294967295)this._bufferBuilder.append(221),this.pack_uint32(t);else throw Error(`Invalid length`);let n=r=>{if(rn(r+1)):n(r+1)}};return n(0)}pack_integer(e){if(e>=-32&&e<=127)this._bufferBuilder.append(e&255);else if(e>=0&&e<=255)this._bufferBuilder.append(204),this.pack_uint8(e);else if(e>=-128&&e<=127)this._bufferBuilder.append(208),this.pack_int8(e);else if(e>=0&&e<=65535)this._bufferBuilder.append(205),this.pack_uint16(e);else if(e>=-32768&&e<=32767)this._bufferBuilder.append(209),this.pack_int16(e);else if(e>=0&&e<=4294967295)this._bufferBuilder.append(206),this.pack_uint32(e);else if(e>=-2147483648&&e<=2147483647)this._bufferBuilder.append(210),this.pack_int32(e);else if(e>=-0x8000000000000000&&e<=0x8000000000000000)this._bufferBuilder.append(211),this.pack_int64(e);else if(e>=0&&e<=0x10000000000000000)this._bufferBuilder.append(207),this.pack_uint64(e);else throw Error(`Invalid integer`)}pack_double(e){let t=0;e<0&&(t=1,e=-e);let n=Math.floor(Math.log(e)/Math.LN2),r=e/2**n-1,i=Math.floor(r*2**52),a=2**32,o=t<<31|n+1023<<20|i/a&1048575,s=i%a;this._bufferBuilder.append(203),this.pack_int32(o),this.pack_int32(s)}pack_object(e){let t=Object.keys(e),n=t.length;if(n<=15)this.pack_uint8(128+n);else if(n<=65535)this._bufferBuilder.append(222),this.pack_uint16(n);else if(n<=4294967295)this._bufferBuilder.append(223),this.pack_uint32(n);else throw Error(`Invalid length`);let r=n=>{if(nr(n+1))}return r(n+1)}};return r(0)}pack_uint8(e){this._bufferBuilder.append(e)}pack_uint16(e){this._bufferBuilder.append(e>>8),this._bufferBuilder.append(e&255)}pack_uint32(e){let t=e&4294967295;this._bufferBuilder.append((t&4278190080)>>>24),this._bufferBuilder.append((t&16711680)>>>16),this._bufferBuilder.append((t&65280)>>>8),this._bufferBuilder.append(t&255)}pack_uint64(e){let t=e/2**32,n=e%2**32;this._bufferBuilder.append((t&4278190080)>>>24),this._bufferBuilder.append((t&16711680)>>>16),this._bufferBuilder.append((t&65280)>>>8),this._bufferBuilder.append(t&255),this._bufferBuilder.append((n&4278190080)>>>24),this._bufferBuilder.append((n&16711680)>>>16),this._bufferBuilder.append((n&65280)>>>8),this._bufferBuilder.append(n&255)}pack_int8(e){this._bufferBuilder.append(e&255)}pack_int16(e){this._bufferBuilder.append((e&65280)>>8),this._bufferBuilder.append(e&255)}pack_int32(e){this._bufferBuilder.append(e>>>24&255),this._bufferBuilder.append((e&16711680)>>>16),this._bufferBuilder.append((e&65280)>>>8),this._bufferBuilder.append(e&255)}pack_int64(e){let t=Math.floor(e/2**32),n=e%2**32;this._bufferBuilder.append((t&4278190080)>>>24),this._bufferBuilder.append((t&16711680)>>>16),this._bufferBuilder.append((t&65280)>>>8),this._bufferBuilder.append(t&255),this._bufferBuilder.append((n&4278190080)>>>24),this._bufferBuilder.append((n&16711680)>>>16),this._bufferBuilder.append((n&65280)>>>8),this._bufferBuilder.append(n&255)}constructor(){this._bufferBuilder=new r,this._textEncoder=new TextEncoder}},l=!0,u=!0;function d(e,t,n){let r=e.match(t);return r&&r.length>=n&&parseFloat(r[n],10)}function f(e,t,n){if(!e.RTCPeerConnection)return;let r=e.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return i.apply(this,arguments);let a=e=>{let t=n(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,a),i.apply(this,[e,a])};let a=r.removeEventListener;r.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t]||!this._eventMap[t].has(n))return a.apply(this,arguments);let r=this._eventMap[t].get(n);return this._eventMap[t].delete(n),this._eventMap[t].size===0&&delete this._eventMap[t],Object.keys(this._eventMap).length===0&&delete this._eventMap,a.apply(this,[e,r])},Object.defineProperty(r,`on`+t,{get(){return this[`_on`+t]},set(e){this[`_on`+t]&&(this.removeEventListener(t,this[`_on`+t]),delete this[`_on`+t]),e&&this.addEventListener(t,this[`_on`+t]=e)},enumerable:!0,configurable:!0})}function p(e){return typeof e==`boolean`?(l=e,e?`adapter.js logging disabled`:`adapter.js logging enabled`):Error(`Argument type: `+typeof e+`. Please use a boolean.`)}function ee(e){return typeof e==`boolean`?(u=!e,`adapter.js deprecation warnings `+(e?`disabled`:`enabled`)):Error(`Argument type: `+typeof e+`. Please use a boolean.`)}function te(){if(typeof window==`object`){if(l)return;typeof console<`u`&&typeof console.log==`function`&&console.log.apply(console,arguments)}}function m(e,t){u&&console.warn(e+` is deprecated, please use `+t+` instead.`)}function ne(e){let t={browser:null,version:null};if(e===void 0||!e.navigator||!e.navigator.userAgent)return t.browser=`Not a browser.`,t;let{navigator:n}=e;if(n.userAgentData&&n.userAgentData.brands){let e=n.userAgentData.brands.find(e=>e.brand===`Chromium`);if(e)return{browser:`chrome`,version:parseInt(e.version,10)}}if(n.mozGetUserMedia)t.browser=`firefox`,t.version=parseInt(d(n.userAgent,/Firefox\/(\d+)\./,1));else if(n.webkitGetUserMedia||e.isSecureContext===!1&&e.webkitRTCPeerConnection)t.browser=`chrome`,t.version=parseInt(d(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2));else if(e.RTCPeerConnection&&n.userAgent.match(/AppleWebKit\/(\d+)\./))t.browser=`safari`,t.version=parseInt(d(n.userAgent,/AppleWebKit\/(\d+)\./,1)),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&`currentDirection`in e.RTCRtpTransceiver.prototype,t._safariVersion=d(n.userAgent,/Version\/(\d+(\.?\d+))/,1);else return t.browser=`Not a supported browser.`,t;return t}function re(e){return Object.prototype.toString.call(e)===`[object Object]`}function ie(e){return re(e)?Object.keys(e).reduce(function(t,n){let r=re(e[n]),i=r?ie(e[n]):e[n],a=r&&!Object.keys(i).length;return i===void 0||a?t:Object.assign(t,{[n]:i})},{}):e}function ae(e,t,n){!t||n.has(t.id)||(n.set(t.id,t),Object.keys(t).forEach(r=>{r.endsWith(`Id`)?ae(e,e.get(t[r]),n):r.endsWith(`Ids`)&&t[r].forEach(t=>{ae(e,e.get(t),n)})}))}function oe(e,t,n){let r=n?`outbound-rtp`:`inbound-rtp`,i=new Map;if(t===null)return i;let a=[];return e.forEach(e=>{e.type===`track`&&e.trackIdentifier===t.id&&a.push(e)}),a.forEach(t=>{e.forEach(n=>{n.type===r&&n.trackId===t.id&&ae(e,n,i)})}),i}var se=te;function ce(e,t){let n=e&&e.navigator;if(!n.mediaDevices)return;let r=function(e){if(typeof e!=`object`||e.mandatory||e.optional)return e;let t={};return Object.keys(e).forEach(n=>{if(n===`require`||n===`advanced`||n===`mediaSource`)return;let r=typeof e[n]==`object`?e[n]:{ideal:e[n]};r.exact!==void 0&&typeof r.exact==`number`&&(r.min=r.max=r.exact);let i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):t===`deviceId`?`sourceId`:t};if(r.ideal!==void 0){t.optional=t.optional||[];let e={};typeof r.ideal==`number`?(e[i(`min`,n)]=r.ideal,t.optional.push(e),e={},e[i(`max`,n)]=r.ideal,t.optional.push(e)):(e[i(``,n)]=r.ideal,t.optional.push(e))}r.exact!==void 0&&typeof r.exact!=`number`?(t.mandatory=t.mandatory||{},t.mandatory[i(``,n)]=r.exact):[`min`,`max`].forEach(e=>{r[e]!==void 0&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])})}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if(e=JSON.parse(JSON.stringify(e)),e&&typeof e.audio==`object`){let t=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};e=JSON.parse(JSON.stringify(e)),t(e.audio,`autoGainControl`,`googAutoGainControl`),t(e.audio,`noiseSuppression`,`googNoiseSuppression`),e.audio=r(e.audio)}if(e&&typeof e.video==`object`){let a=e.video.facingMode;a&&=typeof a==`object`?a:{ideal:a};let o=t.version<66;if(a&&(a.exact===`user`||a.exact===`environment`||a.ideal===`user`||a.ideal===`environment`)&&!(n.mediaDevices.getSupportedConstraints&&n.mediaDevices.getSupportedConstraints().facingMode&&!o)){delete e.video.facingMode;let t;if(a.exact===`environment`||a.ideal===`environment`?t=[`back`,`rear`]:(a.exact===`user`||a.ideal===`user`)&&(t=[`front`]),t)return n.mediaDevices.enumerateDevices().then(n=>{n=n.filter(e=>e.kind===`videoinput`);let o=n.find(e=>t.some(t=>e.label.toLowerCase().includes(t)));return!o&&n.length&&t.includes(`back`)&&(o=n[n.length-1]),o&&(e.video.deviceId=a.exact?{exact:o.deviceId}:{ideal:o.deviceId}),e.video=r(e.video),se(`chrome: `+JSON.stringify(e)),i(e)})}e.video=r(e.video)}return se(`chrome: `+JSON.stringify(e)),i(e)},a=function(e){return t.version>=64?e:{name:{PermissionDeniedError:`NotAllowedError`,PermissionDismissedError:`NotAllowedError`,InvalidStateError:`NotAllowedError`,DevicesNotFoundError:`NotFoundError`,ConstraintNotSatisfiedError:`OverconstrainedError`,TrackStartError:`NotReadableError`,MediaDeviceFailedDueToShutdown:`NotAllowedError`,MediaDeviceKillSwitchOn:`NotAllowedError`,TabCaptureError:`AbortError`,ScreenCaptureError:`AbortError`,DeviceCaptureError:`AbortError`}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&`: `)+this.message}}};if(n.getUserMedia=function(e,t,r){i(e,e=>{n.webkitGetUserMedia(e,t,e=>{r&&r(a(e))})})}.bind(n),n.mediaDevices.getUserMedia){let e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(t){return i(t,t=>e(t).then(e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach(e=>{e.stop()}),new DOMException(``,`NotFoundError`);return e},e=>Promise.reject(a(e))))}}}var le=t({fixNegotiationNeeded:()=>_e,shimAddTrackRemoveTrack:()=>he,shimAddTrackRemoveTrackWithNative:()=>me,shimGetSendersWithDtmf:()=>fe,shimGetUserMedia:()=>ce,shimMediaStream:()=>ue,shimOnTrack:()=>de,shimPeerConnection:()=>ge,shimSenderReceiverGetStats:()=>pe});function ue(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function de(e){if(typeof e==`object`&&e.RTCPeerConnection&&!(`ontrack`in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,`ontrack`,{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener(`track`,this._ontrack),this.addEventListener(`track`,this._ontrack=e)},enumerable:!0,configurable:!0});let t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener(`addtrack`,n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.track.id):{track:n.track};let i=new Event(`track`);i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)}),t.stream.getTracks().forEach(n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.id):{track:n};let i=new Event(`track`);i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)})},this.addEventListener(`addstream`,this._ontrackpoly)),t.apply(this,arguments)}}else f(e,`track`,e=>(e.transceiver||Object.defineProperty(e,`transceiver`,{value:{receiver:e.receiver}}),e))}function fe(e){if(typeof e==`object`&&e.RTCPeerConnection&&!(`getSenders`in e.RTCPeerConnection.prototype)&&`createDTMFSender`in e.RTCPeerConnection.prototype){let t=function(e,t){return{track:t,get dtmf(){return this._dtmf===void 0&&(t.kind===`audio`?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};let n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){let i=n.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};let r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);let t=this._senders.indexOf(e);t!==-1&&this._senders.splice(t,1)}}let n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach(e=>{this._senders.push(t(this,e))})};let r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach(e=>{let t=this._senders.find(t=>t.track===e);t&&this._senders.splice(this._senders.indexOf(t),1)})}}else if(typeof e==`object`&&e.RTCPeerConnection&&`getSenders`in e.RTCPeerConnection.prototype&&`createDTMFSender`in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!(`dtmf`in e.RTCRtpSender.prototype)){let t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e},Object.defineProperty(e.RTCRtpSender.prototype,`dtmf`,{get(){return this._dtmf===void 0&&(this.track.kind===`audio`?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function pe(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!(`getStats`in e.RTCRtpSender.prototype)){let t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});let n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){let e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){let e=this;return this._pc.getStats().then(t=>oe(t,e.track,!0))}}if(!(`getStats`in e.RTCRtpReceiver.prototype)){let t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),f(e,`track`,e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){let e=this;return this._pc.getStats().then(t=>oe(t,e.track,!1))}}if(!(`getStats`in e.RTCRtpSender.prototype&&`getStats`in e.RTCRtpReceiver.prototype))return;let t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){let e=arguments[0],t,n,r;return this.getSenders().forEach(n=>{n.track===e&&(t?r=!0:t=n)}),this.getReceivers().forEach(t=>(t.track===e&&(n?r=!0:n=t),t.track===e)),r||t&&n?Promise.reject(new DOMException(`There are more than one sender or receiver for the track.`,`InvalidAccessError`)):t?t.getStats():n?n.getStats():Promise.reject(new DOMException(`There is no sender or receiver for the track.`,`InvalidAccessError`))}return t.apply(this,arguments)}}function me(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(e=>this._shimmedLocalStreams[e][0])};let t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};let r=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?this._shimmedLocalStreams[n.id].indexOf(r)===-1&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};let n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException(`Track already exists.`,`InvalidAccessError`)});let t=this.getSenders();n.apply(this,arguments);let r=this.getSenders().filter(e=>t.indexOf(e)===-1);this._shimmedLocalStreams[e.id]=[e].concat(r)};let r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};let i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(t=>{let n=this._shimmedLocalStreams[t].indexOf(e);n!==-1&&this._shimmedLocalStreams[t].splice(n,1),this._shimmedLocalStreams[t].length===1&&delete this._shimmedLocalStreams[t]}),i.apply(this,arguments)}}function he(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return me(e);let n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){let e=n.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map(e=>this._reverseStreams[e.id])};let r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException(`Track already exists.`,`InvalidAccessError`)}),!this._reverseStreams[t.id]){let n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};let i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,n){if(this.signalingState===`closed`)throw new DOMException(`The RTCPeerConnection's signalingState is 'closed'.`,`InvalidStateError`);let r=[].slice.call(arguments,1);if(r.length!==1||!r[0].getTracks().find(e=>e===t))throw new DOMException(`The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.`,`NotSupportedError`);if(this.getSenders().find(e=>e.track===t))throw new DOMException(`Track already exists.`,`InvalidAccessError`);this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};let i=this._streams[n.id];if(i)i.addTrack(t),Promise.resolve().then(()=>{this.dispatchEvent(new Event(`negotiationneeded`))});else{let r=new e.MediaStream([t]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find(e=>e.track===t)};function a(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{let r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(i.id,`g`),r.id)}),new RTCSessionDescription({type:t.type,sdp:n})}function o(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{let r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(r.id,`g`),i.id)}),new RTCSessionDescription({type:t.type,sdp:n})}[`createOffer`,`createAnswer`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){let e=arguments;return arguments.length&&typeof arguments[0]==`function`?n.apply(this,[t=>{let n=a(this,t);e[0].apply(null,[n])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):n.apply(this,arguments).then(e=>a(this,e))}};e.RTCPeerConnection.prototype[t]=r[t]});let s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type||(arguments[0]=o(this,arguments[0])),s.apply(this,arguments)};let c=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,`localDescription`);Object.defineProperty(e.RTCPeerConnection.prototype,`localDescription`,{get(){let e=c.get.apply(this);return e.type===``?e:a(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if(this.signalingState===`closed`)throw new DOMException(`The RTCPeerConnection's signalingState is 'closed'.`,`InvalidStateError`);if(!e._pc)throw new DOMException(`Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.`,`TypeError`);if(e._pc!==this)throw new DOMException(`Sender was not created by this connection.`,`InvalidAccessError`);this._streams=this._streams||{};let t;Object.keys(this._streams).forEach(n=>{this._streams[n].getTracks().find(t=>e.track===t)&&(t=this._streams[n])}),t&&(t.getTracks().length===1?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event(`negotiationneeded`)))}}function ge(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&[`setLocalDescription`,`setRemoteDescription`,`addIceCandidate`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new(t===`addIceCandidate`?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]})}function _e(e,t){f(e,`negotiationneeded`,e=>{let n=e.target;if(!((t.version<72||n.getConfiguration&&n.getConfiguration().sdpSemantics===`plan-b`)&&n.signalingState!==`stable`))return e})}function ve(e,t){let n=e&&e.navigator,r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){m(`navigator.getUserMedia`,`navigator.mediaDevices.getUserMedia`),n.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&`autoGainControl`in n.mediaDevices.getSupportedConstraints())){let e=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return typeof n==`object`&&typeof n.audio==`object`&&(n=JSON.parse(JSON.stringify(n)),e(n.audio,`autoGainControl`,`mozAutoGainControl`),e(n.audio,`noiseSuppression`,`mozNoiseSuppression`)),t(n)},r&&r.prototype.getSettings){let t=r.prototype.getSettings;r.prototype.getSettings=function(){let n=t.apply(this,arguments);return e(n,`mozAutoGainControl`,`autoGainControl`),e(n,`mozNoiseSuppression`,`noiseSuppression`),n}}if(r&&r.prototype.applyConstraints){let t=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return this.kind===`audio`&&typeof n==`object`&&(n=JSON.parse(JSON.stringify(n)),e(n,`autoGainControl`,`mozAutoGainControl`),e(n,`noiseSuppression`,`mozNoiseSuppression`)),t.apply(this,[n])}}}}function ye(e,t){e.navigator.mediaDevices&&`getDisplayMedia`in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!(n&&n.video)){let e=new DOMException(`getDisplayMedia without video constraints is undefined`);return e.name=`NotFoundError`,e.code=8,Promise.reject(e)}return n.video===!0?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)})}var be=t({shimAddTransceiver:()=>Ee,shimCreateAnswer:()=>ke,shimCreateOffer:()=>Oe,shimGetDisplayMedia:()=>ye,shimGetParameters:()=>De,shimGetUserMedia:()=>ve,shimOnTrack:()=>xe,shimPeerConnection:()=>h,shimRTCDataChannel:()=>Te,shimReceiverGetStats:()=>Ce,shimRemoveStream:()=>we,shimSenderGetStats:()=>Se});function xe(e){typeof e==`object`&&e.RTCTrackEvent&&`receiver`in e.RTCTrackEvent.prototype&&!(`transceiver`in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,`transceiver`,{get(){return{receiver:this.receiver}}})}function h(e,t){if(typeof e!=`object`||!(e.RTCPeerConnection||e.mozRTCPeerConnection))return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&[`setLocalDescription`,`setRemoteDescription`,`addIceCandidate`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new(t===`addIceCandidate`?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]});let n={inboundrtp:`inbound-rtp`,outboundrtp:`outbound-rtp`,candidatepair:`candidate-pair`,localcandidate:`local-candidate`,remotecandidate:`remote-candidate`},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){let[e,i,a]=arguments;return r.apply(this,[e||null]).then(e=>{if(t.version<53&&!i)try{e.forEach(e=>{e.type=n[e.type]||e.type})}catch(t){if(t.name!==`TypeError`)throw t;e.forEach((t,r)=>{e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))})}return e}).then(i,a)}}function Se(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&`getStats`in e.RTCRtpSender.prototype)return;let t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});let n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){let e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function Ce(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&`getStats`in e.RTCRtpReceiver.prototype)return;let t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),f(e,`track`,e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function we(e){!e.RTCPeerConnection||`removeStream`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){m(`removeStream`,`removeTrack`),this.getSenders().forEach(t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)})})}function Te(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function Ee(e){if(!(typeof e==`object`&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;e===void 0&&(e=[]),e=[...e];let n=e.length>0;n&&e.forEach(e=>{if(`rid`in e&&!/^[a-z0-9]{0,16}$/i.test(e.rid))throw TypeError(`Invalid RID value provided.`);if(`scaleResolutionDownBy`in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw RangeError(`scale_resolution_down_by must be >= 1.0`);if(`maxFramerate`in e&&!(parseFloat(e.maxFramerate)>=0))throw RangeError(`max_framerate must be >= 0.0`)});let r=t.apply(this,arguments);if(n){let{sender:t}=r,n=t.getParameters();(!(`encodings`in n)||n.encodings.length===1&&Object.keys(n.encodings[0]).length===0)&&(n.encodings=e,t.sendEncodings=e,this.setParametersPromises.push(t.setParameters(n).then(()=>{delete t.sendEncodings}).catch(()=>{delete t.sendEncodings})))}return r})}function De(e){if(!(typeof e==`object`&&e.RTCRtpSender))return;let t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){let e=t.apply(this,arguments);return`encodings`in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function Oe(e){if(!(typeof e==`object`&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function ke(e){if(!(typeof e==`object`&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}var Ae=t({shimAudioContext:()=>ze,shimCallbacksAPI:()=>Ne,shimConstraints:()=>Fe,shimCreateOfferLegacy:()=>Re,shimGetUserMedia:()=>Pe,shimLocalStreamsAPI:()=>je,shimRTCIceServerUrls:()=>Ie,shimRemoteStreamsAPI:()=>Me,shimTrackEventTransceiver:()=>Le});function je(e){if(!(typeof e!=`object`||!e.RTCPeerConnection)){if(`getLocalStreams`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||=[],this._localStreams}),!(`addStream`in e.RTCPeerConnection.prototype)){let t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||=[],this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(n=>t.call(this,n,e)),e.getVideoTracks().forEach(n=>t.call(this,n,e))},e.RTCPeerConnection.prototype.addTrack=function(e,...n){return n&&n.forEach(e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]}),t.apply(this,arguments)}}`removeStream`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||=[];let t=this._localStreams.indexOf(e);if(t===-1)return;this._localStreams.splice(t,1);let n=e.getTracks();this.getSenders().forEach(e=>{n.includes(e.track)&&this.removeTrack(e)})})}}function Me(e){if(!(typeof e!=`object`||!e.RTCPeerConnection)&&(`getRemoteStreams`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!(`onaddstream`in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,`onaddstream`,{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener(`addstream`,this._onaddstream),this.removeEventListener(`track`,this._onaddstreampoly)),this.addEventListener(`addstream`,this._onaddstream=e),this.addEventListener(`track`,this._onaddstreampoly=e=>{e.streams.forEach(e=>{if(this._remoteStreams||=[],this._remoteStreams.includes(e))return;this._remoteStreams.push(e);let t=new Event(`addstream`);t.stream=e,this.dispatchEvent(t)})})}});let t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){let e=this;return this._onaddstreampoly||this.addEventListener(`track`,this._onaddstreampoly=function(t){t.streams.forEach(t=>{if(e._remoteStreams||=[],e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);let n=new Event(`addstream`);n.stream=t,e.dispatchEvent(n)})}),t.apply(e,arguments)}}}function Ne(e){if(typeof e!=`object`||!e.RTCPeerConnection)return;let t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,a=t.setRemoteDescription,o=t.addIceCandidate;t.createOffer=function(e,t){let r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){let n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};let s=function(e,t,n){let r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=s,s=function(e,t,n){let r=a.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=s,s=function(e,t,n){let r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=s}function Pe(e){let t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){let e=t.mediaDevices,n=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>n(Fe(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t))}function Fe(e){return e&&e.video!==void 0?Object.assign({},e,{video:ie(e.video)}):e}function Ie(e){if(!e.RTCPeerConnection)return;let t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){let t=[];for(let n=0;ne.receiver.track.kind===`audio`);e.offerToReceiveAudio===!1&&t?t.direction===`sendrecv`?t.setDirection?t.setDirection(`sendonly`):t.direction=`sendonly`:t.direction===`recvonly`&&(t.setDirection?t.setDirection(`inactive`):t.direction=`inactive`):e.offerToReceiveAudio===!0&&!t&&this.addTransceiver(`audio`,{direction:`recvonly`}),e.offerToReceiveVideo!==void 0&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);let n=this.getTransceivers().find(e=>e.receiver.track.kind===`video`);e.offerToReceiveVideo===!1&&n?n.direction===`sendrecv`?n.setDirection?n.setDirection(`sendonly`):n.direction=`sendonly`:n.direction===`recvonly`&&(n.setDirection?n.setDirection(`inactive`):n.direction=`inactive`):e.offerToReceiveVideo===!0&&!n&&this.addTransceiver(`video`,{direction:`recvonly`})}return t.apply(this,arguments)}}function ze(e){typeof e!=`object`||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Be=e(((e,t)=>{var n={};n.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},n.localCName=n.generateIdentifier(),n.splitLines=function(e){return e.trim().split(` +import{En as e,On as t,jn as n}from"./index-BWApiWDT.js";var r=class{constructor(){this.encoder=new TextEncoder,this._pieces=[],this._parts=[]}append_buffer(e){this.flush(),this._parts.push(e)}append(e){this._pieces.push(e)}flush(){if(this._pieces.length>0){let e=new Uint8Array(this._pieces);this._parts.push(e),this._pieces=[]}}toArrayBuffer(){let e=[];for(let t of this._parts)e.push(t);return i(e).buffer}};function i(e){let t=0;for(let n of e)t+=n.byteLength;let n=new Uint8Array(t),r=0;for(let t of e){let e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);n.set(e,r),r+=t.byteLength}return n}function a(e){return new s(e).unpack()}function o(e){let t=new c,n=t.pack(e);return n instanceof Promise?n.then(()=>t.getBuffer()):t.getBuffer()}var s=class{constructor(e){this.index=0,this.dataBuffer=e,this.dataView=new Uint8Array(this.dataBuffer),this.length=this.dataBuffer.byteLength}unpack(){let e=this.unpack_uint8();if(e<128)return e;if((e^224)<32)return(e^224)-32;let t;if((t=e^160)<=15)return this.unpack_raw(t);if((t=e^176)<=15)return this.unpack_string(t);if((t=e^144)<=15)return this.unpack_array(t);if((t=e^128)<=15)return this.unpack_map(t);switch(e){case 192:return null;case 193:return;case 194:return!1;case 195:return!0;case 202:return this.unpack_float();case 203:return this.unpack_double();case 204:return this.unpack_uint8();case 205:return this.unpack_uint16();case 206:return this.unpack_uint32();case 207:return this.unpack_uint64();case 208:return this.unpack_int8();case 209:return this.unpack_int16();case 210:return this.unpack_int32();case 211:return this.unpack_int64();case 212:return;case 213:return;case 214:return;case 215:return;case 216:return t=this.unpack_uint16(),this.unpack_string(t);case 217:return t=this.unpack_uint32(),this.unpack_string(t);case 218:return t=this.unpack_uint16(),this.unpack_raw(t);case 219:return t=this.unpack_uint32(),this.unpack_raw(t);case 220:return t=this.unpack_uint16(),this.unpack_array(t);case 221:return t=this.unpack_uint32(),this.unpack_array(t);case 222:return t=this.unpack_uint16(),this.unpack_map(t);case 223:return t=this.unpack_uint32(),this.unpack_map(t)}}unpack_uint8(){let e=this.dataView[this.index]&255;return this.index++,e}unpack_uint16(){let e=this.read(2),t=(e[0]&255)*256+(e[1]&255);return this.index+=2,t}unpack_uint32(){let e=this.read(4),t=((e[0]*256+e[1])*256+e[2])*256+e[3];return this.index+=4,t}unpack_uint64(){let e=this.read(8),t=((((((e[0]*256+e[1])*256+e[2])*256+e[3])*256+e[4])*256+e[5])*256+e[6])*256+e[7];return this.index+=8,t}unpack_int8(){let e=this.unpack_uint8();return e<128?e:e-256}unpack_int16(){let e=this.unpack_uint16();return e<32768?e:e-65536}unpack_int32(){let e=this.unpack_uint32();return e<2**31?e:e-2**32}unpack_int64(){let e=this.unpack_uint64();return e<2**63?e:e-2**64}unpack_raw(e){if(this.length>31,n=(e>>23&255)-127,r=e&8388607|8388608;return(t===0?1:-1)*r*2**(n-23)}unpack_double(){let e=this.unpack_uint32(),t=this.unpack_uint32(),n=e>>31,r=(e>>20&2047)-1023,i=(e&1048575|1048576)*2**(r-20)+t*2**(r-52);return(n===0?1:-1)*i}read(e){let t=this.index;if(t+e<=this.length)return this.dataView.subarray(t,t+e);throw Error(`BinaryPackFailure: read index out of range`)}},c=class{getBuffer(){return this._bufferBuilder.toArrayBuffer()}pack(e){if(typeof e==`string`)this.pack_string(e);else if(typeof e==`number`)Math.floor(e)===e?this.pack_integer(e):this.pack_double(e);else if(typeof e==`boolean`)e===!0?this._bufferBuilder.append(195):e===!1&&this._bufferBuilder.append(194);else if(e===void 0)this._bufferBuilder.append(192);else if(typeof e==`object`)if(e===null)this._bufferBuilder.append(192);else{let t=e.constructor;if(e instanceof Array){let t=this.pack_array(e);if(t instanceof Promise)return t.then(()=>this._bufferBuilder.flush())}else if(e instanceof ArrayBuffer)this.pack_bin(new Uint8Array(e));else if(`BYTES_PER_ELEMENT`in e){let t=e;this.pack_bin(new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}else if(e instanceof Date)this.pack_string(e.toString());else if(e instanceof Blob)return e.arrayBuffer().then(e=>{this.pack_bin(new Uint8Array(e)),this._bufferBuilder.flush()});else if(t==Object||t.toString().startsWith(`class`)){let t=this.pack_object(e);if(t instanceof Promise)return t.then(()=>this._bufferBuilder.flush())}else throw Error(`Type "${t.toString()}" not yet supported`)}else throw Error(`Type "${typeof e}" not yet supported`);this._bufferBuilder.flush()}pack_bin(e){let t=e.length;if(t<=15)this.pack_uint8(160+t);else if(t<=65535)this._bufferBuilder.append(218),this.pack_uint16(t);else if(t<=4294967295)this._bufferBuilder.append(219),this.pack_uint32(t);else throw Error(`Invalid length`);this._bufferBuilder.append_buffer(e)}pack_string(e){let t=this._textEncoder.encode(e),n=t.length;if(n<=15)this.pack_uint8(176+n);else if(n<=65535)this._bufferBuilder.append(216),this.pack_uint16(n);else if(n<=4294967295)this._bufferBuilder.append(217),this.pack_uint32(n);else throw Error(`Invalid length`);this._bufferBuilder.append_buffer(t)}pack_array(e){let t=e.length;if(t<=15)this.pack_uint8(144+t);else if(t<=65535)this._bufferBuilder.append(220),this.pack_uint16(t);else if(t<=4294967295)this._bufferBuilder.append(221),this.pack_uint32(t);else throw Error(`Invalid length`);let n=r=>{if(rn(r+1)):n(r+1)}};return n(0)}pack_integer(e){if(e>=-32&&e<=127)this._bufferBuilder.append(e&255);else if(e>=0&&e<=255)this._bufferBuilder.append(204),this.pack_uint8(e);else if(e>=-128&&e<=127)this._bufferBuilder.append(208),this.pack_int8(e);else if(e>=0&&e<=65535)this._bufferBuilder.append(205),this.pack_uint16(e);else if(e>=-32768&&e<=32767)this._bufferBuilder.append(209),this.pack_int16(e);else if(e>=0&&e<=4294967295)this._bufferBuilder.append(206),this.pack_uint32(e);else if(e>=-2147483648&&e<=2147483647)this._bufferBuilder.append(210),this.pack_int32(e);else if(e>=-0x8000000000000000&&e<=0x8000000000000000)this._bufferBuilder.append(211),this.pack_int64(e);else if(e>=0&&e<=0x10000000000000000)this._bufferBuilder.append(207),this.pack_uint64(e);else throw Error(`Invalid integer`)}pack_double(e){let t=0;e<0&&(t=1,e=-e);let n=Math.floor(Math.log(e)/Math.LN2),r=e/2**n-1,i=Math.floor(r*2**52),a=2**32,o=t<<31|n+1023<<20|i/a&1048575,s=i%a;this._bufferBuilder.append(203),this.pack_int32(o),this.pack_int32(s)}pack_object(e){let t=Object.keys(e),n=t.length;if(n<=15)this.pack_uint8(128+n);else if(n<=65535)this._bufferBuilder.append(222),this.pack_uint16(n);else if(n<=4294967295)this._bufferBuilder.append(223),this.pack_uint32(n);else throw Error(`Invalid length`);let r=n=>{if(nr(n+1))}return r(n+1)}};return r(0)}pack_uint8(e){this._bufferBuilder.append(e)}pack_uint16(e){this._bufferBuilder.append(e>>8),this._bufferBuilder.append(e&255)}pack_uint32(e){let t=e&4294967295;this._bufferBuilder.append((t&4278190080)>>>24),this._bufferBuilder.append((t&16711680)>>>16),this._bufferBuilder.append((t&65280)>>>8),this._bufferBuilder.append(t&255)}pack_uint64(e){let t=e/2**32,n=e%2**32;this._bufferBuilder.append((t&4278190080)>>>24),this._bufferBuilder.append((t&16711680)>>>16),this._bufferBuilder.append((t&65280)>>>8),this._bufferBuilder.append(t&255),this._bufferBuilder.append((n&4278190080)>>>24),this._bufferBuilder.append((n&16711680)>>>16),this._bufferBuilder.append((n&65280)>>>8),this._bufferBuilder.append(n&255)}pack_int8(e){this._bufferBuilder.append(e&255)}pack_int16(e){this._bufferBuilder.append((e&65280)>>8),this._bufferBuilder.append(e&255)}pack_int32(e){this._bufferBuilder.append(e>>>24&255),this._bufferBuilder.append((e&16711680)>>>16),this._bufferBuilder.append((e&65280)>>>8),this._bufferBuilder.append(e&255)}pack_int64(e){let t=Math.floor(e/2**32),n=e%2**32;this._bufferBuilder.append((t&4278190080)>>>24),this._bufferBuilder.append((t&16711680)>>>16),this._bufferBuilder.append((t&65280)>>>8),this._bufferBuilder.append(t&255),this._bufferBuilder.append((n&4278190080)>>>24),this._bufferBuilder.append((n&16711680)>>>16),this._bufferBuilder.append((n&65280)>>>8),this._bufferBuilder.append(n&255)}constructor(){this._bufferBuilder=new r,this._textEncoder=new TextEncoder}},l=!0,u=!0;function d(e,t,n){let r=e.match(t);return r&&r.length>=n&&parseFloat(r[n],10)}function f(e,t,n){if(!e.RTCPeerConnection)return;let r=e.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return i.apply(this,arguments);let a=e=>{let t=n(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,a),i.apply(this,[e,a])};let a=r.removeEventListener;r.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t]||!this._eventMap[t].has(n))return a.apply(this,arguments);let r=this._eventMap[t].get(n);return this._eventMap[t].delete(n),this._eventMap[t].size===0&&delete this._eventMap[t],Object.keys(this._eventMap).length===0&&delete this._eventMap,a.apply(this,[e,r])},Object.defineProperty(r,`on`+t,{get(){return this[`_on`+t]},set(e){this[`_on`+t]&&(this.removeEventListener(t,this[`_on`+t]),delete this[`_on`+t]),e&&this.addEventListener(t,this[`_on`+t]=e)},enumerable:!0,configurable:!0})}function p(e){return typeof e==`boolean`?(l=e,e?`adapter.js logging disabled`:`adapter.js logging enabled`):Error(`Argument type: `+typeof e+`. Please use a boolean.`)}function ee(e){return typeof e==`boolean`?(u=!e,`adapter.js deprecation warnings `+(e?`disabled`:`enabled`)):Error(`Argument type: `+typeof e+`. Please use a boolean.`)}function te(){if(typeof window==`object`){if(l)return;typeof console<`u`&&typeof console.log==`function`&&console.log.apply(console,arguments)}}function m(e,t){u&&console.warn(e+` is deprecated, please use `+t+` instead.`)}function ne(e){let t={browser:null,version:null};if(e===void 0||!e.navigator||!e.navigator.userAgent)return t.browser=`Not a browser.`,t;let{navigator:n}=e;if(n.userAgentData&&n.userAgentData.brands){let e=n.userAgentData.brands.find(e=>e.brand===`Chromium`);if(e)return{browser:`chrome`,version:parseInt(e.version,10)}}if(n.mozGetUserMedia)t.browser=`firefox`,t.version=parseInt(d(n.userAgent,/Firefox\/(\d+)\./,1));else if(n.webkitGetUserMedia||e.isSecureContext===!1&&e.webkitRTCPeerConnection)t.browser=`chrome`,t.version=parseInt(d(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2));else if(e.RTCPeerConnection&&n.userAgent.match(/AppleWebKit\/(\d+)\./))t.browser=`safari`,t.version=parseInt(d(n.userAgent,/AppleWebKit\/(\d+)\./,1)),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&`currentDirection`in e.RTCRtpTransceiver.prototype,t._safariVersion=d(n.userAgent,/Version\/(\d+(\.?\d+))/,1);else return t.browser=`Not a supported browser.`,t;return t}function re(e){return Object.prototype.toString.call(e)===`[object Object]`}function ie(e){return re(e)?Object.keys(e).reduce(function(t,n){let r=re(e[n]),i=r?ie(e[n]):e[n],a=r&&!Object.keys(i).length;return i===void 0||a?t:Object.assign(t,{[n]:i})},{}):e}function ae(e,t,n){!t||n.has(t.id)||(n.set(t.id,t),Object.keys(t).forEach(r=>{r.endsWith(`Id`)?ae(e,e.get(t[r]),n):r.endsWith(`Ids`)&&t[r].forEach(t=>{ae(e,e.get(t),n)})}))}function oe(e,t,n){let r=n?`outbound-rtp`:`inbound-rtp`,i=new Map;if(t===null)return i;let a=[];return e.forEach(e=>{e.type===`track`&&e.trackIdentifier===t.id&&a.push(e)}),a.forEach(t=>{e.forEach(n=>{n.type===r&&n.trackId===t.id&&ae(e,n,i)})}),i}var se=te;function ce(e,t){let n=e&&e.navigator;if(!n.mediaDevices)return;let r=function(e){if(typeof e!=`object`||e.mandatory||e.optional)return e;let t={};return Object.keys(e).forEach(n=>{if(n===`require`||n===`advanced`||n===`mediaSource`)return;let r=typeof e[n]==`object`?e[n]:{ideal:e[n]};r.exact!==void 0&&typeof r.exact==`number`&&(r.min=r.max=r.exact);let i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):t===`deviceId`?`sourceId`:t};if(r.ideal!==void 0){t.optional=t.optional||[];let e={};typeof r.ideal==`number`?(e[i(`min`,n)]=r.ideal,t.optional.push(e),e={},e[i(`max`,n)]=r.ideal,t.optional.push(e)):(e[i(``,n)]=r.ideal,t.optional.push(e))}r.exact!==void 0&&typeof r.exact!=`number`?(t.mandatory=t.mandatory||{},t.mandatory[i(``,n)]=r.exact):[`min`,`max`].forEach(e=>{r[e]!==void 0&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])})}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if(e=JSON.parse(JSON.stringify(e)),e&&typeof e.audio==`object`){let t=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};e=JSON.parse(JSON.stringify(e)),t(e.audio,`autoGainControl`,`googAutoGainControl`),t(e.audio,`noiseSuppression`,`googNoiseSuppression`),e.audio=r(e.audio)}if(e&&typeof e.video==`object`){let a=e.video.facingMode;a&&=typeof a==`object`?a:{ideal:a};let o=t.version<66;if(a&&(a.exact===`user`||a.exact===`environment`||a.ideal===`user`||a.ideal===`environment`)&&!(n.mediaDevices.getSupportedConstraints&&n.mediaDevices.getSupportedConstraints().facingMode&&!o)){delete e.video.facingMode;let t;if(a.exact===`environment`||a.ideal===`environment`?t=[`back`,`rear`]:(a.exact===`user`||a.ideal===`user`)&&(t=[`front`]),t)return n.mediaDevices.enumerateDevices().then(n=>{n=n.filter(e=>e.kind===`videoinput`);let o=n.find(e=>t.some(t=>e.label.toLowerCase().includes(t)));return!o&&n.length&&t.includes(`back`)&&(o=n[n.length-1]),o&&(e.video.deviceId=a.exact?{exact:o.deviceId}:{ideal:o.deviceId}),e.video=r(e.video),se(`chrome: `+JSON.stringify(e)),i(e)})}e.video=r(e.video)}return se(`chrome: `+JSON.stringify(e)),i(e)},a=function(e){return t.version>=64?e:{name:{PermissionDeniedError:`NotAllowedError`,PermissionDismissedError:`NotAllowedError`,InvalidStateError:`NotAllowedError`,DevicesNotFoundError:`NotFoundError`,ConstraintNotSatisfiedError:`OverconstrainedError`,TrackStartError:`NotReadableError`,MediaDeviceFailedDueToShutdown:`NotAllowedError`,MediaDeviceKillSwitchOn:`NotAllowedError`,TabCaptureError:`AbortError`,ScreenCaptureError:`AbortError`,DeviceCaptureError:`AbortError`}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&`: `)+this.message}}};if(n.getUserMedia=function(e,t,r){i(e,e=>{n.webkitGetUserMedia(e,t,e=>{r&&r(a(e))})})}.bind(n),n.mediaDevices.getUserMedia){let e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(t){return i(t,t=>e(t).then(e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach(e=>{e.stop()}),new DOMException(``,`NotFoundError`);return e},e=>Promise.reject(a(e))))}}}var le=t({fixNegotiationNeeded:()=>_e,shimAddTrackRemoveTrack:()=>he,shimAddTrackRemoveTrackWithNative:()=>me,shimGetSendersWithDtmf:()=>fe,shimGetUserMedia:()=>ce,shimMediaStream:()=>ue,shimOnTrack:()=>de,shimPeerConnection:()=>ge,shimSenderReceiverGetStats:()=>pe});function ue(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function de(e){if(typeof e==`object`&&e.RTCPeerConnection&&!(`ontrack`in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,`ontrack`,{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener(`track`,this._ontrack),this.addEventListener(`track`,this._ontrack=e)},enumerable:!0,configurable:!0});let t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener(`addtrack`,n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.track.id):{track:n.track};let i=new Event(`track`);i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)}),t.stream.getTracks().forEach(n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.id):{track:n};let i=new Event(`track`);i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)})},this.addEventListener(`addstream`,this._ontrackpoly)),t.apply(this,arguments)}}else f(e,`track`,e=>(e.transceiver||Object.defineProperty(e,`transceiver`,{value:{receiver:e.receiver}}),e))}function fe(e){if(typeof e==`object`&&e.RTCPeerConnection&&!(`getSenders`in e.RTCPeerConnection.prototype)&&`createDTMFSender`in e.RTCPeerConnection.prototype){let t=function(e,t){return{track:t,get dtmf(){return this._dtmf===void 0&&(t.kind===`audio`?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};let n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){let i=n.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};let r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);let t=this._senders.indexOf(e);t!==-1&&this._senders.splice(t,1)}}let n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach(e=>{this._senders.push(t(this,e))})};let r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach(e=>{let t=this._senders.find(t=>t.track===e);t&&this._senders.splice(this._senders.indexOf(t),1)})}}else if(typeof e==`object`&&e.RTCPeerConnection&&`getSenders`in e.RTCPeerConnection.prototype&&`createDTMFSender`in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!(`dtmf`in e.RTCRtpSender.prototype)){let t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e},Object.defineProperty(e.RTCRtpSender.prototype,`dtmf`,{get(){return this._dtmf===void 0&&(this.track.kind===`audio`?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function pe(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!(`getStats`in e.RTCRtpSender.prototype)){let t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});let n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){let e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){let e=this;return this._pc.getStats().then(t=>oe(t,e.track,!0))}}if(!(`getStats`in e.RTCRtpReceiver.prototype)){let t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),f(e,`track`,e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){let e=this;return this._pc.getStats().then(t=>oe(t,e.track,!1))}}if(!(`getStats`in e.RTCRtpSender.prototype&&`getStats`in e.RTCRtpReceiver.prototype))return;let t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){let e=arguments[0],t,n,r;return this.getSenders().forEach(n=>{n.track===e&&(t?r=!0:t=n)}),this.getReceivers().forEach(t=>(t.track===e&&(n?r=!0:n=t),t.track===e)),r||t&&n?Promise.reject(new DOMException(`There are more than one sender or receiver for the track.`,`InvalidAccessError`)):t?t.getStats():n?n.getStats():Promise.reject(new DOMException(`There is no sender or receiver for the track.`,`InvalidAccessError`))}return t.apply(this,arguments)}}function me(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(e=>this._shimmedLocalStreams[e][0])};let t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};let r=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?this._shimmedLocalStreams[n.id].indexOf(r)===-1&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};let n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException(`Track already exists.`,`InvalidAccessError`)});let t=this.getSenders();n.apply(this,arguments);let r=this.getSenders().filter(e=>t.indexOf(e)===-1);this._shimmedLocalStreams[e.id]=[e].concat(r)};let r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};let i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(t=>{let n=this._shimmedLocalStreams[t].indexOf(e);n!==-1&&this._shimmedLocalStreams[t].splice(n,1),this._shimmedLocalStreams[t].length===1&&delete this._shimmedLocalStreams[t]}),i.apply(this,arguments)}}function he(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return me(e);let n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){let e=n.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map(e=>this._reverseStreams[e.id])};let r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException(`Track already exists.`,`InvalidAccessError`)}),!this._reverseStreams[t.id]){let n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};let i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,n){if(this.signalingState===`closed`)throw new DOMException(`The RTCPeerConnection's signalingState is 'closed'.`,`InvalidStateError`);let r=[].slice.call(arguments,1);if(r.length!==1||!r[0].getTracks().find(e=>e===t))throw new DOMException(`The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.`,`NotSupportedError`);if(this.getSenders().find(e=>e.track===t))throw new DOMException(`Track already exists.`,`InvalidAccessError`);this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};let i=this._streams[n.id];if(i)i.addTrack(t),Promise.resolve().then(()=>{this.dispatchEvent(new Event(`negotiationneeded`))});else{let r=new e.MediaStream([t]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find(e=>e.track===t)};function a(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{let r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(i.id,`g`),r.id)}),new RTCSessionDescription({type:t.type,sdp:n})}function o(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{let r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(r.id,`g`),i.id)}),new RTCSessionDescription({type:t.type,sdp:n})}[`createOffer`,`createAnswer`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){let e=arguments;return arguments.length&&typeof arguments[0]==`function`?n.apply(this,[t=>{let n=a(this,t);e[0].apply(null,[n])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):n.apply(this,arguments).then(e=>a(this,e))}};e.RTCPeerConnection.prototype[t]=r[t]});let s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type||(arguments[0]=o(this,arguments[0])),s.apply(this,arguments)};let c=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,`localDescription`);Object.defineProperty(e.RTCPeerConnection.prototype,`localDescription`,{get(){let e=c.get.apply(this);return e.type===``?e:a(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if(this.signalingState===`closed`)throw new DOMException(`The RTCPeerConnection's signalingState is 'closed'.`,`InvalidStateError`);if(!e._pc)throw new DOMException(`Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.`,`TypeError`);if(e._pc!==this)throw new DOMException(`Sender was not created by this connection.`,`InvalidAccessError`);this._streams=this._streams||{};let t;Object.keys(this._streams).forEach(n=>{this._streams[n].getTracks().find(t=>e.track===t)&&(t=this._streams[n])}),t&&(t.getTracks().length===1?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event(`negotiationneeded`)))}}function ge(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&[`setLocalDescription`,`setRemoteDescription`,`addIceCandidate`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new(t===`addIceCandidate`?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]})}function _e(e,t){f(e,`negotiationneeded`,e=>{let n=e.target;if(!((t.version<72||n.getConfiguration&&n.getConfiguration().sdpSemantics===`plan-b`)&&n.signalingState!==`stable`))return e})}function ve(e,t){let n=e&&e.navigator,r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){m(`navigator.getUserMedia`,`navigator.mediaDevices.getUserMedia`),n.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&`autoGainControl`in n.mediaDevices.getSupportedConstraints())){let e=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return typeof n==`object`&&typeof n.audio==`object`&&(n=JSON.parse(JSON.stringify(n)),e(n.audio,`autoGainControl`,`mozAutoGainControl`),e(n.audio,`noiseSuppression`,`mozNoiseSuppression`)),t(n)},r&&r.prototype.getSettings){let t=r.prototype.getSettings;r.prototype.getSettings=function(){let n=t.apply(this,arguments);return e(n,`mozAutoGainControl`,`autoGainControl`),e(n,`mozNoiseSuppression`,`noiseSuppression`),n}}if(r&&r.prototype.applyConstraints){let t=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return this.kind===`audio`&&typeof n==`object`&&(n=JSON.parse(JSON.stringify(n)),e(n,`autoGainControl`,`mozAutoGainControl`),e(n,`noiseSuppression`,`mozNoiseSuppression`)),t.apply(this,[n])}}}}function ye(e,t){e.navigator.mediaDevices&&`getDisplayMedia`in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!(n&&n.video)){let e=new DOMException(`getDisplayMedia without video constraints is undefined`);return e.name=`NotFoundError`,e.code=8,Promise.reject(e)}return n.video===!0?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)})}var be=t({shimAddTransceiver:()=>Ee,shimCreateAnswer:()=>ke,shimCreateOffer:()=>Oe,shimGetDisplayMedia:()=>ye,shimGetParameters:()=>De,shimGetUserMedia:()=>ve,shimOnTrack:()=>xe,shimPeerConnection:()=>h,shimRTCDataChannel:()=>Te,shimReceiverGetStats:()=>Ce,shimRemoveStream:()=>we,shimSenderGetStats:()=>Se});function xe(e){typeof e==`object`&&e.RTCTrackEvent&&`receiver`in e.RTCTrackEvent.prototype&&!(`transceiver`in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,`transceiver`,{get(){return{receiver:this.receiver}}})}function h(e,t){if(typeof e!=`object`||!(e.RTCPeerConnection||e.mozRTCPeerConnection))return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&[`setLocalDescription`,`setRemoteDescription`,`addIceCandidate`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new(t===`addIceCandidate`?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]});let n={inboundrtp:`inbound-rtp`,outboundrtp:`outbound-rtp`,candidatepair:`candidate-pair`,localcandidate:`local-candidate`,remotecandidate:`remote-candidate`},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){let[e,i,a]=arguments;return r.apply(this,[e||null]).then(e=>{if(t.version<53&&!i)try{e.forEach(e=>{e.type=n[e.type]||e.type})}catch(t){if(t.name!==`TypeError`)throw t;e.forEach((t,r)=>{e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))})}return e}).then(i,a)}}function Se(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&`getStats`in e.RTCRtpSender.prototype)return;let t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});let n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){let e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function Ce(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&`getStats`in e.RTCRtpReceiver.prototype)return;let t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),f(e,`track`,e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function we(e){!e.RTCPeerConnection||`removeStream`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){m(`removeStream`,`removeTrack`),this.getSenders().forEach(t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)})})}function Te(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function Ee(e){if(!(typeof e==`object`&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;e===void 0&&(e=[]),e=[...e];let n=e.length>0;n&&e.forEach(e=>{if(`rid`in e&&!/^[a-z0-9]{0,16}$/i.test(e.rid))throw TypeError(`Invalid RID value provided.`);if(`scaleResolutionDownBy`in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw RangeError(`scale_resolution_down_by must be >= 1.0`);if(`maxFramerate`in e&&!(parseFloat(e.maxFramerate)>=0))throw RangeError(`max_framerate must be >= 0.0`)});let r=t.apply(this,arguments);if(n){let{sender:t}=r,n=t.getParameters();(!(`encodings`in n)||n.encodings.length===1&&Object.keys(n.encodings[0]).length===0)&&(n.encodings=e,t.sendEncodings=e,this.setParametersPromises.push(t.setParameters(n).then(()=>{delete t.sendEncodings}).catch(()=>{delete t.sendEncodings})))}return r})}function De(e){if(!(typeof e==`object`&&e.RTCRtpSender))return;let t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){let e=t.apply(this,arguments);return`encodings`in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function Oe(e){if(!(typeof e==`object`&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function ke(e){if(!(typeof e==`object`&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}var Ae=t({shimAudioContext:()=>ze,shimCallbacksAPI:()=>Ne,shimConstraints:()=>Fe,shimCreateOfferLegacy:()=>Re,shimGetUserMedia:()=>Pe,shimLocalStreamsAPI:()=>je,shimRTCIceServerUrls:()=>Ie,shimRemoteStreamsAPI:()=>Me,shimTrackEventTransceiver:()=>Le});function je(e){if(!(typeof e!=`object`||!e.RTCPeerConnection)){if(`getLocalStreams`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||=[],this._localStreams}),!(`addStream`in e.RTCPeerConnection.prototype)){let t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||=[],this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(n=>t.call(this,n,e)),e.getVideoTracks().forEach(n=>t.call(this,n,e))},e.RTCPeerConnection.prototype.addTrack=function(e,...n){return n&&n.forEach(e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]}),t.apply(this,arguments)}}`removeStream`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||=[];let t=this._localStreams.indexOf(e);if(t===-1)return;this._localStreams.splice(t,1);let n=e.getTracks();this.getSenders().forEach(e=>{n.includes(e.track)&&this.removeTrack(e)})})}}function Me(e){if(!(typeof e!=`object`||!e.RTCPeerConnection)&&(`getRemoteStreams`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!(`onaddstream`in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,`onaddstream`,{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener(`addstream`,this._onaddstream),this.removeEventListener(`track`,this._onaddstreampoly)),this.addEventListener(`addstream`,this._onaddstream=e),this.addEventListener(`track`,this._onaddstreampoly=e=>{e.streams.forEach(e=>{if(this._remoteStreams||=[],this._remoteStreams.includes(e))return;this._remoteStreams.push(e);let t=new Event(`addstream`);t.stream=e,this.dispatchEvent(t)})})}});let t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){let e=this;return this._onaddstreampoly||this.addEventListener(`track`,this._onaddstreampoly=function(t){t.streams.forEach(t=>{if(e._remoteStreams||=[],e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);let n=new Event(`addstream`);n.stream=t,e.dispatchEvent(n)})}),t.apply(e,arguments)}}}function Ne(e){if(typeof e!=`object`||!e.RTCPeerConnection)return;let t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,a=t.setRemoteDescription,o=t.addIceCandidate;t.createOffer=function(e,t){let r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){let n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};let s=function(e,t,n){let r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=s,s=function(e,t,n){let r=a.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=s,s=function(e,t,n){let r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=s}function Pe(e){let t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){let e=t.mediaDevices,n=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>n(Fe(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t))}function Fe(e){return e&&e.video!==void 0?Object.assign({},e,{video:ie(e.video)}):e}function Ie(e){if(!e.RTCPeerConnection)return;let t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){let t=[];for(let n=0;ne.receiver.track.kind===`audio`);e.offerToReceiveAudio===!1&&t?t.direction===`sendrecv`?t.setDirection?t.setDirection(`sendonly`):t.direction=`sendonly`:t.direction===`recvonly`&&(t.setDirection?t.setDirection(`inactive`):t.direction=`inactive`):e.offerToReceiveAudio===!0&&!t&&this.addTransceiver(`audio`,{direction:`recvonly`}),e.offerToReceiveVideo!==void 0&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);let n=this.getTransceivers().find(e=>e.receiver.track.kind===`video`);e.offerToReceiveVideo===!1&&n?n.direction===`sendrecv`?n.setDirection?n.setDirection(`sendonly`):n.direction=`sendonly`:n.direction===`recvonly`&&(n.setDirection?n.setDirection(`inactive`):n.direction=`inactive`):e.offerToReceiveVideo===!0&&!n&&this.addTransceiver(`video`,{direction:`recvonly`})}return t.apply(this,arguments)}}function ze(e){typeof e!=`object`||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Be=e(((e,t)=>{var n={};n.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},n.localCName=n.generateIdentifier(),n.splitLines=function(e){return e.trim().split(` `).map(e=>e.trim())},n.splitSections=function(e){return e.split(` m=`).map((e,t)=>(t>0?`m=`+e:e).trim()+`\r `)},n.getDescription=function(e){let t=n.splitSections(e);return t&&t[0]},n.getMediaSections=function(e){let t=n.splitSections(e);return t.shift(),t},n.matchPrefix=function(e,t){return n.splitLines(e).filter(e=>e.indexOf(t)===0)},n.parseCandidate=function(e){let t;t=e.indexOf(`a=candidate:`)===0?e.substring(12).split(` `):e.substring(10).split(` `);let n={foundation:t[0],component:{1:`rtp`,2:`rtcp`}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let e=8;e{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self,n.html2canvas=r())})(e,(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}var n=function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&a[a.length-1]))&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]=55296&&i<=56319&&n>10)+55296,a%1024+56320)),(r+1===t||n.length>16384)&&(i+=String.fromCharCode.apply(String,n),n.length=0)}return i},d=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,f=typeof Uint8Array>`u`?[]:new Uint8Array(256),p=0;p`u`?[]:new Uint8Array(256),g=0;g>4,u[i++]=(o&15)<<4|s>>2,u[i++]=(s&3)<<6|c&63;return l},v=function(e){for(var t=e.length,n=[],r=0;r>b,T=(1<>b)+32,D=65536>>x,O=(1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>b],t=(t<>b)],t=(t<>x),t=this.index[t],t+=e>>b&O,t=this.index[t],t=(t<`u`?[]:new Uint8Array(256),oe=0;oece?(i.push(!0),o-=ce):i.push(!1),[`normal`,`auto`,`loose`].indexOf(t)!==-1&&[8208,8211,12316,12448].indexOf(e)!==-1)return r.push(a),n.push(Ce);if(o===fe||o===ve){if(a===0)return r.push(a),n.push(Ie);var s=n[a-1];return rt.indexOf(s)===-1?(r.push(r[a-1]),n.push(s)):(r.push(a),n.push(Ie))}if(r.push(a),o===Le)return n.push(t===`strict`?Oe:Ue);if(o===Je||o===Fe)return n.push(Ie);if(o===Ye)return e>=131072&&e<=196605||e>=196608&&e<=262141?n.push(Ue):n.push(Ie);n.push(o)}),[r,n,i]},st=function(e,t,n,r){var i=r[n];if(Array.isArray(e)?e.indexOf(i)!==-1:e===i)for(var a=n;a<=r.length;){a++;var o=r[a];if(o===t)return!0;if(o!==_e)break}if(i===_e)for(var a=n;a>0;){a--;var s=r[a];if(Array.isArray(e)?e.indexOf(s)!==-1:e===s)for(var c=n;c<=r.length;){c++;var o=r[c];if(o===t)return!0;if(o!==_e)break}if(s!==_e)break}return!1},ct=function(e,t){for(var n=e;n>=0;){var r=t[n];if(r===_e)n--;else return r}return 0},lt=function(e,t,n,r,i){if(n[r]===0)return A;var a=r-1;if(Array.isArray(i)&&i[a]===!0)return A;var o=a-1,s=a+1,c=t[a],l=o>=0?t[o]:0,u=t[s];if(c===ue&&u===de)return A;if(et.indexOf(c)!==-1)return Ze;if(et.indexOf(u)!==-1||tt.indexOf(u)!==-1)return A;if(ct(a,t)===he)return Qe;if($e.get(e[a])===ve||(c===Re||c===ze)&&$e.get(e[s])===ve||c===me||u===me||c===ge||[_e,be,Se].indexOf(c)===-1&&u===ge||[we,Te,Ee,je,Pe].indexOf(u)!==-1||ct(a,t)===ke||st(Ae,ke,a,t)||st([we,Te],Oe,a,t)||st(ye,ye,a,t))return A;if(c===_e)return Qe;if(c===Ae||u===Ae)return A;if(u===Ce||c===Ce)return Qe;if([be,Se,Oe].indexOf(u)!==-1||c===xe||l===He&&at.indexOf(c)!==-1||c===Pe&&u===He||u===De||j.indexOf(u)!==-1&&c===k||j.indexOf(c)!==-1&&u===k||c===Ne&&[Ue,Re,ze].indexOf(u)!==-1||[Ue,Re,ze].indexOf(c)!==-1&&u===Me||j.indexOf(c)!==-1&&nt.indexOf(u)!==-1||nt.indexOf(c)!==-1&&j.indexOf(u)!==-1||[Ne,Me].indexOf(c)!==-1&&(u===k||[ke,Se].indexOf(u)!==-1&&t[s+1]===k)||[ke,Se].indexOf(c)!==-1&&u===k||c===k&&[k,Pe,je].indexOf(u)!==-1)return A;if([k,Pe,je,we,Te].indexOf(u)!==-1)for(var d=a;d>=0;){var f=t[d];if(f===k)return A;if([Pe,je].indexOf(f)!==-1)d--;else break}if([Ne,Me].indexOf(u)!==-1)for(var d=[we,Te].indexOf(c)===-1?a:o;d>=0;){var f=t[d];if(f===k)return A;if([Pe,je].indexOf(f)!==-1)d--;else break}if(We===c&&[We,Ge,Be,Ve].indexOf(u)!==-1||[Ge,Be].indexOf(c)!==-1&&[Ge,Ke].indexOf(u)!==-1||[Ke,Ve].indexOf(c)!==-1&&u===Ke||it.indexOf(c)!==-1&&[De,Me].indexOf(u)!==-1||it.indexOf(u)!==-1&&c===Ne||j.indexOf(c)!==-1&&j.indexOf(u)!==-1||c===je&&j.indexOf(u)!==-1||j.concat(k).indexOf(c)!==-1&&u===ke&&Xe.indexOf(e[s])===-1||j.concat(k).indexOf(u)!==-1&&c===Te)return A;if(c===qe&&u===qe){for(var p=n[a],m=1;p>0&&(p--,t[p]===qe);)m++;if(m%2!=0)return A}return c===Re&&u===ze?A:Qe},ut=function(e,t){t||={lineBreak:`normal`,wordBreak:`normal`};var n=ot(e,t.lineBreak),r=n[0],i=n[1],a=n[2];(t.wordBreak===`break-all`||t.wordBreak===`break-word`)&&(i=i.map(function(e){return[k,Ie,Je].indexOf(e)===-1?e:Ue}));var o=t.wordBreak===`keep-all`?a.map(function(t,n){return t&&e[n]>=19968&&e[n]<=40959}):void 0;return[r,i,o]},dt=function(){function e(e,t,n,r){this.codePoints=e,this.required=t===Ze,this.start=n,this.end=r}return e.prototype.slice=function(){return u.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),ft=function(e,t){var n=l(e),r=ut(n,t),i=r[0],a=r[1],o=r[2],s=n.length,c=0,u=0;return{next:function(){if(u>=s)return{done:!0,value:null};for(var e=A;u=rn&&e<=57},hn=function(e){return e>=55296&&e<=57343},gn=function(e){return P(e)||e>=un&&e<=fn||e>=an&&e<=sn},_n=function(e){return e>=an&&e<=ln},vn=function(e){return e>=un&&e<=mn},yn=function(e){return _n(e)||vn(e)},bn=function(e){return e>=Ut},xn=function(e){return e===_t||e===bt||e===xt},Sn=function(e){return yn(e)||bn(e)||e===At},Cn=function(e){return Sn(e)||P(e)||e===M},wn=function(e){return e>=Zt&&e<=Qt||e===$t||e>=en&&e<=tn||e===nn},Tn=function(e,t){return e===yt?t!==_t:!1},En=function(e,t,n){return e===M?Sn(t)||Tn(t,n):Sn(e)?!0:!!(e===yt&&Tn(e,t))},Dn=function(e,t,n){return e===Kt||e===M?P(t)?!0:t===Xt&&P(n):P(e===Xt?t:e)},On=function(e){var t=0,n=1;(e[t]===Kt||e[t]===M)&&(e[t]===M&&(n=-1),t++);for(var r=[];P(e[t]);)r.push(e[t++]);var i=r.length?parseInt(u.apply(void 0,r),10):0;e[t]===Xt&&t++;for(var a=[];P(e[t]);)a.push(e[t++]);var o=a.length,s=o?parseInt(u.apply(void 0,a),10):0;(e[t]===dn||e[t]===on)&&t++;var c=1;(e[t]===Kt||e[t]===M)&&(e[t]===M&&(c=-1),t++);for(var l=[];P(e[t]);)l.push(e[t++]);var d=l.length?parseInt(u.apply(void 0,l),10):0;return n*(i+s*10**-o)*10**(c*d)},kn={type:2},An={type:3},jn={type:4},Mn={type:13},Nn={type:8},Pn={type:21},Fn={type:9},In={type:10},Ln={type:11},Rn={type:12},zn={type:14},Bn={type:23},Vn={type:1},Hn={type:25},Un={type:24},Wn={type:26},Gn={type:27},Kn={type:28},qn={type:29},Jn={type:31},Yn={type:32},Xn=function(){function e(){this._value=[]}return e.prototype.write=function(e){this._value=this._value.concat(l(e))},e.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==Yn;)e.push(t),t=this.consumeToken();return e},e.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case St:return this.consumeStringToken(St);case wt:var t=this.peekCodePoint(0),n=this.peekCodePoint(1),r=this.peekCodePoint(2);if(Cn(t)||Tn(n,r)){var i=En(t,n,r)?mt:pt,a=this.consumeName();return{type:5,value:a,flags:i}}break;case Tt:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),Mn;break;case Dt:return this.consumeStringToken(Dt);case Ot:return kn;case kt:return An;case Gt:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),zn;break;case Kt:if(Dn(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case qt:return jn;case M:var o=e,s=this.peekCodePoint(0),c=this.peekCodePoint(1);if(Dn(o,s,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(En(o,s,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(s===M&&c===Nt)return this.consumeCodePoint(),this.consumeCodePoint(),Un;break;case Xt:if(Dn(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case vt:if(this.peekCodePoint(0)===Gt)for(this.consumeCodePoint();;){var l=this.consumeCodePoint();if(l===Gt&&(l=this.consumeCodePoint(),l===vt)||l===N)return this.consumeToken()}break;case Jt:return Wn;case Yt:return Gn;case Mt:if(this.peekCodePoint(0)===jt&&this.peekCodePoint(1)===M&&this.peekCodePoint(2)===M)return this.consumeCodePoint(),this.consumeCodePoint(),Hn;break;case Pt:if(En(this.peekCodePoint(0),this.peekCodePoint(1),this.peekCodePoint(2))){var a=this.consumeName();return{type:7,value:a}}break;case Ft:return Kn;case yt:if(Tn(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case It:return qn;case Lt:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),Nn;break;case Rt:return Ln;case Bt:return Rn;case cn:case pn:var d=this.peekCodePoint(0),f=this.peekCodePoint(1);return d===Kt&&(gn(f)||f===zt)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case Vt:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),Fn;if(this.peekCodePoint(0)===Vt)return this.consumeCodePoint(),Pn;break;case Ht:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),In;break;case N:return Yn}return xn(e)?(this.consumeWhiteSpace(),Jn):P(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):Sn(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:u(e)}},e.prototype.consumeCodePoint=function(){var e=this._value.shift();return e===void 0?-1:e},e.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},e.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},e.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();gn(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var n=!1;t===zt&&e.length<6;)e.push(t),t=this.consumeCodePoint(),n=!0;if(n){var r=parseInt(u.apply(void 0,e.map(function(e){return e===zt?rn:e})),16),i=parseInt(u.apply(void 0,e.map(function(e){return e===zt?fn:e})),16);return{type:30,start:r,end:i}}var a=parseInt(u.apply(void 0,e),16);if(this.peekCodePoint(0)===M&&gn(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];gn(t)&&o.length<6;)o.push(t),t=this.consumeCodePoint();var i=parseInt(u.apply(void 0,o),16);return{type:30,start:a,end:i}}else return{type:30,start:a,end:a}},e.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()===`url`&&this.peekCodePoint(0)===Ot?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===Ot?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},e.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===N)return{type:22,value:``};var t=this.peekCodePoint(0);if(t===Dt||t===St){var n=this.consumeStringToken(this.consumeCodePoint());return n.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===N||this.peekCodePoint(0)===kt)?(this.consumeCodePoint(),{type:22,value:n.value}):(this.consumeBadUrlRemnants(),Bn)}for(;;){var r=this.consumeCodePoint();if(r===N||r===kt)return{type:22,value:u.apply(void 0,e)};if(xn(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===N||this.peekCodePoint(0)===kt?(this.consumeCodePoint(),{type:22,value:u.apply(void 0,e)}):(this.consumeBadUrlRemnants(),Bn);if(r===St||r===Dt||r===Ot||wn(r))return this.consumeBadUrlRemnants(),Bn;if(r===yt)if(Tn(r,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),Bn;else e.push(r)}},e.prototype.consumeWhiteSpace=function(){for(;xn(this.peekCodePoint(0));)this.consumeCodePoint()},e.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===kt||e===N)return;Tn(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},e.prototype.consumeStringSlice=function(e){for(var t=5e4,n=``;e>0;){var r=Math.min(t,e);n+=u.apply(void 0,this._value.splice(0,r)),e-=r}return this._value.shift(),n},e.prototype.consumeStringToken=function(e){var t=``,n=0;do{var r=this._value[n];if(r===N||r===void 0||r===e)return t+=this.consumeStringSlice(n),{type:0,value:t};if(r===_t)return this._value.splice(0,n),Vn;if(r===yt){var i=this._value[n+1];i!==N&&i!==void 0&&(i===_t?(t+=this.consumeStringSlice(n),n=-1,this._value.shift()):Tn(r,i)&&(t+=this.consumeStringSlice(n),t+=u(this.consumeEscapedCodePoint()),n=-1))}n++}while(!0)},e.prototype.consumeNumber=function(){var e=[],t=ht,n=this.peekCodePoint(0);for((n===Kt||n===M)&&e.push(this.consumeCodePoint());P(this.peekCodePoint(0));)e.push(this.consumeCodePoint());n=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(n===Xt&&P(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=gt;P(this.peekCodePoint(0));)e.push(this.consumeCodePoint());n=this.peekCodePoint(0),r=this.peekCodePoint(1);var i=this.peekCodePoint(2);if((n===dn||n===on)&&((r===Kt||r===M)&&P(i)||P(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=gt;P(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[On(e),t]},e.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],n=e[1],r=this.peekCodePoint(0);return En(r,this.peekCodePoint(1),this.peekCodePoint(2))?{type:15,number:t,flags:n,unit:this.consumeName()}:r===Et?(this.consumeCodePoint(),{type:16,number:t,flags:n}):{type:17,number:t,flags:n}},e.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(gn(e)){for(var t=u(e);gn(this.peekCodePoint(0))&&t.length<6;)t+=u(this.consumeCodePoint());xn(this.peekCodePoint(0))&&this.consumeCodePoint();var n=parseInt(t,16);return n===0||hn(n)||n>1114111?Wt:n}return e===N?Wt:e},e.prototype.consumeName=function(){for(var e=``;;){var t=this.consumeCodePoint();if(Cn(t))e+=u(t);else if(Tn(t,this.peekCodePoint(0)))e+=u(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},e}(),Zn=function(){function e(e){this._tokens=e}return e.create=function(t){var n=new Xn;return n.write(t),new e(n.read())},e.parseValue=function(t){return e.create(t).parseComponentValue()},e.parseValues=function(t){return e.create(t).parseComponentValues()},e.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw SyntaxError(`Error parsing CSS component value, unexpected EOF`);this.reconsumeToken(e);var t=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return t;throw SyntaxError(`Error parsing CSS component value, multiple values found when expecting only one`)},e.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},e.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},e.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},n=this.consumeToken();;){if(n.type===32||ir(n,e))return t;this.reconsumeToken(n),t.values.push(this.consumeComponentValue()),n=this.consumeToken()}},e.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var n=this.consumeToken();if(n.type===32||n.type===3)return t;this.reconsumeToken(n),t.values.push(this.consumeComponentValue())}},e.prototype.consumeToken=function(){var e=this._tokens.shift();return e===void 0?Yn:e},e.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},e}(),Qn=function(e){return e.type===15},$n=function(e){return e.type===17},F=function(e){return e.type===20},er=function(e){return e.type===0},tr=function(e,t){return F(e)&&e.value===t},nr=function(e){return e.type!==31},rr=function(e){return e.type!==31&&e.type!==4},I=function(e){var t=[],n=[];return e.forEach(function(e){if(e.type===4){if(n.length===0)throw Error(`Error parsing function args, zero tokens for arg`);t.push(n),n=[];return}e.type!==31&&n.push(e)}),n.length&&t.push(n),t},ir=function(e,t){return t===11&&e.type===12||t===28&&e.type===29?!0:t===2&&e.type===3},ar=function(e){return e.type===17||e.type===15},L=function(e){return e.type===16||ar(e)},or=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},R={type:17,number:0,flags:ht},sr={type:16,number:50,flags:ht},cr={type:16,number:100,flags:ht},lr=function(e,t,n){var r=e[0],i=e[1];return[z(r,t),z(i===void 0?r:i,n)]},z=function(e,t){if(e.type===16)return e.number/100*t;if(Qn(e))switch(e.unit){case`rem`:case`em`:return 16*e.number;case`px`:default:return e.number}return e.number},ur=`deg`,dr=`grad`,fr=`rad`,pr=`turn`,mr={name:`angle`,parse:function(e,t){if(t.type===15)switch(t.unit){case ur:return Math.PI*t.number/180;case dr:return Math.PI/200*t.number;case fr:return t.number;case pr:return Math.PI*2*t.number}throw Error(`Unsupported angle type`)}},hr=function(e){return e.type===15&&(e.unit===ur||e.unit===dr||e.unit===fr||e.unit===pr)},gr=function(e){switch(e.filter(F).map(function(e){return e.value}).join(` `)){case`to bottom right`:case`to right bottom`:case`left top`:case`top left`:return[R,R];case`to top`:case`bottom`:return B(0);case`to bottom left`:case`to left bottom`:case`right top`:case`top right`:return[R,cr];case`to right`:case`left`:return B(90);case`to top left`:case`to left top`:case`right bottom`:case`bottom right`:return[cr,cr];case`to bottom`:case`top`:return B(180);case`to top right`:case`to right top`:case`left bottom`:case`bottom left`:return[cr,R];case`to left`:case`right`:return B(270)}return 0},B=function(e){return Math.PI*e/180},_r={name:`color`,parse:function(e,t){if(t.type===18){var n=wr[t.name];if(n===void 0)throw Error(`Attempting to parse an unsupported color function "`+t.name+`"`);return n(e,t.values)}if(t.type===5){if(t.value.length===3){var r=t.value.substring(0,1),i=t.value.substring(1,2),a=t.value.substring(2,3);return yr(parseInt(r+r,16),parseInt(i+i,16),parseInt(a+a,16),1)}if(t.value.length===4){var r=t.value.substring(0,1),i=t.value.substring(1,2),a=t.value.substring(2,3),o=t.value.substring(3,4);return yr(parseInt(r+r,16),parseInt(i+i,16),parseInt(a+a,16),parseInt(o+o,16)/255)}if(t.value.length===6){var r=t.value.substring(0,2),i=t.value.substring(2,4),a=t.value.substring(4,6);return yr(parseInt(r,16),parseInt(i,16),parseInt(a,16),1)}if(t.value.length===8){var r=t.value.substring(0,2),i=t.value.substring(2,4),a=t.value.substring(4,6),o=t.value.substring(6,8);return yr(parseInt(r,16),parseInt(i,16),parseInt(a,16),parseInt(o,16)/255)}}if(t.type===20){var s=H[t.value.toUpperCase()];if(s!==void 0)return s}return H.TRANSPARENT}},vr=function(e){return(255&e)==0},V=function(e){var t=255&e,n=255&e>>8,r=255&e>>16,i=255&e>>24;return t<255?`rgba(`+i+`,`+r+`,`+n+`,`+t/255+`)`:`rgb(`+i+`,`+r+`,`+n+`)`},yr=function(e,t,n,r){return(e<<24|t<<16|n<<8|Math.round(r*255)<<0)>>>0},br=function(e,t){if(e.type===17)return e.number;if(e.type===16){var n=t===3?1:255;return t===3?e.number/100*n:Math.round(e.number/100*n)}return 0},xr=function(e,t){var n=t.filter(rr);if(n.length===3){var r=n.map(br),i=r[0],a=r[1],o=r[2];return yr(i,a,o,1)}if(n.length===4){var s=n.map(br),i=s[0],a=s[1],o=s[2],c=s[3];return yr(i,a,o,c)}return 0};function Sr(e,t,n){return n<0&&(n+=1),n>=1&&--n,n<1/6?(t-e)*n*6+e:n<1/2?t:n<2/3?(t-e)*6*(2/3-n)+e:e}var Cr=function(e,t){var n=t.filter(rr),r=n[0],i=n[1],a=n[2],o=n[3],s=(r.type===17?B(r.number):mr.parse(e,r))/(Math.PI*2),c=L(i)?i.number/100:0,l=L(a)?a.number/100:0,u=o!==void 0&&L(o)?z(o,1):1;if(c===0)return yr(l*255,l*255,l*255,1);var d=l<=.5?l*(c+1):l+c-l*c,f=l*2-d,p=Sr(f,d,s+1/3),m=Sr(f,d,s),h=Sr(f,d,s-1/3);return yr(p*255,m*255,h*255,u)},wr={hsl:Cr,hsla:Cr,rgb:xr,rgba:xr},Tr=function(e,t){return _r.parse(e,Zn.create(t).parseComponentValue())},H={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},Er={name:`background-clip`,initialValue:`border-box`,prefix:!1,type:1,parse:function(e,t){return t.map(function(e){if(F(e))switch(e.value){case`padding-box`:return 1;case`content-box`:return 2}return 0})}},Dr={name:`background-color`,initialValue:`transparent`,prefix:!1,type:3,format:`color`},Or=function(e,t){var n=_r.parse(e,t[0]),r=t[1];return r&&L(r)?{color:n,stop:r}:{color:n,stop:null}},kr=function(e,t){var n=e[0],r=e[e.length-1];n.stop===null&&(n.stop=R),r.stop===null&&(r.stop=cr);for(var i=[],a=0,o=0;oa?i.push(c):i.push(a),a=c}else i.push(null)}for(var l=null,o=0;oe.optimumDistance)?{optimumCorner:t,optimumDistance:s}:e},{optimumDistance:i?1/0:-1/0,optimumCorner:null}).optimumCorner},Nr=function(e,t,n,r,i){var a=0,o=0;switch(e.size){case 0:e.shape===0?a=o=Math.min(Math.abs(t),Math.abs(t-r),Math.abs(n),Math.abs(n-i)):e.shape===1&&(a=Math.min(Math.abs(t),Math.abs(t-r)),o=Math.min(Math.abs(n),Math.abs(n-i)));break;case 2:if(e.shape===0)a=o=Math.min(U(t,n),U(t,n-i),U(t-r,n),U(t-r,n-i));else if(e.shape===1){var s=Math.min(Math.abs(n),Math.abs(n-i))/Math.min(Math.abs(t),Math.abs(t-r)),c=Mr(r,i,t,n,!0),l=c[0],u=c[1];a=U(l-t,(u-n)/s),o=s*a}break;case 1:e.shape===0?a=o=Math.max(Math.abs(t),Math.abs(t-r),Math.abs(n),Math.abs(n-i)):e.shape===1&&(a=Math.max(Math.abs(t),Math.abs(t-r)),o=Math.max(Math.abs(n),Math.abs(n-i)));break;case 3:if(e.shape===0)a=o=Math.max(U(t,n),U(t,n-i),U(t-r,n),U(t-r,n-i));else if(e.shape===1){var s=Math.max(Math.abs(n),Math.abs(n-i))/Math.max(Math.abs(t),Math.abs(t-r)),d=Mr(r,i,t,n,!1),l=d[0],u=d[1];a=U(l-t,(u-n)/s),o=s*a}break}return Array.isArray(e.size)&&(a=z(e.size[0],r),o=e.size.length===2?z(e.size[1],i):a),[a,o]},Pr=function(e,t){var n=B(180),r=[];return I(t).forEach(function(t,i){if(i===0){var a=t[0];if(a.type===20&&a.value===`to`){n=gr(t);return}else if(hr(a)){n=mr.parse(e,a);return}}var o=Or(e,t);r.push(o)}),{angle:n,stops:r,type:1}},Fr=function(e,t){var n=B(180),r=[];return I(t).forEach(function(t,i){if(i===0){var a=t[0];if(a.type===20&&[`top`,`left`,`right`,`bottom`].indexOf(a.value)!==-1){n=gr(t);return}else if(hr(a)){n=(mr.parse(e,a)+B(270))%B(360);return}}var o=Or(e,t);r.push(o)}),{angle:n,stops:r,type:1}},Ir=function(e,t){var n=B(180),r=[],i=1;return I(t).forEach(function(t,n){var a=t[0];if(n===0){if(F(a)&&a.value===`linear`){i=1;return}else if(F(a)&&a.value===`radial`){i=2;return}}if(a.type===18){if(a.name===`from`){var o=_r.parse(e,a.values[0]);r.push({stop:R,color:o})}else if(a.name===`to`){var o=_r.parse(e,a.values[0]);r.push({stop:cr,color:o})}else if(a.name===`color-stop`){var s=a.values.filter(rr);if(s.length===2){var o=_r.parse(e,s[1]),c=s[0];$n(c)&&r.push({stop:{type:16,number:c.number*100,flags:c.flags},color:o})}}}}),i===1?{angle:(n+B(180))%B(360),stops:r,type:i}:{size:3,shape:0,stops:r,position:[],type:i}},Lr=`closest-side`,Rr=`farthest-side`,zr=`closest-corner`,Br=`farthest-corner`,Vr=`circle`,Hr=`ellipse`,Ur=`cover`,Wr=`contain`,Gr=function(e,t){var n=0,r=3,i=[],a=[];return I(t).forEach(function(t,o){var s=!0;if(o===0){var c=!1;s=t.reduce(function(e,t){if(c)if(F(t))switch(t.value){case`center`:return a.push(sr),e;case`top`:case`left`:return a.push(R),e;case`right`:case`bottom`:return a.push(cr),e}else (L(t)||ar(t))&&a.push(t);else if(F(t))switch(t.value){case Vr:return n=0,!1;case Hr:return n=1,!1;case`at`:return c=!0,!1;case Lr:return r=0,!1;case Ur:case Rr:return r=1,!1;case Wr:case zr:return r=2,!1;case Br:return r=3,!1}else if(ar(t)||L(t))return Array.isArray(r)||(r=[]),r.push(t),!1;return e},s)}if(s){var l=Or(e,t);i.push(l)}}),{size:r,shape:n,stops:i,position:a,type:2}},Kr=function(e,t){var n=0,r=3,i=[],a=[];return I(t).forEach(function(t,o){var s=!0;if(o===0?s=t.reduce(function(e,t){if(F(t))switch(t.value){case`center`:return a.push(sr),!1;case`top`:case`left`:return a.push(R),!1;case`right`:case`bottom`:return a.push(cr),!1}else if(L(t)||ar(t))return a.push(t),!1;return e},s):o===1&&(s=t.reduce(function(e,t){if(F(t))switch(t.value){case Vr:return n=0,!1;case Hr:return n=1,!1;case Wr:case Lr:return r=0,!1;case Rr:return r=1,!1;case zr:return r=2,!1;case Ur:case Br:return r=3,!1}else if(ar(t)||L(t))return Array.isArray(r)||(r=[]),r.push(t),!1;return e},s)),s){var c=Or(e,t);i.push(c)}}),{size:r,shape:n,stops:i,position:a,type:2}},qr=function(e){return e.type===1},Jr=function(e){return e.type===2},Yr={name:`image`,parse:function(e,t){if(t.type===22){var n={url:t.value,type:0};return e.cache.addImage(t.value),n}if(t.type===18){var r=Zr[t.name];if(r===void 0)throw Error(`Attempting to parse an unsupported image function "`+t.name+`"`);return r(e,t.values)}throw Error(`Unsupported image type `+t.type)}};function Xr(e){return!(e.type===20&&e.value===`none`)&&(e.type!==18||!!Zr[e.name])}var Zr={"linear-gradient":Pr,"-moz-linear-gradient":Fr,"-ms-linear-gradient":Fr,"-o-linear-gradient":Fr,"-webkit-linear-gradient":Fr,"radial-gradient":Gr,"-moz-radial-gradient":Kr,"-ms-radial-gradient":Kr,"-o-radial-gradient":Kr,"-webkit-radial-gradient":Kr,"-webkit-gradient":Ir},Qr={name:`background-image`,initialValue:`none`,type:1,prefix:!1,parse:function(e,t){if(t.length===0)return[];var n=t[0];return n.type===20&&n.value===`none`?[]:t.filter(function(e){return rr(e)&&Xr(e)}).map(function(t){return Yr.parse(e,t)})}},$r={name:`background-origin`,initialValue:`border-box`,prefix:!1,type:1,parse:function(e,t){return t.map(function(e){if(F(e))switch(e.value){case`padding-box`:return 1;case`content-box`:return 2}return 0})}},ei={name:`background-position`,initialValue:`0% 0%`,type:1,prefix:!1,parse:function(e,t){return I(t).map(function(e){return e.filter(L)}).map(or)}},ti={name:`background-repeat`,initialValue:`repeat`,prefix:!1,type:1,parse:function(e,t){return I(t).map(function(e){return e.filter(F).map(function(e){return e.value}).join(` `)}).map(ni)}},ni=function(e){switch(e){case`no-repeat`:return 1;case`repeat-x`:case`repeat no-repeat`:return 2;case`repeat-y`:case`no-repeat repeat`:return 3;case`repeat`:default:return 0}},ri;(function(e){e.AUTO=`auto`,e.CONTAIN=`contain`,e.COVER=`cover`})(ri||={});var ii={name:`background-size`,initialValue:`0`,prefix:!1,type:1,parse:function(e,t){return I(t).map(function(e){return e.filter(ai)})}},ai=function(e){return F(e)||L(e)},oi=function(e){return{name:`border-`+e+`-color`,initialValue:`transparent`,prefix:!1,type:3,format:`color`}},si=oi(`top`),ci=oi(`right`),li=oi(`bottom`),ui=oi(`left`),di=function(e){return{name:`border-radius-`+e,initialValue:`0 0`,prefix:!1,type:1,parse:function(e,t){return or(t.filter(L))}}},fi=di(`top-left`),pi=di(`top-right`),mi=di(`bottom-right`),hi=di(`bottom-left`),gi=function(e){return{name:`border-`+e+`-style`,initialValue:`solid`,prefix:!1,type:2,parse:function(e,t){switch(t){case`none`:return 0;case`dashed`:return 2;case`dotted`:return 3;case`double`:return 4}return 1}}},_i=gi(`top`),vi=gi(`right`),yi=gi(`bottom`),bi=gi(`left`),xi=function(e){return{name:`border-`+e+`-width`,initialValue:`0`,type:0,prefix:!1,parse:function(e,t){return Qn(t)?t.number:0}}},Si=xi(`top`),Ci=xi(`right`),wi=xi(`bottom`),Ti=xi(`left`),Ei={name:`color`,initialValue:`transparent`,prefix:!1,type:3,format:`color`},Di={name:`direction`,initialValue:`ltr`,prefix:!1,type:2,parse:function(e,t){switch(t){case`rtl`:return 1;case`ltr`:default:return 0}}},Oi={name:`display`,initialValue:`inline-block`,prefix:!1,type:1,parse:function(e,t){return t.filter(F).reduce(function(e,t){return e|ki(t.value)},0)}},ki=function(e){switch(e){case`block`:case`-webkit-box`:return 2;case`inline`:return 4;case`run-in`:return 8;case`flow`:return 16;case`flow-root`:return 32;case`table`:return 64;case`flex`:case`-webkit-flex`:return 128;case`grid`:case`-ms-grid`:return 256;case`ruby`:return 512;case`subgrid`:return 1024;case`list-item`:return 2048;case`table-row-group`:return 4096;case`table-header-group`:return 8192;case`table-footer-group`:return 16384;case`table-row`:return 32768;case`table-cell`:return 65536;case`table-column-group`:return 131072;case`table-column`:return 262144;case`table-caption`:return 524288;case`ruby-base`:return 1048576;case`ruby-text`:return 2097152;case`ruby-base-container`:return 4194304;case`ruby-text-container`:return 8388608;case`contents`:return 16777216;case`inline-block`:return 33554432;case`inline-list-item`:return 67108864;case`inline-table`:return 134217728;case`inline-flex`:return 268435456;case`inline-grid`:return 536870912}return 0},Ai={name:`float`,initialValue:`none`,prefix:!1,type:2,parse:function(e,t){switch(t){case`left`:return 1;case`right`:return 2;case`inline-start`:return 3;case`inline-end`:return 4}return 0}},ji={name:`letter-spacing`,initialValue:`0`,prefix:!1,type:0,parse:function(e,t){return t.type===20&&t.value===`normal`?0:t.type===17||t.type===15?t.number:0}},Mi;(function(e){e.NORMAL=`normal`,e.STRICT=`strict`})(Mi||={});var Ni={name:`line-break`,initialValue:`normal`,prefix:!1,type:2,parse:function(e,t){switch(t){case`strict`:return Mi.STRICT;case`normal`:default:return Mi.NORMAL}}},Pi={name:`line-height`,initialValue:`normal`,prefix:!1,type:4},Fi=function(e,t){return F(e)&&e.value===`normal`?1.2*t:e.type===17?t*e.number:L(e)?z(e,t):t},Ii={name:`list-style-image`,initialValue:`none`,type:0,prefix:!1,parse:function(e,t){return t.type===20&&t.value===`none`?null:Yr.parse(e,t)}},Li={name:`list-style-position`,initialValue:`outside`,prefix:!1,type:2,parse:function(e,t){switch(t){case`inside`:return 0;case`outside`:default:return 1}}},Ri={name:`list-style-type`,initialValue:`none`,prefix:!1,type:2,parse:function(e,t){switch(t){case`disc`:return 0;case`circle`:return 1;case`square`:return 2;case`decimal`:return 3;case`cjk-decimal`:return 4;case`decimal-leading-zero`:return 5;case`lower-roman`:return 6;case`upper-roman`:return 7;case`lower-greek`:return 8;case`lower-alpha`:return 9;case`upper-alpha`:return 10;case`arabic-indic`:return 11;case`armenian`:return 12;case`bengali`:return 13;case`cambodian`:return 14;case`cjk-earthly-branch`:return 15;case`cjk-heavenly-stem`:return 16;case`cjk-ideographic`:return 17;case`devanagari`:return 18;case`ethiopic-numeric`:return 19;case`georgian`:return 20;case`gujarati`:return 21;case`gurmukhi`:return 22;case`hebrew`:return 22;case`hiragana`:return 23;case`hiragana-iroha`:return 24;case`japanese-formal`:return 25;case`japanese-informal`:return 26;case`kannada`:return 27;case`katakana`:return 28;case`katakana-iroha`:return 29;case`khmer`:return 30;case`korean-hangul-formal`:return 31;case`korean-hanja-formal`:return 32;case`korean-hanja-informal`:return 33;case`lao`:return 34;case`lower-armenian`:return 35;case`malayalam`:return 36;case`mongolian`:return 37;case`myanmar`:return 38;case`oriya`:return 39;case`persian`:return 40;case`simp-chinese-formal`:return 41;case`simp-chinese-informal`:return 42;case`tamil`:return 43;case`telugu`:return 44;case`thai`:return 45;case`tibetan`:return 46;case`trad-chinese-formal`:return 47;case`trad-chinese-informal`:return 48;case`upper-armenian`:return 49;case`disclosure-open`:return 50;case`disclosure-closed`:return 51;case`none`:default:return-1}}},zi=function(e){return{name:`margin-`+e,initialValue:`0`,prefix:!1,type:4}},Bi=zi(`top`),Vi=zi(`right`),Hi=zi(`bottom`),Ui=zi(`left`),Wi={name:`overflow`,initialValue:`visible`,prefix:!1,type:1,parse:function(e,t){return t.filter(F).map(function(e){switch(e.value){case`hidden`:return 1;case`scroll`:return 2;case`clip`:return 3;case`auto`:return 4;case`visible`:default:return 0}})}},Gi={name:`overflow-wrap`,initialValue:`normal`,prefix:!1,type:2,parse:function(e,t){switch(t){case`break-word`:return`break-word`;case`normal`:default:return`normal`}}},Ki=function(e){return{name:`padding-`+e,initialValue:`0`,prefix:!1,type:3,format:`length-percentage`}},qi=Ki(`top`),Ji=Ki(`right`),Yi=Ki(`bottom`),Xi=Ki(`left`),Zi={name:`text-align`,initialValue:`left`,prefix:!1,type:2,parse:function(e,t){switch(t){case`right`:return 2;case`center`:case`justify`:return 1;case`left`:default:return 0}}},Qi={name:`position`,initialValue:`static`,prefix:!1,type:2,parse:function(e,t){switch(t){case`relative`:return 1;case`absolute`:return 2;case`fixed`:return 3;case`sticky`:return 4}return 0}},$i={name:`text-shadow`,initialValue:`none`,type:1,prefix:!1,parse:function(e,t){return t.length===1&&tr(t[0],`none`)?[]:I(t).map(function(t){for(var n={color:H.TRANSPARENT,offsetX:R,offsetY:R,blur:R},r=0,i=0;i1?1:0],this.overflowWrap=G(e,Gi,t.overflowWrap),this.paddingTop=G(e,qi,t.paddingTop),this.paddingRight=G(e,Ji,t.paddingRight),this.paddingBottom=G(e,Yi,t.paddingBottom),this.paddingLeft=G(e,Xi,t.paddingLeft),this.paintOrder=G(e,Ea,t.paintOrder),this.position=G(e,Qi,t.position),this.textAlign=G(e,Zi,t.textAlign),this.textDecorationColor=G(e,fa,t.textDecorationColor??t.color),this.textDecorationLine=G(e,pa,t.textDecorationLine??t.textDecoration),this.textShadow=G(e,$i,t.textShadow),this.textTransform=G(e,ea,t.textTransform),this.transform=G(e,ta,t.transform),this.transformOrigin=G(e,aa,t.transformOrigin),this.visibility=G(e,oa,t.visibility),this.webkitTextStrokeColor=G(e,Da,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=G(e,Oa,t.webkitTextStrokeWidth),this.wordBreak=G(e,ca,t.wordBreak),this.zIndex=G(e,la,t.zIndex)}return e.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},e.prototype.isTransparent=function(){return vr(this.backgroundColor)},e.prototype.isTransformed=function(){return this.transform!==null},e.prototype.isPositioned=function(){return this.position!==0},e.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},e.prototype.isFloating=function(){return this.float!==0},e.prototype.isInlineLevel=function(){return W(this.display,4)||W(this.display,33554432)||W(this.display,268435456)||W(this.display,536870912)||W(this.display,67108864)||W(this.display,134217728)},e}(),Aa=function(){function e(e,t){this.content=G(e,ya,t.content),this.quotes=G(e,Ca,t.quotes)}return e}(),ja=function(){function e(e,t){this.counterIncrement=G(e,ba,t.counterIncrement),this.counterReset=G(e,xa,t.counterReset)}return e}(),G=function(e,t,n){var r=new Xn,i=n==null?t.initialValue:n.toString();r.write(i);var a=new Zn(r.read());switch(t.type){case 2:var o=a.parseComponentValue();return t.parse(e,F(o)?o.value:t.initialValue);case 0:return t.parse(e,a.parseComponentValue());case 1:return t.parse(e,a.parseComponentValues());case 4:return a.parseComponentValue();case 3:switch(t.format){case`angle`:return mr.parse(e,a.parseComponentValue());case`color`:return _r.parse(e,a.parseComponentValue());case`image`:return Yr.parse(e,a.parseComponentValue());case`length`:var s=a.parseComponentValue();return ar(s)?s:R;case`length-percentage`:var c=a.parseComponentValue();return L(c)?c:R;case`time`:return ua.parse(e,a.parseComponentValue())}break}},Ma=`data-html2canvas-debug`,Na=function(e){switch(e.getAttribute(Ma)){case`all`:return 1;case`clone`:return 2;case`parse`:return 3;case`render`:return 4;default:return 0}},Pa=function(e,t){var n=Na(e);return n===1||t===n},K=function(){function e(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Pa(t,3))debugger;this.styles=new ka(e,window.getComputedStyle(t,null)),xs(t)&&(this.styles.animationDuration.some(function(e){return e>0})&&(t.style.animationDuration=`0s`),this.styles.transform!==null&&(t.style.transform=`none`)),this.bounds=s(this.context,t),Pa(t,4)&&(this.flags|=16)}return e}(),Fa=`AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=`,Ia=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,La=typeof Uint8Array>`u`?[]:new Uint8Array(256),Ra=0;Ra>4,u[i++]=(o&15)<<4|s>>2,u[i++]=(s&3)<<6|c&63;return l},Ba=function(e){for(var t=e.length,n=[],r=0;r>Ha,qa=(1<>Ha)+32,Ya=65536>>Ua,Xa=(1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Ha],t=(t<>Ha)],t=(t<>Ua),t=this.index[t],t+=e>>Ha&Xa,t=this.index[t],t=(t<`u`?[]:new Uint8Array(256),ro=0;ro=55296&&i<=56319&&n>10)+55296,a%1024+56320)),(r+1===t||n.length>16384)&&(i+=String.fromCharCode.apply(String,n),n.length=0)}return i},xo=$a(Fa),So=`×`,Co=`÷`,wo=function(e){return xo.get(e)},To=function(e,t,n){var r=n-2,i=t[r],a=t[n-1],o=t[n];if(a===ao&&o===oo)return So;if(a===ao||a===oo||a===so||o===ao||o===oo||o===so)return Co;if(a===uo&&[uo,fo,mo,ho].indexOf(o)!==-1||(a===mo||a===fo)&&(o===fo||o===po)||(a===ho||a===po)&&o===po||o===go||o===co||o===lo||a===io)return So;if(a===go&&o===_o){for(;i===co;)i=t[--r];if(i===_o)return So}if(a===vo&&o===vo){for(var s=0;i===vo;)s++,i=t[--r];if(s%2==0)return So}return Co},Eo=function(e){var t=yo(e),n=t.length,r=0,i=0,a=t.map(wo);return{next:function(){if(r>=n)return{done:!0,value:null};for(var e=So;ro.x||i.y>o.y;return o=i,t===0?!0:s});return e.body.removeChild(t),s},Ao=function(){return new Image().crossOrigin!==void 0},jo=function(){return typeof new XMLHttpRequest().responseType==`string`},Mo=function(e){var t=new Image,n=e.createElement(`canvas`),r=n.getContext(`2d`);if(!r)return!1;t.src=`data:image/svg+xml,`;try{r.drawImage(t,0,0),n.toDataURL()}catch{return!1}return!0},No=function(e){return e[0]===0&&e[1]===255&&e[2]===0&&e[3]===255},Po=function(e){var t=e.createElement(`canvas`),n=100;t.width=n,t.height=n;var r=t.getContext(`2d`);if(!r)return Promise.reject(!1);r.fillStyle=`rgb(0, 255, 0)`,r.fillRect(0,0,n,n);var i=new Image,a=t.toDataURL();i.src=a;var o=Fo(n,n,0,0,i);return r.fillStyle=`red`,r.fillRect(0,0,n,n),Io(o).then(function(t){r.drawImage(t,0,0);var i=r.getImageData(0,0,n,n).data;r.fillStyle=`red`,r.fillRect(0,0,n,n);var o=e.createElement(`div`);return o.style.backgroundImage=`url(`+a+`)`,o.style.height=n+`px`,No(i)?Io(Fo(n,n,0,0,o)):Promise.reject(!1)}).then(function(e){return r.drawImage(e,0,0),No(r.getImageData(0,0,n,n).data)}).catch(function(){return!1})},Fo=function(e,t,n,r,i){var a=`http://www.w3.org/2000/svg`,o=document.createElementNS(a,`svg`),s=document.createElementNS(a,`foreignObject`);return o.setAttributeNS(null,`width`,e.toString()),o.setAttributeNS(null,`height`,t.toString()),s.setAttributeNS(null,`width`,`100%`),s.setAttributeNS(null,`height`,`100%`),s.setAttributeNS(null,`x`,n.toString()),s.setAttributeNS(null,`y`,r.toString()),s.setAttributeNS(null,`externalResourcesRequired`,`true`),o.appendChild(s),s.appendChild(i),o},Io=function(e){return new Promise(function(t,n){var r=new Image;r.onload=function(){return t(r)},r.onerror=n,r.src=`data:image/svg+xml;charset=utf-8,`+encodeURIComponent(new XMLSerializer().serializeToString(e))})},q={get SUPPORT_RANGE_BOUNDS(){var e=Oo(document);return Object.defineProperty(q,`SUPPORT_RANGE_BOUNDS`,{value:e}),e},get SUPPORT_WORD_BREAKING(){var e=q.SUPPORT_RANGE_BOUNDS&&ko(document);return Object.defineProperty(q,`SUPPORT_WORD_BREAKING`,{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=Mo(document);return Object.defineProperty(q,`SUPPORT_SVG_DRAWING`,{value:e}),e},get SUPPORT_FOREIGNOBJECT_DRAWING(){var e=typeof Array.from==`function`&&typeof window.fetch==`function`?Po(document):Promise.resolve(!1);return Object.defineProperty(q,`SUPPORT_FOREIGNOBJECT_DRAWING`,{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=Ao();return Object.defineProperty(q,`SUPPORT_CORS_IMAGES`,{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e=jo();return Object.defineProperty(q,`SUPPORT_RESPONSE_TYPE`,{value:e}),e},get SUPPORT_CORS_XHR(){var e=`withCredentials`in new XMLHttpRequest;return Object.defineProperty(q,`SUPPORT_CORS_XHR`,{value:e}),e},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var e=!!(typeof Intl<`u`&&Intl.Segmenter);return Object.defineProperty(q,`SUPPORT_NATIVE_TEXT_SEGMENTATION`,{value:e}),e}},Lo=function(){function e(e,t){this.text=e,this.bounds=t}return e}(),Ro=function(e,t,n,r){var i=Uo(t,n),a=[],s=0;return i.forEach(function(t){if(n.textDecorationLine.length||t.trim().length>0)if(q.SUPPORT_RANGE_BOUNDS){var i=Bo(r,s,t.length).getClientRects();if(i.length>1){var c=Vo(t),l=0;c.forEach(function(t){a.push(new Lo(t,o.fromDOMRectList(e,Bo(r,l+s,t.length).getClientRects()))),l+=t.length})}else a.push(new Lo(t,o.fromDOMRectList(e,i)))}else{var u=r.splitText(t.length);a.push(new Lo(t,zo(e,r))),r=u}else q.SUPPORT_RANGE_BOUNDS||(r=r.splitText(t.length));s+=t.length}),a},zo=function(e,t){var n=t.ownerDocument;if(n){var r=n.createElement(`html2canvaswrapper`);r.appendChild(t.cloneNode(!0));var i=t.parentNode;if(i){i.replaceChild(r,t);var a=s(e,r);return r.firstChild&&i.replaceChild(r.firstChild,r),a}}return o.EMPTY},Bo=function(e,t,n){var r=e.ownerDocument;if(!r)throw Error(`Node has no owner document`);var i=r.createRange();return i.setStart(e,t),i.setEnd(e,t+n),i},Vo=function(e){if(q.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:`grapheme`});return Array.from(t.segment(e)).map(function(e){return e.segment})}return Do(e)},Ho=function(e,t){if(q.SUPPORT_NATIVE_TEXT_SEGMENTATION){var n=new Intl.Segmenter(void 0,{granularity:`word`});return Array.from(n.segment(e)).map(function(e){return e.segment})}return Go(e,t)},Uo=function(e,t){return t.letterSpacing===0?Ho(e,t):Vo(e)},Wo=[32,160,4961,65792,65793,4153,4241],Go=function(e,t){for(var n=ft(e,{lineBreak:t.lineBreak,wordBreak:t.overflowWrap===`break-word`?`break-word`:t.wordBreak}),r=[],i,a=function(){if(i.value){var e=l(i.value.slice()),t=``;e.forEach(function(e){Wo.indexOf(e)===-1?t+=u(e):(t.length&&r.push(t),r.push(u(e)),t=``)}),t.length&&r.push(t)}};!(i=n.next()).done;)a();return r},Ko=function(){function e(e,t,n){this.text=qo(t.data,n.textTransform),this.textBounds=Ro(e,this.text,n,t)}return e}(),qo=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(Jo,Yo);case 2:return e.toUpperCase();default:return e}},Jo=/(^|\s|:|-|\(|\))([a-z])/g,Yo=function(e,t,n){return e.length>0?t+n.toUpperCase():e},Xo=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.src=n.currentSrc||n.src,r.intrinsicWidth=n.naturalWidth,r.intrinsicHeight=n.naturalHeight,r.context.cache.addImage(r.src),r}return n}(K),Zo=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.canvas=n,r.intrinsicWidth=n.width,r.intrinsicHeight=n.height,r}return n}(K),Qo=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this,i=new XMLSerializer,a=s(t,n);return n.setAttribute(`width`,a.width+`px`),n.setAttribute(`height`,a.height+`px`),r.svg=`data:image/svg+xml,`+encodeURIComponent(i.serializeToString(n)),r.intrinsicWidth=n.width.baseVal.value,r.intrinsicHeight=n.height.baseVal.value,r.context.cache.addImage(r.svg),r}return n}(K),$o=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.value=n.value,r}return n}(K),es=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.start=n.start,r.reversed=typeof n.reversed==`boolean`&&n.reversed===!0,r}return n}(K),ts=[{type:15,flags:0,unit:`px`,number:3}],ns=[{type:16,flags:0,number:50}],rs=function(e){return e.width>e.height?new o(e.left+(e.width-e.height)/2,e.top,e.height,e.height):e.width0)n.textNodes.push(new Ko(e,i,n.styles));else if(bs(i))if(Ls(i)&&i.assignedNodes)i.assignedNodes().forEach(function(t){return ms(e,t,n,r)});else{var o=hs(e,i);o.styles.isVisible()&&(_s(i,o,r)?o.flags|=4:vs(o.styles)&&(o.flags|=2),ps.indexOf(i.tagName)!==-1&&(o.flags|=8),n.elements.push(o),i.slot,i.shadowRoot?ms(e,i.shadowRoot,o,r):!Fs(i)&&!Ds(i)&&!Is(i)&&ms(e,i,o,r))}},hs=function(e,t){return js(t)?new Xo(e,t):ks(t)?new Zo(e,t):Ds(t)?new Qo(e,t):Cs(t)?new $o(e,t):ws(t)?new es(e,t):Ts(t)?new ls(e,t):Is(t)?new us(e,t):Fs(t)?new ds(e,t):Ms(t)?new fs(e,t):new K(e,t)},gs=function(e,t){var n=hs(e,t);return n.flags|=4,ms(e,t,n,n),n},_s=function(e,t,n){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||Os(e)&&n.styles.isTransparent()},vs=function(e){return e.isPositioned()||e.isFloating()},ys=function(e){return e.nodeType===Node.TEXT_NODE},bs=function(e){return e.nodeType===Node.ELEMENT_NODE},xs=function(e){return bs(e)&&e.style!==void 0&&!Ss(e)},Ss=function(e){return typeof e.className==`object`},Cs=function(e){return e.tagName===`LI`},ws=function(e){return e.tagName===`OL`},Ts=function(e){return e.tagName===`INPUT`},Es=function(e){return e.tagName===`HTML`},Ds=function(e){return e.tagName===`svg`},Os=function(e){return e.tagName===`BODY`},ks=function(e){return e.tagName===`CANVAS`},As=function(e){return e.tagName===`VIDEO`},js=function(e){return e.tagName===`IMG`},Ms=function(e){return e.tagName===`IFRAME`},Ns=function(e){return e.tagName===`STYLE`},Ps=function(e){return e.tagName===`SCRIPT`},Fs=function(e){return e.tagName===`TEXTAREA`},Is=function(e){return e.tagName===`SELECT`},Ls=function(e){return e.tagName===`SLOT`},Rs=function(e){return e.tagName.indexOf(`-`)>0},zs=function(){function e(){this.counters={}}return e.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},e.prototype.getCounterValues=function(e){return this.counters[e]||[]},e.prototype.pop=function(e){var t=this;e.forEach(function(e){return t.counters[e].pop()})},e.prototype.parse=function(e){var t=this,n=e.counterIncrement,r=e.counterReset,i=!0;n!==null&&n.forEach(function(e){var n=t.counters[e.counter];n&&e.increment!==0&&(i=!1,n.length||n.push(1),n[Math.max(0,n.length-1)]+=e.increment)});var a=[];return i&&r.forEach(function(e){var n=t.counters[e.counter];a.push(e.counter),n||=t.counters[e.counter]=[],n.push(e.reset)}),a},e}(),Bs={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:[`M`,`CM`,`D`,`CD`,`C`,`XC`,`L`,`XL`,`X`,`IX`,`V`,`IV`,`I`]},Vs={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:`Ք.Փ.Ւ.Ց.Ր.Տ.Վ.Ս.Ռ.Ջ.Պ.Չ.Ո.Շ.Ն.Յ.Մ.Ճ.Ղ.Ձ.Հ.Կ.Ծ.Խ.Լ.Ի.Ժ.Թ.Ը.Է.Զ.Ե.Դ.Գ.Բ.Ա`.split(`.`)},Hs={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:`י׳.ט׳.ח׳.ז׳.ו׳.ה׳.ד׳.ג׳.ב׳.א׳.ת.ש.ר.ק.צ.פ.ע.ס.נ.מ.ל.כ.יט.יח.יז.טז.טו.י.ט.ח.ז.ו.ה.ד.ג.ב.א`.split(`.`)},Us={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:`ჵ.ჰ.ჯ.ჴ.ხ.ჭ.წ.ძ.ც.ჩ.შ.ყ.ღ.ქ.ფ.ჳ.ტ.ს.რ.ჟ.პ.ო.ჲ.ნ.მ.ლ.კ.ი.თ.ჱ.ზ.ვ.ე.დ.გ.ბ.ა`.split(`.`)},Ws=function(e,t,n,r,i,a){return en?nc(e,i,a.length>0):r.integers.reduce(function(t,n,i){for(;e>=n;)e-=n,t+=r.values[i];return t},``)+a},Gs=function(e,t,n,r){var i=``;do n||e--,i=r(e)+i,e/=t;while(e*t>=t);return i},J=function(e,t,n,r,i){var a=n-t+1;return(e<0?`-`:``)+(Gs(Math.abs(e),a,r,function(e){return u(Math.floor(e%a)+t)})+i)},Ks=function(e,t,n){n===void 0&&(n=`. `);var r=t.length;return Gs(Math.abs(e),r,!1,function(e){return t[Math.floor(e%r)]})+n},qs=1,Js=2,Ys=4,Xs=8,Zs=function(e,t,n,r,i,a){if(e<-9999||e>9999)return nc(e,4,i.length>0);var o=Math.abs(e),s=i;if(o===0)return t[0]+s;for(var c=0;o>0&&c<=4;c++){var l=o%10;l===0&&W(a,qs)&&s!==``?s=t[l]+s:l>1||l===1&&c===0||l===1&&c===1&&W(a,Js)||l===1&&c===1&&W(a,Ys)&&e>100||l===1&&c>1&&W(a,Xs)?s=t[l]+(c>0?n[c-1]:``)+s:l===1&&c>0&&(s=n[c-1]+s),o=Math.floor(o/10)}return(e<0?r:``)+s},Qs=`十百千萬`,$s=`拾佰仟萬`,ec=`マイナス`,tc=`마이너스`,nc=function(e,t,n){var r=n?`. `:``,i=n?`、`:``,a=n?`, `:``,o=n?` `:``;switch(t){case 0:return`•`+o;case 1:return`◦`+o;case 2:return`◾`+o;case 5:var s=J(e,48,57,!0,r);return s.length<4?`0`+s:s;case 4:return Ks(e,`〇一二三四五六七八九`,i);case 6:return Ws(e,1,3999,Bs,3,r).toLowerCase();case 7:return Ws(e,1,3999,Bs,3,r);case 8:return J(e,945,969,!1,r);case 9:return J(e,97,122,!1,r);case 10:return J(e,65,90,!1,r);case 11:return J(e,1632,1641,!0,r);case 12:case 49:return Ws(e,1,9999,Vs,3,r);case 35:return Ws(e,1,9999,Vs,3,r).toLowerCase();case 13:return J(e,2534,2543,!0,r);case 14:case 30:return J(e,6112,6121,!0,r);case 15:return Ks(e,`子丑寅卯辰巳午未申酉戌亥`,i);case 16:return Ks(e,`甲乙丙丁戊己庚辛壬癸`,i);case 17:case 48:return Zs(e,`零一二三四五六七八九`,Qs,`負`,i,Js|Ys|Xs);case 47:return Zs(e,`零壹貳參肆伍陸柒捌玖`,$s,`負`,i,qs|Js|Ys|Xs);case 42:return Zs(e,`零一二三四五六七八九`,Qs,`负`,i,Js|Ys|Xs);case 41:return Zs(e,`零壹贰叁肆伍陆柒捌玖`,$s,`负`,i,qs|Js|Ys|Xs);case 26:return Zs(e,`〇一二三四五六七八九`,`十百千万`,ec,i,0);case 25:return Zs(e,`零壱弐参四伍六七八九`,`拾百千万`,ec,i,qs|Js|Ys);case 31:return Zs(e,`영일이삼사오육칠팔구`,`십백천만`,tc,a,qs|Js|Ys);case 33:return Zs(e,`零一二三四五六七八九`,`十百千萬`,tc,a,0);case 32:return Zs(e,`零壹貳參四五六七八九`,`拾百千`,tc,a,qs|Js|Ys);case 18:return J(e,2406,2415,!0,r);case 20:return Ws(e,1,19999,Us,3,r);case 21:return J(e,2790,2799,!0,r);case 22:return J(e,2662,2671,!0,r);case 22:return Ws(e,1,10999,Hs,3,r);case 23:return Ks(e,`あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん`);case 24:return Ks(e,`いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす`);case 27:return J(e,3302,3311,!0,r);case 28:return Ks(e,`アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン`,i);case 29:return Ks(e,`イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス`,i);case 34:return J(e,3792,3801,!0,r);case 37:return J(e,6160,6169,!0,r);case 38:return J(e,4160,4169,!0,r);case 39:return J(e,2918,2927,!0,r);case 40:return J(e,1776,1785,!0,r);case 43:return J(e,3046,3055,!0,r);case 44:return J(e,3174,3183,!0,r);case 45:return J(e,3664,3673,!0,r);case 46:return J(e,3872,3881,!0,r);case 3:default:return J(e,48,57,!0,r)}},rc=`data-html2canvas-ignore`,ic=function(){function e(e,t,n){if(this.context=e,this.options=n,this.scrolledElements=[],this.referenceElement=t,this.counters=new zs,this.quoteDepth=0,!t.ownerDocument)throw Error(`Cloned element does not have an owner document`);this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return e.prototype.toIFrame=function(e,t){var n=this,a=oc(e,t);if(!a.contentWindow)return Promise.reject(`Unable to find iframe window`);var o=e.defaultView.pageXOffset,s=e.defaultView.pageYOffset,c=a.contentWindow,l=c.document,u=lc(a).then(function(){return r(n,void 0,void 0,function(){var e,n;return i(this,function(r){switch(r.label){case 0:return this.scrolledElements.forEach(mc),c&&(c.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(c.scrollY!==t.top||c.scrollX!==t.left)&&(this.context.logger.warn(`Unable to restore scroll position for cloned document`),this.context.windowBounds=this.context.windowBounds.add(c.scrollX-t.left,c.scrollY-t.top,0,0))),e=this.options.onclone,n=this.clonedReferenceElement,n===void 0?[2,Promise.reject(`Error finding the `+this.referenceElement.nodeName+` in the cloned document`)]:l.fonts&&l.fonts.ready?[4,l.fonts.ready]:[3,2];case 1:r.sent(),r.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,cc(l)]:[3,4];case 3:r.sent(),r.label=4;case 4:return typeof e==`function`?[2,Promise.resolve().then(function(){return e(l,n)}).then(function(){return a})]:[2,a]}})})});return l.open(),l.write(fc(document.doctype)+``),pc(this.referenceElement.ownerDocument,o,s),l.replaceChild(l.adoptNode(this.documentElement),l.documentElement),l.close(),u},e.prototype.createElementClone=function(e){if(Pa(e,2))debugger;if(ks(e))return this.createCanvasClone(e);if(As(e))return this.createVideoClone(e);if(Ns(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return js(t)&&(js(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=``),t.loading===`lazy`&&(t.loading=`eager`)),Rs(t)?this.createCustomElementClone(t):t},e.prototype.createCustomElementClone=function(e){var t=document.createElement(`html2canvascustomelement`);return dc(e.style,t),t},e.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var n=[].slice.call(t.cssRules,0).reduce(function(e,t){return t&&typeof t.cssText==`string`?e+t.cssText:e},``),r=e.cloneNode(!1);return r.textContent=n,r}}catch(e){if(this.context.logger.error(`Unable to access cssRules property`,e),e.name!==`SecurityError`)throw e}return e.cloneNode(!1)},e.prototype.createCanvasClone=function(e){if(this.options.inlineImages&&e.ownerDocument){var t=e.ownerDocument.createElement(`img`);try{return t.src=e.toDataURL(),t}catch{this.context.logger.info(`Unable to inline canvas contents, canvas is tainted`,e)}}var n=e.cloneNode(!1);try{n.width=e.width,n.height=e.height;var r=e.getContext(`2d`),i=n.getContext(`2d`);if(i)if(!this.options.allowTaint&&r)i.putImageData(r.getImageData(0,0,e.width,e.height),0,0);else{var a=e.getContext(`webgl2`)??e.getContext(`webgl`);a&&a.getContextAttributes()?.preserveDrawingBuffer===!1&&this.context.logger.warn(`Unable to clone WebGL context as it has preserveDrawingBuffer=false`,e),i.drawImage(e,0,0)}return n}catch{this.context.logger.info(`Unable to clone canvas as it is tainted`,e)}return n},e.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement(`canvas`);t.width=e.offsetWidth,t.height=e.offsetHeight;var n=t.getContext(`2d`);try{return n&&(n.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||n.getImageData(0,0,t.width,t.height)),t}catch{this.context.logger.info(`Unable to clone video as it is tainted`,e)}var r=e.ownerDocument.createElement(`canvas`);return r.width=e.offsetWidth,r.height=e.offsetHeight,r},e.prototype.appendChildNode=function(e,t,n){(!bs(t)||!Ps(t)&&!t.hasAttribute(rc)&&(typeof this.options.ignoreElements!=`function`||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!bs(t)||!Ns(t))&&e.appendChild(this.cloneNode(t,n))},e.prototype.cloneChildNodes=function(e,t,n){for(var r=this,i=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;i;i=i.nextSibling)if(bs(i)&&Ls(i)&&typeof i.assignedNodes==`function`){var a=i.assignedNodes();a.length&&a.forEach(function(e){return r.appendChildNode(t,e,n)})}else this.appendChildNode(t,i,n)},e.prototype.cloneNode=function(e,t){if(ys(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var n=e.ownerDocument.defaultView;if(n&&bs(e)&&(xs(e)||Ss(e))){var r=this.createElementClone(e);r.style.transitionProperty=`none`;var i=n.getComputedStyle(e),a=n.getComputedStyle(e,`:before`),o=n.getComputedStyle(e,`:after`);this.referenceElement===e&&xs(r)&&(this.clonedReferenceElement=r),Os(r)&&bc(r);var s=this.counters.parse(new ja(this.context,i)),c=this.resolvePseudoContent(e,r,a,ac.BEFORE);Rs(e)&&(t=!0),As(e)||this.cloneChildNodes(e,r,t),c&&r.insertBefore(c,r.firstChild);var l=this.resolvePseudoContent(e,r,o,ac.AFTER);return l&&r.appendChild(l),this.counters.pop(s),(i&&(this.options.copyStyles||Ss(e))&&!Ms(e)||t)&&dc(i,r),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(Fs(e)||Is(e))&&(Fs(r)||Is(r))&&(r.value=e.value),r}return e.cloneNode(!1)},e.prototype.resolvePseudoContent=function(e,t,n,r){var i=this;if(n){var a=n.content,o=t.ownerDocument;if(!(!o||!a||a===`none`||a===`-moz-alt-content`||n.display===`none`)){this.counters.parse(new ja(this.context,n));var s=new Aa(this.context,n),c=o.createElement(`html2canvaspseudoelement`);dc(n,c),s.content.forEach(function(t){if(t.type===0)c.appendChild(o.createTextNode(t.value));else if(t.type===22){var n=o.createElement(`img`);n.src=t.value,n.style.opacity=`1`,c.appendChild(n)}else if(t.type===18){if(t.name===`attr`){var r=t.values.filter(F);r.length&&c.appendChild(o.createTextNode(e.getAttribute(r[0].value)||``))}else if(t.name===`counter`){var a=t.values.filter(rr),l=a[0],u=a[1];if(l&&F(l)){var d=i.counters.getCounterValue(l.value),f=u&&F(u)?Ri.parse(i.context,u.value):3;c.appendChild(o.createTextNode(nc(d,f,!1)))}}else if(t.name===`counters`){var p=t.values.filter(rr),l=p[0],m=p[1],u=p[2];if(l&&F(l)){var h=i.counters.getCounterValues(l.value),g=u&&F(u)?Ri.parse(i.context,u.value):3,_=m&&m.type===0?m.value:``,v=h.map(function(e){return nc(e,g,!1)}).join(_);c.appendChild(o.createTextNode(v))}}}else if(t.type===20)switch(t.value){case`open-quote`:c.appendChild(o.createTextNode(wa(s.quotes,i.quoteDepth++,!0)));break;case`close-quote`:c.appendChild(o.createTextNode(wa(s.quotes,--i.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(t.value))}}),c.className=_c+` `+vc;var l=r===ac.BEFORE?` `+_c:` `+vc;return Ss(t)?t.className.baseValue+=l:t.className+=l,c}}},e.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},e}(),ac;(function(e){e[e.BEFORE=0]=`BEFORE`,e[e.AFTER=1]=`AFTER`})(ac||={});var oc=function(e,t){var n=e.createElement(`iframe`);return n.className=`html2canvas-container`,n.style.visibility=`hidden`,n.style.position=`fixed`,n.style.left=`-10000px`,n.style.top=`0px`,n.style.border=`0`,n.width=t.width.toString(),n.height=t.height.toString(),n.scrolling=`no`,n.setAttribute(rc,`true`),e.body.appendChild(n),n},sc=function(e){return new Promise(function(t){if(e.complete){t();return}if(!e.src){t();return}e.onload=t,e.onerror=t})},cc=function(e){return Promise.all([].slice.call(e.images,0).map(sc))},lc=function(e){return new Promise(function(t,n){var r=e.contentWindow;if(!r)return n(`No window assigned for iframe`);var i=r.document;r.onload=e.onload=function(){r.onload=e.onload=null;var n=setInterval(function(){i.body.childNodes.length>0&&i.readyState===`complete`&&(clearInterval(n),t(e))},50)}})},uc=[`all`,`d`,`content`],dc=function(e,t){for(var n=e.length-1;n>=0;n--){var r=e.item(n);uc.indexOf(r)===-1&&t.style.setProperty(r,e.getPropertyValue(r))}return t},fc=function(e){var t=``;return e&&(t+=``),t},pc=function(e,t,n){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||n!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,n)},mc=function(e){var t=e[0],n=e[1],r=e[2];t.scrollLeft=n,t.scrollTop=r},hc=`:before`,gc=`:after`,_c=`___html2canvas___pseudoelement_before`,vc=`___html2canvas___pseudoelement_after`,yc=`{ +import{En as e}from"./index-BWApiWDT.js";var t=e(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self,n.html2canvas=r())})(e,(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}var n=function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&a[a.length-1]))&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]=55296&&i<=56319&&n>10)+55296,a%1024+56320)),(r+1===t||n.length>16384)&&(i+=String.fromCharCode.apply(String,n),n.length=0)}return i},d=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,f=typeof Uint8Array>`u`?[]:new Uint8Array(256),p=0;p`u`?[]:new Uint8Array(256),g=0;g>4,u[i++]=(o&15)<<4|s>>2,u[i++]=(s&3)<<6|c&63;return l},v=function(e){for(var t=e.length,n=[],r=0;r>b,T=(1<>b)+32,D=65536>>x,O=(1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>b],t=(t<>b)],t=(t<>x),t=this.index[t],t+=e>>b&O,t=this.index[t],t=(t<`u`?[]:new Uint8Array(256),oe=0;oece?(i.push(!0),o-=ce):i.push(!1),[`normal`,`auto`,`loose`].indexOf(t)!==-1&&[8208,8211,12316,12448].indexOf(e)!==-1)return r.push(a),n.push(Ce);if(o===fe||o===ve){if(a===0)return r.push(a),n.push(Ie);var s=n[a-1];return rt.indexOf(s)===-1?(r.push(r[a-1]),n.push(s)):(r.push(a),n.push(Ie))}if(r.push(a),o===Le)return n.push(t===`strict`?Oe:Ue);if(o===Je||o===Fe)return n.push(Ie);if(o===Ye)return e>=131072&&e<=196605||e>=196608&&e<=262141?n.push(Ue):n.push(Ie);n.push(o)}),[r,n,i]},st=function(e,t,n,r){var i=r[n];if(Array.isArray(e)?e.indexOf(i)!==-1:e===i)for(var a=n;a<=r.length;){a++;var o=r[a];if(o===t)return!0;if(o!==_e)break}if(i===_e)for(var a=n;a>0;){a--;var s=r[a];if(Array.isArray(e)?e.indexOf(s)!==-1:e===s)for(var c=n;c<=r.length;){c++;var o=r[c];if(o===t)return!0;if(o!==_e)break}if(s!==_e)break}return!1},ct=function(e,t){for(var n=e;n>=0;){var r=t[n];if(r===_e)n--;else return r}return 0},lt=function(e,t,n,r,i){if(n[r]===0)return A;var a=r-1;if(Array.isArray(i)&&i[a]===!0)return A;var o=a-1,s=a+1,c=t[a],l=o>=0?t[o]:0,u=t[s];if(c===ue&&u===de)return A;if(et.indexOf(c)!==-1)return Ze;if(et.indexOf(u)!==-1||tt.indexOf(u)!==-1)return A;if(ct(a,t)===he)return Qe;if($e.get(e[a])===ve||(c===Re||c===ze)&&$e.get(e[s])===ve||c===me||u===me||c===ge||[_e,be,Se].indexOf(c)===-1&&u===ge||[we,Te,Ee,je,Pe].indexOf(u)!==-1||ct(a,t)===ke||st(Ae,ke,a,t)||st([we,Te],Oe,a,t)||st(ye,ye,a,t))return A;if(c===_e)return Qe;if(c===Ae||u===Ae)return A;if(u===Ce||c===Ce)return Qe;if([be,Se,Oe].indexOf(u)!==-1||c===xe||l===He&&at.indexOf(c)!==-1||c===Pe&&u===He||u===De||j.indexOf(u)!==-1&&c===k||j.indexOf(c)!==-1&&u===k||c===Ne&&[Ue,Re,ze].indexOf(u)!==-1||[Ue,Re,ze].indexOf(c)!==-1&&u===Me||j.indexOf(c)!==-1&&nt.indexOf(u)!==-1||nt.indexOf(c)!==-1&&j.indexOf(u)!==-1||[Ne,Me].indexOf(c)!==-1&&(u===k||[ke,Se].indexOf(u)!==-1&&t[s+1]===k)||[ke,Se].indexOf(c)!==-1&&u===k||c===k&&[k,Pe,je].indexOf(u)!==-1)return A;if([k,Pe,je,we,Te].indexOf(u)!==-1)for(var d=a;d>=0;){var f=t[d];if(f===k)return A;if([Pe,je].indexOf(f)!==-1)d--;else break}if([Ne,Me].indexOf(u)!==-1)for(var d=[we,Te].indexOf(c)===-1?a:o;d>=0;){var f=t[d];if(f===k)return A;if([Pe,je].indexOf(f)!==-1)d--;else break}if(We===c&&[We,Ge,Be,Ve].indexOf(u)!==-1||[Ge,Be].indexOf(c)!==-1&&[Ge,Ke].indexOf(u)!==-1||[Ke,Ve].indexOf(c)!==-1&&u===Ke||it.indexOf(c)!==-1&&[De,Me].indexOf(u)!==-1||it.indexOf(u)!==-1&&c===Ne||j.indexOf(c)!==-1&&j.indexOf(u)!==-1||c===je&&j.indexOf(u)!==-1||j.concat(k).indexOf(c)!==-1&&u===ke&&Xe.indexOf(e[s])===-1||j.concat(k).indexOf(u)!==-1&&c===Te)return A;if(c===qe&&u===qe){for(var p=n[a],m=1;p>0&&(p--,t[p]===qe);)m++;if(m%2!=0)return A}return c===Re&&u===ze?A:Qe},ut=function(e,t){t||={lineBreak:`normal`,wordBreak:`normal`};var n=ot(e,t.lineBreak),r=n[0],i=n[1],a=n[2];(t.wordBreak===`break-all`||t.wordBreak===`break-word`)&&(i=i.map(function(e){return[k,Ie,Je].indexOf(e)===-1?e:Ue}));var o=t.wordBreak===`keep-all`?a.map(function(t,n){return t&&e[n]>=19968&&e[n]<=40959}):void 0;return[r,i,o]},dt=function(){function e(e,t,n,r){this.codePoints=e,this.required=t===Ze,this.start=n,this.end=r}return e.prototype.slice=function(){return u.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),ft=function(e,t){var n=l(e),r=ut(n,t),i=r[0],a=r[1],o=r[2],s=n.length,c=0,u=0;return{next:function(){if(u>=s)return{done:!0,value:null};for(var e=A;u=rn&&e<=57},hn=function(e){return e>=55296&&e<=57343},gn=function(e){return P(e)||e>=un&&e<=fn||e>=an&&e<=sn},_n=function(e){return e>=an&&e<=ln},vn=function(e){return e>=un&&e<=mn},yn=function(e){return _n(e)||vn(e)},bn=function(e){return e>=Ut},xn=function(e){return e===_t||e===bt||e===xt},Sn=function(e){return yn(e)||bn(e)||e===At},Cn=function(e){return Sn(e)||P(e)||e===M},wn=function(e){return e>=Zt&&e<=Qt||e===$t||e>=en&&e<=tn||e===nn},Tn=function(e,t){return e===yt?t!==_t:!1},En=function(e,t,n){return e===M?Sn(t)||Tn(t,n):Sn(e)?!0:!!(e===yt&&Tn(e,t))},Dn=function(e,t,n){return e===Kt||e===M?P(t)?!0:t===Xt&&P(n):P(e===Xt?t:e)},On=function(e){var t=0,n=1;(e[t]===Kt||e[t]===M)&&(e[t]===M&&(n=-1),t++);for(var r=[];P(e[t]);)r.push(e[t++]);var i=r.length?parseInt(u.apply(void 0,r),10):0;e[t]===Xt&&t++;for(var a=[];P(e[t]);)a.push(e[t++]);var o=a.length,s=o?parseInt(u.apply(void 0,a),10):0;(e[t]===dn||e[t]===on)&&t++;var c=1;(e[t]===Kt||e[t]===M)&&(e[t]===M&&(c=-1),t++);for(var l=[];P(e[t]);)l.push(e[t++]);var d=l.length?parseInt(u.apply(void 0,l),10):0;return n*(i+s*10**-o)*10**(c*d)},kn={type:2},An={type:3},jn={type:4},Mn={type:13},Nn={type:8},Pn={type:21},Fn={type:9},In={type:10},Ln={type:11},Rn={type:12},zn={type:14},Bn={type:23},Vn={type:1},Hn={type:25},Un={type:24},Wn={type:26},Gn={type:27},Kn={type:28},qn={type:29},Jn={type:31},Yn={type:32},Xn=function(){function e(){this._value=[]}return e.prototype.write=function(e){this._value=this._value.concat(l(e))},e.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==Yn;)e.push(t),t=this.consumeToken();return e},e.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case St:return this.consumeStringToken(St);case wt:var t=this.peekCodePoint(0),n=this.peekCodePoint(1),r=this.peekCodePoint(2);if(Cn(t)||Tn(n,r)){var i=En(t,n,r)?mt:pt,a=this.consumeName();return{type:5,value:a,flags:i}}break;case Tt:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),Mn;break;case Dt:return this.consumeStringToken(Dt);case Ot:return kn;case kt:return An;case Gt:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),zn;break;case Kt:if(Dn(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case qt:return jn;case M:var o=e,s=this.peekCodePoint(0),c=this.peekCodePoint(1);if(Dn(o,s,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(En(o,s,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(s===M&&c===Nt)return this.consumeCodePoint(),this.consumeCodePoint(),Un;break;case Xt:if(Dn(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case vt:if(this.peekCodePoint(0)===Gt)for(this.consumeCodePoint();;){var l=this.consumeCodePoint();if(l===Gt&&(l=this.consumeCodePoint(),l===vt)||l===N)return this.consumeToken()}break;case Jt:return Wn;case Yt:return Gn;case Mt:if(this.peekCodePoint(0)===jt&&this.peekCodePoint(1)===M&&this.peekCodePoint(2)===M)return this.consumeCodePoint(),this.consumeCodePoint(),Hn;break;case Pt:if(En(this.peekCodePoint(0),this.peekCodePoint(1),this.peekCodePoint(2))){var a=this.consumeName();return{type:7,value:a}}break;case Ft:return Kn;case yt:if(Tn(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case It:return qn;case Lt:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),Nn;break;case Rt:return Ln;case Bt:return Rn;case cn:case pn:var d=this.peekCodePoint(0),f=this.peekCodePoint(1);return d===Kt&&(gn(f)||f===zt)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case Vt:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),Fn;if(this.peekCodePoint(0)===Vt)return this.consumeCodePoint(),Pn;break;case Ht:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),In;break;case N:return Yn}return xn(e)?(this.consumeWhiteSpace(),Jn):P(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):Sn(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:u(e)}},e.prototype.consumeCodePoint=function(){var e=this._value.shift();return e===void 0?-1:e},e.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},e.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},e.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();gn(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var n=!1;t===zt&&e.length<6;)e.push(t),t=this.consumeCodePoint(),n=!0;if(n){var r=parseInt(u.apply(void 0,e.map(function(e){return e===zt?rn:e})),16),i=parseInt(u.apply(void 0,e.map(function(e){return e===zt?fn:e})),16);return{type:30,start:r,end:i}}var a=parseInt(u.apply(void 0,e),16);if(this.peekCodePoint(0)===M&&gn(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];gn(t)&&o.length<6;)o.push(t),t=this.consumeCodePoint();var i=parseInt(u.apply(void 0,o),16);return{type:30,start:a,end:i}}else return{type:30,start:a,end:a}},e.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()===`url`&&this.peekCodePoint(0)===Ot?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===Ot?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},e.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===N)return{type:22,value:``};var t=this.peekCodePoint(0);if(t===Dt||t===St){var n=this.consumeStringToken(this.consumeCodePoint());return n.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===N||this.peekCodePoint(0)===kt)?(this.consumeCodePoint(),{type:22,value:n.value}):(this.consumeBadUrlRemnants(),Bn)}for(;;){var r=this.consumeCodePoint();if(r===N||r===kt)return{type:22,value:u.apply(void 0,e)};if(xn(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===N||this.peekCodePoint(0)===kt?(this.consumeCodePoint(),{type:22,value:u.apply(void 0,e)}):(this.consumeBadUrlRemnants(),Bn);if(r===St||r===Dt||r===Ot||wn(r))return this.consumeBadUrlRemnants(),Bn;if(r===yt)if(Tn(r,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),Bn;else e.push(r)}},e.prototype.consumeWhiteSpace=function(){for(;xn(this.peekCodePoint(0));)this.consumeCodePoint()},e.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===kt||e===N)return;Tn(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},e.prototype.consumeStringSlice=function(e){for(var t=5e4,n=``;e>0;){var r=Math.min(t,e);n+=u.apply(void 0,this._value.splice(0,r)),e-=r}return this._value.shift(),n},e.prototype.consumeStringToken=function(e){var t=``,n=0;do{var r=this._value[n];if(r===N||r===void 0||r===e)return t+=this.consumeStringSlice(n),{type:0,value:t};if(r===_t)return this._value.splice(0,n),Vn;if(r===yt){var i=this._value[n+1];i!==N&&i!==void 0&&(i===_t?(t+=this.consumeStringSlice(n),n=-1,this._value.shift()):Tn(r,i)&&(t+=this.consumeStringSlice(n),t+=u(this.consumeEscapedCodePoint()),n=-1))}n++}while(!0)},e.prototype.consumeNumber=function(){var e=[],t=ht,n=this.peekCodePoint(0);for((n===Kt||n===M)&&e.push(this.consumeCodePoint());P(this.peekCodePoint(0));)e.push(this.consumeCodePoint());n=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(n===Xt&&P(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=gt;P(this.peekCodePoint(0));)e.push(this.consumeCodePoint());n=this.peekCodePoint(0),r=this.peekCodePoint(1);var i=this.peekCodePoint(2);if((n===dn||n===on)&&((r===Kt||r===M)&&P(i)||P(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=gt;P(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[On(e),t]},e.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],n=e[1],r=this.peekCodePoint(0);return En(r,this.peekCodePoint(1),this.peekCodePoint(2))?{type:15,number:t,flags:n,unit:this.consumeName()}:r===Et?(this.consumeCodePoint(),{type:16,number:t,flags:n}):{type:17,number:t,flags:n}},e.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(gn(e)){for(var t=u(e);gn(this.peekCodePoint(0))&&t.length<6;)t+=u(this.consumeCodePoint());xn(this.peekCodePoint(0))&&this.consumeCodePoint();var n=parseInt(t,16);return n===0||hn(n)||n>1114111?Wt:n}return e===N?Wt:e},e.prototype.consumeName=function(){for(var e=``;;){var t=this.consumeCodePoint();if(Cn(t))e+=u(t);else if(Tn(t,this.peekCodePoint(0)))e+=u(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},e}(),Zn=function(){function e(e){this._tokens=e}return e.create=function(t){var n=new Xn;return n.write(t),new e(n.read())},e.parseValue=function(t){return e.create(t).parseComponentValue()},e.parseValues=function(t){return e.create(t).parseComponentValues()},e.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw SyntaxError(`Error parsing CSS component value, unexpected EOF`);this.reconsumeToken(e);var t=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return t;throw SyntaxError(`Error parsing CSS component value, multiple values found when expecting only one`)},e.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},e.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},e.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},n=this.consumeToken();;){if(n.type===32||ir(n,e))return t;this.reconsumeToken(n),t.values.push(this.consumeComponentValue()),n=this.consumeToken()}},e.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var n=this.consumeToken();if(n.type===32||n.type===3)return t;this.reconsumeToken(n),t.values.push(this.consumeComponentValue())}},e.prototype.consumeToken=function(){var e=this._tokens.shift();return e===void 0?Yn:e},e.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},e}(),Qn=function(e){return e.type===15},$n=function(e){return e.type===17},F=function(e){return e.type===20},er=function(e){return e.type===0},tr=function(e,t){return F(e)&&e.value===t},nr=function(e){return e.type!==31},rr=function(e){return e.type!==31&&e.type!==4},I=function(e){var t=[],n=[];return e.forEach(function(e){if(e.type===4){if(n.length===0)throw Error(`Error parsing function args, zero tokens for arg`);t.push(n),n=[];return}e.type!==31&&n.push(e)}),n.length&&t.push(n),t},ir=function(e,t){return t===11&&e.type===12||t===28&&e.type===29?!0:t===2&&e.type===3},ar=function(e){return e.type===17||e.type===15},L=function(e){return e.type===16||ar(e)},or=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},R={type:17,number:0,flags:ht},sr={type:16,number:50,flags:ht},cr={type:16,number:100,flags:ht},lr=function(e,t,n){var r=e[0],i=e[1];return[z(r,t),z(i===void 0?r:i,n)]},z=function(e,t){if(e.type===16)return e.number/100*t;if(Qn(e))switch(e.unit){case`rem`:case`em`:return 16*e.number;case`px`:default:return e.number}return e.number},ur=`deg`,dr=`grad`,fr=`rad`,pr=`turn`,mr={name:`angle`,parse:function(e,t){if(t.type===15)switch(t.unit){case ur:return Math.PI*t.number/180;case dr:return Math.PI/200*t.number;case fr:return t.number;case pr:return Math.PI*2*t.number}throw Error(`Unsupported angle type`)}},hr=function(e){return e.type===15&&(e.unit===ur||e.unit===dr||e.unit===fr||e.unit===pr)},gr=function(e){switch(e.filter(F).map(function(e){return e.value}).join(` `)){case`to bottom right`:case`to right bottom`:case`left top`:case`top left`:return[R,R];case`to top`:case`bottom`:return B(0);case`to bottom left`:case`to left bottom`:case`right top`:case`top right`:return[R,cr];case`to right`:case`left`:return B(90);case`to top left`:case`to left top`:case`right bottom`:case`bottom right`:return[cr,cr];case`to bottom`:case`top`:return B(180);case`to top right`:case`to right top`:case`left bottom`:case`bottom left`:return[cr,R];case`to left`:case`right`:return B(270)}return 0},B=function(e){return Math.PI*e/180},_r={name:`color`,parse:function(e,t){if(t.type===18){var n=wr[t.name];if(n===void 0)throw Error(`Attempting to parse an unsupported color function "`+t.name+`"`);return n(e,t.values)}if(t.type===5){if(t.value.length===3){var r=t.value.substring(0,1),i=t.value.substring(1,2),a=t.value.substring(2,3);return yr(parseInt(r+r,16),parseInt(i+i,16),parseInt(a+a,16),1)}if(t.value.length===4){var r=t.value.substring(0,1),i=t.value.substring(1,2),a=t.value.substring(2,3),o=t.value.substring(3,4);return yr(parseInt(r+r,16),parseInt(i+i,16),parseInt(a+a,16),parseInt(o+o,16)/255)}if(t.value.length===6){var r=t.value.substring(0,2),i=t.value.substring(2,4),a=t.value.substring(4,6);return yr(parseInt(r,16),parseInt(i,16),parseInt(a,16),1)}if(t.value.length===8){var r=t.value.substring(0,2),i=t.value.substring(2,4),a=t.value.substring(4,6),o=t.value.substring(6,8);return yr(parseInt(r,16),parseInt(i,16),parseInt(a,16),parseInt(o,16)/255)}}if(t.type===20){var s=H[t.value.toUpperCase()];if(s!==void 0)return s}return H.TRANSPARENT}},vr=function(e){return(255&e)==0},V=function(e){var t=255&e,n=255&e>>8,r=255&e>>16,i=255&e>>24;return t<255?`rgba(`+i+`,`+r+`,`+n+`,`+t/255+`)`:`rgb(`+i+`,`+r+`,`+n+`)`},yr=function(e,t,n,r){return(e<<24|t<<16|n<<8|Math.round(r*255)<<0)>>>0},br=function(e,t){if(e.type===17)return e.number;if(e.type===16){var n=t===3?1:255;return t===3?e.number/100*n:Math.round(e.number/100*n)}return 0},xr=function(e,t){var n=t.filter(rr);if(n.length===3){var r=n.map(br),i=r[0],a=r[1],o=r[2];return yr(i,a,o,1)}if(n.length===4){var s=n.map(br),i=s[0],a=s[1],o=s[2],c=s[3];return yr(i,a,o,c)}return 0};function Sr(e,t,n){return n<0&&(n+=1),n>=1&&--n,n<1/6?(t-e)*n*6+e:n<1/2?t:n<2/3?(t-e)*6*(2/3-n)+e:e}var Cr=function(e,t){var n=t.filter(rr),r=n[0],i=n[1],a=n[2],o=n[3],s=(r.type===17?B(r.number):mr.parse(e,r))/(Math.PI*2),c=L(i)?i.number/100:0,l=L(a)?a.number/100:0,u=o!==void 0&&L(o)?z(o,1):1;if(c===0)return yr(l*255,l*255,l*255,1);var d=l<=.5?l*(c+1):l+c-l*c,f=l*2-d,p=Sr(f,d,s+1/3),m=Sr(f,d,s),h=Sr(f,d,s-1/3);return yr(p*255,m*255,h*255,u)},wr={hsl:Cr,hsla:Cr,rgb:xr,rgba:xr},Tr=function(e,t){return _r.parse(e,Zn.create(t).parseComponentValue())},H={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},Er={name:`background-clip`,initialValue:`border-box`,prefix:!1,type:1,parse:function(e,t){return t.map(function(e){if(F(e))switch(e.value){case`padding-box`:return 1;case`content-box`:return 2}return 0})}},Dr={name:`background-color`,initialValue:`transparent`,prefix:!1,type:3,format:`color`},Or=function(e,t){var n=_r.parse(e,t[0]),r=t[1];return r&&L(r)?{color:n,stop:r}:{color:n,stop:null}},kr=function(e,t){var n=e[0],r=e[e.length-1];n.stop===null&&(n.stop=R),r.stop===null&&(r.stop=cr);for(var i=[],a=0,o=0;oa?i.push(c):i.push(a),a=c}else i.push(null)}for(var l=null,o=0;oe.optimumDistance)?{optimumCorner:t,optimumDistance:s}:e},{optimumDistance:i?1/0:-1/0,optimumCorner:null}).optimumCorner},Nr=function(e,t,n,r,i){var a=0,o=0;switch(e.size){case 0:e.shape===0?a=o=Math.min(Math.abs(t),Math.abs(t-r),Math.abs(n),Math.abs(n-i)):e.shape===1&&(a=Math.min(Math.abs(t),Math.abs(t-r)),o=Math.min(Math.abs(n),Math.abs(n-i)));break;case 2:if(e.shape===0)a=o=Math.min(U(t,n),U(t,n-i),U(t-r,n),U(t-r,n-i));else if(e.shape===1){var s=Math.min(Math.abs(n),Math.abs(n-i))/Math.min(Math.abs(t),Math.abs(t-r)),c=Mr(r,i,t,n,!0),l=c[0],u=c[1];a=U(l-t,(u-n)/s),o=s*a}break;case 1:e.shape===0?a=o=Math.max(Math.abs(t),Math.abs(t-r),Math.abs(n),Math.abs(n-i)):e.shape===1&&(a=Math.max(Math.abs(t),Math.abs(t-r)),o=Math.max(Math.abs(n),Math.abs(n-i)));break;case 3:if(e.shape===0)a=o=Math.max(U(t,n),U(t,n-i),U(t-r,n),U(t-r,n-i));else if(e.shape===1){var s=Math.max(Math.abs(n),Math.abs(n-i))/Math.max(Math.abs(t),Math.abs(t-r)),d=Mr(r,i,t,n,!1),l=d[0],u=d[1];a=U(l-t,(u-n)/s),o=s*a}break}return Array.isArray(e.size)&&(a=z(e.size[0],r),o=e.size.length===2?z(e.size[1],i):a),[a,o]},Pr=function(e,t){var n=B(180),r=[];return I(t).forEach(function(t,i){if(i===0){var a=t[0];if(a.type===20&&a.value===`to`){n=gr(t);return}else if(hr(a)){n=mr.parse(e,a);return}}var o=Or(e,t);r.push(o)}),{angle:n,stops:r,type:1}},Fr=function(e,t){var n=B(180),r=[];return I(t).forEach(function(t,i){if(i===0){var a=t[0];if(a.type===20&&[`top`,`left`,`right`,`bottom`].indexOf(a.value)!==-1){n=gr(t);return}else if(hr(a)){n=(mr.parse(e,a)+B(270))%B(360);return}}var o=Or(e,t);r.push(o)}),{angle:n,stops:r,type:1}},Ir=function(e,t){var n=B(180),r=[],i=1;return I(t).forEach(function(t,n){var a=t[0];if(n===0){if(F(a)&&a.value===`linear`){i=1;return}else if(F(a)&&a.value===`radial`){i=2;return}}if(a.type===18){if(a.name===`from`){var o=_r.parse(e,a.values[0]);r.push({stop:R,color:o})}else if(a.name===`to`){var o=_r.parse(e,a.values[0]);r.push({stop:cr,color:o})}else if(a.name===`color-stop`){var s=a.values.filter(rr);if(s.length===2){var o=_r.parse(e,s[1]),c=s[0];$n(c)&&r.push({stop:{type:16,number:c.number*100,flags:c.flags},color:o})}}}}),i===1?{angle:(n+B(180))%B(360),stops:r,type:i}:{size:3,shape:0,stops:r,position:[],type:i}},Lr=`closest-side`,Rr=`farthest-side`,zr=`closest-corner`,Br=`farthest-corner`,Vr=`circle`,Hr=`ellipse`,Ur=`cover`,Wr=`contain`,Gr=function(e,t){var n=0,r=3,i=[],a=[];return I(t).forEach(function(t,o){var s=!0;if(o===0){var c=!1;s=t.reduce(function(e,t){if(c)if(F(t))switch(t.value){case`center`:return a.push(sr),e;case`top`:case`left`:return a.push(R),e;case`right`:case`bottom`:return a.push(cr),e}else (L(t)||ar(t))&&a.push(t);else if(F(t))switch(t.value){case Vr:return n=0,!1;case Hr:return n=1,!1;case`at`:return c=!0,!1;case Lr:return r=0,!1;case Ur:case Rr:return r=1,!1;case Wr:case zr:return r=2,!1;case Br:return r=3,!1}else if(ar(t)||L(t))return Array.isArray(r)||(r=[]),r.push(t),!1;return e},s)}if(s){var l=Or(e,t);i.push(l)}}),{size:r,shape:n,stops:i,position:a,type:2}},Kr=function(e,t){var n=0,r=3,i=[],a=[];return I(t).forEach(function(t,o){var s=!0;if(o===0?s=t.reduce(function(e,t){if(F(t))switch(t.value){case`center`:return a.push(sr),!1;case`top`:case`left`:return a.push(R),!1;case`right`:case`bottom`:return a.push(cr),!1}else if(L(t)||ar(t))return a.push(t),!1;return e},s):o===1&&(s=t.reduce(function(e,t){if(F(t))switch(t.value){case Vr:return n=0,!1;case Hr:return n=1,!1;case Wr:case Lr:return r=0,!1;case Rr:return r=1,!1;case zr:return r=2,!1;case Ur:case Br:return r=3,!1}else if(ar(t)||L(t))return Array.isArray(r)||(r=[]),r.push(t),!1;return e},s)),s){var c=Or(e,t);i.push(c)}}),{size:r,shape:n,stops:i,position:a,type:2}},qr=function(e){return e.type===1},Jr=function(e){return e.type===2},Yr={name:`image`,parse:function(e,t){if(t.type===22){var n={url:t.value,type:0};return e.cache.addImage(t.value),n}if(t.type===18){var r=Zr[t.name];if(r===void 0)throw Error(`Attempting to parse an unsupported image function "`+t.name+`"`);return r(e,t.values)}throw Error(`Unsupported image type `+t.type)}};function Xr(e){return!(e.type===20&&e.value===`none`)&&(e.type!==18||!!Zr[e.name])}var Zr={"linear-gradient":Pr,"-moz-linear-gradient":Fr,"-ms-linear-gradient":Fr,"-o-linear-gradient":Fr,"-webkit-linear-gradient":Fr,"radial-gradient":Gr,"-moz-radial-gradient":Kr,"-ms-radial-gradient":Kr,"-o-radial-gradient":Kr,"-webkit-radial-gradient":Kr,"-webkit-gradient":Ir},Qr={name:`background-image`,initialValue:`none`,type:1,prefix:!1,parse:function(e,t){if(t.length===0)return[];var n=t[0];return n.type===20&&n.value===`none`?[]:t.filter(function(e){return rr(e)&&Xr(e)}).map(function(t){return Yr.parse(e,t)})}},$r={name:`background-origin`,initialValue:`border-box`,prefix:!1,type:1,parse:function(e,t){return t.map(function(e){if(F(e))switch(e.value){case`padding-box`:return 1;case`content-box`:return 2}return 0})}},ei={name:`background-position`,initialValue:`0% 0%`,type:1,prefix:!1,parse:function(e,t){return I(t).map(function(e){return e.filter(L)}).map(or)}},ti={name:`background-repeat`,initialValue:`repeat`,prefix:!1,type:1,parse:function(e,t){return I(t).map(function(e){return e.filter(F).map(function(e){return e.value}).join(` `)}).map(ni)}},ni=function(e){switch(e){case`no-repeat`:return 1;case`repeat-x`:case`repeat no-repeat`:return 2;case`repeat-y`:case`no-repeat repeat`:return 3;case`repeat`:default:return 0}},ri;(function(e){e.AUTO=`auto`,e.CONTAIN=`contain`,e.COVER=`cover`})(ri||={});var ii={name:`background-size`,initialValue:`0`,prefix:!1,type:1,parse:function(e,t){return I(t).map(function(e){return e.filter(ai)})}},ai=function(e){return F(e)||L(e)},oi=function(e){return{name:`border-`+e+`-color`,initialValue:`transparent`,prefix:!1,type:3,format:`color`}},si=oi(`top`),ci=oi(`right`),li=oi(`bottom`),ui=oi(`left`),di=function(e){return{name:`border-radius-`+e,initialValue:`0 0`,prefix:!1,type:1,parse:function(e,t){return or(t.filter(L))}}},fi=di(`top-left`),pi=di(`top-right`),mi=di(`bottom-right`),hi=di(`bottom-left`),gi=function(e){return{name:`border-`+e+`-style`,initialValue:`solid`,prefix:!1,type:2,parse:function(e,t){switch(t){case`none`:return 0;case`dashed`:return 2;case`dotted`:return 3;case`double`:return 4}return 1}}},_i=gi(`top`),vi=gi(`right`),yi=gi(`bottom`),bi=gi(`left`),xi=function(e){return{name:`border-`+e+`-width`,initialValue:`0`,type:0,prefix:!1,parse:function(e,t){return Qn(t)?t.number:0}}},Si=xi(`top`),Ci=xi(`right`),wi=xi(`bottom`),Ti=xi(`left`),Ei={name:`color`,initialValue:`transparent`,prefix:!1,type:3,format:`color`},Di={name:`direction`,initialValue:`ltr`,prefix:!1,type:2,parse:function(e,t){switch(t){case`rtl`:return 1;case`ltr`:default:return 0}}},Oi={name:`display`,initialValue:`inline-block`,prefix:!1,type:1,parse:function(e,t){return t.filter(F).reduce(function(e,t){return e|ki(t.value)},0)}},ki=function(e){switch(e){case`block`:case`-webkit-box`:return 2;case`inline`:return 4;case`run-in`:return 8;case`flow`:return 16;case`flow-root`:return 32;case`table`:return 64;case`flex`:case`-webkit-flex`:return 128;case`grid`:case`-ms-grid`:return 256;case`ruby`:return 512;case`subgrid`:return 1024;case`list-item`:return 2048;case`table-row-group`:return 4096;case`table-header-group`:return 8192;case`table-footer-group`:return 16384;case`table-row`:return 32768;case`table-cell`:return 65536;case`table-column-group`:return 131072;case`table-column`:return 262144;case`table-caption`:return 524288;case`ruby-base`:return 1048576;case`ruby-text`:return 2097152;case`ruby-base-container`:return 4194304;case`ruby-text-container`:return 8388608;case`contents`:return 16777216;case`inline-block`:return 33554432;case`inline-list-item`:return 67108864;case`inline-table`:return 134217728;case`inline-flex`:return 268435456;case`inline-grid`:return 536870912}return 0},Ai={name:`float`,initialValue:`none`,prefix:!1,type:2,parse:function(e,t){switch(t){case`left`:return 1;case`right`:return 2;case`inline-start`:return 3;case`inline-end`:return 4}return 0}},ji={name:`letter-spacing`,initialValue:`0`,prefix:!1,type:0,parse:function(e,t){return t.type===20&&t.value===`normal`?0:t.type===17||t.type===15?t.number:0}},Mi;(function(e){e.NORMAL=`normal`,e.STRICT=`strict`})(Mi||={});var Ni={name:`line-break`,initialValue:`normal`,prefix:!1,type:2,parse:function(e,t){switch(t){case`strict`:return Mi.STRICT;case`normal`:default:return Mi.NORMAL}}},Pi={name:`line-height`,initialValue:`normal`,prefix:!1,type:4},Fi=function(e,t){return F(e)&&e.value===`normal`?1.2*t:e.type===17?t*e.number:L(e)?z(e,t):t},Ii={name:`list-style-image`,initialValue:`none`,type:0,prefix:!1,parse:function(e,t){return t.type===20&&t.value===`none`?null:Yr.parse(e,t)}},Li={name:`list-style-position`,initialValue:`outside`,prefix:!1,type:2,parse:function(e,t){switch(t){case`inside`:return 0;case`outside`:default:return 1}}},Ri={name:`list-style-type`,initialValue:`none`,prefix:!1,type:2,parse:function(e,t){switch(t){case`disc`:return 0;case`circle`:return 1;case`square`:return 2;case`decimal`:return 3;case`cjk-decimal`:return 4;case`decimal-leading-zero`:return 5;case`lower-roman`:return 6;case`upper-roman`:return 7;case`lower-greek`:return 8;case`lower-alpha`:return 9;case`upper-alpha`:return 10;case`arabic-indic`:return 11;case`armenian`:return 12;case`bengali`:return 13;case`cambodian`:return 14;case`cjk-earthly-branch`:return 15;case`cjk-heavenly-stem`:return 16;case`cjk-ideographic`:return 17;case`devanagari`:return 18;case`ethiopic-numeric`:return 19;case`georgian`:return 20;case`gujarati`:return 21;case`gurmukhi`:return 22;case`hebrew`:return 22;case`hiragana`:return 23;case`hiragana-iroha`:return 24;case`japanese-formal`:return 25;case`japanese-informal`:return 26;case`kannada`:return 27;case`katakana`:return 28;case`katakana-iroha`:return 29;case`khmer`:return 30;case`korean-hangul-formal`:return 31;case`korean-hanja-formal`:return 32;case`korean-hanja-informal`:return 33;case`lao`:return 34;case`lower-armenian`:return 35;case`malayalam`:return 36;case`mongolian`:return 37;case`myanmar`:return 38;case`oriya`:return 39;case`persian`:return 40;case`simp-chinese-formal`:return 41;case`simp-chinese-informal`:return 42;case`tamil`:return 43;case`telugu`:return 44;case`thai`:return 45;case`tibetan`:return 46;case`trad-chinese-formal`:return 47;case`trad-chinese-informal`:return 48;case`upper-armenian`:return 49;case`disclosure-open`:return 50;case`disclosure-closed`:return 51;case`none`:default:return-1}}},zi=function(e){return{name:`margin-`+e,initialValue:`0`,prefix:!1,type:4}},Bi=zi(`top`),Vi=zi(`right`),Hi=zi(`bottom`),Ui=zi(`left`),Wi={name:`overflow`,initialValue:`visible`,prefix:!1,type:1,parse:function(e,t){return t.filter(F).map(function(e){switch(e.value){case`hidden`:return 1;case`scroll`:return 2;case`clip`:return 3;case`auto`:return 4;case`visible`:default:return 0}})}},Gi={name:`overflow-wrap`,initialValue:`normal`,prefix:!1,type:2,parse:function(e,t){switch(t){case`break-word`:return`break-word`;case`normal`:default:return`normal`}}},Ki=function(e){return{name:`padding-`+e,initialValue:`0`,prefix:!1,type:3,format:`length-percentage`}},qi=Ki(`top`),Ji=Ki(`right`),Yi=Ki(`bottom`),Xi=Ki(`left`),Zi={name:`text-align`,initialValue:`left`,prefix:!1,type:2,parse:function(e,t){switch(t){case`right`:return 2;case`center`:case`justify`:return 1;case`left`:default:return 0}}},Qi={name:`position`,initialValue:`static`,prefix:!1,type:2,parse:function(e,t){switch(t){case`relative`:return 1;case`absolute`:return 2;case`fixed`:return 3;case`sticky`:return 4}return 0}},$i={name:`text-shadow`,initialValue:`none`,type:1,prefix:!1,parse:function(e,t){return t.length===1&&tr(t[0],`none`)?[]:I(t).map(function(t){for(var n={color:H.TRANSPARENT,offsetX:R,offsetY:R,blur:R},r=0,i=0;i1?1:0],this.overflowWrap=G(e,Gi,t.overflowWrap),this.paddingTop=G(e,qi,t.paddingTop),this.paddingRight=G(e,Ji,t.paddingRight),this.paddingBottom=G(e,Yi,t.paddingBottom),this.paddingLeft=G(e,Xi,t.paddingLeft),this.paintOrder=G(e,Ea,t.paintOrder),this.position=G(e,Qi,t.position),this.textAlign=G(e,Zi,t.textAlign),this.textDecorationColor=G(e,fa,t.textDecorationColor??t.color),this.textDecorationLine=G(e,pa,t.textDecorationLine??t.textDecoration),this.textShadow=G(e,$i,t.textShadow),this.textTransform=G(e,ea,t.textTransform),this.transform=G(e,ta,t.transform),this.transformOrigin=G(e,aa,t.transformOrigin),this.visibility=G(e,oa,t.visibility),this.webkitTextStrokeColor=G(e,Da,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=G(e,Oa,t.webkitTextStrokeWidth),this.wordBreak=G(e,ca,t.wordBreak),this.zIndex=G(e,la,t.zIndex)}return e.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},e.prototype.isTransparent=function(){return vr(this.backgroundColor)},e.prototype.isTransformed=function(){return this.transform!==null},e.prototype.isPositioned=function(){return this.position!==0},e.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},e.prototype.isFloating=function(){return this.float!==0},e.prototype.isInlineLevel=function(){return W(this.display,4)||W(this.display,33554432)||W(this.display,268435456)||W(this.display,536870912)||W(this.display,67108864)||W(this.display,134217728)},e}(),Aa=function(){function e(e,t){this.content=G(e,ya,t.content),this.quotes=G(e,Ca,t.quotes)}return e}(),ja=function(){function e(e,t){this.counterIncrement=G(e,ba,t.counterIncrement),this.counterReset=G(e,xa,t.counterReset)}return e}(),G=function(e,t,n){var r=new Xn,i=n==null?t.initialValue:n.toString();r.write(i);var a=new Zn(r.read());switch(t.type){case 2:var o=a.parseComponentValue();return t.parse(e,F(o)?o.value:t.initialValue);case 0:return t.parse(e,a.parseComponentValue());case 1:return t.parse(e,a.parseComponentValues());case 4:return a.parseComponentValue();case 3:switch(t.format){case`angle`:return mr.parse(e,a.parseComponentValue());case`color`:return _r.parse(e,a.parseComponentValue());case`image`:return Yr.parse(e,a.parseComponentValue());case`length`:var s=a.parseComponentValue();return ar(s)?s:R;case`length-percentage`:var c=a.parseComponentValue();return L(c)?c:R;case`time`:return ua.parse(e,a.parseComponentValue())}break}},Ma=`data-html2canvas-debug`,Na=function(e){switch(e.getAttribute(Ma)){case`all`:return 1;case`clone`:return 2;case`parse`:return 3;case`render`:return 4;default:return 0}},Pa=function(e,t){var n=Na(e);return n===1||t===n},K=function(){function e(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Pa(t,3))debugger;this.styles=new ka(e,window.getComputedStyle(t,null)),xs(t)&&(this.styles.animationDuration.some(function(e){return e>0})&&(t.style.animationDuration=`0s`),this.styles.transform!==null&&(t.style.transform=`none`)),this.bounds=s(this.context,t),Pa(t,4)&&(this.flags|=16)}return e}(),Fa=`AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=`,Ia=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,La=typeof Uint8Array>`u`?[]:new Uint8Array(256),Ra=0;Ra>4,u[i++]=(o&15)<<4|s>>2,u[i++]=(s&3)<<6|c&63;return l},Ba=function(e){for(var t=e.length,n=[],r=0;r>Ha,qa=(1<>Ha)+32,Ya=65536>>Ua,Xa=(1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Ha],t=(t<>Ha)],t=(t<>Ua),t=this.index[t],t+=e>>Ha&Xa,t=this.index[t],t=(t<`u`?[]:new Uint8Array(256),ro=0;ro=55296&&i<=56319&&n>10)+55296,a%1024+56320)),(r+1===t||n.length>16384)&&(i+=String.fromCharCode.apply(String,n),n.length=0)}return i},xo=$a(Fa),So=`×`,Co=`÷`,wo=function(e){return xo.get(e)},To=function(e,t,n){var r=n-2,i=t[r],a=t[n-1],o=t[n];if(a===ao&&o===oo)return So;if(a===ao||a===oo||a===so||o===ao||o===oo||o===so)return Co;if(a===uo&&[uo,fo,mo,ho].indexOf(o)!==-1||(a===mo||a===fo)&&(o===fo||o===po)||(a===ho||a===po)&&o===po||o===go||o===co||o===lo||a===io)return So;if(a===go&&o===_o){for(;i===co;)i=t[--r];if(i===_o)return So}if(a===vo&&o===vo){for(var s=0;i===vo;)s++,i=t[--r];if(s%2==0)return So}return Co},Eo=function(e){var t=yo(e),n=t.length,r=0,i=0,a=t.map(wo);return{next:function(){if(r>=n)return{done:!0,value:null};for(var e=So;ro.x||i.y>o.y;return o=i,t===0?!0:s});return e.body.removeChild(t),s},Ao=function(){return new Image().crossOrigin!==void 0},jo=function(){return typeof new XMLHttpRequest().responseType==`string`},Mo=function(e){var t=new Image,n=e.createElement(`canvas`),r=n.getContext(`2d`);if(!r)return!1;t.src=`data:image/svg+xml,`;try{r.drawImage(t,0,0),n.toDataURL()}catch{return!1}return!0},No=function(e){return e[0]===0&&e[1]===255&&e[2]===0&&e[3]===255},Po=function(e){var t=e.createElement(`canvas`),n=100;t.width=n,t.height=n;var r=t.getContext(`2d`);if(!r)return Promise.reject(!1);r.fillStyle=`rgb(0, 255, 0)`,r.fillRect(0,0,n,n);var i=new Image,a=t.toDataURL();i.src=a;var o=Fo(n,n,0,0,i);return r.fillStyle=`red`,r.fillRect(0,0,n,n),Io(o).then(function(t){r.drawImage(t,0,0);var i=r.getImageData(0,0,n,n).data;r.fillStyle=`red`,r.fillRect(0,0,n,n);var o=e.createElement(`div`);return o.style.backgroundImage=`url(`+a+`)`,o.style.height=n+`px`,No(i)?Io(Fo(n,n,0,0,o)):Promise.reject(!1)}).then(function(e){return r.drawImage(e,0,0),No(r.getImageData(0,0,n,n).data)}).catch(function(){return!1})},Fo=function(e,t,n,r,i){var a=`http://www.w3.org/2000/svg`,o=document.createElementNS(a,`svg`),s=document.createElementNS(a,`foreignObject`);return o.setAttributeNS(null,`width`,e.toString()),o.setAttributeNS(null,`height`,t.toString()),s.setAttributeNS(null,`width`,`100%`),s.setAttributeNS(null,`height`,`100%`),s.setAttributeNS(null,`x`,n.toString()),s.setAttributeNS(null,`y`,r.toString()),s.setAttributeNS(null,`externalResourcesRequired`,`true`),o.appendChild(s),s.appendChild(i),o},Io=function(e){return new Promise(function(t,n){var r=new Image;r.onload=function(){return t(r)},r.onerror=n,r.src=`data:image/svg+xml;charset=utf-8,`+encodeURIComponent(new XMLSerializer().serializeToString(e))})},q={get SUPPORT_RANGE_BOUNDS(){var e=Oo(document);return Object.defineProperty(q,`SUPPORT_RANGE_BOUNDS`,{value:e}),e},get SUPPORT_WORD_BREAKING(){var e=q.SUPPORT_RANGE_BOUNDS&&ko(document);return Object.defineProperty(q,`SUPPORT_WORD_BREAKING`,{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=Mo(document);return Object.defineProperty(q,`SUPPORT_SVG_DRAWING`,{value:e}),e},get SUPPORT_FOREIGNOBJECT_DRAWING(){var e=typeof Array.from==`function`&&typeof window.fetch==`function`?Po(document):Promise.resolve(!1);return Object.defineProperty(q,`SUPPORT_FOREIGNOBJECT_DRAWING`,{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=Ao();return Object.defineProperty(q,`SUPPORT_CORS_IMAGES`,{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e=jo();return Object.defineProperty(q,`SUPPORT_RESPONSE_TYPE`,{value:e}),e},get SUPPORT_CORS_XHR(){var e=`withCredentials`in new XMLHttpRequest;return Object.defineProperty(q,`SUPPORT_CORS_XHR`,{value:e}),e},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var e=!!(typeof Intl<`u`&&Intl.Segmenter);return Object.defineProperty(q,`SUPPORT_NATIVE_TEXT_SEGMENTATION`,{value:e}),e}},Lo=function(){function e(e,t){this.text=e,this.bounds=t}return e}(),Ro=function(e,t,n,r){var i=Uo(t,n),a=[],s=0;return i.forEach(function(t){if(n.textDecorationLine.length||t.trim().length>0)if(q.SUPPORT_RANGE_BOUNDS){var i=Bo(r,s,t.length).getClientRects();if(i.length>1){var c=Vo(t),l=0;c.forEach(function(t){a.push(new Lo(t,o.fromDOMRectList(e,Bo(r,l+s,t.length).getClientRects()))),l+=t.length})}else a.push(new Lo(t,o.fromDOMRectList(e,i)))}else{var u=r.splitText(t.length);a.push(new Lo(t,zo(e,r))),r=u}else q.SUPPORT_RANGE_BOUNDS||(r=r.splitText(t.length));s+=t.length}),a},zo=function(e,t){var n=t.ownerDocument;if(n){var r=n.createElement(`html2canvaswrapper`);r.appendChild(t.cloneNode(!0));var i=t.parentNode;if(i){i.replaceChild(r,t);var a=s(e,r);return r.firstChild&&i.replaceChild(r.firstChild,r),a}}return o.EMPTY},Bo=function(e,t,n){var r=e.ownerDocument;if(!r)throw Error(`Node has no owner document`);var i=r.createRange();return i.setStart(e,t),i.setEnd(e,t+n),i},Vo=function(e){if(q.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:`grapheme`});return Array.from(t.segment(e)).map(function(e){return e.segment})}return Do(e)},Ho=function(e,t){if(q.SUPPORT_NATIVE_TEXT_SEGMENTATION){var n=new Intl.Segmenter(void 0,{granularity:`word`});return Array.from(n.segment(e)).map(function(e){return e.segment})}return Go(e,t)},Uo=function(e,t){return t.letterSpacing===0?Ho(e,t):Vo(e)},Wo=[32,160,4961,65792,65793,4153,4241],Go=function(e,t){for(var n=ft(e,{lineBreak:t.lineBreak,wordBreak:t.overflowWrap===`break-word`?`break-word`:t.wordBreak}),r=[],i,a=function(){if(i.value){var e=l(i.value.slice()),t=``;e.forEach(function(e){Wo.indexOf(e)===-1?t+=u(e):(t.length&&r.push(t),r.push(u(e)),t=``)}),t.length&&r.push(t)}};!(i=n.next()).done;)a();return r},Ko=function(){function e(e,t,n){this.text=qo(t.data,n.textTransform),this.textBounds=Ro(e,this.text,n,t)}return e}(),qo=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(Jo,Yo);case 2:return e.toUpperCase();default:return e}},Jo=/(^|\s|:|-|\(|\))([a-z])/g,Yo=function(e,t,n){return e.length>0?t+n.toUpperCase():e},Xo=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.src=n.currentSrc||n.src,r.intrinsicWidth=n.naturalWidth,r.intrinsicHeight=n.naturalHeight,r.context.cache.addImage(r.src),r}return n}(K),Zo=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.canvas=n,r.intrinsicWidth=n.width,r.intrinsicHeight=n.height,r}return n}(K),Qo=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this,i=new XMLSerializer,a=s(t,n);return n.setAttribute(`width`,a.width+`px`),n.setAttribute(`height`,a.height+`px`),r.svg=`data:image/svg+xml,`+encodeURIComponent(i.serializeToString(n)),r.intrinsicWidth=n.width.baseVal.value,r.intrinsicHeight=n.height.baseVal.value,r.context.cache.addImage(r.svg),r}return n}(K),$o=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.value=n.value,r}return n}(K),es=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.start=n.start,r.reversed=typeof n.reversed==`boolean`&&n.reversed===!0,r}return n}(K),ts=[{type:15,flags:0,unit:`px`,number:3}],ns=[{type:16,flags:0,number:50}],rs=function(e){return e.width>e.height?new o(e.left+(e.width-e.height)/2,e.top,e.height,e.height):e.width0)n.textNodes.push(new Ko(e,i,n.styles));else if(bs(i))if(Ls(i)&&i.assignedNodes)i.assignedNodes().forEach(function(t){return ms(e,t,n,r)});else{var o=hs(e,i);o.styles.isVisible()&&(_s(i,o,r)?o.flags|=4:vs(o.styles)&&(o.flags|=2),ps.indexOf(i.tagName)!==-1&&(o.flags|=8),n.elements.push(o),i.slot,i.shadowRoot?ms(e,i.shadowRoot,o,r):!Fs(i)&&!Ds(i)&&!Is(i)&&ms(e,i,o,r))}},hs=function(e,t){return js(t)?new Xo(e,t):ks(t)?new Zo(e,t):Ds(t)?new Qo(e,t):Cs(t)?new $o(e,t):ws(t)?new es(e,t):Ts(t)?new ls(e,t):Is(t)?new us(e,t):Fs(t)?new ds(e,t):Ms(t)?new fs(e,t):new K(e,t)},gs=function(e,t){var n=hs(e,t);return n.flags|=4,ms(e,t,n,n),n},_s=function(e,t,n){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||Os(e)&&n.styles.isTransparent()},vs=function(e){return e.isPositioned()||e.isFloating()},ys=function(e){return e.nodeType===Node.TEXT_NODE},bs=function(e){return e.nodeType===Node.ELEMENT_NODE},xs=function(e){return bs(e)&&e.style!==void 0&&!Ss(e)},Ss=function(e){return typeof e.className==`object`},Cs=function(e){return e.tagName===`LI`},ws=function(e){return e.tagName===`OL`},Ts=function(e){return e.tagName===`INPUT`},Es=function(e){return e.tagName===`HTML`},Ds=function(e){return e.tagName===`svg`},Os=function(e){return e.tagName===`BODY`},ks=function(e){return e.tagName===`CANVAS`},As=function(e){return e.tagName===`VIDEO`},js=function(e){return e.tagName===`IMG`},Ms=function(e){return e.tagName===`IFRAME`},Ns=function(e){return e.tagName===`STYLE`},Ps=function(e){return e.tagName===`SCRIPT`},Fs=function(e){return e.tagName===`TEXTAREA`},Is=function(e){return e.tagName===`SELECT`},Ls=function(e){return e.tagName===`SLOT`},Rs=function(e){return e.tagName.indexOf(`-`)>0},zs=function(){function e(){this.counters={}}return e.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},e.prototype.getCounterValues=function(e){return this.counters[e]||[]},e.prototype.pop=function(e){var t=this;e.forEach(function(e){return t.counters[e].pop()})},e.prototype.parse=function(e){var t=this,n=e.counterIncrement,r=e.counterReset,i=!0;n!==null&&n.forEach(function(e){var n=t.counters[e.counter];n&&e.increment!==0&&(i=!1,n.length||n.push(1),n[Math.max(0,n.length-1)]+=e.increment)});var a=[];return i&&r.forEach(function(e){var n=t.counters[e.counter];a.push(e.counter),n||=t.counters[e.counter]=[],n.push(e.reset)}),a},e}(),Bs={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:[`M`,`CM`,`D`,`CD`,`C`,`XC`,`L`,`XL`,`X`,`IX`,`V`,`IV`,`I`]},Vs={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:`Ք.Փ.Ւ.Ց.Ր.Տ.Վ.Ս.Ռ.Ջ.Պ.Չ.Ո.Շ.Ն.Յ.Մ.Ճ.Ղ.Ձ.Հ.Կ.Ծ.Խ.Լ.Ի.Ժ.Թ.Ը.Է.Զ.Ե.Դ.Գ.Բ.Ա`.split(`.`)},Hs={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:`י׳.ט׳.ח׳.ז׳.ו׳.ה׳.ד׳.ג׳.ב׳.א׳.ת.ש.ר.ק.צ.פ.ע.ס.נ.מ.ל.כ.יט.יח.יז.טז.טו.י.ט.ח.ז.ו.ה.ד.ג.ב.א`.split(`.`)},Us={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:`ჵ.ჰ.ჯ.ჴ.ხ.ჭ.წ.ძ.ც.ჩ.შ.ყ.ღ.ქ.ფ.ჳ.ტ.ს.რ.ჟ.პ.ო.ჲ.ნ.მ.ლ.კ.ი.თ.ჱ.ზ.ვ.ე.დ.გ.ბ.ა`.split(`.`)},Ws=function(e,t,n,r,i,a){return en?nc(e,i,a.length>0):r.integers.reduce(function(t,n,i){for(;e>=n;)e-=n,t+=r.values[i];return t},``)+a},Gs=function(e,t,n,r){var i=``;do n||e--,i=r(e)+i,e/=t;while(e*t>=t);return i},J=function(e,t,n,r,i){var a=n-t+1;return(e<0?`-`:``)+(Gs(Math.abs(e),a,r,function(e){return u(Math.floor(e%a)+t)})+i)},Ks=function(e,t,n){n===void 0&&(n=`. `);var r=t.length;return Gs(Math.abs(e),r,!1,function(e){return t[Math.floor(e%r)]})+n},qs=1,Js=2,Ys=4,Xs=8,Zs=function(e,t,n,r,i,a){if(e<-9999||e>9999)return nc(e,4,i.length>0);var o=Math.abs(e),s=i;if(o===0)return t[0]+s;for(var c=0;o>0&&c<=4;c++){var l=o%10;l===0&&W(a,qs)&&s!==``?s=t[l]+s:l>1||l===1&&c===0||l===1&&c===1&&W(a,Js)||l===1&&c===1&&W(a,Ys)&&e>100||l===1&&c>1&&W(a,Xs)?s=t[l]+(c>0?n[c-1]:``)+s:l===1&&c>0&&(s=n[c-1]+s),o=Math.floor(o/10)}return(e<0?r:``)+s},Qs=`十百千萬`,$s=`拾佰仟萬`,ec=`マイナス`,tc=`마이너스`,nc=function(e,t,n){var r=n?`. `:``,i=n?`、`:``,a=n?`, `:``,o=n?` `:``;switch(t){case 0:return`•`+o;case 1:return`◦`+o;case 2:return`◾`+o;case 5:var s=J(e,48,57,!0,r);return s.length<4?`0`+s:s;case 4:return Ks(e,`〇一二三四五六七八九`,i);case 6:return Ws(e,1,3999,Bs,3,r).toLowerCase();case 7:return Ws(e,1,3999,Bs,3,r);case 8:return J(e,945,969,!1,r);case 9:return J(e,97,122,!1,r);case 10:return J(e,65,90,!1,r);case 11:return J(e,1632,1641,!0,r);case 12:case 49:return Ws(e,1,9999,Vs,3,r);case 35:return Ws(e,1,9999,Vs,3,r).toLowerCase();case 13:return J(e,2534,2543,!0,r);case 14:case 30:return J(e,6112,6121,!0,r);case 15:return Ks(e,`子丑寅卯辰巳午未申酉戌亥`,i);case 16:return Ks(e,`甲乙丙丁戊己庚辛壬癸`,i);case 17:case 48:return Zs(e,`零一二三四五六七八九`,Qs,`負`,i,Js|Ys|Xs);case 47:return Zs(e,`零壹貳參肆伍陸柒捌玖`,$s,`負`,i,qs|Js|Ys|Xs);case 42:return Zs(e,`零一二三四五六七八九`,Qs,`负`,i,Js|Ys|Xs);case 41:return Zs(e,`零壹贰叁肆伍陆柒捌玖`,$s,`负`,i,qs|Js|Ys|Xs);case 26:return Zs(e,`〇一二三四五六七八九`,`十百千万`,ec,i,0);case 25:return Zs(e,`零壱弐参四伍六七八九`,`拾百千万`,ec,i,qs|Js|Ys);case 31:return Zs(e,`영일이삼사오육칠팔구`,`십백천만`,tc,a,qs|Js|Ys);case 33:return Zs(e,`零一二三四五六七八九`,`十百千萬`,tc,a,0);case 32:return Zs(e,`零壹貳參四五六七八九`,`拾百千`,tc,a,qs|Js|Ys);case 18:return J(e,2406,2415,!0,r);case 20:return Ws(e,1,19999,Us,3,r);case 21:return J(e,2790,2799,!0,r);case 22:return J(e,2662,2671,!0,r);case 22:return Ws(e,1,10999,Hs,3,r);case 23:return Ks(e,`あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん`);case 24:return Ks(e,`いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす`);case 27:return J(e,3302,3311,!0,r);case 28:return Ks(e,`アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン`,i);case 29:return Ks(e,`イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス`,i);case 34:return J(e,3792,3801,!0,r);case 37:return J(e,6160,6169,!0,r);case 38:return J(e,4160,4169,!0,r);case 39:return J(e,2918,2927,!0,r);case 40:return J(e,1776,1785,!0,r);case 43:return J(e,3046,3055,!0,r);case 44:return J(e,3174,3183,!0,r);case 45:return J(e,3664,3673,!0,r);case 46:return J(e,3872,3881,!0,r);case 3:default:return J(e,48,57,!0,r)}},rc=`data-html2canvas-ignore`,ic=function(){function e(e,t,n){if(this.context=e,this.options=n,this.scrolledElements=[],this.referenceElement=t,this.counters=new zs,this.quoteDepth=0,!t.ownerDocument)throw Error(`Cloned element does not have an owner document`);this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return e.prototype.toIFrame=function(e,t){var n=this,a=oc(e,t);if(!a.contentWindow)return Promise.reject(`Unable to find iframe window`);var o=e.defaultView.pageXOffset,s=e.defaultView.pageYOffset,c=a.contentWindow,l=c.document,u=lc(a).then(function(){return r(n,void 0,void 0,function(){var e,n;return i(this,function(r){switch(r.label){case 0:return this.scrolledElements.forEach(mc),c&&(c.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(c.scrollY!==t.top||c.scrollX!==t.left)&&(this.context.logger.warn(`Unable to restore scroll position for cloned document`),this.context.windowBounds=this.context.windowBounds.add(c.scrollX-t.left,c.scrollY-t.top,0,0))),e=this.options.onclone,n=this.clonedReferenceElement,n===void 0?[2,Promise.reject(`Error finding the `+this.referenceElement.nodeName+` in the cloned document`)]:l.fonts&&l.fonts.ready?[4,l.fonts.ready]:[3,2];case 1:r.sent(),r.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,cc(l)]:[3,4];case 3:r.sent(),r.label=4;case 4:return typeof e==`function`?[2,Promise.resolve().then(function(){return e(l,n)}).then(function(){return a})]:[2,a]}})})});return l.open(),l.write(fc(document.doctype)+``),pc(this.referenceElement.ownerDocument,o,s),l.replaceChild(l.adoptNode(this.documentElement),l.documentElement),l.close(),u},e.prototype.createElementClone=function(e){if(Pa(e,2))debugger;if(ks(e))return this.createCanvasClone(e);if(As(e))return this.createVideoClone(e);if(Ns(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return js(t)&&(js(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=``),t.loading===`lazy`&&(t.loading=`eager`)),Rs(t)?this.createCustomElementClone(t):t},e.prototype.createCustomElementClone=function(e){var t=document.createElement(`html2canvascustomelement`);return dc(e.style,t),t},e.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var n=[].slice.call(t.cssRules,0).reduce(function(e,t){return t&&typeof t.cssText==`string`?e+t.cssText:e},``),r=e.cloneNode(!1);return r.textContent=n,r}}catch(e){if(this.context.logger.error(`Unable to access cssRules property`,e),e.name!==`SecurityError`)throw e}return e.cloneNode(!1)},e.prototype.createCanvasClone=function(e){if(this.options.inlineImages&&e.ownerDocument){var t=e.ownerDocument.createElement(`img`);try{return t.src=e.toDataURL(),t}catch{this.context.logger.info(`Unable to inline canvas contents, canvas is tainted`,e)}}var n=e.cloneNode(!1);try{n.width=e.width,n.height=e.height;var r=e.getContext(`2d`),i=n.getContext(`2d`);if(i)if(!this.options.allowTaint&&r)i.putImageData(r.getImageData(0,0,e.width,e.height),0,0);else{var a=e.getContext(`webgl2`)??e.getContext(`webgl`);a&&a.getContextAttributes()?.preserveDrawingBuffer===!1&&this.context.logger.warn(`Unable to clone WebGL context as it has preserveDrawingBuffer=false`,e),i.drawImage(e,0,0)}return n}catch{this.context.logger.info(`Unable to clone canvas as it is tainted`,e)}return n},e.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement(`canvas`);t.width=e.offsetWidth,t.height=e.offsetHeight;var n=t.getContext(`2d`);try{return n&&(n.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||n.getImageData(0,0,t.width,t.height)),t}catch{this.context.logger.info(`Unable to clone video as it is tainted`,e)}var r=e.ownerDocument.createElement(`canvas`);return r.width=e.offsetWidth,r.height=e.offsetHeight,r},e.prototype.appendChildNode=function(e,t,n){(!bs(t)||!Ps(t)&&!t.hasAttribute(rc)&&(typeof this.options.ignoreElements!=`function`||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!bs(t)||!Ns(t))&&e.appendChild(this.cloneNode(t,n))},e.prototype.cloneChildNodes=function(e,t,n){for(var r=this,i=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;i;i=i.nextSibling)if(bs(i)&&Ls(i)&&typeof i.assignedNodes==`function`){var a=i.assignedNodes();a.length&&a.forEach(function(e){return r.appendChildNode(t,e,n)})}else this.appendChildNode(t,i,n)},e.prototype.cloneNode=function(e,t){if(ys(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var n=e.ownerDocument.defaultView;if(n&&bs(e)&&(xs(e)||Ss(e))){var r=this.createElementClone(e);r.style.transitionProperty=`none`;var i=n.getComputedStyle(e),a=n.getComputedStyle(e,`:before`),o=n.getComputedStyle(e,`:after`);this.referenceElement===e&&xs(r)&&(this.clonedReferenceElement=r),Os(r)&&bc(r);var s=this.counters.parse(new ja(this.context,i)),c=this.resolvePseudoContent(e,r,a,ac.BEFORE);Rs(e)&&(t=!0),As(e)||this.cloneChildNodes(e,r,t),c&&r.insertBefore(c,r.firstChild);var l=this.resolvePseudoContent(e,r,o,ac.AFTER);return l&&r.appendChild(l),this.counters.pop(s),(i&&(this.options.copyStyles||Ss(e))&&!Ms(e)||t)&&dc(i,r),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(Fs(e)||Is(e))&&(Fs(r)||Is(r))&&(r.value=e.value),r}return e.cloneNode(!1)},e.prototype.resolvePseudoContent=function(e,t,n,r){var i=this;if(n){var a=n.content,o=t.ownerDocument;if(!(!o||!a||a===`none`||a===`-moz-alt-content`||n.display===`none`)){this.counters.parse(new ja(this.context,n));var s=new Aa(this.context,n),c=o.createElement(`html2canvaspseudoelement`);dc(n,c),s.content.forEach(function(t){if(t.type===0)c.appendChild(o.createTextNode(t.value));else if(t.type===22){var n=o.createElement(`img`);n.src=t.value,n.style.opacity=`1`,c.appendChild(n)}else if(t.type===18){if(t.name===`attr`){var r=t.values.filter(F);r.length&&c.appendChild(o.createTextNode(e.getAttribute(r[0].value)||``))}else if(t.name===`counter`){var a=t.values.filter(rr),l=a[0],u=a[1];if(l&&F(l)){var d=i.counters.getCounterValue(l.value),f=u&&F(u)?Ri.parse(i.context,u.value):3;c.appendChild(o.createTextNode(nc(d,f,!1)))}}else if(t.name===`counters`){var p=t.values.filter(rr),l=p[0],m=p[1],u=p[2];if(l&&F(l)){var h=i.counters.getCounterValues(l.value),g=u&&F(u)?Ri.parse(i.context,u.value):3,_=m&&m.type===0?m.value:``,v=h.map(function(e){return nc(e,g,!1)}).join(_);c.appendChild(o.createTextNode(v))}}}else if(t.type===20)switch(t.value){case`open-quote`:c.appendChild(o.createTextNode(wa(s.quotes,i.quoteDepth++,!0)));break;case`close-quote`:c.appendChild(o.createTextNode(wa(s.quotes,--i.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(t.value))}}),c.className=_c+` `+vc;var l=r===ac.BEFORE?` `+_c:` `+vc;return Ss(t)?t.className.baseValue+=l:t.className+=l,c}}},e.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},e}(),ac;(function(e){e[e.BEFORE=0]=`BEFORE`,e[e.AFTER=1]=`AFTER`})(ac||={});var oc=function(e,t){var n=e.createElement(`iframe`);return n.className=`html2canvas-container`,n.style.visibility=`hidden`,n.style.position=`fixed`,n.style.left=`-10000px`,n.style.top=`0px`,n.style.border=`0`,n.width=t.width.toString(),n.height=t.height.toString(),n.scrolling=`no`,n.setAttribute(rc,`true`),e.body.appendChild(n),n},sc=function(e){return new Promise(function(t){if(e.complete){t();return}if(!e.src){t();return}e.onload=t,e.onerror=t})},cc=function(e){return Promise.all([].slice.call(e.images,0).map(sc))},lc=function(e){return new Promise(function(t,n){var r=e.contentWindow;if(!r)return n(`No window assigned for iframe`);var i=r.document;r.onload=e.onload=function(){r.onload=e.onload=null;var n=setInterval(function(){i.body.childNodes.length>0&&i.readyState===`complete`&&(clearInterval(n),t(e))},50)}})},uc=[`all`,`d`,`content`],dc=function(e,t){for(var n=e.length-1;n>=0;n--){var r=e.item(n);uc.indexOf(r)===-1&&t.style.setProperty(r,e.getPropertyValue(r))}return t},fc=function(e){var t=``;return e&&(t+=``),t},pc=function(e,t,n){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||n!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,n)},mc=function(e){var t=e[0],n=e[1],r=e[2];t.scrollLeft=n,t.scrollTop=r},hc=`:before`,gc=`:after`,_c=`___html2canvas___pseudoelement_before`,vc=`___html2canvas___pseudoelement_after`,yc=`{ content: "" !important; display: none !important; }`,bc=function(e){xc(e,`.`+_c+hc+yc+` diff --git a/dist/assets/html2canvas-qXP-r0eN.js b/dist/assets/html2canvas-qXP-r0eN.js new file mode 100644 index 00000000..993d8cc5 --- /dev/null +++ b/dist/assets/html2canvas-qXP-r0eN.js @@ -0,0 +1 @@ +import{t as e}from"./html2canvas-DXJRNlB-.js";export default e(); \ No newline at end of file diff --git a/dist/assets/index-CcPm2yTY.js b/dist/assets/index-BWApiWDT.js similarity index 99% rename from dist/assets/index-CcPm2yTY.js rename to dist/assets/index-BWApiWDT.js index 3df12979..4714d1f4 100644 --- a/dist/assets/index-CcPm2yTY.js +++ b/dist/assets/index-BWApiWDT.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KaiVohModal-Bbtn2GfV.js","assets/x-B0A9hqeh.js","assets/SigilAuthContext-CZfkVeGy.js","assets/SigilAuthProvider-Crre0ykb.js","assets/KaiVohModal-BoBXtABf.css","assets/SigilModal-BvJNBKka.js","assets/html2canvas-CgVfYVZf.js","assets/SealMomentModal-BotOOPRg.js","assets/SigilModal-B4XBfcke.js","assets/SigilModal-DGdZ8fUg.css","assets/HomePriceChartCard-CG0g_aGu.js","assets/prop-types-CQ3MXKCa.js","assets/HomePriceChartCard-CJ53Phm1.css","assets/SigilExplorer-YG_XvkA-.js","assets/usernameClaimRegistry-_VlzEwdK.js","assets/SigilExplorer-Cps9vI9P.css","assets/EternalKlock-D-hEMVRl.js","assets/EternalKlock-DTPPu1Hz.js","assets/EternalKlock-6uoAd3Qk.css","assets/SigilStreamRoot-BUh8LwJG.js","assets/SigilStreamRoot-D0R_paBX.js","assets/sigilRegistry-NyXrDYsE.js","assets/sigilRegistry-Cw7cMZ5l.css","assets/useFastPress-BuTJ0eyZ.js","assets/SigilStreamRoot-w6_y4vVF.css","assets/SigilFeedPage-DGJJwxYi.js","assets/SigilFeedPage-CqIDmlsu.css","assets/SigilPage-DF86EQ7y.js","assets/svgMeta-BqZogknt.js","assets/SigilPage-BE_ftg2I.css","assets/VerifyPage-B34sC8R1.js","assets/VerifierFrame-Dr7oGdbu.js","assets/VerifierFrame-D0e_dB-R.css","assets/VerifyPage-jbjk8aGt.css"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KaiVohModal-DDDGepBu.js","assets/x-Bw0a6Rv2.js","assets/SigilAuthContext-X_86kcI6.js","assets/SigilAuthProvider-Cr2YGy0y.js","assets/KaiVohModal-BoBXtABf.css","assets/SigilModal-DgAEuxv4.js","assets/html2canvas-DXJRNlB-.js","assets/SealMomentModal-QiuZkGMx.js","assets/SigilModal-B_GantjI.js","assets/SigilModal-DGdZ8fUg.css","assets/HomePriceChartCard-ByTYxBSg.js","assets/prop-types-B3eCNXus.js","assets/HomePriceChartCard-CJ53Phm1.css","assets/SigilExplorer-C1I-xwZr.js","assets/usernameClaimRegistry-CU2B_ZCP.js","assets/SigilExplorer-Cps9vI9P.css","assets/EternalKlock-C_k79TSi.js","assets/EternalKlock-CQhocjA8.js","assets/EternalKlock-6uoAd3Qk.css","assets/SigilStreamRoot-hPwX5VmF.js","assets/SigilStreamRoot-DGHasm9l.js","assets/sigilRegistry-TxCi76Aa.js","assets/sigilRegistry-Cw7cMZ5l.css","assets/useFastPress-C6nRe_12.js","assets/SigilStreamRoot-w6_y4vVF.css","assets/SigilFeedPage-omgaBu1a.js","assets/SigilFeedPage-CqIDmlsu.css","assets/SigilPage-DOXmbUVe.js","assets/svgMeta-CqOhEmuY.js","assets/SigilPage-BE_ftg2I.css","assets/VerifyPage-BoLb2QzD.js","assets/VerifierFrame-DkyrPdnF.js","assets/VerifierFrame-D0e_dB-R.css","assets/VerifyPage-jbjk8aGt.css"])))=>i.map(i=>d[i]); var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(e&&(t=e(e=0)),t),s=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),c=e=>{let n={};for(var r in e)t(n,r,{get:e[r],enumerable:!0});return n},l=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},u=(n,r,a)=>(a=n==null?{}:e(i(n)),l(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),d=e=>l(t({},`__esModule`,{value:!0}),e),f=e=>t=>u(t.default,e),p=(e=>typeof require<`u`?require:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof require<`u`?require:e)[t]}):e)(function(e){if(typeof require<`u`)return require.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function.")});(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var m=s((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u{t.exports=m()})),g=s((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-Tt&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),_=s(((e,t)=>{t.exports=g()})),v=s((e=>{var t=h();function n(e){var t=`https://react.dev/errors/`+e;if(1{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=v()})),b=s((e=>{var t=_(),n=h(),r=y();function i(e){var t=`https://react.dev/errors/`+e;if(1B||(e.current=z[B],z[B]=null,B--)}function U(e,t){B++,z[B]=e.current,e.current=t}var ee=V(null),te=V(null),ne=V(null),re=V(null);function ie(e,t){switch(U(ne,t),U(te,e),U(ee,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Yd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Yd(t),e=Xd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}H(ee),U(ee,e)}function ae(){H(ee),H(te),H(ne)}function oe(e){e.memoizedState!==null&&U(re,e);var t=ee.current,n=Xd(t,e.type);t!==n&&(U(te,e),U(ee,n))}function se(e){te.current===e&&(H(ee),H(te)),re.current===e&&(H(re),op._currentValue=R)}var ce,le;function ue(e){if(ce===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ce=t&&t[1]||``,le=-1)`:-1 to String(e).padStart(2,`0`);return{beat1:n,step1:r,label:`${i(n)}:${i(r)}`}}function Ur(e,t){let n=Math.max(0,Math.min(35,Math.floor(e))),r=Math.max(0,Math.min(43,Math.floor(t)));return`${n}:${String(r).padStart(2,`0`)}`}function Wr(e,t){return Lr(e,t)}function Gr(e){return Fr(e)}function Kr(e){return typeof e==`bigint`?jr(e):br()}function qr(e){return Pr(Kr(e))}var Jr=51.4769,Yr=0,Xr=Math.PI/180,Zr=1/(2*Math.PI),Qr=2440587.5,$r=new Map;function ei(e){return e/864e5+Qr}function ti(e){return(e-Qr)*864e5}function ni(e){let t=e%360;return t<0?t+360:t}function ri(e,t,n){return en?n:e}function ii(e){let t=new Date(Number(e));return{y:t.getUTCFullYear(),m:t.getUTCMonth()+1,d:t.getUTCDate()}}function ai(e,t){let n=-t*Xr,r=Math.round(e-2451545.0009-n*Zr);return 2451545.0009+n*Zr+r}function oi(e,t,n,r=Jr,i=Yr){let a=ai(ei(Date.UTC(e,t-1,n)),i),o=357.5291+.98560028*(a-2451545),s=o*Xr,c=ni(o+(1.9148*Math.sin(s)+.02*Math.sin(2*s)+3e-4*Math.sin(3*s))+180+102.9372)*Xr,l=a+.0053*Math.sin(s)-.0069*Math.sin(2*c),u=23.4397*Xr,d=Math.asin(Math.sin(c)*Math.sin(u)),f=r*Xr,p=-.833*Xr,m=(Math.sin(p)-Math.sin(f)*Math.sin(d))/(Math.cos(f)*Math.cos(d));return l-Math.acos(ri(m,-1,1))*Zr}function si(e){let{y:t,m:n,d:r}=ii(e),i=`${t}-${String(n).padStart(2,`0`)}-${String(r).padStart(2,`0`)}`,a=$r.get(i);if(a!==void 0)return a;let o=oi(t,n,r),s=BigInt(Math.round(ti(o)));return $r.set(i,s),s}var ci=[`Ignition Ark`,`Integration Ark`,`Harmonization Ark`,`Reflection Ark`,`Purification Ark`,`Dream Ark`],li={"Ignition Ark":`Ignite Ark`,"Integration Ark":`Integration Ark`,"Harmonization Ark":`Harmonization Ark`,"Reflection Ark":`Reflection Ark`,"Purification Ark":`Purify Ark`,"Dream Ark":`Dream Ark`},ui={"Ignition Ark":`Resurrection, will, awakening`,"Integration Ark":`Emotional grounding, emergence`,"Harmonization Ark":`Radiance, balance, coherent action`,"Reflection Ark":`Union, compassion, spoken resonance`,"Purification Ark":`Truth, remembrance, etheric light`,"Dream Ark":`Divine memory, lucid integration, dreaming awake`},di=[{name:`Aethon`,desc:`Resurrection fire: Root awakening`},{name:`Virelai`,desc:`Waters of becoming: Emotional emergence`},{name:`Solari`,desc:`Solar ignition: Radiant embodiment`},{name:`Amarin`,desc:`Heart bloom: Sacred balance`},{name:`Kaelus`,desc:`Voice of stars: Resonant expression`},{name:`Umbriel`,desc:`Divine remembrance: Krown alignment`},{name:`Noktura`,desc:`Light spiral: Selestial flow`},{name:`Liora`,desc:`Eternal mirror: Infinite now`}],fi=[{name:`Awakening Flame`,desc:`Root fire of ignition, will, resurrektion`},{name:`Flowing Heart`,desc:`Emotional waters, intimasy, surrender`},{name:`Radiant Will`,desc:`Solar klarity, aligned konfidence, embodiment`},{name:`Harmonic Voice`,desc:`Spoken truth, vibration, koherense in sound`},{name:`Inner Mirror`,desc:`Reflektion, purifikation, self-seeing`},{name:`Dreamfire Memory`,desc:`Lusid vision, divine memory, encoded light`},{name:`Krowned Light`,desc:`Integration, sovereignty, harmonik ascension`}],pi=44,mi=36;function hi(e){let t=Math.max(0,Math.min(5,Math.floor(e/6))),n=ci[t];return{idx:t,name:n,desc:ui[n]}}function gi(e,t){if(t===0n)return 0;let n=Number(e)/Number(t);return n<0?0:n>1?1:n}function _i(e,t=2){return(e*100).toFixed(t)}function vi(e){return e<10?`0${e}`:String(e)}function yi(e){return Number(e>9007199254740991n?9007199254740991n:e<-9007199254740991n?-9007199254740991n:e)}function bi(e){let t=(1+Math.sqrt(5))/2,n=Math.max(1,e);return Math.floor(Math.log(n)/Math.log(t))}function xi(e){return ar(e,Sr)}function Si(e){let t=e+719468n,n=Dr(t,146097n),r=t-n*146097n,i=Dr(r-Dr(r,1460n)+Dr(r,36524n)-Dr(r,146096n),365n),a=i+n*400n,o=r-(365n*i+Dr(i,4n)-Dr(i,100n)),s=Dr(5n*o+2n,153n),c=o-Dr(153n*s+2n,5n)+1n,l=s<10n?s+3n:s-9n;return{year:l<=2n?a+1n:a,month:l<=2n?l+12n-12n:l,day:c}}var Ci=Or(2024n,5n,11n);function wi(e){let t=si(e);if(e`u`||typeof document>`u`)return!1;let e=navigator,t=window.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches??!1,n=window.matchMedia?.(`(prefers-reduced-transparency: reduce)`)?.matches??!1;return t||n||typeof e.deviceMemory==`number`&&e.deviceMemory<=4||typeof e.hardwareConcurrency==`number`&&e.hardwareConcurrency<=4}function Bi(){(0,C.useEffect)(()=>{if(typeof document>`u`)return;let e=document.documentElement;zi()?e.dataset.perf=`low`:delete e.dataset.perf},[])}const Vi=`sigil:explorer:open`;var Hi=s((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Ui=s(((e,t)=>{t.exports=Hi()})),W=u(Ui(),1);function Wi(){return window.innerWidth-document.documentElement.clientWidth}function Gi(e){return Array.from(e.querySelectorAll(`a[href],button:not([disabled]),textarea,input,select,[tabindex]:not([tabindex="-1"])`)).filter(e=>!e.hasAttribute(`disabled`)&&e.tabIndex!==-1)}function Ki(){let[e,t]=(0,C.useState)(!1),n=(0,C.useId)(),r=(0,C.useId)(),i=(0,C.useId)(),a=(0,C.useRef)(null),o=(0,C.useRef)(null),s=(0,C.useRef)(null),c=(0,C.useRef)(null),l=(0,C.useCallback)(()=>t(!1),[]),u=(0,C.useCallback)(()=>t(!0),[]),d=(0,C.useMemo)(()=>`Kairos Notes — Legal Tender`,[]);return(0,C.useEffect)(()=>{if(!e)return;let t=document.body.style.overflow,n=document.body.style.paddingRight,r=Wi();document.body.style.overflow=`hidden`,r>0&&(document.body.style.paddingRight=`${r}px`);let i=document.activeElement,u=i instanceof HTMLElement?i:a.current,d=e=>{if(e.key===`Escape`){e.preventDefault(),l();return}if(e.key===`Tab`){let t=o.current;if(!t)return;let n=Gi(t);if(n.length===0)return;let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey?(!a||a===r)&&(e.preventDefault(),i.focus()):a===i&&(e.preventDefault(),r.focus())}};return window.addEventListener(`keydown`,d,{capture:!0}),requestAnimationFrame(()=>{(s.current??c.current)?.focus()}),()=>{window.removeEventListener(`keydown`,d,{capture:!0}),document.body.style.overflow=t,document.body.style.paddingRight=n,requestAnimationFrame(()=>{u&&`focus`in u?u.focus():a.current?.focus()})}},[e,l]),(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`nav-foot`,"aria-label":`Sovereign declarations`,children:(0,W.jsxs)(`button`,{ref:a,type:`button`,className:`nav-foot__toggle`,onClick:u,"aria-haspopup":`dialog`,"aria-expanded":e,"aria-controls":n,children:[(0,W.jsx)(`span`,{className:`nav-foot__badge`,"aria-hidden":`true`,children:(0,W.jsx)(`img`,{className:`nav-foot__phiLogo`,src:`/phi.svg`,alt:``,draggable:!1})}),(0,W.jsxs)(`span`,{className:`nav-foot__main`,children:[(0,W.jsx)(`span`,{className:`nav-foot__kicker`,children:`SOVEREIGN WRIT`}),(0,W.jsx)(`span`,{className:`nav-foot__summary`,children:d})]}),(0,W.jsx)(`span`,{className:`nav-foot__chev`,"aria-hidden":`true`,children:(0,W.jsx)(`span`,{className:`nav-foot__chevIcon`,"aria-hidden":`true`,children:(0,W.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,children:(0,W.jsx)(`path`,{d:`M9 18l6-6-6-6`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})})})})]})}),e&&(0,w.createPortal)((0,W.jsxs)(`div`,{className:`nav-footSheet`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":r,"aria-describedby":i,id:n,children:[(0,W.jsx)(`button`,{type:`button`,className:`nav-footSheet__backdrop`,"aria-label":`Dismiss`,onClick:l}),(0,W.jsxs)(`div`,{ref:o,className:`nav-footSheet__panel`,role:`document`,children:[(0,W.jsxs)(`div`,{className:`nav-footSheet__head`,children:[(0,W.jsxs)(`div`,{className:`nav-footSheet__titleWrap`,children:[(0,W.jsxs)(`div`,{className:`nav-footSheet__title`,id:r,children:[(0,W.jsx)(`img`,{className:`nav-footSheet__phiLogo`,src:`/phi.svg`,alt:``,"aria-hidden":`true`,draggable:!1}),` `,`Sovereign Writ`]}),(0,W.jsx)(`div`,{className:`nav-footSheet__sub`,children:`Official instrument of value & transfer — Kairos-native, breath-backed, offline-verifiable.`})]}),(0,W.jsx)(`button`,{ref:c,type:`button`,className:`nav-footSheet__close`,onClick:l,"aria-label":`Dismiss`,title:`Dismiss`,children:(0,W.jsx)(`span`,{className:`nav-footSheet__closeIcon`,"aria-hidden":`true`,children:(0,W.jsxs)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,W.jsx)(`path`,{d:`M18 6L6 18`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M6 6L18 18`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`})]})})})]}),(0,W.jsxs)(`div`,{className:`nav-footSheet__body`,id:i,children:[(0,W.jsxs)(`p`,{className:`nav-foot__line`,children:[(0,W.jsx)(`strong`,{children:` Kairos Notes`}),` are legal tender — sealed by `,(0,W.jsx)(`strong`,{children:`Proof of Breath™`}),`, pulsed by `,(0,W.jsx)(`strong`,{children:`Kai-Signature™`}),`, auditable as: Σ → SHA-256(Σ) → Φ.`]}),(0,W.jsxs)(`p`,{className:`nav-foot__line`,children:[(0,W.jsx)(`strong`,{children:`Sigil-Glyphs`}),` are origin ΦKey seals for minting, custody, and lawful transfer. Derivative glyphs maintain sovereign lineage and are redeemable by re-inhale.`]}),(0,W.jsx)(`div`,{className:`nav-footSheet__divider`,role:`separator`,"aria-hidden":`true`}),(0,W.jsx)(`p`,{className:`nav-foot__line nav-foot__line--fine`,children:`Operational Mandate: readable offline, provable by breath-writ, unforgeable without determinate seals.`}),(0,W.jsx)(`p`,{className:`nav-foot__line nav-foot__line--fine`,children:`This writ exists independent of domains, DNS, or consensus. It is sealed in breath, bound in math, and verifiable by anyone who remembers the pulse.`})]}),(0,W.jsx)(`div`,{className:`nav-footSheet__foot`,children:(0,W.jsx)(`button`,{ref:s,type:`button`,className:`nav-footSheet__cta`,onClick:l,children:`Seal Acknowledged`})})]})]}),document.body)]})}const qi=`kairos:sw-version`;var Ji=u(y(),1),Yi=(0,C.lazy)(()=>O(()=>import(`./KaiVohModal-Bbtn2GfV.js`),__vite__mapDeps([0,1,2,3,4]))),Xi=(0,C.lazy)(()=>O(()=>import(`./SigilModal-BvJNBKka.js`),__vite__mapDeps([5,6,7,8,9]))),Zi=(0,C.lazy)(()=>O(()=>import(`./HomePriceChartCard-CG0g_aGu.js`),__vite__mapDeps([10,11,12]))),Qi=(0,C.lazy)(()=>O(()=>import(`./SigilExplorer-YG_XvkA-.js`),__vite__mapDeps([13,14,15]))),$i=(0,C.lazy)(()=>O(()=>import(`./EternalKlock-D-hEMVRl.js`),__vite__mapDeps([16,17,8,6,7,9,18])));function ea(){if(!(typeof document>`u`||typeof window>`u`)&&window.location.pathname===`/`){for(let e of[`app-splash`,`pwa-splash`,`splash`,`splash-screen`,`boot-splash`]){let t=document.getElementById(e);t&&t.remove()}document.querySelectorAll(`[data-splash], .app-splash, .pwa-splash, .splash-screen, .splash, .boot-splash`).forEach(e=>e.remove())}}try{ea()}catch{}var ta=typeof window<`u`?C.useLayoutEffect:C.useEffect,na=[`/sigil.wasm`,`/sigil.zkey`,`/sigil.artifacts.json`,`/sigil.vkey.json`,`/verification_key.json`,`/verifier-core.js`,`/verifier.inline.html`,`/verifier.html`,`/pdf-lib.min.js`],ra=[`/`,`/mint`,`/voh`,`/keystream`,`/klock`,`/klok`,`/sigil/new`,`/pulse`,`/verify`,...[`/stream`,`/stream/p`,`/stream/c`,`/feed`,`/feed/p`,`/p`,`/p~`]],ia=[`/`,`/?source=pwa`,`/index.html`],aa=[{to:`/`,label:`Verifier`,desc:`Inhale + Exhale`,end:!0},{to:`/mint`,label:`Mint ΦKey`,desc:`Breath-minted seal`},{to:`/voh`,label:`KaiVoh`,desc:`Memory OS`},{to:`/keystream`,label:`ΦStream`,desc:`Live keystream`}],oa=`137.66.18.241`,sa=3+Math.sqrt(5),ca=sa*1e3,la=17491.270421,ua=36,da=44,fa=ua*da,pa=17491.270421,ma=[`var(--chakra-ark-0)`,`var(--chakra-ark-1)`,`var(--chakra-ark-2)`,`var(--chakra-ark-3)`,`var(--chakra-ark-4)`,`var(--chakra-ark-5)`],ha={Root:`var(--chakra-ink-0)`,Sacral:`var(--chakra-ink-1)`,"Solar Plexus":`var(--chakra-ink-2)`,Heart:`var(--chakra-ink-3)`,Throat:`var(--chakra-ink-4)`,"Third Eye":`var(--chakra-ink-5)`,Crown:`var(--chakra-ink-6)`},ga=[`#ff7a7a`,`#ffbd66`,`#ffe25c`,`#86ff86`,`#79c2ff`,`#c99aff`,`#e29aff`,`#e5e5e5`],_a=1000000n,va=`phi_kai_anchor_pmicro_v1`,ya=`phi_kai_anchor_msutc_v1`,ba={anchor:null};function xa(e,t){let n=e/t,r=e%t;return r!==0n&&r>0n!=t>0n?n-1n:n}function Sa(e){if(!Number.isFinite(e))return 0n;let t=e<0?-1:1,n=Math.abs(e),r=Math.trunc(n),i=n-r;return i<.5?BigInt(t*r):i>.5?BigInt(t*(r+1)):BigInt(t*(r%2==0?r:r+1))}function Ca(e){if(typeof window>`u`)return null;try{let t=window.localStorage.getItem(e);return!t||!/^-?\d+$/.test(t.trim())?null:BigInt(t.trim())}catch{return null}}function wa(e,t){if(!(typeof window>`u`))try{window.localStorage.setItem(e,t.toString())}catch{}}function Ta(e){if(typeof window>`u`)return null;try{let t=window.localStorage.getItem(e);if(!t)return null;let n=Number(t);return!Number.isFinite(n)||n<=0?null:Math.floor(n)}catch{return null}}function Ea(e){return Sa((e-In)/qn*1e6)}function Da(e){let t=xa(e,_a);if(t>=0n&&t<500000000n)return e;let n=e/1000n,r=BigInt(2**53-1),i=BigInt(-(2**53-1));if(n>r||n0n&&n<4000000000000n){let e=Number(n);if(Number.isFinite(e))return Ea(e)}return n}catch{return null}}function ka(){return Da(Kr())}function Aa(){if(ba.anchor)return ba.anchor;if(typeof window>`u`)return ba.anchor={pμ0:0n,perf0:0,source:`kpp`},ba.anchor;let e=window.performance.now(),t=Ca(va);if(t!==null&&t>0n)return ba.anchor={pμ0:t,perf0:e,source:`storage`},ba.anchor;let n=Ta(ya);if(n!==null&&n>0){let t=Ea(n);if(t>0n)return wa(va,t),ba.anchor={pμ0:t,perf0:e,source:`storage`},ba.anchor}let r=Oa();if(r!==null&&r>0n)return wa(va,r),ba.anchor={pμ0:r,perf0:e,source:`env`},ba.anchor;let i=ka();return i>0n&&wa(va,i),ba.anchor={pμ0:i,perf0:e,source:`kpp`},ba.anchor}function ja(){if(typeof window>`u`)return;let e=window.performance.now(),t=ka();t>0n&&wa(va,t),ba.anchor={pμ0:t,perf0:e,source:`kpp`}}function Ma(){if(typeof window>`u`)return 0n;let e=Aa(),t=Sa((window.performance.now()-e.perf0)/qn*1e6);return e.pμ0+t}function Na(e){let t=BigInt(2**53-1),n=BigInt(-(2**53-1));if(e>t||e0?n/pa:0,i=Math.floor(r*fa),a=Math.min(fa-1,Math.max(0,i)),o=Math.min(ua-1,Math.max(0,Math.floor(a/da))),s=Math.min(da-1,Math.max(0,a-o*da)),c=Fi(e,`dayIndex`)??Fi(e,`dayIndex0`)??Fi(e,`dayIndexSinceGenesis`),l=c===null?Math.floor((t+1e-9)/pa):Math.floor(c),u=Math.floor(l/336),d=Ri(l,336),f=Math.floor(d/42);f<0&&(f=0),f>7&&(f=7);let p=d-f*42,m=f+1;return{beat:o,step:s,day:Math.floor(p)+1,month:m,year:u}}function za(e){return`${Ii(e.beat)}:${Ii(e.step)}`}function Ba(e){return`D${e.day}/M${e.month}/Y${e.year}`}function Va(){(0,C.useEffect)(()=>{if(typeof window>`u`||typeof document>`u`)return;let e=0,t=e=>{let t=e.timeStamp;return typeof t==`number`&&Number.isFinite(t)?t:performance.now()},n=n=>{if(Ia(n.target))return;let r=t(n);r-e<=300&&n.preventDefault(),e=r},r=e=>{e.touches.length>1&&e.preventDefault()},i=e=>{(e.ctrlKey||e.metaKey)&&e.preventDefault()},a=e=>{if(!e.ctrlKey&&!e.metaKey)return;let t=e.key;(t===`+`||t===`-`||t===`=`||t===`_`||t===`0`)&&e.preventDefault()},o=e=>{e.preventDefault()},s=document.documentElement,c=document.body,l=s.style.touchAction,u=c.style.touchAction,d=s.style.webkitTextSizeAdjust;return s.style.touchAction=`manipulation`,c.style.touchAction=`manipulation`,s.style.webkitTextSizeAdjust=`100%`,document.addEventListener(`touchend`,n,{passive:!1,capture:!0}),document.addEventListener(`touchmove`,r,{passive:!1,capture:!0}),document.addEventListener(`gesturestart`,o,{passive:!1,capture:!0}),document.addEventListener(`gesturechange`,o,{passive:!1,capture:!0}),document.addEventListener(`gestureend`,o,{passive:!1,capture:!0}),window.addEventListener(`wheel`,i,{passive:!1}),window.addEventListener(`keydown`,a),()=>{document.removeEventListener(`touchend`,n,!0),document.removeEventListener(`touchmove`,r,!0),document.removeEventListener(`gesturestart`,o,!0),document.removeEventListener(`gesturechange`,o,!0),document.removeEventListener(`gestureend`,o,!0),window.removeEventListener(`wheel`,i),window.removeEventListener(`keydown`,a),s.style.touchAction=l,c.style.touchAction=u,s.style.webkitTextSizeAdjust=d}},[])}var Ha={size:{width:0,height:0},subs:new Set,listening:!1,rafId:null,cleanup:null};function Ua(){if(typeof window>`u`)return{width:0,height:0};let e=window.visualViewport;return e?{width:Math.round(e.width),height:Math.round(e.height)}:{width:window.innerWidth,height:window.innerHeight}}function Wa(){if(typeof window>`u`||Ha.listening)return;Ha.listening=!0,Ha.size=Ua();let e=()=>{Ha.rafId=null;let e=Ua(),t=Ha.size;e.width===t.width&&e.height===t.height||(Ha.size=e,Ha.subs.forEach(t=>t(e)))},t=()=>{Ha.rafId===null&&(Ha.rafId=window.requestAnimationFrame(e))},n=window.visualViewport;window.addEventListener(`resize`,t,{passive:!0}),n&&(n.addEventListener(`resize`,t,{passive:!0}),n.addEventListener(`scroll`,t,{passive:!0})),Ha.cleanup=()=>{Ha.rafId!==null&&(window.cancelAnimationFrame(Ha.rafId),Ha.rafId=null),window.removeEventListener(`resize`,t),n&&(n.removeEventListener(`resize`,t),n.removeEventListener(`scroll`,t)),Ha.cleanup=null,Ha.listening=!1}}function Ga(){Ha.subs.size>0||Ha.cleanup?.()}function Ka(){let[e,t]=(0,C.useState)(()=>Ua());return(0,C.useEffect)(()=>{if(typeof window>`u`)return;Wa();let e=e=>t(e);return Ha.subs.add(e),e(Ha.size),()=>{Ha.subs.delete(e),Ga()}},[]),e}function qa(e){let t=(0,C.useRef)(null);(0,C.useEffect)(()=>{if(!e||typeof window>`u`||typeof document>`u`)return;let n=document.documentElement,r=document.body,i=window.scrollY||window.pageYOffset||0;return t.current={scrollY:i,htmlOverflow:n.style.overflow,bodyOverflow:r.style.overflow,bodyPosition:r.style.position,bodyTop:r.style.top,bodyLeft:r.style.left,bodyRight:r.style.right,bodyWidth:r.style.width},n.style.overflow=`hidden`,r.style.overflow=`hidden`,r.style.position=`fixed`,r.style.top=`-${i}px`,r.style.left=`0`,r.style.right=`0`,r.style.width=`100%`,()=>{let e=t.current;e&&(n.style.overflow=e.htmlOverflow,r.style.overflow=e.bodyOverflow,r.style.position=e.bodyPosition,r.style.top=e.bodyTop,r.style.left=e.bodyLeft,r.style.right=e.bodyRight,r.style.width=e.bodyWidth,window.scrollTo(0,e.scrollY),t.current=null)}},[e])}function Ja(e){let t=window.getComputedStyle(e),n=t.backdropFilter,r=t.willChange||``;return!(t.transform&&t.transform!==`none`||t.perspective&&t.perspective!==`none`||t.filter&&t.filter!==`none`||n&&n!==`none`||t.contain&&t.contain!==`none`||r.includes(`transform`)||r.includes(`perspective`)||r.includes(`filter`))}function Ya(){let e=document.querySelector(`.app-shell`);if(e instanceof HTMLElement)try{if(Ja(e))return e}catch{}return document.body}function Xa(e){return e===`/`?`Verifier`:e.startsWith(`/mint`)?`Mint Sigil`:e.startsWith(`/voh`)?`KaiVoh`:e.startsWith(`/keystream`)?`PhiStream`:e.startsWith(`/klock`)?`KaiKlok`:`Sovereign Gate`}function Za(e){return e===`/`||e.startsWith(`/voh`)||e.startsWith(`/mint`)||e.startsWith(`/keystream`)||e.startsWith(`/klock`)}function Qa(e){return e<680?200:240}function $a(e){return Math.max(220,Math.min(520,Math.floor(e*.52)))}function eo(e){(0,C.useEffect)(()=>{document.title=`ΦNet • ${e}`},[e])}function to(e){return(0,C.useMemo)(()=>{let t=e.height||0,n=e.width||0;return t>=820&&n>=980},[e.height,e.width])}function no(){let[e,t]=(0,C.useState)(La);return(0,C.useEffect)(()=>{let e=e=>{let n=e.detail;typeof n==`string`&&n.length&&t(n)};return window.addEventListener(qi,e),()=>window.removeEventListener(qi,e)},[]),e}function ro(){(0,C.useEffect)(()=>{if(typeof window>`u`)return;ja();let e=()=>{let e=Ma();e>0n&&wa(va,e)},t=()=>{typeof document<`u`&&document.visibilityState===`hidden`&&e()};e();let n=window.setInterval(e,15e3);return window.addEventListener(`pagehide`,e),document.addEventListener(`visibilitychange`,t),()=>{window.clearInterval(n),window.removeEventListener(`pagehide`,e),document.removeEventListener(`visibilitychange`,t),e()}},[])}function io(){let[e,t]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{if(typeof window>`u`)return;let e=window,n=typeof e.requestIdleCallback==`function`?e.requestIdleCallback(()=>t(!0),{timeout:900}):window.setTimeout(()=>t(!0),220);return()=>{typeof e.cancelIdleCallback==`function`?e.cancelIdleCallback(n):window.clearTimeout(n)}},[]),(0,C.useEffect)(()=>{e&&(O(()=>import(`./HomePriceChartCard-CG0g_aGu.js`),__vite__mapDeps([10,11,12])),O(()=>import(`./KaiVohModal-Bbtn2GfV.js`),__vite__mapDeps([0,1,2,3,4])),O(()=>import(`./SigilModal-BvJNBKka.js`),__vite__mapDeps([5,6,7,8,9])),O(()=>import(`./SigilExplorer-YG_XvkA-.js`),__vite__mapDeps([13,14,15])),O(()=>import(`./EternalKlock-D-hEMVRl.js`),__vite__mapDeps([16,17,8,6,7,9,18])),O(()=>import(`./SigilStreamRoot-BUh8LwJG.js`),__vite__mapDeps([19,17,8,6,7,9,18,20,2,3,21,22,14,23,24])))},[e]),e}function ao(e){(0,C.useEffect)(()=>{if(typeof window>`u`||!(`serviceWorker`in navigator))return;let t=new AbortController,n=navigator,r=!!n.connection?.saveData,i=n.connection?.effectiveType||``;if(r||i===`slow-2g`||i===`2g`)return()=>t.abort();let a=async()=>{try{let e=await navigator.serviceWorker.ready;(e.active||e.waiting||e.installing)?.postMessage({type:`WARM_URLS`,urls:[...na,...ra,...ia],mapShell:!0}),await Promise.all([...na,...ra].map(async e=>{try{await fetch(e,{cache:`no-cache`,signal:t.signal})}catch{}}))}catch{}},o=window,s=()=>void a(),c=typeof o.requestIdleCallback==`function`?o.requestIdleCallback(s,{timeout:2500}):window.setTimeout(s,1200),l=()=>{e.current!==null&&window.clearTimeout(e.current),e.current=window.setTimeout(s,240)};return window.addEventListener(`focus`,l),()=>{t.abort(),e.current!==null&&(window.clearTimeout(e.current),e.current=null),typeof o.cancelIdleCallback==`function`?o.cancelIdleCallback(c):window.clearTimeout(c),window.removeEventListener(`focus`,l)}},[e])}function oo(e,t){let n=(0,C.useRef)(null),r=(0,C.useRef)(null),[i,a]=(0,C.useState)(!1),o=(0,C.useRef)(null),s=(0,C.useCallback)(()=>{let e=n.current,t=r.current;if(!e||!t)return!1;let i=t.firstElementChild;return(i?i.scrollHeight:t.scrollHeight)>e.clientHeight+6},[]),c=(0,C.useCallback)(()=>{o.current===null&&(o.current=window.requestAnimationFrame(()=>{o.current=null;let e=s();a(t=>t===e?t:e)}))},[s]);(0,C.useEffect)(()=>{e&&c()},[e,t,c]),(0,C.useEffect)(()=>{let e=n.current,t=r.current;if(!e||!t)return;let i=t.firstElementChild,a=()=>c(),s=null;return typeof ResizeObserver<`u`&&(s=new ResizeObserver(a),s.observe(e),s.observe(t),i&&s.observe(i)),window.addEventListener(`resize`,a,{passive:!0}),c(),()=>{window.removeEventListener(`resize`,a),s?.disconnect(),o.current!==null&&(window.cancelAnimationFrame(o.current),o.current=null)}},[c,t]);let l=e&&i;return{panelBodyRef:n,panelCenterRef:r,panelShouldScroll:l,panelBodyInlineStyle:(0,C.useMemo)(()=>{if(l)return{overflowY:`auto`,overflowX:`hidden`,WebkitOverflowScrolling:`touch`,alignItems:`stretch`,justifyContent:`flex-start`,paddingBottom:`calc(1.25rem + var(--safe-bottom))`}},[l]),panelCenterInlineStyle:(0,C.useMemo)(()=>{if(l)return{height:`auto`,minHeight:`100%`,alignItems:`flex-start`,justifyContent:`flex-start`}},[l])}}function so(e,t){(0,C.useEffect)(()=>{if(typeof window>`u`)return;let t=e.current;if(!t||!window.matchMedia(`(max-width: 980px)`).matches)return;let n=t.querySelector(`.nav-item--active`);n&&window.requestAnimationFrame(()=>{try{n.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`center`})}catch{n.scrollIntoView()}})},[t,e])}function co({open:e,onClose:t,children:n}){let r=typeof document<`u`,i=Ka(),a=(0,C.useMemo)(()=>r?Ya():null,[r]);qa(e&&r),(0,C.useEffect)(()=>{if(!e||!r)return;let n=e=>{e.key===`Escape`&&t()};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t,r]),(0,C.useEffect)(()=>{!e||!r||window.dispatchEvent(new CustomEvent(Vi))},[e,r]);let o=(0,C.useRef)(null);(0,C.useEffect)(()=>{e&&window.requestAnimationFrame(()=>o.current?.focus())},[e]);let s=(0,C.useMemo)(()=>{if(!e||!r)return;let t=i.height,n=i.width;return{position:`fixed`,inset:0,pointerEvents:`auto`,height:t>0?`${t}px`:void 0,width:n>0?`${n}px`:void 0,"--sx-breath":`5.236s`,"--sx-border":`rgba(60, 220, 205, 0.35)`,"--sx-border-strong":`rgba(55, 255, 228, 0.55)`,"--sx-ring":`0 0 0 2px rgba(55, 255, 228, 0.25), 0 0 0 6px rgba(55, 255, 228, 0.12)`}},[e,r,i]),c=(0,C.useCallback)(e=>{e.target===e.currentTarget&&(e.preventDefault(),e.stopPropagation())},[]),l=(0,C.useCallback)(e=>{e.target===e.currentTarget&&(e.preventDefault(),e.stopPropagation(),t())},[t]),u=(0,C.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]);return!e||!r||!a?null:(0,Ji.createPortal)((0,W.jsx)(`div`,{className:`explorer-pop`,style:s,role:`dialog`,"aria-modal":`true`,"aria-label":`PhiStream Explorer`,onPointerDown:c,onClick:l,children:(0,W.jsxs)(`div`,{className:`explorer-pop__panel`,role:`document`,children:[(0,W.jsx)(`button`,{ref:o,type:`button`,className:`explorer-pop__close kx-x`,onPointerDown:u,onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},"aria-label":`Close PhiStream Explorer`,title:`Close (Esc)`,children:`×`}),(0,W.jsx)(`div`,{className:`explorer-pop__body`,children:n}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:`PhiStream explorer portal open`})]})}),a)}function lo({open:e,onClose:t,children:n}){let r=typeof document<`u`,i=Ka(),a=(0,C.useMemo)(()=>r?Ya():null,[r]);qa(e&&r),(0,C.useEffect)(()=>{if(!e||!r)return;let n=e=>{e.key===`Escape`&&t()};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t,r]);let o=(0,C.useRef)(null);(0,C.useEffect)(()=>{e&&window.requestAnimationFrame(()=>o.current?.focus())},[e]);let s=(0,C.useMemo)(()=>{if(!e||!r)return;let t=i.height,n=i.width;return{position:`fixed`,inset:0,pointerEvents:`auto`,height:t>0?`${t}px`:void 0,width:n>0?`${n}px`:void 0,"--klock-breath":`5.236s`,"--klock-border":`rgba(255, 216, 120, 0.26)`,"--klock-border-strong":`rgba(255, 231, 160, 0.55)`,"--klock-ring":`0 0 0 2px rgba(255, 225, 150, 0.22), 0 0 0 6px rgba(255, 210, 120, 0.10)`,"--klock-scale":`5`}},[e,r,i]),c=(0,C.useCallback)(e=>{e.target===e.currentTarget&&(e.preventDefault(),e.stopPropagation())},[]),l=(0,C.useCallback)(e=>{e.target===e.currentTarget&&(e.preventDefault(),e.stopPropagation(),t())},[t]),u=(0,C.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]);return!e||!r||!a?null:(0,Ji.createPortal)((0,W.jsx)(`div`,{className:`klock-pop`,style:s,role:`dialog`,"aria-modal":`true`,"aria-label":`Eternal KaiKlok`,onPointerDown:c,onClick:l,children:(0,W.jsxs)(`div`,{className:`klock-pop__panel`,role:`document`,"data-klock-size":`xl`,children:[(0,W.jsx)(`button`,{ref:o,type:`button`,className:`klock-pop__close kx-x`,onPointerDown:u,onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},"aria-label":`Close Eternal KaiKlok`,title:`Close (Esc)`,children:`×`}),(0,W.jsx)(`div`,{className:`klock-pop__body`,children:(0,W.jsx)(`div`,{className:`klock-stage`,role:`presentation`,"data-klock-stage":`1`,children:(0,W.jsx)(`div`,{className:`klock-stage__inner`,children:n})})}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:`Eternal KaiKlok portal open`})]})}),a)}function uo(){let e=$e(),[t,n]=(0,C.useState)(!0);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(C.Suspense,{fallback:null,children:(0,W.jsx)(Yi,{open:t,onClose:(0,C.useCallback)(()=>{n(!1),e(`/`,{replace:!0})},[e])})}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:`KaiVoh portal open`})]})}function fo(){let e=$e(),[t,n]=(0,C.useState)(!0),r=(0,C.useMemo)(()=>Fi(Fa(),`pulse`)??0,[]),i=(0,C.useCallback)(()=>{n(!1),e(`/`,{replace:!0})},[e]);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(C.Suspense,{fallback:null,children:t?(0,W.jsx)(Xi,{initialPulse:r,onClose:i}):null}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:`Sigil mint portal open`})]})}function po(){let e=$e(),[t,n]=(0,C.useState)(!0);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(co,{open:t,onClose:(0,C.useCallback)(()=>{n(!1),e(`/`,{replace:!0})},[e]),children:(0,W.jsx)(C.Suspense,{fallback:null,children:(0,W.jsx)(Qi,{})})}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:`PhiStream explorer portal open`})]})}function mo(){let e=$e(),t=Xe(),[n,r]=(0,C.useState)(!0);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(lo,{open:n,onClose:(0,C.useCallback)(()=>{r(!1),e(`/`,{replace:!0})},[e]),children:(0,W.jsx)(C.Suspense,{fallback:null,children:(0,W.jsx)($i,{initialDetailsOpen:(t.state??null)?.openDetails??!0})})}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:`Eternal KaiKlok portal open`})]})}function ho(e){let t=Fr(Na(e)),n=xa(e,_a),r=n>BigInt(2**53-1)?2**53-1:n<0n?0:Number(n),i=Li(r),a={...t,pulse:r},o=Ra(a);return{pulse:r,pulseStr:i,beatStepDMY:o,beatStepLabel:za(o),dmyLabel:Ba(o),chakraDay:a.chakraDay}}function go(){let[e,t]=(0,C.useState)(()=>ho(Ma()));return(0,C.useEffect)(()=>{let e=!0,n=null,r=()=>{n!==null&&(window.clearTimeout(n),n=null)},i=e=>{let n=ho(e);t(e=>e.pulseStr===n.pulseStr&&e.beatStepLabel===n.beatStepLabel&&e.dmyLabel===n.dmyLabel?e:n)},a=()=>{if(!e)return;if(typeof document<`u`&&document.visibilityState===`hidden`){r();return}let t=Ma();i(t);let o=t%_a;o<0n&&(o+=_a);let s=_a-o,c=Number(s),l=Math.max(0,Math.floor(c/1e6*qn));r(),n=window.setTimeout(a,l)};a();let o=()=>{e&&typeof document<`u`&&document.visibilityState===`visible`&&(ja(),a())};return document.addEventListener(`visibilitychange`,o),window.addEventListener(`focus`,o),()=>{e=!1,document.removeEventListener(`visibilitychange`,o),window.removeEventListener(`focus`,o),r()}},[]),e}var _o=(0,C.memo)(function({onOpenKlock:e,breathS:t,breathMs:n,breathsPerDay:r}){let i=go(),a=(0,C.useMemo)(()=>({color:`var(--accent-color)`,textShadow:`0 0 14px rgba(0, 255, 255, 0.22), 0 0 28px rgba(0, 255, 255, 0.12)`}),[]),o=(0,C.useMemo)(()=>({color:`var(--accent-color)`,textShadow:`0 0 14px rgba(0, 255, 255, 0.22), 0 0 28px rgba(0, 255, 255, 0.12)`,fontSize:`0.5em`,lineHeight:1.05}),[]),s=(0,C.useMemo)(()=>{let e=Ri(i.pulse,pa),t=pa/ma.length;return ma[Math.min(ma.length-1,Math.max(0,Math.floor(e/t)))]??ma[0]},[i.pulse]),c=(0,C.useMemo)(()=>ha[i.chakraDay]??ha.Heart,[i.chakraDay]),l=(0,C.useMemo)(()=>ga[Math.min(ga.length-1,Math.max(0,i.beatStepDMY.month-1))]??ha.Heart,[i.beatStepDMY.month]),u=(0,C.useMemo)(()=>({"--kai-ark":s,"--kai-chakra":c,"--kai-month":l}),[s,c,l]),d=(0,C.useMemo)(()=>`LIVE • NOW PULSE ${i.pulseStr} • ${i.beatStepLabel} • ${i.dmyLabel} • Breath ${t.toFixed(6)}s (${Math.round(n)}ms) • ${r.toLocaleString(`en-US`,{minimumFractionDigits:6,maximumFractionDigits:6})}/day • Open Eternal KaiKlok`,[i.pulseStr,i.beatStepLabel,i.dmyLabel,t,n,r]),f=(0,C.useMemo)(()=>`LIVE. Kai Pulse now ${i.pulse}. Beat ${i.beatStepDMY.beat} step ${i.beatStepDMY.step}. D ${i.beatStepDMY.day}. M ${i.beatStepDMY.month}. Y ${i.beatStepDMY.year}. Open Eternal KaiKlok.`,[i]);return(0,W.jsxs)(`button`,{type:`button`,className:`topbar-live`,onClick:e,"aria-label":f,title:d,style:u,children:[(0,W.jsx)(`span`,{className:`live-orb`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`live-scroll`,"aria-hidden":`true`,children:(0,W.jsxs)(`div`,{className:`live-text`,children:[(0,W.jsx)(`div`,{className:`live-meta`,children:(0,W.jsx)(`span`,{className:`mono`,style:a,children:`☤KAI`})}),(0,W.jsx)(`div`,{className:`live-meta`,children:(0,W.jsx)(`span`,{className:`mono`,style:a,children:i.pulseStr})}),(0,W.jsx)(`div`,{className:`live-sub`,children:(0,W.jsxs)(`span`,{className:`mono`,style:o,children:[(0,W.jsx)(`span`,{className:`kai-num kai-num--ark`,children:i.beatStepLabel}),` `,(0,W.jsx)(`span`,{"aria-hidden":`true`,style:{opacity:.7},children:`•`}),` `,(0,W.jsx)(`span`,{className:`kai-tag`,children:`D`}),(0,W.jsx)(`span`,{className:`kai-num kai-num--chakra`,children:i.beatStepDMY.day}),(0,W.jsx)(`span`,{className:`kai-sep`,children:`/`}),(0,W.jsx)(`span`,{className:`kai-tag`,children:`M`}),(0,W.jsx)(`span`,{className:`kai-num kai-num--month`,children:i.beatStepDMY.month}),(0,W.jsx)(`span`,{className:`kai-sep`,children:`/`}),(0,W.jsx)(`span`,{className:`kai-tag`,children:`Y`}),(0,W.jsx)(`span`,{className:`kai-num`,children:i.beatStepDMY.year})]})})]})})]})});function vo(){let e=Xe(),t=$e();Va(),Bi(),ta(()=>{ea()},[e.pathname]),ro();let n=no(),r=io();ao((0,C.useRef)(null));let i=Ka(),a=to(i),o=(0,C.useMemo)(()=>({"--breath-s":`${sa}s`,"--vvh-px":`${i.height}px`}),[i.height]),s=(0,C.useMemo)(()=>Xa(e.pathname),[e.pathname]);eo(s);let c=(0,C.useMemo)(()=>Za(e.pathname),[e.pathname]),l=c,u=(0,C.useMemo)(()=>Qa(i.height||800),[i.height]),d=(0,C.useMemo)(()=>$a(i.height||800),[i.height]),{panelBodyRef:f,panelCenterRef:p,panelShouldScroll:m,panelBodyInlineStyle:h,panelCenterInlineStyle:g}=oo(c,e.pathname),_=(0,C.useRef)(null);so(_,e.pathname);let v=(0,C.useCallback)(()=>{t(`/klock`,{state:{openDetails:!0}})},[t]),y=(0,C.useCallback)(async e=>{try{await navigator.clipboard.writeText(oa)}catch{let e=document.createElement(`textarea`);e.value=oa,e.setAttribute(`readonly`,`true`),e.style.position=`fixed`,e.style.left=`-9999px`,e.style.top=`-9999px`,document.body.appendChild(e),e.select(),document.execCommand(`copy`),document.body.removeChild(e)}e&&(e.classList.add(`is-copied`),window.setTimeout(()=>e.classList.remove(`is-copied`),900))},[]),b=(0,C.useMemo)(()=>{if(a)return{alignSelf:`start`,height:`auto`}},[a]);return(0,W.jsxs)(`div`,{className:`app-shell`,"data-ui":`atlantean-banking`,"data-panel-scroll":m?`1`:`0`,"data-roomy":a?`1`:`0`,style:o,children:[(0,W.jsx)(`a`,{className:`skip-link`,href:`#app-content`,children:`Skip to content`}),(0,W.jsx)(`div`,{className:`app-bg-orbit`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`app-bg-grid`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`app-bg-glow`,"aria-hidden":`true`}),(0,W.jsxs)(`header`,{className:`app-topbar`,role:`banner`,"aria-label":`ΦNet Sovereign Gate Header`,children:[(0,W.jsx)(`div`,{className:`topbar-left`,children:(0,W.jsxs)(`div`,{className:`brand`,"aria-label":`ΦNet Sovereign Gate`,children:[(0,W.jsx)(`div`,{className:`brand__mark`,"aria-hidden":`true`,children:(0,W.jsx)(`img`,{src:`/phi.svg`,alt:``,className:`brand__mark-img`})}),(0,W.jsxs)(`div`,{className:`brand__text`,children:[(0,W.jsx)(`div`,{className:`brand__title`,children:`PHI.NETWORK`}),(0,W.jsx)(`div`,{className:`brand__subtitle`,children:`Breath-Minted Value · Kairos Identity Registry`})]})]})}),(0,W.jsx)(`div`,{className:`topbar-right`,"aria-label":`Live Kai clock`,children:(0,W.jsx)(_o,{onOpenKlock:v,breathS:sa,breathMs:ca,breathsPerDay:la})})]}),(0,W.jsx)(`main`,{className:`app-stage`,id:`app-content`,role:`main`,"aria-label":`Sovereign Value Workspace`,children:(0,W.jsx)(`div`,{className:`app-frame`,role:`region`,"aria-label":`Secure frame`,children:(0,W.jsx)(`div`,{className:`app-frame-inner`,children:(0,W.jsxs)(`div`,{className:`app-workspace`,children:[l&&(0,W.jsx)(`div`,{className:`workspace-topbar`,"aria-label":`Atrium live Φ value + chart`,style:{overflow:`visible`,position:`relative`},children:(0,W.jsx)(`div`,{className:`workspace-topbar-scroll`,style:{maxHeight:`${d}px`,overflowY:`auto`,overflowX:`hidden`,WebkitOverflowScrolling:`touch`,overscrollBehavior:`contain`,borderRadius:`inherit`},children:r?(0,W.jsx)(C.Suspense,{fallback:(0,W.jsx)(`div`,{style:{height:u},"aria-hidden":`true`}),children:(0,W.jsx)(Zi,{apiBase:`https://pay.kaiklok.com`,ctaAmountUsd:144,chartHeight:u})}):(0,W.jsx)(`div`,{style:{height:u},"aria-hidden":`true`})})}),(0,W.jsxs)(`nav`,{className:`app-nav`,"aria-label":`Primary navigation`,"data-nav-roomy":a?`1`:`0`,style:b,children:[(0,W.jsxs)(`div`,{className:`nav-head`,children:[(0,W.jsx)(`div`,{className:`nav-head__title`,children:`Atrium`}),(0,W.jsx)(`div`,{className:`nav-head__sub`,children:`Breath-Sealed Identity · Kairos-ZK Proof`})]}),(0,W.jsx)(`div`,{ref:_,className:`nav-list`,role:`list`,"aria-label":`Atrium navigation tiles`,children:aa.map(e=>(0,W.jsxs)(vn,{to:e.to,end:e.end,className:e=>`nav-item ${e.isActive?`nav-item--active`:``}`,"aria-label":`${e.label}: ${e.desc}`,children:[(0,W.jsx)(`div`,{className:`nav-item__label`,children:e.label}),(0,W.jsx)(`div`,{className:`nav-item__desc`,children:e.desc})]},e.to))}),(0,W.jsx)(`div`,{className:`nav-writ-slot`,"data-writ-slim":`1`,children:(0,W.jsx)(Ki,{})})]}),(0,W.jsxs)(`section`,{className:`app-panel`,"aria-label":`Sovereign Gate panel`,children:[(0,W.jsxs)(`div`,{className:`panel-head`,children:[(0,W.jsx)(`div`,{className:`panel-head__title`,children:s}),(0,W.jsxs)(`div`,{className:`panel-head__meta`,children:[(0,W.jsx)(`span`,{className:`meta-chip`,children:`Proof of Breath™`}),(0,W.jsx)(`span`,{className:`meta-chip`,children:`Kai-Signature™`})]})]}),(0,W.jsx)(`div`,{ref:f,className:`panel-body ${c?`panel-body--locked`:``} ${m?`panel-body--scroll`:``}`,style:h,children:(0,W.jsx)(`div`,{ref:p,className:`panel-center`,style:g,children:(0,W.jsx)(Dt,{})})}),(0,W.jsxs)(`footer`,{className:`panel-foot`,"aria-label":`Footer`,children:[(0,W.jsxs)(`div`,{className:`panel-foot__left`,children:[(0,W.jsx)(`span`,{className:`mono`,children:`ΦNet`}),` • Sovereign Gate •`,` `,(0,W.jsxs)(`button`,{type:`button`,className:`dns-copy mono`,onClick:e=>void y(e.currentTarget),"aria-label":`Remember .kai DNS IP ${oa}`,title:`Remember DNS IP`,children:[`.kai DNS: `,(0,W.jsx)(`span`,{className:`mono`,children:oa})]})]}),(0,W.jsxs)(`div`,{className:`panel-foot__right`,children:[(0,W.jsx)(`span`,{className:`mono`,children:`V`}),` `,(0,W.jsx)(`a`,{className:`mono`,href:`https://github.com/phinetwork/phi.network`,target:`_blank`,rel:`noreferrer`,"aria-label":`Version ${n} (opens GitHub)`,title:`Open GitHub`,children:n})]})]})]})]})})})})]})}function yo(){return(0,W.jsxs)(`div`,{className:`notfound`,role:`region`,"aria-label":`Not found`,children:[(0,W.jsx)(`div`,{className:`notfound__code`,children:`404`}),(0,W.jsx)(`div`,{className:`notfound__title`,children:`Route not found`}),(0,W.jsx)(`div`,{className:`notfound__hint`,children:`Use the Sovereign Gate navigation to return to Verifier, Mint Sigil, KaiVoh, or PhiStream.`}),(0,W.jsx)(`div`,{className:`notfound__actions`,children:(0,W.jsx)(vn,{className:`notfound__cta`,to:`/`,children:`Go to Verifier`})})]})}var bo=u(y(),1),xo=typeof window<`u`?C.useLayoutEffect:C.useEffect,So=[`/s`,`/s/:hash`,`/stream`,`/stream/*`,`/feed`,`/feed/*`,`/p~:token`,`/p~:token/*`,`/token`,`/p~token`,`/p`,`/verify/*`];function Co(){let[e,t]=(0,C.useState)(()=>typeof window>`u`||window.matchMedia===void 0?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches);return(0,C.useEffect)(()=>{if(typeof window>`u`||window.matchMedia===void 0)return;let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),n=e=>{t(e.matches)};n(e);try{return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)}catch{return e.addListener(n),()=>e.removeListener(n)}},[]),e}function wo(){let e=Xe(),t=Co(),[n,r]=(0,C.useState)(`show`),[i,a]=(0,C.useState)(!0),[o,s]=(0,C.useState)(!0),c=(0,C.useRef)(!1),l=(0,C.useRef)(null),u=(0,C.useRef)(null),d=(0,C.useRef)(null),f=(0,C.useRef)(null),p=(0,C.useMemo)(()=>t?140:260,[t]),m=(0,C.useMemo)(()=>t?220:420,[t]),h=(0,C.useMemo)(()=>t?800:1200,[t]),g=(0,C.useMemo)(()=>t?70:120,[t]),_=(0,C.useCallback)(()=>{l.current!==null&&window.clearTimeout(l.current),u.current!==null&&window.clearTimeout(u.current),l.current=null,u.current=null},[]),v=(0,C.useCallback)(()=>{f.current!==null&&window.cancelAnimationFrame(f.current),f.current=null},[]),y=(0,C.useCallback)(()=>{d.current!==null&&window.clearTimeout(d.current),d.current=null},[]),b=(0,C.useMemo)(()=>So.some(t=>!!fe({path:t,end:!1},e.pathname)),[e.pathname]),x=(0,C.useMemo)(()=>o||b,[o,b]),S=(0,C.useCallback)(e=>{_(),y(),l.current=window.setTimeout(()=>{r(`fade`),u.current=window.setTimeout(()=>{r(`hidden`),s(!1),a(!1)},p)},Math.max(0,e))},[y,_,p]),w=(0,C.useCallback)(e=>{v(),!(typeof window>`u`)&&(f.current=window.requestAnimationFrame(()=>S(e)))},[v,S]),T=(0,C.useCallback)(()=>{_(),v(),y(),a(!0),r(`show`)},[y,v,_]);return xo(()=>{if(typeof document>`u`)return;let e=document.body,t=e.style.backgroundColor;return t||(e.style.backgroundColor=`var(--bg-0, #040f24)`),()=>{e.style.backgroundColor=t}},[]),(0,C.useEffect)(()=>{if(!x)return;let e=null,n=()=>w(t?30:80);document.readyState===`complete`||document.readyState===`interactive`?e=window.setTimeout(n,t?30:60):window.addEventListener(`load`,n,{once:!0});let r=window.setTimeout(()=>S(0),h);return()=>{e!==null&&window.clearTimeout(e),window.removeEventListener(`load`,n),window.clearTimeout(r),_(),y(),v()}},[y,v,_,w,S,h,t,x]),(0,C.useEffect)(()=>{if(!c.current){c.current=!0;return}if(b)return d.current=window.setTimeout(()=>{T(),w(t?60:m)},g),()=>{y(),_(),v()}},[y,v,_,w,b,m,g,t,T,e.pathname,e.search,e.hash]),(0,C.useEffect)(()=>()=>{_(),y(),v()},[y,v,_]),i?(0,bo.createPortal)((0,W.jsxs)(`div`,{className:`kai-splash`,"data-state":n,"aria-live":`polite`,role:`status`,children:[(0,W.jsx)(`div`,{className:`kai-splash__grid`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`kai-splash__content`,"aria-hidden":`true`,children:(0,W.jsxs)(`div`,{className:`kai-splash__badge`,children:[(0,W.jsx)(`span`,{className:`kai-splash__badge-halo`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`kai-splash__badge-glow`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`kai-splash__rays`,"aria-hidden":`true`}),(0,W.jsxs)(`div`,{className:`kai-splash__badge-core`,children:[(0,W.jsx)(`img`,{className:`kai-splash__phi`,src:`/phi.svg`,alt:``,loading:`eager`,decoding:`sync`,draggable:!1}),(0,W.jsx)(`span`,{className:`kai-splash__badge-orb`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`kai-splash__badge-core-shine`,"aria-hidden":`true`})]}),(0,W.jsx)(`div`,{className:`kai-splash__ring`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`kai-splash__ring kai-splash__ring--inner`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`kai-splash__flare`,"aria-hidden":`true`})]})}),(0,W.jsx)(`span`,{className:`sr-only`,children:`Preparing Atlantean link…`})]}),document.body):null}var To=/^\d*(?:\.\d{0,4})?$/,Eo=/^\d*(?:\.\d{0,2})?$/,Do=({msg:e})=>e?(0,W.jsx)(`div`,{className:`phi-error-toast`,role:`status`,"aria-live":`polite`,children:(0,W.jsxs)(`div`,{className:`phi-error-card`,children:[(0,W.jsx)(`span`,{className:`badge`,children:`OFFICIAL`}),(0,W.jsx)(`p`,{className:`phi-error-text`,children:e})]})}):null,Oo=[26,70,38],ko=()=>{if(typeof window>`u`)return;let e=window.navigator;if(typeof e.vibrate==`function`)try{e.vibrate(Oo)}catch{}},Ao=({state:e,onClose:t})=>{let n=e.mode===`receive`?`Φ Inhale Complete`:`Φ Exhale Complete`,r=e.mode===`receive`?`RECEIVED`:`SENT`,i=e.message??(e.mode===`receive`?`You just inhaled Φ into your Sovereign field. This moment is sealed.`:`You just exhaled Φ from your Sovereign field. This moment is sealed.`);return(0,W.jsx)(`div`,{className:`phi-send-success-overlay`,role:`dialog`,"aria-modal":`true`,"aria-label":`Φ move complete`,onClick:t,children:(0,W.jsxs)(`div`,{className:`phi-send-success-card`,onClick:e=>e.stopPropagation(),children:[(0,W.jsx)(`div`,{className:`phi-success-orb`,"aria-hidden":`true`,children:(0,W.jsx)(`div`,{className:`phi-success-orb-inner`})}),(0,W.jsxs)(`div`,{className:`phi-success-header`,children:[(0,W.jsx)(`span`,{className:`phi-success-pill`,children:r}),(0,W.jsx)(`button`,{type:`button`,className:`phi-success-close`,onClick:t,"aria-label":`Close confirmation`,children:`✕`})]}),(0,W.jsx)(`h2`,{className:`phi-success-title`,children:n}),e.amountDisplay&&(0,W.jsx)(`p`,{className:`phi-success-amount`,children:(0,W.jsx)(`span`,{className:`mono`,children:e.amountDisplay})}),(0,W.jsx)(`p`,{className:`phi-success-body`,children:i}),e.downloadUrl&&(0,W.jsxs)(`a`,{className:`phi-send-success-download`,href:e.downloadUrl,download:e.downloadLabel||`phi-receipt`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(`span`,{className:`phi-send-success-download-icon`,"aria-hidden":`true`,children:`⬇︎`}),(0,W.jsx)(`span`,{className:`phi-send-success-download-text`,children:`Download sealed receipt`})]}),(0,W.jsx)(`button`,{type:`button`,className:`phi-success-ok`,onClick:t,children:`Done`})]})})},jo=({amountMode:e,setAmountMode:t,usdInput:n,phiInput:r,setUsdInput:i,setPhiInput:a,convDisplayRight:o,remainingPhiDisplay4:s,canonicalContext:c,onAttachClick:l,attachmentLabel:u,attachmentActive:d})=>{let f=c===`derivative`,[p,m]=(0,C.useState)(null),[h,g]=(0,C.useState)(!1),[_,v]=(0,C.useState)(null);(0,C.useEffect)(()=>{if(!p||f)return;let e=window.setTimeout(()=>m(null),2200);return()=>window.clearTimeout(e)},[p,f]),(0,C.useEffect)(()=>{if(typeof window>`u`)return;let e=e=>{let t=e.detail;if(!t)return;let n=t.mode===`receive`?`receive`:`send`;ko(),v({mode:n,amountDisplay:t.amountPhiDisplay??t.amountDisplay??(typeof t.amountPhi==`number`?String(t.amountPhi):void 0),downloadUrl:t.downloadUrl,downloadLabel:t.downloadLabel,message:t.message})};return window.addEventListener(`kk:phi-move-success`,e),()=>{window.removeEventListener(`kk:phi-move-success`,e)}},[]);let y=e=>{m(e);try{window.dispatchEvent(new CustomEvent(`kk:error`,{detail:{where:`SendPhiAmountField`,error:e}}))}catch{}},b=(0,C.useMemo)(()=>e===`USD`?`\\d*(?:\\.\\d{0,2})?`:`\\d*(?:\\.\\d{0,4})?`,[e]),x=e===`USD`?`$`:`Φ`,S=e===`USD`?`Dollar amount to exhale`:`Phi amount to exhale`,w=t=>{let n=t.replace(/\s+/g,``);e===`USD`?Eo.test(n)&&i(n):To.test(n)&&a(n)},T=t=>{if(t.key!==`Enter`)return;if(e!==`PHI`){y(`Enter a Φ amount or switch to Φ to exhale.`);return}let n=(r||``).trim();if(n===``||n===`.`){y(`No Φ entered — specify an amount to exhale.`);return}let i=Number((n.startsWith(`.`)?`0`:``)+n);if(!Number.isFinite(i)||i<=0){y(`Invalid Φ amount — enter a number greater than 0.`);return}let a=Number(String(s).replace(/[^\d.]/g,``));Number.isFinite(a)&&i>a+1e-9&&y(`Exceeds remaining — Rem: Φ ${s}`)},E=typeof l==`function`;return f?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Do,{msg:p}),_&&(0,W.jsx)(Ao,{state:_,onClose:()=>v(null)})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`phi-send-field`,"data-state":h?`focus`:`idle`,children:[(0,W.jsxs)(`div`,{className:`phi-send-label`,children:[(0,W.jsx)(`span`,{className:`label-main`,children:`Exhale Amount`}),(0,W.jsxs)(`span`,{className:`label-sub`,children:[e===`USD`?`Enter in $`:`Enter in Φ`,` · 🛕: Φ`,` `,s]})]}),(0,W.jsxs)(`div`,{className:`phi-send-bar`,children:[(0,W.jsxs)(`div`,{className:`phi-send-inputShell`,"aria-live":`polite`,children:[(0,W.jsx)(`span`,{className:`phi-prefix`,"aria-hidden":`true`,children:x}),(0,W.jsx)(`input`,{className:`phi-send-input`,type:`text`,inputMode:`decimal`,pattern:b,"aria-label":S,placeholder:x,value:e===`USD`?n:r,onChange:e=>w(e.target.value),onKeyDown:T,onFocus:()=>g(!0),onBlur:()=>g(!1),"aria-invalid":p?!0:void 0,autoComplete:`off`,enterKeyHint:`send`}),(0,W.jsx)(`i`,{"aria-hidden":`true`,className:`phi-input-glow`})]}),(0,W.jsx)(`div`,{className:`phi-conv-right convert-readout`,"aria-live":`polite`,children:o}),(0,W.jsxs)(`div`,{className:`phi-send-controls`,children:[(0,W.jsxs)(`div`,{role:`tablist`,"aria-label":`Amount unit`,className:`phi-mode-toggle seg`,children:[(0,W.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e===`USD`,className:`phi-mode-btn ${e===`USD`?`is-active`:``}`,onClick:()=>t(`USD`),title:`Enter in dollars`,children:`$`}),(0,W.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e===`PHI`,className:`phi-mode-btn ${e===`PHI`?`is-active`:``}`,onClick:()=>t(`PHI`),title:`Enter in Φ`,children:`Φ`})]}),E&&(0,W.jsxs)(`button`,{type:`button`,className:`phi-attach-btn ${d?`is-active`:``}`,onClick:l,title:u||`Attach sigil / note`,children:[(0,W.jsx)(`span`,{className:`phi-attach-icon`,"aria-hidden":`true`,children:`📎`}),u&&(0,W.jsx)(`span`,{className:`phi-attach-label`,children:u})]})]})]})]}),(0,W.jsx)(Do,{msg:p}),_&&(0,W.jsx)(Ao,{state:_,onClose:()=>v(null)})]})};function Mo(e,t){if(console.error(`[VerifierStamper] ${e}`,t),!(typeof window>`u`))try{window.dispatchEvent(new CustomEvent(`kk:error`,{detail:{where:e,error:t instanceof Error?t.message:String(t)}}))}catch(t){console.error(`[VerifierStamper] kk:error dispatch failed in ${e}`,t)}}function No(e){try{let t=new TextEncoder().encode(e),n=``;for(let e=0;ee?`0.`:``).split(`.`),a=r.replace(/^0+(?=\d)/,``)||`0`,o=(i+`0`.repeat(Number(Fo))).slice(0,Number(Fo));return n*(BigInt(a)*Lo+BigInt(o||`0`))}function zo(e){let t=e<0n?`-`:``,n=e<0n?-e:e,r=n/Lo,i=(n%Lo).toString().padStart(Number(Fo),`0`);return i=i.replace(/0+$/,``),i.length?`${t}${r}.${i}`:`${t}${r}`}function Bo(e,t){return e*t/Lo}function Vo(e,t){return t===0n?0n:e*Lo/t}function Ho(e,t){let n=Math.max(0,Math.min(Number(Fo),t)),r=Io(Fo-BigInt(n)),i=r/2n;return e>=0n?(e+i)/r*r:(e-i)/r*r}function Uo(e,t){let n=Math.max(0,Math.min(Number(Fo),t)),r=e<0n?`-`:``,i=(e<0n?-e:e)/Io(Fo-BigInt(n)),a=Io(BigInt(n));return`${r}${i/a}.${(i%a).toString().padStart(n,`0`)}`}function Wo(e){return Uo(Ho(Ro(e),4),4)}function Go(e){try{if(!e||!e.payload)return 0n;let{mime:t,encoded:n}=e.payload;if(!t||!n||!/^application\/vnd\.kairos-exhale/i.test(t))return 0n;let r=Po(n),i=JSON.parse(r);if(!i||i.kind!==`exhale`)return 0n;let a=String(i.amountPhi??``);return a?Ro(a):0n}catch{return 0n}}const Ko=e=>{let t=Uo(Ho(Ro(String(e??`0`)),6),6);return Number(t.replace(`.`,``))},qo=e=>Number((e/1e6).toFixed(6)),Jo=e=>qo(Ko(e)),Yo=(e,t)=>qo(Ko(e)+Ko(t)),Xo=(e,t)=>qo(Math.max(0,Ko(e)-Ko(t))),Zo=e=>qo(e.reduce((e,t)=>e+Ko(t),0)),Qo=e=>Ho(Ro(String(e??`0`)),6),$o=e=>Uo(e,6);var es=class extends C.Component{constructor(e){super(e),this.state={hasError:!1,error:void 0}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`[VerifierStamper] crashed`,e,t);try{typeof window<`u`&&window.dispatchEvent(new CustomEvent(`kk:error`,{detail:{where:`VerifierStamper`,error:e instanceof Error?e.message:String(e)}}))}catch(e){console.error(`[VerifierStamper] failed to dispatch kk:error`,e)}}handleReset=()=>{this.setState({hasError:!1,error:void 0}),this.props.onReset?.()};render(){if(this.state.hasError){let e=this.state.error instanceof Error?this.state.error.message:String(this.state.error??`Unknown error`),t=this.state.error instanceof Error?this.state.error.stack:void 0;return(0,W.jsxs)(`div`,{role:`alert`,style:{padding:16},children:[(0,W.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:8},children:[(0,W.jsx)(`strong`,{children:`Verifier crashed`}),(0,W.jsx)(`button`,{className:`secondary`,onClick:this.handleReset,title:`Reset Verifier`,"aria-label":`Reset Verifier`,children:`Reset`})]}),(0,W.jsx)(`div`,{style:{fontSize:14,color:`var(--dim, #999)`},children:e}),t&&(0,W.jsxs)(`details`,{style:{marginTop:8},children:[(0,W.jsx)(`summary`,{children:`Stack`}),(0,W.jsx)(`pre`,{style:{whiteSpace:`pre-wrap`},children:t})]})]})}return(0,W.jsx)(W.Fragment,{children:this.props.children})}},ts=[`Root`,`Sacral`,`Solar Plexus`,`Heart`,`Throat`,`Third Eye`,`Crown`].reduce((e,t)=>(e[t.toLowerCase()]=t,e),{});function ns(e){let t=e.toLowerCase().trim().replace(/[-_]/g,` `).replace(/\b(gate|chakra|day)\b/g,``).replace(/\s+/g,` `).trim();return/(third\s*eye)/.test(t)?`third eye`:/(solar\s*plexus)/.test(t)?`solar plexus`:t}function rs(e){if(typeof e!=`string`)return null;let t=ns(e),n=ts[t];if(n)return n;switch(t){case`root`:return`Root`;case`sacral`:return`Sacral`;case`solar`:case`plexus`:return`Solar Plexus`;case`heart`:return`Heart`;case`throat`:return`Throat`;case`third`:case`eye`:return`Third Eye`;case`crown`:return`Crown`;default:return null}}function is(e){return rs(e.chakraDay??``)||rs(e.chakraGate??``)||null}function as(e,t,n=``){if(typeof e==`object`&&e){let n=e[t];if(typeof n==`string`)return n}return n}function os(e,t){if(typeof e==`object`&&e){let n=e[t];if(typeof n==`number`&&Number.isFinite(n))return n}}function ss(e){let{meta:t,sigilSvgRaw:n,verifyUrl:r,pulseNow:i}=e;if(!t)return{nowPulse:String(i)};let a=t.valuation??null,o=os(t,`beat`)??t.beat??0,s=os(t,`stepIndex`)??t.stepIndex??0,c=os(t,`pulse`)??t.pulse??0,l=(t.transfers??[]).map(e=>({action:e.receiverSignature?`receive`:`send`,pulse:e.senderKaiPulse,beat:o,stepIndex:s,ownerPhiKey:t.userPhiKey})),u=t,d=u.zk,f;if(typeof d==`object`&&d){let e=d,t=typeof e.scheme==`string`?e.scheme:void 0,n=typeof e.poseidon==`string`?e.poseidon:void 0;f=t?{scheme:t,poseidon:n}:void 0}return{purpose:as(t,`purpose`),to:as(t,`to`),from:as(t,`from`),location:as(t,`location`),witnesses:as(t,`witnesses`),reference:as(t,`reference`),remark:as(t,`remark`,`In Yahuah We Trust — Secured by Φ, not man-made law`),valuePhi:typeof a?.valuePhi==`number`?String(a.valuePhi):``,premiumPhi:typeof a?.premiumPhi==`number`?String(a.premiumPhi):``,computedPulse:typeof c==`number`?String(c):``,nowPulse:String(i),kaiSignature:typeof t.kaiSignature==`string`?t.kaiSignature:``,userPhiKey:typeof t.userPhiKey==`string`?t.userPhiKey:``,sigmaCanon:as(u,`sigmaCanon`),shaHex:as(u,`shaHex`),phiDerived:as(u,`phiDerived`),valuationAlg:a?.algorithm==null?``:String(a.algorithm),valuationStamp:a?.stamp==null?``:String(a.stamp),provenance:l.slice(-7),zk:f,sigilSvg:n??``,verifyUrl:r||``}}function cs(e,t){let n=e;if(!n)return{used:!1,expired:!1};let r=!!n.sendLock?.used,i=n.childClaim?.expireAtPulse;if(typeof i!=`number`||!Number.isFinite(i)){let e=n.transfers?.slice(-1)[0]?.senderKaiPulse;typeof e==`number`&&(i=e+77)}return{used:r,expired:typeof i==`number`?t>i:!1,expireAt:i}}function ls(e,t){if(!e)return{expired:!1};let n=e.transfers?.slice(-1)[0];if(!(n&&!n.receiverSignature))return{expired:!1};let r=n?.senderKaiPulse;if(typeof r!=`number`)return{expired:!1};let i=r+77;return{expired:t>i,expireAt:i}}function us(e){let{contextOk:t,typeOk:n,hasCore:r,contentSigMatches:i,isOwner:a,hasTransfers:o,lastOpen:s,lastClosed:c,isUnsigned:l,childUsed:u,childExpired:d,parentOpenExpired:f,isChildContext:p}=e;return!t||!n?`invalid`:r?i===!1?`sigMismatch`:a===!1?`notOwner`:l?`unsigned`:s?d||f?`complete`:`readyReceive`:p?u||o&&c?`readySend`:`complete`:`readySend`:`structMismatch`}const ds=e=>`sigil:rotated:${e}`;function fs(e,t){let n=Array.from(new Set((e??[]).map(e=>String(e||``).toLowerCase()).filter(e=>e.length>0)));for(let e of n){try{typeof localStorage<`u`&&localStorage.setItem(ds(e),`${t}@${Kr()}`)}catch(e){Mo(`publishRotation.localStorage`,e)}try{let n=new BroadcastChannel(`sigil-xfer-v1`),r={type:`rotated`,canonical:e,token:t};n.postMessage(r),n.close()}catch(e){Mo(`publishRotation.bc`,e)}try{typeof window<`u`&&window.dispatchEvent(new CustomEvent(`sigil:transfer-rotated`,{detail:{canonical:e,token:t}}))}catch(e){Mo(`publishRotation.dispatch`,e)}}}(3+Math.sqrt(5))*1e3;const ps=`https://schema.phi.network/sigil/v1`,ms=`application/phi.kairos.sigil+svg`,hs=2e3,gs=e=>Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``);async function _s(e){let t=typeof e==`string`?new TextEncoder().encode(e):e,n=await crypto.subtle.digest(`SHA-256`,t);return gs(new Uint8Array(n))}var vs=`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`;function ys(e){let t=0n;for(let n of e)t=(t<<8n)+BigInt(n);let n=``;for(;t>0n;)n=vs[Number(t%58n)]+n,t/=58n;for(let t=0;t1;){let e=[];for(let n=0;n1;){let e=n%2==1?n-1:n+1,t=r[e]??r[n];i.push(t);let a=[];for(let e=0;eJSON.stringify(e)+`:`+ks(t[e])).join(`,`)+`}`}async function As(e){let{pulse:t,beat:n,stepIndex:r,chakraDay:i}=e;return typeof t!=`number`||typeof n!=`number`||typeof r!=`number`||typeof i!=`string`?null:_s(`${t}|${n}|${r}|${i}|${e.intentionSigil??``}`)}async function js(e){let t=await _s(e+`φ`),n=new Uint8Array(20);for(let e=0;e<20;e++)n[e]=parseInt(t.slice(e*2,e*2+2),16);return bs(n,0)}function Ms(e){let t={senderSignature:e.senderSignature,senderStamp:e.senderStamp,senderKaiPulse:e.senderKaiPulse};return e.payload&&(t.payload={name:e.payload.name,mime:e.payload.mime,size:e.payload.size}),e.receiverSignature&&(t.receiverSignature=e.receiverSignature),e.receiverStamp&&(t.receiverStamp=e.receiverStamp),e.receiverKaiPulse!=null&&(t.receiverKaiPulse=e.receiverKaiPulse),t}async function Ns(e){return _s(JSON.stringify(Ms(e)))}function Ps(e){let t={senderSignature:e.senderSignature,senderStamp:e.senderStamp,senderKaiPulse:e.senderKaiPulse};return e.payload&&(t.payload={name:e.payload.name,mime:e.payload.mime,size:e.payload.size}),t}async function Fs(e){return _s(JSON.stringify(Ps(e)))}async function Is(e){return ws(await Promise.all(e.map(Ns)))}async function Ls(e,t){return _s(ks({pulse:e.pulse??0,beat:e.beat??0,stepIndex:e.stepIndex??0,chakraDay:e.chakraDay??``,kaiSignature:e.kaiSignature??``,creatorPublicKey:e.creatorPublicKey??``,cumulativeTransfers:t??e.cumulativeTransfers??0,segments:(e.segments??[]).map(e=>({index:e.index,root:e.root,cid:e.cid,count:e.count})),segmentsMerkleRoot:e.segmentsMerkleRoot??``}))}function Rs(e){return(e.segments??[]).reduce((e,t)=>e+(t.count||0),0)}async function zs(e,t){return Ls(e,Rs(e)+t)}function Bs(e,t){let n=rs(e.chakraDay)??`Root`,r={v:1,type:`send`,sigil:{pulse:e.pulse??0,beat:e.beat??0,stepIndex:e.stepIndex??0,chakraDay:n,kaiSignature:e.kaiSignature??``},previousHeadRoot:t.previousHeadRoot,senderKaiPulse:t.senderKaiPulse,senderPubKey:t.senderPubKey,nonce:t.nonce,transferLeafHashSend:t.transferLeafHashSend};return new TextEncoder().encode(ks(r))}function Vs(e){let t={v:1,type:`receive`,link:e.senderSig,previousHeadRoot:e.previousHeadRoot,receiverKaiPulse:e.receiverKaiPulse,receiverPubKey:e.receiverPubKey,transferLeafHashReceive:e.transferLeafHashReceive};return new TextEncoder().encode(ks(t))}async function Hs(e){return _s(JSON.stringify({pulse:e.pulse,beat:e.beat,stepIndex:e.stepIndex,chakraDay:e.chakraDay,kaiSignature:e.kaiSignature,userPhiKey:e.userPhiKey,cumulativeTransfers:e.cumulativeTransfers??0,segments:(e.segments??[]).map(e=>({index:e.index,root:e.root,cid:e.cid,count:e.count})),segmentsMerkleRoot:e.segmentsMerkleRoot??``}))}function Us(e){let t=JSON.stringify(e);return btoa(unescape(encodeURIComponent(t))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function Ws(){let e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``)}async function Gs(e){return _s(ks(e))}async function Ks(e){let t=JSON.stringify(e),n=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(t));return[...new Uint8Array(n)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}function qs(e,t,n,r){let i=typeof window<`u`&&typeof window.location?.origin==`string`?window.location.origin:`http://localhost`,a=new URL(e,i);return a.searchParams.set(`p`,Us(t)),n&&a.searchParams.set(`t`,n),r&&r.length>0&&a.searchParams.set(`h`,r),a.toString()}var Js=0;function Ys(e,t){console.error(`[modal] ${e}:`,t)}function Xs(e){return!!(e.open||e.hasAttribute(`open`))}function Zs(){Js+=1,typeof document<`u`&&Js===1&&(document.documentElement.classList.add(`kk-dialog-open`),document.body.style.overflow=`hidden`,document.body.style.touchAction=`none`)}function Qs(){Js=Math.max(0,Js-1),typeof document<`u`&&Js===0&&(document.documentElement.classList.remove(`kk-dialog-open`),document.body.style.overflow=``,document.body.style.touchAction=``)}function $s(e){let t=()=>{e.removeEventListener(`close`,t),e.removeEventListener(`cancel`,t),e.setAttribute(`data-open`,`false`),e.removeAttribute(`data-rotate`),Qs()};e.addEventListener(`close`,t,{once:!0}),e.addEventListener(`cancel`,t,{once:!0})}function ec(e){return e.querySelector(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`)??null}function tc(e){if(!(typeof window>`u`||!e))try{if(Xs(e)){e.setAttribute(`data-open`,`true`);let t=ec(e)??e;typeof t.focus==`function`&&t.focus();return}let t=typeof e.showModal==`function`,n=typeof e.show==`function`;try{t?e.showModal():n?e.show():e.setAttribute(`open`,``)}catch(t){Ys(`showModal/show`,t),e.setAttribute(`open`,``)}e.setAttribute(`data-open`,`true`),$s(e),Zs();let r=ec(e)??e;typeof r.focus==`function`&&r.focus()}catch(e){Ys(`safeShowDialog`,e)}}function nc(e,t,n){let r=n?.delayMs??0,i=()=>{if(r>0){window.setTimeout(t,r);return}try{let e=typeof window<`u`?window.requestAnimationFrame:void 0;typeof e==`function`?e(()=>e(t)):window.setTimeout(t,16)}catch(e){Ys(`switchModal.runNext`,e),window.setTimeout(t,16)}};if(!e){i();return}try{if(Xs(e)){e.setAttribute(`data-open`,`false`),e.removeAttribute(`data-rotate`);let t=()=>{e.removeEventListener(`close`,t),Qs()};e.addEventListener(`close`,t,{once:!0});try{e.close()}catch(t){Ys(`current.close`,t),e.removeAttribute(`open`);try{e.dispatchEvent(new Event(`close`))}catch(e){Ys(`dispatch(close)`,e)}}i();return}}catch(e){Ys(`switchModal`,e)}i()}function rc(){let e=window;e.__SIGIL__||={};let t=e.__SIGIL__;return{registerSigilUrl:typeof t.registerSigilUrl==`function`?t.registerSigilUrl:void 0,registerSend:typeof t.registerSend==`function`?t.registerSend:void 0}}const ic=typeof window<`u`&&typeof document<`u`;function ac(e,t){if(!e||typeof e!=`object`)return;let n=t.split(`.`),r=e;for(let e of n)if(r&&typeof r==`object`&&e in r)r=r[e];else return;return r}function oc(e){return e==null?``:String(e)}function sc(e,t){for(let n of t){let t=ac(e,n);if(t!=null&&t!==``)return oc(t)}return``}function cc(e,t){if(!ic)return``;let n=oc(ac(e,`pulse`)),r=oc(ac(e,`beat`)),i=oc(ac(e,`stepIndex`)),a=n&&r&&i?`ks-${n}-${r}-${i}`:``,o=a?document.getElementById(a):null;if(!o)return``;let s=t.replace(/^data-/,``).replace(/-([a-z])/g,(e,t)=>t.toUpperCase());return(o.dataset||{})[s]??o.getAttribute(t)??``}const lc=({data:e})=>{if(typeof e!=`object`||!e)return(0,W.jsx)(`span`,{className:`json-primitive`,children:String(e)});let t=Array.isArray(e);return(0,W.jsx)(`ul`,{className:`json-node`,children:(t?e.map((e,t)=>[t,e]):Object.entries(e)).map(([e,n])=>(0,W.jsx)(`li`,{children:(0,W.jsxs)(`details`,{children:[(0,W.jsx)(`summary`,{children:t?`[${e}]`:`"${e}"`}),(0,W.jsx)(lc,{data:n})]})},String(e)))})};var uc=lc;const dc=({path:e,label:t})=>{let n={check:`M5 13l4 4L19 7`,x:`M6 6l12 12M6 18L18 6`,warn:`M12 9v4m0 4h.01M12 3l9 16H3z`,shield:`M12 3l7 4v6l-7 4-7-4V7l7-4z`,sigma:`M18 6H9l5 6-5 6h9M6 6h2M6 18h2`,phi:`M12 4a8 8 0 100 16 8 8 0 000-16zm0 0v16`,send:`M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z`,recv:`M2 22l11-11M2 22l20-7-9-4-4-9-7 20z`,done:`M12 21c4.97 0 9-4.03 9-9S16.97 3 12 3 3 7.03 3 12s4.03 9 9 9zm-1-6l6-6M8 12l3 3`,stack:`M12 3l9 4-9 4-9-4 9-4zm-9 8l9 4 9-4M3 19l9 4 9-4`,hash:`M10 3L8 21M16 3l-2 18M3 8h18M3 16h18`,zk:`M12 3l7 4v6l-7 4-7-4V7l7-4zM9 12h6`,paperclip:`M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.2a2 2 0 01-2.83-2.83l8.49-8.49`,lock:`M7 10V7a5 5 0 0110 0v3h1a2 2 0 012 2v7a2 2 0 01-2 2H6a2 2 0 01-2-2v-7a2 2 0 012-2h1zm3 0h4V7a3 3 0 00-6 0v3z`,timer:`M12 8v5l3 3M12 2a10 10 0 100 20 10 10 0 000-20`,ban:`M4.93 4.93l14.14 14.14M12 2a10 10 0 110 20 10 10 0 010-20`};return(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`18`,height:`18`,"aria-hidden":`true`,focusable:`false`,className:`ico`,children:[(0,W.jsx)(`path`,{d:n[e],stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`}),t?(0,W.jsx)(`title`,{children:t}):null]})},fc=({title:e,kind:t=`info`,children:n,badge:r=null})=>(0,W.jsx)(`span`,{className:`chip icon ${t}`,role:`img`,"aria-label":e,title:e,...r==null?{}:{"data-badge":String(r)},children:n});function pc({uiState:e,meta:t,contentSigMatches:n,phiKeyMatches:r,headProof:i,canonicalContext:a,childUsed:o,childExpired:s,parentOpenExpired:c,isSendFilename:l}){let u=[],d=e=>u.push(e);e===`invalid`&&d((0,W.jsx)(fc,{kind:`err`,title:`Invalid`,children:(0,W.jsx)(dc,{path:`x`})},`inv`)),e===`structMismatch`&&d((0,W.jsx)(fc,{kind:`err`,title:`Structure mismatch`,children:(0,W.jsx)(dc,{path:`warn`})},`struct`)),e===`sigMismatch`&&d((0,W.jsx)(fc,{kind:`err`,title:`Signature mismatch`,children:(0,W.jsx)(dc,{path:`x`})},`sigm`)),e===`notOwner`&&d((0,W.jsx)(fc,{kind:`warn`,title:`Not owner`,children:(0,W.jsx)(dc,{path:`shield`})},`owner`)),e===`unsigned`&&d((0,W.jsx)(fc,{kind:`warn`,title:`Unsigned`,children:(0,W.jsx)(dc,{path:`hash`})},`unsigned`)),e===`readySend`&&d((0,W.jsx)(fc,{kind:`info`,title:`Ready to send`,children:(0,W.jsx)(dc,{path:`send`})},`send`)),e===`readyReceive`&&d((0,W.jsx)(fc,{kind:`info`,title:`Ready to receive`,children:(0,W.jsx)(dc,{path:`recv`})},`recv`)),e===`complete`&&d((0,W.jsx)(fc,{kind:`ok`,title:`Receipt`,children:(0,W.jsx)(dc,{path:`done`})},`done`)),e===`verified`&&d((0,W.jsx)(fc,{kind:`ok`,title:`Verified`,children:(0,W.jsx)(dc,{path:`check`})},`ver`)),n===!0&&d((0,W.jsx)(fc,{kind:`ok`,title:`Content Σ match`,children:(0,W.jsx)(dc,{path:`sigma`})},`sigok`)),n===!1&&d((0,W.jsx)(fc,{kind:`err`,title:`Content Σ mismatch`,children:(0,W.jsx)(dc,{path:`sigma`})},`sigerr`)),r===!0&&d((0,W.jsx)(fc,{kind:`ok`,title:`Φ-Key match`,children:(0,W.jsx)(dc,{path:`phi`})},`phiok`)),r===!1&&d((0,W.jsx)(fc,{kind:`err`,title:`Φ-Key mismatch`,children:(0,W.jsx)(dc,{path:`phi`})},`phierr`)),t?.cumulativeTransfers!=null&&d((0,W.jsx)(fc,{kind:`info`,title:`Cumulative transfers`,badge:t.cumulativeTransfers,children:(0,W.jsx)(dc,{path:`hash`})},`cum`)),(t?.segments?.length??0)>0&&d((0,W.jsx)(fc,{kind:`info`,title:`Segments`,badge:t?.segments?.length??0,children:(0,W.jsx)(dc,{path:`stack`})},`segs`)),i&&d((0,W.jsx)(fc,{kind:i.ok?`ok`:`err`,title:i.ok?`Head proof verified`:`Head proof failed`,children:(0,W.jsx)(dc,{path:`shield`})},`headproof`)),t?.transfersWindowRootV14&&d((0,W.jsx)(fc,{kind:`info`,title:`v14 head root present`,children:(0,W.jsx)(dc,{path:`hash`})},`v14root`)),(t?.hardenedTransfers??[]).some(e=>!!(e.zkSend?.verified||e.zkReceive?.verified))&&d((0,W.jsx)(fc,{kind:`ok`,title:`Zero-knowledge proof verified`,children:(0,W.jsx)(dc,{path:`zk`})},`zk`));let f=a===`derivative`;return f&&o&&d((0,W.jsx)(fc,{kind:`warn`,title:`Transfer link used`,children:(0,W.jsx)(dc,{path:`lock`})},`used`)),f&&s&&d((0,W.jsx)(fc,{kind:`warn`,title:`Transfer link expired`,children:(0,W.jsx)(dc,{path:`timer`})},`expired`)),a===`parent`&&c&&d((0,W.jsx)(fc,{kind:`warn`,title:`Send expired`,children:(0,W.jsx)(dc,{path:`timer`})},`pexp`)),l&&d((0,W.jsx)(fc,{kind:`warn`,title:`SEND file: segmentation disabled`,children:(0,W.jsx)(dc,{path:`ban`})},`nosg`)),u}var mc=({className:e,scrollable:t=!0,ariaLive:n=`polite`,...r})=>{let i=pc(r);return(0,W.jsxs)(`div`,{className:`status-chips ${e??``}`,role:`group`,"aria-label":`Verification status`,"aria-live":n,style:t?{overflowX:`auto`,whiteSpace:`nowrap`}:void 0,"data-count":i.length,children:[(0,W.jsx)(`span`,{className:`chip-sentinel`,"aria-hidden":`true`}),i.map((e,t)=>(0,W.jsx)(`span`,{className:`chip-wrap`,"data-i":t,style:{display:`inline-block`},children:e},t))]})},hc=u(y(),1),gc=`sigil:urls`;function _c(e){if(!(typeof window>`u`))try{let t=window.localStorage.getItem(gc),n=t?JSON.parse(t):[];n.includes(e)||(n.push(e),window.localStorage.setItem(gc,JSON.stringify(n)));let r=new CustomEvent(`sigil:url-registered`,{detail:{url:e}});window.dispatchEvent(r)}catch{}}var vc=e=>{let{open:t,url:n,hash:r,onClose:i}=e,a=(0,C.useRef)(null),o=(0,C.useRef)(null),s=(0,C.useRef)(null),c=(0,C.useRef)(null),[l,u]=(0,C.useState)(``),d=(0,C.useRef)(null);(0,C.useEffect)(()=>{if(!(!t||!n)&&d.current!==n)if(d.current=n,typeof window<`u`&&window.__SIGIL__&&typeof window.__SIGIL__.registerSigilUrl==`function`)try{window.__SIGIL__.registerSigilUrl(n)}catch{_c(n)}else _c(n)},[t,n]),(0,C.useEffect)(()=>{let e=a.current;if(!e)return;let n=e=>e.preventDefault();if(e.addEventListener(`cancel`,n),t){c.current=document.activeElement??null;try{if(!e.open)try{e.showModal()}catch{e.show()}e.setAttribute(`data-open`,`true`)}catch{}let t=window.setTimeout(()=>s.current?.focus({preventScroll:!0}),0);return()=>{clearTimeout(t),e.removeEventListener(`cancel`,n)}}else e.open&&e.close(),e.setAttribute(`data-open`,`false`),e.removeEventListener(`cancel`,n),c.current?.focus?.()},[t]);let f=(0,C.useMemo)(()=>{if(typeof navigator>`u`)return!1;let e=navigator;return typeof e.share==`function`?n&&typeof e.canShare==`function`?e.canShare({url:n}):!0:!1},[n]),p=(0,C.useCallback)(e=>{if(e.key!==`Tab`)return;let t=o.current;if(!t)return;let n=t.querySelectorAll([`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex='-1'])`].join(`,`));if(n.length===0)return;let r=n[0],i=n[n.length-1];!e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus())},[]);(0,C.useEffect)(()=>{if(!t)return;let e=e=>p(e);return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[t,p]);let m=e=>{u(e),window.setTimeout(()=>u(``),900)},h=async(e,t)=>{try{await navigator.clipboard.writeText(e),m(`${t} copied to clipboard`)}catch{m(`Could not copy ${t}`)}},g=async()=>{try{f&&typeof navigator<`u`?(await navigator.share?.({title:`Kairos Sigil-Glyph`,text:`Sealed Kairos Moment`,url:n}),m(`Share sheet opened`)):await h(n,`Link`)}catch{}},_=(0,C.useMemo)(()=>r?r.slice(0,16):`—`,[r]),v=e=>{e.preventDefault(),e.stopPropagation(),i?.()};return t?(0,hc.createPortal)((0,W.jsxs)(`dialog`,{ref:a,className:`seal-dialog seal-toplayer glass-modal fullscreen`,"aria-label":`Moment Sealed`,style:{zIndex:2147483647,padding:0,border:`none`,background:`transparent`},children:[(0,W.jsx)(`div`,{className:`seal-veil`,"aria-hidden":`true`}),(0,W.jsxs)(`div`,{ref:o,className:`seal-card`,role:`document`,onClick:e=>e.stopPropagation(),children:[(0,W.jsx)(`div`,{className:`seal-ornament seal-ornament--tl`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`seal-ornament seal-ornament--tr`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`seal-ornament seal-ornament--bl`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`seal-ornament seal-ornament--br`,"aria-hidden":`true`}),(0,W.jsx)(`button`,{ref:s,className:`seal-close`,"aria-label":`Close`,onClick:v,type:`button`,children:(0,W.jsx)(yc,{})}),(0,W.jsxs)(`header`,{className:`seal-header`,children:[(0,W.jsx)(`h3`,{id:`seal-title`,className:`seal-title`,children:`Moment Sealed`}),(0,W.jsx)(`p`,{id:`seal-desc`,className:`seal-subtitle`,children:`Your Kairos imprint is preserved. Proceed to the url below to Inhale Claimed Ownership.`})]}),(0,W.jsxs)(`label`,{className:`field`,children:[(0,W.jsx)(`span`,{className:`field-label`,children:`Hash`}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`code`,{className:`hash`,title:r||`—`,children:r?_:`—`}),(0,W.jsx)(`button`,{className:`icon-btn`,onClick:()=>h(r,`Hash`),disabled:!r,"aria-label":`Copy hash`,title:`Copy hash`,type:`button`,children:(0,W.jsx)(xc,{})})]}),r&&(0,W.jsxs)(`p`,{className:`micro`,children:[`Full: `,(0,W.jsx)(`span`,{className:`mono`,children:r})]})]}),(0,W.jsxs)(`label`,{className:`field`,children:[(0,W.jsx)(`span`,{className:`field-label`,children:`URL`}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`input`,{className:`url-input`,value:n,readOnly:!0,"aria-readonly":`true`,spellCheck:!1,dir:`ltr`,title:n,onFocus:e=>e.currentTarget.select()}),(0,W.jsx)(`button`,{className:`icon-btn`,onClick:()=>h(n,`Link`),disabled:!n,"aria-label":`Copy link`,title:`Copy link`,type:`button`,children:(0,W.jsx)(xc,{})}),n&&(0,W.jsx)(`a`,{className:`open-link`,href:n,target:`_blank`,rel:`noopener`,"aria-label":`Open link in new tab`,title:`Open link`,children:(0,W.jsx)(Sc,{})})]})]}),(0,W.jsx)(`div`,{className:`cta-row`,children:(0,W.jsxs)(`button`,{className:`secondary cta`,onClick:g,type:`button`,children:[(0,W.jsx)(bc,{}),(0,W.jsx)(`span`,{children:f?`Share`:`Remember Link`})]})}),(0,W.jsx)(`p`,{className:`fine`,children:`This moment is now sealed in time. Use the link above within the next 11 breaths to claim ownership & gain permanent access to this kairos moment.`}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:l})]})]}),document.body):null},yc=()=>(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`seal-close-ico`,children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,opacity:`.35`}),(0,W.jsx)(`path`,{d:`M7 7l10 10M17 7L7 17`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`})]}),bc=()=>(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,W.jsx)(`path`,{d:`M15 8a3 3 0 100-6 3 3 0 000 6zM6 14a3 3 0 100-6 3 3 0 000 6zm9 12a3 3 0 100-6 3 3 0 000 6z`,fill:`currentColor`}),(0,W.jsx)(`path`,{d:`M8.6 9.7l6.8-3.4M8.6 12.3l6.8 3.4`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`})]}),xc=()=>(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,W.jsx)(`rect`,{x:`9`,y:`9`,width:`10`,height:`10`,rx:`2`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,W.jsx)(`rect`,{x:`5`,y:`5`,width:`10`,height:`10`,rx:`2`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`,opacity:`.5`})]}),Sc=()=>(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,W.jsx)(`path`,{d:`M10 14a5 5 0 007.07 0l1.41-1.41a5 5 0 00-7.07-7.07L10 6`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,W.jsx)(`path`,{d:`M14 10a5 5 0 00-7.07 0L5.5 11.43a5 5 0 007.07 7.07L14 18`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`})]}),Cc=vc,G=(1+Math.sqrt(5))/2,wc=44,Tc=11,Ec=wc*Tc,Dc=17491.270421,Oc=G,kc=1/G,Ac={low:1-1/G**6,med:1,high:1+1/G**6},jc=1/G**6,Mc=1/G**5,Nc=1/G**3,Pc=1/G**4,Fc=1+1/G**4,Ic=.7,Lc=.3,Rc=1/Lc,zc=1/G**6,Bc=1/G**6,Vc=.15,Hc=1/G**5,Uc=1+1/G**3,Wc=1/G**5,Gc=Dc,Kc=1/G**7,qc=1/G**7,Jc=1/G**8,Yc=1/G,Xc=1/G**2,Zc=1/G**2,Qc=1/G**3,$c=1/G**4,el=1/G**4,tl=1/G**5,nl=1/G**6,rl=1/G**5,il=Dc*365,al=il,ol=1/G**3,sl=1/G**2,cl=1/G**4,ll=1/G**6,ul=1/G**7,dl=1/G**8,fl=1/G**8,pl=1/G**9,ml=1/G**4,hl=1/G,gl={RARITY_ONE_OF_ONE:Oc,RARITY_EXP:kc,QUALITY_MAP:Ac,CREATOR_VERIFIED_LIFT:jc,CREATOR_REP_MAX:Mc,PROV_LOG_SLOPE:Nc,HOLD_SLOPE:Pc,HOLD_CAP:Fc,CLOSURE_CENTER:Ic,CLOSURE_RANGE:Lc,CLOSURE_GAIN:zc,CADENCE_GAIN:Bc,CHURN_KAPPA:Vc,AGE_EPS:Hc,AGE_CAP:Uc,RESONANCE_GAIN:Wc,DISCOUNT_PULSE_HALFSPAN:Gc,GEOM_EDGE_GAIN:Kc,GEOM_PHI_GAIN:qc,GEOM_PRIME_GAIN:Jc,MOMENT_FIB_EXACT_GAIN:Yc,MOMENT_LUCAS_EXACT_GAIN:Xc,MOMENT_PHI_TRANSITION_GAIN:Zc,MOMENT_UNIFORM_GAIN:Qc,MOMENT_PAL_GAIN:$c,MOMENT_RUN_GAIN:el,MOMENT_SEQ_GAIN:tl,MOMENT_LOW_ENTROPY_GAIN:nl,GENESIS_BIAS_GAIN:rl,YEAR_PULSES_APPROX:il,ADOPTION_TAU_PULSES:al,ADOPTION_GAIN_BASE:ol,ADOPTION_GAIN_RARE:sl,INDEX_SCARCITY_GAIN:cl,FIB_STEP_GAIN:ll,LUCAS_STEP_GAIN:ul,BREATH_WAVE_GAIN:dl,DAY_WAVE_GAIN:fl,STROBE_WAVE_GAIN:pl,MOMENT_AFFINITY_GAIN_BASE:ml,MOMENT_AFFINITY_DIGIT_WEIGHT:hl,DEFAULT_STEPS_PER_BEAT:wc,PULSES_PER_STEP:Tc,PULSES_PER_BEAT_CANON:Ec,PULSES_PER_DAY_EXACT:Dc,PHI:G};function _l(e){if(e===null)return`null`;switch(typeof e){case`string`:case`number`:case`boolean`:return JSON.stringify(e);case`object`:{if(Array.isArray(e))return`[`+e.map(_l).join(`,`)+`]`;let t=e;return`{`+Object.keys(t).sort().map(e=>JSON.stringify(e)+`:`+_l(t[e])).join(`,`)+`}`}default:return`null`}}function vl(e){return _l(e)}function yl(){let e=`val-policy:`+vl(gl),t=2166136261;for(let n=0;n>>0;return(`00000000`+(t>>>0).toString(16)).slice(-8)}var bl=yl(),xl=(e,t,n)=>Math.max(t,Math.min(n,e)),Sl=e=>Math.log(1+Math.max(0,e)),Cl=e=>e-Math.floor(e);function wl(e){if(!e.length)return 0;let t=e.slice().sort((e,t)=>e-t),n=Math.floor(t.length/2);return t.length%2?t[n]:(t[n-1]+t[n])/2}function Tl(e){let t=new Set;for(let n of e)n.receiverSignature&&t.add(n.receiverSignature);return Math.max(t.size,1)}function El(e){return e.filter(e=>e.receiverSignature&&e.receiverKaiPulse!=null)}function Dl(e){if(e.length<2)return[];let t=[];for(let n=1;n=r&&t.push(i-r)}return t}function Ol(e){if(e.length===0)return 1;let t=wl(e)||1,n=0;for(let r of e)n+=Math.abs(r-t)/t;return 1/(1+n/e.length)}function kl(e,t){let n=e?.expectedCashflowPhi?.map(e=>({atPulse:e.atPulse,amount:e.amountPhi}))??[],r=e?.expectedCashflowKS?.map(e=>({atPulse:e.atPulse,amount:e.amountKS}))??[];return[...n,...r].reduce((e,n)=>{let r=n.atPulse-t,i=1/(1+Math.max(0,r)/Gc);return e+n.amount*i},0)}function Al(e){if(!e||!Number.isFinite(e)||e<=0)return .5;let t=Math.log(e)/Math.log(G);return .5+.5*xl(1-2*Math.abs(t-Math.round(t)),0,1)}function jl(e){if(typeof e!=`number`||!Number.isFinite(e)||e<2)return!1;let t=Math.floor(e);if(t%2==0)return t===2;for(let e=3;e*e<=t;e+=2)if(t%e===0)return!1;return!0}function Ml(e,t,n){let r=1;if(typeof e.stepIndex==`number`&&(e.stepIndex===0||e.stepIndex===(t>0?t-1:-1))&&(r*=1+Kc),jl(e.beat)&&(r*=1+Jc),n>.9){let e=(n-.9)/.1;r*=1+qc*xl(e,0,1)}return r}function Nl(e){if(e<0n)throw Error(`sqrt of negative`);if(e<2n)return e;let t=e,n=(e>>1n)+1n;for(;n>1n;return t}function Pl(e){if(e<0n)return!1;let t=Nl(e);return t*t===e}var Fl=new Map;function Il(e){if(!Number.isFinite(e)||e<0)return!1;let t=Math.trunc(Math.abs(e)),n=Fl.get(t);if(n!==void 0)return n;let r=BigInt(t),i=5n*r*r+4n,a=5n*r*r-4n,o=Pl(i)||Pl(a);return Fl.set(t,o),o}var Ll=new Map;function Rl(e){if(!Number.isFinite(e)||e<0)return!1;let t=Math.trunc(Math.abs(e)),n=Ll.get(t);if(n!==void 0)return n;let r=BigInt(t),i=2n,a=1n;for(;at&&(t=n)):n=1;return t}function Ul(e){if(e.length===0)return{len:0,digit:``};let t=1,n=1,r=e[0],i=e[0];for(let a=1;at&&(t=n,r=i)):(n=1,i=e[a]);return{len:t,digit:r}}function Wl(e){if(e.length<=1)return 1;let t=1,n=1,r=0;for(let i=1;it&&(t=n)}return t}function Gl(e){if(e.length===0)return 1;let t=Array(10).fill(0);for(let n of e)t[n.charCodeAt(0)-48]++;let n=0;for(let r of t)if(r){let t=r/e.length;n-=t*Math.log(t)}let r=Math.log(Math.min(10,e.length));return xl(n/(r||1),0,1)}function Kl(e){return!Number.isFinite(e)||e<0?1:1+rl*(1-2*(e/(e+il)))}var ql=new Map;function Jl(e){if(!Number.isFinite(e)||e<1)return null;let t=Math.trunc(e),n=ql.get(t);if(n!==void 0)return n;let r=t,i=Math.log(r)/Math.log(G),a=Math.max(1,Math.floor(i)-2),o=null;for(let e=a;e<=a+6;e++)if(Math.ceil(G**+e)===r){o=e;break}return ql.set(t,o),o}function Yl(e){if(!Number.isFinite(e)||e<0)return 1;let t=zl(e),n=t.length,r=1;Il(e)&&(r*=1+Yc),Rl(e)&&(r*=1+Xc),Jl(e)!==null&&(r*=1+Zc),Bl(t)&&(r*=1+Qc),Vl(t)&&(r*=1+$c);let i=Hl(t);if(i>=3){let e=xl((i-2)/Math.max(3,n-2),0,1);r*=1+el*e}let a=Wl(t);if(a>=4){let e=xl((a-3)/Math.max(4,n-3),0,1);r*=1+tl*e}let o=Gl(t);return r*=1+nl*(1-o),r}function Xl(e){if(!Number.isFinite(e)||e<0)return 0;let t=zl(e),n=t.length,r=0,i=0,a=Il(e)?1:0;r+=1*a,i+=1;let o=Rl(e)?1:0;r+=1/G*o,i+=1/G;let s=Bl(t)?1:0;r+=1/G*s,i+=1/G;let c=Vl(t)?1:0;r+=1/G**2*c,i+=1/G**2;let l=xl((Hl(t)-2)/Math.max(3,n-2),0,1);r+=1/G**2*l,i+=1/G**2;let u=xl((Wl(t)-3)/Math.max(4,n-3),0,1);r+=1/G**3*u,i+=1/G**3;let d=Gl(t);return r+=1/G**3*(1-d),i+=1/G**3,i<=0?0:xl(r/i,0,1)}function Zl(e){if(!e.length)return 1;let t=0;for(let n of e)t+=Math.log(Math.max(n,1e-12));return Math.exp(t/e.length)}function Ql(e,t,n){if(!Number.isFinite(e)||!Number.isFinite(t)||n<=0)return .5;let r=((e-t)%n+n)%n,i=2*Math.PI*r/n;return .5*(1+Math.cos(i))}function $l(e,t){return!Number.isFinite(e)||t<=0?0:Math.floor(Math.floor(Math.max(0,e))/Tc)%t}function eu(e){return Number.isFinite(e)?Math.floor(Math.max(0,e))%Tc:0}function tu(e){return!Number.isFinite(e)||e<=0?0:Cl(Math.log(e)/Math.log(G))}function nu(e,t){if(e.size===0&&t.size===0)return 0;let n=new Set([...e,...t]),r=0;for(let n of e)t.has(n)&&r++;return r/n.size}function ru(e){let t=new Set;Il(e)&&t.add(`fib`),Rl(e)&&t.add(`lucas`);let n=zl(e);return Bl(n)&&t.add(`uniform`),Vl(n)&&t.add(`pal`),Hl(n)>=4&&t.add(`longrun`),Wl(n)>=5&&t.add(`longseq`),t}function iu(e){return!Number.isFinite(e)||e<=0?0:1-G**+(-e/al)}function au(e){if(!Number.isFinite(e)||e<=0)return 0;let t=1n,n=1n,r=0,i=BigInt(Math.trunc(e));for(;n<=i;){r++;let e=t+n;t=n,n=e}return r}function ou(e){if(!Number.isFinite(e)||e<=0)return 0;let t=2n,n=1n,r=0,i=BigInt(Math.trunc(e));for(;n<=i;){r++;let e=t+n;t=n,n=e}return r}function su(e,t){let n=Cl((e+t)*G);return{phase01:n,wave:1+pl*(2*n-1)}}function cu(e){return Number.isFinite(e)&&e>0?Math.trunc(e):wc}function lu(e,t){return typeof e.kaiPulse==`number`?e.kaiPulse:typeof e.pulse==`number`?e.pulse:t}function uu(e,t,n){return typeof e.stepIndex==`number`&&Number.isFinite(e.stepIndex)?xl(Math.trunc(e.stepIndex),0,t-1):$l(n,t)}function du(e,t,n){return typeof e.beat==`number`&&Number.isFinite(e.beat)?Math.trunc(e.beat):Math.floor(n/t)}function fu(e){return Object.freeze(e.inputs),Object.freeze(e.headRef),Object.freeze(e)}var pu=new Map;function mu(e,t){let n=cu(e.stepsPerBeat),r=n*Tc,i=lu(e,t),a=e.transfers??[],o=El(a),s=Math.max(1,(t-i)/r),c=a.length/s,l=Tl(a),u=a.length===0?1:o.length/a.length,d=Ol(Dl(a)),f=wl(o.map(e=>(e.receiverKaiPulse-e.senderKaiPulse)/r).filter(e=>e>=0)),p=Al(e.frequencyHz),m=uu(e,n,i),h=du(e,r,i),g=Ml({...e,stepIndex:m,beat:h},n,p),_=Math.max(0,t-i),v=kl(e.ip,t),y=e.seriesSize??1,b=y<=1?Oc:y**+-kc,x=e.quality??`med`,S=Ac[x],C=(e.creatorVerified?1+jc:1)+(e.creatorRep??0)*Mc,w=1+Nc*Sl(l-1),T=1+zc*xl((u-Ic)*Rc,-1,1),E=1+Bc*(2*d-1),D=xl(1+Pc*Sl(f),1,Fc),O=1+Wc*(2*p-1),k=_/r,A=Math.min(Uc,1+Hc*Sl(k)),j=1/(1+Vc*Math.max(0,c)),M=Yl(i),N=Zl(o.map(e=>Number.isFinite(e.receiverKaiPulse)?Yl(e.receiverKaiPulse):1)),P=Kl(i),F=M*Math.max(1,N)*P,I=b*S*C*w*T*E*D*O*A*j*g*F,L=iu(i),R=iu(t),z=Math.max(0,R-L),B=Xl(i),V=ol+sl*B,H=Math.exp(V*z),U=1+cl*(1-L),ee=au(_),te=ou(_),ne=Math.exp(ll*ee),re=Math.exp(ul*te),ie=U*H*ne*re,ae=1*M*U*H*ne*re*Math.max(1,P),oe=r>0?t%r/r:0,se=1+dl*(.5+.5*d)*Math.sin(2*Math.PI*oe),ce=Cl(t/Dc),le=Cl(i/Dc),ue=1-Math.abs((ce-le+1)%1-.5)*2,de=1+fl*(.5+.5*p)*(.5+.5*d)*(2*ue-1),{phase01:fe,wave:pe}=su(i,t),me=m,he=Ql($l(t,n),me,n),ge=eu(i),_e=Ql(eu(t),ge,Tc),ve=1-Math.abs((tu(t+1)-tu(i+1)+1)%1-.5)*2,ye=B,be=Xl(t),xe=1-Math.abs(ye-be),Se=hl*nu(ru(i),ru(t))+(1-hl)*xe,Ce=.3*he+.3*_e+.2*ve+.2*Se,we=ml*(.5+.5*ye)*(.5+.5*p),Te=1+we*(2*Ce-1),Ee=se*de*pe*Te,De=I*ie,Oe=Math.max(0,De-ae),ke=ae+Oe*Ee,Ae=1*ke+v,je={headHash:void 0,transfersWindowRoot:e.transfersWindowRoot,cumulativeTransfers:e.cumulativeTransfers??a.length},Me={size:y,quality:x,creatorVerified:!!e.creatorVerified,creatorRep:e.creatorRep??0,uniqueHolders:l,closedFraction:u,cadenceRegularity:d,medianHoldBeats:f,velocityPerBeat:c,resonancePhi:p,pulsesPerBeat:r,agePulses:_,geometryLift:g,momentLift:F,pv_phi:v,algorithmVersion:`phi/kosmos-vφ-5`,adoptionAtClaim:L,adoptionNow:R,adoptionDelta:z,rarityScore01:B,fibAccrualLevels:ee,lucasAccrualLevels:te,indexScarcity:U,adoptionLift:H,fibAccrualLift:ne,lucasAccrualLift:re,breathPhase01:oe,breathWave:se,dayPhase01:ce,dayWave:de,strobePhase01:fe,strobeWave:pe,momentAffinitySim01:Ce,momentAffinityAmp:we,momentAffinityOsc:Te,combinedOsc:Ee,dynamicGrowth:ie,rarityFloor:ae,premiumBandBase:Oe},Ne=bl,Pe={version:1,unit:`Φ`,algorithm:`phi/kosmos-vφ-5`,policyId:e.valuationPolicyId,policyChecksum:Ne,valuePhi:Ae,premium:ke,inputs:Me,computedAtPulse:t,headRef:je},Fe=vl({algorithm:Pe.algorithm,policy:Pe.policyId??null,policyChecksum:Pe.policyChecksum,inputs:Pe.inputs,minimalHead:{headHash:Pe.headRef.headHash??null,transfersWindowRoot:Pe.headRef.transfersWindowRoot??null,cumulativeTransfers:Pe.headRef.cumulativeTransfers}}),Ie=pu.get(Fe);if(Ie)return{unsigned:Ie,stampPayload:Fe};let Le=fu({...Pe,inputs:{...Pe.inputs},headRef:{...Pe.headRef}});return pu.set(Fe,Le),{unsigned:Le,stampPayload:Fe}}async function hu(e,t,n,r){let{unsigned:i,stampPayload:a}=mu(e,t),o={...i,headRef:{...i.headRef,headHash:r}},s=await n(a);return{seal:{...o,stamp:s}}}function gu(e,t){return{...e,valuation:t}}function _u(e){let t=e.inputs;return[`Algorithm: ${e.algorithm} • Policy checksum: ${e.policyChecksum}`,`Series rarity: size=${t.size} → rarityFactor≈${t.size<=1?Oc:t.size**+-kc}`,`Moment lifts: geometry=${t.geometryLift} × numericMoment=${t.momentLift} × genesis/baseline floor=${t.rarityFloor}`,`Adoption field: ΔA=${t.adoptionDelta} → adoptionLift=${t.adoptionLift} • indexScarcity=${t.indexScarcity} • fibLevels=${t.fibAccrualLevels} • lucasLevels=${t.lucasAccrualLevels}`,`Live alignment: breath=${t.breathWave} • day=${t.dayWave} • strobe=${t.strobeWave} • affinity=${t.momentAffinityOsc} → combined=${t.combinedOsc}`,`Premium: floor=${t.rarityFloor} + band=${t.premiumBandBase} × combined=${t.combinedOsc} ⇒ premium=${e.premium} → valueΦ=${e.valuePhi}`].join(` +`);return lr()}function xr(e){let t=sr(e,Jn,Yn*1000000n);return BigInt(In)+t}var Sr=86400000n,Cr=3600000n,wr=60000n,Tr=1000n,Er=/^([+-]?\d{4,})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?(Z|[+-]\d{2}:\d{2})$/,Dr=ar;function Or(e,t,n){let r=t<=2n?e-1n:e,i=t<=2n?t+12n:t,a=Dr(r>=0n?r:r-399n,400n),o=r-a*400n,s=Dr(153n*(i-3n)+2n,5n)+n-1n,c=o*365n+Dr(o,4n)-Dr(o,100n)+s;return a*146097n+c-719468n}function kr(e){let t=Er.exec(e);if(!t){let t=new Date(e).getTime();if(Number.isFinite(t))return BigInt(Math.trunc(t));throw Error(`Invalid ISO datetime.`)}let[,n,r,i,a,o,s=`00`,c=`0`,l]=t,u=BigInt(n),d=BigInt(r),f=BigInt(i),p=BigInt(a),m=BigInt(o),h=BigInt(s),g=0n;if(c&&c!==`0`){let e=(c+`000000000`).slice(0,9);g=(BigInt(e)+500000n)/1000000n}let _=p*Cr+m*wr+h*Tr+g,v=0n;if(l!==`Z`){let e=l[0]===`-`?-1n:1n,[t,n]=l.slice(1).split(`:`);v=e*(BigInt(t)*60n+BigInt(n))}return Or(u,d,f)*Sr+_-v*wr}function Ar(e){return sr(typeof e==`bigint`?e:BigInt(Math.trunc(e)),Xn,Zn)}function jr(e){let t;if(typeof e==`bigint`)t=e;else if(typeof e==`number`){if(!Number.isFinite(e))throw Error(`Invalid ms epoch number.`);t=BigInt(Math.trunc(e))}else if(typeof e==`string`)t=kr(e);else{let n=e.getTime();if(!Number.isFinite(n))throw Error(`Invalid Date: ${String(e)}`);t=BigInt(Math.trunc(n))}return sr(t-BigInt(In),Xn,Zn)}function Mr(e){let t=sr(typeof e==`bigint`?e:BigInt(Math.trunc(e)),Jn,Yn);return BigInt(In)+t}function Nr(e){let t=ir(e,Bn)%Un,n=t/Hn,r=t-n*Hn,i=r/Vn,a=r-i*Vn,o=Number(a)/Number(Vn);return{beat:Number(n),stepIndex:Number(i),percentIntoStep:o}}function Pr(e){let t=or(ar(e,1000000n)),{beat:n,stepIndex:r,percentIntoStep:i}=Nr(e),a=er((r+i)/44),{weekday:o,chakraDay:s}=cr(or(ir(ar(e,Bn),nr(Qn.length))));return{pulse:t,beat:n,stepIndex:r,stepPctAcrossBeat:a,chakraDay:s,weekday:o}}function Fr(e){return Pr(jr(e))}function Ir(e){return Fr(Mr(e))}function Lr(e,t){let n=new Date(e);if(Number.isNaN(n.getTime()))return``;let r=n.getTime(),i=r-r%6e4,a=Math.max(1,Math.floor(t))-1,o=sr(BigInt(a),Jn,Yn),s=BigInt(i)+o;return new Date(Number(s)).toISOString()}function Rr(e){let t=Number(e.kaiPulseEternal)||0,[n,r]=(e.chakraStepString??``).trim().split(`:`),i=Math.max(0,Math.min(35,Math.floor(Number(n))||0)),a=Math.max(0,Math.min(43,Math.floor(Number(r))||0)),o=0;if(typeof e.chakraStep?.percentIntoStep==`number`){let t=e.chakraStep.percentIntoStep;o=t>1.0000001?t/100:t,o=tr(o)}let s=er((a+o)/44),c=e=>{if(!e)return null;let t=e.trim().toLowerCase();return{root:`Root`,sacral:`Sacral`,"solar plexus":`Solar Plexus`,heart:`Heart`,throat:`Throat`,"third eye":`Third Eye`,thirdeye:`Third Eye`,crown:`Crown`}[t]??null},l=Qn[or(ir(ar(BigInt(Math.trunc(t))*1000000n,Bn),nr(Qn.length)))],u=e.harmonicDay??l,d=c(e.eternalChakraArc)??$n[u];return{pulse:Math.trunc(t),beat:i,stepIndex:a,stepPctAcrossBeat:s,chakraDay:d,weekday:u}}async function zr(e){return e===void 0?Promise.resolve(Pr(br())):Promise.resolve(Fr(e))}async function Br(e,t){return e===void 0?t?Promise.resolve(Fr(t)):Promise.resolve(Pr(br())):Promise.resolve(Fr(e))}function Vr(e){let t=Math.floor(tr(e)*44);return Math.max(0,Math.min(43,t))}function Hr(e,t){let n=e+1,r=t+1,i=e=>String(e).padStart(2,`0`);return{beat1:n,step1:r,label:`${i(n)}:${i(r)}`}}function Ur(e,t){let n=Math.max(0,Math.min(35,Math.floor(e))),r=Math.max(0,Math.min(43,Math.floor(t)));return`${n}:${String(r).padStart(2,`0`)}`}function Wr(e,t){return Lr(e,t)}function Gr(e){return Fr(e)}function Kr(e){return typeof e==`bigint`?jr(e):br()}function qr(e){return Pr(Kr(e))}var Jr=51.4769,Yr=0,Xr=Math.PI/180,Zr=1/(2*Math.PI),Qr=2440587.5,$r=new Map;function ei(e){return e/864e5+Qr}function ti(e){return(e-Qr)*864e5}function ni(e){let t=e%360;return t<0?t+360:t}function ri(e,t,n){return en?n:e}function ii(e){let t=new Date(Number(e));return{y:t.getUTCFullYear(),m:t.getUTCMonth()+1,d:t.getUTCDate()}}function ai(e,t){let n=-t*Xr,r=Math.round(e-2451545.0009-n*Zr);return 2451545.0009+n*Zr+r}function oi(e,t,n,r=Jr,i=Yr){let a=ai(ei(Date.UTC(e,t-1,n)),i),o=357.5291+.98560028*(a-2451545),s=o*Xr,c=ni(o+(1.9148*Math.sin(s)+.02*Math.sin(2*s)+3e-4*Math.sin(3*s))+180+102.9372)*Xr,l=a+.0053*Math.sin(s)-.0069*Math.sin(2*c),u=23.4397*Xr,d=Math.asin(Math.sin(c)*Math.sin(u)),f=r*Xr,p=-.833*Xr,m=(Math.sin(p)-Math.sin(f)*Math.sin(d))/(Math.cos(f)*Math.cos(d));return l-Math.acos(ri(m,-1,1))*Zr}function si(e){let{y:t,m:n,d:r}=ii(e),i=`${t}-${String(n).padStart(2,`0`)}-${String(r).padStart(2,`0`)}`,a=$r.get(i);if(a!==void 0)return a;let o=oi(t,n,r),s=BigInt(Math.round(ti(o)));return $r.set(i,s),s}var ci=[`Ignition Ark`,`Integration Ark`,`Harmonization Ark`,`Reflection Ark`,`Purification Ark`,`Dream Ark`],li={"Ignition Ark":`Ignite Ark`,"Integration Ark":`Integration Ark`,"Harmonization Ark":`Harmonization Ark`,"Reflection Ark":`Reflection Ark`,"Purification Ark":`Purify Ark`,"Dream Ark":`Dream Ark`},ui={"Ignition Ark":`Resurrection, will, awakening`,"Integration Ark":`Emotional grounding, emergence`,"Harmonization Ark":`Radiance, balance, coherent action`,"Reflection Ark":`Union, compassion, spoken resonance`,"Purification Ark":`Truth, remembrance, etheric light`,"Dream Ark":`Divine memory, lucid integration, dreaming awake`},di=[{name:`Aethon`,desc:`Resurrection fire: Root awakening`},{name:`Virelai`,desc:`Waters of becoming: Emotional emergence`},{name:`Solari`,desc:`Solar ignition: Radiant embodiment`},{name:`Amarin`,desc:`Heart bloom: Sacred balance`},{name:`Kaelus`,desc:`Voice of stars: Resonant expression`},{name:`Umbriel`,desc:`Divine remembrance: Krown alignment`},{name:`Noktura`,desc:`Light spiral: Selestial flow`},{name:`Liora`,desc:`Eternal mirror: Infinite now`}],fi=[{name:`Awakening Flame`,desc:`Root fire of ignition, will, resurrektion`},{name:`Flowing Heart`,desc:`Emotional waters, intimasy, surrender`},{name:`Radiant Will`,desc:`Solar klarity, aligned konfidence, embodiment`},{name:`Harmonic Voice`,desc:`Spoken truth, vibration, koherense in sound`},{name:`Inner Mirror`,desc:`Reflektion, purifikation, self-seeing`},{name:`Dreamfire Memory`,desc:`Lusid vision, divine memory, encoded light`},{name:`Krowned Light`,desc:`Integration, sovereignty, harmonik ascension`}],pi=44,mi=36;function hi(e){let t=Math.max(0,Math.min(5,Math.floor(e/6))),n=ci[t];return{idx:t,name:n,desc:ui[n]}}function gi(e,t){if(t===0n)return 0;let n=Number(e)/Number(t);return n<0?0:n>1?1:n}function _i(e,t=2){return(e*100).toFixed(t)}function vi(e){return e<10?`0${e}`:String(e)}function yi(e){return Number(e>9007199254740991n?9007199254740991n:e<-9007199254740991n?-9007199254740991n:e)}function bi(e){let t=(1+Math.sqrt(5))/2,n=Math.max(1,e);return Math.floor(Math.log(n)/Math.log(t))}function xi(e){return ar(e,Sr)}function Si(e){let t=e+719468n,n=Dr(t,146097n),r=t-n*146097n,i=Dr(r-Dr(r,1460n)+Dr(r,36524n)-Dr(r,146096n),365n),a=i+n*400n,o=r-(365n*i+Dr(i,4n)-Dr(i,100n)),s=Dr(5n*o+2n,153n),c=o-Dr(153n*s+2n,5n)+1n,l=s<10n?s+3n:s-9n;return{year:l<=2n?a+1n:a,month:l<=2n?l+12n-12n:l,day:c}}var Ci=Or(2024n,5n,11n);function wi(e){let t=si(e);if(e`u`||typeof document>`u`)return!1;let e=navigator,t=window.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches??!1,n=window.matchMedia?.(`(prefers-reduced-transparency: reduce)`)?.matches??!1;return t||n||typeof e.deviceMemory==`number`&&e.deviceMemory<=4||typeof e.hardwareConcurrency==`number`&&e.hardwareConcurrency<=4}function Bi(){(0,C.useEffect)(()=>{if(typeof document>`u`)return;let e=document.documentElement;zi()?e.dataset.perf=`low`:delete e.dataset.perf},[])}const Vi=`sigil:explorer:open`;var Hi=s((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Ui=s(((e,t)=>{t.exports=Hi()})),W=u(Ui(),1);function Wi(){return window.innerWidth-document.documentElement.clientWidth}function Gi(e){return Array.from(e.querySelectorAll(`a[href],button:not([disabled]),textarea,input,select,[tabindex]:not([tabindex="-1"])`)).filter(e=>!e.hasAttribute(`disabled`)&&e.tabIndex!==-1)}function Ki(){let[e,t]=(0,C.useState)(!1),n=(0,C.useId)(),r=(0,C.useId)(),i=(0,C.useId)(),a=(0,C.useRef)(null),o=(0,C.useRef)(null),s=(0,C.useRef)(null),c=(0,C.useRef)(null),l=(0,C.useCallback)(()=>t(!1),[]),u=(0,C.useCallback)(()=>t(!0),[]),d=(0,C.useMemo)(()=>`Kairos Notes — Legal Tender`,[]);return(0,C.useEffect)(()=>{if(!e)return;let t=document.body.style.overflow,n=document.body.style.paddingRight,r=Wi();document.body.style.overflow=`hidden`,r>0&&(document.body.style.paddingRight=`${r}px`);let i=document.activeElement,u=i instanceof HTMLElement?i:a.current,d=e=>{if(e.key===`Escape`){e.preventDefault(),l();return}if(e.key===`Tab`){let t=o.current;if(!t)return;let n=Gi(t);if(n.length===0)return;let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey?(!a||a===r)&&(e.preventDefault(),i.focus()):a===i&&(e.preventDefault(),r.focus())}};return window.addEventListener(`keydown`,d,{capture:!0}),requestAnimationFrame(()=>{(s.current??c.current)?.focus()}),()=>{window.removeEventListener(`keydown`,d,{capture:!0}),document.body.style.overflow=t,document.body.style.paddingRight=n,requestAnimationFrame(()=>{u&&`focus`in u?u.focus():a.current?.focus()})}},[e,l]),(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`nav-foot`,"aria-label":`Sovereign declarations`,children:(0,W.jsxs)(`button`,{ref:a,type:`button`,className:`nav-foot__toggle`,onClick:u,"aria-haspopup":`dialog`,"aria-expanded":e,"aria-controls":n,children:[(0,W.jsx)(`span`,{className:`nav-foot__badge`,"aria-hidden":`true`,children:(0,W.jsx)(`img`,{className:`nav-foot__phiLogo`,src:`/phi.svg`,alt:``,draggable:!1})}),(0,W.jsxs)(`span`,{className:`nav-foot__main`,children:[(0,W.jsx)(`span`,{className:`nav-foot__kicker`,children:`SOVEREIGN WRIT`}),(0,W.jsx)(`span`,{className:`nav-foot__summary`,children:d})]}),(0,W.jsx)(`span`,{className:`nav-foot__chev`,"aria-hidden":`true`,children:(0,W.jsx)(`span`,{className:`nav-foot__chevIcon`,"aria-hidden":`true`,children:(0,W.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,children:(0,W.jsx)(`path`,{d:`M9 18l6-6-6-6`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})})})})]})}),e&&(0,w.createPortal)((0,W.jsxs)(`div`,{className:`nav-footSheet`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":r,"aria-describedby":i,id:n,children:[(0,W.jsx)(`button`,{type:`button`,className:`nav-footSheet__backdrop`,"aria-label":`Dismiss`,onClick:l}),(0,W.jsxs)(`div`,{ref:o,className:`nav-footSheet__panel`,role:`document`,children:[(0,W.jsxs)(`div`,{className:`nav-footSheet__head`,children:[(0,W.jsxs)(`div`,{className:`nav-footSheet__titleWrap`,children:[(0,W.jsxs)(`div`,{className:`nav-footSheet__title`,id:r,children:[(0,W.jsx)(`img`,{className:`nav-footSheet__phiLogo`,src:`/phi.svg`,alt:``,"aria-hidden":`true`,draggable:!1}),` `,`Sovereign Writ`]}),(0,W.jsx)(`div`,{className:`nav-footSheet__sub`,children:`Official instrument of value & transfer — Kairos-native, breath-backed, offline-verifiable.`})]}),(0,W.jsx)(`button`,{ref:c,type:`button`,className:`nav-footSheet__close`,onClick:l,"aria-label":`Dismiss`,title:`Dismiss`,children:(0,W.jsx)(`span`,{className:`nav-footSheet__closeIcon`,"aria-hidden":`true`,children:(0,W.jsxs)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,W.jsx)(`path`,{d:`M18 6L6 18`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M6 6L18 18`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`})]})})})]}),(0,W.jsxs)(`div`,{className:`nav-footSheet__body`,id:i,children:[(0,W.jsxs)(`p`,{className:`nav-foot__line`,children:[(0,W.jsx)(`strong`,{children:` Kairos Notes`}),` are legal tender — sealed by `,(0,W.jsx)(`strong`,{children:`Proof of Breath™`}),`, pulsed by `,(0,W.jsx)(`strong`,{children:`Kai-Signature™`}),`, auditable as: Σ → SHA-256(Σ) → Φ.`]}),(0,W.jsxs)(`p`,{className:`nav-foot__line`,children:[(0,W.jsx)(`strong`,{children:`Sigil-Glyphs`}),` are origin ΦKey seals for minting, custody, and lawful transfer. Derivative glyphs maintain sovereign lineage and are redeemable by re-inhale.`]}),(0,W.jsx)(`div`,{className:`nav-footSheet__divider`,role:`separator`,"aria-hidden":`true`}),(0,W.jsx)(`p`,{className:`nav-foot__line nav-foot__line--fine`,children:`Operational Mandate: readable offline, provable by breath-writ, unforgeable without determinate seals.`}),(0,W.jsx)(`p`,{className:`nav-foot__line nav-foot__line--fine`,children:`This writ exists independent of domains, DNS, or consensus. It is sealed in breath, bound in math, and verifiable by anyone who remembers the pulse.`})]}),(0,W.jsx)(`div`,{className:`nav-footSheet__foot`,children:(0,W.jsx)(`button`,{ref:s,type:`button`,className:`nav-footSheet__cta`,onClick:l,children:`Seal Acknowledged`})})]})]}),document.body)]})}const qi=`kairos:sw-version`;var Ji=u(y(),1),Yi=(0,C.lazy)(()=>O(()=>import(`./KaiVohModal-DDDGepBu.js`),__vite__mapDeps([0,1,2,3,4]))),Xi=(0,C.lazy)(()=>O(()=>import(`./SigilModal-DgAEuxv4.js`),__vite__mapDeps([5,6,7,8,9]))),Zi=(0,C.lazy)(()=>O(()=>import(`./HomePriceChartCard-ByTYxBSg.js`),__vite__mapDeps([10,11,12]))),Qi=(0,C.lazy)(()=>O(()=>import(`./SigilExplorer-C1I-xwZr.js`),__vite__mapDeps([13,14,15]))),$i=(0,C.lazy)(()=>O(()=>import(`./EternalKlock-C_k79TSi.js`),__vite__mapDeps([16,17,8,6,7,9,18])));function ea(){if(!(typeof document>`u`||typeof window>`u`)&&window.location.pathname===`/`){for(let e of[`app-splash`,`pwa-splash`,`splash`,`splash-screen`,`boot-splash`]){let t=document.getElementById(e);t&&t.remove()}document.querySelectorAll(`[data-splash], .app-splash, .pwa-splash, .splash-screen, .splash, .boot-splash`).forEach(e=>e.remove())}}try{ea()}catch{}var ta=typeof window<`u`?C.useLayoutEffect:C.useEffect,na=[`/sigil.wasm`,`/sigil.zkey`,`/sigil.artifacts.json`,`/sigil.vkey.json`,`/verification_key.json`,`/verifier-core.js`,`/verifier.inline.html`,`/verifier.html`,`/pdf-lib.min.js`],ra=[`/`,`/mint`,`/voh`,`/keystream`,`/klock`,`/klok`,`/sigil/new`,`/pulse`,`/verify`,...[`/stream`,`/stream/p`,`/stream/c`,`/feed`,`/feed/p`,`/p`,`/p~`]],ia=[`/`,`/?source=pwa`,`/index.html`],aa=[{to:`/`,label:`Verifier`,desc:`Inhale + Exhale`,end:!0},{to:`/mint`,label:`Mint ΦKey`,desc:`Breath-minted seal`},{to:`/voh`,label:`KaiVoh`,desc:`Memory OS`},{to:`/keystream`,label:`ΦStream`,desc:`Live keystream`}],oa=`137.66.18.241`,sa=3+Math.sqrt(5),ca=sa*1e3,la=17491.270421,ua=36,da=44,fa=ua*da,pa=17491.270421,ma=[`var(--chakra-ark-0)`,`var(--chakra-ark-1)`,`var(--chakra-ark-2)`,`var(--chakra-ark-3)`,`var(--chakra-ark-4)`,`var(--chakra-ark-5)`],ha={Root:`var(--chakra-ink-0)`,Sacral:`var(--chakra-ink-1)`,"Solar Plexus":`var(--chakra-ink-2)`,Heart:`var(--chakra-ink-3)`,Throat:`var(--chakra-ink-4)`,"Third Eye":`var(--chakra-ink-5)`,Crown:`var(--chakra-ink-6)`},ga=[`#ff7a7a`,`#ffbd66`,`#ffe25c`,`#86ff86`,`#79c2ff`,`#c99aff`,`#e29aff`,`#e5e5e5`],_a=1000000n,va=`phi_kai_anchor_pmicro_v1`,ya=`phi_kai_anchor_msutc_v1`,ba={anchor:null};function xa(e,t){let n=e/t,r=e%t;return r!==0n&&r>0n!=t>0n?n-1n:n}function Sa(e){if(!Number.isFinite(e))return 0n;let t=e<0?-1:1,n=Math.abs(e),r=Math.trunc(n),i=n-r;return i<.5?BigInt(t*r):i>.5?BigInt(t*(r+1)):BigInt(t*(r%2==0?r:r+1))}function Ca(e){if(typeof window>`u`)return null;try{let t=window.localStorage.getItem(e);return!t||!/^-?\d+$/.test(t.trim())?null:BigInt(t.trim())}catch{return null}}function wa(e,t){if(!(typeof window>`u`))try{window.localStorage.setItem(e,t.toString())}catch{}}function Ta(e){if(typeof window>`u`)return null;try{let t=window.localStorage.getItem(e);if(!t)return null;let n=Number(t);return!Number.isFinite(n)||n<=0?null:Math.floor(n)}catch{return null}}function Ea(e){return Sa((e-In)/qn*1e6)}function Da(e){let t=xa(e,_a);if(t>=0n&&t<500000000n)return e;let n=e/1000n,r=BigInt(2**53-1),i=BigInt(-(2**53-1));if(n>r||n0n&&n<4000000000000n){let e=Number(n);if(Number.isFinite(e))return Ea(e)}return n}catch{return null}}function ka(){return Da(Kr())}function Aa(){if(ba.anchor)return ba.anchor;if(typeof window>`u`)return ba.anchor={pμ0:0n,perf0:0,source:`kpp`},ba.anchor;let e=window.performance.now(),t=Ca(va);if(t!==null&&t>0n)return ba.anchor={pμ0:t,perf0:e,source:`storage`},ba.anchor;let n=Ta(ya);if(n!==null&&n>0){let t=Ea(n);if(t>0n)return wa(va,t),ba.anchor={pμ0:t,perf0:e,source:`storage`},ba.anchor}let r=Oa();if(r!==null&&r>0n)return wa(va,r),ba.anchor={pμ0:r,perf0:e,source:`env`},ba.anchor;let i=ka();return i>0n&&wa(va,i),ba.anchor={pμ0:i,perf0:e,source:`kpp`},ba.anchor}function ja(){if(typeof window>`u`)return;let e=window.performance.now(),t=ka();t>0n&&wa(va,t),ba.anchor={pμ0:t,perf0:e,source:`kpp`}}function Ma(){if(typeof window>`u`)return 0n;let e=Aa(),t=Sa((window.performance.now()-e.perf0)/qn*1e6);return e.pμ0+t}function Na(e){let t=BigInt(2**53-1),n=BigInt(-(2**53-1));if(e>t||e0?n/pa:0,i=Math.floor(r*fa),a=Math.min(fa-1,Math.max(0,i)),o=Math.min(ua-1,Math.max(0,Math.floor(a/da))),s=Math.min(da-1,Math.max(0,a-o*da)),c=Fi(e,`dayIndex`)??Fi(e,`dayIndex0`)??Fi(e,`dayIndexSinceGenesis`),l=c===null?Math.floor((t+1e-9)/pa):Math.floor(c),u=Math.floor(l/336),d=Ri(l,336),f=Math.floor(d/42);f<0&&(f=0),f>7&&(f=7);let p=d-f*42,m=f+1;return{beat:o,step:s,day:Math.floor(p)+1,month:m,year:u}}function za(e){return`${Ii(e.beat)}:${Ii(e.step)}`}function Ba(e){return`D${e.day}/M${e.month}/Y${e.year}`}function Va(){(0,C.useEffect)(()=>{if(typeof window>`u`||typeof document>`u`)return;let e=0,t=e=>{let t=e.timeStamp;return typeof t==`number`&&Number.isFinite(t)?t:performance.now()},n=n=>{if(Ia(n.target))return;let r=t(n);r-e<=300&&n.preventDefault(),e=r},r=e=>{e.touches.length>1&&e.preventDefault()},i=e=>{(e.ctrlKey||e.metaKey)&&e.preventDefault()},a=e=>{if(!e.ctrlKey&&!e.metaKey)return;let t=e.key;(t===`+`||t===`-`||t===`=`||t===`_`||t===`0`)&&e.preventDefault()},o=e=>{e.preventDefault()},s=document.documentElement,c=document.body,l=s.style.touchAction,u=c.style.touchAction,d=s.style.webkitTextSizeAdjust;return s.style.touchAction=`manipulation`,c.style.touchAction=`manipulation`,s.style.webkitTextSizeAdjust=`100%`,document.addEventListener(`touchend`,n,{passive:!1,capture:!0}),document.addEventListener(`touchmove`,r,{passive:!1,capture:!0}),document.addEventListener(`gesturestart`,o,{passive:!1,capture:!0}),document.addEventListener(`gesturechange`,o,{passive:!1,capture:!0}),document.addEventListener(`gestureend`,o,{passive:!1,capture:!0}),window.addEventListener(`wheel`,i,{passive:!1}),window.addEventListener(`keydown`,a),()=>{document.removeEventListener(`touchend`,n,!0),document.removeEventListener(`touchmove`,r,!0),document.removeEventListener(`gesturestart`,o,!0),document.removeEventListener(`gesturechange`,o,!0),document.removeEventListener(`gestureend`,o,!0),window.removeEventListener(`wheel`,i),window.removeEventListener(`keydown`,a),s.style.touchAction=l,c.style.touchAction=u,s.style.webkitTextSizeAdjust=d}},[])}var Ha={size:{width:0,height:0},subs:new Set,listening:!1,rafId:null,cleanup:null};function Ua(){if(typeof window>`u`)return{width:0,height:0};let e=window.visualViewport;return e?{width:Math.round(e.width),height:Math.round(e.height)}:{width:window.innerWidth,height:window.innerHeight}}function Wa(){if(typeof window>`u`||Ha.listening)return;Ha.listening=!0,Ha.size=Ua();let e=()=>{Ha.rafId=null;let e=Ua(),t=Ha.size;e.width===t.width&&e.height===t.height||(Ha.size=e,Ha.subs.forEach(t=>t(e)))},t=()=>{Ha.rafId===null&&(Ha.rafId=window.requestAnimationFrame(e))},n=window.visualViewport;window.addEventListener(`resize`,t,{passive:!0}),n&&(n.addEventListener(`resize`,t,{passive:!0}),n.addEventListener(`scroll`,t,{passive:!0})),Ha.cleanup=()=>{Ha.rafId!==null&&(window.cancelAnimationFrame(Ha.rafId),Ha.rafId=null),window.removeEventListener(`resize`,t),n&&(n.removeEventListener(`resize`,t),n.removeEventListener(`scroll`,t)),Ha.cleanup=null,Ha.listening=!1}}function Ga(){Ha.subs.size>0||Ha.cleanup?.()}function Ka(){let[e,t]=(0,C.useState)(()=>Ua());return(0,C.useEffect)(()=>{if(typeof window>`u`)return;Wa();let e=e=>t(e);return Ha.subs.add(e),e(Ha.size),()=>{Ha.subs.delete(e),Ga()}},[]),e}function qa(e){let t=(0,C.useRef)(null);(0,C.useEffect)(()=>{if(!e||typeof window>`u`||typeof document>`u`)return;let n=document.documentElement,r=document.body,i=window.scrollY||window.pageYOffset||0;return t.current={scrollY:i,htmlOverflow:n.style.overflow,bodyOverflow:r.style.overflow,bodyPosition:r.style.position,bodyTop:r.style.top,bodyLeft:r.style.left,bodyRight:r.style.right,bodyWidth:r.style.width},n.style.overflow=`hidden`,r.style.overflow=`hidden`,r.style.position=`fixed`,r.style.top=`-${i}px`,r.style.left=`0`,r.style.right=`0`,r.style.width=`100%`,()=>{let e=t.current;e&&(n.style.overflow=e.htmlOverflow,r.style.overflow=e.bodyOverflow,r.style.position=e.bodyPosition,r.style.top=e.bodyTop,r.style.left=e.bodyLeft,r.style.right=e.bodyRight,r.style.width=e.bodyWidth,window.scrollTo(0,e.scrollY),t.current=null)}},[e])}function Ja(e){let t=window.getComputedStyle(e),n=t.backdropFilter,r=t.willChange||``;return!(t.transform&&t.transform!==`none`||t.perspective&&t.perspective!==`none`||t.filter&&t.filter!==`none`||n&&n!==`none`||t.contain&&t.contain!==`none`||r.includes(`transform`)||r.includes(`perspective`)||r.includes(`filter`))}function Ya(){let e=document.querySelector(`.app-shell`);if(e instanceof HTMLElement)try{if(Ja(e))return e}catch{}return document.body}function Xa(e){return e===`/`?`Verifier`:e.startsWith(`/mint`)?`Mint Sigil`:e.startsWith(`/voh`)?`KaiVoh`:e.startsWith(`/keystream`)?`PhiStream`:e.startsWith(`/klock`)?`KaiKlok`:`Sovereign Gate`}function Za(e){return e===`/`||e.startsWith(`/voh`)||e.startsWith(`/mint`)||e.startsWith(`/keystream`)||e.startsWith(`/klock`)}function Qa(e){return e<680?200:240}function $a(e){return Math.max(220,Math.min(520,Math.floor(e*.52)))}function eo(e){(0,C.useEffect)(()=>{document.title=`ΦNet • ${e}`},[e])}function to(e){return(0,C.useMemo)(()=>{let t=e.height||0,n=e.width||0;return t>=820&&n>=980},[e.height,e.width])}function no(){let[e,t]=(0,C.useState)(La);return(0,C.useEffect)(()=>{let e=e=>{let n=e.detail;typeof n==`string`&&n.length&&t(n)};return window.addEventListener(qi,e),()=>window.removeEventListener(qi,e)},[]),e}function ro(){(0,C.useEffect)(()=>{if(typeof window>`u`)return;ja();let e=()=>{let e=Ma();e>0n&&wa(va,e)},t=()=>{typeof document<`u`&&document.visibilityState===`hidden`&&e()};e();let n=window.setInterval(e,15e3);return window.addEventListener(`pagehide`,e),document.addEventListener(`visibilitychange`,t),()=>{window.clearInterval(n),window.removeEventListener(`pagehide`,e),document.removeEventListener(`visibilitychange`,t),e()}},[])}function io(){let[e,t]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{if(typeof window>`u`)return;let e=window,n=typeof e.requestIdleCallback==`function`?e.requestIdleCallback(()=>t(!0),{timeout:900}):window.setTimeout(()=>t(!0),220);return()=>{typeof e.cancelIdleCallback==`function`?e.cancelIdleCallback(n):window.clearTimeout(n)}},[]),(0,C.useEffect)(()=>{e&&(O(()=>import(`./HomePriceChartCard-ByTYxBSg.js`),__vite__mapDeps([10,11,12])),O(()=>import(`./KaiVohModal-DDDGepBu.js`),__vite__mapDeps([0,1,2,3,4])),O(()=>import(`./SigilModal-DgAEuxv4.js`),__vite__mapDeps([5,6,7,8,9])),O(()=>import(`./SigilExplorer-C1I-xwZr.js`),__vite__mapDeps([13,14,15])),O(()=>import(`./EternalKlock-C_k79TSi.js`),__vite__mapDeps([16,17,8,6,7,9,18])),O(()=>import(`./SigilStreamRoot-hPwX5VmF.js`),__vite__mapDeps([19,17,8,6,7,9,18,20,2,3,21,22,14,23,24])))},[e]),e}function ao(e){(0,C.useEffect)(()=>{if(typeof window>`u`||!(`serviceWorker`in navigator))return;let t=new AbortController,n=navigator,r=!!n.connection?.saveData,i=n.connection?.effectiveType||``;if(r||i===`slow-2g`||i===`2g`)return()=>t.abort();let a=async()=>{try{let e=await navigator.serviceWorker.ready;(e.active||e.waiting||e.installing)?.postMessage({type:`WARM_URLS`,urls:[...na,...ra,...ia],mapShell:!0}),await Promise.all([...na,...ra].map(async e=>{try{await fetch(e,{cache:`no-cache`,signal:t.signal})}catch{}}))}catch{}},o=window,s=()=>void a(),c=typeof o.requestIdleCallback==`function`?o.requestIdleCallback(s,{timeout:2500}):window.setTimeout(s,1200),l=()=>{e.current!==null&&window.clearTimeout(e.current),e.current=window.setTimeout(s,240)};return window.addEventListener(`focus`,l),()=>{t.abort(),e.current!==null&&(window.clearTimeout(e.current),e.current=null),typeof o.cancelIdleCallback==`function`?o.cancelIdleCallback(c):window.clearTimeout(c),window.removeEventListener(`focus`,l)}},[e])}function oo(e,t){let n=(0,C.useRef)(null),r=(0,C.useRef)(null),[i,a]=(0,C.useState)(!1),o=(0,C.useRef)(null),s=(0,C.useCallback)(()=>{let e=n.current,t=r.current;if(!e||!t)return!1;let i=t.firstElementChild;return(i?i.scrollHeight:t.scrollHeight)>e.clientHeight+6},[]),c=(0,C.useCallback)(()=>{o.current===null&&(o.current=window.requestAnimationFrame(()=>{o.current=null;let e=s();a(t=>t===e?t:e)}))},[s]);(0,C.useEffect)(()=>{e&&c()},[e,t,c]),(0,C.useEffect)(()=>{let e=n.current,t=r.current;if(!e||!t)return;let i=t.firstElementChild,a=()=>c(),s=null;return typeof ResizeObserver<`u`&&(s=new ResizeObserver(a),s.observe(e),s.observe(t),i&&s.observe(i)),window.addEventListener(`resize`,a,{passive:!0}),c(),()=>{window.removeEventListener(`resize`,a),s?.disconnect(),o.current!==null&&(window.cancelAnimationFrame(o.current),o.current=null)}},[c,t]);let l=e&&i;return{panelBodyRef:n,panelCenterRef:r,panelShouldScroll:l,panelBodyInlineStyle:(0,C.useMemo)(()=>{if(l)return{overflowY:`auto`,overflowX:`hidden`,WebkitOverflowScrolling:`touch`,alignItems:`stretch`,justifyContent:`flex-start`,paddingBottom:`calc(1.25rem + var(--safe-bottom))`}},[l]),panelCenterInlineStyle:(0,C.useMemo)(()=>{if(l)return{height:`auto`,minHeight:`100%`,alignItems:`flex-start`,justifyContent:`flex-start`}},[l])}}function so(e,t){(0,C.useEffect)(()=>{if(typeof window>`u`)return;let t=e.current;if(!t||!window.matchMedia(`(max-width: 980px)`).matches)return;let n=t.querySelector(`.nav-item--active`);n&&window.requestAnimationFrame(()=>{try{n.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`center`})}catch{n.scrollIntoView()}})},[t,e])}function co({open:e,onClose:t,children:n}){let r=typeof document<`u`,i=Ka(),a=(0,C.useMemo)(()=>r?Ya():null,[r]);qa(e&&r),(0,C.useEffect)(()=>{if(!e||!r)return;let n=e=>{e.key===`Escape`&&t()};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t,r]),(0,C.useEffect)(()=>{!e||!r||window.dispatchEvent(new CustomEvent(Vi))},[e,r]);let o=(0,C.useRef)(null);(0,C.useEffect)(()=>{e&&window.requestAnimationFrame(()=>o.current?.focus())},[e]);let s=(0,C.useMemo)(()=>{if(!e||!r)return;let t=i.height,n=i.width;return{position:`fixed`,inset:0,pointerEvents:`auto`,height:t>0?`${t}px`:void 0,width:n>0?`${n}px`:void 0,"--sx-breath":`5.236s`,"--sx-border":`rgba(60, 220, 205, 0.35)`,"--sx-border-strong":`rgba(55, 255, 228, 0.55)`,"--sx-ring":`0 0 0 2px rgba(55, 255, 228, 0.25), 0 0 0 6px rgba(55, 255, 228, 0.12)`}},[e,r,i]),c=(0,C.useCallback)(e=>{e.target===e.currentTarget&&(e.preventDefault(),e.stopPropagation())},[]),l=(0,C.useCallback)(e=>{e.target===e.currentTarget&&(e.preventDefault(),e.stopPropagation(),t())},[t]),u=(0,C.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]);return!e||!r||!a?null:(0,Ji.createPortal)((0,W.jsx)(`div`,{className:`explorer-pop`,style:s,role:`dialog`,"aria-modal":`true`,"aria-label":`PhiStream Explorer`,onPointerDown:c,onClick:l,children:(0,W.jsxs)(`div`,{className:`explorer-pop__panel`,role:`document`,children:[(0,W.jsx)(`button`,{ref:o,type:`button`,className:`explorer-pop__close kx-x`,onPointerDown:u,onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},"aria-label":`Close PhiStream Explorer`,title:`Close (Esc)`,children:`×`}),(0,W.jsx)(`div`,{className:`explorer-pop__body`,children:n}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:`PhiStream explorer portal open`})]})}),a)}function lo({open:e,onClose:t,children:n}){let r=typeof document<`u`,i=Ka(),a=(0,C.useMemo)(()=>r?Ya():null,[r]);qa(e&&r),(0,C.useEffect)(()=>{if(!e||!r)return;let n=e=>{e.key===`Escape`&&t()};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t,r]);let o=(0,C.useRef)(null);(0,C.useEffect)(()=>{e&&window.requestAnimationFrame(()=>o.current?.focus())},[e]);let s=(0,C.useMemo)(()=>{if(!e||!r)return;let t=i.height,n=i.width;return{position:`fixed`,inset:0,pointerEvents:`auto`,height:t>0?`${t}px`:void 0,width:n>0?`${n}px`:void 0,"--klock-breath":`5.236s`,"--klock-border":`rgba(255, 216, 120, 0.26)`,"--klock-border-strong":`rgba(255, 231, 160, 0.55)`,"--klock-ring":`0 0 0 2px rgba(255, 225, 150, 0.22), 0 0 0 6px rgba(255, 210, 120, 0.10)`,"--klock-scale":`5`}},[e,r,i]),c=(0,C.useCallback)(e=>{e.target===e.currentTarget&&(e.preventDefault(),e.stopPropagation())},[]),l=(0,C.useCallback)(e=>{e.target===e.currentTarget&&(e.preventDefault(),e.stopPropagation(),t())},[t]),u=(0,C.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]);return!e||!r||!a?null:(0,Ji.createPortal)((0,W.jsx)(`div`,{className:`klock-pop`,style:s,role:`dialog`,"aria-modal":`true`,"aria-label":`Eternal KaiKlok`,onPointerDown:c,onClick:l,children:(0,W.jsxs)(`div`,{className:`klock-pop__panel`,role:`document`,"data-klock-size":`xl`,children:[(0,W.jsx)(`button`,{ref:o,type:`button`,className:`klock-pop__close kx-x`,onPointerDown:u,onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},"aria-label":`Close Eternal KaiKlok`,title:`Close (Esc)`,children:`×`}),(0,W.jsx)(`div`,{className:`klock-pop__body`,children:(0,W.jsx)(`div`,{className:`klock-stage`,role:`presentation`,"data-klock-stage":`1`,children:(0,W.jsx)(`div`,{className:`klock-stage__inner`,children:n})})}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:`Eternal KaiKlok portal open`})]})}),a)}function uo(){let e=$e(),[t,n]=(0,C.useState)(!0);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(C.Suspense,{fallback:null,children:(0,W.jsx)(Yi,{open:t,onClose:(0,C.useCallback)(()=>{n(!1),e(`/`,{replace:!0})},[e])})}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:`KaiVoh portal open`})]})}function fo(){let e=$e(),[t,n]=(0,C.useState)(!0),r=(0,C.useMemo)(()=>Fi(Fa(),`pulse`)??0,[]),i=(0,C.useCallback)(()=>{n(!1),e(`/`,{replace:!0})},[e]);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(C.Suspense,{fallback:null,children:t?(0,W.jsx)(Xi,{initialPulse:r,onClose:i}):null}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:`Sigil mint portal open`})]})}function po(){let e=$e(),[t,n]=(0,C.useState)(!0);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(co,{open:t,onClose:(0,C.useCallback)(()=>{n(!1),e(`/`,{replace:!0})},[e]),children:(0,W.jsx)(C.Suspense,{fallback:null,children:(0,W.jsx)(Qi,{})})}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:`PhiStream explorer portal open`})]})}function mo(){let e=$e(),t=Xe(),[n,r]=(0,C.useState)(!0);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(lo,{open:n,onClose:(0,C.useCallback)(()=>{r(!1),e(`/`,{replace:!0})},[e]),children:(0,W.jsx)(C.Suspense,{fallback:null,children:(0,W.jsx)($i,{initialDetailsOpen:(t.state??null)?.openDetails??!0})})}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:`Eternal KaiKlok portal open`})]})}function ho(e){let t=Fr(Na(e)),n=xa(e,_a),r=n>BigInt(2**53-1)?2**53-1:n<0n?0:Number(n),i=Li(r),a={...t,pulse:r},o=Ra(a);return{pulse:r,pulseStr:i,beatStepDMY:o,beatStepLabel:za(o),dmyLabel:Ba(o),chakraDay:a.chakraDay}}function go(){let[e,t]=(0,C.useState)(()=>ho(Ma()));return(0,C.useEffect)(()=>{let e=!0,n=null,r=()=>{n!==null&&(window.clearTimeout(n),n=null)},i=e=>{let n=ho(e);t(e=>e.pulseStr===n.pulseStr&&e.beatStepLabel===n.beatStepLabel&&e.dmyLabel===n.dmyLabel?e:n)},a=()=>{if(!e)return;if(typeof document<`u`&&document.visibilityState===`hidden`){r();return}let t=Ma();i(t);let o=t%_a;o<0n&&(o+=_a);let s=_a-o,c=Number(s),l=Math.max(0,Math.floor(c/1e6*qn));r(),n=window.setTimeout(a,l)};a();let o=()=>{e&&typeof document<`u`&&document.visibilityState===`visible`&&(ja(),a())};return document.addEventListener(`visibilitychange`,o),window.addEventListener(`focus`,o),()=>{e=!1,document.removeEventListener(`visibilitychange`,o),window.removeEventListener(`focus`,o),r()}},[]),e}var _o=(0,C.memo)(function({onOpenKlock:e,breathS:t,breathMs:n,breathsPerDay:r}){let i=go(),a=(0,C.useMemo)(()=>({color:`var(--accent-color)`,textShadow:`0 0 14px rgba(0, 255, 255, 0.22), 0 0 28px rgba(0, 255, 255, 0.12)`}),[]),o=(0,C.useMemo)(()=>({color:`var(--accent-color)`,textShadow:`0 0 14px rgba(0, 255, 255, 0.22), 0 0 28px rgba(0, 255, 255, 0.12)`,fontSize:`0.5em`,lineHeight:1.05}),[]),s=(0,C.useMemo)(()=>{let e=Ri(i.pulse,pa),t=pa/ma.length;return ma[Math.min(ma.length-1,Math.max(0,Math.floor(e/t)))]??ma[0]},[i.pulse]),c=(0,C.useMemo)(()=>ha[i.chakraDay]??ha.Heart,[i.chakraDay]),l=(0,C.useMemo)(()=>ga[Math.min(ga.length-1,Math.max(0,i.beatStepDMY.month-1))]??ha.Heart,[i.beatStepDMY.month]),u=(0,C.useMemo)(()=>({"--kai-ark":s,"--kai-chakra":c,"--kai-month":l}),[s,c,l]),d=(0,C.useMemo)(()=>`LIVE • NOW PULSE ${i.pulseStr} • ${i.beatStepLabel} • ${i.dmyLabel} • Breath ${t.toFixed(6)}s (${Math.round(n)}ms) • ${r.toLocaleString(`en-US`,{minimumFractionDigits:6,maximumFractionDigits:6})}/day • Open Eternal KaiKlok`,[i.pulseStr,i.beatStepLabel,i.dmyLabel,t,n,r]),f=(0,C.useMemo)(()=>`LIVE. Kai Pulse now ${i.pulse}. Beat ${i.beatStepDMY.beat} step ${i.beatStepDMY.step}. D ${i.beatStepDMY.day}. M ${i.beatStepDMY.month}. Y ${i.beatStepDMY.year}. Open Eternal KaiKlok.`,[i]);return(0,W.jsxs)(`button`,{type:`button`,className:`topbar-live`,onClick:e,"aria-label":f,title:d,style:u,children:[(0,W.jsx)(`span`,{className:`live-orb`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`live-scroll`,"aria-hidden":`true`,children:(0,W.jsxs)(`div`,{className:`live-text`,children:[(0,W.jsx)(`div`,{className:`live-meta`,children:(0,W.jsx)(`span`,{className:`mono`,style:a,children:`☤KAI`})}),(0,W.jsx)(`div`,{className:`live-meta`,children:(0,W.jsx)(`span`,{className:`mono`,style:a,children:i.pulseStr})}),(0,W.jsx)(`div`,{className:`live-sub`,children:(0,W.jsxs)(`span`,{className:`mono`,style:o,children:[(0,W.jsx)(`span`,{className:`kai-num kai-num--ark`,children:i.beatStepLabel}),` `,(0,W.jsx)(`span`,{"aria-hidden":`true`,style:{opacity:.7},children:`•`}),` `,(0,W.jsx)(`span`,{className:`kai-tag`,children:`D`}),(0,W.jsx)(`span`,{className:`kai-num kai-num--chakra`,children:i.beatStepDMY.day}),(0,W.jsx)(`span`,{className:`kai-sep`,children:`/`}),(0,W.jsx)(`span`,{className:`kai-tag`,children:`M`}),(0,W.jsx)(`span`,{className:`kai-num kai-num--month`,children:i.beatStepDMY.month}),(0,W.jsx)(`span`,{className:`kai-sep`,children:`/`}),(0,W.jsx)(`span`,{className:`kai-tag`,children:`Y`}),(0,W.jsx)(`span`,{className:`kai-num`,children:i.beatStepDMY.year})]})})]})})]})});function vo(){let e=Xe(),t=$e();Va(),Bi(),ta(()=>{ea()},[e.pathname]),ro();let n=no(),r=io();ao((0,C.useRef)(null));let i=Ka(),a=to(i),o=(0,C.useMemo)(()=>({"--breath-s":`${sa}s`,"--vvh-px":`${i.height}px`}),[i.height]),s=(0,C.useMemo)(()=>Xa(e.pathname),[e.pathname]);eo(s);let c=(0,C.useMemo)(()=>Za(e.pathname),[e.pathname]),l=c,u=(0,C.useMemo)(()=>Qa(i.height||800),[i.height]),d=(0,C.useMemo)(()=>$a(i.height||800),[i.height]),{panelBodyRef:f,panelCenterRef:p,panelShouldScroll:m,panelBodyInlineStyle:h,panelCenterInlineStyle:g}=oo(c,e.pathname),_=(0,C.useRef)(null);so(_,e.pathname);let v=(0,C.useCallback)(()=>{t(`/klock`,{state:{openDetails:!0}})},[t]),y=(0,C.useCallback)(async e=>{try{await navigator.clipboard.writeText(oa)}catch{let e=document.createElement(`textarea`);e.value=oa,e.setAttribute(`readonly`,`true`),e.style.position=`fixed`,e.style.left=`-9999px`,e.style.top=`-9999px`,document.body.appendChild(e),e.select(),document.execCommand(`copy`),document.body.removeChild(e)}e&&(e.classList.add(`is-copied`),window.setTimeout(()=>e.classList.remove(`is-copied`),900))},[]),b=(0,C.useMemo)(()=>{if(a)return{alignSelf:`start`,height:`auto`}},[a]);return(0,W.jsxs)(`div`,{className:`app-shell`,"data-ui":`atlantean-banking`,"data-panel-scroll":m?`1`:`0`,"data-roomy":a?`1`:`0`,style:o,children:[(0,W.jsx)(`a`,{className:`skip-link`,href:`#app-content`,children:`Skip to content`}),(0,W.jsx)(`div`,{className:`app-bg-orbit`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`app-bg-grid`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`app-bg-glow`,"aria-hidden":`true`}),(0,W.jsxs)(`header`,{className:`app-topbar`,role:`banner`,"aria-label":`ΦNet Sovereign Gate Header`,children:[(0,W.jsx)(`div`,{className:`topbar-left`,children:(0,W.jsxs)(`div`,{className:`brand`,"aria-label":`ΦNet Sovereign Gate`,children:[(0,W.jsx)(`div`,{className:`brand__mark`,"aria-hidden":`true`,children:(0,W.jsx)(`img`,{src:`/phi.svg`,alt:``,className:`brand__mark-img`})}),(0,W.jsxs)(`div`,{className:`brand__text`,children:[(0,W.jsx)(`div`,{className:`brand__title`,children:`PHI.NETWORK`}),(0,W.jsx)(`div`,{className:`brand__subtitle`,children:`Breath-Minted Value · Kairos Identity Registry`})]})]})}),(0,W.jsx)(`div`,{className:`topbar-right`,"aria-label":`Live Kai clock`,children:(0,W.jsx)(_o,{onOpenKlock:v,breathS:sa,breathMs:ca,breathsPerDay:la})})]}),(0,W.jsx)(`main`,{className:`app-stage`,id:`app-content`,role:`main`,"aria-label":`Sovereign Value Workspace`,children:(0,W.jsx)(`div`,{className:`app-frame`,role:`region`,"aria-label":`Secure frame`,children:(0,W.jsx)(`div`,{className:`app-frame-inner`,children:(0,W.jsxs)(`div`,{className:`app-workspace`,children:[l&&(0,W.jsx)(`div`,{className:`workspace-topbar`,"aria-label":`Atrium live Φ value + chart`,style:{overflow:`visible`,position:`relative`},children:(0,W.jsx)(`div`,{className:`workspace-topbar-scroll`,style:{maxHeight:`${d}px`,overflowY:`auto`,overflowX:`hidden`,WebkitOverflowScrolling:`touch`,overscrollBehavior:`contain`,borderRadius:`inherit`},children:r?(0,W.jsx)(C.Suspense,{fallback:(0,W.jsx)(`div`,{style:{height:u},"aria-hidden":`true`}),children:(0,W.jsx)(Zi,{apiBase:`https://pay.kaiklok.com`,ctaAmountUsd:144,chartHeight:u})}):(0,W.jsx)(`div`,{style:{height:u},"aria-hidden":`true`})})}),(0,W.jsxs)(`nav`,{className:`app-nav`,"aria-label":`Primary navigation`,"data-nav-roomy":a?`1`:`0`,style:b,children:[(0,W.jsxs)(`div`,{className:`nav-head`,children:[(0,W.jsx)(`div`,{className:`nav-head__title`,children:`Atrium`}),(0,W.jsx)(`div`,{className:`nav-head__sub`,children:`Breath-Sealed Identity · Kairos-ZK Proof`})]}),(0,W.jsx)(`div`,{ref:_,className:`nav-list`,role:`list`,"aria-label":`Atrium navigation tiles`,children:aa.map(e=>(0,W.jsxs)(vn,{to:e.to,end:e.end,className:e=>`nav-item ${e.isActive?`nav-item--active`:``}`,"aria-label":`${e.label}: ${e.desc}`,children:[(0,W.jsx)(`div`,{className:`nav-item__label`,children:e.label}),(0,W.jsx)(`div`,{className:`nav-item__desc`,children:e.desc})]},e.to))}),(0,W.jsx)(`div`,{className:`nav-writ-slot`,"data-writ-slim":`1`,children:(0,W.jsx)(Ki,{})})]}),(0,W.jsxs)(`section`,{className:`app-panel`,"aria-label":`Sovereign Gate panel`,children:[(0,W.jsxs)(`div`,{className:`panel-head`,children:[(0,W.jsx)(`div`,{className:`panel-head__title`,children:s}),(0,W.jsxs)(`div`,{className:`panel-head__meta`,children:[(0,W.jsx)(`span`,{className:`meta-chip`,children:`Proof of Breath™`}),(0,W.jsx)(`span`,{className:`meta-chip`,children:`Kai-Signature™`})]})]}),(0,W.jsx)(`div`,{ref:f,className:`panel-body ${c?`panel-body--locked`:``} ${m?`panel-body--scroll`:``}`,style:h,children:(0,W.jsx)(`div`,{ref:p,className:`panel-center`,style:g,children:(0,W.jsx)(Dt,{})})}),(0,W.jsxs)(`footer`,{className:`panel-foot`,"aria-label":`Footer`,children:[(0,W.jsxs)(`div`,{className:`panel-foot__left`,children:[(0,W.jsx)(`span`,{className:`mono`,children:`ΦNet`}),` • Sovereign Gate •`,` `,(0,W.jsxs)(`button`,{type:`button`,className:`dns-copy mono`,onClick:e=>void y(e.currentTarget),"aria-label":`Remember .kai DNS IP ${oa}`,title:`Remember DNS IP`,children:[`.kai DNS: `,(0,W.jsx)(`span`,{className:`mono`,children:oa})]})]}),(0,W.jsxs)(`div`,{className:`panel-foot__right`,children:[(0,W.jsx)(`span`,{className:`mono`,children:`V`}),` `,(0,W.jsx)(`a`,{className:`mono`,href:`https://github.com/phinetwork/phi.network`,target:`_blank`,rel:`noreferrer`,"aria-label":`Version ${n} (opens GitHub)`,title:`Open GitHub`,children:n})]})]})]})]})})})})]})}function yo(){return(0,W.jsxs)(`div`,{className:`notfound`,role:`region`,"aria-label":`Not found`,children:[(0,W.jsx)(`div`,{className:`notfound__code`,children:`404`}),(0,W.jsx)(`div`,{className:`notfound__title`,children:`Route not found`}),(0,W.jsx)(`div`,{className:`notfound__hint`,children:`Use the Sovereign Gate navigation to return to Verifier, Mint Sigil, KaiVoh, or PhiStream.`}),(0,W.jsx)(`div`,{className:`notfound__actions`,children:(0,W.jsx)(vn,{className:`notfound__cta`,to:`/`,children:`Go to Verifier`})})]})}var bo=u(y(),1),xo=typeof window<`u`?C.useLayoutEffect:C.useEffect,So=[`/s`,`/s/:hash`,`/stream`,`/stream/*`,`/feed`,`/feed/*`,`/p~:token`,`/p~:token/*`,`/token`,`/p~token`,`/p`,`/verify/*`];function Co(){let[e,t]=(0,C.useState)(()=>typeof window>`u`||window.matchMedia===void 0?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches);return(0,C.useEffect)(()=>{if(typeof window>`u`||window.matchMedia===void 0)return;let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),n=e=>{t(e.matches)};n(e);try{return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)}catch{return e.addListener(n),()=>e.removeListener(n)}},[]),e}function wo(){let e=Xe(),t=Co(),[n,r]=(0,C.useState)(`show`),[i,a]=(0,C.useState)(!0),[o,s]=(0,C.useState)(!0),c=(0,C.useRef)(!1),l=(0,C.useRef)(null),u=(0,C.useRef)(null),d=(0,C.useRef)(null),f=(0,C.useRef)(null),p=(0,C.useMemo)(()=>t?140:260,[t]),m=(0,C.useMemo)(()=>t?220:420,[t]),h=(0,C.useMemo)(()=>t?800:1200,[t]),g=(0,C.useMemo)(()=>t?70:120,[t]),_=(0,C.useCallback)(()=>{l.current!==null&&window.clearTimeout(l.current),u.current!==null&&window.clearTimeout(u.current),l.current=null,u.current=null},[]),v=(0,C.useCallback)(()=>{f.current!==null&&window.cancelAnimationFrame(f.current),f.current=null},[]),y=(0,C.useCallback)(()=>{d.current!==null&&window.clearTimeout(d.current),d.current=null},[]),b=(0,C.useMemo)(()=>So.some(t=>!!fe({path:t,end:!1},e.pathname)),[e.pathname]),x=(0,C.useMemo)(()=>o||b,[o,b]),S=(0,C.useCallback)(e=>{_(),y(),l.current=window.setTimeout(()=>{r(`fade`),u.current=window.setTimeout(()=>{r(`hidden`),s(!1),a(!1)},p)},Math.max(0,e))},[y,_,p]),w=(0,C.useCallback)(e=>{v(),!(typeof window>`u`)&&(f.current=window.requestAnimationFrame(()=>S(e)))},[v,S]),T=(0,C.useCallback)(()=>{_(),v(),y(),a(!0),r(`show`)},[y,v,_]);return xo(()=>{if(typeof document>`u`)return;let e=document.body,t=e.style.backgroundColor;return t||(e.style.backgroundColor=`var(--bg-0, #040f24)`),()=>{e.style.backgroundColor=t}},[]),(0,C.useEffect)(()=>{if(!x)return;let e=null,n=()=>w(t?30:80);document.readyState===`complete`||document.readyState===`interactive`?e=window.setTimeout(n,t?30:60):window.addEventListener(`load`,n,{once:!0});let r=window.setTimeout(()=>S(0),h);return()=>{e!==null&&window.clearTimeout(e),window.removeEventListener(`load`,n),window.clearTimeout(r),_(),y(),v()}},[y,v,_,w,S,h,t,x]),(0,C.useEffect)(()=>{if(!c.current){c.current=!0;return}if(b)return d.current=window.setTimeout(()=>{T(),w(t?60:m)},g),()=>{y(),_(),v()}},[y,v,_,w,b,m,g,t,T,e.pathname,e.search,e.hash]),(0,C.useEffect)(()=>()=>{_(),y(),v()},[y,v,_]),i?(0,bo.createPortal)((0,W.jsxs)(`div`,{className:`kai-splash`,"data-state":n,"aria-live":`polite`,role:`status`,children:[(0,W.jsx)(`div`,{className:`kai-splash__grid`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`kai-splash__content`,"aria-hidden":`true`,children:(0,W.jsxs)(`div`,{className:`kai-splash__badge`,children:[(0,W.jsx)(`span`,{className:`kai-splash__badge-halo`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`kai-splash__badge-glow`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`kai-splash__rays`,"aria-hidden":`true`}),(0,W.jsxs)(`div`,{className:`kai-splash__badge-core`,children:[(0,W.jsx)(`img`,{className:`kai-splash__phi`,src:`/phi.svg`,alt:``,loading:`eager`,decoding:`sync`,draggable:!1}),(0,W.jsx)(`span`,{className:`kai-splash__badge-orb`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`kai-splash__badge-core-shine`,"aria-hidden":`true`})]}),(0,W.jsx)(`div`,{className:`kai-splash__ring`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`kai-splash__ring kai-splash__ring--inner`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`kai-splash__flare`,"aria-hidden":`true`})]})}),(0,W.jsx)(`span`,{className:`sr-only`,children:`Preparing Atlantean link…`})]}),document.body):null}var To=/^\d*(?:\.\d{0,4})?$/,Eo=/^\d*(?:\.\d{0,2})?$/,Do=({msg:e})=>e?(0,W.jsx)(`div`,{className:`phi-error-toast`,role:`status`,"aria-live":`polite`,children:(0,W.jsxs)(`div`,{className:`phi-error-card`,children:[(0,W.jsx)(`span`,{className:`badge`,children:`OFFICIAL`}),(0,W.jsx)(`p`,{className:`phi-error-text`,children:e})]})}):null,Oo=[26,70,38],ko=()=>{if(typeof window>`u`)return;let e=window.navigator;if(typeof e.vibrate==`function`)try{e.vibrate(Oo)}catch{}},Ao=({state:e,onClose:t})=>{let n=e.mode===`receive`?`Φ Inhale Complete`:`Φ Exhale Complete`,r=e.mode===`receive`?`RECEIVED`:`SENT`,i=e.message??(e.mode===`receive`?`You just inhaled Φ into your Sovereign field. This moment is sealed.`:`You just exhaled Φ from your Sovereign field. This moment is sealed.`);return(0,W.jsx)(`div`,{className:`phi-send-success-overlay`,role:`dialog`,"aria-modal":`true`,"aria-label":`Φ move complete`,onClick:t,children:(0,W.jsxs)(`div`,{className:`phi-send-success-card`,onClick:e=>e.stopPropagation(),children:[(0,W.jsx)(`div`,{className:`phi-success-orb`,"aria-hidden":`true`,children:(0,W.jsx)(`div`,{className:`phi-success-orb-inner`})}),(0,W.jsxs)(`div`,{className:`phi-success-header`,children:[(0,W.jsx)(`span`,{className:`phi-success-pill`,children:r}),(0,W.jsx)(`button`,{type:`button`,className:`phi-success-close`,onClick:t,"aria-label":`Close confirmation`,children:`✕`})]}),(0,W.jsx)(`h2`,{className:`phi-success-title`,children:n}),e.amountDisplay&&(0,W.jsx)(`p`,{className:`phi-success-amount`,children:(0,W.jsx)(`span`,{className:`mono`,children:e.amountDisplay})}),(0,W.jsx)(`p`,{className:`phi-success-body`,children:i}),e.downloadUrl&&(0,W.jsxs)(`a`,{className:`phi-send-success-download`,href:e.downloadUrl,download:e.downloadLabel||`phi-receipt`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(`span`,{className:`phi-send-success-download-icon`,"aria-hidden":`true`,children:`⬇︎`}),(0,W.jsx)(`span`,{className:`phi-send-success-download-text`,children:`Download sealed receipt`})]}),(0,W.jsx)(`button`,{type:`button`,className:`phi-success-ok`,onClick:t,children:`Done`})]})})},jo=({amountMode:e,setAmountMode:t,usdInput:n,phiInput:r,setUsdInput:i,setPhiInput:a,convDisplayRight:o,remainingPhiDisplay4:s,canonicalContext:c,onAttachClick:l,attachmentLabel:u,attachmentActive:d})=>{let f=c===`derivative`,[p,m]=(0,C.useState)(null),[h,g]=(0,C.useState)(!1),[_,v]=(0,C.useState)(null);(0,C.useEffect)(()=>{if(!p||f)return;let e=window.setTimeout(()=>m(null),2200);return()=>window.clearTimeout(e)},[p,f]),(0,C.useEffect)(()=>{if(typeof window>`u`)return;let e=e=>{let t=e.detail;if(!t)return;let n=t.mode===`receive`?`receive`:`send`;ko(),v({mode:n,amountDisplay:t.amountPhiDisplay??t.amountDisplay??(typeof t.amountPhi==`number`?String(t.amountPhi):void 0),downloadUrl:t.downloadUrl,downloadLabel:t.downloadLabel,message:t.message})};return window.addEventListener(`kk:phi-move-success`,e),()=>{window.removeEventListener(`kk:phi-move-success`,e)}},[]);let y=e=>{m(e);try{window.dispatchEvent(new CustomEvent(`kk:error`,{detail:{where:`SendPhiAmountField`,error:e}}))}catch{}},b=(0,C.useMemo)(()=>e===`USD`?`\\d*(?:\\.\\d{0,2})?`:`\\d*(?:\\.\\d{0,4})?`,[e]),x=e===`USD`?`$`:`Φ`,S=e===`USD`?`Dollar amount to exhale`:`Phi amount to exhale`,w=t=>{let n=t.replace(/\s+/g,``);e===`USD`?Eo.test(n)&&i(n):To.test(n)&&a(n)},T=t=>{if(t.key!==`Enter`)return;if(e!==`PHI`){y(`Enter a Φ amount or switch to Φ to exhale.`);return}let n=(r||``).trim();if(n===``||n===`.`){y(`No Φ entered — specify an amount to exhale.`);return}let i=Number((n.startsWith(`.`)?`0`:``)+n);if(!Number.isFinite(i)||i<=0){y(`Invalid Φ amount — enter a number greater than 0.`);return}let a=Number(String(s).replace(/[^\d.]/g,``));Number.isFinite(a)&&i>a+1e-9&&y(`Exceeds remaining — Rem: Φ ${s}`)},E=typeof l==`function`;return f?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Do,{msg:p}),_&&(0,W.jsx)(Ao,{state:_,onClose:()=>v(null)})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`phi-send-field`,"data-state":h?`focus`:`idle`,children:[(0,W.jsxs)(`div`,{className:`phi-send-label`,children:[(0,W.jsx)(`span`,{className:`label-main`,children:`Exhale Amount`}),(0,W.jsxs)(`span`,{className:`label-sub`,children:[e===`USD`?`Enter in $`:`Enter in Φ`,` · 🛕: Φ`,` `,s]})]}),(0,W.jsxs)(`div`,{className:`phi-send-bar`,children:[(0,W.jsxs)(`div`,{className:`phi-send-inputShell`,"aria-live":`polite`,children:[(0,W.jsx)(`span`,{className:`phi-prefix`,"aria-hidden":`true`,children:x}),(0,W.jsx)(`input`,{className:`phi-send-input`,type:`text`,inputMode:`decimal`,pattern:b,"aria-label":S,placeholder:x,value:e===`USD`?n:r,onChange:e=>w(e.target.value),onKeyDown:T,onFocus:()=>g(!0),onBlur:()=>g(!1),"aria-invalid":p?!0:void 0,autoComplete:`off`,enterKeyHint:`send`}),(0,W.jsx)(`i`,{"aria-hidden":`true`,className:`phi-input-glow`})]}),(0,W.jsx)(`div`,{className:`phi-conv-right convert-readout`,"aria-live":`polite`,children:o}),(0,W.jsxs)(`div`,{className:`phi-send-controls`,children:[(0,W.jsxs)(`div`,{role:`tablist`,"aria-label":`Amount unit`,className:`phi-mode-toggle seg`,children:[(0,W.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e===`USD`,className:`phi-mode-btn ${e===`USD`?`is-active`:``}`,onClick:()=>t(`USD`),title:`Enter in dollars`,children:`$`}),(0,W.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e===`PHI`,className:`phi-mode-btn ${e===`PHI`?`is-active`:``}`,onClick:()=>t(`PHI`),title:`Enter in Φ`,children:`Φ`})]}),E&&(0,W.jsxs)(`button`,{type:`button`,className:`phi-attach-btn ${d?`is-active`:``}`,onClick:l,title:u||`Attach sigil / note`,children:[(0,W.jsx)(`span`,{className:`phi-attach-icon`,"aria-hidden":`true`,children:`📎`}),u&&(0,W.jsx)(`span`,{className:`phi-attach-label`,children:u})]})]})]})]}),(0,W.jsx)(Do,{msg:p}),_&&(0,W.jsx)(Ao,{state:_,onClose:()=>v(null)})]})};function Mo(e,t){if(console.error(`[VerifierStamper] ${e}`,t),!(typeof window>`u`))try{window.dispatchEvent(new CustomEvent(`kk:error`,{detail:{where:e,error:t instanceof Error?t.message:String(t)}}))}catch(t){console.error(`[VerifierStamper] kk:error dispatch failed in ${e}`,t)}}function No(e){try{let t=new TextEncoder().encode(e),n=``;for(let e=0;ee?`0.`:``).split(`.`),a=r.replace(/^0+(?=\d)/,``)||`0`,o=(i+`0`.repeat(Number(Fo))).slice(0,Number(Fo));return n*(BigInt(a)*Lo+BigInt(o||`0`))}function zo(e){let t=e<0n?`-`:``,n=e<0n?-e:e,r=n/Lo,i=(n%Lo).toString().padStart(Number(Fo),`0`);return i=i.replace(/0+$/,``),i.length?`${t}${r}.${i}`:`${t}${r}`}function Bo(e,t){return e*t/Lo}function Vo(e,t){return t===0n?0n:e*Lo/t}function Ho(e,t){let n=Math.max(0,Math.min(Number(Fo),t)),r=Io(Fo-BigInt(n)),i=r/2n;return e>=0n?(e+i)/r*r:(e-i)/r*r}function Uo(e,t){let n=Math.max(0,Math.min(Number(Fo),t)),r=e<0n?`-`:``,i=(e<0n?-e:e)/Io(Fo-BigInt(n)),a=Io(BigInt(n));return`${r}${i/a}.${(i%a).toString().padStart(n,`0`)}`}function Wo(e){return Uo(Ho(Ro(e),4),4)}function Go(e){try{if(!e||!e.payload)return 0n;let{mime:t,encoded:n}=e.payload;if(!t||!n||!/^application\/vnd\.kairos-exhale/i.test(t))return 0n;let r=Po(n),i=JSON.parse(r);if(!i||i.kind!==`exhale`)return 0n;let a=String(i.amountPhi??``);return a?Ro(a):0n}catch{return 0n}}const Ko=e=>{let t=Uo(Ho(Ro(String(e??`0`)),6),6);return Number(t.replace(`.`,``))},qo=e=>Number((e/1e6).toFixed(6)),Jo=e=>qo(Ko(e)),Yo=(e,t)=>qo(Ko(e)+Ko(t)),Xo=(e,t)=>qo(Math.max(0,Ko(e)-Ko(t))),Zo=e=>qo(e.reduce((e,t)=>e+Ko(t),0)),Qo=e=>Ho(Ro(String(e??`0`)),6),$o=e=>Uo(e,6);var es=class extends C.Component{constructor(e){super(e),this.state={hasError:!1,error:void 0}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`[VerifierStamper] crashed`,e,t);try{typeof window<`u`&&window.dispatchEvent(new CustomEvent(`kk:error`,{detail:{where:`VerifierStamper`,error:e instanceof Error?e.message:String(e)}}))}catch(e){console.error(`[VerifierStamper] failed to dispatch kk:error`,e)}}handleReset=()=>{this.setState({hasError:!1,error:void 0}),this.props.onReset?.()};render(){if(this.state.hasError){let e=this.state.error instanceof Error?this.state.error.message:String(this.state.error??`Unknown error`),t=this.state.error instanceof Error?this.state.error.stack:void 0;return(0,W.jsxs)(`div`,{role:`alert`,style:{padding:16},children:[(0,W.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:8},children:[(0,W.jsx)(`strong`,{children:`Verifier crashed`}),(0,W.jsx)(`button`,{className:`secondary`,onClick:this.handleReset,title:`Reset Verifier`,"aria-label":`Reset Verifier`,children:`Reset`})]}),(0,W.jsx)(`div`,{style:{fontSize:14,color:`var(--dim, #999)`},children:e}),t&&(0,W.jsxs)(`details`,{style:{marginTop:8},children:[(0,W.jsx)(`summary`,{children:`Stack`}),(0,W.jsx)(`pre`,{style:{whiteSpace:`pre-wrap`},children:t})]})]})}return(0,W.jsx)(W.Fragment,{children:this.props.children})}},ts=[`Root`,`Sacral`,`Solar Plexus`,`Heart`,`Throat`,`Third Eye`,`Crown`].reduce((e,t)=>(e[t.toLowerCase()]=t,e),{});function ns(e){let t=e.toLowerCase().trim().replace(/[-_]/g,` `).replace(/\b(gate|chakra|day)\b/g,``).replace(/\s+/g,` `).trim();return/(third\s*eye)/.test(t)?`third eye`:/(solar\s*plexus)/.test(t)?`solar plexus`:t}function rs(e){if(typeof e!=`string`)return null;let t=ns(e),n=ts[t];if(n)return n;switch(t){case`root`:return`Root`;case`sacral`:return`Sacral`;case`solar`:case`plexus`:return`Solar Plexus`;case`heart`:return`Heart`;case`throat`:return`Throat`;case`third`:case`eye`:return`Third Eye`;case`crown`:return`Crown`;default:return null}}function is(e){return rs(e.chakraDay??``)||rs(e.chakraGate??``)||null}function as(e,t,n=``){if(typeof e==`object`&&e){let n=e[t];if(typeof n==`string`)return n}return n}function os(e,t){if(typeof e==`object`&&e){let n=e[t];if(typeof n==`number`&&Number.isFinite(n))return n}}function ss(e){let{meta:t,sigilSvgRaw:n,verifyUrl:r,pulseNow:i}=e;if(!t)return{nowPulse:String(i)};let a=t.valuation??null,o=os(t,`beat`)??t.beat??0,s=os(t,`stepIndex`)??t.stepIndex??0,c=os(t,`pulse`)??t.pulse??0,l=(t.transfers??[]).map(e=>({action:e.receiverSignature?`receive`:`send`,pulse:e.senderKaiPulse,beat:o,stepIndex:s,ownerPhiKey:t.userPhiKey})),u=t,d=u.zk,f;if(typeof d==`object`&&d){let e=d,t=typeof e.scheme==`string`?e.scheme:void 0,n=typeof e.poseidon==`string`?e.poseidon:void 0;f=t?{scheme:t,poseidon:n}:void 0}return{purpose:as(t,`purpose`),to:as(t,`to`),from:as(t,`from`),location:as(t,`location`),witnesses:as(t,`witnesses`),reference:as(t,`reference`),remark:as(t,`remark`,`In Yahuah We Trust — Secured by Φ, not man-made law`),valuePhi:typeof a?.valuePhi==`number`?String(a.valuePhi):``,premiumPhi:typeof a?.premiumPhi==`number`?String(a.premiumPhi):``,computedPulse:typeof c==`number`?String(c):``,nowPulse:String(i),kaiSignature:typeof t.kaiSignature==`string`?t.kaiSignature:``,userPhiKey:typeof t.userPhiKey==`string`?t.userPhiKey:``,sigmaCanon:as(u,`sigmaCanon`),shaHex:as(u,`shaHex`),phiDerived:as(u,`phiDerived`),valuationAlg:a?.algorithm==null?``:String(a.algorithm),valuationStamp:a?.stamp==null?``:String(a.stamp),provenance:l.slice(-7),zk:f,sigilSvg:n??``,verifyUrl:r||``}}function cs(e,t){let n=e;if(!n)return{used:!1,expired:!1};let r=!!n.sendLock?.used,i=n.childClaim?.expireAtPulse;if(typeof i!=`number`||!Number.isFinite(i)){let e=n.transfers?.slice(-1)[0]?.senderKaiPulse;typeof e==`number`&&(i=e+77)}return{used:r,expired:typeof i==`number`?t>i:!1,expireAt:i}}function ls(e,t){if(!e)return{expired:!1};let n=e.transfers?.slice(-1)[0];if(!(n&&!n.receiverSignature))return{expired:!1};let r=n?.senderKaiPulse;if(typeof r!=`number`)return{expired:!1};let i=r+77;return{expired:t>i,expireAt:i}}function us(e){let{contextOk:t,typeOk:n,hasCore:r,contentSigMatches:i,isOwner:a,hasTransfers:o,lastOpen:s,lastClosed:c,isUnsigned:l,childUsed:u,childExpired:d,parentOpenExpired:f,isChildContext:p}=e;return!t||!n?`invalid`:r?i===!1?`sigMismatch`:a===!1?`notOwner`:l?`unsigned`:s?d||f?`complete`:`readyReceive`:p?u||o&&c?`readySend`:`complete`:`readySend`:`structMismatch`}const ds=e=>`sigil:rotated:${e}`;function fs(e,t){let n=Array.from(new Set((e??[]).map(e=>String(e||``).toLowerCase()).filter(e=>e.length>0)));for(let e of n){try{typeof localStorage<`u`&&localStorage.setItem(ds(e),`${t}@${Kr()}`)}catch(e){Mo(`publishRotation.localStorage`,e)}try{let n=new BroadcastChannel(`sigil-xfer-v1`),r={type:`rotated`,canonical:e,token:t};n.postMessage(r),n.close()}catch(e){Mo(`publishRotation.bc`,e)}try{typeof window<`u`&&window.dispatchEvent(new CustomEvent(`sigil:transfer-rotated`,{detail:{canonical:e,token:t}}))}catch(e){Mo(`publishRotation.dispatch`,e)}}}(3+Math.sqrt(5))*1e3;const ps=`https://schema.phi.network/sigil/v1`,ms=`application/phi.kairos.sigil+svg`,hs=2e3,gs=e=>Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``);async function _s(e){let t=typeof e==`string`?new TextEncoder().encode(e):e,n=await crypto.subtle.digest(`SHA-256`,t);return gs(new Uint8Array(n))}var vs=`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`;function ys(e){let t=0n;for(let n of e)t=(t<<8n)+BigInt(n);let n=``;for(;t>0n;)n=vs[Number(t%58n)]+n,t/=58n;for(let t=0;t1;){let e=[];for(let n=0;n1;){let e=n%2==1?n-1:n+1,t=r[e]??r[n];i.push(t);let a=[];for(let e=0;eJSON.stringify(e)+`:`+ks(t[e])).join(`,`)+`}`}async function As(e){let{pulse:t,beat:n,stepIndex:r,chakraDay:i}=e;return typeof t!=`number`||typeof n!=`number`||typeof r!=`number`||typeof i!=`string`?null:_s(`${t}|${n}|${r}|${i}|${e.intentionSigil??``}`)}async function js(e){let t=await _s(e+`φ`),n=new Uint8Array(20);for(let e=0;e<20;e++)n[e]=parseInt(t.slice(e*2,e*2+2),16);return bs(n,0)}function Ms(e){let t={senderSignature:e.senderSignature,senderStamp:e.senderStamp,senderKaiPulse:e.senderKaiPulse};return e.payload&&(t.payload={name:e.payload.name,mime:e.payload.mime,size:e.payload.size}),e.receiverSignature&&(t.receiverSignature=e.receiverSignature),e.receiverStamp&&(t.receiverStamp=e.receiverStamp),e.receiverKaiPulse!=null&&(t.receiverKaiPulse=e.receiverKaiPulse),t}async function Ns(e){return _s(JSON.stringify(Ms(e)))}function Ps(e){let t={senderSignature:e.senderSignature,senderStamp:e.senderStamp,senderKaiPulse:e.senderKaiPulse};return e.payload&&(t.payload={name:e.payload.name,mime:e.payload.mime,size:e.payload.size}),t}async function Fs(e){return _s(JSON.stringify(Ps(e)))}async function Is(e){return ws(await Promise.all(e.map(Ns)))}async function Ls(e,t){return _s(ks({pulse:e.pulse??0,beat:e.beat??0,stepIndex:e.stepIndex??0,chakraDay:e.chakraDay??``,kaiSignature:e.kaiSignature??``,creatorPublicKey:e.creatorPublicKey??``,cumulativeTransfers:t??e.cumulativeTransfers??0,segments:(e.segments??[]).map(e=>({index:e.index,root:e.root,cid:e.cid,count:e.count})),segmentsMerkleRoot:e.segmentsMerkleRoot??``}))}function Rs(e){return(e.segments??[]).reduce((e,t)=>e+(t.count||0),0)}async function zs(e,t){return Ls(e,Rs(e)+t)}function Bs(e,t){let n=rs(e.chakraDay)??`Root`,r={v:1,type:`send`,sigil:{pulse:e.pulse??0,beat:e.beat??0,stepIndex:e.stepIndex??0,chakraDay:n,kaiSignature:e.kaiSignature??``},previousHeadRoot:t.previousHeadRoot,senderKaiPulse:t.senderKaiPulse,senderPubKey:t.senderPubKey,nonce:t.nonce,transferLeafHashSend:t.transferLeafHashSend};return new TextEncoder().encode(ks(r))}function Vs(e){let t={v:1,type:`receive`,link:e.senderSig,previousHeadRoot:e.previousHeadRoot,receiverKaiPulse:e.receiverKaiPulse,receiverPubKey:e.receiverPubKey,transferLeafHashReceive:e.transferLeafHashReceive};return new TextEncoder().encode(ks(t))}async function Hs(e){return _s(JSON.stringify({pulse:e.pulse,beat:e.beat,stepIndex:e.stepIndex,chakraDay:e.chakraDay,kaiSignature:e.kaiSignature,userPhiKey:e.userPhiKey,cumulativeTransfers:e.cumulativeTransfers??0,segments:(e.segments??[]).map(e=>({index:e.index,root:e.root,cid:e.cid,count:e.count})),segmentsMerkleRoot:e.segmentsMerkleRoot??``}))}function Us(e){let t=JSON.stringify(e);return btoa(unescape(encodeURIComponent(t))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function Ws(){let e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``)}async function Gs(e){return _s(ks(e))}async function Ks(e){let t=JSON.stringify(e),n=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(t));return[...new Uint8Array(n)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}function qs(e,t,n,r){let i=typeof window<`u`&&typeof window.location?.origin==`string`?window.location.origin:`http://localhost`,a=new URL(e,i);return a.searchParams.set(`p`,Us(t)),n&&a.searchParams.set(`t`,n),r&&r.length>0&&a.searchParams.set(`h`,r),a.toString()}var Js=0;function Ys(e,t){console.error(`[modal] ${e}:`,t)}function Xs(e){return!!(e.open||e.hasAttribute(`open`))}function Zs(){Js+=1,typeof document<`u`&&Js===1&&(document.documentElement.classList.add(`kk-dialog-open`),document.body.style.overflow=`hidden`,document.body.style.touchAction=`none`)}function Qs(){Js=Math.max(0,Js-1),typeof document<`u`&&Js===0&&(document.documentElement.classList.remove(`kk-dialog-open`),document.body.style.overflow=``,document.body.style.touchAction=``)}function $s(e){let t=()=>{e.removeEventListener(`close`,t),e.removeEventListener(`cancel`,t),e.setAttribute(`data-open`,`false`),e.removeAttribute(`data-rotate`),Qs()};e.addEventListener(`close`,t,{once:!0}),e.addEventListener(`cancel`,t,{once:!0})}function ec(e){return e.querySelector(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`)??null}function tc(e){if(!(typeof window>`u`||!e))try{if(Xs(e)){e.setAttribute(`data-open`,`true`);let t=ec(e)??e;typeof t.focus==`function`&&t.focus();return}let t=typeof e.showModal==`function`,n=typeof e.show==`function`;try{t?e.showModal():n?e.show():e.setAttribute(`open`,``)}catch(t){Ys(`showModal/show`,t),e.setAttribute(`open`,``)}e.setAttribute(`data-open`,`true`),$s(e),Zs();let r=ec(e)??e;typeof r.focus==`function`&&r.focus()}catch(e){Ys(`safeShowDialog`,e)}}function nc(e,t,n){let r=n?.delayMs??0,i=()=>{if(r>0){window.setTimeout(t,r);return}try{let e=typeof window<`u`?window.requestAnimationFrame:void 0;typeof e==`function`?e(()=>e(t)):window.setTimeout(t,16)}catch(e){Ys(`switchModal.runNext`,e),window.setTimeout(t,16)}};if(!e){i();return}try{if(Xs(e)){e.setAttribute(`data-open`,`false`),e.removeAttribute(`data-rotate`);let t=()=>{e.removeEventListener(`close`,t),Qs()};e.addEventListener(`close`,t,{once:!0});try{e.close()}catch(t){Ys(`current.close`,t),e.removeAttribute(`open`);try{e.dispatchEvent(new Event(`close`))}catch(e){Ys(`dispatch(close)`,e)}}i();return}}catch(e){Ys(`switchModal`,e)}i()}function rc(){let e=window;e.__SIGIL__||={};let t=e.__SIGIL__;return{registerSigilUrl:typeof t.registerSigilUrl==`function`?t.registerSigilUrl:void 0,registerSend:typeof t.registerSend==`function`?t.registerSend:void 0}}const ic=typeof window<`u`&&typeof document<`u`;function ac(e,t){if(!e||typeof e!=`object`)return;let n=t.split(`.`),r=e;for(let e of n)if(r&&typeof r==`object`&&e in r)r=r[e];else return;return r}function oc(e){return e==null?``:String(e)}function sc(e,t){for(let n of t){let t=ac(e,n);if(t!=null&&t!==``)return oc(t)}return``}function cc(e,t){if(!ic)return``;let n=oc(ac(e,`pulse`)),r=oc(ac(e,`beat`)),i=oc(ac(e,`stepIndex`)),a=n&&r&&i?`ks-${n}-${r}-${i}`:``,o=a?document.getElementById(a):null;if(!o)return``;let s=t.replace(/^data-/,``).replace(/-([a-z])/g,(e,t)=>t.toUpperCase());return(o.dataset||{})[s]??o.getAttribute(t)??``}const lc=({data:e})=>{if(typeof e!=`object`||!e)return(0,W.jsx)(`span`,{className:`json-primitive`,children:String(e)});let t=Array.isArray(e);return(0,W.jsx)(`ul`,{className:`json-node`,children:(t?e.map((e,t)=>[t,e]):Object.entries(e)).map(([e,n])=>(0,W.jsx)(`li`,{children:(0,W.jsxs)(`details`,{children:[(0,W.jsx)(`summary`,{children:t?`[${e}]`:`"${e}"`}),(0,W.jsx)(lc,{data:n})]})},String(e)))})};var uc=lc;const dc=({path:e,label:t})=>{let n={check:`M5 13l4 4L19 7`,x:`M6 6l12 12M6 18L18 6`,warn:`M12 9v4m0 4h.01M12 3l9 16H3z`,shield:`M12 3l7 4v6l-7 4-7-4V7l7-4z`,sigma:`M18 6H9l5 6-5 6h9M6 6h2M6 18h2`,phi:`M12 4a8 8 0 100 16 8 8 0 000-16zm0 0v16`,send:`M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z`,recv:`M2 22l11-11M2 22l20-7-9-4-4-9-7 20z`,done:`M12 21c4.97 0 9-4.03 9-9S16.97 3 12 3 3 7.03 3 12s4.03 9 9 9zm-1-6l6-6M8 12l3 3`,stack:`M12 3l9 4-9 4-9-4 9-4zm-9 8l9 4 9-4M3 19l9 4 9-4`,hash:`M10 3L8 21M16 3l-2 18M3 8h18M3 16h18`,zk:`M12 3l7 4v6l-7 4-7-4V7l7-4zM9 12h6`,paperclip:`M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.2a2 2 0 01-2.83-2.83l8.49-8.49`,lock:`M7 10V7a5 5 0 0110 0v3h1a2 2 0 012 2v7a2 2 0 01-2 2H6a2 2 0 01-2-2v-7a2 2 0 012-2h1zm3 0h4V7a3 3 0 00-6 0v3z`,timer:`M12 8v5l3 3M12 2a10 10 0 100 20 10 10 0 000-20`,ban:`M4.93 4.93l14.14 14.14M12 2a10 10 0 110 20 10 10 0 010-20`};return(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`18`,height:`18`,"aria-hidden":`true`,focusable:`false`,className:`ico`,children:[(0,W.jsx)(`path`,{d:n[e],stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`}),t?(0,W.jsx)(`title`,{children:t}):null]})},fc=({title:e,kind:t=`info`,children:n,badge:r=null})=>(0,W.jsx)(`span`,{className:`chip icon ${t}`,role:`img`,"aria-label":e,title:e,...r==null?{}:{"data-badge":String(r)},children:n});function pc({uiState:e,meta:t,contentSigMatches:n,phiKeyMatches:r,headProof:i,canonicalContext:a,childUsed:o,childExpired:s,parentOpenExpired:c,isSendFilename:l}){let u=[],d=e=>u.push(e);e===`invalid`&&d((0,W.jsx)(fc,{kind:`err`,title:`Invalid`,children:(0,W.jsx)(dc,{path:`x`})},`inv`)),e===`structMismatch`&&d((0,W.jsx)(fc,{kind:`err`,title:`Structure mismatch`,children:(0,W.jsx)(dc,{path:`warn`})},`struct`)),e===`sigMismatch`&&d((0,W.jsx)(fc,{kind:`err`,title:`Signature mismatch`,children:(0,W.jsx)(dc,{path:`x`})},`sigm`)),e===`notOwner`&&d((0,W.jsx)(fc,{kind:`warn`,title:`Not owner`,children:(0,W.jsx)(dc,{path:`shield`})},`owner`)),e===`unsigned`&&d((0,W.jsx)(fc,{kind:`warn`,title:`Unsigned`,children:(0,W.jsx)(dc,{path:`hash`})},`unsigned`)),e===`readySend`&&d((0,W.jsx)(fc,{kind:`info`,title:`Ready to send`,children:(0,W.jsx)(dc,{path:`send`})},`send`)),e===`readyReceive`&&d((0,W.jsx)(fc,{kind:`info`,title:`Ready to receive`,children:(0,W.jsx)(dc,{path:`recv`})},`recv`)),e===`complete`&&d((0,W.jsx)(fc,{kind:`ok`,title:`Receipt`,children:(0,W.jsx)(dc,{path:`done`})},`done`)),e===`verified`&&d((0,W.jsx)(fc,{kind:`ok`,title:`Verified`,children:(0,W.jsx)(dc,{path:`check`})},`ver`)),n===!0&&d((0,W.jsx)(fc,{kind:`ok`,title:`Content Σ match`,children:(0,W.jsx)(dc,{path:`sigma`})},`sigok`)),n===!1&&d((0,W.jsx)(fc,{kind:`err`,title:`Content Σ mismatch`,children:(0,W.jsx)(dc,{path:`sigma`})},`sigerr`)),r===!0&&d((0,W.jsx)(fc,{kind:`ok`,title:`Φ-Key match`,children:(0,W.jsx)(dc,{path:`phi`})},`phiok`)),r===!1&&d((0,W.jsx)(fc,{kind:`err`,title:`Φ-Key mismatch`,children:(0,W.jsx)(dc,{path:`phi`})},`phierr`)),t?.cumulativeTransfers!=null&&d((0,W.jsx)(fc,{kind:`info`,title:`Cumulative transfers`,badge:t.cumulativeTransfers,children:(0,W.jsx)(dc,{path:`hash`})},`cum`)),(t?.segments?.length??0)>0&&d((0,W.jsx)(fc,{kind:`info`,title:`Segments`,badge:t?.segments?.length??0,children:(0,W.jsx)(dc,{path:`stack`})},`segs`)),i&&d((0,W.jsx)(fc,{kind:i.ok?`ok`:`err`,title:i.ok?`Head proof verified`:`Head proof failed`,children:(0,W.jsx)(dc,{path:`shield`})},`headproof`)),t?.transfersWindowRootV14&&d((0,W.jsx)(fc,{kind:`info`,title:`v14 head root present`,children:(0,W.jsx)(dc,{path:`hash`})},`v14root`)),(t?.hardenedTransfers??[]).some(e=>!!(e.zkSend?.verified||e.zkReceive?.verified))&&d((0,W.jsx)(fc,{kind:`ok`,title:`Zero-knowledge proof verified`,children:(0,W.jsx)(dc,{path:`zk`})},`zk`));let f=a===`derivative`;return f&&o&&d((0,W.jsx)(fc,{kind:`warn`,title:`Transfer link used`,children:(0,W.jsx)(dc,{path:`lock`})},`used`)),f&&s&&d((0,W.jsx)(fc,{kind:`warn`,title:`Transfer link expired`,children:(0,W.jsx)(dc,{path:`timer`})},`expired`)),a===`parent`&&c&&d((0,W.jsx)(fc,{kind:`warn`,title:`Send expired`,children:(0,W.jsx)(dc,{path:`timer`})},`pexp`)),l&&d((0,W.jsx)(fc,{kind:`warn`,title:`SEND file: segmentation disabled`,children:(0,W.jsx)(dc,{path:`ban`})},`nosg`)),u}var mc=({className:e,scrollable:t=!0,ariaLive:n=`polite`,...r})=>{let i=pc(r);return(0,W.jsxs)(`div`,{className:`status-chips ${e??``}`,role:`group`,"aria-label":`Verification status`,"aria-live":n,style:t?{overflowX:`auto`,whiteSpace:`nowrap`}:void 0,"data-count":i.length,children:[(0,W.jsx)(`span`,{className:`chip-sentinel`,"aria-hidden":`true`}),i.map((e,t)=>(0,W.jsx)(`span`,{className:`chip-wrap`,"data-i":t,style:{display:`inline-block`},children:e},t))]})},hc=u(y(),1),gc=`sigil:urls`;function _c(e){if(!(typeof window>`u`))try{let t=window.localStorage.getItem(gc),n=t?JSON.parse(t):[];n.includes(e)||(n.push(e),window.localStorage.setItem(gc,JSON.stringify(n)));let r=new CustomEvent(`sigil:url-registered`,{detail:{url:e}});window.dispatchEvent(r)}catch{}}var vc=e=>{let{open:t,url:n,hash:r,onClose:i}=e,a=(0,C.useRef)(null),o=(0,C.useRef)(null),s=(0,C.useRef)(null),c=(0,C.useRef)(null),[l,u]=(0,C.useState)(``),d=(0,C.useRef)(null);(0,C.useEffect)(()=>{if(!(!t||!n)&&d.current!==n)if(d.current=n,typeof window<`u`&&window.__SIGIL__&&typeof window.__SIGIL__.registerSigilUrl==`function`)try{window.__SIGIL__.registerSigilUrl(n)}catch{_c(n)}else _c(n)},[t,n]),(0,C.useEffect)(()=>{let e=a.current;if(!e)return;let n=e=>e.preventDefault();if(e.addEventListener(`cancel`,n),t){c.current=document.activeElement??null;try{if(!e.open)try{e.showModal()}catch{e.show()}e.setAttribute(`data-open`,`true`)}catch{}let t=window.setTimeout(()=>s.current?.focus({preventScroll:!0}),0);return()=>{clearTimeout(t),e.removeEventListener(`cancel`,n)}}else e.open&&e.close(),e.setAttribute(`data-open`,`false`),e.removeEventListener(`cancel`,n),c.current?.focus?.()},[t]);let f=(0,C.useMemo)(()=>{if(typeof navigator>`u`)return!1;let e=navigator;return typeof e.share==`function`?n&&typeof e.canShare==`function`?e.canShare({url:n}):!0:!1},[n]),p=(0,C.useCallback)(e=>{if(e.key!==`Tab`)return;let t=o.current;if(!t)return;let n=t.querySelectorAll([`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex='-1'])`].join(`,`));if(n.length===0)return;let r=n[0],i=n[n.length-1];!e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus())},[]);(0,C.useEffect)(()=>{if(!t)return;let e=e=>p(e);return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[t,p]);let m=e=>{u(e),window.setTimeout(()=>u(``),900)},h=async(e,t)=>{try{await navigator.clipboard.writeText(e),m(`${t} copied to clipboard`)}catch{m(`Could not copy ${t}`)}},g=async()=>{try{f&&typeof navigator<`u`?(await navigator.share?.({title:`Kairos Sigil-Glyph`,text:`Sealed Kairos Moment`,url:n}),m(`Share sheet opened`)):await h(n,`Link`)}catch{}},_=(0,C.useMemo)(()=>r?r.slice(0,16):`—`,[r]),v=e=>{e.preventDefault(),e.stopPropagation(),i?.()};return t?(0,hc.createPortal)((0,W.jsxs)(`dialog`,{ref:a,className:`seal-dialog seal-toplayer glass-modal fullscreen`,"aria-label":`Moment Sealed`,style:{zIndex:2147483647,padding:0,border:`none`,background:`transparent`},children:[(0,W.jsx)(`div`,{className:`seal-veil`,"aria-hidden":`true`}),(0,W.jsxs)(`div`,{ref:o,className:`seal-card`,role:`document`,onClick:e=>e.stopPropagation(),children:[(0,W.jsx)(`div`,{className:`seal-ornament seal-ornament--tl`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`seal-ornament seal-ornament--tr`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`seal-ornament seal-ornament--bl`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`seal-ornament seal-ornament--br`,"aria-hidden":`true`}),(0,W.jsx)(`button`,{ref:s,className:`seal-close`,"aria-label":`Close`,onClick:v,type:`button`,children:(0,W.jsx)(yc,{})}),(0,W.jsxs)(`header`,{className:`seal-header`,children:[(0,W.jsx)(`h3`,{id:`seal-title`,className:`seal-title`,children:`Moment Sealed`}),(0,W.jsx)(`p`,{id:`seal-desc`,className:`seal-subtitle`,children:`Your Kairos imprint is preserved. Proceed to the url below to Inhale Claimed Ownership.`})]}),(0,W.jsxs)(`label`,{className:`field`,children:[(0,W.jsx)(`span`,{className:`field-label`,children:`Hash`}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`code`,{className:`hash`,title:r||`—`,children:r?_:`—`}),(0,W.jsx)(`button`,{className:`icon-btn`,onClick:()=>h(r,`Hash`),disabled:!r,"aria-label":`Copy hash`,title:`Copy hash`,type:`button`,children:(0,W.jsx)(xc,{})})]}),r&&(0,W.jsxs)(`p`,{className:`micro`,children:[`Full: `,(0,W.jsx)(`span`,{className:`mono`,children:r})]})]}),(0,W.jsxs)(`label`,{className:`field`,children:[(0,W.jsx)(`span`,{className:`field-label`,children:`URL`}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`input`,{className:`url-input`,value:n,readOnly:!0,"aria-readonly":`true`,spellCheck:!1,dir:`ltr`,title:n,onFocus:e=>e.currentTarget.select()}),(0,W.jsx)(`button`,{className:`icon-btn`,onClick:()=>h(n,`Link`),disabled:!n,"aria-label":`Copy link`,title:`Copy link`,type:`button`,children:(0,W.jsx)(xc,{})}),n&&(0,W.jsx)(`a`,{className:`open-link`,href:n,target:`_blank`,rel:`noopener`,"aria-label":`Open link in new tab`,title:`Open link`,children:(0,W.jsx)(Sc,{})})]})]}),(0,W.jsx)(`div`,{className:`cta-row`,children:(0,W.jsxs)(`button`,{className:`secondary cta`,onClick:g,type:`button`,children:[(0,W.jsx)(bc,{}),(0,W.jsx)(`span`,{children:f?`Share`:`Remember Link`})]})}),(0,W.jsx)(`p`,{className:`fine`,children:`This moment is now sealed in time. Use the link above within the next 11 breaths to claim ownership & gain permanent access to this kairos moment.`}),(0,W.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:l})]})]}),document.body):null},yc=()=>(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`seal-close-ico`,children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,opacity:`.35`}),(0,W.jsx)(`path`,{d:`M7 7l10 10M17 7L7 17`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`})]}),bc=()=>(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,W.jsx)(`path`,{d:`M15 8a3 3 0 100-6 3 3 0 000 6zM6 14a3 3 0 100-6 3 3 0 000 6zm9 12a3 3 0 100-6 3 3 0 000 6z`,fill:`currentColor`}),(0,W.jsx)(`path`,{d:`M8.6 9.7l6.8-3.4M8.6 12.3l6.8 3.4`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`})]}),xc=()=>(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,W.jsx)(`rect`,{x:`9`,y:`9`,width:`10`,height:`10`,rx:`2`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,W.jsx)(`rect`,{x:`5`,y:`5`,width:`10`,height:`10`,rx:`2`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`,opacity:`.5`})]}),Sc=()=>(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,W.jsx)(`path`,{d:`M10 14a5 5 0 007.07 0l1.41-1.41a5 5 0 00-7.07-7.07L10 6`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,W.jsx)(`path`,{d:`M14 10a5 5 0 00-7.07 0L5.5 11.43a5 5 0 007.07 7.07L14 18`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`})]}),Cc=vc,G=(1+Math.sqrt(5))/2,wc=44,Tc=11,Ec=wc*Tc,Dc=17491.270421,Oc=G,kc=1/G,Ac={low:1-1/G**6,med:1,high:1+1/G**6},jc=1/G**6,Mc=1/G**5,Nc=1/G**3,Pc=1/G**4,Fc=1+1/G**4,Ic=.7,Lc=.3,Rc=1/Lc,zc=1/G**6,Bc=1/G**6,Vc=.15,Hc=1/G**5,Uc=1+1/G**3,Wc=1/G**5,Gc=Dc,Kc=1/G**7,qc=1/G**7,Jc=1/G**8,Yc=1/G,Xc=1/G**2,Zc=1/G**2,Qc=1/G**3,$c=1/G**4,el=1/G**4,tl=1/G**5,nl=1/G**6,rl=1/G**5,il=Dc*365,al=il,ol=1/G**3,sl=1/G**2,cl=1/G**4,ll=1/G**6,ul=1/G**7,dl=1/G**8,fl=1/G**8,pl=1/G**9,ml=1/G**4,hl=1/G,gl={RARITY_ONE_OF_ONE:Oc,RARITY_EXP:kc,QUALITY_MAP:Ac,CREATOR_VERIFIED_LIFT:jc,CREATOR_REP_MAX:Mc,PROV_LOG_SLOPE:Nc,HOLD_SLOPE:Pc,HOLD_CAP:Fc,CLOSURE_CENTER:Ic,CLOSURE_RANGE:Lc,CLOSURE_GAIN:zc,CADENCE_GAIN:Bc,CHURN_KAPPA:Vc,AGE_EPS:Hc,AGE_CAP:Uc,RESONANCE_GAIN:Wc,DISCOUNT_PULSE_HALFSPAN:Gc,GEOM_EDGE_GAIN:Kc,GEOM_PHI_GAIN:qc,GEOM_PRIME_GAIN:Jc,MOMENT_FIB_EXACT_GAIN:Yc,MOMENT_LUCAS_EXACT_GAIN:Xc,MOMENT_PHI_TRANSITION_GAIN:Zc,MOMENT_UNIFORM_GAIN:Qc,MOMENT_PAL_GAIN:$c,MOMENT_RUN_GAIN:el,MOMENT_SEQ_GAIN:tl,MOMENT_LOW_ENTROPY_GAIN:nl,GENESIS_BIAS_GAIN:rl,YEAR_PULSES_APPROX:il,ADOPTION_TAU_PULSES:al,ADOPTION_GAIN_BASE:ol,ADOPTION_GAIN_RARE:sl,INDEX_SCARCITY_GAIN:cl,FIB_STEP_GAIN:ll,LUCAS_STEP_GAIN:ul,BREATH_WAVE_GAIN:dl,DAY_WAVE_GAIN:fl,STROBE_WAVE_GAIN:pl,MOMENT_AFFINITY_GAIN_BASE:ml,MOMENT_AFFINITY_DIGIT_WEIGHT:hl,DEFAULT_STEPS_PER_BEAT:wc,PULSES_PER_STEP:Tc,PULSES_PER_BEAT_CANON:Ec,PULSES_PER_DAY_EXACT:Dc,PHI:G};function _l(e){if(e===null)return`null`;switch(typeof e){case`string`:case`number`:case`boolean`:return JSON.stringify(e);case`object`:{if(Array.isArray(e))return`[`+e.map(_l).join(`,`)+`]`;let t=e;return`{`+Object.keys(t).sort().map(e=>JSON.stringify(e)+`:`+_l(t[e])).join(`,`)+`}`}default:return`null`}}function vl(e){return _l(e)}function yl(){let e=`val-policy:`+vl(gl),t=2166136261;for(let n=0;n>>0;return(`00000000`+(t>>>0).toString(16)).slice(-8)}var bl=yl(),xl=(e,t,n)=>Math.max(t,Math.min(n,e)),Sl=e=>Math.log(1+Math.max(0,e)),Cl=e=>e-Math.floor(e);function wl(e){if(!e.length)return 0;let t=e.slice().sort((e,t)=>e-t),n=Math.floor(t.length/2);return t.length%2?t[n]:(t[n-1]+t[n])/2}function Tl(e){let t=new Set;for(let n of e)n.receiverSignature&&t.add(n.receiverSignature);return Math.max(t.size,1)}function El(e){return e.filter(e=>e.receiverSignature&&e.receiverKaiPulse!=null)}function Dl(e){if(e.length<2)return[];let t=[];for(let n=1;n=r&&t.push(i-r)}return t}function Ol(e){if(e.length===0)return 1;let t=wl(e)||1,n=0;for(let r of e)n+=Math.abs(r-t)/t;return 1/(1+n/e.length)}function kl(e,t){let n=e?.expectedCashflowPhi?.map(e=>({atPulse:e.atPulse,amount:e.amountPhi}))??[],r=e?.expectedCashflowKS?.map(e=>({atPulse:e.atPulse,amount:e.amountKS}))??[];return[...n,...r].reduce((e,n)=>{let r=n.atPulse-t,i=1/(1+Math.max(0,r)/Gc);return e+n.amount*i},0)}function Al(e){if(!e||!Number.isFinite(e)||e<=0)return .5;let t=Math.log(e)/Math.log(G);return .5+.5*xl(1-2*Math.abs(t-Math.round(t)),0,1)}function jl(e){if(typeof e!=`number`||!Number.isFinite(e)||e<2)return!1;let t=Math.floor(e);if(t%2==0)return t===2;for(let e=3;e*e<=t;e+=2)if(t%e===0)return!1;return!0}function Ml(e,t,n){let r=1;if(typeof e.stepIndex==`number`&&(e.stepIndex===0||e.stepIndex===(t>0?t-1:-1))&&(r*=1+Kc),jl(e.beat)&&(r*=1+Jc),n>.9){let e=(n-.9)/.1;r*=1+qc*xl(e,0,1)}return r}function Nl(e){if(e<0n)throw Error(`sqrt of negative`);if(e<2n)return e;let t=e,n=(e>>1n)+1n;for(;n>1n;return t}function Pl(e){if(e<0n)return!1;let t=Nl(e);return t*t===e}var Fl=new Map;function Il(e){if(!Number.isFinite(e)||e<0)return!1;let t=Math.trunc(Math.abs(e)),n=Fl.get(t);if(n!==void 0)return n;let r=BigInt(t),i=5n*r*r+4n,a=5n*r*r-4n,o=Pl(i)||Pl(a);return Fl.set(t,o),o}var Ll=new Map;function Rl(e){if(!Number.isFinite(e)||e<0)return!1;let t=Math.trunc(Math.abs(e)),n=Ll.get(t);if(n!==void 0)return n;let r=BigInt(t),i=2n,a=1n;for(;at&&(t=n)):n=1;return t}function Ul(e){if(e.length===0)return{len:0,digit:``};let t=1,n=1,r=e[0],i=e[0];for(let a=1;at&&(t=n,r=i)):(n=1,i=e[a]);return{len:t,digit:r}}function Wl(e){if(e.length<=1)return 1;let t=1,n=1,r=0;for(let i=1;it&&(t=n)}return t}function Gl(e){if(e.length===0)return 1;let t=Array(10).fill(0);for(let n of e)t[n.charCodeAt(0)-48]++;let n=0;for(let r of t)if(r){let t=r/e.length;n-=t*Math.log(t)}let r=Math.log(Math.min(10,e.length));return xl(n/(r||1),0,1)}function Kl(e){return!Number.isFinite(e)||e<0?1:1+rl*(1-2*(e/(e+il)))}var ql=new Map;function Jl(e){if(!Number.isFinite(e)||e<1)return null;let t=Math.trunc(e),n=ql.get(t);if(n!==void 0)return n;let r=t,i=Math.log(r)/Math.log(G),a=Math.max(1,Math.floor(i)-2),o=null;for(let e=a;e<=a+6;e++)if(Math.ceil(G**+e)===r){o=e;break}return ql.set(t,o),o}function Yl(e){if(!Number.isFinite(e)||e<0)return 1;let t=zl(e),n=t.length,r=1;Il(e)&&(r*=1+Yc),Rl(e)&&(r*=1+Xc),Jl(e)!==null&&(r*=1+Zc),Bl(t)&&(r*=1+Qc),Vl(t)&&(r*=1+$c);let i=Hl(t);if(i>=3){let e=xl((i-2)/Math.max(3,n-2),0,1);r*=1+el*e}let a=Wl(t);if(a>=4){let e=xl((a-3)/Math.max(4,n-3),0,1);r*=1+tl*e}let o=Gl(t);return r*=1+nl*(1-o),r}function Xl(e){if(!Number.isFinite(e)||e<0)return 0;let t=zl(e),n=t.length,r=0,i=0,a=Il(e)?1:0;r+=1*a,i+=1;let o=Rl(e)?1:0;r+=1/G*o,i+=1/G;let s=Bl(t)?1:0;r+=1/G*s,i+=1/G;let c=Vl(t)?1:0;r+=1/G**2*c,i+=1/G**2;let l=xl((Hl(t)-2)/Math.max(3,n-2),0,1);r+=1/G**2*l,i+=1/G**2;let u=xl((Wl(t)-3)/Math.max(4,n-3),0,1);r+=1/G**3*u,i+=1/G**3;let d=Gl(t);return r+=1/G**3*(1-d),i+=1/G**3,i<=0?0:xl(r/i,0,1)}function Zl(e){if(!e.length)return 1;let t=0;for(let n of e)t+=Math.log(Math.max(n,1e-12));return Math.exp(t/e.length)}function Ql(e,t,n){if(!Number.isFinite(e)||!Number.isFinite(t)||n<=0)return .5;let r=((e-t)%n+n)%n,i=2*Math.PI*r/n;return .5*(1+Math.cos(i))}function $l(e,t){return!Number.isFinite(e)||t<=0?0:Math.floor(Math.floor(Math.max(0,e))/Tc)%t}function eu(e){return Number.isFinite(e)?Math.floor(Math.max(0,e))%Tc:0}function tu(e){return!Number.isFinite(e)||e<=0?0:Cl(Math.log(e)/Math.log(G))}function nu(e,t){if(e.size===0&&t.size===0)return 0;let n=new Set([...e,...t]),r=0;for(let n of e)t.has(n)&&r++;return r/n.size}function ru(e){let t=new Set;Il(e)&&t.add(`fib`),Rl(e)&&t.add(`lucas`);let n=zl(e);return Bl(n)&&t.add(`uniform`),Vl(n)&&t.add(`pal`),Hl(n)>=4&&t.add(`longrun`),Wl(n)>=5&&t.add(`longseq`),t}function iu(e){return!Number.isFinite(e)||e<=0?0:1-G**+(-e/al)}function au(e){if(!Number.isFinite(e)||e<=0)return 0;let t=1n,n=1n,r=0,i=BigInt(Math.trunc(e));for(;n<=i;){r++;let e=t+n;t=n,n=e}return r}function ou(e){if(!Number.isFinite(e)||e<=0)return 0;let t=2n,n=1n,r=0,i=BigInt(Math.trunc(e));for(;n<=i;){r++;let e=t+n;t=n,n=e}return r}function su(e,t){let n=Cl((e+t)*G);return{phase01:n,wave:1+pl*(2*n-1)}}function cu(e){return Number.isFinite(e)&&e>0?Math.trunc(e):wc}function lu(e,t){return typeof e.kaiPulse==`number`?e.kaiPulse:typeof e.pulse==`number`?e.pulse:t}function uu(e,t,n){return typeof e.stepIndex==`number`&&Number.isFinite(e.stepIndex)?xl(Math.trunc(e.stepIndex),0,t-1):$l(n,t)}function du(e,t,n){return typeof e.beat==`number`&&Number.isFinite(e.beat)?Math.trunc(e.beat):Math.floor(n/t)}function fu(e){return Object.freeze(e.inputs),Object.freeze(e.headRef),Object.freeze(e)}var pu=new Map;function mu(e,t){let n=cu(e.stepsPerBeat),r=n*Tc,i=lu(e,t),a=e.transfers??[],o=El(a),s=Math.max(1,(t-i)/r),c=a.length/s,l=Tl(a),u=a.length===0?1:o.length/a.length,d=Ol(Dl(a)),f=wl(o.map(e=>(e.receiverKaiPulse-e.senderKaiPulse)/r).filter(e=>e>=0)),p=Al(e.frequencyHz),m=uu(e,n,i),h=du(e,r,i),g=Ml({...e,stepIndex:m,beat:h},n,p),_=Math.max(0,t-i),v=kl(e.ip,t),y=e.seriesSize??1,b=y<=1?Oc:y**+-kc,x=e.quality??`med`,S=Ac[x],C=(e.creatorVerified?1+jc:1)+(e.creatorRep??0)*Mc,w=1+Nc*Sl(l-1),T=1+zc*xl((u-Ic)*Rc,-1,1),E=1+Bc*(2*d-1),D=xl(1+Pc*Sl(f),1,Fc),O=1+Wc*(2*p-1),k=_/r,A=Math.min(Uc,1+Hc*Sl(k)),j=1/(1+Vc*Math.max(0,c)),M=Yl(i),N=Zl(o.map(e=>Number.isFinite(e.receiverKaiPulse)?Yl(e.receiverKaiPulse):1)),P=Kl(i),F=M*Math.max(1,N)*P,I=b*S*C*w*T*E*D*O*A*j*g*F,L=iu(i),R=iu(t),z=Math.max(0,R-L),B=Xl(i),V=ol+sl*B,H=Math.exp(V*z),U=1+cl*(1-L),ee=au(_),te=ou(_),ne=Math.exp(ll*ee),re=Math.exp(ul*te),ie=U*H*ne*re,ae=1*M*U*H*ne*re*Math.max(1,P),oe=r>0?t%r/r:0,se=1+dl*(.5+.5*d)*Math.sin(2*Math.PI*oe),ce=Cl(t/Dc),le=Cl(i/Dc),ue=1-Math.abs((ce-le+1)%1-.5)*2,de=1+fl*(.5+.5*p)*(.5+.5*d)*(2*ue-1),{phase01:fe,wave:pe}=su(i,t),me=m,he=Ql($l(t,n),me,n),ge=eu(i),_e=Ql(eu(t),ge,Tc),ve=1-Math.abs((tu(t+1)-tu(i+1)+1)%1-.5)*2,ye=B,be=Xl(t),xe=1-Math.abs(ye-be),Se=hl*nu(ru(i),ru(t))+(1-hl)*xe,Ce=.3*he+.3*_e+.2*ve+.2*Se,we=ml*(.5+.5*ye)*(.5+.5*p),Te=1+we*(2*Ce-1),Ee=se*de*pe*Te,De=I*ie,Oe=Math.max(0,De-ae),ke=ae+Oe*Ee,Ae=1*ke+v,je={headHash:void 0,transfersWindowRoot:e.transfersWindowRoot,cumulativeTransfers:e.cumulativeTransfers??a.length},Me={size:y,quality:x,creatorVerified:!!e.creatorVerified,creatorRep:e.creatorRep??0,uniqueHolders:l,closedFraction:u,cadenceRegularity:d,medianHoldBeats:f,velocityPerBeat:c,resonancePhi:p,pulsesPerBeat:r,agePulses:_,geometryLift:g,momentLift:F,pv_phi:v,algorithmVersion:`phi/kosmos-vφ-5`,adoptionAtClaim:L,adoptionNow:R,adoptionDelta:z,rarityScore01:B,fibAccrualLevels:ee,lucasAccrualLevels:te,indexScarcity:U,adoptionLift:H,fibAccrualLift:ne,lucasAccrualLift:re,breathPhase01:oe,breathWave:se,dayPhase01:ce,dayWave:de,strobePhase01:fe,strobeWave:pe,momentAffinitySim01:Ce,momentAffinityAmp:we,momentAffinityOsc:Te,combinedOsc:Ee,dynamicGrowth:ie,rarityFloor:ae,premiumBandBase:Oe},Ne=bl,Pe={version:1,unit:`Φ`,algorithm:`phi/kosmos-vφ-5`,policyId:e.valuationPolicyId,policyChecksum:Ne,valuePhi:Ae,premium:ke,inputs:Me,computedAtPulse:t,headRef:je},Fe=vl({algorithm:Pe.algorithm,policy:Pe.policyId??null,policyChecksum:Pe.policyChecksum,inputs:Pe.inputs,minimalHead:{headHash:Pe.headRef.headHash??null,transfersWindowRoot:Pe.headRef.transfersWindowRoot??null,cumulativeTransfers:Pe.headRef.cumulativeTransfers}}),Ie=pu.get(Fe);if(Ie)return{unsigned:Ie,stampPayload:Fe};let Le=fu({...Pe,inputs:{...Pe.inputs},headRef:{...Pe.headRef}});return pu.set(Fe,Le),{unsigned:Le,stampPayload:Fe}}async function hu(e,t,n,r){let{unsigned:i,stampPayload:a}=mu(e,t),o={...i,headRef:{...i.headRef,headHash:r}},s=await n(a);return{seal:{...o,stamp:s}}}function gu(e,t){return{...e,valuation:t}}function _u(e){let t=e.inputs;return[`Algorithm: ${e.algorithm} • Policy checksum: ${e.policyChecksum}`,`Series rarity: size=${t.size} → rarityFactor≈${t.size<=1?Oc:t.size**+-kc}`,`Moment lifts: geometry=${t.geometryLift} × numericMoment=${t.momentLift} × genesis/baseline floor=${t.rarityFloor}`,`Adoption field: ΔA=${t.adoptionDelta} → adoptionLift=${t.adoptionLift} • indexScarcity=${t.indexScarcity} • fibLevels=${t.fibAccrualLevels} • lucasLevels=${t.lucasAccrualLevels}`,`Live alignment: breath=${t.breathWave} • day=${t.dayWave} • strobe=${t.strobeWave} • affinity=${t.momentAffinityOsc} → combined=${t.combinedOsc}`,`Premium: floor=${t.rarityFloor} + band=${t.premiumBandBase} × combined=${t.combinedOsc} ⇒ premium=${e.premium} → valueΦ=${e.valuePhi}`].join(` `)}function vu(e){return Xl(e)}function yu(e){let t=[],n=zl(e),r=n.length;Il(e)&&t.push(`✓ Fibonacci exact (+${Yc*100}%)`),Rl(e)&&t.push(`✓ Lucas exact (+${Xc*100}%)`),Jl(e)!==null&&t.push(`✓ φ-spiral transition (+${Zc*100}%)`),Bl(n)&&t.push(`✓ Uniform digits (${n[0].repeat(Math.max(1,r))}) (+${Qc*100}%)`),Vl(n)&&t.push(`✓ Palindrome (+${$c*100}%)`);let{len:i,digit:a}=Ul(n);if(i>=3){let e=xl((i-2)/Math.max(3,r-2),0,1);t.push(`✓ Long digit run (${i}×${a}) (+${el*e*100}%)`)}let o=Wl(n);if(o>=4){let e=xl((o-3)/Math.max(4,r-3),0,1);t.push(`✓ Consecutive sequence (len ${o}) (+${tl*e*100}%)`)}let s=Gl(n);return s<1&&t.push(`✓ Low entropy (digit uniformity) (+${nl*(1-s)*100}%)`),t.length===0&&t.push(`• Clean moment (no special digit motifs)`),t}function bu(e,t,n){let r=cu(n?.stepsPerBeat),i=r*Tc,a=typeof n?.cadenceRegularity==`number`?xl(n.cadenceRegularity,0,1):1,o=typeof n?.resonancePhi==`number`?xl(n.resonancePhi,0,1):.5,s=i>0?t%i/i:0,c=1+dl*(.5+.5*a)*Math.sin(2*Math.PI*s),l=Cl(t/Dc),u=Cl(e/Dc),d=1-Math.abs((l-u+1)%1-.5)*2,f=1+fl*(.5+.5*o)*(.5+.5*a)*(2*d-1),p=typeof n?.stepIndexClaimOverride==`number`?xl(Math.trunc(n.stepIndexClaimOverride),0,r-1):$l(e,r),m=Ql($l(t,r),p,r),h=eu(e),g=Ql(eu(t),h,Tc),_=1-Math.abs((tu(t+1)-tu(e+1)+1)%1-.5)*2,v=Xl(e),y=Xl(t),b=1-Math.abs(v-y),x=nu(ru(e),ru(t)),{phase01:S,wave:C}=su(e,t),w=hl*x+(1-hl)*b,T=.3*m+.3*g+.2*_+.2*w,E=ml*(.5+.5*v)*(.5+.5*o),D=1+E*(2*T-1);return{breathWave:c,dayWave:f,strobeWave:C,momentAffinity:D,combinedOsc:c*f*C*D,breathPhase01:s,dayPhase01:l,strobePhase01:S,momentAffinitySim01:T,momentAffinityAmp:E}}function xu(e,t){let n=cu(t?.stepsPerBeat)*Tc,r=El(e),i=[];return r.forEach((e,t)=>{let r=t+1,a=(e.receiverKaiPulse-e.senderKaiPulse)/n,o=[];Il(e.receiverKaiPulse)&&o.push(`Fibonacci pulse`),Rl(e.receiverKaiPulse)&&o.push(`Lucas pulse`);let s=zl(e.receiverKaiPulse);Bl(s)&&o.push(`uniform digits`),Vl(s)&&o.push(`palindrome`);let c=Hl(s);if(c>=4){let{digit:e}=Ul(s);o.push(`long run (${c}×${e})`)}let l=``;l=a<5?`quick flip → churn penalty`:a<20?`held ${a} beats`:`held ${a} beats (strong stewardship)`;let u=o.length?` + ${o.join(` • `)}`:``;i.push(`Transfer ${r}: ${l}${u}`)}),i.length||i.push(`No closed transfers yet — lineage still forming.`),i}function Su(e,t){let n=nu(ru(e),ru(t)),r=Xl(e),i=Xl(t),a=1-Math.abs(r-i);return hl*n+(1-hl)*a}function Cu(e,t){let n=t?.title??`Kai-Sigil Valuation Scroll`,r=[`# ${n}`,``,"```",_u(e),"```",``,`### Rarity Evidence`,...yu(e.computedAtPulse).map(e=>`- `+e)].join(` `),i=t?.width??800,a=t?.padding??24,o=_u(e).split(` `),s=o.map((e,t)=>`${wu(e)}`).join(``),c=`${wu(n)} · φ`,l=a+80+o.length*20+a;return{seal:e,scrollText:r,scrollSVG:` @@ -55,7 +55,7 @@ Please change the parent to ${r} `}function Fu(e){return e.replace(/&/g,`&`).replace(//g,`>`).replace(/"/g,`"`)}var Iu=(1+Math.sqrt(5))/2,Lu=17491.270421,Ru=11,zu=(e,t,n)=>Math.max(t,Math.min(n,e)),Bu=(e,t=9)=>Math.round(e*10**t)/10**t;function Vu(e,t){let n=Math.trunc(Math.max(0,e));return Math.floor(n/Ru)%Math.max(1,t)}function Hu(e){return Math.trunc(Math.max(0,e))%Ru}function Uu(e,t,n){let r=((e-t)%n+n)%n;return .5*(1+Math.cos(2*Math.PI*r/n))}const Wu={basePhiPerUsd:.1,adoptionLambda:1/Iu,premiumGamma:1/Iu**2,momentBoostMax:1/Iu**2,sizeScaleUsd:100,sizeMu:1/Iu**3,sizeCap:1+1/Iu**2,whaleTaper:{k:1/Iu**4},streakMaxBoost:1/Iu**3,lifetimeTiers:[{thresholdUsd:200,boost:.05},{thresholdUsd:1e3,boost:.1},{thresholdUsd:3e3,boost:.16}],holdBonus:{eta:1/Iu**2,rho:1/Iu**3,capMultiple:1/Iu},choir:{windowPulses:242,maxBoost:1/Iu**3,wStep:.6,wBreath:.4},breath:{maxBoost:1/Iu**4},festival:{mode:`beatEvery`,interval:13,widthBeats:1,bonus:1/Iu**4},milestones:{adoption:[{atAdoption:.1,multiplier:.95},{atAdoption:.25,multiplier:.9},{atAdoption:.5,multiplier:1/Iu},{atAdoption:.75,multiplier:1/Iu**1.25}],phiTransition:[{atN:18,multiplier:.92},{atN:21,multiplier:.88},{atN:25,multiplier:.82}],combine:`min`,interpolation:`step`},vow:{earlyUnlockPenalty:.5,stewardEpochBeats:55,stewardSpreadBeats:21}};function Gu(e,t){let n=1;for(let r of t)e>=r.at&&(n=r.multiplier);return n}function Ku(e,t){if(!t.length)return 1;if(e<=t[0].at)return t[0].multiplier;for(let n=1;ne*t,1):1}function Ju(e,t,n,r){let i=[],a=null,o=e.milestones;if(!o)return{M_milestone:1,next:a};let s=o.interpolation??`step`;if(o.adoption?.length){let e=o.adoption.slice().sort((e,t)=>e.atAdoption-t.atAdoption).map(e=>({at:zu(e.atAdoption,0,1),multiplier:e.multiplier})),t=s===`linear`?Ku(n,e):Gu(n,e);i.push(t);let r=e.find(e=>e.at>n);r&&(a??={kind:`adoption`,at:r.at,multiplier:r.multiplier})}if(o.pulse?.length){let e=o.pulse.slice().sort((e,t)=>e.atPulse-t.atPulse).map(e=>({at:Math.max(0,Math.trunc(e.atPulse)),multiplier:e.multiplier})),n=s===`linear`?Ku(t,e):Gu(t,e);i.push(n);let r=e.find(e=>e.at>t);r&&!a&&(a={kind:`pulse`,at:r.at,multiplier:r.multiplier})}if(o.beat?.length){let e=Math.floor(t/r),n=o.beat.slice().sort((e,t)=>e.atBeat-t.atBeat).map(e=>({at:Math.max(0,Math.trunc(e.atBeat)),multiplier:e.multiplier})),c=s===`linear`?Ku(e,n):Gu(e,n);i.push(c);let l=n.find(t=>t.at>e);l&&!a&&(a={kind:`beat`,at:l.at,multiplier:l.multiplier})}if(o.phiTransition?.length){let e=Math.floor(Math.log(Math.max(1,t))/Math.log(Iu)),n=o.phiTransition.slice().sort((e,t)=>e.atN-t.atN).map(e=>({at:Math.max(1,Math.trunc(e.atN)),multiplier:e.multiplier})),r=s===`linear`?Ku(e,n):Gu(e,n);i.push(r);let c=n.find(t=>t.at>e);c&&!a&&(a={kind:`phiTransition`,at:c.at,multiplier:c.multiplier})}return{M_milestone:Bu(qu(i,o.combine??`min`)),next:a}}function Yu(e,t,n,r){if(!r||!n?.length)return 1;let i=Math.max(1,r.windowPulses),a=e-i,o=e+i,s=n.filter(e=>e.pulse>=a&&e.pulse<=o);if(!s.length)return 1;let c=Vu(e,t),l=Hu(e),u=0;for(let e of s){let n=Vu(e.pulse,t),i=Hu(e.pulse),a=Uu(c,n,t),o=Uu(l,i,Ru),s=(r.wStep??.5)*a+(r.wBreath??.5)*o;u+=s}let d=u/s.length;return Bu(1+(r.maxBoost??0)*(2*d-1))}function Xu(e,t,n){if(!n||t==null)return 1;let r=Hu(e)/Ru,i=1-Math.abs((t-r+1)%1-.5)*2;return Bu(1+(n.maxBoost??0)*(2*i-1))}function Zu(e,t,n){if(!n)return 1;let r=Math.floor(e/t);if(n.mode===`beatEvery`){let e=Math.max(1,Math.trunc(n.interval)),t=Math.max(0,Math.trunc(n.widthBeats));return Bu(r%e===0||Math.abs(r%e)<=t||Math.abs(r%e-e)<=t?1+(n.bonus||0):1)}let i=Math.floor(Math.log(Math.max(1,e))/Math.log(Iu)),a=Math.ceil(Iu**+i),o=i%Math.max(1,Math.trunc(n.interval))===0,s=Math.max(0,Math.trunc(n.widthBeats)),c=Math.floor(a/t),l=Math.abs(r-c)<=s;return Bu(o&&l?1+(n.bonus||0):1)}function Qu(e,t=Wu){let{unsigned:n}=mu(e.meta,e.nowPulse),{premium:r,inputs:i}=n,a=i.adoptionNow,o=i.rarityScore01,s=i.pulsesPerBeat,c=Math.max(0,e.usd||0),l=t.basePhiPerUsd,u=Bu(Math.exp(-t.adoptionLambda*a)),d=Bu((1/Math.max(r,1e-9))**t.premiumGamma),f=Bu(1+t.momentBoostMax*o),p=1+t.sizeMu*Math.log1p(c/Math.max(t.sizeScaleUsd,1)),m=Math.min(p,t.sizeCap),h=t.whaleTaper?1/Math.sqrt(1+t.whaleTaper.k*c):1,g=Bu(m*h),_=Math.max(0,e.currentStreakDays||0),v=Bu(1+t.streakMaxBoost*(1-Iu**+-_)),y=Math.max(0,(e.lifetimeUsdSoFar||0)+c),b=Bu(1+(t.lifetimeTiers||[]).reduce((e,t)=>y>=t.thresholdUsd?Math.max(e,t.boost):e,0)),x=Bu(Yu(e.nowPulse,s/Ru,e.choirNearby??[],t.choir)),S=Bu(Xu(e.nowPulse,e.breathPhase01,t.breath)),C=Bu(Zu(e.nowPulse,s,t.festival)),{M_milestone:w,next:T}=Ju(t,e.nowPulse,a,s),E=Bu(u*d*f*g*v*b*x*S*C*w),D=Bu(l*E),O=Bu(c*D),k=null,A=0,j=0;if(t.holdBonus&&(e.plannedHoldBeats||0)>0){let n=Math.max(0,e.plannedHoldBeats),r=e.nowPulse+n*s;k=Math.trunc(r);let i=O*t.holdBonus.eta*(1-Math.exp(-t.holdBonus.rho*n));A=Math.min(i,O*t.holdBonus.capMultiple);let a=1/(1+Math.max(0,k-e.nowPulse)/Lu);j=Bu(A*a)}let M=Bu(1*r+i.pv_phi),N=Bu(M+O+j),P=t.vow&&k?{earlyUnlockPenalty:t.vow.earlyUnlockPenalty,stewardEpochBeats:t.vow.stewardEpochBeats,stewardSpreadBeats:t.vow.stewardSpreadBeats}:null;return{phiPerUsd:D,usdPerPhi:D>0?Bu(1/D):1/0,addPhiNow:O,issuanceMultiplier:E,multipliers:{M_adoption:u,M_premium:d,M_moment:f,sizeMultiplier:g,M_streak:v,M_tier:b,M_choir:x,M_breath:S,M_festival:C,M_milestone:w,M_taper:h},hold:k?{vestAtPulse:k,bonusPhiAtVest:Bu(A),bonusNowPV:j}:null,vow:P,premium:r,rarityFloor:i.rarityFloor,adoption:a,rarityScore:o,pulsesPerBeat:s,nextMilestone:T,valuePhiBefore:M,valuePhiAfterPV:N,ipEntries:[{atPulse:e.nowPulse,amountPhi:O},...k?[{atPulse:k,amountPhi:Bu(A)}]:[]]}}var $u=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),ed=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),td=e=>{let t=ed(e);return t.charAt(0).toUpperCase()+t.slice(1)},nd=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),rd=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0},id={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ad=(0,C.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,C.createElement)(`svg`,{ref:c,...id,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:nd(`lucide`,i),...!a&&!rd(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,C.createElement)(e,t)),...Array.isArray(a)?a:[a]])),od=(e,t)=>{let n=(0,C.forwardRef)(({className:n,...r},i)=>(0,C.createElement)(ad,{ref:i,iconNode:t,className:nd(`lucide-${$u(td(e))}`,`lucide-${e}`,n),...r}));return n.displayName=td(e),n},sd=od(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),cd=od(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),ld=od(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),ud=od(`gem`,[[`path`,{d:`M10.5 3 8 9l4 13 4-13-2.5-6`,key:`b3dvk1`}],[`path`,{d:`M17 3a2 2 0 0 1 1.6.8l3 4a2 2 0 0 1 .013 2.382l-7.99 10.986a2 2 0 0 1-3.247 0l-7.99-10.986A2 2 0 0 1 2.4 7.8l2.998-3.997A2 2 0 0 1 7 3z`,key:`7w4byz`}],[`path`,{d:`M2 9h20`,key:`16fsjt`}]]),dd=od(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),fd=od(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),pd=od(`send-horizontal`,[[`path`,{d:`M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z`,key:`117uat`}],[`path`,{d:`M6 12h16`,key:`s4cdu5`}]]),md=od(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),hd=od(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),gd=od(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),_d=od(`wind`,[[`path`,{d:`M12.8 19.6A2 2 0 1 0 14 16H2`,key:`148xed`}],[`path`,{d:`M17.5 8a2.5 2.5 0 1 1 2 4H2`,key:`1u4tom`}],[`path`,{d:`M9.8 4.4A2 2 0 1 1 11 8H2`,key:`75valh`}]]);function vd(e){let t=new Uint8Array(e.byteLength);return t.set(e),t.buffer}var yd=e=>Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``);async function bd(e){let t=typeof e==`string`?new TextEncoder().encode(e):e,n=await crypto.subtle.digest(`SHA-256`,vd(t));return yd(new Uint8Array(n))}async function xd(e){let{pulse:t,beat:n,stepIndex:r,chakraDay:i}=e;return typeof t!=`number`||typeof n!=`number`||typeof r!=`number`||typeof i!=`string`?null:bd(`${t}|${n}|${r}|${i}|${typeof e.intentionSigil==`string`?e.intentionSigil:``}`)}function Sd(e,t){let n=e.match(RegExp(`${t}="([^"]+)"`,`i`));return n?n[1]:void 0}function Cd(e,t){let n=Sd(e,t);if(!n)return;let r=Number(n);return Number.isFinite(r)?r:void 0}function wd(e){try{let t=new DOMParser().parseFromString(e,`image/svg+xml`).querySelector(`metadata`);return t?t.textContent??null:null}catch{return null}}function Td(e){let t={},n=wd(e);if(n)try{t={...JSON.parse(n)}}catch{}if(t.pulse??=Cd(e,`data-pulse`),t.beat??=Cd(e,`data-beat`),t.stepIndex??=Cd(e,`data-step-index`),t.frequencyHz==null){let n=Sd(e,`data-frequency-hz`);n&&(t.frequencyHz=Number(n))}if(t.chakraGate??=Sd(e,`data-chakra-gate`),!t.chakraDay){let n=Sd(e,`data-harmonic-day`)||Sd(e,`data-chakra-day`);n&&(t.chakraDay=n)}t.kaiSignature??=Sd(e,`data-kai-signature`),t.userPhiKey??=Sd(e,`data-phi-key`);let r=Sd(e,`data-intention-sigil`);return r&&typeof t.intentionSigil!=`string`&&(t.intentionSigil=r),t}async function Ed(e,t){let n=t?Sd(t,`data-payload-hash`):void 0;return n?n.toLowerCase():typeof e.canonicalHash==`string`&&e.canonicalHash.length>=32?e.canonicalHash.toLowerCase():(await bd(`${e.pulse??0}|${e.beat??0}|${e.stepIndex??0}|${e.chakraDay??``}`)).toLowerCase()}async function Dd(e){try{if(!new DOMParser().parseFromString(e,`image/svg+xml`).querySelector(`svg`))return{ok:!1,reason:`Unrecognized SVG content.`}}catch{return{ok:!1,reason:`Unrecognized SVG content.`}}let t=Td(e),n=!t[`@context`]||t[`@context`]===`https://schema.phi.network/sigil/v1`,r=!t.type||t.type===`application/phi.kairos.sigil+svg`;if(!n||!r)return{ok:!1,reason:`Invalid sigil context/type.`};if(!(typeof t.pulse==`number`&&typeof t.beat==`number`&&typeof t.stepIndex==`number`&&typeof t.chakraDay==`string`))return{ok:!1,reason:`Missing core fields (pulse/beat/stepIndex/chakraDay).`};let i=await xd(t),a=!1;if(i&&t.kaiSignature&&(a=i.toLowerCase()!==t.kaiSignature.toLowerCase()),a){let n=Cd(e,`data-step-index-canonical`),r=Sd(e,`data-kai-signature`);if(typeof n==`number`&&r){let e=await xd({...t,stepIndex:n,kaiSignature:r});e&&e.toLowerCase()===r.toLowerCase()&&(t.stepIndex=n,t.kaiSignature=r,a=!1)}}if(a)return{ok:!1,reason:`Content signature mismatch (Σ).`};t.segmentSize??=2e3,typeof t.cumulativeTransfers!=`number`&&(t.cumulativeTransfers=(t.segments??[]).reduce((e,t)=>e+(t.count||0),0)+(t.transfers?.length??0));let o=await Ed(t,e);return{ok:!0,unsigned:!t.kaiSignature,meta:t,canonical:o}}function Od(e){let t=e.credits;if(!Array.isArray(t))return;let n=t.map(e=>{if(e&&typeof e==`object`){let t=e.atPulse,n=e.amountPhi,r=e.source;if(typeof t==`number`&&typeof n==`number`)return{atPulse:t,amountPhi:n,source:typeof r==`string`?r:void 0}}return null}).filter(e=>e!==null);return n.length?n:void 0}function kd(e,t){if(!t)return e;let n=[...Od(e)??[],t];return{...e,credits:n}}var Ad=e=>Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``);async function jd(e){let t;t=typeof e==`string`?new TextEncoder().encode(e).buffer:e instanceof Uint8Array?e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.slice().buffer:e;let n=await crypto.subtle.digest(`SHA-256`,t);return Ad(new Uint8Array(n))}function Md({open:e,onClose:t,onImport:n,onCreditPhi:r}){let i=(0,C.useRef)(null),a=(0,C.useRef)(null),[o,s]=(0,C.useState)(null),[c,l]=(0,C.useState)(null),[u,d]=(0,C.useState)(null),[f,p]=(0,C.useState)(!1),[m,h]=(0,C.useState)(null),[g,_]=(0,C.useState)(0),[v,y]=(0,C.useState)(null),b=(0,C.useCallback)(()=>i.current?.click(),[]);(0,C.useEffect)(()=>{if(!e)return;let t=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=t}},[e]),(0,C.useEffect)(()=>{e||(l(null),s(null),d(null),p(!1),h(null),_(0),y(null))},[e]),(0,C.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&t(),(e.key===` `||e.key===`Enter`)&&document.activeElement?.dataset?.upload===`true`&&(e.preventDefault(),b())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,b]);let x=(0,C.useCallback)(async e=>{if(!e.name.toLowerCase().endsWith(`.svg`)){s(`Please select a Kairos Sigil .svg file.`),d(`err`);return}s(null),d(`checking`),l(null),h(null),p(!1),_(0),y(e.name);try{let t=await e.text();if(!new DOMParser().parseFromString(t,`image/svg+xml`).querySelector(`svg`))throw Error(`Unrecognized SVG content.`);let n=await Dd(t);if(!n?.ok){d(`err`),s(n?.reason||`Failed verification.`);return}let r=n.meta||{},i=n.canonical,{unsigned:a}=mu(r,r.exportedAtPulse??r.kaiPulse??r.pulse??0),o=a.valuePhi,c=r.pulse??0;l({hash:i,value:o,pulseCreated:c,meta:r}),p(!!n.unsigned),h({hash:i,value:o,pulse:c}),d(n.unsigned?`warn`:`ok`)}catch(e){console.error(`Glyph import error:`,e),d(`err`);let t=e?.message,n=typeof t==`string`?t:``;s(/signature mismatch|Σ/i.test(n)?`Content signature mismatch (Σ).`:`Invalid glyph file. Ensure it's an authentic Kairos Sigil SVG with .`)}finally{i.current&&(i.current.value=``)}},[]),S=(0,C.useCallback)(async e=>{if(e.preventDefault(),!e.dataTransfer.files?.length)return;let t=e.dataTransfer.files[0];await x(t)},[x]),w=(0,C.useCallback)(e=>{e.preventDefault()},[]),T=(0,C.useCallback)(async e=>{let t=e.target.files?.[0];t&&await x(t)},[x]),E=(0,C.useCallback)(async()=>{if(!c)return;let e=Math.max(0,c.value||0),i=Math.max(0,Math.min(Number.isFinite(g)?g:0,e));try{let e=c.meta||{},a=e.exportedAtPulse??e.kaiPulse??e.pulse??0,o=kd(e,i>0?{atPulse:a,amountPhi:Number(i.toFixed(6)),source:`import`}:null),{seal:s}=await hu(o,a,jd),l=gu(o,s),u={...c,value:s.valuePhi,meta:l};r&&i>0&&r(Number(i.toFixed(6))),n(u),t()}catch(e){console.error(`Finalize import error:`,e),d(`err`),s(`Failed to finalize valuation for this glyph.`)}},[c,g,r,n,t]),D=(0,C.useMemo)(()=>u===`checking`?`Validating…`:u===`ok`?`Verified`:u===`warn`?`Unsigned (permissible)`:u===`err`?`Invalid`:``,[u]);if(!e)return null;let O=m?.value??0,k=g<0?`Cannot credit a negative amount.`:g>O?`Exceeds available value.`:null;return(0,W.jsx)(`div`,{className:`glyph-import-backdrop`,onClick:e=>{e.target===e.currentTarget&&t()},"aria-hidden":!e,children:(0,W.jsxs)(`div`,{className:`glyph-import-modal`,ref:a,role:`dialog`,"aria-modal":`true`,"aria-label":`Import Kairos Sigil`,"aria-busy":u===`checking`,"data-status":u??``,children:[(0,W.jsx)(`button`,{className:`close-button`,onClick:t,"aria-label":`Close`,children:(0,W.jsx)(cd,{size:22})}),(0,W.jsxs)(`header`,{className:`modal-header`,children:[(0,W.jsx)(`h2`,{className:`modal-title`,children:`Import Kairos Sigil`}),(0,W.jsx)(`p`,{className:`modal-sub`,children:`breathe in the moment — measure in Φ`})]}),(0,W.jsxs)(`div`,{className:`upload-section`,onClick:b,role:`button`,tabIndex:0,"data-upload":`true`,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),b())},onDrop:S,onDragOver:w,children:[(0,W.jsx)(`div`,{className:`halo`,"aria-hidden":`true`}),(0,W.jsx)(ld,{size:48}),(0,W.jsx)(`p`,{className:`upload-title`,children:`Drop your Kairos Sigil .svg here`}),(0,W.jsx)(`p`,{className:`upload-sub`,children:`or tap to select`}),v&&(0,W.jsx)(`div`,{className:`file-name`,children:v}),(0,W.jsx)(`input`,{type:`file`,accept:`image/svg+xml,.svg`,ref:i,onChange:T,hidden:!0})]}),u&&(0,W.jsx)(`div`,{className:`import-status ${u}`,children:u===`err`?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(gd,{size:18}),(0,W.jsx)(`span`,{className:`label`,children:D})]}):(0,W.jsxs)(W.Fragment,{children:[u===`ok`&&(0,W.jsx)(sd,{size:18,className:`success-icon`}),u===`warn`&&(0,W.jsx)(gd,{size:18}),(0,W.jsx)(`span`,{className:`label`,children:D})]})}),m&&(0,W.jsxs)(`div`,{className:`import-preview`,children:[(0,W.jsxs)(`div`,{className:`kv`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Canonical Hash`}),(0,W.jsx)(`span`,{className:`v mono`,children:m.hash})]}),(0,W.jsxs)(`div`,{className:`kv`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Intrinsic Value`}),(0,W.jsxs)(`span`,{className:`v`,children:[m.value.toFixed(6),` Φ`]})]}),(0,W.jsxs)(`div`,{className:`kv`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Pulse`}),(0,W.jsxs)(`span`,{className:`v`,children:[m.pulse,f&&(0,W.jsx)(`span`,{className:`chip warn`,children:`unsigned`})]})]}),(0,W.jsxs)(`div`,{className:`phi-credit`,children:[(0,W.jsxs)(`label`,{htmlFor:`phi-credit-input`,children:[`Credit Φ to balance before import`,` `,(0,W.jsxs)(`em`,{children:[`(max `,O.toFixed(6),` Φ)`]})]}),(0,W.jsxs)(`div`,{className:`credit-row`,children:[(0,W.jsx)(`input`,{id:`phi-credit-input`,type:`number`,inputMode:`decimal`,min:0,step:1e-6,value:Number.isFinite(g)?g:0,onChange:e=>_(Number(e.target.value))}),(0,W.jsx)(`button`,{className:`chip quick`,onClick:()=>_(Number((O*.236).toFixed(6))),title:`φ^-3 (~23.6%)`,children:`23.6%`}),(0,W.jsx)(`button`,{className:`chip quick`,onClick:()=>_(Number((O*.382).toFixed(6))),title:`φ^-2 (~38.2%)`,children:`38.2%`}),(0,W.jsx)(`button`,{className:`chip quick`,onClick:()=>_(Number((O*.618).toFixed(6))),title:`1/φ (~61.8%)`,children:`61.8%`}),(0,W.jsx)(`button`,{className:`chip quick`,onClick:()=>_(Number(O.toFixed(6))),title:`All`,children:`Max`})]}),k&&(0,W.jsx)(`div`,{className:`helper error`,children:k}),!k&&g>0&&(0,W.jsxs)(`div`,{className:`helper`,children:[`Remaining intrinsic value after credit:`,` `,(O-g).toFixed(6),` Φ`]})]}),(0,W.jsx)(`button`,{className:`import-confirm`,onClick:E,disabled:!c||!!k,title:k??`Import glyph`,children:`Import Glyph`})]}),o&&(0,W.jsxs)(`div`,{className:`import-error`,role:`status`,"aria-live":`polite`,children:[(0,W.jsx)(gd,{size:20}),(0,W.jsx)(`p`,{children:o})]}),(0,W.jsxs)(`footer`,{className:`modal-footer`,children:[(0,W.jsx)(`span`,{className:`seal`,children:`Σ`}),(0,W.jsx)(`span`,{className:`foot`,children:`Authentic SVG only • deterministic valuation • one breath = 1 Φ`})]})]})})}function Nd(e){let t=2166136261;for(let n=0;n>>0).toString(16).padStart(8,`0`)}function Pd(e){let t=[`send`,`src=${e.sourceHash}`,`p=${e.pulse}`,`amt=${e.amount}`,`to=${e.recipientHash??``}`,`msg=${e.message??``}`].join(`|`);return`glyph::${e.pulse}::${Nd(t)}`}function Fd(e){return e}function Id(e,t,n,r,i){if(t<=0)throw Error(`Amount must be positive.`);if(e.value{(function(n){typeof e==`object`&&t!==void 0?t.exports=n():typeof define==`function`&&define.amd?define([],n):(typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:this).JSZip=n()})(function(){return function e(t,n,r){function i(o,s){if(!n[o]){if(!t[o]){var c=typeof p==`function`&&p;if(!s&&c)return c(o,!0);if(a)return a(o,!0);var l=Error(`Cannot find module '`+o+`'`);throw l.code=`MODULE_NOT_FOUND`,l}var u=n[o]={exports:{}};t[o][0].call(u.exports,function(e){var n=t[o][1][e];return i(n||e)},u,u.exports,e,t,n,r)}return n[o].exports}for(var a=typeof p==`function`&&p,o=0;o>2,s=(3&t)<<4|n>>4,c=1>6:64,l=2>4,n=(15&o)<<4|(s=a.indexOf(e.charAt(l++)))>>2,r=(3&s)<<6|(c=a.indexOf(e.charAt(l++))),f[u++]=t,s!==64&&(f[u++]=n),c!==64&&(f[u++]=r);return f}},{"./support":30,"./utils":32}],2:[function(e,t,n){var r=e(`./external`),i=e(`./stream/DataWorker`),a=e(`./stream/Crc32Probe`),o=e(`./stream/DataLengthProbe`);function s(e,t,n,r,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=r,this.compressedContent=i}s.prototype={getContentWorker:function(){var e=new i(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o(`data_length`)),t=this;return e.on(`end`,function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw Error(`Bug : uncompressed data size mismatch`)}),e},getCompressedWorker:function(){return new i(r.Promise.resolve(this.compressedContent)).withStreamInfo(`compressedSize`,this.compressedSize).withStreamInfo(`uncompressedSize`,this.uncompressedSize).withStreamInfo(`crc32`,this.crc32).withStreamInfo(`compression`,this.compression)}},s.createWorkerFrom=function(e,t,n){return e.pipe(new a).pipe(new o(`uncompressedSize`)).pipe(t.compressWorker(n)).pipe(new o(`compressedSize`)).withStreamInfo(`compression`,t)},t.exports=s},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,n){var r=e(`./stream/GenericWorker`);n.STORE={magic:`\0\0`,compressWorker:function(){return new r(`STORE compression`)},uncompressWorker:function(){return new r(`STORE decompression`)}},n.DEFLATE=e(`./flate`)},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,n){var r=e(`./utils`),i=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t){return e!==void 0&&e.length?r.getTypeOf(e)===`string`?function(e,t,n,r){var a=i,o=r+n;e^=-1;for(var s=r;s>>8^a[255&(e^t.charCodeAt(s))];return-1^e}(0|t,e,e.length,0):function(e,t,n,r){var a=i,o=r+n;e^=-1;for(var s=r;s>>8^a[255&(e^t[s])];return-1^e}(0|t,e,e.length,0):0}},{"./utils":32}],5:[function(e,t,n){n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(e,t,n){var r=null;r=typeof Promise<`u`?Promise:e(`lie`),t.exports={Promise:r}},{lie:37}],7:[function(e,t,n){var r=typeof Uint8Array<`u`&&typeof Uint16Array<`u`&&typeof Uint32Array<`u`,i=e(`pako`),a=e(`./utils`),o=e(`./stream/GenericWorker`),s=r?`uint8array`:`array`;function c(e,t){o.call(this,`FlateWorker/`+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}n.magic=`\b\0`,a.inherits(c,o),c.prototype.processChunk=function(e){this.meta=e.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(s,e.data),!1)},c.prototype.flush=function(){o.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},n.compressWorker=function(e){return new c(`Deflate`,e)},n.uncompressWorker=function(){return new c(`Inflate`,{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,n){function r(e,t){var n,r=``;for(n=0;n>>=8;return r}function i(e,t,n,i,o,u){var d,f,p=e.file,m=e.compression,h=u!==s.utf8encode,g=a.transformTo(`string`,u(p.name)),_=a.transformTo(`string`,s.utf8encode(p.name)),v=p.comment,y=a.transformTo(`string`,u(v)),b=a.transformTo(`string`,s.utf8encode(v)),x=_.length!==p.name.length,S=b.length!==v.length,C=``,w=``,T=``,E=p.dir,D=p.date,O={crc32:0,compressedSize:0,uncompressedSize:0};t&&!n||(O.crc32=e.crc32,O.compressedSize=e.compressedSize,O.uncompressedSize=e.uncompressedSize);var k=0;t&&(k|=8),h||!x&&!S||(k|=2048);var A=0,j=0;E&&(A|=16),o===`UNIX`?(j=798,A|=function(e,t){var n=e;return e||(n=t?16893:33204),(65535&n)<<16}(p.unixPermissions,E)):(j=20,A|=function(e){return 63&(e||0)}(p.dosPermissions)),d=D.getUTCHours(),d<<=6,d|=D.getUTCMinutes(),d<<=5,d|=D.getUTCSeconds()/2,f=D.getUTCFullYear()-1980,f<<=4,f|=D.getUTCMonth()+1,f<<=5,f|=D.getUTCDate(),x&&(w=r(1,1)+r(c(g),4)+_,C+=`up`+r(w.length,2)+w),S&&(T=r(1,1)+r(c(y),4)+b,C+=`uc`+r(T.length,2)+T);var M=``;return M+=` -\0`,M+=r(k,2),M+=m.magic,M+=r(d,2),M+=r(f,2),M+=r(O.crc32,4),M+=r(O.compressedSize,4),M+=r(O.uncompressedSize,4),M+=r(g.length,2),M+=r(C.length,2),{fileRecord:l.LOCAL_FILE_HEADER+M+g+C,dirRecord:l.CENTRAL_FILE_HEADER+r(j,2)+M+r(y.length,2)+`\0\0\0\0`+r(A,4)+r(i,4)+g+C+y}}var a=e(`../utils`),o=e(`../stream/GenericWorker`),s=e(`../utf8`),c=e(`../crc32`),l=e(`../signature`);function u(e,t,n,r){o.call(this,`ZipFileWorker`),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(u,o),u.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-r-1))/n:100}}))},u.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var n=i(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},u.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=i(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:function(e){return l.DATA_DESCRIPTOR+r(e.crc32,4)+r(e.compressedSize,4)+r(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},u.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return r.transformTo(`string`,this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,n){var r=e(`./Uint8ArrayReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,n){var r=e(`./DataReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,n){var r=e(`./ArrayReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.readData=function(e){if(this.checkOffset(e),e===0)return new Uint8Array;var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,n){var r=e(`../utils`),i=e(`../support`),a=e(`./ArrayReader`),o=e(`./StringReader`),s=e(`./NodeBufferReader`),c=e(`./Uint8ArrayReader`);t.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),t!==`string`||i.uint8array?t===`nodebuffer`?new s(e):i.uint8array?new c(r.transformTo(`uint8array`,e)):new a(r.transformTo(`array`,e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,n){n.LOCAL_FILE_HEADER=`PK`,n.CENTRAL_FILE_HEADER=`PK`,n.CENTRAL_DIRECTORY_END=`PK`,n.ZIP64_CENTRAL_DIRECTORY_LOCATOR=`PK\x07`,n.ZIP64_CENTRAL_DIRECTORY_END=`PK`,n.DATA_DESCRIPTOR=`PK\x07\b`},{}],24:[function(e,t,n){var r=e(`./GenericWorker`),i=e(`../utils`);function a(e){r.call(this,`ConvertWorker to `+e),this.destType=e}i.inherits(a,r),a.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,n){var r=e(`./GenericWorker`),i=e(`../crc32`);function a(){r.call(this,`Crc32Probe`),this.withStreamInfo(`crc32`,0)}e(`../utils`).inherits(a,r),a.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,n){var r=e(`../utils`),i=e(`./GenericWorker`);function a(e){i.call(this,`DataLengthProbe for `+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(a,i),a.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,n){var r=e(`../utils`),i=e(`./GenericWorker`);function a(e){i.call(this,`DataWorker`);var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type=``,this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}r.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case`string`:e=this.data.substring(this.index,t);break;case`uint8array`:e=this.data.subarray(this.index,t);break;case`array`:case`nodebuffer`:e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,n){function r(e){this.name=e||`default`,this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit(`data`,e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit(`end`),this.cleanUp(),this.isFinished=!0}catch(e){this.emit(`error`,e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit(`error`,e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n `+e:e}},t.exports=r},{}],29:[function(e,t,n){var r=e(`../utils`),i=e(`./ConvertWorker`),a=e(`./GenericWorker`),o=e(`../base64`),s=e(`../support`),c=e(`../external`),l=null;if(s.nodestream)try{l=e(`../nodejs/NodejsStreamOutputAdapter`)}catch{}function u(e,t){return new c.Promise(function(n,i){var a=[],s=e._internalType,c=e._outputType,l=e._mimeType;e.on(`data`,function(e,n){a.push(e),t&&t(n)}).on(`error`,function(e){a=[],i(e)}).on(`end`,function(){try{n(function(e,t,n){switch(e){case`blob`:return r.newBlob(r.transformTo(`arraybuffer`,t),n);case`base64`:return o.encode(t);default:return r.transformTo(e,t)}}(c,function(e,t){var n,r=0,i=null,a=0;for(n=0;n`u`)n.blob=!1;else{var r=new ArrayBuffer(0);try{n.blob=new Blob([r],{type:`application/zip`}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(r),n.blob=i.getBlob(`application/zip`).size===0}catch{n.blob=!1}}}try{n.nodestream=!!e(`readable-stream`).Readable}catch{n.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,n){for(var r=e(`./utils`),i=e(`./support`),a=e(`./nodejsUtils`),o=e(`./stream/GenericWorker`),s=Array(256),c=0;c<256;c++)s[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;s[254]=s[254]=1;function l(){o.call(this,`utf-8 decode`),this.leftOver=null}function u(){o.call(this,`utf-8 encode`)}n.utf8encode=function(e){return i.nodebuffer?a.newBufferFrom(e,`utf-8`):function(e){var t,n,r,a,o,s=e.length,c=0;for(a=0;a>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t}(e)},n.utf8decode=function(e){return i.nodebuffer?r.transformTo(`nodebuffer`,e).toString(`utf-8`):function(e){var t,n,i,a,o=e.length,c=Array(2*o);for(t=n=0;t>10&1023,c[n++]=56320|1023&i)}return c.length!==n&&(c.subarray?c=c.subarray(0,n):c.length=n),r.applyFromCharCode(c)}(e=r.transformTo(i.uint8array?`uint8array`:`array`,e))},r.inherits(l,o),l.prototype.processChunk=function(e){var t=r.transformTo(i.uint8array?`uint8array`:`array`,e.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var a=t;(t=new Uint8Array(a.length+this.leftOver.length)).set(this.leftOver,0),t.set(a,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var n;for((t||=e.length)>e.length&&(t=e.length),n=t-1;0<=n&&(192&e[n])==128;)n--;return n<0||n===0?t:n+s[e[n]]>t?n:t}(t),c=t;o!==t.length&&(i.uint8array?(c=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(c=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:n.utf8decode(c),meta:e.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=l,r.inherits(u,o),u.prototype.processChunk=function(e){this.push({data:n.utf8encode(e.data),meta:e.meta})},n.Utf8EncodeWorker=u},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,n){var r=e(`./support`),i=e(`./base64`),a=e(`./nodejsUtils`),o=e(`./external`);function s(e){return e}function c(e,t){for(var n=0;n>8;this.dir=!!(16&this.externalFileAttributes),e==0&&(this.dosPermissions=63&this.externalFileAttributes),e==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!==`/`||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=r(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,n,r,i=e.index+this.extraFieldsLength;for(this.extraFields||={};e.index+4>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t},n.buf2binstring=function(e){return c(e,e.length)},n.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n>10&1023,l[r++]=56320|1023&i)}return c(l,r)},n.utf8border=function(e,t){var n;for((t||=e.length)>e.length&&(t=e.length),n=t-1;0<=n&&(192&e[n])==128;)n--;return n<0||n===0?t:n+o[e[n]]>t?n:t}},{"./common":41}],43:[function(e,t,n){t.exports=function(e,t,n,r){for(var i=65535&e|0,a=e>>>16&65535|0,o=0;n!==0;){for(n-=o=2e3>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,i){var a=r,o=i+n;e^=-1;for(var s=i;s>>8^a[255&(e^t[s])];return-1^e}},{}],46:[function(e,t,n){var r,i=e(`../utils/common`),a=e(`./trees`),o=e(`./adler32`),s=e(`./crc32`),c=e(`./messages`),l=0,u=4,d=0,f=-2,p=-1,m=4,h=2,g=8,_=9,v=286,y=30,b=19,x=2*v+1,S=15,C=3,w=258,T=w+C+1,E=42,D=113,O=1,k=2,A=3,j=4;function M(e,t){return e.msg=c[t],t}function N(e){return(e<<1)-(4e.avail_out&&(n=e.avail_out),n!==0&&(i.arraySet(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 I(e,t){a._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,F(e.strm)}function L(e,t){e.pending_buf[e.pending++]=t}function R(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function z(e,t){var n,r,i=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-T?e.strstart-(e.w_size-T):0,l=e.window,u=e.w_mask,d=e.prev,f=e.strstart+w,p=l[a+o-1],m=l[a+o];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do if(l[(n=t)+o]===m&&l[n+o-1]===p&&l[n]===l[a]&&l[++n]===l[a+1]){a+=2,n++;do;while(l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&ac&&--i!=0);return o<=e.lookahead?o:e.lookahead}function B(e){var t,n,r,a,c,l,u,d,f,p,m=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=m+(m-T)){for(i.arraySet(e.window,e.window,m,m,0),e.match_start-=m,e.strstart-=m,e.block_start-=m,t=n=e.hash_size;r=e.head[--t],e.head[t]=m<=r?r-m:0,--n;);for(t=n=m;r=e.prev[--t],e.prev[t]=m<=r?r-m:0,--n;);a+=m}if(e.strm.avail_in===0)break;if(l=e.strm,u=e.window,d=e.strstart+e.lookahead,f=a,p=void 0,p=l.avail_in,f=C)for(c=e.strstart-e.insert,e.ins_h=e.window[c],e.ins_h=(e.ins_h<=C&&(e.ins_h=(e.ins_h<=C)if(r=a._tr_tally(e,e.strstart-e.match_start,e.match_length-C),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=C){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=C&&(e.ins_h=(e.ins_h<=C&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-C,r=a._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-C),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(B(e),e.lookahead===0&&t===l)return O;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,I(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-T&&(I(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(I(e,!0),e.strm.avail_out===0?A:j):(e.strstart>e.block_start&&(I(e,!1),e.strm.avail_out),O)}),new U(4,4,8,4,V),new U(4,5,16,8,V),new U(4,6,32,32,V),new U(4,4,16,16,H),new U(8,16,32,32,H),new U(8,16,128,128,H),new U(8,32,128,256,H),new U(32,128,258,1024,H),new U(32,258,258,4096,H)],n.deflateInit=function(e,t){return re(e,t,g,15,8,0)},n.deflateInit2=re,n.deflateReset=ne,n.deflateResetKeep=te,n.deflateSetHeader=function(e,t){return e&&e.state&&e.state.wrap===2?(e.state.gzhead=t,d):f},n.deflate=function(e,t){var n,i,o,c;if(!e||!e.state||5>8&255),L(i,i.gzhead.time>>16&255),L(i,i.gzhead.time>>24&255),L(i,i.level===9?2:2<=i.strategy||i.level<2?4:0),L(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(L(i,255&i.gzhead.extra.length),L(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=s(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(L(i,0),L(i,0),L(i,0),L(i,0),L(i,0),L(i,i.level===9?2:2<=i.strategy||i.level<2?4:0),L(i,3),i.status=D);else{var p=g+(i.w_bits-8<<4)<<8;p|=(2<=i.strategy||i.level<2?0:i.level<6?1:i.level===6?2:3)<<6,i.strstart!==0&&(p|=32),p+=31-p%31,i.status=D,R(i,p),i.strstart!==0&&(R(i,e.adler>>>16),R(i,65535&e.adler)),e.adler=1}if(i.status===69)if(i.gzhead.extra){for(o=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),F(e),o=i.pending,i.pending!==i.pending_buf_size));)L(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(i.status===73)if(i.gzhead.name){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),F(e),o=i.pending,i.pending===i.pending_buf_size)){c=1;break}c=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),c===0&&(i.gzindex=0,i.status=91)}else i.status=91;if(i.status===91)if(i.gzhead.comment){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),F(e),o=i.pending,i.pending===i.pending_buf_size)){c=1;break}c=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),c===0&&(i.status=103)}else i.status=103;if(i.status===103&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&F(e),i.pending+2<=i.pending_buf_size&&(L(i,255&e.adler),L(i,e.adler>>8&255),e.adler=0,i.status=D)):i.status=D),i.pending!==0){if(F(e),e.avail_out===0)return i.last_flush=-1,d}else if(e.avail_in===0&&N(t)<=N(n)&&t!==u)return M(e,-5);if(i.status===666&&e.avail_in!==0)return M(e,-5);if(e.avail_in!==0||i.lookahead!==0||t!==l&&i.status!==666){var m=i.strategy===2?function(e,t){for(var n;;){if(e.lookahead===0&&(B(e),e.lookahead===0)){if(t===l)return O;break}if(e.match_length=0,n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(I(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(I(e,!0),e.strm.avail_out===0?A:j):e.last_lit&&(I(e,!1),e.strm.avail_out===0)?O:k}(i,t):i.strategy===3?function(e,t){for(var n,r,i,o,s=e.window;;){if(e.lookahead<=w){if(B(e),e.lookahead<=w&&t===l)return O;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=C&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=C?(n=a._tr_tally(e,1,e.match_length-C),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(I(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(I(e,!0),e.strm.avail_out===0?A:j):e.last_lit&&(I(e,!1),e.strm.avail_out===0)?O:k}(i,t):r[i.level].func(i,t);if(m!==A&&m!==j||(i.status=666),m===O||m===A)return e.avail_out===0&&(i.last_flush=-1),d;if(m===k&&(t===1?a._tr_align(i):t!==5&&(a._tr_stored_block(i,0,0,!1),t===3&&(P(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),F(e),e.avail_out===0))return i.last_flush=-1,d}return t===u?i.wrap<=0?1:(i.wrap===2?(L(i,255&e.adler),L(i,e.adler>>8&255),L(i,e.adler>>16&255),L(i,e.adler>>24&255),L(i,255&e.total_in),L(i,e.total_in>>8&255),L(i,e.total_in>>16&255),L(i,e.total_in>>24&255)):(R(i,e.adler>>>16),R(i,65535&e.adler)),F(e),0=n.w_size&&(s===0&&(P(n.head),n.strstart=0,n.block_start=0,n.insert=0),p=new i.Buf8(n.w_size),i.arraySet(p,t,m-n.w_size,n.w_size,0),t=p,m=n.w_size),c=e.avail_in,l=e.next_in,u=e.input,e.avail_in=m,e.next_in=0,e.input=t,B(n);n.lookahead>=C;){for(r=n.strstart,a=n.lookahead-(C-1);n.ins_h=(n.ins_h<>>=b=y>>>24,m-=b,(b=y>>>16&255)==0)E[a++]=65535&y;else{if(!(16&b)){if(!(64&b)){y=h[(65535&y)+(p&(1<>>=b,m-=b),m<15&&(p+=T[r++]<>>=b=y>>>24,m-=b,!(16&(b=y>>>16&255))){if(!(64&b)){y=g[(65535&y)+(p&(1<>>=b,m-=b,(b=a-o)>3,p&=(1<<(m-=x<<3))-1,e.next_in=r,e.next_out=a,e.avail_in=r>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function g(){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 r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg=``,t.wrap&&(e.adler=1&t.wrap),t.mode=f,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(p),t.distcode=t.distdyn=new r.Buf32(m),t.sane=1,t.back=-1,u):d}function v(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,_(e)):d}function y(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=o.wsize?(r.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(i<(a=o.wsize-o.wnext)&&(a=i),r.arraySet(o.window,t,n-i,a,o.wnext),(i-=a)?(r.arraySet(o.window,t,n-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,n.check=a(n.check,B,2,0),x=b=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&b)<<8)+(b>>8))%31){e.msg=`incorrect header check`,n.mode=30;break}if((15&b)!=8){e.msg=`unknown compression method`,n.mode=30;break}if(x-=4,F=8+(15&(b>>>=4)),n.wbits===0)n.wbits=F;else if(F>n.wbits){e.msg=`invalid window size`,n.mode=30;break}n.dmax=1<>8&1),512&n.flags&&(B[0]=255&b,B[1]=b>>>8&255,n.check=a(n.check,B,2,0)),x=b=0,n.mode=3;case 3:for(;x<32;){if(v===0)break e;v--,b+=p[g++]<>>8&255,B[2]=b>>>16&255,B[3]=b>>>24&255,n.check=a(n.check,B,4,0)),x=b=0,n.mode=4;case 4:for(;x<16;){if(v===0)break e;v--,b+=p[g++]<>8),512&n.flags&&(B[0]=255&b,B[1]=b>>>8&255,n.check=a(n.check,B,2,0)),x=b=0,n.mode=5;case 5:if(1024&n.flags){for(;x<16;){if(v===0)break e;v--,b+=p[g++]<>>8&255,n.check=a(n.check,B,2,0)),x=b=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(v<(E=n.length)&&(E=v),E&&(n.head&&(F=n.head.extra_len-n.length,n.head.extra||(n.head.extra=Array(n.head.extra_len)),r.arraySet(n.head.extra,p,g,E,F)),512&n.flags&&(n.check=a(n.check,p,E,g)),v-=E,g+=E,n.length-=E),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(v===0)break e;for(E=0;F=p[g+ E++],n.head&&F&&n.length<65536&&(n.head.name+=String.fromCharCode(F)),F&&E>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;x<32;){if(v===0)break e;v--,b+=p[g++]<>>=7&x,x-=7&x,n.mode=27;break}for(;x<3;){if(v===0)break e;v--,b+=p[g++]<>>=1)){case 0:n.mode=14;break;case 1:if(w(n),n.mode=20,t!==6)break;b>>>=2,x-=2;break e;case 2:n.mode=17;break;case 3:e.msg=`invalid block type`,n.mode=30}b>>>=2,x-=2;break;case 14:for(b>>>=7&x,x-=7&x;x<32;){if(v===0)break e;v--,b+=p[g++]<>>16^65535)){e.msg=`invalid stored block lengths`,n.mode=30;break}if(n.length=65535&b,x=b=0,n.mode=15,t===6)break e;case 15:n.mode=16;case 16:if(E=n.length){if(v>>=5,x-=5,n.ndist=1+(31&b),b>>>=5,x-=5,n.ncode=4+(15&b),b>>>=4,x-=4,286>>=3,x-=3}for(;n.have<19;)n.lens[V[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,L={bits:n.lenbits},I=s(0,n.lens,0,19,n.lencode,0,n.work,L),n.lenbits=L.bits,I){e.msg=`invalid code lengths set`,n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,j=65535&z,!((k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=k,x-=k,n.lens[n.have++]=j;else{if(j===16){for(R=k+2;x>>=k,x-=k,n.have===0){e.msg=`invalid bit length repeat`,n.mode=30;break}F=n.lens[n.have-1],E=3+(3&b),b>>>=2,x-=2}else if(j===17){for(R=k+3;x>>=k)),b>>>=3,x-=3}else{for(R=k+7;x>>=k)),b>>>=7,x-=7}if(n.have+E>n.nlen+n.ndist){e.msg=`invalid bit length repeat`,n.mode=30;break}for(;E--;)n.lens[n.have++]=F}}if(n.mode===30)break;if(n.lens[256]===0){e.msg=`invalid code -- missing end-of-block`,n.mode=30;break}if(n.lenbits=9,L={bits:n.lenbits},I=s(c,n.lens,0,n.nlen,n.lencode,0,n.work,L),n.lenbits=L.bits,I){e.msg=`invalid literal/lengths set`,n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,L={bits:n.distbits},I=s(l,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,L),n.distbits=L.bits,I){e.msg=`invalid distances set`,n.mode=30;break}if(n.mode=20,t===6)break e;case 20:n.mode=21;case 21:if(6<=v&&258<=y){e.next_out=_,e.avail_out=y,e.next_in=g,e.avail_in=v,n.hold=b,n.bits=x,o(e,C),_=e.next_out,m=e.output,y=e.avail_out,g=e.next_in,p=e.input,v=e.avail_in,b=n.hold,x=n.bits,n.mode===12&&(n.back=-1);break}for(n.back=0;A=(z=n.lencode[b&(1<>>16&255,j=65535&z,!((k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>M)])>>>16&255,j=65535&z,!(M+(k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=M,x-=M,n.back+=M}if(b>>>=k,x-=k,n.back+=k,n.length=j,A===0){n.mode=26;break}if(32&A){n.back=-1,n.mode=12;break}if(64&A){e.msg=`invalid literal/length code`,n.mode=30;break}n.extra=15&A,n.mode=22;case 22:if(n.extra){for(R=n.extra;x>>=n.extra,x-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;A=(z=n.distcode[b&(1<>>16&255,j=65535&z,!((k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>M)])>>>16&255,j=65535&z,!(M+(k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=M,x-=M,n.back+=M}if(b>>>=k,x-=k,n.back+=k,64&A){e.msg=`invalid distance code`,n.mode=30;break}n.offset=j,n.extra=15&A,n.mode=24;case 24:if(n.extra){for(R=n.extra;x>>=n.extra,x-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg=`invalid distance too far back`,n.mode=30;break}n.mode=25;case 25:if(y===0)break e;if(E=C-y,n.offset>E){if((E=n.offset-E)>n.whave&&n.sane){e.msg=`invalid distance too far back`,n.mode=30;break}D=E>n.wnext?(E-=n.wnext,n.wsize-E):n.wnext-E,E>n.length&&(E=n.length),O=n.window}else O=m,D=_-n.offset,E=n.length;for(yv?(b=L[R+d[w]],N[P+d[w]]):(b=96,0),p=1<>k)+(m-=p)]=y<<24|b<<16|x|0,m!==0;);for(p=1<>=1;if(p===0?M=0:(M&=p-1,M+=p),w++,--F[C]==0){if(C===E)break;C=t[n+d[w]]}if(D>>7)]}function L(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function R(e,t,n){e.bi_valid>h-n?(e.bi_buf|=t<>h-e.bi_valid,e.bi_valid+=n-h):(e.bi_buf|=t<>>=1,n<<=1,0<--t;);return n>>>1}function V(e,t,n){var r,i,a=Array(m+1),o=0;for(r=1;r<=m;r++)a[r]=o=o+n[r-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];s!==0&&(e[2*i]=B(a[s]++,s))}}function H(e){var t;for(t=0;t>1;1<=n;n--)te(e,a,n);for(i=c;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],te(e,a,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,a[2*i]=a[2*n]+a[2*r],e.depth[i]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,a[2*n+1]=a[2*r+1]=i,e.heap[1]=i++,te(e,a,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,i,a,o,s,c=t.dyn_tree,l=t.max_code,u=t.stat_desc.static_tree,d=t.stat_desc.has_stree,f=t.stat_desc.extra_bits,h=t.stat_desc.extra_base,g=t.stat_desc.max_length,_=0;for(a=0;a<=m;a++)e.bl_count[a]=0;for(c[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n>=7;r>>=1)if(1&n&&e.dyn_ltree[2*t]!==0)return i;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return a;for(t=32;t>>3,(s=e.static_len+3+7>>>3)<=o&&(o=s)):o=s=n+5,n+4<=o&&t!==-1?se(e,t,n,r):e.strategy===4||s===o?(R(e,2+(r?1:0),3),ne(e,T,E)):(R(e,4+(r?1:0),3),function(e,t,n,r){var i;for(R(e,t-257,5),R(e,n-1,5),R(e,r-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,t===0?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(O[n]+l+1)]++,e.dyn_dtree[2*I(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){R(e,2,3),z(e,_,T),function(e){e.bi_valid===16?(L(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,n){t.exports=function(){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}},{}],54:[function(e,t,n){(function(e){(function(e,t){if(!e.setImmediate){var n,r,i,a,o=1,s={},c=!1,l=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,n={}.toString.call(e.process)===`[object process]`?function(e){process.nextTick(function(){f(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage(``,`*`),e.onmessage=n,t}}()?(a=`setImmediate$`+Math.random()+`$`,e.addEventListener?e.addEventListener(`message`,p,!1):e.attachEvent(`onmessage`,p),function(t){e.postMessage(a+t,`*`)}):e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){f(e.data)},function(e){i.port2.postMessage(e)}):l&&`onreadystatechange`in l.createElement(`script`)?(r=l.documentElement,function(e){var t=l.createElement(`script`);t.onreadystatechange=function(){f(e),t.onreadystatechange=null,r.removeChild(t),t=null},r.appendChild(t)}):function(e){setTimeout(f,0,e)},u.setImmediate=function(e){typeof e!=`function`&&(e=Function(``+e));for(var t=Array(arguments.length-1),r=0;r`u`?e===void 0?this:e:self)}).call(this,typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:{})},{}]},{},[10])(10)})})),Rd=u(Ld(),1);const zd=`username_claim`,Bd=1,Vd=1800,Hd=3500;function Ud(e){return typeof e==`object`&&!!e}function Wd(e){return typeof e==`string`}function Gd(e){return typeof e==`number`&&Number.isFinite(e)}function Kd(e){return e===void 0||Wd(e)}function qd(e){return e===void 0||Gd(e)}function Jd(e){return e===void 0||e===`x`||e===`manual`}function Yd(e){return Ud(e)?e.kind===`username_claim`&&Wd(e.username)&&Wd(e.normalized)&&Wd(e.originHash)&&(e.ownerHint===void 0||e.ownerHint===null||Wd(e.ownerHint)):!1}function Xd(e){return Ud(e)?Wd(e.hash)&&(e.url===void 0||Wd(e.url))&&Yd(e.payload)&&(e.ownerHint===void 0||e.ownerHint===null||Wd(e.ownerHint)):!1}function Zd(e){return Ud(e)?e.kind===`text`&&Wd(e.text):!1}function Qd(e){return Ud(e)?e.kind===`code`&&Wd(e.code)&&Kd(e.lang):!1}function $d(e){if(!Ud(e))return!1;let t=e.mode,n=t===void 0||t===`code`||t===`sanitized`;return e.kind===`html`&&Wd(e.html)&&n}function ef(e){return Ud(e)?e.kind===`md`&&Wd(e.md):!1}function tf(e){return Zd(e)||Qd(e)||$d(e)||ef(e)}function nf(e){return e===void 0||tf(e)}function rf(e){return Ud(e)?e.kind===`url`&&Wd(e.url)&&Kd(e.title):!1}function af(e){if(!Ud(e))return!1;let t=e.kind===`file-ref`,n=e.sha256;return!!t&&Wd(n)&&/^[0-9a-f]{64}$/.test(n)&&Kd(e.name)&&Kd(e.type)&&qd(e.size)&&(e.url===void 0||Wd(e.url))}function of(e){return Ud(e)?e.kind===`file-inline`&&Kd(e.name)&&Kd(e.type)&&qd(e.size)&&Wd(e.data_b64url)&&(e.thumbnail_b64===void 0||Wd(e.thumbnail_b64)):!1}function sf(e){return rf(e)||af(e)||of(e)}function cf(e){return!(!Ud(e)||e.version!==1||!Array.isArray(e.items)||!e.items.every(sf)||!qd(e.totalBytes)||!qd(e.inlinedBytes))}function lf(e){return e===void 0||Ud(e)}function uf(e){return Ud(e)?e.v===2&&Wd(e.url)&&Gd(e.pulse)&&Jd(e.source)&&Kd(e.caption)&&nf(e.body)&&Kd(e.author)&&Kd(e.sigilId)&&Kd(e.phiKey)&&Kd(e.kaiSignature)&&Kd(e.parent)&&Kd(e.parentUrl)&&Kd(e.originUrl)&&qd(e.ts)&&(e.attachments===void 0||cf(e.attachments))&&lf(e.seal)&&(e.usernameClaim===void 0||Xd(e.usernameClaim)):!1}function df(e){return Ud(e)?e.v===1&&Wd(e.url)&&Gd(e.pulse)&&Jd(e.source)&&Kd(e.caption)&&Kd(e.author)&&Kd(e.sigilId)&&Kd(e.phiKey)&&Kd(e.kaiSignature)&&Kd(e.parent)&&Kd(e.parentUrl)&&Kd(e.originUrl)&&qd(e.ts)&&(e.attachments===void 0||cf(e.attachments)):!1}var ff=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,pf=(()=>{let e=new Int16Array(256);for(let t=0;t<256;t++)e[t]=-1;for(let t=0;t<64;t++)e[ff.charCodeAt(t)]=t;return e})();function mf(e){let t=[],n=e.length,r=0;for(;r+2>>18&63]+ff[n>>>12&63]+ff[n>>>6&63]+ff[n&63])}let i=n-r;if(i===1){let n=e[r]<<16;t.push(ff[n>>>18&63]+ff[n>>>12&63]+`==`)}else if(i===2){let n=e[r]<<16|e[r+1]<<8;t.push(ff[n>>>18&63]+ff[n>>>12&63]+ff[n>>>6&63]+`=`)}return t.join(``).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function hf(e){let t=(e??``).trim();if(!t)return new Uint8Array;let n=t.replace(/-/g,`+`).replace(/_/g,`/`);n=n.replace(/[\r\n\s]/g,``);let r=(4-n.length%4)%4;r&&(n+=`=`.repeat(r));let i=n.length;if(i%4!=0)throw Error(`Invalid base64 length`);let a=i/4*3;i>=2&&n[i-2]===`=`&&n[i-1]===`=`?a-=2:i>=1&&n[i-1]===`=`&&--a;let o=new Uint8Array(a),s=0;for(let e=0;e>>16&255,d!==64&&s>>8&255),f!==64&&s1e6)return null;let t=hf(e);if(t.length===0)return null;let n=new TextDecoder().decode(t),r=JSON.parse(n);return uf(r)?r:df(r)?_f(r):null}catch{return null}}function yf(e){if(e instanceof ArrayBuffer)return e;let t=new Uint8Array(e),n=new ArrayBuffer(t.byteLength);return new Uint8Array(n).set(t),n}function bf(e){let t=new Uint8Array(e),n=``;for(let e=0;e{let{createHash:e}=await import(`./__vite-browser-external-CUSLmM9D.js`).then(f(1));return{createHash:e}},[]);return n(`sha256`).update(new Uint8Array(t)).digest(`hex`)}function Sf(e,t){let n=yf(e);try{return new Blob([n],{type:t||`application/octet-stream`})}catch{return new Blob([n])}}function Cf(e){return hf(e)}function wf(e){let t=0,n=0,r=e.attachments?.items??[];for(let e of r)e.kind===`file-ref`?t+=e.size??0:e.kind===`file-inline`&&(t+=e.size??0,n+=e.data_b64url.length*.75,e.thumbnail_b64&&(n+=e.thumbnail_b64.length*.75));return{totalBytes:Math.round(t),inlinedBytes:Math.round(n)}}function Tf(e){if(!e.attachments)return e;let t=e.attachments.items.map(e=>{if(e.kind===`file-inline`&&e.thumbnail_b64){let t={...e};return delete t.thumbnail_b64,t}return e}),{totalBytes:n,inlinedBytes:r}=wf({attachments:{...e.attachments,items:t}});return{...e,attachments:{version:1,items:t,totalBytes:n,inlinedBytes:r}}}async function Ef(e,t={}){let n=t.cacheName??`sigil-attachments-v1`,r=(t.pathPrefix??`/att/`).replace(/\/+$/,``)+`/`,i=Tf(e);if(!i.attachments||i.attachments.items.length===0||!(globalThis.caches!==void 0&&typeof globalThis.caches.open==`function`))return i;let a=null;try{a=await globalThis.caches.open(n)}catch{a=null}let o=[];for(let e of i.attachments.items){if(e.kind!==`file-inline`){o.push(e);continue}if(!a){o.push(e);continue}try{let t=Cf(e.data_b64url),n=await xf(t.buffer),i=Sf(t.buffer,e.type),s=`${r}${n}`;await a.put(new Request(s,{method:`GET`}),new Response(i,{headers:e.type?{"Content-Type":e.type}:void 0}));let c={kind:`file-ref`,name:e.name,type:e.type,size:e.size,sha256:n,url:s};o.push(c)}catch{o.push(e)}}return{...i,attachments:Rf(o)}}function Df(e){let t=gf(Tf(e));return{token:t,withinSoft:t.length<=Vd,withinHard:t.length<=Hd}}function Of(e){let t=(e??``).trim();if(!t)return``;if(/%[0-9A-Fa-f]{2}/.test(t))try{t=decodeURIComponent(t)}catch{}return t.includes(` `)&&(t=t.replace(/ /g,`+`)),/[+/=]/.test(t)&&(t=t.replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)),t}function kf(e){try{let t=e??(typeof window<`u`&&window.location?window.location:null);if(!t)return null;let n=t.hash.startsWith(`#`)?t.hash.slice(1):t.hash,r=t.search.startsWith(`?`)?t.search.slice(1):t.search,i=new URLSearchParams(n),a=new URLSearchParams(r),o=i.get(`t`)??i.get(`p`)??i.get(`token`);if(o)return Of(o);let s=a.get(`t`)??a.get(`p`)??a.get(`token`);if(s)return Of(s);let c=t.pathname.match(/^\/(?:stream|feed)\/p\/([^/?#]+)\/?$/);if(c?.[1])return Of(c[1]);let l=t.pathname.match(/^\/p~([^/?#]+)\/?$/);return l?.[1]?Of(l[1]):null}catch{return null}}function Af(e){let t=(e??``).trim();if(!t)return null;let n=t.split(`?`)[0].split(`#`)[0],r=e=>{try{return decodeURIComponent(e)}catch{return e}},i=n.match(/^\/p~([^/?#]+)\/?$/);if(i?.[1])return Of(r(i[1]));let a=n.match(/^\/(?:stream|feed)\/p\/([^/?#]+)\/?$/);return a?.[1]?Of(r(a[1])):null}function jf(e){let t=typeof window<`u`?window.location?.origin??void 0:void 0,n=e.trim();if(!n)return null;if(/^[A-Za-z0-9_-]{16,}$/u.test(n))return Of(n);let r;try{r=new URL(n)}catch{try{r=new URL(n,t)}catch{return null}}let i=r.pathname||``;{let e=i.match(/\/(?:stream|feed)\/p\/([^/?#]+)/u);if(e?.[1])return Of(e[1])}{let e=i.match(/\/p\/([^/?#]+)/u);if(e?.[1])return Of(e[1])}{let e=i.match(/\/p(?:\u007e|%7[Ee])\/?([^/?#]+)/u);if(e?.[1])return Of(e[1])}let a=r.hash&&r.hash.startsWith(`#`)?r.hash.slice(1):``,o=new URLSearchParams(a);for(let e of[`t`,`p`,`token`,`capsule`]){let t=o.get(e);if(t)return Of(t);let n=r.searchParams.get(e);if(n)return Of(n)}return null}async function Mf(e,t={}){let n=Tf(e);if(Df(n).withinHard||!(n.attachments?.items?.some(e=>e.kind===`file-inline`)??!1))return n;if(!(globalThis.caches!==void 0&&typeof globalThis.caches.open==`function`))throw Error(`Inline attachments exceed safe token size, but CacheStorage is unavailable on this device/session. Attach via a public URL (Drive/S3/IPFS) or use smaller files.`);let r=await Ef(n,t),i=Df(r),a=r.attachments?.items?.some(e=>e.kind===`file-inline`)??!1;if(!i.withinHard&&a)throw Error(`Inline attachments are still too large to share safely (and could not be cached). Attach via public URL or reduce inline file size/count.`);return Tf(r)}function Nf(e){return{kind:`text`,text:e}}function Pf(e,t){return{kind:`code`,code:e,lang:t}}function Ff(e,t){return{kind:`html`,html:e,mode:t}}function If(e){return{kind:`md`,md:e}}function Lf(e){let t=e.parentUrl??e.parent,n=e.caption??(e.body?.kind===`text`&&e.body.text.length>0?e.body.text:void 0);return{v:2,url:e.url,pulse:e.pulse,caption:n,body:e.body,author:e.author,source:e.source,sigilId:e.sigilId,phiKey:e.phiKey,kaiSignature:e.kaiSignature,parent:e.parent,parentUrl:t,originUrl:e.originUrl,ts:e.ts,attachments:e.attachments,seal:e.seal,usernameClaim:e.usernameClaim}}function Rf(e){let t={version:1,items:e.slice()},{totalBytes:n,inlinedBytes:r}=wf({attachments:t});return t.totalBytes=n,t.inlinedBytes=r,t}function zf(e){return{kind:`file-inline`,name:e.name,type:e.type,size:e.size,data_b64url:e.data_b64url,thumbnail_b64:e.thumbnail_b64}}function Bf(e){if(!/^[0-9a-f]{64}$/.test(e.sha256))throw Error(`sha256 must be 64 hex chars`);return{kind:`file-ref`,sha256:e.sha256,name:e.name,type:e.type,size:e.size,url:e.url}}function Vf(e){return{kind:`url`,url:e.url,title:e.title}}function Hf(e){let t=JSON.stringify(e);return`h:${Jf(Kf(new TextEncoder().encode(t)))}`}function Uf(e){if(!e.startsWith(`h:`))throw Error(`Invalid history param`);let t=qf(Yf(e.slice(2))),n=new TextDecoder().decode(t);return JSON.parse(n)}var Wf=e=>typeof globalThis.btoa==`function`?globalThis.btoa(e):Buffer.from(e,`binary`).toString(`base64`),Gf=e=>typeof globalThis.atob==`function`?globalThis.atob(e):Buffer.from(e,`base64`).toString(`binary`),Kf=e=>Wf(String.fromCharCode(...e)),qf=e=>Uint8Array.from(Gf(e),e=>e.charCodeAt(0)),Jf=e=>e.replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``),Yf=e=>{let t=e.replace(/-/g,`+`).replace(/_/g,`/`);return t+(t.length%4?`=`.repeat(4-t.length%4):``)};function Xf(e){let t={u:e.pulse,b:e.beat,s:e.stepIndex,c:e.chakraDay,d:e.stepsPerBeat??44,k:e.kaiSignature,p:e.userPhiKey};e.parentUrl&&(t.r=e.parentUrl),e.originUrl&&(t.o=e.originUrl);let n=JSON.stringify(t);return`c:${Jf(Kf(new TextEncoder().encode(n)))}`}function Zf(e){if(e.startsWith(`c:`)){let t=qf(Yf(e.slice(2))),n=new TextDecoder().decode(t),r=JSON.parse(n);return{pulse:Number(r.u)||0,beat:Number(r.b)||0,stepIndex:Number(r.s)||0,chakraDay:r.c,stepsPerBeat:Number(r.d)||44,kaiSignature:typeof r.k==`string`?r.k:void 0,userPhiKey:typeof r.p==`string`?r.p:void 0,parentUrl:typeof r.r==`string`?r.r:void 0,originUrl:typeof r.o==`string`?r.o:void 0}}let t=qf(Yf(e.startsWith(`j:`)?e.slice(2):e)),n=new TextDecoder().decode(t),r=JSON.parse(n),i={pulse:Number(r.pulse)||0,beat:Number(r.beat)||0,stepIndex:Number(r.stepIndex)||0,chakraDay:r.chakraDay,stepsPerBeat:Number(r.stepsPerBeat)||44,kaiSignature:typeof r.kaiSignature==`string`?r.kaiSignature:void 0,userPhiKey:typeof r.userPhiKey==`string`?r.userPhiKey:void 0,parentUrl:typeof r.parentUrl==`string`?r.parentUrl:void 0,originUrl:typeof r.originUrl==`string`?r.originUrl:void 0},a={expiresAtPulse:r.expiresAtPulse==null?void 0:Number(r.expiresAtPulse),canonicalHash:typeof r.canonicalHash==`string`?r.canonicalHash:void 0,transferNonce:typeof r.transferNonce==`string`?r.transferNonce:void 0,exportedAtPulse:r.exportedAtPulse==null?void 0:Number(r.exportedAtPulse),claimExtendUnit:r.claimExtendUnit===`breaths`||r.claimExtendUnit===`steps`?r.claimExtendUnit:void 0,claimExtendAmount:r.claimExtendAmount==null?void 0:Number(r.claimExtendAmount)};return{...r,...a,...i}}function Qf(e,t,n){let r=typeof window<`u`&&window.location?.origin?window.location.origin:``,i=n?.absolute===!1?``:n?.origin??r,a={...t},o=n?.parentUrl||(n?.autoInferParent&&typeof window<`u`?window.location.href:void 0);if(o&&!a.parentUrl){a.parentUrl=o;try{let e=np(o);a.originUrl=a.originUrl||e?.originUrl||o}catch{a.originUrl=a.originUrl||o}}let s=Xf(a),c=`/s/${encodeURIComponent(e)}?p=${s}`;return i?`${i}${c}`:c}function $f(e){try{return new URL(e,`resolve://`).searchParams.get(`p`)??null}catch{let t=e.match(/[?&]p=([^&#]+)/);return t?decodeURIComponent(t[1]):null}}function ep(e){try{let t=new URL(e,`https://example.invalid`);if(t.hash){let e=new URLSearchParams(t.hash.replace(/^#/,``)).get(`t`);if(e)return e}return Af(t.pathname)||(t.searchParams.get(`p`)??null)}catch{let t=e.match(/#(?:t|p)=([^&#]+)/);if(t)return decodeURIComponent(t[1]);let n=e.match(/\/p~([^/?#]+)/);if(n)return decodeURIComponent(n[1]);let r=e.match(/\/(?:stream|feed)\/p\/([^/]+)/);if(r)return decodeURIComponent(r[1]);let i=e.match(/[?&]p=([^&#]+)/);return i?decodeURIComponent(i[1]):null}}function tp(e){let t=ep(e);if(!t)return null;let n=vf(t);if(!n)return null;let r=0,i=0,a=`Root`,o=44;try{let e=Ir(n.pulse);typeof e.beat==`number`?r=e.beat:typeof e.beatIndex==`number`&&(r=e.beatIndex),typeof e.stepIndex==`number`&&(i=e.stepIndex),typeof e.chakraDay==`string`&&(a=e.chakraDay),typeof e.stepsPerBeat==`number`&&(o=e.stepsPerBeat)}catch{}let s=typeof n.parentUrl==`string`?n.parentUrl:typeof n.parent==`string`?n.parent:void 0;return{pulse:n.pulse,beat:r,stepIndex:i,chakraDay:a,stepsPerBeat:o,kaiSignature:typeof n.kaiSignature==`string`?n.kaiSignature:void 0,userPhiKey:typeof n.phiKey==`string`?n.phiKey:void 0,parentUrl:s,originUrl:typeof n.originUrl==`string`?n.originUrl:void 0,feed:n}}function np(e){let t=$f(e);if(t)try{return Zf(t)}catch{}return tp(e)}function rp(e){let t=[],n=e,r=new Set;for(;n&&!r.has(n);){r.add(n),t.push(n);let e=np(n);if(!e?.parentUrl)break;n=e.parentUrl}return t}function ip(e){let t=np(e);if(t?.originUrl)return t.originUrl;let n=rp(e);return n.length?n[n.length-1]:void 0}const ap=`kai:sigils:v1`,op=`sigil:urls`,sp=`kai-sigil-registry`;var cp=typeof window<`u`;function lp(e){if(!cp)return[];try{let t=window.localStorage.getItem(e);if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(e=>typeof e==`string`):[]}catch{return[]}}function up(e,t){if(cp)try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}}function dp(e,t){return e.includes(t)?!1:(e.push(t),!0)}function fp(e){try{return new URL(e,cp?window.location.origin:`https://example.invalid`).toString()}catch{return e}}var pp=null;function mp(){return!cp||!(`BroadcastChannel`in window)?null:pp||(pp=new BroadcastChannel(sp),pp)}function hp(e){if(!cp||!e)return;let t=fp(e),n=lp(ap);dp(n,t)&&up(ap,n);let r=lp(op);dp(r,t)&&up(op,r);try{window.dispatchEvent(new CustomEvent(`sigil:url-registered`,{detail:{url:t}}))}catch{}try{mp()?.postMessage({type:`sigil:add`,url:t})}catch{}}function gp(e){try{let t=new URL(e),n=t.pathname.match(/\/(?:s|sigil)\/([a-f0-9]{6,})/i)?.[1],r=np(e);if(n&&r)return Qf(n,r);let i=t.hash?.slice(1).match(/^([a-f0-9]{6,})$/i)?.[1];return i&&r?Qf(i,r):null}catch(e){return console.error(`Failed to generate canonical QR URL:`,e),null}}function _p(e){if(e)try{return new URL(e).origin}catch{}return typeof window<`u`&&typeof window.location?.origin==`string`&&window.location.origin?window.location.origin:`https://kaiklok.com`}function vp(e,t){let n=_p(t),r=(e??``).toString().trim().toLowerCase();if(!r)return n+`/`;let i=new URL(`/s/${encodeURIComponent(r)}`,n);if(typeof window<`u`){let e=new URLSearchParams(window.location.search),t=e.get(`d`);t&&i.searchParams.set(`d`,t);let n=e.get(`t`);n&&i.searchParams.set(`t`,n)}return i.toString()}const yp=(1+Math.sqrt(5))/2,bp=`ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial`,xp=1e3,Sp=xp/2,Cp={Root:{sides:4,hue:0},Sacral:{sides:6,hue:30},"Solar Plexus":{sides:5,hue:53},Heart:{sides:8,hue:122},Throat:{sides:12,hue:180},"Third Eye":{sides:14,hue:222},Crown:{sides:16,hue:258}},wp={Root:`Earth Gate`,Sacral:`Water Gate`,"Solar Plexus":`Fire Gate`,Heart:`Air Gate`,Throat:`Will Gate`,"Third Eye":`Light Gate`,Crown:`Ether Gate`},Tp={Root:194.18,Sacral:210.42,"Solar Plexus":378.4,Heart:620.9,Throat:1292.3,"Third Eye":1664.7,Crown:2594.2},Ep={Solhara:`Root`,Aquaris:`Solar Plexus`,Flamora:`Heart`,Verdari:`Throat`,Sonari:`Third Eye`,Kaelith:`Crown`},Dp=e=>e===`Solhara`||e===`Aquaris`||e===`Flamora`||e===`Verdari`||e===`Sonari`||e===`Kaelith`,Op=e=>Dp(e)?Ep[e]:e,kp=(e,t=100,n=50)=>`hsl(${e} ${t}% ${n}%)`,Ap=(e,t=0,n=.38)=>{let r=xp*n,i=[];for(let n=0;n{let r=[];for(let i=0;i<360;i+=1){let a=i/359*2*Math.PI,o=(Math.sin(e*a+n)+1)/2*xp,s=(Math.sin(t*a)+1)/2*xp;r.push(`${i?`L`:`M`}${o},${s}`)}return`${r.join(``)}Z`};function Mp(e){let t=((Number.isFinite(e)?Math.trunc(e):0)%484+484)%484,n=Math.floor(t/11);return Math.min(Math.max(0,n),43)}function Np(e){let t=((Number.isFinite(e)?Math.trunc(e):0)%484+484)%484%11/11;return t>=1?1-2**-52:t<0?0:t}const Pp=(e,t)=>+(Tp[e]*yp**((Number.isFinite(t)?t:0)/44)).toFixed(3),Fp=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Ip=e=>JSON.stringify(e,(e,t)=>t instanceof Date?t.toISOString():typeof t==`bigint`?t.toString():t),Lp=(e,t)=>{if(!Fp(e))return;let n=e[t];return typeof n==`string`?n:void 0},Rp=(e,t)=>{if(!Fp(e))return;let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0},zp=e=>`${e}`;var Bp=e=>e instanceof Date?e.toISOString():String(e);function Vp(e,t,n=6){let r={},i=(e,t)=>{r[`data-${e}`]=t},a=(e,t,r)=>{if(!(r>n)){if(Array.isArray(t)){i(e,JSON.stringify(t.map(e=>e instanceof Date?e.toISOString():e)));return}if(Fp(t)){for(let[n,i]of Object.entries(t))a(`${e}-${n.replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-+|-+$/g,``).toLowerCase()}`,i,r+1);return}typeof t==`number`||typeof t==`string`||t===void 0||t===`null`||t===null?i(e,t===null?void 0:typeof t==`number`?t:Bp(t)):i(e,Bp(t))}};for(let[n,r]of Object.entries(t))a(`${e}-${n.replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-+|-+$/g,``).toLowerCase()}`,r,1);return r}const Hp=(e,t=220)=>e?e.replace(/\s+/g,` `).trim().slice(0,t):void 0,Up=(e,t=NaN)=>typeof e==`number`&&Number.isFinite(e)?Math.trunc(e):t,Wp=(e,t=NaN)=>typeof e==`number`&&Number.isFinite(e)?Math.max(0,Math.min(1-2**-52,e)):t,Gp=e=>[...e].map(e=>e.toString(16)).map(e=>e.padStart(2,`0`)).join(``);function Kp(e){return!(typeof SharedArrayBuffer<`u`&&e.buffer instanceof SharedArrayBuffer)&&e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.slice().buffer}async function qp(e){let t=typeof e==`string`?new TextEncoder().encode(e):e,n=await crypto.subtle.digest(`SHA-256`,Kp(t));return new Uint8Array(n)}var Jp=`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`;function Yp(e){let t=0n;for(let n of e)t=(t<<8n)+BigInt(n);let n=``;for(;t>0n;){let e=t%58n;n=Jp[Number(e)]+n,t/=58n}for(let t=0;t>>0;return function(){t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|t)^e,((e^e>>>14)>>>0)/4294967296}}const Qp=e=>{let t=e.replace(/^0x/i,``),n=new Uint8Array(t.length/2);for(let e=0;e>>0;for(let n=0;n>>1:t>>>1}return~t>>>0}const em=e=>{let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=t.length%4;n&&(t+=`=`.repeat(4-n));let r=atob(t),i=new Uint8Array(r.length);for(let e=0;eString(e))),typeof e.ext==`boolean`&&(t.ext=e.ext),t}function rm(){let[e,t]=(0,C.useState)(!1),[n,r]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),n=window.matchMedia(`(prefers-contrast: more)`),i=()=>{t(!!e.matches),r(!!n.matches)};return i(),e.addEventListener?.(`change`,i),n.addEventListener?.(`change`,i),()=>{e.removeEventListener?.(`change`,i),n.removeEventListener?.(`change`,i)}},[]),{prefersReduce:e,prefersContrast:n}}var im=e=>typeof e==`object`&&!!e;function am(e){let[t,n]=(0,C.useState)(null),r=(0,C.useRef)(null);return(0,C.useEffect)(()=>{r.current=t},[t]),(0,C.useEffect)(()=>{if(e!==`moment`)return;let t=!1,r=async()=>{try{let e=await ji();!t&&im(e)&&n(e)}catch{}};r();let i=window.setInterval(r,qn);return()=>{t=!0,window.clearInterval(i)}},[e]),{kaiData:t,kaiDataRef:r}}function om(e){let t=e=>{let t=2166136261;for(let n=0;n>>0};return(0,C.useMemo)(()=>t(e),[e])}function sm(){return(0,C.useMemo)(()=>async e=>{let t=new TextEncoder().encode(e),n=await crypto.subtle.digest(`SHA-256`,Kp(t));return Array.from(new Uint8Array(n)).map(e=>e.toString(16)).map(e=>e.padStart(2,`0`)).join(``)},[])}var cm=({uid:e,size:t,phaseColor:n,outerRingText:r,innerRingText:i,animate:a,prefersReduce:o})=>{xp*.34;let s=340/yp,c=s*.96/(xp/2),l=`${e}-zk-phi-ring`,u=`${e}-zk-bin-ring`,d=`${e}-zk-grad`,f=`${e}-zk-petal-def`,p=Math.max(1,(t??240)*.008),m=Math.max(.9,(t??240)*.007),h=Math.max(1.2,(t??240)*.009),g=a&&!o,_=(0,C.useRef)(null);(0,C.useEffect)(()=>{if(!g)return;let e=_.current;if(!e)return;let t=0,n=performance.now(),r=qn/1e3,i=1/r*(yp*.21),a=1/r*((yp-1)*.17),o=1/r*(Math.SQRT2*.15),s=Math.PI/2,c=Math.PI/3,l=()=>{let r=(performance.now()-n)/1e3,u=5+1.6*(.5+.5*Math.sin(2*Math.PI*i*r)),d=8+1.2*(.5+.5*Math.sin(2*Math.PI*a*r+1.234)),f=s+c*Math.sin(2*Math.PI*o*r+.777);e.setAttribute(`d`,jp(u,d,f)),t=requestAnimationFrame(l)};return t=requestAnimationFrame(l),()=>cancelAnimationFrame(t)},[g]);let v=Math.max(8,(t??240)*.026),y=Math.max(7,(t??240)*.022),b=e=>e*.62,x=(e,t)=>{let n=2*Math.PI*e;return Math.max(48,Math.floor(n/b(t)))},S=(e,t)=>{let n=(e??``).trim();if(!n)return``;let r=[`sig=`,`b58=`,`len=`,`crc32=`,`creator=`,`zk=`,`alg=`,`day=`,`beat=`,`hz=`,`poseidon=`],i=n.split(` · `).map(e=>e.trim()).filter(Boolean),a=i.filter(e=>r.some(t=>e.startsWith(t))),o=(a.length?a:i).join(` · `);return o.length<=t?o:o.slice(0,Math.max(0,t-1)).trimEnd()+`…`},w=(0,C.useMemo)(()=>S(r,x(340,v)),[r,340,v]),T=(0,C.useMemo)(()=>S(i,x(s,y)),[i,s,y]),E=(e,t,n,r,i,a)=>{let o=Array.from(e);if(!o.length)return null;let s=-Math.PI/2,c=o.length,l=Math.max(.45,r*.085);return(0,W.jsx)(`g`,{"aria-hidden":`true`,pointerEvents:`none`,children:o.map((e,o)=>{let u=s+o/c*Math.PI*2;return(0,W.jsx)(`text`,{transform:`translate(${500+t*Math.cos(u)} ${500+t*Math.sin(u)}) rotate(${u*180/Math.PI+90})`,fontFamily:n,fontSize:r,fill:i,opacity:a,textAnchor:`middle`,dominantBaseline:`middle`,letterSpacing:`0`,stroke:`#001014`,strokeOpacity:`0.6`,strokeWidth:l,paintOrder:`stroke`,children:e},`${o}-${e}`)})})};return(0,W.jsxs)(`g`,{id:`${e}-zk-glyph`,"aria-label":`Atlantean zero-knowledge verification glyph`,pointerEvents:`none`,children:[(0,W.jsxs)(`defs`,{children:[(0,W.jsxs)(`radialGradient`,{id:d,cx:`50%`,cy:`50%`,r:`60%`,children:[(0,W.jsx)(`stop`,{offset:`0%`,stopColor:n,stopOpacity:`0.85`,children:g&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`animate`,{attributeName:`stop-opacity`,values:`.55;.85;.55`,dur:`${qn}ms`,repeatCount:`indefinite`}),(0,W.jsx)(`animate`,{attributeName:`stop-color`,values:`${n};#00FFD0;${n}`,dur:`${qn*3}ms`,repeatCount:`indefinite`})]})}),(0,W.jsx)(`stop`,{offset:`55%`,stopColor:n,stopOpacity:`0.55`,children:g&&(0,W.jsx)(`animate`,{attributeName:`stop-color`,values:`${n};#00FFD0;${n}`,dur:`${qn*3}ms`,repeatCount:`indefinite`})}),(0,W.jsx)(`stop`,{offset:`100%`,stopColor:`#00FFD0`,stopOpacity:`0.25`,children:g&&(0,W.jsx)(`animate`,{attributeName:`stop-opacity`,values:`.15;.35;.15`,dur:`${qn}ms`,repeatCount:`indefinite`})})]}),(0,W.jsx)(`path`,{id:l,d:`M 500 160 a 340 340 0 1 1 0 ${2*340} a 340 340 0 1 1 0 -${2*340}`,fill:`none`}),(0,W.jsx)(`path`,{id:u,d:`M 500 ${500-s} a ${s} ${s} 0 1 1 0 ${2*s} a ${s} ${s} 0 1 1 0 -${2*s}`,fill:`none`}),(0,W.jsx)(`path`,{id:f,ref:_,d:jp(5,8,Math.PI/2)})]}),(0,W.jsx)(`circle`,{cx:500,cy:500,r:340,fill:`none`,stroke:`url(#${d})`,strokeWidth:h,opacity:`0.5`,vectorEffect:`non-scaling-stroke`}),Array.from({length:12},(e,t)=>(0,W.jsx)(`use`,{href:`#${f}`,transform:`translate(500,500) scale(${c}) rotate(${t*30}) translate(-500,-500)`,stroke:`url(#${d})`,strokeWidth:p,strokeLinecap:`round`,strokeLinejoin:`round`,opacity:`0.42`,fill:`none`,vectorEffect:`non-scaling-stroke`},t)),(0,W.jsxs)(`g`,{opacity:`0.25`,children:[(0,W.jsx)(`circle`,{cx:500-s/2.2,cy:500,r:s*.86,fill:`none`,stroke:n,strokeWidth:m}),(0,W.jsx)(`circle`,{cx:500+s/2.2,cy:500,r:s*.86,fill:`none`,stroke:`#00FFD0`,strokeWidth:m})]}),(0,W.jsx)(`circle`,{cx:500,cy:500,r:s,fill:`none`,stroke:`url(#${d})`,strokeWidth:m,opacity:`0.55`,vectorEffect:`non-scaling-stroke`}),w&&E(w,340,`ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`,v,n,.33),T&&E(T,s,`ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial`,y,`#00FFD0`,.28)]})};function lm(e){if(e instanceof Date)return e.toISOString();if(e===null||typeof e==`string`||typeof e==`boolean`)return e;if(typeof e==`number`)return Number.isFinite(e)?e:null;if(Array.isArray(e))return e.map(e=>lm(e));let t=e,n={},r=Object.keys(t).sort();for(let e of r){let r=t[e];r!==void 0&&(n[e]=lm(r))}return n}function um(e){let t=lm(e);return JSON.stringify(t)}function dm(e){return new TextEncoder().encode(um(e))}async function fm(e){let{blake3:t}=await O(async()=>{let{blake3:e}=await import(`./index.esm-jE_FWBZ6.js`);return{blake3:e}},[]);return t(e)}var pm=4,mm=0,hm=1,gm=2;function _m(e){let t=e.length;for(;--t>=0;)e[t]=0}var vm=0,ym=1,bm=2,xm=3,Sm=258,Cm=29,wm=256,Tm=wm+1+Cm,Em=30,Dm=19,Om=2*Tm+1,km=15,Am=16,jm=7,Mm=256,Nm=16,Pm=17,Fm=18,Im=new Uint8Array([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]),Lm=new Uint8Array([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]),Rm=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),zm=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Bm=512,Vm=Array((Tm+2)*2);_m(Vm);var Hm=Array(Em*2);_m(Hm);var Um=Array(Bm);_m(Um);var Wm=Array(Sm-xm+1);_m(Wm);var Gm=Array(Cm);_m(Gm);var Km=Array(Em);_m(Km);function qm(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 Jm,Ym,Xm;function Zm(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}var Qm=e=>e<256?Um[e]:Um[256+(e>>>7)],$m=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},eh=(e,t,n)=>{e.bi_valid>Am-n?(e.bi_buf|=t<>Am-e.bi_valid,e.bi_valid+=n-Am):(e.bi_buf|=t<{eh(e,n[t*2],n[t*2+1])},nh=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},rh=e=>{e.bi_valid===16?($m(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)},ih=(e,t)=>{let 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<=km;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;lc&&(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--)}},ah=(e,t,n)=>{let r=Array(km+1),i=0,a,o;for(a=1;a<=km;a++)i=i+n[a-1]<<1,r[a]=i;for(o=0;o<=t;o++){let t=e[o*2+1];t!==0&&(e[o*2]=nh(r[t]++,t))}},oh=()=>{let e,t,n,r,i,a=Array(km+1);for(n=0,r=0;r>=7;r{let t;for(t=0;t{e.bi_valid>8?$m(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},lh=(e,t,n,r)=>{let i=t*2,a=n*2;return e[i]{let r=e.heap[n],i=n<<1;for(;i<=e.heap_len&&(i{let r,i,a=0,o,s;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+ a++]&255,r+=(e.pending_buf[e.sym_buf+ a++]&255)<<8,i=e.pending_buf[e.sym_buf+ a++],r===0?th(e,i,t):(o=Wm[i],th(e,o+wm+1,t),s=Im[o],s!==0&&(i-=Gm[o],eh(e,i,s)),r--,o=Qm(r),th(e,o,n),s=Lm[o],s!==0&&(r-=Km[o],eh(e,r,s)));while(a{let 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=Om,o=0;o>1;o>=1;o--)uh(e,n,o);l=a;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],uh(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++,uh(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],ih(e,t),ah(n,c,e.bl_count)},ph=(e,t,n)=>{let 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{let 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{let t;for(ph(e,e.dyn_ltree,e.l_desc.max_code),ph(e,e.dyn_dtree,e.d_desc.max_code),fh(e,e.bl_desc),t=Dm-1;t>=3&&e.bl_tree[zm[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},gh=(e,t,n,r)=>{let i;for(eh(e,t-257,5),eh(e,n-1,5),eh(e,r-4,4),i=0;i{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return mm;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return hm;for(n=32;n{vh||=(oh(),!0),e.l_desc=new Zm(e.dyn_ltree,Jm),e.d_desc=new Zm(e.dyn_dtree,Ym),e.bl_desc=new Zm(e.bl_tree,Xm),e.bi_buf=0,e.bi_valid=0,sh(e)},bh=(e,t,n,r)=>{eh(e,(vm<<1)+(r?1:0),3),ch(e),$m(e,n),$m(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},xh={_tr_init:yh,_tr_stored_block:bh,_tr_flush_block:(e,t,n,r)=>{let i,a,o=0;e.level>0?(e.strm.data_type===gm&&(e.strm.data_type=_h(e)),fh(e,e.l_desc),fh(e,e.d_desc),o=hh(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?bh(e,t,n,r):e.strategy===pm||a===i?(eh(e,(ym<<1)+(r?1:0),3),dh(e,Vm,Hm)):(eh(e,(bm<<1)+(r?1:0),3),gh(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),dh(e,e.dyn_ltree,e.dyn_dtree)),sh(e),r&&ch(e)},_tr_tally:(e,t,n)=>(e.pending_buf[e.sym_buf+ e.sym_next++]=t,e.pending_buf[e.sym_buf+ e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+ e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(Wm[n]+wm+1)*2]++,e.dyn_dtree[Qm(t)*2]++),e.sym_next===e.sym_end),_tr_align:e=>{eh(e,ym<<1,3),th(e,Mm,Vm),rh(e)}},Sh=(e,t,n,r)=>{let i=e&65535|0,a=e>>>16&65535|0,o=0;for(;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},Ch=new Uint32Array((()=>{let e,t=[];for(var 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})()),wh=(e,t,n,r)=>{let i=Ch,a=r+n;e^=-1;for(let n=r;n>>8^i[(e^t[n])&255];return e^-1},Th={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`},Eh={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:Dh,_tr_stored_block:Oh,_tr_flush_block:kh,_tr_tally:Ah,_tr_align:jh}=xh,{Z_NO_FLUSH:Mh,Z_PARTIAL_FLUSH:Nh,Z_FULL_FLUSH:Ph,Z_FINISH:Fh,Z_BLOCK:Ih,Z_OK:Lh,Z_STREAM_END:Rh,Z_STREAM_ERROR:zh,Z_DATA_ERROR:Bh,Z_BUF_ERROR:Vh,Z_DEFAULT_COMPRESSION:Hh,Z_FILTERED:Uh,Z_HUFFMAN_ONLY:Wh,Z_RLE:Gh,Z_FIXED:Kh,Z_DEFAULT_STRATEGY:qh,Z_UNKNOWN:Jh,Z_DEFLATED:Yh}=Eh,Xh=9,Zh=15,Qh=8,$h=286,eg=30,tg=19,ng=2*$h+1,rg=15,ig=3,ag=258,og=ag+ig+1,sg=32,cg=42,lg=57,ug=69,dg=73,fg=91,pg=103,mg=113,hg=666,gg=1,_g=2,vg=3,yg=4,bg=3,xg=(e,t)=>(e.msg=Th[t],t),Sg=e=>e*2-(e>4?9:0),Cg=e=>{let t=e.length;for(;--t>=0;)e[t]=0},wg=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=i?n-i:0;while(--t);t=i,r=t;do n=e.prev[--r],e.prev[r]=n>=i?n-i:0;while(--t)},Tg=(e,t,n)=>(t<{let t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,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))},Dg=(e,t)=>{kh(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Eg(e.strm)},Og=(e,t)=>{e.pending_buf[e.pending++]=t},kg=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},Ag=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),e.state.wrap===1?e.adler=Sh(e.adler,t,i,n):e.state.wrap===2&&(e.adler=wh(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},jg=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,a,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-og?e.strstart-(e.w_size-og):0,l=e.window,u=e.w_mask,d=e.prev,f=e.strstart+ag,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])continue;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]&&ro){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},Mg=e=>{let t=e.w_size,n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-og)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),wg(e),r+=t),e.strm.avail_in===0)break;if(n=Ag(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=ig)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Tg(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Tg(e,e.ins_h,e.window[i+ig-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,a,o=0,s=e.strm.avail_in;do{if(r=65535,a=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(r=i+e.strm.avail_in),r>a&&(r=a),r>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,Eg(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(Ag(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(o===0);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_watera&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,a+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),a>e.strm.avail_in&&(a=e.strm.avail_in),a&&(Ag(e.strm,e.window,e.strstart,a),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.high_water>3,a=e.pending_buf_size-a>65535?65535:e.pending_buf_size-a,n=a>e.w_size?e.w_size:a,i=e.strstart-e.block_start,(i>=n||(i||t===Fh)&&t!==Mh&&e.strm.avail_in===0&&i<=a)&&(r=i>a?a:i,o=t===Fh&&e.strm.avail_in===0&&r===i?1:0,Oh(e,e.block_start,r,o),e.block_start+=r,Eg(e.strm)),o?vg:gg)},Pg=(e,t)=>{let n,r;for(;;){if(e.lookahead=ig&&(e.ins_h=Tg(e,e.ins_h,e.window[e.strstart+ig-1]),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-og&&(e.match_length=jg(e,n)),e.match_length>=ig)if(r=Ah(e,e.strstart-e.match_start,e.match_length-ig),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=ig){e.match_length--;do e.strstart++,e.ins_h=Tg(e,e.ins_h,e.window[e.strstart+ig-1]),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=Tg(e,e.ins_h,e.window[e.strstart+1]);else r=Ah(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Dg(e,!1),e.strm.avail_out===0))return gg}return e.insert=e.strstart{let n,r,i;for(;;){if(e.lookahead=ig&&(e.ins_h=Tg(e,e.ins_h,e.window[e.strstart+ig-1]),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=ig-1,n!==0&&e.prev_length4096)&&(e.match_length=ig-1)),e.prev_length>=ig&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-ig,r=Ah(e,e.strstart-1-e.prev_match,e.prev_length-ig),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=Tg(e,e.ins_h,e.window[e.strstart+ig-1]),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=ig-1,e.strstart++,r&&(Dg(e,!1),e.strm.avail_out===0))return gg}else if(e.match_available){if(r=Ah(e,0,e.window[e.strstart-1]),r&&Dg(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return gg}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&=(r=Ah(e,0,e.window[e.strstart-1]),0),e.insert=e.strstart{let n,r,i,a,o=e.window;for(;;){if(e.lookahead<=ag){if(Mg(e),e.lookahead<=ag&&t===Mh)return gg;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=ig&&e.strstart>0&&(i=e.strstart-1,r=o[i],r===o[++i]&&r===o[++i]&&r===o[++i])){a=e.strstart+ag;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]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=ig?(n=Ah(e,1,e.match_length-ig),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Ah(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Dg(e,!1),e.strm.avail_out===0))return gg}return e.insert=0,t===Fh?(Dg(e,!0),e.strm.avail_out===0?vg:yg):e.sym_next&&(Dg(e,!1),e.strm.avail_out===0)?gg:_g},Lg=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(Mg(e),e.lookahead===0)){if(t===Mh)return gg;break}if(e.match_length=0,n=Ah(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Dg(e,!1),e.strm.avail_out===0))return gg}return e.insert=0,t===Fh?(Dg(e,!0),e.strm.avail_out===0?vg:yg):e.sym_next&&(Dg(e,!1),e.strm.avail_out===0)?gg:_g};function Rg(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 zg=[new Rg(0,0,0,0,Ng),new Rg(4,4,8,4,Pg),new Rg(4,5,16,8,Pg),new Rg(4,6,32,32,Pg),new Rg(4,4,16,16,Fg),new Rg(8,16,32,32,Fg),new Rg(8,16,128,128,Fg),new Rg(8,32,128,256,Fg),new Rg(32,128,258,1024,Fg),new Rg(32,258,258,4096,Fg)],Bg=e=>{e.window_size=2*e.w_size,Cg(e.head),e.max_lazy_match=zg[e.level].max_lazy,e.good_match=zg[e.level].good_length,e.nice_match=zg[e.level].nice_length,e.max_chain_length=zg[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=ig-1,e.match_available=0,e.ins_h=0};function Vg(){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=Yh,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 Uint16Array(ng*2),this.dyn_dtree=new Uint16Array((2*eg+1)*2),this.bl_tree=new Uint16Array((2*tg+1)*2),Cg(this.dyn_ltree),Cg(this.dyn_dtree),Cg(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(rg+1),this.heap=new Uint16Array(2*$h+1),Cg(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*$h+1),Cg(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var Hg=e=>{if(!e)return 1;let t=e.state;return!t||t.strm!==e||t.status!==cg&&t.status!==lg&&t.status!==ug&&t.status!==dg&&t.status!==fg&&t.status!==pg&&t.status!==mg&&t.status!==hg?1:0},Ug=e=>{if(Hg(e))return xg(e,zh);e.total_in=e.total_out=0,e.data_type=Jh;let t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?lg:t.wrap?cg:mg,e.adler=t.wrap===2?0:1,t.last_flush=-2,Dh(t),Lh},Wg=e=>{let t=Ug(e);return t===Lh&&Bg(e.state),t},Gg=(e,t)=>Hg(e)||e.state.wrap!==2?zh:(e.state.gzhead=t,Lh),Kg=(e,t,n,r,i,a)=>{if(!e)return zh;let o=1;if(t===Hh&&(t=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),i<1||i>Xh||n!==Yh||r<8||r>15||t<0||t>9||a<0||a>Kh||r===8&&o!==1)return xg(e,zh);r===8&&(r=9);let s=new Vg;return e.state=s,s.strm=e,s.status=cg,s.wrap=o,s.gzhead=null,s.w_bits=r,s.w_size=1<Kg(e,t,Yh,Zh,Qh,qh),deflateInit2:Kg,deflateReset:Wg,deflateResetKeep:Ug,deflateSetHeader:Gg,deflate:(e,t)=>{if(Hg(e)||t>Ih||t<0)return e?xg(e,zh):zh;let n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===hg&&t!==Fh)return xg(e,e.avail_out===0?Vh:zh);let r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(Eg(e),e.avail_out===0)return n.last_flush=-1,Lh}else if(e.avail_in===0&&Sg(t)<=Sg(r)&&t!==Fh)return xg(e,Vh);if(n.status===hg&&e.avail_in!==0)return xg(e,Vh);if(n.status===cg&&n.wrap===0&&(n.status=mg),n.status===cg){let t=Yh+(n.w_bits-8<<4)<<8,r=-1;if(r=n.strategy>=Wh||n.level<2?0:n.level<6?1:n.level===6?2:3,t|=r<<6,n.strstart!==0&&(t|=sg),t+=31-t%31,kg(n,t),n.strstart!==0&&(kg(n,e.adler>>>16),kg(n,e.adler&65535)),e.adler=1,n.status=mg,Eg(e),n.pending!==0)return n.last_flush=-1,Lh}if(n.status===lg){if(e.adler=0,Og(n,31),Og(n,139),Og(n,8),n.gzhead)Og(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Og(n,n.gzhead.time&255),Og(n,n.gzhead.time>>8&255),Og(n,n.gzhead.time>>16&255),Og(n,n.gzhead.time>>24&255),Og(n,n.level===9?2:n.strategy>=Wh||n.level<2?4:0),Og(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(Og(n,n.gzhead.extra.length&255),Og(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=wh(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=ug;else if(Og(n,0),Og(n,0),Og(n,0),Og(n,0),Og(n,0),Og(n,n.level===9?2:n.strategy>=Wh||n.level<2?4:0),Og(n,bg),n.status=mg,Eg(e),n.pending!==0)return n.last_flush=-1,Lh}if(n.status===ug){if(n.gzhead.extra){let t=n.pending,r=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+r>n.pending_buf_size;){let i=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>t&&(e.adler=wh(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex+=i,Eg(e),n.pending!==0)return n.last_flush=-1,Lh;t=0,r-=i}let i=new Uint8Array(n.gzhead.extra);n.pending_buf.set(i.subarray(n.gzindex,n.gzindex+r),n.pending),n.pending+=r,n.gzhead.hcrc&&n.pending>t&&(e.adler=wh(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=dg}if(n.status===dg){if(n.gzhead.name){let t=n.pending,r;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>t&&(e.adler=wh(e.adler,n.pending_buf,n.pending-t,t)),Eg(e),n.pending!==0)return n.last_flush=-1,Lh;t=0}r=n.gzindext&&(e.adler=wh(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=fg}if(n.status===fg){if(n.gzhead.comment){let t=n.pending,r;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>t&&(e.adler=wh(e.adler,n.pending_buf,n.pending-t,t)),Eg(e),n.pending!==0)return n.last_flush=-1,Lh;t=0}r=n.gzindext&&(e.adler=wh(e.adler,n.pending_buf,n.pending-t,t))}n.status=pg}if(n.status===pg){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Eg(e),n.pending!==0))return n.last_flush=-1,Lh;Og(n,e.adler&255),Og(n,e.adler>>8&255),e.adler=0}if(n.status=mg,Eg(e),n.pending!==0)return n.last_flush=-1,Lh}if(e.avail_in!==0||n.lookahead!==0||t!==Mh&&n.status!==hg){let r=n.level===0?Ng(n,t):n.strategy===Wh?Lg(n,t):n.strategy===Gh?Ig(n,t):zg[n.level].func(n,t);if((r===vg||r===yg)&&(n.status=hg),r===gg||r===vg)return e.avail_out===0&&(n.last_flush=-1),Lh;if(r===_g&&(t===Nh?jh(n):t!==Ih&&(Oh(n,0,0,!1),t===Ph&&(Cg(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),Eg(e),e.avail_out===0))return n.last_flush=-1,Lh}return t===Fh?n.wrap<=0?Rh:(n.wrap===2?(Og(n,e.adler&255),Og(n,e.adler>>8&255),Og(n,e.adler>>16&255),Og(n,e.adler>>24&255),Og(n,e.total_in&255),Og(n,e.total_in>>8&255),Og(n,e.total_in>>16&255),Og(n,e.total_in>>24&255)):(kg(n,e.adler>>>16),kg(n,e.adler&65535)),Eg(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending===0?Rh:Lh):Lh},deflateEnd:e=>{if(Hg(e))return zh;let t=e.state.status;return e.state=null,t===mg?xg(e,Bh):Lh},deflateSetDictionary:(e,t)=>{let n=t.length;if(Hg(e))return zh;let r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==cg||r.lookahead)return zh;if(i===1&&(e.adler=Sh(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(Cg(r.head),r.strstart=0,r.block_start=0,r.insert=0);let e=new Uint8Array(r.w_size);e.set(t.subarray(n-r.w_size,n),0),t=e,n=r.w_size}let a=e.avail_in,o=e.next_in,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,Mg(r);r.lookahead>=ig;){let e=r.strstart,t=r.lookahead-(ig-1);do r.ins_h=Tg(r,r.ins_h,r.window[e+ig-1]),r.prev[e&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=e,e++;while(--t);r.strstart=e,r.lookahead=ig-1,Mg(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=ig-1,r.match_available=0,e.next_in=o,e.input=s,e.avail_in=a,r.wrap=i,Lh},deflateInfo:`pako deflate (from Nodeca project)`},Jg=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Yg={assign:function(e){let t=Array.prototype.slice.call(arguments,1);for(;t.length;){let n=t.shift();if(n){if(typeof n!=`object`)throw TypeError(n+`must be non-object`);for(let t in n)Jg(n,t)&&(e[t]=n[t])}}return e},flattenChunks:e=>{let t=0;for(let n=0,r=e.length;n=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Zg[254]=Zg[254]=1;var Qg=e=>{if(typeof TextEncoder==`function`&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,a,o=e.length,s=0;for(i=0;i>>6,t[a++]=128|n&63):n<65536?(t[a++]=224|n>>>12,t[a++]=128|n>>>6&63,t[a++]=128|n&63):(t[a++]=240|n>>>18,t[a++]=128|n>>>12&63,t[a++]=128|n>>>6&63,t[a++]=128|n&63);return t},$g=(e,t)=>{if(t<65534&&e.subarray&&Xg)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n=``;for(let r=0;r{let n=t||e.length;if(typeof TextDecoder==`function`&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i,a=Array(n*2);for(i=0,r=0;r4){a[i++]=65533,r+=o-1;continue}for(t&=o===2?31:o===3?15:7;o>1&&r1){a[i++]=65533;continue}t<65536?a[i++]=t:(t-=65536,a[i++]=55296|t>>10&1023,a[i++]=56320|t&1023)}return $g(a,i)},utf8border:(e,t)=>{t||=e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)==128;)n--;return n<0||n===0?t:n+Zg[e[n]]>t?n:t}};function t_(){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}var n_=t_,r_=Object.prototype.toString,{Z_NO_FLUSH:i_,Z_SYNC_FLUSH:a_,Z_FULL_FLUSH:o_,Z_FINISH:s_,Z_OK:c_,Z_STREAM_END:l_,Z_DEFAULT_COMPRESSION:u_,Z_DEFAULT_STRATEGY:d_,Z_DEFLATED:f_}=Eh;function p_(e){this.options=Yg.assign({level:u_,method:f_,chunkSize:16384,windowBits:15,memLevel:8,strategy:d_},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg=``,this.ended=!1,this.chunks=[],this.strm=new n_,this.strm.avail_out=0;let n=qg.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==c_)throw Error(Th[n]);if(t.header&&qg.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e=typeof t.dictionary==`string`?e_.string2buf(t.dictionary):r_.call(t.dictionary)===`[object ArrayBuffer]`?new Uint8Array(t.dictionary):t.dictionary,n=qg.deflateSetDictionary(this.strm,e),n!==c_)throw Error(Th[n]);this._dict_set=!0}}p_.prototype.push=function(e,t){let n=this.strm,r=this.options.chunkSize,i,a;if(this.ended)return!1;for(a=t===~~t?t:t===!0?s_:i_,typeof e==`string`?n.input=e_.string2buf(e):r_.call(e)===`[object ArrayBuffer]`?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(a===a_||a===o_)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=qg.deflate(n,a),i===l_)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=qg.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===c_;if(n.avail_out===0){this.onData(n.output);continue}if(a>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0},p_.prototype.onData=function(e){this.chunks.push(e)},p_.prototype.onEnd=function(e){e===c_&&(this.result=Yg.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function m_(e,t){let n=new p_(t);if(n.push(e,!0),n.err)throw n.msg||Th[n.err];return n.result}function h_(e,t){return t||={},t.raw=!0,m_(e,t)}function g_(e,t){return t||={},t.gzip=!0,m_(e,t)}var __={Deflate:p_,deflate:m_,deflateRaw:h_,gzip:g_,constants:Eh},v_=16209,y_=16191,b_=function(e,t){let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E=e.state;n=e.next_in,w=e.input,r=n+(e.avail_in-5),i=e.next_out,T=e.output,a=i-(t-e.avail_out),o=i+(e.avail_out-257),s=E.dmax,c=E.wsize,l=E.whave,u=E.wnext,d=E.window,f=E.hold,p=E.bits,m=E.lencode,h=E.distcode,g=(1<>>24,f>>>=y,p-=y,y=v>>>16&255,y===0)T[i++]=v&65535;else if(y&16){b=v&65535,y&=15,y&&(p>>=y,p-=y),p<15&&(f+=w[n++]<>>24,f>>>=y,p-=y,y=v>>>16&255,y&16){if(x=v&65535,y&=15,ps){e.msg=`invalid distance too far back`,E.mode=v_;break top}if(f>>>=y,p-=y,y=i-a,x>y){if(y=x-y,y>l&&E.sane){e.msg=`invalid distance too far back`,E.mode=v_;break top}if(S=0,C=d,u===0){if(S+=c-y,y2;)T[i++]=C[S++],T[i++]=C[S++],T[i++]=C[S++],b-=3;b&&(T[i++]=C[S++],b>1&&(T[i++]=C[S++]))}else{S=i-x;do T[i++]=T[S++],T[i++]=T[S++],T[i++]=T[S++],b-=3;while(b>2);b&&(T[i++]=T[S++],b>1&&(T[i++]=T[S++]))}}else if(y&64){e.msg=`invalid distance code`,E.mode=v_;break top}else{v=h[(v&65535)+(f&(1<>3,n-=b,p-=b<<3,f&=(1<{let 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,E=new Uint16Array(x_+1),D=new Uint16Array(x_+1),O=null,k,A,j;for(l=0;l<=x_;l++)E[l]=0;for(u=0;u=1&&E[f]===0;f--);if(p>f&&(p=f),f===0)return i[a++]=20971520,i[a++]=20971520,s.bits=1,0;for(d=1;d0&&(e===w_||f!==1))return-1;for(D[1]=0,l=1;lS_||e===E_&&_>C_)return 1;for(;;){k=l-h,o[u]+1=T?(A=O[o[u]-T],j=w[o[u]-T]):(A=96,j=0),y=1<>h)+b]=k<<24|A<<16|j|0;while(b!==0);for(y=1<>=1;if(y===0?v=0:(v&=y-1,v+=y),u++,--E[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<S_||e===E_&&_>C_)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},M_=0,N_=1,P_=2,{Z_FINISH:F_,Z_BLOCK:I_,Z_TREES:L_,Z_OK:R_,Z_STREAM_END:z_,Z_NEED_DICT:B_,Z_STREAM_ERROR:V_,Z_DATA_ERROR:H_,Z_MEM_ERROR:U_,Z_BUF_ERROR:W_,Z_DEFLATED:G_}=Eh,K_=16180,q_=16181,J_=16182,Y_=16183,X_=16184,Z_=16185,Q_=16186,$_=16187,ev=16188,tv=16189,nv=16190,rv=16191,iv=16192,av=16193,ov=16194,sv=16195,cv=16196,lv=16197,uv=16198,dv=16199,fv=16200,pv=16201,mv=16202,hv=16203,gv=16204,_v=16205,vv=16206,yv=16207,bv=16208,xv=16209,Sv=16210,Cv=16211,wv=852,Tv=592,Ev=15,Dv=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function Ov(){this.strm=null,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 Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var kv=e=>{if(!e)return 1;let t=e.state;return!t||t.strm!==e||t.modeCv?1:0},Av=e=>{if(kv(e))return V_;let t=e.state;return e.total_in=e.total_out=t.total=0,e.msg=``,t.wrap&&(e.adler=t.wrap&1),t.mode=K_,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(wv),t.distcode=t.distdyn=new Int32Array(Tv),t.sane=1,t.back=-1,R_},jv=e=>{if(kv(e))return V_;let t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Av(e)},Mv=(e,t)=>{let n;if(kv(e))return V_;let r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?V_:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,jv(e))},Nv=(e,t)=>{if(!e)return V_;let n=new Ov;e.state=n,n.strm=e,n.window=null,n.mode=K_;let r=Mv(e,t);return r!==R_&&(e.state=null),r},Pv=e=>Nv(e,Ev),Fv=!0,Iv,Lv,Rv=e=>{if(Fv){Iv=new Int32Array(512),Lv=new Int32Array(32);let t=0;for(;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(j_(N_,e.lens,0,288,Iv,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;j_(P_,e.lens,0,32,Lv,0,e.work,{bits:5}),Fv=!1}e.lencode=Iv,e.lenbits=9,e.distcode=Lv,e.distbits=5},zv=(e,t,n,r)=>{let i,a=e.state;return a.window===null&&(a.wsize=1<=a.wsize?(a.window.set(t.subarray(n-a.wsize,n),0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>r&&(i=r),a.window.set(t.subarray(n-r,n-r+i),a.wnext),r-=i,r?(a.window.set(t.subarray(n-r,n),0),a.wnext=r,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave{let 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 Uint8Array(4),E,D,O=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(kv(e)||!e.output||!e.input&&e.avail_in!==0)return V_;n=e.state,n.mode===rv&&(n.mode=iv),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=R_;inf_leave:for(;;)switch(n.mode){case K_:if(n.wrap===0){n.mode=iv;break}for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<>>8&255,n.check=wh(n.check,T,2,0),l=0,u=0,n.mode=q_;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((l&255)<<8)+(l>>8))%31){e.msg=`incorrect header check`,n.mode=xv;break}if((l&15)!==G_){e.msg=`unknown compression method`,n.mode=xv;break}if(l>>>=4,u-=4,C=(l&15)+8,n.wbits===0&&(n.wbits=C),C>15||C>n.wbits){e.msg=`invalid window size`,n.mode=xv;break}n.dmax=1<>8&1),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,n.check=wh(n.check,T,2,0)),l=0,u=0,n.mode=J_;case J_:for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<>>8&255,T[2]=l>>>16&255,T[3]=l>>>24&255,n.check=wh(n.check,T,4,0)),l=0,u=0,n.mode=Y_;case Y_:for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<>8),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,n.check=wh(n.check,T,2,0)),l=0,u=0,n.mode=X_;case X_:if(n.flags&1024){for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<>>8&255,n.check=wh(n.check,T,2,0)),l=0,u=0}else n.head&&(n.head.extra=null);n.mode=Z_;case Z_: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=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(a,a+p),C)),n.flags&512&&n.wrap&4&&(n.check=wh(n.check,r,p,a)),s-=p,a+=p,n.length-=p),n.length))break inf_leave;n.length=0,n.mode=Q_;case Q_: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>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=rv;break;case tv:for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<>>=u&7,u-=u&7,n.mode=vv;break}for(;u<3;){if(s===0)break inf_leave;s--,l+=r[a++]<>>=1,--u,l&3){case 0:n.mode=av;break;case 1:if(Rv(n),n.mode=dv,t===L_){l>>>=2,u-=2;break inf_leave}break;case 2:n.mode=cv;break;case 3:e.msg=`invalid block type`,n.mode=xv}l>>>=2,u-=2;break;case av:for(l>>>=u&7,u-=u&7;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<>>16^65535)){e.msg=`invalid stored block lengths`,n.mode=xv;break}if(n.length=l&65535,l=0,u=0,n.mode=ov,t===L_)break inf_leave;case ov:n.mode=sv;case sv:if(p=n.length,p){if(p>s&&(p=s),p>c&&(p=c),p===0)break inf_leave;i.set(r.subarray(a,a+p),o),s-=p,a+=p,c-=p,o+=p,n.length-=p;break}n.mode=rv;break;case cv:for(;u<14;){if(s===0)break inf_leave;s--,l+=r[a++]<>>=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=xv;break}n.have=0,n.mode=lv;case lv:for(;n.have>>=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=j_(M_,n.lens,0,19,n.lencode,0,n.work,E),n.lenbits=E.bits,w){e.msg=`invalid code lengths set`,n.mode=xv;break}n.have=0,n.mode=uv;case uv:for(;n.have>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<>>=_,u-=_,n.lens[n.have++]=y;else{if(y===16){for(D=_+2;u>>=_,u-=_,n.have===0){e.msg=`invalid bit length repeat`,n.mode=xv;break}C=n.lens[n.have-1],p=3+(l&3),l>>>=2,u-=2}else if(y===17){for(D=_+3;u>>=_,u-=_,C=0,p=3+(l&7),l>>>=3,u-=3}else{for(D=_+7;u>>=_,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=xv;break}for(;p--;)n.lens[n.have++]=C}}if(n.mode===xv)break;if(n.lens[256]===0){e.msg=`invalid code -- missing end-of-block`,n.mode=xv;break}if(n.lenbits=9,E={bits:n.lenbits},w=j_(N_,n.lens,0,n.nlen,n.lencode,0,n.work,E),n.lenbits=E.bits,w){e.msg=`invalid literal/lengths set`,n.mode=xv;break}if(n.distbits=6,n.distcode=n.distdyn,E={bits:n.distbits},w=j_(P_,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,E),n.distbits=E.bits,w){e.msg=`invalid distances set`,n.mode=xv;break}if(n.mode=dv,t===L_)break inf_leave;case dv:n.mode=fv;case fv: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,b_(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===rv&&(n.back=-1);break}for(n.back=0;g=n.lencode[l&(1<>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<>b)],_=g>>>24,v=g>>>16&255,y=g&65535,!(b+_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<>>=b,u-=b,n.back+=b}if(l>>>=_,u-=_,n.back+=_,n.length=y,v===0){n.mode=_v;break}if(v&32){n.back=-1,n.mode=rv;break}if(v&64){e.msg=`invalid literal/length code`,n.mode=xv;break}n.extra=v&15,n.mode=pv;case pv:if(n.extra){for(D=n.extra;u>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=mv;case mv:for(;g=n.distcode[l&(1<>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<>b)],_=g>>>24,v=g>>>16&255,y=g&65535,!(b+_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<>>=b,u-=b,n.back+=b}if(l>>>=_,u-=_,n.back+=_,v&64){e.msg=`invalid distance code`,n.mode=xv;break}n.offset=y,n.extra=v&15,n.mode=hv;case hv:if(n.extra){for(D=n.extra;u>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg=`invalid distance too far back`,n.mode=xv;break}n.mode=gv;case gv: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=xv;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=fv);break;case _v:if(c===0)break inf_leave;i[o++]=n.length,c--,n.mode=fv;break;case vv:if(n.wrap){for(;u<32;){if(s===0)break inf_leave;s--,l|=r[a++]<{if(kv(e))return V_;let t=e.state;return t.window&&=null,e.state=null,R_},inflateGetHeader:(e,t)=>{if(kv(e))return V_;let n=e.state;return n.wrap&2?(n.head=t,t.done=!1,R_):V_},inflateSetDictionary:(e,t)=>{let n=t.length,r,i,a;return kv(e)||(r=e.state,r.wrap!==0&&r.mode!==nv)?V_:r.mode===nv&&(i=1,i=Sh(i,t,n,0),i!==r.check)?H_:(a=zv(e,t,n,n),a?(r.mode=Sv,U_):(r.havedict=1,R_))},inflateInfo:`pako inflate (from Nodeca project)`};function Vv(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name=``,this.comment=``,this.hcrc=0,this.done=!1}var Hv=Vv,Uv=Object.prototype.toString,{Z_NO_FLUSH:Wv,Z_FINISH:Gv,Z_OK:Kv,Z_STREAM_END:qv,Z_NEED_DICT:Jv,Z_STREAM_ERROR:Yv,Z_DATA_ERROR:Xv,Z_MEM_ERROR:Zv}=Eh;function Qv(e){this.options=Yg.assign({chunkSize:1024*64,windowBits:15,to:``},e||{});let t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg=``,this.ended=!1,this.chunks=[],this.strm=new n_,this.strm.avail_out=0;let n=Bv.inflateInit2(this.strm,t.windowBits);if(n!==Kv||(this.header=new Hv,Bv.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary==`string`?t.dictionary=e_.string2buf(t.dictionary):Uv.call(t.dictionary)===`[object ArrayBuffer]`&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=Bv.inflateSetDictionary(this.strm,t.dictionary),n!==Kv))))throw Error(Th[n])}Qv.prototype.push=function(e,t){let n=this.strm,r=this.options.chunkSize,i=this.options.dictionary,a,o,s;if(this.ended)return!1;for(o=t===~~t?t:t===!0?Gv:Wv,Uv.call(e)===`[object ArrayBuffer]`?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),a=Bv.inflate(n,o),a===Jv&&i&&(a=Bv.inflateSetDictionary(n,i),a===Kv?a=Bv.inflate(n,o):a===Xv&&(a=Jv));n.avail_in>0&&a===qv&&n.state.wrap>0&&e[n.next_in]!==0;)Bv.inflateReset(n),a=Bv.inflate(n,o);switch(a){case Yv:case Xv:case Jv:case Zv:return this.onEnd(a),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(n.avail_out===0||a===qv))if(this.options.to===`string`){let e=e_.utf8border(n.output,n.next_out),t=n.next_out-e,i=e_.buf2string(n.output,e);n.next_out=t,n.avail_out=r-t,t&&n.output.set(n.output.subarray(e,e+t),0),this.onData(i)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(a===Kv&&s===0)){if(a===qv)return a=Bv.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(n.avail_in===0)break}}return!0},Qv.prototype.onData=function(e){this.chunks.push(e)},Qv.prototype.onEnd=function(e){e===Kv&&(this.options.to===`string`?this.result=this.chunks.join(``):this.result=Yg.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function $v(e,t){let n=new Qv(t);if(n.push(e),n.err)throw n.msg||Th[n.err];return n.result}function ey(e,t){return t||={},t.raw=!0,$v(e,t)}var ty={Inflate:Qv,inflate:$v,inflateRaw:ey,ungzip:$v,constants:Eh},{Deflate:ny,deflate:ry,deflateRaw:iy,gzip:ay}=__,{Inflate:oy,inflate:sy,inflateRaw:cy,ungzip:ly}=ty,uy=ay;function dy(e){if(typeof window<`u`&&typeof window.btoa==`function`){let t=``;for(let n=0;ne.hash);for(;t.length>1;){let e=[];for(let n=0;ne.pulse),0)}}async function ky(e){let t=JSON.stringify(e);return{v:1,codec:`gzip+base64`,payload:fy(new TextEncoder().encode(t))}}const Ay={async publish(e){return{headCid:``}}};async function jy(e){let{ipfs:t=Ay,packedLedgerBytes:n,prevCid:r,sign:i,pubKeyJwk:a,merkleRoot:o,pulse:s}=e,{headCid:c}=await t.publish(n).catch(()=>({headCid:``})),l=``;return c&&i&&(l=My(await i(new TextEncoder().encode(`${c}|${o}|${s}`)))),{headCid:c,prevCid:r,merkleRoot:o,pulse:s,headSig:l,pubKeyJwk:a}}function My(e){let t=``,n=32768;for(let r=0;r{let t=(e||``).toLowerCase().replace(/\s+/g,` `).trim();return t===`root`?`Root`:t===`sacral`?`Sacral`:t===`solar plexus`||t===`solarplexus`?`Solar Plexus`:t===`heart`?`Heart`:t===`throat`?`Throat`:t===`third eye`||t===`thirdeye`||t===`third-eye`?`Third Eye`:`Crown`};async function Iy(e){let{canon:t,hashMode:n,chakraGate:r,kaiSignature:i,userPhiKey:a,origin:o,title:s,weekdayResolved:c,valuationSource:l,mintSeal:u,frequencyHzCurrent:d,creatorResolved:f}=e,p=new Date().toISOString(),m=(n??`moment`)===`moment`,h={v:`1.0`,title:s,creator:f.creator,creatorAlg:f.creatorAlg,creatorId:f.creatorId,pulse:t.pulse,...m?{timestamp:p}:{}},g=Hp(s,300)??`Day Seal: ${t.beat}:${t.stepIndex} • Kai-Pulse ${t.pulse}`,_={v:`1.0`,kaiSignature:i??``,phikey:a??``,pulse:t.pulse,beat:t.beat,stepIndex:t.stepIndex,chakraDay:t.chakraDayKey,chakraGate:r,kaiPulse:t.pulse,stepsPerBeat:t.stepsPerBeat,...m?{timestamp:p}:{},eternalRecord:g,creatorResolved:h.creator,origin:o??(typeof window<`u`?window.location.origin:``),proofHints:{scheme:`groth16-poseidon`,api:`/api/proof/sigil`,explorer:`/keystream/hash/`},zkPoseidonHash:`7110303097080024260800444665787206606103183587082596139871399733998958991511`,zkProof:{pi_a:[`19856134890912647180646267915828904326160277174078581619567068747845749027250`,`10106391353796902212003294779502313309244930326624220933310482777016833544602`,`1`],pi_b:[[`15332824283171511432216330300808558575577774780613056045013182220474274609373`,`520780065640616094309336546820413644814574749252299536726307039414737648361`],[`19765599185680435083316275297102369245623399312670847112193589466041197993879`,`18523858679421850672423367816452968252787306686524085684854491935388533516266`],[`1`,`0`]],pi_c:[`17563530240039003419001811545927065585981558862932312235837455317235418749777`,`8962254954310810065423022980767523639237247171719646270365369937175985524426`,`1`]}},v=dm({v:_.v,kaiSignature:_.kaiSignature,phikey:_.phikey,pulse:_.pulse,beat:_.beat,stepIndex:_.stepIndex,chakraDay:_.chakraDay,chakraGate:_.chakraGate,kaiPulse:_.kaiPulse,stepsPerBeat:_.stepsPerBeat,timestamp:_.timestamp,eternalRecord:_.eternalRecord,creatorResolved:_.creatorResolved,origin:_.origin,proofHints:_.proofHints,zkPoseidonHash:_.zkPoseidonHash,zkProof:_.zkProof,ownerPubKey:_.ownerPubKey?nm(_.ownerPubKey):void 0,ownerSig:_.ownerSig}),y=(await fm(v)).toLowerCase(),b=Array.from(await qp(v)).map(e=>e.toString(16).padStart(2,`0`)).join(``),x=fy(v),S;hy()&&(S=await gy(y));let C={payloadEncoding:`gzip+base64`,payloadHash:{alg:`blake3`,value:y},payloadHashSecondary:{alg:`sha256`,value:b},payloadSignature:S??{alg:`harmonic-sig`,public:a??f.creatorId,value:``}},w=Ny(Kp(dm({parentCanonical:`optional-parent-ref`,parentStateRoot:`optional-state-root`,eventKind:`mint`,pulse:t.pulse,beat:t.beat,stepIndex:t.stepIndex,chakraDay:t.chakraDayKey,childNonce:`${t.beat}-${t.stepIndex}`,amount:`1.000`,expiresAtPulse:t.pulse+12,lineageCommitment:`optional-hash-of-lineage`}))),{publicKeyJwk:T,privateKey:E}=await yy(),D=await by(E,w);_.ownerPubKey=T,_.ownerSig=D;let O=Qf(y,{pulse:t.pulse,beat:t.beat,stepIndex:t.stepIndex,chakraDay:Fy(String(t.chakraDayKey)),stepsPerBeat:t.stepsPerBeat,canonicalHash:y,exportedAt:p,expiresAtPulse:t.pulse+11,kaiSignature:i??void 0,userPhiKey:a??void 0}),k=await Oy([{v:1,pulse:t.pulse,beat:t.beat,stepIndex:t.stepIndex,chakraDay:t.chakraDayKey,stepsPerBeat:t.stepsPerBeat,kaiSignature:i??void 0,userPhiKey:a??void 0,ts:p}]),A=await ky(k),j=await jy({ipfs:Ay,packedLedgerBytes:em(A.payload),prevCid:void 0,pubKeyJwk:_.ownerPubKey,merkleRoot:k.root,pulse:t.pulse,sign:async e=>{let t=Ny(e),n=Py(E),r=await crypto.subtle.sign(n,E,t);return new Uint8Array(r)}}),M={$schema:`https://atlantean.lumitech/schemas/kai-sigil/1.0.json`,contentType:`application/vnd.kai-sigil+json;v=1`,header:{...h,shareUrl:O},payload:x,integrity:C,frequencyHzAtMint:d,valuationSource:l??null,valuationSeal:u??null},N=v.length,P=$p(v).toString(16).padStart(8,`0`),F=Yp(Qp(y)),I=f.creatorId.slice(0,12),L=String(_.zkPoseidonHash).slice(0,12);return{parityUrl:O,payloadHashHex:y,innerRingText:[`u=${O}`,`b58=${F}`,`len=${N}`,`crc32=${P}`,`creator=${I}`,`zk=${L}`,`alg=${f.creatorAlg}`].join(` · `),sigilUrl:O,hashB58:F,embeddedBase:{...M,ledger:A,dht:j,weekdayResolved:c??null}}}function Ly(e){return JSON.stringify(e)}function Ry(e,t){let n=e=>{if(typeof window>`u`||typeof window.btoa!=`function`)throw Error(`Base64 encoding unavailable in this environment`);let t=encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)));return window.btoa(t)};return{toDataURL:()=>{let t=e.current;if(!t)throw Error(`SVG not mounted`);return`data:image/svg+xml;base64,${n(new XMLSerializer().serializeToString(t))}`},async exportBlob(n=`image/svg+xml`,r=2){let i=e.current;if(!i)throw Error(`SVG not mounted`);let a=new XMLSerializer().serializeToString(i);if(n===`image/svg+xml`)return new Blob([a],{type:n});let o=URL.createObjectURL(new Blob([a],{type:`image/svg+xml`}));try{let e=new Image,n=Math.round((t??240)*r);e.decoding=`async`,e.src=o,await e.decode();let i=document.createElement(`canvas`);i.width=n,i.height=n;let a=i.getContext(`2d`);if(!a)throw Error(`Canvas 2D context not available`);return a.drawImage(e,0,0,n,n),await new Promise((e,t)=>{i.toBlob(n=>n?e(n):t(Error(`Canvas toBlob failed`)),`image/png`)})}finally{URL.revokeObjectURL(o)}},async verifySvgHash(t){let n=e.current;if(!n)throw Error(`SVG not mounted`);let r=n.cloneNode(!0);r.removeAttribute(`data-svg-hash`),r.removeAttribute(`data-svg-valid`);let i=Gp(await qp(new XMLSerializer().serializeToString(r)));if(i!==t.toLowerCase())throw Error(`SVG HASH MISMATCH (${i} != ${t})`);return i}}}var zy=({uid:e,hue:t,visualClamped:n,doAnim:r,quality:i,dpr:a,seed:o,payloadHashHex:s,auraPath:c})=>{let l=`${e}-halo`,u=`${e}-glow`,d=`${e}-bloom`,f=`${e}-mask`,p=`${e}-net`,m=`${e}-warp`;return(0,W.jsxs)(`defs`,{children:[(0,W.jsx)(`path`,{id:`${e}-aura`,d:c}),(0,W.jsxs)(`radialGradient`,{id:l,cx:`50%`,cy:`50%`,r:`50%`,children:[(0,W.jsx)(`stop`,{offset:`0%`,stopColor:kp(t,100,50+15*Math.sin(n*2*Math.PI)),stopOpacity:`.55`,children:r&&i!==`low`&&(0,W.jsx)(`animate`,{attributeName:`stop-opacity`,values:`.35;.75;.35`,dur:`var(--dur)`,begin:`var(--off)`,repeatCount:`indefinite`})}),(0,W.jsx)(`stop`,{offset:`100%`,stopColor:`#000`,stopOpacity:`0`})]}),i!==`low`&&a>1&&(0,W.jsxs)(`filter`,{id:u,x:`-30%`,y:`-30%`,width:`160%`,height:`160%`,children:[(0,W.jsx)(`feGaussianBlur`,{stdDeviation:`2.2`,result:`b`}),(0,W.jsxs)(`feMerge`,{children:[(0,W.jsx)(`feMergeNode`,{in:`b`}),(0,W.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]}),i===`ultra`&&(0,W.jsxs)(`filter`,{id:d,x:`-50%`,y:`-50%`,width:`200%`,height:`200%`,children:[(0,W.jsx)(`feGaussianBlur`,{stdDeviation:`6`,result:`u`}),(0,W.jsx)(`feBlend`,{in:`SourceGraphic`,in2:`u`,mode:`screen`})]}),(0,W.jsx)(`mask`,{id:f,children:(0,W.jsx)(`rect`,{width:`100%`,height:`100%`,fill:`white`})}),(0,W.jsx)(`pattern`,{id:p,patternUnits:`userSpaceOnUse`,width:`160`,height:`160`,patternTransform:`rotate(${o*7%60} 500 500)`,children:(0,W.jsx)(`path`,{d:`M0 80 H160 M80 0 V160 M160 0 L0 160 M0 0 L160 160`,stroke:`#00FFD0`,strokeOpacity:`.06`,strokeWidth:`1`})}),(0,W.jsxs)(`filter`,{id:m,x:`-20%`,y:`-20%`,width:`140%`,height:`140%`,children:[(0,W.jsx)(`feTurbulence`,{type:`fractalNoise`,baseFrequency:`0.006`,numOctaves:`2`,seed:o%997+3,result:`noise`}),(0,W.jsx)(`feDisplacementMap`,{in:`SourceGraphic`,in2:`noise`,scale:.35+(s?parseInt(s.slice(-2),16):0)%12*.05,xChannelSelector:`R`,yChannelSelector:`G`})]})]})},By=({uid:e,stateKeyOk:t,embeddedMetaJson:n,klockIsoSnapshot:r,apiSnapshot:i,extraEmbed:a,mintSealJson:o,valuationSourceJson:s,displayStepIndex:c,stepsPerBeat:l,eternalSeal:u,ledgerJson:d,dhtJson:f})=>(0,W.jsxs)(W.Fragment,{children:[t&&n&&(0,W.jsx)(`metadata`,{children:zp(n)}),r&&(0,W.jsx)(`metadata`,{id:`${e}-klock-json`,children:zp(Ip(r))}),i&&(0,W.jsx)(`metadata`,{id:`${e}-kai-api-json`,children:zp(Ip(i))}),u&&(0,W.jsx)(`metadata`,{id:`${e}-eternal-seal`,children:zp(u)}),a&&(0,W.jsx)(`metadata`,{id:`${e}-extra-embed`,children:zp(Ip(a))}),o&&(0,W.jsx)(`metadata`,{id:`${e}-valuation-seal-json`,children:zp(o)}),t&&s&&(0,W.jsx)(`metadata`,{id:`${e}-valuation-source-json`,children:zp(s)}),(0,W.jsx)(`metadata`,{id:`sigil-display`,children:`{"stepIndex":${c},"stepsPerBeat":${l}}`}),t&&n&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`metadata`,{id:`${e}-ledger-json`,children:zp(d)}),(0,W.jsx)(`metadata`,{id:`${e}-dht-json`,children:zp(f)})]})]}),Vy=({uid:e,size:t,baseColor:n,corePath:r,auraId:i,sigPathId:a,doAnim:o,quality:s,dpr:c,pad:l,safeTextWidth:u,outlineWidth:d,strokeCore:f,dotR:p,debugOutline:m,prefersContrast:h,haloId:g,netId:_,warpId:v,glowId:y,maskId:b,rotation:x,chakraSides:S,binaryForRender:C,summary:w,pulse:T})=>(0,W.jsxs)(`g`,{id:`${e}-art`,filter:`url(#${v})`,children:[(0,W.jsx)(`rect`,{width:xp,height:xp,fill:`url(#${g})`,"aria-hidden":`true`,pointerEvents:`none`}),(0,W.jsx)(`rect`,{x:`0`,y:`0`,width:xp,height:xp,fill:`url(#${_})`,pointerEvents:`none`}),(0,W.jsx)(`path`,{d:r,fill:`none`,stroke:n,strokeWidth:f,vectorEffect:`non-scaling-stroke`,strokeLinecap:`round`,strokeLinejoin:`round`,mask:`url(#${b})`,filter:s!==`low`&&c>1?`url(#${y})`:void 0,style:{strokeDasharray:m||h?`4 4`:void 0},"aria-hidden":`true`,pointerEvents:`none`}),(m||h)&&(0,W.jsx)(`path`,{d:r,fill:`none`,stroke:`#00FFD0`,strokeWidth:Math.max(1,f*.45),vectorEffect:`non-scaling-stroke`,opacity:.6,"aria-hidden":!0,pointerEvents:`none`}),s!==`low`&&Array.from({length:S},(e,t)=>{let r=t/S*2*Math.PI+x;return(0,W.jsx)(`circle`,{cx:500+380*Math.cos(r),cy:500+380*Math.sin(r),r:p,fill:n,"aria-hidden":`true`,pointerEvents:`none`},t)}),o&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`use`,{href:`#${i}`,stroke:`#00FFD0`,strokeWidth:Math.max(2,f*1.05),fill:`none`,opacity:`.2`,strokeLinecap:`round`,strokeLinejoin:`round`,vectorEffect:`non-scaling-stroke`,"aria-hidden":`true`,pointerEvents:`none`,children:(0,W.jsx)(`animate`,{attributeName:`stroke-opacity`,values:`.2;.6;.2`,dur:`var(--dur)`,begin:`var(--off)`,repeatCount:`indefinite`})}),(0,W.jsx)(`use`,{href:`#${i}`,stroke:n,strokeWidth:Math.max(1.2,f*.8),fill:`none`,opacity:`.4`,strokeLinecap:`round`,strokeLinejoin:`round`,vectorEffect:`non-scaling-stroke`,"aria-hidden":`true`,pointerEvents:`none`,children:(0,W.jsx)(`animate`,{attributeName:`stroke-opacity`,values:`.4;.9;.4`,dur:`var(--dur)`,begin:`var(--off)`,repeatCount:`indefinite`})})]}),(0,W.jsx)(`circle`,{cx:500,cy:500,r:Math.max(3,p),fill:`#00FFD0`,"aria-hidden":`true`,pointerEvents:`none`,children:o&&(0,W.jsx)(`animateTransform`,{attributeName:`transform`,type:`scale`,values:`1;1.5;1`,dur:`var(--dur)`,begin:`var(--off)`,repeatCount:`indefinite`})}),s!==`low`&&a&&C&&(0,W.jsx)(`g`,{id:`signature`,children:(0,W.jsx)(`text`,{fontFamily:`ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial`,fontSize:Math.max(4,t*.028),fill:n,letterSpacing:`1.2`,textAnchor:`middle`,dominantBaseline:`middle`,opacity:`.7`,pointerEvents:`none`,children:(0,W.jsx)(`textPath`,{href:`#${a}`,startOffset:`50%`,children:C})})}),(0,W.jsxs)(`g`,{id:`signature-hint`,"aria-hidden":`true`,pointerEvents:`none`,children:[(0,W.jsx)(`text`,{x:l,y:t-6,fontFamily:bp,fontSize:Math.max(4,t*.025),fill:n,opacity:`.12`,textAnchor:`start`,lengthAdjust:`spacingAndGlyphs`,textLength:u,style:{paintOrder:`stroke`,stroke:`#000`,strokeWidth:d,fontVariantNumeric:`tabular-nums`,fontFeatureSettings:`'tnum' 1`},children:w}),(0,W.jsx)(`text`,{x:t-l,y:t-l,fontFamily:bp,fontSize:t*.25,fill:n,opacity:`0.04`,textAnchor:`end`,dominantBaseline:`ideographic`,lengthAdjust:`spacingAndGlyphs`,textLength:u,vectorEffect:`non-scaling-stroke`,style:{paintOrder:`stroke`,stroke:`#000`,strokeWidth:d,fontVariantNumeric:`tabular-nums`,fontFeatureSettings:`'tnum' 1`},children:typeof T==`number`?T.toLocaleString?.()??String(T):String(T)})]})]});const Hy=[`Solhara`,`Aquaris`,`Flamora`,`Verdari`,`Sonari`,`Kaelith`],Uy=e=>typeof e==`string`&&Hy.includes(e);function Wy(e){return typeof e==`object`&&!!e}const Gy=e=>e===`low`?`low`:e===`ultra`||e===`high`?`high`:`med`,Ky=e=>e.replace(/^0x/i,``).split(``).map(e=>parseInt(e,16).toString(2).padStart(4,`0`)).join(``);function qy(e,t,n,r){return e?`Eternal Seal • ${e}`:`Day Seal: ${t}:${n} • Kai-Pulse ${r}`}var Jy=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`;function Yy(e){let t=``,n=e.length,r=0;for(;r+2>>18&63]+Jy[n>>>12&63]+Jy[n>>>6&63]+Jy[n&63]}let i=n-r;if(i===1){let n=e[r]<<16;t+=Jy[n>>>18&63]+Jy[n>>>12&63]+`==`}else if(i===2){let n=e[r]<<16|e[r+1]<<8;t+=Jy[n>>>18&63]+Jy[n>>>12&63]+Jy[n>>>6&63]+`=`}return t}function Xy(e){let t=e.replace(/\s+/g,``);if(!/^[A-Za-z0-9+/]*={0,2}$/.test(t)||t.length%4!=0)return new Uint8Array;let n=t.length/4*3-(t.endsWith(`==`)?2:t.endsWith(`=`)?1:0),r=new Uint8Array(n),i=0;for(let e=0;e>>16&255,s>=0&&i>>8&255),c>=0&&ie.replace(/·|\u2022/g,`•`);function Qy(e){if(!e)return``;let t=Zy(e);return Yy(new TextEncoder().encode(t))}function $y(e){if(!e)return``;try{let t=Xy(e);return Zy(new TextDecoder().decode(t))}catch{return``}}function eb(e){let t=`null`;if(!e)return{ledgerJson:t,dhtJson:t};try{let t=JSON.parse(e);return{ledgerJson:JSON.stringify(t.ledger??null),dhtJson:JSON.stringify(t.dht??null)}}catch{return{ledgerJson:t,dhtJson:t}}}function tb(e){let t=Object.entries(e).flatMap(([e,t])=>t==null?[]:[[e,String(t)]]);return Object.fromEntries(t)}function nb(e,t){let n=Fp(e)?JSON.parse(Ip(e)):null,r=Fp(t)?JSON.parse(Ip(t)):null,i=tb(n?Vp(`klock`,n):{}),a=Lp(e,`eternalMonth`),o=Lp(e,`harmonicDay`),s=Rp(e,`kaiPulseEternal`),c=Lp(e,`solarChakraStepString`),l=Lp(e,`chakraArc`);return{klockIsoSnapshot:n,apiSnapshot:r,klockDataAttrs:i,eternalMonth:a,harmonicDay:o,kaiPulseEternal:typeof s==`number`?s:void 0,solarChakraStepString:c,chakraArc:l}}function rb(e,t,n,r,i,a,o){let s=String(n).replace(/\s+/g,`_`),c=[`sig=${t?e??`pending`:`pending`}`,`pulse=${i}`,`beat=${a}`,`day=${s}`,`hz=${r}`];return o&&c.push(`poseidon=${o}`),c.join(` | `)}function ib(e,t,n){return kp((e+(n?parseInt(n.slice(-2),16)%12*2.5:0))%360,100,50+15*Math.sin(t*2*Math.PI))}var ab=(0,C.forwardRef)((e,t)=>{let{id:n,pulse:r,beat:i,stepIndex:a,stepPct:o,chakraDay:s,size:c=240,hashOverride:l,strict:u=!0,quality:d=`high`,animate:f=!0,debugOutline:p=!1,goldenId:m,hashMode:h=`moment`,userPhiKey:g,kaiSignature:_,intentionSigil:v,creatorPublicKey:y,origin:b,onReady:x,onError:S,showZKBadge:w=!0,qrHref:T,klock:E,embed:D}=e,O=Up(r),k=Up(i),A=(0,C.useMemo)(()=>Mp(O),[O]),j=(0,C.useMemo)(()=>Np(O),[O]),M=(0,C.useMemo)(()=>{let e=Up(a,NaN);return(!Number.isFinite(e)||e<0||e>=44)&&(e=A),Math.trunc((e%44+44)%44)},[a,A]),N=(0,C.useMemo)(()=>{let e=Wp(o,NaN);return Number.isFinite(e)||(e=j),Math.max(0,Math.min(1-2**-52,e))},[o,j]),P=Op(s),F=Uy(s)?s:void 0,I=(0,C.useMemo)(()=>({pulse:O,beat:k,stepIndex:M,chakraDayKey:P,stepsPerBeat:44,visualClamped:N}),[O,k,M,P,N]),{prefersReduce:L,prefersContrast:R}=rm(),{kaiData:z,kaiDataRef:B}=am(h),V=om(`${I.pulse}|${I.beat}|${I.stepIndex}|${I.chakraDayKey}`),H=(0,C.useMemo)(()=>Zp(V),[V]),{sides:U,hue:ee}=Cp[P],te=I.pulse%7+1,ne=I.beat%5+2,re=I.visualClamped*2*Math.PI,ie=yp**2*Math.PI*(I.pulse%97)%(2*Math.PI),ae=50+15*Math.sin(I.visualClamped*2*Math.PI),oe=kp((ee+360*.03*I.visualClamped)%360,100,ae),se=wp[P],ce=(0,C.useMemo)(()=>Pp(P,M),[P,M]),le=typeof window<`u`?window.devicePixelRatio??1:1,ue=f&&!L,de=(m?`${m}-${M}`:void 0)??`ks-${I.pulse}-${I.beat}-${M}`,fe=Math.max(10,Math.floor((c??240)*.08)),pe=Math.max(40,(c??240)-fe*2),me=Math.max(.6,(c??240)*.003),he=Math.max(1.4,(c??240)*.009),ge=Math.max(2.5,(c??240)*.016),_e=5e3+Math.floor(H()*800)+Math.floor(V%436/2),ve=Math.floor((V>>>1)%_e),ye=(0,C.useMemo)(()=>Ap(U,ie),[U,ie]),be=(0,C.useMemo)(()=>jp(te,ne,re),[te,ne,re]),[xe,Se]=(0,C.useState)(),[Ce,we]=(0,C.useState)();(0,C.useEffect)(()=>{(async()=>{let e=_;e||(e=Gp(await qp(`${I.pulse}|${I.beat}|${M}|${P}|${v??``}`)),Se(e));let t=g;!t&&e&&(t=await Xp((await qp(`${e}φ`)).slice(0,20)),we(t))})().catch(S)},[_,g,I.pulse,I.beat,M,P,v,S]);let Te=_??xe,Ee=g??Ce,De=sm(),Oe=(0,C.useRef)(I.pulse),[ke,Ae]=(0,C.useState)(null),[je,Me]=(0,C.useState)(null),Ne=(0,C.useRef)(null);(0,C.useEffect)(()=>{Ne.current={pulse:Oe.current,kaiPulse:Oe.current,kaiSignature:Te??void 0,userPhiKey:Ee??void 0,beat:I.beat,stepIndex:I.stepIndex,stepsPerBeat:I.stepsPerBeat,quality:Gy(d),frequencyHz:ce,chakraDay:I.chakraDayKey,chakraGate:se}},[I.beat,I.stepIndex,Te,Ee,ce,I.chakraDayKey,se,d]);let Pe=(0,C.useMemo)(()=>`${I.pulse}|${I.beat}|${I.stepIndex}|${I.chakraDayKey}`,[I.pulse,I.beat,I.stepIndex,I.chakraDayKey]),[Fe,Ie]=(0,C.useState)(null);(0,C.useEffect)(()=>{let e=!1,t=I.pulse,n=I.beat,r=I.stepIndex,i=I.chakraDayKey,a=I.stepsPerBeat,o=ce,c=Pe,l=Uy(s)?s:null;return(async()=>{try{let s=await tm({creatorPublicKey:y,userPhiKey:Ee,kaiSignature:Te,origin:b,pulse:t,beat:n,chakraDay:i,stepIndex:r}),u=B.current,f=Hp(Lp(u,`kaiMomentSummary`))??Hp(Lp(u,`kairos_seal`))??Hp(Lp(u,`kairos_seal_day_month_percent`))??`Kairos HarmoniK Sigil • ${i} • Beat ${n} • Step ${r}`,p={pulse:Oe.current,kaiPulse:Oe.current,kaiSignature:Te??void 0,userPhiKey:Ee??void 0,beat:n,stepsPerBeat:a,quality:d===`low`?`low`:`high`,frequencyHz:o,chakraDay:i,chakraGate:se};try{let{seal:e}=await hu(p,Oe.current,De);Me(e)}catch(e){S?.(e)}let m=await Iy({canon:{pulse:t,beat:n,stepIndex:r,chakraDayKey:i,stepsPerBeat:a},hashMode:h,chakraGate:se,kaiSignature:Te,userPhiKey:Ee,intentionSigil:v,origin:b,title:f,klockSnapshot:Fp(E)?JSON.parse(Ip(E)):null,kaiApiSnapshot:Fp(z)?JSON.parse(Ip(z)):null,weekdayResolved:l,valuationSource:p,mintSeal:null,frequencyHzCurrent:o,qrHref:T,canonicalUrlFromContext:vp,creatorResolved:s}),g={},_=``,C=``,w=``,D=``,O=``;if(Wy(m)){let e=m.embeddedBase;Wy(e)&&(g=e);let t=m.payloadHashHex;typeof t==`string`&&(_=t);let n=m.parityUrl;typeof n==`string`&&(C=n);let r=m.innerRingText;typeof r==`string`&&(w=r);let i=m.sigilUrl;typeof i==`string`&&(D=i);let a=m.hashB58;typeof a==`string`&&(O=a)}let k={PULSE_MS:qn,STEPS_BEAT:a,PHI:yp,algorithm:`computeIntrinsicUnsigned`,version:`1`},A=p?mu(p,t).unsigned.valuePhi:null,j=Ly({...g,valuation:je??null,valuationSource:p,valuationRuntime:k,valuationLiveAtExport:A}),M={createdFor:{pulse:t,beat:n,stepIndex:r,chakraDayKey:i,stateKey:c},payloadHashHex:_,shareUrl:C,embeddedMetaJson:j,valuationSourceJson:JSON.stringify(p),zkScheme:`groth16-poseidon`,zkPoseidonHash:`7110303097080024260800444665787206606103183587082596139871399733998958991511`,innerRingText:w,sigilUrl:D,hashB58:O,frequencyHz:o};!e&&M.createdFor.stateKey===c&&(Ie(M),x?.({hash:M.payloadHashHex,url:M.shareUrl,metadataJson:M.embeddedMetaJson}))}catch(e){if(S?.(e),u)throw e instanceof Error?e:Error(String(e))}})().catch(e=>{if(S?.(e),u)throw e instanceof Error?e:Error(String(e))}),()=>{e=!0}},[Pe,I.pulse,I.beat,I.stepIndex,I.chakraDayKey,I.stepsPerBeat,ce,Te,Ee,h,y,b,T,u,x,S,P,d,E,z,B,De,se,s]);let Le=(0,C.useMemo)(()=>{let e=Fe;return e&&e.createdFor.stateKey===Pe?e.createdFor.stepIndex:I.stepIndex},[Fe,Pe,I.stepIndex]),Re=(0,C.useMemo)(()=>{let e=Fe;return e&&e.createdFor.stateKey===Pe?e.frequencyHz:ce},[Fe,Pe,ce]);(0,C.useEffect)(()=>{try{if(!Ne.current||!Number.isFinite(I.pulse)){Ae(null);return}let{unsigned:e}=mu(Ne.current,I.pulse);Ae(e.valuePhi)}catch(e){S?.(e),Ae(null)}},[I.pulse,S]);let ze=Lp(E,`eternalSeal`)??Lp(E,`seal`)??Lp(z,`kairos_seal`),Be=(0,C.useMemo)(()=>qy(ze,I.beat,Le,I.pulse),[ze,I.beat,Le,I.pulse]),Ve=(0,C.useMemo)(()=>{let e=Fe&&Fe.createdFor.stateKey===Pe?Fe.createdFor.stepIndex:Le;return qy(ze,I.beat,e,I.pulse)},[Fe,Pe,ze,I.beat,Le,I.pulse]),He=(0,C.useMemo)(()=>Qy(Ve),[Ve]),{klockIsoSnapshot:Ue,apiSnapshot:We,klockDataAttrs:Ge,eternalMonth:Ke,harmonicDay:qe,kaiPulseEternal:Je,solarChakraStepString:Ye,chakraArc:Xe}=(0,C.useMemo)(()=>nb(E,z),[E,z]),Ze=(0,C.useRef)(null);(0,C.useLayoutEffect)(()=>{let e=Ze.current;if(!e||!l)return;let t=!1;return(async()=>{try{let n=e.cloneNode(!0);n.removeAttribute(`data-svg-hash`),n.removeAttribute(`data-svg-valid`);let r=Gp(await qp(new XMLSerializer().serializeToString(n)));if(t)return;if(e.dataset.svgHash=r,e.dataset.svgValid=String(r===l.toLowerCase()),r!==l.toLowerCase()&&u)throw Error(`[KaiSigil] SVG HASH MISMATCH (${r})`)}catch(e){if(S?.(e),u)throw e instanceof Error?e:Error(String(e))}})().catch(e=>{if(S?.(e),u)throw e instanceof Error?e:Error(String(e))}),()=>{t=!0}},[l,u,Pe,S]),(0,C.useLayoutEffect)(()=>{if(!u)return;let e=Ze.current;if(!e)return;let t=Fe;if(!t||t.createdFor.stateKey!==Pe)return;let n=e.getAttribute(`data-step-index`),r=e.getAttribute(`data-frequency-hz`),i=e.getAttribute(`data-summary-b64`)??``,a=n!=null&&n!==``?Number(n):NaN,o=r!=null&&r!==``?Number(r):NaN,s=e.getAttribute(`data-share-url`)||void 0,c=e.getAttribute(`data-payload-hash`)||void 0,l=``;try{l=$y(i)}catch{l=``}let d=Ve,f=e=>e.replace(/•|·|\u2022/g,`•`),p=[];if(f(l)!==f(d)&&p.push(`summary mismatch (“${l}” != “${d}”)`),Number.isFinite(a)?a!==t.createdFor.stepIndex&&p.push(`data-step-index(${a}) != built(${t.createdFor.stepIndex})`):p.push(`missing/invalid data-step-index`),!Number.isFinite(o))p.push(`missing/invalid data-frequency-hz`);else{let e=Pp(P,a);(Math.abs(o-t.frequencyHz)>1e-6||Math.abs(e-o)>1e-6)&&p.push(`frequency/step mismatch (${o} vs step ${a})`)}if(s!==t.shareUrl&&p.push(`data-share-url != built.shareUrl`),c&&c!==t.payloadHashHex&&p.push(`data-payload-hash != built.payloadHashHex`),p.length)throw Error(`[KaiSigil] Invariant violation → ${p.join(`; `)}`)},[u,Fe,Pe,P,I.beat,I.pulse,Re,Ve]);let{toDataURL:Qe,exportBlob:$e,verifySvgHash:et}=Ry(Ze,c),tt=(0,C.useMemo)(()=>Fp(D)?JSON.parse(Ip(D)):null,[D]),nt=Fe?.createdFor.stateKey===Pe?Fe?.payloadHashHex:void 0,rt=Fe?.createdFor.stateKey===Pe?Fe?.zkScheme:void 0,it=Fe?.createdFor.stateKey===Pe?Fe?.zkPoseidonHash:void 0,at=Fe?.createdFor.stateKey===Pe?Fe?.shareUrl:void 0,ot=(Fe?.createdFor.stateKey===Pe?Fe?.frequencyHz:void 0)??ce,st=(0,C.useMemo)(()=>{if(!Te)return``;let e=Ky(Te),t=2*Math.PI*((c??240)*.46),n=Math.max(3.5,(c??240)*.028*.55),r=Math.max(24,Math.floor(t/n));return e.length>r?e.slice(0,r):e},[Te,c]),ct=ib(ee,I.visualClamped,Fe?.payloadHashHex),lt=Te?`${de}-sig-path`:void 0,ut=`${de}-desc`,dt=Fe?.createdFor.stateKey===Pe?Fe?.shareUrl:void 0,ft=({children:e})=>dt?(0,W.jsx)(`a`,{href:dt,target:`_self`,"aria-label":`Open canonical sigil ${Fe?.payloadHashHex??``}`,children:e}):(0,W.jsx)(`g`,{tabIndex:0,role:`button`,"aria-label":`Sigil not yet canonicalized`,children:e}),pt=Fe?.createdFor.stateKey===Pe,mt=rb(nt,pt,P,ot,I.pulse,I.beat,it),{ledgerJson:ht,dhtJson:gt}=(0,C.useMemo)(()=>eb(pt?Fe?.embeddedMetaJson:void 0),[Fe,pt]);return(0,C.useImperativeHandle)(t,()=>({toDataURL:Qe,exportBlob:$e,verifySvgHash:et,verifyConsistency:()=>{let e=Fe;if(!e)throw Error(`No built snapshot yet`);if(e.createdFor.stateKey!==Pe)throw Error(`Built snapshot does not match current stateKey`)},uid:de,stepIndex:M,payloadHashHex:Fe?.payloadHashHex,sigilUrl:Fe?.sigilUrl,userPhiKey:Ee,kaiSignature:Te})),(0,W.jsxs)(`svg`,{ref:Ze,id:n??de,role:`img`,"aria-describedby":ut,lang:`en`,"aria-label":`Kairos sigil — pulse ${I.pulse}`,viewBox:`0 0 ${xp} ${xp}`,width:c,height:c,shapeRendering:`geometricPrecision`,style:{background:`transparent`,"--dur":`${_e}ms`,"--off":`${ve}ms`,"--pulse":`${qn}ms`,cursor:at?`pointer`:`default`},"data-pulse":String(I.pulse),"data-beat":String(I.beat),"data-step-index":String(Le),"data-frequency-hz":String(Re),"data-chakra-day":P,"data-weekday":F??void 0,"data-chakra-gate":se,"data-quality":d,"data-golden-id":m??void 0,"data-kai-signature":Te??void 0,"data-phi-key":Ee??void 0,"data-payload-hash":nt??void 0,"data-zk-scheme":rt??void 0,"data-zk-poseidon-hash":it??void 0,"data-share-url":at||void 0,"data-eternal-seal":ze??void 0,"data-eternal-month":Ke??void 0,"data-harmonic-day":qe??void 0,"data-kai-pulse-eternal":typeof Je==`number`?String(Je):void 0,"data-solar-chakra-step":Ye??void 0,"data-arc":Xe??void 0,"data-summary-b64":He,...Ge,"data-valuation-algorithm":je?.algorithm??void 0,"data-valuation-policy":je?.policyId??void 0,"data-valuation-policy-checksum":je?.policyChecksum??void 0,"data-valuation-stamp":je?.stamp??void 0,"data-valuation-value-phi":je?.valuePhi==null?void 0:String(je.valuePhi),"data-valuation-computed-at":je?.computedAtPulse==null?void 0:String(je.computedAtPulse),"data-value-phi-live":ke==null?void 0:String(ke),children:[(0,W.jsx)(`title`,{children:`Kairos HarmoniK Sigil • Pulse ${I.pulse}`}),(0,W.jsxs)(`desc`,{id:ut,children:[`↳ `,Be]}),(0,W.jsx)(By,{uid:de,stateKeyOk:pt,embeddedMetaJson:pt?Fe?.embeddedMetaJson:void 0,klockIsoSnapshot:Ue,apiSnapshot:We,extraEmbed:tt,mintSealJson:je?JSON.stringify(je):null,valuationSourceJson:pt?Fe?.valuationSourceJson:void 0,displayStepIndex:Le,stepsPerBeat:I.stepsPerBeat,eternalSeal:ze??void 0,ledgerJson:ht,dhtJson:gt}),(0,W.jsx)(zy,{uid:de,hue:ee,visualClamped:I.visualClamped,doAnim:ue,quality:d,dpr:le,seed:V,payloadHashHex:Fe?.payloadHashHex,auraPath:be}),Te&&(0,W.jsx)(`defs`,{children:(0,W.jsx)(`path`,{id:lt,d:`M 500 ${500-1e3*.46} +\0`,M+=r(k,2),M+=m.magic,M+=r(d,2),M+=r(f,2),M+=r(O.crc32,4),M+=r(O.compressedSize,4),M+=r(O.uncompressedSize,4),M+=r(g.length,2),M+=r(C.length,2),{fileRecord:l.LOCAL_FILE_HEADER+M+g+C,dirRecord:l.CENTRAL_FILE_HEADER+r(j,2)+M+r(y.length,2)+`\0\0\0\0`+r(A,4)+r(i,4)+g+C+y}}var a=e(`../utils`),o=e(`../stream/GenericWorker`),s=e(`../utf8`),c=e(`../crc32`),l=e(`../signature`);function u(e,t,n,r){o.call(this,`ZipFileWorker`),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(u,o),u.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-r-1))/n:100}}))},u.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var n=i(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},u.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=i(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:function(e){return l.DATA_DESCRIPTOR+r(e.crc32,4)+r(e.compressedSize,4)+r(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},u.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return r.transformTo(`string`,this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,n){var r=e(`./Uint8ArrayReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,n){var r=e(`./DataReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,n){var r=e(`./ArrayReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.readData=function(e){if(this.checkOffset(e),e===0)return new Uint8Array;var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,n){var r=e(`../utils`),i=e(`../support`),a=e(`./ArrayReader`),o=e(`./StringReader`),s=e(`./NodeBufferReader`),c=e(`./Uint8ArrayReader`);t.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),t!==`string`||i.uint8array?t===`nodebuffer`?new s(e):i.uint8array?new c(r.transformTo(`uint8array`,e)):new a(r.transformTo(`array`,e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,n){n.LOCAL_FILE_HEADER=`PK`,n.CENTRAL_FILE_HEADER=`PK`,n.CENTRAL_DIRECTORY_END=`PK`,n.ZIP64_CENTRAL_DIRECTORY_LOCATOR=`PK\x07`,n.ZIP64_CENTRAL_DIRECTORY_END=`PK`,n.DATA_DESCRIPTOR=`PK\x07\b`},{}],24:[function(e,t,n){var r=e(`./GenericWorker`),i=e(`../utils`);function a(e){r.call(this,`ConvertWorker to `+e),this.destType=e}i.inherits(a,r),a.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,n){var r=e(`./GenericWorker`),i=e(`../crc32`);function a(){r.call(this,`Crc32Probe`),this.withStreamInfo(`crc32`,0)}e(`../utils`).inherits(a,r),a.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,n){var r=e(`../utils`),i=e(`./GenericWorker`);function a(e){i.call(this,`DataLengthProbe for `+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(a,i),a.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,n){var r=e(`../utils`),i=e(`./GenericWorker`);function a(e){i.call(this,`DataWorker`);var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type=``,this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}r.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case`string`:e=this.data.substring(this.index,t);break;case`uint8array`:e=this.data.subarray(this.index,t);break;case`array`:case`nodebuffer`:e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,n){function r(e){this.name=e||`default`,this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit(`data`,e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit(`end`),this.cleanUp(),this.isFinished=!0}catch(e){this.emit(`error`,e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit(`error`,e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n `+e:e}},t.exports=r},{}],29:[function(e,t,n){var r=e(`../utils`),i=e(`./ConvertWorker`),a=e(`./GenericWorker`),o=e(`../base64`),s=e(`../support`),c=e(`../external`),l=null;if(s.nodestream)try{l=e(`../nodejs/NodejsStreamOutputAdapter`)}catch{}function u(e,t){return new c.Promise(function(n,i){var a=[],s=e._internalType,c=e._outputType,l=e._mimeType;e.on(`data`,function(e,n){a.push(e),t&&t(n)}).on(`error`,function(e){a=[],i(e)}).on(`end`,function(){try{n(function(e,t,n){switch(e){case`blob`:return r.newBlob(r.transformTo(`arraybuffer`,t),n);case`base64`:return o.encode(t);default:return r.transformTo(e,t)}}(c,function(e,t){var n,r=0,i=null,a=0;for(n=0;n`u`)n.blob=!1;else{var r=new ArrayBuffer(0);try{n.blob=new Blob([r],{type:`application/zip`}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(r),n.blob=i.getBlob(`application/zip`).size===0}catch{n.blob=!1}}}try{n.nodestream=!!e(`readable-stream`).Readable}catch{n.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,n){for(var r=e(`./utils`),i=e(`./support`),a=e(`./nodejsUtils`),o=e(`./stream/GenericWorker`),s=Array(256),c=0;c<256;c++)s[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;s[254]=s[254]=1;function l(){o.call(this,`utf-8 decode`),this.leftOver=null}function u(){o.call(this,`utf-8 encode`)}n.utf8encode=function(e){return i.nodebuffer?a.newBufferFrom(e,`utf-8`):function(e){var t,n,r,a,o,s=e.length,c=0;for(a=0;a>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t}(e)},n.utf8decode=function(e){return i.nodebuffer?r.transformTo(`nodebuffer`,e).toString(`utf-8`):function(e){var t,n,i,a,o=e.length,c=Array(2*o);for(t=n=0;t>10&1023,c[n++]=56320|1023&i)}return c.length!==n&&(c.subarray?c=c.subarray(0,n):c.length=n),r.applyFromCharCode(c)}(e=r.transformTo(i.uint8array?`uint8array`:`array`,e))},r.inherits(l,o),l.prototype.processChunk=function(e){var t=r.transformTo(i.uint8array?`uint8array`:`array`,e.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var a=t;(t=new Uint8Array(a.length+this.leftOver.length)).set(this.leftOver,0),t.set(a,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var n;for((t||=e.length)>e.length&&(t=e.length),n=t-1;0<=n&&(192&e[n])==128;)n--;return n<0||n===0?t:n+s[e[n]]>t?n:t}(t),c=t;o!==t.length&&(i.uint8array?(c=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(c=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:n.utf8decode(c),meta:e.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=l,r.inherits(u,o),u.prototype.processChunk=function(e){this.push({data:n.utf8encode(e.data),meta:e.meta})},n.Utf8EncodeWorker=u},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,n){var r=e(`./support`),i=e(`./base64`),a=e(`./nodejsUtils`),o=e(`./external`);function s(e){return e}function c(e,t){for(var n=0;n>8;this.dir=!!(16&this.externalFileAttributes),e==0&&(this.dosPermissions=63&this.externalFileAttributes),e==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!==`/`||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=r(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,n,r,i=e.index+this.extraFieldsLength;for(this.extraFields||={};e.index+4>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t},n.buf2binstring=function(e){return c(e,e.length)},n.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n>10&1023,l[r++]=56320|1023&i)}return c(l,r)},n.utf8border=function(e,t){var n;for((t||=e.length)>e.length&&(t=e.length),n=t-1;0<=n&&(192&e[n])==128;)n--;return n<0||n===0?t:n+o[e[n]]>t?n:t}},{"./common":41}],43:[function(e,t,n){t.exports=function(e,t,n,r){for(var i=65535&e|0,a=e>>>16&65535|0,o=0;n!==0;){for(n-=o=2e3>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,i){var a=r,o=i+n;e^=-1;for(var s=i;s>>8^a[255&(e^t[s])];return-1^e}},{}],46:[function(e,t,n){var r,i=e(`../utils/common`),a=e(`./trees`),o=e(`./adler32`),s=e(`./crc32`),c=e(`./messages`),l=0,u=4,d=0,f=-2,p=-1,m=4,h=2,g=8,_=9,v=286,y=30,b=19,x=2*v+1,S=15,C=3,w=258,T=w+C+1,E=42,D=113,O=1,k=2,A=3,j=4;function M(e,t){return e.msg=c[t],t}function N(e){return(e<<1)-(4e.avail_out&&(n=e.avail_out),n!==0&&(i.arraySet(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 I(e,t){a._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,F(e.strm)}function L(e,t){e.pending_buf[e.pending++]=t}function R(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function z(e,t){var n,r,i=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-T?e.strstart-(e.w_size-T):0,l=e.window,u=e.w_mask,d=e.prev,f=e.strstart+w,p=l[a+o-1],m=l[a+o];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do if(l[(n=t)+o]===m&&l[n+o-1]===p&&l[n]===l[a]&&l[++n]===l[a+1]){a+=2,n++;do;while(l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&ac&&--i!=0);return o<=e.lookahead?o:e.lookahead}function B(e){var t,n,r,a,c,l,u,d,f,p,m=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=m+(m-T)){for(i.arraySet(e.window,e.window,m,m,0),e.match_start-=m,e.strstart-=m,e.block_start-=m,t=n=e.hash_size;r=e.head[--t],e.head[t]=m<=r?r-m:0,--n;);for(t=n=m;r=e.prev[--t],e.prev[t]=m<=r?r-m:0,--n;);a+=m}if(e.strm.avail_in===0)break;if(l=e.strm,u=e.window,d=e.strstart+e.lookahead,f=a,p=void 0,p=l.avail_in,f=C)for(c=e.strstart-e.insert,e.ins_h=e.window[c],e.ins_h=(e.ins_h<=C&&(e.ins_h=(e.ins_h<=C)if(r=a._tr_tally(e,e.strstart-e.match_start,e.match_length-C),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=C){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=C&&(e.ins_h=(e.ins_h<=C&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-C,r=a._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-C),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(B(e),e.lookahead===0&&t===l)return O;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,I(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-T&&(I(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(I(e,!0),e.strm.avail_out===0?A:j):(e.strstart>e.block_start&&(I(e,!1),e.strm.avail_out),O)}),new U(4,4,8,4,V),new U(4,5,16,8,V),new U(4,6,32,32,V),new U(4,4,16,16,H),new U(8,16,32,32,H),new U(8,16,128,128,H),new U(8,32,128,256,H),new U(32,128,258,1024,H),new U(32,258,258,4096,H)],n.deflateInit=function(e,t){return re(e,t,g,15,8,0)},n.deflateInit2=re,n.deflateReset=ne,n.deflateResetKeep=te,n.deflateSetHeader=function(e,t){return e&&e.state&&e.state.wrap===2?(e.state.gzhead=t,d):f},n.deflate=function(e,t){var n,i,o,c;if(!e||!e.state||5>8&255),L(i,i.gzhead.time>>16&255),L(i,i.gzhead.time>>24&255),L(i,i.level===9?2:2<=i.strategy||i.level<2?4:0),L(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(L(i,255&i.gzhead.extra.length),L(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=s(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(L(i,0),L(i,0),L(i,0),L(i,0),L(i,0),L(i,i.level===9?2:2<=i.strategy||i.level<2?4:0),L(i,3),i.status=D);else{var p=g+(i.w_bits-8<<4)<<8;p|=(2<=i.strategy||i.level<2?0:i.level<6?1:i.level===6?2:3)<<6,i.strstart!==0&&(p|=32),p+=31-p%31,i.status=D,R(i,p),i.strstart!==0&&(R(i,e.adler>>>16),R(i,65535&e.adler)),e.adler=1}if(i.status===69)if(i.gzhead.extra){for(o=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),F(e),o=i.pending,i.pending!==i.pending_buf_size));)L(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(i.status===73)if(i.gzhead.name){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),F(e),o=i.pending,i.pending===i.pending_buf_size)){c=1;break}c=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),c===0&&(i.gzindex=0,i.status=91)}else i.status=91;if(i.status===91)if(i.gzhead.comment){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),F(e),o=i.pending,i.pending===i.pending_buf_size)){c=1;break}c=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),c===0&&(i.status=103)}else i.status=103;if(i.status===103&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&F(e),i.pending+2<=i.pending_buf_size&&(L(i,255&e.adler),L(i,e.adler>>8&255),e.adler=0,i.status=D)):i.status=D),i.pending!==0){if(F(e),e.avail_out===0)return i.last_flush=-1,d}else if(e.avail_in===0&&N(t)<=N(n)&&t!==u)return M(e,-5);if(i.status===666&&e.avail_in!==0)return M(e,-5);if(e.avail_in!==0||i.lookahead!==0||t!==l&&i.status!==666){var m=i.strategy===2?function(e,t){for(var n;;){if(e.lookahead===0&&(B(e),e.lookahead===0)){if(t===l)return O;break}if(e.match_length=0,n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(I(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(I(e,!0),e.strm.avail_out===0?A:j):e.last_lit&&(I(e,!1),e.strm.avail_out===0)?O:k}(i,t):i.strategy===3?function(e,t){for(var n,r,i,o,s=e.window;;){if(e.lookahead<=w){if(B(e),e.lookahead<=w&&t===l)return O;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=C&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=C?(n=a._tr_tally(e,1,e.match_length-C),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(I(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(I(e,!0),e.strm.avail_out===0?A:j):e.last_lit&&(I(e,!1),e.strm.avail_out===0)?O:k}(i,t):r[i.level].func(i,t);if(m!==A&&m!==j||(i.status=666),m===O||m===A)return e.avail_out===0&&(i.last_flush=-1),d;if(m===k&&(t===1?a._tr_align(i):t!==5&&(a._tr_stored_block(i,0,0,!1),t===3&&(P(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),F(e),e.avail_out===0))return i.last_flush=-1,d}return t===u?i.wrap<=0?1:(i.wrap===2?(L(i,255&e.adler),L(i,e.adler>>8&255),L(i,e.adler>>16&255),L(i,e.adler>>24&255),L(i,255&e.total_in),L(i,e.total_in>>8&255),L(i,e.total_in>>16&255),L(i,e.total_in>>24&255)):(R(i,e.adler>>>16),R(i,65535&e.adler)),F(e),0=n.w_size&&(s===0&&(P(n.head),n.strstart=0,n.block_start=0,n.insert=0),p=new i.Buf8(n.w_size),i.arraySet(p,t,m-n.w_size,n.w_size,0),t=p,m=n.w_size),c=e.avail_in,l=e.next_in,u=e.input,e.avail_in=m,e.next_in=0,e.input=t,B(n);n.lookahead>=C;){for(r=n.strstart,a=n.lookahead-(C-1);n.ins_h=(n.ins_h<>>=b=y>>>24,m-=b,(b=y>>>16&255)==0)E[a++]=65535&y;else{if(!(16&b)){if(!(64&b)){y=h[(65535&y)+(p&(1<>>=b,m-=b),m<15&&(p+=T[r++]<>>=b=y>>>24,m-=b,!(16&(b=y>>>16&255))){if(!(64&b)){y=g[(65535&y)+(p&(1<>>=b,m-=b,(b=a-o)>3,p&=(1<<(m-=x<<3))-1,e.next_in=r,e.next_out=a,e.avail_in=r>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function g(){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 r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg=``,t.wrap&&(e.adler=1&t.wrap),t.mode=f,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(p),t.distcode=t.distdyn=new r.Buf32(m),t.sane=1,t.back=-1,u):d}function v(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,_(e)):d}function y(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=o.wsize?(r.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(i<(a=o.wsize-o.wnext)&&(a=i),r.arraySet(o.window,t,n-i,a,o.wnext),(i-=a)?(r.arraySet(o.window,t,n-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,n.check=a(n.check,B,2,0),x=b=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&b)<<8)+(b>>8))%31){e.msg=`incorrect header check`,n.mode=30;break}if((15&b)!=8){e.msg=`unknown compression method`,n.mode=30;break}if(x-=4,F=8+(15&(b>>>=4)),n.wbits===0)n.wbits=F;else if(F>n.wbits){e.msg=`invalid window size`,n.mode=30;break}n.dmax=1<>8&1),512&n.flags&&(B[0]=255&b,B[1]=b>>>8&255,n.check=a(n.check,B,2,0)),x=b=0,n.mode=3;case 3:for(;x<32;){if(v===0)break e;v--,b+=p[g++]<>>8&255,B[2]=b>>>16&255,B[3]=b>>>24&255,n.check=a(n.check,B,4,0)),x=b=0,n.mode=4;case 4:for(;x<16;){if(v===0)break e;v--,b+=p[g++]<>8),512&n.flags&&(B[0]=255&b,B[1]=b>>>8&255,n.check=a(n.check,B,2,0)),x=b=0,n.mode=5;case 5:if(1024&n.flags){for(;x<16;){if(v===0)break e;v--,b+=p[g++]<>>8&255,n.check=a(n.check,B,2,0)),x=b=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(v<(E=n.length)&&(E=v),E&&(n.head&&(F=n.head.extra_len-n.length,n.head.extra||(n.head.extra=Array(n.head.extra_len)),r.arraySet(n.head.extra,p,g,E,F)),512&n.flags&&(n.check=a(n.check,p,E,g)),v-=E,g+=E,n.length-=E),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(v===0)break e;for(E=0;F=p[g+ E++],n.head&&F&&n.length<65536&&(n.head.name+=String.fromCharCode(F)),F&&E>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;x<32;){if(v===0)break e;v--,b+=p[g++]<>>=7&x,x-=7&x,n.mode=27;break}for(;x<3;){if(v===0)break e;v--,b+=p[g++]<>>=1)){case 0:n.mode=14;break;case 1:if(w(n),n.mode=20,t!==6)break;b>>>=2,x-=2;break e;case 2:n.mode=17;break;case 3:e.msg=`invalid block type`,n.mode=30}b>>>=2,x-=2;break;case 14:for(b>>>=7&x,x-=7&x;x<32;){if(v===0)break e;v--,b+=p[g++]<>>16^65535)){e.msg=`invalid stored block lengths`,n.mode=30;break}if(n.length=65535&b,x=b=0,n.mode=15,t===6)break e;case 15:n.mode=16;case 16:if(E=n.length){if(v>>=5,x-=5,n.ndist=1+(31&b),b>>>=5,x-=5,n.ncode=4+(15&b),b>>>=4,x-=4,286>>=3,x-=3}for(;n.have<19;)n.lens[V[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,L={bits:n.lenbits},I=s(0,n.lens,0,19,n.lencode,0,n.work,L),n.lenbits=L.bits,I){e.msg=`invalid code lengths set`,n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,j=65535&z,!((k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=k,x-=k,n.lens[n.have++]=j;else{if(j===16){for(R=k+2;x>>=k,x-=k,n.have===0){e.msg=`invalid bit length repeat`,n.mode=30;break}F=n.lens[n.have-1],E=3+(3&b),b>>>=2,x-=2}else if(j===17){for(R=k+3;x>>=k)),b>>>=3,x-=3}else{for(R=k+7;x>>=k)),b>>>=7,x-=7}if(n.have+E>n.nlen+n.ndist){e.msg=`invalid bit length repeat`,n.mode=30;break}for(;E--;)n.lens[n.have++]=F}}if(n.mode===30)break;if(n.lens[256]===0){e.msg=`invalid code -- missing end-of-block`,n.mode=30;break}if(n.lenbits=9,L={bits:n.lenbits},I=s(c,n.lens,0,n.nlen,n.lencode,0,n.work,L),n.lenbits=L.bits,I){e.msg=`invalid literal/lengths set`,n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,L={bits:n.distbits},I=s(l,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,L),n.distbits=L.bits,I){e.msg=`invalid distances set`,n.mode=30;break}if(n.mode=20,t===6)break e;case 20:n.mode=21;case 21:if(6<=v&&258<=y){e.next_out=_,e.avail_out=y,e.next_in=g,e.avail_in=v,n.hold=b,n.bits=x,o(e,C),_=e.next_out,m=e.output,y=e.avail_out,g=e.next_in,p=e.input,v=e.avail_in,b=n.hold,x=n.bits,n.mode===12&&(n.back=-1);break}for(n.back=0;A=(z=n.lencode[b&(1<>>16&255,j=65535&z,!((k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>M)])>>>16&255,j=65535&z,!(M+(k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=M,x-=M,n.back+=M}if(b>>>=k,x-=k,n.back+=k,n.length=j,A===0){n.mode=26;break}if(32&A){n.back=-1,n.mode=12;break}if(64&A){e.msg=`invalid literal/length code`,n.mode=30;break}n.extra=15&A,n.mode=22;case 22:if(n.extra){for(R=n.extra;x>>=n.extra,x-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;A=(z=n.distcode[b&(1<>>16&255,j=65535&z,!((k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>M)])>>>16&255,j=65535&z,!(M+(k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=M,x-=M,n.back+=M}if(b>>>=k,x-=k,n.back+=k,64&A){e.msg=`invalid distance code`,n.mode=30;break}n.offset=j,n.extra=15&A,n.mode=24;case 24:if(n.extra){for(R=n.extra;x>>=n.extra,x-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg=`invalid distance too far back`,n.mode=30;break}n.mode=25;case 25:if(y===0)break e;if(E=C-y,n.offset>E){if((E=n.offset-E)>n.whave&&n.sane){e.msg=`invalid distance too far back`,n.mode=30;break}D=E>n.wnext?(E-=n.wnext,n.wsize-E):n.wnext-E,E>n.length&&(E=n.length),O=n.window}else O=m,D=_-n.offset,E=n.length;for(yv?(b=L[R+d[w]],N[P+d[w]]):(b=96,0),p=1<>k)+(m-=p)]=y<<24|b<<16|x|0,m!==0;);for(p=1<>=1;if(p===0?M=0:(M&=p-1,M+=p),w++,--F[C]==0){if(C===E)break;C=t[n+d[w]]}if(D>>7)]}function L(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function R(e,t,n){e.bi_valid>h-n?(e.bi_buf|=t<>h-e.bi_valid,e.bi_valid+=n-h):(e.bi_buf|=t<>>=1,n<<=1,0<--t;);return n>>>1}function V(e,t,n){var r,i,a=Array(m+1),o=0;for(r=1;r<=m;r++)a[r]=o=o+n[r-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];s!==0&&(e[2*i]=B(a[s]++,s))}}function H(e){var t;for(t=0;t>1;1<=n;n--)te(e,a,n);for(i=c;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],te(e,a,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,a[2*i]=a[2*n]+a[2*r],e.depth[i]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,a[2*n+1]=a[2*r+1]=i,e.heap[1]=i++,te(e,a,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,i,a,o,s,c=t.dyn_tree,l=t.max_code,u=t.stat_desc.static_tree,d=t.stat_desc.has_stree,f=t.stat_desc.extra_bits,h=t.stat_desc.extra_base,g=t.stat_desc.max_length,_=0;for(a=0;a<=m;a++)e.bl_count[a]=0;for(c[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n>=7;r>>=1)if(1&n&&e.dyn_ltree[2*t]!==0)return i;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return a;for(t=32;t>>3,(s=e.static_len+3+7>>>3)<=o&&(o=s)):o=s=n+5,n+4<=o&&t!==-1?se(e,t,n,r):e.strategy===4||s===o?(R(e,2+(r?1:0),3),ne(e,T,E)):(R(e,4+(r?1:0),3),function(e,t,n,r){var i;for(R(e,t-257,5),R(e,n-1,5),R(e,r-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,t===0?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(O[n]+l+1)]++,e.dyn_dtree[2*I(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){R(e,2,3),z(e,_,T),function(e){e.bi_valid===16?(L(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,n){t.exports=function(){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}},{}],54:[function(e,t,n){(function(e){(function(e,t){if(!e.setImmediate){var n,r,i,a,o=1,s={},c=!1,l=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,n={}.toString.call(e.process)===`[object process]`?function(e){process.nextTick(function(){f(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage(``,`*`),e.onmessage=n,t}}()?(a=`setImmediate$`+Math.random()+`$`,e.addEventListener?e.addEventListener(`message`,p,!1):e.attachEvent(`onmessage`,p),function(t){e.postMessage(a+t,`*`)}):e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){f(e.data)},function(e){i.port2.postMessage(e)}):l&&`onreadystatechange`in l.createElement(`script`)?(r=l.documentElement,function(e){var t=l.createElement(`script`);t.onreadystatechange=function(){f(e),t.onreadystatechange=null,r.removeChild(t),t=null},r.appendChild(t)}):function(e){setTimeout(f,0,e)},u.setImmediate=function(e){typeof e!=`function`&&(e=Function(``+e));for(var t=Array(arguments.length-1),r=0;r`u`?e===void 0?this:e:self)}).call(this,typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:{})},{}]},{},[10])(10)})})),Rd=u(Ld(),1);const zd=`username_claim`,Bd=1,Vd=1800,Hd=3500;function Ud(e){return typeof e==`object`&&!!e}function Wd(e){return typeof e==`string`}function Gd(e){return typeof e==`number`&&Number.isFinite(e)}function Kd(e){return e===void 0||Wd(e)}function qd(e){return e===void 0||Gd(e)}function Jd(e){return e===void 0||e===`x`||e===`manual`}function Yd(e){return Ud(e)?e.kind===`username_claim`&&Wd(e.username)&&Wd(e.normalized)&&Wd(e.originHash)&&(e.ownerHint===void 0||e.ownerHint===null||Wd(e.ownerHint)):!1}function Xd(e){return Ud(e)?Wd(e.hash)&&(e.url===void 0||Wd(e.url))&&Yd(e.payload)&&(e.ownerHint===void 0||e.ownerHint===null||Wd(e.ownerHint)):!1}function Zd(e){return Ud(e)?e.kind===`text`&&Wd(e.text):!1}function Qd(e){return Ud(e)?e.kind===`code`&&Wd(e.code)&&Kd(e.lang):!1}function $d(e){if(!Ud(e))return!1;let t=e.mode,n=t===void 0||t===`code`||t===`sanitized`;return e.kind===`html`&&Wd(e.html)&&n}function ef(e){return Ud(e)?e.kind===`md`&&Wd(e.md):!1}function tf(e){return Zd(e)||Qd(e)||$d(e)||ef(e)}function nf(e){return e===void 0||tf(e)}function rf(e){return Ud(e)?e.kind===`url`&&Wd(e.url)&&Kd(e.title):!1}function af(e){if(!Ud(e))return!1;let t=e.kind===`file-ref`,n=e.sha256;return!!t&&Wd(n)&&/^[0-9a-f]{64}$/.test(n)&&Kd(e.name)&&Kd(e.type)&&qd(e.size)&&(e.url===void 0||Wd(e.url))}function of(e){return Ud(e)?e.kind===`file-inline`&&Kd(e.name)&&Kd(e.type)&&qd(e.size)&&Wd(e.data_b64url)&&(e.thumbnail_b64===void 0||Wd(e.thumbnail_b64)):!1}function sf(e){return rf(e)||af(e)||of(e)}function cf(e){return!(!Ud(e)||e.version!==1||!Array.isArray(e.items)||!e.items.every(sf)||!qd(e.totalBytes)||!qd(e.inlinedBytes))}function lf(e){return e===void 0||Ud(e)}function uf(e){return Ud(e)?e.v===2&&Wd(e.url)&&Gd(e.pulse)&&Jd(e.source)&&Kd(e.caption)&&nf(e.body)&&Kd(e.author)&&Kd(e.sigilId)&&Kd(e.phiKey)&&Kd(e.kaiSignature)&&Kd(e.parent)&&Kd(e.parentUrl)&&Kd(e.originUrl)&&qd(e.ts)&&(e.attachments===void 0||cf(e.attachments))&&lf(e.seal)&&(e.usernameClaim===void 0||Xd(e.usernameClaim)):!1}function df(e){return Ud(e)?e.v===1&&Wd(e.url)&&Gd(e.pulse)&&Jd(e.source)&&Kd(e.caption)&&Kd(e.author)&&Kd(e.sigilId)&&Kd(e.phiKey)&&Kd(e.kaiSignature)&&Kd(e.parent)&&Kd(e.parentUrl)&&Kd(e.originUrl)&&qd(e.ts)&&(e.attachments===void 0||cf(e.attachments)):!1}var ff=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,pf=(()=>{let e=new Int16Array(256);for(let t=0;t<256;t++)e[t]=-1;for(let t=0;t<64;t++)e[ff.charCodeAt(t)]=t;return e})();function mf(e){let t=[],n=e.length,r=0;for(;r+2>>18&63]+ff[n>>>12&63]+ff[n>>>6&63]+ff[n&63])}let i=n-r;if(i===1){let n=e[r]<<16;t.push(ff[n>>>18&63]+ff[n>>>12&63]+`==`)}else if(i===2){let n=e[r]<<16|e[r+1]<<8;t.push(ff[n>>>18&63]+ff[n>>>12&63]+ff[n>>>6&63]+`=`)}return t.join(``).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function hf(e){let t=(e??``).trim();if(!t)return new Uint8Array;let n=t.replace(/-/g,`+`).replace(/_/g,`/`);n=n.replace(/[\r\n\s]/g,``);let r=(4-n.length%4)%4;r&&(n+=`=`.repeat(r));let i=n.length;if(i%4!=0)throw Error(`Invalid base64 length`);let a=i/4*3;i>=2&&n[i-2]===`=`&&n[i-1]===`=`?a-=2:i>=1&&n[i-1]===`=`&&--a;let o=new Uint8Array(a),s=0;for(let e=0;e>>16&255,d!==64&&s>>8&255),f!==64&&s1e6)return null;let t=hf(e);if(t.length===0)return null;let n=new TextDecoder().decode(t),r=JSON.parse(n);return uf(r)?r:df(r)?_f(r):null}catch{return null}}function yf(e){if(e instanceof ArrayBuffer)return e;let t=new Uint8Array(e),n=new ArrayBuffer(t.byteLength);return new Uint8Array(n).set(t),n}function bf(e){let t=new Uint8Array(e),n=``;for(let e=0;e{let{createHash:e}=await import(`./__vite-browser-external-CekNgi1j.js`).then(f(1));return{createHash:e}},[]);return n(`sha256`).update(new Uint8Array(t)).digest(`hex`)}function Sf(e,t){let n=yf(e);try{return new Blob([n],{type:t||`application/octet-stream`})}catch{return new Blob([n])}}function Cf(e){return hf(e)}function wf(e){let t=0,n=0,r=e.attachments?.items??[];for(let e of r)e.kind===`file-ref`?t+=e.size??0:e.kind===`file-inline`&&(t+=e.size??0,n+=e.data_b64url.length*.75,e.thumbnail_b64&&(n+=e.thumbnail_b64.length*.75));return{totalBytes:Math.round(t),inlinedBytes:Math.round(n)}}function Tf(e){if(!e.attachments)return e;let t=e.attachments.items.map(e=>{if(e.kind===`file-inline`&&e.thumbnail_b64){let t={...e};return delete t.thumbnail_b64,t}return e}),{totalBytes:n,inlinedBytes:r}=wf({attachments:{...e.attachments,items:t}});return{...e,attachments:{version:1,items:t,totalBytes:n,inlinedBytes:r}}}async function Ef(e,t={}){let n=t.cacheName??`sigil-attachments-v1`,r=(t.pathPrefix??`/att/`).replace(/\/+$/,``)+`/`,i=Tf(e);if(!i.attachments||i.attachments.items.length===0||!(globalThis.caches!==void 0&&typeof globalThis.caches.open==`function`))return i;let a=null;try{a=await globalThis.caches.open(n)}catch{a=null}let o=[];for(let e of i.attachments.items){if(e.kind!==`file-inline`){o.push(e);continue}if(!a){o.push(e);continue}try{let t=Cf(e.data_b64url),n=await xf(t.buffer),i=Sf(t.buffer,e.type),s=`${r}${n}`;await a.put(new Request(s,{method:`GET`}),new Response(i,{headers:e.type?{"Content-Type":e.type}:void 0}));let c={kind:`file-ref`,name:e.name,type:e.type,size:e.size,sha256:n,url:s};o.push(c)}catch{o.push(e)}}return{...i,attachments:Rf(o)}}function Df(e){let t=gf(Tf(e));return{token:t,withinSoft:t.length<=Vd,withinHard:t.length<=Hd}}function Of(e){let t=(e??``).trim();if(!t)return``;if(/%[0-9A-Fa-f]{2}/.test(t))try{t=decodeURIComponent(t)}catch{}return t.includes(` `)&&(t=t.replace(/ /g,`+`)),/[+/=]/.test(t)&&(t=t.replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)),t}function kf(e){try{let t=e??(typeof window<`u`&&window.location?window.location:null);if(!t)return null;let n=t.hash.startsWith(`#`)?t.hash.slice(1):t.hash,r=t.search.startsWith(`?`)?t.search.slice(1):t.search,i=new URLSearchParams(n),a=new URLSearchParams(r),o=i.get(`t`)??i.get(`p`)??i.get(`token`);if(o)return Of(o);let s=a.get(`t`)??a.get(`p`)??a.get(`token`);if(s)return Of(s);let c=t.pathname.match(/^\/(?:stream|feed)\/p\/([^/?#]+)\/?$/);if(c?.[1])return Of(c[1]);let l=t.pathname.match(/^\/p~([^/?#]+)\/?$/);return l?.[1]?Of(l[1]):null}catch{return null}}function Af(e){let t=(e??``).trim();if(!t)return null;let n=t.split(`?`)[0].split(`#`)[0],r=e=>{try{return decodeURIComponent(e)}catch{return e}},i=n.match(/^\/p~([^/?#]+)\/?$/);if(i?.[1])return Of(r(i[1]));let a=n.match(/^\/(?:stream|feed)\/p\/([^/?#]+)\/?$/);return a?.[1]?Of(r(a[1])):null}function jf(e){let t=typeof window<`u`?window.location?.origin??void 0:void 0,n=e.trim();if(!n)return null;if(/^[A-Za-z0-9_-]{16,}$/u.test(n))return Of(n);let r;try{r=new URL(n)}catch{try{r=new URL(n,t)}catch{return null}}let i=r.pathname||``;{let e=i.match(/\/(?:stream|feed)\/p\/([^/?#]+)/u);if(e?.[1])return Of(e[1])}{let e=i.match(/\/p\/([^/?#]+)/u);if(e?.[1])return Of(e[1])}{let e=i.match(/\/p(?:\u007e|%7[Ee])\/?([^/?#]+)/u);if(e?.[1])return Of(e[1])}let a=r.hash&&r.hash.startsWith(`#`)?r.hash.slice(1):``,o=new URLSearchParams(a);for(let e of[`t`,`p`,`token`,`capsule`]){let t=o.get(e);if(t)return Of(t);let n=r.searchParams.get(e);if(n)return Of(n)}return null}async function Mf(e,t={}){let n=Tf(e);if(Df(n).withinHard||!(n.attachments?.items?.some(e=>e.kind===`file-inline`)??!1))return n;if(!(globalThis.caches!==void 0&&typeof globalThis.caches.open==`function`))throw Error(`Inline attachments exceed safe token size, but CacheStorage is unavailable on this device/session. Attach via a public URL (Drive/S3/IPFS) or use smaller files.`);let r=await Ef(n,t),i=Df(r),a=r.attachments?.items?.some(e=>e.kind===`file-inline`)??!1;if(!i.withinHard&&a)throw Error(`Inline attachments are still too large to share safely (and could not be cached). Attach via public URL or reduce inline file size/count.`);return Tf(r)}function Nf(e){return{kind:`text`,text:e}}function Pf(e,t){return{kind:`code`,code:e,lang:t}}function Ff(e,t){return{kind:`html`,html:e,mode:t}}function If(e){return{kind:`md`,md:e}}function Lf(e){let t=e.parentUrl??e.parent,n=e.caption??(e.body?.kind===`text`&&e.body.text.length>0?e.body.text:void 0);return{v:2,url:e.url,pulse:e.pulse,caption:n,body:e.body,author:e.author,source:e.source,sigilId:e.sigilId,phiKey:e.phiKey,kaiSignature:e.kaiSignature,parent:e.parent,parentUrl:t,originUrl:e.originUrl,ts:e.ts,attachments:e.attachments,seal:e.seal,usernameClaim:e.usernameClaim}}function Rf(e){let t={version:1,items:e.slice()},{totalBytes:n,inlinedBytes:r}=wf({attachments:t});return t.totalBytes=n,t.inlinedBytes=r,t}function zf(e){return{kind:`file-inline`,name:e.name,type:e.type,size:e.size,data_b64url:e.data_b64url,thumbnail_b64:e.thumbnail_b64}}function Bf(e){if(!/^[0-9a-f]{64}$/.test(e.sha256))throw Error(`sha256 must be 64 hex chars`);return{kind:`file-ref`,sha256:e.sha256,name:e.name,type:e.type,size:e.size,url:e.url}}function Vf(e){return{kind:`url`,url:e.url,title:e.title}}function Hf(e){let t=JSON.stringify(e);return`h:${Jf(Kf(new TextEncoder().encode(t)))}`}function Uf(e){if(!e.startsWith(`h:`))throw Error(`Invalid history param`);let t=qf(Yf(e.slice(2))),n=new TextDecoder().decode(t);return JSON.parse(n)}var Wf=e=>typeof globalThis.btoa==`function`?globalThis.btoa(e):Buffer.from(e,`binary`).toString(`base64`),Gf=e=>typeof globalThis.atob==`function`?globalThis.atob(e):Buffer.from(e,`base64`).toString(`binary`),Kf=e=>Wf(String.fromCharCode(...e)),qf=e=>Uint8Array.from(Gf(e),e=>e.charCodeAt(0)),Jf=e=>e.replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``),Yf=e=>{let t=e.replace(/-/g,`+`).replace(/_/g,`/`);return t+(t.length%4?`=`.repeat(4-t.length%4):``)};function Xf(e){let t={u:e.pulse,b:e.beat,s:e.stepIndex,c:e.chakraDay,d:e.stepsPerBeat??44,k:e.kaiSignature,p:e.userPhiKey};e.parentUrl&&(t.r=e.parentUrl),e.originUrl&&(t.o=e.originUrl);let n=JSON.stringify(t);return`c:${Jf(Kf(new TextEncoder().encode(n)))}`}function Zf(e){if(e.startsWith(`c:`)){let t=qf(Yf(e.slice(2))),n=new TextDecoder().decode(t),r=JSON.parse(n);return{pulse:Number(r.u)||0,beat:Number(r.b)||0,stepIndex:Number(r.s)||0,chakraDay:r.c,stepsPerBeat:Number(r.d)||44,kaiSignature:typeof r.k==`string`?r.k:void 0,userPhiKey:typeof r.p==`string`?r.p:void 0,parentUrl:typeof r.r==`string`?r.r:void 0,originUrl:typeof r.o==`string`?r.o:void 0}}let t=qf(Yf(e.startsWith(`j:`)?e.slice(2):e)),n=new TextDecoder().decode(t),r=JSON.parse(n),i={pulse:Number(r.pulse)||0,beat:Number(r.beat)||0,stepIndex:Number(r.stepIndex)||0,chakraDay:r.chakraDay,stepsPerBeat:Number(r.stepsPerBeat)||44,kaiSignature:typeof r.kaiSignature==`string`?r.kaiSignature:void 0,userPhiKey:typeof r.userPhiKey==`string`?r.userPhiKey:void 0,parentUrl:typeof r.parentUrl==`string`?r.parentUrl:void 0,originUrl:typeof r.originUrl==`string`?r.originUrl:void 0},a={expiresAtPulse:r.expiresAtPulse==null?void 0:Number(r.expiresAtPulse),canonicalHash:typeof r.canonicalHash==`string`?r.canonicalHash:void 0,transferNonce:typeof r.transferNonce==`string`?r.transferNonce:void 0,exportedAtPulse:r.exportedAtPulse==null?void 0:Number(r.exportedAtPulse),claimExtendUnit:r.claimExtendUnit===`breaths`||r.claimExtendUnit===`steps`?r.claimExtendUnit:void 0,claimExtendAmount:r.claimExtendAmount==null?void 0:Number(r.claimExtendAmount)};return{...r,...a,...i}}function Qf(e,t,n){let r=typeof window<`u`&&window.location?.origin?window.location.origin:``,i=n?.absolute===!1?``:n?.origin??r,a={...t},o=n?.parentUrl||(n?.autoInferParent&&typeof window<`u`?window.location.href:void 0);if(o&&!a.parentUrl){a.parentUrl=o;try{let e=np(o);a.originUrl=a.originUrl||e?.originUrl||o}catch{a.originUrl=a.originUrl||o}}let s=Xf(a),c=`/s/${encodeURIComponent(e)}?p=${s}`;return i?`${i}${c}`:c}function $f(e){try{return new URL(e,`resolve://`).searchParams.get(`p`)??null}catch{let t=e.match(/[?&]p=([^&#]+)/);return t?decodeURIComponent(t[1]):null}}function ep(e){try{let t=new URL(e,`https://example.invalid`);if(t.hash){let e=new URLSearchParams(t.hash.replace(/^#/,``)).get(`t`);if(e)return e}return Af(t.pathname)||(t.searchParams.get(`p`)??null)}catch{let t=e.match(/#(?:t|p)=([^&#]+)/);if(t)return decodeURIComponent(t[1]);let n=e.match(/\/p~([^/?#]+)/);if(n)return decodeURIComponent(n[1]);let r=e.match(/\/(?:stream|feed)\/p\/([^/]+)/);if(r)return decodeURIComponent(r[1]);let i=e.match(/[?&]p=([^&#]+)/);return i?decodeURIComponent(i[1]):null}}function tp(e){let t=ep(e);if(!t)return null;let n=vf(t);if(!n)return null;let r=0,i=0,a=`Root`,o=44;try{let e=Ir(n.pulse);typeof e.beat==`number`?r=e.beat:typeof e.beatIndex==`number`&&(r=e.beatIndex),typeof e.stepIndex==`number`&&(i=e.stepIndex),typeof e.chakraDay==`string`&&(a=e.chakraDay),typeof e.stepsPerBeat==`number`&&(o=e.stepsPerBeat)}catch{}let s=typeof n.parentUrl==`string`?n.parentUrl:typeof n.parent==`string`?n.parent:void 0;return{pulse:n.pulse,beat:r,stepIndex:i,chakraDay:a,stepsPerBeat:o,kaiSignature:typeof n.kaiSignature==`string`?n.kaiSignature:void 0,userPhiKey:typeof n.phiKey==`string`?n.phiKey:void 0,parentUrl:s,originUrl:typeof n.originUrl==`string`?n.originUrl:void 0,feed:n}}function np(e){let t=$f(e);if(t)try{return Zf(t)}catch{}return tp(e)}function rp(e){let t=[],n=e,r=new Set;for(;n&&!r.has(n);){r.add(n),t.push(n);let e=np(n);if(!e?.parentUrl)break;n=e.parentUrl}return t}function ip(e){let t=np(e);if(t?.originUrl)return t.originUrl;let n=rp(e);return n.length?n[n.length-1]:void 0}const ap=`kai:sigils:v1`,op=`sigil:urls`,sp=`kai-sigil-registry`;var cp=typeof window<`u`;function lp(e){if(!cp)return[];try{let t=window.localStorage.getItem(e);if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(e=>typeof e==`string`):[]}catch{return[]}}function up(e,t){if(cp)try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}}function dp(e,t){return e.includes(t)?!1:(e.push(t),!0)}function fp(e){try{return new URL(e,cp?window.location.origin:`https://example.invalid`).toString()}catch{return e}}var pp=null;function mp(){return!cp||!(`BroadcastChannel`in window)?null:pp||(pp=new BroadcastChannel(sp),pp)}function hp(e){if(!cp||!e)return;let t=fp(e),n=lp(ap);dp(n,t)&&up(ap,n);let r=lp(op);dp(r,t)&&up(op,r);try{window.dispatchEvent(new CustomEvent(`sigil:url-registered`,{detail:{url:t}}))}catch{}try{mp()?.postMessage({type:`sigil:add`,url:t})}catch{}}function gp(e){try{let t=new URL(e),n=t.pathname.match(/\/(?:s|sigil)\/([a-f0-9]{6,})/i)?.[1],r=np(e);if(n&&r)return Qf(n,r);let i=t.hash?.slice(1).match(/^([a-f0-9]{6,})$/i)?.[1];return i&&r?Qf(i,r):null}catch(e){return console.error(`Failed to generate canonical QR URL:`,e),null}}function _p(e){if(e)try{return new URL(e).origin}catch{}return typeof window<`u`&&typeof window.location?.origin==`string`&&window.location.origin?window.location.origin:`https://kaiklok.com`}function vp(e,t){let n=_p(t),r=(e??``).toString().trim().toLowerCase();if(!r)return n+`/`;let i=new URL(`/s/${encodeURIComponent(r)}`,n);if(typeof window<`u`){let e=new URLSearchParams(window.location.search),t=e.get(`d`);t&&i.searchParams.set(`d`,t);let n=e.get(`t`);n&&i.searchParams.set(`t`,n)}return i.toString()}const yp=(1+Math.sqrt(5))/2,bp=`ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial`,xp=1e3,Sp=xp/2,Cp={Root:{sides:4,hue:0},Sacral:{sides:6,hue:30},"Solar Plexus":{sides:5,hue:53},Heart:{sides:8,hue:122},Throat:{sides:12,hue:180},"Third Eye":{sides:14,hue:222},Crown:{sides:16,hue:258}},wp={Root:`Earth Gate`,Sacral:`Water Gate`,"Solar Plexus":`Fire Gate`,Heart:`Air Gate`,Throat:`Will Gate`,"Third Eye":`Light Gate`,Crown:`Ether Gate`},Tp={Root:194.18,Sacral:210.42,"Solar Plexus":378.4,Heart:620.9,Throat:1292.3,"Third Eye":1664.7,Crown:2594.2},Ep={Solhara:`Root`,Aquaris:`Solar Plexus`,Flamora:`Heart`,Verdari:`Throat`,Sonari:`Third Eye`,Kaelith:`Crown`},Dp=e=>e===`Solhara`||e===`Aquaris`||e===`Flamora`||e===`Verdari`||e===`Sonari`||e===`Kaelith`,Op=e=>Dp(e)?Ep[e]:e,kp=(e,t=100,n=50)=>`hsl(${e} ${t}% ${n}%)`,Ap=(e,t=0,n=.38)=>{let r=xp*n,i=[];for(let n=0;n{let r=[];for(let i=0;i<360;i+=1){let a=i/359*2*Math.PI,o=(Math.sin(e*a+n)+1)/2*xp,s=(Math.sin(t*a)+1)/2*xp;r.push(`${i?`L`:`M`}${o},${s}`)}return`${r.join(``)}Z`};function Mp(e){let t=((Number.isFinite(e)?Math.trunc(e):0)%484+484)%484,n=Math.floor(t/11);return Math.min(Math.max(0,n),43)}function Np(e){let t=((Number.isFinite(e)?Math.trunc(e):0)%484+484)%484%11/11;return t>=1?1-2**-52:t<0?0:t}const Pp=(e,t)=>+(Tp[e]*yp**((Number.isFinite(t)?t:0)/44)).toFixed(3),Fp=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Ip=e=>JSON.stringify(e,(e,t)=>t instanceof Date?t.toISOString():typeof t==`bigint`?t.toString():t),Lp=(e,t)=>{if(!Fp(e))return;let n=e[t];return typeof n==`string`?n:void 0},Rp=(e,t)=>{if(!Fp(e))return;let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0},zp=e=>`${e}`;var Bp=e=>e instanceof Date?e.toISOString():String(e);function Vp(e,t,n=6){let r={},i=(e,t)=>{r[`data-${e}`]=t},a=(e,t,r)=>{if(!(r>n)){if(Array.isArray(t)){i(e,JSON.stringify(t.map(e=>e instanceof Date?e.toISOString():e)));return}if(Fp(t)){for(let[n,i]of Object.entries(t))a(`${e}-${n.replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-+|-+$/g,``).toLowerCase()}`,i,r+1);return}typeof t==`number`||typeof t==`string`||t===void 0||t===`null`||t===null?i(e,t===null?void 0:typeof t==`number`?t:Bp(t)):i(e,Bp(t))}};for(let[n,r]of Object.entries(t))a(`${e}-${n.replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-+|-+$/g,``).toLowerCase()}`,r,1);return r}const Hp=(e,t=220)=>e?e.replace(/\s+/g,` `).trim().slice(0,t):void 0,Up=(e,t=NaN)=>typeof e==`number`&&Number.isFinite(e)?Math.trunc(e):t,Wp=(e,t=NaN)=>typeof e==`number`&&Number.isFinite(e)?Math.max(0,Math.min(1-2**-52,e)):t,Gp=e=>[...e].map(e=>e.toString(16)).map(e=>e.padStart(2,`0`)).join(``);function Kp(e){return!(typeof SharedArrayBuffer<`u`&&e.buffer instanceof SharedArrayBuffer)&&e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.slice().buffer}async function qp(e){let t=typeof e==`string`?new TextEncoder().encode(e):e,n=await crypto.subtle.digest(`SHA-256`,Kp(t));return new Uint8Array(n)}var Jp=`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`;function Yp(e){let t=0n;for(let n of e)t=(t<<8n)+BigInt(n);let n=``;for(;t>0n;){let e=t%58n;n=Jp[Number(e)]+n,t/=58n}for(let t=0;t>>0;return function(){t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|t)^e,((e^e>>>14)>>>0)/4294967296}}const Qp=e=>{let t=e.replace(/^0x/i,``),n=new Uint8Array(t.length/2);for(let e=0;e>>0;for(let n=0;n>>1:t>>>1}return~t>>>0}const em=e=>{let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=t.length%4;n&&(t+=`=`.repeat(4-n));let r=atob(t),i=new Uint8Array(r.length);for(let e=0;eString(e))),typeof e.ext==`boolean`&&(t.ext=e.ext),t}function rm(){let[e,t]=(0,C.useState)(!1),[n,r]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),n=window.matchMedia(`(prefers-contrast: more)`),i=()=>{t(!!e.matches),r(!!n.matches)};return i(),e.addEventListener?.(`change`,i),n.addEventListener?.(`change`,i),()=>{e.removeEventListener?.(`change`,i),n.removeEventListener?.(`change`,i)}},[]),{prefersReduce:e,prefersContrast:n}}var im=e=>typeof e==`object`&&!!e;function am(e){let[t,n]=(0,C.useState)(null),r=(0,C.useRef)(null);return(0,C.useEffect)(()=>{r.current=t},[t]),(0,C.useEffect)(()=>{if(e!==`moment`)return;let t=!1,r=async()=>{try{let e=await ji();!t&&im(e)&&n(e)}catch{}};r();let i=window.setInterval(r,qn);return()=>{t=!0,window.clearInterval(i)}},[e]),{kaiData:t,kaiDataRef:r}}function om(e){let t=e=>{let t=2166136261;for(let n=0;n>>0};return(0,C.useMemo)(()=>t(e),[e])}function sm(){return(0,C.useMemo)(()=>async e=>{let t=new TextEncoder().encode(e),n=await crypto.subtle.digest(`SHA-256`,Kp(t));return Array.from(new Uint8Array(n)).map(e=>e.toString(16)).map(e=>e.padStart(2,`0`)).join(``)},[])}var cm=({uid:e,size:t,phaseColor:n,outerRingText:r,innerRingText:i,animate:a,prefersReduce:o})=>{xp*.34;let s=340/yp,c=s*.96/(xp/2),l=`${e}-zk-phi-ring`,u=`${e}-zk-bin-ring`,d=`${e}-zk-grad`,f=`${e}-zk-petal-def`,p=Math.max(1,(t??240)*.008),m=Math.max(.9,(t??240)*.007),h=Math.max(1.2,(t??240)*.009),g=a&&!o,_=(0,C.useRef)(null);(0,C.useEffect)(()=>{if(!g)return;let e=_.current;if(!e)return;let t=0,n=performance.now(),r=qn/1e3,i=1/r*(yp*.21),a=1/r*((yp-1)*.17),o=1/r*(Math.SQRT2*.15),s=Math.PI/2,c=Math.PI/3,l=()=>{let r=(performance.now()-n)/1e3,u=5+1.6*(.5+.5*Math.sin(2*Math.PI*i*r)),d=8+1.2*(.5+.5*Math.sin(2*Math.PI*a*r+1.234)),f=s+c*Math.sin(2*Math.PI*o*r+.777);e.setAttribute(`d`,jp(u,d,f)),t=requestAnimationFrame(l)};return t=requestAnimationFrame(l),()=>cancelAnimationFrame(t)},[g]);let v=Math.max(8,(t??240)*.026),y=Math.max(7,(t??240)*.022),b=e=>e*.62,x=(e,t)=>{let n=2*Math.PI*e;return Math.max(48,Math.floor(n/b(t)))},S=(e,t)=>{let n=(e??``).trim();if(!n)return``;let r=[`sig=`,`b58=`,`len=`,`crc32=`,`creator=`,`zk=`,`alg=`,`day=`,`beat=`,`hz=`,`poseidon=`],i=n.split(` · `).map(e=>e.trim()).filter(Boolean),a=i.filter(e=>r.some(t=>e.startsWith(t))),o=(a.length?a:i).join(` · `);return o.length<=t?o:o.slice(0,Math.max(0,t-1)).trimEnd()+`…`},w=(0,C.useMemo)(()=>S(r,x(340,v)),[r,340,v]),T=(0,C.useMemo)(()=>S(i,x(s,y)),[i,s,y]),E=(e,t,n,r,i,a)=>{let o=Array.from(e);if(!o.length)return null;let s=-Math.PI/2,c=o.length,l=Math.max(.45,r*.085);return(0,W.jsx)(`g`,{"aria-hidden":`true`,pointerEvents:`none`,children:o.map((e,o)=>{let u=s+o/c*Math.PI*2;return(0,W.jsx)(`text`,{transform:`translate(${500+t*Math.cos(u)} ${500+t*Math.sin(u)}) rotate(${u*180/Math.PI+90})`,fontFamily:n,fontSize:r,fill:i,opacity:a,textAnchor:`middle`,dominantBaseline:`middle`,letterSpacing:`0`,stroke:`#001014`,strokeOpacity:`0.6`,strokeWidth:l,paintOrder:`stroke`,children:e},`${o}-${e}`)})})};return(0,W.jsxs)(`g`,{id:`${e}-zk-glyph`,"aria-label":`Atlantean zero-knowledge verification glyph`,pointerEvents:`none`,children:[(0,W.jsxs)(`defs`,{children:[(0,W.jsxs)(`radialGradient`,{id:d,cx:`50%`,cy:`50%`,r:`60%`,children:[(0,W.jsx)(`stop`,{offset:`0%`,stopColor:n,stopOpacity:`0.85`,children:g&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`animate`,{attributeName:`stop-opacity`,values:`.55;.85;.55`,dur:`${qn}ms`,repeatCount:`indefinite`}),(0,W.jsx)(`animate`,{attributeName:`stop-color`,values:`${n};#00FFD0;${n}`,dur:`${qn*3}ms`,repeatCount:`indefinite`})]})}),(0,W.jsx)(`stop`,{offset:`55%`,stopColor:n,stopOpacity:`0.55`,children:g&&(0,W.jsx)(`animate`,{attributeName:`stop-color`,values:`${n};#00FFD0;${n}`,dur:`${qn*3}ms`,repeatCount:`indefinite`})}),(0,W.jsx)(`stop`,{offset:`100%`,stopColor:`#00FFD0`,stopOpacity:`0.25`,children:g&&(0,W.jsx)(`animate`,{attributeName:`stop-opacity`,values:`.15;.35;.15`,dur:`${qn}ms`,repeatCount:`indefinite`})})]}),(0,W.jsx)(`path`,{id:l,d:`M 500 160 a 340 340 0 1 1 0 ${2*340} a 340 340 0 1 1 0 -${2*340}`,fill:`none`}),(0,W.jsx)(`path`,{id:u,d:`M 500 ${500-s} a ${s} ${s} 0 1 1 0 ${2*s} a ${s} ${s} 0 1 1 0 -${2*s}`,fill:`none`}),(0,W.jsx)(`path`,{id:f,ref:_,d:jp(5,8,Math.PI/2)})]}),(0,W.jsx)(`circle`,{cx:500,cy:500,r:340,fill:`none`,stroke:`url(#${d})`,strokeWidth:h,opacity:`0.5`,vectorEffect:`non-scaling-stroke`}),Array.from({length:12},(e,t)=>(0,W.jsx)(`use`,{href:`#${f}`,transform:`translate(500,500) scale(${c}) rotate(${t*30}) translate(-500,-500)`,stroke:`url(#${d})`,strokeWidth:p,strokeLinecap:`round`,strokeLinejoin:`round`,opacity:`0.42`,fill:`none`,vectorEffect:`non-scaling-stroke`},t)),(0,W.jsxs)(`g`,{opacity:`0.25`,children:[(0,W.jsx)(`circle`,{cx:500-s/2.2,cy:500,r:s*.86,fill:`none`,stroke:n,strokeWidth:m}),(0,W.jsx)(`circle`,{cx:500+s/2.2,cy:500,r:s*.86,fill:`none`,stroke:`#00FFD0`,strokeWidth:m})]}),(0,W.jsx)(`circle`,{cx:500,cy:500,r:s,fill:`none`,stroke:`url(#${d})`,strokeWidth:m,opacity:`0.55`,vectorEffect:`non-scaling-stroke`}),w&&E(w,340,`ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`,v,n,.33),T&&E(T,s,`ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial`,y,`#00FFD0`,.28)]})};function lm(e){if(e instanceof Date)return e.toISOString();if(e===null||typeof e==`string`||typeof e==`boolean`)return e;if(typeof e==`number`)return Number.isFinite(e)?e:null;if(Array.isArray(e))return e.map(e=>lm(e));let t=e,n={},r=Object.keys(t).sort();for(let e of r){let r=t[e];r!==void 0&&(n[e]=lm(r))}return n}function um(e){let t=lm(e);return JSON.stringify(t)}function dm(e){return new TextEncoder().encode(um(e))}async function fm(e){let{blake3:t}=await O(async()=>{let{blake3:e}=await import(`./index.esm-jE_FWBZ6.js`);return{blake3:e}},[]);return t(e)}var pm=4,mm=0,hm=1,gm=2;function _m(e){let t=e.length;for(;--t>=0;)e[t]=0}var vm=0,ym=1,bm=2,xm=3,Sm=258,Cm=29,wm=256,Tm=wm+1+Cm,Em=30,Dm=19,Om=2*Tm+1,km=15,Am=16,jm=7,Mm=256,Nm=16,Pm=17,Fm=18,Im=new Uint8Array([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]),Lm=new Uint8Array([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]),Rm=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),zm=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Bm=512,Vm=Array((Tm+2)*2);_m(Vm);var Hm=Array(Em*2);_m(Hm);var Um=Array(Bm);_m(Um);var Wm=Array(Sm-xm+1);_m(Wm);var Gm=Array(Cm);_m(Gm);var Km=Array(Em);_m(Km);function qm(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 Jm,Ym,Xm;function Zm(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}var Qm=e=>e<256?Um[e]:Um[256+(e>>>7)],$m=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},eh=(e,t,n)=>{e.bi_valid>Am-n?(e.bi_buf|=t<>Am-e.bi_valid,e.bi_valid+=n-Am):(e.bi_buf|=t<{eh(e,n[t*2],n[t*2+1])},nh=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},rh=e=>{e.bi_valid===16?($m(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)},ih=(e,t)=>{let 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<=km;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;lc&&(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--)}},ah=(e,t,n)=>{let r=Array(km+1),i=0,a,o;for(a=1;a<=km;a++)i=i+n[a-1]<<1,r[a]=i;for(o=0;o<=t;o++){let t=e[o*2+1];t!==0&&(e[o*2]=nh(r[t]++,t))}},oh=()=>{let e,t,n,r,i,a=Array(km+1);for(n=0,r=0;r>=7;r{let t;for(t=0;t{e.bi_valid>8?$m(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},lh=(e,t,n,r)=>{let i=t*2,a=n*2;return e[i]{let r=e.heap[n],i=n<<1;for(;i<=e.heap_len&&(i{let r,i,a=0,o,s;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+ a++]&255,r+=(e.pending_buf[e.sym_buf+ a++]&255)<<8,i=e.pending_buf[e.sym_buf+ a++],r===0?th(e,i,t):(o=Wm[i],th(e,o+wm+1,t),s=Im[o],s!==0&&(i-=Gm[o],eh(e,i,s)),r--,o=Qm(r),th(e,o,n),s=Lm[o],s!==0&&(r-=Km[o],eh(e,r,s)));while(a{let 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=Om,o=0;o>1;o>=1;o--)uh(e,n,o);l=a;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],uh(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++,uh(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],ih(e,t),ah(n,c,e.bl_count)},ph=(e,t,n)=>{let 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{let 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{let t;for(ph(e,e.dyn_ltree,e.l_desc.max_code),ph(e,e.dyn_dtree,e.d_desc.max_code),fh(e,e.bl_desc),t=Dm-1;t>=3&&e.bl_tree[zm[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},gh=(e,t,n,r)=>{let i;for(eh(e,t-257,5),eh(e,n-1,5),eh(e,r-4,4),i=0;i{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return mm;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return hm;for(n=32;n{vh||=(oh(),!0),e.l_desc=new Zm(e.dyn_ltree,Jm),e.d_desc=new Zm(e.dyn_dtree,Ym),e.bl_desc=new Zm(e.bl_tree,Xm),e.bi_buf=0,e.bi_valid=0,sh(e)},bh=(e,t,n,r)=>{eh(e,(vm<<1)+(r?1:0),3),ch(e),$m(e,n),$m(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},xh={_tr_init:yh,_tr_stored_block:bh,_tr_flush_block:(e,t,n,r)=>{let i,a,o=0;e.level>0?(e.strm.data_type===gm&&(e.strm.data_type=_h(e)),fh(e,e.l_desc),fh(e,e.d_desc),o=hh(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?bh(e,t,n,r):e.strategy===pm||a===i?(eh(e,(ym<<1)+(r?1:0),3),dh(e,Vm,Hm)):(eh(e,(bm<<1)+(r?1:0),3),gh(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),dh(e,e.dyn_ltree,e.dyn_dtree)),sh(e),r&&ch(e)},_tr_tally:(e,t,n)=>(e.pending_buf[e.sym_buf+ e.sym_next++]=t,e.pending_buf[e.sym_buf+ e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+ e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(Wm[n]+wm+1)*2]++,e.dyn_dtree[Qm(t)*2]++),e.sym_next===e.sym_end),_tr_align:e=>{eh(e,ym<<1,3),th(e,Mm,Vm),rh(e)}},Sh=(e,t,n,r)=>{let i=e&65535|0,a=e>>>16&65535|0,o=0;for(;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},Ch=new Uint32Array((()=>{let e,t=[];for(var 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})()),wh=(e,t,n,r)=>{let i=Ch,a=r+n;e^=-1;for(let n=r;n>>8^i[(e^t[n])&255];return e^-1},Th={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`},Eh={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:Dh,_tr_stored_block:Oh,_tr_flush_block:kh,_tr_tally:Ah,_tr_align:jh}=xh,{Z_NO_FLUSH:Mh,Z_PARTIAL_FLUSH:Nh,Z_FULL_FLUSH:Ph,Z_FINISH:Fh,Z_BLOCK:Ih,Z_OK:Lh,Z_STREAM_END:Rh,Z_STREAM_ERROR:zh,Z_DATA_ERROR:Bh,Z_BUF_ERROR:Vh,Z_DEFAULT_COMPRESSION:Hh,Z_FILTERED:Uh,Z_HUFFMAN_ONLY:Wh,Z_RLE:Gh,Z_FIXED:Kh,Z_DEFAULT_STRATEGY:qh,Z_UNKNOWN:Jh,Z_DEFLATED:Yh}=Eh,Xh=9,Zh=15,Qh=8,$h=286,eg=30,tg=19,ng=2*$h+1,rg=15,ig=3,ag=258,og=ag+ig+1,sg=32,cg=42,lg=57,ug=69,dg=73,fg=91,pg=103,mg=113,hg=666,gg=1,_g=2,vg=3,yg=4,bg=3,xg=(e,t)=>(e.msg=Th[t],t),Sg=e=>e*2-(e>4?9:0),Cg=e=>{let t=e.length;for(;--t>=0;)e[t]=0},wg=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=i?n-i:0;while(--t);t=i,r=t;do n=e.prev[--r],e.prev[r]=n>=i?n-i:0;while(--t)},Tg=(e,t,n)=>(t<{let t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,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))},Dg=(e,t)=>{kh(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Eg(e.strm)},Og=(e,t)=>{e.pending_buf[e.pending++]=t},kg=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},Ag=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),e.state.wrap===1?e.adler=Sh(e.adler,t,i,n):e.state.wrap===2&&(e.adler=wh(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},jg=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,a,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-og?e.strstart-(e.w_size-og):0,l=e.window,u=e.w_mask,d=e.prev,f=e.strstart+ag,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])continue;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]&&ro){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},Mg=e=>{let t=e.w_size,n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-og)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),wg(e),r+=t),e.strm.avail_in===0)break;if(n=Ag(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=ig)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Tg(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Tg(e,e.ins_h,e.window[i+ig-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,a,o=0,s=e.strm.avail_in;do{if(r=65535,a=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(r=i+e.strm.avail_in),r>a&&(r=a),r>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,Eg(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(Ag(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(o===0);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_watera&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,a+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),a>e.strm.avail_in&&(a=e.strm.avail_in),a&&(Ag(e.strm,e.window,e.strstart,a),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.high_water>3,a=e.pending_buf_size-a>65535?65535:e.pending_buf_size-a,n=a>e.w_size?e.w_size:a,i=e.strstart-e.block_start,(i>=n||(i||t===Fh)&&t!==Mh&&e.strm.avail_in===0&&i<=a)&&(r=i>a?a:i,o=t===Fh&&e.strm.avail_in===0&&r===i?1:0,Oh(e,e.block_start,r,o),e.block_start+=r,Eg(e.strm)),o?vg:gg)},Pg=(e,t)=>{let n,r;for(;;){if(e.lookahead=ig&&(e.ins_h=Tg(e,e.ins_h,e.window[e.strstart+ig-1]),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-og&&(e.match_length=jg(e,n)),e.match_length>=ig)if(r=Ah(e,e.strstart-e.match_start,e.match_length-ig),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=ig){e.match_length--;do e.strstart++,e.ins_h=Tg(e,e.ins_h,e.window[e.strstart+ig-1]),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=Tg(e,e.ins_h,e.window[e.strstart+1]);else r=Ah(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Dg(e,!1),e.strm.avail_out===0))return gg}return e.insert=e.strstart{let n,r,i;for(;;){if(e.lookahead=ig&&(e.ins_h=Tg(e,e.ins_h,e.window[e.strstart+ig-1]),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=ig-1,n!==0&&e.prev_length4096)&&(e.match_length=ig-1)),e.prev_length>=ig&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-ig,r=Ah(e,e.strstart-1-e.prev_match,e.prev_length-ig),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=Tg(e,e.ins_h,e.window[e.strstart+ig-1]),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=ig-1,e.strstart++,r&&(Dg(e,!1),e.strm.avail_out===0))return gg}else if(e.match_available){if(r=Ah(e,0,e.window[e.strstart-1]),r&&Dg(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return gg}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&=(r=Ah(e,0,e.window[e.strstart-1]),0),e.insert=e.strstart{let n,r,i,a,o=e.window;for(;;){if(e.lookahead<=ag){if(Mg(e),e.lookahead<=ag&&t===Mh)return gg;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=ig&&e.strstart>0&&(i=e.strstart-1,r=o[i],r===o[++i]&&r===o[++i]&&r===o[++i])){a=e.strstart+ag;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]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=ig?(n=Ah(e,1,e.match_length-ig),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Ah(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Dg(e,!1),e.strm.avail_out===0))return gg}return e.insert=0,t===Fh?(Dg(e,!0),e.strm.avail_out===0?vg:yg):e.sym_next&&(Dg(e,!1),e.strm.avail_out===0)?gg:_g},Lg=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(Mg(e),e.lookahead===0)){if(t===Mh)return gg;break}if(e.match_length=0,n=Ah(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Dg(e,!1),e.strm.avail_out===0))return gg}return e.insert=0,t===Fh?(Dg(e,!0),e.strm.avail_out===0?vg:yg):e.sym_next&&(Dg(e,!1),e.strm.avail_out===0)?gg:_g};function Rg(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 zg=[new Rg(0,0,0,0,Ng),new Rg(4,4,8,4,Pg),new Rg(4,5,16,8,Pg),new Rg(4,6,32,32,Pg),new Rg(4,4,16,16,Fg),new Rg(8,16,32,32,Fg),new Rg(8,16,128,128,Fg),new Rg(8,32,128,256,Fg),new Rg(32,128,258,1024,Fg),new Rg(32,258,258,4096,Fg)],Bg=e=>{e.window_size=2*e.w_size,Cg(e.head),e.max_lazy_match=zg[e.level].max_lazy,e.good_match=zg[e.level].good_length,e.nice_match=zg[e.level].nice_length,e.max_chain_length=zg[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=ig-1,e.match_available=0,e.ins_h=0};function Vg(){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=Yh,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 Uint16Array(ng*2),this.dyn_dtree=new Uint16Array((2*eg+1)*2),this.bl_tree=new Uint16Array((2*tg+1)*2),Cg(this.dyn_ltree),Cg(this.dyn_dtree),Cg(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(rg+1),this.heap=new Uint16Array(2*$h+1),Cg(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*$h+1),Cg(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var Hg=e=>{if(!e)return 1;let t=e.state;return!t||t.strm!==e||t.status!==cg&&t.status!==lg&&t.status!==ug&&t.status!==dg&&t.status!==fg&&t.status!==pg&&t.status!==mg&&t.status!==hg?1:0},Ug=e=>{if(Hg(e))return xg(e,zh);e.total_in=e.total_out=0,e.data_type=Jh;let t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?lg:t.wrap?cg:mg,e.adler=t.wrap===2?0:1,t.last_flush=-2,Dh(t),Lh},Wg=e=>{let t=Ug(e);return t===Lh&&Bg(e.state),t},Gg=(e,t)=>Hg(e)||e.state.wrap!==2?zh:(e.state.gzhead=t,Lh),Kg=(e,t,n,r,i,a)=>{if(!e)return zh;let o=1;if(t===Hh&&(t=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),i<1||i>Xh||n!==Yh||r<8||r>15||t<0||t>9||a<0||a>Kh||r===8&&o!==1)return xg(e,zh);r===8&&(r=9);let s=new Vg;return e.state=s,s.strm=e,s.status=cg,s.wrap=o,s.gzhead=null,s.w_bits=r,s.w_size=1<Kg(e,t,Yh,Zh,Qh,qh),deflateInit2:Kg,deflateReset:Wg,deflateResetKeep:Ug,deflateSetHeader:Gg,deflate:(e,t)=>{if(Hg(e)||t>Ih||t<0)return e?xg(e,zh):zh;let n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===hg&&t!==Fh)return xg(e,e.avail_out===0?Vh:zh);let r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(Eg(e),e.avail_out===0)return n.last_flush=-1,Lh}else if(e.avail_in===0&&Sg(t)<=Sg(r)&&t!==Fh)return xg(e,Vh);if(n.status===hg&&e.avail_in!==0)return xg(e,Vh);if(n.status===cg&&n.wrap===0&&(n.status=mg),n.status===cg){let t=Yh+(n.w_bits-8<<4)<<8,r=-1;if(r=n.strategy>=Wh||n.level<2?0:n.level<6?1:n.level===6?2:3,t|=r<<6,n.strstart!==0&&(t|=sg),t+=31-t%31,kg(n,t),n.strstart!==0&&(kg(n,e.adler>>>16),kg(n,e.adler&65535)),e.adler=1,n.status=mg,Eg(e),n.pending!==0)return n.last_flush=-1,Lh}if(n.status===lg){if(e.adler=0,Og(n,31),Og(n,139),Og(n,8),n.gzhead)Og(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Og(n,n.gzhead.time&255),Og(n,n.gzhead.time>>8&255),Og(n,n.gzhead.time>>16&255),Og(n,n.gzhead.time>>24&255),Og(n,n.level===9?2:n.strategy>=Wh||n.level<2?4:0),Og(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(Og(n,n.gzhead.extra.length&255),Og(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=wh(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=ug;else if(Og(n,0),Og(n,0),Og(n,0),Og(n,0),Og(n,0),Og(n,n.level===9?2:n.strategy>=Wh||n.level<2?4:0),Og(n,bg),n.status=mg,Eg(e),n.pending!==0)return n.last_flush=-1,Lh}if(n.status===ug){if(n.gzhead.extra){let t=n.pending,r=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+r>n.pending_buf_size;){let i=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>t&&(e.adler=wh(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex+=i,Eg(e),n.pending!==0)return n.last_flush=-1,Lh;t=0,r-=i}let i=new Uint8Array(n.gzhead.extra);n.pending_buf.set(i.subarray(n.gzindex,n.gzindex+r),n.pending),n.pending+=r,n.gzhead.hcrc&&n.pending>t&&(e.adler=wh(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=dg}if(n.status===dg){if(n.gzhead.name){let t=n.pending,r;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>t&&(e.adler=wh(e.adler,n.pending_buf,n.pending-t,t)),Eg(e),n.pending!==0)return n.last_flush=-1,Lh;t=0}r=n.gzindext&&(e.adler=wh(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=fg}if(n.status===fg){if(n.gzhead.comment){let t=n.pending,r;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>t&&(e.adler=wh(e.adler,n.pending_buf,n.pending-t,t)),Eg(e),n.pending!==0)return n.last_flush=-1,Lh;t=0}r=n.gzindext&&(e.adler=wh(e.adler,n.pending_buf,n.pending-t,t))}n.status=pg}if(n.status===pg){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Eg(e),n.pending!==0))return n.last_flush=-1,Lh;Og(n,e.adler&255),Og(n,e.adler>>8&255),e.adler=0}if(n.status=mg,Eg(e),n.pending!==0)return n.last_flush=-1,Lh}if(e.avail_in!==0||n.lookahead!==0||t!==Mh&&n.status!==hg){let r=n.level===0?Ng(n,t):n.strategy===Wh?Lg(n,t):n.strategy===Gh?Ig(n,t):zg[n.level].func(n,t);if((r===vg||r===yg)&&(n.status=hg),r===gg||r===vg)return e.avail_out===0&&(n.last_flush=-1),Lh;if(r===_g&&(t===Nh?jh(n):t!==Ih&&(Oh(n,0,0,!1),t===Ph&&(Cg(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),Eg(e),e.avail_out===0))return n.last_flush=-1,Lh}return t===Fh?n.wrap<=0?Rh:(n.wrap===2?(Og(n,e.adler&255),Og(n,e.adler>>8&255),Og(n,e.adler>>16&255),Og(n,e.adler>>24&255),Og(n,e.total_in&255),Og(n,e.total_in>>8&255),Og(n,e.total_in>>16&255),Og(n,e.total_in>>24&255)):(kg(n,e.adler>>>16),kg(n,e.adler&65535)),Eg(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending===0?Rh:Lh):Lh},deflateEnd:e=>{if(Hg(e))return zh;let t=e.state.status;return e.state=null,t===mg?xg(e,Bh):Lh},deflateSetDictionary:(e,t)=>{let n=t.length;if(Hg(e))return zh;let r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==cg||r.lookahead)return zh;if(i===1&&(e.adler=Sh(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(Cg(r.head),r.strstart=0,r.block_start=0,r.insert=0);let e=new Uint8Array(r.w_size);e.set(t.subarray(n-r.w_size,n),0),t=e,n=r.w_size}let a=e.avail_in,o=e.next_in,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,Mg(r);r.lookahead>=ig;){let e=r.strstart,t=r.lookahead-(ig-1);do r.ins_h=Tg(r,r.ins_h,r.window[e+ig-1]),r.prev[e&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=e,e++;while(--t);r.strstart=e,r.lookahead=ig-1,Mg(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=ig-1,r.match_available=0,e.next_in=o,e.input=s,e.avail_in=a,r.wrap=i,Lh},deflateInfo:`pako deflate (from Nodeca project)`},Jg=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Yg={assign:function(e){let t=Array.prototype.slice.call(arguments,1);for(;t.length;){let n=t.shift();if(n){if(typeof n!=`object`)throw TypeError(n+`must be non-object`);for(let t in n)Jg(n,t)&&(e[t]=n[t])}}return e},flattenChunks:e=>{let t=0;for(let n=0,r=e.length;n=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Zg[254]=Zg[254]=1;var Qg=e=>{if(typeof TextEncoder==`function`&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,a,o=e.length,s=0;for(i=0;i>>6,t[a++]=128|n&63):n<65536?(t[a++]=224|n>>>12,t[a++]=128|n>>>6&63,t[a++]=128|n&63):(t[a++]=240|n>>>18,t[a++]=128|n>>>12&63,t[a++]=128|n>>>6&63,t[a++]=128|n&63);return t},$g=(e,t)=>{if(t<65534&&e.subarray&&Xg)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n=``;for(let r=0;r{let n=t||e.length;if(typeof TextDecoder==`function`&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i,a=Array(n*2);for(i=0,r=0;r4){a[i++]=65533,r+=o-1;continue}for(t&=o===2?31:o===3?15:7;o>1&&r1){a[i++]=65533;continue}t<65536?a[i++]=t:(t-=65536,a[i++]=55296|t>>10&1023,a[i++]=56320|t&1023)}return $g(a,i)},utf8border:(e,t)=>{t||=e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)==128;)n--;return n<0||n===0?t:n+Zg[e[n]]>t?n:t}};function t_(){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}var n_=t_,r_=Object.prototype.toString,{Z_NO_FLUSH:i_,Z_SYNC_FLUSH:a_,Z_FULL_FLUSH:o_,Z_FINISH:s_,Z_OK:c_,Z_STREAM_END:l_,Z_DEFAULT_COMPRESSION:u_,Z_DEFAULT_STRATEGY:d_,Z_DEFLATED:f_}=Eh;function p_(e){this.options=Yg.assign({level:u_,method:f_,chunkSize:16384,windowBits:15,memLevel:8,strategy:d_},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg=``,this.ended=!1,this.chunks=[],this.strm=new n_,this.strm.avail_out=0;let n=qg.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==c_)throw Error(Th[n]);if(t.header&&qg.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e=typeof t.dictionary==`string`?e_.string2buf(t.dictionary):r_.call(t.dictionary)===`[object ArrayBuffer]`?new Uint8Array(t.dictionary):t.dictionary,n=qg.deflateSetDictionary(this.strm,e),n!==c_)throw Error(Th[n]);this._dict_set=!0}}p_.prototype.push=function(e,t){let n=this.strm,r=this.options.chunkSize,i,a;if(this.ended)return!1;for(a=t===~~t?t:t===!0?s_:i_,typeof e==`string`?n.input=e_.string2buf(e):r_.call(e)===`[object ArrayBuffer]`?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(a===a_||a===o_)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=qg.deflate(n,a),i===l_)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=qg.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===c_;if(n.avail_out===0){this.onData(n.output);continue}if(a>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0},p_.prototype.onData=function(e){this.chunks.push(e)},p_.prototype.onEnd=function(e){e===c_&&(this.result=Yg.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function m_(e,t){let n=new p_(t);if(n.push(e,!0),n.err)throw n.msg||Th[n.err];return n.result}function h_(e,t){return t||={},t.raw=!0,m_(e,t)}function g_(e,t){return t||={},t.gzip=!0,m_(e,t)}var __={Deflate:p_,deflate:m_,deflateRaw:h_,gzip:g_,constants:Eh},v_=16209,y_=16191,b_=function(e,t){let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E=e.state;n=e.next_in,w=e.input,r=n+(e.avail_in-5),i=e.next_out,T=e.output,a=i-(t-e.avail_out),o=i+(e.avail_out-257),s=E.dmax,c=E.wsize,l=E.whave,u=E.wnext,d=E.window,f=E.hold,p=E.bits,m=E.lencode,h=E.distcode,g=(1<>>24,f>>>=y,p-=y,y=v>>>16&255,y===0)T[i++]=v&65535;else if(y&16){b=v&65535,y&=15,y&&(p>>=y,p-=y),p<15&&(f+=w[n++]<>>24,f>>>=y,p-=y,y=v>>>16&255,y&16){if(x=v&65535,y&=15,ps){e.msg=`invalid distance too far back`,E.mode=v_;break top}if(f>>>=y,p-=y,y=i-a,x>y){if(y=x-y,y>l&&E.sane){e.msg=`invalid distance too far back`,E.mode=v_;break top}if(S=0,C=d,u===0){if(S+=c-y,y2;)T[i++]=C[S++],T[i++]=C[S++],T[i++]=C[S++],b-=3;b&&(T[i++]=C[S++],b>1&&(T[i++]=C[S++]))}else{S=i-x;do T[i++]=T[S++],T[i++]=T[S++],T[i++]=T[S++],b-=3;while(b>2);b&&(T[i++]=T[S++],b>1&&(T[i++]=T[S++]))}}else if(y&64){e.msg=`invalid distance code`,E.mode=v_;break top}else{v=h[(v&65535)+(f&(1<>3,n-=b,p-=b<<3,f&=(1<{let 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,E=new Uint16Array(x_+1),D=new Uint16Array(x_+1),O=null,k,A,j;for(l=0;l<=x_;l++)E[l]=0;for(u=0;u=1&&E[f]===0;f--);if(p>f&&(p=f),f===0)return i[a++]=20971520,i[a++]=20971520,s.bits=1,0;for(d=1;d0&&(e===w_||f!==1))return-1;for(D[1]=0,l=1;lS_||e===E_&&_>C_)return 1;for(;;){k=l-h,o[u]+1=T?(A=O[o[u]-T],j=w[o[u]-T]):(A=96,j=0),y=1<>h)+b]=k<<24|A<<16|j|0;while(b!==0);for(y=1<>=1;if(y===0?v=0:(v&=y-1,v+=y),u++,--E[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<S_||e===E_&&_>C_)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},M_=0,N_=1,P_=2,{Z_FINISH:F_,Z_BLOCK:I_,Z_TREES:L_,Z_OK:R_,Z_STREAM_END:z_,Z_NEED_DICT:B_,Z_STREAM_ERROR:V_,Z_DATA_ERROR:H_,Z_MEM_ERROR:U_,Z_BUF_ERROR:W_,Z_DEFLATED:G_}=Eh,K_=16180,q_=16181,J_=16182,Y_=16183,X_=16184,Z_=16185,Q_=16186,$_=16187,ev=16188,tv=16189,nv=16190,rv=16191,iv=16192,av=16193,ov=16194,sv=16195,cv=16196,lv=16197,uv=16198,dv=16199,fv=16200,pv=16201,mv=16202,hv=16203,gv=16204,_v=16205,vv=16206,yv=16207,bv=16208,xv=16209,Sv=16210,Cv=16211,wv=852,Tv=592,Ev=15,Dv=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function Ov(){this.strm=null,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 Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var kv=e=>{if(!e)return 1;let t=e.state;return!t||t.strm!==e||t.modeCv?1:0},Av=e=>{if(kv(e))return V_;let t=e.state;return e.total_in=e.total_out=t.total=0,e.msg=``,t.wrap&&(e.adler=t.wrap&1),t.mode=K_,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(wv),t.distcode=t.distdyn=new Int32Array(Tv),t.sane=1,t.back=-1,R_},jv=e=>{if(kv(e))return V_;let t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Av(e)},Mv=(e,t)=>{let n;if(kv(e))return V_;let r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?V_:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,jv(e))},Nv=(e,t)=>{if(!e)return V_;let n=new Ov;e.state=n,n.strm=e,n.window=null,n.mode=K_;let r=Mv(e,t);return r!==R_&&(e.state=null),r},Pv=e=>Nv(e,Ev),Fv=!0,Iv,Lv,Rv=e=>{if(Fv){Iv=new Int32Array(512),Lv=new Int32Array(32);let t=0;for(;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(j_(N_,e.lens,0,288,Iv,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;j_(P_,e.lens,0,32,Lv,0,e.work,{bits:5}),Fv=!1}e.lencode=Iv,e.lenbits=9,e.distcode=Lv,e.distbits=5},zv=(e,t,n,r)=>{let i,a=e.state;return a.window===null&&(a.wsize=1<=a.wsize?(a.window.set(t.subarray(n-a.wsize,n),0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>r&&(i=r),a.window.set(t.subarray(n-r,n-r+i),a.wnext),r-=i,r?(a.window.set(t.subarray(n-r,n),0),a.wnext=r,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave{let 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 Uint8Array(4),E,D,O=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(kv(e)||!e.output||!e.input&&e.avail_in!==0)return V_;n=e.state,n.mode===rv&&(n.mode=iv),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=R_;inf_leave:for(;;)switch(n.mode){case K_:if(n.wrap===0){n.mode=iv;break}for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<>>8&255,n.check=wh(n.check,T,2,0),l=0,u=0,n.mode=q_;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((l&255)<<8)+(l>>8))%31){e.msg=`incorrect header check`,n.mode=xv;break}if((l&15)!==G_){e.msg=`unknown compression method`,n.mode=xv;break}if(l>>>=4,u-=4,C=(l&15)+8,n.wbits===0&&(n.wbits=C),C>15||C>n.wbits){e.msg=`invalid window size`,n.mode=xv;break}n.dmax=1<>8&1),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,n.check=wh(n.check,T,2,0)),l=0,u=0,n.mode=J_;case J_:for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<>>8&255,T[2]=l>>>16&255,T[3]=l>>>24&255,n.check=wh(n.check,T,4,0)),l=0,u=0,n.mode=Y_;case Y_:for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<>8),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,n.check=wh(n.check,T,2,0)),l=0,u=0,n.mode=X_;case X_:if(n.flags&1024){for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<>>8&255,n.check=wh(n.check,T,2,0)),l=0,u=0}else n.head&&(n.head.extra=null);n.mode=Z_;case Z_: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=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(a,a+p),C)),n.flags&512&&n.wrap&4&&(n.check=wh(n.check,r,p,a)),s-=p,a+=p,n.length-=p),n.length))break inf_leave;n.length=0,n.mode=Q_;case Q_: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>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=rv;break;case tv:for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<>>=u&7,u-=u&7,n.mode=vv;break}for(;u<3;){if(s===0)break inf_leave;s--,l+=r[a++]<>>=1,--u,l&3){case 0:n.mode=av;break;case 1:if(Rv(n),n.mode=dv,t===L_){l>>>=2,u-=2;break inf_leave}break;case 2:n.mode=cv;break;case 3:e.msg=`invalid block type`,n.mode=xv}l>>>=2,u-=2;break;case av:for(l>>>=u&7,u-=u&7;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<>>16^65535)){e.msg=`invalid stored block lengths`,n.mode=xv;break}if(n.length=l&65535,l=0,u=0,n.mode=ov,t===L_)break inf_leave;case ov:n.mode=sv;case sv:if(p=n.length,p){if(p>s&&(p=s),p>c&&(p=c),p===0)break inf_leave;i.set(r.subarray(a,a+p),o),s-=p,a+=p,c-=p,o+=p,n.length-=p;break}n.mode=rv;break;case cv:for(;u<14;){if(s===0)break inf_leave;s--,l+=r[a++]<>>=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=xv;break}n.have=0,n.mode=lv;case lv:for(;n.have>>=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=j_(M_,n.lens,0,19,n.lencode,0,n.work,E),n.lenbits=E.bits,w){e.msg=`invalid code lengths set`,n.mode=xv;break}n.have=0,n.mode=uv;case uv:for(;n.have>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<>>=_,u-=_,n.lens[n.have++]=y;else{if(y===16){for(D=_+2;u>>=_,u-=_,n.have===0){e.msg=`invalid bit length repeat`,n.mode=xv;break}C=n.lens[n.have-1],p=3+(l&3),l>>>=2,u-=2}else if(y===17){for(D=_+3;u>>=_,u-=_,C=0,p=3+(l&7),l>>>=3,u-=3}else{for(D=_+7;u>>=_,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=xv;break}for(;p--;)n.lens[n.have++]=C}}if(n.mode===xv)break;if(n.lens[256]===0){e.msg=`invalid code -- missing end-of-block`,n.mode=xv;break}if(n.lenbits=9,E={bits:n.lenbits},w=j_(N_,n.lens,0,n.nlen,n.lencode,0,n.work,E),n.lenbits=E.bits,w){e.msg=`invalid literal/lengths set`,n.mode=xv;break}if(n.distbits=6,n.distcode=n.distdyn,E={bits:n.distbits},w=j_(P_,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,E),n.distbits=E.bits,w){e.msg=`invalid distances set`,n.mode=xv;break}if(n.mode=dv,t===L_)break inf_leave;case dv:n.mode=fv;case fv: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,b_(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===rv&&(n.back=-1);break}for(n.back=0;g=n.lencode[l&(1<>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<>b)],_=g>>>24,v=g>>>16&255,y=g&65535,!(b+_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<>>=b,u-=b,n.back+=b}if(l>>>=_,u-=_,n.back+=_,n.length=y,v===0){n.mode=_v;break}if(v&32){n.back=-1,n.mode=rv;break}if(v&64){e.msg=`invalid literal/length code`,n.mode=xv;break}n.extra=v&15,n.mode=pv;case pv:if(n.extra){for(D=n.extra;u>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=mv;case mv:for(;g=n.distcode[l&(1<>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<>b)],_=g>>>24,v=g>>>16&255,y=g&65535,!(b+_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<>>=b,u-=b,n.back+=b}if(l>>>=_,u-=_,n.back+=_,v&64){e.msg=`invalid distance code`,n.mode=xv;break}n.offset=y,n.extra=v&15,n.mode=hv;case hv:if(n.extra){for(D=n.extra;u>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg=`invalid distance too far back`,n.mode=xv;break}n.mode=gv;case gv: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=xv;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=fv);break;case _v:if(c===0)break inf_leave;i[o++]=n.length,c--,n.mode=fv;break;case vv:if(n.wrap){for(;u<32;){if(s===0)break inf_leave;s--,l|=r[a++]<{if(kv(e))return V_;let t=e.state;return t.window&&=null,e.state=null,R_},inflateGetHeader:(e,t)=>{if(kv(e))return V_;let n=e.state;return n.wrap&2?(n.head=t,t.done=!1,R_):V_},inflateSetDictionary:(e,t)=>{let n=t.length,r,i,a;return kv(e)||(r=e.state,r.wrap!==0&&r.mode!==nv)?V_:r.mode===nv&&(i=1,i=Sh(i,t,n,0),i!==r.check)?H_:(a=zv(e,t,n,n),a?(r.mode=Sv,U_):(r.havedict=1,R_))},inflateInfo:`pako inflate (from Nodeca project)`};function Vv(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name=``,this.comment=``,this.hcrc=0,this.done=!1}var Hv=Vv,Uv=Object.prototype.toString,{Z_NO_FLUSH:Wv,Z_FINISH:Gv,Z_OK:Kv,Z_STREAM_END:qv,Z_NEED_DICT:Jv,Z_STREAM_ERROR:Yv,Z_DATA_ERROR:Xv,Z_MEM_ERROR:Zv}=Eh;function Qv(e){this.options=Yg.assign({chunkSize:1024*64,windowBits:15,to:``},e||{});let t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg=``,this.ended=!1,this.chunks=[],this.strm=new n_,this.strm.avail_out=0;let n=Bv.inflateInit2(this.strm,t.windowBits);if(n!==Kv||(this.header=new Hv,Bv.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary==`string`?t.dictionary=e_.string2buf(t.dictionary):Uv.call(t.dictionary)===`[object ArrayBuffer]`&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=Bv.inflateSetDictionary(this.strm,t.dictionary),n!==Kv))))throw Error(Th[n])}Qv.prototype.push=function(e,t){let n=this.strm,r=this.options.chunkSize,i=this.options.dictionary,a,o,s;if(this.ended)return!1;for(o=t===~~t?t:t===!0?Gv:Wv,Uv.call(e)===`[object ArrayBuffer]`?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),a=Bv.inflate(n,o),a===Jv&&i&&(a=Bv.inflateSetDictionary(n,i),a===Kv?a=Bv.inflate(n,o):a===Xv&&(a=Jv));n.avail_in>0&&a===qv&&n.state.wrap>0&&e[n.next_in]!==0;)Bv.inflateReset(n),a=Bv.inflate(n,o);switch(a){case Yv:case Xv:case Jv:case Zv:return this.onEnd(a),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(n.avail_out===0||a===qv))if(this.options.to===`string`){let e=e_.utf8border(n.output,n.next_out),t=n.next_out-e,i=e_.buf2string(n.output,e);n.next_out=t,n.avail_out=r-t,t&&n.output.set(n.output.subarray(e,e+t),0),this.onData(i)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(a===Kv&&s===0)){if(a===qv)return a=Bv.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(n.avail_in===0)break}}return!0},Qv.prototype.onData=function(e){this.chunks.push(e)},Qv.prototype.onEnd=function(e){e===Kv&&(this.options.to===`string`?this.result=this.chunks.join(``):this.result=Yg.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function $v(e,t){let n=new Qv(t);if(n.push(e),n.err)throw n.msg||Th[n.err];return n.result}function ey(e,t){return t||={},t.raw=!0,$v(e,t)}var ty={Inflate:Qv,inflate:$v,inflateRaw:ey,ungzip:$v,constants:Eh},{Deflate:ny,deflate:ry,deflateRaw:iy,gzip:ay}=__,{Inflate:oy,inflate:sy,inflateRaw:cy,ungzip:ly}=ty,uy=ay;function dy(e){if(typeof window<`u`&&typeof window.btoa==`function`){let t=``;for(let n=0;ne.hash);for(;t.length>1;){let e=[];for(let n=0;ne.pulse),0)}}async function ky(e){let t=JSON.stringify(e);return{v:1,codec:`gzip+base64`,payload:fy(new TextEncoder().encode(t))}}const Ay={async publish(e){return{headCid:``}}};async function jy(e){let{ipfs:t=Ay,packedLedgerBytes:n,prevCid:r,sign:i,pubKeyJwk:a,merkleRoot:o,pulse:s}=e,{headCid:c}=await t.publish(n).catch(()=>({headCid:``})),l=``;return c&&i&&(l=My(await i(new TextEncoder().encode(`${c}|${o}|${s}`)))),{headCid:c,prevCid:r,merkleRoot:o,pulse:s,headSig:l,pubKeyJwk:a}}function My(e){let t=``,n=32768;for(let r=0;r{let t=(e||``).toLowerCase().replace(/\s+/g,` `).trim();return t===`root`?`Root`:t===`sacral`?`Sacral`:t===`solar plexus`||t===`solarplexus`?`Solar Plexus`:t===`heart`?`Heart`:t===`throat`?`Throat`:t===`third eye`||t===`thirdeye`||t===`third-eye`?`Third Eye`:`Crown`};async function Iy(e){let{canon:t,hashMode:n,chakraGate:r,kaiSignature:i,userPhiKey:a,origin:o,title:s,weekdayResolved:c,valuationSource:l,mintSeal:u,frequencyHzCurrent:d,creatorResolved:f}=e,p=new Date().toISOString(),m=(n??`moment`)===`moment`,h={v:`1.0`,title:s,creator:f.creator,creatorAlg:f.creatorAlg,creatorId:f.creatorId,pulse:t.pulse,...m?{timestamp:p}:{}},g=Hp(s,300)??`Day Seal: ${t.beat}:${t.stepIndex} • Kai-Pulse ${t.pulse}`,_={v:`1.0`,kaiSignature:i??``,phikey:a??``,pulse:t.pulse,beat:t.beat,stepIndex:t.stepIndex,chakraDay:t.chakraDayKey,chakraGate:r,kaiPulse:t.pulse,stepsPerBeat:t.stepsPerBeat,...m?{timestamp:p}:{},eternalRecord:g,creatorResolved:h.creator,origin:o??(typeof window<`u`?window.location.origin:``),proofHints:{scheme:`groth16-poseidon`,api:`/api/proof/sigil`,explorer:`/keystream/hash/`},zkPoseidonHash:`7110303097080024260800444665787206606103183587082596139871399733998958991511`,zkProof:{pi_a:[`19856134890912647180646267915828904326160277174078581619567068747845749027250`,`10106391353796902212003294779502313309244930326624220933310482777016833544602`,`1`],pi_b:[[`15332824283171511432216330300808558575577774780613056045013182220474274609373`,`520780065640616094309336546820413644814574749252299536726307039414737648361`],[`19765599185680435083316275297102369245623399312670847112193589466041197993879`,`18523858679421850672423367816452968252787306686524085684854491935388533516266`],[`1`,`0`]],pi_c:[`17563530240039003419001811545927065585981558862932312235837455317235418749777`,`8962254954310810065423022980767523639237247171719646270365369937175985524426`,`1`]}},v=dm({v:_.v,kaiSignature:_.kaiSignature,phikey:_.phikey,pulse:_.pulse,beat:_.beat,stepIndex:_.stepIndex,chakraDay:_.chakraDay,chakraGate:_.chakraGate,kaiPulse:_.kaiPulse,stepsPerBeat:_.stepsPerBeat,timestamp:_.timestamp,eternalRecord:_.eternalRecord,creatorResolved:_.creatorResolved,origin:_.origin,proofHints:_.proofHints,zkPoseidonHash:_.zkPoseidonHash,zkProof:_.zkProof,ownerPubKey:_.ownerPubKey?nm(_.ownerPubKey):void 0,ownerSig:_.ownerSig}),y=(await fm(v)).toLowerCase(),b=Array.from(await qp(v)).map(e=>e.toString(16).padStart(2,`0`)).join(``),x=fy(v),S;hy()&&(S=await gy(y));let C={payloadEncoding:`gzip+base64`,payloadHash:{alg:`blake3`,value:y},payloadHashSecondary:{alg:`sha256`,value:b},payloadSignature:S??{alg:`harmonic-sig`,public:a??f.creatorId,value:``}},w=Ny(Kp(dm({parentCanonical:`optional-parent-ref`,parentStateRoot:`optional-state-root`,eventKind:`mint`,pulse:t.pulse,beat:t.beat,stepIndex:t.stepIndex,chakraDay:t.chakraDayKey,childNonce:`${t.beat}-${t.stepIndex}`,amount:`1.000`,expiresAtPulse:t.pulse+12,lineageCommitment:`optional-hash-of-lineage`}))),{publicKeyJwk:T,privateKey:E}=await yy(),D=await by(E,w);_.ownerPubKey=T,_.ownerSig=D;let O=Qf(y,{pulse:t.pulse,beat:t.beat,stepIndex:t.stepIndex,chakraDay:Fy(String(t.chakraDayKey)),stepsPerBeat:t.stepsPerBeat,canonicalHash:y,exportedAt:p,expiresAtPulse:t.pulse+11,kaiSignature:i??void 0,userPhiKey:a??void 0}),k=await Oy([{v:1,pulse:t.pulse,beat:t.beat,stepIndex:t.stepIndex,chakraDay:t.chakraDayKey,stepsPerBeat:t.stepsPerBeat,kaiSignature:i??void 0,userPhiKey:a??void 0,ts:p}]),A=await ky(k),j=await jy({ipfs:Ay,packedLedgerBytes:em(A.payload),prevCid:void 0,pubKeyJwk:_.ownerPubKey,merkleRoot:k.root,pulse:t.pulse,sign:async e=>{let t=Ny(e),n=Py(E),r=await crypto.subtle.sign(n,E,t);return new Uint8Array(r)}}),M={$schema:`https://atlantean.lumitech/schemas/kai-sigil/1.0.json`,contentType:`application/vnd.kai-sigil+json;v=1`,header:{...h,shareUrl:O},payload:x,integrity:C,frequencyHzAtMint:d,valuationSource:l??null,valuationSeal:u??null},N=v.length,P=$p(v).toString(16).padStart(8,`0`),F=Yp(Qp(y)),I=f.creatorId.slice(0,12),L=String(_.zkPoseidonHash).slice(0,12);return{parityUrl:O,payloadHashHex:y,innerRingText:[`u=${O}`,`b58=${F}`,`len=${N}`,`crc32=${P}`,`creator=${I}`,`zk=${L}`,`alg=${f.creatorAlg}`].join(` · `),sigilUrl:O,hashB58:F,embeddedBase:{...M,ledger:A,dht:j,weekdayResolved:c??null}}}function Ly(e){return JSON.stringify(e)}function Ry(e,t){let n=e=>{if(typeof window>`u`||typeof window.btoa!=`function`)throw Error(`Base64 encoding unavailable in this environment`);let t=encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)));return window.btoa(t)};return{toDataURL:()=>{let t=e.current;if(!t)throw Error(`SVG not mounted`);return`data:image/svg+xml;base64,${n(new XMLSerializer().serializeToString(t))}`},async exportBlob(n=`image/svg+xml`,r=2){let i=e.current;if(!i)throw Error(`SVG not mounted`);let a=new XMLSerializer().serializeToString(i);if(n===`image/svg+xml`)return new Blob([a],{type:n});let o=URL.createObjectURL(new Blob([a],{type:`image/svg+xml`}));try{let e=new Image,n=Math.round((t??240)*r);e.decoding=`async`,e.src=o,await e.decode();let i=document.createElement(`canvas`);i.width=n,i.height=n;let a=i.getContext(`2d`);if(!a)throw Error(`Canvas 2D context not available`);return a.drawImage(e,0,0,n,n),await new Promise((e,t)=>{i.toBlob(n=>n?e(n):t(Error(`Canvas toBlob failed`)),`image/png`)})}finally{URL.revokeObjectURL(o)}},async verifySvgHash(t){let n=e.current;if(!n)throw Error(`SVG not mounted`);let r=n.cloneNode(!0);r.removeAttribute(`data-svg-hash`),r.removeAttribute(`data-svg-valid`);let i=Gp(await qp(new XMLSerializer().serializeToString(r)));if(i!==t.toLowerCase())throw Error(`SVG HASH MISMATCH (${i} != ${t})`);return i}}}var zy=({uid:e,hue:t,visualClamped:n,doAnim:r,quality:i,dpr:a,seed:o,payloadHashHex:s,auraPath:c})=>{let l=`${e}-halo`,u=`${e}-glow`,d=`${e}-bloom`,f=`${e}-mask`,p=`${e}-net`,m=`${e}-warp`;return(0,W.jsxs)(`defs`,{children:[(0,W.jsx)(`path`,{id:`${e}-aura`,d:c}),(0,W.jsxs)(`radialGradient`,{id:l,cx:`50%`,cy:`50%`,r:`50%`,children:[(0,W.jsx)(`stop`,{offset:`0%`,stopColor:kp(t,100,50+15*Math.sin(n*2*Math.PI)),stopOpacity:`.55`,children:r&&i!==`low`&&(0,W.jsx)(`animate`,{attributeName:`stop-opacity`,values:`.35;.75;.35`,dur:`var(--dur)`,begin:`var(--off)`,repeatCount:`indefinite`})}),(0,W.jsx)(`stop`,{offset:`100%`,stopColor:`#000`,stopOpacity:`0`})]}),i!==`low`&&a>1&&(0,W.jsxs)(`filter`,{id:u,x:`-30%`,y:`-30%`,width:`160%`,height:`160%`,children:[(0,W.jsx)(`feGaussianBlur`,{stdDeviation:`2.2`,result:`b`}),(0,W.jsxs)(`feMerge`,{children:[(0,W.jsx)(`feMergeNode`,{in:`b`}),(0,W.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]}),i===`ultra`&&(0,W.jsxs)(`filter`,{id:d,x:`-50%`,y:`-50%`,width:`200%`,height:`200%`,children:[(0,W.jsx)(`feGaussianBlur`,{stdDeviation:`6`,result:`u`}),(0,W.jsx)(`feBlend`,{in:`SourceGraphic`,in2:`u`,mode:`screen`})]}),(0,W.jsx)(`mask`,{id:f,children:(0,W.jsx)(`rect`,{width:`100%`,height:`100%`,fill:`white`})}),(0,W.jsx)(`pattern`,{id:p,patternUnits:`userSpaceOnUse`,width:`160`,height:`160`,patternTransform:`rotate(${o*7%60} 500 500)`,children:(0,W.jsx)(`path`,{d:`M0 80 H160 M80 0 V160 M160 0 L0 160 M0 0 L160 160`,stroke:`#00FFD0`,strokeOpacity:`.06`,strokeWidth:`1`})}),(0,W.jsxs)(`filter`,{id:m,x:`-20%`,y:`-20%`,width:`140%`,height:`140%`,children:[(0,W.jsx)(`feTurbulence`,{type:`fractalNoise`,baseFrequency:`0.006`,numOctaves:`2`,seed:o%997+3,result:`noise`}),(0,W.jsx)(`feDisplacementMap`,{in:`SourceGraphic`,in2:`noise`,scale:.35+(s?parseInt(s.slice(-2),16):0)%12*.05,xChannelSelector:`R`,yChannelSelector:`G`})]})]})},By=({uid:e,stateKeyOk:t,embeddedMetaJson:n,klockIsoSnapshot:r,apiSnapshot:i,extraEmbed:a,mintSealJson:o,valuationSourceJson:s,displayStepIndex:c,stepsPerBeat:l,eternalSeal:u,ledgerJson:d,dhtJson:f})=>(0,W.jsxs)(W.Fragment,{children:[t&&n&&(0,W.jsx)(`metadata`,{children:zp(n)}),r&&(0,W.jsx)(`metadata`,{id:`${e}-klock-json`,children:zp(Ip(r))}),i&&(0,W.jsx)(`metadata`,{id:`${e}-kai-api-json`,children:zp(Ip(i))}),u&&(0,W.jsx)(`metadata`,{id:`${e}-eternal-seal`,children:zp(u)}),a&&(0,W.jsx)(`metadata`,{id:`${e}-extra-embed`,children:zp(Ip(a))}),o&&(0,W.jsx)(`metadata`,{id:`${e}-valuation-seal-json`,children:zp(o)}),t&&s&&(0,W.jsx)(`metadata`,{id:`${e}-valuation-source-json`,children:zp(s)}),(0,W.jsx)(`metadata`,{id:`sigil-display`,children:`{"stepIndex":${c},"stepsPerBeat":${l}}`}),t&&n&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`metadata`,{id:`${e}-ledger-json`,children:zp(d)}),(0,W.jsx)(`metadata`,{id:`${e}-dht-json`,children:zp(f)})]})]}),Vy=({uid:e,size:t,baseColor:n,corePath:r,auraId:i,sigPathId:a,doAnim:o,quality:s,dpr:c,pad:l,safeTextWidth:u,outlineWidth:d,strokeCore:f,dotR:p,debugOutline:m,prefersContrast:h,haloId:g,netId:_,warpId:v,glowId:y,maskId:b,rotation:x,chakraSides:S,binaryForRender:C,summary:w,pulse:T})=>(0,W.jsxs)(`g`,{id:`${e}-art`,filter:`url(#${v})`,children:[(0,W.jsx)(`rect`,{width:xp,height:xp,fill:`url(#${g})`,"aria-hidden":`true`,pointerEvents:`none`}),(0,W.jsx)(`rect`,{x:`0`,y:`0`,width:xp,height:xp,fill:`url(#${_})`,pointerEvents:`none`}),(0,W.jsx)(`path`,{d:r,fill:`none`,stroke:n,strokeWidth:f,vectorEffect:`non-scaling-stroke`,strokeLinecap:`round`,strokeLinejoin:`round`,mask:`url(#${b})`,filter:s!==`low`&&c>1?`url(#${y})`:void 0,style:{strokeDasharray:m||h?`4 4`:void 0},"aria-hidden":`true`,pointerEvents:`none`}),(m||h)&&(0,W.jsx)(`path`,{d:r,fill:`none`,stroke:`#00FFD0`,strokeWidth:Math.max(1,f*.45),vectorEffect:`non-scaling-stroke`,opacity:.6,"aria-hidden":!0,pointerEvents:`none`}),s!==`low`&&Array.from({length:S},(e,t)=>{let r=t/S*2*Math.PI+x;return(0,W.jsx)(`circle`,{cx:500+380*Math.cos(r),cy:500+380*Math.sin(r),r:p,fill:n,"aria-hidden":`true`,pointerEvents:`none`},t)}),o&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`use`,{href:`#${i}`,stroke:`#00FFD0`,strokeWidth:Math.max(2,f*1.05),fill:`none`,opacity:`.2`,strokeLinecap:`round`,strokeLinejoin:`round`,vectorEffect:`non-scaling-stroke`,"aria-hidden":`true`,pointerEvents:`none`,children:(0,W.jsx)(`animate`,{attributeName:`stroke-opacity`,values:`.2;.6;.2`,dur:`var(--dur)`,begin:`var(--off)`,repeatCount:`indefinite`})}),(0,W.jsx)(`use`,{href:`#${i}`,stroke:n,strokeWidth:Math.max(1.2,f*.8),fill:`none`,opacity:`.4`,strokeLinecap:`round`,strokeLinejoin:`round`,vectorEffect:`non-scaling-stroke`,"aria-hidden":`true`,pointerEvents:`none`,children:(0,W.jsx)(`animate`,{attributeName:`stroke-opacity`,values:`.4;.9;.4`,dur:`var(--dur)`,begin:`var(--off)`,repeatCount:`indefinite`})})]}),(0,W.jsx)(`circle`,{cx:500,cy:500,r:Math.max(3,p),fill:`#00FFD0`,"aria-hidden":`true`,pointerEvents:`none`,children:o&&(0,W.jsx)(`animateTransform`,{attributeName:`transform`,type:`scale`,values:`1;1.5;1`,dur:`var(--dur)`,begin:`var(--off)`,repeatCount:`indefinite`})}),s!==`low`&&a&&C&&(0,W.jsx)(`g`,{id:`signature`,children:(0,W.jsx)(`text`,{fontFamily:`ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial`,fontSize:Math.max(4,t*.028),fill:n,letterSpacing:`1.2`,textAnchor:`middle`,dominantBaseline:`middle`,opacity:`.7`,pointerEvents:`none`,children:(0,W.jsx)(`textPath`,{href:`#${a}`,startOffset:`50%`,children:C})})}),(0,W.jsxs)(`g`,{id:`signature-hint`,"aria-hidden":`true`,pointerEvents:`none`,children:[(0,W.jsx)(`text`,{x:l,y:t-6,fontFamily:bp,fontSize:Math.max(4,t*.025),fill:n,opacity:`.12`,textAnchor:`start`,lengthAdjust:`spacingAndGlyphs`,textLength:u,style:{paintOrder:`stroke`,stroke:`#000`,strokeWidth:d,fontVariantNumeric:`tabular-nums`,fontFeatureSettings:`'tnum' 1`},children:w}),(0,W.jsx)(`text`,{x:t-l,y:t-l,fontFamily:bp,fontSize:t*.25,fill:n,opacity:`0.04`,textAnchor:`end`,dominantBaseline:`ideographic`,lengthAdjust:`spacingAndGlyphs`,textLength:u,vectorEffect:`non-scaling-stroke`,style:{paintOrder:`stroke`,stroke:`#000`,strokeWidth:d,fontVariantNumeric:`tabular-nums`,fontFeatureSettings:`'tnum' 1`},children:typeof T==`number`?T.toLocaleString?.()??String(T):String(T)})]})]});const Hy=[`Solhara`,`Aquaris`,`Flamora`,`Verdari`,`Sonari`,`Kaelith`],Uy=e=>typeof e==`string`&&Hy.includes(e);function Wy(e){return typeof e==`object`&&!!e}const Gy=e=>e===`low`?`low`:e===`ultra`||e===`high`?`high`:`med`,Ky=e=>e.replace(/^0x/i,``).split(``).map(e=>parseInt(e,16).toString(2).padStart(4,`0`)).join(``);function qy(e,t,n,r){return e?`Eternal Seal • ${e}`:`Day Seal: ${t}:${n} • Kai-Pulse ${r}`}var Jy=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`;function Yy(e){let t=``,n=e.length,r=0;for(;r+2>>18&63]+Jy[n>>>12&63]+Jy[n>>>6&63]+Jy[n&63]}let i=n-r;if(i===1){let n=e[r]<<16;t+=Jy[n>>>18&63]+Jy[n>>>12&63]+`==`}else if(i===2){let n=e[r]<<16|e[r+1]<<8;t+=Jy[n>>>18&63]+Jy[n>>>12&63]+Jy[n>>>6&63]+`=`}return t}function Xy(e){let t=e.replace(/\s+/g,``);if(!/^[A-Za-z0-9+/]*={0,2}$/.test(t)||t.length%4!=0)return new Uint8Array;let n=t.length/4*3-(t.endsWith(`==`)?2:t.endsWith(`=`)?1:0),r=new Uint8Array(n),i=0;for(let e=0;e>>16&255,s>=0&&i>>8&255),c>=0&&ie.replace(/·|\u2022/g,`•`);function Qy(e){if(!e)return``;let t=Zy(e);return Yy(new TextEncoder().encode(t))}function $y(e){if(!e)return``;try{let t=Xy(e);return Zy(new TextDecoder().decode(t))}catch{return``}}function eb(e){let t=`null`;if(!e)return{ledgerJson:t,dhtJson:t};try{let t=JSON.parse(e);return{ledgerJson:JSON.stringify(t.ledger??null),dhtJson:JSON.stringify(t.dht??null)}}catch{return{ledgerJson:t,dhtJson:t}}}function tb(e){let t=Object.entries(e).flatMap(([e,t])=>t==null?[]:[[e,String(t)]]);return Object.fromEntries(t)}function nb(e,t){let n=Fp(e)?JSON.parse(Ip(e)):null,r=Fp(t)?JSON.parse(Ip(t)):null,i=tb(n?Vp(`klock`,n):{}),a=Lp(e,`eternalMonth`),o=Lp(e,`harmonicDay`),s=Rp(e,`kaiPulseEternal`),c=Lp(e,`solarChakraStepString`),l=Lp(e,`chakraArc`);return{klockIsoSnapshot:n,apiSnapshot:r,klockDataAttrs:i,eternalMonth:a,harmonicDay:o,kaiPulseEternal:typeof s==`number`?s:void 0,solarChakraStepString:c,chakraArc:l}}function rb(e,t,n,r,i,a,o){let s=String(n).replace(/\s+/g,`_`),c=[`sig=${t?e??`pending`:`pending`}`,`pulse=${i}`,`beat=${a}`,`day=${s}`,`hz=${r}`];return o&&c.push(`poseidon=${o}`),c.join(` | `)}function ib(e,t,n){return kp((e+(n?parseInt(n.slice(-2),16)%12*2.5:0))%360,100,50+15*Math.sin(t*2*Math.PI))}var ab=(0,C.forwardRef)((e,t)=>{let{id:n,pulse:r,beat:i,stepIndex:a,stepPct:o,chakraDay:s,size:c=240,hashOverride:l,strict:u=!0,quality:d=`high`,animate:f=!0,debugOutline:p=!1,goldenId:m,hashMode:h=`moment`,userPhiKey:g,kaiSignature:_,intentionSigil:v,creatorPublicKey:y,origin:b,onReady:x,onError:S,showZKBadge:w=!0,qrHref:T,klock:E,embed:D}=e,O=Up(r),k=Up(i),A=(0,C.useMemo)(()=>Mp(O),[O]),j=(0,C.useMemo)(()=>Np(O),[O]),M=(0,C.useMemo)(()=>{let e=Up(a,NaN);return(!Number.isFinite(e)||e<0||e>=44)&&(e=A),Math.trunc((e%44+44)%44)},[a,A]),N=(0,C.useMemo)(()=>{let e=Wp(o,NaN);return Number.isFinite(e)||(e=j),Math.max(0,Math.min(1-2**-52,e))},[o,j]),P=Op(s),F=Uy(s)?s:void 0,I=(0,C.useMemo)(()=>({pulse:O,beat:k,stepIndex:M,chakraDayKey:P,stepsPerBeat:44,visualClamped:N}),[O,k,M,P,N]),{prefersReduce:L,prefersContrast:R}=rm(),{kaiData:z,kaiDataRef:B}=am(h),V=om(`${I.pulse}|${I.beat}|${I.stepIndex}|${I.chakraDayKey}`),H=(0,C.useMemo)(()=>Zp(V),[V]),{sides:U,hue:ee}=Cp[P],te=I.pulse%7+1,ne=I.beat%5+2,re=I.visualClamped*2*Math.PI,ie=yp**2*Math.PI*(I.pulse%97)%(2*Math.PI),ae=50+15*Math.sin(I.visualClamped*2*Math.PI),oe=kp((ee+360*.03*I.visualClamped)%360,100,ae),se=wp[P],ce=(0,C.useMemo)(()=>Pp(P,M),[P,M]),le=typeof window<`u`?window.devicePixelRatio??1:1,ue=f&&!L,de=(m?`${m}-${M}`:void 0)??`ks-${I.pulse}-${I.beat}-${M}`,fe=Math.max(10,Math.floor((c??240)*.08)),pe=Math.max(40,(c??240)-fe*2),me=Math.max(.6,(c??240)*.003),he=Math.max(1.4,(c??240)*.009),ge=Math.max(2.5,(c??240)*.016),_e=5e3+Math.floor(H()*800)+Math.floor(V%436/2),ve=Math.floor((V>>>1)%_e),ye=(0,C.useMemo)(()=>Ap(U,ie),[U,ie]),be=(0,C.useMemo)(()=>jp(te,ne,re),[te,ne,re]),[xe,Se]=(0,C.useState)(),[Ce,we]=(0,C.useState)();(0,C.useEffect)(()=>{(async()=>{let e=_;e||(e=Gp(await qp(`${I.pulse}|${I.beat}|${M}|${P}|${v??``}`)),Se(e));let t=g;!t&&e&&(t=await Xp((await qp(`${e}φ`)).slice(0,20)),we(t))})().catch(S)},[_,g,I.pulse,I.beat,M,P,v,S]);let Te=_??xe,Ee=g??Ce,De=sm(),Oe=(0,C.useRef)(I.pulse),[ke,Ae]=(0,C.useState)(null),[je,Me]=(0,C.useState)(null),Ne=(0,C.useRef)(null);(0,C.useEffect)(()=>{Ne.current={pulse:Oe.current,kaiPulse:Oe.current,kaiSignature:Te??void 0,userPhiKey:Ee??void 0,beat:I.beat,stepIndex:I.stepIndex,stepsPerBeat:I.stepsPerBeat,quality:Gy(d),frequencyHz:ce,chakraDay:I.chakraDayKey,chakraGate:se}},[I.beat,I.stepIndex,Te,Ee,ce,I.chakraDayKey,se,d]);let Pe=(0,C.useMemo)(()=>`${I.pulse}|${I.beat}|${I.stepIndex}|${I.chakraDayKey}`,[I.pulse,I.beat,I.stepIndex,I.chakraDayKey]),[Fe,Ie]=(0,C.useState)(null);(0,C.useEffect)(()=>{let e=!1,t=I.pulse,n=I.beat,r=I.stepIndex,i=I.chakraDayKey,a=I.stepsPerBeat,o=ce,c=Pe,l=Uy(s)?s:null;return(async()=>{try{let s=await tm({creatorPublicKey:y,userPhiKey:Ee,kaiSignature:Te,origin:b,pulse:t,beat:n,chakraDay:i,stepIndex:r}),u=B.current,f=Hp(Lp(u,`kaiMomentSummary`))??Hp(Lp(u,`kairos_seal`))??Hp(Lp(u,`kairos_seal_day_month_percent`))??`Kairos HarmoniK Sigil • ${i} • Beat ${n} • Step ${r}`,p={pulse:Oe.current,kaiPulse:Oe.current,kaiSignature:Te??void 0,userPhiKey:Ee??void 0,beat:n,stepsPerBeat:a,quality:d===`low`?`low`:`high`,frequencyHz:o,chakraDay:i,chakraGate:se};try{let{seal:e}=await hu(p,Oe.current,De);Me(e)}catch(e){S?.(e)}let m=await Iy({canon:{pulse:t,beat:n,stepIndex:r,chakraDayKey:i,stepsPerBeat:a},hashMode:h,chakraGate:se,kaiSignature:Te,userPhiKey:Ee,intentionSigil:v,origin:b,title:f,klockSnapshot:Fp(E)?JSON.parse(Ip(E)):null,kaiApiSnapshot:Fp(z)?JSON.parse(Ip(z)):null,weekdayResolved:l,valuationSource:p,mintSeal:null,frequencyHzCurrent:o,qrHref:T,canonicalUrlFromContext:vp,creatorResolved:s}),g={},_=``,C=``,w=``,D=``,O=``;if(Wy(m)){let e=m.embeddedBase;Wy(e)&&(g=e);let t=m.payloadHashHex;typeof t==`string`&&(_=t);let n=m.parityUrl;typeof n==`string`&&(C=n);let r=m.innerRingText;typeof r==`string`&&(w=r);let i=m.sigilUrl;typeof i==`string`&&(D=i);let a=m.hashB58;typeof a==`string`&&(O=a)}let k={PULSE_MS:qn,STEPS_BEAT:a,PHI:yp,algorithm:`computeIntrinsicUnsigned`,version:`1`},A=p?mu(p,t).unsigned.valuePhi:null,j=Ly({...g,valuation:je??null,valuationSource:p,valuationRuntime:k,valuationLiveAtExport:A}),M={createdFor:{pulse:t,beat:n,stepIndex:r,chakraDayKey:i,stateKey:c},payloadHashHex:_,shareUrl:C,embeddedMetaJson:j,valuationSourceJson:JSON.stringify(p),zkScheme:`groth16-poseidon`,zkPoseidonHash:`7110303097080024260800444665787206606103183587082596139871399733998958991511`,innerRingText:w,sigilUrl:D,hashB58:O,frequencyHz:o};!e&&M.createdFor.stateKey===c&&(Ie(M),x?.({hash:M.payloadHashHex,url:M.shareUrl,metadataJson:M.embeddedMetaJson}))}catch(e){if(S?.(e),u)throw e instanceof Error?e:Error(String(e))}})().catch(e=>{if(S?.(e),u)throw e instanceof Error?e:Error(String(e))}),()=>{e=!0}},[Pe,I.pulse,I.beat,I.stepIndex,I.chakraDayKey,I.stepsPerBeat,ce,Te,Ee,h,y,b,T,u,x,S,P,d,E,z,B,De,se,s]);let Le=(0,C.useMemo)(()=>{let e=Fe;return e&&e.createdFor.stateKey===Pe?e.createdFor.stepIndex:I.stepIndex},[Fe,Pe,I.stepIndex]),Re=(0,C.useMemo)(()=>{let e=Fe;return e&&e.createdFor.stateKey===Pe?e.frequencyHz:ce},[Fe,Pe,ce]);(0,C.useEffect)(()=>{try{if(!Ne.current||!Number.isFinite(I.pulse)){Ae(null);return}let{unsigned:e}=mu(Ne.current,I.pulse);Ae(e.valuePhi)}catch(e){S?.(e),Ae(null)}},[I.pulse,S]);let ze=Lp(E,`eternalSeal`)??Lp(E,`seal`)??Lp(z,`kairos_seal`),Be=(0,C.useMemo)(()=>qy(ze,I.beat,Le,I.pulse),[ze,I.beat,Le,I.pulse]),Ve=(0,C.useMemo)(()=>{let e=Fe&&Fe.createdFor.stateKey===Pe?Fe.createdFor.stepIndex:Le;return qy(ze,I.beat,e,I.pulse)},[Fe,Pe,ze,I.beat,Le,I.pulse]),He=(0,C.useMemo)(()=>Qy(Ve),[Ve]),{klockIsoSnapshot:Ue,apiSnapshot:We,klockDataAttrs:Ge,eternalMonth:Ke,harmonicDay:qe,kaiPulseEternal:Je,solarChakraStepString:Ye,chakraArc:Xe}=(0,C.useMemo)(()=>nb(E,z),[E,z]),Ze=(0,C.useRef)(null);(0,C.useLayoutEffect)(()=>{let e=Ze.current;if(!e||!l)return;let t=!1;return(async()=>{try{let n=e.cloneNode(!0);n.removeAttribute(`data-svg-hash`),n.removeAttribute(`data-svg-valid`);let r=Gp(await qp(new XMLSerializer().serializeToString(n)));if(t)return;if(e.dataset.svgHash=r,e.dataset.svgValid=String(r===l.toLowerCase()),r!==l.toLowerCase()&&u)throw Error(`[KaiSigil] SVG HASH MISMATCH (${r})`)}catch(e){if(S?.(e),u)throw e instanceof Error?e:Error(String(e))}})().catch(e=>{if(S?.(e),u)throw e instanceof Error?e:Error(String(e))}),()=>{t=!0}},[l,u,Pe,S]),(0,C.useLayoutEffect)(()=>{if(!u)return;let e=Ze.current;if(!e)return;let t=Fe;if(!t||t.createdFor.stateKey!==Pe)return;let n=e.getAttribute(`data-step-index`),r=e.getAttribute(`data-frequency-hz`),i=e.getAttribute(`data-summary-b64`)??``,a=n!=null&&n!==``?Number(n):NaN,o=r!=null&&r!==``?Number(r):NaN,s=e.getAttribute(`data-share-url`)||void 0,c=e.getAttribute(`data-payload-hash`)||void 0,l=``;try{l=$y(i)}catch{l=``}let d=Ve,f=e=>e.replace(/•|·|\u2022/g,`•`),p=[];if(f(l)!==f(d)&&p.push(`summary mismatch (“${l}” != “${d}”)`),Number.isFinite(a)?a!==t.createdFor.stepIndex&&p.push(`data-step-index(${a}) != built(${t.createdFor.stepIndex})`):p.push(`missing/invalid data-step-index`),!Number.isFinite(o))p.push(`missing/invalid data-frequency-hz`);else{let e=Pp(P,a);(Math.abs(o-t.frequencyHz)>1e-6||Math.abs(e-o)>1e-6)&&p.push(`frequency/step mismatch (${o} vs step ${a})`)}if(s!==t.shareUrl&&p.push(`data-share-url != built.shareUrl`),c&&c!==t.payloadHashHex&&p.push(`data-payload-hash != built.payloadHashHex`),p.length)throw Error(`[KaiSigil] Invariant violation → ${p.join(`; `)}`)},[u,Fe,Pe,P,I.beat,I.pulse,Re,Ve]);let{toDataURL:Qe,exportBlob:$e,verifySvgHash:et}=Ry(Ze,c),tt=(0,C.useMemo)(()=>Fp(D)?JSON.parse(Ip(D)):null,[D]),nt=Fe?.createdFor.stateKey===Pe?Fe?.payloadHashHex:void 0,rt=Fe?.createdFor.stateKey===Pe?Fe?.zkScheme:void 0,it=Fe?.createdFor.stateKey===Pe?Fe?.zkPoseidonHash:void 0,at=Fe?.createdFor.stateKey===Pe?Fe?.shareUrl:void 0,ot=(Fe?.createdFor.stateKey===Pe?Fe?.frequencyHz:void 0)??ce,st=(0,C.useMemo)(()=>{if(!Te)return``;let e=Ky(Te),t=2*Math.PI*((c??240)*.46),n=Math.max(3.5,(c??240)*.028*.55),r=Math.max(24,Math.floor(t/n));return e.length>r?e.slice(0,r):e},[Te,c]),ct=ib(ee,I.visualClamped,Fe?.payloadHashHex),lt=Te?`${de}-sig-path`:void 0,ut=`${de}-desc`,dt=Fe?.createdFor.stateKey===Pe?Fe?.shareUrl:void 0,ft=({children:e})=>dt?(0,W.jsx)(`a`,{href:dt,target:`_self`,"aria-label":`Open canonical sigil ${Fe?.payloadHashHex??``}`,children:e}):(0,W.jsx)(`g`,{tabIndex:0,role:`button`,"aria-label":`Sigil not yet canonicalized`,children:e}),pt=Fe?.createdFor.stateKey===Pe,mt=rb(nt,pt,P,ot,I.pulse,I.beat,it),{ledgerJson:ht,dhtJson:gt}=(0,C.useMemo)(()=>eb(pt?Fe?.embeddedMetaJson:void 0),[Fe,pt]);return(0,C.useImperativeHandle)(t,()=>({toDataURL:Qe,exportBlob:$e,verifySvgHash:et,verifyConsistency:()=>{let e=Fe;if(!e)throw Error(`No built snapshot yet`);if(e.createdFor.stateKey!==Pe)throw Error(`Built snapshot does not match current stateKey`)},uid:de,stepIndex:M,payloadHashHex:Fe?.payloadHashHex,sigilUrl:Fe?.sigilUrl,userPhiKey:Ee,kaiSignature:Te})),(0,W.jsxs)(`svg`,{ref:Ze,id:n??de,role:`img`,"aria-describedby":ut,lang:`en`,"aria-label":`Kairos sigil — pulse ${I.pulse}`,viewBox:`0 0 ${xp} ${xp}`,width:c,height:c,shapeRendering:`geometricPrecision`,style:{background:`transparent`,"--dur":`${_e}ms`,"--off":`${ve}ms`,"--pulse":`${qn}ms`,cursor:at?`pointer`:`default`},"data-pulse":String(I.pulse),"data-beat":String(I.beat),"data-step-index":String(Le),"data-frequency-hz":String(Re),"data-chakra-day":P,"data-weekday":F??void 0,"data-chakra-gate":se,"data-quality":d,"data-golden-id":m??void 0,"data-kai-signature":Te??void 0,"data-phi-key":Ee??void 0,"data-payload-hash":nt??void 0,"data-zk-scheme":rt??void 0,"data-zk-poseidon-hash":it??void 0,"data-share-url":at||void 0,"data-eternal-seal":ze??void 0,"data-eternal-month":Ke??void 0,"data-harmonic-day":qe??void 0,"data-kai-pulse-eternal":typeof Je==`number`?String(Je):void 0,"data-solar-chakra-step":Ye??void 0,"data-arc":Xe??void 0,"data-summary-b64":He,...Ge,"data-valuation-algorithm":je?.algorithm??void 0,"data-valuation-policy":je?.policyId??void 0,"data-valuation-policy-checksum":je?.policyChecksum??void 0,"data-valuation-stamp":je?.stamp??void 0,"data-valuation-value-phi":je?.valuePhi==null?void 0:String(je.valuePhi),"data-valuation-computed-at":je?.computedAtPulse==null?void 0:String(je.computedAtPulse),"data-value-phi-live":ke==null?void 0:String(ke),children:[(0,W.jsx)(`title`,{children:`Kairos HarmoniK Sigil • Pulse ${I.pulse}`}),(0,W.jsxs)(`desc`,{id:ut,children:[`↳ `,Be]}),(0,W.jsx)(By,{uid:de,stateKeyOk:pt,embeddedMetaJson:pt?Fe?.embeddedMetaJson:void 0,klockIsoSnapshot:Ue,apiSnapshot:We,extraEmbed:tt,mintSealJson:je?JSON.stringify(je):null,valuationSourceJson:pt?Fe?.valuationSourceJson:void 0,displayStepIndex:Le,stepsPerBeat:I.stepsPerBeat,eternalSeal:ze??void 0,ledgerJson:ht,dhtJson:gt}),(0,W.jsx)(zy,{uid:de,hue:ee,visualClamped:I.visualClamped,doAnim:ue,quality:d,dpr:le,seed:V,payloadHashHex:Fe?.payloadHashHex,auraPath:be}),Te&&(0,W.jsx)(`defs`,{children:(0,W.jsx)(`path`,{id:lt,d:`M 500 ${500-1e3*.46} a ${1e3*.46} ${1e3*.46} 0 1 1 0 ${1e3*.92} a ${1e3*.46} ${1e3*.46} 0 1 1 0 -${1e3*.92}`,fill:`none`})}),(0,W.jsx)(ft,{children:(0,W.jsxs)(`g`,{id:`${de}-tilt`,style:{transformOrigin:`500px 500px`},children:[ue&&(0,W.jsx)(`animateTransform`,{attributeName:`transform`,type:`rotate`,values:`-2 500 500;2 500 500;-2 500 500`,dur:`var(--dur)`,begin:`var(--off)`,repeatCount:`indefinite`}),(0,W.jsx)(Vy,{uid:de,size:c,baseColor:oe,corePath:ye,auraId:`${de}-aura`,sigPathId:lt,doAnim:ue,quality:d,dpr:le,pad:fe,safeTextWidth:pe,outlineWidth:R?me*1.2:me,strokeCore:he,dotR:ge,debugOutline:p,prefersContrast:R,haloId:`${de}-halo`,netId:`${de}-net`,warpId:`${de}-warp`,glowId:`${de}-glow`,maskId:`${de}-mask`,rotation:ie,chakraSides:Cp[P].sides,binaryForRender:st,summary:Be,pulse:I.pulse})]})}),w&&(0,W.jsx)(cm,{uid:de,size:c,phaseColor:ct,outerRingText:mt,innerRingText:Fe&&Fe.createdFor.stateKey===Pe?Fe.innerRingText:`initializing…`,animate:f,prefersReduce:L})]})});ab.displayName=`KaiSigil`;var ob=ab,sb=9e15,cb=1e9,lb=`0123456789abcdef`,ub=`2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058`,db=`3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789`,fb={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-sb,maxE:sb,crypto:!1},pb,mb,K=!0,hb=`[DecimalError] `,gb=hb+`Invalid argument: `,_b=hb+`Precision limit exceeded`,vb=hb+`crypto unavailable`,yb=`[object Decimal]`,bb=Math.floor,xb=Math.pow,Sb=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Cb=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,wb=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Tb=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Eb=1e7,q=7,Db=9007199254740991,Ob=ub.length-1,kb=db.length-1,J={toStringTag:yb};J.absoluteValue=J.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Y(e)},J.ceil=function(){return Y(new this.constructor(this),this.e+1,2)},J.clampedTo=J.clamp=function(e,t){var n,r=this,i=r.constructor;if(e=new i(e),t=new i(t),!e.s||!t.s)return new i(NaN);if(e.gt(t))throw Error(gb+t);return n=r.cmp(e),n<0?e:r.cmp(t)>0?t:new i(r)},J.comparedTo=J.cmp=function(e){var t,n,r,i,a=this,o=a.d,s=(e=new a.constructor(e)).d,c=a.s,l=e.s;if(!o||!s)return!c||!l?NaN:c===l?o===s?0:!o^c<0?1:-1:c;if(!o[0]||!s[0])return o[0]?c:s[0]?-l:0;if(c!==l)return c;if(a.e!==e.e)return a.e>e.e^c<0?1:-1;for(r=o.length,i=s.length,t=0,n=rs[t]^c<0?1:-1;return r===i?0:r>i^c<0?1:-1},J.cosine=J.cos=function(){var e,t,n=this,r=n.constructor;return n.d?n.d[0]?(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+q,r.rounding=1,n=Pb(r,$b(r,n)),r.precision=e,r.rounding=t,Y(mb==2||mb==3?n.neg():n,e,t,!0)):new r(1):new r(NaN)},J.cubeRoot=J.cbrt=function(){var e,t,n,r,i,a,o,s,c,l,u=this,d=u.constructor;if(!u.isFinite()||u.isZero())return new d(u);for(K=!1,a=u.s*xb(u.s*u,1/3),!a||Math.abs(a)==1/0?(n=Ab(u.d),e=u.e,(a=(e-n.length+1)%3)&&(n+=a==1||a==-2?`0`:`00`),a=xb(n,1/3),e=bb((e+1)/3)-(e%3==(e<0?-1:2)),a==1/0?n=`5e`+e:(n=a.toExponential(),n=n.slice(0,n.indexOf(`e`)+1)+e),r=new d(n),r.s=u.s):r=new d(a.toString()),o=(e=d.precision)+3;;)if(s=r,c=s.times(s).times(s),l=c.plus(u),r=Fb(l.plus(u).times(s),l.plus(c),o+2,1),Ab(s.d).slice(0,o)===(n=Ab(r.d)).slice(0,o))if(n=n.slice(o-3,o+1),n==`9999`||!i&&n==`4999`){if(!i&&(Y(s,e+1,0),s.times(s).times(s).eq(u))){r=s;break}o+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)==`5`)&&(Y(r,e+1,1),t=!r.times(r).times(r).eq(u));break}return K=!0,Y(r,e,d.rounding,t)},J.decimalPlaces=J.dp=function(){var e,t=this.d,n=NaN;if(t){if(e=t.length-1,n=(e-bb(this.e/q))*q,e=t[e],e)for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n},J.dividedBy=J.div=function(e){return Fb(this,new this.constructor(e))},J.dividedToIntegerBy=J.divToInt=function(e){var t=this,n=t.constructor;return Y(Fb(t,new n(e),0,1,1),n.precision,n.rounding)},J.equals=J.eq=function(e){return this.cmp(e)===0},J.floor=function(){return Y(new this.constructor(this),this.e+1,3)},J.greaterThan=J.gt=function(e){return this.cmp(e)>0},J.greaterThanOrEqualTo=J.gte=function(e){var t=this.cmp(e);return t==1||t===0},J.hyperbolicCosine=J.cosh=function(){var e,t,n,r,i,a=this,o=a.constructor,s=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return s;n=o.precision,r=o.rounding,o.precision=n+Math.max(a.e,a.sd())+4,o.rounding=1,i=a.d.length,i<32?(e=Math.ceil(i/3),t=(1/Qb(4,e)).toString()):(e=16,t=`2.3283064365386962890625e-10`),a=Zb(o,1,a.times(t),new o(1),!0);for(var c,l=e,u=new o(8);l--;)c=a.times(a),a=s.minus(c.times(u.minus(c.times(u))));return Y(a,o.precision=n,o.rounding=r,!0)},J.hyperbolicSine=J.sinh=function(){var e,t,n,r,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(t=a.precision,n=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,r=i.d.length,r<3)i=Zb(a,2,i,i,!0);else{e=1.4*Math.sqrt(r),e=e>16?16:e|0,i=i.times(1/Qb(5,e)),i=Zb(a,2,i,i,!0);for(var o,s=new a(5),c=new a(16),l=new a(20);e--;)o=i.times(i),i=i.times(s.plus(o.times(c.times(o).plus(l))))}return a.precision=t,a.rounding=n,Y(i,t,n,!0)},J.hyperbolicTangent=J.tanh=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,Fb(n.sinh(),n.cosh(),r.precision=e,r.rounding=t)):new r(n.s)},J.inverseCosine=J.acos=function(){var e=this,t=e.constructor,n=e.abs().cmp(1),r=t.precision,i=t.rounding;return n===-1?e.isZero()?zb(t,r+4,i).times(.5):(t.precision=r+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=r,t.rounding=i,e.times(2)):n===0?e.isNeg()?zb(t,r,i):new t(0):new t(NaN)},J.inverseHyperbolicCosine=J.acosh=function(){var e,t,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(e=r.precision,t=r.rounding,r.precision=e+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,K=!1,n=n.times(n).minus(1).sqrt().plus(n),K=!0,r.precision=e,r.rounding=t,n.ln()):new r(n)},J.inverseHyperbolicSine=J.asinh=function(){var e,t,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,K=!1,n=n.times(n).plus(1).sqrt().plus(n),K=!0,r.precision=e,r.rounding=t,n.ln())},J.inverseHyperbolicTangent=J.atanh=function(){var e,t,n,r,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=a.precision,t=a.rounding,r=i.sd(),Math.max(r,e)<2*-i.e-1?Y(new a(i),e,t,!0):(a.precision=n=r-i.e,i=Fb(i.plus(1),new a(1).minus(i),n+e,1),a.precision=e+4,a.rounding=1,i=i.ln(),a.precision=e,a.rounding=t,i.times(.5))):new a(NaN)},J.inverseSine=J.asin=function(){var e,t,n,r,i=this,a=i.constructor;return i.isZero()?new a(i):(t=i.abs().cmp(1),n=a.precision,r=a.rounding,t===-1?(a.precision=n+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=n,a.rounding=r,i.times(2)):t===0?(e=zb(a,n+4,r).times(.5),e.s=i.s,e):new a(NaN))},J.inverseTangent=J.atan=function(){var e,t,n,r,i,a,o,s,c,l=this,u=l.constructor,d=u.precision,f=u.rounding;if(l.isFinite()){if(l.isZero())return new u(l);if(l.abs().eq(1)&&d+4<=kb)return o=zb(u,d+4,f).times(.25),o.s=l.s,o}else{if(!l.s)return new u(NaN);if(d+4<=kb)return o=zb(u,d+4,f).times(.5),o.s=l.s,o}for(u.precision=s=d+10,u.rounding=1,n=Math.min(28,s/q+2|0),e=n;e;--e)l=l.div(l.times(l).plus(1).sqrt().plus(1));for(K=!1,t=Math.ceil(s/q),r=1,c=l.times(l),o=new u(l),i=l;e!==-1;)if(i=i.times(c),a=o.minus(i.div(r+=2)),i=i.times(c),o=a.plus(i.div(r+=2)),o.d[t]!==void 0)for(e=t;o.d[e]===a.d[e]&&e--;);return n&&(o=o.times(2<this.d.length-2},J.isNaN=function(){return!this.s},J.isNegative=J.isNeg=function(){return this.s<0},J.isPositive=J.isPos=function(){return this.s>0},J.isZero=function(){return!!this.d&&this.d[0]===0},J.lessThan=J.lt=function(e){return this.cmp(e)<0},J.lessThanOrEqualTo=J.lte=function(e){return this.cmp(e)<1},J.logarithm=J.log=function(e){var t,n,r,i,a,o,s,c,l=this,u=l.constructor,d=u.precision,f=u.rounding,p=5;if(e==null)e=new u(10),t=!0;else{if(e=new u(e),n=e.d,e.s<0||!n||!n[0]||e.eq(1))return new u(NaN);t=e.eq(10)}if(n=l.d,l.s<0||!n||!n[0]||l.eq(1))return new u(n&&!n[0]?-1/0:l.s==1?n?0:1/0:NaN);if(t)if(n.length>1)a=!0;else{for(i=n[0];i%10==0;)i/=10;a=i!==1}if(K=!1,s=d+p,o=Kb(l,s),r=t?Rb(u,s+10):Kb(e,s),c=Fb(o,r,s,1),Mb(c.d,i=d,f))do if(s+=10,o=Kb(l,s),r=t?Rb(u,s+10):Kb(e,s),c=Fb(o,r,s,1),!a){+Ab(c.d).slice(i+1,i+15)+1==0x5af3107a4000&&(c=Y(c,d+1,0));break}while(Mb(c.d,i+=10,f));return K=!0,Y(c,d,f)},J.minus=J.sub=function(e){var t,n,r,i,a,o,s,c,l,u,d,f,p=this,m=p.constructor;if(e=new m(e),!p.d||!e.d)return!p.s||!e.s?e=new m(NaN):p.d?e.s=-e.s:e=new m(e.d||p.s!==e.s?p:NaN),e;if(p.s!=e.s)return e.s=-e.s,p.plus(e);if(l=p.d,f=e.d,s=m.precision,c=m.rounding,!l[0]||!f[0]){if(f[0])e.s=-e.s;else if(l[0])e=new m(p);else return new m(c===3?-0:0);return K?Y(e,s,c):e}if(n=bb(e.e/q),u=bb(p.e/q),l=l.slice(),a=u-n,a){for(d=a<0,d?(t=l,a=-a,o=f.length):(t=f,n=u,o=l.length),r=Math.max(Math.ceil(s/q),o)+2,a>r&&(a=r,t.length=1),t.reverse(),r=a;r--;)t.push(0);t.reverse()}else{for(r=l.length,o=f.length,d=r0;--r)l[o++]=0;for(r=f.length;r>a;){if(l[--r]o?a+1:o+1,i>o&&(i=o,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(o=l.length,i=u.length,o-i<0&&(i=o,n=u,u=l,l=n),t=0;i;)t=(l[--i]=l[i]+u[i]+t)/Eb|0,l[i]%=Eb;for(t&&(l.unshift(t),++r),o=l.length;l[--o]==0;)l.pop();return e.d=l,e.e=Lb(l,r),K?Y(e,s,c):e},J.precision=J.sd=function(e){var t,n=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(gb+e);return n.d?(t=Bb(n.d),e&&n.e+1>t&&(t=n.e+1)):t=NaN,t},J.round=function(){var e=this,t=e.constructor;return Y(new t(e),e.e+1,t.rounding)},J.sine=J.sin=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+q,r.rounding=1,n=Xb(r,$b(r,n)),r.precision=e,r.rounding=t,Y(mb>2?n.neg():n,e,t,!0)):new r(NaN)},J.squareRoot=J.sqrt=function(){var e,t,n,r,i,a,o=this,s=o.d,c=o.e,l=o.s,u=o.constructor;if(l!==1||!s||!s[0])return new u(!l||l<0&&(!s||s[0])?NaN:s?o:1/0);for(K=!1,l=Math.sqrt(+o),l==0||l==1/0?(t=Ab(s),(t.length+c)%2==0&&(t+=`0`),l=Math.sqrt(t),c=bb((c+1)/2)-(c<0||c%2),l==1/0?t=`5e`+c:(t=l.toExponential(),t=t.slice(0,t.indexOf(`e`)+1)+c),r=new u(t)):r=new u(l.toString()),n=(c=u.precision)+3;;)if(a=r,r=a.plus(Fb(o,a,n+2,1)).times(.5),Ab(a.d).slice(0,n)===(t=Ab(r.d)).slice(0,n))if(t=t.slice(n-3,n+1),t==`9999`||!i&&t==`4999`){if(!i&&(Y(a,c+1,0),a.times(a).eq(o))){r=a;break}n+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)==`5`)&&(Y(r,c+1,1),e=!r.times(r).eq(o));break}return K=!0,Y(r,c,u.rounding,e)},J.tangent=J.tan=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+10,r.rounding=1,n=n.sin(),n.s=1,n=Fb(n,new r(1).minus(n.times(n)).sqrt(),e+10,0),r.precision=e,r.rounding=t,Y(mb==2||mb==4?n.neg():n,e,t,!0)):new r(NaN)},J.times=J.mul=function(e){var t,n,r,i,a,o,s,c,l,u=this,d=u.constructor,f=u.d,p=(e=new d(e)).d;if(e.s*=u.s,!f||!f[0]||!p||!p[0])return new d(!e.s||f&&!f[0]&&!p||p&&!p[0]&&!f?NaN:!f||!p?e.s/0:e.s*0);for(n=bb(u.e/q)+bb(e.e/q),c=f.length,l=p.length,c=0;){for(t=0,i=c+r;i>r;)s=a[i]+p[r]*f[i-r-1]+t,a[i--]=s%Eb|0,t=s/Eb|0;a[i]=(a[i]+t)%Eb|0}for(;!a[--o];)a.pop();return t?++n:a.shift(),e.d=a,e.e=Lb(a,n),K?Y(e,d.precision,d.rounding):e},J.toBinary=function(e,t){return ex(this,2,e,t)},J.toDecimalPlaces=J.toDP=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(jb(e,0,cb),t===void 0?t=r.rounding:jb(t,0,8),Y(n,e+n.e+1,t))},J.toExponential=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=Ib(r,!0):(jb(e,0,cb),t===void 0?t=i.rounding:jb(t,0,8),r=Y(new i(r),e+1,t),n=Ib(r,!0,e+1)),r.isNeg()&&!r.isZero()?`-`+n:n},J.toFixed=function(e,t){var n,r,i=this,a=i.constructor;return e===void 0?n=Ib(i):(jb(e,0,cb),t===void 0?t=a.rounding:jb(t,0,8),r=Y(new a(i),e+i.e+1,t),n=Ib(r,!1,e+r.e+1)),i.isNeg()&&!i.isZero()?`-`+n:n},J.toFraction=function(e){var t,n,r,i,a,o,s,c,l,u,d,f,p=this,m=p.d,h=p.constructor;if(!m)return new h(p);if(l=n=new h(1),r=c=new h(0),t=new h(r),a=t.e=Bb(m)-p.e-1,o=a%q,t.d[0]=xb(10,o<0?q+o:o),e==null)e=a>0?t:l;else{if(s=new h(e),!s.isInt()||s.lt(l))throw Error(gb+s);e=s.gt(t)?a>0?t:l:s}for(K=!1,s=new h(Ab(m)),u=h.precision,h.precision=a=m.length*q*2;d=Fb(s,t,0,1,1),i=n.plus(d.times(r)),i.cmp(e)!=1;)n=r,r=i,i=l,l=c.plus(d.times(i)),c=i,i=t,t=s.minus(d.times(i)),s=i;return i=Fb(e.minus(n),r,0,1,1),c=c.plus(i.times(l)),n=n.plus(i.times(r)),c.s=l.s=p.s,f=Fb(l,r,a,1).minus(p).abs().cmp(Fb(c,n,a,1).minus(p).abs())<1?[l,r]:[c,n],h.precision=u,K=!0,f},J.toHexadecimal=J.toHex=function(e,t){return ex(this,16,e,t)},J.toNearest=function(e,t){var n=this,r=n.constructor;if(n=new r(n),e==null){if(!n.d)return n;e=new r(1),t=r.rounding}else{if(e=new r(e),t===void 0?t=r.rounding:jb(t,0,8),!n.d)return e.s?n:e;if(!e.d)return e.s&&=n.s,e}return e.d[0]?(K=!1,n=Fb(n,e,0,t,1).times(e),K=!0,Y(n)):(e.s=n.s,n=e),n},J.toNumber=function(){return+this},J.toOctal=function(e,t){return ex(this,8,e,t)},J.toPower=J.pow=function(e){var t,n,r,i,a,o,s=this,c=s.constructor,l=+(e=new c(e));if(!s.d||!e.d||!s.d[0]||!e.d[0])return new c(xb(+s,l));if(s=new c(s),s.eq(1))return s;if(r=c.precision,a=c.rounding,e.eq(1))return Y(s,r,a);if(t=bb(e.e/q),t>=e.d.length-1&&(n=l<0?-l:l)<=Db)return i=Hb(c,s,n,r),e.s<0?new c(1).div(i):Y(i,r,a);if(o=s.s,o<0){if(tc.maxE+1||t0?o/0:0):(K=!1,c.rounding=s.s=1,n=Math.min(12,(t+``).length),i=Gb(e.times(Kb(s,r+n)),r),i.d&&(i=Y(i,r+5,1),Mb(i.d,r,a)&&(t=r+10,i=Y(Gb(e.times(Kb(s,t+n)),t),t+5,1),+Ab(i.d).slice(r+1,r+15)+1==0x5af3107a4000&&(i=Y(i,r+1,0)))),i.s=o,K=!0,c.rounding=a,Y(i,r,a))},J.toPrecision=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=Ib(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(jb(e,1,cb),t===void 0?t=i.rounding:jb(t,0,8),r=Y(new i(r),e,t),n=Ib(r,e<=r.e||r.e<=i.toExpNeg,e)),r.isNeg()&&!r.isZero()?`-`+n:n},J.toSignificantDigits=J.toSD=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(jb(e,1,cb),t===void 0?t=r.rounding:jb(t,0,8)),Y(new r(n),e,t)},J.toString=function(){var e=this,t=e.constructor,n=Ib(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?`-`+n:n},J.truncated=J.trunc=function(){return Y(new this.constructor(this),this.e+1,1)},J.valueOf=J.toJSON=function(){var e=this,t=e.constructor,n=Ib(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?`-`+n:n};function Ab(e){var t,n,r,i=e.length-1,a=``,o=e[0];if(i>0){for(a+=o,t=1;tn)throw Error(gb+e)}function Mb(e,t,n,r){var i,a,o,s;for(a=e[0];a>=10;a/=10)--t;return--t<0?(t+=q,i=0):(i=Math.ceil((t+1)/q),t%=q),a=xb(10,q-t),s=e[i]%a|0,r==null?t<3?(t==0?s=s/100|0:t==1&&(s=s/10|0),o=n<4&&s==99999||n>3&&s==49999||s==5e4||s==0):o=(n<4&&s+1==a||n>3&&s+1==a/2)&&(e[i+1]/a/100|0)==xb(10,t-2)-1||(s==a/2||s==0)&&(e[i+1]/a/100|0)==0:t<4?(t==0?s=s/1e3|0:t==1?s=s/100|0:t==2&&(s=s/10|0),o=(r||n<4)&&s==9999||!r&&n>3&&s==4999):o=((r||n<4)&&s+1==a||!r&&n>3&&s+1==a/2)&&(e[i+1]/a/1e3|0)==xb(10,t-3)-1,o}function Nb(e,t,n){for(var r,i=[0],a,o=0,s=e.length;on-1&&(i[r+1]===void 0&&(i[r+1]=0),i[r+1]+=i[r]/n|0,i[r]%=n)}return i.reverse()}function Pb(e,t){var n,r,i;if(t.isZero())return t;r=t.d.length,r<32?(n=Math.ceil(r/3),i=(1/Qb(4,n)).toString()):(n=16,i=`2.3283064365386962890625e-10`),e.precision+=n,t=Zb(e,1,t.times(i),new e(1));for(var a=n;a--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=n,t}var Fb=(function(){function e(e,t,n){var r,i=0,a=e.length;for(e=e.slice();a--;)r=e[a]*t+i,e[a]=r%n|0,i=r/n|0;return i&&e.unshift(i),e}function t(e,t,n,r){var i,a;if(n!=r)a=n>r?1:-1;else for(i=a=0;it[i]?1:-1;break}return a}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]1;)e.shift()}return function(r,i,a,o,s,c){var l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k=r.constructor,A=r.s==i.s?1:-1,j=r.d,M=i.d;if(!j||!j[0]||!M||!M[0])return new k(!r.s||!i.s||(j?M&&j[0]==M[0]:!M)?NaN:j&&j[0]==0||!M?A*0:A/0);for(c?(p=1,u=r.e-i.e):(c=Eb,p=q,u=bb(r.e/p)-bb(i.e/p)),D=M.length,T=j.length,_=new k(A),v=_.d=[],d=0;M[d]==(j[d]||0);d++);if(M[d]>(j[d]||0)&&u--,a==null?(S=a=k.precision,o=k.rounding):S=s?a+(r.e-i.e)+1:a,S<0)v.push(1),m=!0;else{if(S=S/p+2|0,d=0,D==1){for(f=0,M=M[0],S++;(d1&&(M=e(M,f,c),j=e(j,f,c),D=M.length,T=j.length),w=D,y=j.slice(0,D),b=y.length;b=c/2&&++E;do f=0,l=t(M,y,D,b),l<0?(x=y[0],D!=b&&(x=x*c+(y[1]||0)),f=x/E|0,f>1?(f>=c&&(f=c-1),h=e(M,f,c),g=h.length,b=y.length,l=t(h,y,g,b),l==1&&(f--,n(h,D=10;f/=10)d++;_.e=d+u*p-1,Y(_,s?a+_.e+1:a,o,m)}return _}})();function Y(e,t,n,r){var i,a,o,s,c,l,u,d,f,p=e.constructor;out:if(t!=null){if(d=e.d,!d)return e;for(i=1,s=d[0];s>=10;s/=10)i++;if(a=t-i,a<0)a+=q,o=t,u=d[f=0],c=u/xb(10,i-o-1)%10|0;else if(f=Math.ceil((a+1)/q),s=d.length,f>=s)if(r){for(;s++<=f;)d.push(0);u=c=0,i=1,a%=q,o=a-q+1}else break out;else{for(u=s=d[f],i=1;s>=10;s/=10)i++;a%=q,o=a-q+i,c=o<0?0:u/xb(10,i-o-1)%10|0}if(r=r||t<0||d[f+1]!==void 0||(o<0?u:u%xb(10,i-o-1)),l=n<4?(c||r)&&(n==0||n==(e.s<0?3:2)):c>5||c==5&&(n==4||r||n==6&&(a>0?o>0?u/xb(10,i-o):0:d[f-1])%10&1||n==(e.s<0?8:7)),t<1||!d[0])return d.length=0,l?(t-=e.e+1,d[0]=xb(10,(q-t%q)%q),e.e=-t||0):d[0]=e.e=0,e;if(a==0?(d.length=f,s=1,f--):(d.length=f+1,s=xb(10,q-a),d[f]=o>0?(u/xb(10,i-o)%xb(10,o)|0)*s:0),l)for(;;)if(f==0){for(a=1,o=d[0];o>=10;o/=10)a++;for(o=d[0]+=s,s=1;o>=10;o/=10)s++;a!=s&&(e.e++,d[0]==Eb&&(d[0]=1));break}else{if(d[f]+=s,d[f]!=Eb)break;d[f--]=0,s=1}for(a=d.length;d[--a]===0;)d.pop()}return K&&(e.e>p.maxE?(e.d=null,e.e=NaN):e.e0?a=a.charAt(0)+`.`+a.slice(1)+Vb(r):o>1&&(a=a.charAt(0)+`.`+a.slice(1)),a=a+(e.e<0?`e`:`e+`)+e.e):i<0?(a=`0.`+Vb(-i-1)+a,n&&(r=n-o)>0&&(a+=Vb(r))):i>=o?(a+=Vb(i+1-o),n&&(r=n-i-1)>0&&(a=a+`.`+Vb(r))):((r=i+1)0&&(i+1===o&&(a+=`.`),a+=Vb(r))),a}function Lb(e,t){var n=e[0];for(t*=q;n>=10;n/=10)t++;return t}function Rb(e,t,n){if(t>Ob)throw K=!0,n&&(e.precision=n),Error(_b);return Y(new e(ub),t,1,!0)}function zb(e,t,n){if(t>kb)throw Error(_b);return Y(new e(db),t,n,!0)}function Bb(e){var t=e.length-1,n=t*q+1;if(t=e[t],t){for(;t%10==0;t/=10)n--;for(t=e[0];t>=10;t/=10)n++}return n}function Vb(e){for(var t=``;e--;)t+=`0`;return t}function Hb(e,t,n,r){var i,a=new e(1),o=Math.ceil(r/q+4);for(K=!1;;){if(n%2&&(a=a.times(t),tx(a.d,o)&&(i=!0)),n=bb(n/2),n===0){n=a.d.length-1,i&&a.d[n]===0&&++a.d[n];break}t=t.times(t),tx(t.d,o)}return K=!0,a}function Ub(e){return e.d[e.d.length-1]&1}function Wb(e,t,n){for(var r,i,a=new e(t[0]),o=0;++o17)return new f(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(t==null?(K=!1,c=m):c=t,s=new f(.03125);e.e>-2;)e=e.times(s),d+=5;for(r=Math.log(xb(2,d))/Math.LN10*2+5|0,c+=r,n=a=o=new f(1),f.precision=c;;){if(a=Y(a.times(e),c,1),n=n.times(++u),s=o.plus(Fb(a,n,c,1)),Ab(s.d).slice(0,c)===Ab(o.d).slice(0,c)){for(i=d;i--;)o=Y(o.times(o),c,1);if(t==null)if(l<3&&Mb(o.d,c-r,p,l))f.precision=c+=10,n=a=s=new f(1),u=0,l++;else return Y(o,f.precision=m,p,K=!0);else return f.precision=m,o}o=s}}function Kb(e,t){var n,r,i,a,o,s,c,l,u,d,f,p=1,m=10,h=e,g=h.d,_=h.constructor,v=_.rounding,y=_.precision;if(h.s<0||!g||!g[0]||!h.e&&g[0]==1&&g.length==1)return new _(g&&!g[0]?-1/0:h.s==1?g?0:h:NaN);if(t==null?(K=!1,u=y):u=t,_.precision=u+=m,n=Ab(g),r=n.charAt(0),Math.abs(a=h.e)<0x5543df729c000){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)h=h.times(e),n=Ab(h.d),r=n.charAt(0),p++;a=h.e,r>1?(h=new _(`0.`+n),a++):h=new _(r+`.`+n.slice(1))}else return l=Rb(_,u+2,y).times(a+``),h=Kb(new _(r+`.`+n.slice(1)),u-m).plus(l),_.precision=y,t==null?Y(h,y,v,K=!0):h;for(d=h,c=o=h=Fb(h.minus(1),h.plus(1),u,1),f=Y(h.times(h),u,1),i=3;;){if(o=Y(o.times(f),u,1),l=c.plus(Fb(o,new _(i),u,1)),Ab(l.d).slice(0,u)===Ab(c.d).slice(0,u))if(c=c.times(2),a!==0&&(c=c.plus(Rb(_,u+2,y).times(a+``))),c=Fb(c,new _(p),u,1),t==null)if(Mb(c.d,u-m,v,s))_.precision=u+=m,l=o=h=Fb(d.minus(1),d.plus(1),u,1),f=Y(h.times(h),u,1),i=s=1;else return Y(c,_.precision=y,v,K=!0);else return _.precision=y,c;c=l,i+=2}}function qb(e){return String(e.s*e.s/0)}function Jb(e,t){var n,r,i;for((n=t.indexOf(`.`))>-1&&(t=t.replace(`.`,``)),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;r++);for(i=t.length;t.charCodeAt(i-1)===48;--i);if(t=t.slice(r,i),t){if(i-=r,e.e=n=n-r-1,e.d=[],r=(n+1)%q,n<0&&(r+=q),re.constructor.maxE?(e.d=null,e.e=NaN):e.e-1){if(t=t.replace(/(\d)_(?=\d)/g,`$1`),Tb.test(t))return Jb(e,t)}else if(t===`Infinity`||t===`NaN`)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(Cb.test(t))n=16,t=t.toLowerCase();else if(Sb.test(t))n=2;else if(wb.test(t))n=8;else throw Error(gb+t);for(a=t.search(/p/i),a>0?(c=+t.slice(a+1),t=t.substring(2,a)):t=t.slice(2),a=t.indexOf(`.`),o=a>=0,r=e.constructor,o&&(t=t.replace(`.`,``),s=t.length,a=s-a,i=Hb(r,new r(n),a,a*2)),l=Nb(t,n,Eb),u=l.length-1,a=u;l[a]===0;--a)l.pop();return a<0?new r(e.s*0):(e.e=Lb(l,u),e.d=l,K=!1,o&&(e=Fb(e,i,s*4)),c&&(e=e.times(Math.abs(c)<54?xb(2,c):Ux.pow(2,c))),K=!0,e)}function Xb(e,t){var n,r=t.d.length;if(r<3)return t.isZero()?t:Zb(e,2,t,t);n=1.4*Math.sqrt(r),n=n>16?16:n|0,t=t.times(1/Qb(5,n)),t=Zb(e,2,t,t);for(var i,a=new e(5),o=new e(16),s=new e(20);n--;)i=t.times(t),t=t.times(a.plus(i.times(o.times(i).minus(s))));return t}function Zb(e,t,n,r,i){var a,o,s,c,l=1,u=e.precision,d=Math.ceil(u/q);for(K=!1,c=n.times(n),s=new e(r);;){if(o=Fb(s.times(c),new e(t++*t++),u,1),s=i?r.plus(o):r.minus(o),r=Fb(o.times(c),new e(t++*t++),u,1),o=s.plus(r),o.d[d]!==void 0){for(a=d;o.d[a]===s.d[a]&&a--;);if(a==-1)break}a=s,s=r,r=o,o=a,l++}return K=!0,o.d.length=d+1,o}function Qb(e,t){for(var n=e;--t;)n*=e;return n}function $b(e,t){var n,r=t.s<0,i=zb(e,e.precision,1),a=i.times(.5);if(t=t.abs(),t.lte(a))return mb=r?4:1,t;if(n=t.divToInt(i),n.isZero())mb=r?3:2;else{if(t=t.minus(n.times(i)),t.lte(a))return mb=Ub(n)?r?2:3:r?4:1,t;mb=Ub(n)?r?1:4:r?3:2}return t.minus(i).abs()}function ex(e,t,n,r){var i,a,o,s,c,l,u,d,f,p=e.constructor,m=n!==void 0;if(m?(jb(n,1,cb),r===void 0?r=p.rounding:jb(r,0,8)):(n=p.precision,r=p.rounding),!e.isFinite())u=qb(e);else{for(u=Ib(e),o=u.indexOf(`.`),m?(i=2,t==16?n=n*4-3:t==8&&(n=n*3-2)):i=t,o>=0&&(u=u.replace(`.`,``),f=new p(1),f.e=u.length-o,f.d=Nb(Ib(f),10,i),f.e=f.d.length),d=Nb(u,10,i),a=c=d.length;d[--c]==0;)d.pop();if(!d[0])u=m?`0p+0`:`0`;else{if(o<0?a--:(e=new p(e),e.d=d,e.e=a,e=Fb(e,f,n,r,0,i),d=e.d,a=e.e,l=pb),o=d[n],s=i/2,l||=d[n+1]!==void 0,l=r<4?(o!==void 0||l)&&(r===0||r===(e.s<0?3:2)):o>s||o===s&&(r===4||l||r===6&&d[n-1]&1||r===(e.s<0?8:7)),d.length=n,l)for(;++d[--n]>i-1;)d[n]=0,n||(++a,d.unshift(1));for(c=d.length;!d[c-1];--c);for(o=0,u=``;o1)if(t==16||t==8){for(o=t==16?4:3,--c;c%o;c++)u+=`0`;for(d=Nb(u,i,t),c=d.length;!d[c-1];--c);for(o=1,u=`1.`;oc)for(a-=c;a--;)u+=`0`;else at)return e.length=t,!0}function nx(e){return new this(e).abs()}function rx(e){return new this(e).acos()}function ix(e){return new this(e).acosh()}function ax(e,t){return new this(e).plus(t)}function ox(e){return new this(e).asin()}function sx(e){return new this(e).asinh()}function cx(e){return new this(e).atan()}function lx(e){return new this(e).atanh()}function ux(e,t){e=new this(e),t=new this(t);var n,r=this.precision,i=this.rounding,a=r+4;return!e.s||!t.s?n=new this(NaN):!e.d&&!t.d?(n=zb(this,a,1).times(t.s>0?.25:.75),n.s=e.s):!t.d||e.isZero()?(n=t.s<0?zb(this,r,i):new this(0),n.s=e.s):!e.d||t.isZero()?(n=zb(this,a,1).times(.5),n.s=e.s):t.s<0?(this.precision=a,this.rounding=1,n=this.atan(Fb(e,t,a,1)),t=zb(this,a,1),this.precision=r,this.rounding=i,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan(Fb(e,t,a,1)),n}function dx(e){return new this(e).cbrt()}function fx(e){return Y(e=new this(e),e.e+1,2)}function px(e,t,n){return new this(e).clamp(t,n)}function mx(e){if(!e||typeof e!=`object`)throw Error(hb+`Object expected`);var t,n,r,i=e.defaults===!0,a=[`precision`,1,cb,`rounding`,0,8,`toExpNeg`,-sb,0,`toExpPos`,0,sb,`maxE`,0,sb,`minE`,-sb,0,`modulo`,0,9];for(t=0;t=a[t+1]&&r<=a[t+2])this[n]=r;else throw Error(gb+n+`: `+r);if(n=`crypto`,i&&(this[n]=fb[n]),(r=e[n])!==void 0)if(r===!0||r===!1||r===0||r===1)if(r)if(typeof crypto<`u`&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[n]=!0;else throw Error(vb);else this[n]=!1;else throw Error(gb+n+`: `+r);return this}function hx(e){return new this(e).cos()}function gx(e){return new this(e).cosh()}function _x(e){var t,n,r;function i(e){var t,n,r,a=this;if(!(a instanceof i))return new i(e);if(a.constructor=i,Sx(e)){a.s=e.s,K?!e.d||e.e>i.maxE?(a.e=NaN,a.d=null):e.e=10;n/=10)t++;K?t>i.maxE?(a.e=NaN,a.d=null):t=429e7?t[a]=crypto.getRandomValues(new Uint32Array(1))[0]:s[a++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(r*=4);a=214e7?crypto.randomBytes(4).copy(t,a):(s.push(i%1e7),a+=4);a=r/4}else throw Error(vb);else for(;a=10;i/=10)r++;re<0?0:e>1?1:e,mS=(e,t)=>(e%t+t)%t;function hS(e){return e instanceof Wx?e:new Wx(e)}function gS(e){let t=new Wx(e).minus(Zx).div(1e3).div(Yx).mul(1e6).toDecimalPlaces(0,Wx.ROUND_FLOOR);return BigInt(t.toString())}function _S(e){let t=new Wx(e.toString()).div(1e6).mul(Yx).mul(1e3).plus(Zx);return Number(t.toNearest(1,Wx.ROUND_HALF_EVEN).toString())}var vS=`kai.sunrise.offsetSec`,yS=`kai.sunrise.anchorISO`;function bS(){let e=localStorage.getItem(vS);try{return e?new Wx(e):new Wx(0)}catch{return new Wx(0)}}function xS(){return Number(bS())}function SS(e){let t=hS(e).mod(86400).plus(86400).mod(86400);localStorage.setItem(vS,t.toString()),localStorage.setItem(yS,new Date().toISOString())}function CS(e=new Date){let t=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));SS(new Wx(e.getTime()-t.getTime()).div(1e3))}function wS(e,t=new Date){let n=e.match(/^(\d{1,2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?$/);if(!n)return;let r=Math.min(23,Math.max(0,Number(n[1]))),i=Math.min(59,Math.max(0,Number(n[2]))),a=n[3]?Math.min(59,Math.max(0,Number(n[3]))):0,o=n[4]?new Wx(`0.`+n[4]):new Wx(0),s=new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0),c=new Date(s.getTime());c.setHours(r,i,a,0);let l=new Wx(c.getTime()).plus(o.mul(1e3)),u=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()));SS(l.minus(u.getTime()).div(1e3))}function TS(){let e=bS(),t=new Date(Zx),n=gS(new Wx(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())).plus(e.mul(1e3)).toNumber());return n<=gS(1715323541888)?n+oS:n}function ES(e=new Date){let t=bS(),n=gS(e.getTime()),r=gS(new Wx(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())).plus(t.mul(1e3)).toNumber()),i=r,a=r+oS;return nArray.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``);function RS(e){let t=e.buffer;return t instanceof ArrayBuffer&&e.byteOffset===0&&e.byteLength===t.byteLength?t:e.slice().buffer}async function zS(e){let t=RS(typeof e==`string`?new TextEncoder().encode(e):e),n=await crypto.subtle.digest(`SHA-256`,t);return LS(new Uint8Array(n))}async function BS(e,t){let n=URL.createObjectURL(e);try{let e=new Image;e.decoding=`async`,e.src=n,await e.decode();let r=document.createElement(`canvas`);r.width=e.width,r.height=e.height;let i=r.getContext(`2d`);if(!i)throw Error(`Canvas 2D context unavailable`);i.drawImage(e,0,0);let{data:a}=i.getImageData(Math.floor(e.width/2),Math.floor(e.height/2),1,1),o=[a[0],a[1],a[2]];return{sig:(await zS(`${t}-2:3-${o.join(`,`)}`)).slice(0,32),rgb:o}}finally{URL.revokeObjectURL(n)}}function VS(e){return btoa(String.fromCharCode(...e)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function HS(e){let t=JSON.stringify(e);return VS(new TextEncoder().encode(t))}function US(e){let t=JSON.stringify(e);return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))).replace(/=+$/g,``)}function WS(e,t,n){return`${e}_${t}_${n}`}function GS(e,t){try{let n=new URL(e,typeof window<`u`?window.location.origin:`http://localhost`),r={k:`phi.transfer.claim`,v:1,a:t.amountPhi,p:t.sendPulse,s:t.senderStamp,h:t.canonicalHash};return n.searchParams.set(`x`,`t:`+HS(r)),n.toString()}catch{return e}}var KS=e=>typeof e==`object`&&!!e,qS=(e,t)=>{if(!KS(e))return;let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0},JS=(e,t)=>{if(!KS(e))return;let n=e[t];return typeof n==`string`?n:void 0},YS=e=>{let t=typeof e==`string`?e:void 0;return t&&[`Root`,`Sacral`,`Solar Plexus`,`Heart`,`Throat`,`Third Eye`,`Crown`].includes(t)?t:void 0};function XS(e){let t=KS(e)&&`meta`in e?e.meta:void 0,n=qS(t,`pulse`)??(KS(e)?qS(e,`pulseCreated`):void 0)??AS(),r=qS(t,`beat`)??0,i=qS(t,`stepsPerBeat`)??44,a=qS(t,`stepIndex`)??Math.floor((qS(t,`stepPct`)??.5)*i),o=JS(t,`chakraDay`),s=KS(e)?JS(e,`chakraDay`):void 0,c=YS(o)??(s?YS(s):void 0)??`Root`,l=JS(t,`userPhiKey`),u=JS(t,`kaiSignature`),d=JS(t,`creatorPublicKey`);return{pulse:n,beat:r,stepsPerBeat:i,stepIndex:a,chakraDay:c,userPhiKey:l||void 0,kaiSignature:u||void 0,creatorPublicKey:d||void 0}}function ZS(e,t,n){let r=new Date,{kaiPulseToday:i,beatIndex:a,stepIndex:o,percentIntoStep:s}=MS(r),{display:c}=FS(r),l=IS(r),u=iS(e),d=`Kairos • ${c.dayName} (D${c.dayIndex1}/6) • Month ${c.monthIndex1} ${c.monthName} • Day ${c.dayInMonth1}/42 • YearDay ${c.dayInYear1}/336 • Beat ${a+1}/36 • Step ${o+1}/44 • ΦPulse ${e} • Ark ${l} • Chakra ${n}`;return{version:1,eternalPulse:e,sigilPulse:t,dayName:c.dayName,dayIndex1:c.dayIndex1,dayInMonth1:c.dayInMonth1,dayInYear1:c.dayInYear1,monthIndex1:c.monthIndex1,monthName:c.monthName,weekIndex1:c.weekIndex1,beatIndex:a,stepIndex:o,pulsesIntoBeat:u,kaiPulseToday:i,percentIntoStep:s,arcName:l,chakraDay:n,text:d}}function QS(e=9){return VS(crypto.getRandomValues(new Uint8Array(e)))}async function $S(e,t,n){let r=await e.text(),i=JSON.stringify(t,null,2).replace(/]]>/g,`]]]]>>`),a=JSON.stringify({phiTransfer:n},null,2).replace(//g,`]]]]>>`),o=`<metadata id="sigil-meta" data-type="application/json"><![CDATA[${i}`,s=`${a}`,c=r;return c=/]/i.test(c)?c.replace(//i,o):c.replace(/]*)?>/i,e=>`${e}${o}`),c=c.replace(/<\/svg>\s*$/i,`${s}`),new Blob([c],{type:`image/svg+xml`})}function eC({isOpen:e,onClose:t,sourceGlyph:n,onSend:r}){let[i,a]=(0,C.useState)(``),[o,s]=(0,C.useState)(``),[c,l]=(0,C.useState)(``),[u,d]=(0,C.useState)(null),[f,p]=(0,C.useState)(!1),m=(0,C.useRef)(null),[h,g]=(0,C.useState)(null),[_,v]=(0,C.useState)(null),[y,b]=(0,C.useState)(null),x=(0,C.useMemo)(()=>Number(KS(n)&&`value`in n?n.value:0),[n]),S=(0,C.useMemo)(()=>XS(n),[n]),w=Math.min(Math.max(S.stepIndex/S.stepsPerBeat,0),1);if((0,C.useEffect)(()=>{e||(a(``),s(``),l(``),d(null),p(!1))},[e]),!e)return null;let T=async()=>{d(null);let e=parseFloat(i);if(isNaN(e)||e<=0){d(`Enter a valid Φ amount.`);return}if(e>x){d(`Insufficient balance. Only ${x.toFixed(3)} Φ available.`);return}try{p(!0);let i=AS(),a=S.pulse,s=m.current;if(!s)throw Error(`Renderer unavailable`);let l=await s.exportBlob(`image/svg+xml`),u=await s.exportBlob(`image/png`,3),{sig:d,rgb:f}=await BS(u,a),g=await zS(`${d}-${a}-${i}`),v=ZS(i,a,S.chakraDay);if(!h)throw Error(`Sigil hash not ready`);let b={pulse:S.pulse,beat:S.beat,stepIndex:S.stepIndex,chakraDay:S.chakraDay,stepsPerBeat:S.stepsPerBeat,kaiSignature:S.kaiSignature,userPhiKey:S.userPhiKey},x=_??Qf(h,b,{origin:typeof window<`u`?window.location.origin:``,autoInferParent:!0}),C=GS(x,{amountPhi:e,sendPulse:i,senderStamp:g,canonicalHash:h}),w={kind:`phi.transfer`,version:1,amountPhi:e,recipient:o||null,message:c||null,createdAtPulseEternal:i,sigilPulse:a,sendPulse:i,rgbSeed:f,canonicalHash:h,shareUrl:C,sourcePhiKey:S.userPhiKey??null,kairosStamp:v},T=US(w),E={senderSignature:d,senderStamp:g,senderKaiPulse:i,payload:{name:`phi_transfer_value.json`,mime:`application/phi.transfer+json`,size:T.length,encoded:T}},D=y&&y.trim().length>0?JSON.parse(y):null,O={"@context":ps,type:ms,pulse:a,beat:S.beat,stepIndex:S.stepIndex,chakraDay:S.chakraDay,stepsPerBeat:S.stepsPerBeat,kaiSignature:S.kaiSignature??void 0,userPhiKey:S.userPhiKey??void 0,creatorPublicKey:S.creatorPublicKey??void 0,kaiPulse:i,canonicalHash:h,transferNonce:QS(),segmentSize:hs,transfers:[E],canonicalUrl:x,shareUrl:C,embeddedMeta:D},k=await $S(l,O,w),A=WS(`sigil_transfer`,a,i),j={version:1,kind:`phi.sigil.mint`,canonicalHash:h,canonicalUrl:x,shareUrl:C,meta:O},M=new Rd.default;M.file(`${A}.svg`,k),M.file(`${A}.png`,u),M.file(`${A}.json`,JSON.stringify(j,null,2));let N=await M.generateAsync({type:`blob`}),P=document.createElement(`a`),F=URL.createObjectURL(N);P.href=F,P.download=`${A}.zip`,P.rel=`noopener`,document.body.appendChild(P),P.click(),P.remove(),setTimeout(()=>URL.revokeObjectURL(F),0),hp(C),r(Id(n,e,i,o,c)),p(!1),t()}catch(e){p(!1),d(`Failed to mint & send glyph. `+(e instanceof Error?e.message:String(e)))}};return(0,W.jsx)(`div`,{className:`modal-overlay`,children:(0,W.jsxs)(`dialog`,{className:`send-sigil-modal`,open:!0,children:[(0,W.jsx)(`button`,{className:`close-btn`,onClick:t,"aria-label":`Close`,children:(0,W.jsx)(cd,{size:22})}),(0,W.jsx)(`h2`,{children:`Exhale Composite Derivative Breath`}),(0,W.jsx)(`div`,{"aria-hidden":!0,style:{position:`absolute`,width:0,height:0,overflow:`hidden`},children:(0,W.jsx)(ob,{ref:m,pulse:S.pulse,beat:S.beat,stepPct:w,chakraDay:S.chakraDay,userPhiKey:S.userPhiKey,kaiSignature:S.kaiSignature,creatorPublicKey:S.creatorPublicKey,origin:typeof window<`u`?window.location.origin:void 0,animate:!1,quality:`high`,showZKBadge:!1,onReady:({hash:e,metadataJson:t})=>{let n=Qf(e,{pulse:S.pulse,beat:S.beat,stepIndex:S.stepIndex,chakraDay:S.chakraDay,stepsPerBeat:S.stepsPerBeat,kaiSignature:S.kaiSignature,userPhiKey:S.userPhiKey},{origin:typeof window<`u`?window.location.origin:``,autoInferParent:!0});g(e),v(n),b(t)},onError:()=>{}})}),(0,W.jsxs)(`div`,{className:`field-group`,children:[(0,W.jsx)(`label`,{children:`Recipient Hash (optional)`}),(0,W.jsx)(`input`,{type:`text`,placeholder:`e.g. phikey::sig`,value:o,onChange:e=>s(e.currentTarget.value)})]}),(0,W.jsxs)(`div`,{className:`field-group`,children:[(0,W.jsx)(`label`,{children:`Memory (optional)`}),(0,W.jsx)(`input`,{type:`text`,placeholder:`Message to attach`,value:c,onChange:e=>l(e.currentTarget.value)})]}),(0,W.jsxs)(`div`,{className:`field-group`,children:[(0,W.jsx)(`label`,{children:`Amount to Exhale (Φ)`}),(0,W.jsx)(`input`,{type:`number`,value:i,onChange:e=>a(e.currentTarget.value),placeholder:`0.0`,min:`0`,step:`0.001`})]}),(0,W.jsxs)(`div`,{className:`balance-hint`,children:[`Available: `,x.toFixed(3),` Φ`]}),u&&(0,W.jsx)(`div`,{className:`error-msg`,children:u}),(0,W.jsxs)(`button`,{className:`send-btn`,onClick:T,disabled:f,children:[(0,W.jsx)(pd,{size:18}),` `,f?`Exhaling…`:`Exhale Breath`]}),(0,W.jsx)(`p`,{className:`small subtle`,style:{marginTop:8},children:h?`canonical: ${h.slice(0,10)}…`:`remembering sigil…`})]})})}var tC=e=>typeof e==`number`&&Number.isFinite(e),nC=new Map;function rC(e=2){if(nC.has(e))return nC.get(e);try{if(typeof Intl<`u`&&typeof Intl.NumberFormat==`function`){let t=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:e,maximumFractionDigits:e});return t.format(0),nC.set(e,t),t}}catch{}return nC.set(e,null),null}function iC(e,t){let n=e<0?`-`:``,[r,i]=Math.abs(e).toFixed(Math.max(0,t)).split(`.`);return`${n}$${r.replace(/\B(?=(\d{3})+(?!\d))/g,`,`)}${t>0?`.`+i:``}`}function aC(e,t=2){if(!tC(e))return t===0?`$0`:`$0.00`;let n=rC(t);return n?n.format(e):iC(e,t)}function oC(e,t=6){return`Φ ${(tC(e)?e:0).toFixed(Math.max(0,t))}`}const sC=(e,t=3)=>typeof e==`number`&&Number.isFinite(e)?`${(e*100).toFixed(t)}%`:`—`,cC=(e,t=3)=>typeof e==`number`&&Number.isFinite(e)?e.toFixed(t):`—`,lC=(e,t=2)=>`${tC(e)&&e>=0?`+`:``}${(e*100).toFixed(t)}%`,uC=(e,t=2)=>`${tC(e)&&e>=0?`+`:``}${(tC(e)?e:0).toFixed(t)}%`;function dC(e){let t=(e||``).trim();if(!t)return null;try{let e=new URL(t,typeof window<`u`?window.location.origin:`http://localhost`).pathname.match(/[/]s[/]([a-f0-9]{64})/i);if(e)return e[1].toLowerCase();let n=t.match(/[a-f0-9]{64}/i);return n?n[0].toLowerCase():null}catch{let e=t.match(/[a-f0-9]{64}/i);return e?e[0].toLowerCase():null}}function fC(e){return Number((Number.isFinite(e)?e:0).toFixed(6))}function pC(e){let t=(e.url||``).trim(),n=Math.max(0,Number.isFinite(e.amount)?e.amount:0);if(!t&&n<=0)return{...e,canonicalHash:null,valid:!1,error:`Enter URL and amount`};if(!t)return{...e,canonicalHash:null,valid:!1,error:`Missing URL`};let r=dC(t);return r?n<=0?{...e,canonicalHash:r,valid:!1,error:`Amount must be > 0`}:{...e,canonicalHash:r,valid:!0,error:null}:{...e,canonicalHash:null,valid:!1,error:`No canonical hash found`}}function mC({donors:e,balancePhi:t,balanceForMintPhi:n,setBalanceForMintPhi:r,addDonor:i,removeDonor:a,updateDonor:o,onMintComposite:s,minting:c,totalDonorAmount:l}){let u=(0,C.useMemo)(()=>e.map(pC),[e]),d=(0,C.useMemo)(()=>{let e=new Map;for(let t of u)t.canonicalHash&&e.set(t.canonicalHash,(e.get(t.canonicalHash)||0)+1);return e},[u]),f=u.some(e=>e.valid===!1&&(e.url||e.amount>0))||u.some(e=>e.canonicalHash&&(d.get(e.canonicalHash)||0)>1),p=(0,C.useMemo)(()=>fC(l+Math.max(0,Number(n||0))),[l,n]),m=(0,C.useCallback)((t,n)=>{let r=pC({...e[t],url:n});o(t,{url:n,canonicalHash:r.canonicalHash,valid:r.valid,error:r.error})},[e,o]),h=(0,C.useCallback)((t,n)=>{let r=Math.max(0,Number(n||0)),i=pC({...e[t],amount:r});o(t,{amount:r,canonicalHash:i.canonicalHash,valid:i.valid,error:i.error})},[e,o]);return(0,W.jsxs)(`section`,{className:`card donors-card streams-card`,"aria-label":`Create Temple-Glyph streams`,children:[(0,W.jsxs)(`header`,{className:`card-hd`,children:[(0,W.jsxs)(`div`,{className:`hd-left`,children:[(0,W.jsx)(_d,{size:16}),` `,(0,W.jsx)(`strong`,{children:`Temple-Glyph — Streams`})]}),(0,W.jsxs)(`div`,{className:`badge dim small`,title:`Validated streams · total Φ from streams only`,children:[u.filter(e=>e.url).length,` streams • Φ `,fC(l).toFixed(6)]})]}),(0,W.jsxs)(`div`,{className:`card-bd donors-bd`,children:[(0,W.jsxs)(`div`,{className:`donor-row local`,children:[(0,W.jsxs)(`div`,{className:`local-balance`,title:`Current pooled balance (available in-app)`,children:[(0,W.jsx)(`span`,{className:`mono`,children:`Pool`}),(0,W.jsx)(`strong`,{children:oC(t)})]}),(0,W.jsx)(`input`,{className:`donor-amt`,type:`number`,step:`0.000001`,min:0,max:t,placeholder:`Φ from pool`,"aria-label":`Amount from pooled balance`,value:Number.isFinite(n)?n:0,onChange:e=>r(Math.min(Math.max(0,Number(e.currentTarget.value||0)),t)),onBlur:e=>r(fC(Number(e.currentTarget.value||0)))}),(0,W.jsxs)(`div`,{className:`quick-pcts`,"aria-label":`Quick allocations`,children:[(0,W.jsx)(`button`,{className:`btn ghost tiny`,onClick:()=>r(fC(t*.618)),title:`1/φ (~61.8%)`,children:`61.8%`}),(0,W.jsx)(`button`,{className:`btn ghost tiny`,onClick:()=>r(fC(t)),title:`Use all`,children:`Max`})]})]}),(0,W.jsx)(`div`,{className:`donors-grid`,role:`list`,"aria-label":`Stream entries`,children:u.map((e,t)=>{let n=e.canonicalHash&&(d.get(e.canonicalHash)||0)>1,r=e.error||n;return(0,W.jsxs)(`div`,{className:`donor-row ${e.valid&&!n?`ok`:r?`err`:``}`,role:`listitem`,children:[(0,W.jsxs)(`div`,{className:`url-wrap`,children:[(0,W.jsx)(`input`,{className:`donor-url`,type:`url`,placeholder:`Stream sigil URL (or paste a 64-hex canonical hash)`,"aria-label":`Stream ${t+1} URL`,value:e.url,onChange:e=>m(t,e.currentTarget.value),spellCheck:!1,inputMode:`url`}),e.canonicalHash?(0,W.jsxs)(`span`,{className:`chip mono`,title:`Parsed canonical hash`,children:[(0,W.jsx)(dd,{size:12}),` `,e.canonicalHash.slice(0,8),`…`]}):e.url&&(0,W.jsxs)(`span`,{className:`chip warn`,title:`No canonical hash parsed`,children:[(0,W.jsx)(gd,{size:12}),` hash?`]})]}),(0,W.jsx)(`div`,{className:`amt-wrap`,children:(0,W.jsx)(`input`,{className:`donor-amt`,type:`number`,step:`0.000001`,min:0,placeholder:`Φ amount`,"aria-label":`Stream ${t+1} amount (Phi)`,value:Number.isFinite(e.amount)?e.amount:0,onChange:e=>h(t,e.currentTarget.value),onBlur:e=>h(t,fC(Number(e.currentTarget.value||0)).toString())})}),(0,W.jsx)(`button`,{className:`btn ghost small`,title:`Remove stream`,"aria-label":`Remove stream ${t+1}`,onClick:()=>a(t),children:`×`}),r&&(0,W.jsxs)(`div`,{className:`donor-hint`,role:`status`,"aria-live":`polite`,children:[(0,W.jsx)(gd,{size:14}),(0,W.jsx)(`span`,{children:n?`Duplicate stream (same hash)`:e.error})]}),e.valid&&!n&&(0,W.jsxs)(`div`,{className:`donor-hint ok`,"aria-hidden":`true`,children:[(0,W.jsx)(sd,{size:14}),(0,W.jsx)(`span`,{children:`Ready`})]})]},`stream-${t}`)})}),(0,W.jsxs)(`div`,{className:`donors-actions`,children:[(0,W.jsxs)(`button`,{className:`btn ghost`,onClick:i,children:[(0,W.jsx)(fd,{size:16}),` Add stream`]}),(0,W.jsxs)(`button`,{className:`btn primary`,disabled:c||f||!u.some(e=>e.valid&&!((d.get(e.canonicalHash||``)||0)>1))&&fC(n)<=0,title:f?`Fix invalid streams (URL/amount/duplicates)`:`Continue to seal your composite Temple-Glyph`,onClick:s,children:[(0,W.jsx)(_d,{size:16}),` `,c?`Exhaling...`:`➵ to Exhale Temple-Glyph`]})]}),(0,W.jsxs)(`div`,{className:`donors-summary`,children:[(0,W.jsxs)(`div`,{className:`kv`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Streams (valid)`}),(0,W.jsxs)(`span`,{className:`v`,children:[u.filter(e=>e.valid&&!(e.canonicalHash&&(d.get(e.canonicalHash)||0)>1)).length,`/`,u.filter(e=>e.url).length]})]}),(0,W.jsxs)(`div`,{className:`kv`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Σ streams`}),(0,W.jsxs)(`span`,{className:`v`,children:[`Φ `,fC(l).toFixed(6)]})]}),(0,W.jsxs)(`div`,{className:`kv`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Pool allocation`}),(0,W.jsxs)(`span`,{className:`v`,children:[`Φ `,fC(n).toFixed(6)]})]}),(0,W.jsxs)(`div`,{className:`kv total`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Total (Temple-Glyph)`}),(0,W.jsxs)(`span`,{className:`v strong`,children:[`Φ `,p.toFixed(6)]})]})]}),(0,W.jsxs)(`p`,{className:`small subtle`,children:[`You’re one breath away. This step gathers your streams (each with a canonical hash) and any pool allocation into a single memory. In the next step, your composite`,` `,(0,W.jsx)(`strong`,{children:`Temple Glyph`}),` will embed a verifier-compatible `,(0,W.jsx)(`code`,{children:`Temple-Glyph`}),` key listing each stream’s hash and Φ amount, plus your pool contribution. The export includes`,(0,W.jsx)(`code`,{children:` Φkey*.svg`}),` (with `,(0,W.jsx)(`code`,{children:``}),`), a PNG preview, and a`,` `,(0,W.jsx)(`code`,{children:`manifest.json`}),` mirroring the values for auditing.`]})]})]})}var hC=u(Ld(),1),gC=e=>Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``);function _C(e){let t=e.buffer;if(t instanceof ArrayBuffer&&e.byteOffset===0&&e.byteLength===t.byteLength)return t;let n=new Uint8Array(e.byteLength);return n.set(e),n.buffer}async function vC(e){let t=typeof e==`string`?new TextEncoder().encode(e):e,n=await crypto.subtle.digest(`SHA-256`,_C(t));return gC(new Uint8Array(n))}async function yC(e,t){let n=URL.createObjectURL(e);try{let e=new Image;e.decoding=`async`,e.src=n,await e.decode();let r=document.createElement(`canvas`);r.width=e.width,r.height=e.height;let i=r.getContext(`2d`);if(!i)throw Error(`Canvas 2D context unavailable`);i.drawImage(e,0,0);let{data:a}=i.getImageData(Math.floor(e.width/2),Math.floor(e.height/2),1,1),o=[a[0],a[1],a[2]];return{sig:(await vC(`${t}-2:3-${o.join(`,`)}`)).slice(0,32),rgb:o}}finally{URL.revokeObjectURL(n)}}function bC(e=9){let t=crypto.getRandomValues(new Uint8Array(e));return btoa(String.fromCharCode(...t)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function xC(e,t,n){return`${e}_${t}_${n}`}function SC(e,t,n){let r=new Date,{kaiPulseToday:i,beatIndex:a,stepIndex:o,percentIntoStep:s}=MS(r),{display:c}=FS(r),l=IS(r),u=iS(e),d=`Kairos • ${c.dayName} (D${c.dayIndex1}/6) • Month ${c.monthIndex1} ${c.monthName} • Day ${c.dayInMonth1}/42 • YearDay ${c.dayInYear1}/336 • Beat ${a+1}/36 • Step ${o+1}/44 • ΦPulse ${e} • Arc ${l} • Chakra ${n}`;return{version:1,eternalPulse:e,sigilPulse:t,dayName:c.dayName,dayIndex1:c.dayIndex1,dayInMonth1:c.dayInMonth1,dayInYear1:c.dayInYear1,monthIndex1:c.monthIndex1,monthName:c.monthName,weekIndex1:c.weekIndex1,beatIndex:a,stepIndex:o,pulsesIntoBeat:u,kaiPulseToday:i,percentIntoStep:s,arcName:l,chakraDay:n,text:d}}async function CC(e,t,n){let r=await e.text(),i=JSON.stringify(t,null,2).replace(/]]>/g,`]]]]>`),a=JSON.stringify({wallet:n},null,2).replace(/]]>/g,`]]]]>`),o=``,s=``,c=r;return c=/]/i.test(c)?c.replace(//i,o):c.replace(/]*)?>/i,e=>`${e}${o}`),c=c.replace(/<\/svg>\s*$/i,`${s}`),new Blob([c],{type:`image/svg+xml`})}function wC({isOpen:e,onClose:t,donors:n,balancePhi:r,balanceForMintPhi:i,setBalanceForMintPhi:a,addDonor:o,removeDonor:s,updateDonor:c,totalDonorAmount:l,userPhiKey:u,kaiSignature:d,creatorPublicKey:f,chakraDay:p=`Throat`,onMinted:m}){let[h,g]=(0,C.useState)(null),[_,v]=(0,C.useState)(!1),y=(0,C.useRef)(null),[b,x]=(0,C.useState)(null),[S,w]=(0,C.useState)(null),[T,E]=(0,C.useState)(null),D=(0,C.useMemo)(()=>AS(),[]),O=(0,C.useMemo)(()=>MS(new Date),[]),k=(0,C.useMemo)(()=>Math.min(Math.max(O.stepIndex/44,0),1),[O.stepIndex]);(0,C.useEffect)(()=>{e||(g(null),v(!1))},[e]);let A=(0,C.useMemo)(()=>n.map(e=>({canonicalHash:(e.canonicalHash||``).toLowerCase(),url:e.url||void 0,amountPhi:Math.max(0,Number.isFinite(e.amount)?e.amount:0)})).filter(e=>e.canonicalHash&&e.amountPhi>0).map(e=>{let t;try{e.url&&(t=np(e.url)?.originUrl)}catch{t=void 0}return{...e,originUrl:t}}),[n]),j=(0,C.useMemo)(()=>{let e=A.reduce((e,t)=>e+t.amountPhi,0),t=Math.max(0,Number.isFinite(i)?i:0);return{totalDonorPhi:e,poolAllocationPhi:+t.toFixed(6),totalPhi:Number((e+t).toFixed(6))}},[A,i]),M=(0,C.useCallback)(async()=>{if(g(null),!(A.length>0||j.poolAllocationPhi>0)){g(`Add at least one donor or a pool allocation.`);return}try{v(!0);let e=y.current;if(!e)throw Error(`Renderer unavailable`);let n=await e.exportBlob(`image/svg+xml`),r=await e.exportBlob(`image/png`,3),{sig:i,rgb:a}=await yC(r,D),o=await vC(`${i}-${O.kaiPulseToday}-${D}`),{display:s}=FS(new Date),c={version:1,mintedAtPulseEternal:D,pulsesIntoBeat:iS(D),kaiPulseToday:O.kaiPulseToday,beatIndex:O.beatIndex,stepIndex:O.stepIndex,dayName:s.dayName,monthName:s.monthName,dayInMonth1:s.dayInMonth1,dayInYear1:s.dayInYear1,monthIndex1:s.monthIndex1,weekIndex1:s.weekIndex1},l={donors:A,poolAllocationPhi:j.poolAllocationPhi,totalDonorPhi:+j.totalDonorPhi.toFixed(6),totalPhi:+j.totalPhi.toFixed(6),createdAtPulseEternal:D};if(!b)throw Error(`Sigil hash not ready`);let h={pulse:D,beat:O.beatIndex,stepIndex:O.stepIndex,chakraDay:p,stepsPerBeat:44,kaiSignature:d,userPhiKey:u},g=S??Qf(b,h,{origin:typeof window<`u`?window.location.origin:``,autoInferParent:!0}),_=T&&T.trim().length>0?JSON.parse(T):null,x=SC(D,D,p),C={"@context":ps,type:ms,pulse:D,beat:O.beatIndex,stepIndex:O.stepIndex,chakraDay:p,stepsPerBeat:44,kaiSignature:d||void 0,userPhiKey:u||void 0,creatorPublicKey:f||void 0,kaiPulse:D,canonicalHash:b,transferNonce:bC(),segmentSize:hs,composite:{kind:`phi.sigil.composite`,wallet:l},kairosStamp:x,canonicalUrl:g,shareUrl:g,embeddedMeta:_},w=await CC(n,C,l),E=xC(`sigil_phiglyph`,D,D),k={version:1,kind:`phi.sigil.composite`,canonicalHash:b,canonicalUrl:g,shareUrl:g,meta:C,donors:A.map(e=>({canonicalHash:e.canonicalHash,amountPhi:+e.amountPhi.toFixed(6),url:e.url,originUrl:e.originUrl})),totals:{totalDonorPhi:+j.totalDonorPhi.toFixed(6),poolAllocationPhi:j.poolAllocationPhi,totalPhi:+j.totalPhi.toFixed(6)},provenance:c},M={version:1,centrePixelSig:i,sealStamp:o,centreRgb:a,kairosStamp:x,provenance:c},N=new hC.default;N.file(`${E}.svg`,w),N.file(`${E}.png`,r),N.file(`${E}.json`,JSON.stringify(k,null,2)),N.file(`${E}_provenance.json`,JSON.stringify(M,null,2));let P=await N.generateAsync({type:`blob`}),F=document.createElement(`a`),I=URL.createObjectURL(P);F.href=I,F.download=`${E}.zip`,F.rel=`noopener`,document.body.appendChild(F),F.click(),F.remove(),setTimeout(()=>URL.revokeObjectURL(I),0),hp(g),m?.(k),v(!1),t()}catch(e){v(!1),g(`Failed to exhale Temple-Glyph. `+(e instanceof Error?e.message:String(e)))}},[A,j.poolAllocationPhi,j.totalDonorPhi,j.totalPhi,D,O.beatIndex,O.kaiPulseToday,O.stepIndex,p,b,S,T,d,u,f,m,t]);return e?(0,W.jsx)(`div`,{className:`modal-overlay`,role:`presentation`,children:(0,W.jsx)(`dialog`,{className:`send-sigil-modal`,open:!0,"aria-label":`Mint Composite ΦGlyph`,children:(0,W.jsxs)(`div`,{className:`modal-viewport`,children:[(0,W.jsxs)(`div`,{className:`modal-topbar`,children:[(0,W.jsx)(`h2`,{className:`modal-title`,children:`Exhale Temple-Glyph`}),(0,W.jsx)(`button`,{className:`close-btn`,onClick:t,"aria-label":`Close`,children:(0,W.jsx)(cd,{size:22})})]}),(0,W.jsx)(`div`,{"aria-hidden":!0,style:{position:`absolute`,width:0,height:0,overflow:`hidden`},children:(0,W.jsx)(ob,{ref:y,pulse:D,beat:O.beatIndex,stepPct:k,chakraDay:p,userPhiKey:u,kaiSignature:d,creatorPublicKey:f,origin:typeof window<`u`?window.location.origin:void 0,animate:!1,quality:`high`,showZKBadge:!1,onReady:({hash:e,url:t,metadataJson:n})=>{x(e),w(t),E(n)},onError:()=>{}})}),(0,W.jsxs)(`div`,{className:`modal-body`,children:[(0,W.jsx)(mC,{donors:n,balancePhi:r,balanceForMintPhi:i,setBalanceForMintPhi:a,addDonor:o,removeDonor:s,updateDonor:c,onMintComposite:e=>{e.preventDefault(),M()},minting:_,totalDonorAmount:l}),h&&(0,W.jsx)(`div`,{className:`error-msg`,role:`alert`,children:h})]}),(0,W.jsxs)(`div`,{className:`modal-footer`,children:[(0,W.jsxs)(`button`,{className:`send-btn`,onClick:()=>void M(),disabled:_,"aria-label":`Exhale Temple-Glyph`,title:`Exhale a Temple-Glyph at the current Eternal pulse`,children:[(0,W.jsx)(`span`,{className:`ico-exhale`,"aria-hidden":!0,children:`⟿`}),_?`Exhale...`:`Exhale Temple-Glyph`]}),(0,W.jsx)(`p`,{className:`small subtle status-line`,"aria-live":`polite`,children:b?`canonical: ${b.slice(0,10)}…`:`canonicalizing…`})]})]})})}):null}const TC=[`#37ffe4`,`#a78bfa`,`#5ce1ff`,`#11d7ff`],EC=(3+Math.sqrt(5))*1e3;BigInt(2**53-1);const DC=(()=>{if(typeof navigator>`u`)return!1;let e=navigator.userAgent||``;return/\bFBAN|FBAV|Instagram|Line|Twitter|TikTok|; wv\)|\bWebView\b/i.test(e)})(),OC=typeof window<`u`&&window.HTMLDialogElement!==void 0&&typeof window.HTMLDialogElement.prototype.showModal==`function`&&!DC;function kC(){let[e,t]=(0,C.useState)(!1);return(0,C.useEffect)(()=>t(!0),[]),e}function AC(e){let[t,n]=(0,C.useState)(()=>typeof window<`u`?window.matchMedia(e).matches:!1);return(0,C.useEffect)(()=>{if(typeof window>`u`)return;let t=window.matchMedia(e),r=e=>n(e.matches),i=function(e){r(e)};return typeof t.addEventListener==`function`?t.addEventListener(`change`,r):t.addListener?.(i),n(t.matches),()=>{typeof t.removeEventListener==`function`?t.removeEventListener(`change`,r):t.removeListener?.(i)}},[e]),t}function jC(e){(0,C.useEffect)(()=>{let t=typeof window<`u`?window.matchMedia(`(max-width: 560px)`).matches:!1;if(!e||t)return;let{scrollY:n}=window,r={top:document.body.style.top,pos:document.body.style.position,w:document.body.style.width,o:document.documentElement.style.overflow};return document.documentElement.style.overflow=`hidden`,document.body.style.position=`fixed`,document.body.style.top=`-${n}px`,document.body.style.width=`100%`,()=>{document.documentElement.style.overflow=r.o,document.body.style.position=r.pos,document.body.style.top=r.top,document.body.style.width=r.w,window.scrollTo(0,n)}},[e])}function MC(e,t){(0,C.useEffect)(()=>{if(!e)return;let n=t.current;if(!n)return;let r=`a[href], button:not([disabled]), textarea, input, select, summary, [tabindex]:not([tabindex="-1"])`,i=()=>{(n.querySelector(`.close-btn`)||n.querySelector(`.btn.primary`)||n.querySelector(r))?.focus()},a=e=>{if(e.key!==`Tab`)return;let t=Array.from(n.querySelectorAll(r)).filter(e=>e.offsetParent!==null||e===document.activeElement);if(!t.length)return;let i=t[0],a=t[t.length-1];e.shiftKey?document.activeElement===i&&(e.preventDefault(),a.focus()):document.activeElement===a&&(e.preventDefault(),i.focus())},o=document.activeElement;return i(),n.addEventListener(`keydown`,a),()=>{n.removeEventListener(`keydown`,a),o?.focus?.()}},[e,t])}function NC(e){return function(){let t=e+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}function PC(e){let t=e.length,n=0,r=0,i=0,a=0;for(let o=0;o>>0}function IC(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t{var{children:n,width:r,height:i,viewBox:a,className:o,style:s,title:c,desc:l}=e,u=YC(e,qC),d=a||{width:r,height:i,x:0,y:0},f=LC(`recharts-surface`,o);return C.createElement(`svg`,JC({},GC(u),{className:f,width:r,height:i,style:s,viewBox:`${d.x} ${d.y} ${d.width} ${d.height}`,ref:t}),C.createElement(`title`,null,c),C.createElement(`desc`,null,l),n)}),QC=[`children`,`className`];function $C(){return $C=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:n,className:r}=e,i=ew(e,QC),a=LC(`recharts-layer`,r);return C.createElement(`g`,$C({className:a},GC(i),{ref:t}),n)}),rw=(0,C.createContext)(null);function iw(e){return function(){return e}}const aw=Math.cos,ow=Math.sin,sw=Math.sqrt,cw=Math.PI;cw/2;const lw=2*cw;var uw=Math.PI,dw=2*uw,fw=1e-6,pw=dw-fw;function mw(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return mw;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;tfw)if(!(Math.abs(u*s-c*l)>fw)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((uw-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>fw&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>fw||Math.abs(this._y1-l)>fw)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%dw+dw),d>pw?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>fw&&this._append`A${n},${n},0,${+(d>=uw)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};function _w(){return new gw}_w.prototype=gw.prototype;function vw(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new gw(t)}Array.prototype.slice;function yw(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function bw(e){this._context=e}bw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function xw(e){return new bw(e)}function Sw(e){return e[0]}function Cw(e){return e[1]}function ww(e,t){var n=iw(!0),r=null,i=xw,a=null,o=vw(s);e=typeof e==`function`?e:e===void 0?Sw:iw(e),t=typeof t==`function`?t:t===void 0?Cw:iw(t);function s(s){var c,l=(s=yw(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return ww().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:iw(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:iw(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:iw(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:iw(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:iw(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:iw(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:iw(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var Ew=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t);break}this._x0=e,this._y0=t}};function Dw(e){return new Ew(e,!0)}function Ow(e){return new Ew(e,!1)}var kw={draw(e,t){let n=sw(t/cw);e.moveTo(n,0),e.arc(0,0,n,0,lw)}},Aw={draw(e,t){let n=sw(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},jw=sw(1/3),Mw=jw*2,Nw={draw(e,t){let n=sw(t/Mw),r=n*jw;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},Pw={draw(e,t){let n=sw(t),r=-n/2;e.rect(r,r,n,n)}},Fw=.8908130915292852,Iw=ow(cw/10)/ow(7*cw/10),Lw=ow(lw/10)*Iw,Rw=-aw(lw/10)*Iw,zw={draw(e,t){let n=sw(t*Fw),r=Lw*n,i=Rw*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=lw*t/5,o=aw(a),s=ow(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},Bw=sw(3),Vw={draw(e,t){let n=-sw(t/(Bw*3));e.moveTo(0,n*2),e.lineTo(-Bw*n,-n),e.lineTo(Bw*n,-n),e.closePath()}},Hw=-.5,Uw=sw(3)/2,Ww=1/sw(12),Gw=(Ww/2+1)*3,Kw={draw(e,t){let n=sw(t/Gw),r=n/2,i=n*Ww,a=r,o=n*Ww+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(Hw*r-Uw*i,Uw*r+Hw*i),e.lineTo(Hw*a-Uw*o,Uw*a+Hw*o),e.lineTo(Hw*s-Uw*c,Uw*s+Hw*c),e.lineTo(Hw*r+Uw*i,Hw*i-Uw*r),e.lineTo(Hw*a+Uw*o,Hw*o-Uw*a),e.lineTo(Hw*s+Uw*c,Hw*c-Uw*s),e.closePath()}};function qw(e,t){let n=null,r=vw(i);e=typeof e==`function`?e:iw(e||kw),t=typeof t==`function`?t:iw(t===void 0?64:+t);function i(){let i;if(n||=i=r(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+``||null}return i.type=function(t){return arguments.length?(e=typeof t==`function`?t:iw(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:iw(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}function Jw(){}function Yw(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Xw(e){this._context=e}Xw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Yw(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Yw(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Zw(e){return new Xw(e)}function Qw(e){this._context=e}Qw.prototype={areaStart:Jw,areaEnd:Jw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Yw(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function $w(e){return new Qw(e)}function eT(e){this._context=e}eT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Yw(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function tT(e){return new eT(e)}function nT(e){this._context=e}nT.prototype={areaStart:Jw,areaEnd:Jw,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function rT(e){return new nT(e)}function iT(e){return e<0?-1:1}function aT(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(iT(a)+iT(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function oT(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function sT(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function cT(e){this._context=e}cT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:sT(this,this._t0,oT(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,sT(this,oT(this,n=aT(this,e,t)),n);break;default:sT(this,this._t0,n=aT(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function lT(e){this._context=new uT(e)}(lT.prototype=Object.create(cT.prototype)).point=function(e,t){cT.prototype.point.call(this,t,e)};function uT(e){this._context=e}uT.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function dT(e){return new cT(e)}function fT(e){return new lT(e)}function pT(e){this._context=e}pT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=mT(e),i=mT(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}this._x=e,this._y=t}};function _T(e){return new gT(e,.5)}function vT(e){return new gT(e,0)}function yT(e){return new gT(e,1)}function bT(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n=0;)n[t]=t;return n}function ST(e,t){return e[t]}function CT(e){let t=[];return t.key=e,t}function wT(){var e=iw([]),t=xT,n=bT,r=ST;function i(i){var a=Array.from(e.apply(this,arguments),CT),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o0){for(var n,r,i=0,a=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,a=r.length;n0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return e===`__proto__`}e.isUnsafeProperty=t})),kT=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e.includes(`.`)||e.includes(`[`)||e.includes(`]`)}}e.isDeepKey=t})),AT=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}e.toKey=t})),jT=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){if(e==null)return``;if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(t).join(`,`);let n=String(e);return n===`0`&&Object.is(Number(e),-0)?`-0`:n}e.toString=t})),MT=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=jT(),n=AT();function r(e){if(Array.isArray(e))return e.map(n.toKey);if(typeof e==`symbol`)return[e];e=t.toString(e);let r=[],i=e.length;if(i===0)return r;let a=0,o=``,s=``,c=!1;for(e.charCodeAt(0)===46&&(r.push(``),a++);a{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=OT(),n=kT(),r=AT(),i=MT();function a(e,s,c){if(e==null)return c;switch(typeof s){case`string`:{if(t.isUnsafeProperty(s))return c;let r=e[s];return r===void 0?n.isDeepKey(s)?a(e,i.toPath(s),c):c:r}case`number`:case`symbol`:{typeof s==`number`&&(s=r.toKey(s));let t=e[s];return t===void 0?c:t}default:{if(Array.isArray(s))return o(e,s,c);if(s=Object.is(s?.valueOf(),-0)?`-0`:String(s),t.isUnsafeProperty(s))return c;let n=e[s];return n===void 0?c:n}}}function o(e,n,r){if(n.length===0)return r;let i=e;for(let e=0;e{t.exports=NT().get})),FT=4;function IT(e){var t=10**(arguments.length>1&&arguments[1]!==void 0?arguments[1]:FT),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function LT(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+IT(i)+n},``)}var RT=u(PT()),zT=e=>e===0?0:e>0?1:-1,BT=e=>typeof e==`number`&&e!=+e,VT=e=>typeof e==`string`&&e.indexOf(`%`)===e.length-1,X=e=>(typeof e==`number`||e instanceof Number)&&!BT(e),HT=e=>X(e)||typeof e==`string`,UT=0,WT=e=>{var t=++UT;return`${e||``}${t}`},GT=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!X(e)&&typeof e!=`string`)return n;var i;if(VT(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return BT(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},KT=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;re&&(typeof t==`function`?t(e):(0,RT.default)(e,t))===n)}var YT=e=>e==null,XT=e=>YT(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function ZT(e){return e!=null}function QT(){}var $T=[`type`,`size`,`sizeType`];function eE(){return eE=Object.assign?Object.assign.bind():function(e){for(var t=1;tcE[`symbol${XT(e)}`]||kw,dE=(e,t,n)=>{if(t===`area`)return e;switch(n){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var r=18*lE;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2);case`triangle`:return Math.sqrt(3)*e*e/4;case`wye`:return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},fE=(e,t)=>{cE[`symbol${XT(e)}`]=t},pE=e=>{var{type:t=`circle`,size:n=64,sizeType:r=`area`}=e,i=nE(nE({},oE(e,$T)),{},{type:t,size:n,sizeType:r}),a=`circle`;typeof t==`string`&&(a=t);var o=()=>{var e=uE(a),t=qw().type(e).size(dE(n,r,a))();if(t!==null)return t},{className:s,cx:c,cy:l}=i,u=GC(i);return X(c)&&X(l)&&X(n)?C.createElement(`path`,eE({},u,{className:LC(`recharts-symbols`,s),transform:`translate(${c}, ${l})`,d:o()})):null};pE.registerSymbol=fE;var mE=e=>`radius`in e&&`startAngle`in e&&`endAngle`in e,hE=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,C.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{zC(e)&&(r[e]=t||(t=>n[e](n,t)))}),r},gE=(e,t,n)=>r=>(e(t,n,r),null),_E=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];zC(i)&&typeof a==`function`&&(r||={},r[i]=gE(a,t,n))}),r};function vE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function yE(e){for(var t=1;t(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}var wE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e,t){let n=new Map;for(let r=0;r{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return e}e.identity=t})),EE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return Number.isSafeInteger(e)&&e>=0}e.isLength=t})),DE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=EE();function n(e){return e!=null&&typeof e!=`function`&&t.isLength(e.length)}e.isArrayLike=n})),OE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return typeof e==`object`&&!!e}e.isObjectLike=t})),kE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=DE(),n=OE();function r(e){return n.isObjectLike(e)&&t.isArrayLike(e)}e.isArrayLikeObject=r})),AE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=NT();function n(e){return function(n){return t.get(n,e)}}e.property=n})),jE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}e.isObject=t})),ME=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return e==null||typeof e!=`object`&&typeof e!=`function`}e.isPrimitive=t})),NE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}e.eq=t})),PE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=jE(),n=ME(),r=NE();function i(e,t,n){return typeof n==`function`?a(e,t,function e(t,r,i,o,s,c){let l=n(t,r,i,o,s,c);return l===void 0?a(t,r,e,c):!!l},new Map):i(e,t,()=>void 0)}function a(e,n,i,s){if(n===e)return!0;switch(typeof n){case`object`:return o(e,n,i,s);case`function`:return Object.keys(n).length>0?a(e,{...n},i,s):r.eq(e,n);default:return t.isObject(e)?typeof n==`string`?n===``:!0:r.eq(e,n)}}function o(e,t,r,i){if(t==null)return!0;if(Array.isArray(t))return c(e,t,r,i);if(t instanceof Map)return s(e,t,r,i);if(t instanceof Set)return l(e,t,r,i);let a=Object.keys(t);if(e==null||n.isPrimitive(e))return a.length===0;if(a.length===0)return!0;if(i?.has(t))return i.get(t)===e;i?.set(t,e);try{for(let o=0;o{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=PE();function n(e,n){return t.isMatchWith(e,n,()=>void 0)}e.isMatch=n})),IE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}e.getSymbols=t})),LE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}e.getTag=t})),RE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`}),e.argumentsTag=`[object Arguments]`,e.arrayBufferTag=`[object ArrayBuffer]`,e.arrayTag=`[object Array]`,e.bigInt64ArrayTag=`[object BigInt64Array]`,e.bigUint64ArrayTag=`[object BigUint64Array]`,e.booleanTag=`[object Boolean]`,e.dataViewTag=`[object DataView]`,e.dateTag=`[object Date]`,e.errorTag=`[object Error]`,e.float32ArrayTag=`[object Float32Array]`,e.float64ArrayTag=`[object Float64Array]`,e.functionTag=`[object Function]`,e.int16ArrayTag=`[object Int16Array]`,e.int32ArrayTag=`[object Int32Array]`,e.int8ArrayTag=`[object Int8Array]`,e.mapTag=`[object Map]`,e.numberTag=`[object Number]`,e.objectTag=`[object Object]`,e.regexpTag=`[object RegExp]`,e.setTag=`[object Set]`,e.stringTag=`[object String]`,e.symbolTag=`[object Symbol]`,e.uint16ArrayTag=`[object Uint16Array]`,e.uint32ArrayTag=`[object Uint32Array]`,e.uint8ArrayTag=`[object Uint8Array]`,e.uint8ClampedArrayTag=`[object Uint8ClampedArray]`})),zE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}e.isTypedArray=t})),BE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=IE(),n=LE(),r=RE(),i=ME(),a=zE();function o(e,t){return s(e,void 0,e,new Map,t)}function s(e,t,n,r=new Map,o=void 0){let u=o?.(e,t,n,r);if(u!==void 0)return u;if(i.isPrimitive(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){let t=Array(e.length);r.set(e,t);for(let i=0;i{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=BE();function n(e){return t.cloneDeepWithImpl(e,void 0,e,new Map,void 0)}e.cloneDeep=n})),HE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=FE(),n=VE();function r(e){return e=n.cloneDeep(e),n=>t.isMatch(n,e)}e.matches=r})),UE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=BE(),n=RE();function r(e,r){return t.cloneDeepWith(e,(i,a,o,s)=>{let c=r?.(i,a,o,s);if(c!==void 0)return c;if(typeof e==`object`)switch(Object.prototype.toString.call(e)){case n.numberTag:case n.stringTag:case n.booleanTag:{let n=new e.constructor(e?.valueOf());return t.copyProperties(n,e),n}case n.argumentsTag:{let n={};return t.copyProperties(n,e),n.length=e.length,n[Symbol.iterator]=e[Symbol.iterator],n}default:return}})}e.cloneDeepWith=r})),WE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=UE();function n(e){return t.cloneDeepWith(e)}e.cloneDeep=n})),GE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=/^(?:0|[1-9]\d*)$/;function n(e,n=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=LE();function n(e){return typeof e==`object`&&!!e&&t.getTag(e)===`[object Arguments]`}e.isArguments=n})),qE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=kT(),n=GE(),r=KE(),i=MT();function a(e,a){let o;if(o=Array.isArray(a)?a:typeof a==`string`&&t.isDeepKey(a)&&e?.[a]==null?i.toPath(a):[a],o.length===0)return!1;let s=e;for(let e=0;e{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=FE(),n=AT(),r=WE(),i=NT(),a=qE();function o(e,o){switch(typeof e){case`object`:Object.is(e?.valueOf(),-0)&&(e=`-0`);break;case`number`:e=n.toKey(e);break}return o=r.cloneDeep(o),function(n){let r=i.get(n,e);return r===void 0?a.has(n,e):o===void 0?r===void 0:t.isMatch(r,o)}}e.matchesProperty=o})),YE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=TE(),n=AE(),r=HE(),i=JE();function a(e){if(e==null)return t.identity;switch(typeof e){case`function`:return e;case`object`:return Array.isArray(e)&&e.length===2?i.matchesProperty(e[0],e[1]):r.matches(e);case`string`:case`symbol`:case`number`:return n.property(e)}}e.iteratee=a})),XE=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=wE(),n=TE(),r=kE(),i=YE();function a(e,a=n.identity){return r.isArrayLikeObject(e)?t.uniqBy(Array.from(e),i.iteratee(a)):[]}e.uniqBy=a})),ZE=u(s(((e,t)=>{t.exports=XE().uniqBy}))());function QE(e,t,n){return t===!0?(0,ZE.default)(e,n):typeof t==`function`?(0,ZE.default)(e,t):e}var $E=s((e=>{var t=h();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),eD=s(((e,t)=>{t.exports=$E()})),tD=s((e=>{var t=h(),n=eD();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),nD=s(((e,t)=>{t.exports=tD()})),rD=(0,C.createContext)(null),iD=u(nD()),aD=e=>e,oD=()=>{var e=(0,C.useContext)(rD);return e?e.store.dispatch:aD},sD=()=>{},cD=()=>sD,lD=(e,t)=>e===t;function Z(e){var t=(0,C.useContext)(rD);return(0,iD.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:cD,t?t.store.getState:sD,t?t.store.getState:sD,t?e:sD,lD)}function uD(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function dD(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!=`object`)throw TypeError(t)}function fD(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var pD=e=>Array.isArray(e)?e:[e];function mD(e){let t=Array.isArray(e[0])?e[0]:e;return fD(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function hD(e,t){let n=[],{length:r}=e;for(let i=0;i{n=bD(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function SD(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),uD(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=xD,argsMemoizeOptions:u=[],devModeChecks:d={}}={...n,...a},f=pD(c),p=pD(u),m=mD(e),h=s(function(){return t++,o.apply(null,arguments)},...f),g=l(function(){r++;let e=hD(m,arguments);return i=h.apply(null,e),i},...p);return Object.assign(g,{resultFunc:o,memoizedResultFunc:h,dependencies:m,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var Q=SD(xD),CD=Object.assign((e,t=Q)=>{dD(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>CD}),wD=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return typeof e==`symbol`?1:e===null?2:e===void 0?3:e===e?0:4}e.compareValues=(e,n,r)=>{if(e!==n){let i=t(e),a=t(n);if(i===a&&i===0){if(en)return r===`desc`?-1:1}return r===`desc`?a-i:i-a}return 0}})),TD=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return typeof e==`symbol`||e instanceof Symbol}e.isSymbol=t})),ED=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=TD(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(e,i){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||t.isSymbol(e)?!0:typeof e==`string`&&(r.test(e)||!n.test(e))||i!=null&&Object.hasOwn(i,e)}e.isKey=i})),DD=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=wD(),n=ED(),r=MT();function i(e,i,a,o){if(e==null)return[];a=o?void 0:a,Array.isArray(e)||(e=Object.values(e)),Array.isArray(i)||(i=i==null?[null]:[i]),i.length===0&&(i=[null]),Array.isArray(a)||(a=a==null?[]:[a]),a=a.map(e=>String(e));let s=(e,t)=>{let n=e;for(let e=0;et==null||e==null?t:typeof e==`object`&&`key`in e?Object.hasOwn(t,e.key)?t[e.key]:s(t,e.path):typeof e==`function`?e(t):Array.isArray(e)?s(t,e):typeof t==`object`?t[e]:t,l=i.map(e=>(Array.isArray(e)&&e.length===1&&(e=e[0]),e==null||typeof e==`function`||Array.isArray(e)||n.isKey(e)?e:{key:e,path:r.toPath(e)}));return e.map(e=>({original:e,criteria:l.map(t=>c(t,e))})).slice().sort((e,n)=>{for(let r=0;re.original)}e.orderBy=i})),OD=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=GE(),n=DE(),r=jE(),i=NE();function a(e,a,o){return r.isObject(o)&&(typeof a==`number`&&n.isArrayLike(o)&&t.isIndex(a)&&a{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=DD(),n=OD(),r=kD();function i(e,...i){let a=i.length;return a>1&&r.isIterateeCall(e,i[0],i[1])?i=[]:a>2&&r.isIterateeCall(i[0],i[1],i[2])&&(i=[i[0]]),t.orderBy(e,n.flatten(i),[`asc`])}e.sortBy=i})),jD=s(((e,t)=>{t.exports=AD().sortBy})),MD=u(jD()),ND=e=>e.legend.settings,PD=e=>e.legend.size;Q([e=>e.legend.payload,ND],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?(0,MD.default)(r,n):r});var FD=1;function ID(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,n]=(0,C.useState)({height:0,left:0,top:0,width:0});return[t,(0,C.useCallback)(e=>{if(e!=null){var r=e.getBoundingClientRect(),i={height:r.height,left:r.left,top:r.top,width:r.width};(Math.abs(i.height-t.height)>FD||Math.abs(i.left-t.left)>FD||Math.abs(i.top-t.top)>FD||Math.abs(i.width-t.width)>FD)&&n({height:i.height,left:i.left,top:i.top,width:i.width})}},[t.width,t.height,t.top,t.left,...e])]}function LD(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var RD=(()=>typeof Symbol==`function`&&Symbol.observable||`@@observable`)(),zD=()=>Math.random().toString(36).substring(7).split(``).join(`.`),BD={INIT:`@@redux/INIT${zD()}`,REPLACE:`@@redux/REPLACE${zD()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${zD()}`};function VD(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function HD(e,t,n){if(typeof e!=`function`)throw Error(LD(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(LD(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(LD(1));return n(HD)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error(LD(3));return i}function d(e){if(typeof e!=`function`)throw Error(LD(4));if(c)throw Error(LD(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(LD(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!VD(e))throw Error(LD(7));if(e.type===void 0)throw Error(LD(8));if(typeof e.type!=`string`)throw Error(LD(17));if(c)throw Error(LD(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error(LD(10));r=e,f({type:BD.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(LD(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[RD](){return this}}}return f({type:BD.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[RD]:m}}function UD(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:BD.INIT})===void 0)throw Error(LD(12));if(n(void 0,{type:BD.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(LD(13))})}function WD(e){let t=Object.keys(e),n={};for(let r=0;re:e.length===1?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function KD(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(LD(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=GD(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}function qD(e){return VD(e)&&`type`in e&&typeof e.type==`string`}var JD=Symbol.for(`immer-nothing`),YD=Symbol.for(`immer-draftable`),XD=Symbol.for(`immer-state`);function ZD(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var QD=Object,$D=QD.getPrototypeOf,eO=`constructor`,tO=`prototype`,nO=`configurable`,rO=`enumerable`,iO=`writable`,aO=`value`,oO=e=>!!e&&!!e[XD];function sO(e){return e?uO(e)||_O(e)||!!e[YD]||!!e[eO]?.[YD]||vO(e)||yO(e):!1}var cO=QD[tO][eO].toString(),lO=new WeakMap;function uO(e){if(!e||!bO(e))return!1;let t=$D(e);if(t===null||t===QD[tO])return!0;let n=QD.hasOwnProperty.call(t,eO)&&t[eO];if(n===Object)return!0;if(!xO(n))return!1;let r=lO.get(n);return r===void 0&&(r=Function.toString.call(n),lO.set(n,r)),r===cO}function dO(e,t,n=!0){fO(e)===0?(n?Reflect.ownKeys(e):QD.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function fO(e){let t=e[XD];return t?t.type_:_O(e)?1:vO(e)?2:yO(e)?3:0}var pO=(e,t,n=fO(e))=>n===2?e.has(t):QD[tO].hasOwnProperty.call(e,t),mO=(e,t,n=fO(e))=>n===2?e.get(t):e[t],hO=(e,t,n,r=fO(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function gO(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var _O=Array.isArray,vO=e=>e instanceof Map,yO=e=>e instanceof Set,bO=e=>typeof e==`object`,xO=e=>typeof e==`function`,SO=e=>typeof e==`boolean`;function CO(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var wO=e=>e.copy_||e.base_,TO=e=>e.modified_?e.copy_:e.base_;function EO(e,t){if(vO(e))return new Map(e);if(yO(e))return new Set(e);if(_O(e))return Array[tO].slice.call(e);let n=uO(e);if(t===!0||t===`class_only`&&!n){let t=QD.getOwnPropertyDescriptors(e);delete t[XD];let n=Reflect.ownKeys(t);for(let r=0;r1&&QD.defineProperties(e,{set:kO,add:kO,clear:kO,delete:kO}),QD.freeze(e),t&&dO(e,(e,t)=>{DO(t,!0)},!1),e)}function OO(){ZD(2)}var kO={[aO]:OO};function AO(e){return e===null||!bO(e)?!0:QD.isFrozen(e)}var jO=`MapSet`,MO=`Patches`,NO=`ArrayMethods`,PO={};function FO(e){let t=PO[e];return t||ZD(0,e),t}var IO=e=>!!PO[e],LO,RO=()=>LO,zO=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:IO(jO)?FO(jO):void 0,arrayMethodsPlugin_:IO(NO)?FO(NO):void 0});function BO(e,t){t&&(e.patchPlugin_=FO(MO),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function VO(e){HO(e),e.drafts_.forEach(WO),e.drafts_=null}function HO(e){e===LO&&(LO=e.parent_)}var UO=e=>LO=zO(LO,e);function WO(e){let t=e[XD];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function GO(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[XD].modified_&&(VO(t),ZD(4)),sO(e)&&(e=KO(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[XD].base_,e,t)}else e=KO(t,n);return qO(t,e,!0),VO(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===JD?void 0:e}function KO(e,t){if(AO(t))return t;let n=t[XD];if(!n)return tk(t,e.handledSet_,e);if(!YO(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);$O(n,e)}return n.copy_}function qO(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&DO(t,n)}function JO(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var YO=(e,t)=>e.scope_===t,XO=[];function ZO(e,t,n,r){let i=wO(e),a=e.type_;if(r!==void 0&&mO(i,r,a)===t){hO(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;dO(i,(e,n)=>{if(oO(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??XO;for(let e of o)hO(i,e,n,a)}function QO(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!YO(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=TO(i);ZO(e,i.draft_??i,a,n),$O(i,r)})}function $O(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}JO(e)}}function ek(e,t,n){let{scope_:r}=e;if(oO(n)){let i=n[XD];YO(i,r)&&i.callbacks_.push(function(){lk(e),ZO(e,n,TO(i),t)})}else sO(n)&&e.callbacks_.push(function(){mO(wO(e),t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&tk(mO(e.copy_,t,e.type_),r.handledSet_,r)})}function tk(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||oO(e)||t.has(e)||!sO(e)||AO(e)?e:(t.add(e),dO(e,(r,i)=>{if(oO(i)){let t=i[XD];YO(t,n)&&(hO(e,r,TO(t),e.type_),JO(t))}else sO(i)&&tk(i,t,n)}),e)}function nk(e,t){let n=_O(e),r={type_:n?1:0,scope_:t?t.scope_:RO(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=rk;n&&(i=[r],a=ik);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var rk={get(e,t){if(t===XD)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=wO(e);if(!pO(i,t,e.type_))return ok(e,i,t);let a=i[t];if(e.finalized_||!sO(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&CO(t))return a;if(a===ak(e.base_,t)){lk(e);let n=e.type_===1?+t:t,r=dk(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in wO(e)},ownKeys(e){return Reflect.ownKeys(wO(e))},set(e,t,n){let r=sk(wO(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=ak(wO(e),t),i=r?.[XD];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(gO(n,r)&&(n!==void 0||pO(e.base_,t,e.type_)))return!0;lk(e),ck(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_.set(t,!0),ek(e,t,n),!0)},deleteProperty(e,t){return lk(e),ak(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),ck(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=wO(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[iO]:!0,[nO]:e.type_!==1||t!==`length`,[rO]:r[rO],[aO]:n[t]}},defineProperty(){ZD(11)},getPrototypeOf(e){return $D(e.base_)},setPrototypeOf(){ZD(12)}},ik={};dO(rk,(e,t)=>{ik[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}),ik.deleteProperty=function(e,t){return ik.set.call(this,e,t,void 0)},ik.set=function(e,t,n){return rk.set.call(this,e[0],t,n,e[0])};function ak(e,t){let n=e[XD];return(n?wO(n):e)[t]}function ok(e,t,n){let r=sk(t,n);return r?aO in r?r[aO]:r.get?.call(e.draft_):void 0}function sk(e,t){if(!(t in e))return;let n=$D(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=$D(n)}}function ck(e){e.modified_||(e.modified_=!0,e.parent_&&ck(e.parent_))}function lk(e){e.copy_||=(e.assigned_=new Map,EO(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var uk=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(xO(e)&&!xO(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}xO(t)||ZD(6),n!==void 0&&!xO(n)&&ZD(7);let r;if(sO(e)){let i=UO(this),a=dk(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?VO(i):HO(i)}return BO(i,n),GO(r,i)}else if(!e||!bO(e)){if(r=t(e),r===void 0&&(r=e),r===JD&&(r=void 0),this.autoFreeze_&&DO(r,!0),n){let t=[],i=[];FO(MO).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}else ZD(1,e)},this.produceWithPatches=(e,t)=>{if(xO(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},SO(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),SO(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),SO(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){sO(e)||ZD(8),oO(e)&&(e=fk(e));let t=UO(this),n=dk(t,e,void 0);return n[XD].isManual_=!0,HO(t),n}finishDraft(e,t){let n=e&&e[XD];(!n||!n.isManual_)&&ZD(9);let{scope_:r}=n;return BO(r,t),GO(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=FO(MO).applyPatches_;return oO(e)?r(e,t):this.produce(e,e=>r(e,t))}};function dk(e,t,n,r){let[i,a]=vO(t)?FO(jO).proxyMap_(t,n):yO(t)?FO(jO).proxySet_(t,n):nk(t,n);return(n?.scope_??RO()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?QO(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function fk(e){return oO(e)||ZD(10,e),pk(e)}function pk(e){if(!sO(e)||AO(e))return e;let t=e[XD],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=EO(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=EO(e,!0);return dO(n,(e,t)=>{hO(n,e,pk(t))},r),t&&(t.finalized_=!1),n}var mk=new uk().produce;function hk(e){return({dispatch:t,getState:n})=>r=>i=>typeof i==`function`?i(t,n,e):r(i)}var gk=hk(),_k=hk,vk=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]==`object`?GD:GD.apply(null,arguments)};typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;function yk(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw Error(DA(0));return{type:e,payload:r.payload,...`meta`in r&&{meta:r.meta},...`error`in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>qD(t)&&t.type===e,n}var bk=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function xk(e){return sO(e)?mk(e,()=>{}):e}function Sk(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function Ck(e){return typeof e==`boolean`}var wk=()=>function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new bk;return t&&(Ck(t)?a.push(gk):a.push(_k(t.extraArgument))),a},Tk=`RTK_autoBatch`,Ek=()=>e=>({payload:e,meta:{[Tk]:!0}}),Dk=e=>t=>{setTimeout(t,e)},Ok=(e={type:`raf`})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,c=e.type===`tick`?queueMicrotask:e.type===`raf`?typeof window<`u`&&window.requestAnimationFrame?window.requestAnimationFrame:Dk(10):e.type===`callback`?e.queueNotification:Dk(e.timeout),l=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.[Tk],a=!i,a&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})},kk=e=>function(t){let{autoBatch:n=!0}=t??{},r=new bk(e);return n&&r.push(Ok(typeof n==`object`?n:void 0)),r};function Ak(e){let t=wk(),{reducer:n=void 0,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:a=!0,preloadedState:o=void 0,enhancers:s=void 0}=e||{},c;if(typeof n==`function`)c=n;else if(VD(n))c=WD(n);else throw Error(DA(1));let l;l=typeof r==`function`?r(t):t();let u=GD;i&&(u=vk({trace:!1,...typeof i==`object`&&i}));let d=kk(KD(...l)),f=typeof s==`function`?s(d):d(),p=u(...f);return HD(c,o,p)}function jk(e){let t={},n=[],r,i={addCase(e,n){let r=typeof e==`string`?e:e.type;if(!r)throw Error(DA(28));if(r in t)throw Error(DA(29));return t[r]=n,i},addAsyncThunk(e,r){return r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i},addMatcher(e,t){return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){return r=e,i}};return e(i),[t,n,r]}function Mk(e){return typeof e==`function`}function Nk(e,t){let[n,r,i]=jk(t),a;if(Mk(e))a=()=>xk(e());else{let t=xk(e);a=()=>t}function o(e=a(),t){let o=[n[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return o.filter(e=>!!e).length===0&&(o=[i]),o.reduce((e,n)=>{if(n)if(oO(e)){let r=n(e,t);return r===void 0?e:r}else if(sO(e))return mk(e,e=>n(e,t));else{let r=n(e,t);if(r===void 0){if(e===null)return e;throw Error(`A case reducer on a non-draftable value must not return undefined`)}return r}return e},e)}return o.getInitialState=a,o}var Pk=`ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW`,Fk=(e=21)=>{let t=``,n=e;for(;n--;)t+=Pk[Math.random()*64|0];return t},Ik=Symbol.for(`rtk-slice-createasyncthunk`);function Lk(e,t){return`${e}/${t}`}function Rk({creators:e}={}){let t=e?.asyncThunk?.[Ik];return function(e){let{name:n,reducerPath:r=n}=e;if(!n)throw Error(DA(11));let i=(typeof e.reducers==`function`?e.reducers(Vk()):e.reducers)||{},a=Object.keys(i),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},s={addCase(e,t){let n=typeof e==`string`?e:e.type;if(!n)throw Error(DA(12));if(n in o.sliceCaseReducersByType)throw Error(DA(13));return o.sliceCaseReducersByType[n]=t,s},addMatcher(e,t){return o.sliceMatchers.push({matcher:e,reducer:t}),s},exposeAction(e,t){return o.actionCreators[e]=t,s},exposeCaseReducer(e,t){return o.sliceCaseReducersByName[e]=t,s}};a.forEach(r=>{let a=i[r],o={reducerName:r,type:Lk(n,r),createNotation:typeof e.reducers==`function`};Uk(a)?Gk(o,a,s,t):Hk(o,a,s)});function c(){let[t={},n=[],r=void 0]=typeof e.extraReducers==`function`?jk(e.extraReducers):[e.extraReducers],i={...t,...o.sliceCaseReducersByType};return Nk(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of o.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}let l=e=>e,u=new Map,d=new WeakMap,f;function p(e,t){return f||=c(),f(e,t)}function m(){return f||=c(),f.getInitialState()}function h(t,n=!1){function r(e){let i=e[t];return i===void 0&&n&&(i=Sk(d,r,m)),i}function i(t=l){return Sk(Sk(u,n,()=>new WeakMap),t,()=>{let r={};for(let[i,a]of Object.entries(e.selectors??{}))r[i]=zk(a,t,()=>Sk(d,t,m),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}let g={name:n,reducer:p,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:m,...h(r),injectInto(e,{reducerPath:t,...n}={}){let i=t??r;return e.inject({reducerPath:i,reducer:p},n),{...g,...h(i,!0)}}};return g}}function zk(e,t,n,r){function i(i,...a){let o=t(i);return o===void 0&&r&&(o=n()),e(o,...a)}return i.unwrapped=e,i}var Bk=Rk();function Vk(){function e(e,t){return{_reducerDefinitionType:`asyncThunk`,payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer(e){return Object.assign({[e.name](...t){return e(...t)}}[e.name],{_reducerDefinitionType:`reducer`})},preparedReducer(e,t){return{_reducerDefinitionType:`reducerWithPrepare`,prepare:e,reducer:t}},asyncThunk:e}}function Hk({type:e,reducerName:t,createNotation:n},r,i){let a,o;if(`reducer`in r){if(n&&!Wk(r))throw Error(DA(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?yk(e,o):yk(e))}function Uk(e){return e._reducerDefinitionType===`asyncThunk`}function Wk(e){return e._reducerDefinitionType===`reducerWithPrepare`}function Gk({type:e,reducerName:t},n,r,i){if(!i)throw Error(DA(18));let{payloadCreator:a,fulfilled:o,pending:s,rejected:c,settled:l,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:o||Kk,pending:s||Kk,rejected:c||Kk,settled:l||Kk})}function Kk(){}var qk=`task`,Jk=`listener`,Yk=`completed`,Xk=`cancelled`,Zk=`task-${Xk}`,Qk=`task-${Yk}`,$k=`${Jk}-${Xk}`,eA=`${Jk}-${Yk}`,tA=class{constructor(e){this.code=e,this.message=`${qk} ${Xk} (reason: ${e})`}name=`TaskAbortError`;message},nA=(e,t)=>{if(typeof e!=`function`)throw TypeError(DA(32))},rA=()=>{},iA=(e,t=rA)=>(e.catch(t),e),aA=(e,t)=>(e.addEventListener(`abort`,t,{once:!0}),()=>e.removeEventListener(`abort`,t)),oA=e=>{if(e.aborted)throw new tA(e.reason)};function sA(e,t){let n=rA;return new Promise((r,i)=>{let a=()=>i(new tA(e.reason));if(e.aborted){a();return}n=aA(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=rA})}var cA=async(e,t)=>{try{return await Promise.resolve(),{status:`ok`,value:await e()}}catch(e){return{status:e instanceof tA?`cancelled`:`rejected`,error:e}}finally{t?.()}},lA=e=>t=>iA(sA(e,t).then(t=>(oA(e),t))),uA=e=>{let t=lA(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:dA}=Object,fA={},pA=`listenerMiddleware`,mA=(e,t)=>{let n=t=>aA(e,()=>t.abort(e.reason));return(r,i)=>{nA(r,`taskExecutor`);let a=new AbortController;n(a);let o=cA(async()=>{oA(e),oA(a.signal);let t=await r({pause:lA(a.signal),delay:uA(a.signal),signal:a.signal});return oA(a.signal),t},()=>a.abort(Qk));return i?.autoJoin&&t.push(o.catch(rA)),{result:lA(e)(o),cancel(){a.abort(Zk)}}}},hA=(e,t)=>{let n=async(n,r)=>{oA(t);let i=()=>{},a=[new Promise((t,r)=>{let a=e({predicate:n,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});i=()=>{a(),r()}})];r!=null&&a.push(new Promise(e=>setTimeout(e,r,null)));try{let e=await sA(t,Promise.race(a));return oA(t),e}finally{i()}};return(e,t)=>iA(n(e,t))},gA=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=yk(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw Error(DA(21));return nA(a,`options.listener`),{predicate:i,type:t,effect:a}},_A=dA(e=>{let{type:t,predicate:n,effect:r}=gA(e);return{id:Fk(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw Error(DA(22))}}},{withTypes:()=>_A}),vA=(e,t)=>{let{type:n,effect:r,predicate:i}=gA(t);return Array.from(e.values()).find(e=>(typeof n==`string`?e.type===n:e.predicate===i)&&e.effect===r)},yA=e=>{e.pending.forEach(e=>{e.abort($k)})},bA=(e,t)=>()=>{for(let e of t.keys())yA(e);e.clear()},xA=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},SA=dA(yk(`${pA}/add`),{withTypes:()=>SA}),CA=yk(`${pA}/removeAll`),wA=dA(yk(`${pA}/remove`),{withTypes:()=>wA}),TA=(...e)=>{console.error(`${pA}/error`,...e)},EA=(e={})=>{let t=new Map,n=new Map,r=e=>{let t=n.get(e)??0;n.set(e,t+1)},i=e=>{let t=n.get(e)??1;t===1?n.delete(e):n.set(e,t-1)},{extra:a,onError:o=TA}=e;nA(o,`onError`);let s=e=>(e.unsubscribe=()=>t.delete(e.id),t.set(e.id,e),t=>{e.unsubscribe(),t?.cancelActive&&yA(e)}),c=e=>s(vA(t,e)??_A(e));dA(c,{withTypes:()=>c});let l=e=>{let n=vA(t,e);return n&&(n.unsubscribe(),e.cancelActive&&yA(n)),!!n};dA(l,{withTypes:()=>l});let u=async(e,n,s,l)=>{let u=new AbortController,d=hA(c,u.signal),f=[];try{e.pending.add(u),r(e),await Promise.resolve(e.effect(n,dA({},s,{getOriginalState:l,condition:(e,t)=>d(e,t).then(Boolean),take:d,delay:uA(u.signal),pause:lA(u.signal),extra:a,signal:u.signal,fork:mA(u.signal,f),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==u&&(e.abort($k),n.delete(e))})},cancel:()=>{u.abort($k),e.pending.delete(u)},throwIfCancelled:()=>{oA(u.signal)}})))}catch(e){e instanceof tA||xA(o,e,{raisedBy:`effect`})}finally{await Promise.all(f),u.abort(eA),i(e),e.pending.delete(u)}},d=bA(t,n);return{middleware:e=>n=>r=>{if(!qD(r))return n(r);if(SA.match(r))return c(r.payload);if(CA.match(r)){d();return}if(wA.match(r))return l(r.payload);let i=e.getState(),a=()=>{if(i===fA)throw Error(DA(23));return i},s;try{if(s=n(r),t.size>0){let n=e.getState(),s=Array.from(t.values());for(let t of s){let s=!1;try{s=t.predicate(r,n,i)}catch(e){s=!1,xA(o,e,{raisedBy:`predicate`})}s&&u(t,r,e,a)}}}finally{i=fA}return s},startListening:c,stopListening:l,clearListeners:d}};function DA(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var OA=Bk({name:`chartLayout`,initialState:{layoutType:`horizontal`,width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){e.margin.top=t.payload.top??0,e.margin.right=t.payload.right??0,e.margin.bottom=t.payload.bottom??0,e.margin.left=t.payload.left??0},setScale(e,t){e.scale=t.payload}}}),{setMargin:kA,setLayout:AA,setChartSize:jA,setScale:MA}=OA.actions,NA=OA.reducer;function PA(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function FA(e){return Number.isFinite(e)}function IA(e){return typeof e==`number`&&e>0&&Number.isFinite(e)}var LA=u(jD()),RA=u(PT());function zA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function BA(e){for(var t=1;t{if(t&&n){var{width:r,height:i}=n,{align:a,verticalAlign:o,layout:s}=t;if((s===`vertical`||s===`horizontal`&&o===`middle`)&&a!==`center`&&X(e[a]))return BA(BA({},e),{},{[a]:e[a]+(r||0)});if((s===`horizontal`||s===`vertical`&&a===`center`)&&o!==`middle`&&X(e[o]))return BA(BA({},e),{},{[o]:e[o]+(i||0)})}return e},KA=(e,t)=>e===`horizontal`&&t===`xAxis`||e===`vertical`&&t===`yAxis`||e===`centric`&&t===`angleAxis`||e===`radial`&&t===`radiusAxis`,qA=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},JA=(e,t,n)=>{if(!e)return null;var{duplicateDomain:r,type:i,range:a,scale:o,realScaleType:s,isCategorical:c,categoricalDomain:l,tickCount:u,ticks:d,niceTicks:f,axisType:p}=e;if(!o)return null;var m=s===`scaleBand`&&o.bandwidth?o.bandwidth()/2:2,h=(t||n)&&i===`category`&&o.bandwidth?o.bandwidth()/m:0;return h=p===`angleAxis`&&a&&a.length>=2?zT(a[0]-a[1])*2*h:h,t&&(d||f)?(d||f||[]).map((e,t)=>({coordinate:o(r?r.indexOf(e):e)+h,value:e,offset:h,index:t})).filter(e=>!BT(e.coordinate)):c&&l?l.map((e,t)=>({coordinate:o(e)+h,value:e,index:t,offset:h})):o.ticks&&!n&&u!=null?o.ticks(u).map((e,t)=>({coordinate:o(e)+h,value:e,offset:h,index:t})):o.domain().map((e,t)=>({coordinate:o(e)+h,value:r?r[e]:e,index:t,offset:h}))},YA=1e-4,XA=e=>{var t=e.domain();if(!(!t||t.length<=2)){var n=t.length,r=e.range(),i=Math.min(r[0],r[1])-YA,a=Math.max(r[0],r[1])+YA,o=e(t[0]),s=e(t[n-1]);(oa||sa)&&e.domain([t[0],t[n-1]])}},ZA={sign:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r=0?(s[0]=i,s[1]=i+u,i=c):(s[0]=a,s[1]=a+u,a=c)}}}},expand:TT,none:bT,silhouette:ET,wiggle:DT,positive:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r=0?(o[0]=i,o[1]=i+s,i=o[1]):(o[0]=0,o[1]=0)}}}}},QA=(e,t,n)=>{var r=ZA[n]??bT,i=wT().keys(t).value((e,t)=>Number(WA(e,t,0))).order(xT).offset(r)(e);return i.forEach((n,r)=>{n.forEach((n,i)=>{var a=WA(e[i],t[r],0);Array.isArray(a)&&a.length===2&&X(a[0])&&X(a[1])&&(n[0]=a[0],n[1]=a[1])})}),i};function $A(e){return e==null?void 0:String(e)}function ej(e){var{axis:t,ticks:n,bandSize:r,entry:i,index:a,dataKey:o}=e;if(t.type===`category`){if(!t.allowDuplicatedCategory&&t.dataKey&&!YT(i[t.dataKey])){var s=JT(n,`value`,i[t.dataKey]);if(s)return s.coordinate+r/2}return n[a]?n[a].coordinate+r/2:null}var c=WA(i,YT(o)?t.dataKey:o);return YT(c)?null:t.scale(c)}var tj=e=>{var t=e.flat(2).filter(X);return[Math.min(...t),Math.max(...t)]},nj=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],rj=(e,t,n)=>{if(e!=null)return nj(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var{stackedData:o}=a,s=o.reduce((e,r)=>{var i=tj(PA(r,t,n));return!FA(i[0])||!FA(i[1])?e:[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(s[0],r[0]),Math.max(s[1],r[1])]},[1/0,-1/0]))},ij=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,aj=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,oj=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=(0,LA.default)(t,e=>e.coordinate),a=1/0,o=1,s=i.length;o{if(t===`horizontal`)return e.chartX;if(t===`vertical`)return e.chartY},uj=(e,t)=>t===`centric`?e.angle:e.radius,dj=e=>e.layout.width,fj=e=>e.layout.height,pj=e=>e.layout.scale,mj=e=>e.layout.margin,hj=Q(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),gj=Q(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),_j=`data-recharts-item-index`,vj=`data-recharts-item-id`;function yj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function bj(e){for(var t=1;te.brush.height;function Tj(e){return gj(e).reduce((e,t)=>t.orientation===`left`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function Ej(e){return gj(e).reduce((e,t)=>t.orientation===`right`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function Dj(e){return hj(e).reduce((e,t)=>t.orientation===`top`&&!t.mirror&&!t.hide?e+t.height:e,0)}function Oj(e){return hj(e).reduce((e,t)=>t.orientation===`bottom`&&!t.mirror&&!t.hide?e+t.height:e,0)}var kj=Q([dj,fj,mj,wj,Tj,Ej,Dj,Oj,ND,PD],(e,t,n,r,i,a,o,s,c,l)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=bj(bj({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),f=d.bottom;d.bottom+=r,d=GA(d,c,l);var p=e-d.left-d.right,m=t-d.top-d.bottom;return bj(bj({brushBottom:f},d),{},{width:Math.max(p,0),height:Math.max(m,0)})}),Aj=Q(kj,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),jj=Q(dj,fj,(e,t)=>({x:0,y:0,width:e,height:t})),Mj=(0,C.createContext)(null),Nj=()=>(0,C.useContext)(Mj)!=null,Pj=e=>e.brush,Fj=Q([Pj,kj,mj],(e,t,n)=>({height:e.height,x:X(e.x)?e.x:t.left,y:X(e.y)?e.y:t.top+t.height+t.brushBottom-(n?.bottom||0),width:X(e.width)?e.width:t.width})),Ij=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}e.debounce=t})),Lj=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Ij();function n(e,n=0,r={}){typeof r!=`object`&&(r={});let{leading:i=!1,trailing:a=!0,maxWait:o}=r,s=[,,];i&&(s[0]=`leading`),a&&(s[1]=`trailing`);let c,l=null,u=t.debounce(function(...t){c=e.apply(this,t),l=null},n,{edges:s}),d=function(...t){return o!=null&&(l===null&&(l=Date.now()),Date.now()-l>=o)?(c=e.apply(this,t),l=Date.now(),u.cancel(),u.schedule(),c):(u.apply(this,t),c)};return d.cancel=u.cancel,d.flush=()=>(u.flush(),c),d}e.debounce=n})),Rj=s((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Lj();function n(e,n=0,r={}){let{leading:i=!0,trailing:a=!0}=r;return t.debounce(e,n,{leading:i,maxWait:n,trailing:a})}e.throttle=n})),zj=s(((e,t)=>{t.exports=Rj().throttle})),Bj=!0,Vj=function(e,t){var n=[...arguments].slice(2);if(Bj&&typeof console<`u`&&console.warn&&(t===void 0&&console.warn(`LogUtils requires an error message argument`),!e))if(t===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var r=0;console.warn(t.replace(/%s/g,()=>n[r++]))}},Hj=(e,t,n)=>{var{width:r=`100%`,height:i=`100%`,aspect:a,maxHeight:o}=n,s=VT(r)?e:Number(r),c=VT(i)?t:Number(i);return a&&a>0&&(s?c=s/a:c&&(s=c*a),o&&c!=null&&c>o&&(c=o)),{calculatedWidth:s,calculatedHeight:c}},Uj={width:0,height:0,overflow:`visible`},Wj={width:0,overflowX:`visible`},Gj={height:0,overflowY:`visible`},Kj={},qj=e=>{var{width:t,height:n}=e,r=VT(t),i=VT(n);return r&&i?Uj:r?Wj:i?Gj:Kj};function Jj(e){var{width:t,height:n,aspect:r}=e,i=t,a=n;return i===void 0&&a===void 0?(i=`100%`,a=`100%`):i===void 0?i=r&&r>0?void 0:`100%`:a===void 0&&(a=r&&r>0?void 0:`100%`),{width:i,height:a}}var Yj=u(zj());function Xj(){return Xj=Object.assign?Object.assign.bind():function(e){for(var t=1;t({width:n,height:r}),[n,r]);return rM(i)?C.createElement(nM.Provider,{value:i},t):null}var aM=()=>(0,C.useContext)(nM),oM=(0,C.forwardRef)((e,t)=>{var{aspect:n,initialDimension:r={width:-1,height:-1},width:i,height:a,minWidth:o=0,minHeight:s,maxHeight:c,children:l,debounce:u=0,id:d,className:f,onResize:p,style:m={}}=e,h=(0,C.useRef)(null),g=(0,C.useRef)();g.current=p,(0,C.useImperativeHandle)(t,()=>h.current);var[_,v]=(0,C.useState)({containerWidth:r.width,containerHeight:r.height}),y=(0,C.useCallback)((e,t)=>{v(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]);(0,C.useEffect)(()=>{if(h.current==null||typeof ResizeObserver>`u`)return QT;var e=e=>{var t,{width:n,height:r}=e[0].contentRect;y(n,r),(t=g.current)==null||t.call(g,n,r)};u>0&&(e=(0,Yj.default)(e,u,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),{width:n,height:r}=h.current.getBoundingClientRect();return y(n,r),t.observe(h.current),()=>{t.disconnect()}},[y,u]);var{containerWidth:b,containerHeight:x}=_;Vj(!n||n>0,`The aspect(%s) must be greater than zero.`,n);var{calculatedWidth:S,calculatedHeight:w}=Hj(b,x,{width:i,height:a,aspect:n,maxHeight:c});return Vj(S!=null&&S>0||w!=null&&w>0,`The width(%s) and height(%s) of chart should be greater than 0, please check the style of container, or the props width(%s) and height(%s), @@ -665,4 +665,4 @@ Please change the parent to {let s=(0,C.useId)(),c=(0,C.useRef)(null),l=(0,C.useRef)(null);(0,C.useEffect)(()=>{k5(),A5()},[]);let u=(0,C.useCallback)(()=>{let e=b5(Kr()),t=x5(e),n=r?.(),i=typeof n==`number`&&Number.isFinite(n)&&Math.abs(Math.trunc(n)-Math.trunc(t))<=2;return{pulse:Math.trunc(i?n:t),micro:e}},[r]),[{pulse:d},f]=(0,C.useState)(()=>u()),p=(0,C.useRef)(null),m=(0,C.useRef)(d),h=(0,C.useCallback)(()=>{p.current!==null&&(window.clearTimeout(p.current),p.current=null);let e=()=>{let t=u();m.current=t.pulse,f(e=>e.pulse===t.pulse?e:t);let n=R5(t.micro);p.current=window.setTimeout(()=>{let t=u();t.pulse!==m.current&&(m.current=t.pulse,f(t)),e()},Math.max(0,n))};e()},[u]);(0,C.useEffect)(()=>(h(),()=>{p.current!==null&&window.clearTimeout(p.current)}),[h]),(0,C.useEffect)(()=>{let e=()=>{typeof document<`u`&&!document.hidden&&h()};return document.addEventListener(`visibilitychange`,e,{passive:!0}),()=>document.removeEventListener(`visibilitychange`,e)},[h]);let g=(0,C.useMemo)(()=>{if(typeof window>`u`)return`/`;let e=String(window.location.href||``).trim();if(e&&/^https?:\/\//i.test(e))return e;let t=window.location.origin,n=`${window.location.pathname}${window.location.search}${window.location.hash}`;return t&&t!==`null`?`${t}${n||`/`}`:n||`/`},[]),[_,v]=(0,C.useState)(()=>{let e={purpose:``,to:``,from:``,location:``,witnesses:``,reference:``,remark:`In Yahuah We Trust — Secured by Φ, not man-made law`,valuePhi:``,premiumPhi:``,computedPulse:``,nowPulse:``,kaiSignature:``,userPhiKey:``,sigmaCanon:``,shaHex:``,phiDerived:``,valuationAlg:``,valuationStamp:``,provenance:[],zk:void 0,sigilSvg:``,verifyUrl:g,...a??{}};return{...e,verifyUrl:O5(e.verifyUrl,g)}}),[y,b]=(0,C.useState)(null),x=(0,C.useRef)(!1),[S,w]=(0,C.useState)(!1),T=e=>t=>v(n=>({...n,[e]:t})),E=Math.trunc(d),D=(0,C.useMemo)(()=>{let{unsigned:t}=mu(e,E);return t},[e,E]),O=(0,C.useMemo)(()=>`${D.algorithm} • ${D.policyChecksum}`,[D.algorithm,D.policyChecksum]);(0,C.useEffect)(()=>{v(e=>e.valuationAlg?e:{...e,valuationAlg:O})},[O]);let k=(0,C.useMemo)(()=>Qu({meta:e,nowPulse:E,usd:t,currentStreakDays:0,lifetimeUsdSoFar:0},n),[e,E,t,n]),A=D.valuePhi,j=D.premium??0,M=k.usdPerPhi,N=k.phiPerUsd,P=A*M,F=(0,C.useCallback)(()=>{let e=!!y,t=Z8(e?y.valuePhi:A),n=e&&_.premiumPhi||Z8(j),r=e?String(y.lockedPulse):``,i=e?_.valuationStamp||y.seal.stamp:``,a=O5(_.verifyUrl,g);return k8({purpose:_.purpose,to:_.to,from:_.from,location:_.location,witnesses:_.witnesses,reference:_.reference,remark:_.remark,valuePhi:t,premiumPhi:n,computedPulse:r,nowPulse:String(E),kaiSignature:_.kaiSignature||``,userPhiKey:_.userPhiKey||``,valuationAlg:_.valuationAlg||O,valuationStamp:i,sigilSvg:_.sigilSvg||``,verifyUrl:a,provenance:_.provenance??[]})},[_,A,j,E,O,y,g]),I=j5(()=>{let e=c.current;if(e)try{o8(e,F())}catch(e){console.error(`preview render failed`,e)}});(0,C.useEffect)(()=>{I()},[I,F]);let L=(0,C.useCallback)(async()=>{if(!(x.current||S)){w(!0);try{await new Promise(e=>requestAnimationFrame(()=>e()));let r=E,{unsigned:a}=mu(e,r),o=await L5(a),s=Qu({meta:e,nowPulse:r,usd:t,currentStreakDays:0,lifetimeUsdSoFar:0},n),c={...C5(a),stamp:o},l={lockedPulse:r,seal:c,usdPerPhi:s.usdPerPhi,phiPerUsd:s.phiPerUsd,valuePhi:c.valuePhi,valueUsdIndicative:c.valuePhi*s.usdPerPhi,quote:s};p.current!==null&&(window.clearTimeout(p.current),p.current=null),x.current=!0,b(l),v(e=>({...e,computedPulse:String(r),nowPulse:String(r),valuationStamp:o,premiumPhi:a.premium===void 0?e.premiumPhi:Z8(a.premium),valuationAlg:e.valuationAlg||`${a.algorithm} • ${a.policyChecksum}`,valuePhi:Z8(c.valuePhi),verifyUrl:O5(e.verifyUrl,g)})),i?.(l)}catch(e){console.error(`Render/Lock failed`,e),window.alert(`Render failed.\n${e instanceof Error?e.message:String(e)}`)}finally{w(!1)}}},[E,e,t,n,i,S,g]),R=(0,C.useRef)(``);(0,C.useEffect)(()=>{let e=!0;(async()=>{try{let t=await o5();if(!e||!t)return;let n={...t,verifyUrl:t.verifyUrl?O5(t.verifyUrl,g):void 0};v(e=>({...e,...n,verifyUrl:O5(n.verifyUrl??e.verifyUrl,g)}))}catch(e){console.error(`bridge hydration failed`,e)}})();let t=e=>{try{let t=e.detail;if(!t)return;let n=e=>(typeof e.verifyUrl==`string`&&(e.verifyUrl=O5(e.verifyUrl,g)),e);if(x.current){let e=[`kaiSignature`,`userPhiKey`,`sigmaCanon`,`shaHex`,`phiDerived`,`zk`,`provenance`,`sigilSvg`,`verifyUrl`],r=n(Object.fromEntries(Object.entries(t).filter(([t])=>e.includes(t)))),i=JSON.stringify(r);if(i===R.current)return;R.current=i,v(e=>({...e,...r}));return}let r=n({...t}),i=JSON.stringify(r);if(i===R.current)return;R.current=i,v(e=>({...e,...r}))}catch(e){console.error(`bridge event failed`,e)}};return window.addEventListener(`kk:note-data`,t,{passive:!0}),()=>{e=!1,window.removeEventListener(`kk:note-data`,t)}},[g]);let z=(0,C.useCallback)(async()=>{let e=l.current;if(!e)return;if(!x.current||!y){window.alert(`Please Render to lock the valuation before printing.`);return}let t=O5(_.verifyUrl,g),n=k8({..._,valuePhi:_.valuePhi||Z8(y.valuePhi),premiumPhi:_.premiumPhi||Z8(j),computedPulse:String(y.lockedPulse),nowPulse:String(y.lockedPulse),kaiSignature:_.kaiSignature||``,userPhiKey:_.userPhiKey||``,valuationAlg:_.valuationAlg||O,valuationStamp:_.valuationStamp||y.seal.stamp,sigilSvg:_.sigilSvg||``,verifyUrl:t,provenance:_.provenance??[]}),r=L8({frozenPulse:String(y.lockedPulse),kaiSignature:_.kaiSignature||``,userPhiKey:_.userPhiKey||``,sigmaCanon:_.sigmaCanon||``,shaHex:_.shaHex||``,phiDerived:_.phiDerived||``,valuePhi:_.valuePhi||Z8(y.valuePhi),premiumPhi:_.premiumPhi||Z8(j),valuationAlg:_.valuationAlg||O,valuationStamp:_.valuationStamp||y.seal.stamp,zk:_.zk,provenance:_.provenance??[],sigilSvg:_.sigilSvg||``,verifyUrl:t});G8(e,n,String(y.lockedPulse),r),e.setAttribute(`aria-hidden`,`false`),await D5(),await K8(`☤KAI ${w5(y.lockedPulse)} — ${a8}`),e.setAttribute(`aria-hidden`,`true`)},[_,y,j,O,g]),B=(0,C.useCallback)(async()=>{try{if(!x.current||!y){window.alert(`Please Render to lock the valuation before saving PNG.`);return}let e=O5(_.verifyUrl,g),t=await _5(k8({..._,valuePhi:_.valuePhi||Z8(y.valuePhi),premiumPhi:_.premiumPhi||Z8(j),computedPulse:String(y.lockedPulse),nowPulse:String(y.lockedPulse),kaiSignature:_.kaiSignature||``,userPhiKey:_.userPhiKey||``,valuationAlg:_.valuationAlg||O,valuationStamp:_.valuationStamp||y.seal.stamp,sigilSvg:_.sigilSvg||``,verifyUrl:e,provenance:_.provenance??[]}),2400);v5(`${T5(_.kaiSignature||``,String(y.lockedPulse),_.valuationStamp||y.seal.stamp||``)}.png`,t,`image/png`)}catch(e){window.alert(`Save PNG failed: `+(e instanceof Error?e.message:String(e))),console.error(e)}},[_,y,j,O,g]),V=y?y.lockedPulse:E,H=y?y.valuePhi:A,U=y?y.valueUsdIndicative:P,ee=y?y.usdPerPhi:M,te=y?y.phiPerUsd:N,ne=y?_.premiumPhi?Number(_.premiumPhi):0:j,re=E5(H),ie=(0,C.useMemo)(()=>`☤KAI ${w5(V)}`,[V]);return(0,W.jsxs)(`div`,{"data-kk-scope":s,className:`kk-note ${o??``}`,children:[(0,W.jsxs)(`div`,{className:`kk-bar`,children:[(0,W.jsx)(`div`,{className:`kk-brand`,children:(0,W.jsx)(`strong`,{children:`☤KAI — Kairos Kurrensy · Sovereign Harmonik Kingdom`})}),(0,W.jsx)(`div`,{className:`kk-legal-pill`,children:`Issued under Yahuah’s Law of Eternal Light (Φ • Kai-Turah)`})]}),(0,W.jsxs)(`section`,{className:`kk-hero ${y?`is-locked`:`is-live`}`,children:[(0,W.jsxs)(`div`,{className:`kk-status`,children:[(0,W.jsx)(`span`,{className:`kk-chip ${y?`chip-locked`:`chip-live`}`,children:y?`LOCKED`:`LIVE`}),(0,W.jsxs)(`span`,{className:`kk-chip kk-chip-pulse`,children:[`☤KAI `,w5(V)]}),(0,W.jsxs)(`span`,{className:`kk-chip`,children:[`value: `,Y8(H)]}),(0,W.jsxs)(`span`,{className:`kk-chip`,children:[`$ / φ: `,Z8(ee)]}),(0,W.jsxs)(`span`,{className:`kk-chip`,children:[`φ / $: `,Z8(te)]}),(0,W.jsxs)(`span`,{className:`kk-chip`,children:[`premium φ: `,Z8(ne)]})]}),(0,W.jsxs)(`div`,{className:`kk-value-row`,children:[(0,W.jsxs)(`div`,{className:`kk-value-block`,children:[(0,W.jsx)(`div`,{className:`kk-value-label`,children:`VALUE`}),(0,W.jsxs)(`div`,{className:`kk-value`,children:[(0,W.jsx)(`span`,{className:`kk-value-sigil`,children:`Φ`}),(0,W.jsx)(`span`,{className:`kk-value-int`,children:re.int}),(0,W.jsx)(`span`,{className:`kk-value-frac`,children:re.frac})]}),(0,W.jsxs)(`div`,{className:`kk-value-usd`,children:[`≈ `,X8(U)]})]}),(0,W.jsxs)(`div`,{className:`kk-cta`,children:[y?(0,W.jsxs)(`div`,{className:`kk-locked-banner`,role:`status`,"aria-live":`polite`,children:[(0,W.jsx)(`div`,{className:`kk-locked-title`,children:`Valuation Locked`}),(0,W.jsxs)(`div`,{className:`kk-locked-sub`,children:[`☤KAI `,w5(y.lockedPulse),` • Hash: `,_.valuationStamp||y.seal.stamp||`—`]})]}):(0,W.jsx)(`button`,{className:`kk-btn kk-btn-primary kk-btn-xl`,onClick:L,title:`Freeze current pulse and valuation`,disabled:S,children:S?`Rendering…`:`Render — Lock Valuation`}),(0,W.jsxs)(`div`,{className:`kk-cta-actions`,children:[(0,W.jsx)(`button`,{className:`kk-btn`,onClick:z,disabled:!y,title:`Print proof pages`,children:`Print / Save PDF`}),(0,W.jsx)(`button`,{className:`kk-btn kk-btn-ghost`,onClick:B,disabled:!y,title:`Export note PNG`,children:`Save PNG`})]})]})]})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Title`}),(0,W.jsx)(`input`,{value:`${ie} — ${a8}`,disabled:!0,className:`kk-out`})]}),(0,W.jsxs)(`div`,{className:`kk-grid`,children:[(0,W.jsxs)(`div`,{className:`kk-stack`,children:[(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Purpose`}),(0,W.jsx)(`input`,{value:_.purpose,onChange:e=>T(`purpose`)(e.target.value),placeholder:`e.g., consideration for work / gift / exchange`,disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`To`}),(0,W.jsx)(`input`,{value:_.to,onChange:e=>T(`to`)(e.target.value),placeholder:`Recipient`,disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`From`}),(0,W.jsx)(`input`,{value:_.from,onChange:e=>T(`from`)(e.target.value),placeholder:`Issuer`,disabled:!!y})]})]}),(0,W.jsxs)(`div`,{className:`kk-stack`,children:[(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Location`}),(0,W.jsx)(`input`,{value:_.location,onChange:e=>T(`location`)(e.target.value),placeholder:`(optional)`,disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Witnesses`}),(0,W.jsx)(`input`,{value:_.witnesses,onChange:e=>T(`witnesses`)(e.target.value),placeholder:`(optional)`,disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Reference`}),(0,W.jsx)(`input`,{value:_.reference,onChange:e=>T(`reference`)(e.target.value),placeholder:`(optional)`,disabled:!!y})]})]})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Remark`}),(0,W.jsx)(`input`,{value:_.remark,onChange:e=>T(`remark`)(e.target.value),placeholder:`In Yahuah We Trust — Secured by Φ, not man-made law`,disabled:!!y})]}),(0,W.jsxs)(`details`,{className:`kk-stack`,style:{marginTop:8},open:!0,children:[(0,W.jsxs)(`summary`,{children:[(0,W.jsx)(`strong`,{children:`Identity & Valuation`}),` `,(0,W.jsx)(`span`,{className:`kk-hint`,children:`— appears on the bill + proof pages`})]}),(0,W.jsxs)(`div`,{className:`kk-grid`,style:{marginTop:8},children:[(0,W.jsxs)(`div`,{className:`kk-stack`,children:[(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Value Φ`}),(0,W.jsx)(`input`,{value:Z8(H),readOnly:!0})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Premium Φ`}),(0,W.jsx)(`input`,{value:Z8(ne),readOnly:!0})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Valuation Alg`}),(0,W.jsx)(`input`,{value:_.valuationAlg||O,readOnly:!0})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Valuation Stamp`}),(0,W.jsx)(`input`,{value:y?_.valuationStamp||y.seal.stamp||`—`:``,readOnly:!0})]})]}),(0,W.jsxs)(`div`,{className:`kk-stack`,children:[(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Pulse (locked)`}),(0,W.jsx)(`input`,{value:y?String(y.lockedPulse):``,readOnly:!0,placeholder:`set on Render`})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Pulse (live)`}),(0,W.jsx)(`input`,{value:String(E),readOnly:!0,placeholder:`live`})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`kaiSignature`}),(0,W.jsx)(`input`,{value:_.kaiSignature,onChange:e=>T(`kaiSignature`)(e.target.value),disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`userΦkey`}),(0,W.jsx)(`input`,{value:_.userPhiKey,onChange:e=>T(`userPhiKey`)(e.target.value),disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Σ (canonical)`}),(0,W.jsx)(`input`,{value:_.sigmaCanon,onChange:e=>T(`sigmaCanon`)(e.target.value),disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`sha256(Σ)`}),(0,W.jsx)(`input`,{value:_.shaHex,onChange:e=>T(`shaHex`)(e.target.value),disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Φ (derived)`}),(0,W.jsx)(`input`,{value:_.phiDerived,onChange:e=>T(`phiDerived`)(e.target.value),disabled:!!y})]})]})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Verify URL`}),(0,W.jsx)(`input`,{value:_.verifyUrl,onChange:e=>T(`verifyUrl`)(e.target.value),placeholder:`Used for QR & clickable sigil`,disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Sigil SVG (raw)`}),(0,W.jsx)(`textarea`,{value:_.sigilSvg,onChange:e=>T(`sigilSvg`)(e.target.value),className:`kk-out`,disabled:!!y})]})]}),(0,W.jsxs)(`div`,{className:`kk-row kk-actions`,children:[(0,W.jsx)(`div`,{}),(0,W.jsxs)(`div`,{className:`kk-flex`,children:[!y&&(0,W.jsx)(`button`,{className:`kk-btn kk-btn-primary`,onClick:L,disabled:S,children:S?`Rendering…`:`Render — Lock Valuation`}),(0,W.jsx)(`button`,{className:`kk-btn`,onClick:z,disabled:!y,children:`Print / Save PDF`}),(0,W.jsx)(`button`,{className:`kk-btn kk-btn-ghost`,onClick:B,disabled:!y,children:`Save PNG`})]}),(0,W.jsx)(`div`,{})]}),(0,W.jsx)(`div`,{ref:c,id:`note-preview`,className:`kk-note-preview kk-out`}),(0,W.jsx)(`div`,{ref:l,id:`print-root`,"aria-hidden":`true`})]})},B5=`kairos:key:pkcs8`,V5=`kairos:key:spki`,H5={name:`ECDSA`,namedCurve:`P-256`},U5={name:`ECDSA`,hash:`SHA-256`};function W5(e){let t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(e),t}async function G5(e){return crypto.subtle.importKey(`pkcs8`,e,H5,!0,[`sign`])}async function K5(e){return crypto.subtle.importKey(`spki`,e,H5,!0,[`verify`])}async function q5(e){let t=await crypto.subtle.exportKey(`pkcs8`,e);return xs.encode(new Uint8Array(t))}async function J5(e){let t=await crypto.subtle.exportKey(`spki`,e);return xs.encode(new Uint8Array(t))}async function Y5(){let e=await crypto.subtle.generateKey(H5,!0,[`sign`,`verify`]),t=await J5(e.publicKey);return{priv:e.privateKey,pub:e.publicKey,spkiB64u:t}}async function X5(){try{let e=localStorage.getItem(B5),t=localStorage.getItem(V5);if(e&&t){let n=xs.decode(e),r=xs.decode(t);return{priv:await G5(W5(n)),pub:await K5(W5(r)),spkiB64u:t}}let n=await Y5();return localStorage.setItem(B5,await q5(n.priv)),localStorage.setItem(V5,n.spkiB64u),n}catch{return Y5()}}async function Z5(e,t){let n=W5(t),r=await crypto.subtle.sign(U5,e,n);return xs.encode(new Uint8Array(r))}function Q5(e,t){let n=e.match(RegExp(`${t}="([^"]+)"`,`i`));return n?n[1]:void 0}function $5(e,t){let n=Q5(e,t);if(!n)return;let r=Number(n);return Number.isFinite(r)?r:void 0}function e7(e){try{let t=new DOMParser().parseFromString(e,`image/svg+xml`).querySelector(`metadata`);return t?t.textContent??null:null}catch{return null}}async function t7(e){let t=await e.text(),n={},r=e7(t);if(r)try{n=JSON.parse(r)}catch{}if(n.pulse??=$5(t,`data-pulse`),n.beat??=$5(t,`data-beat`),n.stepIndex??=$5(t,`data-step-index`),n.frequencyHz??=(()=>{let e=Q5(t,`data-frequency-hz`);return e?Number(e):void 0})(),n.chakraGate??=Q5(t,`data-chakra-gate`),!n.chakraDay){let e=Q5(t,`data-harmonic-day`)||Q5(t,`data-chakra-day`);e&&(n.chakraDay=e)}n.kaiSignature??=Q5(t,`data-kai-signature`),n.userPhiKey??=Q5(t,`data-phi-key`);let i=!n[`@context`]||n[`@context`]===`https://schema.phi.network/sigil/v1`,a=!n.type||n.type===`application/phi.kairos.sigil+svg`;return{text:t,meta:n,contextOk:i,typeOk:a}}async function n7(e,t){let n=new Image;n.crossOrigin=`anonymous`,n.src=e,await n.decode();let r=document.createElement(`canvas`);r.width=n.width,r.height=n.height;let i=r.getContext(`2d`);if(!i)throw Error(`Canvas 2D context unavailable`);i.drawImage(n,0,0);let{data:a}=i.getImageData(Math.floor(n.width/2),Math.floor(n.height/2),1,1),o=[a[0],a[1],a[2]];return{sig:(await _s(`${t}-2:3-${o.join(`,`)}`)).slice(0,32),rgb:o}}async function r7(e,t){let n=await fetch(e).then(e=>e.text()),r=JSON.stringify(t,null,2),i=n.match(/]*>/i)?n.replace(/]*>[\s\S]*?<\/metadata>/i,`${r}`):n.replace(/]*)>/i,`${r}`);return`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(i)))}`}async function i7(e,t=1024){let n=new Image;await new Promise((t,r)=>{n.onload=()=>t(),n.onerror=r,n.src=e});let r=document.createElement(`canvas`);r.width=t,r.height=t;let i=r.getContext(`2d`);if(!i)throw Error(`Canvas unsupported`);return i.clearRect(0,0,t,t),i.drawImage(n,0,0,t,t),await new Promise((e,t)=>r.toBlob(n=>n?e(n):t(Error(`PNG encode failed`)),`image/png`))}const a7=()=>new Date().toISOString(),o7=(e,t)=>`${e}_${t}_${a7().replace(/[:.]/g,`-`)}`,s7=(e,t,n)=>`${e}_${t}_${n}`,c7=(e,t)=>{let n=document.createElement(`a`);if(typeof e==`string`)n.href=e;else{let t=URL.createObjectURL(e);n.href=t,setTimeout(()=>URL.revokeObjectURL(t),0)}n.download=t,n.rel=`noopener`,document.body.appendChild(n),n.click(),n.remove()},l7=e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let n=String(r.result),i=n.indexOf(`,`),a=i>=0?n.slice(i+1):``;t({name:e.name,mime:e.type,size:e.size,encoded:a})},r.onerror=n,r.readAsDataURL(e)});var u7=18n;function d7(e){let t=1n;for(let n=0n;ne?`0.`:``).split(`.`),a=(r||`0`).replace(/^0+(?=\d)/,``)||`0`,o=(i+`0`.repeat(Number(u7))).slice(0,Number(u7));return n*(BigInt(a)*f7+BigInt(o||`0`))}function m7(e){let t=e<0n?`-`:``,n=e<0n?-e:e,r=n/f7,i=(n%f7).toString().padStart(Number(u7),`0`);return i=i.replace(/0+$/,``),i?`${t}${r}.${i}`:`${t}${r}`}function h7(e){try{let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e=0;e--)if(t[e]?.receiverSignature){n=e;break}let r=0n;for(let e=Math.max(0,n+1);e=0)i=g7(t[n]);else{let t=e.valuation;t&&typeof t.valuePhi==`number`&&(i=p7(String(t.valuePhi)))}let a=p7(e.branchSpentPhi??`0`)+r,o=e.segments?.length??0,s=e.cumulativeTransfers??0,c=s+t.length-1,l=await ws(await Promise.all(t.map(async e=>{let t={senderSignature:e.senderSignature,senderStamp:e.senderStamp,senderKaiPulse:e.senderKaiPulse};return e.payload&&(t.payload={name:e.payload.name,mime:e.payload.mime,size:e.payload.size}),e.receiverSignature&&(t.receiverSignature=e.receiverSignature),e.receiverStamp&&(t.receiverStamp=e.receiverStamp),e.receiverKaiPulse!=null&&(t.receiverKaiPulse=e.receiverKaiPulse),_s(JSON.stringify(t))}))),u=await Hs(e),d={version:1,segmentIndex:o,segmentRange:[s,c],segmentRoot:l,headHashAtSeal:u,leafHash:`sha256`,transfers:t},f=JSON.stringify(d),p=await _s(f),m=new Blob([f],{type:`application/json`}),h=[...e.segments??[],{index:o,root:l,cid:p,count:t.length}],g=await ws(h.map(e=>e.root));return{meta:{...e,segments:h,segmentsMerkleRoot:g,cumulativeTransfers:(e.cumulativeTransfers??0)+t.length,transfers:[],transfersWindowRoot:void 0,headHashAtSeal:u,segmentSize:e.segmentSize??2e3,...i>0n?{branchBasePhi:m7(i)}:{},branchSpentPhi:m7(a)},segmentFileBlob:m}}async function v7(e,t){if(t.kind===`head`)return!e.transfersWindowRoot||e.transfersWindowRoot!==t.windowMerkleRoot?!1:Es(e.transfersWindowRoot,t.transferProof);if(!e.segments||!e.segmentsMerkleRoot)return!1;let n=e.segments.find(e=>e.index===t.segmentIndex);if(!n||n.root!==t.segmentRoot)return!1;let r=t.segmentRoot,i=t.segmentIndex;for(let e of t.segmentsSiblings){let t=i%2==0?[r,e]:[e,r];r=await Cs(t[0]<=t[1]?t[0]:t[1],t[0]<=t[1]?t[1]:t[0]),i=Math.floor(i/2)}return r===e.segmentsMerkleRoot?Es(t.segmentRoot,t.transferProof):!1}var y7=e=>typeof e==`object`&&!!e,b7=e=>typeof e==`string`||typeof e==`number`||typeof e==`bigint`;function x7(e){return y7(e)}function S7(e){return y7(e)}function C7(e){return Array.isArray(e)?e.every(b7):y7(e)?Object.values(e).every(e=>b7(e)):!1}function w7(e){return typeof e==`object`&&!!e&&`verify`in e&&typeof e.verify==`function`}async function T7(){if(typeof window<`u`&&window.snarkjs?.groth16&&w7(window.snarkjs.groth16))return window.snarkjs.groth16;try{let e=await O(()=>import(`snarkjs`),[]),t=e.groth16??e.default?.groth16;if(w7(t))return t}catch{}return null}async function E7(e){let t=await T7();if(!t)return null;let n=e.vkey??e.fallbackVkey;return!x7(n)||!C7(e.publicSignals)||!S7(e.proof)?!1:!!await t.verify(n,e.publicSignals,e.proof)}async function D7(e){let t=e.zkVerifyingKey,n=typeof window<`u`?window.SIGIL_ZK_VKEY:void 0,r=t??n,i=e.hardenedTransfers??[];for(let e=0;ee?String(e).toLowerCase():``;function F7(e){let t=typeof e==`string`?e.trim():String(e??``);return t&&(t.replace(/[^0-9]/g,``)||`0`).replace(/^0+(?=\d)/,``)||`0`}function I7(e){let t=BigInt(2**53-1);return e>t?2**53-1:e<-t?-(2**53-1):Number(e)}function L7(){return I7(Kr())}function R7(){if(!M7)return[];try{let e=localStorage.getItem(O7);return e?JSON.parse(e):[]}catch{return[]}}function z7(){if(M7)try{if(localStorage.getItem(O7))return;for(let e of k7){let t=localStorage.getItem(e);if(t)try{let e=JSON.parse(t);if(!Array.isArray(e))continue;let n=[];for(let t of e){let e=t??{},r=P7(e.parentCanonical??e.parent??e.p),i=P7(e.childCanonical??e.child??e.c),a=F7(e.amountPhiScaled??e.amountScaled??e.a),o=Number(e.senderKaiPulse??e.k??0)||0,s=String(e.transferNonce??e.n??``),c=String(e.senderStamp??e.s??``),l=String(e.previousHeadRoot??e.r??``),u=String(e.transferLeafHashSend??e.l??``),d=!!e.confirmed,f=e.createdAt??e.t,p=(f==null?L7():Number(f))||L7();!r||!i||n.push({id:``,parentCanonical:r,childCanonical:i,amountPhiScaled:a,senderKaiPulse:o,transferNonce:s,senderStamp:c,previousHeadRoot:l,transferLeafHashSend:u,confirmed:d,createdAt:p})}(async()=>{for(let e of n)e.id=await H7({parentCanonical:e.parentCanonical,childCanonical:e.childCanonical,amountPhiScaled:e.amountPhiScaled,senderKaiPulse:e.senderKaiPulse,transferNonce:e.transferNonce,senderStamp:e.senderStamp,previousHeadRoot:e.previousHeadRoot,transferLeafHashSend:e.transferLeafHashSend});let e=new Map;for(let t of n)e.set(t.id,t);V7(Array.from(e.values()))})();return}catch{}}}catch{}}function B7(){z7();let e=R7();if(!Array.isArray(e))return[];let t=[];for(let n of e)try{let e=n,r={id:String(e.id??``),parentCanonical:P7(e.parentCanonical),childCanonical:P7(e.childCanonical),amountPhiScaled:F7(e.amountPhiScaled),senderKaiPulse:Number(e.senderKaiPulse??0)||0,transferNonce:String(e.transferNonce??``),senderStamp:String(e.senderStamp??``),previousHeadRoot:String(e.previousHeadRoot??``),transferLeafHashSend:String(e.transferLeafHashSend??``),confirmed:!!e.confirmed,createdAt:Number(e.createdAt??L7())||L7()};if(!r.parentCanonical||!r.childCanonical||!r.id)continue;t.push(r)}catch{}return t.sort((e,t)=>e.createdAt-t.createdAt),t}function V7(e){if(M7)try{let t=e.map(e=>({...e,parentCanonical:P7(e.parentCanonical),childCanonical:P7(e.childCanonical),amountPhiScaled:F7(e.amountPhiScaled),createdAt:Number(e.createdAt||L7())||L7()}));localStorage.setItem(O7,JSON.stringify(t))}catch{}}async function H7(e){return(await _s(JSON.stringify({p:P7(e.parentCanonical),c:P7(e.childCanonical),a:F7(e.amountPhiScaled),k:e.senderKaiPulse,n:e.transferNonce,s:e.senderStamp,r:e.previousHeadRoot,l:e.transferLeafHashSend}))).toLowerCase()}async function U7(e){let t=B7(),n=await H7(e);if(!t.some(e=>e.id===n)){let r={...e,id:n,parentCanonical:P7(e.parentCanonical),childCanonical:P7(e.childCanonical),amountPhiScaled:F7(e.amountPhiScaled),createdAt:L7()};V7([...t,r]),q7({type:`send:add`,record:r})}return n}function W7(e,t){let n=P7(e),r=String(t||``),i=B7(),a=!1;for(let e of i)e.parentCanonical===n&&e.transferLeafHashSend===r&&!e.confirmed&&(e.confirmed=!0,a=!0);a&&(V7(i),q7({type:`send:update`,parentCanonical:n}))}function G7(e){let t=P7(e);return B7().filter(e=>e.parentCanonical===t)}function K7(e){return G7(e).reduce((e,t)=>e+BigInt(F7(t.amountPhiScaled)),0n)}function q7(e){try{N7?.postMessage(e)}catch{}}var J7=({size:e=22,color:t=`currentColor`,label:n=`Inhale & Upload`})=>(0,W.jsxs)(`div`,{style:{display:`inline-flex`,alignItems:`center`,gap:`8px`,cursor:`pointer`,userSelect:`none`,transition:`transform 0.35s ease`},className:`inhale-upload`,title:n,children:[(0,W.jsxs)(`svg`,{viewBox:`0 0 64 64`,width:e,height:e,"aria-hidden":`true`,style:{display:`inline-block`,verticalAlign:`middle`,filter:`drop-shadow(0 0 6px rgba(55,255,228,0.25))`},children:[(0,W.jsx)(`circle`,{cx:`32`,cy:`32`,r:`28`,stroke:t,strokeWidth:`2`,fill:`none`,strokeDasharray:`4 6`,opacity:`0.6`,children:(0,W.jsx)(`animateTransform`,{attributeName:`transform`,type:`rotate`,values:`0 32 32;360 32 32`,dur:`6s`,repeatCount:`indefinite`})}),(0,W.jsx)(`path`,{d:`M32 44V18`,stroke:t,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,W.jsx)(`animate`,{attributeName:`stroke-dasharray`,values:`0,50;50,0;0,50`,dur:`3.236s`,repeatCount:`indefinite`})}),(0,W.jsx)(`polyline`,{points:`22,26 32,16 42,26`,fill:`none`,stroke:t,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,W.jsx)(`animateTransform`,{attributeName:`transform`,type:`translate`,values:`0 2;0 -2;0 2`,dur:`2.618s`,repeatCount:`indefinite`})}),(0,W.jsx)(`rect`,{x:`22`,y:`46`,width:`20`,height:`4`,rx:`2`,fill:t,opacity:`0.7`,children:(0,W.jsx)(`animate`,{attributeName:`opacity`,values:`0.5;1;0.5`,dur:`4s`,repeatCount:`indefinite`})})]}),(0,W.jsx)(`span`,{style:{fontFamily:`var(--font-sans, 'Inter', sans-serif)`,fontWeight:600,letterSpacing:`0.03em`,color:t,fontSize:`0.9rem`}})]}),Y7={full:{width:`100vw`,maxWidth:`100vw`,height:`100dvh`,maxHeight:`100dvh`,margin:0,padding:0,overflow:`hidden`},viewport:{display:`flex`,flexDirection:`column`,width:`100%`,height:`100%`,maxWidth:`100vw`,overflow:`hidden`},gridBar:{display:`grid`,gridTemplateColumns:`1fr auto`,alignItems:`center`},stickyTabs:{position:`sticky`,top:48,zIndex:2},mono:{overflowWrap:`anywhere`},iconBtn:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:44,height:44,padding:0,flex:`0 0 auto`},iconBtnSm:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:40,height:40,padding:0,flex:`0 0 auto`},modalBody:{flex:`1 1 auto`,minHeight:0,overflowY:`auto`,overflowX:`hidden`,paddingBottom:80},headerImg:{maxWidth:`64px`,height:`auto`,flex:`0 0 auto`},valueStrip:{overflowX:`auto`,whiteSpace:`nowrap`},popBg:{position:`fixed`,inset:0,zIndex:9999,background:`rgba(0,0,0,.55)`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:14},popCard:{width:`min(980px, 100%)`,maxHeight:`min(680px, calc(100dvh - 28px))`,borderRadius:18,overflow:`hidden`,background:`rgba(8,10,16,.92)`,border:`1px solid rgba(255,255,255,.12)`,boxShadow:`0 24px 70px rgba(0,0,0,.6)`,display:`flex`,flexDirection:`column`},popHead:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:10,padding:`12px 12px 10px 14px`,borderBottom:`1px solid rgba(255,255,255,.08)`},popBody:{flex:`1 1 auto`,minHeight:0,overflow:`auto`,padding:10},popTitle:{fontSize:12,color:`rgba(255,255,255,.82)`,letterSpacing:`.02em`}};function X7(e=[],t=16,n=.65){let r=(0,C.useRef)(null),i=(0,C.useRef)(null),[a,o]=(0,C.useState)(1);return(0,C.useEffect)(()=>{let e=r.current,a=i.current;if(!e||!a)return;let s=()=>{let r=Math.max(0,e.clientWidth-t),i=a.scrollWidth;if(r<=0||i<=0)return o(1);o(Math.min(1,Math.max(n,r/i)))};s();let c=new ResizeObserver(s);c.observe(e),c.observe(a),window.addEventListener(`resize`,s);let l=window.setInterval(s,250);return()=>{c.disconnect(),window.removeEventListener(`resize`,s),window.clearInterval(l)}},e),{boxRef:r,textRef:i,scale:a}}var Z7=({k:e,v:t,wide:n,mono:r})=>(0,W.jsxs)(`div`,{className:`kv${n?` wide`:``}`,children:[(0,W.jsx)(`span`,{className:`k`,children:e}),(0,W.jsx)(`span`,{className:`v${r?` mono`:``}`,style:r?Y7.mono:void 0,children:t})]}),Q7=({kind:e,trend:t,flash:n,title:r,children:i,onClick:a,ariaLabel:o})=>{let{boxRef:s,textRef:c,scale:l}=X7([i,t,n],16,.65),u=typeof a==`function`,d=e=>{u&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),a?.())};return(0,W.jsx)(`div`,{ref:s,className:`value-chip ${e} ${t}${n?` is-flashing`:``}${u?` is-clickable`:``}`,"data-trend":t,title:r,role:u?`button`:void 0,tabIndex:u?0:void 0,"aria-label":u?o||r:void 0,onClick:a,onKeyDown:d,style:u?{cursor:`pointer`,userSelect:`none`}:void 0,children:(0,W.jsx)(`span`,{ref:c,className:`amount`,style:{display:`inline-block`,whiteSpace:`nowrap`,lineHeight:1,transform:`scale(${l})`,transformOrigin:`left center`,willChange:`transform`},children:i})})},$7=({small:e,aria:t,titleText:n,path:r,...i})=>(0,W.jsx)(`button`,{...i,className:i.className||`secondary`,"aria-label":t,title:n,style:e?Y7.iconBtnSm:Y7.iconBtn,children:(0,W.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`18`,height:`18`,"aria-hidden":`true`,focusable:`false`,className:`ico`,children:(0,W.jsx)(`path`,{d:r,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`})})}),e9=`kai:sigils:v1`,t9=`sigil:urls`,n9=`kai-sigil-registry`;function r9(e){if(typeof window>`u`)return;let t=t=>{try{let n=window.localStorage.getItem(t),r=n?JSON.parse(n):[],i=Array.isArray(r)?r.slice():[];i.includes(e)||i.unshift(e),window.localStorage.setItem(t,JSON.stringify(i.slice(0,2e4)))}catch{}};t(e9),t(t9);try{let t=new BroadcastChannel(n9);t.postMessage({type:`add`,url:e}),t.close()}catch{}try{window.dispatchEvent(new CustomEvent(`kai:registry:add`,{detail:{url:e}}))}catch{}}var i9=1000000n,a9=17491270421n,o9=11000000n,s9=44,c9=36,l9=6,u9=[`Solhara`,`Aquaris`,`Flamora`,`Verdari`,`Sonari`,`Kaelith`],d9={Solhara:`Root`,Aquaris:`Sacral`,Flamora:`Solar Plexus`,Verdari:`Heart`,Sonari:`Throat`,Kaelith:`Crown`},f9=(a9+18n)/36n,p9=(e,t)=>(e%t+t)%t;function m9(e,t){let n=e/t,r=e%t;return r!==0n&&r>0n!=t>0n?n-1n:n}function h9(e){let t=(e-In)/qn*1e6,n=t<0?-1:1,r=Math.abs(t),i=Math.trunc(r),a=r-i,o=i;return a>.5?o=i+1:a===.5&&(o=i%2==0?i:i+1),BigInt(n)*BigInt(o)}function g9(e){if(e>=0n&&e<500000000n)return e*i9;let t=m9(e,i9);if(t>=0n&&t<500000000n)return e;let n=e/1000n,r=BigInt(2**53-1),i=BigInt(-(2**53-1));if(n>r||nBigInt(2**53-1)?2**53-1:Number(t),r=p9(e,i9),i=i9-r;return{pμ:e,pulse:n,μInPulse:r,msToNext:Math.max(0,Math.ceil(Number(i)*qn/1e6))}}function v9(e){let t=m9(e,i9),n=t<=0n?0:t>BigInt(2**53-1)?2**53-1:Number(t),r=p9(e,a9),i=m9(e,a9),a=Number(m9(r,f9)),o=Math.min(Math.max(a,0),c9-1),s=r-BigInt(o)*f9,c=Number(s/o9),l=Math.min(Math.max(c,0),s9-1),u=u9[Number(p9(i,BigInt(l9)))];return{pulse:n,beat:o,stepIndex:l,harmonicDay:u,chakraDay:d9[u]}}function y9(e){let[t,n]=(0,C.useState)(()=>_9()),r=(0,C.useRef)(null);return(0,C.useEffect)(()=>{if(r.current!==null&&(window.clearTimeout(r.current),r.current=null),!e)return;let t=()=>{let e=_9();n(t=>t.pulse===e.pulse?t:e),r.current=window.setTimeout(t,e.msToNext)};return t(),()=>{r.current!==null&&window.clearTimeout(r.current),r.current=null}},[e]),t}function b9(e){let[t,n]=(0,C.useState)(qn/1e3),r=(0,C.useRef)(null);return(0,C.useEffect)(()=>{if(r.current!==null&&(cancelAnimationFrame(r.current),r.current=null),!e)return;let t=()=>{let e=i9-_9().μInPulse,i=Number(e)*qn/1e6;n(Math.max(0,i/1e3)),r.current=requestAnimationFrame(t)};return r.current=requestAnimationFrame(t),()=>{r.current!==null&&cancelAnimationFrame(r.current),r.current=null}},[e]),e?t:null}function x9(){return _9().pulse}var S9=()=>{let e=(0,C.useRef)(null),t=(0,C.useRef)(null),n=(0,C.useRef)(null),r=(0,C.useRef)(null),i=y9(!0),a=(0,C.useMemo)(()=>v9(i.pμ),[i.pμ]);b9(!0);let o=a.pulse;(0,C.useMemo)(()=>`${a.beat}:${String(a.stepIndex).padStart(2,`0`)}`,[a.beat,a.stepIndex]);let[s,c]=(0,C.useState)(null),[l,u]=(0,C.useState)(null),[d,p]=(0,C.useState)(null),[m,h]=(0,C.useState)(null),[g,_]=(0,C.useState)(null),[v,y]=(0,C.useState)(null),[b,x]=(0,C.useState)(null),[S,w]=(0,C.useState)(null),[T,E]=(0,C.useState)(null),[D,k]=(0,C.useState)(null),[A,j]=(0,C.useState)(null),[M,N]=(0,C.useState)(`PHI`),[P,F]=(0,C.useState)(``),[I,L]=(0,C.useState)(``),[R,z]=(0,C.useState)(`idle`),[B,V]=(0,C.useState)(`summary`),[H,U]=(0,C.useState)(null),[ee,te]=(0,C.useState)(!1),[ne,re]=(0,C.useState)(null),[ie,ae]=(0,C.useState)(!1),[oe,se]=(0,C.useState)(``),[ce,le]=(0,C.useState)(``),[ue,de]=(0,C.useState)(!1),[fe,pe]=(0,C.useState)(!1),[me,he]=(0,C.useState)(null),[ge,_e]=(0,C.useState)(!1);(0,C.useEffect)(()=>{let e=n.current;e&&(ge?e.setAttribute(`data-rotate`,`true`):e.removeAttribute(`data-rotate`))},[ge]);let[ve,ye]=(0,C.useState)(null);(0,C.useEffect)(()=>{(async()=>{try{ye(await X5())}catch(e){Mo(`loadOrCreateKeypair`,e)}})()},[]),(0,C.useEffect)(()=>{let e=!0;return(async()=>{try{let t=await fetch(`/verification_key.json`,{cache:`no-store`});if(!t.ok)return;let n=await t.json();if(!e)return;window.SIGIL_ZK_VKEY=n}catch(e){Mo(`fetch(/verification_key.json)`,e)}})(),()=>{e=!1}},[]);let[be,xe]=(0,C.useState)(null),[Se,Ce]=(0,C.useState)(null),we=()=>tc(n.current),Te=()=>{U(null),z(`idle`),V(`summary`),te(!1),F(``),L(``),j(null),e.current&&(e.current.value=``),t.current&&(t.current.value=``),n.current?.close(),n.current?.setAttribute(`data-open`,`false`)},Ee=(0,C.useMemo)(()=>ss({meta:m,sigilSvgRaw:me,verifyUrl:oe||(typeof window<`u`?window.location.href:``),pulseNow:o}),[m,me,oe,o]),De=()=>nc(n.current,()=>{let e=r.current;if(!e)return;let t=ss({meta:m,sigilSvgRaw:me,verifyUrl:oe||(typeof window<`u`?window.location.href:``),pulseNow:o}),n={getNoteData:async()=>t};window.KKVerifier=n;try{window.dispatchEvent(new CustomEvent(`kk:note-data`,{detail:t}))}catch(e){Mo(`dispatch(kk:note-data)`,e)}tc(e),pe(!0)}),Oe=()=>{let e=r.current;e?.close(),e?.setAttribute(`data-open`,`false`),pe(!1)},ke=()=>nc(n.current,()=>de(!0)),Ae=()=>de(!1),je=async e=>{if(!m)return;let t=gu(m,e);h(t),p(JSON.stringify(t,null,2)),s&&c7(await r7(s,t),`${s7(`sigil_with_valuation`,t.pulse??0,o)}.svg`),de(!1)},Me=(0,C.useCallback)(async e=>{let t=e.transfers??[],n=await(await O(async()=>{let{computeHeadWindowRoot:e}=await import(`./sigilUtils-BWqerTXt.js`);return{computeHeadWindowRoot:e}},[])).computeHeadWindowRoot(t);if(e.transfersWindowRoot=n,t.length>0){let r=await Promise.all(t.map(Ns)),i=r.length-1,a=await Ts(r,i),o=await Es(n,a),s=await v7(e,{kind:`head`,windowMerkleRoot:n,transferProof:a});re({ok:o&&s,index:i,root:n})}else re(null);try{e.transfersWindowRootV14=await ws(await Promise.all((e.hardenedTransfers??[]).map(async e=>_s(ks({previousHeadRoot:e.previousHeadRoot,senderPubKey:e.senderPubKey,senderSig:e.senderSig,senderKaiPulse:e.senderKaiPulse,nonce:e.nonce,transferLeafHashSend:e.transferLeafHashSend,receiverPubKey:e.receiverPubKey,receiverSig:e.receiverSig,receiverKaiPulse:e.receiverKaiPulse,transferLeafHashReceive:e.transferLeafHashReceive,zkSend:e.zkSend??null,zkReceive:e.zkReceive??null})))))}catch(e){Mo(`refreshHeadWindow.buildMerkleRoot(v14)`,e)}try{await D7(e),h({...e})}catch(e){Mo(`refreshHeadWindow.verifyZkOnHead`,e)}return e},[]),Ne=(0,C.useCallback)(async e=>{let t=e.canonicalHash?.toLowerCase()||(await _s(`${e.pulse}|${e.beat}|${e.stepIndex}|${e.chakraDay}`)).toLowerCase();return e.childOfHash?.toLowerCase()&&(e.canonicalHash?.toLowerCase()??``)!==t?!0:(e.canonicalHash?.toLowerCase()??``)!==t},[]),Pe=(0,C.useCallback)(async e=>{let t=e.canonicalHash?.toLowerCase()||(await _s(`${e.pulse}|${e.beat}|${e.stepIndex}|${e.chakraDay}`)).toLowerCase();if(await Ne(e)){let t=e.canonicalHash.toLowerCase(),n=!!e.sendLock?.used,r=!!(e.transfers??[]).slice(-1)[0]?.receiverSignature;return{canonical:t,context:n||r?`parent`:`derivative`}}let n=(e.transfers??[]).slice(-1)[0],r=(e.hardenedTransfers??[]).slice(-1)[0];if(!(n&&!n.receiverSignature))return{canonical:t,context:`parent`};let i=n?await Fs(n):``,a=r?.previousHeadRoot||e.transfersWindowRootV14||e.transfersWindowRoot||``;return{canonical:(await _s(ks({parent:t,nonce:e.transferNonce||``,senderStamp:n?.senderStamp||``,senderKaiPulse:n?.senderKaiPulse||0,prevHead:a,leafSend:i}))).toLowerCase(),context:`derivative`}},[Ne]),Fe=async e=>{let t=e.target.files?.[0];if(!t)return;try{he(await t.text())}catch(e){Mo(`handleSvg.readFile`,e),he(null)}u(t.name||null),U(null),j(null),V(`summary`),te(!1);let n=URL.createObjectURL(t);c(n);let{meta:r,contextOk:i,typeOk:a}=await t7(t);r.segmentSize??=hs;let o=(r.segments??[]).reduce((e,t)=>e+(t.count||0),0);typeof r.cumulativeTransfers!=`number`&&(r.cumulativeTransfers=o+(r.transfers?.length??0)),(r.segments?.length??0)>0&&!r.segmentsMerkleRoot&&(r.segmentsMerkleRoot=await ws((r.segments??[]).map(e=>e.root)));let{sig:s,rgb:l}=await n7(n,typeof r.pulse==`number`?r.pulse:x9());E(s),k(l);let d=await As(r);_(d);let f=d&&r.kaiSignature?d.toLowerCase()===r.kaiSignature.toLowerCase():null;if(y(f),r.kaiSignature){let e=await js(r.kaiSignature);x(e),w(r.userPhiKey?e===r.userPhiKey:null)}else x(null),w(null);try{if(r.creatorPublicKey){let e=await Ss(r.creatorPublicKey);r.userPhiKey||=e}}catch(e){Mo(`handleSvg.phiFromPublicKey`,e)}let m=typeof r.pulse==`number`&&typeof r.beat==`number`&&typeof r.stepIndex==`number`&&typeof r.chakraDay==`string`,g=r.transfers?.slice(-1)[0],v=g?.receiverSignature||g?.senderSignature||null,b=v&&s?v===s:null,S=!!(r.transfers&&r.transfers.length>0),C=!!(g&&!g.receiverSignature),T=!!(g&&g.receiverSignature),D=!r.kaiSignature,O=await Me(r),A=null;try{let e=await Pe(O);xe(e.canonical),Ce(e.context),A=e.context}catch(e){Mo(`computeEffectiveCanonical`,e),xe(null),Ce(null)}let{used:M,expired:P}=cs(O,x9()),{expired:I}=ls(O,x9());h(O),p(JSON.stringify(O,null,2)),z(us({contextOk:i,typeOk:a,hasCore:m,contentSigMatches:f,isOwner:b,hasTransfers:S,lastOpen:C,lastClosed:T,isUnsigned:D,childUsed:M,childExpired:P,parentOpenExpired:I,isChildContext:A===`derivative`})),N(`PHI`),F(``),L(``),we(),e.target&&(e.target.value=``)},Ie=async e=>{let t=e.target.files?.[0];t&&j(await l7(t))},Le=async()=>{if(!m||!s)return;let e={...m},t=x9();if(!e.kaiSignature){let t=await As(e);if(!t){U(`Cannot compute kaiSignature — missing core fields.`);return}e.kaiSignature=t}!e.userPhiKey&&e.kaiSignature&&(e.userPhiKey=await js(e.kaiSignature)),typeof e.kaiPulse!=`number`&&(e.kaiPulse=t);try{!e.creatorPublicKey&&ve&&(e.creatorPublicKey=ve.spkiB64u)}catch(e){Mo(`sealUnsigned.creatorPublicKey`,e)}c7(await r7(s,e),`${o7(`sigil_sealed`,t)}.svg`);let n=await Me(e);h(n),p(JSON.stringify(n,null,2)),z(e=>e===`unsigned`?`readySend`:e),U(null)};async function Re(e,t){let n=JSON.parse(JSON.stringify(e));return n.canonicalHash=t.childCanonical,n.childOfHash=t.parentCanonical,n.childAllocationPhi=t.allocationPhiStr,n.childIssuedPulse=t.issuedPulse,n.childClaim={steps:7,expireAtPulse:t.issuedPulse+77},n.sendLock={nonce:e.transferNonce,used:!1},n.branchBasePhi=t.allocationPhiStr,n.branchSpentPhi=`0`,n}let ze=(0,C.useCallback)(async e=>{let t=e.canonicalHash?.toLowerCase()||(await _s(`${e.pulse}|${e.beat}|${e.stepIndex}|${e.chakraDay}`)).toLowerCase(),r=(e.transfers??[]).slice(-1)[0],i=(e.hardenedTransfers??[]).slice(-1)[0],a=r?await Fs(r):``,o=(await _s(ks({parent:t,nonce:e.transferNonce||``,senderStamp:r?.senderStamp||``,senderKaiPulse:r?.senderKaiPulse||0,prevHead:i?.previousHeadRoot||e.transfersWindowRootV14||e.transfersWindowRoot||``,leafSend:a}))).toLowerCase(),s=e.transferNonce||Ws(),c=e.chakraDay||`Root`,l={pulse:e.pulse,beat:e.beat,stepIndex:e.stepIndex,chakraDay:c,kaiSignature:e.kaiSignature,userPhiKey:e.userPhiKey},u={steps:7,expireAtPulse:(r?.senderKaiPulse??x9())+77,stepsPerBeat:e.stepsPerBeat??44},d;try{if(r?.payload?.mime?.startsWith(`application/vnd.kairos-exhale`)){let e=JSON.parse(Po(r.payload.encoded));e?.kind===`exhale`&&(d={unit:e.unit,amountPhi:e.amountPhi,amountUsd:e.amountUsd,usdPerPhi:e.usdPerPhi})}}catch(e){Mo(`shareTransferLink.previewDecode`,e)}let f={...l,canonicalHash:o,parentHash:t,transferNonce:s,claim:u,preview:d},p=``;try{let{makeSigilUrl:e}=await O(async()=>{let{makeSigilUrl:e}=await import(`./sigilUrl-w0EYDFh2.js`);return{makeSigilUrl:e}},[]);p=e(o,l)}catch(e){Mo(`shareTransferLink.makeSigilUrl`,e);let t=new URL(typeof window<`u`?window.location.href:`http://localhost`);t.pathname=`/s/${o}`,p=t.toString()}let m;try{let{encodeSigilHistory:t}=await O(async()=>{let{encodeSigilHistory:e}=await import(`./sigilUrl-w0EYDFh2.js`);return{encodeSigilHistory:e}},[]),n=[];for(let t of e.transfers??[])!t?.senderSignature||typeof t.senderKaiPulse!=`number`||n.push(typeof t.receiverSignature==`string`&&typeof t.receiverKaiPulse==`number`?{s:t.senderSignature,p:t.senderKaiPulse,r:t.receiverSignature}:{s:t.senderSignature,p:t.senderKaiPulse});let r=t(n);m=r.startsWith(`h:`)?r.slice(2):r}catch(e){Mo(`shareTransferLink.encodeSigilHistory`,e)}let h=qs(p,f,s,m);se(h),le(o),_e(!0),r9(h),nc(n.current,()=>ae(!0));try{fs([t],s)}catch(e){Mo(`shareTransferLink.publishRotation`,e)}},[]),Be=(0,C.useCallback)(async e=>{h(e),p(JSON.stringify(e,null,2));let t=typeof e.pulse==`number`&&typeof e.beat==`number`&&typeof e.stepIndex==`number`&&typeof e.chakraDay==`string`,n=e.transfers?.slice(-1)[0],r=n?.receiverSignature||n?.senderSignature||null,i=r&&T?r===T:null,a=!!(e.transfers&&e.transfers.length>0),o=!!(n&&!n.receiverSignature),s=!!(n&&n.receiverSignature),c=!e.kaiSignature,l=null;try{let t=await Pe(e);xe(t.canonical),Ce(t.context),l=t.context}catch(e){Mo(`syncMetaAndUi.computeEffectiveCanonical`,e),xe(null),Ce(null)}let{used:u,expired:d}=cs(e,x9()),{expired:f}=ls(e,x9());z(us({contextOk:!0,typeOk:!0,hasCore:t,contentSigMatches:g&&e.kaiSignature?g.toLowerCase()===e.kaiSignature.toLowerCase():null,isOwner:i,hasTransfers:a,lastOpen:o,lastClosed:s,isUnsigned:c,childUsed:u,childExpired:d,parentOpenExpired:f,isChildContext:l===`derivative`}))},[T,Pe,g]),Ve=(0,C.useCallback)(e=>{let t=(e||``).trim();return t?(t.startsWith(`.`)&&(t=`0`+t),t=t.replace(/\.?$/,e=>/\.\d/.test(t)?e:``),t):`0`},[]),He=(0,C.useCallback)(e=>new Intl.NumberFormat(void 0,{minimumFractionDigits:2,maximumFractionDigits:2,useGrouping:!0}).format(Math.max(0,e||0)),[]),Ue=(0,C.useMemo)(()=>typeof navigator<`u`&&typeof navigator.share==`function`,[]);(0,C.useEffect)(()=>()=>{if(s?.startsWith(`blob:`))try{URL.revokeObjectURL(s)}catch(e){Mo(`revokeObjectURL`,e)}},[s]);let We=(0,C.useMemo)(()=>{if(!m)return null;let e=m,t=typeof e.stepsPerBeat==`number`?e.stepsPerBeat:12,n=e.transfersWindowRoot??e.transfersWindowRootV14??``;return{pulse:m.pulse,beat:m.beat,stepIndex:m.stepIndex,stepsPerBeat:t,chakraDay:m.chakraDay||`Root`,kaiSignature:m.kaiSignature??``,userPhiKey:m.userPhiKey??``,transfersWindowRoot:n,canonicalContext:Se??void 0,childOfHash:e.childOfHash??void 0,sendLock:e.sendLock??void 0,childClaim:e.childClaim??void 0,childAllocationPhi:e.childAllocationPhi??void 0,branchBasePhi:e.branchBasePhi??void 0,valuationSource:e.valuationSource,stats:e.stats,fileName:l??void 0}},[m,Se,l]),Ge=(0,C.useMemo)(()=>{if(!m)return null;let e=sc(m,[`chakraGate`,`valuationSource.chakraGate`])||cc(m,`data-chakra-gate`)||null;return e?e.replace(/\bgate\b/gi,``).replace(/\s{2,}/g,` `).trim()||e:null},[m]),[Ke,qe]=(0,C.useState)(null);(0,C.useEffect)(()=>{let e=!1;return(async()=>{if(!We){qe(null);return}let t=(m?.canonicalHash)?.toLowerCase()||(await _s(`${We.pulse}|${We.beat}|${We.stepIndex}|${We.chakraDay}`)).toLowerCase();try{let{seal:n}=await hu(We,o,_s,m?.transfersWindowRoot||m?.transfersWindowRootV14||``);e||qe({hash:t,value:n.valuePhi??0,pulseCreated:We.pulse??o,meta:We})}catch(n){Mo(`buildValueSeal`,n),e||qe({hash:t,value:0,pulseCreated:We.pulse??o,meta:We})}})(),()=>{e=!0}},[We,m,o]),(0,C.useEffect)(()=>{!fe||me||!s||(async()=>{try{he(await fetch(s).then(e=>e.text()))}catch(e){Mo(`ensureRawSvgForNote`,e)}})()},[fe,me,s]);let Je=Wu,{usdPerPhi:Ye}=(0,C.useMemo)(()=>{try{return{usdPerPhi:Qu({meta:We??{pulse:0,beat:0,stepIndex:0,stepsPerBeat:12,chakraDay:`Root`,kaiSignature:``,userPhiKey:``,transfersWindowRoot:``},nowPulse:o,usd:100,currentStreakDays:0,lifetimeUsdSoFar:0},Je).usdPerPhi??0}}catch(e){return Mo(`quotePhiForUsd`,e),{usdPerPhi:0}}},[We,o,Je]),Xe=(0,C.useMemo)(()=>Ro(m?.branchBasePhi??``),[m]),Ze=(0,C.useMemo)(()=>Ro(m?.branchSpentPhi??`0`),[m]),Qe=(0,C.useMemo)(()=>{let e=m?.transfers??[];for(let t=e.length-1;t>=0;--t)if(e[t]?.receiverSignature)return t;return e.length>0?e.length-1:-1},[m?.transfers]),$e=(0,C.useMemo)(()=>{let e=m?.transfers??[],t=0;for(let n=e.length-1;n>=0;--n)if(e[n]?.receiverSignature&&++t===2)return n;return-1},[m?.transfers]),et=(0,C.useMemo)(()=>(m?.transfers??[]).slice(-1)[0],[m?.transfers]),tt=(0,C.useMemo)(()=>Se===`derivative`,[Se]),nt=(0,C.useMemo)(()=>{if(tt){let e=m?.childAllocationPhi;if(e){let t=Ro(e);if(t>0n)return t}let t=Ro(zo(Go(et)));return t>0n?t:0n}if(Xe>0n)return Xe;if(Qe>=0&&m?.transfers){let e=Go(m.transfers[Qe]);return e>0n?e:0n}return Ro(String(Ke?.value??0)||`0`)},[tt,m,et,Xe,Qe,Ke]),rt=(0,C.useMemo)(()=>{try{let e=m?.transfers??[],t=0n;for(let n=Math.max(0,Qe+1);n{try{let e=m?.transfers??[];if(Qe<=0)return 0n;let t=Math.max(0,$e+1),n=Math.max(t,Qe),r=0n;for(let i=t;i{if(!be)return 0n;try{return K7(be)}catch(e){return Mo(`ledgerSpentScaled`,e),0n}},[be]),ot=(0,C.useMemo)(()=>Ze>it?Ze:it,[Ze,it]),st=(0,C.useMemo)(()=>tt?0n:ot+rt,[tt,ot,rt]),ct=(0,C.useMemo)(()=>at>st?at:st,[at,st]),lt=(0,C.useMemo)(()=>nt>ct?nt-ct:0n,[nt,ct]),ut=(0,C.useMemo)(()=>Uo(Ho(lt,4),4),[lt]),dt=(0,C.useMemo)(()=>Jo(Number(zo(lt))),[lt]),ft=(0,C.useMemo)(()=>Ro((Ye||0).toFixed(18)),[Ye]),pt=(0,C.useMemo)(()=>Number(zo(Bo(lt,ft)))||0,[lt,ft]),[mt,ht]=(0,C.useState)(`flat`),[gt,_t]=(0,C.useState)(`flat`),[vt,yt]=(0,C.useState)(!1),[bt,xt]=(0,C.useState)(!1),St=(0,C.useRef)(dt),Ct=(0,C.useRef)(pt),wt=(0,C.useRef)(dt),Tt=(0,C.useRef)(Math.round(pt*100)/100),Et=(0,C.useRef)(null),Dt=(0,C.useRef)(null);(0,C.useEffect)(()=>{St.current=dt},[dt]),(0,C.useEffect)(()=>{Ct.current=pt},[pt]),(0,C.useEffect)(()=>{let e=1e-9,t=()=>{let t=St.current,n=t-wt.current,r=n>e?`up`:n<-e?`down`:`flat`;r!==`flat`&&Math.abs(n)>e?(ht(r),yt(!0),Et.current&&window.clearTimeout(Et.current),Et.current=window.setTimeout(()=>yt(!1),420)):ht(`flat`),wt.current=t;let i=Math.round(Ct.current*100)/100,a=i-Tt.current,o=a>e?`up`:a<-e?`down`:`flat`;o!==`flat`&&Math.abs(a)>e?(_t(o),xt(!0),Dt.current&&window.clearTimeout(Dt.current),Dt.current=window.setTimeout(()=>xt(!1),420)):_t(`flat`),Tt.current=i};wt.current=St.current,Tt.current=Math.round(Ct.current*100)/100;let n=window.setInterval(t,EC);return()=>{window.clearInterval(n),Et.current&&window.clearTimeout(Et.current),Dt.current&&window.clearTimeout(Dt.current)}},[]);let[Ot,kt]=(0,C.useState)(!1),[At,jt]=(0,C.useState)(`phi`),[Mt,Nt]=(0,C.useState)(0),Pt=(0,C.useCallback)(e=>{jt(e),kt(!0),Nt(e=>e+1)},[]);(0,C.useEffect)(()=>{Ot&&Nt(e=>e+1)},[Ot,At]);let Ft=(0,C.useCallback)(()=>{kt(!1)},[]);(0,C.useEffect)(()=>{if(!Ot)return;let e=e=>{e.key===`Escape`&&Ft()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Ot,Ft]);let It=(0,C.useMemo)(()=>{if(M===`PHI`){let e=$o(Qo(Ve(P))),t=Bo(Ro(e),ft),n=Number(zo(t));return{displayLeftLabel:`Φ`,displayRight:Number.isFinite(n)?`$ ${He(n)}`:`$ 0.00`,phiStringToSend:e,usdNumberAtSend:Number.isFinite(n)?n:0}}let e=Ro(I),t=Vo(e,ft),n=Uo(Ho(t,6),6);return{displayLeftLabel:`$`,displayRight:`≈ Φ ${Uo(Ho(t,4),4)}`,phiStringToSend:n,usdNumberAtSend:Number(zo(e))||0}},[M,P,I,ft,He,Ve]),Lt=(0,C.useMemo)(()=>Ro(It.phiStringToSend||`0`)>0n&&Ro(It.phiStringToSend||`0`)<=lt,[It.phiStringToSend,lt]),Rt=(0,C.useCallback)(async()=>{if(!m||!s)return;let e=await r7(s,m),t=await fetch(e).then(e=>e.blob()),n=null;try{n=await i7(e,1024)}catch(e){Mo(`pngBlobFromSvgDataUrl`,e)}let{default:r}=await O(async()=>{let{default:e}=await import(`./jszip.min-BlBKh1bQ.js`).then(f(1));return{default:e}},[]),i=new r,a=s7(`sigil_bundle`,m.pulse??0,m.transfers?.slice(-1)[0]?.senderKaiPulse??m.kaiPulse??x9());i.file(`${a}.svg`,t),n&&i.file(`${a}.png`,n),c7(await i.generateAsync({type:`blob`}),`${a}.zip`)},[m,s]),zt=(0,C.useMemo)(()=>(l||``).toLowerCase().includes(`sigil_send`),[l]),Bt=async()=>{if(!m||!s||!T)return;if(m.kaiSignature&&g&&m.kaiSignature.toLowerCase()!==g.toLowerCase()){U(`Content signature mismatch — cannot send.`),z(`sigMismatch`);return}let e={...m};if(!e.kaiSignature){let t=await As(e);if(!t){U(`Cannot compute kaiSignature — missing core fields.`);return}e.kaiSignature=t,e.userPhiKey||=await js(t)}typeof e.kaiPulse!=`number`&&(e.kaiPulse=x9());let t=x9(),n=await _s(`${T}-${e.pulse??0}-${t}`),r=(It.phiStringToSend||``).trim(),i=Ro(r);if(i<=0n){U(`Enter a Φ amount greater than zero.`);return}if(i>lt){U(`Exhale exceeds resonance Φ — requested Φ ${Uo(i,4)} but only Φ ${ut} remains on this glyph.`);return}let a=Number.isFinite(It.usdNumberAtSend)?Math.max(0,It.usdNumberAtSend):0,o;{let n={kind:`exhale`,unit:M,amountPhi:r,amountUsd:a.toFixed(2),usdPerPhi:Ye||0,atPulse:t,kaiSignature:e.kaiSignature||``,userPhiKey:e.userPhiKey||``};o={name:`exhale_${r.replace(/\./g,`_`)}phi.json`,mime:`application/vnd.kairos-exhale+json`,size:No(JSON.stringify(n)).length,encoded:No(JSON.stringify(n))}}!o&&A&&(o=A);let c={senderSignature:T,senderStamp:n,senderKaiPulse:t,payload:o??void 0},l={...e,"@context":e[`@context`]??`https://schema.phi.network/sigil/v1`,type:e.type??`application/phi.kairos.sigil+svg`,canonicalHash:e.canonicalHash||void 0,transferNonce:e.transferNonce||Ws(),transfers:[...e.transfers??[],c],segmentSize:e.segmentSize??2e3};try{let e=Ro(m?.branchSpentPhi??`0`)+i;l.branchBasePhi=m?.branchBasePhi??zo(nt),l.branchSpentPhi=zo(e)}catch(e){Mo(`send.persistBranchProgress`,e)}let u=``,d=``,f=``,p=``;try{if(u=l.canonicalHash?.toLowerCase()||(await _s(`${l.pulse}|${l.beat}|${l.stepIndex}|${l.chakraDay}`)).toLowerCase(),ve){l.creatorPublicKey??=ve.spkiB64u,p=await zs(l,l.hardenedTransfers?.length??0),f=await Fs(c);let e=l.transferNonce,n=await O(()=>import(`./sigilUtils-BWqerTXt.js`),[]),r=n.buildSendMessageV14(l,{previousHeadRoot:p,senderKaiPulse:t,senderPubKey:l.creatorPublicKey,nonce:e,transferLeafHashSend:f}),i=await Z5(ve.priv,r),a={previousHeadRoot:p,senderPubKey:l.creatorPublicKey,senderSig:i,senderKaiPulse:t,nonce:e,transferLeafHashSend:f};if(window.SIGIL_ZK?.provideSendProof)try{let t=await window.SIGIL_ZK.provideSendProof({meta:l,leafHash:f,previousHeadRoot:p,nonce:e});if(t){a.zkSendBundle={scheme:`groth16`,curve:`BLS12-381`,proof:t.proof,publicSignals:t.publicSignals,vkey:t.vkey};let e=await n.hashAny(t.publicSignals),r=await n.hashAny(t.proof),i=t.vkey??l.zkVerifyingKey??window.SIGIL_ZK_VKEY;a.zkSend={scheme:`groth16`,curve:`BLS12-381`,publicHash:e,proofHash:r,vkeyHash:i?await n.hashAny(i):void 0}}}catch(e){Mo(`provideSendProof`,e)}l.hardenedTransfers=[...l.hardenedTransfers??[],a]}d=(await _s(ks({parent:u,nonce:l.transferNonce||``,senderStamp:c.senderStamp||``,senderKaiPulse:c.senderKaiPulse||0,prevHead:p||l.transfersWindowRootV14||l.transfersWindowRoot||``,leafSend:f}))).toLowerCase();let e={parentCanonical:u,childCanonical:d,amountPhiScaled:Ro(r).toString(),senderKaiPulse:t,transferNonce:l.transferNonce,senderStamp:n,previousHeadRoot:p,transferLeafHashSend:f};try{await U7(e)}catch(e){Mo(`recordSend`,e)}try{rc().registerSend?.(e)}catch(e){Mo(`__SIGIL__.registerSend`,e)}try{window.dispatchEvent(new CustomEvent(`sigil:sent`,{detail:e}))}catch(e){Mo(`dispatchEvent(sigil:sent)`,e)}}catch(e){Mo(`send.hardenedBuild/ledger`,e)}if(c7(await r7(s,await Re(l,{parentCanonical:u,childCanonical:d,allocationPhiStr:r,issuedPulse:t})),`${s7(`sigil_send`,l.pulse??0,t)}.svg`),(l.transfers??[]).length>=(l.segmentSize??2e3)){let{meta:e,segmentFileBlob:n}=await _7(l);n&&c7(n,`sigil_segment_${e.pulse??0}_${String((e.segments?.length??1)-1).padStart(6,`0`)}.json`),c7(await r7(s,e),`${s7(`sigil_head_after_seal`,e.pulse??0,t)}.svg`);let r=await Me(e);await Be(r),U(null),F(``),L(``),await ze(r);return}let h=await Me(l);await Be(h),U(null),F(``),L(``),await ze(h)},Vt=async()=>{if(!m||!s||!T)return;if(Se===`parent`){let{expired:e}=ls(m,x9());if(e){U(`This open send has expired.`);return}}let{used:e,expired:t}=cs(m,x9());if(e){U(`This transfer link has already been used.`);return}if(t){U(`This transfer link has expired.`),z(`complete`);return}let n=m.transfers?.slice(-1)[0];if(!n||n.receiverSignature)return;let r=x9(),i={...n,receiverSignature:T,receiverStamp:await _s(`${T}-${n.senderStamp}-${r}`),receiverKaiPulse:r},a={...m,transfers:[...(m.transfers??[]).slice(0,-1),i]};try{if(ve&&(a.hardenedTransfers?.length??0)>0){let e=a.hardenedTransfers[a.hardenedTransfers.length-1];if(!e.receiverSig){a.creatorPublicKey??=ve.spkiB64u;let t=await Ns(i),n=await O(()=>import(`./sigilUtils-BWqerTXt.js`),[]),o=n.buildReceiveMessageV14({previousHeadRoot:e.previousHeadRoot,senderSig:e.senderSig,receiverKaiPulse:r,receiverPubKey:a.creatorPublicKey,transferLeafHashReceive:t}),s=await Z5(ve.priv,o),c={...e,receiverPubKey:a.creatorPublicKey,receiverSig:s,receiverKaiPulse:r,transferLeafHashReceive:t};if(window.SIGIL_ZK?.provideReceiveProof)try{let r=await window.SIGIL_ZK.provideReceiveProof({meta:a,leafHash:t,previousHeadRoot:e.previousHeadRoot,linkSig:e.senderSig});if(r){c.zkReceiveBundle={scheme:`groth16`,curve:`BLS12-381`,proof:r.proof,publicSignals:r.publicSignals,vkey:r.vkey};let e=await n.hashAny(r.publicSignals),t=await n.hashAny(r.proof),i=r.vkey??a.zkVerifyingKey??window.SIGIL_ZK_VKEY;c.zkReceive={scheme:`groth16`,curve:`BLS12-381`,publicHash:e,proofHash:t,vkeyHash:i?await n.hashAny(i):void 0}}}catch(e){Mo(`provideReceiveProof`,e)}a.hardenedTransfers=[...a.hardenedTransfers.slice(0,-1),c];try{let t=a.childOfHash?.toLowerCase()||(await _s(`${a.pulse}|${a.beat}|${a.stepIndex}|${a.chakraDay}`)).toLowerCase();e.transferLeafHashSend&&W7(t,e.transferLeafHashSend)}catch(e){Mo(`ledger.markConfirmedByLeaf`,e)}}}}catch(e){Mo(`receive.hardenedSeal`,e)}try{await Ne(a)&&(a.sendLock={...a.sendLock??{nonce:a.transferNonce},used:!0,usedPulse:r})}catch(e){Mo(`receive.setUsedLock`,e)}c7(await r7(s,a),`${s7(`sigil_receive`,a.pulse??0,r)}.svg`),await Be(await Me(a)),U(null)},Ht=(0,C.useCallback)(async()=>{if(!m||!m.transfers?.length)return;if(zt){U(`Segmentation is disabled on SEND sigils.`);return}let{meta:e,segmentFileBlob:t}=await _7(m);t&&c7(t,`sigil_segment_${e.pulse??0}_${String((e.segments?.length??1)-1).padStart(6,`0`)}.json`),s&&c7(await r7(s,e),`${s7(`sigil_head_after_seal`,e.pulse??0,x9())}.svg`),await Be(await Me(e)),U(null)},[m,s,zt,Me,Be]),Ut=(0,C.useMemo)(()=>sc(m,[`frequencyHz`,`valuationSource.frequencyHz`])||cc(m,`data-frequency-hz`),[m]),Wt=(0,C.useMemo)(()=>is(m??{}),[m]),Gt=(0,C.useMemo)(()=>{if(Se!==`derivative`)return null;let e=cs(m,o);if(!e.expireAt)return null;let t=Math.max(0,e.expireAt-o);return{leftPulses:t,leftSteps:Math.ceil(t/11),expireAt:e.expireAt}},[m,o,Se]),{used:Kt,expired:qt}=(0,C.useMemo)(()=>cs(m,o),[m,o]),Jt=(0,C.useMemo)(()=>ls(m,o).expired,[m,o]);function Yt({seriesKey:e,sampleMs:t,valuePhi:n,usdPerPhi:r,maxPoints:i=2048,snapKey:a}){let[o,s]=C.useState([]),c=C.useRef([]),l=C.useRef(n),u=C.useRef(r);C.useEffect(()=>{Number.isFinite(n)&&(l.current=n)},[n]),C.useEffect(()=>{Number.isFinite(r)&&r>0&&(u.current=r)},[r]);let d=C.useCallback(()=>{let e=x9(),t=Number.isFinite(l.current)?l.current:0,n=Number.isFinite(u.current)&&u.current>0?u.current:0,r=c.current;if(!r.length){let r=[{i:e-1,value:t,fx:n},{i:e,value:t,fx:n}];c.current=r,s(r);return}let a=r[r.length-1],o;o=a?.i===e?[...r.slice(0,-1),{...a,value:t,fx:n}]:typeof a?.i==`number`&&a.ii&&o.splice(0,o.length-i),c.current=o,s(o)},[i]);return C.useEffect(()=>{c.current=[],s([]),d()},[e,d]),C.useEffect(()=>{d()},[n,r,d]),C.useEffect(()=>{typeof a==`number`&&d()},[a,d]),C.useEffect(()=>{let e=window.setInterval(()=>{let e=x9(),t=c.current;if(t[t.length-1]?.i===e)return;let n={i:e,value:l.current,fx:u.current},r=t.length?[...t,n]:[n];r.length>i&&r.splice(0,r.length-i),c.current=r,s(r)},t);return()=>window.clearInterval(e)},[t,i]),o}let Xt=Yt({seriesKey:(0,C.useMemo)(()=>be||(m?`${m.pulse??`x`}|${m.beat??`x`}|${m.stepIndex??`x`}|${m.chakraDay??`x`}`:`none`),[be,m]),sampleMs:EC,valuePhi:dt,usdPerPhi:Ye,maxPoints:4096,snapKey:Mt}),Zt=(0,C.useMemo)(()=>{let e=Number(Ke?.value);return Number.isFinite(e)&&e>0?e:dt},[Ke,dt]);return(0,W.jsxs)(`div`,{className:`verifier-stamper`,role:`application`,style:{maxWidth:`100vw`,overflowX:`hidden`},children:[(0,W.jsx)(`div`,{className:`toolbar`,children:(0,W.jsxs)(`div`,{className:`toolbar-main`,children:[(0,W.jsx)(`div`,{className:`brand-lockup`,"aria-label":`Kairos live status`,children:(0,W.jsx)(`div`,{className:`brand-text`,children:(0,W.jsxs)(`div`,{className:`live-pulse`,children:[(0,W.jsx)(`span`,{className:`now`,children:`LIVE`}),(0,W.jsxs)(`span`,{className:`pulse-number`,children:[` ☤KAI `,o]})]})})}),(0,W.jsx)(`div`,{className:`toolbar-actions`,"aria-label":`Verifier actions`,children:(0,W.jsxs)(`button`,{className:`primary`,onClick:()=>e.current?.click(),type:`button`,children:[(0,W.jsx)(J7,{color:`#37FFE4`}),(0,W.jsxs)(`span`,{className:`phikey-label`,"aria-label":`PhiKey`,children:[(0,W.jsx)(`img`,{className:`phikey-mark`,src:`/phi.svg`,alt:`Φ`}),(0,W.jsx)(`span`,{className:`phikey-text`,children:`Key`})]})]})})]})}),(0,W.jsx)(`input`,{ref:e,type:`file`,accept:`.svg`,hidden:!0,onChange:Fe}),(0,W.jsx)(`dialog`,{ref:n,className:`glass-modal fullscreen`,id:`verifier-dialog`,"data-open":`false`,"aria-label":`Kai-Sigil Verifier Modal`,style:Y7.full,children:(0,W.jsxs)(`div`,{className:`modal-viewport`,style:Y7.viewport,children:[(0,W.jsxs)(`div`,{className:`modal-topbar`,style:Y7.gridBar,children:[(0,W.jsx)(`div`,{className:`status-strip`,"aria-live":`polite`,style:Y7.valueStrip,children:(0,W.jsx)(mc,{uiState:R,contentSigMatches:v,phiKeyMatches:S,meta:m,headProof:ne,canonicalContext:Se,childUsed:Kt,childExpired:qt,parentOpenExpired:Jt,isSendFilename:zt})}),(0,W.jsx)(`button`,{className:`close-btn holo`,"data-aurora":`true`,"aria-label":`Close`,title:`Close`,onClick:Te,style:{justifySelf:`end`,marginRight:8},children:`×`})]}),s&&m&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`header`,{className:`modal-header`,style:{paddingInline:16},children:[(0,W.jsx)(`img`,{src:s,alt:`Sigil thumbnail`,width:64,height:64,style:Y7.headerImg}),(0,W.jsxs)(`div`,{className:`header-fields`,style:{minWidth:0},children:[(0,W.jsxs)(`h2`,{style:{overflowWrap:`anywhere`},children:[`Pulse `,(0,W.jsx)(`span`,{children:m.pulse??`—`})]}),(0,W.jsxs)(`p`,{children:[`Beat `,(0,W.jsx)(`span`,{children:m.beat??`—`}),` · Step `,(0,W.jsx)(`span`,{children:m.stepIndex??`—`}),` · Day:`,` `,(0,W.jsx)(`span`,{children:Wt??m.chakraDay??`—`})]}),(0,W.jsxs)(`div`,{className:`value-strip`,"aria-live":`polite`,children:[(0,W.jsxs)(Q7,{kind:`phi`,trend:mt,flash:vt,title:Se===`derivative`?`Resonance Φ for this derivative glyph`:`Resonance Φ on this glyph`,ariaLabel:`Open live chart for Φ value`,onClick:()=>Pt(`phi`),children:[(0,W.jsx)(`span`,{className:`sym`,children:`Φ`}),dt.toFixed(6)]}),(0,W.jsxs)(Q7,{kind:`usd`,trend:gt,flash:bt,title:`Indicative USD (issuance model)`,ariaLabel:`Open live chart for USD value`,onClick:()=>Pt(`usd`),children:[(0,W.jsx)(`span`,{className:`sym`,children:`$`}),He(pt)]})]}),zt&&(0,W.jsxs)(`div`,{className:`child-banner tooltip-container`,style:{fontSize:10,opacity:.9,marginTop:6},children:[(0,W.jsx)(`strong`,{children:`7 Steps from Exhale`}),` `,(0,W.jsx)(`span`,{className:`tooltip-trigger`,children:`INHALE:`}),(0,W.jsx)(`div`,{className:`tooltip`,children:`You have 7 steps (77 pulses) to inhale & seal this Sigil. After this period, INHALE is permanently finalized & the Sigil is eternally sealed.`})]})]})]}),Ot&&(0,W.jsx)(`div`,{className:`chart-popover-backdrop`,role:`dialog`,"aria-modal":`true`,"aria-label":`Live chart`,onMouseDown:Ft,onClick:Ft,style:Y7.popBg,children:(0,W.jsxs)(`div`,{className:`chart-popover`,onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),style:Y7.popCard,children:[(0,W.jsxs)(`div`,{className:`chart-popover-head`,style:Y7.popHead,children:[(0,W.jsx)(`div`,{style:Y7.popTitle,className:`chart-popover-title`,children:At===`phi`?`Φ Resonance · Live`:`$ Price · Live`}),(0,W.jsx)(`button`,{className:`close-btn holo`,"data-aurora":`true`,"aria-label":`Close chart`,title:`Close`,onClick:Ft,style:{width:40,height:40,display:`inline-flex`,alignItems:`center`,justifyContent:`center`},children:`×`})]}),(0,W.jsx)(`div`,{className:`chart-popover-body`,style:Y7.popBody,children:(0,W.jsx)(C.Suspense,{fallback:(0,W.jsx)(`div`,{style:{padding:16,color:`var(--dim)`},children:`Loading chart…`}),children:(0,W.jsx)(v6,{data:Xt,live:dt,pv:Zt,premiumX:1,momentX:1,colors:[`rgba(167,255,244,1)`],usdPerPhi:Ye,mode:At===`usd`?`usd`:`phi`,isChildGlyph:Se===`derivative`,reflowKey:Mt})})})]})}),(0,W.jsxs)(`nav`,{className:`tabs`,role:`tablist`,"aria-label":`Views`,style:Y7.stickyTabs,children:[(0,W.jsx)(`button`,{role:`tab`,"aria-selected":B===`summary`,className:B===`summary`?`active`:``,onClick:()=>V(`summary`),children:`Presence`}),(0,W.jsx)(`button`,{role:`tab`,"aria-selected":B===`lineage`,className:B===`lineage`?`active`:``,onClick:()=>V(`lineage`),children:`Stewardship`}),(0,W.jsx)(`button`,{role:`tab`,"aria-selected":B===`data`,className:B===`data`?`active`:``,onClick:()=>V(`data`),children:`Memory`}),(0,W.jsx)(`button`,{className:`secondary`,onClick:ke,disabled:!m,children:`Resonance`}),(0,W.jsx)(`button`,{className:`secondary`,onClick:De,disabled:!s,children:`Note`})]}),(0,W.jsxs)(`section`,{className:`modal-body`,role:`tabpanel`,style:Y7.modalBody,children:[B===`summary`&&(0,W.jsxs)(`div`,{className:`summary-grid`,children:[(0,W.jsx)(Z7,{k:`Now`,v:o}),Gt&&(0,W.jsx)(Z7,{k:`Inhale Seal:`,v:`${Gt.leftSteps} steps (${Gt.leftPulses} pulses) left`}),Se===`derivative`&&(()=>{let{expireAt:e}=cs(m,o);return typeof e==`number`&&Number.isFinite(e)?(0,W.jsx)(Z7,{k:`Inhale by:`,v:e}):null})(),m.userPhiKey&&(0,W.jsx)(Z7,{k:`Φ-Key:`,v:(0,W.jsxs)(W.Fragment,{children:[m.userPhiKey,b&&(S?(0,W.jsx)(`span`,{className:`chip ok`,children:`match`}):(0,W.jsx)(`span`,{className:`chip err`,children:`mismatch`}))]}),wide:!0,mono:!0}),m.kaiSignature&&(0,W.jsx)(Z7,{k:`Kai-Signature (Σ):`,v:(0,W.jsxs)(W.Fragment,{children:[m.kaiSignature,v===!0&&(0,W.jsx)(`span`,{className:`chip ok`,children:`match`}),v===!1&&(0,W.jsx)(`span`,{className:`chip err`,children:`mismatch`})]}),wide:!0,mono:!0}),Ut&&(0,W.jsx)(Z7,{k:`Frequency (Hz):`,v:Ut}),Ge&&(0,W.jsx)(Z7,{k:`Spiral Gate:`,v:Ge}),T&&(0,W.jsx)(Z7,{k:`PROOF OF BREATH™:`,v:T,wide:!0,mono:!0}),(0,W.jsx)(Z7,{k:`Stewardship Hash:`,v:be??`—`,wide:!0,mono:!0}),(0,W.jsx)(Z7,{k:Se===`derivative`?`Derivative Resonance`:`Resonance `,v:` Φ${ut}`}),(0,W.jsx)(Z7,{k:`Exhale key:`,v:m?.creatorPublicKey??`—`,wide:!0,mono:!0}),(0,W.jsx)(Z7,{k:`Exhale nonce:`,v:m.transferNonce??`—`,wide:!0,mono:!0}),(0,W.jsx)(Z7,{k:`Issued @ (derivative):`,v:m?.childIssuedPulse??`—`}),(0,W.jsx)(Z7,{k:`Derivative of (source):`,v:m?.childOfHash??`—`,wide:!0,mono:!0}),ne&&(0,W.jsx)(Z7,{k:`Latest proof:`,v:ne.ok?`#${ne.index+1} ✓`:`#${ne.index} ×`}),ne!==null&&(0,W.jsx)(Z7,{k:`Head proof root:`,v:ne.root,wide:!0,mono:!0}),(0,W.jsx)(Z7,{k:`Head proof root (v14):`,v:m?.transfersWindowRootV14??`—`,wide:!0,mono:!0}),Se===`parent`&&(()=>{let e=ls(m,o);return e.expireAt?(0,W.jsx)(Z7,{k:`Inhale expires @:`,v:e.expireAt}):null})(),Se===`derivative`&&m?.sendLock?.used&&(0,W.jsx)(Z7,{k:`One-time lock:`,v:`Used`}),(0,W.jsx)(Z7,{k:`Hardened transfers:`,v:m.hardenedTransfers?.length??0}),(0,W.jsx)(Z7,{k:`Segments:`,v:m.segments?.length??0}),(0,W.jsx)(Z7,{k:`Segment size:`,v:m.segmentSize??2e3}),(0,W.jsx)(Z7,{k:`Segment Depth:`,v:m.cumulativeTransfers??0}),(0,W.jsx)(Z7,{k:`Segment Tree Root:`,v:m.segmentsMerkleRoot??`—`,wide:!0,mono:!0}),D&&(0,W.jsx)(Z7,{k:`RGB seed:`,v:D.join(`, `)})]}),B===`lineage`&&(0,W.jsx)(`div`,{className:`lineage`,children:m.transfers?.length?(0,W.jsx)(`ol`,{className:`transfers`,children:m.transfers.map((e,t)=>{let n=!e.receiverSignature,r=m.hardenedTransfers?.[t],i=null;try{if(e.payload?.mime?.startsWith(`application/vnd.kairos-exhale`)){let t=JSON.parse(Po(e.payload.encoded));t?.kind===`exhale`&&(i={unit:t.unit,amountPhi:t.amountPhi,amountUsd:t.amountUsd,usdPerPhi:t.usdPerPhi})}}catch(e){Mo(`lineage.decodeExhalePayload`,e)}let a=``,o=``;try{i?.amountPhi&&(a=Wo(i.amountPhi),o=typeof i.amountUsd==`string`&&i.amountUsd?i.amountUsd:typeof i.usdPerPhi==`number`&&Number.isFinite(i.usdPerPhi)?He((Number(i.amountPhi)||0)*i.usdPerPhi):`0.00`)}catch(e){Mo(`lineage.computeDisplay`,e)}return(0,W.jsxs)(`li`,{className:n?`transfer open`:`transfer closed`,children:[(0,W.jsxs)(`header`,{children:[(0,W.jsxs)(`span`,{className:`index`,children:[`#`,t+1]}),(0,W.jsx)(`span`,{className:`state ${n?`open`:`closed`}`,children:n?`Pending receive`:`Sealed`})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Exhaler Σ`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:e.senderSignature})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Exhaler Seal:`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:e.senderStamp})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Exhaler Pulse`}),(0,W.jsx)(`span`,{className:`v`,children:e.senderKaiPulse})]}),i?.amountPhi&&(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Exhaled`}),(0,W.jsxs)(`span`,{className:`v`,children:[`Φ `,a,` · $`,o]})]}),r&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Prev-Head`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:r.previousHeadRoot})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Exhale leaf`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:r.transferLeafHashSend})]}),r.transferLeafHashReceive&&(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Inhale leaf`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:r.transferLeafHashReceive})]}),r.zkSend&&(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`ZK Exhale:`}),(0,W.jsxs)(`span`,{className:`v`,children:[r.zkSend.verified?`✓`:`•`,` `,r.zkSend.scheme]})]}),r.zkSend?.proofHash&&(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`ZK Exhale hash:`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:r.zkSend.proofHash})]}),r.zkReceive&&(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`ZK Inhale`}),(0,W.jsxs)(`span`,{className:`v`,children:[r.zkReceive.verified?`✓`:`•`,` `,r.zkReceive.scheme]})]}),r.zkReceive?.proofHash&&(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`ZK Inhale hash`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:r.zkReceive.proofHash})]})]}),e.receiverSignature&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Inhaler Σ`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:e.receiverSignature})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Inhaler Seal`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:e.receiverStamp})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Inhaler Pulse`}),(0,W.jsx)(`span`,{className:`v`,children:e.receiverKaiPulse})]})]}),e.payload&&(0,W.jsxs)(`details`,{className:`payload`,open:!0,children:[(0,W.jsx)(`summary`,{children:`Payload`}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Name`}),(0,W.jsx)(`span`,{className:`v`,children:e.payload.name})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`MIME`}),(0,W.jsx)(`span`,{className:`v`,children:e.payload.mime})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Size`}),(0,W.jsxs)(`span`,{className:`v`,children:[e.payload.size,` bytes`]})]})]})]},t)})}):(0,W.jsx)(`p`,{className:`empty`,children:`No stewardship yet — ready to exhale from Sigil-Glyph.`})}),B===`data`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`json-toggle`,children:(0,W.jsxs)(`label`,{children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:ee,onChange:()=>te(e=>!e)}),` View raw JSON`]})}),ee?(0,W.jsx)(`pre`,{className:`raw-json`,style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:d}):(0,W.jsx)(`div`,{className:`json-tree-wrap`,style:{overflowX:`hidden`},children:(0,W.jsx)(uc,{data:m})})]})]}),(0,W.jsxs)(`footer`,{className:`modal-footer`,style:{position:`sticky`,bottom:0},children:[H&&(0,W.jsx)(`p`,{className:`status error`,style:{overflowWrap:`anywhere`},children:H}),(0,W.jsxs)(`div`,{className:`footer-actions`,style:{display:`flex`,alignItems:`center`,gap:8,flexWrap:`wrap`,width:`100%`,boxSizing:`border-box`},children:[R===`unsigned`&&(0,W.jsx)(`button`,{className:`secondary`,onClick:Le,children:`Seal content (Σ + Φ)`}),(R===`readySend`||R===`verified`)&&(0,W.jsxs)(`div`,{className:`send-row no-zoom-input`,"data-nozoom":`true`,style:{display:`flex`,alignItems:`center`,gap:8,flex:`1 1 auto`,minWidth:0,fontSize:16,WebkitTextSizeAdjust:`100%`},children:[(0,W.jsx)(jo,{amountMode:M,setAmountMode:N,usdInput:I,phiInput:P,setUsdInput:L,setPhiInput:F,convDisplayRight:It.displayRight,remainingPhiDisplay4:ut,canonicalContext:Se,phiFormatter:e=>$o(Qo(Ve(e)))}),(0,W.jsx)($7,{className:`primary`,onClick:Bt,aria:`Exhale (send)`,titleText:Ue?`Exhale (seal & share)`:`Exhale (seal & copy link)`,disabled:!Lt,path:`M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z`})]}),(0,W.jsx)($7,{onClick:()=>t.current?.click(),aria:`Attach a file`,titleText:`Attach a file`,small:!0,path:`M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.2a2 2 0 01-2.83-2.83l8.49-8.49`}),(0,W.jsx)(`input`,{ref:t,type:`file`,hidden:!0,onChange:Ie}),R===`readyReceive`&&(0,W.jsx)($7,{className:`primary`,onClick:Vt,aria:`Inhale (receive)`,titleText:Se===`derivative`?qt?`Link expired`:Kt?`Link already used`:`Inhale`:Jt?`Send expired`:`Inhale`,disabled:Se===`derivative`&&(qt||Kt)||Se===`parent`&&Jt,path:`M2 22l11-11M2 22l20-7-9-4-4-9-7 20z`}),(m?.transfers?.length??0)>0&&(0,W.jsx)($7,{className:`secondary`,onClick:Ht,aria:`Segment head window`,titleText:`Roll current head-window into a segment (continuous)`,disabled:zt,small:!0,path:`M12 3l9 4-9 4-9-4 9-4zm-9 8l9 4 9-4M3 19l9 4 9-4`})]})]})]})]})}),(0,W.jsx)(Cc,{open:ie,url:oe,hash:ce,onClose:()=>{ae(!1),_e(!1),we()},onDownloadZip:Rt}),m&&We&&(0,W.jsx)(i8,{open:ue,onClose:Ae,meta:We,nowPulse:o,initialGlyph:Ke??void 0,onAttach:R===`verified`?je:void 0}),(0,W.jsx)(`dialog`,{ref:r,className:`glass-modal fullscreen`,id:`note-dialog`,"data-open":fe?`true`:`false`,"aria-label":`Note Exhaler`,style:Y7.full,children:(0,W.jsxs)(`div`,{className:`modal-viewport`,style:Y7.viewport,children:[(0,W.jsxs)(`div`,{className:`modal-topbar`,style:Y7.gridBar,children:[(0,W.jsx)(`div`,{style:{paddingInline:12,fontSize:12,color:`var(--dim)`},children:`Kairos — Note Exhaler`}),(0,W.jsx)(`button`,{className:`close-btn holo`,"data-aurora":`true`,"aria-label":`Close`,title:`Close`,onClick:Oe,style:{justifySelf:`end`,marginRight:8},children:`×`})]}),(0,W.jsx)(`div`,{style:{flex:`1 1 auto`,minHeight:0,overflowY:`auto`},children:me&&We?(0,W.jsx)(z5,{meta:We,initial:Ee}):me?(0,W.jsx)(`div`,{style:{padding:16,color:`var(--dim)`},children:`Missing valuation metadata for Note — upload/parse a sigil first.`}):(0,W.jsx)(`div`,{style:{padding:16,color:`var(--dim)`},children:`Load a sigil to print a note.`})})]})})]})};function C9(){return(0,W.jsx)(es,{onReset:()=>{},children:(0,W.jsx)(C.Suspense,{fallback:(0,W.jsx)(`div`,{style:{padding:16},children:`Loading…`}),children:(0,W.jsx)(S9,{})})})}var w9=C.lazy(()=>O(()=>import(`./SigilFeedPage-DGJJwxYi.js`),__vite__mapDeps([25,17,8,6,7,9,18,20,2,3,21,22,14,23,24,26]))),T9=C.lazy(()=>O(()=>import(`./SigilPage-DF86EQ7y.js`),__vite__mapDeps([27,6,7,23,28,29]))),E9=C.lazy(()=>O(()=>import(`./PShort-Bmqr2bV5.js`),[])),D9=C.lazy(()=>O(()=>import(`./VerifyPage-B34sC8R1.js`),__vite__mapDeps([30,11,31,32,33]))),O9=[()=>O(()=>import(`./SigilFeedPage-DGJJwxYi.js`),__vite__mapDeps([25,17,8,6,7,9,18,20,2,3,21,22,14,23,24,26])),()=>O(()=>import(`./SigilPage-DF86EQ7y.js`),__vite__mapDeps([27,6,7,23,28,29])),()=>O(()=>import(`./PShort-Bmqr2bV5.js`),[]),()=>O(()=>import(`./VerifyPage-B34sC8R1.js`),__vite__mapDeps([30,11,31,32,33]))];function k9(){return(0,W.jsxs)(`div`,{className:`route-loader`,role:`status`,"aria-live":`polite`,"aria-label":`Loading`,children:[(0,W.jsx)(`div`,{className:`route-loader__bg`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`route-loader__grid`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`route-loader__halo`,"aria-hidden":`true`}),(0,W.jsxs)(`div`,{className:`route-loader__stage`,children:[(0,W.jsxs)(`div`,{className:`route-loader__orb`,"aria-hidden":`true`,children:[(0,W.jsx)(`div`,{className:`route-loader__orb-ring route-loader__orb-ring--a`}),(0,W.jsx)(`div`,{className:`route-loader__orb-ring route-loader__orb-ring--b`}),(0,W.jsx)(`div`,{className:`route-loader__orb-ring route-loader__orb-ring--c`}),(0,W.jsx)(`div`,{className:`route-loader__orb-core`}),(0,W.jsx)(`span`,{className:`route-loader__spark route-loader__spark--a`}),(0,W.jsx)(`span`,{className:`route-loader__spark route-loader__spark--b`})]}),(0,W.jsx)(`div`,{className:`route-loader__content`,children:(0,W.jsxs)(`div`,{className:`route-loader__content-inner`,children:[(0,W.jsx)(`div`,{className:`route-loader__dot`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`route-loader__text`,children:`BREATH REMEMBERS`}),(0,W.jsx)(`div`,{className:`route-loader__sub`,children:`Aligning…`})]})})]})]})}function A9(e){return(0,W.jsx)(C.Suspense,{fallback:(0,W.jsx)(k9,{}),children:e})}function j9(e){return(0,W.jsx)(C.Suspense,{fallback:null,children:e})}function M9(){return(0,C.useEffect)(()=>{if(typeof window>`u`)return;let e=window,t=()=>{for(let e of O9)e().catch(()=>{})},n=typeof e.requestIdleCallback==`function`?e.requestIdleCallback(t,{timeout:1e3}):window.setTimeout(t,380);return()=>{typeof e.cancelIdleCallback==`function`?e.cancelIdleCallback(n):window.clearTimeout(n)}},[]),(0,W.jsxs)(mn,{children:[(0,W.jsx)(wo,{}),(0,W.jsxs)(At,{children:[(0,W.jsx)(Ot,{path:`s`,element:A9((0,W.jsx)(T9,{}))}),(0,W.jsx)(Ot,{path:`s/:hash`,element:A9((0,W.jsx)(T9,{}))}),(0,W.jsx)(Ot,{path:`stream`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`stream/p/:token`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`stream/c/:token`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`feed`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`feed/p/:token`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`p~:token`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`p~:token/*`,element:A9((0,W.jsx)(E9,{}))}),(0,W.jsx)(Ot,{path:`token`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`p~token`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`p`,element:A9((0,W.jsx)(E9,{}))}),(0,W.jsx)(Ot,{path:`verify/*`,element:A9((0,W.jsx)(D9,{}))}),(0,W.jsxs)(Ot,{element:(0,W.jsx)(vo,{}),children:[(0,W.jsx)(Ot,{index:!0,element:(0,W.jsx)(C9,{})}),(0,W.jsx)(Ot,{path:`mint`,element:(0,W.jsx)(fo,{})}),(0,W.jsx)(Ot,{path:`voh`,element:(0,W.jsx)(uo,{})}),(0,W.jsx)(Ot,{path:`explorer`,element:(0,W.jsx)(po,{})}),(0,W.jsx)(Ot,{path:`keystream`,element:(0,W.jsx)(po,{})}),(0,W.jsx)(Ot,{path:`klock`,element:(0,W.jsx)(mo,{})}),(0,W.jsx)(Ot,{path:`klok`,element:(0,W.jsx)(mo,{})}),(0,W.jsx)(Ot,{path:`*`,element:j9((0,W.jsx)(yo,{}))})]})]})]})}var N9=(e,t,n)=>{let r=Math.floor(e);return rn?n:r},P9=250,F9=2**31-1;function I9(e){return e===`pulse`?qn:qn*484}function L9(e){let t=e.pauseWhenHidden!==!1,n=N9(N9(e.every,1,1e6)*I9(e.unit),P9,F9),r=!1,i=null,a=()=>{i!==null&&window.clearTimeout(i),i=null},o=e=>{if(r)return;let t=N9(e,P9,F9);i=window.setTimeout(()=>void s(),t)},s=async()=>{if(!r){if(t&&document.visibilityState!==`visible`){o(n);return}try{await e.onTick()}finally{o(n)}}};o(n);let c=()=>{document.visibilityState===`visible`&&(a(),o(Math.min(n,1e3)))};return document.addEventListener(`visibilitychange`,c,{passive:!0}),{stop:()=>{r=!0,a(),document.removeEventListener(`visibilitychange`,c)}}}var R9=[`kai.now.micro`,`kai_now_micro`,`kai_anchor_micro`,`KAI_ANCHOR_MICRO`,`KAI_NOW_MICRO`],z9=e=>{if(typeof e!=`string`)return null;let t=e.trim();if(!/^-?\d+$/.test(t))return null;try{return BigInt(t)}catch{return null}},B9=e=>{if(!Number.isFinite(e))return 0n;let t=e<0?-1:1,n=Math.abs(e),r=Math.trunc(n),i=n-r;return i<.5?BigInt(t*r):i>.5?BigInt(t*(r+1)):BigInt(t*(r%2==0?r:r+1))},V9=e=>B9((e-In)/qn*1e6),H9=()=>{if(typeof window>`u`)return null;try{for(let e of R9){let t=z9(window.localStorage.getItem(e));if(t!==null)return t}}catch{}return null},U9=()=>{let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`30.0.5`,VITE_KAI_ANCHOR_MICRO:null,VITE_KAI_BEATS_DAY:36,VITE_KAI_GENESIS_TS_MS_UTC:1715323541888,VITE_KAI_N_DAY_MICRO:`17491270421`,VITE_KAI_PULSES_STEP:11,VITE_KAI_PULSE_MS:5236,VITE_KAI_SOLAR_GENESIS_TS_MS_UTC:1715400806e3,VITE_KAI_STEPS_BEAT:44,VITE_SOVEREIGN_BUILD_JSON:`{"appVersion":"30.0.5","genesisTsMsUtc":1715323541888,"solarGenesisTsMsUtc":1715400806000,"pulseMs":5236,"pulsesPerStep":11,"stepsPerBeat":44,"beatsPerDay":36,"nDayMicro":"17491270421","kaiAnchorMicro":null}`}.VITE_KAI_ANCHOR_MICRO;return z9(typeof e==`string`?e:void 0)};typeof window<`u`&&_r((()=>{let e=H9();if(e!==null)return e;let t=U9();return t===null?V9(performance.timeOrigin+performance.now()):t})());var W9=!0;function G9(){let e=window.location.hash||``;if(!e.startsWith(`#/`))return;let t=e.slice(1),n=t.indexOf(`?`),r=(n===-1?t:t.slice(0,n))||`/`,i=n===-1?``:t.slice(n+1);if(!r.startsWith(`/stream/p/`))return;let a=new URLSearchParams(i),o=a.get(`add`)||``;a.delete(`add`);let s=a.toString(),c=`${r}${s?`?${s}`:``}${o?`#add=${o}`:``}`;window.history.replaceState(null,``,c)}window.addEventListener(`DOMContentLoaded`,G9,{once:!0}),S.createRoot(document.getElementById(`root`)).render((0,W.jsx)(C.StrictMode,{children:(0,W.jsx)(M9,{})})),`serviceWorker`in navigator&&W9&&window.addEventListener(`load`,async()=>{try{let e=await navigator.serviceWorker.register(`/sw.js?v=30.0.5`,{scope:`/`}),t=!1;navigator.serviceWorker.addEventListener(`controllerchange`,()=>{t||(t=!0,window.location.reload())});let n=e=>{e?.postMessage({type:`SKIP_WAITING`})};(e=>{e.addEventListener(`updatefound`,()=>{let t=e.installing;t&&t.addEventListener(`statechange`,()=>{t.state===`installed`&&navigator.serviceWorker.controller&&n(t)})})})(e),navigator.serviceWorker.addEventListener(`message`,e=>{e.data?.type===`SW_ACTIVATED`&&(console.log(`Kairos service worker active`,e.data.version),typeof e.data.version==`string`&&(window.kairosSwVersion=e.data.version,window.dispatchEvent(new CustomEvent(qi,{detail:e.data.version}))))}),L9({unit:`beat`,every:1,onTick:async()=>{await e.update()}}),console.log(`Kairos Service Worker registered:`,e)}catch(e){console.error(`Service Worker error:`,e)}});export{Vd as $,ps as $t,yp as A,f as An,Nu as At,Uf as B,As as Bt,CS as C,x as Cn,mu as Ct,Sp as D,o as Dn,yu as Dt,Pp as E,s as En,bu as Et,Ap as F,Ds as Ft,$f as G,Gs as Gt,Hf as H,js as Ht,sp as I,Us as It,Qf as J,Hs as Jt,ip as K,Ns as Kt,op as L,Vs as Lt,kp as M,Ou as Mt,jp as N,Du as Nt,Cp as O,c as On,Su as Ot,Op as P,Cu as Pt,Hd as Q,Rs as Qt,ap as R,Bs as Rt,nS as S,O as Sn,Eu as St,qy as T,h as Tn,xu as Tt,Xf as U,zs as Ut,Zf as V,Ks as Vt,np as W,Ws as Wt,rp as X,Os as Xt,hp as Y,Ls as Yt,Bd as Z,ks as Zt,IS as _,Fr as _n,Ld as _t,Kx as a,In as an,Rf as at,rS as b,$e as bn,Qu as bt,Gx as c,Rn as cn,Bf as ct,tS as d,Mr as dn,If as dt,ms as en,vf as et,FS as f,zr as fn,Nf as ft,NS as g,Ir as gn,zd as gt,MS as h,jr as hn,Mf as ht,Xx as i,Kn as in,jf as it,xp as j,u as jn,Pu as jt,wp as k,d as kn,vu as kt,$x as l,qn as ln,Ff as lt,AS as m,Kr as mn,Of as mt,nD as n,Vi as nn,Df as nt,qx as o,Gn as on,Lf as ot,jS as p,Fn as pn,Vf as pt,gp as q,Fs as qt,aC as r,Wn as rn,kf as rt,Zx as s,Bn as sn,Pf as st,t7 as t,Ui as tn,gf as tt,Qx as u,zn as un,zf as ut,OS as v,_n as vn,od as vt,ob as w,y as wn,Tu as wt,wS as x,rt as xn,hu as xt,xS as y,Xe as yn,Wu as yt,vp as z,Is as zt}; \ No newline at end of file + `,document.head.appendChild(t)}function j5(e){let t=(0,C.useRef)(e);(0,C.useEffect)(()=>{t.current=e},[e]);let n=(0,C.useRef)(null);return(0,C.useEffect)(()=>()=>{n.current!=null&&cancelAnimationFrame(n.current)},[]),(0,C.useCallback)(()=>{n.current??=requestAnimationFrame(()=>{n.current=null,t.current()})},[])}function M5(e){let t=new Uint8Array(e),n=``;for(let e=0;e>>e|t<<32-e}function n(e,t,n){return e&t^~e&n}function r(e,t,n){return e&t^e&n^t&n}function i(e){return t(7,e)^t(18,e)^e>>>3}function a(e){return t(17,e)^t(19,e)^e>>>10}function o(e){return t(2,e)^t(13,e)^t(22,e)}function s(e){return t(6,e)^t(11,e)^t(25,e)}let c=new Uint32Array([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]),l=new TextEncoder().encode(e),u=l.length,d=u+1,f=d+(d%64<=56?56-d%64:120-d%64)+8,p=new Uint8Array(f);p.set(l),p[u]=128;let m=u*8;for(let e=0;e<8;e++)p[f-1-e]=m>>>e*8&255;let h=1779033703,g=3144134277,_=1013904242,v=2773480762,y=1359893119,b=2600822924,x=528734635,S=1541459225,C=new Uint32Array(64);for(let e=0;e>>0;let t=h,l=g,u=_,d=v,f=y,m=b,w=x,T=S;for(let e=0;e<64;e++){let i=T+s(f)+n(f,m,w)+c[e]+C[e]>>>0,a=o(t)+r(t,l,u)>>>0;T=w,w=m,m=f,f=d+i>>>0,d=u,u=l,l=t,t=i+a>>>0}h=h+t>>>0,g=g+l>>>0,_=_+u>>>0,v=v+d>>>0,y=y+f>>>0,b=b+m>>>0,x=x+w>>>0,S=S+T>>>0}let w=e=>e.toString(16).padStart(8,`0`);return w(h)+w(g)+w(_)+w(v)+w(y)+w(b)+w(x)+w(S)}async function P5(e){try{let t=(typeof crypto<`u`?crypto:void 0)??globalThis.crypto;if(t?.subtle){let n=new TextEncoder().encode(e);return M5(await t.subtle.digest(`SHA-256`,n))}}catch{}return N5(e)}function F5(e){try{return JSON.stringify(e,(e,t)=>typeof t==`bigint`?t.toString():t)}catch{try{return JSON.stringify({error:`unstringifiable`,kind:typeof e})}catch{return`{"error":"unstringifiable"}`}}}function I5(e){let t=e;return{algorithm:e.algorithm,policy:t.policyId??null,policyChecksum:e.policyChecksum,valuePhi:e.valuePhi,premium:e.premium??null,inputs:t.inputs,minimalHead:{headHash:t.headRef?.headHash??null,transfersWindowRoot:t.headRef?.transfersWindowRoot??null,cumulativeTransfers:t.headRef?.cumulativeTransfers??0}}}async function L5(e){return P5(`val-stamp:${F5(I5(e))}`)}function R5(e){try{let t=Mr(x5(e)+1)-S5(e);return t<=0n?0:Number(t)}catch{return Math.max(0,Math.floor(qn))}}var z5=({meta:e,usdSample:t=100,policy:n=Wu,getNowPulse:r,onRender:i,initial:a,className:o})=>{let s=(0,C.useId)(),c=(0,C.useRef)(null),l=(0,C.useRef)(null);(0,C.useEffect)(()=>{k5(),A5()},[]);let u=(0,C.useCallback)(()=>{let e=b5(Kr()),t=x5(e),n=r?.(),i=typeof n==`number`&&Number.isFinite(n)&&Math.abs(Math.trunc(n)-Math.trunc(t))<=2;return{pulse:Math.trunc(i?n:t),micro:e}},[r]),[{pulse:d},f]=(0,C.useState)(()=>u()),p=(0,C.useRef)(null),m=(0,C.useRef)(d),h=(0,C.useCallback)(()=>{p.current!==null&&(window.clearTimeout(p.current),p.current=null);let e=()=>{let t=u();m.current=t.pulse,f(e=>e.pulse===t.pulse?e:t);let n=R5(t.micro);p.current=window.setTimeout(()=>{let t=u();t.pulse!==m.current&&(m.current=t.pulse,f(t)),e()},Math.max(0,n))};e()},[u]);(0,C.useEffect)(()=>(h(),()=>{p.current!==null&&window.clearTimeout(p.current)}),[h]),(0,C.useEffect)(()=>{let e=()=>{typeof document<`u`&&!document.hidden&&h()};return document.addEventListener(`visibilitychange`,e,{passive:!0}),()=>document.removeEventListener(`visibilitychange`,e)},[h]);let g=(0,C.useMemo)(()=>{if(typeof window>`u`)return`/`;let e=String(window.location.href||``).trim();if(e&&/^https?:\/\//i.test(e))return e;let t=window.location.origin,n=`${window.location.pathname}${window.location.search}${window.location.hash}`;return t&&t!==`null`?`${t}${n||`/`}`:n||`/`},[]),[_,v]=(0,C.useState)(()=>{let e={purpose:``,to:``,from:``,location:``,witnesses:``,reference:``,remark:`In Yahuah We Trust — Secured by Φ, not man-made law`,valuePhi:``,premiumPhi:``,computedPulse:``,nowPulse:``,kaiSignature:``,userPhiKey:``,sigmaCanon:``,shaHex:``,phiDerived:``,valuationAlg:``,valuationStamp:``,provenance:[],zk:void 0,sigilSvg:``,verifyUrl:g,...a??{}};return{...e,verifyUrl:O5(e.verifyUrl,g)}}),[y,b]=(0,C.useState)(null),x=(0,C.useRef)(!1),[S,w]=(0,C.useState)(!1),T=e=>t=>v(n=>({...n,[e]:t})),E=Math.trunc(d),D=(0,C.useMemo)(()=>{let{unsigned:t}=mu(e,E);return t},[e,E]),O=(0,C.useMemo)(()=>`${D.algorithm} • ${D.policyChecksum}`,[D.algorithm,D.policyChecksum]);(0,C.useEffect)(()=>{v(e=>e.valuationAlg?e:{...e,valuationAlg:O})},[O]);let k=(0,C.useMemo)(()=>Qu({meta:e,nowPulse:E,usd:t,currentStreakDays:0,lifetimeUsdSoFar:0},n),[e,E,t,n]),A=D.valuePhi,j=D.premium??0,M=k.usdPerPhi,N=k.phiPerUsd,P=A*M,F=(0,C.useCallback)(()=>{let e=!!y,t=Z8(e?y.valuePhi:A),n=e&&_.premiumPhi||Z8(j),r=e?String(y.lockedPulse):``,i=e?_.valuationStamp||y.seal.stamp:``,a=O5(_.verifyUrl,g);return k8({purpose:_.purpose,to:_.to,from:_.from,location:_.location,witnesses:_.witnesses,reference:_.reference,remark:_.remark,valuePhi:t,premiumPhi:n,computedPulse:r,nowPulse:String(E),kaiSignature:_.kaiSignature||``,userPhiKey:_.userPhiKey||``,valuationAlg:_.valuationAlg||O,valuationStamp:i,sigilSvg:_.sigilSvg||``,verifyUrl:a,provenance:_.provenance??[]})},[_,A,j,E,O,y,g]),I=j5(()=>{let e=c.current;if(e)try{o8(e,F())}catch(e){console.error(`preview render failed`,e)}});(0,C.useEffect)(()=>{I()},[I,F]);let L=(0,C.useCallback)(async()=>{if(!(x.current||S)){w(!0);try{await new Promise(e=>requestAnimationFrame(()=>e()));let r=E,{unsigned:a}=mu(e,r),o=await L5(a),s=Qu({meta:e,nowPulse:r,usd:t,currentStreakDays:0,lifetimeUsdSoFar:0},n),c={...C5(a),stamp:o},l={lockedPulse:r,seal:c,usdPerPhi:s.usdPerPhi,phiPerUsd:s.phiPerUsd,valuePhi:c.valuePhi,valueUsdIndicative:c.valuePhi*s.usdPerPhi,quote:s};p.current!==null&&(window.clearTimeout(p.current),p.current=null),x.current=!0,b(l),v(e=>({...e,computedPulse:String(r),nowPulse:String(r),valuationStamp:o,premiumPhi:a.premium===void 0?e.premiumPhi:Z8(a.premium),valuationAlg:e.valuationAlg||`${a.algorithm} • ${a.policyChecksum}`,valuePhi:Z8(c.valuePhi),verifyUrl:O5(e.verifyUrl,g)})),i?.(l)}catch(e){console.error(`Render/Lock failed`,e),window.alert(`Render failed.\n${e instanceof Error?e.message:String(e)}`)}finally{w(!1)}}},[E,e,t,n,i,S,g]),R=(0,C.useRef)(``);(0,C.useEffect)(()=>{let e=!0;(async()=>{try{let t=await o5();if(!e||!t)return;let n={...t,verifyUrl:t.verifyUrl?O5(t.verifyUrl,g):void 0};v(e=>({...e,...n,verifyUrl:O5(n.verifyUrl??e.verifyUrl,g)}))}catch(e){console.error(`bridge hydration failed`,e)}})();let t=e=>{try{let t=e.detail;if(!t)return;let n=e=>(typeof e.verifyUrl==`string`&&(e.verifyUrl=O5(e.verifyUrl,g)),e);if(x.current){let e=[`kaiSignature`,`userPhiKey`,`sigmaCanon`,`shaHex`,`phiDerived`,`zk`,`provenance`,`sigilSvg`,`verifyUrl`],r=n(Object.fromEntries(Object.entries(t).filter(([t])=>e.includes(t)))),i=JSON.stringify(r);if(i===R.current)return;R.current=i,v(e=>({...e,...r}));return}let r=n({...t}),i=JSON.stringify(r);if(i===R.current)return;R.current=i,v(e=>({...e,...r}))}catch(e){console.error(`bridge event failed`,e)}};return window.addEventListener(`kk:note-data`,t,{passive:!0}),()=>{e=!1,window.removeEventListener(`kk:note-data`,t)}},[g]);let z=(0,C.useCallback)(async()=>{let e=l.current;if(!e)return;if(!x.current||!y){window.alert(`Please Render to lock the valuation before printing.`);return}let t=O5(_.verifyUrl,g),n=k8({..._,valuePhi:_.valuePhi||Z8(y.valuePhi),premiumPhi:_.premiumPhi||Z8(j),computedPulse:String(y.lockedPulse),nowPulse:String(y.lockedPulse),kaiSignature:_.kaiSignature||``,userPhiKey:_.userPhiKey||``,valuationAlg:_.valuationAlg||O,valuationStamp:_.valuationStamp||y.seal.stamp,sigilSvg:_.sigilSvg||``,verifyUrl:t,provenance:_.provenance??[]}),r=L8({frozenPulse:String(y.lockedPulse),kaiSignature:_.kaiSignature||``,userPhiKey:_.userPhiKey||``,sigmaCanon:_.sigmaCanon||``,shaHex:_.shaHex||``,phiDerived:_.phiDerived||``,valuePhi:_.valuePhi||Z8(y.valuePhi),premiumPhi:_.premiumPhi||Z8(j),valuationAlg:_.valuationAlg||O,valuationStamp:_.valuationStamp||y.seal.stamp,zk:_.zk,provenance:_.provenance??[],sigilSvg:_.sigilSvg||``,verifyUrl:t});G8(e,n,String(y.lockedPulse),r),e.setAttribute(`aria-hidden`,`false`),await D5(),await K8(`☤KAI ${w5(y.lockedPulse)} — ${a8}`),e.setAttribute(`aria-hidden`,`true`)},[_,y,j,O,g]),B=(0,C.useCallback)(async()=>{try{if(!x.current||!y){window.alert(`Please Render to lock the valuation before saving PNG.`);return}let e=O5(_.verifyUrl,g),t=await _5(k8({..._,valuePhi:_.valuePhi||Z8(y.valuePhi),premiumPhi:_.premiumPhi||Z8(j),computedPulse:String(y.lockedPulse),nowPulse:String(y.lockedPulse),kaiSignature:_.kaiSignature||``,userPhiKey:_.userPhiKey||``,valuationAlg:_.valuationAlg||O,valuationStamp:_.valuationStamp||y.seal.stamp,sigilSvg:_.sigilSvg||``,verifyUrl:e,provenance:_.provenance??[]}),2400);v5(`${T5(_.kaiSignature||``,String(y.lockedPulse),_.valuationStamp||y.seal.stamp||``)}.png`,t,`image/png`)}catch(e){window.alert(`Save PNG failed: `+(e instanceof Error?e.message:String(e))),console.error(e)}},[_,y,j,O,g]),V=y?y.lockedPulse:E,H=y?y.valuePhi:A,U=y?y.valueUsdIndicative:P,ee=y?y.usdPerPhi:M,te=y?y.phiPerUsd:N,ne=y?_.premiumPhi?Number(_.premiumPhi):0:j,re=E5(H),ie=(0,C.useMemo)(()=>`☤KAI ${w5(V)}`,[V]);return(0,W.jsxs)(`div`,{"data-kk-scope":s,className:`kk-note ${o??``}`,children:[(0,W.jsxs)(`div`,{className:`kk-bar`,children:[(0,W.jsx)(`div`,{className:`kk-brand`,children:(0,W.jsx)(`strong`,{children:`☤KAI — Kairos Kurrensy · Sovereign Harmonik Kingdom`})}),(0,W.jsx)(`div`,{className:`kk-legal-pill`,children:`Issued under Yahuah’s Law of Eternal Light (Φ • Kai-Turah)`})]}),(0,W.jsxs)(`section`,{className:`kk-hero ${y?`is-locked`:`is-live`}`,children:[(0,W.jsxs)(`div`,{className:`kk-status`,children:[(0,W.jsx)(`span`,{className:`kk-chip ${y?`chip-locked`:`chip-live`}`,children:y?`LOCKED`:`LIVE`}),(0,W.jsxs)(`span`,{className:`kk-chip kk-chip-pulse`,children:[`☤KAI `,w5(V)]}),(0,W.jsxs)(`span`,{className:`kk-chip`,children:[`value: `,Y8(H)]}),(0,W.jsxs)(`span`,{className:`kk-chip`,children:[`$ / φ: `,Z8(ee)]}),(0,W.jsxs)(`span`,{className:`kk-chip`,children:[`φ / $: `,Z8(te)]}),(0,W.jsxs)(`span`,{className:`kk-chip`,children:[`premium φ: `,Z8(ne)]})]}),(0,W.jsxs)(`div`,{className:`kk-value-row`,children:[(0,W.jsxs)(`div`,{className:`kk-value-block`,children:[(0,W.jsx)(`div`,{className:`kk-value-label`,children:`VALUE`}),(0,W.jsxs)(`div`,{className:`kk-value`,children:[(0,W.jsx)(`span`,{className:`kk-value-sigil`,children:`Φ`}),(0,W.jsx)(`span`,{className:`kk-value-int`,children:re.int}),(0,W.jsx)(`span`,{className:`kk-value-frac`,children:re.frac})]}),(0,W.jsxs)(`div`,{className:`kk-value-usd`,children:[`≈ `,X8(U)]})]}),(0,W.jsxs)(`div`,{className:`kk-cta`,children:[y?(0,W.jsxs)(`div`,{className:`kk-locked-banner`,role:`status`,"aria-live":`polite`,children:[(0,W.jsx)(`div`,{className:`kk-locked-title`,children:`Valuation Locked`}),(0,W.jsxs)(`div`,{className:`kk-locked-sub`,children:[`☤KAI `,w5(y.lockedPulse),` • Hash: `,_.valuationStamp||y.seal.stamp||`—`]})]}):(0,W.jsx)(`button`,{className:`kk-btn kk-btn-primary kk-btn-xl`,onClick:L,title:`Freeze current pulse and valuation`,disabled:S,children:S?`Rendering…`:`Render — Lock Valuation`}),(0,W.jsxs)(`div`,{className:`kk-cta-actions`,children:[(0,W.jsx)(`button`,{className:`kk-btn`,onClick:z,disabled:!y,title:`Print proof pages`,children:`Print / Save PDF`}),(0,W.jsx)(`button`,{className:`kk-btn kk-btn-ghost`,onClick:B,disabled:!y,title:`Export note PNG`,children:`Save PNG`})]})]})]})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Title`}),(0,W.jsx)(`input`,{value:`${ie} — ${a8}`,disabled:!0,className:`kk-out`})]}),(0,W.jsxs)(`div`,{className:`kk-grid`,children:[(0,W.jsxs)(`div`,{className:`kk-stack`,children:[(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Purpose`}),(0,W.jsx)(`input`,{value:_.purpose,onChange:e=>T(`purpose`)(e.target.value),placeholder:`e.g., consideration for work / gift / exchange`,disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`To`}),(0,W.jsx)(`input`,{value:_.to,onChange:e=>T(`to`)(e.target.value),placeholder:`Recipient`,disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`From`}),(0,W.jsx)(`input`,{value:_.from,onChange:e=>T(`from`)(e.target.value),placeholder:`Issuer`,disabled:!!y})]})]}),(0,W.jsxs)(`div`,{className:`kk-stack`,children:[(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Location`}),(0,W.jsx)(`input`,{value:_.location,onChange:e=>T(`location`)(e.target.value),placeholder:`(optional)`,disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Witnesses`}),(0,W.jsx)(`input`,{value:_.witnesses,onChange:e=>T(`witnesses`)(e.target.value),placeholder:`(optional)`,disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Reference`}),(0,W.jsx)(`input`,{value:_.reference,onChange:e=>T(`reference`)(e.target.value),placeholder:`(optional)`,disabled:!!y})]})]})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Remark`}),(0,W.jsx)(`input`,{value:_.remark,onChange:e=>T(`remark`)(e.target.value),placeholder:`In Yahuah We Trust — Secured by Φ, not man-made law`,disabled:!!y})]}),(0,W.jsxs)(`details`,{className:`kk-stack`,style:{marginTop:8},open:!0,children:[(0,W.jsxs)(`summary`,{children:[(0,W.jsx)(`strong`,{children:`Identity & Valuation`}),` `,(0,W.jsx)(`span`,{className:`kk-hint`,children:`— appears on the bill + proof pages`})]}),(0,W.jsxs)(`div`,{className:`kk-grid`,style:{marginTop:8},children:[(0,W.jsxs)(`div`,{className:`kk-stack`,children:[(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Value Φ`}),(0,W.jsx)(`input`,{value:Z8(H),readOnly:!0})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Premium Φ`}),(0,W.jsx)(`input`,{value:Z8(ne),readOnly:!0})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Valuation Alg`}),(0,W.jsx)(`input`,{value:_.valuationAlg||O,readOnly:!0})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Valuation Stamp`}),(0,W.jsx)(`input`,{value:y?_.valuationStamp||y.seal.stamp||`—`:``,readOnly:!0})]})]}),(0,W.jsxs)(`div`,{className:`kk-stack`,children:[(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Pulse (locked)`}),(0,W.jsx)(`input`,{value:y?String(y.lockedPulse):``,readOnly:!0,placeholder:`set on Render`})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Pulse (live)`}),(0,W.jsx)(`input`,{value:String(E),readOnly:!0,placeholder:`live`})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`kaiSignature`}),(0,W.jsx)(`input`,{value:_.kaiSignature,onChange:e=>T(`kaiSignature`)(e.target.value),disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`userΦkey`}),(0,W.jsx)(`input`,{value:_.userPhiKey,onChange:e=>T(`userPhiKey`)(e.target.value),disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Σ (canonical)`}),(0,W.jsx)(`input`,{value:_.sigmaCanon,onChange:e=>T(`sigmaCanon`)(e.target.value),disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`sha256(Σ)`}),(0,W.jsx)(`input`,{value:_.shaHex,onChange:e=>T(`shaHex`)(e.target.value),disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Φ (derived)`}),(0,W.jsx)(`input`,{value:_.phiDerived,onChange:e=>T(`phiDerived`)(e.target.value),disabled:!!y})]})]})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Verify URL`}),(0,W.jsx)(`input`,{value:_.verifyUrl,onChange:e=>T(`verifyUrl`)(e.target.value),placeholder:`Used for QR & clickable sigil`,disabled:!!y})]}),(0,W.jsxs)(`div`,{className:`kk-row`,children:[(0,W.jsx)(`label`,{children:`Sigil SVG (raw)`}),(0,W.jsx)(`textarea`,{value:_.sigilSvg,onChange:e=>T(`sigilSvg`)(e.target.value),className:`kk-out`,disabled:!!y})]})]}),(0,W.jsxs)(`div`,{className:`kk-row kk-actions`,children:[(0,W.jsx)(`div`,{}),(0,W.jsxs)(`div`,{className:`kk-flex`,children:[!y&&(0,W.jsx)(`button`,{className:`kk-btn kk-btn-primary`,onClick:L,disabled:S,children:S?`Rendering…`:`Render — Lock Valuation`}),(0,W.jsx)(`button`,{className:`kk-btn`,onClick:z,disabled:!y,children:`Print / Save PDF`}),(0,W.jsx)(`button`,{className:`kk-btn kk-btn-ghost`,onClick:B,disabled:!y,children:`Save PNG`})]}),(0,W.jsx)(`div`,{})]}),(0,W.jsx)(`div`,{ref:c,id:`note-preview`,className:`kk-note-preview kk-out`}),(0,W.jsx)(`div`,{ref:l,id:`print-root`,"aria-hidden":`true`})]})},B5=`kairos:key:pkcs8`,V5=`kairos:key:spki`,H5={name:`ECDSA`,namedCurve:`P-256`},U5={name:`ECDSA`,hash:`SHA-256`};function W5(e){let t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(e),t}async function G5(e){return crypto.subtle.importKey(`pkcs8`,e,H5,!0,[`sign`])}async function K5(e){return crypto.subtle.importKey(`spki`,e,H5,!0,[`verify`])}async function q5(e){let t=await crypto.subtle.exportKey(`pkcs8`,e);return xs.encode(new Uint8Array(t))}async function J5(e){let t=await crypto.subtle.exportKey(`spki`,e);return xs.encode(new Uint8Array(t))}async function Y5(){let e=await crypto.subtle.generateKey(H5,!0,[`sign`,`verify`]),t=await J5(e.publicKey);return{priv:e.privateKey,pub:e.publicKey,spkiB64u:t}}async function X5(){try{let e=localStorage.getItem(B5),t=localStorage.getItem(V5);if(e&&t){let n=xs.decode(e),r=xs.decode(t);return{priv:await G5(W5(n)),pub:await K5(W5(r)),spkiB64u:t}}let n=await Y5();return localStorage.setItem(B5,await q5(n.priv)),localStorage.setItem(V5,n.spkiB64u),n}catch{return Y5()}}async function Z5(e,t){let n=W5(t),r=await crypto.subtle.sign(U5,e,n);return xs.encode(new Uint8Array(r))}function Q5(e,t){let n=e.match(RegExp(`${t}="([^"]+)"`,`i`));return n?n[1]:void 0}function $5(e,t){let n=Q5(e,t);if(!n)return;let r=Number(n);return Number.isFinite(r)?r:void 0}function e7(e){try{let t=new DOMParser().parseFromString(e,`image/svg+xml`).querySelector(`metadata`);return t?t.textContent??null:null}catch{return null}}async function t7(e){let t=await e.text(),n={},r=e7(t);if(r)try{n=JSON.parse(r)}catch{}if(n.pulse??=$5(t,`data-pulse`),n.beat??=$5(t,`data-beat`),n.stepIndex??=$5(t,`data-step-index`),n.frequencyHz??=(()=>{let e=Q5(t,`data-frequency-hz`);return e?Number(e):void 0})(),n.chakraGate??=Q5(t,`data-chakra-gate`),!n.chakraDay){let e=Q5(t,`data-harmonic-day`)||Q5(t,`data-chakra-day`);e&&(n.chakraDay=e)}n.kaiSignature??=Q5(t,`data-kai-signature`),n.userPhiKey??=Q5(t,`data-phi-key`);let i=!n[`@context`]||n[`@context`]===`https://schema.phi.network/sigil/v1`,a=!n.type||n.type===`application/phi.kairos.sigil+svg`;return{text:t,meta:n,contextOk:i,typeOk:a}}async function n7(e,t){let n=new Image;n.crossOrigin=`anonymous`,n.src=e,await n.decode();let r=document.createElement(`canvas`);r.width=n.width,r.height=n.height;let i=r.getContext(`2d`);if(!i)throw Error(`Canvas 2D context unavailable`);i.drawImage(n,0,0);let{data:a}=i.getImageData(Math.floor(n.width/2),Math.floor(n.height/2),1,1),o=[a[0],a[1],a[2]];return{sig:(await _s(`${t}-2:3-${o.join(`,`)}`)).slice(0,32),rgb:o}}async function r7(e,t){let n=await fetch(e).then(e=>e.text()),r=JSON.stringify(t,null,2),i=n.match(/]*>/i)?n.replace(/]*>[\s\S]*?<\/metadata>/i,`${r}`):n.replace(/]*)>/i,`${r}`);return`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(i)))}`}async function i7(e,t=1024){let n=new Image;await new Promise((t,r)=>{n.onload=()=>t(),n.onerror=r,n.src=e});let r=document.createElement(`canvas`);r.width=t,r.height=t;let i=r.getContext(`2d`);if(!i)throw Error(`Canvas unsupported`);return i.clearRect(0,0,t,t),i.drawImage(n,0,0,t,t),await new Promise((e,t)=>r.toBlob(n=>n?e(n):t(Error(`PNG encode failed`)),`image/png`))}const a7=()=>new Date().toISOString(),o7=(e,t)=>`${e}_${t}_${a7().replace(/[:.]/g,`-`)}`,s7=(e,t,n)=>`${e}_${t}_${n}`,c7=(e,t)=>{let n=document.createElement(`a`);if(typeof e==`string`)n.href=e;else{let t=URL.createObjectURL(e);n.href=t,setTimeout(()=>URL.revokeObjectURL(t),0)}n.download=t,n.rel=`noopener`,document.body.appendChild(n),n.click(),n.remove()},l7=e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let n=String(r.result),i=n.indexOf(`,`),a=i>=0?n.slice(i+1):``;t({name:e.name,mime:e.type,size:e.size,encoded:a})},r.onerror=n,r.readAsDataURL(e)});var u7=18n;function d7(e){let t=1n;for(let n=0n;ne?`0.`:``).split(`.`),a=(r||`0`).replace(/^0+(?=\d)/,``)||`0`,o=(i+`0`.repeat(Number(u7))).slice(0,Number(u7));return n*(BigInt(a)*f7+BigInt(o||`0`))}function m7(e){let t=e<0n?`-`:``,n=e<0n?-e:e,r=n/f7,i=(n%f7).toString().padStart(Number(u7),`0`);return i=i.replace(/0+$/,``),i?`${t}${r}.${i}`:`${t}${r}`}function h7(e){try{let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e=0;e--)if(t[e]?.receiverSignature){n=e;break}let r=0n;for(let e=Math.max(0,n+1);e=0)i=g7(t[n]);else{let t=e.valuation;t&&typeof t.valuePhi==`number`&&(i=p7(String(t.valuePhi)))}let a=p7(e.branchSpentPhi??`0`)+r,o=e.segments?.length??0,s=e.cumulativeTransfers??0,c=s+t.length-1,l=await ws(await Promise.all(t.map(async e=>{let t={senderSignature:e.senderSignature,senderStamp:e.senderStamp,senderKaiPulse:e.senderKaiPulse};return e.payload&&(t.payload={name:e.payload.name,mime:e.payload.mime,size:e.payload.size}),e.receiverSignature&&(t.receiverSignature=e.receiverSignature),e.receiverStamp&&(t.receiverStamp=e.receiverStamp),e.receiverKaiPulse!=null&&(t.receiverKaiPulse=e.receiverKaiPulse),_s(JSON.stringify(t))}))),u=await Hs(e),d={version:1,segmentIndex:o,segmentRange:[s,c],segmentRoot:l,headHashAtSeal:u,leafHash:`sha256`,transfers:t},f=JSON.stringify(d),p=await _s(f),m=new Blob([f],{type:`application/json`}),h=[...e.segments??[],{index:o,root:l,cid:p,count:t.length}],g=await ws(h.map(e=>e.root));return{meta:{...e,segments:h,segmentsMerkleRoot:g,cumulativeTransfers:(e.cumulativeTransfers??0)+t.length,transfers:[],transfersWindowRoot:void 0,headHashAtSeal:u,segmentSize:e.segmentSize??2e3,...i>0n?{branchBasePhi:m7(i)}:{},branchSpentPhi:m7(a)},segmentFileBlob:m}}async function v7(e,t){if(t.kind===`head`)return!e.transfersWindowRoot||e.transfersWindowRoot!==t.windowMerkleRoot?!1:Es(e.transfersWindowRoot,t.transferProof);if(!e.segments||!e.segmentsMerkleRoot)return!1;let n=e.segments.find(e=>e.index===t.segmentIndex);if(!n||n.root!==t.segmentRoot)return!1;let r=t.segmentRoot,i=t.segmentIndex;for(let e of t.segmentsSiblings){let t=i%2==0?[r,e]:[e,r];r=await Cs(t[0]<=t[1]?t[0]:t[1],t[0]<=t[1]?t[1]:t[0]),i=Math.floor(i/2)}return r===e.segmentsMerkleRoot?Es(t.segmentRoot,t.transferProof):!1}var y7=e=>typeof e==`object`&&!!e,b7=e=>typeof e==`string`||typeof e==`number`||typeof e==`bigint`;function x7(e){return y7(e)}function S7(e){return y7(e)}function C7(e){return Array.isArray(e)?e.every(b7):y7(e)?Object.values(e).every(e=>b7(e)):!1}function w7(e){return typeof e==`object`&&!!e&&`verify`in e&&typeof e.verify==`function`}async function T7(){if(typeof window<`u`&&window.snarkjs?.groth16&&w7(window.snarkjs.groth16))return window.snarkjs.groth16;try{let e=await O(()=>import(`snarkjs`),[]),t=e.groth16??e.default?.groth16;if(w7(t))return t}catch{}return null}async function E7(e){let t=await T7();if(!t)return null;let n=e.vkey??e.fallbackVkey;return!x7(n)||!C7(e.publicSignals)||!S7(e.proof)?!1:!!await t.verify(n,e.publicSignals,e.proof)}async function D7(e){let t=e.zkVerifyingKey,n=typeof window<`u`?window.SIGIL_ZK_VKEY:void 0,r=t??n,i=e.hardenedTransfers??[];for(let e=0;ee?String(e).toLowerCase():``;function F7(e){let t=typeof e==`string`?e.trim():String(e??``);return t&&(t.replace(/[^0-9]/g,``)||`0`).replace(/^0+(?=\d)/,``)||`0`}function I7(e){let t=BigInt(2**53-1);return e>t?2**53-1:e<-t?-(2**53-1):Number(e)}function L7(){return I7(Kr())}function R7(){if(!M7)return[];try{let e=localStorage.getItem(O7);return e?JSON.parse(e):[]}catch{return[]}}function z7(){if(M7)try{if(localStorage.getItem(O7))return;for(let e of k7){let t=localStorage.getItem(e);if(t)try{let e=JSON.parse(t);if(!Array.isArray(e))continue;let n=[];for(let t of e){let e=t??{},r=P7(e.parentCanonical??e.parent??e.p),i=P7(e.childCanonical??e.child??e.c),a=F7(e.amountPhiScaled??e.amountScaled??e.a),o=Number(e.senderKaiPulse??e.k??0)||0,s=String(e.transferNonce??e.n??``),c=String(e.senderStamp??e.s??``),l=String(e.previousHeadRoot??e.r??``),u=String(e.transferLeafHashSend??e.l??``),d=!!e.confirmed,f=e.createdAt??e.t,p=(f==null?L7():Number(f))||L7();!r||!i||n.push({id:``,parentCanonical:r,childCanonical:i,amountPhiScaled:a,senderKaiPulse:o,transferNonce:s,senderStamp:c,previousHeadRoot:l,transferLeafHashSend:u,confirmed:d,createdAt:p})}(async()=>{for(let e of n)e.id=await H7({parentCanonical:e.parentCanonical,childCanonical:e.childCanonical,amountPhiScaled:e.amountPhiScaled,senderKaiPulse:e.senderKaiPulse,transferNonce:e.transferNonce,senderStamp:e.senderStamp,previousHeadRoot:e.previousHeadRoot,transferLeafHashSend:e.transferLeafHashSend});let e=new Map;for(let t of n)e.set(t.id,t);V7(Array.from(e.values()))})();return}catch{}}}catch{}}function B7(){z7();let e=R7();if(!Array.isArray(e))return[];let t=[];for(let n of e)try{let e=n,r={id:String(e.id??``),parentCanonical:P7(e.parentCanonical),childCanonical:P7(e.childCanonical),amountPhiScaled:F7(e.amountPhiScaled),senderKaiPulse:Number(e.senderKaiPulse??0)||0,transferNonce:String(e.transferNonce??``),senderStamp:String(e.senderStamp??``),previousHeadRoot:String(e.previousHeadRoot??``),transferLeafHashSend:String(e.transferLeafHashSend??``),confirmed:!!e.confirmed,createdAt:Number(e.createdAt??L7())||L7()};if(!r.parentCanonical||!r.childCanonical||!r.id)continue;t.push(r)}catch{}return t.sort((e,t)=>e.createdAt-t.createdAt),t}function V7(e){if(M7)try{let t=e.map(e=>({...e,parentCanonical:P7(e.parentCanonical),childCanonical:P7(e.childCanonical),amountPhiScaled:F7(e.amountPhiScaled),createdAt:Number(e.createdAt||L7())||L7()}));localStorage.setItem(O7,JSON.stringify(t))}catch{}}async function H7(e){return(await _s(JSON.stringify({p:P7(e.parentCanonical),c:P7(e.childCanonical),a:F7(e.amountPhiScaled),k:e.senderKaiPulse,n:e.transferNonce,s:e.senderStamp,r:e.previousHeadRoot,l:e.transferLeafHashSend}))).toLowerCase()}async function U7(e){let t=B7(),n=await H7(e);if(!t.some(e=>e.id===n)){let r={...e,id:n,parentCanonical:P7(e.parentCanonical),childCanonical:P7(e.childCanonical),amountPhiScaled:F7(e.amountPhiScaled),createdAt:L7()};V7([...t,r]),q7({type:`send:add`,record:r})}return n}function W7(e,t){let n=P7(e),r=String(t||``),i=B7(),a=!1;for(let e of i)e.parentCanonical===n&&e.transferLeafHashSend===r&&!e.confirmed&&(e.confirmed=!0,a=!0);a&&(V7(i),q7({type:`send:update`,parentCanonical:n}))}function G7(e){let t=P7(e);return B7().filter(e=>e.parentCanonical===t)}function K7(e){return G7(e).reduce((e,t)=>e+BigInt(F7(t.amountPhiScaled)),0n)}function q7(e){try{N7?.postMessage(e)}catch{}}var J7=({size:e=22,color:t=`currentColor`,label:n=`Inhale & Upload`})=>(0,W.jsxs)(`div`,{style:{display:`inline-flex`,alignItems:`center`,gap:`8px`,cursor:`pointer`,userSelect:`none`,transition:`transform 0.35s ease`},className:`inhale-upload`,title:n,children:[(0,W.jsxs)(`svg`,{viewBox:`0 0 64 64`,width:e,height:e,"aria-hidden":`true`,style:{display:`inline-block`,verticalAlign:`middle`,filter:`drop-shadow(0 0 6px rgba(55,255,228,0.25))`},children:[(0,W.jsx)(`circle`,{cx:`32`,cy:`32`,r:`28`,stroke:t,strokeWidth:`2`,fill:`none`,strokeDasharray:`4 6`,opacity:`0.6`,children:(0,W.jsx)(`animateTransform`,{attributeName:`transform`,type:`rotate`,values:`0 32 32;360 32 32`,dur:`6s`,repeatCount:`indefinite`})}),(0,W.jsx)(`path`,{d:`M32 44V18`,stroke:t,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,W.jsx)(`animate`,{attributeName:`stroke-dasharray`,values:`0,50;50,0;0,50`,dur:`3.236s`,repeatCount:`indefinite`})}),(0,W.jsx)(`polyline`,{points:`22,26 32,16 42,26`,fill:`none`,stroke:t,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,W.jsx)(`animateTransform`,{attributeName:`transform`,type:`translate`,values:`0 2;0 -2;0 2`,dur:`2.618s`,repeatCount:`indefinite`})}),(0,W.jsx)(`rect`,{x:`22`,y:`46`,width:`20`,height:`4`,rx:`2`,fill:t,opacity:`0.7`,children:(0,W.jsx)(`animate`,{attributeName:`opacity`,values:`0.5;1;0.5`,dur:`4s`,repeatCount:`indefinite`})})]}),(0,W.jsx)(`span`,{style:{fontFamily:`var(--font-sans, 'Inter', sans-serif)`,fontWeight:600,letterSpacing:`0.03em`,color:t,fontSize:`0.9rem`}})]}),Y7={full:{width:`100vw`,maxWidth:`100vw`,height:`100dvh`,maxHeight:`100dvh`,margin:0,padding:0,overflow:`hidden`},viewport:{display:`flex`,flexDirection:`column`,width:`100%`,height:`100%`,maxWidth:`100vw`,overflow:`hidden`},gridBar:{display:`grid`,gridTemplateColumns:`1fr auto`,alignItems:`center`},stickyTabs:{position:`sticky`,top:48,zIndex:2},mono:{overflowWrap:`anywhere`},iconBtn:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:44,height:44,padding:0,flex:`0 0 auto`},iconBtnSm:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:40,height:40,padding:0,flex:`0 0 auto`},modalBody:{flex:`1 1 auto`,minHeight:0,overflowY:`auto`,overflowX:`hidden`,paddingBottom:80},headerImg:{maxWidth:`64px`,height:`auto`,flex:`0 0 auto`},valueStrip:{overflowX:`auto`,whiteSpace:`nowrap`},popBg:{position:`fixed`,inset:0,zIndex:9999,background:`rgba(0,0,0,.55)`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:14},popCard:{width:`min(980px, 100%)`,maxHeight:`min(680px, calc(100dvh - 28px))`,borderRadius:18,overflow:`hidden`,background:`rgba(8,10,16,.92)`,border:`1px solid rgba(255,255,255,.12)`,boxShadow:`0 24px 70px rgba(0,0,0,.6)`,display:`flex`,flexDirection:`column`},popHead:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:10,padding:`12px 12px 10px 14px`,borderBottom:`1px solid rgba(255,255,255,.08)`},popBody:{flex:`1 1 auto`,minHeight:0,overflow:`auto`,padding:10},popTitle:{fontSize:12,color:`rgba(255,255,255,.82)`,letterSpacing:`.02em`}};function X7(e=[],t=16,n=.65){let r=(0,C.useRef)(null),i=(0,C.useRef)(null),[a,o]=(0,C.useState)(1);return(0,C.useEffect)(()=>{let e=r.current,a=i.current;if(!e||!a)return;let s=()=>{let r=Math.max(0,e.clientWidth-t),i=a.scrollWidth;if(r<=0||i<=0)return o(1);o(Math.min(1,Math.max(n,r/i)))};s();let c=new ResizeObserver(s);c.observe(e),c.observe(a),window.addEventListener(`resize`,s);let l=window.setInterval(s,250);return()=>{c.disconnect(),window.removeEventListener(`resize`,s),window.clearInterval(l)}},e),{boxRef:r,textRef:i,scale:a}}var Z7=({k:e,v:t,wide:n,mono:r})=>(0,W.jsxs)(`div`,{className:`kv${n?` wide`:``}`,children:[(0,W.jsx)(`span`,{className:`k`,children:e}),(0,W.jsx)(`span`,{className:`v${r?` mono`:``}`,style:r?Y7.mono:void 0,children:t})]}),Q7=({kind:e,trend:t,flash:n,title:r,children:i,onClick:a,ariaLabel:o})=>{let{boxRef:s,textRef:c,scale:l}=X7([i,t,n],16,.65),u=typeof a==`function`,d=e=>{u&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),a?.())};return(0,W.jsx)(`div`,{ref:s,className:`value-chip ${e} ${t}${n?` is-flashing`:``}${u?` is-clickable`:``}`,"data-trend":t,title:r,role:u?`button`:void 0,tabIndex:u?0:void 0,"aria-label":u?o||r:void 0,onClick:a,onKeyDown:d,style:u?{cursor:`pointer`,userSelect:`none`}:void 0,children:(0,W.jsx)(`span`,{ref:c,className:`amount`,style:{display:`inline-block`,whiteSpace:`nowrap`,lineHeight:1,transform:`scale(${l})`,transformOrigin:`left center`,willChange:`transform`},children:i})})},$7=({small:e,aria:t,titleText:n,path:r,...i})=>(0,W.jsx)(`button`,{...i,className:i.className||`secondary`,"aria-label":t,title:n,style:e?Y7.iconBtnSm:Y7.iconBtn,children:(0,W.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`18`,height:`18`,"aria-hidden":`true`,focusable:`false`,className:`ico`,children:(0,W.jsx)(`path`,{d:r,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`})})}),e9=`kai:sigils:v1`,t9=`sigil:urls`,n9=`kai-sigil-registry`;function r9(e){if(typeof window>`u`)return;let t=t=>{try{let n=window.localStorage.getItem(t),r=n?JSON.parse(n):[],i=Array.isArray(r)?r.slice():[];i.includes(e)||i.unshift(e),window.localStorage.setItem(t,JSON.stringify(i.slice(0,2e4)))}catch{}};t(e9),t(t9);try{let t=new BroadcastChannel(n9);t.postMessage({type:`add`,url:e}),t.close()}catch{}try{window.dispatchEvent(new CustomEvent(`kai:registry:add`,{detail:{url:e}}))}catch{}}var i9=1000000n,a9=17491270421n,o9=11000000n,s9=44,c9=36,l9=6,u9=[`Solhara`,`Aquaris`,`Flamora`,`Verdari`,`Sonari`,`Kaelith`],d9={Solhara:`Root`,Aquaris:`Sacral`,Flamora:`Solar Plexus`,Verdari:`Heart`,Sonari:`Throat`,Kaelith:`Crown`},f9=(a9+18n)/36n,p9=(e,t)=>(e%t+t)%t;function m9(e,t){let n=e/t,r=e%t;return r!==0n&&r>0n!=t>0n?n-1n:n}function h9(e){let t=(e-In)/qn*1e6,n=t<0?-1:1,r=Math.abs(t),i=Math.trunc(r),a=r-i,o=i;return a>.5?o=i+1:a===.5&&(o=i%2==0?i:i+1),BigInt(n)*BigInt(o)}function g9(e){if(e>=0n&&e<500000000n)return e*i9;let t=m9(e,i9);if(t>=0n&&t<500000000n)return e;let n=e/1000n,r=BigInt(2**53-1),i=BigInt(-(2**53-1));if(n>r||nBigInt(2**53-1)?2**53-1:Number(t),r=p9(e,i9),i=i9-r;return{pμ:e,pulse:n,μInPulse:r,msToNext:Math.max(0,Math.ceil(Number(i)*qn/1e6))}}function v9(e){let t=m9(e,i9),n=t<=0n?0:t>BigInt(2**53-1)?2**53-1:Number(t),r=p9(e,a9),i=m9(e,a9),a=Number(m9(r,f9)),o=Math.min(Math.max(a,0),c9-1),s=r-BigInt(o)*f9,c=Number(s/o9),l=Math.min(Math.max(c,0),s9-1),u=u9[Number(p9(i,BigInt(l9)))];return{pulse:n,beat:o,stepIndex:l,harmonicDay:u,chakraDay:d9[u]}}function y9(e){let[t,n]=(0,C.useState)(()=>_9()),r=(0,C.useRef)(null);return(0,C.useEffect)(()=>{if(r.current!==null&&(window.clearTimeout(r.current),r.current=null),!e)return;let t=()=>{let e=_9();n(t=>t.pulse===e.pulse?t:e),r.current=window.setTimeout(t,e.msToNext)};return t(),()=>{r.current!==null&&window.clearTimeout(r.current),r.current=null}},[e]),t}function b9(e){let[t,n]=(0,C.useState)(qn/1e3),r=(0,C.useRef)(null);return(0,C.useEffect)(()=>{if(r.current!==null&&(cancelAnimationFrame(r.current),r.current=null),!e)return;let t=()=>{let e=i9-_9().μInPulse,i=Number(e)*qn/1e6;n(Math.max(0,i/1e3)),r.current=requestAnimationFrame(t)};return r.current=requestAnimationFrame(t),()=>{r.current!==null&&cancelAnimationFrame(r.current),r.current=null}},[e]),e?t:null}function x9(){return _9().pulse}var S9=()=>{let e=(0,C.useRef)(null),t=(0,C.useRef)(null),n=(0,C.useRef)(null),r=(0,C.useRef)(null),i=y9(!0),a=(0,C.useMemo)(()=>v9(i.pμ),[i.pμ]);b9(!0);let o=a.pulse;(0,C.useMemo)(()=>`${a.beat}:${String(a.stepIndex).padStart(2,`0`)}`,[a.beat,a.stepIndex]);let[s,c]=(0,C.useState)(null),[l,u]=(0,C.useState)(null),[d,p]=(0,C.useState)(null),[m,h]=(0,C.useState)(null),[g,_]=(0,C.useState)(null),[v,y]=(0,C.useState)(null),[b,x]=(0,C.useState)(null),[S,w]=(0,C.useState)(null),[T,E]=(0,C.useState)(null),[D,k]=(0,C.useState)(null),[A,j]=(0,C.useState)(null),[M,N]=(0,C.useState)(`PHI`),[P,F]=(0,C.useState)(``),[I,L]=(0,C.useState)(``),[R,z]=(0,C.useState)(`idle`),[B,V]=(0,C.useState)(`summary`),[H,U]=(0,C.useState)(null),[ee,te]=(0,C.useState)(!1),[ne,re]=(0,C.useState)(null),[ie,ae]=(0,C.useState)(!1),[oe,se]=(0,C.useState)(``),[ce,le]=(0,C.useState)(``),[ue,de]=(0,C.useState)(!1),[fe,pe]=(0,C.useState)(!1),[me,he]=(0,C.useState)(null),[ge,_e]=(0,C.useState)(!1);(0,C.useEffect)(()=>{let e=n.current;e&&(ge?e.setAttribute(`data-rotate`,`true`):e.removeAttribute(`data-rotate`))},[ge]);let[ve,ye]=(0,C.useState)(null);(0,C.useEffect)(()=>{(async()=>{try{ye(await X5())}catch(e){Mo(`loadOrCreateKeypair`,e)}})()},[]),(0,C.useEffect)(()=>{let e=!0;return(async()=>{try{let t=await fetch(`/verification_key.json`,{cache:`no-store`});if(!t.ok)return;let n=await t.json();if(!e)return;window.SIGIL_ZK_VKEY=n}catch(e){Mo(`fetch(/verification_key.json)`,e)}})(),()=>{e=!1}},[]);let[be,xe]=(0,C.useState)(null),[Se,Ce]=(0,C.useState)(null),we=()=>tc(n.current),Te=()=>{U(null),z(`idle`),V(`summary`),te(!1),F(``),L(``),j(null),e.current&&(e.current.value=``),t.current&&(t.current.value=``),n.current?.close(),n.current?.setAttribute(`data-open`,`false`)},Ee=(0,C.useMemo)(()=>ss({meta:m,sigilSvgRaw:me,verifyUrl:oe||(typeof window<`u`?window.location.href:``),pulseNow:o}),[m,me,oe,o]),De=()=>nc(n.current,()=>{let e=r.current;if(!e)return;let t=ss({meta:m,sigilSvgRaw:me,verifyUrl:oe||(typeof window<`u`?window.location.href:``),pulseNow:o}),n={getNoteData:async()=>t};window.KKVerifier=n;try{window.dispatchEvent(new CustomEvent(`kk:note-data`,{detail:t}))}catch(e){Mo(`dispatch(kk:note-data)`,e)}tc(e),pe(!0)}),Oe=()=>{let e=r.current;e?.close(),e?.setAttribute(`data-open`,`false`),pe(!1)},ke=()=>nc(n.current,()=>de(!0)),Ae=()=>de(!1),je=async e=>{if(!m)return;let t=gu(m,e);h(t),p(JSON.stringify(t,null,2)),s&&c7(await r7(s,t),`${s7(`sigil_with_valuation`,t.pulse??0,o)}.svg`),de(!1)},Me=(0,C.useCallback)(async e=>{let t=e.transfers??[],n=await(await O(async()=>{let{computeHeadWindowRoot:e}=await import(`./sigilUtils-u_f46p8-.js`);return{computeHeadWindowRoot:e}},[])).computeHeadWindowRoot(t);if(e.transfersWindowRoot=n,t.length>0){let r=await Promise.all(t.map(Ns)),i=r.length-1,a=await Ts(r,i),o=await Es(n,a),s=await v7(e,{kind:`head`,windowMerkleRoot:n,transferProof:a});re({ok:o&&s,index:i,root:n})}else re(null);try{e.transfersWindowRootV14=await ws(await Promise.all((e.hardenedTransfers??[]).map(async e=>_s(ks({previousHeadRoot:e.previousHeadRoot,senderPubKey:e.senderPubKey,senderSig:e.senderSig,senderKaiPulse:e.senderKaiPulse,nonce:e.nonce,transferLeafHashSend:e.transferLeafHashSend,receiverPubKey:e.receiverPubKey,receiverSig:e.receiverSig,receiverKaiPulse:e.receiverKaiPulse,transferLeafHashReceive:e.transferLeafHashReceive,zkSend:e.zkSend??null,zkReceive:e.zkReceive??null})))))}catch(e){Mo(`refreshHeadWindow.buildMerkleRoot(v14)`,e)}try{await D7(e),h({...e})}catch(e){Mo(`refreshHeadWindow.verifyZkOnHead`,e)}return e},[]),Ne=(0,C.useCallback)(async e=>{let t=e.canonicalHash?.toLowerCase()||(await _s(`${e.pulse}|${e.beat}|${e.stepIndex}|${e.chakraDay}`)).toLowerCase();return e.childOfHash?.toLowerCase()&&(e.canonicalHash?.toLowerCase()??``)!==t?!0:(e.canonicalHash?.toLowerCase()??``)!==t},[]),Pe=(0,C.useCallback)(async e=>{let t=e.canonicalHash?.toLowerCase()||(await _s(`${e.pulse}|${e.beat}|${e.stepIndex}|${e.chakraDay}`)).toLowerCase();if(await Ne(e)){let t=e.canonicalHash.toLowerCase(),n=!!e.sendLock?.used,r=!!(e.transfers??[]).slice(-1)[0]?.receiverSignature;return{canonical:t,context:n||r?`parent`:`derivative`}}let n=(e.transfers??[]).slice(-1)[0],r=(e.hardenedTransfers??[]).slice(-1)[0];if(!(n&&!n.receiverSignature))return{canonical:t,context:`parent`};let i=n?await Fs(n):``,a=r?.previousHeadRoot||e.transfersWindowRootV14||e.transfersWindowRoot||``;return{canonical:(await _s(ks({parent:t,nonce:e.transferNonce||``,senderStamp:n?.senderStamp||``,senderKaiPulse:n?.senderKaiPulse||0,prevHead:a,leafSend:i}))).toLowerCase(),context:`derivative`}},[Ne]),Fe=async e=>{let t=e.target.files?.[0];if(!t)return;try{he(await t.text())}catch(e){Mo(`handleSvg.readFile`,e),he(null)}u(t.name||null),U(null),j(null),V(`summary`),te(!1);let n=URL.createObjectURL(t);c(n);let{meta:r,contextOk:i,typeOk:a}=await t7(t);r.segmentSize??=hs;let o=(r.segments??[]).reduce((e,t)=>e+(t.count||0),0);typeof r.cumulativeTransfers!=`number`&&(r.cumulativeTransfers=o+(r.transfers?.length??0)),(r.segments?.length??0)>0&&!r.segmentsMerkleRoot&&(r.segmentsMerkleRoot=await ws((r.segments??[]).map(e=>e.root)));let{sig:s,rgb:l}=await n7(n,typeof r.pulse==`number`?r.pulse:x9());E(s),k(l);let d=await As(r);_(d);let f=d&&r.kaiSignature?d.toLowerCase()===r.kaiSignature.toLowerCase():null;if(y(f),r.kaiSignature){let e=await js(r.kaiSignature);x(e),w(r.userPhiKey?e===r.userPhiKey:null)}else x(null),w(null);try{if(r.creatorPublicKey){let e=await Ss(r.creatorPublicKey);r.userPhiKey||=e}}catch(e){Mo(`handleSvg.phiFromPublicKey`,e)}let m=typeof r.pulse==`number`&&typeof r.beat==`number`&&typeof r.stepIndex==`number`&&typeof r.chakraDay==`string`,g=r.transfers?.slice(-1)[0],v=g?.receiverSignature||g?.senderSignature||null,b=v&&s?v===s:null,S=!!(r.transfers&&r.transfers.length>0),C=!!(g&&!g.receiverSignature),T=!!(g&&g.receiverSignature),D=!r.kaiSignature,O=await Me(r),A=null;try{let e=await Pe(O);xe(e.canonical),Ce(e.context),A=e.context}catch(e){Mo(`computeEffectiveCanonical`,e),xe(null),Ce(null)}let{used:M,expired:P}=cs(O,x9()),{expired:I}=ls(O,x9());h(O),p(JSON.stringify(O,null,2)),z(us({contextOk:i,typeOk:a,hasCore:m,contentSigMatches:f,isOwner:b,hasTransfers:S,lastOpen:C,lastClosed:T,isUnsigned:D,childUsed:M,childExpired:P,parentOpenExpired:I,isChildContext:A===`derivative`})),N(`PHI`),F(``),L(``),we(),e.target&&(e.target.value=``)},Ie=async e=>{let t=e.target.files?.[0];t&&j(await l7(t))},Le=async()=>{if(!m||!s)return;let e={...m},t=x9();if(!e.kaiSignature){let t=await As(e);if(!t){U(`Cannot compute kaiSignature — missing core fields.`);return}e.kaiSignature=t}!e.userPhiKey&&e.kaiSignature&&(e.userPhiKey=await js(e.kaiSignature)),typeof e.kaiPulse!=`number`&&(e.kaiPulse=t);try{!e.creatorPublicKey&&ve&&(e.creatorPublicKey=ve.spkiB64u)}catch(e){Mo(`sealUnsigned.creatorPublicKey`,e)}c7(await r7(s,e),`${o7(`sigil_sealed`,t)}.svg`);let n=await Me(e);h(n),p(JSON.stringify(n,null,2)),z(e=>e===`unsigned`?`readySend`:e),U(null)};async function Re(e,t){let n=JSON.parse(JSON.stringify(e));return n.canonicalHash=t.childCanonical,n.childOfHash=t.parentCanonical,n.childAllocationPhi=t.allocationPhiStr,n.childIssuedPulse=t.issuedPulse,n.childClaim={steps:7,expireAtPulse:t.issuedPulse+77},n.sendLock={nonce:e.transferNonce,used:!1},n.branchBasePhi=t.allocationPhiStr,n.branchSpentPhi=`0`,n}let ze=(0,C.useCallback)(async e=>{let t=e.canonicalHash?.toLowerCase()||(await _s(`${e.pulse}|${e.beat}|${e.stepIndex}|${e.chakraDay}`)).toLowerCase(),r=(e.transfers??[]).slice(-1)[0],i=(e.hardenedTransfers??[]).slice(-1)[0],a=r?await Fs(r):``,o=(await _s(ks({parent:t,nonce:e.transferNonce||``,senderStamp:r?.senderStamp||``,senderKaiPulse:r?.senderKaiPulse||0,prevHead:i?.previousHeadRoot||e.transfersWindowRootV14||e.transfersWindowRoot||``,leafSend:a}))).toLowerCase(),s=e.transferNonce||Ws(),c=e.chakraDay||`Root`,l={pulse:e.pulse,beat:e.beat,stepIndex:e.stepIndex,chakraDay:c,kaiSignature:e.kaiSignature,userPhiKey:e.userPhiKey},u={steps:7,expireAtPulse:(r?.senderKaiPulse??x9())+77,stepsPerBeat:e.stepsPerBeat??44},d;try{if(r?.payload?.mime?.startsWith(`application/vnd.kairos-exhale`)){let e=JSON.parse(Po(r.payload.encoded));e?.kind===`exhale`&&(d={unit:e.unit,amountPhi:e.amountPhi,amountUsd:e.amountUsd,usdPerPhi:e.usdPerPhi})}}catch(e){Mo(`shareTransferLink.previewDecode`,e)}let f={...l,canonicalHash:o,parentHash:t,transferNonce:s,claim:u,preview:d},p=``;try{let{makeSigilUrl:e}=await O(async()=>{let{makeSigilUrl:e}=await import(`./sigilUrl-rhYoayXy.js`);return{makeSigilUrl:e}},[]);p=e(o,l)}catch(e){Mo(`shareTransferLink.makeSigilUrl`,e);let t=new URL(typeof window<`u`?window.location.href:`http://localhost`);t.pathname=`/s/${o}`,p=t.toString()}let m;try{let{encodeSigilHistory:t}=await O(async()=>{let{encodeSigilHistory:e}=await import(`./sigilUrl-rhYoayXy.js`);return{encodeSigilHistory:e}},[]),n=[];for(let t of e.transfers??[])!t?.senderSignature||typeof t.senderKaiPulse!=`number`||n.push(typeof t.receiverSignature==`string`&&typeof t.receiverKaiPulse==`number`?{s:t.senderSignature,p:t.senderKaiPulse,r:t.receiverSignature}:{s:t.senderSignature,p:t.senderKaiPulse});let r=t(n);m=r.startsWith(`h:`)?r.slice(2):r}catch(e){Mo(`shareTransferLink.encodeSigilHistory`,e)}let h=qs(p,f,s,m);se(h),le(o),_e(!0),r9(h),nc(n.current,()=>ae(!0));try{fs([t],s)}catch(e){Mo(`shareTransferLink.publishRotation`,e)}},[]),Be=(0,C.useCallback)(async e=>{h(e),p(JSON.stringify(e,null,2));let t=typeof e.pulse==`number`&&typeof e.beat==`number`&&typeof e.stepIndex==`number`&&typeof e.chakraDay==`string`,n=e.transfers?.slice(-1)[0],r=n?.receiverSignature||n?.senderSignature||null,i=r&&T?r===T:null,a=!!(e.transfers&&e.transfers.length>0),o=!!(n&&!n.receiverSignature),s=!!(n&&n.receiverSignature),c=!e.kaiSignature,l=null;try{let t=await Pe(e);xe(t.canonical),Ce(t.context),l=t.context}catch(e){Mo(`syncMetaAndUi.computeEffectiveCanonical`,e),xe(null),Ce(null)}let{used:u,expired:d}=cs(e,x9()),{expired:f}=ls(e,x9());z(us({contextOk:!0,typeOk:!0,hasCore:t,contentSigMatches:g&&e.kaiSignature?g.toLowerCase()===e.kaiSignature.toLowerCase():null,isOwner:i,hasTransfers:a,lastOpen:o,lastClosed:s,isUnsigned:c,childUsed:u,childExpired:d,parentOpenExpired:f,isChildContext:l===`derivative`}))},[T,Pe,g]),Ve=(0,C.useCallback)(e=>{let t=(e||``).trim();return t?(t.startsWith(`.`)&&(t=`0`+t),t=t.replace(/\.?$/,e=>/\.\d/.test(t)?e:``),t):`0`},[]),He=(0,C.useCallback)(e=>new Intl.NumberFormat(void 0,{minimumFractionDigits:2,maximumFractionDigits:2,useGrouping:!0}).format(Math.max(0,e||0)),[]),Ue=(0,C.useMemo)(()=>typeof navigator<`u`&&typeof navigator.share==`function`,[]);(0,C.useEffect)(()=>()=>{if(s?.startsWith(`blob:`))try{URL.revokeObjectURL(s)}catch(e){Mo(`revokeObjectURL`,e)}},[s]);let We=(0,C.useMemo)(()=>{if(!m)return null;let e=m,t=typeof e.stepsPerBeat==`number`?e.stepsPerBeat:12,n=e.transfersWindowRoot??e.transfersWindowRootV14??``;return{pulse:m.pulse,beat:m.beat,stepIndex:m.stepIndex,stepsPerBeat:t,chakraDay:m.chakraDay||`Root`,kaiSignature:m.kaiSignature??``,userPhiKey:m.userPhiKey??``,transfersWindowRoot:n,canonicalContext:Se??void 0,childOfHash:e.childOfHash??void 0,sendLock:e.sendLock??void 0,childClaim:e.childClaim??void 0,childAllocationPhi:e.childAllocationPhi??void 0,branchBasePhi:e.branchBasePhi??void 0,valuationSource:e.valuationSource,stats:e.stats,fileName:l??void 0}},[m,Se,l]),Ge=(0,C.useMemo)(()=>{if(!m)return null;let e=sc(m,[`chakraGate`,`valuationSource.chakraGate`])||cc(m,`data-chakra-gate`)||null;return e?e.replace(/\bgate\b/gi,``).replace(/\s{2,}/g,` `).trim()||e:null},[m]),[Ke,qe]=(0,C.useState)(null);(0,C.useEffect)(()=>{let e=!1;return(async()=>{if(!We){qe(null);return}let t=(m?.canonicalHash)?.toLowerCase()||(await _s(`${We.pulse}|${We.beat}|${We.stepIndex}|${We.chakraDay}`)).toLowerCase();try{let{seal:n}=await hu(We,o,_s,m?.transfersWindowRoot||m?.transfersWindowRootV14||``);e||qe({hash:t,value:n.valuePhi??0,pulseCreated:We.pulse??o,meta:We})}catch(n){Mo(`buildValueSeal`,n),e||qe({hash:t,value:0,pulseCreated:We.pulse??o,meta:We})}})(),()=>{e=!0}},[We,m,o]),(0,C.useEffect)(()=>{!fe||me||!s||(async()=>{try{he(await fetch(s).then(e=>e.text()))}catch(e){Mo(`ensureRawSvgForNote`,e)}})()},[fe,me,s]);let Je=Wu,{usdPerPhi:Ye}=(0,C.useMemo)(()=>{try{return{usdPerPhi:Qu({meta:We??{pulse:0,beat:0,stepIndex:0,stepsPerBeat:12,chakraDay:`Root`,kaiSignature:``,userPhiKey:``,transfersWindowRoot:``},nowPulse:o,usd:100,currentStreakDays:0,lifetimeUsdSoFar:0},Je).usdPerPhi??0}}catch(e){return Mo(`quotePhiForUsd`,e),{usdPerPhi:0}}},[We,o,Je]),Xe=(0,C.useMemo)(()=>Ro(m?.branchBasePhi??``),[m]),Ze=(0,C.useMemo)(()=>Ro(m?.branchSpentPhi??`0`),[m]),Qe=(0,C.useMemo)(()=>{let e=m?.transfers??[];for(let t=e.length-1;t>=0;--t)if(e[t]?.receiverSignature)return t;return e.length>0?e.length-1:-1},[m?.transfers]),$e=(0,C.useMemo)(()=>{let e=m?.transfers??[],t=0;for(let n=e.length-1;n>=0;--n)if(e[n]?.receiverSignature&&++t===2)return n;return-1},[m?.transfers]),et=(0,C.useMemo)(()=>(m?.transfers??[]).slice(-1)[0],[m?.transfers]),tt=(0,C.useMemo)(()=>Se===`derivative`,[Se]),nt=(0,C.useMemo)(()=>{if(tt){let e=m?.childAllocationPhi;if(e){let t=Ro(e);if(t>0n)return t}let t=Ro(zo(Go(et)));return t>0n?t:0n}if(Xe>0n)return Xe;if(Qe>=0&&m?.transfers){let e=Go(m.transfers[Qe]);return e>0n?e:0n}return Ro(String(Ke?.value??0)||`0`)},[tt,m,et,Xe,Qe,Ke]),rt=(0,C.useMemo)(()=>{try{let e=m?.transfers??[],t=0n;for(let n=Math.max(0,Qe+1);n{try{let e=m?.transfers??[];if(Qe<=0)return 0n;let t=Math.max(0,$e+1),n=Math.max(t,Qe),r=0n;for(let i=t;i{if(!be)return 0n;try{return K7(be)}catch(e){return Mo(`ledgerSpentScaled`,e),0n}},[be]),ot=(0,C.useMemo)(()=>Ze>it?Ze:it,[Ze,it]),st=(0,C.useMemo)(()=>tt?0n:ot+rt,[tt,ot,rt]),ct=(0,C.useMemo)(()=>at>st?at:st,[at,st]),lt=(0,C.useMemo)(()=>nt>ct?nt-ct:0n,[nt,ct]),ut=(0,C.useMemo)(()=>Uo(Ho(lt,4),4),[lt]),dt=(0,C.useMemo)(()=>Jo(Number(zo(lt))),[lt]),ft=(0,C.useMemo)(()=>Ro((Ye||0).toFixed(18)),[Ye]),pt=(0,C.useMemo)(()=>Number(zo(Bo(lt,ft)))||0,[lt,ft]),[mt,ht]=(0,C.useState)(`flat`),[gt,_t]=(0,C.useState)(`flat`),[vt,yt]=(0,C.useState)(!1),[bt,xt]=(0,C.useState)(!1),St=(0,C.useRef)(dt),Ct=(0,C.useRef)(pt),wt=(0,C.useRef)(dt),Tt=(0,C.useRef)(Math.round(pt*100)/100),Et=(0,C.useRef)(null),Dt=(0,C.useRef)(null);(0,C.useEffect)(()=>{St.current=dt},[dt]),(0,C.useEffect)(()=>{Ct.current=pt},[pt]),(0,C.useEffect)(()=>{let e=1e-9,t=()=>{let t=St.current,n=t-wt.current,r=n>e?`up`:n<-e?`down`:`flat`;r!==`flat`&&Math.abs(n)>e?(ht(r),yt(!0),Et.current&&window.clearTimeout(Et.current),Et.current=window.setTimeout(()=>yt(!1),420)):ht(`flat`),wt.current=t;let i=Math.round(Ct.current*100)/100,a=i-Tt.current,o=a>e?`up`:a<-e?`down`:`flat`;o!==`flat`&&Math.abs(a)>e?(_t(o),xt(!0),Dt.current&&window.clearTimeout(Dt.current),Dt.current=window.setTimeout(()=>xt(!1),420)):_t(`flat`),Tt.current=i};wt.current=St.current,Tt.current=Math.round(Ct.current*100)/100;let n=window.setInterval(t,EC);return()=>{window.clearInterval(n),Et.current&&window.clearTimeout(Et.current),Dt.current&&window.clearTimeout(Dt.current)}},[]);let[Ot,kt]=(0,C.useState)(!1),[At,jt]=(0,C.useState)(`phi`),[Mt,Nt]=(0,C.useState)(0),Pt=(0,C.useCallback)(e=>{jt(e),kt(!0),Nt(e=>e+1)},[]);(0,C.useEffect)(()=>{Ot&&Nt(e=>e+1)},[Ot,At]);let Ft=(0,C.useCallback)(()=>{kt(!1)},[]);(0,C.useEffect)(()=>{if(!Ot)return;let e=e=>{e.key===`Escape`&&Ft()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Ot,Ft]);let It=(0,C.useMemo)(()=>{if(M===`PHI`){let e=$o(Qo(Ve(P))),t=Bo(Ro(e),ft),n=Number(zo(t));return{displayLeftLabel:`Φ`,displayRight:Number.isFinite(n)?`$ ${He(n)}`:`$ 0.00`,phiStringToSend:e,usdNumberAtSend:Number.isFinite(n)?n:0}}let e=Ro(I),t=Vo(e,ft),n=Uo(Ho(t,6),6);return{displayLeftLabel:`$`,displayRight:`≈ Φ ${Uo(Ho(t,4),4)}`,phiStringToSend:n,usdNumberAtSend:Number(zo(e))||0}},[M,P,I,ft,He,Ve]),Lt=(0,C.useMemo)(()=>Ro(It.phiStringToSend||`0`)>0n&&Ro(It.phiStringToSend||`0`)<=lt,[It.phiStringToSend,lt]),Rt=(0,C.useCallback)(async()=>{if(!m||!s)return;let e=await r7(s,m),t=await fetch(e).then(e=>e.blob()),n=null;try{n=await i7(e,1024)}catch(e){Mo(`pngBlobFromSvgDataUrl`,e)}let{default:r}=await O(async()=>{let{default:e}=await import(`./jszip.min-OPHeGHZp.js`).then(f(1));return{default:e}},[]),i=new r,a=s7(`sigil_bundle`,m.pulse??0,m.transfers?.slice(-1)[0]?.senderKaiPulse??m.kaiPulse??x9());i.file(`${a}.svg`,t),n&&i.file(`${a}.png`,n),c7(await i.generateAsync({type:`blob`}),`${a}.zip`)},[m,s]),zt=(0,C.useMemo)(()=>(l||``).toLowerCase().includes(`sigil_send`),[l]),Bt=async()=>{if(!m||!s||!T)return;if(m.kaiSignature&&g&&m.kaiSignature.toLowerCase()!==g.toLowerCase()){U(`Content signature mismatch — cannot send.`),z(`sigMismatch`);return}let e={...m};if(!e.kaiSignature){let t=await As(e);if(!t){U(`Cannot compute kaiSignature — missing core fields.`);return}e.kaiSignature=t,e.userPhiKey||=await js(t)}typeof e.kaiPulse!=`number`&&(e.kaiPulse=x9());let t=x9(),n=await _s(`${T}-${e.pulse??0}-${t}`),r=(It.phiStringToSend||``).trim(),i=Ro(r);if(i<=0n){U(`Enter a Φ amount greater than zero.`);return}if(i>lt){U(`Exhale exceeds resonance Φ — requested Φ ${Uo(i,4)} but only Φ ${ut} remains on this glyph.`);return}let a=Number.isFinite(It.usdNumberAtSend)?Math.max(0,It.usdNumberAtSend):0,o;{let n={kind:`exhale`,unit:M,amountPhi:r,amountUsd:a.toFixed(2),usdPerPhi:Ye||0,atPulse:t,kaiSignature:e.kaiSignature||``,userPhiKey:e.userPhiKey||``};o={name:`exhale_${r.replace(/\./g,`_`)}phi.json`,mime:`application/vnd.kairos-exhale+json`,size:No(JSON.stringify(n)).length,encoded:No(JSON.stringify(n))}}!o&&A&&(o=A);let c={senderSignature:T,senderStamp:n,senderKaiPulse:t,payload:o??void 0},l={...e,"@context":e[`@context`]??`https://schema.phi.network/sigil/v1`,type:e.type??`application/phi.kairos.sigil+svg`,canonicalHash:e.canonicalHash||void 0,transferNonce:e.transferNonce||Ws(),transfers:[...e.transfers??[],c],segmentSize:e.segmentSize??2e3};try{let e=Ro(m?.branchSpentPhi??`0`)+i;l.branchBasePhi=m?.branchBasePhi??zo(nt),l.branchSpentPhi=zo(e)}catch(e){Mo(`send.persistBranchProgress`,e)}let u=``,d=``,f=``,p=``;try{if(u=l.canonicalHash?.toLowerCase()||(await _s(`${l.pulse}|${l.beat}|${l.stepIndex}|${l.chakraDay}`)).toLowerCase(),ve){l.creatorPublicKey??=ve.spkiB64u,p=await zs(l,l.hardenedTransfers?.length??0),f=await Fs(c);let e=l.transferNonce,n=await O(()=>import(`./sigilUtils-u_f46p8-.js`),[]),r=n.buildSendMessageV14(l,{previousHeadRoot:p,senderKaiPulse:t,senderPubKey:l.creatorPublicKey,nonce:e,transferLeafHashSend:f}),i=await Z5(ve.priv,r),a={previousHeadRoot:p,senderPubKey:l.creatorPublicKey,senderSig:i,senderKaiPulse:t,nonce:e,transferLeafHashSend:f};if(window.SIGIL_ZK?.provideSendProof)try{let t=await window.SIGIL_ZK.provideSendProof({meta:l,leafHash:f,previousHeadRoot:p,nonce:e});if(t){a.zkSendBundle={scheme:`groth16`,curve:`BLS12-381`,proof:t.proof,publicSignals:t.publicSignals,vkey:t.vkey};let e=await n.hashAny(t.publicSignals),r=await n.hashAny(t.proof),i=t.vkey??l.zkVerifyingKey??window.SIGIL_ZK_VKEY;a.zkSend={scheme:`groth16`,curve:`BLS12-381`,publicHash:e,proofHash:r,vkeyHash:i?await n.hashAny(i):void 0}}}catch(e){Mo(`provideSendProof`,e)}l.hardenedTransfers=[...l.hardenedTransfers??[],a]}d=(await _s(ks({parent:u,nonce:l.transferNonce||``,senderStamp:c.senderStamp||``,senderKaiPulse:c.senderKaiPulse||0,prevHead:p||l.transfersWindowRootV14||l.transfersWindowRoot||``,leafSend:f}))).toLowerCase();let e={parentCanonical:u,childCanonical:d,amountPhiScaled:Ro(r).toString(),senderKaiPulse:t,transferNonce:l.transferNonce,senderStamp:n,previousHeadRoot:p,transferLeafHashSend:f};try{await U7(e)}catch(e){Mo(`recordSend`,e)}try{rc().registerSend?.(e)}catch(e){Mo(`__SIGIL__.registerSend`,e)}try{window.dispatchEvent(new CustomEvent(`sigil:sent`,{detail:e}))}catch(e){Mo(`dispatchEvent(sigil:sent)`,e)}}catch(e){Mo(`send.hardenedBuild/ledger`,e)}if(c7(await r7(s,await Re(l,{parentCanonical:u,childCanonical:d,allocationPhiStr:r,issuedPulse:t})),`${s7(`sigil_send`,l.pulse??0,t)}.svg`),(l.transfers??[]).length>=(l.segmentSize??2e3)){let{meta:e,segmentFileBlob:n}=await _7(l);n&&c7(n,`sigil_segment_${e.pulse??0}_${String((e.segments?.length??1)-1).padStart(6,`0`)}.json`),c7(await r7(s,e),`${s7(`sigil_head_after_seal`,e.pulse??0,t)}.svg`);let r=await Me(e);await Be(r),U(null),F(``),L(``),await ze(r);return}let h=await Me(l);await Be(h),U(null),F(``),L(``),await ze(h)},Vt=async()=>{if(!m||!s||!T)return;if(Se===`parent`){let{expired:e}=ls(m,x9());if(e){U(`This open send has expired.`);return}}let{used:e,expired:t}=cs(m,x9());if(e){U(`This transfer link has already been used.`);return}if(t){U(`This transfer link has expired.`),z(`complete`);return}let n=m.transfers?.slice(-1)[0];if(!n||n.receiverSignature)return;let r=x9(),i={...n,receiverSignature:T,receiverStamp:await _s(`${T}-${n.senderStamp}-${r}`),receiverKaiPulse:r},a={...m,transfers:[...(m.transfers??[]).slice(0,-1),i]};try{if(ve&&(a.hardenedTransfers?.length??0)>0){let e=a.hardenedTransfers[a.hardenedTransfers.length-1];if(!e.receiverSig){a.creatorPublicKey??=ve.spkiB64u;let t=await Ns(i),n=await O(()=>import(`./sigilUtils-u_f46p8-.js`),[]),o=n.buildReceiveMessageV14({previousHeadRoot:e.previousHeadRoot,senderSig:e.senderSig,receiverKaiPulse:r,receiverPubKey:a.creatorPublicKey,transferLeafHashReceive:t}),s=await Z5(ve.priv,o),c={...e,receiverPubKey:a.creatorPublicKey,receiverSig:s,receiverKaiPulse:r,transferLeafHashReceive:t};if(window.SIGIL_ZK?.provideReceiveProof)try{let r=await window.SIGIL_ZK.provideReceiveProof({meta:a,leafHash:t,previousHeadRoot:e.previousHeadRoot,linkSig:e.senderSig});if(r){c.zkReceiveBundle={scheme:`groth16`,curve:`BLS12-381`,proof:r.proof,publicSignals:r.publicSignals,vkey:r.vkey};let e=await n.hashAny(r.publicSignals),t=await n.hashAny(r.proof),i=r.vkey??a.zkVerifyingKey??window.SIGIL_ZK_VKEY;c.zkReceive={scheme:`groth16`,curve:`BLS12-381`,publicHash:e,proofHash:t,vkeyHash:i?await n.hashAny(i):void 0}}}catch(e){Mo(`provideReceiveProof`,e)}a.hardenedTransfers=[...a.hardenedTransfers.slice(0,-1),c];try{let t=a.childOfHash?.toLowerCase()||(await _s(`${a.pulse}|${a.beat}|${a.stepIndex}|${a.chakraDay}`)).toLowerCase();e.transferLeafHashSend&&W7(t,e.transferLeafHashSend)}catch(e){Mo(`ledger.markConfirmedByLeaf`,e)}}}}catch(e){Mo(`receive.hardenedSeal`,e)}try{await Ne(a)&&(a.sendLock={...a.sendLock??{nonce:a.transferNonce},used:!0,usedPulse:r})}catch(e){Mo(`receive.setUsedLock`,e)}c7(await r7(s,a),`${s7(`sigil_receive`,a.pulse??0,r)}.svg`),await Be(await Me(a)),U(null)},Ht=(0,C.useCallback)(async()=>{if(!m||!m.transfers?.length)return;if(zt){U(`Segmentation is disabled on SEND sigils.`);return}let{meta:e,segmentFileBlob:t}=await _7(m);t&&c7(t,`sigil_segment_${e.pulse??0}_${String((e.segments?.length??1)-1).padStart(6,`0`)}.json`),s&&c7(await r7(s,e),`${s7(`sigil_head_after_seal`,e.pulse??0,x9())}.svg`),await Be(await Me(e)),U(null)},[m,s,zt,Me,Be]),Ut=(0,C.useMemo)(()=>sc(m,[`frequencyHz`,`valuationSource.frequencyHz`])||cc(m,`data-frequency-hz`),[m]),Wt=(0,C.useMemo)(()=>is(m??{}),[m]),Gt=(0,C.useMemo)(()=>{if(Se!==`derivative`)return null;let e=cs(m,o);if(!e.expireAt)return null;let t=Math.max(0,e.expireAt-o);return{leftPulses:t,leftSteps:Math.ceil(t/11),expireAt:e.expireAt}},[m,o,Se]),{used:Kt,expired:qt}=(0,C.useMemo)(()=>cs(m,o),[m,o]),Jt=(0,C.useMemo)(()=>ls(m,o).expired,[m,o]);function Yt({seriesKey:e,sampleMs:t,valuePhi:n,usdPerPhi:r,maxPoints:i=2048,snapKey:a}){let[o,s]=C.useState([]),c=C.useRef([]),l=C.useRef(n),u=C.useRef(r);C.useEffect(()=>{Number.isFinite(n)&&(l.current=n)},[n]),C.useEffect(()=>{Number.isFinite(r)&&r>0&&(u.current=r)},[r]);let d=C.useCallback(()=>{let e=x9(),t=Number.isFinite(l.current)?l.current:0,n=Number.isFinite(u.current)&&u.current>0?u.current:0,r=c.current;if(!r.length){let r=[{i:e-1,value:t,fx:n},{i:e,value:t,fx:n}];c.current=r,s(r);return}let a=r[r.length-1],o;o=a?.i===e?[...r.slice(0,-1),{...a,value:t,fx:n}]:typeof a?.i==`number`&&a.ii&&o.splice(0,o.length-i),c.current=o,s(o)},[i]);return C.useEffect(()=>{c.current=[],s([]),d()},[e,d]),C.useEffect(()=>{d()},[n,r,d]),C.useEffect(()=>{typeof a==`number`&&d()},[a,d]),C.useEffect(()=>{let e=window.setInterval(()=>{let e=x9(),t=c.current;if(t[t.length-1]?.i===e)return;let n={i:e,value:l.current,fx:u.current},r=t.length?[...t,n]:[n];r.length>i&&r.splice(0,r.length-i),c.current=r,s(r)},t);return()=>window.clearInterval(e)},[t,i]),o}let Xt=Yt({seriesKey:(0,C.useMemo)(()=>be||(m?`${m.pulse??`x`}|${m.beat??`x`}|${m.stepIndex??`x`}|${m.chakraDay??`x`}`:`none`),[be,m]),sampleMs:EC,valuePhi:dt,usdPerPhi:Ye,maxPoints:4096,snapKey:Mt}),Zt=(0,C.useMemo)(()=>{let e=Number(Ke?.value);return Number.isFinite(e)&&e>0?e:dt},[Ke,dt]);return(0,W.jsxs)(`div`,{className:`verifier-stamper`,role:`application`,style:{maxWidth:`100vw`,overflowX:`hidden`},children:[(0,W.jsx)(`div`,{className:`toolbar`,children:(0,W.jsxs)(`div`,{className:`toolbar-main`,children:[(0,W.jsx)(`div`,{className:`brand-lockup`,"aria-label":`Kairos live status`,children:(0,W.jsx)(`div`,{className:`brand-text`,children:(0,W.jsxs)(`div`,{className:`live-pulse`,children:[(0,W.jsx)(`span`,{className:`now`,children:`LIVE`}),(0,W.jsxs)(`span`,{className:`pulse-number`,children:[` ☤KAI `,o]})]})})}),(0,W.jsx)(`div`,{className:`toolbar-actions`,"aria-label":`Verifier actions`,children:(0,W.jsxs)(`button`,{className:`primary`,onClick:()=>e.current?.click(),type:`button`,children:[(0,W.jsx)(J7,{color:`#37FFE4`}),(0,W.jsxs)(`span`,{className:`phikey-label`,"aria-label":`PhiKey`,children:[(0,W.jsx)(`img`,{className:`phikey-mark`,src:`/phi.svg`,alt:`Φ`}),(0,W.jsx)(`span`,{className:`phikey-text`,children:`Key`})]})]})})]})}),(0,W.jsx)(`input`,{ref:e,type:`file`,accept:`.svg`,hidden:!0,onChange:Fe}),(0,W.jsx)(`dialog`,{ref:n,className:`glass-modal fullscreen`,id:`verifier-dialog`,"data-open":`false`,"aria-label":`Kai-Sigil Verifier Modal`,style:Y7.full,children:(0,W.jsxs)(`div`,{className:`modal-viewport`,style:Y7.viewport,children:[(0,W.jsxs)(`div`,{className:`modal-topbar`,style:Y7.gridBar,children:[(0,W.jsx)(`div`,{className:`status-strip`,"aria-live":`polite`,style:Y7.valueStrip,children:(0,W.jsx)(mc,{uiState:R,contentSigMatches:v,phiKeyMatches:S,meta:m,headProof:ne,canonicalContext:Se,childUsed:Kt,childExpired:qt,parentOpenExpired:Jt,isSendFilename:zt})}),(0,W.jsx)(`button`,{className:`close-btn holo`,"data-aurora":`true`,"aria-label":`Close`,title:`Close`,onClick:Te,style:{justifySelf:`end`,marginRight:8},children:`×`})]}),s&&m&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`header`,{className:`modal-header`,style:{paddingInline:16},children:[(0,W.jsx)(`img`,{src:s,alt:`Sigil thumbnail`,width:64,height:64,style:Y7.headerImg}),(0,W.jsxs)(`div`,{className:`header-fields`,style:{minWidth:0},children:[(0,W.jsxs)(`h2`,{style:{overflowWrap:`anywhere`},children:[`Pulse `,(0,W.jsx)(`span`,{children:m.pulse??`—`})]}),(0,W.jsxs)(`p`,{children:[`Beat `,(0,W.jsx)(`span`,{children:m.beat??`—`}),` · Step `,(0,W.jsx)(`span`,{children:m.stepIndex??`—`}),` · Day:`,` `,(0,W.jsx)(`span`,{children:Wt??m.chakraDay??`—`})]}),(0,W.jsxs)(`div`,{className:`value-strip`,"aria-live":`polite`,children:[(0,W.jsxs)(Q7,{kind:`phi`,trend:mt,flash:vt,title:Se===`derivative`?`Resonance Φ for this derivative glyph`:`Resonance Φ on this glyph`,ariaLabel:`Open live chart for Φ value`,onClick:()=>Pt(`phi`),children:[(0,W.jsx)(`span`,{className:`sym`,children:`Φ`}),dt.toFixed(6)]}),(0,W.jsxs)(Q7,{kind:`usd`,trend:gt,flash:bt,title:`Indicative USD (issuance model)`,ariaLabel:`Open live chart for USD value`,onClick:()=>Pt(`usd`),children:[(0,W.jsx)(`span`,{className:`sym`,children:`$`}),He(pt)]})]}),zt&&(0,W.jsxs)(`div`,{className:`child-banner tooltip-container`,style:{fontSize:10,opacity:.9,marginTop:6},children:[(0,W.jsx)(`strong`,{children:`7 Steps from Exhale`}),` `,(0,W.jsx)(`span`,{className:`tooltip-trigger`,children:`INHALE:`}),(0,W.jsx)(`div`,{className:`tooltip`,children:`You have 7 steps (77 pulses) to inhale & seal this Sigil. After this period, INHALE is permanently finalized & the Sigil is eternally sealed.`})]})]})]}),Ot&&(0,W.jsx)(`div`,{className:`chart-popover-backdrop`,role:`dialog`,"aria-modal":`true`,"aria-label":`Live chart`,onMouseDown:Ft,onClick:Ft,style:Y7.popBg,children:(0,W.jsxs)(`div`,{className:`chart-popover`,onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),style:Y7.popCard,children:[(0,W.jsxs)(`div`,{className:`chart-popover-head`,style:Y7.popHead,children:[(0,W.jsx)(`div`,{style:Y7.popTitle,className:`chart-popover-title`,children:At===`phi`?`Φ Resonance · Live`:`$ Price · Live`}),(0,W.jsx)(`button`,{className:`close-btn holo`,"data-aurora":`true`,"aria-label":`Close chart`,title:`Close`,onClick:Ft,style:{width:40,height:40,display:`inline-flex`,alignItems:`center`,justifyContent:`center`},children:`×`})]}),(0,W.jsx)(`div`,{className:`chart-popover-body`,style:Y7.popBody,children:(0,W.jsx)(C.Suspense,{fallback:(0,W.jsx)(`div`,{style:{padding:16,color:`var(--dim)`},children:`Loading chart…`}),children:(0,W.jsx)(v6,{data:Xt,live:dt,pv:Zt,premiumX:1,momentX:1,colors:[`rgba(167,255,244,1)`],usdPerPhi:Ye,mode:At===`usd`?`usd`:`phi`,isChildGlyph:Se===`derivative`,reflowKey:Mt})})})]})}),(0,W.jsxs)(`nav`,{className:`tabs`,role:`tablist`,"aria-label":`Views`,style:Y7.stickyTabs,children:[(0,W.jsx)(`button`,{role:`tab`,"aria-selected":B===`summary`,className:B===`summary`?`active`:``,onClick:()=>V(`summary`),children:`Presence`}),(0,W.jsx)(`button`,{role:`tab`,"aria-selected":B===`lineage`,className:B===`lineage`?`active`:``,onClick:()=>V(`lineage`),children:`Stewardship`}),(0,W.jsx)(`button`,{role:`tab`,"aria-selected":B===`data`,className:B===`data`?`active`:``,onClick:()=>V(`data`),children:`Memory`}),(0,W.jsx)(`button`,{className:`secondary`,onClick:ke,disabled:!m,children:`Resonance`}),(0,W.jsx)(`button`,{className:`secondary`,onClick:De,disabled:!s,children:`Note`})]}),(0,W.jsxs)(`section`,{className:`modal-body`,role:`tabpanel`,style:Y7.modalBody,children:[B===`summary`&&(0,W.jsxs)(`div`,{className:`summary-grid`,children:[(0,W.jsx)(Z7,{k:`Now`,v:o}),Gt&&(0,W.jsx)(Z7,{k:`Inhale Seal:`,v:`${Gt.leftSteps} steps (${Gt.leftPulses} pulses) left`}),Se===`derivative`&&(()=>{let{expireAt:e}=cs(m,o);return typeof e==`number`&&Number.isFinite(e)?(0,W.jsx)(Z7,{k:`Inhale by:`,v:e}):null})(),m.userPhiKey&&(0,W.jsx)(Z7,{k:`Φ-Key:`,v:(0,W.jsxs)(W.Fragment,{children:[m.userPhiKey,b&&(S?(0,W.jsx)(`span`,{className:`chip ok`,children:`match`}):(0,W.jsx)(`span`,{className:`chip err`,children:`mismatch`}))]}),wide:!0,mono:!0}),m.kaiSignature&&(0,W.jsx)(Z7,{k:`Kai-Signature (Σ):`,v:(0,W.jsxs)(W.Fragment,{children:[m.kaiSignature,v===!0&&(0,W.jsx)(`span`,{className:`chip ok`,children:`match`}),v===!1&&(0,W.jsx)(`span`,{className:`chip err`,children:`mismatch`})]}),wide:!0,mono:!0}),Ut&&(0,W.jsx)(Z7,{k:`Frequency (Hz):`,v:Ut}),Ge&&(0,W.jsx)(Z7,{k:`Spiral Gate:`,v:Ge}),T&&(0,W.jsx)(Z7,{k:`PROOF OF BREATH™:`,v:T,wide:!0,mono:!0}),(0,W.jsx)(Z7,{k:`Stewardship Hash:`,v:be??`—`,wide:!0,mono:!0}),(0,W.jsx)(Z7,{k:Se===`derivative`?`Derivative Resonance`:`Resonance `,v:` Φ${ut}`}),(0,W.jsx)(Z7,{k:`Exhale key:`,v:m?.creatorPublicKey??`—`,wide:!0,mono:!0}),(0,W.jsx)(Z7,{k:`Exhale nonce:`,v:m.transferNonce??`—`,wide:!0,mono:!0}),(0,W.jsx)(Z7,{k:`Issued @ (derivative):`,v:m?.childIssuedPulse??`—`}),(0,W.jsx)(Z7,{k:`Derivative of (source):`,v:m?.childOfHash??`—`,wide:!0,mono:!0}),ne&&(0,W.jsx)(Z7,{k:`Latest proof:`,v:ne.ok?`#${ne.index+1} ✓`:`#${ne.index} ×`}),ne!==null&&(0,W.jsx)(Z7,{k:`Head proof root:`,v:ne.root,wide:!0,mono:!0}),(0,W.jsx)(Z7,{k:`Head proof root (v14):`,v:m?.transfersWindowRootV14??`—`,wide:!0,mono:!0}),Se===`parent`&&(()=>{let e=ls(m,o);return e.expireAt?(0,W.jsx)(Z7,{k:`Inhale expires @:`,v:e.expireAt}):null})(),Se===`derivative`&&m?.sendLock?.used&&(0,W.jsx)(Z7,{k:`One-time lock:`,v:`Used`}),(0,W.jsx)(Z7,{k:`Hardened transfers:`,v:m.hardenedTransfers?.length??0}),(0,W.jsx)(Z7,{k:`Segments:`,v:m.segments?.length??0}),(0,W.jsx)(Z7,{k:`Segment size:`,v:m.segmentSize??2e3}),(0,W.jsx)(Z7,{k:`Segment Depth:`,v:m.cumulativeTransfers??0}),(0,W.jsx)(Z7,{k:`Segment Tree Root:`,v:m.segmentsMerkleRoot??`—`,wide:!0,mono:!0}),D&&(0,W.jsx)(Z7,{k:`RGB seed:`,v:D.join(`, `)})]}),B===`lineage`&&(0,W.jsx)(`div`,{className:`lineage`,children:m.transfers?.length?(0,W.jsx)(`ol`,{className:`transfers`,children:m.transfers.map((e,t)=>{let n=!e.receiverSignature,r=m.hardenedTransfers?.[t],i=null;try{if(e.payload?.mime?.startsWith(`application/vnd.kairos-exhale`)){let t=JSON.parse(Po(e.payload.encoded));t?.kind===`exhale`&&(i={unit:t.unit,amountPhi:t.amountPhi,amountUsd:t.amountUsd,usdPerPhi:t.usdPerPhi})}}catch(e){Mo(`lineage.decodeExhalePayload`,e)}let a=``,o=``;try{i?.amountPhi&&(a=Wo(i.amountPhi),o=typeof i.amountUsd==`string`&&i.amountUsd?i.amountUsd:typeof i.usdPerPhi==`number`&&Number.isFinite(i.usdPerPhi)?He((Number(i.amountPhi)||0)*i.usdPerPhi):`0.00`)}catch(e){Mo(`lineage.computeDisplay`,e)}return(0,W.jsxs)(`li`,{className:n?`transfer open`:`transfer closed`,children:[(0,W.jsxs)(`header`,{children:[(0,W.jsxs)(`span`,{className:`index`,children:[`#`,t+1]}),(0,W.jsx)(`span`,{className:`state ${n?`open`:`closed`}`,children:n?`Pending receive`:`Sealed`})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Exhaler Σ`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:e.senderSignature})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Exhaler Seal:`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:e.senderStamp})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Exhaler Pulse`}),(0,W.jsx)(`span`,{className:`v`,children:e.senderKaiPulse})]}),i?.amountPhi&&(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Exhaled`}),(0,W.jsxs)(`span`,{className:`v`,children:[`Φ `,a,` · $`,o]})]}),r&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Prev-Head`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:r.previousHeadRoot})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Exhale leaf`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:r.transferLeafHashSend})]}),r.transferLeafHashReceive&&(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Inhale leaf`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:r.transferLeafHashReceive})]}),r.zkSend&&(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`ZK Exhale:`}),(0,W.jsxs)(`span`,{className:`v`,children:[r.zkSend.verified?`✓`:`•`,` `,r.zkSend.scheme]})]}),r.zkSend?.proofHash&&(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`ZK Exhale hash:`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:r.zkSend.proofHash})]}),r.zkReceive&&(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`ZK Inhale`}),(0,W.jsxs)(`span`,{className:`v`,children:[r.zkReceive.verified?`✓`:`•`,` `,r.zkReceive.scheme]})]}),r.zkReceive?.proofHash&&(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`ZK Inhale hash`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:r.zkReceive.proofHash})]})]}),e.receiverSignature&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Inhaler Σ`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:e.receiverSignature})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Inhaler Seal`}),(0,W.jsx)(`span`,{className:`v mono`,style:Y7.mono,children:e.receiverStamp})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Inhaler Pulse`}),(0,W.jsx)(`span`,{className:`v`,children:e.receiverKaiPulse})]})]}),e.payload&&(0,W.jsxs)(`details`,{className:`payload`,open:!0,children:[(0,W.jsx)(`summary`,{children:`Payload`}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Name`}),(0,W.jsx)(`span`,{className:`v`,children:e.payload.name})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`MIME`}),(0,W.jsx)(`span`,{className:`v`,children:e.payload.mime})]}),(0,W.jsxs)(`div`,{className:`row`,children:[(0,W.jsx)(`span`,{className:`k`,children:`Size`}),(0,W.jsxs)(`span`,{className:`v`,children:[e.payload.size,` bytes`]})]})]})]},t)})}):(0,W.jsx)(`p`,{className:`empty`,children:`No stewardship yet — ready to exhale from Sigil-Glyph.`})}),B===`data`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`json-toggle`,children:(0,W.jsxs)(`label`,{children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:ee,onChange:()=>te(e=>!e)}),` View raw JSON`]})}),ee?(0,W.jsx)(`pre`,{className:`raw-json`,style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:d}):(0,W.jsx)(`div`,{className:`json-tree-wrap`,style:{overflowX:`hidden`},children:(0,W.jsx)(uc,{data:m})})]})]}),(0,W.jsxs)(`footer`,{className:`modal-footer`,style:{position:`sticky`,bottom:0},children:[H&&(0,W.jsx)(`p`,{className:`status error`,style:{overflowWrap:`anywhere`},children:H}),(0,W.jsxs)(`div`,{className:`footer-actions`,style:{display:`flex`,alignItems:`center`,gap:8,flexWrap:`wrap`,width:`100%`,boxSizing:`border-box`},children:[R===`unsigned`&&(0,W.jsx)(`button`,{className:`secondary`,onClick:Le,children:`Seal content (Σ + Φ)`}),(R===`readySend`||R===`verified`)&&(0,W.jsxs)(`div`,{className:`send-row no-zoom-input`,"data-nozoom":`true`,style:{display:`flex`,alignItems:`center`,gap:8,flex:`1 1 auto`,minWidth:0,fontSize:16,WebkitTextSizeAdjust:`100%`},children:[(0,W.jsx)(jo,{amountMode:M,setAmountMode:N,usdInput:I,phiInput:P,setUsdInput:L,setPhiInput:F,convDisplayRight:It.displayRight,remainingPhiDisplay4:ut,canonicalContext:Se,phiFormatter:e=>$o(Qo(Ve(e)))}),(0,W.jsx)($7,{className:`primary`,onClick:Bt,aria:`Exhale (send)`,titleText:Ue?`Exhale (seal & share)`:`Exhale (seal & copy link)`,disabled:!Lt,path:`M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z`})]}),(0,W.jsx)($7,{onClick:()=>t.current?.click(),aria:`Attach a file`,titleText:`Attach a file`,small:!0,path:`M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.2a2 2 0 01-2.83-2.83l8.49-8.49`}),(0,W.jsx)(`input`,{ref:t,type:`file`,hidden:!0,onChange:Ie}),R===`readyReceive`&&(0,W.jsx)($7,{className:`primary`,onClick:Vt,aria:`Inhale (receive)`,titleText:Se===`derivative`?qt?`Link expired`:Kt?`Link already used`:`Inhale`:Jt?`Send expired`:`Inhale`,disabled:Se===`derivative`&&(qt||Kt)||Se===`parent`&&Jt,path:`M2 22l11-11M2 22l20-7-9-4-4-9-7 20z`}),(m?.transfers?.length??0)>0&&(0,W.jsx)($7,{className:`secondary`,onClick:Ht,aria:`Segment head window`,titleText:`Roll current head-window into a segment (continuous)`,disabled:zt,small:!0,path:`M12 3l9 4-9 4-9-4 9-4zm-9 8l9 4 9-4M3 19l9 4 9-4`})]})]})]})]})}),(0,W.jsx)(Cc,{open:ie,url:oe,hash:ce,onClose:()=>{ae(!1),_e(!1),we()},onDownloadZip:Rt}),m&&We&&(0,W.jsx)(i8,{open:ue,onClose:Ae,meta:We,nowPulse:o,initialGlyph:Ke??void 0,onAttach:R===`verified`?je:void 0}),(0,W.jsx)(`dialog`,{ref:r,className:`glass-modal fullscreen`,id:`note-dialog`,"data-open":fe?`true`:`false`,"aria-label":`Note Exhaler`,style:Y7.full,children:(0,W.jsxs)(`div`,{className:`modal-viewport`,style:Y7.viewport,children:[(0,W.jsxs)(`div`,{className:`modal-topbar`,style:Y7.gridBar,children:[(0,W.jsx)(`div`,{style:{paddingInline:12,fontSize:12,color:`var(--dim)`},children:`Kairos — Note Exhaler`}),(0,W.jsx)(`button`,{className:`close-btn holo`,"data-aurora":`true`,"aria-label":`Close`,title:`Close`,onClick:Oe,style:{justifySelf:`end`,marginRight:8},children:`×`})]}),(0,W.jsx)(`div`,{style:{flex:`1 1 auto`,minHeight:0,overflowY:`auto`},children:me&&We?(0,W.jsx)(z5,{meta:We,initial:Ee}):me?(0,W.jsx)(`div`,{style:{padding:16,color:`var(--dim)`},children:`Missing valuation metadata for Note — upload/parse a sigil first.`}):(0,W.jsx)(`div`,{style:{padding:16,color:`var(--dim)`},children:`Load a sigil to print a note.`})})]})})]})};function C9(){return(0,W.jsx)(es,{onReset:()=>{},children:(0,W.jsx)(C.Suspense,{fallback:(0,W.jsx)(`div`,{style:{padding:16},children:`Loading…`}),children:(0,W.jsx)(S9,{})})})}var w9=C.lazy(()=>O(()=>import(`./SigilFeedPage-omgaBu1a.js`),__vite__mapDeps([25,17,8,6,7,9,18,20,2,3,21,22,14,23,24,26]))),T9=C.lazy(()=>O(()=>import(`./SigilPage-DOXmbUVe.js`),__vite__mapDeps([27,6,7,23,28,29]))),E9=C.lazy(()=>O(()=>import(`./PShort-Dw69zn4D.js`),[])),D9=C.lazy(()=>O(()=>import(`./VerifyPage-BoLb2QzD.js`),__vite__mapDeps([30,11,31,32,33]))),O9=[()=>O(()=>import(`./SigilFeedPage-omgaBu1a.js`),__vite__mapDeps([25,17,8,6,7,9,18,20,2,3,21,22,14,23,24,26])),()=>O(()=>import(`./SigilPage-DOXmbUVe.js`),__vite__mapDeps([27,6,7,23,28,29])),()=>O(()=>import(`./PShort-Dw69zn4D.js`),[]),()=>O(()=>import(`./VerifyPage-BoLb2QzD.js`),__vite__mapDeps([30,11,31,32,33]))];function k9(){return(0,W.jsxs)(`div`,{className:`route-loader`,role:`status`,"aria-live":`polite`,"aria-label":`Loading`,children:[(0,W.jsx)(`div`,{className:`route-loader__bg`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`route-loader__grid`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`route-loader__halo`,"aria-hidden":`true`}),(0,W.jsxs)(`div`,{className:`route-loader__stage`,children:[(0,W.jsxs)(`div`,{className:`route-loader__orb`,"aria-hidden":`true`,children:[(0,W.jsx)(`div`,{className:`route-loader__orb-ring route-loader__orb-ring--a`}),(0,W.jsx)(`div`,{className:`route-loader__orb-ring route-loader__orb-ring--b`}),(0,W.jsx)(`div`,{className:`route-loader__orb-ring route-loader__orb-ring--c`}),(0,W.jsx)(`div`,{className:`route-loader__orb-core`}),(0,W.jsx)(`span`,{className:`route-loader__spark route-loader__spark--a`}),(0,W.jsx)(`span`,{className:`route-loader__spark route-loader__spark--b`})]}),(0,W.jsx)(`div`,{className:`route-loader__content`,children:(0,W.jsxs)(`div`,{className:`route-loader__content-inner`,children:[(0,W.jsx)(`div`,{className:`route-loader__dot`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`route-loader__text`,children:`BREATH REMEMBERS`}),(0,W.jsx)(`div`,{className:`route-loader__sub`,children:`Aligning…`})]})})]})]})}function A9(e){return(0,W.jsx)(C.Suspense,{fallback:(0,W.jsx)(k9,{}),children:e})}function j9(e){return(0,W.jsx)(C.Suspense,{fallback:null,children:e})}function M9(){return(0,C.useEffect)(()=>{if(typeof window>`u`)return;let e=window,t=()=>{for(let e of O9)e().catch(()=>{})},n=typeof e.requestIdleCallback==`function`?e.requestIdleCallback(t,{timeout:1e3}):window.setTimeout(t,380);return()=>{typeof e.cancelIdleCallback==`function`?e.cancelIdleCallback(n):window.clearTimeout(n)}},[]),(0,W.jsxs)(mn,{children:[(0,W.jsx)(wo,{}),(0,W.jsxs)(At,{children:[(0,W.jsx)(Ot,{path:`s`,element:A9((0,W.jsx)(T9,{}))}),(0,W.jsx)(Ot,{path:`s/:hash`,element:A9((0,W.jsx)(T9,{}))}),(0,W.jsx)(Ot,{path:`stream`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`stream/p/:token`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`stream/c/:token`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`feed`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`feed/p/:token`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`p~:token`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`p~:token/*`,element:A9((0,W.jsx)(E9,{}))}),(0,W.jsx)(Ot,{path:`token`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`p~token`,element:A9((0,W.jsx)(w9,{}))}),(0,W.jsx)(Ot,{path:`p`,element:A9((0,W.jsx)(E9,{}))}),(0,W.jsx)(Ot,{path:`verify/*`,element:A9((0,W.jsx)(D9,{}))}),(0,W.jsxs)(Ot,{element:(0,W.jsx)(vo,{}),children:[(0,W.jsx)(Ot,{index:!0,element:(0,W.jsx)(C9,{})}),(0,W.jsx)(Ot,{path:`mint`,element:(0,W.jsx)(fo,{})}),(0,W.jsx)(Ot,{path:`voh`,element:(0,W.jsx)(uo,{})}),(0,W.jsx)(Ot,{path:`explorer`,element:(0,W.jsx)(po,{})}),(0,W.jsx)(Ot,{path:`keystream`,element:(0,W.jsx)(po,{})}),(0,W.jsx)(Ot,{path:`klock`,element:(0,W.jsx)(mo,{})}),(0,W.jsx)(Ot,{path:`klok`,element:(0,W.jsx)(mo,{})}),(0,W.jsx)(Ot,{path:`*`,element:j9((0,W.jsx)(yo,{}))})]})]})]})}var N9=(e,t,n)=>{let r=Math.floor(e);return rn?n:r},P9=250,F9=2**31-1;function I9(e){return e===`pulse`?qn:qn*484}function L9(e){let t=e.pauseWhenHidden!==!1,n=N9(N9(e.every,1,1e6)*I9(e.unit),P9,F9),r=!1,i=null,a=()=>{i!==null&&window.clearTimeout(i),i=null},o=e=>{if(r)return;let t=N9(e,P9,F9);i=window.setTimeout(()=>void s(),t)},s=async()=>{if(!r){if(t&&document.visibilityState!==`visible`){o(n);return}try{await e.onTick()}finally{o(n)}}};o(n);let c=()=>{document.visibilityState===`visible`&&(a(),o(Math.min(n,1e3)))};return document.addEventListener(`visibilitychange`,c,{passive:!0}),{stop:()=>{r=!0,a(),document.removeEventListener(`visibilitychange`,c)}}}var R9=[`kai.now.micro`,`kai_now_micro`,`kai_anchor_micro`,`KAI_ANCHOR_MICRO`,`KAI_NOW_MICRO`],z9=e=>{if(typeof e!=`string`)return null;let t=e.trim();if(!/^-?\d+$/.test(t))return null;try{return BigInt(t)}catch{return null}},B9=e=>{if(!Number.isFinite(e))return 0n;let t=e<0?-1:1,n=Math.abs(e),r=Math.trunc(n),i=n-r;return i<.5?BigInt(t*r):i>.5?BigInt(t*(r+1)):BigInt(t*(r%2==0?r:r+1))},V9=e=>B9((e-In)/qn*1e6),H9=()=>{if(typeof window>`u`)return null;try{for(let e of R9){let t=z9(window.localStorage.getItem(e));if(t!==null)return t}}catch{}return null},U9=()=>{let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`30.0.6`,VITE_KAI_ANCHOR_MICRO:null,VITE_KAI_BEATS_DAY:36,VITE_KAI_GENESIS_TS_MS_UTC:1715323541888,VITE_KAI_N_DAY_MICRO:`17491270421`,VITE_KAI_PULSES_STEP:11,VITE_KAI_PULSE_MS:5236,VITE_KAI_SOLAR_GENESIS_TS_MS_UTC:1715400806e3,VITE_KAI_STEPS_BEAT:44,VITE_SOVEREIGN_BUILD_JSON:`{"appVersion":"30.0.6","genesisTsMsUtc":1715323541888,"solarGenesisTsMsUtc":1715400806000,"pulseMs":5236,"pulsesPerStep":11,"stepsPerBeat":44,"beatsPerDay":36,"nDayMicro":"17491270421","kaiAnchorMicro":null}`}.VITE_KAI_ANCHOR_MICRO;return z9(typeof e==`string`?e:void 0)};typeof window<`u`&&_r((()=>{let e=H9();if(e!==null)return e;let t=U9();return t===null?V9(performance.timeOrigin+performance.now()):t})());var W9=!0;function G9(){let e=window.location.hash||``;if(!e.startsWith(`#/`))return;let t=e.slice(1),n=t.indexOf(`?`),r=(n===-1?t:t.slice(0,n))||`/`,i=n===-1?``:t.slice(n+1);if(!r.startsWith(`/stream/p/`))return;let a=new URLSearchParams(i),o=a.get(`add`)||``;a.delete(`add`);let s=a.toString(),c=`${r}${s?`?${s}`:``}${o?`#add=${o}`:``}`;window.history.replaceState(null,``,c)}window.addEventListener(`DOMContentLoaded`,G9,{once:!0}),S.createRoot(document.getElementById(`root`)).render((0,W.jsx)(C.StrictMode,{children:(0,W.jsx)(M9,{})})),`serviceWorker`in navigator&&W9&&window.addEventListener(`load`,async()=>{try{let e=await navigator.serviceWorker.register(`/sw.js?v=30.0.6`,{scope:`/`}),t=!1;navigator.serviceWorker.addEventListener(`controllerchange`,()=>{t||(t=!0,window.location.reload())});let n=e=>{e?.postMessage({type:`SKIP_WAITING`})};(e=>{e.addEventListener(`updatefound`,()=>{let t=e.installing;t&&t.addEventListener(`statechange`,()=>{t.state===`installed`&&navigator.serviceWorker.controller&&n(t)})})})(e),navigator.serviceWorker.addEventListener(`message`,e=>{e.data?.type===`SW_ACTIVATED`&&(console.log(`Kairos service worker active`,e.data.version),typeof e.data.version==`string`&&(window.kairosSwVersion=e.data.version,window.dispatchEvent(new CustomEvent(qi,{detail:e.data.version}))))}),L9({unit:`beat`,every:1,onTick:async()=>{await e.update()}}),console.log(`Kairos Service Worker registered:`,e)}catch(e){console.error(`Service Worker error:`,e)}});export{Vd as $,ps as $t,yp as A,f as An,Nu as At,Uf as B,As as Bt,CS as C,x as Cn,mu as Ct,Sp as D,o as Dn,yu as Dt,Pp as E,s as En,bu as Et,Ap as F,Ds as Ft,$f as G,Gs as Gt,Hf as H,js as Ht,sp as I,Us as It,Qf as J,Hs as Jt,ip as K,Ns as Kt,op as L,Vs as Lt,kp as M,Ou as Mt,jp as N,Du as Nt,Cp as O,c as On,Su as Ot,Op as P,Cu as Pt,Hd as Q,Rs as Qt,ap as R,Bs as Rt,nS as S,O as Sn,Eu as St,qy as T,h as Tn,xu as Tt,Xf as U,zs as Ut,Zf as V,Ks as Vt,np as W,Ws as Wt,rp as X,Os as Xt,hp as Y,Ls as Yt,Bd as Z,ks as Zt,IS as _,Fr as _n,Ld as _t,Kx as a,In as an,Rf as at,rS as b,$e as bn,Qu as bt,Gx as c,Rn as cn,Bf as ct,tS as d,Mr as dn,If as dt,ms as en,vf as et,FS as f,zr as fn,Nf as ft,NS as g,Ir as gn,zd as gt,MS as h,jr as hn,Mf as ht,Xx as i,Kn as in,jf as it,xp as j,u as jn,Pu as jt,wp as k,d as kn,vu as kt,$x as l,qn as ln,Ff as lt,AS as m,Kr as mn,Of as mt,nD as n,Vi as nn,Df as nt,qx as o,Gn as on,Lf as ot,jS as p,Fn as pn,Vf as pt,gp as q,Fs as qt,aC as r,Wn as rn,kf as rt,Zx as s,Bn as sn,Pf as st,t7 as t,Ui as tn,gf as tt,Qx as u,zn as un,zf as ut,OS as v,_n as vn,od as vt,ob as w,y as wn,Tu as wt,wS as x,rt as xn,hu as xt,xS as y,Xe as yn,Wu as yt,vp as z,Is as zt}; \ No newline at end of file diff --git a/dist/assets/jszip.min-BlBKh1bQ.js b/dist/assets/jszip.min-BlBKh1bQ.js deleted file mode 100644 index 0db01eda..00000000 --- a/dist/assets/jszip.min-BlBKh1bQ.js +++ /dev/null @@ -1 +0,0 @@ -import{_t as e}from"./index-CcPm2yTY.js";export default e(); \ No newline at end of file diff --git a/dist/assets/jszip.min-OPHeGHZp.js b/dist/assets/jszip.min-OPHeGHZp.js new file mode 100644 index 00000000..29688451 --- /dev/null +++ b/dist/assets/jszip.min-OPHeGHZp.js @@ -0,0 +1 @@ +import{_t as e}from"./index-BWApiWDT.js";export default e(); \ No newline at end of file diff --git a/dist/assets/prop-types-CQ3MXKCa.js b/dist/assets/prop-types-B3eCNXus.js similarity index 92% rename from dist/assets/prop-types-CQ3MXKCa.js rename to dist/assets/prop-types-B3eCNXus.js index 741996ad..a5e70d1a 100644 --- a/dist/assets/prop-types-CQ3MXKCa.js +++ b/dist/assets/prop-types-B3eCNXus.js @@ -1 +1 @@ -import{En as e}from"./index-CcPm2yTY.js";var t=e(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),n=e(((e,n)=>{var r=t();function i(){}function a(){}a.resetWarningCache=i,n.exports=function(){function e(e,t,n,i,a,o){if(o!==r){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:i};return n.PropTypes=n,n}})),r=e(((e,t)=>{t.exports=n()()}));export{r as t}; \ No newline at end of file +import{En as e}from"./index-BWApiWDT.js";var t=e(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),n=e(((e,n)=>{var r=t();function i(){}function a(){}a.resetWarningCache=i,n.exports=function(){function e(e,t,n,i,a,o){if(o!==r){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:i};return n.PropTypes=n,n}})),r=e(((e,t)=>{t.exports=n()()}));export{r as t}; \ No newline at end of file diff --git a/dist/assets/sigilRegistry-NyXrDYsE.js b/dist/assets/sigilRegistry-TxCi76Aa.js similarity index 99% rename from dist/assets/sigilRegistry-NyXrDYsE.js rename to dist/assets/sigilRegistry-TxCi76Aa.js index 425b31cb..2b946690 100644 --- a/dist/assets/sigilRegistry-NyXrDYsE.js +++ b/dist/assets/sigilRegistry-TxCi76Aa.js @@ -1 +1 @@ -import{Bt as e,Ht as t,Tn as n,jn as r,t as i,tn as a}from"./index-CcPm2yTY.js";import{n as o}from"./SigilAuthContext-CZfkVeGy.js";var s=r(n(),1),c=r(a(),1);function l(e){return typeof e==`string`?e.toLowerCase():``}function u(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function d(e){return typeof e==`string`&&e.length>0}function f(e){return typeof e==`number`&&Number.isFinite(e)}function p(e){if(typeof e!=`string`||!e)return!1;try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}}function m(e){if(typeof e!=`object`||!e)throw Error(`Malformed sigil metadata.`);let t=e;for(let e of[`pulse`,`beat`,`stepIndex`,`chakraDay`])if(!u(t,e))throw Error(`Missing Kai field: ${e}`);if(!u(t,`kaiSignature`))throw Error(`Invalid Kai Signature — tampered or unsigned sigil.`);if(!f(t.pulse))throw Error(`Invalid field: pulse`);if(!f(t.beat))throw Error(`Invalid field: beat`);if(!f(t.stepIndex))throw Error(`Invalid field: stepIndex`);if(!d(t.chakraDay))throw Error(`Invalid field: chakraDay`);if(!d(t.kaiSignature))throw Error(`Invalid field: kaiSignature`)}function h(e){try{let t=new DOMParser().parseFromString(e,`image/svg+xml`),n=Array.from(t.getElementsByTagName(`metadata`)),r=[`valuation`,`ledger`,`dht`,`source`];for(let e of n){let t=e.getAttribute(`id`)??``;if(r.some(e=>t.includes(e)))continue;let n=(e.textContent??``).trim();if(!n)continue;let i=n.replace(/^$/,``);try{let e=JSON.parse(i);if(typeof e==`object`&&e&&u(e,`pulse`)&&u(e,`beat`)&&u(e,`stepIndex`)&&u(e,`chakraDay`)&&u(e,`kaiSignature`))return e}catch{}}return null}catch{return null}}function g(e,t){let n=[`sigilActionUrl`,`sigilUrl`,`actionUrl`,`url`,`claimedUrl`,`loginUrl`,`sourceUrl`,`originUrl`,`link`,`href`];if(t)for(let e of n){let n=t[e];if(p(n))return n}try{let t=new DOMParser().parseFromString(e,`image/svg+xml`);for(let e of Array.from(t.getElementsByTagName(`metadata`))){let t=(e.textContent??``).trim();if(!t)continue;let r=t.replace(/^$/,``);try{let e=JSON.parse(r);if(typeof e==`object`&&e)for(let t of n){let n=e[t];if(p(n))return n}}catch{let e=r.match(/https?:\/\/[^\s"'<>)#]+/i);if(e&&p(e[0]))return e[0]}}for(let e of Array.from(t.getElementsByTagName(`a`))){let t=e.getAttribute(`href`)||e.getAttribute(`xlink:href`);if(p(t))return t}}catch{}return null}function _(){return(0,c.jsxs)(`svg`,{className:`kai-orb-svg`,viewBox:`0 0 88 88`,role:`img`,"aria-label":`Kai Orb`,children:[(0,c.jsx)(`defs`,{children:(0,c.jsxs)(`radialGradient`,{id:`orbGlow`,cx:`50%`,cy:`50%`,r:`50%`,children:[(0,c.jsx)(`stop`,{offset:`0%`,stopColor:`#ffffff`,stopOpacity:`1`}),(0,c.jsx)(`stop`,{offset:`55%`,stopColor:`#00ffd0`,stopOpacity:`1`}),(0,c.jsx)(`stop`,{offset:`100%`,stopColor:`#00ffd0`,stopOpacity:`0`})]})}),(0,c.jsx)(`circle`,{cx:`44`,cy:`44`,r:`41`,fill:`none`,stroke:`#00ffd0`,strokeOpacity:`0.38`,strokeWidth:`1.6`}),(0,c.jsx)(`circle`,{cx:`44`,cy:`44`,r:`32`,fill:`none`,stroke:`#8a2be2`,strokeOpacity:`0.45`,strokeWidth:`1.4`}),(0,c.jsxs)(`g`,{opacity:`0.45`,children:[(0,c.jsx)(`circle`,{cx:`44`,cy:`44`,r:`20`,fill:`none`,stroke:`rgba(255,255,255,.3)`,strokeWidth:`.8`}),(0,c.jsx)(`circle`,{cx:`44`,cy:`44`,r:`10`,fill:`none`,stroke:`rgba(255,255,255,.25)`,strokeWidth:`.7`}),(0,c.jsx)(`line`,{x1:`44`,y1:`4`,x2:`44`,y2:`84`,stroke:`rgba(255,255,255,.2)`,strokeWidth:`.8`}),(0,c.jsx)(`line`,{x1:`4`,y1:`44`,x2:`84`,y2:`44`,stroke:`rgba(255,255,255,.2)`,strokeWidth:`.8`})]}),(0,c.jsx)(`circle`,{cx:`44`,cy:`44`,r:`10`,fill:`url(#orbGlow)`}),(0,c.jsx)(`path`,{d:`M44 14 L72 68 H16 Z`,fill:`none`,stroke:`#00b4ff`,strokeOpacity:`0.35`,strokeWidth:`1.2`})]})}function v({onVerified:n}){let r=(0,s.useRef)(null),[a,d]=(0,s.useState)(null),[f,p]=(0,s.useState)(!1),[v,y]=(0,s.useState)(!1),[b,x]=(0,s.useState)(null),{setAuth:S}=o(),C=(0,s.useCallback)(async a=>{p(!0),d(null),x(null);try{if(a.type!==`image/svg+xml`&&!a.name.toLowerCase().endsWith(`.svg`))throw Error(`Please upload an SVG sigil file.`);let r=await a.text(),{meta:o,contextOk:s,typeOk:c}=await i(a),d=o&&u(o,`kaiSignature`)&&u(o,`pulse`)?o:h(r);if(!d||!s||!c)throw Error(`Malformed or unrecognized sigil structure.`);m(d);let f=d,p=await e(f);if(!p||l(p)!==l(f.kaiSignature))throw Error(`Invalid Kai Signature — tampered or unsigned sigil.`);let _=await t(f.kaiSignature);if(typeof f.userPhiKey==`string`){if(l(_)!==l(f.userPhiKey))throw Error(`Φ-Key mismatch — identity invalid.`)}else f.userPhiKey=_;let v=g(r,f)??void 0;S(r,{pulse:f.pulse,beat:f.beat,stepIndex:f.stepIndex,chakraDay:f.chakraDay,kaiSignature:f.kaiSignature,userPhiKey:f.userPhiKey,...typeof f.sigilId==`string`?{sigilId:f.sigilId}:{},...v?{sigilActionUrl:v}:{}}),x(f),n(r,f)}catch(e){d(e instanceof Error?e.message:`Invalid sigil file. Ensure it’s a Kai-sealed SVG with embedded JSON .`)}finally{p(!1),r.current&&(r.current.value=``)}},[n,S]),w=async e=>{let t=e.target.files?.[0];t&&await C(t)};return(0,c.jsx)(`div`,{className:`sigil-login-only w-full max-w-xl mx-auto`,children:(0,c.jsxs)(`div`,{onDrop:async e=>{e.preventDefault(),e.stopPropagation(),y(!1);let t=e.dataTransfer.files?.[0];t&&await C(t)},onDragOver:e=>{e.preventDefault(),e.stopPropagation(),y(!0)},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),y(!1)},onKeyDown:e=>{f||(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),r.current?.click())},className:[`sigil-dropzone`,v?`sigil-dropzone--over`:``,f?`sigil-dropzone--loading`:``,b?`sigil-dropzone--ok`:``,a?`sigil-dropzone--err`:``].filter(Boolean).join(` `),role:`button`,tabIndex:0,"aria-disabled":f,title:`Drag & drop your Kai-sealed SVG here, or tap to browse`,"aria-label":`Inhale or drop your Kai-sealed SVG sigil`,"aria-describedby":`sigil-instructions sigil-trustline`,onClick:()=>{f||r.current?.click()},children:[(0,c.jsx)(`div`,{className:`sigil-grid`,"aria-hidden":!0}),(0,c.jsx)(`div`,{className:`sigil-ring sigil-ring--outer`,"aria-hidden":!0}),(0,c.jsx)(`div`,{className:`sigil-ring sigil-ring--inner`,"aria-hidden":!0}),(0,c.jsxs)(`div`,{className:`sigil-center`,children:[(0,c.jsx)(`div`,{className:`sigil-orb`,"aria-hidden":!0,children:(0,c.jsx)(_,{})}),(0,c.jsxs)(`p`,{id:`sigil-instructions`,className:`sigil-instructions`,children:[`Inhale, `,(0,c.jsx)(`span`,{className:`sigil-accent`,children:`Φkey here.`})]}),(0,c.jsxs)(`div`,{className:`sigil-status`,"aria-live":`polite`,children:[f&&(0,c.jsxs)(`div`,{className:`sigil-status__row`,children:[(0,c.jsx)(`span`,{className:`sigil-spinner`,"aria-hidden":`true`}),(0,c.jsx)(`span`,{children:`Verifying signature & deriving Φ-Key…`})]}),!f&&b&&(0,c.jsxs)(`div`,{className:`sigil-status__ok`,children:[(0,c.jsx)(`span`,{className:`ok-dot`,"aria-hidden":`true`}),(0,c.jsx)(`span`,{children:`Verified — Φ-Key bound`})]}),!f&&a&&(0,c.jsx)(`div`,{className:`sigil-status__err`,children:a})]})]}),(0,c.jsx)(`input`,{ref:r,type:`file`,accept:`.svg,image/svg+xml`,onChange:w,className:`sigil-file-input`,tabIndex:-1,"aria-hidden":`true`})]})})}const y=`kai:sigils:v1`,b=`sigil:urls`;var x=typeof window<`u`;function S(){if(!x)return{};let e=window;return e.__SIGIL__||={},e.__SIGIL__}function C(e){if(!x)return[];try{let t=window.localStorage.getItem(e);if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean):[]}catch{return[]}}function w(e,t){if(x)try{let n=Array.from(new Set(t.map(e=>e.trim()).filter(Boolean)));window.localStorage.setItem(e,JSON.stringify(n))}catch{}}function T(e,t){return e.includes(t)?!1:(e.push(t),!0)}function E(e){let t=e.trim();if(!t)return null;if(!x)return t;try{return new URL(t,window.location.origin).toString()}catch{return t}}var D=null;function O(){return!x||!(`BroadcastChannel`in window)?null:D||(D=new BroadcastChannel(`kai-sigil-registry`),D)}function k(e){if(!x)return;let t=E(e);if(!t)return;let n=C(y);T(n,t)&&w(y,n);let r=C(b);T(r,t)&&w(b,r);try{let e=new CustomEvent(`sigil:url-registered`,{detail:{url:t}});window.dispatchEvent(e)}catch{}try{O()?.postMessage({type:`sigil:add`,url:t})}catch{}try{let e=S();e.registerSigilUrl!==k&&(e.registerSigilUrl=k)}catch{}}if(x)try{let e=S();e.registerSigilUrl!==k&&(e.registerSigilUrl=k)}catch{}export{v as n,k as t}; \ No newline at end of file +import{Bt as e,Ht as t,Tn as n,jn as r,t as i,tn as a}from"./index-BWApiWDT.js";import{n as o}from"./SigilAuthContext-X_86kcI6.js";var s=r(n(),1),c=r(a(),1);function l(e){return typeof e==`string`?e.toLowerCase():``}function u(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function d(e){return typeof e==`string`&&e.length>0}function f(e){return typeof e==`number`&&Number.isFinite(e)}function p(e){if(typeof e!=`string`||!e)return!1;try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}}function m(e){if(typeof e!=`object`||!e)throw Error(`Malformed sigil metadata.`);let t=e;for(let e of[`pulse`,`beat`,`stepIndex`,`chakraDay`])if(!u(t,e))throw Error(`Missing Kai field: ${e}`);if(!u(t,`kaiSignature`))throw Error(`Invalid Kai Signature — tampered or unsigned sigil.`);if(!f(t.pulse))throw Error(`Invalid field: pulse`);if(!f(t.beat))throw Error(`Invalid field: beat`);if(!f(t.stepIndex))throw Error(`Invalid field: stepIndex`);if(!d(t.chakraDay))throw Error(`Invalid field: chakraDay`);if(!d(t.kaiSignature))throw Error(`Invalid field: kaiSignature`)}function h(e){try{let t=new DOMParser().parseFromString(e,`image/svg+xml`),n=Array.from(t.getElementsByTagName(`metadata`)),r=[`valuation`,`ledger`,`dht`,`source`];for(let e of n){let t=e.getAttribute(`id`)??``;if(r.some(e=>t.includes(e)))continue;let n=(e.textContent??``).trim();if(!n)continue;let i=n.replace(/^$/,``);try{let e=JSON.parse(i);if(typeof e==`object`&&e&&u(e,`pulse`)&&u(e,`beat`)&&u(e,`stepIndex`)&&u(e,`chakraDay`)&&u(e,`kaiSignature`))return e}catch{}}return null}catch{return null}}function g(e,t){let n=[`sigilActionUrl`,`sigilUrl`,`actionUrl`,`url`,`claimedUrl`,`loginUrl`,`sourceUrl`,`originUrl`,`link`,`href`];if(t)for(let e of n){let n=t[e];if(p(n))return n}try{let t=new DOMParser().parseFromString(e,`image/svg+xml`);for(let e of Array.from(t.getElementsByTagName(`metadata`))){let t=(e.textContent??``).trim();if(!t)continue;let r=t.replace(/^$/,``);try{let e=JSON.parse(r);if(typeof e==`object`&&e)for(let t of n){let n=e[t];if(p(n))return n}}catch{let e=r.match(/https?:\/\/[^\s"'<>)#]+/i);if(e&&p(e[0]))return e[0]}}for(let e of Array.from(t.getElementsByTagName(`a`))){let t=e.getAttribute(`href`)||e.getAttribute(`xlink:href`);if(p(t))return t}}catch{}return null}function _(){return(0,c.jsxs)(`svg`,{className:`kai-orb-svg`,viewBox:`0 0 88 88`,role:`img`,"aria-label":`Kai Orb`,children:[(0,c.jsx)(`defs`,{children:(0,c.jsxs)(`radialGradient`,{id:`orbGlow`,cx:`50%`,cy:`50%`,r:`50%`,children:[(0,c.jsx)(`stop`,{offset:`0%`,stopColor:`#ffffff`,stopOpacity:`1`}),(0,c.jsx)(`stop`,{offset:`55%`,stopColor:`#00ffd0`,stopOpacity:`1`}),(0,c.jsx)(`stop`,{offset:`100%`,stopColor:`#00ffd0`,stopOpacity:`0`})]})}),(0,c.jsx)(`circle`,{cx:`44`,cy:`44`,r:`41`,fill:`none`,stroke:`#00ffd0`,strokeOpacity:`0.38`,strokeWidth:`1.6`}),(0,c.jsx)(`circle`,{cx:`44`,cy:`44`,r:`32`,fill:`none`,stroke:`#8a2be2`,strokeOpacity:`0.45`,strokeWidth:`1.4`}),(0,c.jsxs)(`g`,{opacity:`0.45`,children:[(0,c.jsx)(`circle`,{cx:`44`,cy:`44`,r:`20`,fill:`none`,stroke:`rgba(255,255,255,.3)`,strokeWidth:`.8`}),(0,c.jsx)(`circle`,{cx:`44`,cy:`44`,r:`10`,fill:`none`,stroke:`rgba(255,255,255,.25)`,strokeWidth:`.7`}),(0,c.jsx)(`line`,{x1:`44`,y1:`4`,x2:`44`,y2:`84`,stroke:`rgba(255,255,255,.2)`,strokeWidth:`.8`}),(0,c.jsx)(`line`,{x1:`4`,y1:`44`,x2:`84`,y2:`44`,stroke:`rgba(255,255,255,.2)`,strokeWidth:`.8`})]}),(0,c.jsx)(`circle`,{cx:`44`,cy:`44`,r:`10`,fill:`url(#orbGlow)`}),(0,c.jsx)(`path`,{d:`M44 14 L72 68 H16 Z`,fill:`none`,stroke:`#00b4ff`,strokeOpacity:`0.35`,strokeWidth:`1.2`})]})}function v({onVerified:n}){let r=(0,s.useRef)(null),[a,d]=(0,s.useState)(null),[f,p]=(0,s.useState)(!1),[v,y]=(0,s.useState)(!1),[b,x]=(0,s.useState)(null),{setAuth:S}=o(),C=(0,s.useCallback)(async a=>{p(!0),d(null),x(null);try{if(a.type!==`image/svg+xml`&&!a.name.toLowerCase().endsWith(`.svg`))throw Error(`Please upload an SVG sigil file.`);let r=await a.text(),{meta:o,contextOk:s,typeOk:c}=await i(a),d=o&&u(o,`kaiSignature`)&&u(o,`pulse`)?o:h(r);if(!d||!s||!c)throw Error(`Malformed or unrecognized sigil structure.`);m(d);let f=d,p=await e(f);if(!p||l(p)!==l(f.kaiSignature))throw Error(`Invalid Kai Signature — tampered or unsigned sigil.`);let _=await t(f.kaiSignature);if(typeof f.userPhiKey==`string`){if(l(_)!==l(f.userPhiKey))throw Error(`Φ-Key mismatch — identity invalid.`)}else f.userPhiKey=_;let v=g(r,f)??void 0;S(r,{pulse:f.pulse,beat:f.beat,stepIndex:f.stepIndex,chakraDay:f.chakraDay,kaiSignature:f.kaiSignature,userPhiKey:f.userPhiKey,...typeof f.sigilId==`string`?{sigilId:f.sigilId}:{},...v?{sigilActionUrl:v}:{}}),x(f),n(r,f)}catch(e){d(e instanceof Error?e.message:`Invalid sigil file. Ensure it’s a Kai-sealed SVG with embedded JSON .`)}finally{p(!1),r.current&&(r.current.value=``)}},[n,S]),w=async e=>{let t=e.target.files?.[0];t&&await C(t)};return(0,c.jsx)(`div`,{className:`sigil-login-only w-full max-w-xl mx-auto`,children:(0,c.jsxs)(`div`,{onDrop:async e=>{e.preventDefault(),e.stopPropagation(),y(!1);let t=e.dataTransfer.files?.[0];t&&await C(t)},onDragOver:e=>{e.preventDefault(),e.stopPropagation(),y(!0)},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),y(!1)},onKeyDown:e=>{f||(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),r.current?.click())},className:[`sigil-dropzone`,v?`sigil-dropzone--over`:``,f?`sigil-dropzone--loading`:``,b?`sigil-dropzone--ok`:``,a?`sigil-dropzone--err`:``].filter(Boolean).join(` `),role:`button`,tabIndex:0,"aria-disabled":f,title:`Drag & drop your Kai-sealed SVG here, or tap to browse`,"aria-label":`Inhale or drop your Kai-sealed SVG sigil`,"aria-describedby":`sigil-instructions sigil-trustline`,onClick:()=>{f||r.current?.click()},children:[(0,c.jsx)(`div`,{className:`sigil-grid`,"aria-hidden":!0}),(0,c.jsx)(`div`,{className:`sigil-ring sigil-ring--outer`,"aria-hidden":!0}),(0,c.jsx)(`div`,{className:`sigil-ring sigil-ring--inner`,"aria-hidden":!0}),(0,c.jsxs)(`div`,{className:`sigil-center`,children:[(0,c.jsx)(`div`,{className:`sigil-orb`,"aria-hidden":!0,children:(0,c.jsx)(_,{})}),(0,c.jsxs)(`p`,{id:`sigil-instructions`,className:`sigil-instructions`,children:[`Inhale, `,(0,c.jsx)(`span`,{className:`sigil-accent`,children:`Φkey here.`})]}),(0,c.jsxs)(`div`,{className:`sigil-status`,"aria-live":`polite`,children:[f&&(0,c.jsxs)(`div`,{className:`sigil-status__row`,children:[(0,c.jsx)(`span`,{className:`sigil-spinner`,"aria-hidden":`true`}),(0,c.jsx)(`span`,{children:`Verifying signature & deriving Φ-Key…`})]}),!f&&b&&(0,c.jsxs)(`div`,{className:`sigil-status__ok`,children:[(0,c.jsx)(`span`,{className:`ok-dot`,"aria-hidden":`true`}),(0,c.jsx)(`span`,{children:`Verified — Φ-Key bound`})]}),!f&&a&&(0,c.jsx)(`div`,{className:`sigil-status__err`,children:a})]})]}),(0,c.jsx)(`input`,{ref:r,type:`file`,accept:`.svg,image/svg+xml`,onChange:w,className:`sigil-file-input`,tabIndex:-1,"aria-hidden":`true`})]})})}const y=`kai:sigils:v1`,b=`sigil:urls`;var x=typeof window<`u`;function S(){if(!x)return{};let e=window;return e.__SIGIL__||={},e.__SIGIL__}function C(e){if(!x)return[];try{let t=window.localStorage.getItem(e);if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean):[]}catch{return[]}}function w(e,t){if(x)try{let n=Array.from(new Set(t.map(e=>e.trim()).filter(Boolean)));window.localStorage.setItem(e,JSON.stringify(n))}catch{}}function T(e,t){return e.includes(t)?!1:(e.push(t),!0)}function E(e){let t=e.trim();if(!t)return null;if(!x)return t;try{return new URL(t,window.location.origin).toString()}catch{return t}}var D=null;function O(){return!x||!(`BroadcastChannel`in window)?null:D||(D=new BroadcastChannel(`kai-sigil-registry`),D)}function k(e){if(!x)return;let t=E(e);if(!t)return;let n=C(y);T(n,t)&&w(y,n);let r=C(b);T(r,t)&&w(b,r);try{let e=new CustomEvent(`sigil:url-registered`,{detail:{url:t}});window.dispatchEvent(e)}catch{}try{O()?.postMessage({type:`sigil:add`,url:t})}catch{}try{let e=S();e.registerSigilUrl!==k&&(e.registerSigilUrl=k)}catch{}}if(x)try{let e=S();e.registerSigilUrl!==k&&(e.registerSigilUrl=k)}catch{}export{v as n,k as t}; \ No newline at end of file diff --git a/dist/assets/sigilUrl-w0EYDFh2.js b/dist/assets/sigilUrl-rhYoayXy.js similarity index 75% rename from dist/assets/sigilUrl-w0EYDFh2.js rename to dist/assets/sigilUrl-rhYoayXy.js index 408743d9..c2c56127 100644 --- a/dist/assets/sigilUrl-w0EYDFh2.js +++ b/dist/assets/sigilUrl-rhYoayXy.js @@ -1 +1 @@ -import{B as e,G as t,H as n,I as r,J as i,K as a,L as o,R as s,U as c,V as l,W as u,X as d,Y as f,q as p,z as m}from"./index-CcPm2yTY.js";export{r as SIGIL_CHANNEL_NAME,o as SIGIL_MODAL_FALLBACK_LS_KEY,s as SIGIL_REGISTRY_LS_KEY,m as canonicalUrlFromContext,e as decodeSigilHistory,l as decodeSigilPayload,n as encodeSigilHistory,c as encodeSigilPayload,u as extractPayloadFromUrl,t as extractPayloadParamFromUrl,a as getOriginUrl,p as makeCanonicalQrUrl,i as makeSigilUrl,f as registerSigilUrl,d as resolveLineageBackwards}; \ No newline at end of file +import{B as e,G as t,H as n,I as r,J as i,K as a,L as o,R as s,U as c,V as l,W as u,X as d,Y as f,q as p,z as m}from"./index-BWApiWDT.js";export{r as SIGIL_CHANNEL_NAME,o as SIGIL_MODAL_FALLBACK_LS_KEY,s as SIGIL_REGISTRY_LS_KEY,m as canonicalUrlFromContext,e as decodeSigilHistory,l as decodeSigilPayload,n as encodeSigilHistory,c as encodeSigilPayload,u as extractPayloadFromUrl,t as extractPayloadParamFromUrl,a as getOriginUrl,p as makeCanonicalQrUrl,i as makeSigilUrl,f as registerSigilUrl,d as resolveLineageBackwards}; \ No newline at end of file diff --git a/dist/assets/sigilUtils-BWqerTXt.js b/dist/assets/sigilUtils-u_f46p8-.js similarity index 89% rename from dist/assets/sigilUtils-BWqerTXt.js rename to dist/assets/sigilUtils-u_f46p8-.js index a7334955..cd04dca2 100644 --- a/dist/assets/sigilUtils-BWqerTXt.js +++ b/dist/assets/sigilUtils-u_f46p8-.js @@ -1 +1 @@ -import{Bt as e,Ft as t,Gt as n,Ht as r,It as i,Jt as a,Kt as o,Lt as s,Qt as c,Rt as l,Ut as u,Vt as d,Wt as f,Xt as p,Yt as m,Zt as h,qt as g,zt as _}from"./index-CcPm2yTY.js";export{t as SIGIL_SCHEMA,i as base64urlJson,s as buildReceiveMessageV14,l as buildSendMessageV14,_ as computeHeadWindowRoot,e as computeKaiSignature,d as derivePhiKeyFromMeta,r as derivePhiKeyFromSig,u as expectedPrevHeadRootV14,f as genNonce,n as hashAny,o as hashTransfer,g as hashTransferSenderSide,a as headCanonicalHash,m as headCanonicalHashV14,p as isSigilMetaOk,h as stableStringify,c as sumSegments}; \ No newline at end of file +import{Bt as e,Ft as t,Gt as n,Ht as r,It as i,Jt as a,Kt as o,Lt as s,Qt as c,Rt as l,Ut as u,Vt as d,Wt as f,Xt as p,Yt as m,Zt as h,qt as g,zt as _}from"./index-BWApiWDT.js";export{t as SIGIL_SCHEMA,i as base64urlJson,s as buildReceiveMessageV14,l as buildSendMessageV14,_ as computeHeadWindowRoot,e as computeKaiSignature,d as derivePhiKeyFromMeta,r as derivePhiKeyFromSig,u as expectedPrevHeadRootV14,f as genNonce,n as hashAny,o as hashTransfer,g as hashTransferSenderSide,a as headCanonicalHash,m as headCanonicalHashV14,p as isSigilMetaOk,h as stableStringify,c as sumSegments}; \ No newline at end of file diff --git a/dist/assets/svgMeta-BqZogknt.js b/dist/assets/svgMeta-CqOhEmuY.js similarity index 98% rename from dist/assets/svgMeta-BqZogknt.js rename to dist/assets/svgMeta-CqOhEmuY.js index a649290a..3d23a4d0 100644 --- a/dist/assets/svgMeta-BqZogknt.js +++ b/dist/assets/svgMeta-CqOhEmuY.js @@ -1 +1 @@ -import{cn as e,un as t}from"./index-CcPm2yTY.js";function n(e){return Math.max(0,Math.floor(e))*11}function r(e){return Math.max(0,Math.floor(e))}function i(e,t){let n=11*t,r=(e%n+n)%n;return Math.floor(r/11)}var a=`http://www.w3.org/2000/svg`,o=`http://www.w3.org/1999/xlink`;function s(e){if(typeof e!=`string`||e.trim()===``)return e;let t=e.replace(//gi,``);return t=t.replace(/\son[a-z]+\s*=\s*"[^"]*"/gi,``),t=t.replace(/\son[a-z]+\s*=\s*'[^']*'/gi,``),t=t.replace(/\son[a-z]+\s*=\s*[^\s>'"]+/gi,``),t=t.replace(/\s(?:xlink:)?href\s*=\s*"(?:https?:)?\/\/[^"]*"/gi,``),t=t.replace(/\s(?:xlink:)?href\s*=\s*'(?:https?:)?\/\/[^']*'/gi,``),t=t.replace(//gi,``),t}function c(e){let t=s(e),n=new DOMParser().parseFromString(t,`image/svg+xml`).documentElement;if(!n||n.nodeName.toLowerCase()!==`svg`)throw Error(`Invalid SVG`);let r=n.querySelector(`metadata`),i={};if(r&&r.textContent)try{i=JSON.parse(r.textContent)}catch{i={}}return{svg:n,meta:i}}function l(e){e.getAttribute(`xmlns`)||e.setAttribute(`xmlns`,a),e.getAttribute(`xmlns:xlink`)||e.setAttribute(`xmlns:xlink`,o)}function u(e){let t=e.ownerDocument??document,n=e.querySelector(`metadata`);if(n)return n;let r=t.createElementNS(a,`metadata`);return e.insertBefore(r,e.firstChild),r}function d(e,t,n){let r=e.ownerDocument??document,i=e.querySelector(`title`);i||(i=r.createElementNS(a,`title`),e.insertBefore(i,e.firstChild)),i.textContent=t;let o=e.querySelector(`desc`);o||(o=r.createElementNS(a,`desc`),e.insertBefore(o,i.nextSibling)),o.textContent=n}function f(e,t){if(!e.getAttribute(`viewBox`))try{let n=e.viewBox.baseVal;if(n?.width&&n?.height)e.setAttribute(`viewBox`,`${n.x} ${n.y} ${n.width} ${n.height}`);else if(typeof e.getBBox==`function`){let n=e.getBBox();n?.width&&n?.height?e.setAttribute(`viewBox`,`${n.x} ${n.y} ${n.width} ${n.height}`):e.setAttribute(`viewBox`,`0 0 ${t} ${t}`)}else e.setAttribute(`viewBox`,`0 0 ${t} ${t}`)}catch{e.setAttribute(`viewBox`,`0 0 ${t} ${t}`)}e.setAttribute(`width`,String(t)),e.setAttribute(`height`,String(t)),e.setAttribute(`preserveAspectRatio`,`xMidYMid meet`)}function p(e,t){let n=u(e);n.textContent=JSON.stringify(t),l(e);let r=new XMLSerializer().serializeToString(e);return r.startsWith(`\n${r}`}var m=e=>typeof e==`number`&&Number.isFinite(e),h=(e,t=0)=>{if(m(e))return e;if(typeof e==`string`&&e.trim()!==``){let n=Number(e);return Number.isFinite(n)?n:t}return t};function g(e){let t=[];if(e.pulse??t.push(`Missing metadata field: pulse`),e.beat??t.push(`Missing metadata field: beat`),e.chakraDay??t.push(`Missing metadata field: chakraDay`),t.length>0)return{ok:!1,errors:t};let n=Number.isFinite(e.stepsPerBeat)?Math.max(1,Number(e.stepsPerBeat)):44,r=Number(e.pulse),a=Number(e.stepIndex),o=Number.isFinite(a)&&a>=0&&a.`),a||l.push(`Missing viewBox on .`),o||l.push(`Missing width/height on .`),t&&u?.canonicalHash&&u.canonicalHash!==t&&l.push(`canonicalHash in Φkey metadata does not match the live glyph hash.`),{ok:l.length===0&&s,errors:l,payload:u??null,meta:r}}catch(e){return{ok:!1,errors:[e instanceof Error&&e.message?e.message:`Invalid SVG`],payload:null,meta:null}}}const v={SVG_NS:a,XLINK_NS:o};export{l as a,s as c,r as d,i as f,f as i,g as l,u as n,c as o,n as p,d as r,p as s,v as t,_ as u}; \ No newline at end of file +import{cn as e,un as t}from"./index-BWApiWDT.js";function n(e){return Math.max(0,Math.floor(e))*11}function r(e){return Math.max(0,Math.floor(e))}function i(e,t){let n=11*t,r=(e%n+n)%n;return Math.floor(r/11)}var a=`http://www.w3.org/2000/svg`,o=`http://www.w3.org/1999/xlink`;function s(e){if(typeof e!=`string`||e.trim()===``)return e;let t=e.replace(//gi,``);return t=t.replace(/\son[a-z]+\s*=\s*"[^"]*"/gi,``),t=t.replace(/\son[a-z]+\s*=\s*'[^']*'/gi,``),t=t.replace(/\son[a-z]+\s*=\s*[^\s>'"]+/gi,``),t=t.replace(/\s(?:xlink:)?href\s*=\s*"(?:https?:)?\/\/[^"]*"/gi,``),t=t.replace(/\s(?:xlink:)?href\s*=\s*'(?:https?:)?\/\/[^']*'/gi,``),t=t.replace(//gi,``),t}function c(e){let t=s(e),n=new DOMParser().parseFromString(t,`image/svg+xml`).documentElement;if(!n||n.nodeName.toLowerCase()!==`svg`)throw Error(`Invalid SVG`);let r=n.querySelector(`metadata`),i={};if(r&&r.textContent)try{i=JSON.parse(r.textContent)}catch{i={}}return{svg:n,meta:i}}function l(e){e.getAttribute(`xmlns`)||e.setAttribute(`xmlns`,a),e.getAttribute(`xmlns:xlink`)||e.setAttribute(`xmlns:xlink`,o)}function u(e){let t=e.ownerDocument??document,n=e.querySelector(`metadata`);if(n)return n;let r=t.createElementNS(a,`metadata`);return e.insertBefore(r,e.firstChild),r}function d(e,t,n){let r=e.ownerDocument??document,i=e.querySelector(`title`);i||(i=r.createElementNS(a,`title`),e.insertBefore(i,e.firstChild)),i.textContent=t;let o=e.querySelector(`desc`);o||(o=r.createElementNS(a,`desc`),e.insertBefore(o,i.nextSibling)),o.textContent=n}function f(e,t){if(!e.getAttribute(`viewBox`))try{let n=e.viewBox.baseVal;if(n?.width&&n?.height)e.setAttribute(`viewBox`,`${n.x} ${n.y} ${n.width} ${n.height}`);else if(typeof e.getBBox==`function`){let n=e.getBBox();n?.width&&n?.height?e.setAttribute(`viewBox`,`${n.x} ${n.y} ${n.width} ${n.height}`):e.setAttribute(`viewBox`,`0 0 ${t} ${t}`)}else e.setAttribute(`viewBox`,`0 0 ${t} ${t}`)}catch{e.setAttribute(`viewBox`,`0 0 ${t} ${t}`)}e.setAttribute(`width`,String(t)),e.setAttribute(`height`,String(t)),e.setAttribute(`preserveAspectRatio`,`xMidYMid meet`)}function p(e,t){let n=u(e);n.textContent=JSON.stringify(t),l(e);let r=new XMLSerializer().serializeToString(e);return r.startsWith(`\n${r}`}var m=e=>typeof e==`number`&&Number.isFinite(e),h=(e,t=0)=>{if(m(e))return e;if(typeof e==`string`&&e.trim()!==``){let n=Number(e);return Number.isFinite(n)?n:t}return t};function g(e){let t=[];if(e.pulse??t.push(`Missing metadata field: pulse`),e.beat??t.push(`Missing metadata field: beat`),e.chakraDay??t.push(`Missing metadata field: chakraDay`),t.length>0)return{ok:!1,errors:t};let n=Number.isFinite(e.stepsPerBeat)?Math.max(1,Number(e.stepsPerBeat)):44,r=Number(e.pulse),a=Number(e.stepIndex),o=Number.isFinite(a)&&a>=0&&a.`),a||l.push(`Missing viewBox on .`),o||l.push(`Missing width/height on .`),t&&u?.canonicalHash&&u.canonicalHash!==t&&l.push(`canonicalHash in Φkey metadata does not match the live glyph hash.`),{ok:l.length===0&&s,errors:l,payload:u??null,meta:r}}catch(e){return{ok:!1,errors:[e instanceof Error&&e.message?e.message:`Invalid SVG`],payload:null,meta:null}}}const v={SVG_NS:a,XLINK_NS:o};export{l as a,s as c,r as d,i as f,f as i,g as l,u as n,c as o,n as p,d as r,p as s,v as t,_ as u}; \ No newline at end of file diff --git a/dist/assets/svgMeta-ADMUtfmL.js b/dist/assets/svgMeta-DRLQd2cj.js similarity index 79% rename from dist/assets/svgMeta-ADMUtfmL.js rename to dist/assets/svgMeta-DRLQd2cj.js index 8b6103f0..467e2278 100644 --- a/dist/assets/svgMeta-ADMUtfmL.js +++ b/dist/assets/svgMeta-DRLQd2cj.js @@ -1 +1 @@ -import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c,u as l}from"./svgMeta-BqZogknt.js";export{c as NS,i as ensureMetadata,o as ensureTitleAndDesc,n as ensureViewBoxOnClone,e as ensureXmlns,a as parseSvgAndMetadata,s as putMetadata,t as sanitizeSvgString,r as validateSigilMeta,l as validateSvgForVerifier}; \ No newline at end of file +import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c,u as l}from"./svgMeta-CqOhEmuY.js";export{c as NS,i as ensureMetadata,o as ensureTitleAndDesc,n as ensureViewBoxOnClone,e as ensureXmlns,a as parseSvgAndMetadata,s as putMetadata,t as sanitizeSvgString,r as validateSigilMeta,l as validateSvgForVerifier}; \ No newline at end of file diff --git a/dist/assets/useFastPress-BuTJ0eyZ.js b/dist/assets/useFastPress-C6nRe_12.js similarity index 80% rename from dist/assets/useFastPress-BuTJ0eyZ.js rename to dist/assets/useFastPress-C6nRe_12.js index 0bee3bc6..f0570a14 100644 --- a/dist/assets/useFastPress-BuTJ0eyZ.js +++ b/dist/assets/useFastPress-C6nRe_12.js @@ -1 +1 @@ -import{Tn as e,jn as t}from"./index-CcPm2yTY.js";var n=t(e(),1);function r(e){let t=(0,n.useRef)(!1);return{onPointerUp:(0,n.useCallback)(n=>{n.pointerType&&n.pointerType!==`mouse`&&(t.current=!0,e(n),setTimeout(()=>{t.current=!1},0))},[e]),onClick:(0,n.useCallback)(n=>{if(t.current){t.current=!1;return}e(n)},[e])}}export{r as t}; \ No newline at end of file +import{Tn as e,jn as t}from"./index-BWApiWDT.js";var n=t(e(),1);function r(e){let t=(0,n.useRef)(!1);return{onPointerUp:(0,n.useCallback)(n=>{n.pointerType&&n.pointerType!==`mouse`&&(t.current=!0,e(n),setTimeout(()=>{t.current=!1},0))},[e]),onClick:(0,n.useCallback)(n=>{if(t.current){t.current=!1;return}e(n)},[e])}}export{r as t}; \ No newline at end of file diff --git a/dist/assets/usernameClaimRegistry-_VlzEwdK.js b/dist/assets/usernameClaimRegistry-CU2B_ZCP.js similarity index 98% rename from dist/assets/usernameClaimRegistry-_VlzEwdK.js rename to dist/assets/usernameClaimRegistry-CU2B_ZCP.js index 81ac7669..e8aaab29 100644 --- a/dist/assets/usernameClaimRegistry-_VlzEwdK.js +++ b/dist/assets/usernameClaimRegistry-CU2B_ZCP.js @@ -1 +1 @@ -import{Ct as e,gt as t,mn as n,mt as r}from"./index-CcPm2yTY.js";function i(e){let t=2166136261;for(let n=0;n>>0).toString(16).padStart(8,`0`)}function a(e,t,n){let r=e.metadata?.kaiSignature??``,a=typeof n?.kaiSignature==`string`?n.kaiSignature:``,o=typeof n?.timestamp==`number`?String(n.timestamp):``;return`glyph::${t}::${i(`evolve|p=${t}|parentHash=${e.hash}|parentSig=${r}|patchSig=${a}|patchTs=${o}`)}`}function o(t,n,r){let i=a(t,n,r),o=typeof r?.timestamp==`number`?r.timestamp:n,s={...t.metadata??{},...r??{},kaiSignature:i,timestamp:o},c={hash:i,pulseCreated:n,pulseGenesis:t.pulseGenesis??t.pulseCreated,parentHash:t.hash,sentFrom:t.hash,value:1,inhaled:{},metadata:s},l=(t.sentTo??[]).map(e=>({senderSignature:t.metadata?.kaiSignature??t.hash,senderStamp:t.hash,senderKaiPulse:e.pulseSent,receiverSignature:e.recipientHash})),{unsigned:u}=e({pulse:n,kaiSignature:i,seriesSize:1,quality:`med`,creatorVerified:!1,creatorRep:0,transfers:l,cumulativeTransfers:l.length},n);return c.value=u.valuePhi,c}function s(e){let t=(e??``).trim();return t?t.replace(/^@+/,``).replace(/[\s_]+/g,` `).trim().toLowerCase().replace(/[.,;:!?]+$/g,``):``}function c(e){let t=(e??``).trim();if(!t)return``;if(/^[0-9a-f]{64}$/i.test(t))return t.toLowerCase();if(/^[A-Za-z0-9_-]{16,}$/u.test(t))return r(t);try{let e=new URL(t),n=e.pathname||``,i=n.match(/\/(?:stream|feed)\/p\/([^/?#]+)/u)||n.match(/\/p\/([^/?#]+)/u)||n.match(/\/p(?:\u007e|%7[Ee])\/?([^/?#]+)/u);if(i?.[1])return r(i[1]);let a=e.hash&&e.hash.startsWith(`#`)?e.hash.slice(1):``,o=new URLSearchParams(a),s=e.searchParams;for(let e of[`t`,`p`,`token`,`capsule`]){let t=o.get(e);if(t)return r(t);let n=s.get(e);if(n)return r(n)}}catch{}return``}function l(e,n,r){let i=s(n);if(!i)throw Error(`Username required for claim payload`);return{kind:t,username:n.trim(),normalized:i,originHash:e,ownerHint:r??null}}function u(e){let t=l(e.origin.hash,e.username,e.ownerHint??e.origin.meta?.userPhiKey??e.origin.metadata?.creator??null),n={...e.origin.metadata??{},usernameClaim:t};return o(e.origin,e.pulse,n)}var d=typeof window<`u`,f=`kai:username-claims:v1`,p=`kai-username-claims`,m=`username-claim:registered`,h=`username-claim`,g={};function _(e){return Object.fromEntries(Object.entries(e))}function v(e){let t=BigInt(2**53-1);return e>t?2**53-1:e<-t?-(2**53-1):Number(e)}function y(){return v(n())}function b(e){let t=(e??``).trim();if(!t)return null;if(!d)return t;try{return new URL(t,window.location?.origin??void 0).toString()}catch{return t}}function x(e){if(typeof e==`number`)return Number.isFinite(e)?e:0;if(typeof e==`bigint`)return v(e);if(typeof e==`string`){let t=e.trim();if(!t)return 0;let n=Number(t);return Number.isFinite(n)?n:0}return 0}function S(e){if(!e||typeof e!=`object`)return null;let t=e,n=typeof t.normalized==`string`?t.normalized:``,r=typeof t.claimHash==`string`?t.claimHash:``;if(!n||!r)return null;let i={username:typeof t.username==`string`?t.username:n,normalized:n,claimHash:r,claimUrl:typeof t.claimUrl==`string`?t.claimUrl:``,originHash:typeof t.originHash==`string`?t.originHash:``,ownerHint:t.ownerHint===null||typeof t.ownerHint==`string`?t.ownerHint:null,updatedAt:x(t.updatedAt)};return!i.claimUrl||!i.originHash?null:i}function C(){if(!d)return _(g);try{let e=window.localStorage.getItem(f);if(!e)return g={},{};let t=JSON.parse(e);if(!t||typeof t!=`object`)return{};let n=t,r={};for(let[e,t]of Object.entries(n)){let n=S(t);n&&(r[e]=n)}return g=_(r),_(r)}catch{return _(g)}}function w(e){if(g=_(e),d)try{window.localStorage.setItem(f,JSON.stringify(e))}catch{}}var T=null;function E(){return!d||!(`BroadcastChannel`in window)?null:T||(T=new BroadcastChannel(p),T)}function D(e){let t=C(),n={...e,updatedAt:x(e?.updatedAt)},r=t[n.normalized];return r&&r.claimHash!==n.claimHash?!1:r&&r.claimHash===n.claimHash&&r.claimUrl===n.claimUrl&&r.originHash===n.originHash&&r.ownerHint===n.ownerHint&&r.updatedAt===n.updatedAt?!0:(t[n.normalized]=n,w(t),!0)}function O(e){if(d){try{let t=new CustomEvent(m,{detail:e});window.dispatchEvent(t)}catch{}try{E()?.postMessage({type:h,entry:e})}catch{}}}function k(e,t){let n=t.payload;if(!n||n.kind!==`username_claim`)return{updated:!1,reason:`not a username-claim glyph`};let r=c(t.hash);if(!r)return{updated:!1,reason:`missing glyph hash`};let i=s(n.normalized||n.username);if(!i)return{updated:!1,reason:`missing username`};let a=e[i];if(a&&a.claimHash!==r)return{updated:!1,reason:`username already bound`};let o=b(t.url??``);if(!o)return{updated:!1,reason:`missing claim url`};let l=t.ownerHint??n.ownerHint??null,u={username:n.username,normalized:i,claimHash:r,claimUrl:o,originHash:n.originHash,ownerHint:l,updatedAt:y()},d=a&&a.claimHash===u.claimHash&&a.claimUrl===u.claimUrl&&a.originHash===u.originHash&&a.ownerHint===u.ownerHint;return e[i]=u,{updated:!d,entry:u}}function A(e){let t=C(),{updated:n,entry:r,reason:i}=k(t,e);return n?(w(t),r&&O(r),{accepted:!0,updated:!0,registry:t}):{accepted:!!r,updated:!1,reason:i,registry:t}}function j(){return C()}function M(e){if(!d)return()=>{};let t=t=>{let n=t;n?.detail&&D(n.detail)&&e(n.detail,`event`)},n=E(),r=t=>{let n=t?.data;n?.type===h&&n.entry&&D(n.entry)&&e(n.entry,`broadcast`)},i=t=>{if(!(t.key!==f||typeof t.newValue!=`string`))try{let n=JSON.parse(t.newValue);for(let t of Object.values(n)){let n=S(t);n&&D(n)&&e(n,`storage`)}}catch{}};return window.addEventListener(m,t),n&&n.addEventListener(`message`,r),window.addEventListener(`storage`,i),()=>{window.removeEventListener(m,t),n&&n.removeEventListener(`message`,r),window.removeEventListener(`storage`,i)}}export{c as a,u as i,A as n,s as o,M as r,j as t}; \ No newline at end of file +import{Ct as e,gt as t,mn as n,mt as r}from"./index-BWApiWDT.js";function i(e){let t=2166136261;for(let n=0;n>>0).toString(16).padStart(8,`0`)}function a(e,t,n){let r=e.metadata?.kaiSignature??``,a=typeof n?.kaiSignature==`string`?n.kaiSignature:``,o=typeof n?.timestamp==`number`?String(n.timestamp):``;return`glyph::${t}::${i(`evolve|p=${t}|parentHash=${e.hash}|parentSig=${r}|patchSig=${a}|patchTs=${o}`)}`}function o(t,n,r){let i=a(t,n,r),o=typeof r?.timestamp==`number`?r.timestamp:n,s={...t.metadata??{},...r??{},kaiSignature:i,timestamp:o},c={hash:i,pulseCreated:n,pulseGenesis:t.pulseGenesis??t.pulseCreated,parentHash:t.hash,sentFrom:t.hash,value:1,inhaled:{},metadata:s},l=(t.sentTo??[]).map(e=>({senderSignature:t.metadata?.kaiSignature??t.hash,senderStamp:t.hash,senderKaiPulse:e.pulseSent,receiverSignature:e.recipientHash})),{unsigned:u}=e({pulse:n,kaiSignature:i,seriesSize:1,quality:`med`,creatorVerified:!1,creatorRep:0,transfers:l,cumulativeTransfers:l.length},n);return c.value=u.valuePhi,c}function s(e){let t=(e??``).trim();return t?t.replace(/^@+/,``).replace(/[\s_]+/g,` `).trim().toLowerCase().replace(/[.,;:!?]+$/g,``):``}function c(e){let t=(e??``).trim();if(!t)return``;if(/^[0-9a-f]{64}$/i.test(t))return t.toLowerCase();if(/^[A-Za-z0-9_-]{16,}$/u.test(t))return r(t);try{let e=new URL(t),n=e.pathname||``,i=n.match(/\/(?:stream|feed)\/p\/([^/?#]+)/u)||n.match(/\/p\/([^/?#]+)/u)||n.match(/\/p(?:\u007e|%7[Ee])\/?([^/?#]+)/u);if(i?.[1])return r(i[1]);let a=e.hash&&e.hash.startsWith(`#`)?e.hash.slice(1):``,o=new URLSearchParams(a),s=e.searchParams;for(let e of[`t`,`p`,`token`,`capsule`]){let t=o.get(e);if(t)return r(t);let n=s.get(e);if(n)return r(n)}}catch{}return``}function l(e,n,r){let i=s(n);if(!i)throw Error(`Username required for claim payload`);return{kind:t,username:n.trim(),normalized:i,originHash:e,ownerHint:r??null}}function u(e){let t=l(e.origin.hash,e.username,e.ownerHint??e.origin.meta?.userPhiKey??e.origin.metadata?.creator??null),n={...e.origin.metadata??{},usernameClaim:t};return o(e.origin,e.pulse,n)}var d=typeof window<`u`,f=`kai:username-claims:v1`,p=`kai-username-claims`,m=`username-claim:registered`,h=`username-claim`,g={};function _(e){return Object.fromEntries(Object.entries(e))}function v(e){let t=BigInt(2**53-1);return e>t?2**53-1:e<-t?-(2**53-1):Number(e)}function y(){return v(n())}function b(e){let t=(e??``).trim();if(!t)return null;if(!d)return t;try{return new URL(t,window.location?.origin??void 0).toString()}catch{return t}}function x(e){if(typeof e==`number`)return Number.isFinite(e)?e:0;if(typeof e==`bigint`)return v(e);if(typeof e==`string`){let t=e.trim();if(!t)return 0;let n=Number(t);return Number.isFinite(n)?n:0}return 0}function S(e){if(!e||typeof e!=`object`)return null;let t=e,n=typeof t.normalized==`string`?t.normalized:``,r=typeof t.claimHash==`string`?t.claimHash:``;if(!n||!r)return null;let i={username:typeof t.username==`string`?t.username:n,normalized:n,claimHash:r,claimUrl:typeof t.claimUrl==`string`?t.claimUrl:``,originHash:typeof t.originHash==`string`?t.originHash:``,ownerHint:t.ownerHint===null||typeof t.ownerHint==`string`?t.ownerHint:null,updatedAt:x(t.updatedAt)};return!i.claimUrl||!i.originHash?null:i}function C(){if(!d)return _(g);try{let e=window.localStorage.getItem(f);if(!e)return g={},{};let t=JSON.parse(e);if(!t||typeof t!=`object`)return{};let n=t,r={};for(let[e,t]of Object.entries(n)){let n=S(t);n&&(r[e]=n)}return g=_(r),_(r)}catch{return _(g)}}function w(e){if(g=_(e),d)try{window.localStorage.setItem(f,JSON.stringify(e))}catch{}}var T=null;function E(){return!d||!(`BroadcastChannel`in window)?null:T||(T=new BroadcastChannel(p),T)}function D(e){let t=C(),n={...e,updatedAt:x(e?.updatedAt)},r=t[n.normalized];return r&&r.claimHash!==n.claimHash?!1:r&&r.claimHash===n.claimHash&&r.claimUrl===n.claimUrl&&r.originHash===n.originHash&&r.ownerHint===n.ownerHint&&r.updatedAt===n.updatedAt?!0:(t[n.normalized]=n,w(t),!0)}function O(e){if(d){try{let t=new CustomEvent(m,{detail:e});window.dispatchEvent(t)}catch{}try{E()?.postMessage({type:h,entry:e})}catch{}}}function k(e,t){let n=t.payload;if(!n||n.kind!==`username_claim`)return{updated:!1,reason:`not a username-claim glyph`};let r=c(t.hash);if(!r)return{updated:!1,reason:`missing glyph hash`};let i=s(n.normalized||n.username);if(!i)return{updated:!1,reason:`missing username`};let a=e[i];if(a&&a.claimHash!==r)return{updated:!1,reason:`username already bound`};let o=b(t.url??``);if(!o)return{updated:!1,reason:`missing claim url`};let l=t.ownerHint??n.ownerHint??null,u={username:n.username,normalized:i,claimHash:r,claimUrl:o,originHash:n.originHash,ownerHint:l,updatedAt:y()},d=a&&a.claimHash===u.claimHash&&a.claimUrl===u.claimUrl&&a.originHash===u.originHash&&a.ownerHint===u.ownerHint;return e[i]=u,{updated:!d,entry:u}}function A(e){let t=C(),{updated:n,entry:r,reason:i}=k(t,e);return n?(w(t),r&&O(r),{accepted:!0,updated:!0,registry:t}):{accepted:!!r,updated:!1,reason:i,registry:t}}function j(){return C()}function M(e){if(!d)return()=>{};let t=t=>{let n=t;n?.detail&&D(n.detail)&&e(n.detail,`event`)},n=E(),r=t=>{let n=t?.data;n?.type===h&&n.entry&&D(n.entry)&&e(n.entry,`broadcast`)},i=t=>{if(!(t.key!==f||typeof t.newValue!=`string`))try{let n=JSON.parse(t.newValue);for(let t of Object.values(n)){let n=S(t);n&&D(n)&&e(n,`storage`)}}catch{}};return window.addEventListener(m,t),n&&n.addEventListener(`message`,r),window.addEventListener(`storage`,i),()=>{window.removeEventListener(m,t),n&&n.removeEventListener(`message`,r),window.removeEventListener(`storage`,i)}}export{c as a,u as i,A as n,s as o,M as r,j as t}; \ No newline at end of file diff --git a/dist/assets/x-B0A9hqeh.js b/dist/assets/x-Bw0a6Rv2.js similarity index 55% rename from dist/assets/x-B0A9hqeh.js rename to dist/assets/x-Bw0a6Rv2.js index 572b4334..367b49a8 100644 --- a/dist/assets/x-B0A9hqeh.js +++ b/dist/assets/x-Bw0a6Rv2.js @@ -1 +1 @@ -import{vt as e}from"./index-CcPm2yTY.js";var t=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t}; \ No newline at end of file +import{vt as e}from"./index-BWApiWDT.js";var t=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t}; \ No newline at end of file diff --git a/dist/index.html b/dist/index.html index 413d22de..43ad2d32 100644 --- a/dist/index.html +++ b/dist/index.html @@ -117,7 +117,7 @@ - + diff --git a/dist/sw.js b/dist/sw.js index 1cf30d48..739fc1f6 100644 --- a/dist/sw.js +++ b/dist/sw.js @@ -9,7 +9,7 @@ // Update this version string manually to keep the app + cache versions in sync. // The value is forwarded to the UI via the service worker "SW_ACTIVATED" message. -const APP_VERSION = "30.0.5"; // update on release +const APP_VERSION = "30.0.6"; // update on release const VERSION = new URL(self.location.href).searchParams.get("v") || APP_VERSION; // derived from build const PREFIX = "PHINETWORK"; const PRECACHE = `${PREFIX}-precache-${VERSION}`; diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index fecb011f..7395a78c 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -919,13 +919,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/history": { - "version": "4.7.11", - "resolved": "https://registry.npmjs.org/@types/history/-/history-4.7.11.tgz", - "integrity": "sha512-qjDJRrmvBMiTx+jyLxvLfJU7UznFuokDv4f3WRuriHKERccVpFU+8XMQUAbDzoiJCsmexxRExQeMwwCdamSKDA==", - "dev": true, - "license": "MIT" - }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", @@ -944,13 +937,13 @@ } }, "node_modules/@types/node": { - "version": "24.10.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.4.tgz", - "integrity": "sha512-vnDVpYPMzs4wunl27jHrfmwojOGKya0xyM3sH+UE5iv5uPS6vX7UIoh6m+vQc5LGBq52HBKPIn/zcSZVzeDEZg==", + "version": "22.19.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.3.tgz", + "integrity": "sha512-1N9SBnWYOJTrNZCdh/yJE+t910Y128BoyY+zBLWhL3r0TYzlTmFdXrPwHL9DyFZmlEXNQQolTZh3KHV31QDhyA==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~7.16.0" + "undici-types": "~6.21.0" } }, "node_modules/@types/offscreencanvas": { @@ -1021,29 +1014,6 @@ "@types/react": "*" } }, - "node_modules/@types/react-router": { - "version": "5.1.20", - "resolved": "https://registry.npmjs.org/@types/react-router/-/react-router-5.1.20.tgz", - "integrity": "sha512-jGjmu/ZqS7FjSH6owMcD5qpq19+1RS9DeVRqfl1FeBMxTDQAGwlMWOcs52NDoXaNKyG3d1cYQFMs9rCrb88o9Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/history": "^4.7.11", - "@types/react": "*" - } - }, - "node_modules/@types/react-router-dom": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/@types/react-router-dom/-/react-router-dom-5.3.3.tgz", - "integrity": "sha512-kpqnYK4wcdm5UaWI3fLcELopqLrHgLqNsdpHauzlQktfkHL3npOSwtj1Uz9oKBAzs7lFtVkV8j83voAz2D8fhw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/history": "^4.7.11", - "@types/react": "*", - "@types/react-router": "*" - } - }, "node_modules/@types/stats.js": { "version": "0.17.4", "resolved": "https://registry.npmjs.org/@types/stats.js/-/stats.js-0.17.4.tgz", @@ -2362,6 +2332,21 @@ } } }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -3909,9 +3894,9 @@ } }, "node_modules/undici-types": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", - "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", "dev": true, "license": "MIT" }, diff --git a/node_modules/@types/history/DOMUtils.d.ts b/node_modules/@types/history/DOMUtils.d.ts deleted file mode 100755 index 2b0a597c..00000000 --- a/node_modules/@types/history/DOMUtils.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -declare global { - // Some users of this package are don't use "dom" libs - interface EventTarget {} - interface EventListener {} - interface EventListenerObject {} -} - -export const isExtraneousPopstateEvent: boolean; -export function addEventListener(node: EventTarget, event: string, listener: EventListener | EventListenerObject): void; -export function removeEventListener( - node: EventTarget, - event: string, - listener: EventListener | EventListenerObject, -): void; -export function getConfirmation(message: string, callback: (result: boolean) => void): void; -export function supportsHistory(): boolean; -export function supportsGoWithoutReloadUsingHash(): boolean; diff --git a/node_modules/@types/history/ExecutionEnvironment.d.ts b/node_modules/@types/history/ExecutionEnvironment.d.ts deleted file mode 100755 index ac158887..00000000 --- a/node_modules/@types/history/ExecutionEnvironment.d.ts +++ /dev/null @@ -1 +0,0 @@ -export const canUseDOM: boolean; diff --git a/node_modules/@types/history/LICENSE b/node_modules/@types/history/LICENSE deleted file mode 100755 index 9e841e7a..00000000 --- a/node_modules/@types/history/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE diff --git a/node_modules/@types/history/LocationUtils.d.ts b/node_modules/@types/history/LocationUtils.d.ts deleted file mode 100755 index 26e9324b..00000000 --- a/node_modules/@types/history/LocationUtils.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Path, LocationState, LocationKey, Location, LocationDescriptor } from './index'; - -export function locationsAreEqual(lv: LocationDescriptor, rv: LocationDescriptor): boolean; -export function createLocation( - path: LocationDescriptor, - state?: S, - key?: LocationKey, - currentLocation?: Location, -): Location; diff --git a/node_modules/@types/history/PathUtils.d.ts b/node_modules/@types/history/PathUtils.d.ts deleted file mode 100755 index 18952a2b..00000000 --- a/node_modules/@types/history/PathUtils.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Path, Location, LocationDescriptorObject } from './index'; - -export function addLeadingSlash(path: Path): Path; -export function stripLeadingSlash(path: Path): Path; -export function hasBasename(path: Path): boolean; -export function stripBasename(path: Path, prefix: string): Path; -export function stripTrailingSlash(path: Path): Path; -export function parsePath(path: Path): Location; -export function createPath(location: LocationDescriptorObject): Path; diff --git a/node_modules/@types/history/README.md b/node_modules/@types/history/README.md deleted file mode 100755 index 21e04744..00000000 --- a/node_modules/@types/history/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Installation -> `npm install --save @types/history` - -# Summary -This package contains type definitions for history (https://github.com/mjackson/history). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/history. - -### Additional Details - * Last updated: Sun, 16 Jan 2022 17:31:24 GMT - * Dependencies: none - * Global values: `History` - -# Credits -These definitions were written by [Sergey Buturlakin](https://github.com/sergey-buturlakin), [Nathan Brown](https://github.com/ngbrown), [Young Rok Kim](https://github.com/rokoroku), and [Daniel Nixon](https://github.com/danielnixon). diff --git a/node_modules/@types/history/createBrowserHistory.d.ts b/node_modules/@types/history/createBrowserHistory.d.ts deleted file mode 100755 index 09910bd8..00000000 --- a/node_modules/@types/history/createBrowserHistory.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { History, LocationState } from './index'; -import { getConfirmation } from './DOMUtils'; - -export interface BrowserHistoryBuildOptions { - basename?: string | undefined; - forceRefresh?: boolean | undefined; - getUserConfirmation?: typeof getConfirmation | undefined; - keyLength?: number | undefined; -} - -export default function createBrowserHistory(options?: BrowserHistoryBuildOptions): History; diff --git a/node_modules/@types/history/createHashHistory.d.ts b/node_modules/@types/history/createHashHistory.d.ts deleted file mode 100755 index 4351a484..00000000 --- a/node_modules/@types/history/createHashHistory.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { History, LocationState } from './index'; -import { getConfirmation } from './DOMUtils'; - -export type HashType = 'hashbang' | 'noslash' | 'slash'; - -export interface HashHistoryBuildOptions { - basename?: string | undefined; - hashType?: HashType | undefined; - getUserConfirmation?: typeof getConfirmation | undefined; -} - -export default function createHashHistory(options?: HashHistoryBuildOptions): History; diff --git a/node_modules/@types/history/createMemoryHistory.d.ts b/node_modules/@types/history/createMemoryHistory.d.ts deleted file mode 100755 index fea27d94..00000000 --- a/node_modules/@types/history/createMemoryHistory.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { History, Location, LocationState } from './index'; -import { getConfirmation } from './DOMUtils'; - -export type InitialEntry = string | Partial; - -export interface MemoryHistoryBuildOptions { - getUserConfirmation?: typeof getConfirmation | undefined; - initialEntries?: InitialEntry[] | undefined; - initialIndex?: number | undefined; - keyLength?: number | undefined; -} - -export interface MemoryHistory extends History { - index: number; - entries: Location[]; - canGo(n: number): boolean; -} - -export default function createMemoryHistory(options?: MemoryHistoryBuildOptions): MemoryHistory; diff --git a/node_modules/@types/history/createTransitionManager.d.ts b/node_modules/@types/history/createTransitionManager.d.ts deleted file mode 100755 index 135ee54f..00000000 --- a/node_modules/@types/history/createTransitionManager.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Location, Action, LocationListener, LocationState, UnregisterCallback } from './index'; -import { getConfirmation } from './DOMUtils'; - -export type PromptFunction = (location: Location, action: Action) => any; - -export type Prompt = PromptFunction | boolean; - -export interface TransitionManager { - setPrompt(nextPrompt?: Prompt): UnregisterCallback; - appendListener(listener: LocationListener): UnregisterCallback; - notifyListeners(location: Location, action: Action): void; - confirmTransitionTo( - location: Location, - action: Action, - getUserConfirmation: typeof getConfirmation, - callback: (result: boolean) => void, - ): void; -} - -export default function createTransitionManager(): TransitionManager; diff --git a/node_modules/@types/history/index.d.ts b/node_modules/@types/history/index.d.ts deleted file mode 100755 index c7fb53ec..00000000 --- a/node_modules/@types/history/index.d.ts +++ /dev/null @@ -1,95 +0,0 @@ -// Type definitions for history 4.7.2 -// Project: https://github.com/mjackson/history -// Definitions by: Sergey Buturlakin , Nathan Brown , Young Rok Kim , Daniel Nixon -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 -export as namespace History; - -export type Action = 'PUSH' | 'POP' | 'REPLACE'; -export type UnregisterCallback = () => void; - -export interface History { - length: number; - action: Action; - location: Location; - push(location: Path | LocationDescriptor, state?: HistoryLocationState): void; - replace(location: Path | LocationDescriptor, state?: HistoryLocationState): void; - go(n: number): void; - goBack(): void; - goForward(): void; - block(prompt?: boolean | string | TransitionPromptHook): UnregisterCallback; - listen(listener: LocationListener): UnregisterCallback; - createHref(location: LocationDescriptorObject): Href; -} - -export interface Location { - pathname: Pathname; - search: Search; - state: S; - hash: Hash; - key?: LocationKey | undefined; -} - -export interface LocationDescriptorObject { - pathname?: Pathname | undefined; - search?: Search | undefined; - state?: S | undefined; - hash?: Hash | undefined; - key?: LocationKey | undefined; -} - -export namespace History { - export type LocationDescriptor = Path | LocationDescriptorObject; - export type LocationKey = string; - export type LocationListener = (location: Location, action: Action) => void; - - export type LocationState = unknown; - export type Path = string; - export type Pathname = string; - export type Search = string; - export type TransitionHook = (location: Location, callback: (result: any) => void) => any; - export type TransitionPromptHook = ( - location: Location, - action: Action, - ) => string | false | void; - export type Hash = string; - export type Href = string; -} - -export type LocationDescriptor = History.LocationDescriptor; -export type LocationKey = History.LocationKey; -export type LocationListener = History.LocationListener; -export type LocationState = History.LocationState; -export type Path = History.Path; -export type Pathname = History.Pathname; -export type Search = History.Search; -export type TransitionHook = History.TransitionHook; -export type TransitionPromptHook = History.TransitionPromptHook; -export type Hash = History.Hash; -export type Href = History.Href; - -import { default as createBrowserHistory } from './createBrowserHistory'; -import { default as createHashHistory } from './createHashHistory'; -import { default as createMemoryHistory } from './createMemoryHistory'; -import { createLocation, locationsAreEqual } from './LocationUtils'; -import { parsePath, createPath } from './PathUtils'; - -// Global usage, without modules, needs the small trick, because lib.d.ts -// already has `history` and `History` global definitions: -// var createHistory = ((window as any).History as HistoryModule.Module).createHistory; -export interface Module { - createBrowserHistory: typeof createBrowserHistory; - createHashHistory: typeof createHashHistory; - createMemoryHistory: typeof createMemoryHistory; - createLocation: typeof createLocation; - locationsAreEqual: typeof locationsAreEqual; - parsePath: typeof parsePath; - createPath: typeof createPath; -} - -export * from './createBrowserHistory'; -export * from './createHashHistory'; -export * from './createMemoryHistory'; -export { createLocation, locationsAreEqual } from './LocationUtils'; -export { parsePath, createPath } from './PathUtils'; -export { createBrowserHistory, createHashHistory, createMemoryHistory }; diff --git a/node_modules/@types/history/package.json b/node_modules/@types/history/package.json deleted file mode 100755 index bfa46633..00000000 --- a/node_modules/@types/history/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@types/history", - "version": "4.7.11", - "description": "TypeScript definitions for history", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/history", - "license": "MIT", - "contributors": [ - { - "name": "Sergey Buturlakin", - "url": "https://github.com/sergey-buturlakin", - "githubUsername": "sergey-buturlakin" - }, - { - "name": "Nathan Brown", - "url": "https://github.com/ngbrown", - "githubUsername": "ngbrown" - }, - { - "name": "Young Rok Kim", - "url": "https://github.com/rokoroku", - "githubUsername": "rokoroku" - }, - { - "name": "Daniel Nixon", - "url": "https://github.com/danielnixon", - "githubUsername": "danielnixon" - } - ], - "main": "", - "types": "index.d.ts", - "repository": { - "type": "git", - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", - "directory": "types/history" - }, - "scripts": {}, - "dependencies": {}, - "typesPublisherContentHash": "141516ba36ab9f2b221dc957cba4ac21d9a06776c05786e6773c5581f8cf7455", - "typeScriptVersion": "3.8" -} \ No newline at end of file diff --git a/node_modules/@types/node/README.md b/node_modules/@types/node/README.md index 0b7d3eee..92f79db7 100644 --- a/node_modules/@types/node/README.md +++ b/node_modules/@types/node/README.md @@ -5,11 +5,11 @@ This package contains type definitions for node (https://nodejs.org/). # Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v24. +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v22. ### Additional Details * Last updated: Sun, 14 Dec 2025 00:04:32 GMT * Dependencies: [undici-types](https://npmjs.com/package/undici-types) # Credits -These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [Alberto Schiabel](https://github.com/jkomyno), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [David Junger](https://github.com/touffy), [Mohsen Azimi](https://github.com/mohsen1), [Nikita Galkin](https://github.com/galkin), [Sebastian Silbermann](https://github.com/eps1lon), [Wilco Bakker](https://github.com/WilcoBakker), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), [Dmitry Semigradsky](https://github.com/Semigradsky), [René](https://github.com/Renegade334), and [Yagiz Nizipli](https://github.com/anonrig). +These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [Alberto Schiabel](https://github.com/jkomyno), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [David Junger](https://github.com/touffy), [Mohsen Azimi](https://github.com/mohsen1), [Nikita Galkin](https://github.com/galkin), [Sebastian Silbermann](https://github.com/eps1lon), [Wilco Bakker](https://github.com/WilcoBakker), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), [Dmitry Semigradsky](https://github.com/Semigradsky), and [René](https://github.com/Renegade334). diff --git a/node_modules/@types/node/assert.d.ts b/node_modules/@types/node/assert.d.ts index cd6d6df9..330d860c 100644 --- a/node_modules/@types/node/assert.d.ts +++ b/node_modules/@types/node/assert.d.ts @@ -1,7 +1,7 @@ /** * The `node:assert` module provides a set of assertion functions for verifying * invariants. - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/assert.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/assert.js) */ declare module "assert" { import strict = require("assert/strict"); @@ -44,13 +44,6 @@ declare module "assert" { * @default true */ strict?: boolean | undefined; - /** - * If set to `true`, skips prototype and constructor - * comparison in deep equality checks. - * @since v24.9.0 - * @default false - */ - skipPrototype?: boolean | undefined; } interface Assert extends Pick { readonly [kOptions]: AssertOptions & { strict: false }; @@ -60,7 +53,7 @@ declare module "assert" { } /** * The `Assert` class allows creating independent assertion instances with custom options. - * @since v24.6.0 + * @since v22.19.0 */ var Assert: { /** @@ -74,8 +67,7 @@ declare module "assert" { * ``` * * **Important**: When destructuring assertion methods from an `Assert` instance, - * the methods lose their connection to the instance's configuration options (such - * as `diff`, `strict`, and `skipPrototype` settings). + * the methods lose their connection to the instance's configuration options (such as `diff` and `strict` settings). * The destructured methods will fall back to default behavior instead. * * ```js @@ -89,41 +81,14 @@ declare module "assert" { * strictEqual({ a: 1 }, { b: { c: 1 } }); * ``` * - * The `skipPrototype` option affects all deep equality methods: - * - * ```js - * class Foo { - * constructor(a) { - * this.a = a; - * } - * } - * - * class Bar { - * constructor(a) { - * this.a = a; - * } - * } - * - * const foo = new Foo(1); - * const bar = new Bar(1); - * - * // Default behavior - fails due to different constructors - * const assert1 = new Assert(); - * assert1.deepStrictEqual(foo, bar); // AssertionError - * - * // Skip prototype comparison - passes if properties are equal - * const assert2 = new Assert({ skipPrototype: true }); - * assert2.deepStrictEqual(foo, bar); // OK - * ``` - * * When destructured, methods lose access to the instance's `this` context and revert to default assertion behavior * (diff: 'simple', non-strict mode). * To maintain custom options when using destructured methods, avoid * destructuring and call methods directly on the instance. - * @since v24.6.0 + * @since v22.19.0 */ new( - options?: AssertOptions & { strict?: true | undefined }, + options?: AssertOptions & { strict?: true }, ): AssertStrict; new( options: AssertOptions, @@ -212,9 +177,7 @@ declare module "assert" { * @return A function that wraps `fn`. */ calls(exact?: number): () => void; - calls(fn: undefined, exact?: number): () => void; - calls any>(fn: Func, exact?: number): Func; - calls any>(fn?: Func, exact?: number): Func | (() => void); + calls any>(fn?: Func, exact?: number): Func; /** * Example: * @@ -931,7 +894,7 @@ declare module "assert" { * check that the promise is rejected. * * If `asyncFn` is a function and it throws an error synchronously, `assert.rejects()` will return a rejected `Promise` with that error. If the - * function does not return a promise, `assert.rejects()` will return a rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v24.x/api/errors.html#err_invalid_return_value) + * function does not return a promise, `assert.rejects()` will return a rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v22.x/api/errors.html#err_invalid_return_value) * error. In both cases the error handler is skipped. * * Besides the async nature to await the completion behaves identically to {@link throws}. @@ -1001,7 +964,7 @@ declare module "assert" { * * If `asyncFn` is a function and it throws an error synchronously, `assert.doesNotReject()` will return a rejected `Promise` with that error. If * the function does not return a promise, `assert.doesNotReject()` will return a - * rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v24.x/api/errors.html#err_invalid_return_value) error. In both cases + * rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v22.x/api/errors.html#err_invalid_return_value) error. In both cases * the error handler is skipped. * * Using `assert.doesNotReject()` is actually not useful because there is little @@ -1064,7 +1027,7 @@ declare module "assert" { * If the values do not match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal * to the value of the `message` parameter. If the `message` parameter is * undefined, a default error message is assigned. If the `message` parameter is an - * instance of an [Error](https://nodejs.org/docs/latest-v24.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`. + * instance of an [Error](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`. * @since v13.6.0, v12.16.0 */ function match(value: string, regExp: RegExp, message?: string | Error): void; @@ -1087,7 +1050,7 @@ declare module "assert" { * If the values do match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal * to the value of the `message` parameter. If the `message` parameter is * undefined, a default error message is assigned. If the `message` parameter is an - * instance of an [Error](https://nodejs.org/docs/latest-v24.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`. + * instance of an [Error](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`. * @since v13.6.0, v12.16.0 */ function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void; diff --git a/node_modules/@types/node/assert/strict.d.ts b/node_modules/@types/node/assert/strict.d.ts index 4ed7395a..83ce1fe3 100644 --- a/node_modules/@types/node/assert/strict.d.ts +++ b/node_modules/@types/node/assert/strict.d.ts @@ -40,9 +40,9 @@ * To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS` * environment variables. This will also deactivate the colors in the REPL. For * more on color support in terminal environments, read the tty - * [`getColorDepth()`](https://nodejs.org/docs/latest-v24.x/api/tty.html#writestreamgetcolordepthenv) documentation. + * [`getColorDepth()`](https://nodejs.org/docs/latest-v22.x/api/tty.html#writestreamgetcolordepthenv) documentation. * @since v15.0.0 - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/assert/strict.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/assert/strict.js) */ declare module "assert/strict" { import { diff --git a/node_modules/@types/node/async_hooks.d.ts b/node_modules/@types/node/async_hooks.d.ts index 2377689f..01d21d4b 100644 --- a/node_modules/@types/node/async_hooks.d.ts +++ b/node_modules/@types/node/async_hooks.d.ts @@ -2,8 +2,8 @@ * We strongly discourage the use of the `async_hooks` API. * Other APIs that can cover most of its use cases include: * - * * [`AsyncLocalStorage`](https://nodejs.org/docs/latest-v24.x/api/async_context.html#class-asynclocalstorage) tracks async context - * * [`process.getActiveResourcesInfo()`](https://nodejs.org/docs/latest-v24.x/api/process.html#processgetactiveresourcesinfo) tracks active resources + * * [`AsyncLocalStorage`](https://nodejs.org/docs/latest-v22.x/api/async_context.html#class-asynclocalstorage) tracks async context + * * [`process.getActiveResourcesInfo()`](https://nodejs.org/docs/latest-v22.x/api/process.html#processgetactiveresourcesinfo) tracks active resources * * The `node:async_hooks` module provides an API to track asynchronous resources. * It can be accessed using: @@ -12,7 +12,7 @@ * import async_hooks from 'node:async_hooks'; * ``` * @experimental - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/async_hooks.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/async_hooks.js) */ declare module "async_hooks" { /** @@ -44,7 +44,7 @@ declare module "async_hooks" { * ``` * * Promise contexts may not get precise `executionAsyncIds` by default. - * See the section on [promise execution tracking](https://nodejs.org/docs/latest-v24.x/api/async_hooks.html#promise-execution-tracking). + * See the section on [promise execution tracking](https://nodejs.org/docs/latest-v22.x/api/async_hooks.html#promise-execution-tracking). * @since v8.1.0 * @return The `asyncId` of the current execution context. Useful to track when something calls. */ @@ -117,7 +117,7 @@ declare module "async_hooks" { * ``` * * Promise contexts may not get valid `triggerAsyncId`s by default. See - * the section on [promise execution tracking](https://nodejs.org/docs/latest-v24.x/api/async_hooks.html#promise-execution-tracking). + * the section on [promise execution tracking](https://nodejs.org/docs/latest-v22.x/api/async_hooks.html#promise-execution-tracking). * @return The ID of the resource responsible for calling the callback that is currently being executed. */ function triggerAsyncId(): number; @@ -320,16 +320,6 @@ declare module "async_hooks" { */ triggerAsyncId(): number; } - interface AsyncLocalStorageOptions { - /** - * The default value to be used when no store is provided. - */ - defaultValue?: any; - /** - * A name for the `AsyncLocalStorage` value. - */ - name?: string | undefined; - } /** * This class creates stores that stay coherent through asynchronous operations. * @@ -379,11 +369,6 @@ declare module "async_hooks" { * @since v13.10.0, v12.17.0 */ class AsyncLocalStorage { - /** - * Creates a new instance of `AsyncLocalStorage`. Store is only provided within a - * `run()` call or after an `enterWith()` call. - */ - constructor(options?: AsyncLocalStorageOptions); /** * Binds the given function to the current execution context. * @since v19.8.0 @@ -445,11 +430,6 @@ declare module "async_hooks" { * @since v13.10.0, v12.17.0 */ getStore(): T | undefined; - /** - * The name of the `AsyncLocalStorage` instance if provided. - * @since v24.0.0 - */ - readonly name: string; /** * Runs a function synchronously within a context and returns its * return value. The store is not accessible outside of the callback function. diff --git a/node_modules/@types/node/buffer.d.ts b/node_modules/@types/node/buffer.d.ts index 9a62ccf9..354e08aa 100644 --- a/node_modules/@types/node/buffer.d.ts +++ b/node_modules/@types/node/buffer.d.ts @@ -46,7 +46,7 @@ type _File = typeof globalThis extends { onmessage: any; File: any } ? {} : impo * // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74]. * const buf7 = Buffer.from('tést', 'latin1'); * ``` - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/buffer.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/buffer.js) */ declare module "buffer" { import { BinaryLike } from "node:crypto"; diff --git a/node_modules/@types/node/child_process.d.ts b/node_modules/@types/node/child_process.d.ts index ecad7d8e..313c33c4 100644 --- a/node_modules/@types/node/child_process.d.ts +++ b/node_modules/@types/node/child_process.d.ts @@ -63,7 +63,7 @@ * For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however, * the synchronous methods can have significant impact on performance due to * stalling the event loop while spawned processes complete. - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/child_process.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/child_process.js) */ declare module "child_process" { import { NonSharedBuffer } from "node:buffer"; @@ -458,7 +458,7 @@ declare module "child_process" { * as the connection may have been closed during the time it takes to send the * connection to the child. * @since v0.5.9 - * @param sendHandle `undefined`, or a [`net.Socket`](https://nodejs.org/docs/latest-v24.x/api/net.html#class-netsocket), [`net.Server`](https://nodejs.org/docs/latest-v24.x/api/net.html#class-netserver), or [`dgram.Socket`](https://nodejs.org/docs/latest-v24.x/api/dgram.html#class-dgramsocket) object. + * @param sendHandle `undefined`, or a [`net.Socket`](https://nodejs.org/docs/latest-v22.x/api/net.html#class-netsocket), [`net.Server`](https://nodejs.org/docs/latest-v22.x/api/net.html#class-netserver), or [`dgram.Socket`](https://nodejs.org/docs/latest-v22.x/api/dgram.html#class-dgramsocket) object. * @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties: */ send(message: Serializable, callback?: (error: Error | null) => void): boolean; diff --git a/node_modules/@types/node/cluster.d.ts b/node_modules/@types/node/cluster.d.ts index cdbc2190..eab9783a 100644 --- a/node_modules/@types/node/cluster.d.ts +++ b/node_modules/@types/node/cluster.d.ts @@ -1,7 +1,7 @@ /** * Clusters of Node.js processes can be used to run multiple instances of Node.js * that can distribute workloads among their application threads. When process isolation - * is not needed, use the [`worker_threads`](https://nodejs.org/docs/latest-v24.x/api/worker_threads.html) + * is not needed, use the [`worker_threads`](https://nodejs.org/docs/latest-v22.x/api/worker_threads.html) * module instead, which allows running multiple application threads within a single Node.js instance. * * The cluster module allows easy creation of child processes that all share @@ -50,7 +50,7 @@ * ``` * * On Windows, it is not yet possible to set up a named pipe server in a worker. - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/cluster.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/cluster.js) */ declare module "cluster" { import * as child from "node:child_process"; @@ -80,8 +80,8 @@ declare module "cluster" { silent?: boolean | undefined; /** * Configures the stdio of forked processes. Because the cluster module relies on IPC to function, this configuration must - * contain an `'ipc'` entry. When this option is provided, it overrides `silent`. See [`child_prcess.spawn()`](https://nodejs.org/docs/latest-v24.x/api/child_process.html#child_processspawncommand-args-options)'s - * [`stdio`](https://nodejs.org/docs/latest-v24.x/api/child_process.html#optionsstdio). + * contain an `'ipc'` entry. When this option is provided, it overrides `silent`. See [`child_prcess.spawn()`](https://nodejs.org/docs/latest-v22.x/api/child_process.html#child_processspawncommand-args-options)'s + * [`stdio`](https://nodejs.org/docs/latest-v22.x/api/child_process.html#optionsstdio). */ stdio?: any[] | undefined; /** @@ -99,7 +99,7 @@ declare module "cluster" { inspectPort?: number | (() => number) | undefined; /** * Specify the kind of serialization used for sending messages between processes. Possible values are `'json'` and `'advanced'`. - * See [Advanced serialization for `child_process`](https://nodejs.org/docs/latest-v24.x/api/child_process.html#advanced-serialization) for more details. + * See [Advanced serialization for `child_process`](https://nodejs.org/docs/latest-v22.x/api/child_process.html#advanced-serialization) for more details. * @default false */ serialization?: SerializationType | undefined; @@ -142,10 +142,10 @@ declare module "cluster" { */ id: number; /** - * All workers are created using [`child_process.fork()`](https://nodejs.org/docs/latest-v24.x/api/child_process.html#child_processforkmodulepath-args-options), the returned object + * All workers are created using [`child_process.fork()`](https://nodejs.org/docs/latest-v22.x/api/child_process.html#child_processforkmodulepath-args-options), the returned object * from this function is stored as `.process`. In a worker, the global `process` is stored. * - * See: [Child Process module](https://nodejs.org/docs/latest-v24.x/api/child_process.html#child_processforkmodulepath-args-options). + * See: [Child Process module](https://nodejs.org/docs/latest-v22.x/api/child_process.html#child_processforkmodulepath-args-options). * * Workers will call `process.exit(0)` if the `'disconnect'` event occurs * on `process` and `.exitedAfterDisconnect` is not `true`. This protects against @@ -156,7 +156,7 @@ declare module "cluster" { /** * Send a message to a worker or primary, optionally with a handle. * - * In the primary, this sends a message to a specific worker. It is identical to [`ChildProcess.send()`](https://nodejs.org/docs/latest-v24.x/api/child_process.html#subprocesssendmessage-sendhandle-options-callback). + * In the primary, this sends a message to a specific worker. It is identical to [`ChildProcess.send()`](https://nodejs.org/docs/latest-v22.x/api/child_process.html#subprocesssendmessage-sendhandle-options-callback). * * In a worker, this sends a message to the primary. It is identical to `process.send()`. * @@ -198,7 +198,7 @@ declare module "cluster" { * This method is aliased as `worker.destroy()` for backwards compatibility. * * In a worker, `process.kill()` exists, but it is not this function; - * it is [`kill()`](https://nodejs.org/docs/latest-v24.x/api/process.html#processkillpid-signal). + * it is [`kill()`](https://nodejs.org/docs/latest-v22.x/api/process.html#processkillpid-signal). * @since v0.9.12 * @param [signal='SIGTERM'] Name of the kill signal to send to the worker process. */ @@ -412,7 +412,7 @@ declare module "cluster" { readonly isWorker: boolean; /** * The scheduling policy, either `cluster.SCHED_RR` for round-robin or `cluster.SCHED_NONE` to leave it to the operating system. This is a - * global setting and effectively frozen once either the first worker is spawned, or [`.setupPrimary()`](https://nodejs.org/docs/latest-v24.x/api/cluster.html#clustersetupprimarysettings) + * global setting and effectively frozen once either the first worker is spawned, or [`.setupPrimary()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clustersetupprimarysettings) * is called, whichever comes first. * * `SCHED_RR` is the default on all operating systems except Windows. Windows will change to `SCHED_RR` once libuv is able to effectively distribute @@ -423,24 +423,24 @@ declare module "cluster" { */ schedulingPolicy: number; /** - * After calling [`.setupPrimary()`](https://nodejs.org/docs/latest-v24.x/api/cluster.html#clustersetupprimarysettings) - * (or [`.fork()`](https://nodejs.org/docs/latest-v24.x/api/cluster.html#clusterforkenv)) this settings object will contain + * After calling [`.setupPrimary()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clustersetupprimarysettings) + * (or [`.fork()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clusterforkenv)) this settings object will contain * the settings, including the default values. * * This object is not intended to be changed or set manually. * @since v0.7.1 */ readonly settings: ClusterSettings; - /** @deprecated since v16.0.0 - use [`.setupPrimary()`](https://nodejs.org/docs/latest-v24.x/api/cluster.html#clustersetupprimarysettings) instead. */ + /** @deprecated since v16.0.0 - use [`.setupPrimary()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clustersetupprimarysettings) instead. */ setupMaster(settings?: ClusterSettings): void; /** * `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in `cluster.settings`. * - * Any settings changes only affect future calls to [`.fork()`](https://nodejs.org/docs/latest-v24.x/api/cluster.html#clusterforkenv) + * Any settings changes only affect future calls to [`.fork()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clusterforkenv) * and have no effect on workers that are already running. * * The only attribute of a worker that cannot be set via `.setupPrimary()` is the `env` passed to - * [`.fork()`](https://nodejs.org/docs/latest-v24.x/api/cluster.html#clusterforkenv). + * [`.fork()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clusterforkenv). * * The defaults above apply to the first call only; the defaults for later calls are the current values at the time of * `cluster.setupPrimary()` is called. diff --git a/node_modules/@types/node/compatibility/iterators.d.ts b/node_modules/@types/node/compatibility/iterators.d.ts index 156e7856..2f9be9cd 100644 --- a/node_modules/@types/node/compatibility/iterators.d.ts +++ b/node_modules/@types/node/compatibility/iterators.d.ts @@ -3,7 +3,6 @@ // are expected (eg. DOM-compatible APIs) if lib.esnext.iterator is loaded. // Also ensures that iterators returned by the Node API, which inherit from Iterator.prototype, correctly expose the iterator helper methods // if lib.esnext.iterator is loaded. -// TODO: remove once this package no longer supports TS 5.5, and replace NodeJS.BuiltinIteratorReturn with BuiltinIteratorReturn. // Placeholders for TS <5.6 interface IteratorObject {} diff --git a/node_modules/@types/node/console.d.ts b/node_modules/@types/node/console.d.ts index 3c8a6825..3e4c2d9a 100644 --- a/node_modules/@types/node/console.d.ts +++ b/node_modules/@types/node/console.d.ts @@ -5,12 +5,12 @@ * The module exports two specific components: * * * A `Console` class with methods such as `console.log()`, `console.error()`, and `console.warn()` that can be used to write to any Node.js stream. - * * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstdout) and - * [`process.stderr`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. + * * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and + * [`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. * * _**Warning**_: The global console object's methods are neither consistently * synchronous like the browser APIs they resemble, nor are they consistently - * asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v24.x/api/process.html#a-note-on-process-io) for + * asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io) for * more information. * * Example using the global `console`: @@ -54,7 +54,7 @@ * myConsole.warn(`Danger ${name}! Danger!`); * // Prints: Danger Will Robinson! Danger!, to err * ``` - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/console.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/console.js) */ declare module "console" { import console = require("node:console"); @@ -70,7 +70,7 @@ declare module "node:console" { * `console.assert()` writes a message if `value` is [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) or omitted. It only * writes a message and does not otherwise affect execution. The output always * starts with `"Assertion failed"`. If provided, `message` is formatted using - * [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args). + * [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args). * * If `value` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy), nothing happens. * @@ -152,7 +152,7 @@ declare module "node:console" { */ debug(message?: any, ...optionalParams: any[]): void; /** - * Uses [`util.inspect()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilinspectobject-options) on `obj` and prints the resulting string to `stdout`. + * Uses [`util.inspect()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilinspectobject-options) on `obj` and prints the resulting string to `stdout`. * This function bypasses any custom `inspect()` function defined on `obj`. * @since v0.1.101 */ @@ -167,7 +167,7 @@ declare module "node:console" { * Prints to `stderr` with newline. Multiple arguments can be passed, with the * first used as the primary message and all additional used as substitution * values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) - * (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args)). + * (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)). * * ```js * const code = 5; @@ -178,8 +178,8 @@ declare module "node:console" { * ``` * * If formatting elements (e.g. `%d`) are not found in the first string then - * [`util.inspect()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilinspectobject-options) is called on each argument and the - * resulting string values are concatenated. See [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args) + * [`util.inspect()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilinspectobject-options) is called on each argument and the + * resulting string values are concatenated. See [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args) * for more information. * @since v0.1.100 */ @@ -211,7 +211,7 @@ declare module "node:console" { * Prints to `stdout` with newline. Multiple arguments can be passed, with the * first used as the primary message and all additional used as substitution * values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) - * (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args)). + * (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)). * * ```js * const count = 5; @@ -221,7 +221,7 @@ declare module "node:console" { * // Prints: count: 5, to stdout * ``` * - * See [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args) for more information. + * See [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args) for more information. * @since v0.1.100 */ log(message?: any, ...optionalParams: any[]): void; @@ -297,7 +297,7 @@ declare module "node:console" { */ timeLog(label?: string, ...data: any[]): void; /** - * Prints to `stderr` the string `'Trace: '`, followed by the [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args) + * Prints to `stderr` the string `'Trace: '`, followed by the [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args) * formatted message and stack trace to the current position in the code. * * ```js @@ -361,12 +361,12 @@ declare module "node:console" { * The module exports two specific components: * * * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream. - * * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstdout) and - * [`process.stderr`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. + * * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and + * [`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. * * _**Warning**_: The global console object's methods are neither consistently * synchronous like the browser APIs they resemble, nor are they consistently - * asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v24.x/api/process.html#a-note-on-process-io) for + * asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io) for * more information. * * Example using the global `console`: @@ -410,7 +410,7 @@ declare module "node:console" { * myConsole.warn(`Danger ${name}! Danger!`); * // Prints: Danger Will Robinson! Danger!, to err * ``` - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/console.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/console.js) */ namespace console { interface ConsoleConstructorOptions { @@ -431,10 +431,9 @@ declare module "node:console" { colorMode?: boolean | "auto" | undefined; /** * Specifies options that are passed along to - * `util.inspect()`. Can be an options object or, if different options - * for stdout and stderr are desired, a `Map` from stream objects to options. + * [`util.inspect()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilinspectobject-options). */ - inspectOptions?: InspectOptions | ReadonlyMap | undefined; + inspectOptions?: InspectOptions | undefined; /** * Set group indentation. * @default 2 diff --git a/node_modules/@types/node/crypto.d.ts b/node_modules/@types/node/crypto.d.ts index d975cafc..90238053 100644 --- a/node_modules/@types/node/crypto.d.ts +++ b/node_modules/@types/node/crypto.d.ts @@ -14,7 +14,7 @@ * // Prints: * // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e * ``` - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/crypto.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/crypto.js) */ declare module "crypto" { import { NonSharedBuffer } from "node:buffer"; @@ -97,7 +97,7 @@ declare module "crypto" { verifySpkac(spkac: NodeJS.ArrayBufferView): boolean; } namespace constants { - // https://nodejs.org/dist/latest-v24.x/docs/api/crypto.html#crypto-constants + // https://nodejs.org/dist/latest-v22.x/docs/api/crypto.html#crypto-constants const OPENSSL_VERSION_NUMBER: number; /** Applies multiple bug workarounds within OpenSSL. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html for detail. */ const SSL_OP_ALL: number; @@ -592,8 +592,18 @@ declare module "crypto" { */ static from(key: webcrypto.CryptoKey): KeyObject; /** - * For asymmetric keys, this property represents the type of the key. See the - * supported [asymmetric key types](https://nodejs.org/docs/latest-v24.x/api/crypto.html#asymmetric-key-types). + * For asymmetric keys, this property represents the type of the key. Supported key + * types are: + * + * * `'rsa'` (OID 1.2.840.113549.1.1.1) + * * `'rsa-pss'` (OID 1.2.840.113549.1.1.10) + * * `'dsa'` (OID 1.2.840.10040.4.1) + * * `'ec'` (OID 1.2.840.10045.2.1) + * * `'x25519'` (OID 1.3.101.110) + * * `'x448'` (OID 1.3.101.111) + * * `'ed25519'` (OID 1.3.101.112) + * * `'ed448'` (OID 1.3.101.113) + * * `'dh'` (OID 1.2.840.113549.1.3.1) * * This property is `undefined` for unrecognized `KeyObject` types and symmetric * keys. @@ -751,9 +761,9 @@ declare module "crypto" { key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions, - ): Cipheriv; + ): Cipher; /** - * Instances of the `Cipheriv` class are used to encrypt data. The class can be + * Instances of the `Cipher` class are used to encrypt data. The class can be * used in one of two ways: * * * As a `stream` that is both readable and writable, where plain unencrypted @@ -762,10 +772,10 @@ declare module "crypto" { * the encrypted data. * * The {@link createCipheriv} method is - * used to create `Cipheriv` instances. `Cipheriv` objects are not to be created + * used to create `Cipher` instances. `Cipher` objects are not to be created * directly using the `new` keyword. * - * Example: Using `Cipheriv` objects as streams: + * Example: Using `Cipher` objects as streams: * * ```js * const { @@ -800,7 +810,7 @@ declare module "crypto" { * }); * ``` * - * Example: Using `Cipheriv` and piped streams: + * Example: Using `Cipher` and piped streams: * * ```js * import { @@ -871,7 +881,7 @@ declare module "crypto" { * ``` * @since v0.1.94 */ - class Cipheriv extends stream.Transform { + class Cipher extends stream.Transform { private constructor(); /** * Updates the cipher with `data`. If the `inputEncoding` argument is given, @@ -892,7 +902,7 @@ declare module "crypto" { update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string; update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string; /** - * Once the `cipher.final()` method has been called, the `Cipheriv` object can no + * Once the `cipher.final()` method has been called, the `Cipher` object can no * longer be used to encrypt data. Attempts to call `cipher.final()` more than * once will result in an error being thrown. * @since v0.1.94 @@ -902,7 +912,7 @@ declare module "crypto" { final(): NonSharedBuffer; final(outputEncoding: BufferEncoding): string; /** - * When using block encryption algorithms, the `Cipheriv` class will automatically + * When using block encryption algorithms, the `Cipher` class will automatically * add padding to the input data to the appropriate block size. To disable the * default padding call `cipher.setAutoPadding(false)`. * @@ -918,7 +928,7 @@ declare module "crypto" { */ setAutoPadding(autoPadding?: boolean): this; } - interface CipherCCM extends Cipheriv { + interface CipherCCM extends Cipher { setAAD( buffer: NodeJS.ArrayBufferView, options: { @@ -927,7 +937,7 @@ declare module "crypto" { ): this; getAuthTag(): NonSharedBuffer; } - interface CipherGCM extends Cipheriv { + interface CipherGCM extends Cipher { setAAD( buffer: NodeJS.ArrayBufferView, options?: { @@ -936,7 +946,7 @@ declare module "crypto" { ): this; getAuthTag(): NonSharedBuffer; } - interface CipherOCB extends Cipheriv { + interface CipherOCB extends Cipher { setAAD( buffer: NodeJS.ArrayBufferView, options?: { @@ -945,7 +955,7 @@ declare module "crypto" { ): this; getAuthTag(): NonSharedBuffer; } - interface CipherChaCha20Poly1305 extends Cipheriv { + interface CipherChaCha20Poly1305 extends Cipher { setAAD( buffer: NodeJS.ArrayBufferView, options: { @@ -955,7 +965,7 @@ declare module "crypto" { getAuthTag(): NonSharedBuffer; } /** - * Creates and returns a `Decipheriv` object that uses the given `algorithm`, `key` and initialization vector (`iv`). + * Creates and returns a `Decipher` object that uses the given `algorithm`, `key` and initialization vector (`iv`). * * The `options` argument controls stream behavior and is optional except when a * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the `authTagLength` option is required and specifies the length of the @@ -1012,9 +1022,9 @@ declare module "crypto" { key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions, - ): Decipheriv; + ): Decipher; /** - * Instances of the `Decipheriv` class are used to decrypt data. The class can be + * Instances of the `Decipher` class are used to decrypt data. The class can be * used in one of two ways: * * * As a `stream` that is both readable and writable, where plain encrypted @@ -1023,10 +1033,10 @@ declare module "crypto" { * produce the unencrypted data. * * The {@link createDecipheriv} method is - * used to create `Decipheriv` instances. `Decipheriv` objects are not to be created + * used to create `Decipher` instances. `Decipher` objects are not to be created * directly using the `new` keyword. * - * Example: Using `Decipheriv` objects as streams: + * Example: Using `Decipher` objects as streams: * * ```js * import { Buffer } from 'node:buffer'; @@ -1065,7 +1075,7 @@ declare module "crypto" { * decipher.end(); * ``` * - * Example: Using `Decipheriv` and piped streams: + * Example: Using `Decipher` and piped streams: * * ```js * import { @@ -1121,7 +1131,7 @@ declare module "crypto" { * ``` * @since v0.1.94 */ - class Decipheriv extends stream.Transform { + class Decipher extends stream.Transform { private constructor(); /** * Updates the decipher with `data`. If the `inputEncoding` argument is given, @@ -1142,7 +1152,7 @@ declare module "crypto" { update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string; update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string; /** - * Once the `decipher.final()` method has been called, the `Decipheriv` object can + * Once the `decipher.final()` method has been called, the `Decipher` object can * no longer be used to decrypt data. Attempts to call `decipher.final()` more * than once will result in an error being thrown. * @since v0.1.94 @@ -1165,7 +1175,7 @@ declare module "crypto" { */ setAutoPadding(auto_padding?: boolean): this; } - interface DecipherCCM extends Decipheriv { + interface DecipherCCM extends Decipher { setAuthTag(buffer: NodeJS.ArrayBufferView): this; setAAD( buffer: NodeJS.ArrayBufferView, @@ -1174,7 +1184,7 @@ declare module "crypto" { }, ): this; } - interface DecipherGCM extends Decipheriv { + interface DecipherGCM extends Decipher { setAuthTag(buffer: NodeJS.ArrayBufferView): this; setAAD( buffer: NodeJS.ArrayBufferView, @@ -1183,7 +1193,7 @@ declare module "crypto" { }, ): this; } - interface DecipherOCB extends Decipheriv { + interface DecipherOCB extends Decipher { setAuthTag(buffer: NodeJS.ArrayBufferView): this; setAAD( buffer: NodeJS.ArrayBufferView, @@ -1192,7 +1202,7 @@ declare module "crypto" { }, ): this; } - interface DecipherChaCha20Poly1305 extends Decipheriv { + interface DecipherChaCha20Poly1305 extends Decipher { setAuthTag(buffer: NodeJS.ArrayBufferView): this; setAAD( buffer: NodeJS.ArrayBufferView, @@ -1311,7 +1321,6 @@ declare module "crypto" { * @since v0.1.92 * @param options `stream.Writable` options */ - // TODO: signing algorithm type function createSign(algorithm: string, options?: stream.WritableOptions): Sign; type DSAEncoding = "der" | "ieee-p1363"; interface SigningOptions { @@ -1321,7 +1330,6 @@ declare module "crypto" { padding?: number | undefined; saltLength?: number | undefined; dsaEncoding?: DSAEncoding | undefined; - context?: ArrayBuffer | NodeJS.ArrayBufferView | undefined; } interface SignPrivateKeyInput extends PrivateKeyInput, SigningOptions {} interface SignKeyObjectInput extends SigningOptions { @@ -2468,34 +2476,7 @@ declare module "crypto" { * @since v6.6.0 */ function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean; - type KeyType = - | "dh" - | "dsa" - | "ec" - | "ed25519" - | "ed448" - | "ml-dsa-44" - | "ml-dsa-65" - | "ml-dsa-87" - | "ml-kem-1024" - | "ml-kem-512" - | "ml-kem-768" - | "rsa-pss" - | "rsa" - | "slh-dsa-sha2-128f" - | "slh-dsa-sha2-128s" - | "slh-dsa-sha2-192f" - | "slh-dsa-sha2-192s" - | "slh-dsa-sha2-256f" - | "slh-dsa-sha2-256s" - | "slh-dsa-shake-128f" - | "slh-dsa-shake-128s" - | "slh-dsa-shake-192f" - | "slh-dsa-shake-192s" - | "slh-dsa-shake-256f" - | "slh-dsa-shake-256s" - | "x25519" - | "x448"; + type KeyType = "rsa" | "rsa-pss" | "dsa" | "ec" | "ed25519" | "ed448" | "x25519" | "x448"; type KeyFormat = "pem" | "der" | "jwk"; interface BasePrivateKeyEncodingOptions { format: T; @@ -2510,9 +2491,6 @@ declare module "crypto" { interface ED448KeyPairKeyObjectOptions {} interface X25519KeyPairKeyObjectOptions {} interface X448KeyPairKeyObjectOptions {} - interface MLDSAKeyPairKeyObjectOptions {} - interface MLKEMKeyPairKeyObjectOptions {} - interface SLHDSAKeyPairKeyObjectOptions {} interface ECKeyPairKeyObjectOptions { /** * Name of the curve to use @@ -2677,40 +2655,13 @@ declare module "crypto" { type: "pkcs8"; }; } - interface MLDSAKeyPairOptions { - publicKeyEncoding: { - type: "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "pkcs8"; - }; - } - interface MLKEMKeyPairOptions { - publicKeyEncoding: { - type: "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "pkcs8"; - }; - } - interface SLHDSAKeyPairOptions { - publicKeyEncoding: { - type: "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "pkcs8"; - }; - } interface KeyPairSyncResult { publicKey: T1; privateKey: T2; } /** * Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC, - * Ed25519, Ed448, X25519, X448, DH, and ML-DSA are currently supported. + * Ed25519, Ed448, X25519, X448, and DH are currently supported. * * If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function * behaves as if `keyObject.export()` had been called on its result. Otherwise, @@ -2747,8 +2698,7 @@ declare module "crypto" { * When PEM encoding was selected, the respective key will be a string, otherwise * it will be a buffer containing the data encoded as DER. * @since v10.12.0 - * @param type The asymmetric key type to generate. See the - * supported [asymmetric key types](https://nodejs.org/docs/latest-v24.x/api/crypto.html#asymmetric-key-types). + * @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`. */ function generateKeyPairSync( type: "rsa", @@ -2886,126 +2836,6 @@ declare module "crypto" { options: X448KeyPairOptions<"der", "der">, ): KeyPairSyncResult; function generateKeyPairSync(type: "x448", options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult; - function generateKeyPairSync( - type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", - options: MLDSAKeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", - options: MLDSAKeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", - options: MLDSAKeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", - options: MLDSAKeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", - options?: MLDSAKeyPairKeyObjectOptions, - ): KeyPairKeyObjectResult; - function generateKeyPairSync( - type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768", - options: MLKEMKeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768", - options: MLKEMKeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768", - options: MLKEMKeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768", - options: MLKEMKeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768", - options?: MLKEMKeyPairKeyObjectOptions, - ): KeyPairKeyObjectResult; - function generateKeyPairSync( - type: - | "slh-dsa-sha2-128f" - | "slh-dsa-sha2-128s" - | "slh-dsa-sha2-192f" - | "slh-dsa-sha2-192s" - | "slh-dsa-sha2-256f" - | "slh-dsa-sha2-256s" - | "slh-dsa-shake-128f" - | "slh-dsa-shake-128s" - | "slh-dsa-shake-192f" - | "slh-dsa-shake-192s" - | "slh-dsa-shake-256f" - | "slh-dsa-shake-256s", - options: SLHDSAKeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: - | "slh-dsa-sha2-128f" - | "slh-dsa-sha2-128s" - | "slh-dsa-sha2-192f" - | "slh-dsa-sha2-192s" - | "slh-dsa-sha2-256f" - | "slh-dsa-sha2-256s" - | "slh-dsa-shake-128f" - | "slh-dsa-shake-128s" - | "slh-dsa-shake-192f" - | "slh-dsa-shake-192s" - | "slh-dsa-shake-256f" - | "slh-dsa-shake-256s", - options: SLHDSAKeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: - | "slh-dsa-sha2-128f" - | "slh-dsa-sha2-128s" - | "slh-dsa-sha2-192f" - | "slh-dsa-sha2-192s" - | "slh-dsa-sha2-256f" - | "slh-dsa-sha2-256s" - | "slh-dsa-shake-128f" - | "slh-dsa-shake-128s" - | "slh-dsa-shake-192f" - | "slh-dsa-shake-192s" - | "slh-dsa-shake-256f" - | "slh-dsa-shake-256s", - options: SLHDSAKeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: - | "slh-dsa-sha2-128f" - | "slh-dsa-sha2-128s" - | "slh-dsa-sha2-192f" - | "slh-dsa-sha2-192s" - | "slh-dsa-sha2-256f" - | "slh-dsa-sha2-256s" - | "slh-dsa-shake-128f" - | "slh-dsa-shake-128s" - | "slh-dsa-shake-192f" - | "slh-dsa-shake-192s" - | "slh-dsa-shake-256f" - | "slh-dsa-shake-256s", - options: SLHDSAKeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: - | "slh-dsa-sha2-128f" - | "slh-dsa-sha2-128s" - | "slh-dsa-sha2-192f" - | "slh-dsa-sha2-192s" - | "slh-dsa-sha2-256f" - | "slh-dsa-sha2-256s" - | "slh-dsa-shake-128f" - | "slh-dsa-shake-128s" - | "slh-dsa-shake-192f" - | "slh-dsa-shake-192s" - | "slh-dsa-shake-256f" - | "slh-dsa-shake-256s", - options?: SLHDSAKeyPairKeyObjectOptions, - ): KeyPairKeyObjectResult; /** * Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC, * Ed25519, Ed448, X25519, X448, and DH are currently supported. @@ -3043,8 +2873,7 @@ declare module "crypto" { * If this method is invoked as its `util.promisify()` ed version, it returns * a `Promise` for an `Object` with `publicKey` and `privateKey` properties. * @since v10.12.0 - * @param type The asymmetric key type to generate. See the - * supported [asymmetric key types](https://nodejs.org/docs/latest-v24.x/api/crypto.html#asymmetric-key-types). + * @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`. */ function generateKeyPair( type: "rsa", @@ -3246,141 +3075,6 @@ declare module "crypto" { options: X448KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, ): void; - function generateKeyPair( - type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", - options: MLDSAKeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", - options: MLDSAKeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void, - ): void; - function generateKeyPair( - type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", - options: MLDSAKeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", - options: MLDSAKeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void, - ): void; - function generateKeyPair( - type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", - options: MLDSAKeyPairKeyObjectOptions | undefined, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; - function generateKeyPair( - type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768", - options: MLKEMKeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768", - options: MLKEMKeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void, - ): void; - function generateKeyPair( - type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768", - options: MLKEMKeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768", - options: MLKEMKeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void, - ): void; - function generateKeyPair( - type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768", - options: MLKEMKeyPairKeyObjectOptions | undefined, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; - function generateKeyPair( - type: - | "slh-dsa-sha2-128f" - | "slh-dsa-sha2-128s" - | "slh-dsa-sha2-192f" - | "slh-dsa-sha2-192s" - | "slh-dsa-sha2-256f" - | "slh-dsa-sha2-256s" - | "slh-dsa-shake-128f" - | "slh-dsa-shake-128s" - | "slh-dsa-shake-192f" - | "slh-dsa-shake-192s" - | "slh-dsa-shake-256f" - | "slh-dsa-shake-256s", - options: SLHDSAKeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: - | "slh-dsa-sha2-128f" - | "slh-dsa-sha2-128s" - | "slh-dsa-sha2-192f" - | "slh-dsa-sha2-192s" - | "slh-dsa-sha2-256f" - | "slh-dsa-sha2-256s" - | "slh-dsa-shake-128f" - | "slh-dsa-shake-128s" - | "slh-dsa-shake-192f" - | "slh-dsa-shake-192s" - | "slh-dsa-shake-256f" - | "slh-dsa-shake-256s", - options: SLHDSAKeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: - | "slh-dsa-sha2-128f" - | "slh-dsa-sha2-128s" - | "slh-dsa-sha2-192f" - | "slh-dsa-sha2-192s" - | "slh-dsa-sha2-256f" - | "slh-dsa-sha2-256s" - | "slh-dsa-shake-128f" - | "slh-dsa-shake-128s" - | "slh-dsa-shake-192f" - | "slh-dsa-shake-192s" - | "slh-dsa-shake-256f" - | "slh-dsa-shake-256s", - options: SLHDSAKeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: - | "slh-dsa-sha2-128f" - | "slh-dsa-sha2-128s" - | "slh-dsa-sha2-192f" - | "slh-dsa-sha2-192s" - | "slh-dsa-sha2-256f" - | "slh-dsa-sha2-256s" - | "slh-dsa-shake-128f" - | "slh-dsa-shake-128s" - | "slh-dsa-shake-192f" - | "slh-dsa-shake-192s" - | "slh-dsa-shake-256f" - | "slh-dsa-shake-256s", - options: SLHDSAKeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: - | "slh-dsa-sha2-128f" - | "slh-dsa-sha2-128s" - | "slh-dsa-sha2-192f" - | "slh-dsa-sha2-192s" - | "slh-dsa-sha2-256f" - | "slh-dsa-sha2-256s" - | "slh-dsa-shake-128f" - | "slh-dsa-shake-128s" - | "slh-dsa-shake-192f" - | "slh-dsa-shake-192s" - | "slh-dsa-shake-256f" - | "slh-dsa-shake-256s", - options: SLHDSAKeyPairKeyObjectOptions | undefined, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; namespace generateKeyPair { function __promisify__( type: "rsa", @@ -3623,170 +3317,11 @@ declare module "crypto" { privateKey: NonSharedBuffer; }>; function __promisify__(type: "x448", options?: X448KeyPairKeyObjectOptions): Promise; - function __promisify__( - type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", - options: MLDSAKeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", - options: MLDSAKeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: NonSharedBuffer; - }>; - function __promisify__( - type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", - options: MLDSAKeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: NonSharedBuffer; - privateKey: string; - }>; - function __promisify__( - type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", - options: MLDSAKeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: NonSharedBuffer; - privateKey: NonSharedBuffer; - }>; - function __promisify__( - type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", - options?: MLDSAKeyPairKeyObjectOptions, - ): Promise; - function __promisify__( - type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768", - options: MLKEMKeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768", - options: MLKEMKeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: NonSharedBuffer; - }>; - function __promisify__( - type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768", - options: MLKEMKeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: NonSharedBuffer; - privateKey: string; - }>; - function __promisify__( - type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768", - options: MLKEMKeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: NonSharedBuffer; - privateKey: NonSharedBuffer; - }>; - function __promisify__( - type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768", - options?: MLKEMKeyPairKeyObjectOptions, - ): Promise; - function __promisify__( - type: - | "slh-dsa-sha2-128f" - | "slh-dsa-sha2-128s" - | "slh-dsa-sha2-192f" - | "slh-dsa-sha2-192s" - | "slh-dsa-sha2-256f" - | "slh-dsa-sha2-256s" - | "slh-dsa-shake-128f" - | "slh-dsa-shake-128s" - | "slh-dsa-shake-192f" - | "slh-dsa-shake-192s" - | "slh-dsa-shake-256f" - | "slh-dsa-shake-256s", - options: SLHDSAKeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: - | "slh-dsa-sha2-128f" - | "slh-dsa-sha2-128s" - | "slh-dsa-sha2-192f" - | "slh-dsa-sha2-192s" - | "slh-dsa-sha2-256f" - | "slh-dsa-sha2-256s" - | "slh-dsa-shake-128f" - | "slh-dsa-shake-128s" - | "slh-dsa-shake-192f" - | "slh-dsa-shake-192s" - | "slh-dsa-shake-256f" - | "slh-dsa-shake-256s", - options: SLHDSAKeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: Buffer; - }>; - function __promisify__( - type: - | "slh-dsa-sha2-128f" - | "slh-dsa-sha2-128s" - | "slh-dsa-sha2-192f" - | "slh-dsa-sha2-192s" - | "slh-dsa-sha2-256f" - | "slh-dsa-sha2-256s" - | "slh-dsa-shake-128f" - | "slh-dsa-shake-128s" - | "slh-dsa-shake-192f" - | "slh-dsa-shake-192s" - | "slh-dsa-shake-256f" - | "slh-dsa-shake-256s", - options: SLHDSAKeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: Buffer; - privateKey: string; - }>; - function __promisify__( - type: - | "slh-dsa-sha2-128f" - | "slh-dsa-sha2-128s" - | "slh-dsa-sha2-192f" - | "slh-dsa-sha2-192s" - | "slh-dsa-sha2-256f" - | "slh-dsa-sha2-256s" - | "slh-dsa-shake-128f" - | "slh-dsa-shake-128s" - | "slh-dsa-shake-192f" - | "slh-dsa-shake-192s" - | "slh-dsa-shake-256f" - | "slh-dsa-shake-256s", - options: SLHDSAKeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; - }>; - function __promisify__( - type: - | "slh-dsa-sha2-128f" - | "slh-dsa-sha2-128s" - | "slh-dsa-sha2-192f" - | "slh-dsa-sha2-192s" - | "slh-dsa-sha2-256f" - | "slh-dsa-sha2-256s" - | "slh-dsa-shake-128f" - | "slh-dsa-shake-128s" - | "slh-dsa-shake-192f" - | "slh-dsa-shake-192s" - | "slh-dsa-shake-256f" - | "slh-dsa-shake-256s", - options?: SLHDSAKeyPairKeyObjectOptions, - ): Promise; } /** * Calculates and returns the signature for `data` using the given private key and * algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is - * dependent upon the key type. - * - * `algorithm` is required to be `null` or `undefined` for Ed25519, Ed448, and - * ML-DSA. + * dependent upon the key type (especially Ed25519 and Ed448). * * If `key` is not a `KeyObject`, this function behaves as if `key` had been * passed to {@link createPrivateKey}. If it is an object, the following @@ -3807,12 +3342,8 @@ declare module "crypto" { callback: (error: Error | null, data: NonSharedBuffer) => void, ): void; /** - * Verifies the given signature for `data` using the given key and algorithm. If - * `algorithm` is `null` or `undefined`, then the algorithm is dependent upon the - * key type. - * - * `algorithm` is required to be `null` or `undefined` for Ed25519, Ed448, and - * ML-DSA. + * Verifies the given signature for `data` using the given key and algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is dependent upon the + * key type (especially Ed25519 and Ed448). * * If `key` is not a `KeyObject`, this function behaves as if `key` had been * passed to {@link createPublicKey}. If it is an object, the following @@ -3840,102 +3371,16 @@ declare module "crypto" { callback: (error: Error | null, result: boolean) => void, ): void; /** - * Key decapsulation using a KEM algorithm with a private key. - * - * Supported key types and their KEM algorithms are: - * - * * `'rsa'` RSA Secret Value Encapsulation - * * `'ec'` DHKEM(P-256, HKDF-SHA256), DHKEM(P-384, HKDF-SHA256), DHKEM(P-521, HKDF-SHA256) - * * `'x25519'` DHKEM(X25519, HKDF-SHA256) - * * `'x448'` DHKEM(X448, HKDF-SHA512) - * * `'ml-kem-512'` ML-KEM - * * `'ml-kem-768'` ML-KEM - * * `'ml-kem-1024'` ML-KEM - * - * If `key` is not a {@link KeyObject}, this function behaves as if `key` had been - * passed to `crypto.createPrivateKey()`. - * - * If the `callback` function is provided this function uses libuv's threadpool. - * @since v24.7.0 - */ - function decapsulate( - key: KeyLike | PrivateKeyInput | JsonWebKeyInput, - ciphertext: ArrayBuffer | NodeJS.ArrayBufferView, - ): NonSharedBuffer; - function decapsulate( - key: KeyLike | PrivateKeyInput | JsonWebKeyInput, - ciphertext: ArrayBuffer | NodeJS.ArrayBufferView, - callback: (err: Error, sharedKey: NonSharedBuffer) => void, - ): void; - /** - * Computes the Diffie-Hellman shared secret based on a `privateKey` and a `publicKey`. - * Both keys must have the same `asymmetricKeyType` and must support either the DH or - * ECDH operation. - * - * If the `callback` function is provided this function uses libuv's threadpool. + * Computes the Diffie-Hellman secret based on a `privateKey` and a `publicKey`. + * Both keys must have the same `asymmetricKeyType`, which must be one of `'dh'` (for Diffie-Hellman), `'ec'` (for ECDH), `'x448'`, or `'x25519'` (for ECDH-ES). * @since v13.9.0, v12.17.0 */ function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): NonSharedBuffer; - function diffieHellman( - options: { privateKey: KeyObject; publicKey: KeyObject }, - callback: (err: Error | null, secret: NonSharedBuffer) => void, - ): void; /** - * Key encapsulation using a KEM algorithm with a public key. - * - * Supported key types and their KEM algorithms are: - * - * * `'rsa'` RSA Secret Value Encapsulation - * * `'ec'` DHKEM(P-256, HKDF-SHA256), DHKEM(P-384, HKDF-SHA256), DHKEM(P-521, HKDF-SHA256) - * * `'x25519'` DHKEM(X25519, HKDF-SHA256) - * * `'x448'` DHKEM(X448, HKDF-SHA512) - * * `'ml-kem-512'` ML-KEM - * * `'ml-kem-768'` ML-KEM - * * `'ml-kem-1024'` ML-KEM - * - * If `key` is not a {@link KeyObject}, this function behaves as if `key` had been - * passed to `crypto.createPublicKey()`. - * - * If the `callback` function is provided this function uses libuv's threadpool. - * @since v24.7.0 - */ - function encapsulate( - key: KeyLike | PublicKeyInput | JsonWebKeyInput, - ): { sharedKey: NonSharedBuffer; ciphertext: NonSharedBuffer }; - function encapsulate( - key: KeyLike | PublicKeyInput | JsonWebKeyInput, - callback: (err: Error, result: { sharedKey: NonSharedBuffer; ciphertext: NonSharedBuffer }) => void, - ): void; - interface OneShotDigestOptions { - /** - * Encoding used to encode the returned digest. - * @default 'hex' - */ - outputEncoding?: BinaryToTextEncoding | "buffer" | undefined; - /** - * For XOF hash functions such as 'shake256', the outputLength option - * can be used to specify the desired output length in bytes. - */ - outputLength?: number | undefined; - } - interface OneShotDigestOptionsWithStringEncoding extends OneShotDigestOptions { - outputEncoding?: BinaryToTextEncoding | undefined; - } - interface OneShotDigestOptionsWithBufferEncoding extends OneShotDigestOptions { - outputEncoding: "buffer"; - } - /** - * A utility for creating one-shot hash digests of data. It can be faster than - * the object-based `crypto.createHash()` when hashing a smaller amount of data - * (<= 5MB) that's readily available. If the data can be big or if it is streamed, - * it's still recommended to use `crypto.createHash()` instead. - * - * The `algorithm` is dependent on the available algorithms supported by the - * version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. - * On recent releases of OpenSSL, `openssl list -digest-algorithms` will - * display the available digest algorithms. - * - * If `options` is a string, then it specifies the `outputEncoding`. + * A utility for creating one-shot hash digests of data. It can be faster than the object-based `crypto.createHash()` when hashing a smaller amount of data + * (<= 5MB) that's readily available. If the data can be big or if it is streamed, it's still recommended to use `crypto.createHash()` instead. The `algorithm` + * is dependent on the available algorithms supported by the version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. On recent releases + * of OpenSSL, `openssl list -digest-algorithms` will display the available digest algorithms. * * Example: * @@ -3955,25 +3400,16 @@ declare module "crypto" { * console.log(crypto.hash('sha1', Buffer.from(base64, 'base64'), 'buffer')); * ``` * @since v21.7.0, v20.12.0 - * @param data When `data` is a string, it will be encoded as UTF-8 before being hashed. If a different - * input encoding is desired for a string input, user could encode the string - * into a `TypedArray` using either `TextEncoder` or `Buffer.from()` and passing - * the encoded `TypedArray` into this API instead. + * @param data When `data` is a string, it will be encoded as UTF-8 before being hashed. If a different input encoding is desired for a string input, user + * could encode the string into a `TypedArray` using either `TextEncoder` or `Buffer.from()` and passing the encoded `TypedArray` into this API instead. + * @param [outputEncoding='hex'] [Encoding](https://nodejs.org/docs/latest-v22.x/api/buffer.html#buffers-and-character-encodings) used to encode the returned digest. */ + function hash(algorithm: string, data: BinaryLike, outputEncoding?: BinaryToTextEncoding): string; + function hash(algorithm: string, data: BinaryLike, outputEncoding: "buffer"): NonSharedBuffer; function hash( algorithm: string, data: BinaryLike, - options?: OneShotDigestOptionsWithStringEncoding | BinaryToTextEncoding, - ): string; - function hash( - algorithm: string, - data: BinaryLike, - options: OneShotDigestOptionsWithBufferEncoding | "buffer", - ): NonSharedBuffer; - function hash( - algorithm: string, - data: BinaryLike, - options: OneShotDigestOptions | BinaryToTextEncoding | "buffer", + outputEncoding?: BinaryToTextEncoding | "buffer", ): string | NonSharedBuffer; type CipherMode = "cbc" | "ccm" | "cfb" | "ctr" | "ecb" | "gcm" | "ocb" | "ofb" | "stream" | "wrap" | "xts"; interface CipherInfoOptions { @@ -4276,16 +3712,6 @@ declare module "crypto" { * @since v15.6.0 */ readonly serialNumber: string; - /** - * The algorithm used to sign the certificate or `undefined` if the signature algorithm is unknown by OpenSSL. - * @since v24.9.0 - */ - readonly signatureAlgorithm: string | undefined; - /** - * The OID of the algorithm used to sign the certificate. - * @since v24.9.0 - */ - readonly signatureAlgorithmOid: string; /** * The date/time from which this certificate is considered valid. * @since v15.6.0 @@ -4558,130 +3984,6 @@ declare module "crypto" { * @return Returns `typedArray`. */ function getRandomValues(typedArray: T): T; - type Argon2Algorithm = "argon2d" | "argon2i" | "argon2id"; - interface Argon2Parameters { - /** - * REQUIRED, this is the password for password hashing applications of Argon2. - */ - message: string | ArrayBuffer | NodeJS.ArrayBufferView; - /** - * REQUIRED, must be at least 8 bytes long. This is the salt for password hashing applications of Argon2. - */ - nonce: string | ArrayBuffer | NodeJS.ArrayBufferView; - /** - * REQUIRED, degree of parallelism determines how many computational chains (lanes) - * can be run. Must be greater than 1 and less than `2**24-1`. - */ - parallelism: number; - /** - * REQUIRED, the length of the key to generate. Must be greater than 4 and - * less than `2**32-1`. - */ - tagLength: number; - /** - * REQUIRED, memory cost in 1KiB blocks. Must be greater than - * `8 * parallelism` and less than `2**32-1`. The actual number of blocks is rounded - * down to the nearest multiple of `4 * parallelism`. - */ - memory: number; - /** - * REQUIRED, number of passes (iterations). Must be greater than 1 and less - * than `2**32-1`. - */ - passes: number; - /** - * OPTIONAL, Random additional input, - * similar to the salt, that should **NOT** be stored with the derived key. This is known as pepper in - * password hashing applications. If used, must have a length not greater than `2**32-1` bytes. - */ - secret?: string | ArrayBuffer | NodeJS.ArrayBufferView | undefined; - /** - * OPTIONAL, Additional data to - * be added to the hash, functionally equivalent to salt or secret, but meant for - * non-random data. If used, must have a length not greater than `2**32-1` bytes. - */ - associatedData?: string | ArrayBuffer | NodeJS.ArrayBufferView | undefined; - } - /** - * Provides an asynchronous [Argon2](https://www.rfc-editor.org/rfc/rfc9106.html) implementation. Argon2 is a password-based - * key derivation function that is designed to be expensive computationally and - * memory-wise in order to make brute-force attacks unrewarding. - * - * The `nonce` should be as unique as possible. It is recommended that a nonce is - * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. - * - * When passing strings for `message`, `nonce`, `secret` or `associatedData`, please - * consider [caveats when using strings as inputs to cryptographic APIs](https://nodejs.org/docs/latest-v24.x/api/crypto.html#using-strings-as-inputs-to-cryptographic-apis). - * - * The `callback` function is called with two arguments: `err` and `derivedKey`. - * `err` is an exception object when key derivation fails, otherwise `err` is - * `null`. `derivedKey` is passed to the callback as a `Buffer`. - * - * An exception is thrown when any of the input arguments specify invalid values - * or types. - * - * ```js - * const { argon2, randomBytes } = await import('node:crypto'); - * - * const parameters = { - * message: 'password', - * nonce: randomBytes(16), - * parallelism: 4, - * tagLength: 64, - * memory: 65536, - * passes: 3, - * }; - * - * argon2('argon2id', parameters, (err, derivedKey) => { - * if (err) throw err; - * console.log(derivedKey.toString('hex')); // 'af91dad...9520f15' - * }); - * ``` - * @since v24.7.0 - * @param algorithm Variant of Argon2, one of `"argon2d"`, `"argon2i"` or `"argon2id"`. - * @experimental - */ - function argon2( - algorithm: Argon2Algorithm, - parameters: Argon2Parameters, - callback: (err: Error | null, derivedKey: NonSharedBuffer) => void, - ): void; - /** - * Provides a synchronous [Argon2][] implementation. Argon2 is a password-based - * key derivation function that is designed to be expensive computationally and - * memory-wise in order to make brute-force attacks unrewarding. - * - * The `nonce` should be as unique as possible. It is recommended that a nonce is - * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. - * - * When passing strings for `message`, `nonce`, `secret` or `associatedData`, please - * consider [caveats when using strings as inputs to cryptographic APIs](https://nodejs.org/docs/latest-v24.x/api/crypto.html#using-strings-as-inputs-to-cryptographic-apis). - * - * An exception is thrown when key derivation fails, otherwise the derived key is - * returned as a `Buffer`. - * - * An exception is thrown when any of the input arguments specify invalid values - * or types. - * - * ```js - * const { argon2Sync, randomBytes } = await import('node:crypto'); - * - * const parameters = { - * message: 'password', - * nonce: randomBytes(16), - * parallelism: 4, - * tagLength: 64, - * memory: 65536, - * passes: 3, - * }; - * - * const derivedKey = argon2Sync('argon2id', parameters); - * console.log(derivedKey.toString('hex')); // 'af91dad...9520f15' - * ``` - * @since v24.7.0 - * @experimental - */ - function argon2Sync(algorithm: Argon2Algorithm, parameters: Argon2Parameters): NonSharedBuffer; /** * A convenient alias for `crypto.webcrypto.subtle`. * @since v17.4.0 @@ -4696,30 +3998,21 @@ declare module "crypto" { const webcrypto: webcrypto.Crypto; namespace webcrypto { type BufferSource = ArrayBufferView | ArrayBuffer; - type KeyFormat = "jwk" | "pkcs8" | "raw" | "raw-public" | "raw-secret" | "raw-seed" | "spki"; + type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki"; type KeyType = "private" | "public" | "secret"; type KeyUsage = - | "encrypt" | "decrypt" + | "deriveBits" + | "deriveKey" + | "encrypt" | "sign" + | "unwrapKey" | "verify" - | "deriveKey" - | "deriveBits" - | "encapsulateBits" - | "decapsulateBits" - | "encapsulateKey" - | "decapsulateKey" - | "wrapKey" - | "unwrapKey"; + | "wrapKey"; type AlgorithmIdentifier = Algorithm | string; type HashAlgorithmIdentifier = AlgorithmIdentifier; type NamedCurve = string; type BigInteger = Uint8Array; - interface AeadParams extends Algorithm { - additionalData?: BufferSource; - iv: BufferSource; - tagLength: number; - } interface AesCbcParams extends Algorithm { iv: BufferSource; } @@ -4730,8 +4023,6 @@ declare module "crypto" { interface AesDerivedKeyParams extends Algorithm { length: number; } - // TODO: remove in next major - /** @deprecated Replaced by `AeadParams`. */ interface AesGcmParams extends Algorithm { additionalData?: BufferSource; iv: BufferSource; @@ -4746,23 +4037,6 @@ declare module "crypto" { interface Algorithm { name: string; } - interface Argon2Params extends Algorithm { - associatedData?: BufferSource; - memory: number; - nonce: BufferSource; - parallelism: number; - passes: number; - secretValue?: BufferSource; - version?: number; - } - interface CShakeParams extends Algorithm { - customization?: BufferSource; - functionName?: BufferSource; - length: number; - } - interface ContextParams extends Algorithm { - context?: BufferSource; - } interface EcKeyAlgorithm extends KeyAlgorithm { namedCurve: NamedCurve; } @@ -4778,6 +4052,9 @@ declare module "crypto" { interface EcdsaParams extends Algorithm { hash: HashAlgorithmIdentifier; } + interface Ed448Params extends Algorithm { + context?: BufferSource; + } interface HkdfParams extends Algorithm { hash: HashAlgorithmIdentifier; info: BufferSource; @@ -4818,19 +4095,6 @@ declare module "crypto" { interface KeyAlgorithm { name: string; } - interface KmacImportParams extends Algorithm { - length?: number; - } - interface KmacKeyAlgorithm extends KeyAlgorithm { - length: number; - } - interface KmacKeyGenParams extends Algorithm { - length?: number; - } - interface KmacParams extends Algorithm { - customization?: BufferSource; - length: number; - } interface Pbkdf2Params extends Algorithm { hash: HashAlgorithmIdentifier; iterations: number; @@ -4884,15 +4148,22 @@ declare module "crypto" { * An error will be thrown if the given `typedArray` is larger than 65,536 bytes. * @since v15.0.0 */ - getRandomValues>( - typedArray: T, - ): T; + getRandomValues>(typedArray: T): T; /** * Generates a random {@link https://www.rfc-editor.org/rfc/rfc4122.txt RFC 4122} version 4 UUID. * The UUID is generated using a cryptographic pseudorandom number generator. * @since v16.7.0 */ randomUUID(): UUID; + CryptoKey: CryptoKeyConstructor; + } + // This constructor throws ILLEGAL_CONSTRUCTOR so it should not be newable. + interface CryptoKeyConstructor { + /** Illegal constructor */ + (_: { readonly _: unique symbol }): never; // Allows instanceof to work but not be callable by the user. + readonly length: 0; + readonly name: "CryptoKey"; + readonly prototype: CryptoKey; } /** * @since v15.0.0 @@ -4947,81 +4218,31 @@ declare module "crypto" { */ publicKey: CryptoKey; } - interface EncapsulatedBits { - sharedKey: ArrayBuffer; - ciphertext: ArrayBuffer; - } - interface EncapsulatedKey { - sharedKey: CryptoKey; - ciphertext: ArrayBuffer; - } /** * @since v15.0.0 */ interface SubtleCrypto { - /** - * A message recipient uses their asymmetric private key to decrypt an - * "encapsulated key" (ciphertext), thereby recovering a temporary symmetric - * key (represented as `ArrayBuffer`) which is then used to decrypt a message. - * - * The algorithms currently supported include: - * - * * `'ML-KEM-512'` - * * `'ML-KEM-768'` - * * `'ML-KEM-1024'` - * @since v24.7.0 - * @returns Fulfills with `ArrayBuffer` upon success. - */ - decapsulateBits( - decapsulationAlgorithm: AlgorithmIdentifier, - decapsulationKey: CryptoKey, - ciphertext: BufferSource, - ): Promise; - /** - * A message recipient uses their asymmetric private key to decrypt an - * "encapsulated key" (ciphertext), thereby recovering a temporary symmetric - * key (represented as `CryptoKey`) which is then used to decrypt a message. - * - * The algorithms currently supported include: - * - * * `'ML-KEM-512'` - * * `'ML-KEM-768'` - * * `'ML-KEM-1024'` - * @since v24.7.0 - * @param usages See [Key usages](https://nodejs.org/docs/latest-v24.x/api/webcrypto.html#cryptokeyusages). - * @returns Fulfills with `CryptoKey` upon success. - */ - decapsulateKey( - decapsulationAlgorithm: AlgorithmIdentifier, - decapsulationKey: CryptoKey, - ciphertext: BufferSource, - sharedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams | KmacImportParams, - extractable: boolean, - usages: KeyUsage[], - ): Promise; /** * Using the method and parameters specified in `algorithm` and the keying material provided by `key`, - * this method attempts to decipher the provided `data`. If successful, + * `subtle.decrypt()` attempts to decipher the provided `data`. If successful, * the returned promise will be resolved with an `` containing the plaintext result. * * The algorithms currently supported include: * - * * `'AES-CBC'` - * * `'AES-CTR'` - * * `'AES-GCM'` - * * `'AES-OCB'` - * * `'ChaCha20-Poly1305'` - * * `'RSA-OAEP'` + * - `'RSA-OAEP'` + * - `'AES-CTR'` + * - `'AES-CBC'` + * - `'AES-GCM'` * @since v15.0.0 */ decrypt( - algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AeadParams, + algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource, ): Promise; /** * Using the method and parameters specified in `algorithm` and the keying material provided by `baseKey`, - * this method attempts to generate `length` bits. + * `subtle.deriveBits()` attempts to generate `length` bits. * The Node.js implementation requires that when `length` is a number it must be multiple of `8`. * When `length` is `null` the maximum number of bits for a given algorithm is generated. This is allowed * for the `'ECDH'`, `'X25519'`, and `'X448'` algorithms. @@ -5029,14 +4250,11 @@ declare module "crypto" { * * The algorithms currently supported include: * - * * `'Argon2d'` - * * `'Argon2i'` - * * `'Argon2id'` - * * `'ECDH'` - * * `'HKDF'` - * * `'PBKDF2'` - * * `'X25519'` - * * `'X448'` + * - `'ECDH'` + * - `'X25519'` + * - `'X448'` + * - `'HKDF'` + * - `'PBKDF2'` * @since v15.0.0 */ deriveBits( @@ -5045,34 +4263,31 @@ declare module "crypto" { length?: number | null, ): Promise; deriveBits( - algorithm: EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params | Argon2Params, + algorithm: EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, length: number, ): Promise; /** * Using the method and parameters specified in `algorithm`, and the keying material provided by `baseKey`, - * this method attempts to generate a new ` based on the method and parameters in `derivedKeyAlgorithm`. + * `subtle.deriveKey()` attempts to generate a new ` based on the method and parameters in `derivedKeyAlgorithm`. * * Calling `subtle.deriveKey()` is equivalent to calling `subtle.deriveBits()` to generate raw keying material, * then passing the result into the `subtle.importKey()` method using the `deriveKeyAlgorithm`, `extractable`, and `keyUsages` parameters as input. * * The algorithms currently supported include: * - * * `'Argon2d'` - * * `'Argon2i'` - * * `'Argon2id'` - * * `'ECDH'` - * * `'HKDF'` - * * `'PBKDF2'` - * * `'X25519'` - * * `'X448'` + * - `'ECDH'` + * - `'X25519'` + * - `'X448'` + * - `'HKDF'` + * - `'PBKDF2'` * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. * @since v15.0.0 */ deriveKey( - algorithm: EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params | Argon2Params, + algorithm: EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, - derivedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams | KmacImportParams, + derivedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams, extractable: boolean, keyUsages: readonly KeyUsage[], ): Promise; @@ -5082,73 +4297,30 @@ declare module "crypto" { * * If `algorithm` is provided as a ``, it must be one of: * - * * `'cSHAKE128'` - * * `'cSHAKE256'` - * * `'SHA-1'` - * * `'SHA-256'` - * * `'SHA-384'` - * * `'SHA-512'` - * * `'SHA3-256'` - * * `'SHA3-384'` - * * `'SHA3-512'` + * - `'SHA-1'` + * - `'SHA-256'` + * - `'SHA-384'` + * - `'SHA-512'` * * If `algorithm` is provided as an ``, it must have a `name` property whose value is one of the above. * @since v15.0.0 */ - digest(algorithm: AlgorithmIdentifier | CShakeParams, data: BufferSource): Promise; - /** - * Uses a message recipient's asymmetric public key to encrypt a temporary symmetric key. - * This encrypted key is the "encapsulated key" represented as `EncapsulatedBits`. - * - * The algorithms currently supported include: - * - * * `'ML-KEM-512'` - * * `'ML-KEM-768'` - * * `'ML-KEM-1024'` - * @since v24.7.0 - * @returns Fulfills with `EncapsulatedBits` upon success. - */ - encapsulateBits( - encapsulationAlgorithm: AlgorithmIdentifier, - encapsulationKey: CryptoKey, - ): Promise; - /** - * Uses a message recipient's asymmetric public key to encrypt a temporary symmetric key. - * This encrypted key is the "encapsulated key" represented as `EncapsulatedKey`. - * - * The algorithms currently supported include: - * - * * `'ML-KEM-512'` - * * `'ML-KEM-768'` - * * `'ML-KEM-1024'` - * @since v24.7.0 - * @param usages See [Key usages](https://nodejs.org/docs/latest-v24.x/api/webcrypto.html#cryptokeyusages). - * @returns Fulfills with `EncapsulatedKey` upon success. - */ - encapsulateKey( - encapsulationAlgorithm: AlgorithmIdentifier, - encapsulationKey: CryptoKey, - sharedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams | KmacImportParams, - extractable: boolean, - usages: KeyUsage[], - ): Promise; + digest(algorithm: AlgorithmIdentifier, data: BufferSource): Promise; /** * Using the method and parameters specified by `algorithm` and the keying material provided by `key`, - * this method attempts to encipher `data`. If successful, + * `subtle.encrypt()` attempts to encipher `data`. If successful, * the returned promise is resolved with an `` containing the encrypted result. * * The algorithms currently supported include: * - * * `'AES-CBC'` - * * `'AES-CTR'` - * * `'AES-GCM'` - * * `'AES-OCB'` - * * `'ChaCha20-Poly1305'` - * * `'RSA-OAEP'` + * - `'RSA-OAEP'` + * - `'AES-CTR'` + * - `'AES-CBC'` + * - `'AES-GCM'` * @since v15.0.0 */ encrypt( - algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AeadParams, + algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource, ): Promise; @@ -5162,47 +4334,35 @@ declare module "crypto" { * * When `format` is `'jwk'` and the export is successful, the returned promise will be resolved with a * JavaScript object conforming to the {@link https://tools.ietf.org/html/rfc7517 JSON Web Key} specification. - * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, `'jwk'`, `'raw-secret'`, - * `'raw-public'`, or `'raw-seed'`. + * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. * @returns `` containing ``. * @since v15.0.0 */ exportKey(format: "jwk", key: CryptoKey): Promise; exportKey(format: Exclude, key: CryptoKey): Promise; /** - * Using the parameters provided in `algorithm`, this method - * attempts to generate new keying material. Depending on the algorithm used - * either a single `CryptoKey` or a `CryptoKeyPair` is generated. + * Using the method and parameters provided in `algorithm`, + * `subtle.generateKey()` attempts to generate new keying material. + * Depending the method used, the method may generate either a single `` or a ``. * - * The `CryptoKeyPair` (public and private key) generating algorithms supported - * include: + * The `` (public and private key) generating algorithms supported include: * - * * `'ECDH'` - * * `'ECDSA'` - * * `'Ed25519'` - * * `'Ed448'` - * * `'ML-DSA-44'` - * * `'ML-DSA-65'` - * * `'ML-DSA-87'` - * * `'ML-KEM-512'` - * * `'ML-KEM-768'` - * * `'ML-KEM-1024'` - * * `'RSA-OAEP'` - * * `'RSA-PSS'` - * * `'RSASSA-PKCS1-v1_5'` - * * `'X25519'` - * * `'X448'` + * - `'RSASSA-PKCS1-v1_5'` + * - `'RSA-PSS'` + * - `'RSA-OAEP'` + * - `'ECDSA'` + * - `'Ed25519'` + * - `'Ed448'` + * - `'ECDH'` + * - `'X25519'` + * - `'X448'` + * The `` (secret key) generating algorithms supported include: * - * The `CryptoKey` (secret key) generating algorithms supported include: - * * `'AES-CBC'` - * * `'AES-CTR'` - * * `'AES-GCM'` - * * `'AES-KW'` - * * `'AES-OCB'` - * * `'ChaCha20-Poly1305'` - * * `'HMAC'` - * * `'KMAC128'` - * * `'KMAC256'` + * - `'HMAC'` + * - `'AES-CTR'` + * - `'AES-CBC'` + * - `'AES-GCM'` + * - `'AES-KW'` * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. * @since v15.0.0 */ @@ -5212,7 +4372,7 @@ declare module "crypto" { keyUsages: readonly KeyUsage[], ): Promise; generateKey( - algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params | KmacKeyGenParams, + algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: readonly KeyUsage[], ): Promise; @@ -5222,23 +4382,12 @@ declare module "crypto" { keyUsages: KeyUsage[], ): Promise; /** - * Derives the public key from a given private key. - * @since v24.7.0 - * @param key A private key from which to derive the corresponding public key. - * @param keyUsages See [Key usages](https://nodejs.org/docs/latest-v24.x/api/webcrypto.html#cryptokeyusages). - * @returns Fulfills with a `CryptoKey` upon success. - */ - getPublicKey(key: CryptoKey, keyUsages: KeyUsage[]): Promise; - /** - * This method attempts to interpret the provided `keyData` - * as the given `format` to create a `CryptoKey` instance using the provided - * `algorithm`, `extractable`, and `keyUsages` arguments. If the import is - * successful, the returned promise will be resolved with a {CryptoKey} - * representation of the key material. + * The `subtle.importKey()` method attempts to interpret the provided `keyData` as the given `format` + * to create a `` instance using the provided `algorithm`, `extractable`, and `keyUsages` arguments. + * If the import is successful, the returned promise will be resolved with the created ``. * - * If importing KDF algorithm keys, `extractable` must be `false`. - * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, `'jwk'`, `'raw-secret'`, - * `'raw-public'`, or `'raw-seed'`. + * If importing a `'PBKDF2'` key, `extractable` must be `false`. + * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. * @since v15.0.0 */ @@ -5250,8 +4399,7 @@ declare module "crypto" { | RsaHashedImportParams | EcKeyImportParams | HmacImportParams - | AesKeyAlgorithm - | KmacImportParams, + | AesKeyAlgorithm, extractable: boolean, keyUsages: readonly KeyUsage[], ): Promise; @@ -5263,81 +4411,62 @@ declare module "crypto" { | RsaHashedImportParams | EcKeyImportParams | HmacImportParams - | AesKeyAlgorithm - | KmacImportParams, + | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[], ): Promise; /** * Using the method and parameters given by `algorithm` and the keying material provided by `key`, - * this method attempts to generate a cryptographic signature of `data`. If successful, + * `subtle.sign()` attempts to generate a cryptographic signature of `data`. If successful, * the returned promise is resolved with an `` containing the generated signature. * * The algorithms currently supported include: * - * * `'ECDSA'` - * * `'Ed25519'` - * * `'Ed448'` - * * `'HMAC'` - * * `'KMAC128'` - * * `'KMAC256'` - * * `'ML-DSA-44'` - * * `'ML-DSA-65'` - * * `'ML-DSA-87'` - * * `'RSA-PSS'` - * * `'RSASSA-PKCS1-v1_5'` + * - `'RSASSA-PKCS1-v1_5'` + * - `'RSA-PSS'` + * - `'ECDSA'` + * - `'Ed25519'` + * - `'Ed448'` + * - `'HMAC'` * @since v15.0.0 */ sign( - algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | ContextParams | KmacParams, + algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params, key: CryptoKey, data: BufferSource, ): Promise; /** * In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material. - * This method attempts to decrypt a wrapped key and create a `` instance. + * The `subtle.unwrapKey()` method attempts to decrypt a wrapped key and create a `` instance. * It is equivalent to calling `subtle.decrypt()` first on the encrypted key data (using the `wrappedKey`, `unwrapAlgo`, and `unwrappingKey` arguments as input) * then passing the results in to the `subtle.importKey()` method using the `unwrappedKeyAlgo`, `extractable`, and `keyUsages` arguments as inputs. * If successful, the returned promise is resolved with a `` object. * * The wrapping algorithms currently supported include: * - * * `'AES-CBC'` - * * `'AES-CTR'` - * * `'AES-GCM'` - * * `'AES-KW'` - * * `'AES-OCB'` - * * `'ChaCha20-Poly1305'` - * * `'RSA-OAEP'` + * - `'RSA-OAEP'` + * - `'AES-CTR'` + * - `'AES-CBC'` + * - `'AES-GCM'` + * - `'AES-KW'` * * The unwrapped key algorithms supported include: * - * * `'AES-CBC'` - * * `'AES-CTR'` - * * `'AES-GCM'` - * * `'AES-KW'` - * * `'AES-OCB'` - * * `'ChaCha20-Poly1305'` - * * `'ECDH'` - * * `'ECDSA'` - * * `'Ed25519'` - * * `'Ed448'` - * * `'HMAC'` - * * `'KMAC128'` - * * `'KMAC256'` - * * `'ML-DSA-44'` - * * `'ML-DSA-65'` - * * `'ML-DSA-87'` - * * `'ML-KEM-512'` - * * `'ML-KEM-768'` - * * `'ML-KEM-1024'` - * * `'RSA-OAEP'` - * * `'RSA-PSS'` - * * `'RSASSA-PKCS1-v1_5'` - * * `'X25519'` - * * `'X448'` - * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, `'jwk'`, `'raw-secret'`, - * `'raw-public'`, or `'raw-seed'`. + * - `'RSASSA-PKCS1-v1_5'` + * - `'RSA-PSS'` + * - `'RSA-OAEP'` + * - `'ECDSA'` + * - `'Ed25519'` + * - `'Ed448'` + * - `'ECDH'` + * - `'X25519'` + * - `'X448'` + * - `'HMAC'` + * - `'AES-CTR'` + * - `'AES-CBC'` + * - `'AES-GCM'` + * - `'AES-KW'` + * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. * @since v15.0.0 */ @@ -5345,46 +4474,40 @@ declare module "crypto" { format: KeyFormat, wrappedKey: BufferSource, unwrappingKey: CryptoKey, - unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AeadParams, + unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, unwrappedKeyAlgorithm: | AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams - | AesKeyAlgorithm - | KmacImportParams, + | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[], ): Promise; /** * Using the method and parameters given in `algorithm` and the keying material provided by `key`, - * This method attempts to verify that `signature` is a valid cryptographic signature of `data`. + * `subtle.verify()` attempts to verify that `signature` is a valid cryptographic signature of `data`. * The returned promise is resolved with either `true` or `false`. * * The algorithms currently supported include: * - * * `'ECDSA'` - * * `'Ed25519'` - * * `'Ed448'` - * * `'HMAC'` - * * `'KMAC128'` - * * `'KMAC256'` - * * `'ML-DSA-44'` - * * `'ML-DSA-65'` - * * `'ML-DSA-87'` - * * `'RSA-PSS'` - * * `'RSASSA-PKCS1-v1_5'` + * - `'RSASSA-PKCS1-v1_5'` + * - `'RSA-PSS'` + * - `'ECDSA'` + * - `'Ed25519'` + * - `'Ed448'` + * - `'HMAC'` * @since v15.0.0 */ verify( - algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | ContextParams | KmacParams, + algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params, key: CryptoKey, signature: BufferSource, data: BufferSource, ): Promise; /** * In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material. - * This method exports the keying material into the format identified by `format`, + * The `subtle.wrapKey()` method exports the keying material into the format identified by `format`, * then encrypts it using the method and parameters specified by `wrapAlgo` and the keying material provided by `wrappingKey`. * It is the equivalent to calling `subtle.exportKey()` using `format` and `key` as the arguments, * then passing the result to the `subtle.encrypt()` method using `wrappingKey` and `wrapAlgo` as inputs. @@ -5392,25 +4515,30 @@ declare module "crypto" { * * The wrapping algorithms currently supported include: * - * * `'AES-CBC'` - * * `'AES-CTR'` - * * `'AES-GCM'` - * * `'AES-KW'` - * * `'AES-OCB'` - * * `'ChaCha20-Poly1305'` - * * `'RSA-OAEP'` - * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, `'jwk'`, `'raw-secret'`, - * `'raw-public'`, or `'raw-seed'`. + * - `'RSA-OAEP'` + * - `'AES-CTR'` + * - `'AES-CBC'` + * - `'AES-GCM'` + * - `'AES-KW'` + * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. * @since v15.0.0 */ wrapKey( format: KeyFormat, key: CryptoKey, wrappingKey: CryptoKey, - wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AeadParams, + wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, ): Promise; } } + + global { + var crypto: typeof globalThis extends { + crypto: infer T; + onmessage: any; + } ? T + : webcrypto.Crypto; + } } declare module "node:crypto" { export * from "crypto"; diff --git a/node_modules/@types/node/dgram.d.ts b/node_modules/@types/node/dgram.d.ts index bc69f0b4..9776de0d 100644 --- a/node_modules/@types/node/dgram.d.ts +++ b/node_modules/@types/node/dgram.d.ts @@ -23,7 +23,7 @@ * server.bind(41234); * // Prints: server listening 0.0.0.0:41234 * ``` - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/dgram.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/dgram.js) */ declare module "dgram" { import { NonSharedBuffer } from "node:buffer"; diff --git a/node_modules/@types/node/diagnostics_channel.d.ts b/node_modules/@types/node/diagnostics_channel.d.ts index 025847de..f3bac527 100644 --- a/node_modules/@types/node/diagnostics_channel.d.ts +++ b/node_modules/@types/node/diagnostics_channel.d.ts @@ -20,7 +20,7 @@ * should generally include the module name to avoid collisions with data from * other modules. * @since v15.1.0, v14.17.0 - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/diagnostics_channel.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/diagnostics_channel.js) */ declare module "diagnostics_channel" { import { AsyncLocalStorage } from "node:async_hooks"; @@ -189,6 +189,7 @@ declare module "diagnostics_channel" { * }); * ``` * @since v15.1.0, v14.17.0 + * @deprecated Since v18.7.0,v16.17.0 - Use {@link subscribe(name, onMessage)} * @param onMessage The handler to receive channel messages */ subscribe(onMessage: ChannelListener): void; @@ -209,6 +210,7 @@ declare module "diagnostics_channel" { * channel.unsubscribe(onMessage); * ``` * @since v15.1.0, v14.17.0 + * @deprecated Since v18.7.0,v16.17.0 - Use {@link unsubscribe(name, onMessage)} * @param onMessage The previous subscribed handler to remove * @return `true` if the handler was found, `false` otherwise. */ diff --git a/node_modules/@types/node/dns.d.ts b/node_modules/@types/node/dns.d.ts index ba0d1221..9cb20559 100644 --- a/node_modules/@types/node/dns.d.ts +++ b/node_modules/@types/node/dns.d.ts @@ -41,8 +41,8 @@ * }); * ``` * - * See the [Implementation considerations section](https://nodejs.org/docs/latest-v24.x/api/dns.html#implementation-considerations) for more information. - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/dns.js) + * See the [Implementation considerations section](https://nodejs.org/docs/latest-v22.x/api/dns.html#implementation-considerations) for more information. + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/dns.js) */ declare module "dns" { import * as dnsPromises from "node:dns/promises"; @@ -71,7 +71,7 @@ declare module "dns" { */ family?: number | "IPv4" | "IPv6" | undefined; /** - * One or more [supported `getaddrinfo`](https://nodejs.org/docs/latest-v24.x/api/dns.html#supported-getaddrinfo-flags) flags. Multiple flags may be + * One or more [supported `getaddrinfo`](https://nodejs.org/docs/latest-v22.x/api/dns.html#supported-getaddrinfo-flags) flags. Multiple flags may be * passed by bitwise `OR`ing their values. */ hints?: number | undefined; @@ -84,7 +84,7 @@ declare module "dns" { * When `verbatim`, the resolved addresses are return unsorted. When `ipv4first`, the resolved addresses are sorted * by placing IPv4 addresses before IPv6 addresses. When `ipv6first`, the resolved addresses are sorted by placing IPv6 * addresses before IPv4 addresses. Default value is configurable using - * {@link setDefaultResultOrder} or [`--dns-result-order`](https://nodejs.org/docs/latest-v24.x/api/cli.html#--dns-result-orderorder). + * {@link setDefaultResultOrder} or [`--dns-result-order`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--dns-result-orderorder). * @default `verbatim` (addresses are not reordered) * @since v22.1.0 */ @@ -133,7 +133,7 @@ declare module "dns" { * The implementation uses an operating system facility that can associate names * with addresses and vice versa. This implementation can have subtle but * important consequences on the behavior of any Node.js program. Please take some - * time to consult the [Implementation considerations section](https://nodejs.org/docs/latest-v24.x/api/dns.html#implementation-considerations) + * time to consult the [Implementation considerations section](https://nodejs.org/docs/latest-v22.x/api/dns.html#implementation-considerations) * before using `dns.lookup()`. * * Example usage: @@ -155,7 +155,7 @@ declare module "dns" { * // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}] * ``` * - * If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v24.x/api/util.html#utilpromisifyoriginal) ed + * If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v22.x/api/util.html#utilpromisifyoriginal) ed * version, and `all` is not set to `true`, it returns a `Promise` for an `Object` with `address` and `family` properties. * @since v0.1.90 */ @@ -195,7 +195,7 @@ declare module "dns" { * If `address` is not a valid IP address, a `TypeError` will be thrown. * The `port` will be coerced to a number. If it is not a legal port, a `TypeError` will be thrown. * - * On an error, `err` is an [`Error`](https://nodejs.org/docs/latest-v24.x/api/errors.html#class-error) object, + * On an error, `err` is an [`Error`](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-error) object, * where `err.code` is the error code. * * ```js @@ -206,7 +206,7 @@ declare module "dns" { * }); * ``` * - * If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v24.x/api/util.html#utilpromisifyoriginal) ed + * If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v22.x/api/util.html#utilpromisifyoriginal) ed * version, it returns a `Promise` for an `Object` with `hostname` and `service` properties. * @since v0.11.14 */ @@ -337,7 +337,7 @@ declare module "dns" { * * * - * On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v24.x/api/errors.html#class-error) object, + * On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-error) object, * where `err.code` is one of the `DNS error codes`. * @since v0.1.27 * @param hostname Host name to resolve. @@ -652,7 +652,7 @@ declare module "dns" { * data: [ArrayBuffer] * } * ``` - * @since v23.9.0, v22.15.0 + * @since v22.15.0 */ export function resolveTlsa( hostname: string, @@ -716,8 +716,8 @@ declare module "dns" { * Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an * array of host names. * - * On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v24.x/api/errors.html#class-error) object, where `err.code` is - * one of the [DNS error codes](https://nodejs.org/docs/latest-v24.x/api/dns.html#error-codes). + * On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-error) object, where `err.code` is + * one of the [DNS error codes](https://nodejs.org/docs/latest-v22.x/api/dns.html#error-codes). * @since v0.1.16 */ export function reverse( @@ -725,7 +725,7 @@ declare module "dns" { callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void, ): void; /** - * Get the default value for `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v24.x/api/dns.html#dnspromiseslookuphostname-options). + * Get the default value for `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v22.x/api/dns.html#dnspromiseslookuphostname-options). * The value could be: * * * `ipv4first`: for `order` defaulting to `ipv4first`. @@ -780,7 +780,7 @@ declare module "dns" { */ export function getServers(): string[]; /** - * Set the default value of `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v24.x/api/dns.html#dnspromiseslookuphostname-options). + * Set the default value of `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v22.x/api/dns.html#dnspromiseslookuphostname-options). * The value could be: * * * `ipv4first`: sets default `order` to `ipv4first`. @@ -788,8 +788,8 @@ declare module "dns" { * * `verbatim`: sets default `order` to `verbatim`. * * The default is `verbatim` and {@link setDefaultResultOrder} have higher - * priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v24.x/api/cli.html#--dns-result-orderorder). When using - * [worker threads](https://nodejs.org/docs/latest-v24.x/api/worker_threads.html), {@link setDefaultResultOrder} from the main + * priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--dns-result-orderorder). When using + * [worker threads](https://nodejs.org/docs/latest-v22.x/api/worker_threads.html), {@link setDefaultResultOrder} from the main * thread won't affect the default dns orders in workers. * @since v16.4.0, v14.18.0 * @param order must be `'ipv4first'`, `'ipv6first'` or `'verbatim'`. @@ -840,7 +840,7 @@ declare module "dns" { * An independent resolver for DNS requests. * * Creating a new resolver uses the default server settings. Setting - * the servers used for a resolver using [`resolver.setServers()`](https://nodejs.org/docs/latest-v24.x/api/dns.html#dnssetserversservers) does not affect + * the servers used for a resolver using [`resolver.setServers()`](https://nodejs.org/docs/latest-v22.x/api/dns.html#dnssetserversservers) does not affect * other resolvers: * * ```js diff --git a/node_modules/@types/node/dns/promises.d.ts b/node_modules/@types/node/dns/promises.d.ts index efb9fbfd..a7ba9bb2 100644 --- a/node_modules/@types/node/dns/promises.d.ts +++ b/node_modules/@types/node/dns/promises.d.ts @@ -315,7 +315,7 @@ declare module "dns/promises" { * data: [ArrayBuffer] * } * ``` - * @since v23.9.0, v22.15.0 + * @since v22.15.0 */ function resolveTlsa(hostname: string): Promise; /** diff --git a/node_modules/@types/node/domain.d.ts b/node_modules/@types/node/domain.d.ts index 4c641153..ba8a02c1 100644 --- a/node_modules/@types/node/domain.d.ts +++ b/node_modules/@types/node/domain.d.ts @@ -12,7 +12,7 @@ * will be notified, rather than losing the context of the error in the `process.on('uncaughtException')` handler, or causing the program to * exit immediately with an error code. * @deprecated Since v1.4.2 - Deprecated - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/domain.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/domain.js) */ declare module "domain" { import EventEmitter = require("node:events"); diff --git a/node_modules/@types/node/events.d.ts b/node_modules/@types/node/events.d.ts index 023348e0..c336a289 100644 --- a/node_modules/@types/node/events.d.ts +++ b/node_modules/@types/node/events.d.ts @@ -32,7 +32,7 @@ * }); * myEmitter.emit('event'); * ``` - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/events.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/events.js) */ declare module "events" { import { AsyncResource, AsyncResourceOptions } from "node:async_hooks"; diff --git a/node_modules/@types/node/fs.d.ts b/node_modules/@types/node/fs.d.ts index b300ca45..d40515bf 100644 --- a/node_modules/@types/node/fs.d.ts +++ b/node_modules/@types/node/fs.d.ts @@ -16,7 +16,7 @@ * * All file system operations have synchronous, callback, and promise-based * forms, and are accessible using both CommonJS syntax and ES6 Modules (ESM). - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/fs.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/fs.js) */ declare module "fs" { import { NonSharedBuffer } from "node:buffer"; @@ -248,6 +248,12 @@ declare module "fs" { * @since v20.12.0, v18.20.0 */ parentPath: string; + /** + * Alias for `dirent.parentPath`. + * @since v20.1.0 + * @deprecated Since v20.12.0 + */ + path: string; } /** * A class representing a directory stream. @@ -326,13 +332,15 @@ declare module "fs" { /** * Calls `dir.close()` if the directory handle is open, and returns a promise that * fulfills when disposal is complete. - * @since v24.1.0 + * @since v22.17.0 + * @experimental */ [Symbol.asyncDispose](): Promise; /** * Calls `dir.closeSync()` if the directory handle is open, and returns * `undefined`. - * @since v24.1.0 + * @since v22.17.0 + * @experimental */ [Symbol.dispose](): void; } @@ -457,230 +465,6 @@ declare module "fs" { prependListener(event: K, listener: ReadStreamEvents[K]): this; prependOnceListener(event: K, listener: ReadStreamEvents[K]): this; } - export interface Utf8StreamOptions { - /** - * Appends writes to dest file instead of truncating it. - * @default true - */ - append?: boolean | undefined; - /** - * Which type of data you can send to the write - * function, supported values are `'utf8'` or `'buffer'`. - * @default 'utf8' - */ - contentMode?: "utf8" | "buffer" | undefined; - /** - * A path to a file to be written to (mode controlled by the - * append option). - */ - dest?: string | undefined; - /** - * A file descriptor, something that is returned by `fs.open()` - * or `fs.openSync()`. - */ - fd?: number | undefined; - /** - * An object that has the same API as the `fs` module, useful - * for mocking, testing, or customizing the behavior of the stream. - */ - fs?: object | undefined; - /** - * Perform a `fs.fsyncSync()` every time a write is - * completed. - */ - fsync?: boolean | undefined; - /** - * The maximum length of the internal buffer. If a write - * operation would cause the buffer to exceed `maxLength`, the data written is - * dropped and a drop event is emitted with the dropped data - */ - maxLength?: number | undefined; - /** - * The maximum number of bytes that can be written; - * @default 16384 - */ - maxWrite?: number | undefined; - /** - * The minimum length of the internal buffer that is - * required to be full before flushing. - */ - minLength?: number | undefined; - /** - * Ensure directory for `dest` file exists when true. - * @default false - */ - mkdir?: boolean | undefined; - /** - * Specify the creating file mode (see `fs.open()`). - */ - mode?: number | string | undefined; - /** - * Calls flush every `periodicFlush` milliseconds. - */ - periodicFlush?: number | undefined; - /** - * A function that will be called when `write()`, - * `writeSync()`, or `flushSync()` encounters an `EAGAIN` or `EBUSY` error. - * If the return value is `true` the operation will be retried, otherwise it - * will bubble the error. The `err` is the error that caused this function to - * be called, `writeBufferLen` is the length of the buffer that was written, - * and `remainingBufferLen` is the length of the remaining buffer that the - * stream did not try to write. - */ - retryEAGAIN?: ((err: Error | null, writeBufferLen: number, remainingBufferLen: number) => boolean) | undefined; - /** - * Perform writes synchronously. - */ - sync?: boolean | undefined; - } - /** - * An optimized UTF-8 stream writer that allows for flushing all the internal - * buffering on demand. It handles `EAGAIN` errors correctly, allowing for - * customization, for example, by dropping content if the disk is busy. - * @since v24.6.0 - * @experimental - */ - export class Utf8Stream extends EventEmitter { - constructor(options: Utf8StreamOptions); - /** - * Whether the stream is appending to the file or truncating it. - */ - readonly append: boolean; - /** - * The type of data that can be written to the stream. Supported - * values are `'utf8'` or `'buffer'`. - * @default 'utf8' - */ - readonly contentMode: "utf8" | "buffer"; - /** - * Close the stream immediately, without flushing the internal buffer. - */ - destroy(): void; - /** - * Close the stream gracefully, flushing the internal buffer before closing. - */ - end(): void; - /** - * The file descriptor that is being written to. - */ - readonly fd: number; - /** - * The file that is being written to. - */ - readonly file: string; - /** - * Writes the current buffer to the file if a write was not in progress. Do - * nothing if `minLength` is zero or if it is already writing. - */ - flush(callback: (err: Error | null) => void): void; - /** - * Flushes the buffered data synchronously. This is a costly operation. - */ - flushSync(): void; - /** - * Whether the stream is performing a `fs.fsyncSync()` after every - * write operation. - */ - readonly fsync: boolean; - /** - * The maximum length of the internal buffer. If a write - * operation would cause the buffer to exceed `maxLength`, the data written is - * dropped and a drop event is emitted with the dropped data. - */ - readonly maxLength: number; - /** - * The minimum length of the internal buffer that is required to be - * full before flushing. - */ - readonly minLength: number; - /** - * Whether the stream should ensure that the directory for the - * `dest` file exists. If `true`, it will create the directory if it does not - * exist. - * @default false - */ - readonly mkdir: boolean; - /** - * The mode of the file that is being written to. - */ - readonly mode: number | string; - /** - * The number of milliseconds between flushes. If set to `0`, no - * periodic flushes will be performed. - */ - readonly periodicFlush: number; - /** - * Reopen the file in place, useful for log rotation. - * @param file A path to a file to be written to (mode - * controlled by the append option). - */ - reopen(file: PathLike): void; - /** - * Whether the stream is writing synchronously or asynchronously. - */ - readonly sync: boolean; - /** - * When the `options.contentMode` is set to `'utf8'` when the stream is created, - * the `data` argument must be a string. If the `contentMode` is set to `'buffer'`, - * the `data` argument must be a `Buffer`. - * @param data The data to write. - */ - write(data: string | Buffer): boolean; - /** - * Whether the stream is currently writing data to the file. - */ - readonly writing: boolean; - /** - * Calls `utf8Stream.destroy()`. - */ - [Symbol.dispose](): void; - /** - * events.EventEmitter - * 1. change - * 2. close - * 3. error - */ - addListener(event: "close", listener: () => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "drop", listener: (data: string | Buffer) => void): this; - addListener(event: "error", listener: (error: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "ready", listener: () => void): this; - addListener(event: "write", listener: (n: number) => void): this; - addListener(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "drain", listener: () => void): this; - on(event: "drop", listener: (data: string | Buffer) => void): this; - on(event: "error", listener: (error: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "ready", listener: () => void): this; - on(event: "write", listener: (n: number) => void): this; - on(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "drain", listener: () => void): this; - once(event: "drop", listener: (data: string | Buffer) => void): this; - once(event: "error", listener: (error: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "ready", listener: () => void): this; - once(event: "write", listener: (n: number) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "drop", listener: (data: string | Buffer) => void): this; - prependListener(event: "error", listener: (error: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "ready", listener: () => void): this; - prependListener(event: "write", listener: (n: number) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "drop", listener: (data: string | Buffer) => void): this; - prependOnceListener(event: "error", listener: (error: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "ready", listener: () => void): this; - prependOnceListener(event: "write", listener: (n: number) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - } /** * The Keys are events of the ReadStream and the values are the functions that are called when the event is emitted. @@ -2193,39 +1977,6 @@ declare module "fs" { * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ export function mkdtempSync(prefix: string, options?: EncodingOption): string | NonSharedBuffer; - export interface DisposableTempDir extends AsyncDisposable { - /** - * The path of the created directory. - */ - path: string; - /** - * A function which removes the created directory. - */ - remove(): Promise; - /** - * The same as `remove`. - */ - [Symbol.asyncDispose](): Promise; - } - /** - * Returns a disposable object whose `path` property holds the created directory - * path. When the object is disposed, the directory and its contents will be - * removed if it still exists. If the directory cannot be deleted, disposal will - * throw an error. The object has a `remove()` method which will perform the same - * task. - * - * - * - * For detailed information, see the documentation of `fs.mkdtemp()`. - * - * There is no callback-based version of this API because it is designed for use - * with the `using` syntax. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use. - * @since v24.4.0 - */ - export function mkdtempDisposableSync(prefix: string, options?: EncodingOption): DisposableTempDir; /** * Reads the contents of a directory. The callback gets two arguments `(err, files)` where `files` is an array of the names of the files in the directory excluding `'.'` and `'..'`. * @@ -4613,7 +4364,6 @@ declare module "fs" { */ export function cpSync(source: string | URL, destination: string | URL, opts?: CopySyncOptions): void; - // TODO: collapse interface _GlobOptions { /** * Current working directory. @@ -4630,9 +4380,6 @@ declare module "fs" { * Function to filter out files/directories or a * list of glob patterns to be excluded. If a function is provided, return * `true` to exclude the item, `false` to include it. - * If a string array is provided, each string should be a glob pattern that - * specifies paths to exclude. Note: Negation patterns (e.g., '!foo.js') are - * not supported. * @default undefined */ exclude?: ((fileName: T) => boolean) | readonly string[] | undefined; diff --git a/node_modules/@types/node/fs/promises.d.ts b/node_modules/@types/node/fs/promises.d.ts index 986b6da5..051ddba4 100644 --- a/node_modules/@types/node/fs/promises.d.ts +++ b/node_modules/@types/node/fs/promises.d.ts @@ -21,8 +21,6 @@ declare module "fs/promises" { CopyOptions, Dir, Dirent, - DisposableTempDir, - EncodingOption, GlobOptions, GlobOptionsWithFileTypes, GlobOptionsWithoutFileTypes, @@ -493,7 +491,7 @@ declare module "fs/promises" { /** * Calls `filehandle.close()` and returns a promise that fulfills when the * filehandle is closed. - * @since v20.4.0, v18.8.0 + * @since v20.4.0 */ [Symbol.asyncDispose](): Promise; } @@ -981,26 +979,6 @@ declare module "fs/promises" { prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null, ): Promise; - /** - * The resulting Promise holds an async-disposable object whose `path` property - * holds the created directory path. When the object is disposed, the directory - * and its contents will be removed asynchronously if it still exists. If the - * directory cannot be deleted, disposal will throw an error. The object has an - * async `remove()` method which will perform the same task. - * - * Both this function and the disposal function on the resulting object are - * async, so it should be used with `await` + `await using` as in - * `await using dir = await fsPromises.mkdtempDisposable('prefix')`. - * - * - * - * For detailed information, see the documentation of `fsPromises.mkdtemp()`. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use. - * @since v24.4.0 - */ - function mkdtempDisposable(prefix: PathLike, options?: EncodingOption): Promise; /** * Asynchronously writes data to a file, replacing the file if it already exists. `data` can be a string, a buffer, an * [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an diff --git a/node_modules/@types/node/globals.d.ts b/node_modules/@types/node/globals.d.ts index 9c6837d3..83585974 100644 --- a/node_modules/@types/node/globals.d.ts +++ b/node_modules/@types/node/globals.d.ts @@ -159,12 +159,14 @@ declare namespace NodeJS { } /** An iterable iterator returned by the Node.js API. */ - interface Iterator extends IteratorObject { + // Default TReturn/TNext in v22 is `any`, for compatibility with the previously-used IterableIterator. + interface Iterator extends IteratorObject { [Symbol.iterator](): NodeJS.Iterator; } /** An async iterable iterator returned by the Node.js API. */ - interface AsyncIterator extends AsyncIteratorObject { + // Default TReturn/TNext in v22 is `any`, for compatibility with the previously-used AsyncIterableIterator. + interface AsyncIterator extends AsyncIteratorObject { [Symbol.asyncIterator](): NodeJS.AsyncIterator; } } diff --git a/node_modules/@types/node/globals.typedarray.d.ts b/node_modules/@types/node/globals.typedarray.d.ts index cae4c0b1..8eafc3b4 100644 --- a/node_modules/@types/node/globals.typedarray.d.ts +++ b/node_modules/@types/node/globals.typedarray.d.ts @@ -12,7 +12,6 @@ declare global { | Int32Array | BigUint64Array | BigInt64Array - | Float16Array | Float32Array | Float64Array; type ArrayBufferView = @@ -21,7 +20,6 @@ declare global { // The following aliases are required to allow use of non-shared ArrayBufferViews in @types/node // while maintaining compatibility with TS <=5.6. - // TODO: remove once @types/node no longer supports TS 5.6, and replace with native types. type NonSharedUint8Array = Uint8Array; type NonSharedUint8ClampedArray = Uint8ClampedArray; type NonSharedUint16Array = Uint16Array; @@ -31,7 +29,6 @@ declare global { type NonSharedInt32Array = Int32Array; type NonSharedBigUint64Array = BigUint64Array; type NonSharedBigInt64Array = BigInt64Array; - type NonSharedFloat16Array = Float16Array; type NonSharedFloat32Array = Float32Array; type NonSharedFloat64Array = Float64Array; type NonSharedDataView = DataView; diff --git a/node_modules/@types/node/http.d.ts b/node_modules/@types/node/http.d.ts index 771b8b2f..744a19f7 100644 --- a/node_modules/@types/node/http.d.ts +++ b/node_modules/@types/node/http.d.ts @@ -37,7 +37,7 @@ * 'Host', 'example.com', * 'accepT', '*' ] * ``` - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/http.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/http.js) */ declare module "http" { import { NonSharedBuffer } from "node:buffer"; @@ -272,7 +272,7 @@ declare module "http" { /** * An additional buffer time added to the * `server.keepAliveTimeout` to extend the internal socket timeout. - * @since 24.6.0 + * @since 22.19.0 * @default 1000 */ keepAliveTimeoutBuffer?: number | undefined; @@ -340,17 +340,6 @@ declare module "http" { * If the header's value is an array, the items will be joined using `; `. */ uniqueHeaders?: Array | undefined; - /** - * A callback which receives an - * incoming request and returns a boolean, to control which upgrade attempts - * should be accepted. Accepted upgrades will fire an `'upgrade'` event (or - * their sockets will be destroyed, if no listener is registered) while - * rejected upgrades will fire a `'request'` event like any non-upgrade - * request. - * @since v24.9.0 - * @default () => server.listenerCount('upgrade') > 0 - */ - shouldUpgradeCallback?: ((request: InstanceType) => boolean) | undefined; /** * If set to `true`, an error is thrown when writing to an HTTP response which does not have a body. * @default false @@ -458,7 +447,7 @@ declare module "http" { * the socket timeout slightly beyond the advertised keep-alive timeout. * * This option applies only to new incoming connections. - * @since v24.6.0 + * @since v22.19.0 * @default 1000 */ keepAliveTimeoutBuffer: number; @@ -1473,14 +1462,6 @@ declare module "http" { */ destroy(error?: Error): this; } - interface ProxyEnv extends NodeJS.ProcessEnv { - HTTP_PROXY?: string | undefined; - HTTPS_PROXY?: string | undefined; - NO_PROXY?: string | undefined; - http_proxy?: string | undefined; - https_proxy?: string | undefined; - no_proxy?: string | undefined; - } interface AgentOptions extends NodeJS.PartialOptions { /** * Keep sockets around in a pool to be used by other requests in the future. Default = false @@ -1491,16 +1472,6 @@ declare module "http" { * Only relevant if keepAlive is set to true. */ keepAliveMsecs?: number | undefined; - /** - * Milliseconds to subtract from - * the server-provided `keep-alive: timeout=...` hint when determining socket - * expiration time. This buffer helps ensure the agent closes the socket - * slightly before the server does, reducing the chance of sending a request - * on a socket that’s about to be closed by the server. - * @since v24.7.0 - * @default 1000 - */ - agentKeepAliveTimeoutBuffer?: number | undefined; /** * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity */ @@ -1522,22 +1493,6 @@ declare module "http" { * @default `lifo` */ scheduling?: "fifo" | "lifo" | undefined; - /** - * Environment variables for proxy configuration. See - * [Built-in Proxy Support](https://nodejs.org/docs/latest-v24.x/api/http.html#built-in-proxy-support) for details. - * @since v24.5.0 - */ - proxyEnv?: ProxyEnv | undefined; - /** - * Default port to use when the port is not specified in requests. - * @since v24.5.0 - */ - defaultPort?: number | undefined; - /** - * The protocol to use for the agent. - * @since v24.5.0 - */ - protocol?: string | undefined; } /** * An `Agent` is responsible for managing connection persistence @@ -1593,7 +1548,7 @@ declare module "http" { * }); * ``` * - * `options` in [`socket.connect()`](https://nodejs.org/docs/latest-v24.x/api/net.html#socketconnectoptions-connectlistener) are also supported. + * `options` in [`socket.connect()`](https://nodejs.org/docs/latest-v22.x/api/net.html#socketconnectoptions-connectlistener) are also supported. * * To configure any of them, a custom {@link Agent} instance must be created. * diff --git a/node_modules/@types/node/http2.d.ts b/node_modules/@types/node/http2.d.ts index c90af905..0dcc1d90 100644 --- a/node_modules/@types/node/http2.d.ts +++ b/node_modules/@types/node/http2.d.ts @@ -6,7 +6,7 @@ * import http2 from 'node:http2'; * ``` * @since v8.4.0 - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/http2.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/http2.js) */ declare module "http2" { import { NonSharedBuffer } from "node:buffer"; @@ -33,14 +33,18 @@ declare module "http2" { ":scheme"?: string | undefined; } // Http2Stream + export interface StreamPriorityOptions { + exclusive?: boolean | undefined; + parent?: number | undefined; + weight?: number | undefined; + silent?: boolean | undefined; + } export interface StreamState { localWindowSize?: number | undefined; state?: number | undefined; localClose?: number | undefined; remoteClose?: number | undefined; - /** @deprecated */ sumDependencyWeight?: number | undefined; - /** @deprecated */ weight?: number | undefined; } export interface ServerStreamResponseOptions { @@ -149,9 +153,10 @@ declare module "http2" { */ close(code?: number, callback?: () => void): void; /** - * @deprecated Priority signaling is no longer supported in Node.js. + * Updates the priority for this `Http2Stream` instance. + * @since v8.4.0 */ - priority(options: unknown): void; + priority(options: StreamPriorityOptions): void; /** * ```js * import http2 from 'node:http2'; @@ -285,111 +290,61 @@ declare module "http2" { addListener(event: "continue", listener: () => {}): this; addListener( event: "headers", - listener: ( - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - rawHeaders: string[], - ) => void, + listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, ): this; addListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; addListener( event: "response", - listener: ( - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - rawHeaders: string[], - ) => void, + listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, ): this; addListener(event: string | symbol, listener: (...args: any[]) => void): this; emit(event: "continue"): boolean; - emit( - event: "headers", - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - rawHeaders: string[], - ): boolean; + emit(event: "headers", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; emit(event: "push", headers: IncomingHttpHeaders, flags: number): boolean; - emit( - event: "response", - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - rawHeaders: string[], - ): boolean; + emit(event: "response", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; emit(event: string | symbol, ...args: any[]): boolean; on(event: "continue", listener: () => {}): this; on( event: "headers", - listener: ( - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - rawHeaders: string[], - ) => void, + listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, ): this; on(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; on( event: "response", - listener: ( - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - rawHeaders: string[], - ) => void, + listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, ): this; on(event: string | symbol, listener: (...args: any[]) => void): this; once(event: "continue", listener: () => {}): this; once( event: "headers", - listener: ( - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - rawHeaders: string[], - ) => void, + listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, ): this; once(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; once( event: "response", - listener: ( - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - rawHeaders: string[], - ) => void, + listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, ): this; once(event: string | symbol, listener: (...args: any[]) => void): this; prependListener(event: "continue", listener: () => {}): this; prependListener( event: "headers", - listener: ( - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - rawHeaders: string[], - ) => void, + listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, ): this; prependListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; prependListener( event: "response", - listener: ( - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - rawHeaders: string[], - ) => void, + listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, ): this; prependListener(event: string | symbol, listener: (...args: any[]) => void): this; prependOnceListener(event: "continue", listener: () => {}): this; prependOnceListener( event: "headers", - listener: ( - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - rawHeaders: string[], - ) => void, + listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, ): this; prependOnceListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; prependOnceListener( event: "response", - listener: ( - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - rawHeaders: string[], - ) => void, + listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, ): this; prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; } @@ -442,7 +397,7 @@ declare module "http2" { ): void; pushStream( headers: OutgoingHttpHeaders, - options?: Pick, + options?: StreamPriorityOptions, callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void, ): void; /** @@ -475,7 +430,7 @@ declare module "http2" { * ``` * @since v8.4.0 */ - respond(headers?: OutgoingHttpHeaders | readonly string[], options?: ServerStreamResponseOptions): void; + respond(headers?: OutgoingHttpHeaders, options?: ServerStreamResponseOptions): void; /** * Initiates a response whose data is read from the given file descriptor. No * validation is performed on the given file descriptor. If an error occurs while @@ -676,6 +631,7 @@ declare module "http2" { endStream?: boolean | undefined; exclusive?: boolean | undefined; parent?: number | undefined; + weight?: number | undefined; waitForTrailers?: boolean | undefined; signal?: AbortSignal | undefined; } @@ -1033,7 +989,6 @@ declare module "http2" { stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number, - rawHeaders: string[], ) => void, ): this; addListener(event: string | symbol, listener: (...args: any[]) => void): this; @@ -1045,7 +1000,6 @@ declare module "http2" { stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number, - rawHeaders: string[], ): boolean; emit(event: string | symbol, ...args: any[]): boolean; on(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; @@ -1057,7 +1011,6 @@ declare module "http2" { stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number, - rawHeaders: string[], ) => void, ): this; on(event: string | symbol, listener: (...args: any[]) => void): this; @@ -1073,7 +1026,6 @@ declare module "http2" { stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number, - rawHeaders: string[], ) => void, ): this; once(event: string | symbol, listener: (...args: any[]) => void): this; @@ -1089,7 +1041,6 @@ declare module "http2" { stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number, - rawHeaders: string[], ) => void, ): this; prependListener(event: string | symbol, listener: (...args: any[]) => void): this; @@ -1105,7 +1056,6 @@ declare module "http2" { stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number, - rawHeaders: string[], ) => void, ): this; prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; @@ -1223,12 +1173,7 @@ declare module "http2" { ): this; addListener( event: "stream", - listener: ( - stream: ServerHttp2Stream, - headers: IncomingHttpHeaders, - flags: number, - rawHeaders: string[], - ) => void, + listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, ): this; addListener(event: string | symbol, listener: (...args: any[]) => void): this; emit( @@ -1236,13 +1181,7 @@ declare module "http2" { session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket, ): boolean; - emit( - event: "stream", - stream: ServerHttp2Stream, - headers: IncomingHttpHeaders, - flags: number, - rawHeaders: string[], - ): boolean; + emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; emit(event: string | symbol, ...args: any[]): boolean; on( event: "connect", @@ -1253,12 +1192,7 @@ declare module "http2" { ): this; on( event: "stream", - listener: ( - stream: ServerHttp2Stream, - headers: IncomingHttpHeaders, - flags: number, - rawHeaders: string[], - ) => void, + listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, ): this; on(event: string | symbol, listener: (...args: any[]) => void): this; once( @@ -1270,12 +1204,7 @@ declare module "http2" { ): this; once( event: "stream", - listener: ( - stream: ServerHttp2Stream, - headers: IncomingHttpHeaders, - flags: number, - rawHeaders: string[], - ) => void, + listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, ): this; once(event: string | symbol, listener: (...args: any[]) => void): this; prependListener( @@ -1287,12 +1216,7 @@ declare module "http2" { ): this; prependListener( event: "stream", - listener: ( - stream: ServerHttp2Stream, - headers: IncomingHttpHeaders, - flags: number, - rawHeaders: string[], - ) => void, + listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, ): this; prependListener(event: string | symbol, listener: (...args: any[]) => void): this; prependOnceListener( @@ -1304,12 +1228,7 @@ declare module "http2" { ): this; prependOnceListener( event: "stream", - listener: ( - stream: ServerHttp2Stream, - headers: IncomingHttpHeaders, - flags: number, - rawHeaders: string[], - ) => void, + listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, ): this; prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; } @@ -1478,12 +1397,7 @@ declare module "http2" { addListener(event: "sessionError", listener: (err: Error) => void): this; addListener( event: "stream", - listener: ( - stream: ServerHttp2Stream, - headers: IncomingHttpHeaders, - flags: number, - rawHeaders: string[], - ) => void, + listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, ): this; addListener(event: "timeout", listener: () => void): this; addListener(event: string | symbol, listener: (...args: any[]) => void): this; @@ -1498,13 +1412,7 @@ declare module "http2" { session: ServerHttp2Session, ): boolean; emit(event: "sessionError", err: Error): boolean; - emit( - event: "stream", - stream: ServerHttp2Stream, - headers: IncomingHttpHeaders, - flags: number, - rawHeaders: string[], - ): boolean; + emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; emit(event: "timeout"): boolean; emit(event: string | symbol, ...args: any[]): boolean; on( @@ -1522,12 +1430,7 @@ declare module "http2" { on(event: "sessionError", listener: (err: Error) => void): this; on( event: "stream", - listener: ( - stream: ServerHttp2Stream, - headers: IncomingHttpHeaders, - flags: number, - rawHeaders: string[], - ) => void, + listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, ): this; on(event: "timeout", listener: () => void): this; on(event: string | symbol, listener: (...args: any[]) => void): this; @@ -1546,12 +1449,7 @@ declare module "http2" { once(event: "sessionError", listener: (err: Error) => void): this; once( event: "stream", - listener: ( - stream: ServerHttp2Stream, - headers: IncomingHttpHeaders, - flags: number, - rawHeaders: string[], - ) => void, + listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, ): this; once(event: "timeout", listener: () => void): this; once(event: string | symbol, listener: (...args: any[]) => void): this; @@ -1570,12 +1468,7 @@ declare module "http2" { prependListener(event: "sessionError", listener: (err: Error) => void): this; prependListener( event: "stream", - listener: ( - stream: ServerHttp2Stream, - headers: IncomingHttpHeaders, - flags: number, - rawHeaders: string[], - ) => void, + listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, ): this; prependListener(event: "timeout", listener: () => void): this; prependListener(event: string | symbol, listener: (...args: any[]) => void): this; @@ -1594,12 +1487,7 @@ declare module "http2" { prependOnceListener(event: "sessionError", listener: (err: Error) => void): this; prependOnceListener( event: "stream", - listener: ( - stream: ServerHttp2Stream, - headers: IncomingHttpHeaders, - flags: number, - rawHeaders: string[], - ) => void, + listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, ): this; prependOnceListener(event: "timeout", listener: () => void): this; prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; @@ -1988,7 +1876,7 @@ declare module "http2" { * If there were no previous values for the header, this is equivalent to calling {@link setHeader}. * * Attempting to set a header field name or value that contains invalid characters will result in a - * [TypeError](https://nodejs.org/docs/latest-v24.x/api/errors.html#class-typeerror) being thrown. + * [TypeError](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-typeerror) being thrown. * * ```js * // Returns headers including "set-cookie: a" and "set-cookie: b" @@ -2320,8 +2208,8 @@ declare module "http2" { * will result in a `TypeError` being thrown. * @since v8.4.0 */ - writeHead(statusCode: number, headers?: OutgoingHttpHeaders | readonly string[]): this; - writeHead(statusCode: number, statusMessage: string, headers?: OutgoingHttpHeaders | readonly string[]): this; + writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this; + writeHead(statusCode: number, statusMessage: string, headers?: OutgoingHttpHeaders): this; /** * Call `http2stream.pushStream()` with the given headers, and wrap the * given `Http2Stream` on a newly created `Http2ServerResponse` as the callback diff --git a/node_modules/@types/node/https.d.ts b/node_modules/@types/node/https.d.ts index 53de0b9a..e0502558 100644 --- a/node_modules/@types/node/https.d.ts +++ b/node_modules/@types/node/https.d.ts @@ -1,7 +1,7 @@ /** * HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a * separate module. - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/https.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/https.js) */ declare module "https" { import { NonSharedBuffer } from "node:buffer"; diff --git a/node_modules/@types/node/index.d.ts b/node_modules/@types/node/index.d.ts index c140e0b4..c9edbd78 100644 --- a/node_modules/@types/node/index.d.ts +++ b/node_modules/@types/node/index.d.ts @@ -22,30 +22,26 @@ * IN THE SOFTWARE. */ -// NOTE: These definitions support Node.js and TypeScript 5.8+. +// NOTE: These definitions support Node.js and TypeScript 5.7+. -// Reference required TypeScript libraries: +// Reference required TypeScript libs: /// -/// -/// -// Iterator definitions required for compatibility with TypeScript <5.6: -/// +// TypeScript backwards-compatibility definitions: +/// -// Definitions for Node.js modules specific to TypeScript 5.7+: +// Definitions specific to TypeScript 5.7+: /// /// // Definitions for Node.js modules that are not specific to any version of TypeScript: /// /// -/// /// /// /// /// /// -/// /// /// /// diff --git a/node_modules/@types/node/inspector.d.ts b/node_modules/@types/node/inspector.d.ts index dd0b8888..1f1a6fef 100644 --- a/node_modules/@types/node/inspector.d.ts +++ b/node_modules/@types/node/inspector.d.ts @@ -1,7 +1,7 @@ /** * The `node:inspector` module provides an API for interacting with the V8 * inspector. - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/inspector.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/inspector.js) */ declare module "inspector" { import EventEmitter = require("node:events"); @@ -39,7 +39,7 @@ declare module "inspector" { * If wait is `true`, will block until a client has connected to the inspect port * and flow control has been passed to the debugger client. * - * See the [security warning](https://nodejs.org/docs/latest-v24.x/api/cli.html#warning-binding-inspector-to-a-public-ipport-combination-is-insecure) + * See the [security warning](https://nodejs.org/docs/latest-v22.x/api/cli.html#warning-binding-inspector-to-a-public-ipport-combination-is-insecure) * regarding the `host` parameter usage. * @param port Port to listen on for inspector connections. Defaults to what was specified on the CLI. * @param host Host to listen on for inspector connections. Defaults to what was specified on the CLI. @@ -125,14 +125,14 @@ declare module "inspector" { * `Network.streamResourceContent` command was not invoked for the given request yet. * * Also enables `Network.getResponseBody` command to retrieve the response data. - * @since v24.2.0 + * @since v22.17.0 */ function dataReceived(params: DataReceivedEventDataType): void; /** * This feature is only available with the `--experimental-network-inspection` flag enabled. * * Enables `Network.getRequestPostData` command to retrieve the request data. - * @since v24.3.0 + * @since v22.18.0 */ function dataSent(params: unknown): void; /** @@ -159,30 +159,6 @@ declare module "inspector" { * @since v22.7.0 */ function loadingFailed(params: LoadingFailedEventDataType): void; - /** - * This feature is only available with the `--experimental-network-inspection` flag enabled. - * - * Broadcasts the `Network.webSocketCreated` event to connected frontends. This event indicates that - * a WebSocket connection has been initiated. - * @since v24.7.0 - */ - function webSocketCreated(params: WebSocketCreatedEventDataType): void; - /** - * This feature is only available with the `--experimental-network-inspection` flag enabled. - * - * Broadcasts the `Network.webSocketHandshakeResponseReceived` event to connected frontends. - * This event indicates that the WebSocket handshake response has been received. - * @since v24.7.0 - */ - function webSocketHandshakeResponseReceived(params: WebSocketHandshakeResponseReceivedEventDataType): void; - /** - * This feature is only available with the `--experimental-network-inspection` flag enabled. - * - * Broadcasts the `Network.webSocketClosed` event to connected frontends. - * This event indicates that a WebSocket connection has been closed. - * @since v24.7.0 - */ - function webSocketClosed(params: WebSocketClosedEventDataType): void; } namespace NetworkResources { /** @@ -213,7 +189,7 @@ declare module "inspector" { * ``` * * For more details, see the official CDP documentation: [Network.loadNetworkResource](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-loadNetworkResource) - * @since v24.5.0 + * @since v22.19.0 * @experimental */ function put(url: string, data: string): void; @@ -231,7 +207,7 @@ declare module "node:inspector" { /** * The `node:inspector/promises` module provides an API for interacting with the V8 * inspector. - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/inspector/promises.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/inspector/promises.js) * @since v19.0.0 */ declare module "inspector/promises" { diff --git a/node_modules/@types/node/inspector.generated.d.ts b/node_modules/@types/node/inspector.generated.d.ts index 17352e79..bcf0b3bb 100644 --- a/node_modules/@types/node/inspector.generated.d.ts +++ b/node_modules/@types/node/inspector.generated.d.ts @@ -1774,23 +1774,6 @@ declare module "inspector" { success: boolean; stream?: IO.StreamHandle | undefined; } - /** - * WebSocket response data. - */ - interface WebSocketResponse { - /** - * HTTP response status code. - */ - status: number; - /** - * HTTP response status text. - */ - statusText: string; - /** - * HTTP response headers. - */ - headers: Headers; - } interface GetRequestPostDataParameterType { /** * Identifier of the network request to get content for. @@ -1931,44 +1914,6 @@ declare module "inspector" { */ data?: string | undefined; } - interface WebSocketCreatedEventDataType { - /** - * Request identifier. - */ - requestId: RequestId; - /** - * WebSocket request URL. - */ - url: string; - /** - * Request initiator. - */ - initiator: Initiator; - } - interface WebSocketClosedEventDataType { - /** - * Request identifier. - */ - requestId: RequestId; - /** - * Timestamp. - */ - timestamp: MonotonicTime; - } - interface WebSocketHandshakeResponseReceivedEventDataType { - /** - * Request identifier. - */ - requestId: RequestId; - /** - * Timestamp. - */ - timestamp: MonotonicTime; - /** - * WebSocket response data. - */ - response: WebSocketResponse; - } } namespace NodeRuntime { interface NotifyWhenWaitingForDisconnectParameterType { @@ -2538,18 +2483,6 @@ declare module "inspector" { * Fired when data chunk was received over the network. */ addListener(event: "Network.dataReceived", listener: (message: InspectorNotification) => void): this; - /** - * Fired upon WebSocket creation. - */ - addListener(event: "Network.webSocketCreated", listener: (message: InspectorNotification) => void): this; - /** - * Fired when WebSocket is closed. - */ - addListener(event: "Network.webSocketClosed", listener: (message: InspectorNotification) => void): this; - /** - * Fired when WebSocket handshake response becomes available. - */ - addListener(event: "Network.webSocketHandshakeResponseReceived", listener: (message: InspectorNotification) => void): this; /** * This event is fired instead of `Runtime.executionContextDestroyed` when * enabled. @@ -2596,9 +2529,6 @@ declare module "inspector" { emit(event: "Network.loadingFailed", message: InspectorNotification): boolean; emit(event: "Network.loadingFinished", message: InspectorNotification): boolean; emit(event: "Network.dataReceived", message: InspectorNotification): boolean; - emit(event: "Network.webSocketCreated", message: InspectorNotification): boolean; - emit(event: "Network.webSocketClosed", message: InspectorNotification): boolean; - emit(event: "Network.webSocketHandshakeResponseReceived", message: InspectorNotification): boolean; emit(event: "NodeRuntime.waitingForDisconnect"): boolean; emit(event: "NodeRuntime.waitingForDebugger"): boolean; emit(event: "Target.targetCreated", message: InspectorNotification): boolean; @@ -2712,18 +2642,6 @@ declare module "inspector" { * Fired when data chunk was received over the network. */ on(event: "Network.dataReceived", listener: (message: InspectorNotification) => void): this; - /** - * Fired upon WebSocket creation. - */ - on(event: "Network.webSocketCreated", listener: (message: InspectorNotification) => void): this; - /** - * Fired when WebSocket is closed. - */ - on(event: "Network.webSocketClosed", listener: (message: InspectorNotification) => void): this; - /** - * Fired when WebSocket handshake response becomes available. - */ - on(event: "Network.webSocketHandshakeResponseReceived", listener: (message: InspectorNotification) => void): this; /** * This event is fired instead of `Runtime.executionContextDestroyed` when * enabled. @@ -2847,18 +2765,6 @@ declare module "inspector" { * Fired when data chunk was received over the network. */ once(event: "Network.dataReceived", listener: (message: InspectorNotification) => void): this; - /** - * Fired upon WebSocket creation. - */ - once(event: "Network.webSocketCreated", listener: (message: InspectorNotification) => void): this; - /** - * Fired when WebSocket is closed. - */ - once(event: "Network.webSocketClosed", listener: (message: InspectorNotification) => void): this; - /** - * Fired when WebSocket handshake response becomes available. - */ - once(event: "Network.webSocketHandshakeResponseReceived", listener: (message: InspectorNotification) => void): this; /** * This event is fired instead of `Runtime.executionContextDestroyed` when * enabled. @@ -2982,18 +2888,6 @@ declare module "inspector" { * Fired when data chunk was received over the network. */ prependListener(event: "Network.dataReceived", listener: (message: InspectorNotification) => void): this; - /** - * Fired upon WebSocket creation. - */ - prependListener(event: "Network.webSocketCreated", listener: (message: InspectorNotification) => void): this; - /** - * Fired when WebSocket is closed. - */ - prependListener(event: "Network.webSocketClosed", listener: (message: InspectorNotification) => void): this; - /** - * Fired when WebSocket handshake response becomes available. - */ - prependListener(event: "Network.webSocketHandshakeResponseReceived", listener: (message: InspectorNotification) => void): this; /** * This event is fired instead of `Runtime.executionContextDestroyed` when * enabled. @@ -3117,18 +3011,6 @@ declare module "inspector" { * Fired when data chunk was received over the network. */ prependOnceListener(event: "Network.dataReceived", listener: (message: InspectorNotification) => void): this; - /** - * Fired upon WebSocket creation. - */ - prependOnceListener(event: "Network.webSocketCreated", listener: (message: InspectorNotification) => void): this; - /** - * Fired when WebSocket is closed. - */ - prependOnceListener(event: "Network.webSocketClosed", listener: (message: InspectorNotification) => void): this; - /** - * Fired when WebSocket handshake response becomes available. - */ - prependOnceListener(event: "Network.webSocketHandshakeResponseReceived", listener: (message: InspectorNotification) => void): this; /** * This event is fired instead of `Runtime.executionContextDestroyed` when * enabled. @@ -3624,18 +3506,6 @@ declare module "inspector/promises" { * Fired when data chunk was received over the network. */ addListener(event: "Network.dataReceived", listener: (message: InspectorNotification) => void): this; - /** - * Fired upon WebSocket creation. - */ - addListener(event: "Network.webSocketCreated", listener: (message: InspectorNotification) => void): this; - /** - * Fired when WebSocket is closed. - */ - addListener(event: "Network.webSocketClosed", listener: (message: InspectorNotification) => void): this; - /** - * Fired when WebSocket handshake response becomes available. - */ - addListener(event: "Network.webSocketHandshakeResponseReceived", listener: (message: InspectorNotification) => void): this; /** * This event is fired instead of `Runtime.executionContextDestroyed` when * enabled. @@ -3682,9 +3552,6 @@ declare module "inspector/promises" { emit(event: "Network.loadingFailed", message: InspectorNotification): boolean; emit(event: "Network.loadingFinished", message: InspectorNotification): boolean; emit(event: "Network.dataReceived", message: InspectorNotification): boolean; - emit(event: "Network.webSocketCreated", message: InspectorNotification): boolean; - emit(event: "Network.webSocketClosed", message: InspectorNotification): boolean; - emit(event: "Network.webSocketHandshakeResponseReceived", message: InspectorNotification): boolean; emit(event: "NodeRuntime.waitingForDisconnect"): boolean; emit(event: "NodeRuntime.waitingForDebugger"): boolean; emit(event: "Target.targetCreated", message: InspectorNotification): boolean; @@ -3798,18 +3665,6 @@ declare module "inspector/promises" { * Fired when data chunk was received over the network. */ on(event: "Network.dataReceived", listener: (message: InspectorNotification) => void): this; - /** - * Fired upon WebSocket creation. - */ - on(event: "Network.webSocketCreated", listener: (message: InspectorNotification) => void): this; - /** - * Fired when WebSocket is closed. - */ - on(event: "Network.webSocketClosed", listener: (message: InspectorNotification) => void): this; - /** - * Fired when WebSocket handshake response becomes available. - */ - on(event: "Network.webSocketHandshakeResponseReceived", listener: (message: InspectorNotification) => void): this; /** * This event is fired instead of `Runtime.executionContextDestroyed` when * enabled. @@ -3933,18 +3788,6 @@ declare module "inspector/promises" { * Fired when data chunk was received over the network. */ once(event: "Network.dataReceived", listener: (message: InspectorNotification) => void): this; - /** - * Fired upon WebSocket creation. - */ - once(event: "Network.webSocketCreated", listener: (message: InspectorNotification) => void): this; - /** - * Fired when WebSocket is closed. - */ - once(event: "Network.webSocketClosed", listener: (message: InspectorNotification) => void): this; - /** - * Fired when WebSocket handshake response becomes available. - */ - once(event: "Network.webSocketHandshakeResponseReceived", listener: (message: InspectorNotification) => void): this; /** * This event is fired instead of `Runtime.executionContextDestroyed` when * enabled. @@ -4068,18 +3911,6 @@ declare module "inspector/promises" { * Fired when data chunk was received over the network. */ prependListener(event: "Network.dataReceived", listener: (message: InspectorNotification) => void): this; - /** - * Fired upon WebSocket creation. - */ - prependListener(event: "Network.webSocketCreated", listener: (message: InspectorNotification) => void): this; - /** - * Fired when WebSocket is closed. - */ - prependListener(event: "Network.webSocketClosed", listener: (message: InspectorNotification) => void): this; - /** - * Fired when WebSocket handshake response becomes available. - */ - prependListener(event: "Network.webSocketHandshakeResponseReceived", listener: (message: InspectorNotification) => void): this; /** * This event is fired instead of `Runtime.executionContextDestroyed` when * enabled. @@ -4203,18 +4034,6 @@ declare module "inspector/promises" { * Fired when data chunk was received over the network. */ prependOnceListener(event: "Network.dataReceived", listener: (message: InspectorNotification) => void): this; - /** - * Fired upon WebSocket creation. - */ - prependOnceListener(event: "Network.webSocketCreated", listener: (message: InspectorNotification) => void): this; - /** - * Fired when WebSocket is closed. - */ - prependOnceListener(event: "Network.webSocketClosed", listener: (message: InspectorNotification) => void): this; - /** - * Fired when WebSocket handshake response becomes available. - */ - prependOnceListener(event: "Network.webSocketHandshakeResponseReceived", listener: (message: InspectorNotification) => void): this; /** * This event is fired instead of `Runtime.executionContextDestroyed` when * enabled. diff --git a/node_modules/@types/node/module.d.ts b/node_modules/@types/node/module.d.ts index b563b4be..b48948e8 100644 --- a/node_modules/@types/node/module.d.ts +++ b/node_modules/@types/node/module.d.ts @@ -30,7 +30,7 @@ declare module "module" { /** * The following constants are returned as the `status` field in the object returned by * {@link enableCompileCache} to indicate the result of the attempt to enable the - * [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache). + * [module compile cache](https://nodejs.org/docs/latest-v22.x/api/module.html#module-compile-cache). * @since v22.8.0 */ namespace compileCacheStatus { @@ -81,7 +81,7 @@ declare module "module" { directory?: string; } /** - * Enable [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache) + * Enable [module compile cache](https://nodejs.org/docs/latest-v22.x/api/module.html#module-compile-cache) * in the current Node.js instance. * * If `cacheDir` is not specified, Node.js will either use the directory specified by the @@ -99,7 +99,7 @@ declare module "module" { * contains the path to the directory where the compile cache is stored. The `status` * field in the returned object would be one of the `module.constants.compileCacheStatus` * values to indicate the result of the attempt to enable the - * [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache). + * [module compile cache](https://nodejs.org/docs/latest-v22.x/api/module.html#module-compile-cache). * * This method only affects the current Node.js instance. To enable it in child worker threads, * either call this method in child worker threads too, or set the @@ -112,7 +112,7 @@ declare module "module" { */ function enableCompileCache(cacheDir?: string): EnableCompileCacheResult; /** - * Flush the [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache) + * Flush the [module compile cache](https://nodejs.org/docs/latest-v22.x/api/module.html#module-compile-cache) * accumulated from modules already loaded * in the current Node.js instance to disk. This returns after all the flushing * file system operations come to an end, no matter they succeed or not. If there @@ -123,7 +123,7 @@ declare module "module" { function flushCompileCache(): void; /** * @since v22.8.0 - * @return Path to the [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache) + * @return Path to the [module compile cache](https://nodejs.org/docs/latest-v22.x/api/module.html#module-compile-cache) * directory if it is enabled, or `undefined` otherwise. */ function getCompileCacheDir(): string | undefined; @@ -194,7 +194,7 @@ declare module "module" { */ data?: Data | undefined; /** - * [Transferable objects](https://nodejs.org/docs/latest-v24.x/api/worker_threads.html#portpostmessagevalue-transferlist) + * [Transferable objects](https://nodejs.org/docs/latest-v22.x/api/worker_threads.html#portpostmessagevalue-transferlist) * to be passed into the `initialize` hook. */ transferList?: any[] | undefined; @@ -203,10 +203,10 @@ declare module "module" { /** * Register a module that exports hooks that customize Node.js module * resolution and loading behavior. See - * [Customization hooks](https://nodejs.org/docs/latest-v24.x/api/module.html#customization-hooks). + * [Customization hooks](https://nodejs.org/docs/latest-v22.x/api/module.html#customization-hooks). * * This feature requires `--allow-worker` if used with the - * [Permission Model](https://nodejs.org/docs/latest-v24.x/api/permissions.html#permission-model). + * [Permission Model](https://nodejs.org/docs/latest-v22.x/api/permissions.html#permission-model). * @since v20.6.0, v18.19.0 * @param specifier Customization hooks to be registered; this should be * the same string that would be passed to `import()`, except that if it is @@ -222,12 +222,12 @@ declare module "module" { function register(specifier: string | URL, options?: RegisterOptions): void; interface RegisterHooksOptions { /** - * See [load hook](https://nodejs.org/docs/latest-v24.x/api/module.html#loadurl-context-nextload). + * See [load hook](https://nodejs.org/docs/latest-v22.x/api/module.html#loadurl-context-nextload). * @default undefined */ load?: LoadHookSync | undefined; /** - * See [resolve hook](https://nodejs.org/docs/latest-v24.x/api/module.html#resolvespecifier-context-nextresolve). + * See [resolve hook](https://nodejs.org/docs/latest-v22.x/api/module.html#resolvespecifier-context-nextresolve). * @default undefined */ resolve?: ResolveHookSync | undefined; @@ -239,7 +239,7 @@ declare module "module" { deregister(): void; } /** - * Register [hooks](https://nodejs.org/docs/latest-v24.x/api/module.html#customization-hooks) + * Register [hooks](https://nodejs.org/docs/latest-v22.x/api/module.html#customization-hooks) * that customize Node.js module resolution and loading behavior. * @since v22.15.0 * @experimental @@ -270,9 +270,9 @@ declare module "module" { * with `vm.runInContext()` or `vm.compileFunction()`. * By default, it will throw an error if the code contains TypeScript features * that require transformation such as `Enums`, - * see [type-stripping](https://nodejs.org/docs/latest-v24.x/api/typescript.md#type-stripping) for more information. + * see [type-stripping](https://nodejs.org/docs/latest-v22.x/api/typescript.md#type-stripping) for more information. * When mode is `'transform'`, it also transforms TypeScript features to JavaScript, - * see [transform TypeScript features](https://nodejs.org/docs/latest-v24.x/api/typescript.md#typescript-features) for more information. + * see [transform TypeScript features](https://nodejs.org/docs/latest-v22.x/api/typescript.md#typescript-features) for more information. * When mode is `'strip'`, source maps are not generated, because locations are preserved. * If `sourceMap` is provided, when mode is `'strip'`, an error will be thrown. * @@ -359,9 +359,7 @@ declare module "module" { interface ImportAttributes extends NodeJS.Dict { type?: string | undefined; } - type ImportPhase = "source" | "evaluation"; type ModuleFormat = - | "addon" | "builtin" | "commonjs" | "commonjs-typescript" @@ -503,7 +501,7 @@ declare module "module" { /** * This method returns whether the [Source Map v3](https://tc39.es/ecma426/) support for stack * traces is enabled. - * @since v23.7.0, v22.14.0 + * @since v22.14.0 */ function getSourceMapsSupport(): SourceMapsSupport; /** @@ -537,7 +535,7 @@ declare module "module" { * enabled will be parsed and loaded. Preferably, use the commandline options * `--enable-source-maps` to avoid losing track of source maps of modules loaded * before this API call. - * @since v23.7.0, v22.14.0 + * @since v22.14.0 */ function setSourceMapsSupport(enabled: boolean, options?: SetSourceMapsSupportOptions): void; interface SourceMapConstructorOptions { @@ -706,7 +704,7 @@ declare module "module" { * if (import.meta.main) main(); * // `foo` can be imported from another module without possible side-effects from `main` * ``` - * @since v24.2.0 + * @since v22.18.0 * @experimental */ main: boolean; @@ -784,7 +782,7 @@ declare module "module" { * Modules are cached in this object when they are required. By deleting a key * value from this object, the next `require` will reload the module. * This does not apply to - * [native addons](https://nodejs.org/docs/latest-v24.x/api/addons.html), + * [native addons](https://nodejs.org/docs/latest-v22.x/api/addons.html), * for which reloading will result in an error. * @since v0.3.0 */ @@ -818,7 +816,7 @@ declare module "module" { * Paths to resolve module location from. If present, these * paths are used instead of the default resolution paths, with the exception * of - * [GLOBAL\_FOLDERS](https://nodejs.org/docs/latest-v24.x/api/modules.html#loading-from-the-global-folders) + * [GLOBAL\_FOLDERS](https://nodejs.org/docs/latest-v22.x/api/modules.html#loading-from-the-global-folders) * like `$HOME/.node_modules`, which are * always included. Each of these paths is used as a starting point for * the module resolution algorithm, meaning that the `node_modules` hierarchy @@ -878,7 +876,6 @@ declare module "module" { */ var require: NodeJS.Require; // Global-scope aliases for backwards compatibility with @types/node <13.0.x - // TODO: consider removing in a future major version update /** @deprecated Use `NodeJS.Module` instead. */ interface NodeModule extends NodeJS.Module {} /** @deprecated Use `NodeJS.Require` instead. */ diff --git a/node_modules/@types/node/net.d.ts b/node_modules/@types/node/net.d.ts index 38c16275..d29b929a 100644 --- a/node_modules/@types/node/net.d.ts +++ b/node_modules/@types/node/net.d.ts @@ -10,7 +10,7 @@ * ```js * import net from 'node:net'; * ``` - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/net.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/net.js) */ declare module "net" { import { NonSharedBuffer } from "node:buffer"; @@ -44,6 +44,9 @@ declare module "net" { */ callback(bytesWritten: number, buffer: Uint8Array): boolean; } + // TODO: remove empty ConnectOpts placeholder at next major @types/node version. + /** @deprecated */ + interface ConnectOpts {} interface TcpSocketConnectOpts { port: number; host?: string | undefined; @@ -536,7 +539,7 @@ declare module "net" { keepAliveInitialDelay?: number | undefined; /** * Optionally overrides all `net.Socket`s' `readableHighWaterMark` and `writableHighWaterMark`. - * @default See [stream.getDefaultHighWaterMark()](https://nodejs.org/docs/latest-v24.x/api/stream.html#streamgetdefaulthighwatermarkobjectmode). + * @default See [stream.getDefaultHighWaterMark()](https://nodejs.org/docs/latest-v22.x/api/stream.html#streamgetdefaulthighwatermarkobjectmode). * @since v18.17.0, v20.1.0 */ highWaterMark?: number | undefined; @@ -818,12 +821,12 @@ declare module "net" { * blockList.fromJSON(data); * blockList.fromJSON(JSON.stringify(data)); * ``` - * @since v24.5.0 + * @since v22.19.0 * @experimental */ fromJSON(data: string | readonly string[]): void; /** - * @since v24.5.0 + * @since v22.19.0 * @experimental */ toJSON(): readonly string[]; diff --git a/node_modules/@types/node/os.d.ts b/node_modules/@types/node/os.d.ts index 505f5b44..a40bd77b 100644 --- a/node_modules/@types/node/os.d.ts +++ b/node_modules/@types/node/os.d.ts @@ -5,7 +5,7 @@ * ```js * import os from 'node:os'; * ``` - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/os.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/os.js) */ declare module "os" { import { NonSharedBuffer } from "buffer"; @@ -251,12 +251,12 @@ declare module "os" { * environment variables for the home directory before falling back to the * operating system response. * - * Throws a [`SystemError`](https://nodejs.org/docs/latest-v24.x/api/errors.html#class-systemerror) if a user has no `username` or `homedir`. + * Throws a [`SystemError`](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-systemerror) if a user has no `username` or `homedir`. * @since v6.0.0 */ function userInfo(options?: UserInfoOptionsWithStringEncoding): UserInfo; function userInfo(options: UserInfoOptionsWithBufferEncoding): UserInfo; - function userInfo(options: UserInfoOptions): UserInfo; + function userInfo(options: UserInfoOptions): UserInfo; type SignalConstants = { [key in NodeJS.Signals]: number; }; @@ -428,13 +428,13 @@ declare module "os" { const EOL: string; /** * Returns the operating system CPU architecture for which the Node.js binary was - * compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`, - * `'mips'`, `'mipsel'`, `'ppc64'`, `'riscv64'`, `'s390x'`, and `'x64'`. + * compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`, `'mips'`, `'mipsel'`, `'ppc'`, `'ppc64'`, `'riscv64'`, `'s390'`, `'s390x'`, + * and `'x64'`. * - * The return value is equivalent to [process.arch](https://nodejs.org/docs/latest-v24.x/api/process.html#processarch). + * The return value is equivalent to [process.arch](https://nodejs.org/docs/latest-v22.x/api/process.html#processarch). * @since v0.5.0 */ - function arch(): NodeJS.Architecture; + function arch(): string; /** * Returns a string identifying the kernel version. * @@ -456,8 +456,7 @@ declare module "os" { */ function platform(): NodeJS.Platform; /** - * Returns the machine type as a string, such as `arm`, `arm64`, `aarch64`, - * `mips`, `mips64`, `ppc64`, `ppc64le`, `s390x`, `i386`, `i686`, `x86_64`. + * Returns the machine type as a string, such as `arm`, `arm64`, `aarch64`, `mips`, `mips64`, `ppc64`, `ppc64le`, `s390`, `s390x`, `i386`, `i686`, `x86_64`. * * On POSIX systems, the machine type is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `RtlGetVersion()` is used, and if it is not * available, `GetVersionExW()` will be used. See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information. diff --git a/node_modules/@types/node/package.json b/node_modules/@types/node/package.json index 50d22e5b..43039ce7 100644 --- a/node_modules/@types/node/package.json +++ b/node_modules/@types/node/package.json @@ -1,6 +1,6 @@ { "name": "@types/node", - "version": "24.10.4", + "version": "22.19.3", "description": "TypeScript definitions for node", "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node", "license": "MIT", @@ -119,11 +119,6 @@ "name": "René", "githubUsername": "Renegade334", "url": "https://github.com/Renegade334" - }, - { - "name": "Yagiz Nizipli", - "githubUsername": "anonrig", - "url": "https://github.com/anonrig" } ], "main": "", @@ -133,11 +128,6 @@ "*": [ "ts5.6/*" ] - }, - "<=5.7": { - "*": [ - "ts5.7/*" - ] } }, "repository": { @@ -147,9 +137,9 @@ }, "scripts": {}, "dependencies": { - "undici-types": "~7.16.0" + "undici-types": "~6.21.0" }, "peerDependencies": {}, - "typesPublisherContentHash": "3a9013632111e49759d702b082ccfa1cce713feb78de09513919546221062945", + "typesPublisherContentHash": "a128cc757108a9d18e8f7bd67ff4be34845d5b687153f297e3a25073b6ed8d4b", "typeScriptVersion": "5.2" } \ No newline at end of file diff --git a/node_modules/@types/node/path.d.ts b/node_modules/@types/node/path.d.ts index 08b8a318..b83d8f50 100644 --- a/node_modules/@types/node/path.d.ts +++ b/node_modules/@types/node/path.d.ts @@ -13,7 +13,7 @@ declare module "path/win32" { * ```js * import path from 'node:path'; * ``` - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/path.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/path.js) */ declare module "path" { namespace path { diff --git a/node_modules/@types/node/perf_hooks.d.ts b/node_modules/@types/node/perf_hooks.d.ts index ba4b9ade..ad0785de 100644 --- a/node_modules/@types/node/perf_hooks.d.ts +++ b/node_modules/@types/node/perf_hooks.d.ts @@ -27,7 +27,7 @@ * performance.measure('A to B', 'A', 'B'); * }); * ``` - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/perf_hooks.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/perf_hooks.js) */ declare module "perf_hooks" { import { AsyncResource } from "node:async_hooks"; @@ -811,20 +811,6 @@ declare module "perf_hooks" { * @since v11.10.0 */ disable(): boolean; - /** - * Disables the update interval timer when the histogram is disposed. - * - * ```js - * const { monitorEventLoopDelay } = require('node:perf_hooks'); - * { - * using hist = monitorEventLoopDelay({ resolution: 20 }); - * hist.enable(); - * // The histogram will be disabled when the block is exited. - * } - * ``` - * @since v24.2.0 - */ - [Symbol.dispose](): void; } interface RecordableHistogram extends Histogram { /** @@ -907,7 +893,7 @@ declare module "perf_hooks" { global { /** * `PerformanceEntry` is a global reference for `import { PerformanceEntry } from 'node:perf_hooks'` - * @see https://nodejs.org/docs/latest-v24.x/api/globals.html#performanceentry + * @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performanceentry * @since v19.0.0 */ var PerformanceEntry: typeof globalThis extends { @@ -917,7 +903,7 @@ declare module "perf_hooks" { : typeof _PerformanceEntry; /** * `PerformanceMark` is a global reference for `import { PerformanceMark } from 'node:perf_hooks'` - * @see https://nodejs.org/docs/latest-v24.x/api/globals.html#performancemark + * @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performancemark * @since v19.0.0 */ var PerformanceMark: typeof globalThis extends { @@ -927,7 +913,7 @@ declare module "perf_hooks" { : typeof _PerformanceMark; /** * `PerformanceMeasure` is a global reference for `import { PerformanceMeasure } from 'node:perf_hooks'` - * @see https://nodejs.org/docs/latest-v24.x/api/globals.html#performancemeasure + * @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performancemeasure * @since v19.0.0 */ var PerformanceMeasure: typeof globalThis extends { @@ -937,7 +923,7 @@ declare module "perf_hooks" { : typeof _PerformanceMeasure; /** * `PerformanceObserver` is a global reference for `import { PerformanceObserver } from 'node:perf_hooks'` - * @see https://nodejs.org/docs/latest-v24.x/api/globals.html#performanceobserver + * @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performanceobserver * @since v19.0.0 */ var PerformanceObserver: typeof globalThis extends { @@ -947,7 +933,7 @@ declare module "perf_hooks" { : typeof _PerformanceObserver; /** * `PerformanceObserverEntryList` is a global reference for `import { PerformanceObserverEntryList } from 'node:perf_hooks'` - * @see https://nodejs.org/docs/latest-v24.x/api/globals.html#performanceobserverentrylist + * @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performanceobserverentrylist * @since v19.0.0 */ var PerformanceObserverEntryList: typeof globalThis extends { @@ -957,7 +943,7 @@ declare module "perf_hooks" { : typeof _PerformanceObserverEntryList; /** * `PerformanceResourceTiming` is a global reference for `import { PerformanceResourceTiming } from 'node:perf_hooks'` - * @see https://nodejs.org/docs/latest-v24.x/api/globals.html#performanceresourcetiming + * @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performanceresourcetiming * @since v19.0.0 */ var PerformanceResourceTiming: typeof globalThis extends { @@ -967,7 +953,7 @@ declare module "perf_hooks" { : typeof _PerformanceResourceTiming; /** * `performance` is a global reference for `import { performance } from 'node:perf_hooks'` - * @see https://nodejs.org/docs/latest-v24.x/api/globals.html#performance + * @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performance * @since v16.0.0 */ var performance: typeof globalThis extends { diff --git a/node_modules/@types/node/process.d.ts b/node_modules/@types/node/process.d.ts index c1108661..b761ec17 100644 --- a/node_modules/@types/node/process.d.ts +++ b/node_modules/@types/node/process.d.ts @@ -196,7 +196,7 @@ declare module "process" { readonly ipv6: boolean; /** * A boolean value that is `true` if the current Node.js build supports - * [loading ECMAScript modules using `require()`](https://nodejs.org/docs/latest-v24.x/api/modules.md#loading-ecmascript-modules-using-require). + * [loading ECMAScript modules using `require()`](https://nodejs.org/docs/latest-v22.x/api/modules.md#loading-ecmascript-modules-using-require). * @since v22.10.0 */ readonly require_module: boolean; @@ -277,8 +277,10 @@ declare module "process" { | "loong64" | "mips" | "mipsel" + | "ppc" | "ppc64" | "riscv64" + | "s390" | "s390x" | "x64"; type Signals = @@ -749,7 +751,7 @@ declare module "process" { * should not be used directly, except in special cases. In other words, `require()` should be preferred over `process.dlopen()` * unless there are specific reasons such as custom dlopen flags or loading from ES modules. * - * The `flags` argument is an integer that allows to specify dlopen behavior. See the `[os.constants.dlopen](https://nodejs.org/docs/latest-v24.x/api/os.html#dlopen-constants)` + * The `flags` argument is an integer that allows to specify dlopen behavior. See the `[os.constants.dlopen](https://nodejs.org/docs/latest-v22.x/api/os.html#dlopen-constants)` * documentation for details. * * An important requirement when calling `process.dlopen()` is that the `module` instance must be passed. Functions exported by the C++ Addon @@ -1498,7 +1500,7 @@ declare module "process" { * * The result of a previous call to `process.threadCpuUsage()` can be passed as the * argument to the function, to get a diff reading. - * @since v23.9.0 + * @since v22.19.0 * @param previousValue A previous return value from calling * `process.threadCpuUsage()` */ @@ -1523,8 +1525,7 @@ declare module "process" { title: string; /** * The operating system CPU architecture for which the Node.js binary was compiled. - * Possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`, `'mips'`, - * `'mipsel'`, `'ppc64'`, `'riscv64'`, `'s390x'`, and `'x64'`. + * Possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`, `'mips'`, `'mipsel'`, `'ppc'`, `'ppc64'`, `'riscv64'`, `'s390'`, `'s390x'`, and `'x64'`. * * ```js * import { arch } from 'node:process'; @@ -1584,7 +1585,7 @@ declare module "process" { constrainedMemory(): number; /** * Gets the amount of free memory that is still available to the process (in bytes). - * See [`uv_get_available_memory`](https://nodejs.org/docs/latest-v24.x/api/process.html#processavailablememory) for more information. + * See [`uv_get_available_memory`](https://nodejs.org/docs/latest-v22.x/api/process.html#processavailablememory) for more information. * @since v20.13.0 */ availableMemory(): number; @@ -1849,7 +1850,7 @@ declare module "process" { allowedNodeEnvironmentFlags: ReadonlySet; /** * `process.report` is an object whose methods are used to generate diagnostic reports for the current process. - * Additional documentation is available in the [report documentation](https://nodejs.org/docs/latest-v24.x/api/report.html). + * Additional documentation is available in the [report documentation](https://nodejs.org/docs/latest-v22.x/api/report.html). * @since v11.8.0 */ report: ProcessReport; diff --git a/node_modules/@types/node/punycode.d.ts b/node_modules/@types/node/punycode.d.ts index 7ac26c82..655c47b6 100644 --- a/node_modules/@types/node/punycode.d.ts +++ b/node_modules/@types/node/punycode.d.ts @@ -24,7 +24,7 @@ * made available to developers as a convenience. Fixes or other modifications to * the module must be directed to the [Punycode.js](https://github.com/bestiejs/punycode.js) project. * @deprecated Since v7.0.0 - Deprecated - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/punycode.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/punycode.js) */ declare module "punycode" { /** diff --git a/node_modules/@types/node/querystring.d.ts b/node_modules/@types/node/querystring.d.ts index aaeefe8d..f0d52570 100644 --- a/node_modules/@types/node/querystring.d.ts +++ b/node_modules/@types/node/querystring.d.ts @@ -9,7 +9,7 @@ * `querystring` is more performant than `URLSearchParams` but is not a * standardized API. Use `URLSearchParams` when performance is not critical or * when compatibility with browser code is desirable. - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/querystring.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/querystring.js) */ declare module "querystring" { interface StringifyOptions { diff --git a/node_modules/@types/node/readline.d.ts b/node_modules/@types/node/readline.d.ts index 519b4a46..338972e7 100644 --- a/node_modules/@types/node/readline.d.ts +++ b/node_modules/@types/node/readline.d.ts @@ -1,6 +1,6 @@ /** - * The `node:readline` module provides an interface for reading data from a [Readable](https://nodejs.org/docs/latest-v24.x/api/stream.html#readable-streams) stream - * (such as [`process.stdin`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstdin)) one line at a time. + * The `node:readline` module provides an interface for reading data from a [Readable](https://nodejs.org/docs/latest-v22.x/api/stream.html#readable-streams) stream + * (such as [`process.stdin`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdin)) one line at a time. * * To use the promise-based APIs: * @@ -31,7 +31,7 @@ * * Once this code is invoked, the Node.js application will not terminate until the `readline.Interface` is closed because the interface waits for data to be * received on the `input` stream. - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/readline.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/readline.js) */ declare module "readline" { import { Abortable, EventEmitter } from "node:events"; @@ -46,7 +46,7 @@ declare module "readline" { } /** * Instances of the `readline.Interface` class are constructed using the `readline.createInterface()` method. Every instance is associated with a - * single `input` [Readable](https://nodejs.org/docs/latest-v24.x/api/stream.html#readable-streams) stream and a single `output` [Writable](https://nodejs.org/docs/latest-v24.x/api/stream.html#writable-streams) stream. + * single `input` [Readable](https://nodejs.org/docs/latest-v22.x/api/stream.html#readable-streams) stream and a single `output` [Writable](https://nodejs.org/docs/latest-v22.x/api/stream.html#writable-streams) stream. * The `output` stream is used to print prompts for user input that arrives on, * and is read from, the `input` stream. * @since v0.1.104 @@ -100,7 +100,7 @@ declare module "readline" { * > Instances of the `readline.Interface` class are constructed using the * > `readline.createInterface()` method. * - * @see https://nodejs.org/dist/latest-v24.x/docs/api/readline.html#class-interfaceconstructor + * @see https://nodejs.org/dist/latest-v22.x/docs/api/readline.html#class-interfaceconstructor */ protected constructor( input: NodeJS.ReadableStream, @@ -114,7 +114,7 @@ declare module "readline" { * > Instances of the `readline.Interface` class are constructed using the * > `readline.createInterface()` method. * - * @see https://nodejs.org/dist/latest-v24.x/docs/api/readline.html#class-interfaceconstructor + * @see https://nodejs.org/dist/latest-v22.x/docs/api/readline.html#class-interfaceconstructor */ protected constructor(options: ReadLineOptions); /** @@ -320,11 +320,11 @@ declare module "readline" { export type CompleterResult = [string[], string]; export interface ReadLineOptions { /** - * The [`Readable`](https://nodejs.org/docs/latest-v24.x/api/stream.html#readable-streams) stream to listen to + * The [`Readable`](https://nodejs.org/docs/latest-v22.x/api/stream.html#readable-streams) stream to listen to */ input: NodeJS.ReadableStream; /** - * The [`Writable`](https://nodejs.org/docs/latest-v24.x/api/stream.html#writable-streams) stream to write readline data to. + * The [`Writable`](https://nodejs.org/docs/latest-v22.x/api/stream.html#writable-streams) stream to write readline data to. */ output?: NodeJS.WritableStream | undefined; /** @@ -369,7 +369,7 @@ declare module "readline" { * `crlfDelay` will be coerced to a number no less than `100`. * It can be set to `Infinity`, in which case * `\r` followed by `\n` will always be considered a single newline - * (which may be reasonable for [reading files](https://nodejs.org/docs/latest-v24.x/api/readline.html#example-read-file-stream-line-by-line) with `\r\n` line delimiter). + * (which may be reasonable for [reading files](https://nodejs.org/docs/latest-v22.x/api/readline.html#example-read-file-stream-line-by-line) with `\r\n` line delimiter). * @default 100 */ crlfDelay?: number | undefined; @@ -557,7 +557,7 @@ declare module "readline" { cols: number; } /** - * The `readline.clearLine()` method clears current line of given [TTY](https://nodejs.org/docs/latest-v24.x/api/tty.html) stream + * The `readline.clearLine()` method clears current line of given [TTY](https://nodejs.org/docs/latest-v22.x/api/tty.html) stream * in a specified direction identified by `dir`. * @since v0.7.7 * @param callback Invoked once the operation completes. @@ -565,7 +565,7 @@ declare module "readline" { */ export function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean; /** - * The `readline.clearScreenDown()` method clears the given [TTY](https://nodejs.org/docs/latest-v24.x/api/tty.html) stream from + * The `readline.clearScreenDown()` method clears the given [TTY](https://nodejs.org/docs/latest-v22.x/api/tty.html) stream from * the current position of the cursor down. * @since v0.7.7 * @param callback Invoked once the operation completes. @@ -574,7 +574,7 @@ declare module "readline" { export function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean; /** * The `readline.cursorTo()` method moves cursor to the specified position in a - * given [TTY](https://nodejs.org/docs/latest-v24.x/api/tty.html) `stream`. + * given [TTY](https://nodejs.org/docs/latest-v22.x/api/tty.html) `stream`. * @since v0.7.7 * @param callback Invoked once the operation completes. * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. @@ -582,7 +582,7 @@ declare module "readline" { export function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean; /** * The `readline.moveCursor()` method moves the cursor _relative_ to its current - * position in a given [TTY](https://nodejs.org/docs/latest-v24.x/api/tty.html) `stream`. + * position in a given [TTY](https://nodejs.org/docs/latest-v22.x/api/tty.html) `stream`. * @since v0.7.7 * @param callback Invoked once the operation completes. * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. diff --git a/node_modules/@types/node/repl.d.ts b/node_modules/@types/node/repl.d.ts index 60dc94ad..fb858da1 100644 --- a/node_modules/@types/node/repl.d.ts +++ b/node_modules/@types/node/repl.d.ts @@ -6,7 +6,7 @@ * ```js * import repl from 'node:repl'; * ``` - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/repl.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/repl.js) */ declare module "repl" { import { AsyncCompleter, Completer, Interface } from "node:readline"; @@ -39,7 +39,7 @@ declare module "repl" { * The function to be used when evaluating each given line of input. * **Default:** an async wrapper for the JavaScript `eval()` function. An `eval` function can * error with `repl.Recoverable` to indicate the input was incomplete and prompt for - * additional lines. See the [custom evaluation functions](https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#custom-evaluation-functions) + * additional lines. See the [custom evaluation functions](https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#custom-evaluation-functions) * section for more details. */ eval?: REPLEval | undefined; @@ -72,13 +72,13 @@ declare module "repl" { * The function to invoke to format the output of each command before writing to `output`. * @default a wrapper for `util.inspect` * - * @see https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#repl_customizing_repl_output + * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_customizing_repl_output */ writer?: REPLWriter | undefined; /** * An optional function used for custom Tab auto completion. * - * @see https://nodejs.org/dist/latest-v24.x/docs/api/readline.html#readline_use_of_the_completer_function + * @see https://nodejs.org/dist/latest-v22.x/docs/api/readline.html#readline_use_of_the_completer_function */ completer?: Completer | AsyncCompleter | undefined; /** @@ -123,12 +123,6 @@ declare module "repl" { */ action: REPLCommandAction; } - interface REPLServerSetupHistoryOptions { - filePath?: string | undefined; - size?: number | undefined; - removeHistoryDuplicates?: boolean | undefined; - onHistoryFileLoaded?: ((err: Error | null, repl: REPLServer) => void) | undefined; - } /** * Instances of `repl.REPLServer` are created using the {@link start} method * or directly using the JavaScript `new` keyword. @@ -172,33 +166,33 @@ declare module "repl" { /** * A value indicating whether the REPL is currently in "editor mode". * - * @see https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#repl_commands_and_special_keys + * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_commands_and_special_keys */ readonly editorMode: boolean; /** * A value indicating whether the `_` variable has been assigned. * - * @see https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable + * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable */ readonly underscoreAssigned: boolean; /** * The last evaluation result from the REPL (assigned to the `_` variable inside of the REPL). * - * @see https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable + * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable */ readonly last: any; /** * A value indicating whether the `_error` variable has been assigned. * * @since v9.8.0 - * @see https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable + * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable */ readonly underscoreErrAssigned: boolean; /** * The last error raised inside the REPL (assigned to the `_error` variable inside of the REPL). * * @since v9.8.0 - * @see https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable + * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable */ readonly lastError: any; /** @@ -250,7 +244,7 @@ declare module "repl" { * * `REPLServer` cannot be subclassed due to implementation specifics in NodeJS. * - * @see https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#repl_class_replserver + * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_class_replserver */ private constructor(); /** @@ -295,7 +289,7 @@ declare module "repl" { * The `replServer.displayPrompt()` method readies the REPL instance for input * from the user, printing the configured `prompt` to a new line in the `output` and resuming the `input` to accept new input. * - * When multi-line input is being entered, a pipe `'|'` is printed rather than the + * When multi-line input is being entered, an ellipsis is printed rather than the * 'prompt'. * * When `preserveCursor` is `true`, the cursor placement will not be reset to `0`. @@ -322,11 +316,7 @@ declare module "repl" { * @param historyPath the path to the history file * @param callback called when history writes are ready or upon error */ - setupHistory(historyPath: string, callback: (err: Error | null, repl: this) => void): void; - setupHistory( - historyConfig?: REPLServerSetupHistoryOptions, - callback?: (err: Error | null, repl: this) => void, - ): void; + setupHistory(path: string, callback: (err: Error | null, repl: this) => void): void; /** * events.EventEmitter * 1. close - inherited from `readline.Interface` @@ -426,7 +416,7 @@ declare module "repl" { /** * Indicates a recoverable error that a `REPLServer` can use to support multi-line input. * - * @see https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#repl_recoverable_errors + * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_recoverable_errors */ class Recoverable extends SyntaxError { err: Error; diff --git a/node_modules/@types/node/sea.d.ts b/node_modules/@types/node/sea.d.ts index 870c3045..30130747 100644 --- a/node_modules/@types/node/sea.d.ts +++ b/node_modules/@types/node/sea.d.ts @@ -111,7 +111,7 @@ * ``` * @since v19.7.0, v18.16.0 * @experimental - * @see [source](https://github.com/nodejs/node/blob/v24.x/src/node_sea.cc) + * @see [source](https://github.com/nodejs/node/blob/v22.x/src/node_sea.cc) */ declare module "node:sea" { type AssetKey = string; @@ -150,13 +150,4 @@ declare module "node:sea" { * @since v20.12.0 */ function getRawAsset(key: AssetKey): ArrayBuffer; - /** - * This method can be used to retrieve an array of all the keys of assets - * embedded into the single-executable application. - * An error is thrown when not running inside a single-executable application. - * @since v24.8.0 - * @returns An array containing all the keys of the assets - * embedded in the executable. If no assets are embedded, returns an empty array. - */ - function getAssetKeys(): string[]; } diff --git a/node_modules/@types/node/sqlite.d.ts b/node_modules/@types/node/sqlite.d.ts index 6ff7943a..19d826d4 100644 --- a/node_modules/@types/node/sqlite.d.ts +++ b/node_modules/@types/node/sqlite.d.ts @@ -40,7 +40,7 @@ * ``` * @since v22.5.0 * @experimental - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/sqlite.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/sqlite.js) */ declare module "node:sqlite" { import { PathLike } from "node:fs"; @@ -92,34 +92,34 @@ declare module "node:sqlite" { * The [busy timeout](https://sqlite.org/c3ref/busy_timeout.html) in milliseconds. This is the maximum amount of * time that SQLite will wait for a database lock to be released before * returning an error. - * @since v24.0.0 + * @since v22.16.0 * @default 0 */ timeout?: number | undefined; /** * If `true`, integer fields are read as JavaScript `BigInt` values. If `false`, * integer fields are read as JavaScript numbers. - * @since v24.4.0 + * @since v22.18.0 * @default false */ readBigInts?: boolean | undefined; /** * If `true`, query results are returned as arrays instead of objects. - * @since v24.4.0 + * @since v22.18.0 * @default false */ returnArrays?: boolean | undefined; /** * If `true`, allows binding named parameters without the prefix * character (e.g., `foo` instead of `:foo`). - * @since v24.4.40 + * @since v22.18.0 * @default true */ allowBareNamedParameters?: boolean | undefined; /** * If `true`, unknown named parameters are ignored when binding. * If `false`, an exception is thrown for unknown named parameters. - * @since v24.4.40 + * @since v22.18.0 * @default false */ allowUnknownNamedParameters?: boolean | undefined; @@ -266,7 +266,7 @@ declare module "node:sqlite" { * * db.prepare('SELECT sumint(y) as total FROM t3').get(); // { total: 21 } * ``` - * @since v24.0.0 + * @since v22.16.0 * @param name The name of the SQLite function to create. * @param options Function configuration settings. */ @@ -296,7 +296,7 @@ declare module "node:sqlite" { enableLoadExtension(allow: boolean): void; /** * This method is a wrapper around [`sqlite3_db_filename()`](https://sqlite.org/c3ref/db_filename.html) - * @since v24.0.0 + * @since v22.16.0 * @param dbName Name of the database. This can be `'main'` (the default primary database) or any other * database that has been added with [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html) **Default:** `'main'`. * @returns The location of the database file. When using an in-memory database, @@ -320,7 +320,7 @@ declare module "node:sqlite" { * @param func The JavaScript function to call when the SQLite * function is invoked. The return value of this function should be a valid * SQLite data type: see - * [Type conversion between JavaScript and SQLite](https://nodejs.org/docs/latest-v24.x/api/sqlite.html#type-conversion-between-javascript-and-sqlite). + * [Type conversion between JavaScript and SQLite](https://nodejs.org/docs/latest-v22.x/api/sqlite.html#type-conversion-between-javascript-and-sqlite). * The result defaults to `NULL` if the return value is `undefined`. */ function( @@ -329,64 +329,6 @@ declare module "node:sqlite" { func: (...args: SQLOutputValue[]) => SQLInputValue, ): void; function(name: string, func: (...args: SQLOutputValue[]) => SQLInputValue): void; - /** - * Sets an authorizer callback that SQLite will invoke whenever it attempts to - * access data or modify the database schema through prepared statements. - * This can be used to implement security policies, audit access, or restrict certain operations. - * This method is a wrapper around [`sqlite3_set_authorizer()`](https://sqlite.org/c3ref/set_authorizer.html). - * - * When invoked, the callback receives five arguments: - * - * * `actionCode` {number} The type of operation being performed (e.g., - * `SQLITE_INSERT`, `SQLITE_UPDATE`, `SQLITE_SELECT`). - * * `arg1` {string|null} The first argument (context-dependent, often a table name). - * * `arg2` {string|null} The second argument (context-dependent, often a column name). - * * `dbName` {string|null} The name of the database. - * * `triggerOrView` {string|null} The name of the trigger or view causing the access. - * - * The callback must return one of the following constants: - * - * * `SQLITE_OK` - Allow the operation. - * * `SQLITE_DENY` - Deny the operation (causes an error). - * * `SQLITE_IGNORE` - Ignore the operation (silently skip). - * - * ```js - * import { DatabaseSync, constants } from 'node:sqlite'; - * const db = new DatabaseSync(':memory:'); - * - * // Set up an authorizer that denies all table creation - * db.setAuthorizer((actionCode) => { - * if (actionCode === constants.SQLITE_CREATE_TABLE) { - * return constants.SQLITE_DENY; - * } - * return constants.SQLITE_OK; - * }); - * - * // This will work - * db.prepare('SELECT 1').get(); - * - * // This will throw an error due to authorization denial - * try { - * db.exec('CREATE TABLE blocked (id INTEGER)'); - * } catch (err) { - * console.log('Operation blocked:', err.message); - * } - * ``` - * @since v24.10.0 - * @param callback The authorizer function to set, or `null` to - * clear the current authorizer. - */ - setAuthorizer( - callback: - | (( - actionCode: number, - arg1: string | null, - arg2: string | null, - dbName: string | null, - triggerOrView: string | null, - ) => number) - | null, - ): void; /** * Whether the database is currently open or not. * @since v22.15.0 @@ -395,7 +337,7 @@ declare module "node:sqlite" { /** * Whether the database is currently within a transaction. This method * is a wrapper around [`sqlite3_get_autocommit()`](https://sqlite.org/c3ref/get_autocommit.html). - * @since v24.0.0 + * @since v22.16.0 */ readonly isTransaction: boolean; /** @@ -412,47 +354,6 @@ declare module "node:sqlite" { * @return The prepared statement. */ prepare(sql: string): StatementSync; - /** - * Creates a new `SQLTagStore`, which is an LRU (Least Recently Used) cache for - * storing prepared statements. This allows for the efficient reuse of prepared - * statements by tagging them with a unique identifier. - * - * When a tagged SQL literal is executed, the `SQLTagStore` checks if a prepared - * statement for that specific SQL string already exists in the cache. If it does, - * the cached statement is used. If not, a new prepared statement is created, - * executed, and then stored in the cache for future use. This mechanism helps to - * avoid the overhead of repeatedly parsing and preparing the same SQL statements. - * - * ```js - * import { DatabaseSync } from 'node:sqlite'; - * - * const db = new DatabaseSync(':memory:'); - * const sql = db.createSQLTagStore(); - * - * db.exec('CREATE TABLE users (id INT, name TEXT)'); - * - * // Using the 'run' method to insert data. - * // The tagged literal is used to identify the prepared statement. - * sql.run`INSERT INTO users VALUES (1, 'Alice')`; - * sql.run`INSERT INTO users VALUES (2, 'Bob')`; - * - * // Using the 'get' method to retrieve a single row. - * const id = 1; - * const user = sql.get`SELECT * FROM users WHERE id = ${id}`; - * console.log(user); // { id: 1, name: 'Alice' } - * - * // Using the 'all' method to retrieve all rows. - * const allUsers = sql.all`SELECT * FROM users ORDER BY id`; - * console.log(allUsers); - * // [ - * // { id: 1, name: 'Alice' }, - * // { id: 2, name: 'Bob' } - * // ] - * ``` - * @since v24.9.0 - * @returns A new SQL tag store for caching prepared statements. - */ - createTagStore(maxSize?: number): SQLTagStore; /** * Creates and attaches a session to the database. This method is a wrapper around * [`sqlite3session_create()`](https://www.sqlite.org/session/sqlite3session_create.html) and @@ -494,6 +395,7 @@ declare module "node:sqlite" { * Closes the database connection. If the database connection is already closed * then this is a no-op. * @since v22.15.0 + * @experimental */ [Symbol.dispose](): void; } @@ -526,73 +428,6 @@ declare module "node:sqlite" { */ close(): void; } - /** - * This class represents a single LRU (Least Recently Used) cache for storing - * prepared statements. - * - * Instances of this class are created via the database.createSQLTagStore() method, - * not by using a constructor. The store caches prepared statements based on the - * provided SQL query string. When the same query is seen again, the store - * retrieves the cached statement and safely applies the new values through - * parameter binding, thereby preventing attacks like SQL injection. - * - * The cache has a maxSize that defaults to 1000 statements, but a custom size can - * be provided (e.g., database.createSQLTagStore(100)). All APIs exposed by this - * class execute synchronously. - * @since v24.9.0 - */ - interface SQLTagStore { - /** - * Executes the given SQL query and returns all resulting rows as an array of objects. - * @since v24.9.0 - */ - all( - stringElements: TemplateStringsArray, - ...boundParameters: SQLInputValue[] - ): Record[]; - /** - * Executes the given SQL query and returns the first resulting row as an object. - * @since v24.9.0 - */ - get( - stringElements: TemplateStringsArray, - ...boundParameters: SQLInputValue[] - ): Record | undefined; - /** - * Executes the given SQL query and returns an iterator over the resulting rows. - * @since v24.9.0 - */ - iterate( - stringElements: TemplateStringsArray, - ...boundParameters: SQLInputValue[] - ): NodeJS.Iterator>; - /** - * Executes the given SQL query, which is expected to not return any rows (e.g., INSERT, UPDATE, DELETE). - * @since v24.9.0 - */ - run(stringElements: TemplateStringsArray, ...boundParameters: SQLInputValue[]): StatementResultingChanges; - /** - * A read-only property that returns the number of prepared statements currently in the cache. - * @since v24.9.0 - * @returns The maximum number of prepared statements the cache can hold. - */ - size(): number; - /** - * A read-only property that returns the maximum number of prepared statements the cache can hold. - * @since v24.9.0 - */ - readonly capacity: number; - /** - * A read-only property that returns the `DatabaseSync` object associated with this `SQLTagStore`. - * @since v24.9.0 - */ - readonly db: DatabaseSync; - /** - * Resets the LRU cache, clearing all stored prepared statements. - * @since v24.9.0 - */ - clear(): void; - } interface StatementColumnMetadata { /** * The unaliased name of the column in the origin @@ -672,7 +507,7 @@ declare module "node:sqlite" { /** * This method is used to retrieve information about the columns returned by the * prepared statement. - * @since v23.11.0 + * @since v22.16.0 * @returns An array of objects. Each object corresponds to a column * in the prepared statement, and contains the following properties: */ @@ -761,7 +596,7 @@ declare module "node:sqlite" { /** * When enabled, query results returned by the `all()`, `get()`, and `iterate()` methods will be returned as arrays instead * of objects. - * @since v24.0.0 + * @since v22.16.0 * @param enabled Enables or disables the return of query results as arrays. */ setReturnArrays(enabled: boolean): void; @@ -802,9 +637,8 @@ declare module "node:sqlite" { */ rate?: number | undefined; /** - * An optional callback function that will be called after each backup step. The argument passed - * to this callback is an `Object` with `remainingPages` and `totalPages` properties, describing the current progress - * of the backup operation. + * Callback function that will be called with the number of pages copied and the total number of + * pages. */ progress?: ((progressInfo: BackupProgressInfo) => void) | undefined; } @@ -835,16 +669,15 @@ declare module "node:sqlite" { * * console.log('Backup completed', totalPagesTransferred); * ``` - * @since v23.8.0 + * @since v22.16.0 * @param sourceDb The database to backup. The source database must be open. * @param path The path where the backup will be created. If the file already exists, * the contents will be overwritten. * @param options Optional configuration for the backup. The * following properties are supported: - * @returns A promise that fulfills with the total number of backed-up pages upon completion, or rejects if an - * error occurs. + * @returns A promise that resolves when the backup is completed and rejects if an error occurs. */ - function backup(sourceDb: DatabaseSync, path: PathLike, options?: BackupOptions): Promise; + function backup(sourceDb: DatabaseSync, path: PathLike, options?: BackupOptions): Promise; /** * @since v22.13.0 */ @@ -884,54 +717,5 @@ declare module "node:sqlite" { * @since v22.12.0 */ const SQLITE_CHANGESET_ABORT: number; - /** - * Deny the operation and cause an error to be returned. - * @since v24.10.0 - */ - const SQLITE_DENY: number; - /** - * Ignore the operation and continue as if it had never been requested. - * @since 24.10.0 - */ - const SQLITE_IGNORE: number; - /** - * Allow the operation to proceed normally. - * @since v24.10.0 - */ - const SQLITE_OK: number; - const SQLITE_CREATE_INDEX: number; - const SQLITE_CREATE_TABLE: number; - const SQLITE_CREATE_TEMP_INDEX: number; - const SQLITE_CREATE_TEMP_TABLE: number; - const SQLITE_CREATE_TEMP_TRIGGER: number; - const SQLITE_CREATE_TEMP_VIEW: number; - const SQLITE_CREATE_TRIGGER: number; - const SQLITE_CREATE_VIEW: number; - const SQLITE_DELETE: number; - const SQLITE_DROP_INDEX: number; - const SQLITE_DROP_TABLE: number; - const SQLITE_DROP_TEMP_INDEX: number; - const SQLITE_DROP_TEMP_TABLE: number; - const SQLITE_DROP_TEMP_TRIGGER: number; - const SQLITE_DROP_TEMP_VIEW: number; - const SQLITE_DROP_TRIGGER: number; - const SQLITE_DROP_VIEW: number; - const SQLITE_INSERT: number; - const SQLITE_PRAGMA: number; - const SQLITE_READ: number; - const SQLITE_SELECT: number; - const SQLITE_TRANSACTION: number; - const SQLITE_UPDATE: number; - const SQLITE_ATTACH: number; - const SQLITE_DETACH: number; - const SQLITE_ALTER_TABLE: number; - const SQLITE_REINDEX: number; - const SQLITE_ANALYZE: number; - const SQLITE_CREATE_VTABLE: number; - const SQLITE_DROP_VTABLE: number; - const SQLITE_FUNCTION: number; - const SQLITE_SAVEPOINT: number; - const SQLITE_COPY: number; - const SQLITE_RECURSIVE: number; } } diff --git a/node_modules/@types/node/stream.d.ts b/node_modules/@types/node/stream.d.ts index 3b38302b..5799cc03 100644 --- a/node_modules/@types/node/stream.d.ts +++ b/node_modules/@types/node/stream.d.ts @@ -2,10 +2,10 @@ * A stream is an abstract interface for working with streaming data in Node.js. * The `node:stream` module provides an API for implementing the stream interface. * - * There are many stream objects provided by Node.js. For instance, a [request to an HTTP server](https://nodejs.org/docs/latest-v24.x/api/http.html#class-httpincomingmessage) - * and [`process.stdout`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstdout) are both stream instances. + * There are many stream objects provided by Node.js. For instance, a [request to an HTTP server](https://nodejs.org/docs/latest-v22.x/api/http.html#class-httpincomingmessage) + * and [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) are both stream instances. * - * Streams can be readable, writable, or both. All streams are instances of [`EventEmitter`](https://nodejs.org/docs/latest-v24.x/api/events.html#class-eventemitter). + * Streams can be readable, writable, or both. All streams are instances of [`EventEmitter`](https://nodejs.org/docs/latest-v22.x/api/events.html#class-eventemitter). * * To access the `node:stream` module: * @@ -15,7 +15,7 @@ * * The `node:stream` module is useful for creating new types of stream instances. * It is usually not necessary to use the `node:stream` module to consume streams. - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/stream.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/stream.js) */ declare module "stream" { import { Abortable, EventEmitter } from "node:events"; @@ -118,13 +118,13 @@ declare module "stream" { */ readonly readableEncoding: BufferEncoding | null; /** - * Becomes `true` when [`'end'`](https://nodejs.org/docs/latest-v24.x/api/stream.html#event-end) event is emitted. + * Becomes `true` when [`'end'`](https://nodejs.org/docs/latest-v22.x/api/stream.html#event-end) event is emitted. * @since v12.9.0 */ readonly readableEnded: boolean; /** * This property reflects the current state of a `Readable` stream as described - * in the [Three states](https://nodejs.org/docs/latest-v24.x/api/stream.html#three-states) section. + * in the [Three states](https://nodejs.org/docs/latest-v22.x/api/stream.html#three-states) section. * @since v9.4.0 */ readonly readableFlowing: boolean | null; @@ -615,17 +615,6 @@ declare module "stream" { * @param error Error which will be passed as payload in `'error'` event */ destroy(error?: Error): this; - /** - * @returns `AsyncIterator` to fully consume the stream. - * @since v10.0.0 - */ - [Symbol.asyncIterator](): NodeJS.AsyncIterator; - /** - * Calls `readable.destroy()` with an `AbortError` and returns - * a promise that fulfills when the stream is finished. - * @since v20.4.0 - */ - [Symbol.asyncDispose](): Promise; /** * Event emitter * The defined events on documents including: @@ -693,6 +682,12 @@ declare module "stream" { removeListener(event: "readable", listener: () => void): this; removeListener(event: "resume", listener: () => void): this; removeListener(event: string | symbol, listener: (...args: any[]) => void): this; + [Symbol.asyncIterator](): NodeJS.AsyncIterator; + /** + * Calls `readable.destroy()` with an `AbortError` and returns a promise that fulfills when the stream is finished. + * @since v20.4.0 + */ + [Symbol.asyncDispose](): Promise; } interface WritableOptions extends StreamOptions { decodeStrings?: boolean | undefined; @@ -966,12 +961,6 @@ declare module "stream" { * @param error Optional, an error to emit with `'error'` event. */ destroy(error?: Error): this; - /** - * Calls `writable.destroy()` with an `AbortError` and returns - * a promise that fulfills when the stream is finished. - * @since v22.4.0, v20.16.0 - */ - [Symbol.asyncDispose](): Promise; /** * Event emitter * The defined events on documents including: @@ -1388,7 +1377,7 @@ declare module "stream" { * Especially useful in error handling scenarios where a stream is destroyed * prematurely (like an aborted HTTP request), and will not emit `'end'` or `'finish'`. * - * The `finished` API provides [`promise version`](https://nodejs.org/docs/latest-v24.x/api/stream.html#streamfinishedstream-options). + * The `finished` API provides [`promise version`](https://nodejs.org/docs/latest-v22.x/api/stream.html#streamfinishedstream-options). * * `stream.finished()` leaves dangling event listeners (in particular `'error'`, `'end'`, `'finish'` and `'close'`) after `callback` has been * invoked. The reason for this is so that unexpected `'error'` events (due to @@ -1476,7 +1465,7 @@ declare module "stream" { * ); * ``` * - * The `pipeline` API provides a [`promise version`](https://nodejs.org/docs/latest-v24.x/api/stream.html#streampipelinesource-transforms-destination-options). + * The `pipeline` API provides a [`promise version`](https://nodejs.org/docs/latest-v22.x/api/stream.html#streampipelinesource-transforms-destination-options). * * `stream.pipeline()` will call `stream.destroy(err)` on all streams except: * @@ -1656,7 +1645,6 @@ declare module "stream" { ref(): void; unref(): void; } - // TODO: these should all take webstream arguments /** * Returns whether the stream has encountered an error. * @since v17.3.0, v16.14.0 @@ -1665,15 +1653,8 @@ declare module "stream" { /** * Returns whether the stream is readable. * @since v17.4.0, v16.14.0 - * @returns Only returns `null` if `stream` is not a valid `Readable`, `Duplex` or `ReadableStream`. - */ - function isReadable(stream: Readable | NodeJS.ReadableStream): boolean | null; - /** - * Returns whether the stream is writable. - * @since v20.0.0 - * @returns Only returns `null` if `stream` is not a valid `Writable`, `Duplex` or `WritableStream`. */ - function isWritable(stream: Writable | NodeJS.WritableStream): boolean | null; + function isReadable(stream: Readable | NodeJS.ReadableStream): boolean; } export = Stream; } diff --git a/node_modules/@types/node/stream/web.d.ts b/node_modules/@types/node/stream/web.d.ts index bc7c011c..881e29c0 100644 --- a/node_modules/@types/node/stream/web.d.ts +++ b/node_modules/@types/node/stream/web.d.ts @@ -1,7 +1,11 @@ type _ByteLengthQueuingStrategy = typeof globalThis extends { onmessage: any } ? {} : import("stream/web").ByteLengthQueuingStrategy; +type _CompressionStream = typeof globalThis extends { onmessage: any; ReportingObserver: any } ? {} + : import("stream/web").CompressionStream; type _CountQueuingStrategy = typeof globalThis extends { onmessage: any } ? {} : import("stream/web").CountQueuingStrategy; +type _DecompressionStream = typeof globalThis extends { onmessage: any; ReportingObserver: any } ? {} + : import("stream/web").DecompressionStream; type _QueuingStrategy = typeof globalThis extends { onmessage: any } ? {} : import("stream/web").QueuingStrategy; type _ReadableByteStreamController = typeof globalThis extends { onmessage: any } ? {} @@ -408,17 +412,22 @@ declare module "stream/web" { prototype: TextDecoderStream; new(encoding?: string, options?: TextDecoderOptions): TextDecoderStream; }; - type CompressionFormat = "brotli" | "deflate" | "deflate-raw" | "gzip"; - class CompressionStream { - constructor(format: CompressionFormat); + interface CompressionStream { readonly readable: ReadableStream; readonly writable: WritableStream; } - class DecompressionStream { - constructor(format: CompressionFormat); - readonly readable: ReadableStream; + const CompressionStream: { + prototype: CompressionStream; + new(format: "deflate" | "deflate-raw" | "gzip"): CompressionStream; + }; + interface DecompressionStream { readonly writable: WritableStream; + readonly readable: ReadableStream; } + const DecompressionStream: { + prototype: DecompressionStream; + new(format: "deflate" | "deflate-raw" | "gzip"): DecompressionStream; + }; global { interface ByteLengthQueuingStrategy extends _ByteLengthQueuingStrategy {} @@ -431,6 +440,26 @@ declare module "stream/web" { ? T : typeof import("stream/web").ByteLengthQueuingStrategy; + interface CompressionStream extends _CompressionStream {} + /** + * `CompressionStream` class is a global reference for `import { CompressionStream } from 'node:stream/web'`. + * https://nodejs.org/api/globals.html#class-compressionstream + * @since v18.0.0 + */ + var CompressionStream: typeof globalThis extends { + onmessage: any; + // CompressionStream, DecompressionStream and ReportingObserver was introduced in the same commit. + // If ReportingObserver check is removed, the type here will form a circular reference in TS5.0+lib.dom.d.ts + ReportingObserver: any; + CompressionStream: infer T; + } ? T + // TS 4.8, 4.9, 5.0 + : typeof globalThis extends { onmessage: any; TransformStream: { prototype: infer T } } ? { + prototype: T; + new(format: "deflate" | "deflate-raw" | "gzip"): T; + } + : typeof import("stream/web").CompressionStream; + interface CountQueuingStrategy extends _CountQueuingStrategy {} /** * `CountQueuingStrategy` class is a global reference for `import { CountQueuingStrategy } from 'node:stream/web'`. @@ -440,6 +469,26 @@ declare module "stream/web" { var CountQueuingStrategy: typeof globalThis extends { onmessage: any; CountQueuingStrategy: infer T } ? T : typeof import("stream/web").CountQueuingStrategy; + interface DecompressionStream extends _DecompressionStream {} + /** + * `DecompressionStream` class is a global reference for `import { DecompressionStream } from 'node:stream/web'`. + * https://nodejs.org/api/globals.html#class-decompressionstream + * @since v18.0.0 + */ + var DecompressionStream: typeof globalThis extends { + onmessage: any; + // CompressionStream, DecompressionStream and ReportingObserver was introduced in the same commit. + // If ReportingObserver check is removed, the type here will form a circular reference in TS5.0+lib.dom.d.ts + ReportingObserver: any; + DecompressionStream: infer T extends object; + } ? T + // TS 4.8, 4.9, 5.0 + : typeof globalThis extends { onmessage: any; TransformStream: { prototype: infer T } } ? { + prototype: T; + new(format: "deflate" | "deflate-raw" | "gzip"): T; + } + : typeof import("stream/web").DecompressionStream; + interface QueuingStrategy extends _QueuingStrategy {} interface ReadableByteStreamController extends _ReadableByteStreamController {} diff --git a/node_modules/@types/node/string_decoder.d.ts b/node_modules/@types/node/string_decoder.d.ts index bcd64d5a..d8b9be86 100644 --- a/node_modules/@types/node/string_decoder.d.ts +++ b/node_modules/@types/node/string_decoder.d.ts @@ -36,7 +36,7 @@ * decoder.write(Buffer.from([0x82])); * console.log(decoder.end(Buffer.from([0xAC]))); // Prints: € * ``` - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/string_decoder.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/string_decoder.js) */ declare module "string_decoder" { class StringDecoder { diff --git a/node_modules/@types/node/test.d.ts b/node_modules/@types/node/test.d.ts index e1f103d7..1c173f6a 100644 --- a/node_modules/@types/node/test.d.ts +++ b/node_modules/@types/node/test.d.ts @@ -76,7 +76,7 @@ * * If any tests fail, the process exit code is set to `1`. * @since v18.0.0, v16.17.0 - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/test.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/test.js) */ declare module "node:test" { import { AssertMethodNames } from "node:assert"; @@ -240,17 +240,9 @@ declare module "node:test" { * @default false */ concurrency?: number | boolean | undefined; - /** - * Specifies the current working directory to be used by the test runner. - * Serves as the base path for resolving files according to the - * [test runner execution model](https://nodejs.org/docs/latest-v24.x/api/test.html#test-runner-execution-model). - * @since v23.0.0 - * @default process.cwd() - */ - cwd?: string | undefined; /** * An array containing the list of files to run. If omitted, files are run according to the - * [test runner execution model](https://nodejs.org/docs/latest-v24.x/api/test.html#test-runner-execution-model). + * [test runner execution model](https://nodejs.org/docs/latest-v22.x/api/test.html#test-runner-execution-model). */ files?: readonly string[] | undefined; /** @@ -263,7 +255,7 @@ declare module "node:test" { /** * An array containing the list of glob patterns to match test files. * This option cannot be used together with `files`. If omitted, files are run according to the - * [test runner execution model](https://nodejs.org/docs/latest-v24.x/api/test.html#test-runner-execution-model). + * [test runner execution model](https://nodejs.org/docs/latest-v22.x/api/test.html#test-runner-execution-model). * @since v22.6.0 */ globPatterns?: readonly string[] | undefined; @@ -344,14 +336,7 @@ declare module "node:test" { */ shard?: TestShard | undefined; /** - * A file path where the test runner will - * store the state of the tests to allow rerunning only the failed tests on a next run. - * @since v24.7.0 - * @default undefined - */ - rerunFailuresFilePath?: string | undefined; - /** - * enable [code coverage](https://nodejs.org/docs/latest-v24.x/api/test.html#collecting-code-coverage) collection. + * enable [code coverage](https://nodejs.org/docs/latest-v22.x/api/test.html#collecting-code-coverage) collection. * @since v22.10.0 * @default false */ @@ -418,7 +403,6 @@ declare module "node:test" { addListener(event: "test:stdout", listener: (data: EventData.TestStdout) => void): this; addListener(event: "test:summary", listener: (data: EventData.TestSummary) => void): this; addListener(event: "test:watch:drained", listener: () => void): this; - addListener(event: "test:watch:restarted", listener: () => void): this; addListener(event: string, listener: (...args: any[]) => void): this; emit(event: "test:coverage", data: EventData.TestCoverage): boolean; emit(event: "test:complete", data: EventData.TestComplete): boolean; @@ -433,7 +417,6 @@ declare module "node:test" { emit(event: "test:stdout", data: EventData.TestStdout): boolean; emit(event: "test:summary", data: EventData.TestSummary): boolean; emit(event: "test:watch:drained"): boolean; - emit(event: "test:watch:restarted"): boolean; emit(event: string | symbol, ...args: any[]): boolean; on(event: "test:coverage", listener: (data: EventData.TestCoverage) => void): this; on(event: "test:complete", listener: (data: EventData.TestComplete) => void): this; @@ -448,7 +431,6 @@ declare module "node:test" { on(event: "test:stdout", listener: (data: EventData.TestStdout) => void): this; on(event: "test:summary", listener: (data: EventData.TestSummary) => void): this; on(event: "test:watch:drained", listener: () => void): this; - on(event: "test:watch:restarted", listener: () => void): this; on(event: string, listener: (...args: any[]) => void): this; once(event: "test:coverage", listener: (data: EventData.TestCoverage) => void): this; once(event: "test:complete", listener: (data: EventData.TestComplete) => void): this; @@ -463,7 +445,6 @@ declare module "node:test" { once(event: "test:stdout", listener: (data: EventData.TestStdout) => void): this; once(event: "test:summary", listener: (data: EventData.TestSummary) => void): this; once(event: "test:watch:drained", listener: () => void): this; - once(event: "test:watch:restarted", listener: () => void): this; once(event: string, listener: (...args: any[]) => void): this; prependListener(event: "test:coverage", listener: (data: EventData.TestCoverage) => void): this; prependListener(event: "test:complete", listener: (data: EventData.TestComplete) => void): this; @@ -478,7 +459,6 @@ declare module "node:test" { prependListener(event: "test:stdout", listener: (data: EventData.TestStdout) => void): this; prependListener(event: "test:summary", listener: (data: EventData.TestSummary) => void): this; prependListener(event: "test:watch:drained", listener: () => void): this; - prependListener(event: "test:watch:restarted", listener: () => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; prependOnceListener(event: "test:coverage", listener: (data: EventData.TestCoverage) => void): this; prependOnceListener(event: "test:complete", listener: (data: EventData.TestComplete) => void): this; @@ -493,7 +473,6 @@ declare module "node:test" { prependOnceListener(event: "test:stdout", listener: (data: EventData.TestStdout) => void): this; prependOnceListener(event: "test:summary", listener: (data: EventData.TestSummary) => void): this; prependOnceListener(event: "test:watch:drained", listener: () => void): this; - prependOnceListener(event: "test:watch:restarted", listener: () => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; } namespace EventData { @@ -718,7 +697,7 @@ declare module "node:test" { /** * The type of the test, used to denote whether this is a suite. */ - type?: "suite" | "test"; + type?: "suite"; }; /** * The test name. @@ -788,13 +767,7 @@ declare module "node:test" { * The type of the test, used to denote whether this is a suite. * @since v20.0.0, v19.9.0, v18.17.0 */ - type?: "suite" | "test"; - /** - * The attempt number of the test run, - * present only when using the `--test-rerun-failures` flag. - * @since v24.7.0 - */ - attempt?: number; + type?: "suite"; }; /** * The test name. @@ -830,19 +803,7 @@ declare module "node:test" { * The type of the test, used to denote whether this is a suite. * @since 20.0.0, 19.9.0, 18.17.0 */ - type?: "suite" | "test"; - /** - * The attempt number of the test run, - * present only when using the `--test-rerun-failures` flag. - * @since v24.7.0 - */ - attempt?: number; - /** - * The attempt number the test passed on, - * present only when using the `--test-rerun-failures` flag. - * @since v24.7.0 - */ - passed_on_attempt?: number; + type?: "suite"; }; /** * The test name. @@ -987,7 +948,6 @@ declare module "node:test" { * @since v22.2.0, v20.15.0 */ readonly assert: TestContextAssert; - readonly attempt: number; /** * This function is used to create a hook running before subtest of the current test. * @param fn The hook function. The first argument to this function is a `TestContext` object. @@ -1218,7 +1178,7 @@ declare module "node:test" { * highlighting. * @since v22.14.0 * @param value A value to serialize to a string. If Node.js was started with - * the [`--test-update-snapshots`](https://nodejs.org/docs/latest-v24.x/api/cli.html#--test-update-snapshots) + * the [`--test-update-snapshots`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--test-update-snapshots) * flag, the serialized value is written to * `path`. Otherwise, the serialized value is compared to the contents of the * existing snapshot file. @@ -1241,7 +1201,7 @@ declare module "node:test" { * ``` * @since v22.3.0 * @param value A value to serialize to a string. If Node.js was started with - * the [`--test-update-snapshots`](https://nodejs.org/docs/latest-v24.x/api/cli.html#--test-update-snapshots) + * the [`--test-update-snapshots`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--test-update-snapshots) * flag, the serialized value is written to * the snapshot file. Otherwise, the serialized value is compared to the * corresponding value in the existing snapshot file. @@ -1669,89 +1629,16 @@ declare module "node:test" { options?: MockFunctionOptions, ): Mock<((value: MockedObject[MethodName]) => void) | Implementation>; /** - * This function is used to mock the exports of ECMAScript modules, CommonJS modules, JSON modules, and - * Node.js builtin modules. Any references to the original module prior to mocking are not impacted. In - * order to enable module mocking, Node.js must be started with the - * [`--experimental-test-module-mocks`](https://nodejs.org/docs/latest-v24.x/api/cli.html#--experimental-test-module-mocks) - * command-line flag. - * - * The following example demonstrates how a mock is created for a module. - * - * ```js - * test('mocks a builtin module in both module systems', async (t) => { - * // Create a mock of 'node:readline' with a named export named 'fn', which - * // does not exist in the original 'node:readline' module. - * const mock = t.mock.module('node:readline', { - * namedExports: { fn() { return 42; } }, - * }); + * This function is used to mock the exports of ECMAScript modules, CommonJS modules, and Node.js builtin modules. + * Any references to the original module prior to mocking are not impacted. * - * let esmImpl = await import('node:readline'); - * let cjsImpl = require('node:readline'); - * - * // cursorTo() is an export of the original 'node:readline' module. - * assert.strictEqual(esmImpl.cursorTo, undefined); - * assert.strictEqual(cjsImpl.cursorTo, undefined); - * assert.strictEqual(esmImpl.fn(), 42); - * assert.strictEqual(cjsImpl.fn(), 42); - * - * mock.restore(); - * - * // The mock is restored, so the original builtin module is returned. - * esmImpl = await import('node:readline'); - * cjsImpl = require('node:readline'); - * - * assert.strictEqual(typeof esmImpl.cursorTo, 'function'); - * assert.strictEqual(typeof cjsImpl.cursorTo, 'function'); - * assert.strictEqual(esmImpl.fn, undefined); - * assert.strictEqual(cjsImpl.fn, undefined); - * }); - * ``` + * Only available through the [--experimental-test-module-mocks](https://nodejs.org/api/cli.html#--experimental-test-module-mocks) flag. * @since v22.3.0 * @experimental * @param specifier A string identifying the module to mock. * @param options Optional configuration options for the mock module. */ module(specifier: string, options?: MockModuleOptions): MockModuleContext; - /** - * Creates a mock for a property value on an object. This allows you to track and control access to a specific property, - * including how many times it is read (getter) or written (setter), and to restore the original value after mocking. - * - * ```js - * test('mocks a property value', (t) => { - * const obj = { foo: 42 }; - * const prop = t.mock.property(obj, 'foo', 100); - * - * assert.strictEqual(obj.foo, 100); - * assert.strictEqual(prop.mock.accessCount(), 1); - * assert.strictEqual(prop.mock.accesses[0].type, 'get'); - * assert.strictEqual(prop.mock.accesses[0].value, 100); - * - * obj.foo = 200; - * assert.strictEqual(prop.mock.accessCount(), 2); - * assert.strictEqual(prop.mock.accesses[1].type, 'set'); - * assert.strictEqual(prop.mock.accesses[1].value, 200); - * - * prop.mock.restore(); - * assert.strictEqual(obj.foo, 42); - * }); - * ``` - * @since v24.3.0 - * @param object The object whose value is being mocked. - * @param propertyName The identifier of the property on `object` to mock. - * @param value An optional value used as the mock value - * for `object[propertyName]`. **Default:** The original property value. - * @returns A proxy to the mocked object. The mocked object contains a - * special `mock` property, which is an instance of [`MockPropertyContext`][], and - * can be used for inspecting and changing the behavior of the mocked property. - */ - property< - MockedObject extends object, - PropertyName extends keyof MockedObject, - >( - object: MockedObject, - property: PropertyName, - value?: MockedObject[PropertyName], - ): MockedObject & { mock: MockPropertyContext }; /** * This function restores the default behavior of all mocks that were previously * created by this `MockTracker` and disassociates the mocks from the `MockTracker` instance. Once disassociated, the mocks can still be used, but the `MockTracker` instance can no longer be @@ -1921,70 +1808,6 @@ declare module "node:test" { */ restore(): void; } - /** - * @since v24.3.0 - */ - class MockPropertyContext { - /** - * A getter that returns a copy of the internal array used to track accesses (get/set) to - * the mocked property. Each entry in the array is an object with the following properties: - */ - readonly accesses: Array<{ - type: "get" | "set"; - value: PropertyType; - stack: Error; - }>; - /** - * This function returns the number of times that the property was accessed. - * This function is more efficient than checking `ctx.accesses.length` because - * `ctx.accesses` is a getter that creates a copy of the internal access tracking array. - * @returns The number of times that the property was accessed (read or written). - */ - accessCount(): number; - /** - * This function is used to change the value returned by the mocked property getter. - * @param value The new value to be set as the mocked property value. - */ - mockImplementation(value: PropertyType): void; - /** - * This function is used to change the behavior of an existing mock for a single - * invocation. Once invocation `onAccess` has occurred, the mock will revert to - * whatever behavior it would have used had `mockImplementationOnce()` not been - * called. - * - * The following example creates a mock function using `t.mock.property()`, calls the - * mock property, changes the mock implementation to a different value for the - * next invocation, and then resumes its previous behavior. - * - * ```js - * test('changes a mock behavior once', (t) => { - * const obj = { foo: 1 }; - * - * const prop = t.mock.property(obj, 'foo', 5); - * - * assert.strictEqual(obj.foo, 5); - * prop.mock.mockImplementationOnce(25); - * assert.strictEqual(obj.foo, 25); - * assert.strictEqual(obj.foo, 5); - * }); - * ``` - * @param value The value to be used as the mock's - * implementation for the invocation number specified by `onAccess`. - * @param onAccess The invocation number that will use `value`. If - * the specified invocation has already occurred then an exception is thrown. - * **Default:** The number of the next invocation. - */ - mockImplementationOnce(value: PropertyType, onAccess?: number): void; - /** - * Resets the access history of the mocked property. - */ - resetAccesses(): void; - /** - * Resets the implementation of the mock property to its original behavior. The - * mock can still be used after calling this function. - */ - restore(): void; - } interface MockTimersOptions { apis: ReadonlyArray<"setInterval" | "setTimeout" | "setImmediate" | "Date">; now?: number | Date | undefined; @@ -2000,6 +1823,7 @@ declare module "node:test" { * The `MockTracker` provides a top-level `timers` export * which is a `MockTimers` instance. * @since v20.4.0 + * @experimental */ interface MockTimers { /** @@ -2272,7 +2096,7 @@ declare module "node:test" { * import test from 'node:test/reporters'; * ``` * @since v19.9.0 - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/test/reporters.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/test/reporters.js) */ declare module "node:test/reporters" { import { Transform, TransformOptions } from "node:stream"; @@ -2291,8 +2115,7 @@ declare module "node:test/reporters" { | { type: "test:stderr"; data: EventData.TestStderr } | { type: "test:stdout"; data: EventData.TestStdout } | { type: "test:summary"; data: EventData.TestSummary } - | { type: "test:watch:drained"; data: undefined } - | { type: "test:watch:restarted"; data: undefined }; + | { type: "test:watch:drained"; data: undefined }; type TestEventGenerator = AsyncGenerator; interface ReporterConstructorWrapper Transform> { @@ -2330,10 +2153,10 @@ declare module "node:test/reporters" { } /** * The `lcov` reporter outputs test coverage when used with the - * [`--experimental-test-coverage`](https://nodejs.org/docs/latest-v24.x/api/cli.html#--experimental-test-coverage) flag. + * [`--experimental-test-coverage`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--experimental-test-coverage) flag. * @since v22.0.0 */ - const lcov: ReporterConstructorWrapper; + const lcov: LcovReporter; export { dot, junit, lcov, spec, tap, TestEvent }; } diff --git a/node_modules/@types/node/timers.d.ts b/node_modules/@types/node/timers.d.ts index 30a91c06..44bc977e 100644 --- a/node_modules/@types/node/timers.d.ts +++ b/node_modules/@types/node/timers.d.ts @@ -6,7 +6,7 @@ * The timer functions within Node.js implement a similar API as the timers API * provided by Web Browsers but use a different internal implementation that is * built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout). - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/timers.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/timers.js) */ declare module "timers" { import { Abortable } from "node:events"; @@ -60,6 +60,7 @@ declare module "timers" { /** * Cancels the immediate. This is similar to calling `clearImmediate()`. * @since v20.5.0, v18.18.0 + * @experimental */ [Symbol.dispose](): void; _onImmediate(...args: any[]): void; @@ -140,6 +141,7 @@ declare module "timers" { /** * Cancels the timeout. * @since v20.5.0, v18.18.0 + * @experimental */ [Symbol.dispose](): void; _onTimeout(...args: any[]): void; diff --git a/node_modules/@types/node/timers/promises.d.ts b/node_modules/@types/node/timers/promises.d.ts index 7ad2b297..05db90c6 100644 --- a/node_modules/@types/node/timers/promises.d.ts +++ b/node_modules/@types/node/timers/promises.d.ts @@ -11,7 +11,7 @@ * } from 'node:timers/promises'; * ``` * @since v15.0.0 - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/timers/promises.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/timers/promises.js) */ declare module "timers/promises" { import { TimerOptions } from "node:timers"; diff --git a/node_modules/@types/node/tls.d.ts b/node_modules/@types/node/tls.d.ts index 5d52de81..86e96b89 100644 --- a/node_modules/@types/node/tls.d.ts +++ b/node_modules/@types/node/tls.d.ts @@ -6,7 +6,7 @@ * ```js * import tls from 'node:tls'; * ``` - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/tls.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/tls.js) */ declare module "tls" { import { NonSharedBuffer } from "node:buffer"; @@ -821,6 +821,13 @@ declare module "tls" { prependOnceListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; prependOnceListener(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: TLSSocket) => void): this; } + /** + * @deprecated since v0.11.3 Use `tls.TLSSocket` instead. + */ + interface SecurePair { + encrypted: TLSSocket; + cleartext: TLSSocket; + } type SecureVersion = "TLSv1.3" | "TLSv1.2" | "TLSv1.1" | "TLSv1"; interface SecureContextOptions { /** @@ -1119,6 +1126,45 @@ declare module "tls" { secureConnectListener?: () => void, ): TLSSocket; function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; + /** + * Creates a new secure pair object with two streams, one of which reads and writes + * the encrypted data and the other of which reads and writes the cleartext data. + * Generally, the encrypted stream is piped to/from an incoming encrypted data + * stream and the cleartext one is used as a replacement for the initial encrypted + * stream. + * + * `tls.createSecurePair()` returns a `tls.SecurePair` object with `cleartext` and `encrypted` stream properties. + * + * Using `cleartext` has the same API as {@link TLSSocket}. + * + * The `tls.createSecurePair()` method is now deprecated in favor of`tls.TLSSocket()`. For example, the code: + * + * ```js + * pair = tls.createSecurePair(// ... ); + * pair.encrypted.pipe(socket); + * socket.pipe(pair.encrypted); + * ``` + * + * can be replaced by: + * + * ```js + * secureSocket = tls.TLSSocket(socket, options); + * ``` + * + * where `secureSocket` has the same API as `pair.cleartext`. + * @since v0.3.2 + * @deprecated Since v0.11.3 - Use {@link TLSSocket} instead. + * @param context A secure context object as returned by `tls.createSecureContext()` + * @param isServer `true` to specify that this TLS connection should be opened as a server. + * @param requestCert `true` to specify whether a server should request a certificate from a connecting client. Only applies when `isServer` is `true`. + * @param rejectUnauthorized If not `false` a server automatically reject clients with invalid certificates. Only applies when `isServer` is `true`. + */ + function createSecurePair( + context?: SecureContext, + isServer?: boolean, + requestCert?: boolean, + rejectUnauthorized?: boolean, + ): SecurePair; /** * `{@link createServer}` sets the default value of the `honorCipherOrder` option * to `true`, other APIs that create secure contexts leave it unset. @@ -1175,7 +1221,7 @@ declare module "tls" { * the `ciphers` option of `{@link createSecureContext}`. * * Not all supported ciphers are enabled by default. See - * [Modifying the default TLS cipher suite](https://nodejs.org/docs/latest-v24.x/api/tls.html#modifying-the-default-tls-cipher-suite). + * [Modifying the default TLS cipher suite](https://nodejs.org/docs/latest-v22.x/api/tls.html#modifying-the-default-tls-cipher-suite). * * Cipher names that start with `'tls_'` are for TLSv1.3, all the others are for * TLSv1.2 and below. @@ -1214,7 +1260,7 @@ declare module "tls" { * const additionalCerts = ['-----BEGIN CERTIFICATE-----\n...']; * tls.setDefaultCACertificates([...currentCerts, ...additionalCerts]); * ``` - * @since v24.5.0 + * @since v22.19.0 * @param certs An array of CA certificates in PEM format. */ function setDefaultCACertificates(certs: ReadonlyArray): void; diff --git a/node_modules/@types/node/trace_events.d.ts b/node_modules/@types/node/trace_events.d.ts index 56e46209..f334b0bc 100644 --- a/node_modules/@types/node/trace_events.d.ts +++ b/node_modules/@types/node/trace_events.d.ts @@ -9,8 +9,8 @@ * The available categories are: * * * `node`: An empty placeholder. - * * `node.async_hooks`: Enables capture of detailed [`async_hooks`](https://nodejs.org/docs/latest-v24.x/api/async_hooks.html) trace data. - * The [`async_hooks`](https://nodejs.org/docs/latest-v24.x/api/async_hooks.html) events have a unique `asyncId` and a special `triggerId` `triggerAsyncId` property. + * * `node.async_hooks`: Enables capture of detailed [`async_hooks`](https://nodejs.org/docs/latest-v22.x/api/async_hooks.html) trace data. + * The [`async_hooks`](https://nodejs.org/docs/latest-v22.x/api/async_hooks.html) events have a unique `asyncId` and a special `triggerId` `triggerAsyncId` property. * * `node.bootstrap`: Enables capture of Node.js bootstrap milestones. * * `node.console`: Enables capture of `console.time()` and `console.count()` output. * * `node.threadpoolwork.sync`: Enables capture of trace data for threadpool synchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`. @@ -22,7 +22,7 @@ * * `node.fs_dir.sync`: Enables capture of trace data for file system sync directory methods. * * `node.fs.async`: Enables capture of trace data for file system async methods. * * `node.fs_dir.async`: Enables capture of trace data for file system async directory methods. - * * `node.perf`: Enables capture of [Performance API](https://nodejs.org/docs/latest-v24.x/api/perf_hooks.html) measurements. + * * `node.perf`: Enables capture of [Performance API](https://nodejs.org/docs/latest-v22.x/api/perf_hooks.html) measurements. * * `node.perf.usertiming`: Enables capture of only Performance API User Timing * measures and marks. * * `node.perf.timerify`: Enables capture of only Performance API timerify @@ -30,7 +30,7 @@ * * `node.promises.rejections`: Enables capture of trace data tracking the number * of unhandled Promise rejections and handled-after-rejections. * * `node.vm.script`: Enables capture of trace data for the `node:vm` module's `runInNewContext()`, `runInContext()`, and `runInThisContext()` methods. - * * `v8`: The [V8](https://nodejs.org/docs/latest-v24.x/api/v8.html) events are GC, compiling, and execution related. + * * `v8`: The [V8](https://nodejs.org/docs/latest-v22.x/api/v8.html) events are GC, compiling, and execution related. * * `node.http`: Enables capture of trace data for http request / response. * * By default the `node`, `node.async_hooks`, and `v8` categories are enabled. @@ -88,9 +88,9 @@ * However the trace-event timestamps are expressed in microseconds, * unlike `process.hrtime()` which returns nanoseconds. * - * The features from this module are not available in [`Worker`](https://nodejs.org/docs/latest-v24.x/api/worker_threads.html#class-worker) threads. + * The features from this module are not available in [`Worker`](https://nodejs.org/docs/latest-v22.x/api/worker_threads.html#class-worker) threads. * @experimental - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/trace_events.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/trace_events.js) */ declare module "trace_events" { /** diff --git a/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts b/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts deleted file mode 100644 index f148cc4f..00000000 --- a/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +++ /dev/null @@ -1,71 +0,0 @@ -// Interface declaration for Float16Array, required in @types/node v24+. -// These definitions are specific to TS <=5.6. - -// This needs all of the "common" properties/methods of the TypedArrays, -// otherwise the type unions `TypedArray` and `ArrayBufferView` will be -// empty objects. -interface Float16Array extends Pick { - readonly BYTES_PER_ELEMENT: number; - readonly buffer: ArrayBufferLike; - readonly byteLength: number; - readonly byteOffset: number; - readonly length: number; - readonly [Symbol.toStringTag]: "Float16Array"; - at(index: number): number | undefined; - copyWithin(target: number, start: number, end?: number): this; - every(predicate: (value: number, index: number, array: Float16Array) => unknown, thisArg?: any): boolean; - fill(value: number, start?: number, end?: number): this; - filter(predicate: (value: number, index: number, array: Float16Array) => any, thisArg?: any): Float16Array; - find(predicate: (value: number, index: number, obj: Float16Array) => boolean, thisArg?: any): number | undefined; - findIndex(predicate: (value: number, index: number, obj: Float16Array) => boolean, thisArg?: any): number; - findLast( - predicate: (value: number, index: number, array: Float16Array) => value is S, - thisArg?: any, - ): S | undefined; - findLast( - predicate: (value: number, index: number, array: Float16Array) => unknown, - thisArg?: any, - ): number | undefined; - findLastIndex(predicate: (value: number, index: number, array: Float16Array) => unknown, thisArg?: any): number; - forEach(callbackfn: (value: number, index: number, array: Float16Array) => void, thisArg?: any): void; - includes(searchElement: number, fromIndex?: number): boolean; - indexOf(searchElement: number, fromIndex?: number): number; - join(separator?: string): string; - lastIndexOf(searchElement: number, fromIndex?: number): number; - map(callbackfn: (value: number, index: number, array: Float16Array) => number, thisArg?: any): Float16Array; - reduce( - callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float16Array) => number, - ): number; - reduce( - callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float16Array) => number, - initialValue: number, - ): number; - reduce( - callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float16Array) => U, - initialValue: U, - ): U; - reduceRight( - callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float16Array) => number, - ): number; - reduceRight( - callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float16Array) => number, - initialValue: number, - ): number; - reduceRight( - callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float16Array) => U, - initialValue: U, - ): U; - reverse(): Float16Array; - set(array: ArrayLike, offset?: number): void; - slice(start?: number, end?: number): Float16Array; - some(predicate: (value: number, index: number, array: Float16Array) => unknown, thisArg?: any): boolean; - sort(compareFn?: (a: number, b: number) => number): this; - subarray(begin?: number, end?: number): Float16Array; - toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string; - toReversed(): Float16Array; - toSorted(compareFn?: (a: number, b: number) => number): Float16Array; - toString(): string; - valueOf(): Float16Array; - with(index: number, value: number): Float16Array; - [index: number]: number; -} diff --git a/node_modules/@types/node/ts5.6/globals.typedarray.d.ts b/node_modules/@types/node/ts5.6/globals.typedarray.d.ts index 57a1ab4f..f1c444d1 100644 --- a/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +++ b/node_modules/@types/node/ts5.6/globals.typedarray.d.ts @@ -12,7 +12,6 @@ declare global { | Int32Array | BigUint64Array | BigInt64Array - | Float16Array | Float32Array | Float64Array; type ArrayBufferView = TypedArray | DataView; @@ -26,7 +25,6 @@ declare global { type NonSharedInt32Array = Int32Array; type NonSharedBigUint64Array = BigUint64Array; type NonSharedBigInt64Array = BigInt64Array; - type NonSharedFloat16Array = Float16Array; type NonSharedFloat32Array = Float32Array; type NonSharedFloat64Array = Float64Array; type NonSharedDataView = DataView; diff --git a/node_modules/@types/node/ts5.6/index.d.ts b/node_modules/@types/node/ts5.6/index.d.ts index 52c18699..5a5af42a 100644 --- a/node_modules/@types/node/ts5.6/index.d.ts +++ b/node_modules/@types/node/ts5.6/index.d.ts @@ -22,32 +22,26 @@ * IN THE SOFTWARE. */ -// NOTE: These definitions support Node.js and TypeScript 5.2 through 5.6. +// NOTE: These definitions support Node.js and TypeScript 4.9 through 5.6. -// Reference required TypeScript libraries: +// Reference required TypeScript libs: /// -/// -// TypeScript library polyfills required for TypeScript <=5.6: -/// +// TypeScript backwards-compatibility definitions: +/// -// Iterator definitions required for compatibility with TypeScript <5.6: -/// - -// Definitions for Node.js modules specific to TypeScript <=5.6: +// Definitions specific to TypeScript 4.9 through 5.6: /// /// // Definitions for Node.js modules that are not specific to any version of TypeScript: /// /// -/// /// /// /// /// /// -/// /// /// /// diff --git a/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts b/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts deleted file mode 100644 index 110b1ebb..00000000 --- a/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +++ /dev/null @@ -1,72 +0,0 @@ -// Interface declaration for Float16Array, required in @types/node v24+. -// These definitions are specific to TS 5.7. - -// This needs all of the "common" properties/methods of the TypedArrays, -// otherwise the type unions `TypedArray` and `ArrayBufferView` will be -// empty objects. -interface Float16Array { - readonly BYTES_PER_ELEMENT: number; - readonly buffer: TArrayBuffer; - readonly byteLength: number; - readonly byteOffset: number; - readonly length: number; - readonly [Symbol.toStringTag]: "Float16Array"; - at(index: number): number | undefined; - copyWithin(target: number, start: number, end?: number): this; - entries(): ArrayIterator<[number, number]>; - every(predicate: (value: number, index: number, array: this) => unknown, thisArg?: any): boolean; - fill(value: number, start?: number, end?: number): this; - filter(predicate: (value: number, index: number, array: this) => any, thisArg?: any): Float16Array; - find(predicate: (value: number, index: number, obj: this) => boolean, thisArg?: any): number | undefined; - findIndex(predicate: (value: number, index: number, obj: this) => boolean, thisArg?: any): number; - findLast( - predicate: (value: number, index: number, array: this) => value is S, - thisArg?: any, - ): S | undefined; - findLast(predicate: (value: number, index: number, array: this) => unknown, thisArg?: any): number | undefined; - findLastIndex(predicate: (value: number, index: number, array: this) => unknown, thisArg?: any): number; - forEach(callbackfn: (value: number, index: number, array: this) => void, thisArg?: any): void; - includes(searchElement: number, fromIndex?: number): boolean; - indexOf(searchElement: number, fromIndex?: number): number; - join(separator?: string): string; - keys(): ArrayIterator; - lastIndexOf(searchElement: number, fromIndex?: number): number; - map(callbackfn: (value: number, index: number, array: this) => number, thisArg?: any): Float16Array; - reduce( - callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: this) => number, - ): number; - reduce( - callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: this) => number, - initialValue: number, - ): number; - reduce( - callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: this) => U, - initialValue: U, - ): U; - reduceRight( - callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: this) => number, - ): number; - reduceRight( - callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: this) => number, - initialValue: number, - ): number; - reduceRight( - callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: this) => U, - initialValue: U, - ): U; - reverse(): this; - set(array: ArrayLike, offset?: number): void; - slice(start?: number, end?: number): Float16Array; - some(predicate: (value: number, index: number, array: this) => unknown, thisArg?: any): boolean; - sort(compareFn?: (a: number, b: number) => number): this; - subarray(begin?: number, end?: number): Float16Array; - toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string; - toReversed(): Float16Array; - toSorted(compareFn?: (a: number, b: number) => number): Float16Array; - toString(): string; - valueOf(): this; - values(): ArrayIterator; - with(index: number, value: number): Float16Array; - [Symbol.iterator](): ArrayIterator; - [index: number]: number; -} diff --git a/node_modules/@types/node/ts5.7/index.d.ts b/node_modules/@types/node/ts5.7/index.d.ts deleted file mode 100644 index b3454a72..00000000 --- a/node_modules/@types/node/ts5.7/index.d.ts +++ /dev/null @@ -1,103 +0,0 @@ -/** - * License for programmatically and manually incorporated - * documentation aka. `JSDoc` from https://github.com/nodejs/node/tree/master/doc - * - * Copyright Node.js contributors. All rights reserved. - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -// NOTE: These definitions support Node.js and TypeScript 5.7. - -// Reference required TypeScript libraries: -/// -/// - -// TypeScript library polyfills required for TypeScript 5.7: -/// - -// Iterator definitions required for compatibility with TypeScript <5.6: -/// - -// Definitions for Node.js modules specific to TypeScript 5.7+: -/// -/// - -// Definitions for Node.js modules that are not specific to any version of TypeScript: -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// diff --git a/node_modules/@types/node/tty.d.ts b/node_modules/@types/node/tty.d.ts index 602324ab..f5679466 100644 --- a/node_modules/@types/node/tty.d.ts +++ b/node_modules/@types/node/tty.d.ts @@ -21,7 +21,7 @@ * * In most cases, there should be little to no reason for an application to * manually create instances of the `tty.ReadStream` and `tty.WriteStream` classes. - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/tty.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/tty.js) */ declare module "tty" { import * as net from "node:net"; diff --git a/node_modules/@types/node/url.d.ts b/node_modules/@types/node/url.d.ts index 8d0fb658..6a0effc7 100644 --- a/node_modules/@types/node/url.d.ts +++ b/node_modules/@types/node/url.d.ts @@ -5,7 +5,7 @@ * ```js * import url from 'node:url'; * ``` - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/url.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/url.js) */ declare module "url" { import { Blob as NodeBlob, NonSharedBuffer } from "node:buffer"; @@ -71,44 +71,20 @@ declare module "url" { * A `URIError` is thrown if the `auth` property is present but cannot be decoded. * * `url.parse()` uses a lenient, non-standard algorithm for parsing URL - * strings. It is prone to security issues such as [host name spoofing](https://hackerone.com/reports/678487) - * and incorrect handling of usernames and passwords. Do not use with untrusted - * input. CVEs are not issued for `url.parse()` vulnerabilities. Use the - * [WHATWG URL](https://nodejs.org/docs/latest-v24.x/api/url.html#the-whatwg-url-api) API instead, for example: - * - * ```js - * function getURL(req) { - * const proto = req.headers['x-forwarded-proto'] || 'https'; - * const host = req.headers['x-forwarded-host'] || req.headers.host || 'example.com'; - * return new URL(req.url || '/', `${proto}://${host}`); - * } - * ``` - * - * The example above assumes well-formed headers are forwarded from a reverse - * proxy to your Node.js server. If you are not using a reverse proxy, you should - * use the example below: - * - * ```js - * function getURL(req) { - * return new URL(req.url || '/', 'https://example.com'); - * } - * ``` + * strings. It is prone to security issues such as [host name spoofing](https://hackerone.com/reports/678487) and incorrect handling of usernames and passwords. Do not use with untrusted + * input. CVEs are not issued for `url.parse()` vulnerabilities. Use the `WHATWG URL` API instead. * @since v0.1.25 * @deprecated Use the WHATWG URL API instead. * @param urlString The URL string to parse. - * @param parseQueryString If `true`, the `query` property will always - * be set to an object returned by the [`querystring`](https://nodejs.org/docs/latest-v24.x/api/querystring.html) module's `parse()` - * method. If `false`, the `query` property on the returned URL object will be an - * unparsed, undecoded string. **Default:** `false`. - * @param slashesDenoteHost If `true`, the first token after the literal - * string `//` and preceding the next `/` will be interpreted as the `host`. - * For instance, given `//foo/bar`, the result would be - * `{host: 'foo', pathname: '/bar'}` rather than `{pathname: '//foo/bar'}`. - * **Default:** `false`. + * @param [parseQueryString=false] If `true`, the `query` property will always be set to an object returned by the {@link querystring} module's `parse()` method. If `false`, the `query` property + * on the returned URL object will be an unparsed, undecoded string. + * @param [slashesDenoteHost=false] If `true`, the first token after the literal string `//` and preceding the next `/` will be interpreted as the `host`. For instance, given `//foo/bar`, the + * result would be `{host: 'foo', pathname: '/bar'}` rather than `{pathname: '//foo/bar'}`. */ + function parse(urlString: string): UrlWithStringQuery; function parse( urlString: string, - parseQueryString?: false, + parseQueryString: false | undefined, slashesDenoteHost?: boolean, ): UrlWithStringQuery; function parse(urlString: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery; @@ -344,7 +320,7 @@ declare module "url" { * representation of the path, a `Buffer` is returned. This conversion is * helpful when the input URL contains percent-encoded segments that are * not valid UTF-8 / Unicode sequences. - * @since v24.3.0 + * @since v22.18.0 * @param url The file URL string or URL object to convert to a path. * @returns The fully-resolved platform-specific Node.js file path * as a `Buffer`. @@ -793,54 +769,6 @@ declare module "url" { */ toJSON(): string; } - interface URLPatternComponentResult { - input: string; - groups: Record; - } - interface URLPatternInit { - protocol?: string; - username?: string; - password?: string; - hostname?: string; - port?: string; - pathname?: string; - search?: string; - hash?: string; - baseURL?: string; - } - interface URLPatternOptions { - ignoreCase?: boolean; - } - interface URLPatternResult { - inputs: (string | URLPatternInit)[]; - protocol: URLPatternComponentResult; - username: URLPatternComponentResult; - password: URLPatternComponentResult; - hostname: URLPatternComponentResult; - port: URLPatternComponentResult; - pathname: URLPatternComponentResult; - search: URLPatternComponentResult; - hash: URLPatternComponentResult; - } - /** - * @since v23.8.0 - * @experimental - */ - class URLPattern { - constructor(input: string | URLPatternInit, baseURL: string, options?: URLPatternOptions); - constructor(input?: string | URLPatternInit, options?: URLPatternOptions); - exec(input?: string | URLPatternInit, baseURL?: string): URLPatternResult | null; - readonly hasRegExpGroups: boolean; - readonly hash: string; - readonly hostname: string; - readonly password: string; - readonly pathname: string; - readonly port: string; - readonly protocol: string; - readonly search: string; - test(input?: string | URLPatternInit, baseURL?: string): boolean; - readonly username: string; - } interface URLSearchParamsIterator extends NodeJS.Iterator { [Symbol.iterator](): URLSearchParamsIterator; } @@ -1021,35 +949,34 @@ declare module "url" { values(): URLSearchParamsIterator; [Symbol.iterator](): URLSearchParamsIterator<[string, string]>; } - import { - URL as _URL, - URLPattern as _URLPattern, - URLPatternInit as _URLPatternInit, - URLPatternResult as _URLPatternResult, - URLSearchParams as _URLSearchParams, - } from "url"; + import { URL as _URL, URLSearchParams as _URLSearchParams } from "url"; global { + interface URLSearchParams extends _URLSearchParams {} interface URL extends _URL {} + interface Global { + URL: typeof _URL; + URLSearchParams: typeof _URLSearchParams; + } + /** + * `URL` class is a global reference for `import { URL } from 'url'` + * https://nodejs.org/api/url.html#the-whatwg-url-api + * @since v10.0.0 + */ var URL: typeof globalThis extends { onmessage: any; URL: infer T; } ? T : typeof _URL; - interface URLSearchParams extends _URLSearchParams {} + /** + * `URLSearchParams` class is a global reference for `import { URLSearchParams } from 'node:url'` + * https://nodejs.org/api/url.html#class-urlsearchparams + * @since v10.0.0 + */ var URLSearchParams: typeof globalThis extends { onmessage: any; URLSearchParams: infer T; } ? T : typeof _URLSearchParams; - interface URLPatternInit extends _URLPatternInit {} - interface URLPatternResult extends _URLPatternResult {} - interface URLPattern extends _URLPattern {} - var URLPattern: typeof globalThis extends { - onmessage: any; - scheduler: any; // Must be a var introduced at the same time as URLPattern. - URLPattern: infer T; - } ? T - : typeof _URLPattern; } } declare module "node:url" { diff --git a/node_modules/@types/node/util.d.ts b/node_modules/@types/node/util.d.ts index c825a79b..a171f651 100644 --- a/node_modules/@types/node/util.d.ts +++ b/node_modules/@types/node/util.d.ts @@ -6,7 +6,7 @@ * ```js * import util from 'node:util'; * ``` - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/util.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/util.js) */ declare module "util" { import * as types from "node:util/types"; @@ -340,7 +340,7 @@ declare module "util" { export function getSystemErrorName(err: number): string; /** * Enable or disable printing a stack trace on `SIGINT`. The API is only available on the main thread. - * @since 24.6.0 + * @since 22.19.0 */ export function setTraceSigInt(enable: boolean): void; /** @@ -372,6 +372,19 @@ declare module "util" { * @since v22.12.0 */ export function getSystemErrorMessage(err: number): string; + /** + * The `util.log()` method prints the given `string` to `stdout` with an included + * timestamp. + * + * ```js + * import util from 'node:util'; + * + * util.log('Timestamped message.'); + * ``` + * @since v0.3.0 + * @deprecated Since v6.0.0 - Use a third party module instead. + */ + export function log(string: string): void; /** * Returns the `string` after replacing any surrogate code points * (or equivalently, any unpaired surrogate code units) with the @@ -642,6 +655,71 @@ declare module "util" { * @deprecated Since v4.0.0 - Use `isArray` instead. */ export function isArray(object: unknown): object is unknown[]; + /** + * Returns `true` if the given `object` is a `RegExp`. Otherwise, returns `false`. + * + * ```js + * import util from 'node:util'; + * + * util.isRegExp(/some regexp/); + * // Returns: true + * util.isRegExp(new RegExp('another regexp')); + * // Returns: true + * util.isRegExp({}); + * // Returns: false + * ``` + * @since v0.6.0 + * @deprecated Since v4.0.0 - Deprecated + */ + export function isRegExp(object: unknown): object is RegExp; + /** + * Returns `true` if the given `object` is a `Date`. Otherwise, returns `false`. + * + * ```js + * import util from 'node:util'; + * + * util.isDate(new Date()); + * // Returns: true + * util.isDate(Date()); + * // false (without 'new' returns a String) + * util.isDate({}); + * // Returns: false + * ``` + * @since v0.6.0 + * @deprecated Since v4.0.0 - Use {@link types.isDate} instead. + */ + export function isDate(object: unknown): object is Date; + /** + * Returns `true` if the given `object` is an `Error`. Otherwise, returns `false`. + * + * ```js + * import util from 'node:util'; + * + * util.isError(new Error()); + * // Returns: true + * util.isError(new TypeError()); + * // Returns: true + * util.isError({ name: 'Error', message: 'an error occurred' }); + * // Returns: false + * ``` + * + * This method relies on `Object.prototype.toString()` behavior. It is + * possible to obtain an incorrect result when the `object` argument manipulates `@@toStringTag`. + * + * ```js + * import util from 'node:util'; + * const obj = { name: 'Error', message: 'an error occurred' }; + * + * util.isError(obj); + * // Returns: false + * obj[Symbol.toStringTag] = 'Error'; + * util.isError(obj); + * // Returns: true + * ``` + * @since v0.6.0 + * @deprecated Since v4.0.0 - Use {@link types.isNativeError} instead. + */ + export function isError(object: unknown): object is Error; /** * Usage of `util.inherits()` is discouraged. Please use the ES6 `class` and * `extends` keywords to get language level inheritance support. Also note @@ -792,6 +870,217 @@ declare module "util" { */ export function debuglog(section: string, callback?: (fn: DebugLoggerFunction) => void): DebugLogger; export { debuglog as debug }; + /** + * Returns `true` if the given `object` is a `Boolean`. Otherwise, returns `false`. + * + * ```js + * import util from 'node:util'; + * + * util.isBoolean(1); + * // Returns: false + * util.isBoolean(0); + * // Returns: false + * util.isBoolean(false); + * // Returns: true + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `typeof value === 'boolean'` instead. + */ + export function isBoolean(object: unknown): object is boolean; + /** + * Returns `true` if the given `object` is a `Buffer`. Otherwise, returns `false`. + * + * ```js + * import util from 'node:util'; + * + * util.isBuffer({ length: 0 }); + * // Returns: false + * util.isBuffer([]); + * // Returns: false + * util.isBuffer(Buffer.from('hello world')); + * // Returns: true + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `isBuffer` instead. + */ + export function isBuffer(object: unknown): object is Buffer; + /** + * Returns `true` if the given `object` is a `Function`. Otherwise, returns `false`. + * + * ```js + * import util from 'node:util'; + * + * function Foo() {} + * const Bar = () => {}; + * + * util.isFunction({}); + * // Returns: false + * util.isFunction(Foo); + * // Returns: true + * util.isFunction(Bar); + * // Returns: true + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `typeof value === 'function'` instead. + */ + export function isFunction(object: unknown): boolean; + /** + * Returns `true` if the given `object` is strictly `null`. Otherwise, returns`false`. + * + * ```js + * import util from 'node:util'; + * + * util.isNull(0); + * // Returns: false + * util.isNull(undefined); + * // Returns: false + * util.isNull(null); + * // Returns: true + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `value === null` instead. + */ + export function isNull(object: unknown): object is null; + /** + * Returns `true` if the given `object` is `null` or `undefined`. Otherwise, + * returns `false`. + * + * ```js + * import util from 'node:util'; + * + * util.isNullOrUndefined(0); + * // Returns: false + * util.isNullOrUndefined(undefined); + * // Returns: true + * util.isNullOrUndefined(null); + * // Returns: true + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `value === undefined || value === null` instead. + */ + export function isNullOrUndefined(object: unknown): object is null | undefined; + /** + * Returns `true` if the given `object` is a `Number`. Otherwise, returns `false`. + * + * ```js + * import util from 'node:util'; + * + * util.isNumber(false); + * // Returns: false + * util.isNumber(Infinity); + * // Returns: true + * util.isNumber(0); + * // Returns: true + * util.isNumber(NaN); + * // Returns: true + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `typeof value === 'number'` instead. + */ + export function isNumber(object: unknown): object is number; + /** + * Returns `true` if the given `object` is strictly an `Object`**and** not a`Function` (even though functions are objects in JavaScript). + * Otherwise, returns `false`. + * + * ```js + * import util from 'node:util'; + * + * util.isObject(5); + * // Returns: false + * util.isObject(null); + * // Returns: false + * util.isObject({}); + * // Returns: true + * util.isObject(() => {}); + * // Returns: false + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `value !== null && typeof value === 'object'` instead. + */ + export function isObject(object: unknown): boolean; + /** + * Returns `true` if the given `object` is a primitive type. Otherwise, returns`false`. + * + * ```js + * import util from 'node:util'; + * + * util.isPrimitive(5); + * // Returns: true + * util.isPrimitive('foo'); + * // Returns: true + * util.isPrimitive(false); + * // Returns: true + * util.isPrimitive(null); + * // Returns: true + * util.isPrimitive(undefined); + * // Returns: true + * util.isPrimitive({}); + * // Returns: false + * util.isPrimitive(() => {}); + * // Returns: false + * util.isPrimitive(/^$/); + * // Returns: false + * util.isPrimitive(new Date()); + * // Returns: false + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `(typeof value !== 'object' && typeof value !== 'function') || value === null` instead. + */ + export function isPrimitive(object: unknown): boolean; + /** + * Returns `true` if the given `object` is a `string`. Otherwise, returns `false`. + * + * ```js + * import util from 'node:util'; + * + * util.isString(''); + * // Returns: true + * util.isString('foo'); + * // Returns: true + * util.isString(String('foo')); + * // Returns: true + * util.isString(5); + * // Returns: false + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `typeof value === 'string'` instead. + */ + export function isString(object: unknown): object is string; + /** + * Returns `true` if the given `object` is a `Symbol`. Otherwise, returns `false`. + * + * ```js + * import util from 'node:util'; + * + * util.isSymbol(5); + * // Returns: false + * util.isSymbol('foo'); + * // Returns: false + * util.isSymbol(Symbol('foo')); + * // Returns: true + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `typeof value === 'symbol'` instead. + */ + export function isSymbol(object: unknown): object is symbol; + /** + * Returns `true` if the given `object` is `undefined`. Otherwise, returns `false`. + * + * ```js + * import util from 'node:util'; + * + * const foo = undefined; + * util.isUndefined(5); + * // Returns: false + * util.isUndefined(foo); + * // Returns: true + * util.isUndefined(null); + * // Returns: false + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `value === undefined` instead. + */ + export function isUndefined(object: unknown): object is undefined; /** * The `util.deprecate()` method wraps `fn` (which may be a function or class) in * such a way that it is marked as deprecated. @@ -853,15 +1142,6 @@ declare module "util" { * @return The deprecated function wrapped to emit a warning. */ export function deprecate(fn: T, msg: string, code?: string): T; - export interface IsDeepStrictEqualOptions { - /** - * If `true`, prototype and constructor - * comparison is skipped during deep strict equality check. - * @since v24.9.0 - * @default false - */ - skipPrototype?: boolean | undefined; - } /** * Returns `true` if there is deep strict equality between `val1` and `val2`. * Otherwise, returns `false`. @@ -870,7 +1150,7 @@ declare module "util" { * equality. * @since v9.0.0 */ - export function isDeepStrictEqual(val1: unknown, val2: unknown, options?: IsDeepStrictEqualOptions): boolean; + export function isDeepStrictEqual(val1: unknown, val2: unknown): boolean; /** * Returns `str` with any ANSI escape codes removed. * @@ -1045,7 +1325,7 @@ declare module "util" { * ``` * * If there is an `original[util.promisify.custom]` property present, `promisify` - * will return its value, see [Custom promisified functions](https://nodejs.org/docs/latest-v24.x/api/util.html#custom-promisified-functions). + * will return its value, see [Custom promisified functions](https://nodejs.org/docs/latest-v22.x/api/util.html#custom-promisified-functions). * * `promisify()` assumes that `original` is a function taking a callback as its * final argument in all cases. If `original` is not a function, `promisify()` @@ -1245,7 +1525,7 @@ declare module "util" { * * The special format value `none` applies no additional styling to the text. * - * The full list of formats can be found in [modifiers](https://nodejs.org/docs/latest-v24.x/api/util.html#modifiers). + * The full list of formats can be found in [modifiers](https://nodejs.org/docs/latest-v22.x/api/util.html#modifiers). * @param format A text format or an Array of text formats defined in `util.inspect.colors`. * @param text The text to to be formatted. * @since v20.12.0 @@ -1951,21 +2231,23 @@ declare module "util/types" { * ``` * * For further information on `napi_create_external`, refer to - * [`napi_create_external()`](https://nodejs.org/docs/latest-v24.x/api/n-api.html#napi_create_external). + * [`napi_create_external()`](https://nodejs.org/docs/latest-v22.x/api/n-api.html#napi_create_external). * @since v10.0.0 */ function isExternal(object: unknown): boolean; /** - * Returns `true` if the value is a built-in [`Float16Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float16Array) instance. + * Returns `true` if the value is a built-in `Float16Array` instance. * * ```js * util.types.isFloat16Array(new ArrayBuffer()); // Returns false * util.types.isFloat16Array(new Float16Array()); // Returns true * util.types.isFloat16Array(new Float32Array()); // Returns false * ``` - * @since v24.0.0 + * @since v22.16.0 */ - function isFloat16Array(object: unknown): object is Float16Array; + // This does NOT return a type predicate in v22.x. + // The Float16Array feature does not yet exist in this version of Node.js. + function isFloat16Array(object: unknown): boolean; /** * Returns `true` if the value is a built-in [`Float32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array) instance. * @@ -2127,7 +2409,6 @@ declare module "util/types" { * console.log(myError instanceof Error); // true * ``` * @since v10.0.0 - * @deprecated The `util.types.isNativeError` API is deprecated. Please use `Error.isError` instead. */ function isNativeError(object: unknown): object is Error; /** diff --git a/node_modules/@types/node/v8.d.ts b/node_modules/@types/node/v8.d.ts index d509ee13..34006cd4 100644 --- a/node_modules/@types/node/v8.d.ts +++ b/node_modules/@types/node/v8.d.ts @@ -4,7 +4,7 @@ * ```js * import v8 from 'node:v8'; * ``` - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/v8.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/v8.js) */ declare module "v8" { import { NonSharedBuffer } from "node:buffer"; @@ -401,38 +401,6 @@ declare module "v8" { * @since v12.8.0 */ function getHeapCodeStatistics(): HeapCodeStatistics; - /** - * @since v24.8.0 - */ - interface CPUProfileHandle { - /** - * Stopping collecting the profile, then return a Promise that fulfills with an error or the - * profile data. - * @since v24.8.0 - */ - stop(): Promise; - /** - * Stopping collecting the profile and the profile will be discarded. - * @since v24.8.0 - */ - [Symbol.asyncDispose](): Promise; - } - /** - * @since v24.9.0 - */ - interface HeapProfileHandle { - /** - * Stopping collecting the profile, then return a Promise that fulfills with an error or the - * profile data. - * @since v24.9.0 - */ - stop(): Promise; - /** - * Stopping collecting the profile and the profile will be discarded. - * @since v24.9.0 - */ - [Symbol.asyncDispose](): Promise; - } /** * V8 only supports `Latin-1/ISO-8859-1` and `UTF16` as the underlying representation of a string. * If the `content` uses `Latin-1/ISO-8859-1` as the underlying representation, this function will return true; @@ -463,7 +431,7 @@ declare module "v8" { * writeString('hello'); * writeString('你好'); * ``` - * @since v23.10.0, v22.15.0 + * @since v22.15.0 */ function isStringOneByteRepresentation(content: string): boolean; /** @@ -613,7 +581,7 @@ declare module "v8" { function stopCoverage(): void; /** * The API is a no-op if `--heapsnapshot-near-heap-limit` is already set from the command line or the API is called more than once. - * `limit` must be a positive integer. See [`--heapsnapshot-near-heap-limit`](https://nodejs.org/docs/latest-v24.x/api/cli.html#--heapsnapshot-near-heap-limitmax_count) for more information. + * `limit` must be a positive integer. See [`--heapsnapshot-near-heap-limit`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--heapsnapshot-near-heap-limitmax_count) for more information. * @since v18.10.0, v16.18.0 */ function setHeapSnapshotNearHeapLimit(limit: number): void; diff --git a/node_modules/@types/node/vm.d.ts b/node_modules/@types/node/vm.d.ts index 50b7f09a..a2609bf2 100644 --- a/node_modules/@types/node/vm.d.ts +++ b/node_modules/@types/node/vm.d.ts @@ -34,11 +34,11 @@ * * console.log(x); // 1; y is not defined. * ``` - * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/vm.js) + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/vm.js) */ declare module "vm" { import { NonSharedBuffer } from "node:buffer"; - import { ImportAttributes, ImportPhase } from "node:module"; + import { ImportAttributes } from "node:module"; interface Context extends NodeJS.Dict {} interface BaseOptions { /** @@ -61,7 +61,6 @@ declare module "vm" { specifier: string, referrer: T, importAttributes: ImportAttributes, - phase: ImportPhase, ) => Module | Promise; interface ScriptOptions extends BaseOptions { /** @@ -73,8 +72,7 @@ declare module "vm" { /** * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see - * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v24.x/api/vm.html#support-of-dynamic-import-in-compilation-apis). - * @experimental + * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis). */ importModuleDynamically?: | DynamicModuleLoader - + diff --git a/dist/sw.js b/dist/sw.js index 739fc1f6..576cd303 100644 --- a/dist/sw.js +++ b/dist/sw.js @@ -9,7 +9,7 @@ // Update this version string manually to keep the app + cache versions in sync. // The value is forwarded to the UI via the service worker "SW_ACTIVATED" message. -const APP_VERSION = "30.0.6"; // update on release +const APP_VERSION = "30.0.7"; // update on release const VERSION = new URL(self.location.href).searchParams.get("v") || APP_VERSION; // derived from build const PREFIX = "PHINETWORK"; const PRECACHE = `${PREFIX}-precache-${VERSION}`; diff --git a/public/sw.js b/public/sw.js index 739fc1f6..576cd303 100644 --- a/public/sw.js +++ b/public/sw.js @@ -9,7 +9,7 @@ // Update this version string manually to keep the app + cache versions in sync. // The value is forwarded to the UI via the service worker "SW_ACTIVATED" message. -const APP_VERSION = "30.0.6"; // update on release +const APP_VERSION = "30.0.7"; // update on release const VERSION = new URL(self.location.href).searchParams.get("v") || APP_VERSION; // derived from build const PREFIX = "PHINETWORK"; const PRECACHE = `${PREFIX}-precache-${VERSION}`; diff --git a/src/version.ts b/src/version.ts index 14745b63..05f9bd43 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1,7 +1,7 @@ // src/version.ts // Shared PWA version constants so the app shell, SW registration, and UI stay in sync. -export const BASE_APP_VERSION = "30.0.6"; // Canonical offline/PWA version +export const BASE_APP_VERSION = "30.0.7"; // Canonical offline/PWA version export const SW_VERSION_EVENT = "kairos:sw-version"; export const DEFAULT_APP_VERSION = BASE_APP_VERSION; // Keep in sync with public/sw.js const ENV_APP_VERSION = From 1f76b050eccc5e9b60aaea59eca06e00f116f73a Mon Sep 17 00:00:00 2001 From: Kojib Date: Mon, 22 Dec 2025 21:16:29 -0500 Subject: [PATCH 07/10] v30.0.7 --- .DS_Store | Bin 14340 -> 14340 bytes node_modules/.package-lock.json | 14 +- node_modules/react-router-dom/dist/index.js | 2 +- node_modules/react-router-dom/dist/index.mjs | 2 +- node_modules/react-router-dom/package.json | 11 +- node_modules/react-router/CHANGELOG.md | 35 -- .../dist/development/dom-export.d.mts | 21 +- .../dist/development/dom-export.d.ts | 23 +- .../dist/development/dom-export.js | 61 ++-- .../dist/development/dom-export.mjs | 13 +- .../index-react-server-client.d.mts | 4 +- .../index-react-server-client.d.ts | 4 +- .../development/index-react-server-client.js | 8 +- .../development/index-react-server-client.mjs | 4 +- .../dist/development/index-react-server.d.mts | 6 +- .../dist/development/index-react-server.d.ts | 6 +- .../dist/development/index-react-server.js | 91 +---- .../dist/development/index-react-server.mjs | 91 +---- .../react-router/dist/development/index.d.mts | 33 +- .../react-router/dist/development/index.d.ts | 33 +- .../react-router/dist/development/index.js | 331 ++++++------------ .../react-router/dist/development/index.mjs | 6 +- .../dist/development/lib/types/internal.d.mts | 4 +- .../dist/development/lib/types/internal.d.ts | 4 +- .../dist/development/lib/types/internal.js | 2 +- .../dist/development/lib/types/internal.mjs | 2 +- .../dist/production/dom-export.d.mts | 21 +- .../dist/production/dom-export.d.ts | 23 +- .../dist/production/dom-export.js | 61 ++-- .../dist/production/dom-export.mjs | 13 +- .../index-react-server-client.d.mts | 4 +- .../production/index-react-server-client.d.ts | 4 +- .../production/index-react-server-client.js | 8 +- .../production/index-react-server-client.mjs | 4 +- .../dist/production/index-react-server.d.mts | 6 +- .../dist/production/index-react-server.d.ts | 6 +- .../dist/production/index-react-server.js | 91 +---- .../dist/production/index-react-server.mjs | 91 +---- .../react-router/dist/production/index.d.mts | 33 +- .../react-router/dist/production/index.d.ts | 33 +- .../react-router/dist/production/index.js | 331 ++++++------------ .../react-router/dist/production/index.mjs | 6 +- .../dist/production/lib/types/internal.d.mts | 4 +- .../dist/production/lib/types/internal.d.ts | 4 +- .../dist/production/lib/types/internal.js | 2 +- .../dist/production/lib/types/internal.mjs | 2 +- node_modules/react-router/package.json | 9 +- package-lock.json | 17 +- package.json | 3 +- 49 files changed, 555 insertions(+), 1032 deletions(-) diff --git a/.DS_Store b/.DS_Store index 49a06645463e9d195378416175f3477a2098cedf..64bfa99b05114195aefa886f18eae74802dd8697 100644 GIT binary patch delta 273 zcmZoEXepSmf{n?Vfq^Mx<2pA1HfC`K2F53we+k$!v#tb*PPP#-Wo-tsj%+RyNo8dH z2x3ltAnMH83RbBh7RSWK;K;zhptre4!iABIVLgaF`HjBx#s^Ytlera^u$~2}oV-Qh zF~}gG>2nm-n820-*(a1$89_DynV(d28Cl~Q7?@2qtEd4*fr^<;Ci|%ygY6I5+@_w$ z47NXH@*6EYI%_`cqVEsV%rRju%-3QckKvx}PD^UK8?r*T6K=a?|8?)gte{!38 F9ROJuNCW@? delta 273 zcmZoEXepSmf{pP%0|Ud3jqBV5*qCkunI4;e3D`2T=7K~g+lZL5x-&2^YHThONo8c+ z3Sv%vAnMHO30A2g7RSWK>6UeTc{6=4T;{z$S$=nJ{SSNy1PTr#M z7-SI8^f`)ZOb|;wHlI*dWdz&gvH6pVE+eZlQ1^_@Dr!JckgYQ&`>7j)we8s4rk==20.0.0" diff --git a/node_modules/react-router-dom/dist/index.js b/node_modules/react-router-dom/dist/index.js index 6d0e6364..0412472f 100644 --- a/node_modules/react-router-dom/dist/index.js +++ b/node_modules/react-router-dom/dist/index.js @@ -1,5 +1,5 @@ /** - * react-router-dom v7.11.0 + * react-router-dom v7.10.1 * * Copyright (c) Remix Software Inc. * diff --git a/node_modules/react-router-dom/dist/index.mjs b/node_modules/react-router-dom/dist/index.mjs index 04ba0cbb..3d409b02 100644 --- a/node_modules/react-router-dom/dist/index.mjs +++ b/node_modules/react-router-dom/dist/index.mjs @@ -1,5 +1,5 @@ /** - * react-router-dom v7.11.0 + * react-router-dom v7.10.1 * * Copyright (c) Remix Software Inc. * diff --git a/node_modules/react-router-dom/package.json b/node_modules/react-router-dom/package.json index 629cd411..96fb4cb2 100644 --- a/node_modules/react-router-dom/package.json +++ b/node_modules/react-router-dom/package.json @@ -1,6 +1,6 @@ { "name": "react-router-dom", - "version": "7.11.0", + "version": "7.10.1", "description": "Declarative routing for React web applications", "keywords": [ "react", @@ -44,7 +44,6 @@ "build": { "command": "tsup", "files": [ - "../../pnpm-workspace.yaml", "*.ts", "tsconfig.json", "package.json" @@ -55,13 +54,13 @@ } }, "dependencies": { - "react-router": "7.11.0" + "react-router": "7.10.1" }, "devDependencies": { - "react": "^19.2.3", - "react-dom": "^19.2.3", + "react": "^19.1.0", + "react-dom": "^19.1.0", "tsup": "^8.3.0", - "typescript": "^5.4.5", + "typescript": "^5.1.6", "wireit": "0.14.9" }, "peerDependencies": { diff --git a/node_modules/react-router/CHANGELOG.md b/node_modules/react-router/CHANGELOG.md index 2838f0b3..6ab75a9b 100644 --- a/node_modules/react-router/CHANGELOG.md +++ b/node_modules/react-router/CHANGELOG.md @@ -1,40 +1,5 @@ # `react-router` -## 7.11.0 - -### Minor Changes - -- Stabilize ``/`` ([#14546](https://github.com/remix-run/react-router/pull/14546)) - -### Patch Changes - -- add support for throwing redirect Response's at RSC render time ([#14596](https://github.com/remix-run/react-router/pull/14596)) - -- Support for throwing `data()` and Response from server component render phase. Response body is not serialized as async work is not allowed as error encoding phase. If you wish to transmit data to the boundary, throw `data()` instead. ([#14632](https://github.com/remix-run/react-router/pull/14632)) - -- Fix `unstable_useTransitions` prop on `` component to permit omission for backewards compatibility ([#14646](https://github.com/remix-run/react-router/pull/14646)) - -- `routeRSCServerRequest` replace `fetchServer` with `serverResponse` ([#14597](https://github.com/remix-run/react-router/pull/14597)) - -- \[UNSTABLE] Add a new `unstable_defaultShouldRevalidate` flag to various APIs to allow opt-ing out of standard revalidation behaviors. ([#14542](https://github.com/remix-run/react-router/pull/14542)) - - If active routes include a `shouldRevalidate` function, then your value will be passed as `defaultShouldRevalidate` in those function so that the route always has the final revalidation determination. - - - `
` - - `submit(data, { method: "post", unstable_defaultShouldRevalidate: false })` - - `` - - `fetcher.submit(data, { method: "post", unstable_defaultShouldRevalidate: false })` - - This is also available on non-submission APIs that may trigger revalidations due to changing search params: - - - `` - - `navigate("/?foo=bar", { unstable_defaultShouldRevalidate: false })` - - `setSearchParams(params, { unstable_defaultShouldRevalidate: false })` - -- Allow redirects to be returned from client side middleware ([#14598](https://github.com/remix-run/react-router/pull/14598)) - -- Handle `dataStrategy` implementations that return insufficient result sets by adding errors for routes without any available result ([#14627](https://github.com/remix-run/react-router/pull/14627)) - ## 7.10.1 ### Patch Changes diff --git a/node_modules/react-router/dist/development/dom-export.d.mts b/node_modules/react-router/dist/development/dom-export.d.mts index cc9a565d..12193104 100644 --- a/node_modules/react-router/dist/development/dom-export.d.mts +++ b/node_modules/react-router/dist/development/dom-export.d.mts @@ -1,6 +1,6 @@ import * as React from 'react'; -import { f as RouterProviderProps$1, e as RouterInit, u as unstable_ClientInstrumentation, g as ClientOnErrorFunction } from './router-5fbeEIMQ.mjs'; -export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-Cv4JZyZ5.mjs'; +import { f as RouterProviderProps$1, e as RouterInit, u as unstable_ClientInstrumentation, g as unstable_ClientOnErrorFunction } from './router-CwNp5l9u.mjs'; +export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-C5z6FZmz.mjs'; type RouterProviderProps = Omit; declare function RouterProvider(props: Omit): React.JSX.Element; @@ -71,9 +71,9 @@ interface HydratedRouterProps { */ unstable_instrumentations?: unstable_ClientInstrumentation[]; /** - * An error handler function that will be called for any middleware, loader, action, - * or render errors that are encountered in your application. This is useful for - * logging or reporting errors instead of in the {@link ErrorBoundary} because it's not + * An error handler function that will be called for any loader/action/render + * errors that are encountered in your application. This is useful for + * logging or reporting errors instead of the `ErrorBoundary` because it's not * subject to re-rendering and will only run one time per error. * * The `errorInfo` parameter is passed along from @@ -81,14 +81,13 @@ interface HydratedRouterProps { * and is only present for render errors. * * ```tsx - * { - * let { location, params, unstable_pattern, errorInfo } = info; - * console.error(error, location, errorInfo); - * reportToErrorService(error, location, errorInfo); + * { + * console.error(error, errorInfo); + * reportToErrorService(error, errorInfo); * }} /> * ``` */ - onError?: ClientOnErrorFunction; + unstable_onError?: unstable_ClientOnErrorFunction; /** * Control whether router state updates are internally wrapped in * [`React.startTransition`](https://react.dev/reference/react/startTransition). @@ -118,7 +117,7 @@ interface HydratedRouterProps { * @mode framework * @param props Props * @param {dom.HydratedRouterProps.getContext} props.getContext n/a - * @param {dom.HydratedRouterProps.onError} props.onError n/a + * @param {dom.HydratedRouterProps.unstable_onError} props.unstable_onError n/a * @returns A React element that represents the hydrated application. */ declare function HydratedRouter(props: HydratedRouterProps): React.JSX.Element; diff --git a/node_modules/react-router/dist/development/dom-export.d.ts b/node_modules/react-router/dist/development/dom-export.d.ts index ac784132..8177d29d 100644 --- a/node_modules/react-router/dist/development/dom-export.d.ts +++ b/node_modules/react-router/dist/development/dom-export.d.ts @@ -1,7 +1,7 @@ import * as React from 'react'; -import { RouterProviderProps as RouterProviderProps$1, RouterInit, ClientOnErrorFunction } from 'react-router'; -import { u as unstable_ClientInstrumentation } from './instrumentation-BlrVzjbg.js'; -export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-o-qhcuhA.js'; +import { RouterProviderProps as RouterProviderProps$1, RouterInit, unstable_ClientOnErrorFunction } from 'react-router'; +import { u as unstable_ClientInstrumentation } from './instrumentation-BB0wRuqz.js'; +export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-BpxEZgZC.js'; type RouterProviderProps = Omit; declare function RouterProvider(props: Omit): React.JSX.Element; @@ -72,9 +72,9 @@ interface HydratedRouterProps { */ unstable_instrumentations?: unstable_ClientInstrumentation[]; /** - * An error handler function that will be called for any middleware, loader, action, - * or render errors that are encountered in your application. This is useful for - * logging or reporting errors instead of in the {@link ErrorBoundary} because it's not + * An error handler function that will be called for any loader/action/render + * errors that are encountered in your application. This is useful for + * logging or reporting errors instead of the `ErrorBoundary` because it's not * subject to re-rendering and will only run one time per error. * * The `errorInfo` parameter is passed along from @@ -82,14 +82,13 @@ interface HydratedRouterProps { * and is only present for render errors. * * ```tsx - * { - * let { location, params, unstable_pattern, errorInfo } = info; - * console.error(error, location, errorInfo); - * reportToErrorService(error, location, errorInfo); + * { + * console.error(error, errorInfo); + * reportToErrorService(error, errorInfo); * }} /> * ``` */ - onError?: ClientOnErrorFunction; + unstable_onError?: unstable_ClientOnErrorFunction; /** * Control whether router state updates are internally wrapped in * [`React.startTransition`](https://react.dev/reference/react/startTransition). @@ -119,7 +118,7 @@ interface HydratedRouterProps { * @mode framework * @param props Props * @param {dom.HydratedRouterProps.getContext} props.getContext n/a - * @param {dom.HydratedRouterProps.onError} props.onError n/a + * @param {dom.HydratedRouterProps.unstable_onError} props.unstable_onError n/a * @returns A React element that represents the hydrated application. */ declare function HydratedRouter(props: HydratedRouterProps): React.JSX.Element; diff --git a/node_modules/react-router/dist/development/dom-export.js b/node_modules/react-router/dist/development/dom-export.js index d10fdde8..d57b117d 100644 --- a/node_modules/react-router/dist/development/dom-export.js +++ b/node_modules/react-router/dist/development/dom-export.js @@ -1,5 +1,5 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/** - * react-router v7.11.0 + * react-router v7.10.1 * * Copyright (c) Remix Software Inc. * @@ -13,7 +13,7 @@ -var _chunkGNDLROV6js = require('./chunk-GNDLROV6.js'); +var _chunkFKYGG5Z2js = require('./chunk-FKYGG5Z2.js'); @@ -32,7 +32,7 @@ var _chunkGNDLROV6js = require('./chunk-GNDLROV6.js'); -var _chunkSZQUWNVJjs = require('./chunk-SZQUWNVJ.js'); +var _chunkRBZI3ZHDjs = require('./chunk-RBZI3ZHD.js'); // lib/dom-export/dom-router-provider.tsx var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react); @@ -204,7 +204,7 @@ function HydratedRouter(props) { }, []); React2.useEffect(() => { if (process.env.NODE_ENV === "development" && criticalCss === void 0) { - document.querySelectorAll(`[${_chunkSZQUWNVJjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove()); + document.querySelectorAll(`[${_chunkRBZI3ZHDjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove()); } }, [criticalCss]); let [location2, setLocation] = React2.useState(router.state.location); @@ -253,7 +253,7 @@ function HydratedRouter(props) { { router, unstable_useTransitions: props.unstable_useTransitions, - onError: props.onError + unstable_onError: props.unstable_onError } )) ), /* @__PURE__ */ React2.createElement(React2.Fragment, null)) @@ -376,10 +376,10 @@ function createRouterFromPayload({ }; if (payload.type !== "render") throw new Error("Invalid payload type"); globalVar.__reactRouterRouteModules = _nullishCoalesce(globalVar.__reactRouterRouteModules, () => ( {})); - _chunkGNDLROV6js.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches); + _chunkFKYGG5Z2js.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches); let patches = /* @__PURE__ */ new Map(); _optionalChain([payload, 'access', _22 => _22.patches, 'optionalAccess', _23 => _23.forEach, 'call', _24 => _24((patch) => { - _chunkSZQUWNVJjs.invariant.call(void 0, patch.parentId, "Invalid patch parentId"); + _chunkRBZI3ZHDjs.invariant.call(void 0, patch.parentId, "Invalid patch parentId"); if (!patches.has(patch.parentId)) { patches.set(patch.parentId, []); } @@ -401,12 +401,12 @@ function createRouterFromPayload({ } return [route]; }, []); - globalVar.__reactRouterDataRouter = _chunkSZQUWNVJjs.createRouter.call(void 0, { + globalVar.__reactRouterDataRouter = _chunkRBZI3ZHDjs.createRouter.call(void 0, { routes, getContext, basename: payload.basename, - history: _chunkSZQUWNVJjs.createBrowserHistory.call(void 0, ), - hydrationData: _chunkGNDLROV6js.getHydrationData.call(void 0, { + history: _chunkRBZI3ZHDjs.createBrowserHistory.call(void 0, ), + hydrationData: _chunkFKYGG5Z2js.getHydrationData.call(void 0, { state: { loaderData: payload.loaderData, actionData: payload.actionData, @@ -415,7 +415,7 @@ function createRouterFromPayload({ routes, getRouteInfo: (routeId) => { let match = payload.matches.find((m) => m.id === routeId); - _chunkSZQUWNVJjs.invariant.call(void 0, match, "Route not found in payload"); + _chunkRBZI3ZHDjs.invariant.call(void 0, match, "Route not found in payload"); return { clientLoader: match.clientLoader, hasLoader: match.hasLoader, @@ -513,9 +513,9 @@ function createRouterFromPayload({ routeModules: globalVar.__reactRouterRouteModules }; } -var renderedRoutesContext = _chunkSZQUWNVJjs.createContext.call(void 0, ); +var renderedRoutesContext = _chunkRBZI3ZHDjs.createContext.call(void 0, ); function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReadableStream, fetchImplementation) { - let dataStrategy = _chunkSZQUWNVJjs.getSingleFetchDataStrategyImpl.call(void 0, + let dataStrategy = _chunkRBZI3ZHDjs.getSingleFetchDataStrategyImpl.call(void 0, getRouter, (match) => { let M = match; @@ -571,20 +571,20 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation) { return async (args, basename, targetRoutes) => { let { request, context } = args; - let url = _chunkSZQUWNVJjs.singleFetchUrl.call(void 0, request.url, basename, "rsc"); + let url = _chunkRBZI3ZHDjs.singleFetchUrl.call(void 0, request.url, basename, "rsc"); if (request.method === "GET") { - url = _chunkSZQUWNVJjs.stripIndexParam.call(void 0, url); + url = _chunkRBZI3ZHDjs.stripIndexParam.call(void 0, url); if (targetRoutes) { url.searchParams.set("_routes", targetRoutes.join(",")); } } let res = await fetchImplementation( - new Request(url, await _chunkSZQUWNVJjs.createRequestInit.call(void 0, request)) + new Request(url, await _chunkRBZI3ZHDjs.createRequestInit.call(void 0, request)) ); if (res.status >= 400 && !res.headers.has("X-Remix-Response")) { - throw new (0, _chunkSZQUWNVJjs.ErrorResponseImpl)(res.status, res.statusText, await res.text()); + throw new (0, _chunkRBZI3ZHDjs.ErrorResponseImpl)(res.status, res.statusText, await res.text()); } - _chunkSZQUWNVJjs.invariant.call(void 0, res.body, "No response body to decode"); + _chunkRBZI3ZHDjs.invariant.call(void 0, res.body, "No response body to decode"); try { const payload = await createFromReadableStream(res.body, { temporaryReferences: void 0 @@ -608,7 +608,7 @@ function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation) } context.get(renderedRoutesContext).push(...payload.matches); let results = { routes: {} }; - const dataKey = _chunkSZQUWNVJjs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData"; + const dataKey = _chunkRBZI3ZHDjs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData"; for (let [routeId, data] of Object.entries(payload[dataKey] || {})) { results.routes[routeId] = { data }; } @@ -641,7 +641,7 @@ function RSCHydratedRouter({ [createFromReadableStream, payload, fetchImplementation, getContext] ); React3.useEffect(() => { - _chunkSZQUWNVJjs.setIsHydrated.call(void 0, ); + _chunkRBZI3ZHDjs.setIsHydrated.call(void 0, ); }, []); React3.useLayoutEffect(() => { const globalVar = window; @@ -743,11 +743,12 @@ function RSCHydratedRouter({ routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" }, routeModules }; - return /* @__PURE__ */ React3.createElement(_chunkSZQUWNVJjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkGNDLROV6js.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkSZQUWNVJjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement( - _chunkSZQUWNVJjs.RouterProvider, + return /* @__PURE__ */ React3.createElement(_chunkRBZI3ZHDjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkFKYGG5Z2js.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkRBZI3ZHDjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement( + _chunkRBZI3ZHDjs.RouterProvider, { router: transitionEnabledRouter, - flushSync: ReactDOM2.flushSync + flushSync: ReactDOM2.flushSync, + unstable_useTransitions: true } )))); } @@ -760,8 +761,8 @@ function createRouteFromServerManifest(match, payload) { // the server loader flow regardless of whether the client loader calls // `serverLoader` or not, otherwise we'll have nothing to render. match.hasComponent && !match.element; - _chunkSZQUWNVJjs.invariant.call(void 0, window.__reactRouterRouteModules); - _chunkGNDLROV6js.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match); + _chunkRBZI3ZHDjs.invariant.call(void 0, window.__reactRouterRouteModules); + _chunkFKYGG5Z2js.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match); let dataRoute = { id: match.id, element: match.element, @@ -811,7 +812,7 @@ function createRouteFromServerManifest(match, payload) { return await callSingleFetch(singleFetch); } }) : match.hasAction ? (_, singleFetch) => callSingleFetch(singleFetch) : () => { - throw _chunkSZQUWNVJjs.noActionDefinedError.call(void 0, "action", match.id); + throw _chunkRBZI3ZHDjs.noActionDefinedError.call(void 0, "action", match.id); }, path: match.path, shouldRevalidate: match.shouldRevalidate, @@ -824,7 +825,7 @@ function createRouteFromServerManifest(match, payload) { hasShouldRevalidate: match.shouldRevalidate != null }; if (typeof dataRoute.loader === "function") { - dataRoute.loader.hydrate = _chunkSZQUWNVJjs.shouldHydrateRouteLoader.call(void 0, + dataRoute.loader.hydrate = _chunkRBZI3ZHDjs.shouldHydrateRouteLoader.call(void 0, match.id, match.clientLoader, match.hasLoader, @@ -834,7 +835,7 @@ function createRouteFromServerManifest(match, payload) { return dataRoute; } function callSingleFetch(singleFetch) { - _chunkSZQUWNVJjs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter"); + _chunkRBZI3ZHDjs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter"); return singleFetch(); } function preventInvalidServerHandlerCall(type, routeId, hasHandler) { @@ -842,7 +843,7 @@ function preventInvalidServerHandlerCall(type, routeId, hasHandler) { let fn = type === "action" ? "serverAction()" : "serverLoader()"; let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${routeId}")`; console.error(msg); - throw new (0, _chunkSZQUWNVJjs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true); + throw new (0, _chunkRBZI3ZHDjs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true); } } var nextPaths = /* @__PURE__ */ new Set(); @@ -897,7 +898,7 @@ async function fetchAndApplyManifestPatches(paths, createFromReadableStream, fet function addToFifoQueue(path, queue) { if (queue.size >= discoveredPathsMaxSize) { let first = queue.values().next().value; - if (typeof first === "string") queue.delete(first); + queue.delete(first); } queue.add(path); } diff --git a/node_modules/react-router/dist/development/dom-export.mjs b/node_modules/react-router/dist/development/dom-export.mjs index 04b2bb35..e8393d8d 100644 --- a/node_modules/react-router/dist/development/dom-export.mjs +++ b/node_modules/react-router/dist/development/dom-export.mjs @@ -1,5 +1,5 @@ /** - * react-router v7.11.0 + * react-router v7.10.1 * * Copyright (c) Remix Software Inc. * @@ -14,7 +14,7 @@ import { deserializeErrors, getHydrationData, populateRSCRouteModules -} from "./chunk-YNUBSHFH.mjs"; +} from "./chunk-PMGK554W.mjs"; import { CRITICAL_CSS_DATA_ATTRIBUTE, ErrorResponseImpl, @@ -42,7 +42,7 @@ import { singleFetchUrl, stripIndexParam, useFogOFWarDiscovery -} from "./chunk-JMJ3UQ3L.mjs"; +} from "./chunk-WWGJGFF6.mjs"; // lib/dom-export/dom-router-provider.tsx import * as React from "react"; @@ -245,7 +245,7 @@ function HydratedRouter(props) { { router, unstable_useTransitions: props.unstable_useTransitions, - onError: props.onError + unstable_onError: props.unstable_onError } )) ), /* @__PURE__ */ React2.createElement(React2.Fragment, null)) @@ -739,7 +739,8 @@ function RSCHydratedRouter({ RouterProvider, { router: transitionEnabledRouter, - flushSync: ReactDOM2.flushSync + flushSync: ReactDOM2.flushSync, + unstable_useTransitions: true } )))); } @@ -889,7 +890,7 @@ async function fetchAndApplyManifestPatches(paths, createFromReadableStream, fet function addToFifoQueue(path, queue) { if (queue.size >= discoveredPathsMaxSize) { let first = queue.values().next().value; - if (typeof first === "string") queue.delete(first); + queue.delete(first); } queue.add(path); } diff --git a/node_modules/react-router/dist/development/index-react-server-client.d.mts b/node_modules/react-router/dist/development/index-react-server-client.d.mts index b44cf0ad..045e71c5 100644 --- a/node_modules/react-router/dist/development/index-react-server-client.d.mts +++ b/node_modules/react-router/dist/development/index-react-server-client.d.mts @@ -1,3 +1,3 @@ -export { b2 as MemoryRouter, b3 as Navigate, b4 as Outlet, b5 as Route, b6 as Router, b7 as RouterProvider, b8 as Routes, aR as UNSAFE_AwaitContextProvider, by as UNSAFE_WithComponentProps, bC as UNSAFE_WithErrorBoundaryProps, bA as UNSAFE_WithHydrateFallbackProps } from './router-5fbeEIMQ.mjs'; -export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-P7VgYu6T.mjs'; +export { b2 as MemoryRouter, b3 as Navigate, b4 as Outlet, b5 as Route, b6 as Router, b7 as RouterProvider, b8 as Routes, aR as UNSAFE_AwaitContextProvider, by as UNSAFE_WithComponentProps, bC as UNSAFE_WithErrorBoundaryProps, bA as UNSAFE_WithHydrateFallbackProps } from './router-CwNp5l9u.mjs'; +export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-CipGfVBI.mjs'; import 'react'; diff --git a/node_modules/react-router/dist/development/index-react-server-client.d.ts b/node_modules/react-router/dist/development/index-react-server-client.d.ts index f87529b1..1fc766d9 100644 --- a/node_modules/react-router/dist/development/index-react-server-client.d.ts +++ b/node_modules/react-router/dist/development/index-react-server-client.d.ts @@ -1,3 +1,3 @@ -export { b2 as MemoryRouter, b3 as Navigate, b4 as Outlet, b5 as Route, b6 as Router, b7 as RouterProvider, b8 as Routes, aP as UNSAFE_AwaitContextProvider, by as UNSAFE_WithComponentProps, bC as UNSAFE_WithErrorBoundaryProps, bA as UNSAFE_WithHydrateFallbackProps } from './instrumentation-BlrVzjbg.js'; -export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-Cv5Q9lf0.js'; +export { b2 as MemoryRouter, b3 as Navigate, b4 as Outlet, b5 as Route, b6 as Router, b7 as RouterProvider, b8 as Routes, aP as UNSAFE_AwaitContextProvider, by as UNSAFE_WithComponentProps, bC as UNSAFE_WithErrorBoundaryProps, bA as UNSAFE_WithHydrateFallbackProps } from './instrumentation-BB0wRuqz.js'; +export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-CCjKYJTH.js'; import 'react'; diff --git a/node_modules/react-router/dist/development/index-react-server-client.js b/node_modules/react-router/dist/development/index-react-server-client.js index dcf2eacf..c2f91c23 100644 --- a/node_modules/react-router/dist/development/index-react-server-client.js +++ b/node_modules/react-router/dist/development/index-react-server-client.js @@ -1,5 +1,5 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true});/** - * react-router v7.11.0 + * react-router v7.10.1 * * Copyright (c) Remix Software Inc. * @@ -19,7 +19,7 @@ -var _chunk2JY4UAJAjs = require('./chunk-2JY4UAJA.js'); +var _chunkHMTWJNYBjs = require('./chunk-HMTWJNYB.js'); @@ -34,7 +34,7 @@ var _chunk2JY4UAJAjs = require('./chunk-2JY4UAJA.js'); -var _chunkSZQUWNVJjs = require('./chunk-SZQUWNVJ.js'); +var _chunkRBZI3ZHDjs = require('./chunk-RBZI3ZHD.js'); @@ -58,4 +58,4 @@ var _chunkSZQUWNVJjs = require('./chunk-SZQUWNVJ.js'); -exports.BrowserRouter = _chunk2JY4UAJAjs.BrowserRouter; exports.Form = _chunk2JY4UAJAjs.Form; exports.HashRouter = _chunk2JY4UAJAjs.HashRouter; exports.Link = _chunk2JY4UAJAjs.Link; exports.Links = _chunkSZQUWNVJjs.Links; exports.MemoryRouter = _chunkSZQUWNVJjs.MemoryRouter; exports.Meta = _chunkSZQUWNVJjs.Meta; exports.NavLink = _chunk2JY4UAJAjs.NavLink; exports.Navigate = _chunkSZQUWNVJjs.Navigate; exports.Outlet = _chunkSZQUWNVJjs.Outlet; exports.Route = _chunkSZQUWNVJjs.Route; exports.Router = _chunkSZQUWNVJjs.Router; exports.RouterProvider = _chunkSZQUWNVJjs.RouterProvider; exports.Routes = _chunkSZQUWNVJjs.Routes; exports.ScrollRestoration = _chunk2JY4UAJAjs.ScrollRestoration; exports.StaticRouter = _chunk2JY4UAJAjs.StaticRouter; exports.StaticRouterProvider = _chunk2JY4UAJAjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunkSZQUWNVJjs.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunkSZQUWNVJjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkSZQUWNVJjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkSZQUWNVJjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunk2JY4UAJAjs.HistoryRouter; +exports.BrowserRouter = _chunkHMTWJNYBjs.BrowserRouter; exports.Form = _chunkHMTWJNYBjs.Form; exports.HashRouter = _chunkHMTWJNYBjs.HashRouter; exports.Link = _chunkHMTWJNYBjs.Link; exports.Links = _chunkRBZI3ZHDjs.Links; exports.MemoryRouter = _chunkRBZI3ZHDjs.MemoryRouter; exports.Meta = _chunkRBZI3ZHDjs.Meta; exports.NavLink = _chunkHMTWJNYBjs.NavLink; exports.Navigate = _chunkRBZI3ZHDjs.Navigate; exports.Outlet = _chunkRBZI3ZHDjs.Outlet; exports.Route = _chunkRBZI3ZHDjs.Route; exports.Router = _chunkRBZI3ZHDjs.Router; exports.RouterProvider = _chunkRBZI3ZHDjs.RouterProvider; exports.Routes = _chunkRBZI3ZHDjs.Routes; exports.ScrollRestoration = _chunkHMTWJNYBjs.ScrollRestoration; exports.StaticRouter = _chunkHMTWJNYBjs.StaticRouter; exports.StaticRouterProvider = _chunkHMTWJNYBjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunkRBZI3ZHDjs.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunkRBZI3ZHDjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkRBZI3ZHDjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkRBZI3ZHDjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkHMTWJNYBjs.HistoryRouter; diff --git a/node_modules/react-router/dist/development/index-react-server-client.mjs b/node_modules/react-router/dist/development/index-react-server-client.mjs index 32e8d013..5190516b 100644 --- a/node_modules/react-router/dist/development/index-react-server-client.mjs +++ b/node_modules/react-router/dist/development/index-react-server-client.mjs @@ -1,5 +1,5 @@ /** - * react-router v7.11.0 + * react-router v7.10.1 * * Copyright (c) Remix Software Inc. * @@ -32,7 +32,7 @@ import { WithComponentProps, WithErrorBoundaryProps, WithHydrateFallbackProps -} from "./chunk-JMJ3UQ3L.mjs"; +} from "./chunk-WWGJGFF6.mjs"; export { BrowserRouter, Form, diff --git a/node_modules/react-router/dist/development/index-react-server.d.mts b/node_modules/react-router/dist/development/index-react-server.d.mts index d5a6d724..aab803d8 100644 --- a/node_modules/react-router/dist/development/index-react-server.d.mts +++ b/node_modules/react-router/dist/development/index-react-server.d.mts @@ -1369,7 +1369,6 @@ type BaseNavigateOrFetchOptions = { preventScrollReset?: boolean; relative?: RelativeRoutingType; flushSync?: boolean; - unstable_defaultShouldRevalidate?: boolean; }; type BaseNavigateOptions = BaseNavigateOrFetchOptions & { replace?: boolean; @@ -2193,7 +2192,7 @@ type RSCMatch = { }; type DecodeActionFunction = (formData: FormData) => Promise<() => Promise>; type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown; -type DecodeReplyFunction = (reply: FormData | string, options: { +type DecodeReplyFunction = (reply: FormData | string, { temporaryReferences }: { temporaryReferences: unknown; }) => Promise; type LoadServerActionFunction = (id: string) => Promise; @@ -2278,8 +2277,7 @@ declare function matchRSCServerRequest({ createTemporaryReferenceSet, basename, onError?: (error: unknown) => void; request: Request; routes: RSCRouteConfigEntry[]; - generateResponse: (match: RSCMatch, { onError, temporaryReferences, }: { - onError(error: unknown): string | undefined; + generateResponse: (match: RSCMatch, { temporaryReferences, }: { temporaryReferences: unknown; }) => Response; }): Promise; diff --git a/node_modules/react-router/dist/development/index-react-server.d.ts b/node_modules/react-router/dist/development/index-react-server.d.ts index d5a6d724..aab803d8 100644 --- a/node_modules/react-router/dist/development/index-react-server.d.ts +++ b/node_modules/react-router/dist/development/index-react-server.d.ts @@ -1369,7 +1369,6 @@ type BaseNavigateOrFetchOptions = { preventScrollReset?: boolean; relative?: RelativeRoutingType; flushSync?: boolean; - unstable_defaultShouldRevalidate?: boolean; }; type BaseNavigateOptions = BaseNavigateOrFetchOptions & { replace?: boolean; @@ -2193,7 +2192,7 @@ type RSCMatch = { }; type DecodeActionFunction = (formData: FormData) => Promise<() => Promise>; type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown; -type DecodeReplyFunction = (reply: FormData | string, options: { +type DecodeReplyFunction = (reply: FormData | string, { temporaryReferences }: { temporaryReferences: unknown; }) => Promise; type LoadServerActionFunction = (id: string) => Promise; @@ -2278,8 +2277,7 @@ declare function matchRSCServerRequest({ createTemporaryReferenceSet, basename, onError?: (error: unknown) => void; request: Request; routes: RSCRouteConfigEntry[]; - generateResponse: (match: RSCMatch, { onError, temporaryReferences, }: { - onError(error: unknown): string | undefined; + generateResponse: (match: RSCMatch, { temporaryReferences, }: { temporaryReferences: unknown; }) => Response; }): Promise; diff --git a/node_modules/react-router/dist/development/index-react-server.js b/node_modules/react-router/dist/development/index-react-server.js index c519b430..a525c41b 100644 --- a/node_modules/react-router/dist/development/index-react-server.js +++ b/node_modules/react-router/dist/development/index-react-server.js @@ -27,7 +27,7 @@ function _interopNamespace(e) { var React2__namespace = /*#__PURE__*/_interopNamespace(React2); /** - * react-router v7.11.0 + * react-router v7.10.1 * * Copyright (c) Remix Software Inc. * @@ -1850,7 +1850,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request, handler: lazyRoutePromises.lazyHandlerPromise }; } -function getDataStrategyMatch(mapRouteProperties, manifest, request, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) { +function getDataStrategyMatch(mapRouteProperties, manifest, request, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null) { let isUsingNewApi = false; let _lazyPromises = getDataStrategyMatchLazyPromises( mapRouteProperties, @@ -2393,43 +2393,6 @@ function prependCookies(parentHeaders, childHeaders) { } } var SINGLE_FETCH_REDIRECT_STATUS = 202; - -// lib/errors.ts -var ERROR_DIGEST_BASE = "REACT_ROUTER_ERROR"; -var ERROR_DIGEST_REDIRECT = "REDIRECT"; -var ERROR_DIGEST_ROUTE_ERROR_RESPONSE = "ROUTE_ERROR_RESPONSE"; -function createRedirectErrorDigest(response) { - return `${ERROR_DIGEST_BASE}:${ERROR_DIGEST_REDIRECT}:${JSON.stringify({ - status: response.status, - statusText: response.statusText, - location: response.headers.get("Location"), - reloadDocument: response.headers.get("X-Remix-Reload-Document") === "true", - replace: response.headers.get("X-Remix-Replace") === "true" - })}`; -} -function createRouteErrorResponseDigest(response) { - let status = 500; - let statusText = ""; - let data2; - if (isDataWithResponseInit(response)) { - status = response.init?.status ?? status; - statusText = response.init?.statusText ?? statusText; - data2 = response.data; - } else { - status = response.status; - statusText = response.statusText; - data2 = void 0; - } - return `${ERROR_DIGEST_BASE}:${ERROR_DIGEST_ROUTE_ERROR_RESPONSE}:${JSON.stringify( - { - status, - statusText, - data: data2 - } - )}`; -} - -// lib/rsc/server.rsc.ts var Outlet = reactServerClient.Outlet; var WithComponentProps = reactServerClient.UNSAFE_WithComponentProps; var WithErrorBoundaryProps = reactServerClient.UNSAFE_WithErrorBoundaryProps; @@ -2501,28 +2464,8 @@ async function matchRSCServerRequest({ routes, generateResponse }) { - let url = new URL(request.url); - basename = basename || "/"; - let normalizedPath = url.pathname; - if (stripBasename(normalizedPath, basename) === "/_root.rsc") { - normalizedPath = basename; - } else if (normalizedPath.endsWith(".rsc")) { - normalizedPath = normalizedPath.replace(/\.rsc$/, ""); - } - if (stripBasename(normalizedPath, basename) !== "/" && normalizedPath.endsWith("/")) { - normalizedPath = normalizedPath.slice(0, -1); - } - url.pathname = normalizedPath; - basename = basename.length > normalizedPath.length ? normalizedPath : basename; - let routerRequest = new Request(url.toString(), { - method: request.method, - headers: request.headers, - body: request.body, - signal: request.signal, - duplex: request.body ? "half" : void 0 - }); + let requestUrl = new URL(request.url); const temporaryReferences = createTemporaryReferenceSet(); - const requestUrl = new URL(request.url); if (isManifestRequest(requestUrl)) { let response2 = await generateManifestResponse( routes, @@ -2534,6 +2477,18 @@ async function matchRSCServerRequest({ return response2; } let isDataRequest = isReactServerRequest(requestUrl); + const url = new URL(request.url); + let routerRequest = request; + if (isDataRequest) { + url.pathname = url.pathname.replace(/(_root)?\.rsc$/, ""); + routerRequest = new Request(url.toString(), { + method: request.method, + headers: request.headers, + body: request.body, + signal: request.signal, + duplex: request.body ? "half" : void 0 + }); + } let matches = matchRoutes(routes, url.pathname, basename); if (matches) { await Promise.all(matches.map((m) => explodeLazyRoute(m.route))); @@ -2605,7 +2560,7 @@ async function generateManifestResponse(routes, basename, request, generateRespo }), payload }, - { temporaryReferences, onError: defaultOnError } + { temporaryReferences } ); } function prependBasenameToRedirectResponse(response, basename = "/") { @@ -2883,7 +2838,7 @@ function generateRedirectResponse(response, actionResult, basename, isDataReques headers, payload }, - { temporaryReferences, onError: defaultOnError } + { temporaryReferences } ); } async function generateStaticContextResponse(routes, basename, generateResponse, statusCode, routeIdsToLoad, isDataRequest, isSubmission, actionResult, formState, staticContext, temporaryReferences, skipRevalidation, sideEffectRedirectHeaders) { @@ -2913,7 +2868,7 @@ async function generateStaticContextResponse(routes, basename, generateResponse, headers.delete("Content-Length"); const baseRenderPayload = { type: "render", - basename: staticContext.basename, + basename, actionData: staticContext.actionData, errors: staticContext.errors, loaderData: staticContext.loaderData, @@ -2950,7 +2905,7 @@ async function generateStaticContextResponse(routes, basename, generateResponse, headers, payload }, - { temporaryReferences, onError: defaultOnError } + { temporaryReferences } ); } async function getRenderPayload(baseRenderPayload, routes, basename, routeIdsToLoad, isDataRequest, staticContext) { @@ -3161,14 +3116,6 @@ function isReactServerRequest(url) { function isManifestRequest(url) { return url.pathname.endsWith(".manifest"); } -function defaultOnError(error) { - if (isRedirectResponse(error)) { - return createRedirectErrorDigest(error); - } - if (isResponse(error) || isDataWithResponseInit(error)) { - return createRouteErrorResponseDigest(error); - } -} function isClientReference(x) { try { return x.$$typeof === Symbol.for("react.client.reference"); diff --git a/node_modules/react-router/dist/development/index-react-server.mjs b/node_modules/react-router/dist/development/index-react-server.mjs index 91fc639b..a667d8d2 100644 --- a/node_modules/react-router/dist/development/index-react-server.mjs +++ b/node_modules/react-router/dist/development/index-react-server.mjs @@ -6,7 +6,7 @@ export { BrowserRouter, Form, HashRouter, Link, Links, MemoryRouter, Meta, NavLi import { serialize, parse } from 'cookie'; /** - * react-router v7.11.0 + * react-router v7.10.1 * * Copyright (c) Remix Software Inc. * @@ -1829,7 +1829,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request, handler: lazyRoutePromises.lazyHandlerPromise }; } -function getDataStrategyMatch(mapRouteProperties, manifest, request, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) { +function getDataStrategyMatch(mapRouteProperties, manifest, request, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null) { let isUsingNewApi = false; let _lazyPromises = getDataStrategyMatchLazyPromises( mapRouteProperties, @@ -2372,43 +2372,6 @@ function prependCookies(parentHeaders, childHeaders) { } } var SINGLE_FETCH_REDIRECT_STATUS = 202; - -// lib/errors.ts -var ERROR_DIGEST_BASE = "REACT_ROUTER_ERROR"; -var ERROR_DIGEST_REDIRECT = "REDIRECT"; -var ERROR_DIGEST_ROUTE_ERROR_RESPONSE = "ROUTE_ERROR_RESPONSE"; -function createRedirectErrorDigest(response) { - return `${ERROR_DIGEST_BASE}:${ERROR_DIGEST_REDIRECT}:${JSON.stringify({ - status: response.status, - statusText: response.statusText, - location: response.headers.get("Location"), - reloadDocument: response.headers.get("X-Remix-Reload-Document") === "true", - replace: response.headers.get("X-Remix-Replace") === "true" - })}`; -} -function createRouteErrorResponseDigest(response) { - let status = 500; - let statusText = ""; - let data2; - if (isDataWithResponseInit(response)) { - status = response.init?.status ?? status; - statusText = response.init?.statusText ?? statusText; - data2 = response.data; - } else { - status = response.status; - statusText = response.statusText; - data2 = void 0; - } - return `${ERROR_DIGEST_BASE}:${ERROR_DIGEST_ROUTE_ERROR_RESPONSE}:${JSON.stringify( - { - status, - statusText, - data: data2 - } - )}`; -} - -// lib/rsc/server.rsc.ts var Outlet = Outlet$1; var WithComponentProps = UNSAFE_WithComponentProps; var WithErrorBoundaryProps = UNSAFE_WithErrorBoundaryProps; @@ -2480,28 +2443,8 @@ async function matchRSCServerRequest({ routes, generateResponse }) { - let url = new URL(request.url); - basename = basename || "/"; - let normalizedPath = url.pathname; - if (stripBasename(normalizedPath, basename) === "/_root.rsc") { - normalizedPath = basename; - } else if (normalizedPath.endsWith(".rsc")) { - normalizedPath = normalizedPath.replace(/\.rsc$/, ""); - } - if (stripBasename(normalizedPath, basename) !== "/" && normalizedPath.endsWith("/")) { - normalizedPath = normalizedPath.slice(0, -1); - } - url.pathname = normalizedPath; - basename = basename.length > normalizedPath.length ? normalizedPath : basename; - let routerRequest = new Request(url.toString(), { - method: request.method, - headers: request.headers, - body: request.body, - signal: request.signal, - duplex: request.body ? "half" : void 0 - }); + let requestUrl = new URL(request.url); const temporaryReferences = createTemporaryReferenceSet(); - const requestUrl = new URL(request.url); if (isManifestRequest(requestUrl)) { let response2 = await generateManifestResponse( routes, @@ -2513,6 +2456,18 @@ async function matchRSCServerRequest({ return response2; } let isDataRequest = isReactServerRequest(requestUrl); + const url = new URL(request.url); + let routerRequest = request; + if (isDataRequest) { + url.pathname = url.pathname.replace(/(_root)?\.rsc$/, ""); + routerRequest = new Request(url.toString(), { + method: request.method, + headers: request.headers, + body: request.body, + signal: request.signal, + duplex: request.body ? "half" : void 0 + }); + } let matches = matchRoutes(routes, url.pathname, basename); if (matches) { await Promise.all(matches.map((m) => explodeLazyRoute(m.route))); @@ -2584,7 +2539,7 @@ async function generateManifestResponse(routes, basename, request, generateRespo }), payload }, - { temporaryReferences, onError: defaultOnError } + { temporaryReferences } ); } function prependBasenameToRedirectResponse(response, basename = "/") { @@ -2862,7 +2817,7 @@ function generateRedirectResponse(response, actionResult, basename, isDataReques headers, payload }, - { temporaryReferences, onError: defaultOnError } + { temporaryReferences } ); } async function generateStaticContextResponse(routes, basename, generateResponse, statusCode, routeIdsToLoad, isDataRequest, isSubmission, actionResult, formState, staticContext, temporaryReferences, skipRevalidation, sideEffectRedirectHeaders) { @@ -2892,7 +2847,7 @@ async function generateStaticContextResponse(routes, basename, generateResponse, headers.delete("Content-Length"); const baseRenderPayload = { type: "render", - basename: staticContext.basename, + basename, actionData: staticContext.actionData, errors: staticContext.errors, loaderData: staticContext.loaderData, @@ -2929,7 +2884,7 @@ async function generateStaticContextResponse(routes, basename, generateResponse, headers, payload }, - { temporaryReferences, onError: defaultOnError } + { temporaryReferences } ); } async function getRenderPayload(baseRenderPayload, routes, basename, routeIdsToLoad, isDataRequest, staticContext) { @@ -3140,14 +3095,6 @@ function isReactServerRequest(url) { function isManifestRequest(url) { return url.pathname.endsWith(".manifest"); } -function defaultOnError(error) { - if (isRedirectResponse(error)) { - return createRedirectErrorDigest(error); - } - if (isResponse(error) || isDataWithResponseInit(error)) { - return createRouteErrorResponseDigest(error); - } -} function isClientReference(x) { try { return x.$$typeof === Symbol.for("react.client.reference"); diff --git a/node_modules/react-router/dist/development/index.d.mts b/node_modules/react-router/dist/development/index.d.mts index 323a5489..5b05840c 100644 --- a/node_modules/react-router/dist/development/index.d.mts +++ b/node_modules/react-router/dist/development/index.d.mts @@ -1,15 +1,15 @@ -import { p as Router, q as RouteModules, r as DataStrategyFunction, s as MiddlewareEnabled, c as RouterContextProvider, t as AppLoadContext, T as To, v as NavigateOptions, B as BlockerFunction, w as Blocker, x as SerializeFrom, y as RelativeRoutingType, L as Location, z as ParamParseKey, E as Path, I as PathPattern, J as PathMatch, U as UIMatch, K as Navigation, O as Action, P as Params, Q as RouteObject, G as GetLoaderData, o as GetActionData, V as InitialEntry, W as HydrationState, X as IndexRouteObject, Y as RouteComponentType, Z as HydrateFallbackType, _ as ErrorBoundaryType, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, $ as NonIndexRouteObject, a0 as Equal, a1 as RouterState, a2 as PatchRoutesOnNavigationFunction, a3 as DataRouteObject, a as ClientLoaderFunction } from './router-5fbeEIMQ.mjs'; -export { ae as ActionFunctionArgs, b1 as Await, aS as AwaitProps, C as ClientActionFunction, bd as ClientActionFunctionArgs, be as ClientLoaderFunctionArgs, g as ClientOnErrorFunction, aN as DataRouteMatch, af as DataStrategyFunctionArgs, ag as DataStrategyMatch, D as DataStrategyResult, ai as ErrorResponse, a8 as Fetcher, aj as FormEncType, ak as FormMethod, bj as Future, a5 as GetScrollPositionFunction, a6 as GetScrollRestorationKeyFunction, al as HTMLFormMethod, bf as HeadersArgs, H as HeadersFunction, bi as HtmlLinkDescriptor, aD as IDLE_BLOCKER, aC as IDLE_FETCHER, aB as IDLE_NAVIGATION, aT as IndexRouteProps, aU as LayoutRouteProps, am as LazyRouteFunction, h as LinkDescriptor, an as LoaderFunctionArgs, b2 as MemoryRouter, aV as MemoryRouterOpts, aW as MemoryRouterProps, bg as MetaArgs, j as MetaDescriptor, ao as MiddlewareFunction, b3 as Navigate, aX as NavigateProps, a9 as NavigationStates, aO as Navigator, b4 as Outlet, aY as OutletProps, bh as PageLinkDescriptor, aP as PatchRoutesOnNavigationFunctionArgs, ap as PathParam, aZ as PathRouteProps, aq as RedirectFunction, ad as RevalidationState, b5 as Route, aQ as RouteMatch, a_ as RouteProps, b6 as Router, ar as RouterContext, ac as RouterFetchOptions, e as RouterInit, ab as RouterNavigateOptions, a$ as RouterProps, b7 as RouterProvider, f as RouterProviderProps, aa as RouterSubscriber, b8 as Routes, b0 as RoutesProps, S as ShouldRevalidateFunction, as as ShouldRevalidateFunctionArgs, a4 as StaticHandler, a7 as StaticHandlerContext, aR as UNSAFE_AwaitContextProvider, bp as UNSAFE_DataRouterContext, bq as UNSAFE_DataRouterStateContext, ah as UNSAFE_DataWithResponseInit, bo as UNSAFE_ErrorResponseImpl, br as UNSAFE_FetchersContext, bs as UNSAFE_LocationContext, bt as UNSAFE_NavigationContext, bu as UNSAFE_RouteContext, bv as UNSAFE_ViewTransitionContext, by as UNSAFE_WithComponentProps, bC as UNSAFE_WithErrorBoundaryProps, bA as UNSAFE_WithHydrateFallbackProps, bl as UNSAFE_createBrowserHistory, bn as UNSAFE_createRouter, bw as UNSAFE_hydrationRouteProperties, bm as UNSAFE_invariant, bx as UNSAFE_mapRouteProperties, bz as UNSAFE_withComponentProps, bD as UNSAFE_withErrorBoundaryProps, bB as UNSAFE_withHydrateFallbackProps, at as createContext, b9 as createMemoryRouter, au as createPath, ba as createRoutesFromChildren, bb as createRoutesFromElements, aE as data, aF as generatePath, aG as isRouteErrorResponse, aH as matchPath, aI as matchRoutes, av as parsePath, aJ as redirect, aK as redirectDocument, bc as renderMatches, aL as replace, aM as resolvePath, u as unstable_ClientInstrumentation, ax as unstable_InstrumentRequestHandlerFunction, az as unstable_InstrumentRouteFunction, ay as unstable_InstrumentRouterFunction, aA as unstable_InstrumentationHandlerResult, bk as unstable_SerializesTo, aw as unstable_ServerInstrumentation } from './router-5fbeEIMQ.mjs'; +import { p as Router, q as RouteModules, r as DataStrategyFunction, s as MiddlewareEnabled, c as RouterContextProvider, t as AppLoadContext, T as To, v as NavigateOptions, B as BlockerFunction, w as Blocker, x as SerializeFrom, y as RelativeRoutingType, L as Location, z as ParamParseKey, E as Path, I as PathPattern, J as PathMatch, U as UIMatch, K as Navigation, O as Action, P as Params, Q as RouteObject, G as GetLoaderData, o as GetActionData, V as InitialEntry, W as HydrationState, X as IndexRouteObject, Y as RouteComponentType, Z as HydrateFallbackType, _ as ErrorBoundaryType, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, $ as NonIndexRouteObject, a0 as Equal, a1 as RouterState, a2 as PatchRoutesOnNavigationFunction, a3 as DataRouteObject, a as ClientLoaderFunction } from './router-CwNp5l9u.mjs'; +export { ae as ActionFunctionArgs, b1 as Await, aS as AwaitProps, C as ClientActionFunction, bd as ClientActionFunctionArgs, be as ClientLoaderFunctionArgs, aN as DataRouteMatch, af as DataStrategyFunctionArgs, ag as DataStrategyMatch, D as DataStrategyResult, ai as ErrorResponse, a8 as Fetcher, aj as FormEncType, ak as FormMethod, bj as Future, a5 as GetScrollPositionFunction, a6 as GetScrollRestorationKeyFunction, al as HTMLFormMethod, bf as HeadersArgs, H as HeadersFunction, bi as HtmlLinkDescriptor, aD as IDLE_BLOCKER, aC as IDLE_FETCHER, aB as IDLE_NAVIGATION, aT as IndexRouteProps, aU as LayoutRouteProps, am as LazyRouteFunction, h as LinkDescriptor, an as LoaderFunctionArgs, b2 as MemoryRouter, aV as MemoryRouterOpts, aW as MemoryRouterProps, bg as MetaArgs, j as MetaDescriptor, ao as MiddlewareFunction, b3 as Navigate, aX as NavigateProps, a9 as NavigationStates, aO as Navigator, b4 as Outlet, aY as OutletProps, bh as PageLinkDescriptor, aP as PatchRoutesOnNavigationFunctionArgs, ap as PathParam, aZ as PathRouteProps, aq as RedirectFunction, ad as RevalidationState, b5 as Route, aQ as RouteMatch, a_ as RouteProps, b6 as Router, ar as RouterContext, ac as RouterFetchOptions, e as RouterInit, ab as RouterNavigateOptions, a$ as RouterProps, b7 as RouterProvider, f as RouterProviderProps, aa as RouterSubscriber, b8 as Routes, b0 as RoutesProps, S as ShouldRevalidateFunction, as as ShouldRevalidateFunctionArgs, a4 as StaticHandler, a7 as StaticHandlerContext, aR as UNSAFE_AwaitContextProvider, bp as UNSAFE_DataRouterContext, bq as UNSAFE_DataRouterStateContext, ah as UNSAFE_DataWithResponseInit, bo as UNSAFE_ErrorResponseImpl, br as UNSAFE_FetchersContext, bs as UNSAFE_LocationContext, bt as UNSAFE_NavigationContext, bu as UNSAFE_RouteContext, bv as UNSAFE_ViewTransitionContext, by as UNSAFE_WithComponentProps, bC as UNSAFE_WithErrorBoundaryProps, bA as UNSAFE_WithHydrateFallbackProps, bl as UNSAFE_createBrowserHistory, bn as UNSAFE_createRouter, bw as UNSAFE_hydrationRouteProperties, bm as UNSAFE_invariant, bx as UNSAFE_mapRouteProperties, bz as UNSAFE_withComponentProps, bD as UNSAFE_withErrorBoundaryProps, bB as UNSAFE_withHydrateFallbackProps, at as createContext, b9 as createMemoryRouter, au as createPath, ba as createRoutesFromChildren, bb as createRoutesFromElements, aE as data, aF as generatePath, aG as isRouteErrorResponse, aH as matchPath, aI as matchRoutes, av as parsePath, aJ as redirect, aK as redirectDocument, bc as renderMatches, aL as replace, aM as resolvePath, u as unstable_ClientInstrumentation, g as unstable_ClientOnErrorFunction, ax as unstable_InstrumentRequestHandlerFunction, az as unstable_InstrumentRouteFunction, ay as unstable_InstrumentRouterFunction, aA as unstable_InstrumentationHandlerResult, bk as unstable_SerializesTo, aw as unstable_ServerInstrumentation } from './router-CwNp5l9u.mjs'; import * as React from 'react'; import React__default, { ReactElement } from 'react'; -import { a as RouteModules$1, P as Pages } from './register-DTJJbt1o.mjs'; -export { b as Register } from './register-DTJJbt1o.mjs'; -import { A as AssetsManifest, S as ServerBuild, E as EntryContext, F as FutureConfig } from './index-react-server-client-P7VgYu6T.mjs'; -export { l as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, a1 as DiscoverBehavior, c as FetcherFormProps, h as FetcherSubmitFunction, G as FetcherSubmitOptions, i as FetcherWithComponents, q as Form, d as FormProps, a2 as HandleDataRequestFunction, a3 as HandleDocumentRequestFunction, a4 as HandleErrorFunction, m as HashRouter, H as HashRouterProps, a as HistoryRouterProps, n as Link, L as LinkProps, X as Links, _ as LinksProps, W as Meta, p as NavLink, N as NavLinkProps, b as NavLinkRenderProps, P as ParamKeyValuePair, a0 as PrefetchBehavior, Z as PrefetchPageLinks, Y as Scripts, $ as ScriptsProps, r as ScrollRestoration, e as ScrollRestorationProps, a5 as ServerEntryModule, f as SetURLSearchParams, T as StaticRouter, M as StaticRouterProps, V as StaticRouterProvider, O as StaticRouterProviderProps, g as SubmitFunction, I as SubmitOptions, J as SubmitTarget, a6 as UNSAFE_FrameworkContext, a7 as UNSAFE_createClientRoutes, a8 as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, a9 as UNSAFE_shouldHydrateRouteLoader, aa as UNSAFE_useScrollRestoration, U as URLSearchParamsInit, j as createBrowserRouter, k as createHashRouter, K as createSearchParams, Q as createStaticHandler, R as createStaticRouter, o as unstable_HistoryRouter, z as unstable_usePrompt, y as useBeforeUnload, w as useFetcher, x as useFetchers, v as useFormAction, u as useLinkClickHandler, s as useSearchParams, t as useSubmit, C as useViewTransitionState } from './index-react-server-client-P7VgYu6T.mjs'; +import { a as RouteModules$1, P as Pages } from './register-C1RwVJAt.mjs'; +export { b as Register } from './register-C1RwVJAt.mjs'; +import { A as AssetsManifest, S as ServerBuild, E as EntryContext, F as FutureConfig } from './index-react-server-client-CipGfVBI.mjs'; +export { l as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, a1 as DiscoverBehavior, c as FetcherFormProps, h as FetcherSubmitFunction, G as FetcherSubmitOptions, i as FetcherWithComponents, q as Form, d as FormProps, a2 as HandleDataRequestFunction, a3 as HandleDocumentRequestFunction, a4 as HandleErrorFunction, m as HashRouter, H as HashRouterProps, a as HistoryRouterProps, n as Link, L as LinkProps, X as Links, _ as LinksProps, W as Meta, p as NavLink, N as NavLinkProps, b as NavLinkRenderProps, P as ParamKeyValuePair, a0 as PrefetchBehavior, Z as PrefetchPageLinks, Y as Scripts, $ as ScriptsProps, r as ScrollRestoration, e as ScrollRestorationProps, a5 as ServerEntryModule, f as SetURLSearchParams, T as StaticRouter, M as StaticRouterProps, V as StaticRouterProvider, O as StaticRouterProviderProps, g as SubmitFunction, I as SubmitOptions, J as SubmitTarget, a6 as UNSAFE_FrameworkContext, a7 as UNSAFE_createClientRoutes, a8 as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, a9 as UNSAFE_shouldHydrateRouteLoader, aa as UNSAFE_useScrollRestoration, U as URLSearchParamsInit, j as createBrowserRouter, k as createHashRouter, K as createSearchParams, Q as createStaticHandler, R as createStaticRouter, o as unstable_HistoryRouter, z as unstable_usePrompt, y as useBeforeUnload, w as useFetcher, x as useFetchers, v as useFormAction, u as useLinkClickHandler, s as useSearchParams, t as useSubmit, C as useViewTransitionState } from './index-react-server-client-CipGfVBI.mjs'; import { ParseOptions, SerializeOptions } from 'cookie'; export { ParseOptions as CookieParseOptions, SerializeOptions as CookieSerializeOptions } from 'cookie'; -import { e as RSCPayload, m as matchRSCServerRequest } from './browser-Cv4JZyZ5.mjs'; -export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, g as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, h as unstable_RSCMatch, f as unstable_RSCRenderPayload, l as unstable_RSCRouteConfig, k as unstable_RSCRouteConfigEntry, i as unstable_RSCRouteManifest, j as unstable_RSCRouteMatch } from './browser-Cv4JZyZ5.mjs'; +import { e as RSCPayload, m as matchRSCServerRequest } from './browser-C5z6FZmz.mjs'; +export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, g as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, h as unstable_RSCMatch, f as unstable_RSCRenderPayload, l as unstable_RSCRouteConfig, k as unstable_RSCRouteConfigEntry, i as unstable_RSCRouteManifest, j as unstable_RSCRouteMatch } from './browser-C5z6FZmz.mjs'; declare const SingleFetchRedirectSymbol: unique symbol; declare function getTurboStreamSingleFetchDataStrategy(getRouter: () => Router, manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, basename: string | undefined): DataStrategyFunction; @@ -1236,7 +1236,7 @@ type SSRCreateFromReadableStreamFunction = (body: ReadableStream) => * * routeRSCServerRequest({ * request, - * serverResponse, + * fetchServer, * createFromReadableStream, * async renderHTML(getPayload) { * const payload = getPayload(); @@ -1258,7 +1258,9 @@ type SSRCreateFromReadableStreamFunction = (body: ReadableStream) => * @param opts Options * @param opts.createFromReadableStream Your `react-server-dom-xyz/client`'s * `createFromReadableStream` function, used to decode payloads from the server. - * @param opts.serverResponse A Response or partial response generated by the [RSC](https://react.dev/reference/rsc/server-components) handler containing a serialized {@link unstable_RSCPayload}. + * @param opts.fetchServer A function that forwards a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) + * to the [RSC](https://react.dev/reference/rsc/server-components) handler + * and returns a `Promise` containing a serialized {@link unstable_RSCPayload}. * @param opts.hydrate Whether to hydrate the server response with the RSC payload. * Defaults to `true`. * @param opts.renderHTML A function that renders the {@link unstable_RSCPayload} to @@ -1268,14 +1270,11 @@ type SSRCreateFromReadableStreamFunction = (body: ReadableStream) => * that either contains the [RSC](https://react.dev/reference/rsc/server-components) * payload for data requests, or renders the HTML for document requests. */ -declare function routeRSCServerRequest({ request, serverResponse, createFromReadableStream, renderHTML, hydrate, }: { +declare function routeRSCServerRequest({ request, fetchServer, createFromReadableStream, renderHTML, hydrate, }: { request: Request; - serverResponse: Response; + fetchServer: (request: Request) => Promise; createFromReadableStream: SSRCreateFromReadableStreamFunction; - renderHTML: (getPayload: () => DecodedPayload, options: { - onError(error: unknown): string | undefined; - onHeaders(headers: Headers): void; - }) => ReadableStream | Promise>; + renderHTML: (getPayload: () => DecodedPayload) => ReadableStream | Promise>; hydrate?: boolean; }): Promise; /** @@ -1305,7 +1304,7 @@ interface RSCStaticRouterProps { * * routeRSCServerRequest({ * request, - * serverResponse, + * fetchServer, * createFromReadableStream, * async renderHTML(getPayload) { * const payload = getPayload(); diff --git a/node_modules/react-router/dist/development/index.d.ts b/node_modules/react-router/dist/development/index.d.ts index 634ed14e..e68178c4 100644 --- a/node_modules/react-router/dist/development/index.d.ts +++ b/node_modules/react-router/dist/development/index.d.ts @@ -1,15 +1,15 @@ -import { n as Router, o as RouteModules, p as DataStrategyFunction, q as MiddlewareEnabled, c as RouterContextProvider, r as AppLoadContext, T as To, s as NavigateOptions, B as BlockerFunction, t as Blocker, v as SerializeFrom, w as RelativeRoutingType, L as Location, x as ParamParseKey, y as Path, z as PathPattern, E as PathMatch, U as UIMatch, I as Navigation, J as Action, P as Params, K as RouteObject, G as GetLoaderData, m as GetActionData, O as InitialEntry, Q as HydrationState, V as IndexRouteObject, W as RouteComponentType, X as HydrateFallbackType, Y as ErrorBoundaryType, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, Z as NonIndexRouteObject, _ as Equal, $ as RouterState, a0 as PatchRoutesOnNavigationFunction, a1 as DataRouteObject, a as ClientLoaderFunction } from './instrumentation-BlrVzjbg.js'; -export { ac as ActionFunctionArgs, b1 as Await, aQ as AwaitProps, C as ClientActionFunction, bd as ClientActionFunctionArgs, be as ClientLoaderFunctionArgs, aS as ClientOnErrorFunction, aL as DataRouteMatch, ad as DataStrategyFunctionArgs, ae as DataStrategyMatch, D as DataStrategyResult, ag as ErrorResponse, a6 as Fetcher, ah as FormEncType, ai as FormMethod, bj as Future, a3 as GetScrollPositionFunction, a4 as GetScrollRestorationKeyFunction, aj as HTMLFormMethod, bf as HeadersArgs, H as HeadersFunction, bi as HtmlLinkDescriptor, aB as IDLE_BLOCKER, aA as IDLE_FETCHER, az as IDLE_NAVIGATION, aR as IndexRouteProps, aT as LayoutRouteProps, ak as LazyRouteFunction, f as LinkDescriptor, al as LoaderFunctionArgs, b2 as MemoryRouter, aU as MemoryRouterOpts, aV as MemoryRouterProps, bg as MetaArgs, h as MetaDescriptor, am as MiddlewareFunction, b3 as Navigate, aW as NavigateProps, a7 as NavigationStates, aM as Navigator, b4 as Outlet, aX as OutletProps, bh as PageLinkDescriptor, aN as PatchRoutesOnNavigationFunctionArgs, an as PathParam, aY as PathRouteProps, ao as RedirectFunction, ab as RevalidationState, b5 as Route, aO as RouteMatch, aZ as RouteProps, b6 as Router, ap as RouterContext, aa as RouterFetchOptions, e as RouterInit, a9 as RouterNavigateOptions, a_ as RouterProps, b7 as RouterProvider, a$ as RouterProviderProps, a8 as RouterSubscriber, b8 as Routes, b0 as RoutesProps, S as ShouldRevalidateFunction, aq as ShouldRevalidateFunctionArgs, a2 as StaticHandler, a5 as StaticHandlerContext, aP as UNSAFE_AwaitContextProvider, bp as UNSAFE_DataRouterContext, bq as UNSAFE_DataRouterStateContext, af as UNSAFE_DataWithResponseInit, bo as UNSAFE_ErrorResponseImpl, br as UNSAFE_FetchersContext, bs as UNSAFE_LocationContext, bt as UNSAFE_NavigationContext, bu as UNSAFE_RouteContext, bv as UNSAFE_ViewTransitionContext, by as UNSAFE_WithComponentProps, bC as UNSAFE_WithErrorBoundaryProps, bA as UNSAFE_WithHydrateFallbackProps, bl as UNSAFE_createBrowserHistory, bn as UNSAFE_createRouter, bw as UNSAFE_hydrationRouteProperties, bm as UNSAFE_invariant, bx as UNSAFE_mapRouteProperties, bz as UNSAFE_withComponentProps, bD as UNSAFE_withErrorBoundaryProps, bB as UNSAFE_withHydrateFallbackProps, ar as createContext, b9 as createMemoryRouter, as as createPath, ba as createRoutesFromChildren, bb as createRoutesFromElements, aC as data, aD as generatePath, aE as isRouteErrorResponse, aF as matchPath, aG as matchRoutes, at as parsePath, aH as redirect, aI as redirectDocument, bc as renderMatches, aJ as replace, aK as resolvePath, u as unstable_ClientInstrumentation, av as unstable_InstrumentRequestHandlerFunction, ax as unstable_InstrumentRouteFunction, aw as unstable_InstrumentRouterFunction, ay as unstable_InstrumentationHandlerResult, bk as unstable_SerializesTo, au as unstable_ServerInstrumentation } from './instrumentation-BlrVzjbg.js'; +import { n as Router, o as RouteModules, p as DataStrategyFunction, q as MiddlewareEnabled, c as RouterContextProvider, r as AppLoadContext, T as To, s as NavigateOptions, B as BlockerFunction, t as Blocker, v as SerializeFrom, w as RelativeRoutingType, L as Location, x as ParamParseKey, y as Path, z as PathPattern, E as PathMatch, U as UIMatch, I as Navigation, J as Action, P as Params, K as RouteObject, G as GetLoaderData, m as GetActionData, O as InitialEntry, Q as HydrationState, V as IndexRouteObject, W as RouteComponentType, X as HydrateFallbackType, Y as ErrorBoundaryType, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, Z as NonIndexRouteObject, _ as Equal, $ as RouterState, a0 as PatchRoutesOnNavigationFunction, a1 as DataRouteObject, a as ClientLoaderFunction } from './instrumentation-BB0wRuqz.js'; +export { ac as ActionFunctionArgs, b1 as Await, aQ as AwaitProps, C as ClientActionFunction, bd as ClientActionFunctionArgs, be as ClientLoaderFunctionArgs, aL as DataRouteMatch, ad as DataStrategyFunctionArgs, ae as DataStrategyMatch, D as DataStrategyResult, ag as ErrorResponse, a6 as Fetcher, ah as FormEncType, ai as FormMethod, bj as Future, a3 as GetScrollPositionFunction, a4 as GetScrollRestorationKeyFunction, aj as HTMLFormMethod, bf as HeadersArgs, H as HeadersFunction, bi as HtmlLinkDescriptor, aB as IDLE_BLOCKER, aA as IDLE_FETCHER, az as IDLE_NAVIGATION, aR as IndexRouteProps, aT as LayoutRouteProps, ak as LazyRouteFunction, f as LinkDescriptor, al as LoaderFunctionArgs, b2 as MemoryRouter, aU as MemoryRouterOpts, aV as MemoryRouterProps, bg as MetaArgs, h as MetaDescriptor, am as MiddlewareFunction, b3 as Navigate, aW as NavigateProps, a7 as NavigationStates, aM as Navigator, b4 as Outlet, aX as OutletProps, bh as PageLinkDescriptor, aN as PatchRoutesOnNavigationFunctionArgs, an as PathParam, aY as PathRouteProps, ao as RedirectFunction, ab as RevalidationState, b5 as Route, aO as RouteMatch, aZ as RouteProps, b6 as Router, ap as RouterContext, aa as RouterFetchOptions, e as RouterInit, a9 as RouterNavigateOptions, a_ as RouterProps, b7 as RouterProvider, a$ as RouterProviderProps, a8 as RouterSubscriber, b8 as Routes, b0 as RoutesProps, S as ShouldRevalidateFunction, aq as ShouldRevalidateFunctionArgs, a2 as StaticHandler, a5 as StaticHandlerContext, aP as UNSAFE_AwaitContextProvider, bp as UNSAFE_DataRouterContext, bq as UNSAFE_DataRouterStateContext, af as UNSAFE_DataWithResponseInit, bo as UNSAFE_ErrorResponseImpl, br as UNSAFE_FetchersContext, bs as UNSAFE_LocationContext, bt as UNSAFE_NavigationContext, bu as UNSAFE_RouteContext, bv as UNSAFE_ViewTransitionContext, by as UNSAFE_WithComponentProps, bC as UNSAFE_WithErrorBoundaryProps, bA as UNSAFE_WithHydrateFallbackProps, bl as UNSAFE_createBrowserHistory, bn as UNSAFE_createRouter, bw as UNSAFE_hydrationRouteProperties, bm as UNSAFE_invariant, bx as UNSAFE_mapRouteProperties, bz as UNSAFE_withComponentProps, bD as UNSAFE_withErrorBoundaryProps, bB as UNSAFE_withHydrateFallbackProps, ar as createContext, b9 as createMemoryRouter, as as createPath, ba as createRoutesFromChildren, bb as createRoutesFromElements, aC as data, aD as generatePath, aE as isRouteErrorResponse, aF as matchPath, aG as matchRoutes, at as parsePath, aH as redirect, aI as redirectDocument, bc as renderMatches, aJ as replace, aK as resolvePath, u as unstable_ClientInstrumentation, aS as unstable_ClientOnErrorFunction, av as unstable_InstrumentRequestHandlerFunction, ax as unstable_InstrumentRouteFunction, aw as unstable_InstrumentRouterFunction, ay as unstable_InstrumentationHandlerResult, bk as unstable_SerializesTo, au as unstable_ServerInstrumentation } from './instrumentation-BB0wRuqz.js'; import * as React from 'react'; import React__default, { ReactElement } from 'react'; -import { a as RouteModules$1, P as Pages } from './register-BGQUMCK4.js'; -export { b as Register } from './register-BGQUMCK4.js'; -import { A as AssetsManifest, S as ServerBuild, E as EntryContext, F as FutureConfig } from './index-react-server-client-Cv5Q9lf0.js'; -export { l as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, a1 as DiscoverBehavior, c as FetcherFormProps, h as FetcherSubmitFunction, G as FetcherSubmitOptions, i as FetcherWithComponents, q as Form, d as FormProps, a2 as HandleDataRequestFunction, a3 as HandleDocumentRequestFunction, a4 as HandleErrorFunction, m as HashRouter, H as HashRouterProps, a as HistoryRouterProps, n as Link, L as LinkProps, X as Links, _ as LinksProps, W as Meta, p as NavLink, N as NavLinkProps, b as NavLinkRenderProps, P as ParamKeyValuePair, a0 as PrefetchBehavior, Z as PrefetchPageLinks, Y as Scripts, $ as ScriptsProps, r as ScrollRestoration, e as ScrollRestorationProps, a5 as ServerEntryModule, f as SetURLSearchParams, T as StaticRouter, M as StaticRouterProps, V as StaticRouterProvider, O as StaticRouterProviderProps, g as SubmitFunction, I as SubmitOptions, J as SubmitTarget, a6 as UNSAFE_FrameworkContext, a7 as UNSAFE_createClientRoutes, a8 as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, a9 as UNSAFE_shouldHydrateRouteLoader, aa as UNSAFE_useScrollRestoration, U as URLSearchParamsInit, j as createBrowserRouter, k as createHashRouter, K as createSearchParams, Q as createStaticHandler, R as createStaticRouter, o as unstable_HistoryRouter, z as unstable_usePrompt, y as useBeforeUnload, w as useFetcher, x as useFetchers, v as useFormAction, u as useLinkClickHandler, s as useSearchParams, t as useSubmit, C as useViewTransitionState } from './index-react-server-client-Cv5Q9lf0.js'; +import { a as RouteModules$1, P as Pages } from './register-ODDAAYlf.js'; +export { b as Register } from './register-ODDAAYlf.js'; +import { A as AssetsManifest, S as ServerBuild, E as EntryContext, F as FutureConfig } from './index-react-server-client-CCjKYJTH.js'; +export { l as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, a1 as DiscoverBehavior, c as FetcherFormProps, h as FetcherSubmitFunction, G as FetcherSubmitOptions, i as FetcherWithComponents, q as Form, d as FormProps, a2 as HandleDataRequestFunction, a3 as HandleDocumentRequestFunction, a4 as HandleErrorFunction, m as HashRouter, H as HashRouterProps, a as HistoryRouterProps, n as Link, L as LinkProps, X as Links, _ as LinksProps, W as Meta, p as NavLink, N as NavLinkProps, b as NavLinkRenderProps, P as ParamKeyValuePair, a0 as PrefetchBehavior, Z as PrefetchPageLinks, Y as Scripts, $ as ScriptsProps, r as ScrollRestoration, e as ScrollRestorationProps, a5 as ServerEntryModule, f as SetURLSearchParams, T as StaticRouter, M as StaticRouterProps, V as StaticRouterProvider, O as StaticRouterProviderProps, g as SubmitFunction, I as SubmitOptions, J as SubmitTarget, a6 as UNSAFE_FrameworkContext, a7 as UNSAFE_createClientRoutes, a8 as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, a9 as UNSAFE_shouldHydrateRouteLoader, aa as UNSAFE_useScrollRestoration, U as URLSearchParamsInit, j as createBrowserRouter, k as createHashRouter, K as createSearchParams, Q as createStaticHandler, R as createStaticRouter, o as unstable_HistoryRouter, z as unstable_usePrompt, y as useBeforeUnload, w as useFetcher, x as useFetchers, v as useFormAction, u as useLinkClickHandler, s as useSearchParams, t as useSubmit, C as useViewTransitionState } from './index-react-server-client-CCjKYJTH.js'; import { ParseOptions, SerializeOptions } from 'cookie'; export { ParseOptions as CookieParseOptions, SerializeOptions as CookieSerializeOptions } from 'cookie'; -import { e as RSCPayload, m as matchRSCServerRequest } from './browser-o-qhcuhA.js'; -export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, g as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, h as unstable_RSCMatch, f as unstable_RSCRenderPayload, l as unstable_RSCRouteConfig, k as unstable_RSCRouteConfigEntry, i as unstable_RSCRouteManifest, j as unstable_RSCRouteMatch } from './browser-o-qhcuhA.js'; +import { e as RSCPayload, m as matchRSCServerRequest } from './browser-BpxEZgZC.js'; +export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, g as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, h as unstable_RSCMatch, f as unstable_RSCRenderPayload, l as unstable_RSCRouteConfig, k as unstable_RSCRouteConfigEntry, i as unstable_RSCRouteManifest, j as unstable_RSCRouteMatch } from './browser-BpxEZgZC.js'; declare const SingleFetchRedirectSymbol: unique symbol; declare function getTurboStreamSingleFetchDataStrategy(getRouter: () => Router, manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, basename: string | undefined): DataStrategyFunction; @@ -1236,7 +1236,7 @@ type SSRCreateFromReadableStreamFunction = (body: ReadableStream) => * * routeRSCServerRequest({ * request, - * serverResponse, + * fetchServer, * createFromReadableStream, * async renderHTML(getPayload) { * const payload = getPayload(); @@ -1258,7 +1258,9 @@ type SSRCreateFromReadableStreamFunction = (body: ReadableStream) => * @param opts Options * @param opts.createFromReadableStream Your `react-server-dom-xyz/client`'s * `createFromReadableStream` function, used to decode payloads from the server. - * @param opts.serverResponse A Response or partial response generated by the [RSC](https://react.dev/reference/rsc/server-components) handler containing a serialized {@link unstable_RSCPayload}. + * @param opts.fetchServer A function that forwards a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) + * to the [RSC](https://react.dev/reference/rsc/server-components) handler + * and returns a `Promise` containing a serialized {@link unstable_RSCPayload}. * @param opts.hydrate Whether to hydrate the server response with the RSC payload. * Defaults to `true`. * @param opts.renderHTML A function that renders the {@link unstable_RSCPayload} to @@ -1268,14 +1270,11 @@ type SSRCreateFromReadableStreamFunction = (body: ReadableStream) => * that either contains the [RSC](https://react.dev/reference/rsc/server-components) * payload for data requests, or renders the HTML for document requests. */ -declare function routeRSCServerRequest({ request, serverResponse, createFromReadableStream, renderHTML, hydrate, }: { +declare function routeRSCServerRequest({ request, fetchServer, createFromReadableStream, renderHTML, hydrate, }: { request: Request; - serverResponse: Response; + fetchServer: (request: Request) => Promise; createFromReadableStream: SSRCreateFromReadableStreamFunction; - renderHTML: (getPayload: () => DecodedPayload, options: { - onError(error: unknown): string | undefined; - onHeaders(headers: Headers): void; - }) => ReadableStream | Promise>; + renderHTML: (getPayload: () => DecodedPayload) => ReadableStream | Promise>; hydrate?: boolean; }): Promise; /** @@ -1305,7 +1304,7 @@ interface RSCStaticRouterProps { * * routeRSCServerRequest({ * request, - * serverResponse, + * fetchServer, * createFromReadableStream, * async renderHTML(getPayload) { * const payload = getPayload(); diff --git a/node_modules/react-router/dist/development/index.js b/node_modules/react-router/dist/development/index.js index 28da735b..7be890cb 100644 --- a/node_modules/react-router/dist/development/index.js +++ b/node_modules/react-router/dist/development/index.js @@ -1,5 +1,5 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/** - * react-router v7.11.0 + * react-router v7.10.1 * * Copyright (c) Remix Software Inc. * @@ -14,7 +14,7 @@ -var _chunkGNDLROV6js = require('./chunk-GNDLROV6.js'); +var _chunkFKYGG5Z2js = require('./chunk-FKYGG5Z2.js'); @@ -40,7 +40,7 @@ var _chunkGNDLROV6js = require('./chunk-GNDLROV6.js'); -var _chunk2JY4UAJAjs = require('./chunk-2JY4UAJA.js'); +var _chunkHMTWJNYBjs = require('./chunk-HMTWJNYB.js'); @@ -145,9 +145,7 @@ var _chunk2JY4UAJAjs = require('./chunk-2JY4UAJA.js'); - - -var _chunkSZQUWNVJjs = require('./chunk-SZQUWNVJ.js'); +var _chunkRBZI3ZHDjs = require('./chunk-RBZI3ZHD.js'); // lib/dom/ssr/server.tsx var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react); @@ -160,7 +158,7 @@ function ServerRouter({ url = new URL(url); } let { manifest, routeModules, criticalCss, serverHandoffString } = context; - let routes = _chunkSZQUWNVJjs.createServerRoutes.call(void 0, + let routes = _chunkRBZI3ZHDjs.createServerRoutes.call(void 0, manifest.routes, routeModules, context.future, @@ -173,7 +171,7 @@ function ServerRouter({ let routeId = match.route.id; let route = routeModules[routeId]; let manifestRoute = context.manifest.routes[routeId]; - if (route && manifestRoute && _chunkSZQUWNVJjs.shouldHydrateRouteLoader.call(void 0, + if (route && manifestRoute && _chunkRBZI3ZHDjs.shouldHydrateRouteLoader.call(void 0, routeId, route.clientLoader, manifestRoute.hasLoader, @@ -182,9 +180,9 @@ function ServerRouter({ delete context.staticHandlerContext.loaderData[routeId]; } } - let router = _chunk2JY4UAJAjs.createStaticRouter.call(void 0, routes, context.staticHandlerContext); + let router = _chunkHMTWJNYBjs.createStaticRouter.call(void 0, routes, context.staticHandlerContext); return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement( - _chunkSZQUWNVJjs.FrameworkContext.Provider, + _chunkRBZI3ZHDjs.FrameworkContext.Provider, { value: { manifest, @@ -199,8 +197,8 @@ function ServerRouter({ renderMeta: context.renderMeta } }, - /* @__PURE__ */ React.createElement(_chunkSZQUWNVJjs.RemixErrorBoundary, { location: router.state.location }, /* @__PURE__ */ React.createElement( - _chunk2JY4UAJAjs.StaticRouterProvider, + /* @__PURE__ */ React.createElement(_chunkRBZI3ZHDjs.RemixErrorBoundary, { location: router.state.location }, /* @__PURE__ */ React.createElement( + _chunkHMTWJNYBjs.StaticRouterProvider, { router, context: context.staticHandlerContext, @@ -208,7 +206,7 @@ function ServerRouter({ } )) ), context.serverHandoffStream ? /* @__PURE__ */ React.createElement(React.Suspense, null, /* @__PURE__ */ React.createElement( - _chunkSZQUWNVJjs.StreamTransfer, + _chunkRBZI3ZHDjs.StreamTransfer, { context, identifier: 0, @@ -250,18 +248,18 @@ function createRoutesStub(routes, _context) { let patched = processRoutes( // @ts-expect-error `StubRouteObject` is stricter about `loader`/`action` // types compared to `AgnosticRouteObject` - _chunkSZQUWNVJjs.convertRoutesToDataRoutes.call(void 0, routes, (r) => r), - _context !== void 0 ? _context : _optionalChain([future, 'optionalAccess', _4 => _4.v8_middleware]) ? new (0, _chunkSZQUWNVJjs.RouterContextProvider)() : {}, + _chunkRBZI3ZHDjs.convertRoutesToDataRoutes.call(void 0, routes, (r) => r), + _context !== void 0 ? _context : _optionalChain([future, 'optionalAccess', _4 => _4.v8_middleware]) ? new (0, _chunkRBZI3ZHDjs.RouterContextProvider)() : {}, frameworkContextRef.current.manifest, frameworkContextRef.current.routeModules ); - routerRef.current = _chunkSZQUWNVJjs.createMemoryRouter.call(void 0, patched, { + routerRef.current = _chunkRBZI3ZHDjs.createMemoryRouter.call(void 0, patched, { initialEntries, initialIndex, hydrationData }); } - return /* @__PURE__ */ React2.createElement(_chunkSZQUWNVJjs.FrameworkContext.Provider, { value: frameworkContextRef.current }, /* @__PURE__ */ React2.createElement(_chunkSZQUWNVJjs.RouterProvider, { router: routerRef.current })); + return /* @__PURE__ */ React2.createElement(_chunkRBZI3ZHDjs.FrameworkContext.Provider, { value: frameworkContextRef.current }, /* @__PURE__ */ React2.createElement(_chunkRBZI3ZHDjs.RouterProvider, { router: routerRef.current })); }; } function processRoutes(routes, context, manifest, routeModules, parentId) { @@ -275,9 +273,9 @@ function processRoutes(routes, context, manifest, routeModules, parentId) { id: route.id, path: route.path, index: route.index, - Component: route.Component ? _chunkSZQUWNVJjs.withComponentProps.call(void 0, route.Component) : void 0, - HydrateFallback: route.HydrateFallback ? _chunkSZQUWNVJjs.withHydrateFallbackProps.call(void 0, route.HydrateFallback) : void 0, - ErrorBoundary: route.ErrorBoundary ? _chunkSZQUWNVJjs.withErrorBoundaryProps.call(void 0, route.ErrorBoundary) : void 0, + Component: route.Component ? _chunkRBZI3ZHDjs.withComponentProps.call(void 0, route.Component) : void 0, + HydrateFallback: route.HydrateFallback ? _chunkRBZI3ZHDjs.withHydrateFallbackProps.call(void 0, route.HydrateFallback) : void 0, + ErrorBoundary: route.ErrorBoundary ? _chunkRBZI3ZHDjs.withErrorBoundaryProps.call(void 0, route.ErrorBoundary) : void 0, action: route.action ? (args) => route.action({ ...args, context }) : void 0, loader: route.loader ? (args) => route.loader({ ...args, context }) : void 0, middleware: route.middleware ? route.middleware.map( @@ -312,7 +310,7 @@ function processRoutes(routes, context, manifest, routeModules, parentId) { }; manifest.routes[newRoute.id] = entryRoute; routeModules[route.id] = { - default: newRoute.Component || _chunkSZQUWNVJjs.Outlet, + default: newRoute.Component || _chunkRBZI3ZHDjs.Outlet, ErrorBoundary: newRoute.ErrorBoundary || void 0, handle: route.handle, links: route.links, @@ -507,7 +505,7 @@ function myUnescape(value) { return result; } function warnOnceAboutExpiresCookie(name, expires) { - _chunkSZQUWNVJjs.warnOnce.call(void 0, + _chunkRBZI3ZHDjs.warnOnce.call(void 0, !expires, `The "${name}" cookie has an "expires" property set. This will cause the expires value to not be updated when the session is committed. Instead, you should set the expires value when serializing the cookie. You can use \`commitSession(session, { expires })\` if using a session storage object, or \`cookie.serialize("value", { expires })\` if you're using the cookie directly.` ); @@ -561,7 +559,7 @@ function serializeErrors(errors, serverMode) { let entries = Object.entries(errors); let serialized = {}; for (let [key, val] of entries) { - if (_chunkSZQUWNVJjs.isRouteErrorResponse.call(void 0, val)) { + if (_chunkRBZI3ZHDjs.isRouteErrorResponse.call(void 0, val)) { serialized[key] = { ...val, __type: "RouteErrorResponse" }; } else if (val instanceof Error) { let sanitized = sanitizeError(val, serverMode); @@ -586,7 +584,7 @@ function serializeErrors(errors, serverMode) { // lib/server-runtime/routeMatching.ts function matchServerRoutes(routes, pathname, basename) { - let matches = _chunkSZQUWNVJjs.matchRoutes.call(void 0, + let matches = _chunkRBZI3ZHDjs.matchRoutes.call(void 0, routes, pathname, basename @@ -607,7 +605,7 @@ async function callRouteHandler(handler, args) { context: args.context, unstable_pattern: args.unstable_pattern }); - if (_chunkSZQUWNVJjs.isDataWithResponseInit.call(void 0, result) && result.init && result.init.status && _chunkSZQUWNVJjs.isRedirectStatusCode.call(void 0, result.init.status)) { + if (_chunkRBZI3ZHDjs.isDataWithResponseInit.call(void 0, result) && result.init && result.init.status && _chunkRBZI3ZHDjs.isRedirectStatusCode.call(void 0, result.init.status)) { throw new Response(null, result.init); } return result; @@ -726,17 +724,17 @@ function createStaticHandlerDataRoutes(manifest, future, parentId = "", routesBy controller.close(); } }); - let decoded = await _chunkSZQUWNVJjs.decodeViaTurboStream.call(void 0, stream, global); + let decoded = await _chunkRBZI3ZHDjs.decodeViaTurboStream.call(void 0, stream, global); let data2 = decoded.value; - if (data2 && _chunkSZQUWNVJjs.SingleFetchRedirectSymbol in data2) { - let result = data2[_chunkSZQUWNVJjs.SingleFetchRedirectSymbol]; + if (data2 && _chunkRBZI3ZHDjs.SingleFetchRedirectSymbol in data2) { + let result = data2[_chunkRBZI3ZHDjs.SingleFetchRedirectSymbol]; let init = { status: result.status }; if (result.reload) { - throw _chunkSZQUWNVJjs.redirectDocument.call(void 0, result.redirect, init); + throw _chunkRBZI3ZHDjs.redirectDocument.call(void 0, result.redirect, init); } else if (result.replace) { - throw _chunkSZQUWNVJjs.replace.call(void 0, result.redirect, init); + throw _chunkRBZI3ZHDjs.replace.call(void 0, result.redirect, init); } else { - throw _chunkSZQUWNVJjs.redirect.call(void 0, result.redirect, init); + throw _chunkRBZI3ZHDjs.redirect.call(void 0, result.redirect, init); } } else { invariant2( @@ -775,7 +773,7 @@ function createStaticHandlerDataRoutes(manifest, future, parentId = "", routesBy // lib/server-runtime/serverHandoff.ts function createServerHandoffString(serverHandoff) { - return _chunkSZQUWNVJjs.escapeHtml.call(void 0, JSON.stringify(serverHandoff)); + return _chunkRBZI3ZHDjs.escapeHtml.call(void 0, JSON.stringify(serverHandoff)); } // lib/server-runtime/headers.ts @@ -852,7 +850,7 @@ function prependCookies(parentHeaders, childHeaders) { // lib/server-runtime/single-fetch.ts var SERVER_NO_BODY_STATUS_CODES = /* @__PURE__ */ new Set([ - ..._chunkSZQUWNVJjs.NO_BODY_STATUS_CODES, + ..._chunkRBZI3ZHDjs.NO_BODY_STATUS_CODES, 304 ]); async function singleFetchAction(build, serverMode, staticHandler, request, handlerUrl, loadContext, handleError) { @@ -882,7 +880,7 @@ async function singleFetchAction(build, serverMode, staticHandler, request, hand return handleQueryError(error); } function handleQueryResult(result) { - return _chunkSZQUWNVJjs.isResponse.call(void 0, result) ? result : staticContextToResponse(result); + return _chunkRBZI3ZHDjs.isResponse.call(void 0, result) ? result : staticContextToResponse(result); } function handleQueryError(error) { handleError(error); @@ -894,12 +892,12 @@ async function singleFetchAction(build, serverMode, staticHandler, request, hand } function staticContextToResponse(context) { let headers = getDocumentHeaders(context, build); - if (_chunkSZQUWNVJjs.isRedirectStatusCode.call(void 0, context.statusCode) && headers.has("Location")) { + if (_chunkRBZI3ZHDjs.isRedirectStatusCode.call(void 0, context.statusCode) && headers.has("Location")) { return new Response(null, { status: context.statusCode, headers }); } if (context.errors) { Object.values(context.errors).forEach((err) => { - if (!_chunkSZQUWNVJjs.isRouteErrorResponse.call(void 0, err) || err.error) { + if (!_chunkRBZI3ZHDjs.isRouteErrorResponse.call(void 0, err) || err.error) { handleError(err); } }); @@ -946,7 +944,7 @@ async function singleFetchLoaders(build, serverMode, staticHandler, request, han return handleQueryError(error); } function handleQueryResult(result) { - return _chunkSZQUWNVJjs.isResponse.call(void 0, result) ? result : staticContextToResponse(result); + return _chunkRBZI3ZHDjs.isResponse.call(void 0, result) ? result : staticContextToResponse(result); } function handleQueryError(error) { handleError(error); @@ -958,12 +956,12 @@ async function singleFetchLoaders(build, serverMode, staticHandler, request, han } function staticContextToResponse(context) { let headers = getDocumentHeaders(context, build); - if (_chunkSZQUWNVJjs.isRedirectStatusCode.call(void 0, context.statusCode) && headers.has("Location")) { + if (_chunkRBZI3ZHDjs.isRedirectStatusCode.call(void 0, context.statusCode) && headers.has("Location")) { return new Response(null, { status: context.statusCode, headers }); } if (context.errors) { Object.values(context.errors).forEach((err) => { - if (!_chunkSZQUWNVJjs.isRouteErrorResponse.call(void 0, err) || err.error) { + if (!_chunkRBZI3ZHDjs.isRouteErrorResponse.call(void 0, err) || err.error) { handleError(err); } }); @@ -1027,15 +1025,15 @@ function generateSingleFetchRedirectResponse(redirectResponse, request, build, s headers.delete("Location"); headers.set("Content-Type", "text/x-script"); return generateSingleFetchResponse(request, build, serverMode, { - result: request.method === "GET" ? { [_chunkSZQUWNVJjs.SingleFetchRedirectSymbol]: redirect2 } : redirect2, + result: request.method === "GET" ? { [_chunkRBZI3ZHDjs.SingleFetchRedirectSymbol]: redirect2 } : redirect2, headers, - status: _chunkSZQUWNVJjs.SINGLE_FETCH_REDIRECT_STATUS + status: _chunkRBZI3ZHDjs.SINGLE_FETCH_REDIRECT_STATUS }); } function getSingleFetchRedirect(status, headers, basename) { let redirect2 = headers.get("Location"); if (basename) { - redirect2 = _chunkSZQUWNVJjs.stripBasename.call(void 0, redirect2, basename) || redirect2; + redirect2 = _chunkRBZI3ZHDjs.stripBasename.call(void 0, redirect2, basename) || redirect2; } return { redirect: redirect2, @@ -1061,7 +1059,7 @@ function encodeViaTurboStream(data2, requestSignal, streamTimeout, serverMode) { typeof streamTimeout === "number" ? streamTimeout : 4950 ); requestSignal.addEventListener("abort", () => clearTimeout(timeoutId)); - return _chunkSZQUWNVJjs.encode.call(void 0, data2, { + return _chunkRBZI3ZHDjs.encode.call(void 0, data2, { signal: controller.signal, plugins: [ (value) => { @@ -1069,12 +1067,12 @@ function encodeViaTurboStream(data2, requestSignal, streamTimeout, serverMode) { let { name, message, stack } = serverMode === "production" /* Production */ ? sanitizeError(value, serverMode) : value; return ["SanitizedError", name, message, stack]; } - if (value instanceof _chunkSZQUWNVJjs.ErrorResponseImpl) { + if (value instanceof _chunkRBZI3ZHDjs.ErrorResponseImpl) { let { data: data3, status, statusText } = value; return ["ErrorResponse", data3, status, statusText]; } - if (value && typeof value === "object" && _chunkSZQUWNVJjs.SingleFetchRedirectSymbol in value) { - return ["SingleFetchRedirect", value[_chunkSZQUWNVJjs.SingleFetchRedirectSymbol]]; + if (value && typeof value === "object" && _chunkRBZI3ZHDjs.SingleFetchRedirectSymbol in value) { + return ["SingleFetchRedirect", value[_chunkRBZI3ZHDjs.SingleFetchRedirectSymbol]]; } } ], @@ -1097,7 +1095,7 @@ function derive(build, mode) { let routes = createRoutes(build.routes); let dataRoutes = createStaticHandlerDataRoutes(build.routes, build.future); let serverMode = isServerMode(mode) ? mode : "production" /* Production */; - let staticHandler = _chunkSZQUWNVJjs.createStaticHandler.call(void 0, dataRoutes, { + let staticHandler = _chunkRBZI3ZHDjs.createStaticHandler.call(void 0, dataRoutes, { basename: build.basename, unstable_instrumentations: build.entry.module.unstable_instrumentations }); @@ -1105,7 +1103,7 @@ function derive(build, mode) { if (serverMode !== "test" /* Test */ && !request.signal.aborted) { console.error( // @ts-expect-error This is "private" from users but intended for internal use - _chunkSZQUWNVJjs.isRouteErrorResponse.call(void 0, error) && error.error ? error.error : error + _chunkRBZI3ZHDjs.isRouteErrorResponse.call(void 0, error) && error.error ? error.error : error ); } }); @@ -1123,36 +1121,36 @@ function derive(build, mode) { }); }; if (build.future.v8_middleware) { - if (initialContext && !(initialContext instanceof _chunkSZQUWNVJjs.RouterContextProvider)) { + if (initialContext && !(initialContext instanceof _chunkRBZI3ZHDjs.RouterContextProvider)) { let error = new Error( "Invalid `context` value provided to `handleRequest`. When middleware is enabled you must return an instance of `RouterContextProvider` from your `getLoadContext` function." ); handleError(error); return returnLastResortErrorResponse(error, serverMode); } - loadContext = initialContext || new (0, _chunkSZQUWNVJjs.RouterContextProvider)(); + loadContext = initialContext || new (0, _chunkRBZI3ZHDjs.RouterContextProvider)(); } else { loadContext = initialContext || {}; } let url = new URL(request.url); let normalizedBasename = build.basename || "/"; let normalizedPath = url.pathname; - if (_chunkSZQUWNVJjs.stripBasename.call(void 0, normalizedPath, normalizedBasename) === "/_root.data") { + if (_chunkRBZI3ZHDjs.stripBasename.call(void 0, normalizedPath, normalizedBasename) === "/_root.data") { normalizedPath = normalizedBasename; } else if (normalizedPath.endsWith(".data")) { normalizedPath = normalizedPath.replace(/\.data$/, ""); } - if (_chunkSZQUWNVJjs.stripBasename.call(void 0, normalizedPath, normalizedBasename) !== "/" && normalizedPath.endsWith("/")) { + if (_chunkRBZI3ZHDjs.stripBasename.call(void 0, normalizedPath, normalizedBasename) !== "/" && normalizedPath.endsWith("/")) { normalizedPath = normalizedPath.slice(0, -1); } let isSpaMode = getBuildTimeHeader(request, "X-React-Router-SPA-Mode") === "yes"; if (!build.ssr) { let decodedPath = decodeURI(normalizedPath); if (normalizedBasename !== "/") { - let strippedPath = _chunkSZQUWNVJjs.stripBasename.call(void 0, decodedPath, normalizedBasename); + let strippedPath = _chunkRBZI3ZHDjs.stripBasename.call(void 0, decodedPath, normalizedBasename); if (strippedPath == null) { errorHandler( - new (0, _chunkSZQUWNVJjs.ErrorResponseImpl)( + new (0, _chunkRBZI3ZHDjs.ErrorResponseImpl)( 404, "Not Found", `Refusing to prerender the \`${decodedPath}\` path because it does not start with the basename \`${normalizedBasename}\`` @@ -1175,7 +1173,7 @@ function derive(build, mode) { } else if (!build.prerender.includes(decodedPath) && !build.prerender.includes(decodedPath + "/")) { if (url.pathname.endsWith(".data")) { errorHandler( - new (0, _chunkSZQUWNVJjs.ErrorResponseImpl)( + new (0, _chunkRBZI3ZHDjs.ErrorResponseImpl)( 404, "Not Found", `Refusing to SSR the path \`${decodedPath}\` because \`ssr:false\` is set and the path is not included in the \`prerender\` config, so in production the path will be a 404.` @@ -1195,7 +1193,7 @@ function derive(build, mode) { } } } - let manifestUrl = _chunkSZQUWNVJjs.getManifestPath.call(void 0, + let manifestUrl = _chunkRBZI3ZHDjs.getManifestPath.call(void 0, build.routeDiscovery.manifestPath, normalizedBasename ); @@ -1230,7 +1228,7 @@ function derive(build, mode) { loadContext, handleError ); - if (_chunkSZQUWNVJjs.isRedirectResponse.call(void 0, response)) { + if (_chunkRBZI3ZHDjs.isRedirectResponse.call(void 0, response)) { response = generateSingleFetchRedirectResponse( response, request, @@ -1244,7 +1242,7 @@ function derive(build, mode) { params: singleFetchMatches ? singleFetchMatches[0].params : {}, request }); - if (_chunkSZQUWNVJjs.isRedirectResponse.call(void 0, response)) { + if (_chunkRBZI3ZHDjs.isRedirectResponse.call(void 0, response)) { response = generateSingleFetchRedirectResponse( response, request, @@ -1292,7 +1290,7 @@ function derive(build, mode) { return response; }; if (build.entry.module.unstable_instrumentations) { - requestHandler = _chunkSZQUWNVJjs.instrumentHandler.call(void 0, + requestHandler = _chunkRBZI3ZHDjs.instrumentHandler.call(void 0, requestHandler, build.entry.module.unstable_instrumentations.map((i) => i.handler).filter(Boolean) ); @@ -1404,7 +1402,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request, generateMiddlewareResponse: build.future.v8_middleware ? async (query) => { try { let innerResult = await query(request); - if (!_chunkSZQUWNVJjs.isResponse.call(void 0, innerResult)) { + if (!_chunkRBZI3ZHDjs.isResponse.call(void 0, innerResult)) { innerResult = await renderHtml(innerResult, isSpaMode); } return innerResult; @@ -1414,7 +1412,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request, } } : void 0 }); - if (!_chunkSZQUWNVJjs.isResponse.call(void 0, result)) { + if (!_chunkRBZI3ZHDjs.isResponse.call(void 0, result)) { result = await renderHtml(result, isSpaMode); } return result; @@ -1429,7 +1427,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request, } if (context.errors) { Object.values(context.errors).forEach((err) => { - if (!_chunkSZQUWNVJjs.isRouteErrorResponse.call(void 0, err) || err.error) { + if (!_chunkRBZI3ZHDjs.isRouteErrorResponse.call(void 0, err) || err.error) { handleError(err); } }); @@ -1481,10 +1479,10 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request, } catch (error) { handleError(error); let errorForSecondRender = error; - if (_chunkSZQUWNVJjs.isResponse.call(void 0, error)) { + if (_chunkRBZI3ZHDjs.isResponse.call(void 0, error)) { try { let data2 = await unwrapResponse(error); - errorForSecondRender = new (0, _chunkSZQUWNVJjs.ErrorResponseImpl)( + errorForSecondRender = new (0, _chunkRBZI3ZHDjs.ErrorResponseImpl)( error.status, error.statusText, data2 @@ -1492,7 +1490,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request, } catch (e) { } } - context = _chunkSZQUWNVJjs.getStaticContextFromError.call(void 0, + context = _chunkRBZI3ZHDjs.getStaticContextFromError.call(void 0, staticHandler.dataRoutes, context, errorForSecondRender @@ -1551,7 +1549,7 @@ async function handleResourceRequest(serverMode, build, staticHandler, routeId, return handleQueryRouteError(error); } function handleQueryRouteResult(result) { - if (_chunkSZQUWNVJjs.isResponse.call(void 0, result)) { + if (_chunkRBZI3ZHDjs.isResponse.call(void 0, result)) { return result; } if (typeof result === "string") { @@ -1560,10 +1558,10 @@ async function handleResourceRequest(serverMode, build, staticHandler, routeId, return Response.json(result); } function handleQueryRouteError(error) { - if (_chunkSZQUWNVJjs.isResponse.call(void 0, error)) { + if (_chunkRBZI3ZHDjs.isResponse.call(void 0, error)) { return error; } - if (_chunkSZQUWNVJjs.isRouteErrorResponse.call(void 0, error)) { + if (_chunkRBZI3ZHDjs.isRouteErrorResponse.call(void 0, error)) { handleError(error); return errorResponseToJson(error, serverMode); } @@ -1686,7 +1684,7 @@ function createSessionStorage({ }; } function warnOnceAboutSigningSessionCookie(cookie) { - _chunkSZQUWNVJjs.warnOnce.call(void 0, + _chunkRBZI3ZHDjs.warnOnce.call(void 0, cookie.isSigned, `The "${cookie.name}" cookie is not signed, but session cookies should be signed to prevent tampering on the client before they are sent back to the server. See https://reactrouter.com/explanation/sessions-and-cookies#signing-cookies for more information.` ); @@ -1888,7 +1886,7 @@ function useSafe(promise) { } async function routeRSCServerRequest({ request, - serverResponse, + fetchServer, createFromReadableStream, renderHTML, hydrate = true @@ -1896,6 +1894,7 @@ async function routeRSCServerRequest({ const url = new URL(request.url); const isDataRequest = isReactServerRequest(url); const respondWithRSCPayload = isDataRequest || isManifestRequest(url) || request.headers.has("rsc-action-id"); + const serverResponse = await fetchServer(request); if (respondWithRSCPayload || serverResponse.headers.get("React-Router-Resource") === "true") { return serverResponse; } @@ -1957,8 +1956,6 @@ async function routeRSCServerRequest({ } }); }; - let renderRedirect; - let renderError; try { if (!detectRedirectResponse.body) { throw new Error("Failed to clone server response"); @@ -1966,7 +1963,7 @@ async function routeRSCServerRequest({ const payload = await createFromReadableStream( detectRedirectResponse.body ); - if (serverResponse.status === _chunkSZQUWNVJjs.SINGLE_FETCH_REDIRECT_STATUS && payload.type === "redirect") { + if (serverResponse.status === _chunkRBZI3ZHDjs.SINGLE_FETCH_REDIRECT_STATUS && payload.type === "redirect") { const headers2 = new Headers(serverResponse.headers); headers2.delete("Content-Encoding"); headers2.delete("Content-Length"); @@ -1979,179 +1976,73 @@ async function routeRSCServerRequest({ statusText: serverResponse.statusText }); } - let reactHeaders = new Headers(); - let status = serverResponse.status; - let statusText = serverResponse.statusText; - let html = await renderHTML(getPayload, { - onError(error) { - if (typeof error === "object" && error && "digest" in error && typeof error.digest === "string") { - renderRedirect = _chunkSZQUWNVJjs.decodeRedirectErrorDigest.call(void 0, error.digest); - if (renderRedirect) { - return error.digest; - } - let routeErrorResponse = _chunkSZQUWNVJjs.decodeRouteErrorResponseDigest.call(void 0, error.digest); - if (routeErrorResponse) { - renderError = routeErrorResponse; - status = routeErrorResponse.status; - statusText = routeErrorResponse.statusText; - return error.digest; - } - } - }, - onHeaders(headers2) { - for (const [key, value] of headers2) { - reactHeaders.append(key, value); - } - } - }); - const headers = new Headers(reactHeaders); - for (const [key, value] of serverResponse.headers) { - headers.append(key, value); - } + const html = await renderHTML(getPayload); + const headers = new Headers(serverResponse.headers); headers.set("Content-Type", "text/html; charset=utf-8"); - if (renderRedirect) { - headers.set("Location", renderRedirect.location); - return new Response(html, { - status: renderRedirect.status, - headers - }); - } - const redirectTransform = new TransformStream({ - flush(controller) { - if (renderRedirect) { - controller.enqueue( - new TextEncoder().encode( - `` - ) - ); - } - } - }); if (!hydrate) { - return new Response(html.pipeThrough(redirectTransform), { - status, - statusText, + return new Response(html, { + status: serverResponse.status, headers }); } if (!_optionalChain([serverResponseB, 'optionalAccess', _22 => _22.body])) { throw new Error("Failed to clone server response"); } - const body2 = html.pipeThrough(injectRSCPayload(serverResponseB.body)).pipeThrough(redirectTransform); + const body2 = html.pipeThrough(injectRSCPayload(serverResponseB.body)); return new Response(body2, { - status, - statusText, + status: serverResponse.status, headers }); } catch (reason) { if (reason instanceof Response) { return reason; } - if (renderRedirect) { - return new Response(`Redirect: ${renderRedirect.location}`, { - status: renderRedirect.status, - headers: { - Location: renderRedirect.location - } - }); - } try { - reason = _nullishCoalesce(renderError, () => ( reason)); - let [status, statusText] = _chunkSZQUWNVJjs.isRouteErrorResponse.call(void 0, reason) ? [reason.status, reason.statusText] : [500, ""]; - let retryRedirect; - let reactHeaders = new Headers(); - const html = await renderHTML( - () => { - const decoded = Promise.resolve( - createFromReadableStream(createStream()) - ); - const payloadPromise = decoded.then( - (payload) => Object.assign(payload, { - status, - errors: deepestRenderedBoundaryId ? { - [deepestRenderedBoundaryId]: reason - } : {} - }) - ); - return Object.defineProperties(payloadPromise, { - _deepestRenderedBoundaryId: { - get() { - return deepestRenderedBoundaryId; - }, - set(boundaryId) { - deepestRenderedBoundaryId = boundaryId; - } + const status = _chunkRBZI3ZHDjs.isRouteErrorResponse.call(void 0, reason) ? reason.status : 500; + const html = await renderHTML(() => { + const decoded = Promise.resolve( + createFromReadableStream(createStream()) + ); + const payloadPromise = decoded.then( + (payload) => Object.assign(payload, { + status, + errors: deepestRenderedBoundaryId ? { + [deepestRenderedBoundaryId]: reason + } : {} + }) + ); + return Object.defineProperties(payloadPromise, { + _deepestRenderedBoundaryId: { + get() { + return deepestRenderedBoundaryId; }, - formState: { - get() { - return payloadPromise.then( - (payload) => payload.type === "render" ? payload.formState : void 0 - ); - } - } - }); - }, - { - onError(error) { - if (typeof error === "object" && error && "digest" in error && typeof error.digest === "string") { - retryRedirect = _chunkSZQUWNVJjs.decodeRedirectErrorDigest.call(void 0, error.digest); - if (retryRedirect) { - return error.digest; - } - let routeErrorResponse = _chunkSZQUWNVJjs.decodeRouteErrorResponseDigest.call(void 0, - error.digest - ); - if (routeErrorResponse) { - status = routeErrorResponse.status; - statusText = routeErrorResponse.statusText; - return error.digest; - } + set(boundaryId) { + deepestRenderedBoundaryId = boundaryId; } }, - onHeaders(headers2) { - for (const [key, value] of headers2) { - reactHeaders.append(key, value); + formState: { + get() { + return payloadPromise.then( + (payload) => payload.type === "render" ? payload.formState : void 0 + ); } } - } - ); - const headers = new Headers(reactHeaders); - for (const [key, value] of serverResponse.headers) { - headers.append(key, value); - } - headers.set("Content-Type", "text/html; charset=utf-8"); - if (retryRedirect) { - headers.set("Location", retryRedirect.location); - return new Response(html, { - status: retryRedirect.status, - headers }); - } - const retryRedirectTransform = new TransformStream({ - flush(controller) { - if (retryRedirect) { - controller.enqueue( - new TextEncoder().encode( - `` - ) - ); - } - } }); + const headers = new Headers(serverResponse.headers); + headers.set("Content-Type", "text/html"); if (!hydrate) { - return new Response(html.pipeThrough(retryRedirectTransform), { + return new Response(html, { status, - statusText, headers }); } if (!_optionalChain([serverResponseB, 'optionalAccess', _23 => _23.body])) { throw new Error("Failed to clone server response"); } - const body2 = html.pipeThrough(injectRSCPayload(serverResponseB.body)).pipeThrough(retryRedirectTransform); + const body2 = html.pipeThrough(injectRSCPayload(serverResponseB.body)); return new Response(body2, { status, - statusText, headers }); } catch (e2) { @@ -2173,7 +2064,7 @@ function RSCStaticRouter({ getPayload }) { if (payload.type !== "render") return null; let patchedLoaderData = { ...payload.loaderData }; for (const match of payload.matches) { - if (_chunkSZQUWNVJjs.shouldHydrateRouteLoader.call(void 0, + if (_chunkRBZI3ZHDjs.shouldHydrateRouteLoader.call(void 0, match.id, match.clientLoader, match.hasLoader, @@ -2213,7 +2104,7 @@ function RSCStaticRouter({ getPayload }) { } })) }; - const router = _chunk2JY4UAJAjs.createStaticRouter.call(void 0, + const router = _chunkHMTWJNYBjs.createStaticRouter.call(void 0, payload.matches.reduceRight((previous, match) => { const route = { id: match.id, @@ -2255,10 +2146,10 @@ function RSCStaticRouter({ getPayload }) { } }, routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" }, - routeModules: _chunkGNDLROV6js.createRSCRouteModules.call(void 0, payload) + routeModules: _chunkFKYGG5Z2js.createRSCRouteModules.call(void 0, payload) }; - return /* @__PURE__ */ React3.createElement(_chunkSZQUWNVJjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkGNDLROV6js.RSCRouterGlobalErrorBoundary, { location: payload.location }, /* @__PURE__ */ React3.createElement(_chunkSZQUWNVJjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement( - _chunk2JY4UAJAjs.StaticRouterProvider, + return /* @__PURE__ */ React3.createElement(_chunkRBZI3ZHDjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkFKYGG5Z2js.RSCRouterGlobalErrorBoundary, { location: payload.location }, /* @__PURE__ */ React3.createElement(_chunkRBZI3ZHDjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement( + _chunkHMTWJNYBjs.StaticRouterProvider, { context, router, @@ -2281,7 +2172,7 @@ function deserializeErrors(errors) { let serialized = {}; for (let [key, val] of entries) { if (val && val.__type === "RouteErrorResponse") { - serialized[key] = new (0, _chunkSZQUWNVJjs.ErrorResponseImpl)( + serialized[key] = new (0, _chunkRBZI3ZHDjs.ErrorResponseImpl)( val.status, val.statusText, val.data, @@ -2438,4 +2329,4 @@ function deserializeErrors(errors) { -exports.Await = _chunkSZQUWNVJjs.Await; exports.BrowserRouter = _chunk2JY4UAJAjs.BrowserRouter; exports.Form = _chunk2JY4UAJAjs.Form; exports.HashRouter = _chunk2JY4UAJAjs.HashRouter; exports.IDLE_BLOCKER = _chunkSZQUWNVJjs.IDLE_BLOCKER; exports.IDLE_FETCHER = _chunkSZQUWNVJjs.IDLE_FETCHER; exports.IDLE_NAVIGATION = _chunkSZQUWNVJjs.IDLE_NAVIGATION; exports.Link = _chunk2JY4UAJAjs.Link; exports.Links = _chunkSZQUWNVJjs.Links; exports.MemoryRouter = _chunkSZQUWNVJjs.MemoryRouter; exports.Meta = _chunkSZQUWNVJjs.Meta; exports.NavLink = _chunk2JY4UAJAjs.NavLink; exports.Navigate = _chunkSZQUWNVJjs.Navigate; exports.NavigationType = _chunkSZQUWNVJjs.Action; exports.Outlet = _chunkSZQUWNVJjs.Outlet; exports.PrefetchPageLinks = _chunkSZQUWNVJjs.PrefetchPageLinks; exports.Route = _chunkSZQUWNVJjs.Route; exports.Router = _chunkSZQUWNVJjs.Router; exports.RouterContextProvider = _chunkSZQUWNVJjs.RouterContextProvider; exports.RouterProvider = _chunkSZQUWNVJjs.RouterProvider; exports.Routes = _chunkSZQUWNVJjs.Routes; exports.Scripts = _chunkSZQUWNVJjs.Scripts; exports.ScrollRestoration = _chunk2JY4UAJAjs.ScrollRestoration; exports.ServerRouter = ServerRouter; exports.StaticRouter = _chunk2JY4UAJAjs.StaticRouter; exports.StaticRouterProvider = _chunk2JY4UAJAjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunkSZQUWNVJjs.AwaitContextProvider; exports.UNSAFE_DataRouterContext = _chunkSZQUWNVJjs.DataRouterContext; exports.UNSAFE_DataRouterStateContext = _chunkSZQUWNVJjs.DataRouterStateContext; exports.UNSAFE_ErrorResponseImpl = _chunkSZQUWNVJjs.ErrorResponseImpl; exports.UNSAFE_FetchersContext = _chunkSZQUWNVJjs.FetchersContext; exports.UNSAFE_FrameworkContext = _chunkSZQUWNVJjs.FrameworkContext; exports.UNSAFE_LocationContext = _chunkSZQUWNVJjs.LocationContext; exports.UNSAFE_NavigationContext = _chunkSZQUWNVJjs.NavigationContext; exports.UNSAFE_RSCDefaultRootErrorBoundary = _chunkGNDLROV6js.RSCDefaultRootErrorBoundary; exports.UNSAFE_RemixErrorBoundary = _chunkSZQUWNVJjs.RemixErrorBoundary; exports.UNSAFE_RouteContext = _chunkSZQUWNVJjs.RouteContext; exports.UNSAFE_ServerMode = ServerMode; exports.UNSAFE_SingleFetchRedirectSymbol = _chunkSZQUWNVJjs.SingleFetchRedirectSymbol; exports.UNSAFE_ViewTransitionContext = _chunkSZQUWNVJjs.ViewTransitionContext; exports.UNSAFE_WithComponentProps = _chunkSZQUWNVJjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkSZQUWNVJjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkSZQUWNVJjs.WithHydrateFallbackProps; exports.UNSAFE_createBrowserHistory = _chunkSZQUWNVJjs.createBrowserHistory; exports.UNSAFE_createClientRoutes = _chunkSZQUWNVJjs.createClientRoutes; exports.UNSAFE_createClientRoutesWithHMRRevalidationOptOut = _chunkSZQUWNVJjs.createClientRoutesWithHMRRevalidationOptOut; exports.UNSAFE_createRouter = _chunkSZQUWNVJjs.createRouter; exports.UNSAFE_decodeViaTurboStream = _chunkSZQUWNVJjs.decodeViaTurboStream; exports.UNSAFE_deserializeErrors = deserializeErrors; exports.UNSAFE_getHydrationData = _chunkGNDLROV6js.getHydrationData; exports.UNSAFE_getPatchRoutesOnNavigationFunction = _chunkSZQUWNVJjs.getPatchRoutesOnNavigationFunction; exports.UNSAFE_getTurboStreamSingleFetchDataStrategy = _chunkSZQUWNVJjs.getTurboStreamSingleFetchDataStrategy; exports.UNSAFE_hydrationRouteProperties = _chunkSZQUWNVJjs.hydrationRouteProperties; exports.UNSAFE_invariant = _chunkSZQUWNVJjs.invariant; exports.UNSAFE_mapRouteProperties = _chunkSZQUWNVJjs.mapRouteProperties; exports.UNSAFE_shouldHydrateRouteLoader = _chunkSZQUWNVJjs.shouldHydrateRouteLoader; exports.UNSAFE_useFogOFWarDiscovery = _chunkSZQUWNVJjs.useFogOFWarDiscovery; exports.UNSAFE_useScrollRestoration = _chunk2JY4UAJAjs.useScrollRestoration; exports.UNSAFE_withComponentProps = _chunkSZQUWNVJjs.withComponentProps; exports.UNSAFE_withErrorBoundaryProps = _chunkSZQUWNVJjs.withErrorBoundaryProps; exports.UNSAFE_withHydrateFallbackProps = _chunkSZQUWNVJjs.withHydrateFallbackProps; exports.createBrowserRouter = _chunk2JY4UAJAjs.createBrowserRouter; exports.createContext = _chunkSZQUWNVJjs.createContext; exports.createCookie = createCookie; exports.createCookieSessionStorage = createCookieSessionStorage; exports.createHashRouter = _chunk2JY4UAJAjs.createHashRouter; exports.createMemoryRouter = _chunkSZQUWNVJjs.createMemoryRouter; exports.createMemorySessionStorage = createMemorySessionStorage; exports.createPath = _chunkSZQUWNVJjs.createPath; exports.createRequestHandler = createRequestHandler; exports.createRoutesFromChildren = _chunkSZQUWNVJjs.createRoutesFromChildren; exports.createRoutesFromElements = _chunkSZQUWNVJjs.createRoutesFromElements; exports.createRoutesStub = createRoutesStub; exports.createSearchParams = _chunk2JY4UAJAjs.createSearchParams; exports.createSession = createSession; exports.createSessionStorage = createSessionStorage; exports.createStaticHandler = _chunk2JY4UAJAjs.createStaticHandler; exports.createStaticRouter = _chunk2JY4UAJAjs.createStaticRouter; exports.data = _chunkSZQUWNVJjs.data; exports.generatePath = _chunkSZQUWNVJjs.generatePath; exports.href = href; exports.isCookie = isCookie; exports.isRouteErrorResponse = _chunkSZQUWNVJjs.isRouteErrorResponse; exports.isSession = isSession; exports.matchPath = _chunkSZQUWNVJjs.matchPath; exports.matchRoutes = _chunkSZQUWNVJjs.matchRoutes; exports.parsePath = _chunkSZQUWNVJjs.parsePath; exports.redirect = _chunkSZQUWNVJjs.redirect; exports.redirectDocument = _chunkSZQUWNVJjs.redirectDocument; exports.renderMatches = _chunkSZQUWNVJjs.renderMatches; exports.replace = _chunkSZQUWNVJjs.replace; exports.resolvePath = _chunkSZQUWNVJjs.resolvePath; exports.unstable_HistoryRouter = _chunk2JY4UAJAjs.HistoryRouter; exports.unstable_RSCStaticRouter = RSCStaticRouter; exports.unstable_routeRSCServerRequest = routeRSCServerRequest; exports.unstable_setDevServerHooks = setDevServerHooks; exports.unstable_usePrompt = _chunk2JY4UAJAjs.usePrompt; exports.unstable_useRoute = _chunkSZQUWNVJjs.useRoute; exports.useActionData = _chunkSZQUWNVJjs.useActionData; exports.useAsyncError = _chunkSZQUWNVJjs.useAsyncError; exports.useAsyncValue = _chunkSZQUWNVJjs.useAsyncValue; exports.useBeforeUnload = _chunk2JY4UAJAjs.useBeforeUnload; exports.useBlocker = _chunkSZQUWNVJjs.useBlocker; exports.useFetcher = _chunk2JY4UAJAjs.useFetcher; exports.useFetchers = _chunk2JY4UAJAjs.useFetchers; exports.useFormAction = _chunk2JY4UAJAjs.useFormAction; exports.useHref = _chunkSZQUWNVJjs.useHref; exports.useInRouterContext = _chunkSZQUWNVJjs.useInRouterContext; exports.useLinkClickHandler = _chunk2JY4UAJAjs.useLinkClickHandler; exports.useLoaderData = _chunkSZQUWNVJjs.useLoaderData; exports.useLocation = _chunkSZQUWNVJjs.useLocation; exports.useMatch = _chunkSZQUWNVJjs.useMatch; exports.useMatches = _chunkSZQUWNVJjs.useMatches; exports.useNavigate = _chunkSZQUWNVJjs.useNavigate; exports.useNavigation = _chunkSZQUWNVJjs.useNavigation; exports.useNavigationType = _chunkSZQUWNVJjs.useNavigationType; exports.useOutlet = _chunkSZQUWNVJjs.useOutlet; exports.useOutletContext = _chunkSZQUWNVJjs.useOutletContext; exports.useParams = _chunkSZQUWNVJjs.useParams; exports.useResolvedPath = _chunkSZQUWNVJjs.useResolvedPath; exports.useRevalidator = _chunkSZQUWNVJjs.useRevalidator; exports.useRouteError = _chunkSZQUWNVJjs.useRouteError; exports.useRouteLoaderData = _chunkSZQUWNVJjs.useRouteLoaderData; exports.useRoutes = _chunkSZQUWNVJjs.useRoutes; exports.useSearchParams = _chunk2JY4UAJAjs.useSearchParams; exports.useSubmit = _chunk2JY4UAJAjs.useSubmit; exports.useViewTransitionState = _chunk2JY4UAJAjs.useViewTransitionState; +exports.Await = _chunkRBZI3ZHDjs.Await; exports.BrowserRouter = _chunkHMTWJNYBjs.BrowserRouter; exports.Form = _chunkHMTWJNYBjs.Form; exports.HashRouter = _chunkHMTWJNYBjs.HashRouter; exports.IDLE_BLOCKER = _chunkRBZI3ZHDjs.IDLE_BLOCKER; exports.IDLE_FETCHER = _chunkRBZI3ZHDjs.IDLE_FETCHER; exports.IDLE_NAVIGATION = _chunkRBZI3ZHDjs.IDLE_NAVIGATION; exports.Link = _chunkHMTWJNYBjs.Link; exports.Links = _chunkRBZI3ZHDjs.Links; exports.MemoryRouter = _chunkRBZI3ZHDjs.MemoryRouter; exports.Meta = _chunkRBZI3ZHDjs.Meta; exports.NavLink = _chunkHMTWJNYBjs.NavLink; exports.Navigate = _chunkRBZI3ZHDjs.Navigate; exports.NavigationType = _chunkRBZI3ZHDjs.Action; exports.Outlet = _chunkRBZI3ZHDjs.Outlet; exports.PrefetchPageLinks = _chunkRBZI3ZHDjs.PrefetchPageLinks; exports.Route = _chunkRBZI3ZHDjs.Route; exports.Router = _chunkRBZI3ZHDjs.Router; exports.RouterContextProvider = _chunkRBZI3ZHDjs.RouterContextProvider; exports.RouterProvider = _chunkRBZI3ZHDjs.RouterProvider; exports.Routes = _chunkRBZI3ZHDjs.Routes; exports.Scripts = _chunkRBZI3ZHDjs.Scripts; exports.ScrollRestoration = _chunkHMTWJNYBjs.ScrollRestoration; exports.ServerRouter = ServerRouter; exports.StaticRouter = _chunkHMTWJNYBjs.StaticRouter; exports.StaticRouterProvider = _chunkHMTWJNYBjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunkRBZI3ZHDjs.AwaitContextProvider; exports.UNSAFE_DataRouterContext = _chunkRBZI3ZHDjs.DataRouterContext; exports.UNSAFE_DataRouterStateContext = _chunkRBZI3ZHDjs.DataRouterStateContext; exports.UNSAFE_ErrorResponseImpl = _chunkRBZI3ZHDjs.ErrorResponseImpl; exports.UNSAFE_FetchersContext = _chunkRBZI3ZHDjs.FetchersContext; exports.UNSAFE_FrameworkContext = _chunkRBZI3ZHDjs.FrameworkContext; exports.UNSAFE_LocationContext = _chunkRBZI3ZHDjs.LocationContext; exports.UNSAFE_NavigationContext = _chunkRBZI3ZHDjs.NavigationContext; exports.UNSAFE_RSCDefaultRootErrorBoundary = _chunkFKYGG5Z2js.RSCDefaultRootErrorBoundary; exports.UNSAFE_RemixErrorBoundary = _chunkRBZI3ZHDjs.RemixErrorBoundary; exports.UNSAFE_RouteContext = _chunkRBZI3ZHDjs.RouteContext; exports.UNSAFE_ServerMode = ServerMode; exports.UNSAFE_SingleFetchRedirectSymbol = _chunkRBZI3ZHDjs.SingleFetchRedirectSymbol; exports.UNSAFE_ViewTransitionContext = _chunkRBZI3ZHDjs.ViewTransitionContext; exports.UNSAFE_WithComponentProps = _chunkRBZI3ZHDjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkRBZI3ZHDjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkRBZI3ZHDjs.WithHydrateFallbackProps; exports.UNSAFE_createBrowserHistory = _chunkRBZI3ZHDjs.createBrowserHistory; exports.UNSAFE_createClientRoutes = _chunkRBZI3ZHDjs.createClientRoutes; exports.UNSAFE_createClientRoutesWithHMRRevalidationOptOut = _chunkRBZI3ZHDjs.createClientRoutesWithHMRRevalidationOptOut; exports.UNSAFE_createRouter = _chunkRBZI3ZHDjs.createRouter; exports.UNSAFE_decodeViaTurboStream = _chunkRBZI3ZHDjs.decodeViaTurboStream; exports.UNSAFE_deserializeErrors = deserializeErrors; exports.UNSAFE_getHydrationData = _chunkFKYGG5Z2js.getHydrationData; exports.UNSAFE_getPatchRoutesOnNavigationFunction = _chunkRBZI3ZHDjs.getPatchRoutesOnNavigationFunction; exports.UNSAFE_getTurboStreamSingleFetchDataStrategy = _chunkRBZI3ZHDjs.getTurboStreamSingleFetchDataStrategy; exports.UNSAFE_hydrationRouteProperties = _chunkRBZI3ZHDjs.hydrationRouteProperties; exports.UNSAFE_invariant = _chunkRBZI3ZHDjs.invariant; exports.UNSAFE_mapRouteProperties = _chunkRBZI3ZHDjs.mapRouteProperties; exports.UNSAFE_shouldHydrateRouteLoader = _chunkRBZI3ZHDjs.shouldHydrateRouteLoader; exports.UNSAFE_useFogOFWarDiscovery = _chunkRBZI3ZHDjs.useFogOFWarDiscovery; exports.UNSAFE_useScrollRestoration = _chunkHMTWJNYBjs.useScrollRestoration; exports.UNSAFE_withComponentProps = _chunkRBZI3ZHDjs.withComponentProps; exports.UNSAFE_withErrorBoundaryProps = _chunkRBZI3ZHDjs.withErrorBoundaryProps; exports.UNSAFE_withHydrateFallbackProps = _chunkRBZI3ZHDjs.withHydrateFallbackProps; exports.createBrowserRouter = _chunkHMTWJNYBjs.createBrowserRouter; exports.createContext = _chunkRBZI3ZHDjs.createContext; exports.createCookie = createCookie; exports.createCookieSessionStorage = createCookieSessionStorage; exports.createHashRouter = _chunkHMTWJNYBjs.createHashRouter; exports.createMemoryRouter = _chunkRBZI3ZHDjs.createMemoryRouter; exports.createMemorySessionStorage = createMemorySessionStorage; exports.createPath = _chunkRBZI3ZHDjs.createPath; exports.createRequestHandler = createRequestHandler; exports.createRoutesFromChildren = _chunkRBZI3ZHDjs.createRoutesFromChildren; exports.createRoutesFromElements = _chunkRBZI3ZHDjs.createRoutesFromElements; exports.createRoutesStub = createRoutesStub; exports.createSearchParams = _chunkHMTWJNYBjs.createSearchParams; exports.createSession = createSession; exports.createSessionStorage = createSessionStorage; exports.createStaticHandler = _chunkHMTWJNYBjs.createStaticHandler; exports.createStaticRouter = _chunkHMTWJNYBjs.createStaticRouter; exports.data = _chunkRBZI3ZHDjs.data; exports.generatePath = _chunkRBZI3ZHDjs.generatePath; exports.href = href; exports.isCookie = isCookie; exports.isRouteErrorResponse = _chunkRBZI3ZHDjs.isRouteErrorResponse; exports.isSession = isSession; exports.matchPath = _chunkRBZI3ZHDjs.matchPath; exports.matchRoutes = _chunkRBZI3ZHDjs.matchRoutes; exports.parsePath = _chunkRBZI3ZHDjs.parsePath; exports.redirect = _chunkRBZI3ZHDjs.redirect; exports.redirectDocument = _chunkRBZI3ZHDjs.redirectDocument; exports.renderMatches = _chunkRBZI3ZHDjs.renderMatches; exports.replace = _chunkRBZI3ZHDjs.replace; exports.resolvePath = _chunkRBZI3ZHDjs.resolvePath; exports.unstable_HistoryRouter = _chunkHMTWJNYBjs.HistoryRouter; exports.unstable_RSCStaticRouter = RSCStaticRouter; exports.unstable_routeRSCServerRequest = routeRSCServerRequest; exports.unstable_setDevServerHooks = setDevServerHooks; exports.unstable_usePrompt = _chunkHMTWJNYBjs.usePrompt; exports.unstable_useRoute = _chunkRBZI3ZHDjs.useRoute; exports.useActionData = _chunkRBZI3ZHDjs.useActionData; exports.useAsyncError = _chunkRBZI3ZHDjs.useAsyncError; exports.useAsyncValue = _chunkRBZI3ZHDjs.useAsyncValue; exports.useBeforeUnload = _chunkHMTWJNYBjs.useBeforeUnload; exports.useBlocker = _chunkRBZI3ZHDjs.useBlocker; exports.useFetcher = _chunkHMTWJNYBjs.useFetcher; exports.useFetchers = _chunkHMTWJNYBjs.useFetchers; exports.useFormAction = _chunkHMTWJNYBjs.useFormAction; exports.useHref = _chunkRBZI3ZHDjs.useHref; exports.useInRouterContext = _chunkRBZI3ZHDjs.useInRouterContext; exports.useLinkClickHandler = _chunkHMTWJNYBjs.useLinkClickHandler; exports.useLoaderData = _chunkRBZI3ZHDjs.useLoaderData; exports.useLocation = _chunkRBZI3ZHDjs.useLocation; exports.useMatch = _chunkRBZI3ZHDjs.useMatch; exports.useMatches = _chunkRBZI3ZHDjs.useMatches; exports.useNavigate = _chunkRBZI3ZHDjs.useNavigate; exports.useNavigation = _chunkRBZI3ZHDjs.useNavigation; exports.useNavigationType = _chunkRBZI3ZHDjs.useNavigationType; exports.useOutlet = _chunkRBZI3ZHDjs.useOutlet; exports.useOutletContext = _chunkRBZI3ZHDjs.useOutletContext; exports.useParams = _chunkRBZI3ZHDjs.useParams; exports.useResolvedPath = _chunkRBZI3ZHDjs.useResolvedPath; exports.useRevalidator = _chunkRBZI3ZHDjs.useRevalidator; exports.useRouteError = _chunkRBZI3ZHDjs.useRouteError; exports.useRouteLoaderData = _chunkRBZI3ZHDjs.useRouteLoaderData; exports.useRoutes = _chunkRBZI3ZHDjs.useRoutes; exports.useSearchParams = _chunkHMTWJNYBjs.useSearchParams; exports.useSubmit = _chunkHMTWJNYBjs.useSubmit; exports.useViewTransitionState = _chunkHMTWJNYBjs.useViewTransitionState; diff --git a/node_modules/react-router/dist/development/index.mjs b/node_modules/react-router/dist/development/index.mjs index 977f43bc..ed589d3b 100644 --- a/node_modules/react-router/dist/development/index.mjs +++ b/node_modules/react-router/dist/development/index.mjs @@ -1,5 +1,5 @@ /** - * react-router v7.11.0 + * react-router v7.10.1 * * Copyright (c) Remix Software Inc. * @@ -28,7 +28,7 @@ import { isSession, routeRSCServerRequest, setDevServerHooks -} from "./chunk-YNUBSHFH.mjs"; +} from "./chunk-PMGK554W.mjs"; import { Action, Await, @@ -139,7 +139,7 @@ import { withComponentProps, withErrorBoundaryProps, withHydrateFallbackProps -} from "./chunk-JMJ3UQ3L.mjs"; +} from "./chunk-WWGJGFF6.mjs"; export { Await, BrowserRouter, diff --git a/node_modules/react-router/dist/development/lib/types/internal.d.mts b/node_modules/react-router/dist/development/lib/types/internal.d.mts index c57b4cba..4fd47be2 100644 --- a/node_modules/react-router/dist/development/lib/types/internal.d.mts +++ b/node_modules/react-router/dist/development/lib/types/internal.d.mts @@ -1,5 +1,5 @@ -import { R as RouteModule, h as LinkDescriptor, L as Location, F as Func, i as Pretty, j as MetaDescriptor, G as GetLoaderData, k as ServerDataFunctionArgs, l as MiddlewareNextFunction, m as ClientDataFunctionArgs, D as DataStrategyResult, n as ServerDataFrom, N as Normalize, o as GetActionData } from '../../router-5fbeEIMQ.mjs'; -import { R as RouteFiles, P as Pages } from '../../register-DTJJbt1o.mjs'; +import { R as RouteModule, h as LinkDescriptor, L as Location, F as Func, i as Pretty, j as MetaDescriptor, G as GetLoaderData, k as ServerDataFunctionArgs, l as MiddlewareNextFunction, m as ClientDataFunctionArgs, D as DataStrategyResult, n as ServerDataFrom, N as Normalize, o as GetActionData } from '../../router-CwNp5l9u.mjs'; +import { R as RouteFiles, P as Pages } from '../../register-C1RwVJAt.mjs'; import 'react'; type MaybePromise = T | Promise; diff --git a/node_modules/react-router/dist/development/lib/types/internal.d.ts b/node_modules/react-router/dist/development/lib/types/internal.d.ts index 591efd7e..53109d37 100644 --- a/node_modules/react-router/dist/development/lib/types/internal.d.ts +++ b/node_modules/react-router/dist/development/lib/types/internal.d.ts @@ -1,5 +1,5 @@ -import { R as RouteModule, f as LinkDescriptor, L as Location, F as Func, g as Pretty, h as MetaDescriptor, G as GetLoaderData, i as ServerDataFunctionArgs, j as MiddlewareNextFunction, k as ClientDataFunctionArgs, D as DataStrategyResult, l as ServerDataFrom, N as Normalize, m as GetActionData } from '../../instrumentation-BlrVzjbg.js'; -import { R as RouteFiles, P as Pages } from '../../register-BGQUMCK4.js'; +import { R as RouteModule, f as LinkDescriptor, L as Location, F as Func, g as Pretty, h as MetaDescriptor, G as GetLoaderData, i as ServerDataFunctionArgs, j as MiddlewareNextFunction, k as ClientDataFunctionArgs, D as DataStrategyResult, l as ServerDataFrom, N as Normalize, m as GetActionData } from '../../instrumentation-BB0wRuqz.js'; +import { R as RouteFiles, P as Pages } from '../../register-ODDAAYlf.js'; import 'react'; type MaybePromise = T | Promise; diff --git a/node_modules/react-router/dist/development/lib/types/internal.js b/node_modules/react-router/dist/development/lib/types/internal.js index e58dd817..ec5848bc 100644 --- a/node_modules/react-router/dist/development/lib/types/internal.js +++ b/node_modules/react-router/dist/development/lib/types/internal.js @@ -1,5 +1,5 @@ "use strict";/** - * react-router v7.11.0 + * react-router v7.10.1 * * Copyright (c) Remix Software Inc. * diff --git a/node_modules/react-router/dist/development/lib/types/internal.mjs b/node_modules/react-router/dist/development/lib/types/internal.mjs index d31774a2..b077d3e3 100644 --- a/node_modules/react-router/dist/development/lib/types/internal.mjs +++ b/node_modules/react-router/dist/development/lib/types/internal.mjs @@ -1,5 +1,5 @@ /** - * react-router v7.11.0 + * react-router v7.10.1 * * Copyright (c) Remix Software Inc. * diff --git a/node_modules/react-router/dist/production/dom-export.d.mts b/node_modules/react-router/dist/production/dom-export.d.mts index cc9a565d..12193104 100644 --- a/node_modules/react-router/dist/production/dom-export.d.mts +++ b/node_modules/react-router/dist/production/dom-export.d.mts @@ -1,6 +1,6 @@ import * as React from 'react'; -import { f as RouterProviderProps$1, e as RouterInit, u as unstable_ClientInstrumentation, g as ClientOnErrorFunction } from './router-5fbeEIMQ.mjs'; -export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-Cv4JZyZ5.mjs'; +import { f as RouterProviderProps$1, e as RouterInit, u as unstable_ClientInstrumentation, g as unstable_ClientOnErrorFunction } from './router-CwNp5l9u.mjs'; +export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-C5z6FZmz.mjs'; type RouterProviderProps = Omit; declare function RouterProvider(props: Omit): React.JSX.Element; @@ -71,9 +71,9 @@ interface HydratedRouterProps { */ unstable_instrumentations?: unstable_ClientInstrumentation[]; /** - * An error handler function that will be called for any middleware, loader, action, - * or render errors that are encountered in your application. This is useful for - * logging or reporting errors instead of in the {@link ErrorBoundary} because it's not + * An error handler function that will be called for any loader/action/render + * errors that are encountered in your application. This is useful for + * logging or reporting errors instead of the `ErrorBoundary` because it's not * subject to re-rendering and will only run one time per error. * * The `errorInfo` parameter is passed along from @@ -81,14 +81,13 @@ interface HydratedRouterProps { * and is only present for render errors. * * ```tsx - * { - * let { location, params, unstable_pattern, errorInfo } = info; - * console.error(error, location, errorInfo); - * reportToErrorService(error, location, errorInfo); + * { + * console.error(error, errorInfo); + * reportToErrorService(error, errorInfo); * }} /> * ``` */ - onError?: ClientOnErrorFunction; + unstable_onError?: unstable_ClientOnErrorFunction; /** * Control whether router state updates are internally wrapped in * [`React.startTransition`](https://react.dev/reference/react/startTransition). @@ -118,7 +117,7 @@ interface HydratedRouterProps { * @mode framework * @param props Props * @param {dom.HydratedRouterProps.getContext} props.getContext n/a - * @param {dom.HydratedRouterProps.onError} props.onError n/a + * @param {dom.HydratedRouterProps.unstable_onError} props.unstable_onError n/a * @returns A React element that represents the hydrated application. */ declare function HydratedRouter(props: HydratedRouterProps): React.JSX.Element; diff --git a/node_modules/react-router/dist/production/dom-export.d.ts b/node_modules/react-router/dist/production/dom-export.d.ts index ac784132..8177d29d 100644 --- a/node_modules/react-router/dist/production/dom-export.d.ts +++ b/node_modules/react-router/dist/production/dom-export.d.ts @@ -1,7 +1,7 @@ import * as React from 'react'; -import { RouterProviderProps as RouterProviderProps$1, RouterInit, ClientOnErrorFunction } from 'react-router'; -import { u as unstable_ClientInstrumentation } from './instrumentation-BlrVzjbg.js'; -export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-o-qhcuhA.js'; +import { RouterProviderProps as RouterProviderProps$1, RouterInit, unstable_ClientOnErrorFunction } from 'react-router'; +import { u as unstable_ClientInstrumentation } from './instrumentation-BB0wRuqz.js'; +export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-BpxEZgZC.js'; type RouterProviderProps = Omit; declare function RouterProvider(props: Omit): React.JSX.Element; @@ -72,9 +72,9 @@ interface HydratedRouterProps { */ unstable_instrumentations?: unstable_ClientInstrumentation[]; /** - * An error handler function that will be called for any middleware, loader, action, - * or render errors that are encountered in your application. This is useful for - * logging or reporting errors instead of in the {@link ErrorBoundary} because it's not + * An error handler function that will be called for any loader/action/render + * errors that are encountered in your application. This is useful for + * logging or reporting errors instead of the `ErrorBoundary` because it's not * subject to re-rendering and will only run one time per error. * * The `errorInfo` parameter is passed along from @@ -82,14 +82,13 @@ interface HydratedRouterProps { * and is only present for render errors. * * ```tsx - * { - * let { location, params, unstable_pattern, errorInfo } = info; - * console.error(error, location, errorInfo); - * reportToErrorService(error, location, errorInfo); + * { + * console.error(error, errorInfo); + * reportToErrorService(error, errorInfo); * }} /> * ``` */ - onError?: ClientOnErrorFunction; + unstable_onError?: unstable_ClientOnErrorFunction; /** * Control whether router state updates are internally wrapped in * [`React.startTransition`](https://react.dev/reference/react/startTransition). @@ -119,7 +118,7 @@ interface HydratedRouterProps { * @mode framework * @param props Props * @param {dom.HydratedRouterProps.getContext} props.getContext n/a - * @param {dom.HydratedRouterProps.onError} props.onError n/a + * @param {dom.HydratedRouterProps.unstable_onError} props.unstable_onError n/a * @returns A React element that represents the hydrated application. */ declare function HydratedRouter(props: HydratedRouterProps): React.JSX.Element; diff --git a/node_modules/react-router/dist/production/dom-export.js b/node_modules/react-router/dist/production/dom-export.js index 5e252ff7..269da382 100644 --- a/node_modules/react-router/dist/production/dom-export.js +++ b/node_modules/react-router/dist/production/dom-export.js @@ -1,5 +1,5 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/** - * react-router v7.11.0 + * react-router v7.10.1 * * Copyright (c) Remix Software Inc. * @@ -13,7 +13,7 @@ -var _chunkBEXOWXJOjs = require('./chunk-BEXOWXJO.js'); +var _chunkYO5R3LGQjs = require('./chunk-YO5R3LGQ.js'); @@ -32,7 +32,7 @@ var _chunkBEXOWXJOjs = require('./chunk-BEXOWXJO.js'); -var _chunk2HFJAX7Ujs = require('./chunk-2HFJAX7U.js'); +var _chunkUQPBOMFPjs = require('./chunk-UQPBOMFP.js'); // lib/dom-export/dom-router-provider.tsx var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react); @@ -204,7 +204,7 @@ function HydratedRouter(props) { }, []); React2.useEffect(() => { if (process.env.NODE_ENV === "development" && criticalCss === void 0) { - document.querySelectorAll(`[${_chunk2HFJAX7Ujs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove()); + document.querySelectorAll(`[${_chunkUQPBOMFPjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove()); } }, [criticalCss]); let [location2, setLocation] = React2.useState(router.state.location); @@ -253,7 +253,7 @@ function HydratedRouter(props) { { router, unstable_useTransitions: props.unstable_useTransitions, - onError: props.onError + unstable_onError: props.unstable_onError } )) ), /* @__PURE__ */ React2.createElement(React2.Fragment, null)) @@ -376,10 +376,10 @@ function createRouterFromPayload({ }; if (payload.type !== "render") throw new Error("Invalid payload type"); globalVar.__reactRouterRouteModules = _nullishCoalesce(globalVar.__reactRouterRouteModules, () => ( {})); - _chunkBEXOWXJOjs.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches); + _chunkYO5R3LGQjs.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches); let patches = /* @__PURE__ */ new Map(); _optionalChain([payload, 'access', _22 => _22.patches, 'optionalAccess', _23 => _23.forEach, 'call', _24 => _24((patch) => { - _chunk2HFJAX7Ujs.invariant.call(void 0, patch.parentId, "Invalid patch parentId"); + _chunkUQPBOMFPjs.invariant.call(void 0, patch.parentId, "Invalid patch parentId"); if (!patches.has(patch.parentId)) { patches.set(patch.parentId, []); } @@ -401,12 +401,12 @@ function createRouterFromPayload({ } return [route]; }, []); - globalVar.__reactRouterDataRouter = _chunk2HFJAX7Ujs.createRouter.call(void 0, { + globalVar.__reactRouterDataRouter = _chunkUQPBOMFPjs.createRouter.call(void 0, { routes, getContext, basename: payload.basename, - history: _chunk2HFJAX7Ujs.createBrowserHistory.call(void 0, ), - hydrationData: _chunkBEXOWXJOjs.getHydrationData.call(void 0, { + history: _chunkUQPBOMFPjs.createBrowserHistory.call(void 0, ), + hydrationData: _chunkYO5R3LGQjs.getHydrationData.call(void 0, { state: { loaderData: payload.loaderData, actionData: payload.actionData, @@ -415,7 +415,7 @@ function createRouterFromPayload({ routes, getRouteInfo: (routeId) => { let match = payload.matches.find((m) => m.id === routeId); - _chunk2HFJAX7Ujs.invariant.call(void 0, match, "Route not found in payload"); + _chunkUQPBOMFPjs.invariant.call(void 0, match, "Route not found in payload"); return { clientLoader: match.clientLoader, hasLoader: match.hasLoader, @@ -513,9 +513,9 @@ function createRouterFromPayload({ routeModules: globalVar.__reactRouterRouteModules }; } -var renderedRoutesContext = _chunk2HFJAX7Ujs.createContext.call(void 0, ); +var renderedRoutesContext = _chunkUQPBOMFPjs.createContext.call(void 0, ); function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReadableStream, fetchImplementation) { - let dataStrategy = _chunk2HFJAX7Ujs.getSingleFetchDataStrategyImpl.call(void 0, + let dataStrategy = _chunkUQPBOMFPjs.getSingleFetchDataStrategyImpl.call(void 0, getRouter, (match) => { let M = match; @@ -571,20 +571,20 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation) { return async (args, basename, targetRoutes) => { let { request, context } = args; - let url = _chunk2HFJAX7Ujs.singleFetchUrl.call(void 0, request.url, basename, "rsc"); + let url = _chunkUQPBOMFPjs.singleFetchUrl.call(void 0, request.url, basename, "rsc"); if (request.method === "GET") { - url = _chunk2HFJAX7Ujs.stripIndexParam.call(void 0, url); + url = _chunkUQPBOMFPjs.stripIndexParam.call(void 0, url); if (targetRoutes) { url.searchParams.set("_routes", targetRoutes.join(",")); } } let res = await fetchImplementation( - new Request(url, await _chunk2HFJAX7Ujs.createRequestInit.call(void 0, request)) + new Request(url, await _chunkUQPBOMFPjs.createRequestInit.call(void 0, request)) ); if (res.status >= 400 && !res.headers.has("X-Remix-Response")) { - throw new (0, _chunk2HFJAX7Ujs.ErrorResponseImpl)(res.status, res.statusText, await res.text()); + throw new (0, _chunkUQPBOMFPjs.ErrorResponseImpl)(res.status, res.statusText, await res.text()); } - _chunk2HFJAX7Ujs.invariant.call(void 0, res.body, "No response body to decode"); + _chunkUQPBOMFPjs.invariant.call(void 0, res.body, "No response body to decode"); try { const payload = await createFromReadableStream(res.body, { temporaryReferences: void 0 @@ -608,7 +608,7 @@ function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation) } context.get(renderedRoutesContext).push(...payload.matches); let results = { routes: {} }; - const dataKey = _chunk2HFJAX7Ujs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData"; + const dataKey = _chunkUQPBOMFPjs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData"; for (let [routeId, data] of Object.entries(payload[dataKey] || {})) { results.routes[routeId] = { data }; } @@ -641,7 +641,7 @@ function RSCHydratedRouter({ [createFromReadableStream, payload, fetchImplementation, getContext] ); React3.useEffect(() => { - _chunk2HFJAX7Ujs.setIsHydrated.call(void 0, ); + _chunkUQPBOMFPjs.setIsHydrated.call(void 0, ); }, []); React3.useLayoutEffect(() => { const globalVar = window; @@ -743,11 +743,12 @@ function RSCHydratedRouter({ routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" }, routeModules }; - return /* @__PURE__ */ React3.createElement(_chunk2HFJAX7Ujs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkBEXOWXJOjs.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunk2HFJAX7Ujs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement( - _chunk2HFJAX7Ujs.RouterProvider, + return /* @__PURE__ */ React3.createElement(_chunkUQPBOMFPjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkYO5R3LGQjs.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkUQPBOMFPjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement( + _chunkUQPBOMFPjs.RouterProvider, { router: transitionEnabledRouter, - flushSync: ReactDOM2.flushSync + flushSync: ReactDOM2.flushSync, + unstable_useTransitions: true } )))); } @@ -760,8 +761,8 @@ function createRouteFromServerManifest(match, payload) { // the server loader flow regardless of whether the client loader calls // `serverLoader` or not, otherwise we'll have nothing to render. match.hasComponent && !match.element; - _chunk2HFJAX7Ujs.invariant.call(void 0, window.__reactRouterRouteModules); - _chunkBEXOWXJOjs.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match); + _chunkUQPBOMFPjs.invariant.call(void 0, window.__reactRouterRouteModules); + _chunkYO5R3LGQjs.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match); let dataRoute = { id: match.id, element: match.element, @@ -811,7 +812,7 @@ function createRouteFromServerManifest(match, payload) { return await callSingleFetch(singleFetch); } }) : match.hasAction ? (_, singleFetch) => callSingleFetch(singleFetch) : () => { - throw _chunk2HFJAX7Ujs.noActionDefinedError.call(void 0, "action", match.id); + throw _chunkUQPBOMFPjs.noActionDefinedError.call(void 0, "action", match.id); }, path: match.path, shouldRevalidate: match.shouldRevalidate, @@ -824,7 +825,7 @@ function createRouteFromServerManifest(match, payload) { hasShouldRevalidate: match.shouldRevalidate != null }; if (typeof dataRoute.loader === "function") { - dataRoute.loader.hydrate = _chunk2HFJAX7Ujs.shouldHydrateRouteLoader.call(void 0, + dataRoute.loader.hydrate = _chunkUQPBOMFPjs.shouldHydrateRouteLoader.call(void 0, match.id, match.clientLoader, match.hasLoader, @@ -834,7 +835,7 @@ function createRouteFromServerManifest(match, payload) { return dataRoute; } function callSingleFetch(singleFetch) { - _chunk2HFJAX7Ujs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter"); + _chunkUQPBOMFPjs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter"); return singleFetch(); } function preventInvalidServerHandlerCall(type, routeId, hasHandler) { @@ -842,7 +843,7 @@ function preventInvalidServerHandlerCall(type, routeId, hasHandler) { let fn = type === "action" ? "serverAction()" : "serverLoader()"; let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${routeId}")`; console.error(msg); - throw new (0, _chunk2HFJAX7Ujs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true); + throw new (0, _chunkUQPBOMFPjs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true); } } var nextPaths = /* @__PURE__ */ new Set(); @@ -897,7 +898,7 @@ async function fetchAndApplyManifestPatches(paths, createFromReadableStream, fet function addToFifoQueue(path, queue) { if (queue.size >= discoveredPathsMaxSize) { let first = queue.values().next().value; - if (typeof first === "string") queue.delete(first); + queue.delete(first); } queue.add(path); } diff --git a/node_modules/react-router/dist/production/dom-export.mjs b/node_modules/react-router/dist/production/dom-export.mjs index 72cd31f4..fd57cf8d 100644 --- a/node_modules/react-router/dist/production/dom-export.mjs +++ b/node_modules/react-router/dist/production/dom-export.mjs @@ -1,5 +1,5 @@ /** - * react-router v7.11.0 + * react-router v7.10.1 * * Copyright (c) Remix Software Inc. * @@ -14,7 +14,7 @@ import { deserializeErrors, getHydrationData, populateRSCRouteModules -} from "./chunk-E6GYEQUT.mjs"; +} from "./chunk-TDCOAFPJ.mjs"; import { CRITICAL_CSS_DATA_ATTRIBUTE, ErrorResponseImpl, @@ -42,7 +42,7 @@ import { singleFetchUrl, stripIndexParam, useFogOFWarDiscovery -} from "./chunk-TINMVEA2.mjs"; +} from "./chunk-ANIOYBQK.mjs"; // lib/dom-export/dom-router-provider.tsx import * as React from "react"; @@ -245,7 +245,7 @@ function HydratedRouter(props) { { router, unstable_useTransitions: props.unstable_useTransitions, - onError: props.onError + unstable_onError: props.unstable_onError } )) ), /* @__PURE__ */ React2.createElement(React2.Fragment, null)) @@ -739,7 +739,8 @@ function RSCHydratedRouter({ RouterProvider, { router: transitionEnabledRouter, - flushSync: ReactDOM2.flushSync + flushSync: ReactDOM2.flushSync, + unstable_useTransitions: true } )))); } @@ -889,7 +890,7 @@ async function fetchAndApplyManifestPatches(paths, createFromReadableStream, fet function addToFifoQueue(path, queue) { if (queue.size >= discoveredPathsMaxSize) { let first = queue.values().next().value; - if (typeof first === "string") queue.delete(first); + queue.delete(first); } queue.add(path); } diff --git a/node_modules/react-router/dist/production/index-react-server-client.d.mts b/node_modules/react-router/dist/production/index-react-server-client.d.mts index b44cf0ad..045e71c5 100644 --- a/node_modules/react-router/dist/production/index-react-server-client.d.mts +++ b/node_modules/react-router/dist/production/index-react-server-client.d.mts @@ -1,3 +1,3 @@ -export { b2 as MemoryRouter, b3 as Navigate, b4 as Outlet, b5 as Route, b6 as Router, b7 as RouterProvider, b8 as Routes, aR as UNSAFE_AwaitContextProvider, by as UNSAFE_WithComponentProps, bC as UNSAFE_WithErrorBoundaryProps, bA as UNSAFE_WithHydrateFallbackProps } from './router-5fbeEIMQ.mjs'; -export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-P7VgYu6T.mjs'; +export { b2 as MemoryRouter, b3 as Navigate, b4 as Outlet, b5 as Route, b6 as Router, b7 as RouterProvider, b8 as Routes, aR as UNSAFE_AwaitContextProvider, by as UNSAFE_WithComponentProps, bC as UNSAFE_WithErrorBoundaryProps, bA as UNSAFE_WithHydrateFallbackProps } from './router-CwNp5l9u.mjs'; +export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-CipGfVBI.mjs'; import 'react'; diff --git a/node_modules/react-router/dist/production/index-react-server-client.d.ts b/node_modules/react-router/dist/production/index-react-server-client.d.ts index f87529b1..1fc766d9 100644 --- a/node_modules/react-router/dist/production/index-react-server-client.d.ts +++ b/node_modules/react-router/dist/production/index-react-server-client.d.ts @@ -1,3 +1,3 @@ -export { b2 as MemoryRouter, b3 as Navigate, b4 as Outlet, b5 as Route, b6 as Router, b7 as RouterProvider, b8 as Routes, aP as UNSAFE_AwaitContextProvider, by as UNSAFE_WithComponentProps, bC as UNSAFE_WithErrorBoundaryProps, bA as UNSAFE_WithHydrateFallbackProps } from './instrumentation-BlrVzjbg.js'; -export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-Cv5Q9lf0.js'; +export { b2 as MemoryRouter, b3 as Navigate, b4 as Outlet, b5 as Route, b6 as Router, b7 as RouterProvider, b8 as Routes, aP as UNSAFE_AwaitContextProvider, by as UNSAFE_WithComponentProps, bC as UNSAFE_WithErrorBoundaryProps, bA as UNSAFE_WithHydrateFallbackProps } from './instrumentation-BB0wRuqz.js'; +export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-CCjKYJTH.js'; import 'react'; diff --git a/node_modules/react-router/dist/production/index-react-server-client.js b/node_modules/react-router/dist/production/index-react-server-client.js index a7a00def..f5ce8a7f 100644 --- a/node_modules/react-router/dist/production/index-react-server-client.js +++ b/node_modules/react-router/dist/production/index-react-server-client.js @@ -1,5 +1,5 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true});/** - * react-router v7.11.0 + * react-router v7.10.1 * * Copyright (c) Remix Software Inc. * @@ -19,7 +19,7 @@ -var _chunkZMYPVUNZjs = require('./chunk-ZMYPVUNZ.js'); +var _chunkB3F6YMOFjs = require('./chunk-B3F6YMOF.js'); @@ -34,7 +34,7 @@ var _chunkZMYPVUNZjs = require('./chunk-ZMYPVUNZ.js'); -var _chunk2HFJAX7Ujs = require('./chunk-2HFJAX7U.js'); +var _chunkUQPBOMFPjs = require('./chunk-UQPBOMFP.js'); @@ -58,4 +58,4 @@ var _chunk2HFJAX7Ujs = require('./chunk-2HFJAX7U.js'); -exports.BrowserRouter = _chunkZMYPVUNZjs.BrowserRouter; exports.Form = _chunkZMYPVUNZjs.Form; exports.HashRouter = _chunkZMYPVUNZjs.HashRouter; exports.Link = _chunkZMYPVUNZjs.Link; exports.Links = _chunk2HFJAX7Ujs.Links; exports.MemoryRouter = _chunk2HFJAX7Ujs.MemoryRouter; exports.Meta = _chunk2HFJAX7Ujs.Meta; exports.NavLink = _chunkZMYPVUNZjs.NavLink; exports.Navigate = _chunk2HFJAX7Ujs.Navigate; exports.Outlet = _chunk2HFJAX7Ujs.Outlet; exports.Route = _chunk2HFJAX7Ujs.Route; exports.Router = _chunk2HFJAX7Ujs.Router; exports.RouterProvider = _chunk2HFJAX7Ujs.RouterProvider; exports.Routes = _chunk2HFJAX7Ujs.Routes; exports.ScrollRestoration = _chunkZMYPVUNZjs.ScrollRestoration; exports.StaticRouter = _chunkZMYPVUNZjs.StaticRouter; exports.StaticRouterProvider = _chunkZMYPVUNZjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunk2HFJAX7Ujs.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunk2HFJAX7Ujs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunk2HFJAX7Ujs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunk2HFJAX7Ujs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkZMYPVUNZjs.HistoryRouter; +exports.BrowserRouter = _chunkB3F6YMOFjs.BrowserRouter; exports.Form = _chunkB3F6YMOFjs.Form; exports.HashRouter = _chunkB3F6YMOFjs.HashRouter; exports.Link = _chunkB3F6YMOFjs.Link; exports.Links = _chunkUQPBOMFPjs.Links; exports.MemoryRouter = _chunkUQPBOMFPjs.MemoryRouter; exports.Meta = _chunkUQPBOMFPjs.Meta; exports.NavLink = _chunkB3F6YMOFjs.NavLink; exports.Navigate = _chunkUQPBOMFPjs.Navigate; exports.Outlet = _chunkUQPBOMFPjs.Outlet; exports.Route = _chunkUQPBOMFPjs.Route; exports.Router = _chunkUQPBOMFPjs.Router; exports.RouterProvider = _chunkUQPBOMFPjs.RouterProvider; exports.Routes = _chunkUQPBOMFPjs.Routes; exports.ScrollRestoration = _chunkB3F6YMOFjs.ScrollRestoration; exports.StaticRouter = _chunkB3F6YMOFjs.StaticRouter; exports.StaticRouterProvider = _chunkB3F6YMOFjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunkUQPBOMFPjs.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunkUQPBOMFPjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkUQPBOMFPjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkUQPBOMFPjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkB3F6YMOFjs.HistoryRouter; diff --git a/node_modules/react-router/dist/production/index-react-server-client.mjs b/node_modules/react-router/dist/production/index-react-server-client.mjs index b97cc014..20f2a63b 100644 --- a/node_modules/react-router/dist/production/index-react-server-client.mjs +++ b/node_modules/react-router/dist/production/index-react-server-client.mjs @@ -1,5 +1,5 @@ /** - * react-router v7.11.0 + * react-router v7.10.1 * * Copyright (c) Remix Software Inc. * @@ -32,7 +32,7 @@ import { WithComponentProps, WithErrorBoundaryProps, WithHydrateFallbackProps -} from "./chunk-TINMVEA2.mjs"; +} from "./chunk-ANIOYBQK.mjs"; export { BrowserRouter, Form, diff --git a/node_modules/react-router/dist/production/index-react-server.d.mts b/node_modules/react-router/dist/production/index-react-server.d.mts index d5a6d724..aab803d8 100644 --- a/node_modules/react-router/dist/production/index-react-server.d.mts +++ b/node_modules/react-router/dist/production/index-react-server.d.mts @@ -1369,7 +1369,6 @@ type BaseNavigateOrFetchOptions = { preventScrollReset?: boolean; relative?: RelativeRoutingType; flushSync?: boolean; - unstable_defaultShouldRevalidate?: boolean; }; type BaseNavigateOptions = BaseNavigateOrFetchOptions & { replace?: boolean; @@ -2193,7 +2192,7 @@ type RSCMatch = { }; type DecodeActionFunction = (formData: FormData) => Promise<() => Promise>; type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown; -type DecodeReplyFunction = (reply: FormData | string, options: { +type DecodeReplyFunction = (reply: FormData | string, { temporaryReferences }: { temporaryReferences: unknown; }) => Promise; type LoadServerActionFunction = (id: string) => Promise; @@ -2278,8 +2277,7 @@ declare function matchRSCServerRequest({ createTemporaryReferenceSet, basename, onError?: (error: unknown) => void; request: Request; routes: RSCRouteConfigEntry[]; - generateResponse: (match: RSCMatch, { onError, temporaryReferences, }: { - onError(error: unknown): string | undefined; + generateResponse: (match: RSCMatch, { temporaryReferences, }: { temporaryReferences: unknown; }) => Response; }): Promise; diff --git a/node_modules/react-router/dist/production/index-react-server.d.ts b/node_modules/react-router/dist/production/index-react-server.d.ts index d5a6d724..aab803d8 100644 --- a/node_modules/react-router/dist/production/index-react-server.d.ts +++ b/node_modules/react-router/dist/production/index-react-server.d.ts @@ -1369,7 +1369,6 @@ type BaseNavigateOrFetchOptions = { preventScrollReset?: boolean; relative?: RelativeRoutingType; flushSync?: boolean; - unstable_defaultShouldRevalidate?: boolean; }; type BaseNavigateOptions = BaseNavigateOrFetchOptions & { replace?: boolean; @@ -2193,7 +2192,7 @@ type RSCMatch = { }; type DecodeActionFunction = (formData: FormData) => Promise<() => Promise>; type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown; -type DecodeReplyFunction = (reply: FormData | string, options: { +type DecodeReplyFunction = (reply: FormData | string, { temporaryReferences }: { temporaryReferences: unknown; }) => Promise; type LoadServerActionFunction = (id: string) => Promise; @@ -2278,8 +2277,7 @@ declare function matchRSCServerRequest({ createTemporaryReferenceSet, basename, onError?: (error: unknown) => void; request: Request; routes: RSCRouteConfigEntry[]; - generateResponse: (match: RSCMatch, { onError, temporaryReferences, }: { - onError(error: unknown): string | undefined; + generateResponse: (match: RSCMatch, { temporaryReferences, }: { temporaryReferences: unknown; }) => Response; }): Promise; diff --git a/node_modules/react-router/dist/production/index-react-server.js b/node_modules/react-router/dist/production/index-react-server.js index c519b430..a525c41b 100644 --- a/node_modules/react-router/dist/production/index-react-server.js +++ b/node_modules/react-router/dist/production/index-react-server.js @@ -27,7 +27,7 @@ function _interopNamespace(e) { var React2__namespace = /*#__PURE__*/_interopNamespace(React2); /** - * react-router v7.11.0 + * react-router v7.10.1 * * Copyright (c) Remix Software Inc. * @@ -1850,7 +1850,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request, handler: lazyRoutePromises.lazyHandlerPromise }; } -function getDataStrategyMatch(mapRouteProperties, manifest, request, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) { +function getDataStrategyMatch(mapRouteProperties, manifest, request, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null) { let isUsingNewApi = false; let _lazyPromises = getDataStrategyMatchLazyPromises( mapRouteProperties, @@ -2393,43 +2393,6 @@ function prependCookies(parentHeaders, childHeaders) { } } var SINGLE_FETCH_REDIRECT_STATUS = 202; - -// lib/errors.ts -var ERROR_DIGEST_BASE = "REACT_ROUTER_ERROR"; -var ERROR_DIGEST_REDIRECT = "REDIRECT"; -var ERROR_DIGEST_ROUTE_ERROR_RESPONSE = "ROUTE_ERROR_RESPONSE"; -function createRedirectErrorDigest(response) { - return `${ERROR_DIGEST_BASE}:${ERROR_DIGEST_REDIRECT}:${JSON.stringify({ - status: response.status, - statusText: response.statusText, - location: response.headers.get("Location"), - reloadDocument: response.headers.get("X-Remix-Reload-Document") === "true", - replace: response.headers.get("X-Remix-Replace") === "true" - })}`; -} -function createRouteErrorResponseDigest(response) { - let status = 500; - let statusText = ""; - let data2; - if (isDataWithResponseInit(response)) { - status = response.init?.status ?? status; - statusText = response.init?.statusText ?? statusText; - data2 = response.data; - } else { - status = response.status; - statusText = response.statusText; - data2 = void 0; - } - return `${ERROR_DIGEST_BASE}:${ERROR_DIGEST_ROUTE_ERROR_RESPONSE}:${JSON.stringify( - { - status, - statusText, - data: data2 - } - )}`; -} - -// lib/rsc/server.rsc.ts var Outlet = reactServerClient.Outlet; var WithComponentProps = reactServerClient.UNSAFE_WithComponentProps; var WithErrorBoundaryProps = reactServerClient.UNSAFE_WithErrorBoundaryProps; @@ -2501,28 +2464,8 @@ async function matchRSCServerRequest({ routes, generateResponse }) { - let url = new URL(request.url); - basename = basename || "/"; - let normalizedPath = url.pathname; - if (stripBasename(normalizedPath, basename) === "/_root.rsc") { - normalizedPath = basename; - } else if (normalizedPath.endsWith(".rsc")) { - normalizedPath = normalizedPath.replace(/\.rsc$/, ""); - } - if (stripBasename(normalizedPath, basename) !== "/" && normalizedPath.endsWith("/")) { - normalizedPath = normalizedPath.slice(0, -1); - } - url.pathname = normalizedPath; - basename = basename.length > normalizedPath.length ? normalizedPath : basename; - let routerRequest = new Request(url.toString(), { - method: request.method, - headers: request.headers, - body: request.body, - signal: request.signal, - duplex: request.body ? "half" : void 0 - }); + let requestUrl = new URL(request.url); const temporaryReferences = createTemporaryReferenceSet(); - const requestUrl = new URL(request.url); if (isManifestRequest(requestUrl)) { let response2 = await generateManifestResponse( routes, @@ -2534,6 +2477,18 @@ async function matchRSCServerRequest({ return response2; } let isDataRequest = isReactServerRequest(requestUrl); + const url = new URL(request.url); + let routerRequest = request; + if (isDataRequest) { + url.pathname = url.pathname.replace(/(_root)?\.rsc$/, ""); + routerRequest = new Request(url.toString(), { + method: request.method, + headers: request.headers, + body: request.body, + signal: request.signal, + duplex: request.body ? "half" : void 0 + }); + } let matches = matchRoutes(routes, url.pathname, basename); if (matches) { await Promise.all(matches.map((m) => explodeLazyRoute(m.route))); @@ -2605,7 +2560,7 @@ async function generateManifestResponse(routes, basename, request, generateRespo }), payload }, - { temporaryReferences, onError: defaultOnError } + { temporaryReferences } ); } function prependBasenameToRedirectResponse(response, basename = "/") { @@ -2883,7 +2838,7 @@ function generateRedirectResponse(response, actionResult, basename, isDataReques headers, payload }, - { temporaryReferences, onError: defaultOnError } + { temporaryReferences } ); } async function generateStaticContextResponse(routes, basename, generateResponse, statusCode, routeIdsToLoad, isDataRequest, isSubmission, actionResult, formState, staticContext, temporaryReferences, skipRevalidation, sideEffectRedirectHeaders) { @@ -2913,7 +2868,7 @@ async function generateStaticContextResponse(routes, basename, generateResponse, headers.delete("Content-Length"); const baseRenderPayload = { type: "render", - basename: staticContext.basename, + basename, actionData: staticContext.actionData, errors: staticContext.errors, loaderData: staticContext.loaderData, @@ -2950,7 +2905,7 @@ async function generateStaticContextResponse(routes, basename, generateResponse, headers, payload }, - { temporaryReferences, onError: defaultOnError } + { temporaryReferences } ); } async function getRenderPayload(baseRenderPayload, routes, basename, routeIdsToLoad, isDataRequest, staticContext) { @@ -3161,14 +3116,6 @@ function isReactServerRequest(url) { function isManifestRequest(url) { return url.pathname.endsWith(".manifest"); } -function defaultOnError(error) { - if (isRedirectResponse(error)) { - return createRedirectErrorDigest(error); - } - if (isResponse(error) || isDataWithResponseInit(error)) { - return createRouteErrorResponseDigest(error); - } -} function isClientReference(x) { try { return x.$$typeof === Symbol.for("react.client.reference"); diff --git a/node_modules/react-router/dist/production/index-react-server.mjs b/node_modules/react-router/dist/production/index-react-server.mjs index 91fc639b..a667d8d2 100644 --- a/node_modules/react-router/dist/production/index-react-server.mjs +++ b/node_modules/react-router/dist/production/index-react-server.mjs @@ -6,7 +6,7 @@ export { BrowserRouter, Form, HashRouter, Link, Links, MemoryRouter, Meta, NavLi import { serialize, parse } from 'cookie'; /** - * react-router v7.11.0 + * react-router v7.10.1 * * Copyright (c) Remix Software Inc. * @@ -1829,7 +1829,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request, handler: lazyRoutePromises.lazyHandlerPromise }; } -function getDataStrategyMatch(mapRouteProperties, manifest, request, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) { +function getDataStrategyMatch(mapRouteProperties, manifest, request, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null) { let isUsingNewApi = false; let _lazyPromises = getDataStrategyMatchLazyPromises( mapRouteProperties, @@ -2372,43 +2372,6 @@ function prependCookies(parentHeaders, childHeaders) { } } var SINGLE_FETCH_REDIRECT_STATUS = 202; - -// lib/errors.ts -var ERROR_DIGEST_BASE = "REACT_ROUTER_ERROR"; -var ERROR_DIGEST_REDIRECT = "REDIRECT"; -var ERROR_DIGEST_ROUTE_ERROR_RESPONSE = "ROUTE_ERROR_RESPONSE"; -function createRedirectErrorDigest(response) { - return `${ERROR_DIGEST_BASE}:${ERROR_DIGEST_REDIRECT}:${JSON.stringify({ - status: response.status, - statusText: response.statusText, - location: response.headers.get("Location"), - reloadDocument: response.headers.get("X-Remix-Reload-Document") === "true", - replace: response.headers.get("X-Remix-Replace") === "true" - })}`; -} -function createRouteErrorResponseDigest(response) { - let status = 500; - let statusText = ""; - let data2; - if (isDataWithResponseInit(response)) { - status = response.init?.status ?? status; - statusText = response.init?.statusText ?? statusText; - data2 = response.data; - } else { - status = response.status; - statusText = response.statusText; - data2 = void 0; - } - return `${ERROR_DIGEST_BASE}:${ERROR_DIGEST_ROUTE_ERROR_RESPONSE}:${JSON.stringify( - { - status, - statusText, - data: data2 - } - )}`; -} - -// lib/rsc/server.rsc.ts var Outlet = Outlet$1; var WithComponentProps = UNSAFE_WithComponentProps; var WithErrorBoundaryProps = UNSAFE_WithErrorBoundaryProps; @@ -2480,28 +2443,8 @@ async function matchRSCServerRequest({ routes, generateResponse }) { - let url = new URL(request.url); - basename = basename || "/"; - let normalizedPath = url.pathname; - if (stripBasename(normalizedPath, basename) === "/_root.rsc") { - normalizedPath = basename; - } else if (normalizedPath.endsWith(".rsc")) { - normalizedPath = normalizedPath.replace(/\.rsc$/, ""); - } - if (stripBasename(normalizedPath, basename) !== "/" && normalizedPath.endsWith("/")) { - normalizedPath = normalizedPath.slice(0, -1); - } - url.pathname = normalizedPath; - basename = basename.length > normalizedPath.length ? normalizedPath : basename; - let routerRequest = new Request(url.toString(), { - method: request.method, - headers: request.headers, - body: request.body, - signal: request.signal, - duplex: request.body ? "half" : void 0 - }); + let requestUrl = new URL(request.url); const temporaryReferences = createTemporaryReferenceSet(); - const requestUrl = new URL(request.url); if (isManifestRequest(requestUrl)) { let response2 = await generateManifestResponse( routes, @@ -2513,6 +2456,18 @@ async function matchRSCServerRequest({ return response2; } let isDataRequest = isReactServerRequest(requestUrl); + const url = new URL(request.url); + let routerRequest = request; + if (isDataRequest) { + url.pathname = url.pathname.replace(/(_root)?\.rsc$/, ""); + routerRequest = new Request(url.toString(), { + method: request.method, + headers: request.headers, + body: request.body, + signal: request.signal, + duplex: request.body ? "half" : void 0 + }); + } let matches = matchRoutes(routes, url.pathname, basename); if (matches) { await Promise.all(matches.map((m) => explodeLazyRoute(m.route))); @@ -2584,7 +2539,7 @@ async function generateManifestResponse(routes, basename, request, generateRespo }), payload }, - { temporaryReferences, onError: defaultOnError } + { temporaryReferences } ); } function prependBasenameToRedirectResponse(response, basename = "/") { @@ -2862,7 +2817,7 @@ function generateRedirectResponse(response, actionResult, basename, isDataReques headers, payload }, - { temporaryReferences, onError: defaultOnError } + { temporaryReferences } ); } async function generateStaticContextResponse(routes, basename, generateResponse, statusCode, routeIdsToLoad, isDataRequest, isSubmission, actionResult, formState, staticContext, temporaryReferences, skipRevalidation, sideEffectRedirectHeaders) { @@ -2892,7 +2847,7 @@ async function generateStaticContextResponse(routes, basename, generateResponse, headers.delete("Content-Length"); const baseRenderPayload = { type: "render", - basename: staticContext.basename, + basename, actionData: staticContext.actionData, errors: staticContext.errors, loaderData: staticContext.loaderData, @@ -2929,7 +2884,7 @@ async function generateStaticContextResponse(routes, basename, generateResponse, headers, payload }, - { temporaryReferences, onError: defaultOnError } + { temporaryReferences } ); } async function getRenderPayload(baseRenderPayload, routes, basename, routeIdsToLoad, isDataRequest, staticContext) { @@ -3140,14 +3095,6 @@ function isReactServerRequest(url) { function isManifestRequest(url) { return url.pathname.endsWith(".manifest"); } -function defaultOnError(error) { - if (isRedirectResponse(error)) { - return createRedirectErrorDigest(error); - } - if (isResponse(error) || isDataWithResponseInit(error)) { - return createRouteErrorResponseDigest(error); - } -} function isClientReference(x) { try { return x.$$typeof === Symbol.for("react.client.reference"); diff --git a/node_modules/react-router/dist/production/index.d.mts b/node_modules/react-router/dist/production/index.d.mts index 323a5489..5b05840c 100644 --- a/node_modules/react-router/dist/production/index.d.mts +++ b/node_modules/react-router/dist/production/index.d.mts @@ -1,15 +1,15 @@ -import { p as Router, q as RouteModules, r as DataStrategyFunction, s as MiddlewareEnabled, c as RouterContextProvider, t as AppLoadContext, T as To, v as NavigateOptions, B as BlockerFunction, w as Blocker, x as SerializeFrom, y as RelativeRoutingType, L as Location, z as ParamParseKey, E as Path, I as PathPattern, J as PathMatch, U as UIMatch, K as Navigation, O as Action, P as Params, Q as RouteObject, G as GetLoaderData, o as GetActionData, V as InitialEntry, W as HydrationState, X as IndexRouteObject, Y as RouteComponentType, Z as HydrateFallbackType, _ as ErrorBoundaryType, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, $ as NonIndexRouteObject, a0 as Equal, a1 as RouterState, a2 as PatchRoutesOnNavigationFunction, a3 as DataRouteObject, a as ClientLoaderFunction } from './router-5fbeEIMQ.mjs'; -export { ae as ActionFunctionArgs, b1 as Await, aS as AwaitProps, C as ClientActionFunction, bd as ClientActionFunctionArgs, be as ClientLoaderFunctionArgs, g as ClientOnErrorFunction, aN as DataRouteMatch, af as DataStrategyFunctionArgs, ag as DataStrategyMatch, D as DataStrategyResult, ai as ErrorResponse, a8 as Fetcher, aj as FormEncType, ak as FormMethod, bj as Future, a5 as GetScrollPositionFunction, a6 as GetScrollRestorationKeyFunction, al as HTMLFormMethod, bf as HeadersArgs, H as HeadersFunction, bi as HtmlLinkDescriptor, aD as IDLE_BLOCKER, aC as IDLE_FETCHER, aB as IDLE_NAVIGATION, aT as IndexRouteProps, aU as LayoutRouteProps, am as LazyRouteFunction, h as LinkDescriptor, an as LoaderFunctionArgs, b2 as MemoryRouter, aV as MemoryRouterOpts, aW as MemoryRouterProps, bg as MetaArgs, j as MetaDescriptor, ao as MiddlewareFunction, b3 as Navigate, aX as NavigateProps, a9 as NavigationStates, aO as Navigator, b4 as Outlet, aY as OutletProps, bh as PageLinkDescriptor, aP as PatchRoutesOnNavigationFunctionArgs, ap as PathParam, aZ as PathRouteProps, aq as RedirectFunction, ad as RevalidationState, b5 as Route, aQ as RouteMatch, a_ as RouteProps, b6 as Router, ar as RouterContext, ac as RouterFetchOptions, e as RouterInit, ab as RouterNavigateOptions, a$ as RouterProps, b7 as RouterProvider, f as RouterProviderProps, aa as RouterSubscriber, b8 as Routes, b0 as RoutesProps, S as ShouldRevalidateFunction, as as ShouldRevalidateFunctionArgs, a4 as StaticHandler, a7 as StaticHandlerContext, aR as UNSAFE_AwaitContextProvider, bp as UNSAFE_DataRouterContext, bq as UNSAFE_DataRouterStateContext, ah as UNSAFE_DataWithResponseInit, bo as UNSAFE_ErrorResponseImpl, br as UNSAFE_FetchersContext, bs as UNSAFE_LocationContext, bt as UNSAFE_NavigationContext, bu as UNSAFE_RouteContext, bv as UNSAFE_ViewTransitionContext, by as UNSAFE_WithComponentProps, bC as UNSAFE_WithErrorBoundaryProps, bA as UNSAFE_WithHydrateFallbackProps, bl as UNSAFE_createBrowserHistory, bn as UNSAFE_createRouter, bw as UNSAFE_hydrationRouteProperties, bm as UNSAFE_invariant, bx as UNSAFE_mapRouteProperties, bz as UNSAFE_withComponentProps, bD as UNSAFE_withErrorBoundaryProps, bB as UNSAFE_withHydrateFallbackProps, at as createContext, b9 as createMemoryRouter, au as createPath, ba as createRoutesFromChildren, bb as createRoutesFromElements, aE as data, aF as generatePath, aG as isRouteErrorResponse, aH as matchPath, aI as matchRoutes, av as parsePath, aJ as redirect, aK as redirectDocument, bc as renderMatches, aL as replace, aM as resolvePath, u as unstable_ClientInstrumentation, ax as unstable_InstrumentRequestHandlerFunction, az as unstable_InstrumentRouteFunction, ay as unstable_InstrumentRouterFunction, aA as unstable_InstrumentationHandlerResult, bk as unstable_SerializesTo, aw as unstable_ServerInstrumentation } from './router-5fbeEIMQ.mjs'; +import { p as Router, q as RouteModules, r as DataStrategyFunction, s as MiddlewareEnabled, c as RouterContextProvider, t as AppLoadContext, T as To, v as NavigateOptions, B as BlockerFunction, w as Blocker, x as SerializeFrom, y as RelativeRoutingType, L as Location, z as ParamParseKey, E as Path, I as PathPattern, J as PathMatch, U as UIMatch, K as Navigation, O as Action, P as Params, Q as RouteObject, G as GetLoaderData, o as GetActionData, V as InitialEntry, W as HydrationState, X as IndexRouteObject, Y as RouteComponentType, Z as HydrateFallbackType, _ as ErrorBoundaryType, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, $ as NonIndexRouteObject, a0 as Equal, a1 as RouterState, a2 as PatchRoutesOnNavigationFunction, a3 as DataRouteObject, a as ClientLoaderFunction } from './router-CwNp5l9u.mjs'; +export { ae as ActionFunctionArgs, b1 as Await, aS as AwaitProps, C as ClientActionFunction, bd as ClientActionFunctionArgs, be as ClientLoaderFunctionArgs, aN as DataRouteMatch, af as DataStrategyFunctionArgs, ag as DataStrategyMatch, D as DataStrategyResult, ai as ErrorResponse, a8 as Fetcher, aj as FormEncType, ak as FormMethod, bj as Future, a5 as GetScrollPositionFunction, a6 as GetScrollRestorationKeyFunction, al as HTMLFormMethod, bf as HeadersArgs, H as HeadersFunction, bi as HtmlLinkDescriptor, aD as IDLE_BLOCKER, aC as IDLE_FETCHER, aB as IDLE_NAVIGATION, aT as IndexRouteProps, aU as LayoutRouteProps, am as LazyRouteFunction, h as LinkDescriptor, an as LoaderFunctionArgs, b2 as MemoryRouter, aV as MemoryRouterOpts, aW as MemoryRouterProps, bg as MetaArgs, j as MetaDescriptor, ao as MiddlewareFunction, b3 as Navigate, aX as NavigateProps, a9 as NavigationStates, aO as Navigator, b4 as Outlet, aY as OutletProps, bh as PageLinkDescriptor, aP as PatchRoutesOnNavigationFunctionArgs, ap as PathParam, aZ as PathRouteProps, aq as RedirectFunction, ad as RevalidationState, b5 as Route, aQ as RouteMatch, a_ as RouteProps, b6 as Router, ar as RouterContext, ac as RouterFetchOptions, e as RouterInit, ab as RouterNavigateOptions, a$ as RouterProps, b7 as RouterProvider, f as RouterProviderProps, aa as RouterSubscriber, b8 as Routes, b0 as RoutesProps, S as ShouldRevalidateFunction, as as ShouldRevalidateFunctionArgs, a4 as StaticHandler, a7 as StaticHandlerContext, aR as UNSAFE_AwaitContextProvider, bp as UNSAFE_DataRouterContext, bq as UNSAFE_DataRouterStateContext, ah as UNSAFE_DataWithResponseInit, bo as UNSAFE_ErrorResponseImpl, br as UNSAFE_FetchersContext, bs as UNSAFE_LocationContext, bt as UNSAFE_NavigationContext, bu as UNSAFE_RouteContext, bv as UNSAFE_ViewTransitionContext, by as UNSAFE_WithComponentProps, bC as UNSAFE_WithErrorBoundaryProps, bA as UNSAFE_WithHydrateFallbackProps, bl as UNSAFE_createBrowserHistory, bn as UNSAFE_createRouter, bw as UNSAFE_hydrationRouteProperties, bm as UNSAFE_invariant, bx as UNSAFE_mapRouteProperties, bz as UNSAFE_withComponentProps, bD as UNSAFE_withErrorBoundaryProps, bB as UNSAFE_withHydrateFallbackProps, at as createContext, b9 as createMemoryRouter, au as createPath, ba as createRoutesFromChildren, bb as createRoutesFromElements, aE as data, aF as generatePath, aG as isRouteErrorResponse, aH as matchPath, aI as matchRoutes, av as parsePath, aJ as redirect, aK as redirectDocument, bc as renderMatches, aL as replace, aM as resolvePath, u as unstable_ClientInstrumentation, g as unstable_ClientOnErrorFunction, ax as unstable_InstrumentRequestHandlerFunction, az as unstable_InstrumentRouteFunction, ay as unstable_InstrumentRouterFunction, aA as unstable_InstrumentationHandlerResult, bk as unstable_SerializesTo, aw as unstable_ServerInstrumentation } from './router-CwNp5l9u.mjs'; import * as React from 'react'; import React__default, { ReactElement } from 'react'; -import { a as RouteModules$1, P as Pages } from './register-DTJJbt1o.mjs'; -export { b as Register } from './register-DTJJbt1o.mjs'; -import { A as AssetsManifest, S as ServerBuild, E as EntryContext, F as FutureConfig } from './index-react-server-client-P7VgYu6T.mjs'; -export { l as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, a1 as DiscoverBehavior, c as FetcherFormProps, h as FetcherSubmitFunction, G as FetcherSubmitOptions, i as FetcherWithComponents, q as Form, d as FormProps, a2 as HandleDataRequestFunction, a3 as HandleDocumentRequestFunction, a4 as HandleErrorFunction, m as HashRouter, H as HashRouterProps, a as HistoryRouterProps, n as Link, L as LinkProps, X as Links, _ as LinksProps, W as Meta, p as NavLink, N as NavLinkProps, b as NavLinkRenderProps, P as ParamKeyValuePair, a0 as PrefetchBehavior, Z as PrefetchPageLinks, Y as Scripts, $ as ScriptsProps, r as ScrollRestoration, e as ScrollRestorationProps, a5 as ServerEntryModule, f as SetURLSearchParams, T as StaticRouter, M as StaticRouterProps, V as StaticRouterProvider, O as StaticRouterProviderProps, g as SubmitFunction, I as SubmitOptions, J as SubmitTarget, a6 as UNSAFE_FrameworkContext, a7 as UNSAFE_createClientRoutes, a8 as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, a9 as UNSAFE_shouldHydrateRouteLoader, aa as UNSAFE_useScrollRestoration, U as URLSearchParamsInit, j as createBrowserRouter, k as createHashRouter, K as createSearchParams, Q as createStaticHandler, R as createStaticRouter, o as unstable_HistoryRouter, z as unstable_usePrompt, y as useBeforeUnload, w as useFetcher, x as useFetchers, v as useFormAction, u as useLinkClickHandler, s as useSearchParams, t as useSubmit, C as useViewTransitionState } from './index-react-server-client-P7VgYu6T.mjs'; +import { a as RouteModules$1, P as Pages } from './register-C1RwVJAt.mjs'; +export { b as Register } from './register-C1RwVJAt.mjs'; +import { A as AssetsManifest, S as ServerBuild, E as EntryContext, F as FutureConfig } from './index-react-server-client-CipGfVBI.mjs'; +export { l as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, a1 as DiscoverBehavior, c as FetcherFormProps, h as FetcherSubmitFunction, G as FetcherSubmitOptions, i as FetcherWithComponents, q as Form, d as FormProps, a2 as HandleDataRequestFunction, a3 as HandleDocumentRequestFunction, a4 as HandleErrorFunction, m as HashRouter, H as HashRouterProps, a as HistoryRouterProps, n as Link, L as LinkProps, X as Links, _ as LinksProps, W as Meta, p as NavLink, N as NavLinkProps, b as NavLinkRenderProps, P as ParamKeyValuePair, a0 as PrefetchBehavior, Z as PrefetchPageLinks, Y as Scripts, $ as ScriptsProps, r as ScrollRestoration, e as ScrollRestorationProps, a5 as ServerEntryModule, f as SetURLSearchParams, T as StaticRouter, M as StaticRouterProps, V as StaticRouterProvider, O as StaticRouterProviderProps, g as SubmitFunction, I as SubmitOptions, J as SubmitTarget, a6 as UNSAFE_FrameworkContext, a7 as UNSAFE_createClientRoutes, a8 as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, a9 as UNSAFE_shouldHydrateRouteLoader, aa as UNSAFE_useScrollRestoration, U as URLSearchParamsInit, j as createBrowserRouter, k as createHashRouter, K as createSearchParams, Q as createStaticHandler, R as createStaticRouter, o as unstable_HistoryRouter, z as unstable_usePrompt, y as useBeforeUnload, w as useFetcher, x as useFetchers, v as useFormAction, u as useLinkClickHandler, s as useSearchParams, t as useSubmit, C as useViewTransitionState } from './index-react-server-client-CipGfVBI.mjs'; import { ParseOptions, SerializeOptions } from 'cookie'; export { ParseOptions as CookieParseOptions, SerializeOptions as CookieSerializeOptions } from 'cookie'; -import { e as RSCPayload, m as matchRSCServerRequest } from './browser-Cv4JZyZ5.mjs'; -export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, g as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, h as unstable_RSCMatch, f as unstable_RSCRenderPayload, l as unstable_RSCRouteConfig, k as unstable_RSCRouteConfigEntry, i as unstable_RSCRouteManifest, j as unstable_RSCRouteMatch } from './browser-Cv4JZyZ5.mjs'; +import { e as RSCPayload, m as matchRSCServerRequest } from './browser-C5z6FZmz.mjs'; +export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, g as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, h as unstable_RSCMatch, f as unstable_RSCRenderPayload, l as unstable_RSCRouteConfig, k as unstable_RSCRouteConfigEntry, i as unstable_RSCRouteManifest, j as unstable_RSCRouteMatch } from './browser-C5z6FZmz.mjs'; declare const SingleFetchRedirectSymbol: unique symbol; declare function getTurboStreamSingleFetchDataStrategy(getRouter: () => Router, manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, basename: string | undefined): DataStrategyFunction; @@ -1236,7 +1236,7 @@ type SSRCreateFromReadableStreamFunction = (body: ReadableStream) => * * routeRSCServerRequest({ * request, - * serverResponse, + * fetchServer, * createFromReadableStream, * async renderHTML(getPayload) { * const payload = getPayload(); @@ -1258,7 +1258,9 @@ type SSRCreateFromReadableStreamFunction = (body: ReadableStream) => * @param opts Options * @param opts.createFromReadableStream Your `react-server-dom-xyz/client`'s * `createFromReadableStream` function, used to decode payloads from the server. - * @param opts.serverResponse A Response or partial response generated by the [RSC](https://react.dev/reference/rsc/server-components) handler containing a serialized {@link unstable_RSCPayload}. + * @param opts.fetchServer A function that forwards a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) + * to the [RSC](https://react.dev/reference/rsc/server-components) handler + * and returns a `Promise` containing a serialized {@link unstable_RSCPayload}. * @param opts.hydrate Whether to hydrate the server response with the RSC payload. * Defaults to `true`. * @param opts.renderHTML A function that renders the {@link unstable_RSCPayload} to @@ -1268,14 +1270,11 @@ type SSRCreateFromReadableStreamFunction = (body: ReadableStream) => * that either contains the [RSC](https://react.dev/reference/rsc/server-components) * payload for data requests, or renders the HTML for document requests. */ -declare function routeRSCServerRequest({ request, serverResponse, createFromReadableStream, renderHTML, hydrate, }: { +declare function routeRSCServerRequest({ request, fetchServer, createFromReadableStream, renderHTML, hydrate, }: { request: Request; - serverResponse: Response; + fetchServer: (request: Request) => Promise; createFromReadableStream: SSRCreateFromReadableStreamFunction; - renderHTML: (getPayload: () => DecodedPayload, options: { - onError(error: unknown): string | undefined; - onHeaders(headers: Headers): void; - }) => ReadableStream | Promise>; + renderHTML: (getPayload: () => DecodedPayload) => ReadableStream | Promise>; hydrate?: boolean; }): Promise; /** @@ -1305,7 +1304,7 @@ interface RSCStaticRouterProps { * * routeRSCServerRequest({ * request, - * serverResponse, + * fetchServer, * createFromReadableStream, * async renderHTML(getPayload) { * const payload = getPayload(); diff --git a/node_modules/react-router/dist/production/index.d.ts b/node_modules/react-router/dist/production/index.d.ts index 634ed14e..e68178c4 100644 --- a/node_modules/react-router/dist/production/index.d.ts +++ b/node_modules/react-router/dist/production/index.d.ts @@ -1,15 +1,15 @@ -import { n as Router, o as RouteModules, p as DataStrategyFunction, q as MiddlewareEnabled, c as RouterContextProvider, r as AppLoadContext, T as To, s as NavigateOptions, B as BlockerFunction, t as Blocker, v as SerializeFrom, w as RelativeRoutingType, L as Location, x as ParamParseKey, y as Path, z as PathPattern, E as PathMatch, U as UIMatch, I as Navigation, J as Action, P as Params, K as RouteObject, G as GetLoaderData, m as GetActionData, O as InitialEntry, Q as HydrationState, V as IndexRouteObject, W as RouteComponentType, X as HydrateFallbackType, Y as ErrorBoundaryType, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, Z as NonIndexRouteObject, _ as Equal, $ as RouterState, a0 as PatchRoutesOnNavigationFunction, a1 as DataRouteObject, a as ClientLoaderFunction } from './instrumentation-BlrVzjbg.js'; -export { ac as ActionFunctionArgs, b1 as Await, aQ as AwaitProps, C as ClientActionFunction, bd as ClientActionFunctionArgs, be as ClientLoaderFunctionArgs, aS as ClientOnErrorFunction, aL as DataRouteMatch, ad as DataStrategyFunctionArgs, ae as DataStrategyMatch, D as DataStrategyResult, ag as ErrorResponse, a6 as Fetcher, ah as FormEncType, ai as FormMethod, bj as Future, a3 as GetScrollPositionFunction, a4 as GetScrollRestorationKeyFunction, aj as HTMLFormMethod, bf as HeadersArgs, H as HeadersFunction, bi as HtmlLinkDescriptor, aB as IDLE_BLOCKER, aA as IDLE_FETCHER, az as IDLE_NAVIGATION, aR as IndexRouteProps, aT as LayoutRouteProps, ak as LazyRouteFunction, f as LinkDescriptor, al as LoaderFunctionArgs, b2 as MemoryRouter, aU as MemoryRouterOpts, aV as MemoryRouterProps, bg as MetaArgs, h as MetaDescriptor, am as MiddlewareFunction, b3 as Navigate, aW as NavigateProps, a7 as NavigationStates, aM as Navigator, b4 as Outlet, aX as OutletProps, bh as PageLinkDescriptor, aN as PatchRoutesOnNavigationFunctionArgs, an as PathParam, aY as PathRouteProps, ao as RedirectFunction, ab as RevalidationState, b5 as Route, aO as RouteMatch, aZ as RouteProps, b6 as Router, ap as RouterContext, aa as RouterFetchOptions, e as RouterInit, a9 as RouterNavigateOptions, a_ as RouterProps, b7 as RouterProvider, a$ as RouterProviderProps, a8 as RouterSubscriber, b8 as Routes, b0 as RoutesProps, S as ShouldRevalidateFunction, aq as ShouldRevalidateFunctionArgs, a2 as StaticHandler, a5 as StaticHandlerContext, aP as UNSAFE_AwaitContextProvider, bp as UNSAFE_DataRouterContext, bq as UNSAFE_DataRouterStateContext, af as UNSAFE_DataWithResponseInit, bo as UNSAFE_ErrorResponseImpl, br as UNSAFE_FetchersContext, bs as UNSAFE_LocationContext, bt as UNSAFE_NavigationContext, bu as UNSAFE_RouteContext, bv as UNSAFE_ViewTransitionContext, by as UNSAFE_WithComponentProps, bC as UNSAFE_WithErrorBoundaryProps, bA as UNSAFE_WithHydrateFallbackProps, bl as UNSAFE_createBrowserHistory, bn as UNSAFE_createRouter, bw as UNSAFE_hydrationRouteProperties, bm as UNSAFE_invariant, bx as UNSAFE_mapRouteProperties, bz as UNSAFE_withComponentProps, bD as UNSAFE_withErrorBoundaryProps, bB as UNSAFE_withHydrateFallbackProps, ar as createContext, b9 as createMemoryRouter, as as createPath, ba as createRoutesFromChildren, bb as createRoutesFromElements, aC as data, aD as generatePath, aE as isRouteErrorResponse, aF as matchPath, aG as matchRoutes, at as parsePath, aH as redirect, aI as redirectDocument, bc as renderMatches, aJ as replace, aK as resolvePath, u as unstable_ClientInstrumentation, av as unstable_InstrumentRequestHandlerFunction, ax as unstable_InstrumentRouteFunction, aw as unstable_InstrumentRouterFunction, ay as unstable_InstrumentationHandlerResult, bk as unstable_SerializesTo, au as unstable_ServerInstrumentation } from './instrumentation-BlrVzjbg.js'; +import { n as Router, o as RouteModules, p as DataStrategyFunction, q as MiddlewareEnabled, c as RouterContextProvider, r as AppLoadContext, T as To, s as NavigateOptions, B as BlockerFunction, t as Blocker, v as SerializeFrom, w as RelativeRoutingType, L as Location, x as ParamParseKey, y as Path, z as PathPattern, E as PathMatch, U as UIMatch, I as Navigation, J as Action, P as Params, K as RouteObject, G as GetLoaderData, m as GetActionData, O as InitialEntry, Q as HydrationState, V as IndexRouteObject, W as RouteComponentType, X as HydrateFallbackType, Y as ErrorBoundaryType, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, Z as NonIndexRouteObject, _ as Equal, $ as RouterState, a0 as PatchRoutesOnNavigationFunction, a1 as DataRouteObject, a as ClientLoaderFunction } from './instrumentation-BB0wRuqz.js'; +export { ac as ActionFunctionArgs, b1 as Await, aQ as AwaitProps, C as ClientActionFunction, bd as ClientActionFunctionArgs, be as ClientLoaderFunctionArgs, aL as DataRouteMatch, ad as DataStrategyFunctionArgs, ae as DataStrategyMatch, D as DataStrategyResult, ag as ErrorResponse, a6 as Fetcher, ah as FormEncType, ai as FormMethod, bj as Future, a3 as GetScrollPositionFunction, a4 as GetScrollRestorationKeyFunction, aj as HTMLFormMethod, bf as HeadersArgs, H as HeadersFunction, bi as HtmlLinkDescriptor, aB as IDLE_BLOCKER, aA as IDLE_FETCHER, az as IDLE_NAVIGATION, aR as IndexRouteProps, aT as LayoutRouteProps, ak as LazyRouteFunction, f as LinkDescriptor, al as LoaderFunctionArgs, b2 as MemoryRouter, aU as MemoryRouterOpts, aV as MemoryRouterProps, bg as MetaArgs, h as MetaDescriptor, am as MiddlewareFunction, b3 as Navigate, aW as NavigateProps, a7 as NavigationStates, aM as Navigator, b4 as Outlet, aX as OutletProps, bh as PageLinkDescriptor, aN as PatchRoutesOnNavigationFunctionArgs, an as PathParam, aY as PathRouteProps, ao as RedirectFunction, ab as RevalidationState, b5 as Route, aO as RouteMatch, aZ as RouteProps, b6 as Router, ap as RouterContext, aa as RouterFetchOptions, e as RouterInit, a9 as RouterNavigateOptions, a_ as RouterProps, b7 as RouterProvider, a$ as RouterProviderProps, a8 as RouterSubscriber, b8 as Routes, b0 as RoutesProps, S as ShouldRevalidateFunction, aq as ShouldRevalidateFunctionArgs, a2 as StaticHandler, a5 as StaticHandlerContext, aP as UNSAFE_AwaitContextProvider, bp as UNSAFE_DataRouterContext, bq as UNSAFE_DataRouterStateContext, af as UNSAFE_DataWithResponseInit, bo as UNSAFE_ErrorResponseImpl, br as UNSAFE_FetchersContext, bs as UNSAFE_LocationContext, bt as UNSAFE_NavigationContext, bu as UNSAFE_RouteContext, bv as UNSAFE_ViewTransitionContext, by as UNSAFE_WithComponentProps, bC as UNSAFE_WithErrorBoundaryProps, bA as UNSAFE_WithHydrateFallbackProps, bl as UNSAFE_createBrowserHistory, bn as UNSAFE_createRouter, bw as UNSAFE_hydrationRouteProperties, bm as UNSAFE_invariant, bx as UNSAFE_mapRouteProperties, bz as UNSAFE_withComponentProps, bD as UNSAFE_withErrorBoundaryProps, bB as UNSAFE_withHydrateFallbackProps, ar as createContext, b9 as createMemoryRouter, as as createPath, ba as createRoutesFromChildren, bb as createRoutesFromElements, aC as data, aD as generatePath, aE as isRouteErrorResponse, aF as matchPath, aG as matchRoutes, at as parsePath, aH as redirect, aI as redirectDocument, bc as renderMatches, aJ as replace, aK as resolvePath, u as unstable_ClientInstrumentation, aS as unstable_ClientOnErrorFunction, av as unstable_InstrumentRequestHandlerFunction, ax as unstable_InstrumentRouteFunction, aw as unstable_InstrumentRouterFunction, ay as unstable_InstrumentationHandlerResult, bk as unstable_SerializesTo, au as unstable_ServerInstrumentation } from './instrumentation-BB0wRuqz.js'; import * as React from 'react'; import React__default, { ReactElement } from 'react'; -import { a as RouteModules$1, P as Pages } from './register-BGQUMCK4.js'; -export { b as Register } from './register-BGQUMCK4.js'; -import { A as AssetsManifest, S as ServerBuild, E as EntryContext, F as FutureConfig } from './index-react-server-client-Cv5Q9lf0.js'; -export { l as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, a1 as DiscoverBehavior, c as FetcherFormProps, h as FetcherSubmitFunction, G as FetcherSubmitOptions, i as FetcherWithComponents, q as Form, d as FormProps, a2 as HandleDataRequestFunction, a3 as HandleDocumentRequestFunction, a4 as HandleErrorFunction, m as HashRouter, H as HashRouterProps, a as HistoryRouterProps, n as Link, L as LinkProps, X as Links, _ as LinksProps, W as Meta, p as NavLink, N as NavLinkProps, b as NavLinkRenderProps, P as ParamKeyValuePair, a0 as PrefetchBehavior, Z as PrefetchPageLinks, Y as Scripts, $ as ScriptsProps, r as ScrollRestoration, e as ScrollRestorationProps, a5 as ServerEntryModule, f as SetURLSearchParams, T as StaticRouter, M as StaticRouterProps, V as StaticRouterProvider, O as StaticRouterProviderProps, g as SubmitFunction, I as SubmitOptions, J as SubmitTarget, a6 as UNSAFE_FrameworkContext, a7 as UNSAFE_createClientRoutes, a8 as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, a9 as UNSAFE_shouldHydrateRouteLoader, aa as UNSAFE_useScrollRestoration, U as URLSearchParamsInit, j as createBrowserRouter, k as createHashRouter, K as createSearchParams, Q as createStaticHandler, R as createStaticRouter, o as unstable_HistoryRouter, z as unstable_usePrompt, y as useBeforeUnload, w as useFetcher, x as useFetchers, v as useFormAction, u as useLinkClickHandler, s as useSearchParams, t as useSubmit, C as useViewTransitionState } from './index-react-server-client-Cv5Q9lf0.js'; +import { a as RouteModules$1, P as Pages } from './register-ODDAAYlf.js'; +export { b as Register } from './register-ODDAAYlf.js'; +import { A as AssetsManifest, S as ServerBuild, E as EntryContext, F as FutureConfig } from './index-react-server-client-CCjKYJTH.js'; +export { l as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, a1 as DiscoverBehavior, c as FetcherFormProps, h as FetcherSubmitFunction, G as FetcherSubmitOptions, i as FetcherWithComponents, q as Form, d as FormProps, a2 as HandleDataRequestFunction, a3 as HandleDocumentRequestFunction, a4 as HandleErrorFunction, m as HashRouter, H as HashRouterProps, a as HistoryRouterProps, n as Link, L as LinkProps, X as Links, _ as LinksProps, W as Meta, p as NavLink, N as NavLinkProps, b as NavLinkRenderProps, P as ParamKeyValuePair, a0 as PrefetchBehavior, Z as PrefetchPageLinks, Y as Scripts, $ as ScriptsProps, r as ScrollRestoration, e as ScrollRestorationProps, a5 as ServerEntryModule, f as SetURLSearchParams, T as StaticRouter, M as StaticRouterProps, V as StaticRouterProvider, O as StaticRouterProviderProps, g as SubmitFunction, I as SubmitOptions, J as SubmitTarget, a6 as UNSAFE_FrameworkContext, a7 as UNSAFE_createClientRoutes, a8 as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, a9 as UNSAFE_shouldHydrateRouteLoader, aa as UNSAFE_useScrollRestoration, U as URLSearchParamsInit, j as createBrowserRouter, k as createHashRouter, K as createSearchParams, Q as createStaticHandler, R as createStaticRouter, o as unstable_HistoryRouter, z as unstable_usePrompt, y as useBeforeUnload, w as useFetcher, x as useFetchers, v as useFormAction, u as useLinkClickHandler, s as useSearchParams, t as useSubmit, C as useViewTransitionState } from './index-react-server-client-CCjKYJTH.js'; import { ParseOptions, SerializeOptions } from 'cookie'; export { ParseOptions as CookieParseOptions, SerializeOptions as CookieSerializeOptions } from 'cookie'; -import { e as RSCPayload, m as matchRSCServerRequest } from './browser-o-qhcuhA.js'; -export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, g as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, h as unstable_RSCMatch, f as unstable_RSCRenderPayload, l as unstable_RSCRouteConfig, k as unstable_RSCRouteConfigEntry, i as unstable_RSCRouteManifest, j as unstable_RSCRouteMatch } from './browser-o-qhcuhA.js'; +import { e as RSCPayload, m as matchRSCServerRequest } from './browser-BpxEZgZC.js'; +export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, g as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, h as unstable_RSCMatch, f as unstable_RSCRenderPayload, l as unstable_RSCRouteConfig, k as unstable_RSCRouteConfigEntry, i as unstable_RSCRouteManifest, j as unstable_RSCRouteMatch } from './browser-BpxEZgZC.js'; declare const SingleFetchRedirectSymbol: unique symbol; declare function getTurboStreamSingleFetchDataStrategy(getRouter: () => Router, manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, basename: string | undefined): DataStrategyFunction; @@ -1236,7 +1236,7 @@ type SSRCreateFromReadableStreamFunction = (body: ReadableStream) => * * routeRSCServerRequest({ * request, - * serverResponse, + * fetchServer, * createFromReadableStream, * async renderHTML(getPayload) { * const payload = getPayload(); @@ -1258,7 +1258,9 @@ type SSRCreateFromReadableStreamFunction = (body: ReadableStream) => * @param opts Options * @param opts.createFromReadableStream Your `react-server-dom-xyz/client`'s * `createFromReadableStream` function, used to decode payloads from the server. - * @param opts.serverResponse A Response or partial response generated by the [RSC](https://react.dev/reference/rsc/server-components) handler containing a serialized {@link unstable_RSCPayload}. + * @param opts.fetchServer A function that forwards a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) + * to the [RSC](https://react.dev/reference/rsc/server-components) handler + * and returns a `Promise` containing a serialized {@link unstable_RSCPayload}. * @param opts.hydrate Whether to hydrate the server response with the RSC payload. * Defaults to `true`. * @param opts.renderHTML A function that renders the {@link unstable_RSCPayload} to @@ -1268,14 +1270,11 @@ type SSRCreateFromReadableStreamFunction = (body: ReadableStream) => * that either contains the [RSC](https://react.dev/reference/rsc/server-components) * payload for data requests, or renders the HTML for document requests. */ -declare function routeRSCServerRequest({ request, serverResponse, createFromReadableStream, renderHTML, hydrate, }: { +declare function routeRSCServerRequest({ request, fetchServer, createFromReadableStream, renderHTML, hydrate, }: { request: Request; - serverResponse: Response; + fetchServer: (request: Request) => Promise; createFromReadableStream: SSRCreateFromReadableStreamFunction; - renderHTML: (getPayload: () => DecodedPayload, options: { - onError(error: unknown): string | undefined; - onHeaders(headers: Headers): void; - }) => ReadableStream | Promise>; + renderHTML: (getPayload: () => DecodedPayload) => ReadableStream | Promise>; hydrate?: boolean; }): Promise; /** @@ -1305,7 +1304,7 @@ interface RSCStaticRouterProps { * * routeRSCServerRequest({ * request, - * serverResponse, + * fetchServer, * createFromReadableStream, * async renderHTML(getPayload) { * const payload = getPayload(); diff --git a/node_modules/react-router/dist/production/index.js b/node_modules/react-router/dist/production/index.js index f91c1e3c..b2b06be4 100644 --- a/node_modules/react-router/dist/production/index.js +++ b/node_modules/react-router/dist/production/index.js @@ -1,5 +1,5 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/** - * react-router v7.11.0 + * react-router v7.10.1 * * Copyright (c) Remix Software Inc. * @@ -14,7 +14,7 @@ -var _chunkBEXOWXJOjs = require('./chunk-BEXOWXJO.js'); +var _chunkYO5R3LGQjs = require('./chunk-YO5R3LGQ.js'); @@ -40,7 +40,7 @@ var _chunkBEXOWXJOjs = require('./chunk-BEXOWXJO.js'); -var _chunkZMYPVUNZjs = require('./chunk-ZMYPVUNZ.js'); +var _chunkB3F6YMOFjs = require('./chunk-B3F6YMOF.js'); @@ -145,9 +145,7 @@ var _chunkZMYPVUNZjs = require('./chunk-ZMYPVUNZ.js'); - - -var _chunk2HFJAX7Ujs = require('./chunk-2HFJAX7U.js'); +var _chunkUQPBOMFPjs = require('./chunk-UQPBOMFP.js'); // lib/dom/ssr/server.tsx var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react); @@ -160,7 +158,7 @@ function ServerRouter({ url = new URL(url); } let { manifest, routeModules, criticalCss, serverHandoffString } = context; - let routes = _chunk2HFJAX7Ujs.createServerRoutes.call(void 0, + let routes = _chunkUQPBOMFPjs.createServerRoutes.call(void 0, manifest.routes, routeModules, context.future, @@ -173,7 +171,7 @@ function ServerRouter({ let routeId = match.route.id; let route = routeModules[routeId]; let manifestRoute = context.manifest.routes[routeId]; - if (route && manifestRoute && _chunk2HFJAX7Ujs.shouldHydrateRouteLoader.call(void 0, + if (route && manifestRoute && _chunkUQPBOMFPjs.shouldHydrateRouteLoader.call(void 0, routeId, route.clientLoader, manifestRoute.hasLoader, @@ -182,9 +180,9 @@ function ServerRouter({ delete context.staticHandlerContext.loaderData[routeId]; } } - let router = _chunkZMYPVUNZjs.createStaticRouter.call(void 0, routes, context.staticHandlerContext); + let router = _chunkB3F6YMOFjs.createStaticRouter.call(void 0, routes, context.staticHandlerContext); return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement( - _chunk2HFJAX7Ujs.FrameworkContext.Provider, + _chunkUQPBOMFPjs.FrameworkContext.Provider, { value: { manifest, @@ -199,8 +197,8 @@ function ServerRouter({ renderMeta: context.renderMeta } }, - /* @__PURE__ */ React.createElement(_chunk2HFJAX7Ujs.RemixErrorBoundary, { location: router.state.location }, /* @__PURE__ */ React.createElement( - _chunkZMYPVUNZjs.StaticRouterProvider, + /* @__PURE__ */ React.createElement(_chunkUQPBOMFPjs.RemixErrorBoundary, { location: router.state.location }, /* @__PURE__ */ React.createElement( + _chunkB3F6YMOFjs.StaticRouterProvider, { router, context: context.staticHandlerContext, @@ -208,7 +206,7 @@ function ServerRouter({ } )) ), context.serverHandoffStream ? /* @__PURE__ */ React.createElement(React.Suspense, null, /* @__PURE__ */ React.createElement( - _chunk2HFJAX7Ujs.StreamTransfer, + _chunkUQPBOMFPjs.StreamTransfer, { context, identifier: 0, @@ -250,18 +248,18 @@ function createRoutesStub(routes, _context) { let patched = processRoutes( // @ts-expect-error `StubRouteObject` is stricter about `loader`/`action` // types compared to `AgnosticRouteObject` - _chunk2HFJAX7Ujs.convertRoutesToDataRoutes.call(void 0, routes, (r) => r), - _context !== void 0 ? _context : _optionalChain([future, 'optionalAccess', _4 => _4.v8_middleware]) ? new (0, _chunk2HFJAX7Ujs.RouterContextProvider)() : {}, + _chunkUQPBOMFPjs.convertRoutesToDataRoutes.call(void 0, routes, (r) => r), + _context !== void 0 ? _context : _optionalChain([future, 'optionalAccess', _4 => _4.v8_middleware]) ? new (0, _chunkUQPBOMFPjs.RouterContextProvider)() : {}, frameworkContextRef.current.manifest, frameworkContextRef.current.routeModules ); - routerRef.current = _chunk2HFJAX7Ujs.createMemoryRouter.call(void 0, patched, { + routerRef.current = _chunkUQPBOMFPjs.createMemoryRouter.call(void 0, patched, { initialEntries, initialIndex, hydrationData }); } - return /* @__PURE__ */ React2.createElement(_chunk2HFJAX7Ujs.FrameworkContext.Provider, { value: frameworkContextRef.current }, /* @__PURE__ */ React2.createElement(_chunk2HFJAX7Ujs.RouterProvider, { router: routerRef.current })); + return /* @__PURE__ */ React2.createElement(_chunkUQPBOMFPjs.FrameworkContext.Provider, { value: frameworkContextRef.current }, /* @__PURE__ */ React2.createElement(_chunkUQPBOMFPjs.RouterProvider, { router: routerRef.current })); }; } function processRoutes(routes, context, manifest, routeModules, parentId) { @@ -275,9 +273,9 @@ function processRoutes(routes, context, manifest, routeModules, parentId) { id: route.id, path: route.path, index: route.index, - Component: route.Component ? _chunk2HFJAX7Ujs.withComponentProps.call(void 0, route.Component) : void 0, - HydrateFallback: route.HydrateFallback ? _chunk2HFJAX7Ujs.withHydrateFallbackProps.call(void 0, route.HydrateFallback) : void 0, - ErrorBoundary: route.ErrorBoundary ? _chunk2HFJAX7Ujs.withErrorBoundaryProps.call(void 0, route.ErrorBoundary) : void 0, + Component: route.Component ? _chunkUQPBOMFPjs.withComponentProps.call(void 0, route.Component) : void 0, + HydrateFallback: route.HydrateFallback ? _chunkUQPBOMFPjs.withHydrateFallbackProps.call(void 0, route.HydrateFallback) : void 0, + ErrorBoundary: route.ErrorBoundary ? _chunkUQPBOMFPjs.withErrorBoundaryProps.call(void 0, route.ErrorBoundary) : void 0, action: route.action ? (args) => route.action({ ...args, context }) : void 0, loader: route.loader ? (args) => route.loader({ ...args, context }) : void 0, middleware: route.middleware ? route.middleware.map( @@ -312,7 +310,7 @@ function processRoutes(routes, context, manifest, routeModules, parentId) { }; manifest.routes[newRoute.id] = entryRoute; routeModules[route.id] = { - default: newRoute.Component || _chunk2HFJAX7Ujs.Outlet, + default: newRoute.Component || _chunkUQPBOMFPjs.Outlet, ErrorBoundary: newRoute.ErrorBoundary || void 0, handle: route.handle, links: route.links, @@ -507,7 +505,7 @@ function myUnescape(value) { return result; } function warnOnceAboutExpiresCookie(name, expires) { - _chunk2HFJAX7Ujs.warnOnce.call(void 0, + _chunkUQPBOMFPjs.warnOnce.call(void 0, !expires, `The "${name}" cookie has an "expires" property set. This will cause the expires value to not be updated when the session is committed. Instead, you should set the expires value when serializing the cookie. You can use \`commitSession(session, { expires })\` if using a session storage object, or \`cookie.serialize("value", { expires })\` if you're using the cookie directly.` ); @@ -561,7 +559,7 @@ function serializeErrors(errors, serverMode) { let entries = Object.entries(errors); let serialized = {}; for (let [key, val] of entries) { - if (_chunk2HFJAX7Ujs.isRouteErrorResponse.call(void 0, val)) { + if (_chunkUQPBOMFPjs.isRouteErrorResponse.call(void 0, val)) { serialized[key] = { ...val, __type: "RouteErrorResponse" }; } else if (val instanceof Error) { let sanitized = sanitizeError(val, serverMode); @@ -586,7 +584,7 @@ function serializeErrors(errors, serverMode) { // lib/server-runtime/routeMatching.ts function matchServerRoutes(routes, pathname, basename) { - let matches = _chunk2HFJAX7Ujs.matchRoutes.call(void 0, + let matches = _chunkUQPBOMFPjs.matchRoutes.call(void 0, routes, pathname, basename @@ -607,7 +605,7 @@ async function callRouteHandler(handler, args) { context: args.context, unstable_pattern: args.unstable_pattern }); - if (_chunk2HFJAX7Ujs.isDataWithResponseInit.call(void 0, result) && result.init && result.init.status && _chunk2HFJAX7Ujs.isRedirectStatusCode.call(void 0, result.init.status)) { + if (_chunkUQPBOMFPjs.isDataWithResponseInit.call(void 0, result) && result.init && result.init.status && _chunkUQPBOMFPjs.isRedirectStatusCode.call(void 0, result.init.status)) { throw new Response(null, result.init); } return result; @@ -726,17 +724,17 @@ function createStaticHandlerDataRoutes(manifest, future, parentId = "", routesBy controller.close(); } }); - let decoded = await _chunk2HFJAX7Ujs.decodeViaTurboStream.call(void 0, stream, global); + let decoded = await _chunkUQPBOMFPjs.decodeViaTurboStream.call(void 0, stream, global); let data2 = decoded.value; - if (data2 && _chunk2HFJAX7Ujs.SingleFetchRedirectSymbol in data2) { - let result = data2[_chunk2HFJAX7Ujs.SingleFetchRedirectSymbol]; + if (data2 && _chunkUQPBOMFPjs.SingleFetchRedirectSymbol in data2) { + let result = data2[_chunkUQPBOMFPjs.SingleFetchRedirectSymbol]; let init = { status: result.status }; if (result.reload) { - throw _chunk2HFJAX7Ujs.redirectDocument.call(void 0, result.redirect, init); + throw _chunkUQPBOMFPjs.redirectDocument.call(void 0, result.redirect, init); } else if (result.replace) { - throw _chunk2HFJAX7Ujs.replace.call(void 0, result.redirect, init); + throw _chunkUQPBOMFPjs.replace.call(void 0, result.redirect, init); } else { - throw _chunk2HFJAX7Ujs.redirect.call(void 0, result.redirect, init); + throw _chunkUQPBOMFPjs.redirect.call(void 0, result.redirect, init); } } else { invariant2( @@ -775,7 +773,7 @@ function createStaticHandlerDataRoutes(manifest, future, parentId = "", routesBy // lib/server-runtime/serverHandoff.ts function createServerHandoffString(serverHandoff) { - return _chunk2HFJAX7Ujs.escapeHtml.call(void 0, JSON.stringify(serverHandoff)); + return _chunkUQPBOMFPjs.escapeHtml.call(void 0, JSON.stringify(serverHandoff)); } // lib/server-runtime/headers.ts @@ -852,7 +850,7 @@ function prependCookies(parentHeaders, childHeaders) { // lib/server-runtime/single-fetch.ts var SERVER_NO_BODY_STATUS_CODES = /* @__PURE__ */ new Set([ - ..._chunk2HFJAX7Ujs.NO_BODY_STATUS_CODES, + ..._chunkUQPBOMFPjs.NO_BODY_STATUS_CODES, 304 ]); async function singleFetchAction(build, serverMode, staticHandler, request, handlerUrl, loadContext, handleError) { @@ -882,7 +880,7 @@ async function singleFetchAction(build, serverMode, staticHandler, request, hand return handleQueryError(error); } function handleQueryResult(result) { - return _chunk2HFJAX7Ujs.isResponse.call(void 0, result) ? result : staticContextToResponse(result); + return _chunkUQPBOMFPjs.isResponse.call(void 0, result) ? result : staticContextToResponse(result); } function handleQueryError(error) { handleError(error); @@ -894,12 +892,12 @@ async function singleFetchAction(build, serverMode, staticHandler, request, hand } function staticContextToResponse(context) { let headers = getDocumentHeaders(context, build); - if (_chunk2HFJAX7Ujs.isRedirectStatusCode.call(void 0, context.statusCode) && headers.has("Location")) { + if (_chunkUQPBOMFPjs.isRedirectStatusCode.call(void 0, context.statusCode) && headers.has("Location")) { return new Response(null, { status: context.statusCode, headers }); } if (context.errors) { Object.values(context.errors).forEach((err) => { - if (!_chunk2HFJAX7Ujs.isRouteErrorResponse.call(void 0, err) || err.error) { + if (!_chunkUQPBOMFPjs.isRouteErrorResponse.call(void 0, err) || err.error) { handleError(err); } }); @@ -946,7 +944,7 @@ async function singleFetchLoaders(build, serverMode, staticHandler, request, han return handleQueryError(error); } function handleQueryResult(result) { - return _chunk2HFJAX7Ujs.isResponse.call(void 0, result) ? result : staticContextToResponse(result); + return _chunkUQPBOMFPjs.isResponse.call(void 0, result) ? result : staticContextToResponse(result); } function handleQueryError(error) { handleError(error); @@ -958,12 +956,12 @@ async function singleFetchLoaders(build, serverMode, staticHandler, request, han } function staticContextToResponse(context) { let headers = getDocumentHeaders(context, build); - if (_chunk2HFJAX7Ujs.isRedirectStatusCode.call(void 0, context.statusCode) && headers.has("Location")) { + if (_chunkUQPBOMFPjs.isRedirectStatusCode.call(void 0, context.statusCode) && headers.has("Location")) { return new Response(null, { status: context.statusCode, headers }); } if (context.errors) { Object.values(context.errors).forEach((err) => { - if (!_chunk2HFJAX7Ujs.isRouteErrorResponse.call(void 0, err) || err.error) { + if (!_chunkUQPBOMFPjs.isRouteErrorResponse.call(void 0, err) || err.error) { handleError(err); } }); @@ -1027,15 +1025,15 @@ function generateSingleFetchRedirectResponse(redirectResponse, request, build, s headers.delete("Location"); headers.set("Content-Type", "text/x-script"); return generateSingleFetchResponse(request, build, serverMode, { - result: request.method === "GET" ? { [_chunk2HFJAX7Ujs.SingleFetchRedirectSymbol]: redirect2 } : redirect2, + result: request.method === "GET" ? { [_chunkUQPBOMFPjs.SingleFetchRedirectSymbol]: redirect2 } : redirect2, headers, - status: _chunk2HFJAX7Ujs.SINGLE_FETCH_REDIRECT_STATUS + status: _chunkUQPBOMFPjs.SINGLE_FETCH_REDIRECT_STATUS }); } function getSingleFetchRedirect(status, headers, basename) { let redirect2 = headers.get("Location"); if (basename) { - redirect2 = _chunk2HFJAX7Ujs.stripBasename.call(void 0, redirect2, basename) || redirect2; + redirect2 = _chunkUQPBOMFPjs.stripBasename.call(void 0, redirect2, basename) || redirect2; } return { redirect: redirect2, @@ -1061,7 +1059,7 @@ function encodeViaTurboStream(data2, requestSignal, streamTimeout, serverMode) { typeof streamTimeout === "number" ? streamTimeout : 4950 ); requestSignal.addEventListener("abort", () => clearTimeout(timeoutId)); - return _chunk2HFJAX7Ujs.encode.call(void 0, data2, { + return _chunkUQPBOMFPjs.encode.call(void 0, data2, { signal: controller.signal, plugins: [ (value) => { @@ -1069,12 +1067,12 @@ function encodeViaTurboStream(data2, requestSignal, streamTimeout, serverMode) { let { name, message, stack } = serverMode === "production" /* Production */ ? sanitizeError(value, serverMode) : value; return ["SanitizedError", name, message, stack]; } - if (value instanceof _chunk2HFJAX7Ujs.ErrorResponseImpl) { + if (value instanceof _chunkUQPBOMFPjs.ErrorResponseImpl) { let { data: data3, status, statusText } = value; return ["ErrorResponse", data3, status, statusText]; } - if (value && typeof value === "object" && _chunk2HFJAX7Ujs.SingleFetchRedirectSymbol in value) { - return ["SingleFetchRedirect", value[_chunk2HFJAX7Ujs.SingleFetchRedirectSymbol]]; + if (value && typeof value === "object" && _chunkUQPBOMFPjs.SingleFetchRedirectSymbol in value) { + return ["SingleFetchRedirect", value[_chunkUQPBOMFPjs.SingleFetchRedirectSymbol]]; } } ], @@ -1097,7 +1095,7 @@ function derive(build, mode) { let routes = createRoutes(build.routes); let dataRoutes = createStaticHandlerDataRoutes(build.routes, build.future); let serverMode = isServerMode(mode) ? mode : "production" /* Production */; - let staticHandler = _chunk2HFJAX7Ujs.createStaticHandler.call(void 0, dataRoutes, { + let staticHandler = _chunkUQPBOMFPjs.createStaticHandler.call(void 0, dataRoutes, { basename: build.basename, unstable_instrumentations: build.entry.module.unstable_instrumentations }); @@ -1105,7 +1103,7 @@ function derive(build, mode) { if (serverMode !== "test" /* Test */ && !request.signal.aborted) { console.error( // @ts-expect-error This is "private" from users but intended for internal use - _chunk2HFJAX7Ujs.isRouteErrorResponse.call(void 0, error) && error.error ? error.error : error + _chunkUQPBOMFPjs.isRouteErrorResponse.call(void 0, error) && error.error ? error.error : error ); } }); @@ -1123,36 +1121,36 @@ function derive(build, mode) { }); }; if (build.future.v8_middleware) { - if (initialContext && !(initialContext instanceof _chunk2HFJAX7Ujs.RouterContextProvider)) { + if (initialContext && !(initialContext instanceof _chunkUQPBOMFPjs.RouterContextProvider)) { let error = new Error( "Invalid `context` value provided to `handleRequest`. When middleware is enabled you must return an instance of `RouterContextProvider` from your `getLoadContext` function." ); handleError(error); return returnLastResortErrorResponse(error, serverMode); } - loadContext = initialContext || new (0, _chunk2HFJAX7Ujs.RouterContextProvider)(); + loadContext = initialContext || new (0, _chunkUQPBOMFPjs.RouterContextProvider)(); } else { loadContext = initialContext || {}; } let url = new URL(request.url); let normalizedBasename = build.basename || "/"; let normalizedPath = url.pathname; - if (_chunk2HFJAX7Ujs.stripBasename.call(void 0, normalizedPath, normalizedBasename) === "/_root.data") { + if (_chunkUQPBOMFPjs.stripBasename.call(void 0, normalizedPath, normalizedBasename) === "/_root.data") { normalizedPath = normalizedBasename; } else if (normalizedPath.endsWith(".data")) { normalizedPath = normalizedPath.replace(/\.data$/, ""); } - if (_chunk2HFJAX7Ujs.stripBasename.call(void 0, normalizedPath, normalizedBasename) !== "/" && normalizedPath.endsWith("/")) { + if (_chunkUQPBOMFPjs.stripBasename.call(void 0, normalizedPath, normalizedBasename) !== "/" && normalizedPath.endsWith("/")) { normalizedPath = normalizedPath.slice(0, -1); } let isSpaMode = getBuildTimeHeader(request, "X-React-Router-SPA-Mode") === "yes"; if (!build.ssr) { let decodedPath = decodeURI(normalizedPath); if (normalizedBasename !== "/") { - let strippedPath = _chunk2HFJAX7Ujs.stripBasename.call(void 0, decodedPath, normalizedBasename); + let strippedPath = _chunkUQPBOMFPjs.stripBasename.call(void 0, decodedPath, normalizedBasename); if (strippedPath == null) { errorHandler( - new (0, _chunk2HFJAX7Ujs.ErrorResponseImpl)( + new (0, _chunkUQPBOMFPjs.ErrorResponseImpl)( 404, "Not Found", `Refusing to prerender the \`${decodedPath}\` path because it does not start with the basename \`${normalizedBasename}\`` @@ -1175,7 +1173,7 @@ function derive(build, mode) { } else if (!build.prerender.includes(decodedPath) && !build.prerender.includes(decodedPath + "/")) { if (url.pathname.endsWith(".data")) { errorHandler( - new (0, _chunk2HFJAX7Ujs.ErrorResponseImpl)( + new (0, _chunkUQPBOMFPjs.ErrorResponseImpl)( 404, "Not Found", `Refusing to SSR the path \`${decodedPath}\` because \`ssr:false\` is set and the path is not included in the \`prerender\` config, so in production the path will be a 404.` @@ -1195,7 +1193,7 @@ function derive(build, mode) { } } } - let manifestUrl = _chunk2HFJAX7Ujs.getManifestPath.call(void 0, + let manifestUrl = _chunkUQPBOMFPjs.getManifestPath.call(void 0, build.routeDiscovery.manifestPath, normalizedBasename ); @@ -1230,7 +1228,7 @@ function derive(build, mode) { loadContext, handleError ); - if (_chunk2HFJAX7Ujs.isRedirectResponse.call(void 0, response)) { + if (_chunkUQPBOMFPjs.isRedirectResponse.call(void 0, response)) { response = generateSingleFetchRedirectResponse( response, request, @@ -1244,7 +1242,7 @@ function derive(build, mode) { params: singleFetchMatches ? singleFetchMatches[0].params : {}, request }); - if (_chunk2HFJAX7Ujs.isRedirectResponse.call(void 0, response)) { + if (_chunkUQPBOMFPjs.isRedirectResponse.call(void 0, response)) { response = generateSingleFetchRedirectResponse( response, request, @@ -1292,7 +1290,7 @@ function derive(build, mode) { return response; }; if (build.entry.module.unstable_instrumentations) { - requestHandler = _chunk2HFJAX7Ujs.instrumentHandler.call(void 0, + requestHandler = _chunkUQPBOMFPjs.instrumentHandler.call(void 0, requestHandler, build.entry.module.unstable_instrumentations.map((i) => i.handler).filter(Boolean) ); @@ -1404,7 +1402,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request, generateMiddlewareResponse: build.future.v8_middleware ? async (query) => { try { let innerResult = await query(request); - if (!_chunk2HFJAX7Ujs.isResponse.call(void 0, innerResult)) { + if (!_chunkUQPBOMFPjs.isResponse.call(void 0, innerResult)) { innerResult = await renderHtml(innerResult, isSpaMode); } return innerResult; @@ -1414,7 +1412,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request, } } : void 0 }); - if (!_chunk2HFJAX7Ujs.isResponse.call(void 0, result)) { + if (!_chunkUQPBOMFPjs.isResponse.call(void 0, result)) { result = await renderHtml(result, isSpaMode); } return result; @@ -1429,7 +1427,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request, } if (context.errors) { Object.values(context.errors).forEach((err) => { - if (!_chunk2HFJAX7Ujs.isRouteErrorResponse.call(void 0, err) || err.error) { + if (!_chunkUQPBOMFPjs.isRouteErrorResponse.call(void 0, err) || err.error) { handleError(err); } }); @@ -1481,10 +1479,10 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request, } catch (error) { handleError(error); let errorForSecondRender = error; - if (_chunk2HFJAX7Ujs.isResponse.call(void 0, error)) { + if (_chunkUQPBOMFPjs.isResponse.call(void 0, error)) { try { let data2 = await unwrapResponse(error); - errorForSecondRender = new (0, _chunk2HFJAX7Ujs.ErrorResponseImpl)( + errorForSecondRender = new (0, _chunkUQPBOMFPjs.ErrorResponseImpl)( error.status, error.statusText, data2 @@ -1492,7 +1490,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request, } catch (e) { } } - context = _chunk2HFJAX7Ujs.getStaticContextFromError.call(void 0, + context = _chunkUQPBOMFPjs.getStaticContextFromError.call(void 0, staticHandler.dataRoutes, context, errorForSecondRender @@ -1551,7 +1549,7 @@ async function handleResourceRequest(serverMode, build, staticHandler, routeId, return handleQueryRouteError(error); } function handleQueryRouteResult(result) { - if (_chunk2HFJAX7Ujs.isResponse.call(void 0, result)) { + if (_chunkUQPBOMFPjs.isResponse.call(void 0, result)) { return result; } if (typeof result === "string") { @@ -1560,10 +1558,10 @@ async function handleResourceRequest(serverMode, build, staticHandler, routeId, return Response.json(result); } function handleQueryRouteError(error) { - if (_chunk2HFJAX7Ujs.isResponse.call(void 0, error)) { + if (_chunkUQPBOMFPjs.isResponse.call(void 0, error)) { return error; } - if (_chunk2HFJAX7Ujs.isRouteErrorResponse.call(void 0, error)) { + if (_chunkUQPBOMFPjs.isRouteErrorResponse.call(void 0, error)) { handleError(error); return errorResponseToJson(error, serverMode); } @@ -1686,7 +1684,7 @@ function createSessionStorage({ }; } function warnOnceAboutSigningSessionCookie(cookie) { - _chunk2HFJAX7Ujs.warnOnce.call(void 0, + _chunkUQPBOMFPjs.warnOnce.call(void 0, cookie.isSigned, `The "${cookie.name}" cookie is not signed, but session cookies should be signed to prevent tampering on the client before they are sent back to the server. See https://reactrouter.com/explanation/sessions-and-cookies#signing-cookies for more information.` ); @@ -1888,7 +1886,7 @@ function useSafe(promise) { } async function routeRSCServerRequest({ request, - serverResponse, + fetchServer, createFromReadableStream, renderHTML, hydrate = true @@ -1896,6 +1894,7 @@ async function routeRSCServerRequest({ const url = new URL(request.url); const isDataRequest = isReactServerRequest(url); const respondWithRSCPayload = isDataRequest || isManifestRequest(url) || request.headers.has("rsc-action-id"); + const serverResponse = await fetchServer(request); if (respondWithRSCPayload || serverResponse.headers.get("React-Router-Resource") === "true") { return serverResponse; } @@ -1957,8 +1956,6 @@ async function routeRSCServerRequest({ } }); }; - let renderRedirect; - let renderError; try { if (!detectRedirectResponse.body) { throw new Error("Failed to clone server response"); @@ -1966,7 +1963,7 @@ async function routeRSCServerRequest({ const payload = await createFromReadableStream( detectRedirectResponse.body ); - if (serverResponse.status === _chunk2HFJAX7Ujs.SINGLE_FETCH_REDIRECT_STATUS && payload.type === "redirect") { + if (serverResponse.status === _chunkUQPBOMFPjs.SINGLE_FETCH_REDIRECT_STATUS && payload.type === "redirect") { const headers2 = new Headers(serverResponse.headers); headers2.delete("Content-Encoding"); headers2.delete("Content-Length"); @@ -1979,179 +1976,73 @@ async function routeRSCServerRequest({ statusText: serverResponse.statusText }); } - let reactHeaders = new Headers(); - let status = serverResponse.status; - let statusText = serverResponse.statusText; - let html = await renderHTML(getPayload, { - onError(error) { - if (typeof error === "object" && error && "digest" in error && typeof error.digest === "string") { - renderRedirect = _chunk2HFJAX7Ujs.decodeRedirectErrorDigest.call(void 0, error.digest); - if (renderRedirect) { - return error.digest; - } - let routeErrorResponse = _chunk2HFJAX7Ujs.decodeRouteErrorResponseDigest.call(void 0, error.digest); - if (routeErrorResponse) { - renderError = routeErrorResponse; - status = routeErrorResponse.status; - statusText = routeErrorResponse.statusText; - return error.digest; - } - } - }, - onHeaders(headers2) { - for (const [key, value] of headers2) { - reactHeaders.append(key, value); - } - } - }); - const headers = new Headers(reactHeaders); - for (const [key, value] of serverResponse.headers) { - headers.append(key, value); - } + const html = await renderHTML(getPayload); + const headers = new Headers(serverResponse.headers); headers.set("Content-Type", "text/html; charset=utf-8"); - if (renderRedirect) { - headers.set("Location", renderRedirect.location); - return new Response(html, { - status: renderRedirect.status, - headers - }); - } - const redirectTransform = new TransformStream({ - flush(controller) { - if (renderRedirect) { - controller.enqueue( - new TextEncoder().encode( - `` - ) - ); - } - } - }); if (!hydrate) { - return new Response(html.pipeThrough(redirectTransform), { - status, - statusText, + return new Response(html, { + status: serverResponse.status, headers }); } if (!_optionalChain([serverResponseB, 'optionalAccess', _22 => _22.body])) { throw new Error("Failed to clone server response"); } - const body2 = html.pipeThrough(injectRSCPayload(serverResponseB.body)).pipeThrough(redirectTransform); + const body2 = html.pipeThrough(injectRSCPayload(serverResponseB.body)); return new Response(body2, { - status, - statusText, + status: serverResponse.status, headers }); } catch (reason) { if (reason instanceof Response) { return reason; } - if (renderRedirect) { - return new Response(`Redirect: ${renderRedirect.location}`, { - status: renderRedirect.status, - headers: { - Location: renderRedirect.location - } - }); - } try { - reason = _nullishCoalesce(renderError, () => ( reason)); - let [status, statusText] = _chunk2HFJAX7Ujs.isRouteErrorResponse.call(void 0, reason) ? [reason.status, reason.statusText] : [500, ""]; - let retryRedirect; - let reactHeaders = new Headers(); - const html = await renderHTML( - () => { - const decoded = Promise.resolve( - createFromReadableStream(createStream()) - ); - const payloadPromise = decoded.then( - (payload) => Object.assign(payload, { - status, - errors: deepestRenderedBoundaryId ? { - [deepestRenderedBoundaryId]: reason - } : {} - }) - ); - return Object.defineProperties(payloadPromise, { - _deepestRenderedBoundaryId: { - get() { - return deepestRenderedBoundaryId; - }, - set(boundaryId) { - deepestRenderedBoundaryId = boundaryId; - } + const status = _chunkUQPBOMFPjs.isRouteErrorResponse.call(void 0, reason) ? reason.status : 500; + const html = await renderHTML(() => { + const decoded = Promise.resolve( + createFromReadableStream(createStream()) + ); + const payloadPromise = decoded.then( + (payload) => Object.assign(payload, { + status, + errors: deepestRenderedBoundaryId ? { + [deepestRenderedBoundaryId]: reason + } : {} + }) + ); + return Object.defineProperties(payloadPromise, { + _deepestRenderedBoundaryId: { + get() { + return deepestRenderedBoundaryId; }, - formState: { - get() { - return payloadPromise.then( - (payload) => payload.type === "render" ? payload.formState : void 0 - ); - } - } - }); - }, - { - onError(error) { - if (typeof error === "object" && error && "digest" in error && typeof error.digest === "string") { - retryRedirect = _chunk2HFJAX7Ujs.decodeRedirectErrorDigest.call(void 0, error.digest); - if (retryRedirect) { - return error.digest; - } - let routeErrorResponse = _chunk2HFJAX7Ujs.decodeRouteErrorResponseDigest.call(void 0, - error.digest - ); - if (routeErrorResponse) { - status = routeErrorResponse.status; - statusText = routeErrorResponse.statusText; - return error.digest; - } + set(boundaryId) { + deepestRenderedBoundaryId = boundaryId; } }, - onHeaders(headers2) { - for (const [key, value] of headers2) { - reactHeaders.append(key, value); + formState: { + get() { + return payloadPromise.then( + (payload) => payload.type === "render" ? payload.formState : void 0 + ); } } - } - ); - const headers = new Headers(reactHeaders); - for (const [key, value] of serverResponse.headers) { - headers.append(key, value); - } - headers.set("Content-Type", "text/html; charset=utf-8"); - if (retryRedirect) { - headers.set("Location", retryRedirect.location); - return new Response(html, { - status: retryRedirect.status, - headers }); - } - const retryRedirectTransform = new TransformStream({ - flush(controller) { - if (retryRedirect) { - controller.enqueue( - new TextEncoder().encode( - `` - ) - ); - } - } }); + const headers = new Headers(serverResponse.headers); + headers.set("Content-Type", "text/html"); if (!hydrate) { - return new Response(html.pipeThrough(retryRedirectTransform), { + return new Response(html, { status, - statusText, headers }); } if (!_optionalChain([serverResponseB, 'optionalAccess', _23 => _23.body])) { throw new Error("Failed to clone server response"); } - const body2 = html.pipeThrough(injectRSCPayload(serverResponseB.body)).pipeThrough(retryRedirectTransform); + const body2 = html.pipeThrough(injectRSCPayload(serverResponseB.body)); return new Response(body2, { status, - statusText, headers }); } catch (e2) { @@ -2173,7 +2064,7 @@ function RSCStaticRouter({ getPayload }) { if (payload.type !== "render") return null; let patchedLoaderData = { ...payload.loaderData }; for (const match of payload.matches) { - if (_chunk2HFJAX7Ujs.shouldHydrateRouteLoader.call(void 0, + if (_chunkUQPBOMFPjs.shouldHydrateRouteLoader.call(void 0, match.id, match.clientLoader, match.hasLoader, @@ -2213,7 +2104,7 @@ function RSCStaticRouter({ getPayload }) { } })) }; - const router = _chunkZMYPVUNZjs.createStaticRouter.call(void 0, + const router = _chunkB3F6YMOFjs.createStaticRouter.call(void 0, payload.matches.reduceRight((previous, match) => { const route = { id: match.id, @@ -2255,10 +2146,10 @@ function RSCStaticRouter({ getPayload }) { } }, routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" }, - routeModules: _chunkBEXOWXJOjs.createRSCRouteModules.call(void 0, payload) + routeModules: _chunkYO5R3LGQjs.createRSCRouteModules.call(void 0, payload) }; - return /* @__PURE__ */ React3.createElement(_chunk2HFJAX7Ujs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkBEXOWXJOjs.RSCRouterGlobalErrorBoundary, { location: payload.location }, /* @__PURE__ */ React3.createElement(_chunk2HFJAX7Ujs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement( - _chunkZMYPVUNZjs.StaticRouterProvider, + return /* @__PURE__ */ React3.createElement(_chunkUQPBOMFPjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkYO5R3LGQjs.RSCRouterGlobalErrorBoundary, { location: payload.location }, /* @__PURE__ */ React3.createElement(_chunkUQPBOMFPjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement( + _chunkB3F6YMOFjs.StaticRouterProvider, { context, router, @@ -2281,7 +2172,7 @@ function deserializeErrors(errors) { let serialized = {}; for (let [key, val] of entries) { if (val && val.__type === "RouteErrorResponse") { - serialized[key] = new (0, _chunk2HFJAX7Ujs.ErrorResponseImpl)( + serialized[key] = new (0, _chunkUQPBOMFPjs.ErrorResponseImpl)( val.status, val.statusText, val.data, @@ -2438,4 +2329,4 @@ function deserializeErrors(errors) { -exports.Await = _chunk2HFJAX7Ujs.Await; exports.BrowserRouter = _chunkZMYPVUNZjs.BrowserRouter; exports.Form = _chunkZMYPVUNZjs.Form; exports.HashRouter = _chunkZMYPVUNZjs.HashRouter; exports.IDLE_BLOCKER = _chunk2HFJAX7Ujs.IDLE_BLOCKER; exports.IDLE_FETCHER = _chunk2HFJAX7Ujs.IDLE_FETCHER; exports.IDLE_NAVIGATION = _chunk2HFJAX7Ujs.IDLE_NAVIGATION; exports.Link = _chunkZMYPVUNZjs.Link; exports.Links = _chunk2HFJAX7Ujs.Links; exports.MemoryRouter = _chunk2HFJAX7Ujs.MemoryRouter; exports.Meta = _chunk2HFJAX7Ujs.Meta; exports.NavLink = _chunkZMYPVUNZjs.NavLink; exports.Navigate = _chunk2HFJAX7Ujs.Navigate; exports.NavigationType = _chunk2HFJAX7Ujs.Action; exports.Outlet = _chunk2HFJAX7Ujs.Outlet; exports.PrefetchPageLinks = _chunk2HFJAX7Ujs.PrefetchPageLinks; exports.Route = _chunk2HFJAX7Ujs.Route; exports.Router = _chunk2HFJAX7Ujs.Router; exports.RouterContextProvider = _chunk2HFJAX7Ujs.RouterContextProvider; exports.RouterProvider = _chunk2HFJAX7Ujs.RouterProvider; exports.Routes = _chunk2HFJAX7Ujs.Routes; exports.Scripts = _chunk2HFJAX7Ujs.Scripts; exports.ScrollRestoration = _chunkZMYPVUNZjs.ScrollRestoration; exports.ServerRouter = ServerRouter; exports.StaticRouter = _chunkZMYPVUNZjs.StaticRouter; exports.StaticRouterProvider = _chunkZMYPVUNZjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunk2HFJAX7Ujs.AwaitContextProvider; exports.UNSAFE_DataRouterContext = _chunk2HFJAX7Ujs.DataRouterContext; exports.UNSAFE_DataRouterStateContext = _chunk2HFJAX7Ujs.DataRouterStateContext; exports.UNSAFE_ErrorResponseImpl = _chunk2HFJAX7Ujs.ErrorResponseImpl; exports.UNSAFE_FetchersContext = _chunk2HFJAX7Ujs.FetchersContext; exports.UNSAFE_FrameworkContext = _chunk2HFJAX7Ujs.FrameworkContext; exports.UNSAFE_LocationContext = _chunk2HFJAX7Ujs.LocationContext; exports.UNSAFE_NavigationContext = _chunk2HFJAX7Ujs.NavigationContext; exports.UNSAFE_RSCDefaultRootErrorBoundary = _chunkBEXOWXJOjs.RSCDefaultRootErrorBoundary; exports.UNSAFE_RemixErrorBoundary = _chunk2HFJAX7Ujs.RemixErrorBoundary; exports.UNSAFE_RouteContext = _chunk2HFJAX7Ujs.RouteContext; exports.UNSAFE_ServerMode = ServerMode; exports.UNSAFE_SingleFetchRedirectSymbol = _chunk2HFJAX7Ujs.SingleFetchRedirectSymbol; exports.UNSAFE_ViewTransitionContext = _chunk2HFJAX7Ujs.ViewTransitionContext; exports.UNSAFE_WithComponentProps = _chunk2HFJAX7Ujs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunk2HFJAX7Ujs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunk2HFJAX7Ujs.WithHydrateFallbackProps; exports.UNSAFE_createBrowserHistory = _chunk2HFJAX7Ujs.createBrowserHistory; exports.UNSAFE_createClientRoutes = _chunk2HFJAX7Ujs.createClientRoutes; exports.UNSAFE_createClientRoutesWithHMRRevalidationOptOut = _chunk2HFJAX7Ujs.createClientRoutesWithHMRRevalidationOptOut; exports.UNSAFE_createRouter = _chunk2HFJAX7Ujs.createRouter; exports.UNSAFE_decodeViaTurboStream = _chunk2HFJAX7Ujs.decodeViaTurboStream; exports.UNSAFE_deserializeErrors = deserializeErrors; exports.UNSAFE_getHydrationData = _chunkBEXOWXJOjs.getHydrationData; exports.UNSAFE_getPatchRoutesOnNavigationFunction = _chunk2HFJAX7Ujs.getPatchRoutesOnNavigationFunction; exports.UNSAFE_getTurboStreamSingleFetchDataStrategy = _chunk2HFJAX7Ujs.getTurboStreamSingleFetchDataStrategy; exports.UNSAFE_hydrationRouteProperties = _chunk2HFJAX7Ujs.hydrationRouteProperties; exports.UNSAFE_invariant = _chunk2HFJAX7Ujs.invariant; exports.UNSAFE_mapRouteProperties = _chunk2HFJAX7Ujs.mapRouteProperties; exports.UNSAFE_shouldHydrateRouteLoader = _chunk2HFJAX7Ujs.shouldHydrateRouteLoader; exports.UNSAFE_useFogOFWarDiscovery = _chunk2HFJAX7Ujs.useFogOFWarDiscovery; exports.UNSAFE_useScrollRestoration = _chunkZMYPVUNZjs.useScrollRestoration; exports.UNSAFE_withComponentProps = _chunk2HFJAX7Ujs.withComponentProps; exports.UNSAFE_withErrorBoundaryProps = _chunk2HFJAX7Ujs.withErrorBoundaryProps; exports.UNSAFE_withHydrateFallbackProps = _chunk2HFJAX7Ujs.withHydrateFallbackProps; exports.createBrowserRouter = _chunkZMYPVUNZjs.createBrowserRouter; exports.createContext = _chunk2HFJAX7Ujs.createContext; exports.createCookie = createCookie; exports.createCookieSessionStorage = createCookieSessionStorage; exports.createHashRouter = _chunkZMYPVUNZjs.createHashRouter; exports.createMemoryRouter = _chunk2HFJAX7Ujs.createMemoryRouter; exports.createMemorySessionStorage = createMemorySessionStorage; exports.createPath = _chunk2HFJAX7Ujs.createPath; exports.createRequestHandler = createRequestHandler; exports.createRoutesFromChildren = _chunk2HFJAX7Ujs.createRoutesFromChildren; exports.createRoutesFromElements = _chunk2HFJAX7Ujs.createRoutesFromElements; exports.createRoutesStub = createRoutesStub; exports.createSearchParams = _chunkZMYPVUNZjs.createSearchParams; exports.createSession = createSession; exports.createSessionStorage = createSessionStorage; exports.createStaticHandler = _chunkZMYPVUNZjs.createStaticHandler; exports.createStaticRouter = _chunkZMYPVUNZjs.createStaticRouter; exports.data = _chunk2HFJAX7Ujs.data; exports.generatePath = _chunk2HFJAX7Ujs.generatePath; exports.href = href; exports.isCookie = isCookie; exports.isRouteErrorResponse = _chunk2HFJAX7Ujs.isRouteErrorResponse; exports.isSession = isSession; exports.matchPath = _chunk2HFJAX7Ujs.matchPath; exports.matchRoutes = _chunk2HFJAX7Ujs.matchRoutes; exports.parsePath = _chunk2HFJAX7Ujs.parsePath; exports.redirect = _chunk2HFJAX7Ujs.redirect; exports.redirectDocument = _chunk2HFJAX7Ujs.redirectDocument; exports.renderMatches = _chunk2HFJAX7Ujs.renderMatches; exports.replace = _chunk2HFJAX7Ujs.replace; exports.resolvePath = _chunk2HFJAX7Ujs.resolvePath; exports.unstable_HistoryRouter = _chunkZMYPVUNZjs.HistoryRouter; exports.unstable_RSCStaticRouter = RSCStaticRouter; exports.unstable_routeRSCServerRequest = routeRSCServerRequest; exports.unstable_setDevServerHooks = setDevServerHooks; exports.unstable_usePrompt = _chunkZMYPVUNZjs.usePrompt; exports.unstable_useRoute = _chunk2HFJAX7Ujs.useRoute; exports.useActionData = _chunk2HFJAX7Ujs.useActionData; exports.useAsyncError = _chunk2HFJAX7Ujs.useAsyncError; exports.useAsyncValue = _chunk2HFJAX7Ujs.useAsyncValue; exports.useBeforeUnload = _chunkZMYPVUNZjs.useBeforeUnload; exports.useBlocker = _chunk2HFJAX7Ujs.useBlocker; exports.useFetcher = _chunkZMYPVUNZjs.useFetcher; exports.useFetchers = _chunkZMYPVUNZjs.useFetchers; exports.useFormAction = _chunkZMYPVUNZjs.useFormAction; exports.useHref = _chunk2HFJAX7Ujs.useHref; exports.useInRouterContext = _chunk2HFJAX7Ujs.useInRouterContext; exports.useLinkClickHandler = _chunkZMYPVUNZjs.useLinkClickHandler; exports.useLoaderData = _chunk2HFJAX7Ujs.useLoaderData; exports.useLocation = _chunk2HFJAX7Ujs.useLocation; exports.useMatch = _chunk2HFJAX7Ujs.useMatch; exports.useMatches = _chunk2HFJAX7Ujs.useMatches; exports.useNavigate = _chunk2HFJAX7Ujs.useNavigate; exports.useNavigation = _chunk2HFJAX7Ujs.useNavigation; exports.useNavigationType = _chunk2HFJAX7Ujs.useNavigationType; exports.useOutlet = _chunk2HFJAX7Ujs.useOutlet; exports.useOutletContext = _chunk2HFJAX7Ujs.useOutletContext; exports.useParams = _chunk2HFJAX7Ujs.useParams; exports.useResolvedPath = _chunk2HFJAX7Ujs.useResolvedPath; exports.useRevalidator = _chunk2HFJAX7Ujs.useRevalidator; exports.useRouteError = _chunk2HFJAX7Ujs.useRouteError; exports.useRouteLoaderData = _chunk2HFJAX7Ujs.useRouteLoaderData; exports.useRoutes = _chunk2HFJAX7Ujs.useRoutes; exports.useSearchParams = _chunkZMYPVUNZjs.useSearchParams; exports.useSubmit = _chunkZMYPVUNZjs.useSubmit; exports.useViewTransitionState = _chunkZMYPVUNZjs.useViewTransitionState; +exports.Await = _chunkUQPBOMFPjs.Await; exports.BrowserRouter = _chunkB3F6YMOFjs.BrowserRouter; exports.Form = _chunkB3F6YMOFjs.Form; exports.HashRouter = _chunkB3F6YMOFjs.HashRouter; exports.IDLE_BLOCKER = _chunkUQPBOMFPjs.IDLE_BLOCKER; exports.IDLE_FETCHER = _chunkUQPBOMFPjs.IDLE_FETCHER; exports.IDLE_NAVIGATION = _chunkUQPBOMFPjs.IDLE_NAVIGATION; exports.Link = _chunkB3F6YMOFjs.Link; exports.Links = _chunkUQPBOMFPjs.Links; exports.MemoryRouter = _chunkUQPBOMFPjs.MemoryRouter; exports.Meta = _chunkUQPBOMFPjs.Meta; exports.NavLink = _chunkB3F6YMOFjs.NavLink; exports.Navigate = _chunkUQPBOMFPjs.Navigate; exports.NavigationType = _chunkUQPBOMFPjs.Action; exports.Outlet = _chunkUQPBOMFPjs.Outlet; exports.PrefetchPageLinks = _chunkUQPBOMFPjs.PrefetchPageLinks; exports.Route = _chunkUQPBOMFPjs.Route; exports.Router = _chunkUQPBOMFPjs.Router; exports.RouterContextProvider = _chunkUQPBOMFPjs.RouterContextProvider; exports.RouterProvider = _chunkUQPBOMFPjs.RouterProvider; exports.Routes = _chunkUQPBOMFPjs.Routes; exports.Scripts = _chunkUQPBOMFPjs.Scripts; exports.ScrollRestoration = _chunkB3F6YMOFjs.ScrollRestoration; exports.ServerRouter = ServerRouter; exports.StaticRouter = _chunkB3F6YMOFjs.StaticRouter; exports.StaticRouterProvider = _chunkB3F6YMOFjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunkUQPBOMFPjs.AwaitContextProvider; exports.UNSAFE_DataRouterContext = _chunkUQPBOMFPjs.DataRouterContext; exports.UNSAFE_DataRouterStateContext = _chunkUQPBOMFPjs.DataRouterStateContext; exports.UNSAFE_ErrorResponseImpl = _chunkUQPBOMFPjs.ErrorResponseImpl; exports.UNSAFE_FetchersContext = _chunkUQPBOMFPjs.FetchersContext; exports.UNSAFE_FrameworkContext = _chunkUQPBOMFPjs.FrameworkContext; exports.UNSAFE_LocationContext = _chunkUQPBOMFPjs.LocationContext; exports.UNSAFE_NavigationContext = _chunkUQPBOMFPjs.NavigationContext; exports.UNSAFE_RSCDefaultRootErrorBoundary = _chunkYO5R3LGQjs.RSCDefaultRootErrorBoundary; exports.UNSAFE_RemixErrorBoundary = _chunkUQPBOMFPjs.RemixErrorBoundary; exports.UNSAFE_RouteContext = _chunkUQPBOMFPjs.RouteContext; exports.UNSAFE_ServerMode = ServerMode; exports.UNSAFE_SingleFetchRedirectSymbol = _chunkUQPBOMFPjs.SingleFetchRedirectSymbol; exports.UNSAFE_ViewTransitionContext = _chunkUQPBOMFPjs.ViewTransitionContext; exports.UNSAFE_WithComponentProps = _chunkUQPBOMFPjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkUQPBOMFPjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkUQPBOMFPjs.WithHydrateFallbackProps; exports.UNSAFE_createBrowserHistory = _chunkUQPBOMFPjs.createBrowserHistory; exports.UNSAFE_createClientRoutes = _chunkUQPBOMFPjs.createClientRoutes; exports.UNSAFE_createClientRoutesWithHMRRevalidationOptOut = _chunkUQPBOMFPjs.createClientRoutesWithHMRRevalidationOptOut; exports.UNSAFE_createRouter = _chunkUQPBOMFPjs.createRouter; exports.UNSAFE_decodeViaTurboStream = _chunkUQPBOMFPjs.decodeViaTurboStream; exports.UNSAFE_deserializeErrors = deserializeErrors; exports.UNSAFE_getHydrationData = _chunkYO5R3LGQjs.getHydrationData; exports.UNSAFE_getPatchRoutesOnNavigationFunction = _chunkUQPBOMFPjs.getPatchRoutesOnNavigationFunction; exports.UNSAFE_getTurboStreamSingleFetchDataStrategy = _chunkUQPBOMFPjs.getTurboStreamSingleFetchDataStrategy; exports.UNSAFE_hydrationRouteProperties = _chunkUQPBOMFPjs.hydrationRouteProperties; exports.UNSAFE_invariant = _chunkUQPBOMFPjs.invariant; exports.UNSAFE_mapRouteProperties = _chunkUQPBOMFPjs.mapRouteProperties; exports.UNSAFE_shouldHydrateRouteLoader = _chunkUQPBOMFPjs.shouldHydrateRouteLoader; exports.UNSAFE_useFogOFWarDiscovery = _chunkUQPBOMFPjs.useFogOFWarDiscovery; exports.UNSAFE_useScrollRestoration = _chunkB3F6YMOFjs.useScrollRestoration; exports.UNSAFE_withComponentProps = _chunkUQPBOMFPjs.withComponentProps; exports.UNSAFE_withErrorBoundaryProps = _chunkUQPBOMFPjs.withErrorBoundaryProps; exports.UNSAFE_withHydrateFallbackProps = _chunkUQPBOMFPjs.withHydrateFallbackProps; exports.createBrowserRouter = _chunkB3F6YMOFjs.createBrowserRouter; exports.createContext = _chunkUQPBOMFPjs.createContext; exports.createCookie = createCookie; exports.createCookieSessionStorage = createCookieSessionStorage; exports.createHashRouter = _chunkB3F6YMOFjs.createHashRouter; exports.createMemoryRouter = _chunkUQPBOMFPjs.createMemoryRouter; exports.createMemorySessionStorage = createMemorySessionStorage; exports.createPath = _chunkUQPBOMFPjs.createPath; exports.createRequestHandler = createRequestHandler; exports.createRoutesFromChildren = _chunkUQPBOMFPjs.createRoutesFromChildren; exports.createRoutesFromElements = _chunkUQPBOMFPjs.createRoutesFromElements; exports.createRoutesStub = createRoutesStub; exports.createSearchParams = _chunkB3F6YMOFjs.createSearchParams; exports.createSession = createSession; exports.createSessionStorage = createSessionStorage; exports.createStaticHandler = _chunkB3F6YMOFjs.createStaticHandler; exports.createStaticRouter = _chunkB3F6YMOFjs.createStaticRouter; exports.data = _chunkUQPBOMFPjs.data; exports.generatePath = _chunkUQPBOMFPjs.generatePath; exports.href = href; exports.isCookie = isCookie; exports.isRouteErrorResponse = _chunkUQPBOMFPjs.isRouteErrorResponse; exports.isSession = isSession; exports.matchPath = _chunkUQPBOMFPjs.matchPath; exports.matchRoutes = _chunkUQPBOMFPjs.matchRoutes; exports.parsePath = _chunkUQPBOMFPjs.parsePath; exports.redirect = _chunkUQPBOMFPjs.redirect; exports.redirectDocument = _chunkUQPBOMFPjs.redirectDocument; exports.renderMatches = _chunkUQPBOMFPjs.renderMatches; exports.replace = _chunkUQPBOMFPjs.replace; exports.resolvePath = _chunkUQPBOMFPjs.resolvePath; exports.unstable_HistoryRouter = _chunkB3F6YMOFjs.HistoryRouter; exports.unstable_RSCStaticRouter = RSCStaticRouter; exports.unstable_routeRSCServerRequest = routeRSCServerRequest; exports.unstable_setDevServerHooks = setDevServerHooks; exports.unstable_usePrompt = _chunkB3F6YMOFjs.usePrompt; exports.unstable_useRoute = _chunkUQPBOMFPjs.useRoute; exports.useActionData = _chunkUQPBOMFPjs.useActionData; exports.useAsyncError = _chunkUQPBOMFPjs.useAsyncError; exports.useAsyncValue = _chunkUQPBOMFPjs.useAsyncValue; exports.useBeforeUnload = _chunkB3F6YMOFjs.useBeforeUnload; exports.useBlocker = _chunkUQPBOMFPjs.useBlocker; exports.useFetcher = _chunkB3F6YMOFjs.useFetcher; exports.useFetchers = _chunkB3F6YMOFjs.useFetchers; exports.useFormAction = _chunkB3F6YMOFjs.useFormAction; exports.useHref = _chunkUQPBOMFPjs.useHref; exports.useInRouterContext = _chunkUQPBOMFPjs.useInRouterContext; exports.useLinkClickHandler = _chunkB3F6YMOFjs.useLinkClickHandler; exports.useLoaderData = _chunkUQPBOMFPjs.useLoaderData; exports.useLocation = _chunkUQPBOMFPjs.useLocation; exports.useMatch = _chunkUQPBOMFPjs.useMatch; exports.useMatches = _chunkUQPBOMFPjs.useMatches; exports.useNavigate = _chunkUQPBOMFPjs.useNavigate; exports.useNavigation = _chunkUQPBOMFPjs.useNavigation; exports.useNavigationType = _chunkUQPBOMFPjs.useNavigationType; exports.useOutlet = _chunkUQPBOMFPjs.useOutlet; exports.useOutletContext = _chunkUQPBOMFPjs.useOutletContext; exports.useParams = _chunkUQPBOMFPjs.useParams; exports.useResolvedPath = _chunkUQPBOMFPjs.useResolvedPath; exports.useRevalidator = _chunkUQPBOMFPjs.useRevalidator; exports.useRouteError = _chunkUQPBOMFPjs.useRouteError; exports.useRouteLoaderData = _chunkUQPBOMFPjs.useRouteLoaderData; exports.useRoutes = _chunkUQPBOMFPjs.useRoutes; exports.useSearchParams = _chunkB3F6YMOFjs.useSearchParams; exports.useSubmit = _chunkB3F6YMOFjs.useSubmit; exports.useViewTransitionState = _chunkB3F6YMOFjs.useViewTransitionState; diff --git a/node_modules/react-router/dist/production/index.mjs b/node_modules/react-router/dist/production/index.mjs index deb85dfe..8b6c65d9 100644 --- a/node_modules/react-router/dist/production/index.mjs +++ b/node_modules/react-router/dist/production/index.mjs @@ -1,5 +1,5 @@ /** - * react-router v7.11.0 + * react-router v7.10.1 * * Copyright (c) Remix Software Inc. * @@ -28,7 +28,7 @@ import { isSession, routeRSCServerRequest, setDevServerHooks -} from "./chunk-E6GYEQUT.mjs"; +} from "./chunk-TDCOAFPJ.mjs"; import { Action, Await, @@ -139,7 +139,7 @@ import { withComponentProps, withErrorBoundaryProps, withHydrateFallbackProps -} from "./chunk-TINMVEA2.mjs"; +} from "./chunk-ANIOYBQK.mjs"; export { Await, BrowserRouter, diff --git a/node_modules/react-router/dist/production/lib/types/internal.d.mts b/node_modules/react-router/dist/production/lib/types/internal.d.mts index c57b4cba..4fd47be2 100644 --- a/node_modules/react-router/dist/production/lib/types/internal.d.mts +++ b/node_modules/react-router/dist/production/lib/types/internal.d.mts @@ -1,5 +1,5 @@ -import { R as RouteModule, h as LinkDescriptor, L as Location, F as Func, i as Pretty, j as MetaDescriptor, G as GetLoaderData, k as ServerDataFunctionArgs, l as MiddlewareNextFunction, m as ClientDataFunctionArgs, D as DataStrategyResult, n as ServerDataFrom, N as Normalize, o as GetActionData } from '../../router-5fbeEIMQ.mjs'; -import { R as RouteFiles, P as Pages } from '../../register-DTJJbt1o.mjs'; +import { R as RouteModule, h as LinkDescriptor, L as Location, F as Func, i as Pretty, j as MetaDescriptor, G as GetLoaderData, k as ServerDataFunctionArgs, l as MiddlewareNextFunction, m as ClientDataFunctionArgs, D as DataStrategyResult, n as ServerDataFrom, N as Normalize, o as GetActionData } from '../../router-CwNp5l9u.mjs'; +import { R as RouteFiles, P as Pages } from '../../register-C1RwVJAt.mjs'; import 'react'; type MaybePromise = T | Promise; diff --git a/node_modules/react-router/dist/production/lib/types/internal.d.ts b/node_modules/react-router/dist/production/lib/types/internal.d.ts index 591efd7e..53109d37 100644 --- a/node_modules/react-router/dist/production/lib/types/internal.d.ts +++ b/node_modules/react-router/dist/production/lib/types/internal.d.ts @@ -1,5 +1,5 @@ -import { R as RouteModule, f as LinkDescriptor, L as Location, F as Func, g as Pretty, h as MetaDescriptor, G as GetLoaderData, i as ServerDataFunctionArgs, j as MiddlewareNextFunction, k as ClientDataFunctionArgs, D as DataStrategyResult, l as ServerDataFrom, N as Normalize, m as GetActionData } from '../../instrumentation-BlrVzjbg.js'; -import { R as RouteFiles, P as Pages } from '../../register-BGQUMCK4.js'; +import { R as RouteModule, f as LinkDescriptor, L as Location, F as Func, g as Pretty, h as MetaDescriptor, G as GetLoaderData, i as ServerDataFunctionArgs, j as MiddlewareNextFunction, k as ClientDataFunctionArgs, D as DataStrategyResult, l as ServerDataFrom, N as Normalize, m as GetActionData } from '../../instrumentation-BB0wRuqz.js'; +import { R as RouteFiles, P as Pages } from '../../register-ODDAAYlf.js'; import 'react'; type MaybePromise = T | Promise; diff --git a/node_modules/react-router/dist/production/lib/types/internal.js b/node_modules/react-router/dist/production/lib/types/internal.js index e58dd817..ec5848bc 100644 --- a/node_modules/react-router/dist/production/lib/types/internal.js +++ b/node_modules/react-router/dist/production/lib/types/internal.js @@ -1,5 +1,5 @@ "use strict";/** - * react-router v7.11.0 + * react-router v7.10.1 * * Copyright (c) Remix Software Inc. * diff --git a/node_modules/react-router/dist/production/lib/types/internal.mjs b/node_modules/react-router/dist/production/lib/types/internal.mjs index d31774a2..b077d3e3 100644 --- a/node_modules/react-router/dist/production/lib/types/internal.mjs +++ b/node_modules/react-router/dist/production/lib/types/internal.mjs @@ -1,5 +1,5 @@ /** - * react-router v7.11.0 + * react-router v7.10.1 * * Copyright (c) Remix Software Inc. * diff --git a/node_modules/react-router/package.json b/node_modules/react-router/package.json index 4c6802f2..070ae1be 100644 --- a/node_modules/react-router/package.json +++ b/node_modules/react-router/package.json @@ -1,6 +1,6 @@ { "name": "react-router", - "version": "7.11.0", + "version": "7.10.1", "description": "Declarative routing for React", "keywords": [ "react", @@ -107,7 +107,6 @@ "build": { "command": "premove dist && tsup && tsup --config tsup.config.rsc.ts", "files": [ - "../../pnpm-workspace.yaml", "lib/**", "*.ts", "tsconfig.json", @@ -129,11 +128,11 @@ "@types/set-cookie-parser": "^2.4.1", "jest-environment-jsdom": "^29.6.2", "premove": "^4.0.0", - "react": "^19.2.3", - "react-dom": "^19.2.3", + "react": "^19.1.0", + "react-dom": "^19.1.0", "react-test-renderer": "^19.1.0", "tsup": "^8.3.0", - "typescript": "^5.4.5", + "typescript": "^5.1.6", "undici": "^6.19.2", "wireit": "0.14.9" }, diff --git a/package-lock.json b/package-lock.json index 4500ca4d..4dfdd691 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,7 +29,8 @@ "react": "^19.2.0", "react-dom": "^19.2.0", "react-qr-code": "^2.0.18", - "react-router-dom": "^7.9.6", + "react-router": "7.10.1", + "react-router-dom": "7.10.1", "recharts": "^3.4.1", "three": "^0.181.2" }, @@ -3841,9 +3842,9 @@ } }, "node_modules/react-router": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.11.0.tgz", - "integrity": "sha512-uI4JkMmjbWCZc01WVP2cH7ZfSzH91JAZUDd7/nIprDgWxBV1TkkmLToFh7EbMTcMak8URFRa2YoBL/W8GWnCTQ==", + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.10.1.tgz", + "integrity": "sha512-gHL89dRa3kwlUYtRQ+m8NmxGI6CgqN+k4XyGjwcFoQwwCWF6xXpOCUlDovkXClS0d0XJN/5q7kc5W3kiFEd0Yw==", "license": "MIT", "dependencies": { "cookie": "^1.0.1", @@ -3863,12 +3864,12 @@ } }, "node_modules/react-router-dom": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.11.0.tgz", - "integrity": "sha512-e49Ir/kMGRzFOOrYQBdoitq3ULigw4lKbAyKusnvtDu2t4dBX4AGYPrzNvorXmVuOyeakai6FUPW5MmibvVG8g==", + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.10.1.tgz", + "integrity": "sha512-JNBANI6ChGVjA5bwsUIwJk7LHKmqB4JYnYfzFwyp2t12Izva11elds2jx7Yfoup2zssedntwU0oZ5DEmk5Sdaw==", "license": "MIT", "dependencies": { - "react-router": "7.11.0" + "react-router": "7.10.1" }, "engines": { "node": ">=20.0.0" diff --git a/package.json b/package.json index 624136b7..b4500730 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,8 @@ "react": "^19.2.0", "react-dom": "^19.2.0", "react-qr-code": "^2.0.18", - "react-router-dom": "^7.9.6", + "react-router": "7.10.1", + "react-router-dom": "7.10.1", "recharts": "^3.4.1", "three": "^0.181.2" }, From b76bf9881447b40f9a5002c97e83fb2a5cb93014 Mon Sep 17 00:00:00 2001 From: Kojib Date: Mon, 22 Dec 2025 21:18:35 -0500 Subject: [PATCH 08/10] v30.0.7 --- ...k-BauRu4tr.js => EternalKlock-CdflKbWu.js} | 2 +- dist/assets/EternalKlock-DzMJvrKv.js | 1 - dist/assets/EternalKlock-xlhlR_nN.js | 1 + ...0mRN.js => HomePriceChartCard-B_k89uIK.js} | 2 +- ...alms-BZxV3JLS.js => KaiRealms-DO28buUy.js} | 4 +- ...hApp-gp6G11ut.js => KaiVohApp-ShUUTiq2.js} | 2 +- ...al-_vPaKG1B.js => KaiVohModal-CRpJD1P8.js} | 4 +- ...{PShort-v0v0Lc11.js => PShort-C5MwlKSc.js} | 2 +- ...n7w_Hvo.js => SealMomentModal-C7mxkSGB.js} | 2 +- ...P6HWSa.js => SigilAuthContext-CIPXJp4C.js} | 2 +- ...0VeI7.js => SigilAuthProvider-ea2w3ibF.js} | 2 +- ...-BX8oOgFy.js => SigilExplorer-PXIdIaMp.js} | 2 +- ...-BH0djxz4.js => SigilFeedPage-C5nsUmbd.js} | 2 +- dist/assets/SigilModal-CEATeZhW.js | 1 - dist/assets/SigilModal-DLOp9UnU.js | 1 + ...dal-BVYbqxt6.js => SigilModal-Dm4zpSIO.js} | 2 +- ...Page-BGrlrrbK.js => SigilPage-CGk_cWZs.js} | 6 +- dist/assets/SigilStreamRoot-BAeCOlJX.js | 1 + dist/assets/SigilStreamRoot-CTqcQRVp.js | 1 - ...hYXsfvl.js => SigilStreamRoot-LmEGlu4-.js} | 2 +- ...-BP2mhmRz.js => VerifierFrame-a5dTHTgU.js} | 2 +- ...age-LdgLj3ti.js => VerifyPage-CexUA7n1.js} | 2 +- .../__vite-browser-external-CIGk_S08.js | 1 - .../__vite-browser-external-PL03eeJm.js | 1 + ...undler-BoMe-K_2.js => bundler-BiZDI_w8.js} | 2 +- dist/assets/html2canvas-B1Qzm3Gx.js | 1 + ...as-DKfOm221.js => html2canvas-D-AxDBo3.js} | 2 +- dist/assets/html2canvas-DNGmdnmT.js | 1 - dist/assets/index-BlYU7j-M.js | 668 ++++++++++++++++++ dist/assets/index-CgC-NZbJ.js | 668 ------------------ dist/assets/jszip.min-DJlOe6zd.js | 1 + dist/assets/jszip.min-o4TZRS-g.js | 1 - ...pes-CRrLra82.js => prop-types-BWhc8UTz.js} | 2 +- ...-D8l_pIbq.js => sigilRegistry-dB0OrrJi.js} | 2 +- ...ilUrl-C27mpWXE.js => sigilUrl-CgzM0oLT.js} | 2 +- ...ils-_6GyN6K2.js => sigilUtils-CHRgz00b.js} | 2 +- ...vgMeta-C7DBvyS6.js => svgMeta-BZGc61ho.js} | 2 +- ...vgMeta-iEfjcdB7.js => svgMeta-Bpz7076A.js} | 2 +- ...s-CiepkEei.js => useFastPress-MOMn9nZb.js} | 2 +- ...n.js => usernameClaimRegistry-B6UXZAUR.js} | 2 +- dist/assets/{x-n_FrfVOz.js => x-CaPcBV4E.js} | 2 +- dist/index.html | 2 +- 42 files changed, 706 insertions(+), 706 deletions(-) rename dist/assets/{EternalKlock-BauRu4tr.js => EternalKlock-CdflKbWu.js} (99%) delete mode 100644 dist/assets/EternalKlock-DzMJvrKv.js create mode 100644 dist/assets/EternalKlock-xlhlR_nN.js rename dist/assets/{HomePriceChartCard-CrIv0mRN.js => HomePriceChartCard-B_k89uIK.js} (99%) rename dist/assets/{KaiRealms-BZxV3JLS.js => KaiRealms-DO28buUy.js} (99%) rename dist/assets/{KaiVohApp-gp6G11ut.js => KaiVohApp-ShUUTiq2.js} (99%) rename dist/assets/{KaiVohModal-_vPaKG1B.js => KaiVohModal-CRpJD1P8.js} (91%) rename dist/assets/{PShort-v0v0Lc11.js => PShort-C5MwlKSc.js} (94%) rename dist/assets/{SealMomentModal-Bn7w_Hvo.js => SealMomentModal-C7mxkSGB.js} (99%) rename dist/assets/{SigilAuthContext-CmP6HWSa.js => SigilAuthContext-CIPXJp4C.js} (73%) rename dist/assets/{SigilAuthProvider-EaP0VeI7.js => SigilAuthProvider-ea2w3ibF.js} (91%) rename dist/assets/{SigilExplorer-BX8oOgFy.js => SigilExplorer-PXIdIaMp.js} (99%) rename dist/assets/{SigilFeedPage-BH0djxz4.js => SigilFeedPage-C5nsUmbd.js} (93%) delete mode 100644 dist/assets/SigilModal-CEATeZhW.js create mode 100644 dist/assets/SigilModal-DLOp9UnU.js rename dist/assets/{SigilModal-BVYbqxt6.js => SigilModal-Dm4zpSIO.js} (99%) rename dist/assets/{SigilPage-BGrlrrbK.js => SigilPage-CGk_cWZs.js} (99%) create mode 100644 dist/assets/SigilStreamRoot-BAeCOlJX.js delete mode 100644 dist/assets/SigilStreamRoot-CTqcQRVp.js rename dist/assets/{SigilStreamRoot-DhYXsfvl.js => SigilStreamRoot-LmEGlu4-.js} (99%) rename dist/assets/{VerifierFrame-BP2mhmRz.js => VerifierFrame-a5dTHTgU.js} (99%) rename dist/assets/{VerifyPage-LdgLj3ti.js => VerifyPage-CexUA7n1.js} (97%) delete mode 100644 dist/assets/__vite-browser-external-CIGk_S08.js create mode 100644 dist/assets/__vite-browser-external-PL03eeJm.js rename dist/assets/{bundler-BoMe-K_2.js => bundler-BiZDI_w8.js} (99%) create mode 100644 dist/assets/html2canvas-B1Qzm3Gx.js rename dist/assets/{html2canvas-DKfOm221.js => html2canvas-D-AxDBo3.js} (99%) delete mode 100644 dist/assets/html2canvas-DNGmdnmT.js create mode 100644 dist/assets/index-BlYU7j-M.js delete mode 100644 dist/assets/index-CgC-NZbJ.js create mode 100644 dist/assets/jszip.min-DJlOe6zd.js delete mode 100644 dist/assets/jszip.min-o4TZRS-g.js rename dist/assets/{prop-types-CRrLra82.js => prop-types-BWhc8UTz.js} (92%) rename dist/assets/{sigilRegistry-D8l_pIbq.js => sigilRegistry-dB0OrrJi.js} (99%) rename dist/assets/{sigilUrl-C27mpWXE.js => sigilUrl-CgzM0oLT.js} (75%) rename dist/assets/{sigilUtils-_6GyN6K2.js => sigilUtils-CHRgz00b.js} (89%) rename dist/assets/{svgMeta-C7DBvyS6.js => svgMeta-BZGc61ho.js} (79%) rename dist/assets/{svgMeta-iEfjcdB7.js => svgMeta-Bpz7076A.js} (98%) rename dist/assets/{useFastPress-CiepkEei.js => useFastPress-MOMn9nZb.js} (80%) rename dist/assets/{usernameClaimRegistry-DYzaEFWn.js => usernameClaimRegistry-B6UXZAUR.js} (98%) rename dist/assets/{x-n_FrfVOz.js => x-CaPcBV4E.js} (55%) diff --git a/dist/assets/EternalKlock-BauRu4tr.js b/dist/assets/EternalKlock-CdflKbWu.js similarity index 99% rename from dist/assets/EternalKlock-BauRu4tr.js rename to dist/assets/EternalKlock-CdflKbWu.js index c269ea13..8ef25c9f 100644 --- a/dist/assets/EternalKlock-BauRu4tr.js +++ b/dist/assets/EternalKlock-CdflKbWu.js @@ -1,4 +1,4 @@ -import{C as e,Dn as t,On as n,Tn as r,_ as i,a,an as o,c as s,g as c,h as l,i as u,jn as d,kn as f,l as p,ln as m,mn as h,o as g,p as _,pn as v,tn as y,u as b,v as x,w as S,wn as C,x as w,y as T}from"./index-CgC-NZbJ.js";import{t as E}from"./SigilModal-BVYbqxt6.js";const D=17491.270421,O=[`Ignition Ark`,`Integration Ark`,`Harmonization Ark`,`Reflektion Ark`,`Purifikation Ark`,`Dream Ark`],k={"Ignition Ark":`#ff1559`,"Integration Ark":`#ff6d00`,"Harmonization Ark":`#ffd900`,"Reflektion Ark":`#00ff66`,"Purifikation Ark":`#05e6ff`,"Dream Ark":`#c300ff`},A={"Ignition Ark":`Ignite`,"Integration Ark":`Integrate`,"Harmonization Ark":`Harmony`,"Reflektion Ark":`Reflekt`,"Purifikation Ark":`Purify`,"Dream Ark":`Dream`},j=D/36,ee=j/44,te=3+Math.sqrt(5);Math.round(te*1e3),1/te;var M=d(r(),1),N=d(y(),1),P=120,F=P/2,I=22,L=4.5,ne=2,R=F-.5,re=F-ne,z=36,B=-3,V=3,ie=re-2,ae=(I+L+R)/2-4,oe=e=>e*Math.PI/180,se=e=>e.toLowerCase().replace(/\s+/g,`-`);function ce(e,t,n){let r=parseInt(e.slice(1),16),i=parseInt(t.slice(1),16),a=r>>16,o=r>>8&255,s=r&255,c=i>>16,l=i>>8&255,u=i&255;return`rgb(${Math.round(a+(c-a)*n)},${Math.round(o+(l-o)*n)},${Math.round(s+(u-s)*n)})`}var le=(e,t,n)=>Math.max(t,Math.min(n,e)),H=e=>{if(!e)return;let t=e.match(/(\d{2})$/);if(!t)return;let n=parseInt(t[1],10);if(Number.isFinite(n))return le(n,0,43)},U=({hue:e,pulse:t,kaiPulseEternal:n,harmonicDayPercent:r,microCyclePercent:i,dayLabel:a,monthLabel:o,monthDay:s,glowPulse:c=!0,pulseIntervalSec:l=te,rimFlash:u=!1,rotationOverride:d,solarSpiralStepString:f,solarSpiralStep:p,eternalBeatIndex:m,eternalStepIndex:h})=>{(0,M.useEffect)(()=>{typeof document<`u`&&document.documentElement.style.setProperty(`--cycle`,`${l}s`)},[l]);let g=`${l}s`,_=(n%D+D)%D,v=Number.isFinite(t)?t:_,y=v/D,b=Number.isFinite(r)?r:y*100,x=(v-Math.floor(v/j)*j)%ee/ee,S=Number.isFinite(i)?i:x*100,C=(v%D+D)%D,w=C/D,T=Math.floor(w*36)%36,E=(T+.5)/36*360,ne=typeof d==`number`?d:E,U=360/O.length,W=Math.floor(ne/U)%O.length,ue=(W+1)%O.length,de=(ne-W*U+360)%360,fe=Math.min(1,de/U),pe=k[O[W]],me=k[O[ue]],he=ce(pe,me,fe),ge=2*Math.PI*re,_e=ge*(1-b/100),ve=-(S/100)*l,ye=v,be=[`Aethon`,`Virelai`,`Solari`,`Amarin`,`Kaelus`,`Umbriel`,`Noctura`,`Liora`].indexOf(o)+1,xe=be>0?be:1,Se=F-14,Ce=F,we=F+14,Te=F+28,Ee=Math.floor(_/j)%36,De=Number.isFinite(m)?le(m,0,35):Ee,Oe=_-De*j,ke=Oe/j,Ae=Math.floor(Oe/ee)%44,je=Number.isFinite(h)?le(h,0,43):Ae,Me=je.toString().padStart(2,`0`),Ne=(De+.5)/36*360,Pe=`hsl(${T/36*360}, 100%, 50%)`,Fe=`#ebfdff`,Ie=1.6,Le=R-(I+L)+.5,Re=F-(I+L),ze=Le*ke,Be=Re-ze,Ve=.82,He=F-(I+L)-Le*Ve,Ue=F,We=He+6,Ge=(0,M.useId)().replace(/[^a-zA-Z0-9_-]/g,``)||`klock`,Ke=Me,qe=De.toString().padStart(2,`0`),Je=Math.floor(_),Ye=Oe-je*ee,Xe=Math.max(0,Math.min(1,Ye/ee))*100,Ze=`#00faff`,Qe=`#ff6d00`,$e=((C-T*j)%j+j)%j,et=Math.floor($e/ee)%44,tt=Number.isFinite(p?.stepIndex)?le(p.stepIndex,0,43):void 0,nt=H(f),rt=(tt??nt??et).toString().padStart(2,`0`),it=F-(I+L)-Le*Ve,at=F;return(0,N.jsx)(`div`,{className:`kai-klock-shell`,style:{"--hue":e,"--arc":pe,"--cycle":g,width:`100%`,aspectRatio:`1 / 1`,overflow:`hidden`},children:(0,N.jsxs)(`svg`,{className:`kai-svg`,viewBox:`0 0 ${P} ${P}`,width:`100%`,height:`100%`,preserveAspectRatio:`xMidYMid meet`,role:`img`,children:[(0,N.jsx)(`circle`,{cx:F,cy:F,r:R,className:`rim-ring ${u?`rim-flash`:``}`}),(0,N.jsx)(`circle`,{cx:F,cy:F,r:re,className:`day-progress`,strokeDasharray:ge,strokeDashoffset:_e}),Array.from({length:36}).map((e,t)=>{let n=oe(t*(360/z)-90),r=(t+B+z)%z/z;return(0,N.jsx)(`text`,{x:F+ie*Math.cos(n),y:F+ie*Math.sin(n)+V/2,className:`beat-number`,textAnchor:`middle`,fontSize:V,style:{fill:`hsl(${r*360},100%,50%)`},children:t},t)}),(0,N.jsx)(`circle`,{cx:F,cy:F,r:I+L,className:`inner-halo`}),(0,N.jsx)(`g`,{className:`orb-spin`,style:{animationDelay:`${ve}s`},children:(0,N.jsx)(`circle`,{cx:F,cy:F-(I+L),r:3.6,className:`micro-orb orb-glow`})}),(0,N.jsxs)(`g`,{style:{transform:`rotate(${ne}deg)`,transformOrigin:`${F}px ${F}px`,transition:`transform 1s ease-out`},children:[(0,N.jsx)(`rect`,{x:F-1,y:F-(I+L)-(R-(I+L)),width:2,height:R-(I+L),rx:1,className:`needle`,style:{fill:he}}),(0,N.jsxs)(`g`,{className:`solar-hand-label-wrap`,style:{transform:`rotate(${-ne}deg)`,transformOrigin:`${at}px ${it}px`},children:[(0,N.jsx)(`text`,{x:at,y:it-3.6,textAnchor:`middle`,dominantBaseline:`central`,fontSize:3,fontWeight:900,style:{fill:Qe,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.65)`,strokeWidth:.8,filter:`drop-shadow(0 0 2px ${Qe})`},children:`☀`}),(0,N.jsx)(`text`,{x:at-2.2,y:it,textAnchor:`middle`,dominantBaseline:`central`,className:`solar-hand-label-digit`,fontSize:4.4,fontWeight:900,style:{fill:Qe,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.65)`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px ${Qe}) drop-shadow(0 0 5px ${Qe})`},children:rt[0]}),(0,N.jsx)(`text`,{x:at+2.2,y:it,textAnchor:`middle`,dominantBaseline:`central`,className:`solar-hand-label-digit`,fontSize:4.4,fontWeight:900,style:{fill:Qe,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.65)`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px ${Qe}) drop-shadow(0 0 5px ${Qe})`},children:rt[1]})]})]}),(0,N.jsxs)(`g`,{className:`eternal-hand-group`,style:{transform:`rotate(${Ne}deg)`,transformOrigin:`${F}px ${F}px`,transition:`transform 0.6s cubic-bezier(.22,.61,.36,1)`},children:[(0,N.jsx)(`rect`,{x:F-Ie/2,y:F-(I+L)-Le,width:Ie,height:Le,rx:Ie/1.5,className:`eternal-hand`,style:{fill:`transparent`,stroke:`#bff7ff`,strokeWidth:.7,filter:`drop-shadow(0 0 2px #eaffff) drop-shadow(0 0 6px #d9fbff)`,mixBlendMode:`screen`}}),(0,N.jsx)(`defs`,{children:(0,N.jsxs)(`linearGradient`,{id:`eternalFill-${Ge}`,x1:`0`,y1:`1`,x2:`0`,y2:`0`,children:[(0,N.jsx)(`stop`,{offset:`0%`,stopColor:Fe,stopOpacity:.15}),(0,N.jsx)(`stop`,{offset:`100%`,stopColor:Fe,stopOpacity:.95})]})}),(0,N.jsx)(`rect`,{x:F-Ie/2,y:Be,width:Ie,height:Math.max(0,ze),rx:Ie/2,className:`eternal-hand-fill`,style:{fill:`url(#eternalFill-${Ge})`,filter:`drop-shadow(0 0 3px #eaffff) drop-shadow(0 0 6px #eaffff)`,mixBlendMode:`screen`}}),(0,N.jsx)(`circle`,{cx:F,cy:F-(I+L)-Le-.8,r:1.35,className:`eternal-hand-tip`,style:{fill:`#ffffff`,filter:`drop-shadow(0 0 4px #eaffff) drop-shadow(0 0 8px #eaffff)`,mixBlendMode:`screen`}}),(0,N.jsxs)(`g`,{className:`eternal-hand-label-wrap`,style:{transform:`rotate(${-Ne}deg)`,transformOrigin:`${Ue}px ${He}px`},children:[(0,N.jsx)(`text`,{x:Ue-2.2,y:He,textAnchor:`middle`,dominantBaseline:`central`,className:`eternal-hand-label-digit`,fontSize:4.4,fontWeight:900,style:{fill:`#e8feff`,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.45)`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px #eaffff) drop-shadow(0 0 5px #c8fbff)`},children:Me[0]}),(0,N.jsx)(`text`,{x:Ue+2.2,y:He,textAnchor:`middle`,dominantBaseline:`central`,className:`eternal-hand-label-digit`,fontSize:4.4,fontWeight:900,style:{fill:`#e8feff`,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.45)`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px #eaffff) drop-shadow(0 0 5px #c8fbff)`},children:Me[1]})]}),(0,N.jsx)(`g`,{transform:`rotate(${-Ne} ${Ue} ${We})`,children:(0,N.jsx)(`text`,{x:Ue,y:We,textAnchor:`middle`,dominantBaseline:`central`,className:`eternal-hand-percent`,fontSize:3.2,fontWeight:800,style:{fill:`#dafeff`,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.4)`,strokeWidth:.7,letterSpacing:`0.25px`,filter:`drop-shadow(0 0 2px #eaffff)`}})})]}),(0,N.jsx)(`text`,{x:F,y:F-15,className:`center-sub`,textAnchor:`middle`,fontSize:6,fontWeight:800,style:{fill:Ze,paintOrder:`stroke`,stroke:`#000`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px ${Ze}) drop-shadow(0 0 6px ${Ze})`},children:Je}),(0,N.jsxs)(`text`,{x:F,y:F-3,className:`center-pulse ${c?`pulse-flash`:``}`,textAnchor:`middle`,children:[qe,`:`,Ke]},`et-${ye}`),(0,N.jsx)(`text`,{x:F,y:F+8,className:`center-day day-${se(a)}`,textAnchor:`middle`,children:a}),(0,N.jsx)(`text`,{x:F,y:F+18,className:`center-month month-${se(o)}`,textAnchor:`middle`,children:o}),(0,N.jsx)(`text`,{x:F,y:Te+8,className:`eternal-pulse`,textAnchor:`middle`,children:n}),(0,N.jsx)(`text`,{x:Se,y:Te,className:`step-percent`,textAnchor:`middle`,fontSize:5.5,fill:Pe,fontWeight:800,style:{filter:`drop-shadow(0 0 2px ${Pe}) drop-shadow(0 0 5px #00faff)`,letterSpacing:`0.25px`},children:`${Xe.toFixed(1)}%`}),(0,N.jsx)(`text`,{x:Ce,y:Te,className:`day-of-month day-${se(a)}`,textAnchor:`middle`,children:s}),(0,N.jsx)(`text`,{x:we,y:Te,className:`day-of-month month-${se(o)}`,textAnchor:`middle`,children:xe}),O.map((e,t)=>{let n=oe(t*(360/O.length)-90),r=F+ae*Math.cos(n),i=F+ae*Math.sin(n)+(t===3?7:3);return(0,N.jsxs)(M.Fragment,{children:[(0,N.jsx)(`text`,{x:r,y:i,className:`arc-label arc-${se(e.split(` `)[0])} ${t===W?`active`:``}`,textAnchor:`middle`,children:A[e]}),e===`Ignition Ark`&&f&&(0,N.jsx)(`text`,{x:r,y:i+8,textAnchor:`middle`,dominantBaseline:`hanging`,fontSize:10,fill:`#00faff`,fontWeight:900,style:{filter:`drop-shadow(0 0 2px #00faff) drop-shadow(0 0 4px #00faff) drop-shadow(0 0 8px #00faff)`,paintOrder:`stroke`,stroke:`#000`,strokeWidth:1,vectorEffect:`non-scaling-stroke`,letterSpacing:`0.5px`},children:f})]},e)})]})})},W=Date.UTC(2024,4,10,6,45,41,888),ue=3+Math.sqrt(5),de=ue*1e3,fe=1000000n,pe=17491270421n,me=11000000n,he=(pe+18n)/36n,ge=[`Solhara`,`Aquaris`,`Flamora`,`Verdari`,`Sonari`,`Kaelith`],_e={Solhara:`Root`,Aquaris:`Sacral`,Flamora:`Solar Plexus`,Verdari:`Heart`,Sonari:`Throat`,Kaelith:`Crown`},ve=(e,t)=>(e%t+t)%t;function ye(e,t){let n=e/t,r=e%t;return r!==0n&&r>0n!=t>0n?n-1n:n}function be(e){if(!Number.isFinite(e))return 0n;let t=e<0?-1:1,n=Math.abs(e),r=Math.trunc(n),i=n-r;return i<.5?BigInt(t*r):i>.5?BigInt(t*(r+1)):BigInt(t*(r%2==0?r:r+1))}function xe(e){return be((e.getTime()-W)/1e3/ue*1e6)}function Se(e){let t=xe(e),n=ve(t,pe),r=ye(t,pe),i=Number(ye(n,he)),a=n-BigInt(i)*he,o=a-a/me*me,s=Number(o)/Number(me);return{pulse:Number(ye(t,fe)),beat:i,stepPct:s,chakraDay:_e[ge[Number(ve(r,6n))]]}}var Ce=()=>performance.timeOrigin+performance.now(),we=e=>{let t=e-W;return W+Math.ceil(t/de)*de},Te=()=>{let[e,t]=(0,M.useState)(0),[n,r]=(0,M.useState)(0),[i,a]=(0,M.useState)(0),[o,s]=(0,M.useState)(`Root`),[c,l]=(0,M.useState)(!1),[u]=(0,M.useState)(()=>`btn-${Math.random().toString(36).slice(2)}`),d=c?`sigil-open`:`sigil-closed`,f=(0,M.useRef)(null),p=(0,M.useRef)(null),m=(0,M.useRef)(0),h=(0,M.useCallback)(()=>{let{pulse:e,beat:n,stepPct:i,chakraDay:o}=Se(new Date);t(e),r(n),a(i),s(o)},[]),g=()=>{p.current!==null&&(clearTimeout(p.current),p.current=null)},_=(0,M.useCallback)(()=>{g();let e=Ce();m.current=we(e);let t=()=>{let e=Ce(),n=Math.floor((e-m.current)/de),r=Math.max(0,n)+1;for(let e=0;e(h(),_(),()=>g()),[h,_]),(0,M.useEffect)(()=>{let e=()=>{document.visibilityState===`visible`&&_()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[_]),(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`button`,{className:`sigil-button`,title:`View & save this sigil`,onClick:()=>l(!0),"data-chakra":o,"aria-label":`Open Kairos Sigil`,children:(0,N.jsxs)(`span`,{className:`sigil-thumb`,"aria-hidden":`true`,inert:!0,children:[(0,N.jsx)(S,{ref:f,pulse:e,beat:n,stepPct:i,chakraDay:o,size:40,hashMode:`deterministic`,origin:u,onReady:n=>{n&&typeof n.pulse==`number`&&n.pulse!==e&&t(n.pulse)}},d),(0,N.jsx)(`span`,{className:`sigil-shield`,"aria-hidden":`true`})]})}),c&&(0,N.jsx)(E,{initialPulse:e,onClose:()=>l(!1)})]})},Ee=(0,M.createContext)({});function De(e){let t=(0,M.useRef)(null);return t.current===null&&(t.current=e()),t.current}var Oe=typeof window<`u`,ke=Oe?M.useLayoutEffect:M.useEffect,Ae=(0,M.createContext)(null);function je(e,t){e.indexOf(t)===-1&&e.push(t)}function Me(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var Ne=(e,t,n)=>n>t?t:n/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Ie(e){return typeof e==`object`&&!!e}var Le=e=>/^0[^.\s]+$/u.test(e);function Re(e){let t;return()=>(t===void 0&&(t=e()),t)}var ze=e=>e,Be=(e,t)=>n=>t(e(n)),Ve=(...e)=>e.reduce(Be),He=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},Ue=class{constructor(){this.subscriptions=[]}add(e){return je(this.subscriptions,e),()=>Me(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;ie*1e3,Ge=e=>e/1e3;function Ke(e,t){return t?e*(1e3/t):0}var qe=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Je=1e-7,Ye=12;function Xe(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=qe(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>Je&&++sXe(t,0,1,e,n);return e=>e===0||e===1?e:qe(i(e),t,r)}var Qe=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,$e=e=>t=>1-e(1-t),et=Ze(.33,1.53,.69,.99),tt=$e(et),nt=Qe(tt),rt=e=>(e*=2)<1?.5*tt(e):.5*(2-2**(-10*(e-1))),it=e=>1-Math.sin(Math.acos(e)),at=$e(it),ot=Qe(it),st=Ze(.42,0,1,1),ct=Ze(0,0,.58,1),lt=Ze(.42,0,.58,1),ut=e=>Array.isArray(e)&&typeof e[0]!=`number`,dt=e=>Array.isArray(e)&&typeof e[0]==`number`,ft={linear:ze,easeIn:st,easeInOut:lt,easeOut:ct,circIn:it,circInOut:ot,circOut:at,backIn:tt,backInOut:nt,backOut:et,anticipate:rt},pt=e=>typeof e==`string`,mt=e=>{if(dt(e)){e.length;let[t,n,r,i]=e;return Ze(t,n,r,i)}else if(pt(e))return ft[e],`${e}`,ft[e];return e},ht=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],gt={value:null,addProjectionMetrics:null};function _t(e,t){let n=new Set,r=new Set,i=!1,a=!1,o=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1},c=0;function l(t){o.has(t)&&(u.schedule(t),e()),c++,t(s)}let u={schedule:(e,t=!1,a=!1)=>{let s=a&&i?n:r;return t&&o.add(e),s.has(e)||s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(s=e,i){a=!0;return}i=!0,[n,r]=[r,n],n.forEach(l),t&>.value&>.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var vt=40;function yt(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=ht.reduce((e,n)=>(e[n]=_t(a,t?n:void 0),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=Pe.useManualTiming?i.timestamp:performance.now();n=!1,Pe.useManualTiming||(i.delta=r?1e3/60:Math.max(Math.min(a-i.timestamp,vt),1)),i.timestamp=a,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:ht.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t(St===void 0&&wt.set(K.isProcessing||Pe.useManualTiming?K.timestamp:performance.now()),St),set:e=>{St=e,queueMicrotask(Ct)}},Tt={layout:0,mainThread:0,waapi:0},Et=e=>t=>typeof t==`string`&&t.startsWith(e),Dt=Et(`--`),Ot=Et(`var(--`),kt=e=>Ot(e)?At.test(e.split(`/*`)[0].trim()):!1,At=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,jt={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},Mt={...jt,transform:e=>Ne(0,1,e)},Nt={...jt,default:1},Pt=e=>Math.round(e*1e5)/1e5,Ft=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function It(e){return e==null}var Lt=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Rt=(e,t)=>n=>!!(typeof n==`string`&&Lt.test(n)&&n.startsWith(e)||t&&!It(n)&&Object.prototype.hasOwnProperty.call(n,t)),zt=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(Ft);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},Bt=e=>Ne(0,255,e),Vt={...jt,transform:e=>Math.round(Bt(e))},Ht={test:Rt(`rgb`,`red`),parse:zt(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+Vt.transform(e)+`, `+Vt.transform(t)+`, `+Vt.transform(n)+`, `+Pt(Mt.transform(r))+`)`};function Ut(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var Wt={test:Rt(`#`),parse:Ut,transform:Ht.transform},Gt=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Kt=Gt(`deg`),qt=Gt(`%`),q=Gt(`px`),Jt=Gt(`vh`),Yt=Gt(`vw`),Xt=(()=>({...qt,parse:e=>qt.parse(e)/100,transform:e=>qt.transform(e*100)}))(),Zt={test:Rt(`hsl`,`hue`),parse:zt(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+qt.transform(Pt(t))+`, `+qt.transform(Pt(n))+`, `+Pt(Mt.transform(r))+`)`},J={test:e=>Ht.test(e)||Wt.test(e)||Zt.test(e),parse:e=>Ht.test(e)?Ht.parse(e):Zt.test(e)?Zt.parse(e):Wt.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?Ht.transform(e):Zt.transform(e),getAnimatableNone:e=>{let t=J.parse(e);return t.alpha=0,J.transform(t)}},Qt=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function $t(e){return isNaN(e)&&typeof e==`string`&&(e.match(Ft)?.length||0)+(e.match(Qt)?.length||0)>0}var en=`number`,tn=`color`,nn=`var`,rn=`var(`,an="${}",on=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function sn(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(on,e=>(J.test(e)?(r.color.push(a),i.push(tn),n.push(J.parse(e))):e.startsWith(rn)?(r.var.push(a),i.push(nn),n.push(e)):(r.number.push(a),i.push(en),n.push(parseFloat(e))),++a,an)).split(an),indexes:r,types:i}}function cn(e){return sn(e).values}function ln(e){let{split:t,types:n}=sn(e),r=t.length;return e=>{let i=``;for(let a=0;atypeof e==`number`?0:J.test(e)?J.getAnimatableNone(e):e;function dn(e){let t=cn(e);return ln(e)(t.map(un))}var fn={test:$t,parse:cn,createTransformer:ln,getAnimatableNone:dn};function pn(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function mn({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=pn(s,r,e+1/3),a=pn(s,r,e),o=pn(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function hn(e,t){return n=>n>0?t:e}var Y=(e,t,n)=>e+(t-e)*n,gn=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},_n=[Wt,Ht,Zt],vn=e=>_n.find(t=>t.test(e));function yn(e){let t=vn(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===Zt&&(n=mn(n)),n}var bn=(e,t)=>{let n=yn(e),r=yn(t);if(!n||!r)return hn(e,t);let i={...n};return e=>(i.red=gn(n.red,r.red,e),i.green=gn(n.green,r.green,e),i.blue=gn(n.blue,r.blue,e),i.alpha=Y(n.alpha,r.alpha,e),Ht.transform(i))},xn=new Set([`none`,`hidden`]);function Sn(e,t){return xn.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Cn(e,t){return n=>Y(e,t,n)}function wn(e){return typeof e==`number`?Cn:typeof e==`string`?kt(e)?hn:J.test(e)?bn:On:Array.isArray(e)?Tn:typeof e==`object`?J.test(e)?bn:En:hn}function Tn(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>wn(e)(e,t[n]));return e=>{for(let t=0;t{for(let t in r)n[t]=r[t](e);return n}}function Dn(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i{let n=fn.createTransformer(t),r=sn(e),i=sn(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?xn.has(e)&&!i.values.length||xn.has(t)&&!r.values.length?Sn(e,t):Ve(Tn(Dn(r,i),i.values),n):(`${e}${t}`,hn(e,t))};function kn(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?Y(e,t,n):wn(e)(e,t)}var An=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>G.update(t,e),stop:()=>bt(t),now:()=>K.isProcessing?K.timestamp:wt.now()}},jn=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t=2e4?1/0:t}function Pn(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(Nn(r),Mn);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:Ge(i)}}var Fn=5;function In(e,t,n){let r=Math.max(t-Fn,0);return Ke(n-e(r),t-r)}var X={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Ln=.001;function Rn({duration:e=X.duration,bounce:t=X.bounce,velocity:n=X.velocity,mass:r=X.mass}){let i,a;X.maxDuration;let o=1-t;o=Ne(X.minDamping,X.maxDamping,o),e=Ne(X.minDuration,X.maxDuration,Ge(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=Vn(t,o),c=Math.exp(-i);return Ln-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=Vn(t**2,o);return(-i(t)+Ln>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-Ln+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=Bn(i,a,s);if(e=We(e),isNaN(c))return{stiffness:X.stiffness,damping:X.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var zn=12;function Bn(e,t,n){let r=n;for(let n=1;ne[t]!==void 0)}function Gn(e){let t={velocity:X.velocity,stiffness:X.stiffness,damping:X.damping,mass:X.mass,isResolvedFromDuration:!1,...e};if(!Wn(e,Un)&&Wn(e,Hn))if(e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*Ne(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:X.mass,stiffness:i,damping:a}}else{let n=Rn(e);t={...t,...n,mass:X.mass},t.isResolvedFromDuration=!0}return t}function Kn(e=X.visualDuration,t=X.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=Gn({...n,velocity:-Ge(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=Ge(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?X.restSpeed.granular:X.restSpeed.default,i||=v?X.restDelta.granular:X.restDelta.default;let y;if(h<1){let e=Vn(_,h);y=t=>o-Math.exp(-h*_*t)*((m+h*_*g)/e*Math.sin(e*t)+g*Math.cos(e*t))}else if(h===1)y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e}}let b={calculatedDuration:p&&d||null,next:e=>{let t=y(e);if(p)s.done=e>=d;else{let n=e===0?m:0;h<1&&(n=e===0?We(m):In(y,e,t));let a=Math.abs(n)<=r,c=Math.abs(o-t)<=i;s.done=a&&c}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(Nn(b),Mn),t=jn(t=>b.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return b}Kn.applyToOptions=e=>{let t=Pn(e,100,Kn);return e.ease=t.ease,e.duration=We(t.duration),e.type=`keyframes`,e};function qn({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&ec,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=Kn({keyframes:[f.value,m(f.value)],velocity:In(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function Jn(e,t,n){let r=[],i=n||Pe.mix||kn,a=e.length-1;for(let n=0;nt[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=Jn(t,r,i),c=s.length,l=n=>{if(o&&n1)for(;rl(Ne(e[0],e[a-1],t)):l}function Xn(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=He(0,t,r);e.push(Y(n,1,i))}}function Zn(e){let t=[0];return Xn(t,e.length-1),t}function Qn(e,t){return e.map(e=>e*t)}function $n(e,t){return e.map(()=>t||lt).splice(0,e.length-1)}function er({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=ut(r)?r.map(mt):mt(r),a={done:!1,value:t[0]},o=Yn(Qn(n&&n.length===t.length?n:Zn(t),e),t,{ease:Array.isArray(i)?i:$n(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var tr=e=>e!==null;function nr(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(tr),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var rr={decay:qn,inertia:qn,tween:er,keyframes:er,spring:Kn};function ir(e){typeof e.type==`string`&&(e.type=rr[e.type])}var ar=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},or=e=>e/100,sr=class extends ar{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==wt.now()&&this.tick(wt.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},Tt.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;ir(e);let{type:t=er,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||er;s!==er&&typeof o[0]!=`number`&&(this.mixKeyframes=Ve(or,kn(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=Nn(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=Ne(0,1,n)*o}let b=_?{done:!1,value:l[0]}:y.next(v);i&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==qn&&(b.value=nr(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return Ge(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Ge(e)}get time(){return Ge(this.currentTime)}set time(e){e=We(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(wt.now());let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=Ge(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=An,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(wt.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null,Tt.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function cr(e){for(let t=1;te*180/Math.PI,ur=e=>fr(lr(Math.atan2(e[1],e[0]))),dr={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:ur,rotateZ:ur,skewX:e=>lr(Math.atan(e[1])),skewY:e=>lr(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},fr=e=>(e%=360,e<0&&(e+=360),e),pr=ur,mr=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),hr=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),gr={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:mr,scaleY:hr,scale:e=>(mr(e)+hr(e))/2,rotateX:e=>fr(lr(Math.atan2(e[6],e[5]))),rotateY:e=>fr(lr(Math.atan2(-e[2],e[0]))),rotateZ:pr,rotate:pr,skewX:e=>lr(Math.atan(e[4])),skewY:e=>lr(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function _r(e){return e.includes(`scale`)?1:0}function vr(e,t){if(!e||e===`none`)return _r(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=gr,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=dr,i=t}if(!i)return _r(t);let a=r[t],o=i[1].split(`,`).map(br);return typeof a==`function`?a(o):o[a]}var yr=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return vr(n,t)};function br(e){return parseFloat(e.trim())}var xr=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],Sr=(()=>new Set(xr))(),Cr=e=>e===jt||e===q,wr=new Set([`x`,`y`,`z`]),Tr=xr.filter(e=>!wr.has(e));function Er(e){let t=[];return Tr.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith(`scale`)?1:0))}),t}var Dr={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>vr(t,`x`),y:(e,{transform:t})=>vr(t,`y`)};Dr.translateX=Dr.x,Dr.translateY=Dr.y;var Or=new Set,kr=!1,Ar=!1,jr=!1;function Mr(){if(Ar){let e=Array.from(Or).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=Er(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}Ar=!1,kr=!1,Or.forEach(e=>e.complete(jr)),Or.clear()}function Nr(){Or.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Ar=!0)})}function Pr(){jr=!0,Nr(),Mr(),jr=!1}var Fr=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(Or.add(this),kr||(kr=!0,G.read(Nr),G.resolveKeyframes(Mr))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}cr(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Or.delete(this)}cancel(){this.state===`scheduled`&&(Or.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},Ir=e=>e.startsWith(`--`);function Lr(e,t,n){Ir(t)?e.style.setProperty(t,n):e.style[t]=n}var Rr=Re(()=>window.ScrollTimeline!==void 0),zr={};function Br(e,t){let n=Re(e);return()=>zr[t]??n()}var Vr=Br(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),Hr=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Ur={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:Hr([0,.65,.55,1]),circOut:Hr([.55,0,1,.45]),backIn:Hr([.31,.01,.66,-.59]),backOut:Hr([.33,1.53,.69,.99])};function Wr(e,t){if(e)return typeof e==`function`?Vr()?jn(e,t):`ease-out`:dt(e)?Hr(e):Array.isArray(e)?e.map(e=>Wr(e,t)||Ur.easeOut):Ur[e]}function Gr(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=Wr(s,i);Array.isArray(d)&&(u.easing=d),gt.value&&Tt.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return gt.value&&p.finished.finally(()=>{Tt.waapi--}),p}function Kr(e){return typeof e==`function`&&`applyToOptions`in e}function qr({type:e,...t}){return Kr(e)&&Vr()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var Jr=class extends ar{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=qr(e);this.animation=Gr(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=nr(r,this.options,o,this.speed);this.updateMotionValue?this.updateMotionValue(e):Lr(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return Ge(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Ge(e)}get time(){return Ge(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=We(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&Rr()?(this.animation.timeline=e,ze):t(this)}},Yr={anticipate:rt,backInOut:nt,circInOut:ot};function Xr(e){return e in Yr}function Zr(e){typeof e.ease==`string`&&Xr(e.ease)&&(e.ease=Yr[e.ease])}var Qr=10,$r=class extends Jr{constructor(e){Zr(e),ir(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new sr({...a,autoplay:!1}),s=We(this.finishedTime??this.time);t.setWithVelocity(o.sample(s-Qr).value,o.sample(s).value,Qr),o.stop()}},ei=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(fn.test(e)||e===`0`)&&!e.startsWith(`url(`));function ti(e){let t=e[0];if(e.length===1)return!0;for(let n=0;nObject.hasOwnProperty.call(Element.prototype,`animate`));function oi(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:s,transformTemplate:c}=t.owner.getProps();return ai()&&n&&ii.has(n)&&(n!==`transform`||!c)&&!s&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var si=40,ci=class extends ar{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=wt.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u};this.keyframeResolver=new(l?.KeyframeResolver||Fr)(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=wt.now(),ni(e,i,a,o)||((Pe.instantAnimations||!s)&&l?.(nr(e,n,t)),e[0]=e[e.length-1],ri(n),n.repeat=0);let u={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>si?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},d=!c&&oi(u)?new $r({...u,element:u.motionValue.owner.current}):new sr(u);d.finished.then(()=>this.notifyFinished()).catch(ze),this.pendingTimeline&&=(this.stopTimeline=d.attachTimeline(this.pendingTimeline),void 0),this._animation=d}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Pr()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}},li=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function ui(e){let t=li.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function di(e,t,n=1){`${e}`;let[r,i]=ui(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return Fe(e)?parseFloat(e):e}return kt(i)?di(i,t,n+1):i}function fi(e,t){return e?.[t]??e?.default??e}var pi=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...xr]),mi={test:e=>e===`auto`,parse:e=>e},hi=e=>t=>t.test(e),gi=[jt,q,qt,Kt,Yt,Jt,mi],_i=e=>gi.find(hi(e));function vi(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||Le(e)}var yi=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function bi(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(Ft)||[];if(!r)return e;let i=n.replace(r,``),a=yi.has(t)?1:0;return r!==n&&(a*=100),t+`(`+a+i+`)`}var xi=/\b([a-z-]*)\(.*?\)/gu,Si={...fn,getAnimatableNone:e=>{let t=e.match(xi);return t?t.map(bi).join(` `):e}},Ci={...jt,transform:Math.round},wi={borderWidth:q,borderTopWidth:q,borderRightWidth:q,borderBottomWidth:q,borderLeftWidth:q,borderRadius:q,radius:q,borderTopLeftRadius:q,borderTopRightRadius:q,borderBottomRightRadius:q,borderBottomLeftRadius:q,width:q,maxWidth:q,height:q,maxHeight:q,top:q,right:q,bottom:q,left:q,padding:q,paddingTop:q,paddingRight:q,paddingBottom:q,paddingLeft:q,margin:q,marginTop:q,marginRight:q,marginBottom:q,marginLeft:q,backgroundPositionX:q,backgroundPositionY:q,rotate:Kt,rotateX:Kt,rotateY:Kt,rotateZ:Kt,scale:Nt,scaleX:Nt,scaleY:Nt,scaleZ:Nt,skew:Kt,skewX:Kt,skewY:Kt,distance:q,translateX:q,translateY:q,translateZ:q,x:q,y:q,z:q,perspective:q,transformPerspective:q,opacity:Mt,originX:Xt,originY:Xt,originZ:q,zIndex:Ci,fillOpacity:Mt,strokeOpacity:Mt,numOctaves:Ci},Ti={...wi,color:J,backgroundColor:J,outlineColor:J,fill:J,stroke:J,borderColor:J,borderTopColor:J,borderRightColor:J,borderBottomColor:J,borderLeftColor:J,filter:Si,WebkitFilter:Si},Ei=e=>Ti[e];function Di(e,t){let n=Ei(e);return n!==Si&&(n=fn),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var Oi=new Set([`auto`,`none`,`0`]);function ki(e,t,n){let r=0,i;for(;r{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}};function ji(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}var Mi=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function Ni(e){return Ie(e)&&`offsetHeight`in e}var Pi=30,Fi=e=>!isNaN(parseFloat(e)),Ii={current:void 0},Li=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=wt.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=wt.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Fi(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new Ue);let n=this.events[e].add(t);return e===`change`?()=>{n(),G.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return Ii.current&&Ii.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=wt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Pi)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,Pi);return Ke(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Ri(e,t){return new Li(e,t)}var{schedule:zi,cancel:Bi}=yt(queueMicrotask,!1),Vi={x:!1,y:!1};function Hi(){return Vi.x||Vi.y}function Ui(e){return e===`x`||e===`y`?Vi[e]?null:(Vi[e]=!0,()=>{Vi[e]=!1}):Vi.x||Vi.y?null:(Vi.x=Vi.y=!0,()=>{Vi.x=Vi.y=!1})}function Wi(e,t){let n=ji(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function Gi(e){return!(e.pointerType===`touch`||Hi())}function Ki(e,t,n={}){let[r,i,a]=Wi(e,n),o=e=>{if(!Gi(e))return;let{target:n}=e,r=t(n,e);if(typeof r!=`function`||!n)return;let a=e=>{Gi(e)&&(r(e),n.removeEventListener(`pointerleave`,a))};n.addEventListener(`pointerleave`,a,i)};return r.forEach(e=>{e.addEventListener(`pointerenter`,o,i)}),a}var qi=(e,t)=>t?e===t?!0:qi(e,t.parentElement):!1,Ji=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,Yi=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function Xi(e){return Yi.has(e.tagName)||e.tabIndex!==-1}var Zi=new WeakSet;function Qi(e){return t=>{t.key===`Enter`&&e(t)}}function $i(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var ea=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=Qi(()=>{if(Zi.has(n))return;$i(n,`down`);let e=Qi(()=>{$i(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>$i(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function ta(e){return Ji(e)&&!Hi()}function na(e,t,n={}){let[r,i,a]=Wi(e,n),o=e=>{let r=e.currentTarget;if(!ta(e))return;Zi.add(r);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),Zi.has(r)&&Zi.delete(r),ta(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||qi(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),Ni(e)&&(e.addEventListener(`focus`,e=>ea(e,i)),!Xi(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function ra(e){return Ie(e)&&`ownerSVGElement`in e}function ia(e){return ra(e)&&e.tagName===`svg`}var aa=e=>!!(e&&e.getVelocity),oa=[...gi,J,fn],sa=e=>oa.find(hi(e)),ca=(0,M.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function la(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function ua(...e){return t=>{let n=!1,r=e.map(e=>{let r=la(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t{let{width:e,height:c,top:l,left:u,right:d}=o.current;if(t||!a.current||!e||!c)return;let f=n===`left`?`left: ${u}`:`right: ${d}`;a.current.dataset.motionPopId=i;let p=document.createElement(`style`);s&&(p.nonce=s);let m=r??document.head;return m.appendChild(p),p.sheet&&p.sheet.insertRule(` +import{C as e,Dn as t,On as n,Tn as r,_ as i,a,an as o,c as s,g as c,h as l,i as u,jn as d,kn as f,l as p,ln as m,mn as h,o as g,p as _,pn as v,tn as y,u as b,v as x,w as S,wn as C,x as w,y as T}from"./index-BlYU7j-M.js";import{t as E}from"./SigilModal-Dm4zpSIO.js";const D=17491.270421,O=[`Ignition Ark`,`Integration Ark`,`Harmonization Ark`,`Reflektion Ark`,`Purifikation Ark`,`Dream Ark`],k={"Ignition Ark":`#ff1559`,"Integration Ark":`#ff6d00`,"Harmonization Ark":`#ffd900`,"Reflektion Ark":`#00ff66`,"Purifikation Ark":`#05e6ff`,"Dream Ark":`#c300ff`},A={"Ignition Ark":`Ignite`,"Integration Ark":`Integrate`,"Harmonization Ark":`Harmony`,"Reflektion Ark":`Reflekt`,"Purifikation Ark":`Purify`,"Dream Ark":`Dream`},j=D/36,ee=j/44,te=3+Math.sqrt(5);Math.round(te*1e3),1/te;var M=d(r(),1),N=d(y(),1),P=120,F=P/2,I=22,L=4.5,ne=2,R=F-.5,re=F-ne,z=36,B=-3,V=3,ie=re-2,ae=(I+L+R)/2-4,oe=e=>e*Math.PI/180,se=e=>e.toLowerCase().replace(/\s+/g,`-`);function ce(e,t,n){let r=parseInt(e.slice(1),16),i=parseInt(t.slice(1),16),a=r>>16,o=r>>8&255,s=r&255,c=i>>16,l=i>>8&255,u=i&255;return`rgb(${Math.round(a+(c-a)*n)},${Math.round(o+(l-o)*n)},${Math.round(s+(u-s)*n)})`}var le=(e,t,n)=>Math.max(t,Math.min(n,e)),H=e=>{if(!e)return;let t=e.match(/(\d{2})$/);if(!t)return;let n=parseInt(t[1],10);if(Number.isFinite(n))return le(n,0,43)},U=({hue:e,pulse:t,kaiPulseEternal:n,harmonicDayPercent:r,microCyclePercent:i,dayLabel:a,monthLabel:o,monthDay:s,glowPulse:c=!0,pulseIntervalSec:l=te,rimFlash:u=!1,rotationOverride:d,solarSpiralStepString:f,solarSpiralStep:p,eternalBeatIndex:m,eternalStepIndex:h})=>{(0,M.useEffect)(()=>{typeof document<`u`&&document.documentElement.style.setProperty(`--cycle`,`${l}s`)},[l]);let g=`${l}s`,_=(n%D+D)%D,v=Number.isFinite(t)?t:_,y=v/D,b=Number.isFinite(r)?r:y*100,x=(v-Math.floor(v/j)*j)%ee/ee,S=Number.isFinite(i)?i:x*100,C=(v%D+D)%D,w=C/D,T=Math.floor(w*36)%36,E=(T+.5)/36*360,ne=typeof d==`number`?d:E,U=360/O.length,W=Math.floor(ne/U)%O.length,ue=(W+1)%O.length,de=(ne-W*U+360)%360,fe=Math.min(1,de/U),pe=k[O[W]],me=k[O[ue]],he=ce(pe,me,fe),ge=2*Math.PI*re,_e=ge*(1-b/100),ve=-(S/100)*l,ye=v,be=[`Aethon`,`Virelai`,`Solari`,`Amarin`,`Kaelus`,`Umbriel`,`Noctura`,`Liora`].indexOf(o)+1,xe=be>0?be:1,Se=F-14,Ce=F,we=F+14,Te=F+28,Ee=Math.floor(_/j)%36,De=Number.isFinite(m)?le(m,0,35):Ee,Oe=_-De*j,ke=Oe/j,Ae=Math.floor(Oe/ee)%44,je=Number.isFinite(h)?le(h,0,43):Ae,Me=je.toString().padStart(2,`0`),Ne=(De+.5)/36*360,Pe=`hsl(${T/36*360}, 100%, 50%)`,Fe=`#ebfdff`,Ie=1.6,Le=R-(I+L)+.5,Re=F-(I+L),ze=Le*ke,Be=Re-ze,Ve=.82,He=F-(I+L)-Le*Ve,Ue=F,We=He+6,Ge=(0,M.useId)().replace(/[^a-zA-Z0-9_-]/g,``)||`klock`,Ke=Me,qe=De.toString().padStart(2,`0`),Je=Math.floor(_),Ye=Oe-je*ee,Xe=Math.max(0,Math.min(1,Ye/ee))*100,Ze=`#00faff`,Qe=`#ff6d00`,$e=((C-T*j)%j+j)%j,et=Math.floor($e/ee)%44,tt=Number.isFinite(p?.stepIndex)?le(p.stepIndex,0,43):void 0,nt=H(f),rt=(tt??nt??et).toString().padStart(2,`0`),it=F-(I+L)-Le*Ve,at=F;return(0,N.jsx)(`div`,{className:`kai-klock-shell`,style:{"--hue":e,"--arc":pe,"--cycle":g,width:`100%`,aspectRatio:`1 / 1`,overflow:`hidden`},children:(0,N.jsxs)(`svg`,{className:`kai-svg`,viewBox:`0 0 ${P} ${P}`,width:`100%`,height:`100%`,preserveAspectRatio:`xMidYMid meet`,role:`img`,children:[(0,N.jsx)(`circle`,{cx:F,cy:F,r:R,className:`rim-ring ${u?`rim-flash`:``}`}),(0,N.jsx)(`circle`,{cx:F,cy:F,r:re,className:`day-progress`,strokeDasharray:ge,strokeDashoffset:_e}),Array.from({length:36}).map((e,t)=>{let n=oe(t*(360/z)-90),r=(t+B+z)%z/z;return(0,N.jsx)(`text`,{x:F+ie*Math.cos(n),y:F+ie*Math.sin(n)+V/2,className:`beat-number`,textAnchor:`middle`,fontSize:V,style:{fill:`hsl(${r*360},100%,50%)`},children:t},t)}),(0,N.jsx)(`circle`,{cx:F,cy:F,r:I+L,className:`inner-halo`}),(0,N.jsx)(`g`,{className:`orb-spin`,style:{animationDelay:`${ve}s`},children:(0,N.jsx)(`circle`,{cx:F,cy:F-(I+L),r:3.6,className:`micro-orb orb-glow`})}),(0,N.jsxs)(`g`,{style:{transform:`rotate(${ne}deg)`,transformOrigin:`${F}px ${F}px`,transition:`transform 1s ease-out`},children:[(0,N.jsx)(`rect`,{x:F-1,y:F-(I+L)-(R-(I+L)),width:2,height:R-(I+L),rx:1,className:`needle`,style:{fill:he}}),(0,N.jsxs)(`g`,{className:`solar-hand-label-wrap`,style:{transform:`rotate(${-ne}deg)`,transformOrigin:`${at}px ${it}px`},children:[(0,N.jsx)(`text`,{x:at,y:it-3.6,textAnchor:`middle`,dominantBaseline:`central`,fontSize:3,fontWeight:900,style:{fill:Qe,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.65)`,strokeWidth:.8,filter:`drop-shadow(0 0 2px ${Qe})`},children:`☀`}),(0,N.jsx)(`text`,{x:at-2.2,y:it,textAnchor:`middle`,dominantBaseline:`central`,className:`solar-hand-label-digit`,fontSize:4.4,fontWeight:900,style:{fill:Qe,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.65)`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px ${Qe}) drop-shadow(0 0 5px ${Qe})`},children:rt[0]}),(0,N.jsx)(`text`,{x:at+2.2,y:it,textAnchor:`middle`,dominantBaseline:`central`,className:`solar-hand-label-digit`,fontSize:4.4,fontWeight:900,style:{fill:Qe,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.65)`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px ${Qe}) drop-shadow(0 0 5px ${Qe})`},children:rt[1]})]})]}),(0,N.jsxs)(`g`,{className:`eternal-hand-group`,style:{transform:`rotate(${Ne}deg)`,transformOrigin:`${F}px ${F}px`,transition:`transform 0.6s cubic-bezier(.22,.61,.36,1)`},children:[(0,N.jsx)(`rect`,{x:F-Ie/2,y:F-(I+L)-Le,width:Ie,height:Le,rx:Ie/1.5,className:`eternal-hand`,style:{fill:`transparent`,stroke:`#bff7ff`,strokeWidth:.7,filter:`drop-shadow(0 0 2px #eaffff) drop-shadow(0 0 6px #d9fbff)`,mixBlendMode:`screen`}}),(0,N.jsx)(`defs`,{children:(0,N.jsxs)(`linearGradient`,{id:`eternalFill-${Ge}`,x1:`0`,y1:`1`,x2:`0`,y2:`0`,children:[(0,N.jsx)(`stop`,{offset:`0%`,stopColor:Fe,stopOpacity:.15}),(0,N.jsx)(`stop`,{offset:`100%`,stopColor:Fe,stopOpacity:.95})]})}),(0,N.jsx)(`rect`,{x:F-Ie/2,y:Be,width:Ie,height:Math.max(0,ze),rx:Ie/2,className:`eternal-hand-fill`,style:{fill:`url(#eternalFill-${Ge})`,filter:`drop-shadow(0 0 3px #eaffff) drop-shadow(0 0 6px #eaffff)`,mixBlendMode:`screen`}}),(0,N.jsx)(`circle`,{cx:F,cy:F-(I+L)-Le-.8,r:1.35,className:`eternal-hand-tip`,style:{fill:`#ffffff`,filter:`drop-shadow(0 0 4px #eaffff) drop-shadow(0 0 8px #eaffff)`,mixBlendMode:`screen`}}),(0,N.jsxs)(`g`,{className:`eternal-hand-label-wrap`,style:{transform:`rotate(${-Ne}deg)`,transformOrigin:`${Ue}px ${He}px`},children:[(0,N.jsx)(`text`,{x:Ue-2.2,y:He,textAnchor:`middle`,dominantBaseline:`central`,className:`eternal-hand-label-digit`,fontSize:4.4,fontWeight:900,style:{fill:`#e8feff`,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.45)`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px #eaffff) drop-shadow(0 0 5px #c8fbff)`},children:Me[0]}),(0,N.jsx)(`text`,{x:Ue+2.2,y:He,textAnchor:`middle`,dominantBaseline:`central`,className:`eternal-hand-label-digit`,fontSize:4.4,fontWeight:900,style:{fill:`#e8feff`,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.45)`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px #eaffff) drop-shadow(0 0 5px #c8fbff)`},children:Me[1]})]}),(0,N.jsx)(`g`,{transform:`rotate(${-Ne} ${Ue} ${We})`,children:(0,N.jsx)(`text`,{x:Ue,y:We,textAnchor:`middle`,dominantBaseline:`central`,className:`eternal-hand-percent`,fontSize:3.2,fontWeight:800,style:{fill:`#dafeff`,paintOrder:`stroke`,stroke:`rgba(0,0,0,0.4)`,strokeWidth:.7,letterSpacing:`0.25px`,filter:`drop-shadow(0 0 2px #eaffff)`}})})]}),(0,N.jsx)(`text`,{x:F,y:F-15,className:`center-sub`,textAnchor:`middle`,fontSize:6,fontWeight:800,style:{fill:Ze,paintOrder:`stroke`,stroke:`#000`,strokeWidth:.9,letterSpacing:`0.4px`,filter:`drop-shadow(0 0 2px ${Ze}) drop-shadow(0 0 6px ${Ze})`},children:Je}),(0,N.jsxs)(`text`,{x:F,y:F-3,className:`center-pulse ${c?`pulse-flash`:``}`,textAnchor:`middle`,children:[qe,`:`,Ke]},`et-${ye}`),(0,N.jsx)(`text`,{x:F,y:F+8,className:`center-day day-${se(a)}`,textAnchor:`middle`,children:a}),(0,N.jsx)(`text`,{x:F,y:F+18,className:`center-month month-${se(o)}`,textAnchor:`middle`,children:o}),(0,N.jsx)(`text`,{x:F,y:Te+8,className:`eternal-pulse`,textAnchor:`middle`,children:n}),(0,N.jsx)(`text`,{x:Se,y:Te,className:`step-percent`,textAnchor:`middle`,fontSize:5.5,fill:Pe,fontWeight:800,style:{filter:`drop-shadow(0 0 2px ${Pe}) drop-shadow(0 0 5px #00faff)`,letterSpacing:`0.25px`},children:`${Xe.toFixed(1)}%`}),(0,N.jsx)(`text`,{x:Ce,y:Te,className:`day-of-month day-${se(a)}`,textAnchor:`middle`,children:s}),(0,N.jsx)(`text`,{x:we,y:Te,className:`day-of-month month-${se(o)}`,textAnchor:`middle`,children:xe}),O.map((e,t)=>{let n=oe(t*(360/O.length)-90),r=F+ae*Math.cos(n),i=F+ae*Math.sin(n)+(t===3?7:3);return(0,N.jsxs)(M.Fragment,{children:[(0,N.jsx)(`text`,{x:r,y:i,className:`arc-label arc-${se(e.split(` `)[0])} ${t===W?`active`:``}`,textAnchor:`middle`,children:A[e]}),e===`Ignition Ark`&&f&&(0,N.jsx)(`text`,{x:r,y:i+8,textAnchor:`middle`,dominantBaseline:`hanging`,fontSize:10,fill:`#00faff`,fontWeight:900,style:{filter:`drop-shadow(0 0 2px #00faff) drop-shadow(0 0 4px #00faff) drop-shadow(0 0 8px #00faff)`,paintOrder:`stroke`,stroke:`#000`,strokeWidth:1,vectorEffect:`non-scaling-stroke`,letterSpacing:`0.5px`},children:f})]},e)})]})})},W=Date.UTC(2024,4,10,6,45,41,888),ue=3+Math.sqrt(5),de=ue*1e3,fe=1000000n,pe=17491270421n,me=11000000n,he=(pe+18n)/36n,ge=[`Solhara`,`Aquaris`,`Flamora`,`Verdari`,`Sonari`,`Kaelith`],_e={Solhara:`Root`,Aquaris:`Sacral`,Flamora:`Solar Plexus`,Verdari:`Heart`,Sonari:`Throat`,Kaelith:`Crown`},ve=(e,t)=>(e%t+t)%t;function ye(e,t){let n=e/t,r=e%t;return r!==0n&&r>0n!=t>0n?n-1n:n}function be(e){if(!Number.isFinite(e))return 0n;let t=e<0?-1:1,n=Math.abs(e),r=Math.trunc(n),i=n-r;return i<.5?BigInt(t*r):i>.5?BigInt(t*(r+1)):BigInt(t*(r%2==0?r:r+1))}function xe(e){return be((e.getTime()-W)/1e3/ue*1e6)}function Se(e){let t=xe(e),n=ve(t,pe),r=ye(t,pe),i=Number(ye(n,he)),a=n-BigInt(i)*he,o=a-a/me*me,s=Number(o)/Number(me);return{pulse:Number(ye(t,fe)),beat:i,stepPct:s,chakraDay:_e[ge[Number(ve(r,6n))]]}}var Ce=()=>performance.timeOrigin+performance.now(),we=e=>{let t=e-W;return W+Math.ceil(t/de)*de},Te=()=>{let[e,t]=(0,M.useState)(0),[n,r]=(0,M.useState)(0),[i,a]=(0,M.useState)(0),[o,s]=(0,M.useState)(`Root`),[c,l]=(0,M.useState)(!1),[u]=(0,M.useState)(()=>`btn-${Math.random().toString(36).slice(2)}`),d=c?`sigil-open`:`sigil-closed`,f=(0,M.useRef)(null),p=(0,M.useRef)(null),m=(0,M.useRef)(0),h=(0,M.useCallback)(()=>{let{pulse:e,beat:n,stepPct:i,chakraDay:o}=Se(new Date);t(e),r(n),a(i),s(o)},[]),g=()=>{p.current!==null&&(clearTimeout(p.current),p.current=null)},_=(0,M.useCallback)(()=>{g();let e=Ce();m.current=we(e);let t=()=>{let e=Ce(),n=Math.floor((e-m.current)/de),r=Math.max(0,n)+1;for(let e=0;e(h(),_(),()=>g()),[h,_]),(0,M.useEffect)(()=>{let e=()=>{document.visibilityState===`visible`&&_()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[_]),(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`button`,{className:`sigil-button`,title:`View & save this sigil`,onClick:()=>l(!0),"data-chakra":o,"aria-label":`Open Kairos Sigil`,children:(0,N.jsxs)(`span`,{className:`sigil-thumb`,"aria-hidden":`true`,inert:!0,children:[(0,N.jsx)(S,{ref:f,pulse:e,beat:n,stepPct:i,chakraDay:o,size:40,hashMode:`deterministic`,origin:u,onReady:n=>{n&&typeof n.pulse==`number`&&n.pulse!==e&&t(n.pulse)}},d),(0,N.jsx)(`span`,{className:`sigil-shield`,"aria-hidden":`true`})]})}),c&&(0,N.jsx)(E,{initialPulse:e,onClose:()=>l(!1)})]})},Ee=(0,M.createContext)({});function De(e){let t=(0,M.useRef)(null);return t.current===null&&(t.current=e()),t.current}var Oe=typeof window<`u`,ke=Oe?M.useLayoutEffect:M.useEffect,Ae=(0,M.createContext)(null);function je(e,t){e.indexOf(t)===-1&&e.push(t)}function Me(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var Ne=(e,t,n)=>n>t?t:n/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Ie(e){return typeof e==`object`&&!!e}var Le=e=>/^0[^.\s]+$/u.test(e);function Re(e){let t;return()=>(t===void 0&&(t=e()),t)}var ze=e=>e,Be=(e,t)=>n=>t(e(n)),Ve=(...e)=>e.reduce(Be),He=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},Ue=class{constructor(){this.subscriptions=[]}add(e){return je(this.subscriptions,e),()=>Me(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;ie*1e3,Ge=e=>e/1e3;function Ke(e,t){return t?e*(1e3/t):0}var qe=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Je=1e-7,Ye=12;function Xe(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=qe(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>Je&&++sXe(t,0,1,e,n);return e=>e===0||e===1?e:qe(i(e),t,r)}var Qe=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,$e=e=>t=>1-e(1-t),et=Ze(.33,1.53,.69,.99),tt=$e(et),nt=Qe(tt),rt=e=>(e*=2)<1?.5*tt(e):.5*(2-2**(-10*(e-1))),it=e=>1-Math.sin(Math.acos(e)),at=$e(it),ot=Qe(it),st=Ze(.42,0,1,1),ct=Ze(0,0,.58,1),lt=Ze(.42,0,.58,1),ut=e=>Array.isArray(e)&&typeof e[0]!=`number`,dt=e=>Array.isArray(e)&&typeof e[0]==`number`,ft={linear:ze,easeIn:st,easeInOut:lt,easeOut:ct,circIn:it,circInOut:ot,circOut:at,backIn:tt,backInOut:nt,backOut:et,anticipate:rt},pt=e=>typeof e==`string`,mt=e=>{if(dt(e)){e.length;let[t,n,r,i]=e;return Ze(t,n,r,i)}else if(pt(e))return ft[e],`${e}`,ft[e];return e},ht=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],gt={value:null,addProjectionMetrics:null};function _t(e,t){let n=new Set,r=new Set,i=!1,a=!1,o=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1},c=0;function l(t){o.has(t)&&(u.schedule(t),e()),c++,t(s)}let u={schedule:(e,t=!1,a=!1)=>{let s=a&&i?n:r;return t&&o.add(e),s.has(e)||s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(s=e,i){a=!0;return}i=!0,[n,r]=[r,n],n.forEach(l),t&>.value&>.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var vt=40;function yt(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=ht.reduce((e,n)=>(e[n]=_t(a,t?n:void 0),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=Pe.useManualTiming?i.timestamp:performance.now();n=!1,Pe.useManualTiming||(i.delta=r?1e3/60:Math.max(Math.min(a-i.timestamp,vt),1)),i.timestamp=a,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:ht.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t(St===void 0&&wt.set(K.isProcessing||Pe.useManualTiming?K.timestamp:performance.now()),St),set:e=>{St=e,queueMicrotask(Ct)}},Tt={layout:0,mainThread:0,waapi:0},Et=e=>t=>typeof t==`string`&&t.startsWith(e),Dt=Et(`--`),Ot=Et(`var(--`),kt=e=>Ot(e)?At.test(e.split(`/*`)[0].trim()):!1,At=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,jt={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},Mt={...jt,transform:e=>Ne(0,1,e)},Nt={...jt,default:1},Pt=e=>Math.round(e*1e5)/1e5,Ft=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function It(e){return e==null}var Lt=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Rt=(e,t)=>n=>!!(typeof n==`string`&&Lt.test(n)&&n.startsWith(e)||t&&!It(n)&&Object.prototype.hasOwnProperty.call(n,t)),zt=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(Ft);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},Bt=e=>Ne(0,255,e),Vt={...jt,transform:e=>Math.round(Bt(e))},Ht={test:Rt(`rgb`,`red`),parse:zt(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+Vt.transform(e)+`, `+Vt.transform(t)+`, `+Vt.transform(n)+`, `+Pt(Mt.transform(r))+`)`};function Ut(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var Wt={test:Rt(`#`),parse:Ut,transform:Ht.transform},Gt=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Kt=Gt(`deg`),qt=Gt(`%`),q=Gt(`px`),Jt=Gt(`vh`),Yt=Gt(`vw`),Xt=(()=>({...qt,parse:e=>qt.parse(e)/100,transform:e=>qt.transform(e*100)}))(),Zt={test:Rt(`hsl`,`hue`),parse:zt(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+qt.transform(Pt(t))+`, `+qt.transform(Pt(n))+`, `+Pt(Mt.transform(r))+`)`},J={test:e=>Ht.test(e)||Wt.test(e)||Zt.test(e),parse:e=>Ht.test(e)?Ht.parse(e):Zt.test(e)?Zt.parse(e):Wt.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?Ht.transform(e):Zt.transform(e),getAnimatableNone:e=>{let t=J.parse(e);return t.alpha=0,J.transform(t)}},Qt=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function $t(e){return isNaN(e)&&typeof e==`string`&&(e.match(Ft)?.length||0)+(e.match(Qt)?.length||0)>0}var en=`number`,tn=`color`,nn=`var`,rn=`var(`,an="${}",on=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function sn(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(on,e=>(J.test(e)?(r.color.push(a),i.push(tn),n.push(J.parse(e))):e.startsWith(rn)?(r.var.push(a),i.push(nn),n.push(e)):(r.number.push(a),i.push(en),n.push(parseFloat(e))),++a,an)).split(an),indexes:r,types:i}}function cn(e){return sn(e).values}function ln(e){let{split:t,types:n}=sn(e),r=t.length;return e=>{let i=``;for(let a=0;atypeof e==`number`?0:J.test(e)?J.getAnimatableNone(e):e;function dn(e){let t=cn(e);return ln(e)(t.map(un))}var fn={test:$t,parse:cn,createTransformer:ln,getAnimatableNone:dn};function pn(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function mn({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=pn(s,r,e+1/3),a=pn(s,r,e),o=pn(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function hn(e,t){return n=>n>0?t:e}var Y=(e,t,n)=>e+(t-e)*n,gn=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},_n=[Wt,Ht,Zt],vn=e=>_n.find(t=>t.test(e));function yn(e){let t=vn(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===Zt&&(n=mn(n)),n}var bn=(e,t)=>{let n=yn(e),r=yn(t);if(!n||!r)return hn(e,t);let i={...n};return e=>(i.red=gn(n.red,r.red,e),i.green=gn(n.green,r.green,e),i.blue=gn(n.blue,r.blue,e),i.alpha=Y(n.alpha,r.alpha,e),Ht.transform(i))},xn=new Set([`none`,`hidden`]);function Sn(e,t){return xn.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Cn(e,t){return n=>Y(e,t,n)}function wn(e){return typeof e==`number`?Cn:typeof e==`string`?kt(e)?hn:J.test(e)?bn:On:Array.isArray(e)?Tn:typeof e==`object`?J.test(e)?bn:En:hn}function Tn(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>wn(e)(e,t[n]));return e=>{for(let t=0;t{for(let t in r)n[t]=r[t](e);return n}}function Dn(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i{let n=fn.createTransformer(t),r=sn(e),i=sn(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?xn.has(e)&&!i.values.length||xn.has(t)&&!r.values.length?Sn(e,t):Ve(Tn(Dn(r,i),i.values),n):(`${e}${t}`,hn(e,t))};function kn(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?Y(e,t,n):wn(e)(e,t)}var An=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>G.update(t,e),stop:()=>bt(t),now:()=>K.isProcessing?K.timestamp:wt.now()}},jn=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t=2e4?1/0:t}function Pn(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(Nn(r),Mn);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:Ge(i)}}var Fn=5;function In(e,t,n){let r=Math.max(t-Fn,0);return Ke(n-e(r),t-r)}var X={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Ln=.001;function Rn({duration:e=X.duration,bounce:t=X.bounce,velocity:n=X.velocity,mass:r=X.mass}){let i,a;X.maxDuration;let o=1-t;o=Ne(X.minDamping,X.maxDamping,o),e=Ne(X.minDuration,X.maxDuration,Ge(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=Vn(t,o),c=Math.exp(-i);return Ln-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=Vn(t**2,o);return(-i(t)+Ln>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-Ln+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=Bn(i,a,s);if(e=We(e),isNaN(c))return{stiffness:X.stiffness,damping:X.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var zn=12;function Bn(e,t,n){let r=n;for(let n=1;ne[t]!==void 0)}function Gn(e){let t={velocity:X.velocity,stiffness:X.stiffness,damping:X.damping,mass:X.mass,isResolvedFromDuration:!1,...e};if(!Wn(e,Un)&&Wn(e,Hn))if(e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*Ne(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:X.mass,stiffness:i,damping:a}}else{let n=Rn(e);t={...t,...n,mass:X.mass},t.isResolvedFromDuration=!0}return t}function Kn(e=X.visualDuration,t=X.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=Gn({...n,velocity:-Ge(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=Ge(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?X.restSpeed.granular:X.restSpeed.default,i||=v?X.restDelta.granular:X.restDelta.default;let y;if(h<1){let e=Vn(_,h);y=t=>o-Math.exp(-h*_*t)*((m+h*_*g)/e*Math.sin(e*t)+g*Math.cos(e*t))}else if(h===1)y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e}}let b={calculatedDuration:p&&d||null,next:e=>{let t=y(e);if(p)s.done=e>=d;else{let n=e===0?m:0;h<1&&(n=e===0?We(m):In(y,e,t));let a=Math.abs(n)<=r,c=Math.abs(o-t)<=i;s.done=a&&c}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(Nn(b),Mn),t=jn(t=>b.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return b}Kn.applyToOptions=e=>{let t=Pn(e,100,Kn);return e.ease=t.ease,e.duration=We(t.duration),e.type=`keyframes`,e};function qn({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&ec,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=Kn({keyframes:[f.value,m(f.value)],velocity:In(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function Jn(e,t,n){let r=[],i=n||Pe.mix||kn,a=e.length-1;for(let n=0;nt[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=Jn(t,r,i),c=s.length,l=n=>{if(o&&n1)for(;rl(Ne(e[0],e[a-1],t)):l}function Xn(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=He(0,t,r);e.push(Y(n,1,i))}}function Zn(e){let t=[0];return Xn(t,e.length-1),t}function Qn(e,t){return e.map(e=>e*t)}function $n(e,t){return e.map(()=>t||lt).splice(0,e.length-1)}function er({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=ut(r)?r.map(mt):mt(r),a={done:!1,value:t[0]},o=Yn(Qn(n&&n.length===t.length?n:Zn(t),e),t,{ease:Array.isArray(i)?i:$n(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var tr=e=>e!==null;function nr(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(tr),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var rr={decay:qn,inertia:qn,tween:er,keyframes:er,spring:Kn};function ir(e){typeof e.type==`string`&&(e.type=rr[e.type])}var ar=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},or=e=>e/100,sr=class extends ar{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==wt.now()&&this.tick(wt.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},Tt.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;ir(e);let{type:t=er,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||er;s!==er&&typeof o[0]!=`number`&&(this.mixKeyframes=Ve(or,kn(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=Nn(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=Ne(0,1,n)*o}let b=_?{done:!1,value:l[0]}:y.next(v);i&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==qn&&(b.value=nr(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return Ge(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Ge(e)}get time(){return Ge(this.currentTime)}set time(e){e=We(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(wt.now());let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=Ge(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=An,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(wt.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null,Tt.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function cr(e){for(let t=1;te*180/Math.PI,ur=e=>fr(lr(Math.atan2(e[1],e[0]))),dr={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:ur,rotateZ:ur,skewX:e=>lr(Math.atan(e[1])),skewY:e=>lr(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},fr=e=>(e%=360,e<0&&(e+=360),e),pr=ur,mr=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),hr=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),gr={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:mr,scaleY:hr,scale:e=>(mr(e)+hr(e))/2,rotateX:e=>fr(lr(Math.atan2(e[6],e[5]))),rotateY:e=>fr(lr(Math.atan2(-e[2],e[0]))),rotateZ:pr,rotate:pr,skewX:e=>lr(Math.atan(e[4])),skewY:e=>lr(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function _r(e){return e.includes(`scale`)?1:0}function vr(e,t){if(!e||e===`none`)return _r(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=gr,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=dr,i=t}if(!i)return _r(t);let a=r[t],o=i[1].split(`,`).map(br);return typeof a==`function`?a(o):o[a]}var yr=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return vr(n,t)};function br(e){return parseFloat(e.trim())}var xr=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],Sr=(()=>new Set(xr))(),Cr=e=>e===jt||e===q,wr=new Set([`x`,`y`,`z`]),Tr=xr.filter(e=>!wr.has(e));function Er(e){let t=[];return Tr.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith(`scale`)?1:0))}),t}var Dr={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>vr(t,`x`),y:(e,{transform:t})=>vr(t,`y`)};Dr.translateX=Dr.x,Dr.translateY=Dr.y;var Or=new Set,kr=!1,Ar=!1,jr=!1;function Mr(){if(Ar){let e=Array.from(Or).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=Er(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}Ar=!1,kr=!1,Or.forEach(e=>e.complete(jr)),Or.clear()}function Nr(){Or.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Ar=!0)})}function Pr(){jr=!0,Nr(),Mr(),jr=!1}var Fr=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(Or.add(this),kr||(kr=!0,G.read(Nr),G.resolveKeyframes(Mr))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}cr(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Or.delete(this)}cancel(){this.state===`scheduled`&&(Or.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},Ir=e=>e.startsWith(`--`);function Lr(e,t,n){Ir(t)?e.style.setProperty(t,n):e.style[t]=n}var Rr=Re(()=>window.ScrollTimeline!==void 0),zr={};function Br(e,t){let n=Re(e);return()=>zr[t]??n()}var Vr=Br(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),Hr=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Ur={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:Hr([0,.65,.55,1]),circOut:Hr([.55,0,1,.45]),backIn:Hr([.31,.01,.66,-.59]),backOut:Hr([.33,1.53,.69,.99])};function Wr(e,t){if(e)return typeof e==`function`?Vr()?jn(e,t):`ease-out`:dt(e)?Hr(e):Array.isArray(e)?e.map(e=>Wr(e,t)||Ur.easeOut):Ur[e]}function Gr(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=Wr(s,i);Array.isArray(d)&&(u.easing=d),gt.value&&Tt.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return gt.value&&p.finished.finally(()=>{Tt.waapi--}),p}function Kr(e){return typeof e==`function`&&`applyToOptions`in e}function qr({type:e,...t}){return Kr(e)&&Vr()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var Jr=class extends ar{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=qr(e);this.animation=Gr(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=nr(r,this.options,o,this.speed);this.updateMotionValue?this.updateMotionValue(e):Lr(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return Ge(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Ge(e)}get time(){return Ge(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=We(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&Rr()?(this.animation.timeline=e,ze):t(this)}},Yr={anticipate:rt,backInOut:nt,circInOut:ot};function Xr(e){return e in Yr}function Zr(e){typeof e.ease==`string`&&Xr(e.ease)&&(e.ease=Yr[e.ease])}var Qr=10,$r=class extends Jr{constructor(e){Zr(e),ir(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new sr({...a,autoplay:!1}),s=We(this.finishedTime??this.time);t.setWithVelocity(o.sample(s-Qr).value,o.sample(s).value,Qr),o.stop()}},ei=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(fn.test(e)||e===`0`)&&!e.startsWith(`url(`));function ti(e){let t=e[0];if(e.length===1)return!0;for(let n=0;nObject.hasOwnProperty.call(Element.prototype,`animate`));function oi(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:s,transformTemplate:c}=t.owner.getProps();return ai()&&n&&ii.has(n)&&(n!==`transform`||!c)&&!s&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var si=40,ci=class extends ar{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=wt.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u};this.keyframeResolver=new(l?.KeyframeResolver||Fr)(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=wt.now(),ni(e,i,a,o)||((Pe.instantAnimations||!s)&&l?.(nr(e,n,t)),e[0]=e[e.length-1],ri(n),n.repeat=0);let u={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>si?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},d=!c&&oi(u)?new $r({...u,element:u.motionValue.owner.current}):new sr(u);d.finished.then(()=>this.notifyFinished()).catch(ze),this.pendingTimeline&&=(this.stopTimeline=d.attachTimeline(this.pendingTimeline),void 0),this._animation=d}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Pr()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}},li=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function ui(e){let t=li.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function di(e,t,n=1){`${e}`;let[r,i]=ui(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return Fe(e)?parseFloat(e):e}return kt(i)?di(i,t,n+1):i}function fi(e,t){return e?.[t]??e?.default??e}var pi=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...xr]),mi={test:e=>e===`auto`,parse:e=>e},hi=e=>t=>t.test(e),gi=[jt,q,qt,Kt,Yt,Jt,mi],_i=e=>gi.find(hi(e));function vi(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||Le(e)}var yi=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function bi(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(Ft)||[];if(!r)return e;let i=n.replace(r,``),a=yi.has(t)?1:0;return r!==n&&(a*=100),t+`(`+a+i+`)`}var xi=/\b([a-z-]*)\(.*?\)/gu,Si={...fn,getAnimatableNone:e=>{let t=e.match(xi);return t?t.map(bi).join(` `):e}},Ci={...jt,transform:Math.round},wi={borderWidth:q,borderTopWidth:q,borderRightWidth:q,borderBottomWidth:q,borderLeftWidth:q,borderRadius:q,radius:q,borderTopLeftRadius:q,borderTopRightRadius:q,borderBottomRightRadius:q,borderBottomLeftRadius:q,width:q,maxWidth:q,height:q,maxHeight:q,top:q,right:q,bottom:q,left:q,padding:q,paddingTop:q,paddingRight:q,paddingBottom:q,paddingLeft:q,margin:q,marginTop:q,marginRight:q,marginBottom:q,marginLeft:q,backgroundPositionX:q,backgroundPositionY:q,rotate:Kt,rotateX:Kt,rotateY:Kt,rotateZ:Kt,scale:Nt,scaleX:Nt,scaleY:Nt,scaleZ:Nt,skew:Kt,skewX:Kt,skewY:Kt,distance:q,translateX:q,translateY:q,translateZ:q,x:q,y:q,z:q,perspective:q,transformPerspective:q,opacity:Mt,originX:Xt,originY:Xt,originZ:q,zIndex:Ci,fillOpacity:Mt,strokeOpacity:Mt,numOctaves:Ci},Ti={...wi,color:J,backgroundColor:J,outlineColor:J,fill:J,stroke:J,borderColor:J,borderTopColor:J,borderRightColor:J,borderBottomColor:J,borderLeftColor:J,filter:Si,WebkitFilter:Si},Ei=e=>Ti[e];function Di(e,t){let n=Ei(e);return n!==Si&&(n=fn),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var Oi=new Set([`auto`,`none`,`0`]);function ki(e,t,n){let r=0,i;for(;r{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}};function ji(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}var Mi=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function Ni(e){return Ie(e)&&`offsetHeight`in e}var Pi=30,Fi=e=>!isNaN(parseFloat(e)),Ii={current:void 0},Li=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=wt.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=wt.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Fi(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new Ue);let n=this.events[e].add(t);return e===`change`?()=>{n(),G.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return Ii.current&&Ii.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=wt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Pi)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,Pi);return Ke(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Ri(e,t){return new Li(e,t)}var{schedule:zi,cancel:Bi}=yt(queueMicrotask,!1),Vi={x:!1,y:!1};function Hi(){return Vi.x||Vi.y}function Ui(e){return e===`x`||e===`y`?Vi[e]?null:(Vi[e]=!0,()=>{Vi[e]=!1}):Vi.x||Vi.y?null:(Vi.x=Vi.y=!0,()=>{Vi.x=Vi.y=!1})}function Wi(e,t){let n=ji(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function Gi(e){return!(e.pointerType===`touch`||Hi())}function Ki(e,t,n={}){let[r,i,a]=Wi(e,n),o=e=>{if(!Gi(e))return;let{target:n}=e,r=t(n,e);if(typeof r!=`function`||!n)return;let a=e=>{Gi(e)&&(r(e),n.removeEventListener(`pointerleave`,a))};n.addEventListener(`pointerleave`,a,i)};return r.forEach(e=>{e.addEventListener(`pointerenter`,o,i)}),a}var qi=(e,t)=>t?e===t?!0:qi(e,t.parentElement):!1,Ji=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,Yi=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function Xi(e){return Yi.has(e.tagName)||e.tabIndex!==-1}var Zi=new WeakSet;function Qi(e){return t=>{t.key===`Enter`&&e(t)}}function $i(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var ea=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=Qi(()=>{if(Zi.has(n))return;$i(n,`down`);let e=Qi(()=>{$i(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>$i(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function ta(e){return Ji(e)&&!Hi()}function na(e,t,n={}){let[r,i,a]=Wi(e,n),o=e=>{let r=e.currentTarget;if(!ta(e))return;Zi.add(r);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),Zi.has(r)&&Zi.delete(r),ta(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||qi(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),Ni(e)&&(e.addEventListener(`focus`,e=>ea(e,i)),!Xi(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function ra(e){return Ie(e)&&`ownerSVGElement`in e}function ia(e){return ra(e)&&e.tagName===`svg`}var aa=e=>!!(e&&e.getVelocity),oa=[...gi,J,fn],sa=e=>oa.find(hi(e)),ca=(0,M.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function la(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function ua(...e){return t=>{let n=!1,r=e.map(e=>{let r=la(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t{let{width:e,height:c,top:l,left:u,right:d}=o.current;if(t||!a.current||!e||!c)return;let f=n===`left`?`left: ${u}`:`right: ${d}`;a.current.dataset.motionPopId=i;let p=document.createElement(`style`);s&&(p.nonce=s);let m=r??document.head;return m.appendChild(p),p.sheet&&p.sheet.insertRule(` [data-motion-pop-id="${i}"] { position: absolute !important; width: ${e}px !important; diff --git a/dist/assets/EternalKlock-DzMJvrKv.js b/dist/assets/EternalKlock-DzMJvrKv.js deleted file mode 100644 index b935b5c9..00000000 --- a/dist/assets/EternalKlock-DzMJvrKv.js +++ /dev/null @@ -1 +0,0 @@ -import"./html2canvas-DKfOm221.js";import{n as e,t}from"./EternalKlock-BauRu4tr.js";import"./SigilModal-BVYbqxt6.js";import"./SealMomentModal-Bn7w_Hvo.js";export{t as EternalKlock,e as default}; \ No newline at end of file diff --git a/dist/assets/EternalKlock-xlhlR_nN.js b/dist/assets/EternalKlock-xlhlR_nN.js new file mode 100644 index 00000000..1b8f050e --- /dev/null +++ b/dist/assets/EternalKlock-xlhlR_nN.js @@ -0,0 +1 @@ +import"./html2canvas-D-AxDBo3.js";import{n as e,t}from"./EternalKlock-CdflKbWu.js";import"./SigilModal-Dm4zpSIO.js";import"./SealMomentModal-C7mxkSGB.js";export{t as EternalKlock,e as default}; \ No newline at end of file diff --git a/dist/assets/HomePriceChartCard-CrIv0mRN.js b/dist/assets/HomePriceChartCard-B_k89uIK.js similarity index 99% rename from dist/assets/HomePriceChartCard-CrIv0mRN.js rename to dist/assets/HomePriceChartCard-B_k89uIK.js index dc4546d3..4dded055 100644 --- a/dist/assets/HomePriceChartCard-CrIv0mRN.js +++ b/dist/assets/HomePriceChartCard-B_k89uIK.js @@ -1,4 +1,4 @@ -import{Tn as e,an as t,bt as n,jn as r,ln as i,tn as a,yt as o}from"./index-CgC-NZbJ.js";import{t as s}from"./prop-types-CRrLra82.js";var c=r(e(),1),l=`clover`,u=function(e){return e===3?`v3`:e},d=`https://js.stripe.com`,f=`${d}/${l}/stripe.js`,p=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,ee=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/,m=`loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used`,h=function(e){return p.test(e)||ee.test(e)},g=function(){for(var e=document.querySelectorAll(`script[src^="${d}"]`),t=0;t element.`);return r.appendChild(n),n},te=function(e,t){!e||!e._registerWrapper||e._registerWrapper({name:`stripe-js`,version:`8.6.0`,startTime:t})},v=null,y=null,b=null,x=function(e){return function(t){e(Error(`Failed to load Stripe.js`,{cause:t}))}},S=function(e,t){return function(){window.Stripe?e(window.Stripe):t(Error(`Stripe.js not available`))}},C=function(e){return v===null?(v=new Promise(function(t,n){if(typeof window>`u`||typeof document>`u`){t(null);return}if(window.Stripe&&e&&console.warn(m),window.Stripe){t(window.Stripe);return}try{var r=g();if(r&&e)console.warn(m);else if(!r)r=_(e);else if(r&&b!==null&&y!==null){var i;r.removeEventListener(`load`,b),r.removeEventListener(`error`,y),(i=r.parentNode)==null||i.removeChild(r),r=_(e)}b=S(t,n),y=x(n),r.addEventListener(`load`,b),r.addEventListener(`error`,y)}catch(e){n(e);return}}),v.catch(function(e){return v=null,Promise.reject(e)})):v},w=function(e,t,n){if(e===null)return null;var r=t[0].match(/^pk_test/),i=u(e.version),a=l;r&&i!==a&&console.warn(`Stripe.js@${i} was loaded on the page, but @stripe/stripe-js@8.6.0 expected Stripe.js@${a}. This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning`);var o=e.apply(void 0,t);return te(o,n),o},T,E=!1,D=function(){return T||(T=C(null).catch(function(e){return T=null,Promise.reject(e)}),T)};Promise.resolve().then(function(){return D()}).catch(function(e){E||console.warn(e)});var O=function(){var e=[...arguments];E=!0;var t=Date.now();return D().then(function(n){return w(n,e,t)})},k=r(s(),1);function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function j(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function re(e,t){if(e==null)return{};var n=ne(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ie(e,t){return P(e)||ae(e,t)||F(e,t)||oe()}function P(e){if(Array.isArray(e))return e}function ae(e,t){var n=e&&(typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`]);if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function F(e,t){if(e){if(typeof e==`string`)return I(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return I(e,t)}}function I(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n element.`);return r.appendChild(n),n},te=function(e,t){!e||!e._registerWrapper||e._registerWrapper({name:`stripe-js`,version:`8.6.0`,startTime:t})},v=null,y=null,b=null,x=function(e){return function(t){e(Error(`Failed to load Stripe.js`,{cause:t}))}},S=function(e,t){return function(){window.Stripe?e(window.Stripe):t(Error(`Stripe.js not available`))}},C=function(e){return v===null?(v=new Promise(function(t,n){if(typeof window>`u`||typeof document>`u`){t(null);return}if(window.Stripe&&e&&console.warn(m),window.Stripe){t(window.Stripe);return}try{var r=g();if(r&&e)console.warn(m);else if(!r)r=_(e);else if(r&&b!==null&&y!==null){var i;r.removeEventListener(`load`,b),r.removeEventListener(`error`,y),(i=r.parentNode)==null||i.removeChild(r),r=_(e)}b=S(t,n),y=x(n),r.addEventListener(`load`,b),r.addEventListener(`error`,y)}catch(e){n(e);return}}),v.catch(function(e){return v=null,Promise.reject(e)})):v},w=function(e,t,n){if(e===null)return null;var r=t[0].match(/^pk_test/),i=u(e.version),a=l;r&&i!==a&&console.warn(`Stripe.js@${i} was loaded on the page, but @stripe/stripe-js@8.6.0 expected Stripe.js@${a}. This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning`);var o=e.apply(void 0,t);return te(o,n),o},T,E=!1,D=function(){return T||(T=C(null).catch(function(e){return T=null,Promise.reject(e)}),T)};Promise.resolve().then(function(){return D()}).catch(function(e){E||console.warn(e)});var O=function(){var e=[...arguments];E=!0;var t=Date.now();return D().then(function(n){return w(n,e,t)})},k=r(s(),1);function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function j(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function re(e,t){if(e==null)return{};var n=ne(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ie(e,t){return P(e)||ae(e,t)||F(e,t)||oe()}function P(e){if(Array.isArray(e))return e}function ae(e,t){var n=e&&(typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`]);if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function F(e,t){if(e){if(typeof e==`string`)return I(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return I(e,t)}}function I(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n1&&arguments[1]!==void 0?arguments[1]:ue;if(e===null||V(e))return e;throw Error(t)},U=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ue;if(B(e))return{tag:`async`,stripePromise:Promise.resolve(e).then(function(e){return H(e,t)})};var n=H(e,t);return n===null?{tag:`empty`}:{tag:`sync`,stripe:n}},W=function(e){!e||!e._registerWrapper||!e.registerAppInfo||(e._registerWrapper({name:`react-stripe-js`,version:`5.4.1`}),e.registerAppInfo({name:`react-stripe-js`,version:`5.4.1`,url:`https://stripe.com/docs/stripe-js/react`}))},G=c.createContext(null);G.displayName=`ElementsContext`;var de=function(e,t){if(!e)throw Error(`Could not find Elements context; You need to wrap the part of your app that ${t} in an provider.`);return e},K=function(e){var t=e.stripe,n=e.options,r=e.children,i=c.useMemo(function(){return U(t)},[t]),a=ie(c.useState(function(){return{stripe:i.tag===`sync`?i.stripe:null,elements:i.tag===`sync`?i.stripe.elements(n):null}}),2),o=a[0],s=a[1];c.useEffect(function(){var e=!0,t=function(e){s(function(t){return t.stripe?t:{stripe:e,elements:e.elements(n)}})};return i.tag===`async`&&!o.stripe?i.stripePromise.then(function(n){n&&e&&t(n)}):i.tag===`sync`&&!o.stripe&&t(i.stripe),function(){e=!1}},[i,o,n]);var l=R(t);c.useEffect(function(){l!==null&&l!==t&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")},[l,t]);var u=R(n);return c.useEffect(function(){if(o.elements){var e=le(n,u,[`clientSecret`,`fonts`]);e&&o.elements.update(e)}},[n,u,o.elements]),c.useEffect(function(){W(o.stripe)},[o.stripe]),c.createElement(G.Provider,{value:o},r)};K.propTypes={stripe:k.default.any,options:k.default.object};var fe=function(e){return de(c.useContext(G),e)},pe=function(){return fe(`calls useElements()`).elements},me=function(e){var t=e.children;return t(fe(`mounts `))};me.propTypes={children:k.default.func.isRequired};var q=c.createContext(null);q.displayName=`CheckoutContext`,k.default.any,k.default.shape({clientSecret:k.default.oneOfType([k.default.string,k.default.instanceOf(Promise)]).isRequired,elementsOptions:k.default.object}).isRequired;var J=function(e){var t=c.useContext(q),n=c.useContext(G);if(t){if(n)throw Error(`You cannot wrap the part of your app that ${e} in both and providers.`);return t}else return de(n,e)},Y=[`mode`],he=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},X=function(e,t){var n=`${he(e)}Element`,r=t?function(e){J(`mounts <${n}>`);var t=e.id,r=e.className;return c.createElement(`div`,{id:t,className:r})}:function(t){var r=t.id,i=t.className,a=t.options,o=a===void 0?{}:a,s=t.onBlur,l=t.onFocus,u=t.onReady,d=t.onChange,f=t.onEscape,p=t.onClick,ee=t.onLoadError,m=t.onLoaderStart,h=t.onNetworksChange,g=t.onConfirm,_=t.onCancel,te=t.onShippingAddressChange,v=t.onShippingRateChange,y=t.onSavedPaymentMethodRemove,b=t.onSavedPaymentMethodUpdate,x=J(`mounts <${n}>`),S=`elements`in x?x.elements:null,C=`checkoutState`in x?x.checkoutState:null,w=C?.type===`success`||C?.type===`loading`?C.sdk:null,T=ie(c.useState(null),2),E=T[0],D=T[1],O=c.useRef(null),k=c.useRef(null);L(E,`blur`,s),L(E,`focus`,l),L(E,`escape`,f),L(E,`click`,p),L(E,`loaderror`,ee),L(E,`loaderstart`,m),L(E,`networkschange`,h),L(E,`confirm`,g),L(E,`cancel`,_),L(E,`shippingaddresschange`,te),L(E,`shippingratechange`,v),L(E,`savedpaymentmethodremove`,y),L(E,`savedpaymentmethodupdate`,b),L(E,`change`,d);var A;u&&(A=e===`expressCheckout`?u:function(){u(E)}),L(E,`ready`,A),c.useLayoutEffect(function(){if(O.current===null&&k.current!==null&&(S||w)){var t=null;if(w)switch(e){case`paymentForm`:t=w.createPaymentFormElement();break;case`payment`:t=w.createPaymentElement(o);break;case`address`:if(`mode`in o){var r=o.mode,i=re(o,Y);if(r===`shipping`)t=w.createShippingAddressElement(i);else if(r===`billing`)t=w.createBillingAddressElement(i);else throw Error(`Invalid options.mode. mode must be 'billing' or 'shipping'.`)}else throw Error(`You must supply options.mode. mode must be 'billing' or 'shipping'.`);break;case`expressCheckout`:t=w.createExpressCheckoutElement(o);break;case`currencySelector`:t=w.createCurrencySelectorElement();break;case`taxId`:t=w.createTaxIdElement(o);break;default:throw Error(`Invalid Element type ${n}. You must use either the , , , or .`)}else S&&(t=S.create(e,o));O.current=t,D(t),t&&t.mount(k.current)}},[S,w,o]);var j=R(o);return c.useEffect(function(){if(O.current){var e=le(o,j,[`paymentRequest`]);e&&`update`in O.current&&O.current.update(e)}},[o,j]),c.useLayoutEffect(function(){return function(){if(O.current&&typeof O.current.destroy==`function`)try{O.current.destroy(),O.current=null}catch{}}},[]),c.createElement(`div`,{id:r,className:i,ref:k})};return r.propTypes={id:k.default.string,className:k.default.string,onChange:k.default.func,onBlur:k.default.func,onFocus:k.default.func,onReady:k.default.func,onEscape:k.default.func,onClick:k.default.func,onLoadError:k.default.func,onLoaderStart:k.default.func,onNetworksChange:k.default.func,onConfirm:k.default.func,onCancel:k.default.func,onShippingAddressChange:k.default.func,onShippingRateChange:k.default.func,onSavedPaymentMethodRemove:k.default.func,onSavedPaymentMethodUpdate:k.default.func,options:k.default.object},r.displayName=n,r.__elementType=e,r},Z=typeof window>`u`,ge=c.createContext(null);ge.displayName=`EmbeddedCheckoutProviderContext`;var _e=function(){return J(`calls useStripe()`).stripe};X(`auBankAccount`,Z),X(`card`,Z),X(`cardNumber`,Z),X(`cardExpiry`,Z),X(`cardCvc`,Z),X(`iban`,Z);var ve=X(`payment`,Z);X(`expressCheckout`,Z),X(`paymentRequestButton`,Z),X(`linkAuthentication`,Z),X(`address`,Z),X(`shippingAddress`,Z),X(`paymentMethodMessaging`,Z),X(`taxId`,Z);var Q=r(a(),1),ye=i,$=e=>globalThis[e],be=()=>{let e=$(`kaiPulseNowBridge`)??$(`kaiPulseNow`);return typeof e==`function`?e():(performance.timeOrigin+performance.now()-t)/i},xe=(e,t,n)=>Math.max(t,Math.min(n,e)),Se=e=>Math.round(e*100)/100,Ce=e=>e.toLocaleString(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2}),we=(e,t)=>{let n=(1+Math.sqrt(5))/2,r=Math.sin(2*Math.PI*e/44)*.85,i=Math.sin(2*Math.PI*n*e)*.42,a=Math.sin(2*Math.PI*(n-1)*e)*.28,o=Math.sin(e*.1618)*.35;return Se(t+r+i+a+o)},Te=e=>xe(.35+.65*Math.abs(Math.sin(2*Math.PI*e/11)),0,1),Ee=Object.freeze([]),De=Object.freeze([]),Oe=` .kai-price-wrap { font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Apple Color Emoji","Segoe UI Emoji"; color: #e7fbf7; } .kai-price-chart { display:block; width:100%; height:auto; } diff --git a/dist/assets/KaiRealms-BZxV3JLS.js b/dist/assets/KaiRealms-DO28buUy.js similarity index 99% rename from dist/assets/KaiRealms-BZxV3JLS.js rename to dist/assets/KaiRealms-DO28buUy.js index 1f6e4f89..ddd84085 100644 --- a/dist/assets/KaiRealms-BZxV3JLS.js +++ b/dist/assets/KaiRealms-DO28buUy.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/bundler-BoMe-K_2.js","assets/index-CgC-NZbJ.js","assets/index-BmaJNTKf.css"])))=>i.map(i=>d[i]); -import{t as e}from"./x-n_FrfVOz.js";import{Bt as t,Ht as n,Sn as r,Tn as i,an as a,jn as o,ln as s,mn as c,t as l,tn as u}from"./index-CgC-NZbJ.js";var d=o(i(),1);function f(e){return typeof e==`string`?e.toLowerCase():``}function p(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function m(e){return typeof e==`string`&&e.length>0}function h(e){return typeof e==`number`&&Number.isFinite(e)}function g(e){if(typeof e!=`object`||!e)throw Error(`Malformed sigil metadata.`);let t=e;for(let e of[`pulse`,`beat`,`stepIndex`,`chakraDay`])if(!p(t,e))throw Error(`Missing Kai field: ${e}`);if(!p(t,`kaiSignature`))throw Error(`Invalid Kai Signature — tampered or unsigned sigil.`);if(!h(t.pulse))throw Error(`Invalid field: pulse`);if(!h(t.beat))throw Error(`Invalid field: beat`);if(!h(t.stepIndex))throw Error(`Invalid field: stepIndex`);if(!m(t.chakraDay))throw Error(`Invalid field: chakraDay`);if(!m(t.kaiSignature))throw Error(`Invalid field: kaiSignature`)}function _(e){try{let t=new DOMParser().parseFromString(e,`image/svg+xml`),n=Array.from(t.getElementsByTagName(`metadata`)),r=[`valuation`,`ledger`,`dht`,`source`];for(let e of n){let t=e.getAttribute(`id`)??``;if(r.some(e=>t.includes(e)))continue;let n=(e.textContent??``).trim();if(!n)continue;let i=n.replace(/^$/,``);try{let e=JSON.parse(i);if(typeof e==`object`&&e&&p(e,`pulse`)&&p(e,`beat`)&&p(e,`stepIndex`)&&p(e,`chakraDay`)&&p(e,`kaiSignature`))return e}catch{}}return null}catch{return null}}async function v(e){let r=await e.text(),{meta:i,contextOk:a,typeOk:o}=await l(e),s=i&&p(i,`kaiSignature`)&&p(i,`pulse`)?i:_(r);if(!s||!a||!o)throw Error(`Invalid glyph or missing metadata.`);g(s);let c=s,u=await t(c);if(!u||f(u)!==f(c.kaiSignature))throw Error(`Invalid Kai Signature — tampered or unsigned sigil.`);let d=await n(c.kaiSignature);if(typeof c.userPhiKey==`string`){if(f(c.userPhiKey)!==f(d))throw Error(`Φ-Key mismatch — identity invalid.`)}else c.userPhiKey=d;return{svgText:r,meta:c,phiKey:d}}var y=o(u(),1),b=`.svg,image/svg+xml`,x=({onEnter:e})=>{let t=(0,d.useRef)(null),[n,r]=(0,d.useState)(!1),[i,a]=(0,d.useState)(!1),[o,s]=(0,d.useState)(``),[c,l]=(0,d.useState)(null),u=(0,d.useId)(),f=(0,d.useId)(),p=(0,d.useId)(),m=()=>{t.current&&(t.current.value=``)},h=(0,d.useCallback)(async t=>{l(null),s(t.name),a(!0);try{if(!(t.type===`image/svg+xml`||t.name.toLowerCase().endsWith(`.svg`)))throw Error(`Please upload a valid Kai Sigil (.svg).`);e(await v(t))}catch(e){l(e instanceof Error?e.message:`Invalid glyph or missing metadata.`)}finally{a(!1),m()}},[e]),g=(0,d.useCallback)(async e=>{let t=e.target.files?.[0];t&&await h(t)},[h]),_=(0,d.useCallback)(async e=>{e.preventDefault(),e.stopPropagation(),r(!1);let t=e.dataTransfer.files?.[0];t&&await h(t)},[h]),x=e=>{e.preventDefault(),e.dataTransfer.dropEffect=`copy`,n||r(!0)},S=e=>{e.currentTarget.contains(e.relatedTarget)||r(!1)},C=()=>t.current?.click(),w=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),C())};return(0,y.jsxs)(`section`,{className:`portal-card glass-omni`,"aria-labelledby":u,"aria-describedby":f,children:[(0,y.jsx)(`div`,{className:`breath-ring breath-ring--outer`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`breath-ring breath-ring--inner`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`phi-grid`,"aria-hidden":!0}),(0,y.jsx)(`h1`,{id:u,className:`sr-only`,children:`Drop your Kai Sigil`}),(0,y.jsxs)(`div`,{className:`portal-body`,children:[(0,y.jsxs)(`div`,{className:`dropzone ${n?`dropzone--active`:``} ${i?`dropzone--busy`:``}`,role:`button`,tabIndex:0,onKeyDown:w,onClick:C,onDrop:_,onDragOver:x,onDragLeave:S,"aria-busy":i,"aria-describedby":`${f}${c?` ${p}`:``}`,children:[(0,y.jsxs)(`div`,{className:`dropzone-ornament`,"aria-hidden":!0,children:[(0,y.jsx)(`div`,{className:`ornament-ring ornament-ring--outer`}),(0,y.jsx)(`div`,{className:`ornament-ring ornament-ring--inner`}),(0,y.jsx)(`div`,{className:`ornament-core`})]}),(0,y.jsx)(`div`,{className:`dropzone-icon`,"aria-hidden":!0,children:(0,y.jsxs)(`svg`,{width:`44`,height:`44`,viewBox:`0 0 44 44`,children:[(0,y.jsx)(`defs`,{children:(0,y.jsxs)(`linearGradient`,{id:`dzG`,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,y.jsx)(`stop`,{offset:`0%`,stopColor:`#00ffd0`}),(0,y.jsx)(`stop`,{offset:`100%`,stopColor:`#8a2be2`})]})}),(0,y.jsx)(`circle`,{cx:`22`,cy:`22`,r:`20`,fill:`none`,stroke:`url(#dzG)`,strokeWidth:`1.5`}),(0,y.jsx)(`path`,{d:`M22 12 L22 30 M14 20 L22 12 L30 20`,stroke:`url(#dzG)`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`})]})}),(0,y.jsxs)(`div`,{className:`dropzone-text`,children:[(0,y.jsx)(`div`,{className:`dz-title`,children:`Inhale your Kai Sigil`}),(0,y.jsxs)(`div`,{id:f,className:`dz-hint`,children:[`Breath-minted `,(0,y.jsx)(`strong`,{children:`Φkey`}),` only. Drag & drop.`]}),o&&!i&&!c?(0,y.jsxs)(`div`,{className:`dz-file`,children:[`Selected: `,o]}):null,i?(0,y.jsxs)(`div`,{className:`dz-progress`,children:[(0,y.jsx)(`div`,{className:`dz-spinner`}),(0,y.jsx)(`span`,{children:`Verifying…`})]}):null]}),(0,y.jsx)(`input`,{ref:t,type:`file`,accept:b,onChange:g,tabIndex:-1,"aria-hidden":!0,className:`dz-input`})]}),c?(0,y.jsx)(`div`,{id:p,className:`portal-error`,role:`alert`,"aria-live":`polite`,children:c}):null,(0,y.jsx)(`p`,{className:`portal-note`,children:`Your sigil is verified by breath. No drift. Only truth.`})]}),(0,y.jsx)(`span`,{className:`sr-only`,children:`Kai Realms sigil gate ready.`})]})},S=typeof window<`u`,C=11n,w=44n,T=36n;function E(e){let t=BigInt(a),n=BigInt(s),r=(e>t?e-t:0n)/n,i=r/C%w,o=r/(C*w)%T;return{pulseIndex:Number(r),stepIndex:Number(i),beatIndex:Number(o)}}function D(e){let t=BigInt(a),n=BigInt(s);return t+((e>t?e-t:0n)/n+1n)*n}function ee(e){let t=(0,d.useRef)(null),n=(0,d.useRef)(e);n.current=e,(0,d.useEffect)(()=>{if(!S)return;let e=null,r=!1,i=()=>{if(r)return;let a=c(),{pulseIndex:o,stepIndex:s,beatIndex:l}=E(a);o!==t.current&&(n.current.onPulse?.(o),o%Number(C)===0&&n.current.onStep?.(s),o%Number(C*w)===0&&n.current.onBeat?.(l),t.current=o);let u=D(a),d=u>a?u-a:0n,f=Number(d);e=window.setTimeout(i,f)};return i(),()=>{r=!0,e!==null&&window.clearTimeout(e)}},[])}var O={Root:`#FF0033`,Sacral:`#FF8000`,Solar:`#FFD700`,Heart:`#00FF99`,Throat:`#33CCFF`,ThirdEye:`#9933FF`,Crown:`#AA00FF`};function k(e,t,n,r,i){e.save(),e.translate(n,r);let{chakraDay:a,pulse:o}=t.meta,s=O[a]??`#00FFFF`;e.beginPath(),e.arc(0,0,i+4,0,Math.PI*2),e.fillStyle=s,e.shadowColor=s,e.shadowBlur=15,e.fill(),e.beginPath(),e.arc(0,0,i,0,Math.PI*2),e.fillStyle=`#000012`,e.fill();let c=i+o%11*1.5;e.beginPath(),e.arc(0,0,c,0,Math.PI*2),e.strokeStyle=`${s}AA`,e.lineWidth=1.5,e.stroke(),e.restore()}function A(e){return typeof e==`object`&&!!e}function j(e){if(typeof e==`bigint`)return e;if(typeof e==`number`&&Number.isFinite(e)&&Number.isSafeInteger(e))return BigInt(e);if(typeof e==`string`)try{return BigInt(e)}catch{return null}return null}var M=`kai:game:focus`,N=typeof window<`u`;function P(){if(!N||typeof BroadcastChannel>`u`)return null;try{return new BroadcastChannel(`kai-realms-game-focus`)}catch{return null}}function te(e){let t={id:e,ts:c()};if(N)try{window.dispatchEvent(new CustomEvent(M,{detail:t}))}catch{}let n=P();if(n)try{n.postMessage({type:M,detail:{id:t.id,ts:t.ts.toString()}})}catch{}finally{try{n.close()}catch{}}}function F(e){if(!A(e))return null;let t=e.id,n=j(e.ts);return typeof t!=`string`||n===null?null:{id:t,ts:n}}function ne(e){let t=t=>{let n=F(t?.detail);n&&e(n)};N&&window.addEventListener(M,t);let n=P(),r=t=>{let n=t?.data;if(!A(n)||n.type!==M)return;let r=F(n.detail);r&&e(r)};if(n)try{n.addEventListener(`message`,r)}catch{}return()=>{if(N&&window.removeEventListener(M,t),n)try{n.removeEventListener(`message`,r)}catch{}finally{try{n.close()}catch{}}}}function re(e){let[t,n]=(0,d.useState)(!1),r=(0,d.useRef)(0n);return(0,d.useEffect)(()=>ne(t=>{n(t.id!==e),r.current=t.ts}),[e]),{paused:t,takeFocus:(0,d.useCallback)(()=>{te(e),n(!1)},[e])}}var I=5236,L=.085,R=1,ie=60,ae=6.1,oe=5.6,se=.1,ce=1.6,le=10,ue=50,de=150,fe=10,pe=Math.floor(I*1.25),me=.145,he=2.618,ge=I,z=I,_e=1e3,ve=.12,B=44,ye=.618,be=.35,xe=3,Se=`600 12px ui-sans-serif,system-ui,-apple-system`,V={up:{x:0,y:-1},down:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0},none:{x:0,y:0}},H={up:`down`,down:`up`,left:`right`,right:`left`,none:`none`};function Ce(e,t,n){return e+(t-e)*n}function U(e,t){return(e-t+I)%I/I}function we(e){let t=Math.sin(Math.PI*e);return .78+.44*(t*t)}function Te(e){let t=e.toLowerCase();return t===`arrowup`||t===`w`?`up`:t===`arrowdown`||t===`s`?`down`:t===`arrowleft`||t===`a`?`left`:t===`arrowright`||t===`d`?`right`:`none`}function W(e,t,n){let r=Math.round(n),i=Math.round(t);return r<0||r>=e.length||i<0||i>=e[0].length?!1:e[r][i]!==1}function G(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function K(e,t){let n=e.x-t.x,r=e.y-t.y;return n*n+r*r}function Ee(){let e=Array.from({length:23},()=>Array(27).fill(1));((t,n,r,i)=>{for(let a=n;a0&&a<22&&n>0&&n<26&&(e[a][n]=0)})(1,1,25,21);for(let t=2;t<25;t++)e[5][t]=1,e[17][t]=1;for(let t=2;t<21;t++)e[t][4]=1,e[t][22]=1;for(let t=6;t<21;t++)e[11][t]=0;for(let t=4;t<19;t++)e[t][13]=0;for(let t=1;t<22;t++)for(let n=1;n<26;n++)e[t][n]===0&&(e[t][n]=2);for(let t of[{x:6,y:6},{x:20,y:6},{x:6,y:16},{x:20,y:16}])e[t.y][t.x]=3;for(let t of[{x:2,y:2},{x:24,y:2},{x:2,y:20},{x:24,y:20}])e[t.y]?.[t.x]!==1&&(e[t.y][t.x]=4);return e}function De(e){return{pos:{x:e.x,y:e.y},dir:`left`,next:`left`,speed:ae}}function q(e,t,n){return{pos:{x:e.x,y:e.y},dir:`left`,speed:oe,scatterTarget:n,mode:`chase`,frightUntil:0,color:t}}function Oe(e){let t=0;for(let n=0;n=.1||i>=.1)return!1;let a=0;return[`up`,`down`,`left`,`right`].forEach(t=>{W(e,n.x+V[t].x,n.y+V[t].y)&&a++}),a>=3}function Me(e,t){if(t.next===`none`||t.next===t.dir)return;if(t.next===H[t.dir]){t.dir=t.next;return}let n=G(t.pos),r=Math.abs(t.pos.x-n.x),i=Math.abs(t.pos.y-n.y);r>=.12||i>=.12||W(e,n.x+V[t.next].x,n.y+V[t.next].y)&&(t.pos.x=n.x,t.pos.y=n.y,t.dir=t.next)}function Ne(e,t,n,r,i){if(n===`none`)return;let a=V[n],o=t.x+a.x*r*i,s=t.y+a.y*r*i,c=e[0].length;if(o<-1){t.x=c+1;return}if(o>c+1){t.x=-1;return}if(W(e,Math.round(o),Math.round(s)))t.x=o,t.y=s;else{let e=G(t);t.x=e.x,t.y=e.y}}function Pe(e,t,n,r){let i=[`up`,`left`,`down`,`right`],a=n,o=1/0;for(let s of i){if(s===H[n])continue;let i=Math.round(t.x)+V[s].x,c=Math.round(t.y)+V[s].y;if(!W(e,i,c))continue;let l=K({x:i,y:c},r);l{let r=(0,d.useRef)(null),i=(0,d.useRef)(null),{paused:a,takeFocus:o}=re(`KaiMaze`),[s,c]=(0,d.useState)({w:0,h:0});(0,d.useEffect)(()=>{let e=r.current;if(!e)return;let t=new ResizeObserver(e=>{for(let t of e){let e=t.contentRect;c({w:e.width,h:e.height})}});return t.observe(e),()=>t.disconnect()},[]);let[l,u]=(0,d.useState)(e);(0,d.useEffect)(()=>u(e),[e]);let[f,p]=(0,d.useState)(()=>ke(1,performance.now())),m=(0,d.useRef)(performance.now()),[h,g]=(0,d.useState)(()=>{if(typeof window>`u`)return!1;let e=window.matchMedia?.(`(pointer: coarse)`)?.matches??!1,t=window.matchMedia?.(`(max-width: 900px)`)?.matches??!1;return e||t});(0,d.useEffect)(()=>{if(typeof window>`u`)return;let e=window.matchMedia(`(pointer: coarse)`),t=window.matchMedia(`(max-width: 900px)`),n=()=>g(e.matches||t.matches);return e.addEventListener?.(`change`,n),t.addEventListener?.(`change`,n),()=>{e.removeEventListener?.(`change`,n),t.removeEventListener?.(`change`,n)}},[]);let _=(0,d.useMemo)(()=>e=>Math.floor(_e*(1+ve*(e-1))),[]),v=(0,d.useMemo)(()=>h&&!f.over,[h,f.over]),b=(0,d.useMemo)(()=>(h?`Tap/Swipe or D-pad`:`←↑→↓ / WASD`)+` · B/Space to Channel on ⟐ · Esc to exit`,[h]);(0,d.useEffect)(()=>{if(R>0&&l>=R){let e=l-R;u(e),t(e),o()}},[]);let x=()=>{p(e=>e.channelingUntil?{...e,channelingUntil:0}:e)};(0,d.useEffect)(()=>{let e=e=>{let t=e.key.toLowerCase(),r=Te(t);r!==`none`&&(x(),e.preventDefault(),o(),p(e=>({...e,player:{...e.player,next:r}}))),(t===`b`||t===` `)&&f.onAltar&&f.channelingUntil===0&&(o(),p(e=>({...e,channelingUntil:performance.now()+z}))),t===`escape`&&n&&n(),t===`r`&&f.over&&(o(),p(ke(1,performance.now())),m.current=performance.now())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,f.over,f.onAltar,f.channelingUntil]);let S=e=>{x(),o(),p(t=>({...t,player:{...t.player,next:e}}))},C=()=>{f.onAltar&&f.channelingUntil===0&&(o(),p(e=>({...e,channelingUntil:performance.now()+z})))};(0,d.useEffect)(()=>{let e=0,n=performance.now(),r=(e,n)=>{if(n.channelingUntil===0||!n.onAltar||e0){let e=Math.floor(a*r),i=Math.max(0,n.bankable-e),o=l+a;return u(o),t(o),{...n,scorePhi:n.scorePhi+a,bankable:i,points:i,kaiCharge:Math.max(0,Math.floor(n.kaiCharge*.5)),channelingUntil:0}}return{...n,channelingUntil:0}},i=()=>{e=requestAnimationFrame(i);let o=performance.now(),s=Math.min(1/ie,(o-n)/1e3);n=o,!a&&p(e=>{if(e.over)return e;let n=structuredClone(e);if(o>=n.cycle.nextSwitchAt){let e=n.cycle.phase===`chase`?`scatter`:`chase`;n.cycle={phase:e,nextSwitchAt:o+Ae(n.level,e)};for(let t of n.ghosts)t.mode!==`fright`&&(t.mode=e)}let i=U(o,m.current),a=we(i),c=Math.min(1+n.streak*se,ce),d=Math.min(1+n.streak*me,he),f=n.channelingUntil>0?0:n.player.speed*a*c;Me(n.grid,n.player),Ne(n.grid,n.player.pos,n.player.dir,f,s);let p=G(n.player.pos);n.onAltar=n.grid[p.y]?.[p.x]===4;let h=n.grid[p.y]?.[p.x]??1;if((h===2||h===3)&&n.channelingUntil===0){let e=Math.abs(i-.5)<=L,t=h===2?le:ue;if(e&&(t+=fe,n.kaiCharge=Math.min(B,n.kaiCharge+1)),t=Math.floor(t*d),n.points+=t,n.bankable=n.points,n.streak+=1,n.streak>n.bestStreak&&(n.bestStreak=n.streak),n.comboUntil=o+pe,n.grid[p.y][p.x]=0,n.pellets=Math.max(0,n.pellets-1),h===3){m.current=o;let e=Math.max(ge*Math.max(.55,1-(n.level-1)*.08),I*.5);for(let t of n.ghosts)t.mode=`fright`,t.frightUntil=o+e}}n.comboUntil>0&&o>n.comboUntil&&(n.streak=Math.max(0,Math.floor(n.streak*.5)),n.comboUntil=0);for(let e of n.ghosts){e.mode===`fright`&&o>=e.frightUntil&&(e.mode=n.cycle.phase);let t=G(n.player.pos);if(je(n.grid,e.pos))if(e.mode===`scatter`)e.dir=Pe(n.grid,e.pos,e.dir,e.scatterTarget);else if(e.mode===`fright`){let r=G(e.pos),i=[`up`,`down`,`left`,`right`],a=e.dir,o=-1/0;for(let s of i){if(s===H[e.dir])continue;let i=r.x+V[s].x,c=r.y+V[s].y;if(!W(n.grid,i,c))continue;let l=K({x:i,y:c},t);l>o&&(o=l,a=s)}e.dir=a}else{let r={x:t.x+V[n.player.dir].x*2,y:t.y+V[n.player.dir].y*2};e.dir=Pe(n.grid,e.pos,e.dir,r)}let r=e.mode===`fright`?Ce(.6,.8,Math.sin(i*Math.PI)):a,c=e.speed*r;if(c*=1.06**(n.level-1),Ne(n.grid,e.pos,e.dir,c,s),K(n.player.pos,e.pos)<.4)if(e.mode===`fright`&&n.channelingUntil===0){let t=Math.floor(de*d);n.points+=t,n.bankable=n.points,n.streak+=1,n.streak>n.bestStreak&&(n.bestStreak=n.streak),n.comboUntil=o+pe,e.pos={...e.scatterTarget},e.dir=`left`,e.mode=`scatter`,e.frightUntil=0}else if(--n.lives,n.streak=0,n.comboUntil=0,n.points=Math.max(0,Math.floor(n.points*(1-be))),n.bankable=n.points,n.channelingUntil=0,n.lives<=0)n.alive=!1,n.over=!0;else{let e={x:Math.floor(n.grid[0].length/2),y:n.grid.length-4};n.player.pos={...e},n.player.dir=`left`,n.player.next=`left`;for(let e of n.ghosts)e.mode=`scatter`;m.current=o}}if(n.pellets<=0&&!n.over){let e=_(n.level),r=Math.floor(n.bankable*.2/e);if(r>0){let i=r*e,a=Math.max(0,n.bankable-i),o=l+r;u(o),t(o),n.scorePhi+=r,n.bankable=a,n.points=a}let i=ke(n.level+1,o);i.scorePhi=n.scorePhi,i.lives=Math.max(1,n.lives),i.bestStreak=Math.max(n.bestStreak,n.streak),i.player.speed=n.player.speed*1.06;for(let e of i.ghosts)e.speed*=1.06;return m.current=o,i}return n=r(o,n),n})};return e=requestAnimationFrame(i),()=>cancelAnimationFrame(e)},[t,l,a,_]),(0,d.useEffect)(()=>{let e=0,t=()=>{e=requestAnimationFrame(t);let n=i.current,o=r.current;if(!n||!o)return;let c=n.getContext(`2d`);if(!c)return;let u=Math.max(0,s.w),d=Math.max(0,s.h);if(u===0||d===0)return;let p=Math.min(2,window.devicePixelRatio||1);(n.width!==Math.floor(u*p)||n.height!==Math.floor(d*p))&&(n.width=Math.floor(u*p),n.height=Math.floor(d*p),n.style.width=`${u}px`,n.style.height=`${d}px`),c.setTransform(p,0,0,p,0,0);let h=f.grid.length,g=f.grid[0].length,_=Math.floor(Math.min(u/g,d/h)),v=_*g,y=_*h,b=Math.floor((u-v)/2),x=Math.floor((d-y)/2),S=c.createLinearGradient(0,0,0,d);S.addColorStop(0,`#07071a`),S.addColorStop(1,`#0c1231`),c.fillStyle=S,c.fillRect(0,0,u,d),Be(c,u,d);for(let e=0;e0&&f.onAltar){let e=1-Math.max(0,f.channelingUntil-w)/z,t=u/2;c.strokeStyle=`rgba(0,255,208,0.9)`,c.lineWidth=4,c.globalAlpha=.9,c.beginPath(),c.arc(t,34,16,-Math.PI/2,-Math.PI/2+e*Math.PI*2),c.stroke(),c.globalAlpha=1,c.font=`700 12px ui-sans-serif,system-ui,-apple-system`,c.fillText(`Channeling…`,t+16+8,38)}if(a&&!f.over){c.fillStyle=`rgba(0,0,0,0.35)`,c.fillRect(0,0,u,d),c.fillStyle=`#fff`,c.font=`700 16px ui-sans-serif,system-ui,-apple-system`;let e=`Paused — another Realm is active`;c.fillText(e,(u-c.measureText(e).width)/2,d/2)}if(f.over){c.fillStyle=`rgba(0,0,0,0.55)`,c.fillRect(0,0,u,d),c.fillStyle=`#fff`,c.font=`700 20px ui-sans-serif,system-ui,-apple-system`;let e=`Game Over — Press R to restart`;c.fillText(e,(u-c.measureText(e).width)/2,d/2)}};return e=requestAnimationFrame(t),()=>cancelAnimationFrame(e)},[f,l,s,a]);let w=f.onAltar&&f.channelingUntil===0;return(0,y.jsxs)(`div`,{className:`km-wrap`,role:`group`,"aria-label":`Kai-Maze`,onPointerDown:()=>o(),onTouchStart:()=>o(),onMouseDown:()=>o(),children:[(0,y.jsxs)(`div`,{className:`km-header`,children:[(0,y.jsx)(`div`,{className:`km-title`,children:`🌀 Kai-Maze`}),(0,y.jsx)(`div`,{className:`km-sub`,children:`Score on pulse, risk your points, then ⟐ channel to mint Φ.`})]}),(0,y.jsxs)(`div`,{className:`km-stage`,ref:r,children:[(0,y.jsx)(`canvas`,{ref:i,className:`km-canvas`}),v&&(0,y.jsxs)(`div`,{className:`km-dpad`,style:{position:`absolute`,left:12,bottom:12,width:132,height:132,display:`grid`,gridTemplateColumns:`repeat(3, 1fr)`,gridTemplateRows:`repeat(3, 1fr)`,gap:6,touchAction:`none`,userSelect:`none`,zIndex:4},"aria-label":`Directional pad`,children:[(0,y.jsx)(`div`,{}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:J,"aria-label":`Move up`,onPointerDown:e=>{e.preventDefault(),S(`up`)},children:`▲`}),(0,y.jsx)(`div`,{}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:J,"aria-label":`Move left`,onPointerDown:e=>{e.preventDefault(),S(`left`)},children:`◀`}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:{...J,opacity:.9},"aria-label":`Hold to Channel (if on altar)`,onPointerDown:e=>{e.preventDefault(),C()},title:`Channel one breath to convert points → Φ`,children:`⟐`}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:J,"aria-label":`Move right`,onPointerDown:e=>{e.preventDefault(),S(`right`)},children:`▶`}),(0,y.jsx)(`div`,{}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:J,"aria-label":`Move down`,onPointerDown:e=>{e.preventDefault(),S(`down`)},children:`▼`}),(0,y.jsx)(`div`,{})]}),w&&(0,y.jsx)(`button`,{className:`km-chan-btn`,onClick:()=>{o(),p(e=>e.channelingUntil?e:{...e,channelingUntil:performance.now()+z})},"aria-label":`Channel points into Phi`,title:`Channel one breath to convert points → Φ`,children:`⟐ CHANNEL`}),f.channelingUntil>0&&(0,y.jsx)(`button`,{className:`km-chan-cancel`,onClick:()=>{o(),p(e=>({...e,channelingUntil:0}))},"aria-label":`Cancel channeling`,title:`Cancel`,children:`Cancel`})]}),(0,y.jsxs)(`div`,{className:`km-footer`,children:[(0,y.jsx)(`button`,{className:`km-btn`,onClick:n,title:`Back`,children:`Back`}),(0,y.jsx)(`div`,{className:`km-hint`,children:b})]})]})};function Ie(e,t,n,r,i){e.save(),e.fillStyle=i,e.beginPath(),e.arc(t,n,r,0,Math.PI*2),e.fill(),e.strokeStyle=`rgba(255,255,255,0.35)`,e.lineWidth=1.25,e.stroke(),e.restore()}function Le(e,t,n,r,i){e.save(),e.fillStyle=i,e.beginPath(),e.arc(t,n,r,Math.PI,0),e.lineTo(t+r,n+r*.85),e.lineTo(t-r,n+r*.85),e.closePath(),e.fill(),e.fillStyle=`#fff`,e.beginPath(),e.arc(t-r*.35,n-r*.15,r*.16,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(t+r*.35,n-r*.15,r*.16,0,Math.PI*2),e.fill(),e.fillStyle=`rgba(0,0,0,0.7)`,e.beginPath(),e.arc(t-r*.3,n-r*.15,r*.08,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(t+r*.3,n-r*.15,r*.08,0,Math.PI*2),e.fill(),e.restore()}function Re(e,t,n){let r=Math.min(460,Math.max(220,t*.5)),i=t/2,a=r/2;e.save(),e.globalAlpha=.35,e.strokeStyle=`rgba(0,255,208,.6)`,e.lineWidth=2,e.beginPath(),e.moveTo(i-a,20),e.lineTo(i+a,20),e.stroke();let o=ze(r*L*2);e.globalAlpha=.2,e.fillStyle=`#ffd36e`,e.fillRect(i-o,17,o*2,6),e.globalAlpha=.9,e.fillStyle=`#00ffd0`;let s=i-a+n*r;e.beginPath(),e.arc(s,20,4,0,Math.PI*2),e.fill(),e.restore()}function ze(e){return e/2}function Be(e,t,n){e.save(),e.globalAlpha=.08,e.strokeStyle=`rgba(255,255,255,0.15)`,e.lineWidth=1;let r=t/2,i=n/2,a=(1+Math.sqrt(5))/2,o=4;for(let s=0;s<8;s++){let s=Math.min(t,n)/o;e.beginPath(),e.arc(r,i,s,-Math.PI/2,Math.PI),e.stroke(),o*=a}e.restore()}var J={background:`linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04))`,border:`1px solid rgba(255,255,255,0.25)`,borderRadius:10,color:`rgba(255,255,255,0.9)`,fontSize:18,lineHeight:1,padding:0,display:`flex`,alignItems:`center`,justifyContent:`center`,minWidth:36,minHeight:36,touchAction:`none`};(()=>{let e=Array.from({length:31},()=>Array.from({length:28},()=>2));for(let t=0;t<28;t++)e[0][t]=1,e[30][t]=1;for(let t=0;t<31;t++)e[t][0]=1,e[t][27]=1;for(let t=4;t<24;t+=6)for(let n=4;n<27;n+=6)e[n][t]=1,e[n][t+1]=1,e[n+1][t]=1,e[n+1][t+1]=1;for(let t=2;t<26;t++)e[15][t]=0;e[1][1]=3,e[1][26]=3,e[29][1]=3,e[29][26]=3;for(let t=2;t<29;t++)e[t][14]=0;for(let t=2;t<26;t++)e[11][t]=0;return e})();var Ve=5236,Y=3,He=Y*2,Ue=2,We=.15,Ge=220,Ke=60,qe=20;function Je(e){return(Math.imul(e^2654435769,2654435761)>>>0)%1e5/1e5}function Ye(e,t){let n=Math.abs(e-t)%360;return n>180&&(n=360-n),n}var Xe=({currentPhi:e,onPhiChange:t})=>{let[n,r]=(0,d.useState)(`forge`),[i,a]=(0,d.useState)(null),[o,s]=(0,d.useState)(performance.now()),[c,l]=(0,d.useState)(0),[u,f]=(0,d.useState)(!1),[p,m]=(0,d.useState)(null),[h,g]=(0,d.useState)(0);ee({onPulse:e=>{a(e),s(performance.now()),m(e=>e&&{...e,delta:e.delta})}}),(0,d.useEffect)(()=>{if(n!==`forge`)return;let e=0,t=!0,r=()=>{if(!t)return;let n=performance.now();l(Math.max(0,n-o)%Ve/Ve*360%360),e=requestAnimationFrame(r)};return e=requestAnimationFrame(r),()=>{t=!1,cancelAnimationFrame(e)}},[o,n]);let _=(0,d.useMemo)(()=>{let e=i??0,t=Math.floor(Je(e)*360),n=Ke+(e%2==0?qe:0)-Math.min(20,Math.floor(h*6));return{centerDeg:t,halfWidthDeg:Math.max(10,n/2)}},[i,h]),v=(0,d.useMemo)(()=>n===`forge`&&!u&&e>=Y&&i!==null,[n,u,e,i]),b=(0,d.useCallback)(e=>{let t=He,n=1+h*We,r=e?Ue:1;return Math.floor(t*n*r)},[h]),x=(0,d.useCallback)(()=>{if(!v)return;let n=e-Y;t(n),f(!0),m(null);let r=Ye(c,_.centerDeg),i=Math.max(4,_.halfWidthDeg*.25),a=r<=_.halfWidthDeg,o=a&&r<=i;window.setTimeout(()=>{if(a){let e=b(o);t(n+e),g(e=>e+1),m({kind:o?`crit`:`hit`,delta:e})}else g(0),m({kind:`miss`,delta:-Y});f(!1)},650)},[v,e,t,c,_.centerDeg,_.halfWidthDeg,b]);return(0,d.useEffect)(()=>{if(n!==`forge`)return;let e=e=>{let t=e.key.toLowerCase();(t===` `||t===`enter`)&&(e.preventDefault(),x())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,x]),(0,y.jsx)(`div`,{className:`pf-wrap`,role:`group`,"aria-label":`Pulse Forge`,children:n===`forge`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`pf-header`,children:[(0,y.jsx)(`div`,{className:`pf-title`,children:`⚒️ Pulse Forge`}),(0,y.jsx)(`div`,{className:`pf-sub`,children:`Time your lock to the target arc. Breathe, focus, forge.`}),(0,y.jsx)(`div`,{style:{marginLeft:`auto`,display:`flex`,gap:8},children:(0,y.jsx)(`button`,{type:`button`,className:`pf-lock-btn`,onClick:()=>r(`maze`),title:`Switch to Kai-Maze`,children:`Play Kai-Maze`})})]}),(0,y.jsxs)(`div`,{className:`pf-board`,children:[(0,y.jsxs)(`div`,{className:`pf-dial`,style:{width:Ge,height:Ge},children:[(0,y.jsx)(`div`,{className:`pf-arc`,style:{"--arc-center":`${_.centerDeg}deg`,"--arc-half":`${_.halfWidthDeg}deg`},"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`pf-marker ${u?`pf-marker--lock`:``}`,style:{transform:`rotate(${c}deg)`},"aria-hidden":!0,children:(0,y.jsx)(`div`,{className:`pf-marker-head`})}),(0,y.jsx)(`div`,{className:`pf-rim`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`pf-ticks`,"aria-hidden":!0,children:Array.from({length:12}).map((e,t)=>(0,y.jsx)(`span`,{style:{transform:`rotate(${t*30}deg)`}},t))})]}),(0,y.jsxs)(`div`,{className:`pf-hud`,children:[(0,y.jsxs)(`div`,{className:`pf-chip`,title:`Your Φ`,children:[(0,y.jsx)(`span`,{className:`pf-chip__label`,children:`Φ`}),(0,y.jsx)(`span`,{className:`pf-chip__val`,children:e})]}),(0,y.jsxs)(`div`,{className:`pf-chip`,title:`Streak`,children:[(0,y.jsx)(`span`,{className:`pf-chip__label`,children:`Streak`}),(0,y.jsx)(`span`,{className:`pf-chip__val`,children:h})]}),(0,y.jsxs)(`div`,{className:`pf-chip`,title:`Pulse`,children:[(0,y.jsx)(`span`,{className:`pf-chip__label`,children:`Pulse`}),(0,y.jsx)(`span`,{className:`pf-chip__val`,children:i??`—`})]})]})]}),(0,y.jsxs)(`div`,{className:`pf-cta`,children:[(0,y.jsx)(`button`,{className:`pf-lock-btn`,onClick:x,disabled:!v,"aria-disabled":!v,title:v?`Press Space/Enter to Lock`:`Insufficient Φ or syncing…`,children:u?`Locking…`:`Lock (−${Y} Φ)`}),(0,y.jsxs)(`div`,{className:`pf-hint`,children:[`Press `,(0,y.jsx)(`kbd`,{children:`Space`}),` or `,(0,y.jsx)(`kbd`,{children:`Enter`}),` at the right moment. Even pulses widen the target.`]})]}),p&&(0,y.jsxs)(`div`,{className:`pf-result pf-result--${p.kind}`,role:`status`,"aria-live":`polite`,children:[p.kind===`hit`&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:`pf-result__emoji`,children:`✅`}),(0,y.jsxs)(`span`,{className:`pf-result__text`,children:[`Resonant lock! +`,p.delta,` Φ`]})]}),p.kind===`crit`&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:`pf-result__emoji`,children:`💥`}),(0,y.jsxs)(`span`,{className:`pf-result__text`,children:[`Perfect lock! +`,p.delta,` Φ`]})]}),p.kind===`miss`&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:`pf-result__emoji`,children:`❌`}),(0,y.jsx)(`span`,{className:`pf-result__text`,children:`Miss — breathe again.`})]})]})]}):(0,y.jsx)(Fe,{currentPhi:e,onPhiChange:t,onExit:()=>r(`forge`)})})};function Ze(){return`kai-${Math.random().toString(36).slice(2,8)}`}function Qe(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.x==`number`&&typeof t.pulseIndex==`number`&&typeof t.chakraDay==`string`&&typeof t.glyph==`object`&&t.glyph!==null}var $e=null;async function et(){return $e||($e=(await r(()=>import(`./bundler-BoMe-K_2.js`),__vite__mapDeps([0,1,2]))).default,$e)}function tt(e){let[t]=(0,d.useState)(()=>e??Ze()),[n,r]=(0,d.useState)([]),[i,a]=(0,d.useState)([]),o=(0,d.useRef)(null),s=(0,d.useRef)({}),c=(0,d.useCallback)((e,t)=>{if(!Qe(t))return;let n={...t,id:e,glyph:t.glyph};a(t=>{let r=t.findIndex(t=>t.id===e);if(r>=0){let e=[...t];return e[r]=n,e}return[...t,n]})},[]),l=(0,d.useCallback)((e,t)=>{Qe(e)&&c(t,e)},[c]);return(0,d.useEffect)(()=>{let e=!1;return(async()=>{let n=await et();if(e)return;let i=new n(t);o.current=i,i.on(`open`,()=>{r(e=>e)}),i.on(`connection`,e=>{s.current[e.peer]=e,r(t=>Array.from(new Set([...t,e.peer]))),e.on(`data`,t=>{l(t,e.peer)}),e.on(`close`,()=>{delete s.current[e.peer],r(t=>t.filter(t=>t!==e.peer)),a(t=>t.filter(t=>t.id!==e.peer))})})})().catch(e=>{console.error(`[KaiRealms] Peer init failed:`,e)}),()=>{e=!0;try{o.current?.destroy()}catch(e){console.warn(`[KaiRealms] Peer destroy failed:`,e)}o.current=null,s.current={},r([]),a([])}},[t,l]),{sessionId:t,peers:n,sendState:(0,d.useCallback)(e=>{let t=Object.values(s.current);for(let n of t)n.open&&n.send(e)},[]),remoteStates:i}}var nt=800,rt=500,it=nt/rt,X=28,Z=10,at=360,ot=10,Q=5236,st=.08,ct=22,lt=90,ut=80,dt=2,ft=4,pt=10,mt=3,ht=1,gt=3,_t=1,vt=1,$=(e,t,n)=>en?n:e,yt=({glyphData:e,onExit:t})=>{let n=(0,d.useRef)(null),r=(0,d.useRef)(null),i=(0,d.useRef)(null),[a,o]=(0,d.useState)({w:nt,h:rt}),s=(0,d.useRef)(a);(0,d.useEffect)(()=>{s.current=a},[a]);let[c,l]=(0,d.useState)(0),[u,f]=(0,d.useState)(0),[p,m]=(0,d.useState)(!1),[h,g]=(0,d.useState)(mt),[_,v]=(0,d.useState)(0),[b,x]=(0,d.useState)(0),[S,C]=(0,d.useState)(!1),w=(0,d.useRef)(performance.now()),{sendState:T,remoteStates:E}=tt(),D=(0,d.useRef)([]);(0,d.useEffect)(()=>{D.current=E??[]},[E]);let O=(0,d.useRef)(nt/2),k=(0,d.useRef)([]),A=(0,d.useRef)({}),j=(0,d.useRef)(null),M=(0,d.useRef)(null),N=(0,d.useRef)(null),P=(0,d.useRef)(0),te=(0,d.useRef)(0),F=(0,d.useRef)(null);(0,d.useEffect)(()=>{let e=n.current;if(!e)return;let t=new ResizeObserver(e=>{let t=e[0].contentRect,n=Math.max(320,Math.min(960,t.width));o({w:n,h:Math.round(n/it)})});return t.observe(e),()=>t.disconnect()},[]),(0,d.useEffect)(()=>{let e=r.current;if(!e)return;let t=e.getContext(`2d`);if(!t)return;let n=Math.min(2,window.devicePixelRatio||1);e.style.width=`${a.w}px`,e.style.height=`${a.h}px`,e.width=Math.floor(a.w*n),e.height=Math.floor(a.h*n),t.setTransform(n,0,0,n,0,0),i.current=t,O.current=$(O.current,X,a.w-X)},[a]),(0,d.useEffect)(()=>{let e=e=>{A.current[e.key]=!0,e.key.toLowerCase()===`p`&&m(e=>!e),e.key.toLowerCase()===`r`&&S&&R()},t=e=>{A.current[e.key]=!1};return window.addEventListener(`keydown`,e),window.addEventListener(`keyup`,t),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`keyup`,t)}},[S]),(0,d.useEffect)(()=>{let e=r.current;if(!e)return;let t=t=>{let n=e.getBoundingClientRect();return $((t-n.left)/n.width*s.current.w,X,s.current.w-X)},n=!1,i=e=>{n=!0,O.current=t(e.clientX)},a=e=>{n&&(O.current=t(e.clientX))},o=()=>{n=!1};return e.addEventListener(`pointerdown`,i),e.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o),()=>{e.removeEventListener(`pointerdown`,i),e.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o)}},[]);let ne=e=>Math.max(0,e-w.current)%Q/Q,re=e=>{let t=Math.sin(Math.PI*e);return .65+.7*(t*t)},I=e=>{let{w:t}=s.current,n=performance.now(),r=Math.random()*(t-2*Z)+Z,i=-Z*2,a=(Math.random()-.5)*40,o=(e===`gold`?ut:lt)+_*(pt*.2),c={id:`${e}-${n}-${Math.floor(Math.random()*1e6)}`,x:r,y:i,vx:a,baseVy:o,kind:e,bornAt:n},l=k.current.slice(-(ct-1));l.push(c),k.current=l};ee({onPulse:e=>{f(e),w.current=performance.now(),te.current+=1;for(let e=0;e{let n=N.current,r=O.current,i=u;if(!n||Math.abs(n.x-r)>=1||n.pulseIndex!==i||t-P.current>1e3/ot){N.current={x:r,pulseIndex:i},P.current=t;try{T({id:`you`,x:r,pulseIndex:i,chakraDay:e.meta.chakraDay,glyph:e})}catch{}}};(0,d.useEffect)(()=>{let t=r.current,n=i.current;if(!t||!n)return;let a=!0,o=t=>{if(!a)return;j.current=requestAnimationFrame(o);let r=M.current??t,i=Math.min(.05,(t-r)/1e3);M.current=t;let{w:c,h:u}=s.current,d=u-X-10;if(!p&&!S){let e=A.current,n=!!(e.ArrowLeft||e.a||e.A),r=!!(e.ArrowRight||e.d||e.D);n&&(O.current=$(O.current-at*i,X,c-X)),r&&(O.current=$(O.current+at*i,X,c-X));let a=O.current,o=performance.now(),s=ne(o),f=re(s),p=[],m=0,h=0,y=0;for(let e=0;ec-Z&&(t.x=c-Z,t.vx=-Math.abs(t.vx)*.9);let r=t.x-a,l=t.y-d;if(Math.hypot(r,l)u+Z){y+=1;continue}p.push(t)}if(m>0||h>0){let e=m+h;l(t=>t+e),v(e=>{let t=e+1;return x(e=>t>e?t:e),t})}y>0&&(l(e=>Math.max(0,e-ht*y)),v(0),g(e=>{let t=Math.max(0,e-y);return t===0&&C(!0),t})),k.current=p,L(t)}bt(n,e,O.current,d,p||S,k.current,D.current,s.current,w.current,F.current)};return j.current=requestAnimationFrame(o),()=>{a=!1,j.current!==null&&cancelAnimationFrame(j.current),j.current=null,M.current=null}},[e,p,S,a.w,a.h]);let R=()=>{k.current=[],g(mt),v(0),x(e=>e),C(!1)},ie=(0,d.useMemo)(()=>({pulse:u,chakraDay:e?.meta?.chakraDay??`—`}),[u,e?.meta?.chakraDay]);return(0,y.jsxs)(`div`,{className:`realm-wrap`,ref:n,children:[(0,y.jsxs)(`div`,{className:`realm-hud`,children:[(0,y.jsxs)(`div`,{className:`hud-chip hud-chip--score`,title:`Banked Φ`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Φ`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:c})]}),(0,y.jsxs)(`div`,{className:`hud-chip`,title:`Streak`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Streak`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:_})]}),(0,y.jsxs)(`div`,{className:`hud-chip`,title:`Lives`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Lives`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:h})]}),(0,y.jsxs)(`div`,{className:`hud-chip`,title:`Current Pulse`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Pulse`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:ie.pulse})]}),(0,y.jsxs)(`div`,{className:`hud-chip`,title:`Chakra Day`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Day`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:ie.chakraDay})]}),(0,y.jsx)(`button`,{className:`hud-button`,onClick:()=>m(e=>!e),"aria-pressed":p,title:`Pause (P)`,children:p?`Resume`:`Pause`})]}),(0,y.jsxs)(`div`,{className:`realm-canvas-wrap`,children:[(0,y.jsx)(`canvas`,{ref:r,className:`realm-canvas`,"aria-label":`Kai Realms Canvas`}),(p||S)&&(0,y.jsx)(`div`,{className:`realm-pause-overlay`,"aria-hidden":!0,children:(0,y.jsxs)(`div`,{className:`pause-card`,children:[(0,y.jsx)(`div`,{className:`pause-title`,children:S?`Game Over`:`Paused`}),(0,y.jsx)(`div`,{className:`pause-sub`,children:S?(0,y.jsxs)(y.Fragment,{children:[`Best Streak: `,(0,y.jsx)(`strong`,{children:b}),` — Press `,(0,y.jsx)(`kbd`,{children:`R`}),` to Restart`]}):(0,y.jsxs)(y.Fragment,{children:[`Press `,(0,y.jsx)(`kbd`,{children:`P`}),` or click Resume`]})}),S&&(0,y.jsx)(`button`,{className:`hud-button`,onClick:R,style:{marginTop:12},children:`Restart`})]})})]}),(0,y.jsx)(Xe,{currentPhi:c,onPhiChange:e=>l(e)}),(0,y.jsx)(`button`,{className:`exit-button`,onClick:t,children:`Exit Realm`})]})};function bt(e,t,n,r,i,a,o,s,c,l){let{w:u,h:d}=s,f=e.createLinearGradient(0,0,0,d);f.addColorStop(0,`#020211`),f.addColorStop(1,`#0b0f2a`),e.fillStyle=f,e.fillRect(0,0,u,d),e.save(),e.globalAlpha=.12;for(let t=0;t<40;t++){let n=t*197%u+t%3,r=t*127%d+t*11%7;e.fillStyle=`white`,e.fillRect(n,r,2,2)}e.restore(),xt(e,u,Math.max(36,Math.round(d*.06)),c);for(let t=0;t{let[n,r]=(0,d.useState)(null),i=(0,d.useRef)(null),a=(0,d.useRef)(null),o=(0,d.useCallback)(e=>r(e),[]),s=(0,d.useCallback)(()=>{r(null),t?.()},[t]);(0,d.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t?.()};return document.addEventListener(`keydown`,e),a.current?.focus(),()=>document.removeEventListener(`keydown`,e)},[t]),(0,d.useEffect)(()=>{let e=i.current;if(!e)return;let t=e=>e.stopPropagation();return e.addEventListener(`wheel`,t,{passive:!0}),()=>e.removeEventListener(`wheel`,t)},[]);let c=()=>t?.(),l=e=>e.stopPropagation();return(0,y.jsxs)(`div`,{className:`realms-backdrop realms-veil`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`kai-realms-title`,onMouseDown:c,children:[(0,y.jsx)(`div`,{className:`realms-stars`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`realms-halo realms-halo--1`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`realms-halo realms-halo--2`,"aria-hidden":!0}),(0,y.jsxs)(`div`,{ref:i,className:`realms-container glass-omni`,onMouseDown:l,role:`document`,children:[(0,y.jsx)(`div`,{className:`breath-ring breath-ring--outer`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`breath-ring breath-ring--inner`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`phi-grid`,"aria-hidden":!0}),(0,y.jsxs)(`header`,{className:`realms-header`,children:[(0,y.jsx)(`button`,{ref:a,type:`button`,className:`realms-close auric-btn`,"aria-label":`Close Kai Realms`,onClick:e=>{e.stopPropagation(),t?.()},onMouseDown:e=>e.stopPropagation(),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),t?.())},children:(0,y.jsx)(e,{size:20,"aria-hidden":!0})}),(0,y.jsx)(`div`,{className:`header-seals`,"aria-hidden":!0,children:(0,y.jsxs)(`div`,{className:`seal-emblem`,children:[(0,y.jsx)(`div`,{className:`seal-ring`}),(0,y.jsx)(`div`,{className:`seal-ring seal-ring--inner`}),(0,y.jsx)(`div`,{className:`seal-core`})]})}),(0,y.jsx)(`h2`,{id:`kai-realms-title`,className:`sr-only`,children:`Kai Realms — Sigil Gate`})]}),(0,y.jsx)(`main`,{className:`realms-body`,children:n?(0,y.jsx)(`div`,{className:`realm-stage`,children:(0,y.jsx)(yt,{glyphData:n,onExit:s})}):(0,y.jsx)(`div`,{className:`portal-stage`,children:(0,y.jsx)(x,{onEnter:o})})}),(0,y.jsx)(`footer`,{className:`realms-footer`,"aria-hidden":!0,children:(0,y.jsx)(`div`,{className:`footer-center`,style:{margin:`0 auto`},children:(0,y.jsx)(wt,{})})})]})]})};function wt(){return(0,y.jsxs)(`svg`,{className:`seal-coin`,width:`56`,height:`56`,viewBox:`0 0 56 56`,"aria-hidden":!0,children:[(0,y.jsxs)(`defs`,{children:[(0,y.jsxs)(`radialGradient`,{id:`coinGlowRealms`,cx:`50%`,cy:`50%`,r:`50%`,children:[(0,y.jsx)(`stop`,{offset:`0%`,stopColor:`#ffffff`,stopOpacity:`0.9`}),(0,y.jsx)(`stop`,{offset:`40%`,stopColor:`#ffd86b`,stopOpacity:`0.75`}),(0,y.jsx)(`stop`,{offset:`100%`,stopColor:`#ffd86b`,stopOpacity:`0.15`})]}),(0,y.jsxs)(`linearGradient`,{id:`coinEdgeRealms`,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,y.jsx)(`stop`,{offset:`0%`,stopColor:`#00ffd0`,stopOpacity:`0.8`}),(0,y.jsx)(`stop`,{offset:`100%`,stopColor:`#8a2be2`,stopOpacity:`0.8`})]})]}),(0,y.jsx)(`circle`,{cx:`28`,cy:`28`,r:`26`,fill:`url(#coinGlowRealms)`,stroke:`url(#coinEdgeRealms)`,strokeWidth:`1.5`}),(0,y.jsxs)(`g`,{className:`seal-coin__rotor`,children:[(0,y.jsx)(`circle`,{cx:`28`,cy:`28`,r:`18`,fill:`none`,stroke:`url(#coinEdgeRealms)`,strokeWidth:`1.25`}),(0,y.jsxs)(`g`,{stroke:`rgba(255,255,255,0.35)`,strokeWidth:`0.6`,children:[(0,y.jsx)(`line`,{x1:`28`,y1:`10`,x2:`28`,y2:`46`}),(0,y.jsx)(`line`,{x1:`10`,y1:`28`,x2:`46`,y2:`28`}),(0,y.jsx)(`line`,{x1:`15`,y1:`15`,x2:`41`,y2:`41`}),(0,y.jsx)(`line`,{x1:`41`,y1:`15`,x2:`15`,y2:`41`})]})]}),(0,y.jsx)(`circle`,{className:`seal-coin__core`,cx:`28`,cy:`28`,r:`6.5`})]})}export{Ct as default}; \ No newline at end of file +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/bundler-BiZDI_w8.js","assets/index-BlYU7j-M.js","assets/index-BmaJNTKf.css"])))=>i.map(i=>d[i]); +import{t as e}from"./x-CaPcBV4E.js";import{Bt as t,Ht as n,Sn as r,Tn as i,an as a,jn as o,ln as s,mn as c,t as l,tn as u}from"./index-BlYU7j-M.js";var d=o(i(),1);function f(e){return typeof e==`string`?e.toLowerCase():``}function p(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function m(e){return typeof e==`string`&&e.length>0}function h(e){return typeof e==`number`&&Number.isFinite(e)}function g(e){if(typeof e!=`object`||!e)throw Error(`Malformed sigil metadata.`);let t=e;for(let e of[`pulse`,`beat`,`stepIndex`,`chakraDay`])if(!p(t,e))throw Error(`Missing Kai field: ${e}`);if(!p(t,`kaiSignature`))throw Error(`Invalid Kai Signature — tampered or unsigned sigil.`);if(!h(t.pulse))throw Error(`Invalid field: pulse`);if(!h(t.beat))throw Error(`Invalid field: beat`);if(!h(t.stepIndex))throw Error(`Invalid field: stepIndex`);if(!m(t.chakraDay))throw Error(`Invalid field: chakraDay`);if(!m(t.kaiSignature))throw Error(`Invalid field: kaiSignature`)}function _(e){try{let t=new DOMParser().parseFromString(e,`image/svg+xml`),n=Array.from(t.getElementsByTagName(`metadata`)),r=[`valuation`,`ledger`,`dht`,`source`];for(let e of n){let t=e.getAttribute(`id`)??``;if(r.some(e=>t.includes(e)))continue;let n=(e.textContent??``).trim();if(!n)continue;let i=n.replace(/^$/,``);try{let e=JSON.parse(i);if(typeof e==`object`&&e&&p(e,`pulse`)&&p(e,`beat`)&&p(e,`stepIndex`)&&p(e,`chakraDay`)&&p(e,`kaiSignature`))return e}catch{}}return null}catch{return null}}async function v(e){let r=await e.text(),{meta:i,contextOk:a,typeOk:o}=await l(e),s=i&&p(i,`kaiSignature`)&&p(i,`pulse`)?i:_(r);if(!s||!a||!o)throw Error(`Invalid glyph or missing metadata.`);g(s);let c=s,u=await t(c);if(!u||f(u)!==f(c.kaiSignature))throw Error(`Invalid Kai Signature — tampered or unsigned sigil.`);let d=await n(c.kaiSignature);if(typeof c.userPhiKey==`string`){if(f(c.userPhiKey)!==f(d))throw Error(`Φ-Key mismatch — identity invalid.`)}else c.userPhiKey=d;return{svgText:r,meta:c,phiKey:d}}var y=o(u(),1),b=`.svg,image/svg+xml`,x=({onEnter:e})=>{let t=(0,d.useRef)(null),[n,r]=(0,d.useState)(!1),[i,a]=(0,d.useState)(!1),[o,s]=(0,d.useState)(``),[c,l]=(0,d.useState)(null),u=(0,d.useId)(),f=(0,d.useId)(),p=(0,d.useId)(),m=()=>{t.current&&(t.current.value=``)},h=(0,d.useCallback)(async t=>{l(null),s(t.name),a(!0);try{if(!(t.type===`image/svg+xml`||t.name.toLowerCase().endsWith(`.svg`)))throw Error(`Please upload a valid Kai Sigil (.svg).`);e(await v(t))}catch(e){l(e instanceof Error?e.message:`Invalid glyph or missing metadata.`)}finally{a(!1),m()}},[e]),g=(0,d.useCallback)(async e=>{let t=e.target.files?.[0];t&&await h(t)},[h]),_=(0,d.useCallback)(async e=>{e.preventDefault(),e.stopPropagation(),r(!1);let t=e.dataTransfer.files?.[0];t&&await h(t)},[h]),x=e=>{e.preventDefault(),e.dataTransfer.dropEffect=`copy`,n||r(!0)},S=e=>{e.currentTarget.contains(e.relatedTarget)||r(!1)},C=()=>t.current?.click(),w=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),C())};return(0,y.jsxs)(`section`,{className:`portal-card glass-omni`,"aria-labelledby":u,"aria-describedby":f,children:[(0,y.jsx)(`div`,{className:`breath-ring breath-ring--outer`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`breath-ring breath-ring--inner`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`phi-grid`,"aria-hidden":!0}),(0,y.jsx)(`h1`,{id:u,className:`sr-only`,children:`Drop your Kai Sigil`}),(0,y.jsxs)(`div`,{className:`portal-body`,children:[(0,y.jsxs)(`div`,{className:`dropzone ${n?`dropzone--active`:``} ${i?`dropzone--busy`:``}`,role:`button`,tabIndex:0,onKeyDown:w,onClick:C,onDrop:_,onDragOver:x,onDragLeave:S,"aria-busy":i,"aria-describedby":`${f}${c?` ${p}`:``}`,children:[(0,y.jsxs)(`div`,{className:`dropzone-ornament`,"aria-hidden":!0,children:[(0,y.jsx)(`div`,{className:`ornament-ring ornament-ring--outer`}),(0,y.jsx)(`div`,{className:`ornament-ring ornament-ring--inner`}),(0,y.jsx)(`div`,{className:`ornament-core`})]}),(0,y.jsx)(`div`,{className:`dropzone-icon`,"aria-hidden":!0,children:(0,y.jsxs)(`svg`,{width:`44`,height:`44`,viewBox:`0 0 44 44`,children:[(0,y.jsx)(`defs`,{children:(0,y.jsxs)(`linearGradient`,{id:`dzG`,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,y.jsx)(`stop`,{offset:`0%`,stopColor:`#00ffd0`}),(0,y.jsx)(`stop`,{offset:`100%`,stopColor:`#8a2be2`})]})}),(0,y.jsx)(`circle`,{cx:`22`,cy:`22`,r:`20`,fill:`none`,stroke:`url(#dzG)`,strokeWidth:`1.5`}),(0,y.jsx)(`path`,{d:`M22 12 L22 30 M14 20 L22 12 L30 20`,stroke:`url(#dzG)`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`})]})}),(0,y.jsxs)(`div`,{className:`dropzone-text`,children:[(0,y.jsx)(`div`,{className:`dz-title`,children:`Inhale your Kai Sigil`}),(0,y.jsxs)(`div`,{id:f,className:`dz-hint`,children:[`Breath-minted `,(0,y.jsx)(`strong`,{children:`Φkey`}),` only. Drag & drop.`]}),o&&!i&&!c?(0,y.jsxs)(`div`,{className:`dz-file`,children:[`Selected: `,o]}):null,i?(0,y.jsxs)(`div`,{className:`dz-progress`,children:[(0,y.jsx)(`div`,{className:`dz-spinner`}),(0,y.jsx)(`span`,{children:`Verifying…`})]}):null]}),(0,y.jsx)(`input`,{ref:t,type:`file`,accept:b,onChange:g,tabIndex:-1,"aria-hidden":!0,className:`dz-input`})]}),c?(0,y.jsx)(`div`,{id:p,className:`portal-error`,role:`alert`,"aria-live":`polite`,children:c}):null,(0,y.jsx)(`p`,{className:`portal-note`,children:`Your sigil is verified by breath. No drift. Only truth.`})]}),(0,y.jsx)(`span`,{className:`sr-only`,children:`Kai Realms sigil gate ready.`})]})},S=typeof window<`u`,C=11n,w=44n,T=36n;function E(e){let t=BigInt(a),n=BigInt(s),r=(e>t?e-t:0n)/n,i=r/C%w,o=r/(C*w)%T;return{pulseIndex:Number(r),stepIndex:Number(i),beatIndex:Number(o)}}function D(e){let t=BigInt(a),n=BigInt(s);return t+((e>t?e-t:0n)/n+1n)*n}function ee(e){let t=(0,d.useRef)(null),n=(0,d.useRef)(e);n.current=e,(0,d.useEffect)(()=>{if(!S)return;let e=null,r=!1,i=()=>{if(r)return;let a=c(),{pulseIndex:o,stepIndex:s,beatIndex:l}=E(a);o!==t.current&&(n.current.onPulse?.(o),o%Number(C)===0&&n.current.onStep?.(s),o%Number(C*w)===0&&n.current.onBeat?.(l),t.current=o);let u=D(a),d=u>a?u-a:0n,f=Number(d);e=window.setTimeout(i,f)};return i(),()=>{r=!0,e!==null&&window.clearTimeout(e)}},[])}var O={Root:`#FF0033`,Sacral:`#FF8000`,Solar:`#FFD700`,Heart:`#00FF99`,Throat:`#33CCFF`,ThirdEye:`#9933FF`,Crown:`#AA00FF`};function k(e,t,n,r,i){e.save(),e.translate(n,r);let{chakraDay:a,pulse:o}=t.meta,s=O[a]??`#00FFFF`;e.beginPath(),e.arc(0,0,i+4,0,Math.PI*2),e.fillStyle=s,e.shadowColor=s,e.shadowBlur=15,e.fill(),e.beginPath(),e.arc(0,0,i,0,Math.PI*2),e.fillStyle=`#000012`,e.fill();let c=i+o%11*1.5;e.beginPath(),e.arc(0,0,c,0,Math.PI*2),e.strokeStyle=`${s}AA`,e.lineWidth=1.5,e.stroke(),e.restore()}function A(e){return typeof e==`object`&&!!e}function j(e){if(typeof e==`bigint`)return e;if(typeof e==`number`&&Number.isFinite(e)&&Number.isSafeInteger(e))return BigInt(e);if(typeof e==`string`)try{return BigInt(e)}catch{return null}return null}var M=`kai:game:focus`,N=typeof window<`u`;function P(){if(!N||typeof BroadcastChannel>`u`)return null;try{return new BroadcastChannel(`kai-realms-game-focus`)}catch{return null}}function te(e){let t={id:e,ts:c()};if(N)try{window.dispatchEvent(new CustomEvent(M,{detail:t}))}catch{}let n=P();if(n)try{n.postMessage({type:M,detail:{id:t.id,ts:t.ts.toString()}})}catch{}finally{try{n.close()}catch{}}}function F(e){if(!A(e))return null;let t=e.id,n=j(e.ts);return typeof t!=`string`||n===null?null:{id:t,ts:n}}function ne(e){let t=t=>{let n=F(t?.detail);n&&e(n)};N&&window.addEventListener(M,t);let n=P(),r=t=>{let n=t?.data;if(!A(n)||n.type!==M)return;let r=F(n.detail);r&&e(r)};if(n)try{n.addEventListener(`message`,r)}catch{}return()=>{if(N&&window.removeEventListener(M,t),n)try{n.removeEventListener(`message`,r)}catch{}finally{try{n.close()}catch{}}}}function re(e){let[t,n]=(0,d.useState)(!1),r=(0,d.useRef)(0n);return(0,d.useEffect)(()=>ne(t=>{n(t.id!==e),r.current=t.ts}),[e]),{paused:t,takeFocus:(0,d.useCallback)(()=>{te(e),n(!1)},[e])}}var I=5236,L=.085,R=1,ie=60,ae=6.1,oe=5.6,se=.1,ce=1.6,le=10,ue=50,de=150,fe=10,pe=Math.floor(I*1.25),me=.145,he=2.618,ge=I,z=I,_e=1e3,ve=.12,B=44,ye=.618,be=.35,xe=3,Se=`600 12px ui-sans-serif,system-ui,-apple-system`,V={up:{x:0,y:-1},down:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0},none:{x:0,y:0}},H={up:`down`,down:`up`,left:`right`,right:`left`,none:`none`};function Ce(e,t,n){return e+(t-e)*n}function U(e,t){return(e-t+I)%I/I}function we(e){let t=Math.sin(Math.PI*e);return .78+.44*(t*t)}function Te(e){let t=e.toLowerCase();return t===`arrowup`||t===`w`?`up`:t===`arrowdown`||t===`s`?`down`:t===`arrowleft`||t===`a`?`left`:t===`arrowright`||t===`d`?`right`:`none`}function W(e,t,n){let r=Math.round(n),i=Math.round(t);return r<0||r>=e.length||i<0||i>=e[0].length?!1:e[r][i]!==1}function G(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function K(e,t){let n=e.x-t.x,r=e.y-t.y;return n*n+r*r}function Ee(){let e=Array.from({length:23},()=>Array(27).fill(1));((t,n,r,i)=>{for(let a=n;a0&&a<22&&n>0&&n<26&&(e[a][n]=0)})(1,1,25,21);for(let t=2;t<25;t++)e[5][t]=1,e[17][t]=1;for(let t=2;t<21;t++)e[t][4]=1,e[t][22]=1;for(let t=6;t<21;t++)e[11][t]=0;for(let t=4;t<19;t++)e[t][13]=0;for(let t=1;t<22;t++)for(let n=1;n<26;n++)e[t][n]===0&&(e[t][n]=2);for(let t of[{x:6,y:6},{x:20,y:6},{x:6,y:16},{x:20,y:16}])e[t.y][t.x]=3;for(let t of[{x:2,y:2},{x:24,y:2},{x:2,y:20},{x:24,y:20}])e[t.y]?.[t.x]!==1&&(e[t.y][t.x]=4);return e}function De(e){return{pos:{x:e.x,y:e.y},dir:`left`,next:`left`,speed:ae}}function q(e,t,n){return{pos:{x:e.x,y:e.y},dir:`left`,speed:oe,scatterTarget:n,mode:`chase`,frightUntil:0,color:t}}function Oe(e){let t=0;for(let n=0;n=.1||i>=.1)return!1;let a=0;return[`up`,`down`,`left`,`right`].forEach(t=>{W(e,n.x+V[t].x,n.y+V[t].y)&&a++}),a>=3}function Me(e,t){if(t.next===`none`||t.next===t.dir)return;if(t.next===H[t.dir]){t.dir=t.next;return}let n=G(t.pos),r=Math.abs(t.pos.x-n.x),i=Math.abs(t.pos.y-n.y);r>=.12||i>=.12||W(e,n.x+V[t.next].x,n.y+V[t.next].y)&&(t.pos.x=n.x,t.pos.y=n.y,t.dir=t.next)}function Ne(e,t,n,r,i){if(n===`none`)return;let a=V[n],o=t.x+a.x*r*i,s=t.y+a.y*r*i,c=e[0].length;if(o<-1){t.x=c+1;return}if(o>c+1){t.x=-1;return}if(W(e,Math.round(o),Math.round(s)))t.x=o,t.y=s;else{let e=G(t);t.x=e.x,t.y=e.y}}function Pe(e,t,n,r){let i=[`up`,`left`,`down`,`right`],a=n,o=1/0;for(let s of i){if(s===H[n])continue;let i=Math.round(t.x)+V[s].x,c=Math.round(t.y)+V[s].y;if(!W(e,i,c))continue;let l=K({x:i,y:c},r);l{let r=(0,d.useRef)(null),i=(0,d.useRef)(null),{paused:a,takeFocus:o}=re(`KaiMaze`),[s,c]=(0,d.useState)({w:0,h:0});(0,d.useEffect)(()=>{let e=r.current;if(!e)return;let t=new ResizeObserver(e=>{for(let t of e){let e=t.contentRect;c({w:e.width,h:e.height})}});return t.observe(e),()=>t.disconnect()},[]);let[l,u]=(0,d.useState)(e);(0,d.useEffect)(()=>u(e),[e]);let[f,p]=(0,d.useState)(()=>ke(1,performance.now())),m=(0,d.useRef)(performance.now()),[h,g]=(0,d.useState)(()=>{if(typeof window>`u`)return!1;let e=window.matchMedia?.(`(pointer: coarse)`)?.matches??!1,t=window.matchMedia?.(`(max-width: 900px)`)?.matches??!1;return e||t});(0,d.useEffect)(()=>{if(typeof window>`u`)return;let e=window.matchMedia(`(pointer: coarse)`),t=window.matchMedia(`(max-width: 900px)`),n=()=>g(e.matches||t.matches);return e.addEventListener?.(`change`,n),t.addEventListener?.(`change`,n),()=>{e.removeEventListener?.(`change`,n),t.removeEventListener?.(`change`,n)}},[]);let _=(0,d.useMemo)(()=>e=>Math.floor(_e*(1+ve*(e-1))),[]),v=(0,d.useMemo)(()=>h&&!f.over,[h,f.over]),b=(0,d.useMemo)(()=>(h?`Tap/Swipe or D-pad`:`←↑→↓ / WASD`)+` · B/Space to Channel on ⟐ · Esc to exit`,[h]);(0,d.useEffect)(()=>{if(R>0&&l>=R){let e=l-R;u(e),t(e),o()}},[]);let x=()=>{p(e=>e.channelingUntil?{...e,channelingUntil:0}:e)};(0,d.useEffect)(()=>{let e=e=>{let t=e.key.toLowerCase(),r=Te(t);r!==`none`&&(x(),e.preventDefault(),o(),p(e=>({...e,player:{...e.player,next:r}}))),(t===`b`||t===` `)&&f.onAltar&&f.channelingUntil===0&&(o(),p(e=>({...e,channelingUntil:performance.now()+z}))),t===`escape`&&n&&n(),t===`r`&&f.over&&(o(),p(ke(1,performance.now())),m.current=performance.now())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,f.over,f.onAltar,f.channelingUntil]);let S=e=>{x(),o(),p(t=>({...t,player:{...t.player,next:e}}))},C=()=>{f.onAltar&&f.channelingUntil===0&&(o(),p(e=>({...e,channelingUntil:performance.now()+z})))};(0,d.useEffect)(()=>{let e=0,n=performance.now(),r=(e,n)=>{if(n.channelingUntil===0||!n.onAltar||e0){let e=Math.floor(a*r),i=Math.max(0,n.bankable-e),o=l+a;return u(o),t(o),{...n,scorePhi:n.scorePhi+a,bankable:i,points:i,kaiCharge:Math.max(0,Math.floor(n.kaiCharge*.5)),channelingUntil:0}}return{...n,channelingUntil:0}},i=()=>{e=requestAnimationFrame(i);let o=performance.now(),s=Math.min(1/ie,(o-n)/1e3);n=o,!a&&p(e=>{if(e.over)return e;let n=structuredClone(e);if(o>=n.cycle.nextSwitchAt){let e=n.cycle.phase===`chase`?`scatter`:`chase`;n.cycle={phase:e,nextSwitchAt:o+Ae(n.level,e)};for(let t of n.ghosts)t.mode!==`fright`&&(t.mode=e)}let i=U(o,m.current),a=we(i),c=Math.min(1+n.streak*se,ce),d=Math.min(1+n.streak*me,he),f=n.channelingUntil>0?0:n.player.speed*a*c;Me(n.grid,n.player),Ne(n.grid,n.player.pos,n.player.dir,f,s);let p=G(n.player.pos);n.onAltar=n.grid[p.y]?.[p.x]===4;let h=n.grid[p.y]?.[p.x]??1;if((h===2||h===3)&&n.channelingUntil===0){let e=Math.abs(i-.5)<=L,t=h===2?le:ue;if(e&&(t+=fe,n.kaiCharge=Math.min(B,n.kaiCharge+1)),t=Math.floor(t*d),n.points+=t,n.bankable=n.points,n.streak+=1,n.streak>n.bestStreak&&(n.bestStreak=n.streak),n.comboUntil=o+pe,n.grid[p.y][p.x]=0,n.pellets=Math.max(0,n.pellets-1),h===3){m.current=o;let e=Math.max(ge*Math.max(.55,1-(n.level-1)*.08),I*.5);for(let t of n.ghosts)t.mode=`fright`,t.frightUntil=o+e}}n.comboUntil>0&&o>n.comboUntil&&(n.streak=Math.max(0,Math.floor(n.streak*.5)),n.comboUntil=0);for(let e of n.ghosts){e.mode===`fright`&&o>=e.frightUntil&&(e.mode=n.cycle.phase);let t=G(n.player.pos);if(je(n.grid,e.pos))if(e.mode===`scatter`)e.dir=Pe(n.grid,e.pos,e.dir,e.scatterTarget);else if(e.mode===`fright`){let r=G(e.pos),i=[`up`,`down`,`left`,`right`],a=e.dir,o=-1/0;for(let s of i){if(s===H[e.dir])continue;let i=r.x+V[s].x,c=r.y+V[s].y;if(!W(n.grid,i,c))continue;let l=K({x:i,y:c},t);l>o&&(o=l,a=s)}e.dir=a}else{let r={x:t.x+V[n.player.dir].x*2,y:t.y+V[n.player.dir].y*2};e.dir=Pe(n.grid,e.pos,e.dir,r)}let r=e.mode===`fright`?Ce(.6,.8,Math.sin(i*Math.PI)):a,c=e.speed*r;if(c*=1.06**(n.level-1),Ne(n.grid,e.pos,e.dir,c,s),K(n.player.pos,e.pos)<.4)if(e.mode===`fright`&&n.channelingUntil===0){let t=Math.floor(de*d);n.points+=t,n.bankable=n.points,n.streak+=1,n.streak>n.bestStreak&&(n.bestStreak=n.streak),n.comboUntil=o+pe,e.pos={...e.scatterTarget},e.dir=`left`,e.mode=`scatter`,e.frightUntil=0}else if(--n.lives,n.streak=0,n.comboUntil=0,n.points=Math.max(0,Math.floor(n.points*(1-be))),n.bankable=n.points,n.channelingUntil=0,n.lives<=0)n.alive=!1,n.over=!0;else{let e={x:Math.floor(n.grid[0].length/2),y:n.grid.length-4};n.player.pos={...e},n.player.dir=`left`,n.player.next=`left`;for(let e of n.ghosts)e.mode=`scatter`;m.current=o}}if(n.pellets<=0&&!n.over){let e=_(n.level),r=Math.floor(n.bankable*.2/e);if(r>0){let i=r*e,a=Math.max(0,n.bankable-i),o=l+r;u(o),t(o),n.scorePhi+=r,n.bankable=a,n.points=a}let i=ke(n.level+1,o);i.scorePhi=n.scorePhi,i.lives=Math.max(1,n.lives),i.bestStreak=Math.max(n.bestStreak,n.streak),i.player.speed=n.player.speed*1.06;for(let e of i.ghosts)e.speed*=1.06;return m.current=o,i}return n=r(o,n),n})};return e=requestAnimationFrame(i),()=>cancelAnimationFrame(e)},[t,l,a,_]),(0,d.useEffect)(()=>{let e=0,t=()=>{e=requestAnimationFrame(t);let n=i.current,o=r.current;if(!n||!o)return;let c=n.getContext(`2d`);if(!c)return;let u=Math.max(0,s.w),d=Math.max(0,s.h);if(u===0||d===0)return;let p=Math.min(2,window.devicePixelRatio||1);(n.width!==Math.floor(u*p)||n.height!==Math.floor(d*p))&&(n.width=Math.floor(u*p),n.height=Math.floor(d*p),n.style.width=`${u}px`,n.style.height=`${d}px`),c.setTransform(p,0,0,p,0,0);let h=f.grid.length,g=f.grid[0].length,_=Math.floor(Math.min(u/g,d/h)),v=_*g,y=_*h,b=Math.floor((u-v)/2),x=Math.floor((d-y)/2),S=c.createLinearGradient(0,0,0,d);S.addColorStop(0,`#07071a`),S.addColorStop(1,`#0c1231`),c.fillStyle=S,c.fillRect(0,0,u,d),Be(c,u,d);for(let e=0;e0&&f.onAltar){let e=1-Math.max(0,f.channelingUntil-w)/z,t=u/2;c.strokeStyle=`rgba(0,255,208,0.9)`,c.lineWidth=4,c.globalAlpha=.9,c.beginPath(),c.arc(t,34,16,-Math.PI/2,-Math.PI/2+e*Math.PI*2),c.stroke(),c.globalAlpha=1,c.font=`700 12px ui-sans-serif,system-ui,-apple-system`,c.fillText(`Channeling…`,t+16+8,38)}if(a&&!f.over){c.fillStyle=`rgba(0,0,0,0.35)`,c.fillRect(0,0,u,d),c.fillStyle=`#fff`,c.font=`700 16px ui-sans-serif,system-ui,-apple-system`;let e=`Paused — another Realm is active`;c.fillText(e,(u-c.measureText(e).width)/2,d/2)}if(f.over){c.fillStyle=`rgba(0,0,0,0.55)`,c.fillRect(0,0,u,d),c.fillStyle=`#fff`,c.font=`700 20px ui-sans-serif,system-ui,-apple-system`;let e=`Game Over — Press R to restart`;c.fillText(e,(u-c.measureText(e).width)/2,d/2)}};return e=requestAnimationFrame(t),()=>cancelAnimationFrame(e)},[f,l,s,a]);let w=f.onAltar&&f.channelingUntil===0;return(0,y.jsxs)(`div`,{className:`km-wrap`,role:`group`,"aria-label":`Kai-Maze`,onPointerDown:()=>o(),onTouchStart:()=>o(),onMouseDown:()=>o(),children:[(0,y.jsxs)(`div`,{className:`km-header`,children:[(0,y.jsx)(`div`,{className:`km-title`,children:`🌀 Kai-Maze`}),(0,y.jsx)(`div`,{className:`km-sub`,children:`Score on pulse, risk your points, then ⟐ channel to mint Φ.`})]}),(0,y.jsxs)(`div`,{className:`km-stage`,ref:r,children:[(0,y.jsx)(`canvas`,{ref:i,className:`km-canvas`}),v&&(0,y.jsxs)(`div`,{className:`km-dpad`,style:{position:`absolute`,left:12,bottom:12,width:132,height:132,display:`grid`,gridTemplateColumns:`repeat(3, 1fr)`,gridTemplateRows:`repeat(3, 1fr)`,gap:6,touchAction:`none`,userSelect:`none`,zIndex:4},"aria-label":`Directional pad`,children:[(0,y.jsx)(`div`,{}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:J,"aria-label":`Move up`,onPointerDown:e=>{e.preventDefault(),S(`up`)},children:`▲`}),(0,y.jsx)(`div`,{}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:J,"aria-label":`Move left`,onPointerDown:e=>{e.preventDefault(),S(`left`)},children:`◀`}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:{...J,opacity:.9},"aria-label":`Hold to Channel (if on altar)`,onPointerDown:e=>{e.preventDefault(),C()},title:`Channel one breath to convert points → Φ`,children:`⟐`}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:J,"aria-label":`Move right`,onPointerDown:e=>{e.preventDefault(),S(`right`)},children:`▶`}),(0,y.jsx)(`div`,{}),(0,y.jsx)(`button`,{className:`km-dpad-btn`,style:J,"aria-label":`Move down`,onPointerDown:e=>{e.preventDefault(),S(`down`)},children:`▼`}),(0,y.jsx)(`div`,{})]}),w&&(0,y.jsx)(`button`,{className:`km-chan-btn`,onClick:()=>{o(),p(e=>e.channelingUntil?e:{...e,channelingUntil:performance.now()+z})},"aria-label":`Channel points into Phi`,title:`Channel one breath to convert points → Φ`,children:`⟐ CHANNEL`}),f.channelingUntil>0&&(0,y.jsx)(`button`,{className:`km-chan-cancel`,onClick:()=>{o(),p(e=>({...e,channelingUntil:0}))},"aria-label":`Cancel channeling`,title:`Cancel`,children:`Cancel`})]}),(0,y.jsxs)(`div`,{className:`km-footer`,children:[(0,y.jsx)(`button`,{className:`km-btn`,onClick:n,title:`Back`,children:`Back`}),(0,y.jsx)(`div`,{className:`km-hint`,children:b})]})]})};function Ie(e,t,n,r,i){e.save(),e.fillStyle=i,e.beginPath(),e.arc(t,n,r,0,Math.PI*2),e.fill(),e.strokeStyle=`rgba(255,255,255,0.35)`,e.lineWidth=1.25,e.stroke(),e.restore()}function Le(e,t,n,r,i){e.save(),e.fillStyle=i,e.beginPath(),e.arc(t,n,r,Math.PI,0),e.lineTo(t+r,n+r*.85),e.lineTo(t-r,n+r*.85),e.closePath(),e.fill(),e.fillStyle=`#fff`,e.beginPath(),e.arc(t-r*.35,n-r*.15,r*.16,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(t+r*.35,n-r*.15,r*.16,0,Math.PI*2),e.fill(),e.fillStyle=`rgba(0,0,0,0.7)`,e.beginPath(),e.arc(t-r*.3,n-r*.15,r*.08,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(t+r*.3,n-r*.15,r*.08,0,Math.PI*2),e.fill(),e.restore()}function Re(e,t,n){let r=Math.min(460,Math.max(220,t*.5)),i=t/2,a=r/2;e.save(),e.globalAlpha=.35,e.strokeStyle=`rgba(0,255,208,.6)`,e.lineWidth=2,e.beginPath(),e.moveTo(i-a,20),e.lineTo(i+a,20),e.stroke();let o=ze(r*L*2);e.globalAlpha=.2,e.fillStyle=`#ffd36e`,e.fillRect(i-o,17,o*2,6),e.globalAlpha=.9,e.fillStyle=`#00ffd0`;let s=i-a+n*r;e.beginPath(),e.arc(s,20,4,0,Math.PI*2),e.fill(),e.restore()}function ze(e){return e/2}function Be(e,t,n){e.save(),e.globalAlpha=.08,e.strokeStyle=`rgba(255,255,255,0.15)`,e.lineWidth=1;let r=t/2,i=n/2,a=(1+Math.sqrt(5))/2,o=4;for(let s=0;s<8;s++){let s=Math.min(t,n)/o;e.beginPath(),e.arc(r,i,s,-Math.PI/2,Math.PI),e.stroke(),o*=a}e.restore()}var J={background:`linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04))`,border:`1px solid rgba(255,255,255,0.25)`,borderRadius:10,color:`rgba(255,255,255,0.9)`,fontSize:18,lineHeight:1,padding:0,display:`flex`,alignItems:`center`,justifyContent:`center`,minWidth:36,minHeight:36,touchAction:`none`};(()=>{let e=Array.from({length:31},()=>Array.from({length:28},()=>2));for(let t=0;t<28;t++)e[0][t]=1,e[30][t]=1;for(let t=0;t<31;t++)e[t][0]=1,e[t][27]=1;for(let t=4;t<24;t+=6)for(let n=4;n<27;n+=6)e[n][t]=1,e[n][t+1]=1,e[n+1][t]=1,e[n+1][t+1]=1;for(let t=2;t<26;t++)e[15][t]=0;e[1][1]=3,e[1][26]=3,e[29][1]=3,e[29][26]=3;for(let t=2;t<29;t++)e[t][14]=0;for(let t=2;t<26;t++)e[11][t]=0;return e})();var Ve=5236,Y=3,He=Y*2,Ue=2,We=.15,Ge=220,Ke=60,qe=20;function Je(e){return(Math.imul(e^2654435769,2654435761)>>>0)%1e5/1e5}function Ye(e,t){let n=Math.abs(e-t)%360;return n>180&&(n=360-n),n}var Xe=({currentPhi:e,onPhiChange:t})=>{let[n,r]=(0,d.useState)(`forge`),[i,a]=(0,d.useState)(null),[o,s]=(0,d.useState)(performance.now()),[c,l]=(0,d.useState)(0),[u,f]=(0,d.useState)(!1),[p,m]=(0,d.useState)(null),[h,g]=(0,d.useState)(0);ee({onPulse:e=>{a(e),s(performance.now()),m(e=>e&&{...e,delta:e.delta})}}),(0,d.useEffect)(()=>{if(n!==`forge`)return;let e=0,t=!0,r=()=>{if(!t)return;let n=performance.now();l(Math.max(0,n-o)%Ve/Ve*360%360),e=requestAnimationFrame(r)};return e=requestAnimationFrame(r),()=>{t=!1,cancelAnimationFrame(e)}},[o,n]);let _=(0,d.useMemo)(()=>{let e=i??0,t=Math.floor(Je(e)*360),n=Ke+(e%2==0?qe:0)-Math.min(20,Math.floor(h*6));return{centerDeg:t,halfWidthDeg:Math.max(10,n/2)}},[i,h]),v=(0,d.useMemo)(()=>n===`forge`&&!u&&e>=Y&&i!==null,[n,u,e,i]),b=(0,d.useCallback)(e=>{let t=He,n=1+h*We,r=e?Ue:1;return Math.floor(t*n*r)},[h]),x=(0,d.useCallback)(()=>{if(!v)return;let n=e-Y;t(n),f(!0),m(null);let r=Ye(c,_.centerDeg),i=Math.max(4,_.halfWidthDeg*.25),a=r<=_.halfWidthDeg,o=a&&r<=i;window.setTimeout(()=>{if(a){let e=b(o);t(n+e),g(e=>e+1),m({kind:o?`crit`:`hit`,delta:e})}else g(0),m({kind:`miss`,delta:-Y});f(!1)},650)},[v,e,t,c,_.centerDeg,_.halfWidthDeg,b]);return(0,d.useEffect)(()=>{if(n!==`forge`)return;let e=e=>{let t=e.key.toLowerCase();(t===` `||t===`enter`)&&(e.preventDefault(),x())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,x]),(0,y.jsx)(`div`,{className:`pf-wrap`,role:`group`,"aria-label":`Pulse Forge`,children:n===`forge`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`pf-header`,children:[(0,y.jsx)(`div`,{className:`pf-title`,children:`⚒️ Pulse Forge`}),(0,y.jsx)(`div`,{className:`pf-sub`,children:`Time your lock to the target arc. Breathe, focus, forge.`}),(0,y.jsx)(`div`,{style:{marginLeft:`auto`,display:`flex`,gap:8},children:(0,y.jsx)(`button`,{type:`button`,className:`pf-lock-btn`,onClick:()=>r(`maze`),title:`Switch to Kai-Maze`,children:`Play Kai-Maze`})})]}),(0,y.jsxs)(`div`,{className:`pf-board`,children:[(0,y.jsxs)(`div`,{className:`pf-dial`,style:{width:Ge,height:Ge},children:[(0,y.jsx)(`div`,{className:`pf-arc`,style:{"--arc-center":`${_.centerDeg}deg`,"--arc-half":`${_.halfWidthDeg}deg`},"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`pf-marker ${u?`pf-marker--lock`:``}`,style:{transform:`rotate(${c}deg)`},"aria-hidden":!0,children:(0,y.jsx)(`div`,{className:`pf-marker-head`})}),(0,y.jsx)(`div`,{className:`pf-rim`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`pf-ticks`,"aria-hidden":!0,children:Array.from({length:12}).map((e,t)=>(0,y.jsx)(`span`,{style:{transform:`rotate(${t*30}deg)`}},t))})]}),(0,y.jsxs)(`div`,{className:`pf-hud`,children:[(0,y.jsxs)(`div`,{className:`pf-chip`,title:`Your Φ`,children:[(0,y.jsx)(`span`,{className:`pf-chip__label`,children:`Φ`}),(0,y.jsx)(`span`,{className:`pf-chip__val`,children:e})]}),(0,y.jsxs)(`div`,{className:`pf-chip`,title:`Streak`,children:[(0,y.jsx)(`span`,{className:`pf-chip__label`,children:`Streak`}),(0,y.jsx)(`span`,{className:`pf-chip__val`,children:h})]}),(0,y.jsxs)(`div`,{className:`pf-chip`,title:`Pulse`,children:[(0,y.jsx)(`span`,{className:`pf-chip__label`,children:`Pulse`}),(0,y.jsx)(`span`,{className:`pf-chip__val`,children:i??`—`})]})]})]}),(0,y.jsxs)(`div`,{className:`pf-cta`,children:[(0,y.jsx)(`button`,{className:`pf-lock-btn`,onClick:x,disabled:!v,"aria-disabled":!v,title:v?`Press Space/Enter to Lock`:`Insufficient Φ or syncing…`,children:u?`Locking…`:`Lock (−${Y} Φ)`}),(0,y.jsxs)(`div`,{className:`pf-hint`,children:[`Press `,(0,y.jsx)(`kbd`,{children:`Space`}),` or `,(0,y.jsx)(`kbd`,{children:`Enter`}),` at the right moment. Even pulses widen the target.`]})]}),p&&(0,y.jsxs)(`div`,{className:`pf-result pf-result--${p.kind}`,role:`status`,"aria-live":`polite`,children:[p.kind===`hit`&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:`pf-result__emoji`,children:`✅`}),(0,y.jsxs)(`span`,{className:`pf-result__text`,children:[`Resonant lock! +`,p.delta,` Φ`]})]}),p.kind===`crit`&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:`pf-result__emoji`,children:`💥`}),(0,y.jsxs)(`span`,{className:`pf-result__text`,children:[`Perfect lock! +`,p.delta,` Φ`]})]}),p.kind===`miss`&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:`pf-result__emoji`,children:`❌`}),(0,y.jsx)(`span`,{className:`pf-result__text`,children:`Miss — breathe again.`})]})]})]}):(0,y.jsx)(Fe,{currentPhi:e,onPhiChange:t,onExit:()=>r(`forge`)})})};function Ze(){return`kai-${Math.random().toString(36).slice(2,8)}`}function Qe(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.x==`number`&&typeof t.pulseIndex==`number`&&typeof t.chakraDay==`string`&&typeof t.glyph==`object`&&t.glyph!==null}var $e=null;async function et(){return $e||($e=(await r(()=>import(`./bundler-BiZDI_w8.js`),__vite__mapDeps([0,1,2]))).default,$e)}function tt(e){let[t]=(0,d.useState)(()=>e??Ze()),[n,r]=(0,d.useState)([]),[i,a]=(0,d.useState)([]),o=(0,d.useRef)(null),s=(0,d.useRef)({}),c=(0,d.useCallback)((e,t)=>{if(!Qe(t))return;let n={...t,id:e,glyph:t.glyph};a(t=>{let r=t.findIndex(t=>t.id===e);if(r>=0){let e=[...t];return e[r]=n,e}return[...t,n]})},[]),l=(0,d.useCallback)((e,t)=>{Qe(e)&&c(t,e)},[c]);return(0,d.useEffect)(()=>{let e=!1;return(async()=>{let n=await et();if(e)return;let i=new n(t);o.current=i,i.on(`open`,()=>{r(e=>e)}),i.on(`connection`,e=>{s.current[e.peer]=e,r(t=>Array.from(new Set([...t,e.peer]))),e.on(`data`,t=>{l(t,e.peer)}),e.on(`close`,()=>{delete s.current[e.peer],r(t=>t.filter(t=>t!==e.peer)),a(t=>t.filter(t=>t.id!==e.peer))})})})().catch(e=>{console.error(`[KaiRealms] Peer init failed:`,e)}),()=>{e=!0;try{o.current?.destroy()}catch(e){console.warn(`[KaiRealms] Peer destroy failed:`,e)}o.current=null,s.current={},r([]),a([])}},[t,l]),{sessionId:t,peers:n,sendState:(0,d.useCallback)(e=>{let t=Object.values(s.current);for(let n of t)n.open&&n.send(e)},[]),remoteStates:i}}var nt=800,rt=500,it=nt/rt,X=28,Z=10,at=360,ot=10,Q=5236,st=.08,ct=22,lt=90,ut=80,dt=2,ft=4,pt=10,mt=3,ht=1,gt=3,_t=1,vt=1,$=(e,t,n)=>en?n:e,yt=({glyphData:e,onExit:t})=>{let n=(0,d.useRef)(null),r=(0,d.useRef)(null),i=(0,d.useRef)(null),[a,o]=(0,d.useState)({w:nt,h:rt}),s=(0,d.useRef)(a);(0,d.useEffect)(()=>{s.current=a},[a]);let[c,l]=(0,d.useState)(0),[u,f]=(0,d.useState)(0),[p,m]=(0,d.useState)(!1),[h,g]=(0,d.useState)(mt),[_,v]=(0,d.useState)(0),[b,x]=(0,d.useState)(0),[S,C]=(0,d.useState)(!1),w=(0,d.useRef)(performance.now()),{sendState:T,remoteStates:E}=tt(),D=(0,d.useRef)([]);(0,d.useEffect)(()=>{D.current=E??[]},[E]);let O=(0,d.useRef)(nt/2),k=(0,d.useRef)([]),A=(0,d.useRef)({}),j=(0,d.useRef)(null),M=(0,d.useRef)(null),N=(0,d.useRef)(null),P=(0,d.useRef)(0),te=(0,d.useRef)(0),F=(0,d.useRef)(null);(0,d.useEffect)(()=>{let e=n.current;if(!e)return;let t=new ResizeObserver(e=>{let t=e[0].contentRect,n=Math.max(320,Math.min(960,t.width));o({w:n,h:Math.round(n/it)})});return t.observe(e),()=>t.disconnect()},[]),(0,d.useEffect)(()=>{let e=r.current;if(!e)return;let t=e.getContext(`2d`);if(!t)return;let n=Math.min(2,window.devicePixelRatio||1);e.style.width=`${a.w}px`,e.style.height=`${a.h}px`,e.width=Math.floor(a.w*n),e.height=Math.floor(a.h*n),t.setTransform(n,0,0,n,0,0),i.current=t,O.current=$(O.current,X,a.w-X)},[a]),(0,d.useEffect)(()=>{let e=e=>{A.current[e.key]=!0,e.key.toLowerCase()===`p`&&m(e=>!e),e.key.toLowerCase()===`r`&&S&&R()},t=e=>{A.current[e.key]=!1};return window.addEventListener(`keydown`,e),window.addEventListener(`keyup`,t),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`keyup`,t)}},[S]),(0,d.useEffect)(()=>{let e=r.current;if(!e)return;let t=t=>{let n=e.getBoundingClientRect();return $((t-n.left)/n.width*s.current.w,X,s.current.w-X)},n=!1,i=e=>{n=!0,O.current=t(e.clientX)},a=e=>{n&&(O.current=t(e.clientX))},o=()=>{n=!1};return e.addEventListener(`pointerdown`,i),e.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o),()=>{e.removeEventListener(`pointerdown`,i),e.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o)}},[]);let ne=e=>Math.max(0,e-w.current)%Q/Q,re=e=>{let t=Math.sin(Math.PI*e);return .65+.7*(t*t)},I=e=>{let{w:t}=s.current,n=performance.now(),r=Math.random()*(t-2*Z)+Z,i=-Z*2,a=(Math.random()-.5)*40,o=(e===`gold`?ut:lt)+_*(pt*.2),c={id:`${e}-${n}-${Math.floor(Math.random()*1e6)}`,x:r,y:i,vx:a,baseVy:o,kind:e,bornAt:n},l=k.current.slice(-(ct-1));l.push(c),k.current=l};ee({onPulse:e=>{f(e),w.current=performance.now(),te.current+=1;for(let e=0;e{let n=N.current,r=O.current,i=u;if(!n||Math.abs(n.x-r)>=1||n.pulseIndex!==i||t-P.current>1e3/ot){N.current={x:r,pulseIndex:i},P.current=t;try{T({id:`you`,x:r,pulseIndex:i,chakraDay:e.meta.chakraDay,glyph:e})}catch{}}};(0,d.useEffect)(()=>{let t=r.current,n=i.current;if(!t||!n)return;let a=!0,o=t=>{if(!a)return;j.current=requestAnimationFrame(o);let r=M.current??t,i=Math.min(.05,(t-r)/1e3);M.current=t;let{w:c,h:u}=s.current,d=u-X-10;if(!p&&!S){let e=A.current,n=!!(e.ArrowLeft||e.a||e.A),r=!!(e.ArrowRight||e.d||e.D);n&&(O.current=$(O.current-at*i,X,c-X)),r&&(O.current=$(O.current+at*i,X,c-X));let a=O.current,o=performance.now(),s=ne(o),f=re(s),p=[],m=0,h=0,y=0;for(let e=0;ec-Z&&(t.x=c-Z,t.vx=-Math.abs(t.vx)*.9);let r=t.x-a,l=t.y-d;if(Math.hypot(r,l)u+Z){y+=1;continue}p.push(t)}if(m>0||h>0){let e=m+h;l(t=>t+e),v(e=>{let t=e+1;return x(e=>t>e?t:e),t})}y>0&&(l(e=>Math.max(0,e-ht*y)),v(0),g(e=>{let t=Math.max(0,e-y);return t===0&&C(!0),t})),k.current=p,L(t)}bt(n,e,O.current,d,p||S,k.current,D.current,s.current,w.current,F.current)};return j.current=requestAnimationFrame(o),()=>{a=!1,j.current!==null&&cancelAnimationFrame(j.current),j.current=null,M.current=null}},[e,p,S,a.w,a.h]);let R=()=>{k.current=[],g(mt),v(0),x(e=>e),C(!1)},ie=(0,d.useMemo)(()=>({pulse:u,chakraDay:e?.meta?.chakraDay??`—`}),[u,e?.meta?.chakraDay]);return(0,y.jsxs)(`div`,{className:`realm-wrap`,ref:n,children:[(0,y.jsxs)(`div`,{className:`realm-hud`,children:[(0,y.jsxs)(`div`,{className:`hud-chip hud-chip--score`,title:`Banked Φ`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Φ`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:c})]}),(0,y.jsxs)(`div`,{className:`hud-chip`,title:`Streak`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Streak`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:_})]}),(0,y.jsxs)(`div`,{className:`hud-chip`,title:`Lives`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Lives`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:h})]}),(0,y.jsxs)(`div`,{className:`hud-chip`,title:`Current Pulse`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Pulse`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:ie.pulse})]}),(0,y.jsxs)(`div`,{className:`hud-chip`,title:`Chakra Day`,children:[(0,y.jsx)(`span`,{className:`hud-chip__label`,children:`Day`}),(0,y.jsx)(`span`,{className:`hud-chip__value`,children:ie.chakraDay})]}),(0,y.jsx)(`button`,{className:`hud-button`,onClick:()=>m(e=>!e),"aria-pressed":p,title:`Pause (P)`,children:p?`Resume`:`Pause`})]}),(0,y.jsxs)(`div`,{className:`realm-canvas-wrap`,children:[(0,y.jsx)(`canvas`,{ref:r,className:`realm-canvas`,"aria-label":`Kai Realms Canvas`}),(p||S)&&(0,y.jsx)(`div`,{className:`realm-pause-overlay`,"aria-hidden":!0,children:(0,y.jsxs)(`div`,{className:`pause-card`,children:[(0,y.jsx)(`div`,{className:`pause-title`,children:S?`Game Over`:`Paused`}),(0,y.jsx)(`div`,{className:`pause-sub`,children:S?(0,y.jsxs)(y.Fragment,{children:[`Best Streak: `,(0,y.jsx)(`strong`,{children:b}),` — Press `,(0,y.jsx)(`kbd`,{children:`R`}),` to Restart`]}):(0,y.jsxs)(y.Fragment,{children:[`Press `,(0,y.jsx)(`kbd`,{children:`P`}),` or click Resume`]})}),S&&(0,y.jsx)(`button`,{className:`hud-button`,onClick:R,style:{marginTop:12},children:`Restart`})]})})]}),(0,y.jsx)(Xe,{currentPhi:c,onPhiChange:e=>l(e)}),(0,y.jsx)(`button`,{className:`exit-button`,onClick:t,children:`Exit Realm`})]})};function bt(e,t,n,r,i,a,o,s,c,l){let{w:u,h:d}=s,f=e.createLinearGradient(0,0,0,d);f.addColorStop(0,`#020211`),f.addColorStop(1,`#0b0f2a`),e.fillStyle=f,e.fillRect(0,0,u,d),e.save(),e.globalAlpha=.12;for(let t=0;t<40;t++){let n=t*197%u+t%3,r=t*127%d+t*11%7;e.fillStyle=`white`,e.fillRect(n,r,2,2)}e.restore(),xt(e,u,Math.max(36,Math.round(d*.06)),c);for(let t=0;t{let[n,r]=(0,d.useState)(null),i=(0,d.useRef)(null),a=(0,d.useRef)(null),o=(0,d.useCallback)(e=>r(e),[]),s=(0,d.useCallback)(()=>{r(null),t?.()},[t]);(0,d.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t?.()};return document.addEventListener(`keydown`,e),a.current?.focus(),()=>document.removeEventListener(`keydown`,e)},[t]),(0,d.useEffect)(()=>{let e=i.current;if(!e)return;let t=e=>e.stopPropagation();return e.addEventListener(`wheel`,t,{passive:!0}),()=>e.removeEventListener(`wheel`,t)},[]);let c=()=>t?.(),l=e=>e.stopPropagation();return(0,y.jsxs)(`div`,{className:`realms-backdrop realms-veil`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`kai-realms-title`,onMouseDown:c,children:[(0,y.jsx)(`div`,{className:`realms-stars`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`realms-halo realms-halo--1`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`realms-halo realms-halo--2`,"aria-hidden":!0}),(0,y.jsxs)(`div`,{ref:i,className:`realms-container glass-omni`,onMouseDown:l,role:`document`,children:[(0,y.jsx)(`div`,{className:`breath-ring breath-ring--outer`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`breath-ring breath-ring--inner`,"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`phi-grid`,"aria-hidden":!0}),(0,y.jsxs)(`header`,{className:`realms-header`,children:[(0,y.jsx)(`button`,{ref:a,type:`button`,className:`realms-close auric-btn`,"aria-label":`Close Kai Realms`,onClick:e=>{e.stopPropagation(),t?.()},onMouseDown:e=>e.stopPropagation(),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),t?.())},children:(0,y.jsx)(e,{size:20,"aria-hidden":!0})}),(0,y.jsx)(`div`,{className:`header-seals`,"aria-hidden":!0,children:(0,y.jsxs)(`div`,{className:`seal-emblem`,children:[(0,y.jsx)(`div`,{className:`seal-ring`}),(0,y.jsx)(`div`,{className:`seal-ring seal-ring--inner`}),(0,y.jsx)(`div`,{className:`seal-core`})]})}),(0,y.jsx)(`h2`,{id:`kai-realms-title`,className:`sr-only`,children:`Kai Realms — Sigil Gate`})]}),(0,y.jsx)(`main`,{className:`realms-body`,children:n?(0,y.jsx)(`div`,{className:`realm-stage`,children:(0,y.jsx)(yt,{glyphData:n,onExit:s})}):(0,y.jsx)(`div`,{className:`portal-stage`,children:(0,y.jsx)(x,{onEnter:o})})}),(0,y.jsx)(`footer`,{className:`realms-footer`,"aria-hidden":!0,children:(0,y.jsx)(`div`,{className:`footer-center`,style:{margin:`0 auto`},children:(0,y.jsx)(wt,{})})})]})]})};function wt(){return(0,y.jsxs)(`svg`,{className:`seal-coin`,width:`56`,height:`56`,viewBox:`0 0 56 56`,"aria-hidden":!0,children:[(0,y.jsxs)(`defs`,{children:[(0,y.jsxs)(`radialGradient`,{id:`coinGlowRealms`,cx:`50%`,cy:`50%`,r:`50%`,children:[(0,y.jsx)(`stop`,{offset:`0%`,stopColor:`#ffffff`,stopOpacity:`0.9`}),(0,y.jsx)(`stop`,{offset:`40%`,stopColor:`#ffd86b`,stopOpacity:`0.75`}),(0,y.jsx)(`stop`,{offset:`100%`,stopColor:`#ffd86b`,stopOpacity:`0.15`})]}),(0,y.jsxs)(`linearGradient`,{id:`coinEdgeRealms`,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,y.jsx)(`stop`,{offset:`0%`,stopColor:`#00ffd0`,stopOpacity:`0.8`}),(0,y.jsx)(`stop`,{offset:`100%`,stopColor:`#8a2be2`,stopOpacity:`0.8`})]})]}),(0,y.jsx)(`circle`,{cx:`28`,cy:`28`,r:`26`,fill:`url(#coinGlowRealms)`,stroke:`url(#coinEdgeRealms)`,strokeWidth:`1.5`}),(0,y.jsxs)(`g`,{className:`seal-coin__rotor`,children:[(0,y.jsx)(`circle`,{cx:`28`,cy:`28`,r:`18`,fill:`none`,stroke:`url(#coinEdgeRealms)`,strokeWidth:`1.25`}),(0,y.jsxs)(`g`,{stroke:`rgba(255,255,255,0.35)`,strokeWidth:`0.6`,children:[(0,y.jsx)(`line`,{x1:`28`,y1:`10`,x2:`28`,y2:`46`}),(0,y.jsx)(`line`,{x1:`10`,y1:`28`,x2:`46`,y2:`28`}),(0,y.jsx)(`line`,{x1:`15`,y1:`15`,x2:`41`,y2:`41`}),(0,y.jsx)(`line`,{x1:`41`,y1:`15`,x2:`15`,y2:`41`})]})]}),(0,y.jsx)(`circle`,{className:`seal-coin__core`,cx:`28`,cy:`28`,r:`6.5`})]})}export{Ct as default}; \ No newline at end of file diff --git a/dist/assets/KaiVohApp-gp6G11ut.js b/dist/assets/KaiVohApp-ShUUTiq2.js similarity index 99% rename from dist/assets/KaiVohApp-gp6G11ut.js rename to dist/assets/KaiVohApp-ShUUTiq2.js index 0521fafa..593fb25c 100644 --- a/dist/assets/KaiVohApp-gp6G11ut.js +++ b/dist/assets/KaiVohApp-ShUUTiq2.js @@ -1,4 +1,4 @@ -import{$ as e,$t as t,A as n,D as r,E as i,En as a,F as o,Ht as s,K as c,M as l,N as u,O as d,P as f,Q as p,T as m,Tn as h,Z as g,_n as _,at as v,ct as y,dt as b,en as x,fn as ee,ft as S,gn as C,ht as w,j as T,jn as E,k as D,ln as O,lt as te,mn as k,nt as ne,ot as re,pn as A,pt as j,st as ie,tn as M,un as ae,ut as oe}from"./index-CgC-NZbJ.js";import"./prop-types-CRrLra82.js";import{n as se}from"./SigilAuthContext-CmP6HWSa.js";import{n as N,t as P}from"./sigilRegistry-D8l_pIbq.js";import{i as ce,r as le}from"./postSeal-ClZBwRbf.js";import{a as F,i as I,n as L,r as R,t as z}from"./VerifierFrame-BP2mhmRz.js";var B=E(h(),1);const ue=(0,B.createContext)(void 0);var V=E(M(),1);function de({children:e}){let[t,n]=(0,B.useState)(null),r=(0,B.useMemo)(()=>({session:t,setSession:e=>n(e),clearSession:()=>n(null)}),[t]);return(0,V.jsx)(ue.Provider,{value:r,children:e})}function H(){let e=(0,B.useContext)(ue);if(!e)throw Error(`useSession must be used within a SessionProvider`);return e}var U=[`video/webm;codecs=vp9,opus`,`video/webm;codecs=vp8,opus`,`video/webm`,`video/mp4;codecs=h264,aac`,`video/mp4`],fe=typeof window<`u`&&`MediaRecorder`in window;async function pe(e){let t=await crypto.subtle.digest(`SHA-256`,e),n=new Uint8Array(t),r=``;for(let e=0;eW(),[]);function ne(){let e=typeof performance<`u`?performance:null,t=(e&&typeof e.timeOrigin==`number`?e.timeOrigin:NaN)+(e?e.now():NaN);return Number.isFinite(t)?Math.floor(t):Date.now()}(0,B.useEffect)(()=>{if(t)return(async()=>{s(null),l(!0);try{await re()}catch(e){s(e instanceof Error?e.message:`Failed to access camera.`)}finally{l(!1)}})(),()=>{A()}},[t,u,f]),(0,B.useEffect)(()=>{t&&j().catch(()=>_(!1))},[t,u]);async function re(){A();let e={audio:{echoCancellation:!0,noiseSuppression:!0},video:{facingMode:u,width:{ideal:1080},height:{ideal:1920},frameRate:{ideal:30,max:60}}},t=await navigator.mediaDevices.getUserMedia(e);C.current=t,w.current&&(w.current.srcObject=t,w.current.muted=!0,await w.current.play().catch(()=>{})),await ie(m&&g)}function A(){if(P(!0),w.current&&(w.current.pause(),w.current.srcObject=null),C.current)for(let e of C.current.getTracks())e.stop();C.current=null,h(!1),y(!1),x(0),S(0),O.current!==null&&(cancelAnimationFrame(O.current),O.current=null)}async function j(){let e=C.current;if(!e){_(!1);return}let[t]=e.getVideoTracks();if(!t){_(!1);return}let n=t.getCapabilities?.()??{};_(!!(typeof n.torch==`boolean`&&n.torch)&&u===`environment`)}async function ie(e){let t=C.current;if(!t)return;let[n]=t.getVideoTracks();if(!(!n||!n.applyConstraints))try{g&&u===`environment`&&await n.applyConstraints({advanced:[{torch:e}]})}catch{}}function M(){d(e=>e===`user`?`environment`:`user`)}function ae(){p(e=>!e)}async function oe(){if(!g)return;let e=!m;h(e),await ie(e)}function se(){if(!v)return;let e=performance.now()-D.current;if(S(e),x(Math.min(1,e/i)),e>=i){P(!1);return}O.current=requestAnimationFrame(se)}function N(){if(!fe){s(`MediaRecorder is not supported on this browser.`);return}if(v)return;s(null);let e=C.current;if(!e){s(`No camera stream.`);return}for(let t of e.getAudioTracks())t.enabled=!f;let t=te??``,n;try{n=t?new MediaRecorder(e,{mimeType:t,videoBitsPerSecond:35e5}):new MediaRecorder(e)}catch{n=new MediaRecorder(e)}T.current=n,E.current=[],n.ondataavailable=e=>{e.data&&e.data.size>0&&E.current.push(e.data)},n.onstop=()=>{ce()},n.start(250),y(!0),D.current=performance.now(),O.current=requestAnimationFrame(se)}function P(e){if(!v)return;let t=T.current;if(t){try{t.state!==`inactive`&&t.stop()}catch{}y(!1),O.current!==null&&(cancelAnimationFrame(O.current),O.current=null),e&&(E.current=[],x(0),S(0))}}async function ce(){let e=E.current;if(E.current=[],!e.length)return;let t=Math.max(0,Math.min(i,performance.now()-D.current)),n=T.current?.mimeType||te||`video/webm`,a=new Blob(e,{type:n}),o=ne(),s=k(BigInt(o)),{width:c,height:l,thumbnailDataUrl:u}=await le(a),d=await pe(await a.arrayBuffer()),f=`story_${s.toString()}.${n.includes(`mp4`)?`mp4`:`webm`}`;r({blob:a,file:new File([a],f,{type:n,lastModified:o}),mimeType:n,durationMs:t,width:c,height:l,thumbnailDataUrl:u,sha256:d,createdAt:o})}async function le(e){let t=URL.createObjectURL(e);try{let e=document.createElement(`video`);e.src=t,e.muted=!0,await e.play().catch(()=>void 0),await new Promise(t=>{let n=()=>{e.pause(),e.currentTime=0},r=()=>{n(),t()};e.onloadeddata=r,setTimeout(r,250)});let n=e.videoWidth||1080,r=e.videoHeight||1920,i=document.createElement(`canvas`);i.width=n,i.height=r;let a=i.getContext(`2d`);return a&&a.drawImage(e,0,0,n,r),{width:n,height:r,thumbnailDataUrl:i.toDataURL(`image/png`,.9)}}finally{URL.revokeObjectURL(t)}}function F(){v||N()}function I(){v&&P(!1)}function L(){v?P(!1):N()}return t?(0,V.jsxs)(`div`,{className:`story-rec-overlay`,role:`dialog`,"aria-modal":`true`,"aria-label":`Story recorder`,children:[(0,V.jsx)(`div`,{className:`story-rec-video-wrap`,children:(0,V.jsx)(`video`,{ref:w,className:`story-rec-video ${u===`user`?`mirror`:``}`,playsInline:!0})}),(0,V.jsxs)(`div`,{className:`story-rec-topbar`,children:[(0,V.jsx)(`button`,{type:`button`,className:`story-btn top left`,"aria-label":`Close`,onClick:()=>{A(),n()},children:`✕`}),(0,V.jsx)(`div`,{className:`story-top-center`,children:(0,V.jsxs)(`div`,{className:`story-timer mono`,children:[he(ee),` / `,he(i)]})}),(0,V.jsxs)(`div`,{className:`story-top-actions`,children:[(0,V.jsx)(`button`,{type:`button`,className:`story-btn ${f?`active`:``}`,"aria-pressed":f,"aria-label":f?`Unmute microphone`:`Mute microphone`,onClick:ae,title:f?`Unmute mic`:`Mute mic`,children:f?`🔇`:`🎙️`}),(0,V.jsx)(`button`,{type:`button`,className:`story-btn ${u===`environment`&&g?``:`disabled`}`,disabled:!(u===`environment`&&g),onClick:()=>void oe(),"aria-label":`Toggle torch`,title:g?m?`Torch on`:`Torch off`:`Torch not supported`,children:m?`🔦`:`💡`}),(0,V.jsx)(`button`,{type:`button`,className:`story-btn`,"aria-label":`Flip camera`,onClick:M,title:`Flip camera`,children:`🔁`})]})]}),(0,V.jsxs)(`div`,{className:`story-rec-bottombar`,children:[(0,V.jsx)(`div`,{className:`record-wrap`,children:(0,V.jsxs)(`button`,{type:`button`,className:`record-btn ${v?`recording`:``}`,"aria-pressed":v,"aria-label":v?`Stop recording`:`Start recording`,onClick:L,onPointerDown:F,onPointerUp:I,onPointerLeave:I,children:[(0,V.jsx)(`span`,{className:`progress-ring`,style:{background:`conic-gradient(currentColor ${b*360}deg, transparent 0)`}}),(0,V.jsx)(`span`,{className:`dot`})]})}),o&&(0,V.jsx)(`div`,{className:`story-rec-error`,children:o}),c&&(0,V.jsx)(`div`,{className:`story-rec-hint`,children:`Initializing camera…`})]})]}):null}function he(e){let t=Math.floor(e/1e3);return`${Math.floor(t/60).toString().padStart(2,`0`)}:${(t%60).toString().padStart(2,`0`)}`}var G={phiKey:[`userPhiKey`,`phiKey`,`phikey`,`ΦKey`,`walletPhiKey`],kaiSig:[`kaiSignature`,`kaiSig`,`ksig`,`ΣSig`,`sig`,`signature`],sigilId:[`sigilId`,`sigilID`,`glyphId`,`glyphID`,`sigil_id`,`glyph_id`],url:[`sigilActionUrl`,`sigilUrl`,`actionUrl`,`url`,`claimedUrl`,`loginUrl`,`sourceUrl`,`originUrl`,`link`,`href`]};function ge(e){if(typeof e!=`string`||!e.trim())return!1;try{let t=new URL(e,globalThis.location?.origin??`https://example.org`);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}}function K(e,t){if(typeof e!=`object`||!e)return;let n=e;for(let e of t){let t=n[e];if(typeof t==`string`&&t.trim())return t.trim()}let r=n.meta;if(typeof r==`object`&&r){let e=r;for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim())return t.trim()}}}function _e(e){return e.replace(/^$/,``).trim()}function ve(e){let t=e.trim();if(!t)return;try{let e=JSON.parse(t);if(typeof e==`object`&&e)return e}catch{}let n=t.match(/\{[\s\S]*\}/);if(n)try{let e=JSON.parse(n[0]);if(typeof e==`object`&&e)return e}catch{}}function ye(e,t){let n=RegExp(`${t}"?\\s*[:=]\\s*"?([^"\\n\\r<>{}]+)"?`,`i`),r=e.match(n);if(r)return(r[1]??``).trim()||void 0}function be(e){let t={};for(let n of G.phiKey){let r=ye(e,n);if(r){t.userPhiKey=r;break}}for(let n of G.kaiSig){let r=ye(e,n);if(r){t.kaiSignature=r;break}}for(let n of G.sigilId){let r=ye(e,n);if(r){t.sigilId=r;break}}for(let n of G.url){let r=ye(e,n);if(r&&ge(r))return t.actionUrl=r,t}let n=e.match(/https?:\/\/[^\s"'<>)#]+/i);return n&&ge(n[0])&&(t.actionUrl=n[0]),t}function xe(e,t){return{userPhiKey:e.userPhiKey??t.userPhiKey,kaiSignature:e.kaiSignature??t.kaiSignature,sigilId:e.sigilId??t.sigilId,actionUrl:e.actionUrl??t.actionUrl,meta:e.meta??t.meta}}function Se(e){let t=(e??``).trim();if(!t)return{};try{let e=new DOMParser().parseFromString(t,`image/svg+xml`),n=e.getElementsByTagName(`parsererror`);if(n&&n.length>0)return be(t);let r=e.documentElement,i={};if(r&&r.attributes)for(let e of Array.from(r.attributes))i[e.name]=e.value;let a={userPhiKey:K(i,G.phiKey),kaiSignature:K(i,G.kaiSig),sigilId:K(i,G.sigilId),actionUrl:(()=>{let e=K(i,G.url);return e&&ge(e)?e:void 0})(),meta:void 0},o=Array.from(e.getElementsByTagName(`metadata`));for(let e of o){let t=_e((e.textContent??``).trim());if(!t)continue;let n=ve(t);if(n){let e={userPhiKey:K(n,G.phiKey),kaiSignature:K(n,G.kaiSig),sigilId:K(n,G.sigilId),actionUrl:(()=>{let e=K(n,G.url);return e&&ge(e)?e:void 0})(),meta:n};if(a=xe(a,e),a.userPhiKey&&a.kaiSignature)return a}else a=xe(a,be(t))}for(let t of Array.from(e.getElementsByTagName(`desc`))){let e=_e((t.textContent??``).trim());if(!e)continue;let n=ve(e);if(n){let e={userPhiKey:K(n,G.phiKey),kaiSignature:K(n,G.kaiSig),sigilId:K(n,G.sigilId),actionUrl:(()=>{let e=K(n,G.url);return e&&ge(e)?e:void 0})(),meta:n};a=xe(a,e)}else a=xe(a,be(e));if(a.userPhiKey&&a.kaiSignature)return a}for(let t of Array.from(e.getElementsByTagName(`a`))){let e=t.getAttribute(`href`)||t.getAttribute(`xlink:href`);if(e&&ge(e)){a.actionUrl=a.actionUrl??e;break}}return(!a.userPhiKey||!a.kaiSignature)&&(a=xe(a,be(t))),a}catch{return be(t)}}var Ce=new TextEncoder;function q(){if(typeof crypto>`u`||!crypto.subtle)throw Error(`WebCrypto subtle unavailable`);return crypto.subtle}function we(e){if(e.buffer instanceof ArrayBuffer)return e;let t=new Uint8Array(e.byteLength);return t.set(e),t}function J(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`).trim();if(!/^[A-Za-z0-9+/]*={0,2}$/.test(t))throw Error(`Invalid base64/base64url`);let n=(4-t.length%4)%4,r=t+`=`.repeat(n),i=new Int16Array(128).fill(-1);for(let e=0;e<64;e++)i[`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.charCodeAt(e)]=e;let a=Math.floor(r.length*3/4)-(r.endsWith(`==`)?2:r.endsWith(`=`)?1:0),o=new Uint8Array(a),s=0;for(let e=0;e>>16&255),s>>8&255),s>>18&63]+t[r>>>12&63]+t[r>>>6&63]+t[r&63])}let a=r-i;if(a===1){let r=e[i]<<16;n.push(t[r>>>18&63]+t[r>>>12&63]+`==`)}else if(a===2){let r=e[i]<<16|e[i+1]<<8;n.push(t[r>>>18&63]+t[r>>>12&63]+t[r>>>6&63]+`=`)}return n.join(``).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function Ee(e){let t=e.trim().toLowerCase();if(!/^[0-9a-f]+$/.test(t)||t.length%2!=0)throw Error(`Invalid hex`);let n=new Uint8Array(t.length/2);for(let e=0;e=32&&t.length%2==0&&/^[0-9a-fA-F]+$/.test(t)}function Y(e){let t=e.trim();return t.length>=16&&/^[A-Za-z0-9\-_]+$/.test(t)}function Oe(e){let t=e.trim();if(!t)throw Error(`Empty kaiSignature`);if(De(t))return Ee(t);if(Y(t))try{return J(t)}catch{}return we(Ce.encode(t))}async function ke(e){let t=q(),n=await t.importKey(`raw`,e.ikm,{name:`HKDF`},!1,[`deriveBits`]),r=await t.deriveBits({name:`HKDF`,hash:`SHA-256`,salt:e.salt,info:e.info},n,e.bits);return new Uint8Array(r)}async function Ae(e){let t=we(Oe(e.baseKaiSignature)),n=we(J(e.salt_b64url)),r=(e.context??`KaiVoh.deriveKaiSignature.v1`).trim();return await ke({ikm:t,salt:n,info:we(Ce.encode(r)),bits:256})}async function je(e){return Te(await Ae(e))}function Me(){return(0,V.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`ico`,"aria-hidden":`true`,focusable:`false`,children:[(0,V.jsx)(`rect`,{x:`3`,y:`6`,width:`14`,height:`12`,rx:`3`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,V.jsx)(`circle`,{cx:`10`,cy:`12`,r:`3`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,V.jsx)(`path`,{d:`M17 9l4-2v10l-4-2z`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,V.jsx)(`circle`,{cx:`18.5`,cy:`5.5`,r:`2.5`,fill:`currentColor`})]})}function Ne(){return(0,V.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`ico`,"aria-hidden":`true`,focusable:`false`,children:[(0,V.jsx)(`path`,{d:`M3 6h18M9 6V4h6v2M7 6l1 14h8l1-14`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,V.jsx)(`path`,{d:`M10 10v6M14 10v6`,stroke:`currentColor`,strokeWidth:`2`})]})}var Pe=6e3,Fe=1024,Ie=1024*Fe,Le=e=>e>=Ie?`${(e/Ie).toFixed(2)} MB`:e>=Fe?`${(e/Fe).toFixed(2)} KB`:`${e} B`,Re=(e,t=8,n=6)=>e.length<=t+n?e:`${e.slice(0,t)}…${e.slice(-n)}`,ze=e=>{if(typeof e!=`string`||!e)return!1;try{let t=new URL(e,globalThis.location?.origin??`https://example.org`);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}};function Be(e){try{let t=new URL(e,globalThis.location?.origin??`https://example.org`),n=new URLSearchParams(t.hash.replace(/^#/,``)).has(`t`),r=new URLSearchParams(t.search).has(`p`),i=t.pathname,a=/^\/(?:stream|feed)\/p\/[^/]+$/.test(i),o=/^\/p~[^/?#]+$/.test(i);return n||r||a||o}catch{return!1}}function Ve(e){let t=new Uint8Array(e),n=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,r=[],i=t.length,a=0;for(;a+2>>18&63]+n[e>>>12&63]+n[e>>>6&63]+n[e&63])}let o=i-a;if(o===1){let e=t[a]<<16;r.push(n[e>>>18&63]+n[e>>>12&63]+`==`)}else if(o===2){let e=t[a]<<16|t[a+1]<<8;r.push(n[e>>>18&63]+n[e>>>12&63]+n[e>>>6&63]+`=`)}return r.join(``).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function X(e,t){if(typeof e!=`object`||!e)return;let n=e,r=n[t];if(typeof r==`string`)return r;let i=n.meta;if(typeof i==`object`&&i){let e=i[t];if(typeof e==`string`)return e}}function He(e,t){if(typeof e!=`object`||!e)return;let n=e,r=n[t];if(typeof r==`number`&&Number.isFinite(r))return r;let i=n.meta;if(typeof i==`object`&&i){let e=i[t];if(typeof e==`number`&&Number.isFinite(e))return e}}function Ue(e,t){if(!e)return;let n=[`sigilActionUrl`,`sigilUrl`,`actionUrl`,`url`,`claimedUrl`,`loginUrl`,`sourceUrl`,`originUrl`,`link`,`href`];if(t)for(let e of n){let n=t[e];if(ze(n))return n}try{let t=new DOMParser().parseFromString(e,`image/svg+xml`);for(let e of Array.from(t.getElementsByTagName(`metadata`))){let t=(e.textContent??``).trim();if(!t)continue;let r=t.replace(/^$/,``);try{let e=JSON.parse(r);if(typeof e==`object`&&e)for(let t of n){let n=e[t];if(ze(n))return n}}catch{let e=r.match(/https?:\/\/[^\s"'<>)#]+/i);if(e&&ze(e[0]))return e[0]}}for(let e of Array.from(t.getElementsByTagName(`a`))){let t=e.getAttribute(`href`)||e.getAttribute(`xlink:href`);if(ze(t))return t}}catch{}}async function We(e,t,n={}){let r=n.cacheName??`sigil-attachments-v1`,i=(n.pathPrefix??`/att/`).replace(/\/+$/,``)+`/`;try{if(!(`caches`in globalThis)||typeof caches.open!=`function`)return;let n=await caches.open(r),a=`${i}${e}`;return await n.put(new Request(a,{method:`GET`}),new Response(t,{headers:{"Content-Type":t.type||`application/octet-stream`}})),a}catch{return}}function Ge(e){let t=Math.floor(e/1e3);return`${Math.floor(t/60).toString().padStart(2,`0`)}:${(t%60).toString().padStart(2,`0`)}`}function Ke(e){let t=e.indexOf(` +import{$ as e,$t as t,A as n,D as r,E as i,En as a,F as o,Ht as s,K as c,M as l,N as u,O as d,P as f,Q as p,T as m,Tn as h,Z as g,_n as _,at as v,ct as y,dt as b,en as x,fn as ee,ft as S,gn as C,ht as w,j as T,jn as E,k as D,ln as O,lt as te,mn as k,nt as ne,ot as re,pn as A,pt as j,st as ie,tn as M,un as ae,ut as oe}from"./index-BlYU7j-M.js";import"./prop-types-BWhc8UTz.js";import{n as se}from"./SigilAuthContext-CIPXJp4C.js";import{n as N,t as P}from"./sigilRegistry-dB0OrrJi.js";import{i as ce,r as le}from"./postSeal-ClZBwRbf.js";import{a as F,i as I,n as L,r as R,t as z}from"./VerifierFrame-a5dTHTgU.js";var B=E(h(),1);const ue=(0,B.createContext)(void 0);var V=E(M(),1);function de({children:e}){let[t,n]=(0,B.useState)(null),r=(0,B.useMemo)(()=>({session:t,setSession:e=>n(e),clearSession:()=>n(null)}),[t]);return(0,V.jsx)(ue.Provider,{value:r,children:e})}function H(){let e=(0,B.useContext)(ue);if(!e)throw Error(`useSession must be used within a SessionProvider`);return e}var U=[`video/webm;codecs=vp9,opus`,`video/webm;codecs=vp8,opus`,`video/webm`,`video/mp4;codecs=h264,aac`,`video/mp4`],fe=typeof window<`u`&&`MediaRecorder`in window;async function pe(e){let t=await crypto.subtle.digest(`SHA-256`,e),n=new Uint8Array(t),r=``;for(let e=0;eW(),[]);function ne(){let e=typeof performance<`u`?performance:null,t=(e&&typeof e.timeOrigin==`number`?e.timeOrigin:NaN)+(e?e.now():NaN);return Number.isFinite(t)?Math.floor(t):Date.now()}(0,B.useEffect)(()=>{if(t)return(async()=>{s(null),l(!0);try{await re()}catch(e){s(e instanceof Error?e.message:`Failed to access camera.`)}finally{l(!1)}})(),()=>{A()}},[t,u,f]),(0,B.useEffect)(()=>{t&&j().catch(()=>_(!1))},[t,u]);async function re(){A();let e={audio:{echoCancellation:!0,noiseSuppression:!0},video:{facingMode:u,width:{ideal:1080},height:{ideal:1920},frameRate:{ideal:30,max:60}}},t=await navigator.mediaDevices.getUserMedia(e);C.current=t,w.current&&(w.current.srcObject=t,w.current.muted=!0,await w.current.play().catch(()=>{})),await ie(m&&g)}function A(){if(P(!0),w.current&&(w.current.pause(),w.current.srcObject=null),C.current)for(let e of C.current.getTracks())e.stop();C.current=null,h(!1),y(!1),x(0),S(0),O.current!==null&&(cancelAnimationFrame(O.current),O.current=null)}async function j(){let e=C.current;if(!e){_(!1);return}let[t]=e.getVideoTracks();if(!t){_(!1);return}let n=t.getCapabilities?.()??{};_(!!(typeof n.torch==`boolean`&&n.torch)&&u===`environment`)}async function ie(e){let t=C.current;if(!t)return;let[n]=t.getVideoTracks();if(!(!n||!n.applyConstraints))try{g&&u===`environment`&&await n.applyConstraints({advanced:[{torch:e}]})}catch{}}function M(){d(e=>e===`user`?`environment`:`user`)}function ae(){p(e=>!e)}async function oe(){if(!g)return;let e=!m;h(e),await ie(e)}function se(){if(!v)return;let e=performance.now()-D.current;if(S(e),x(Math.min(1,e/i)),e>=i){P(!1);return}O.current=requestAnimationFrame(se)}function N(){if(!fe){s(`MediaRecorder is not supported on this browser.`);return}if(v)return;s(null);let e=C.current;if(!e){s(`No camera stream.`);return}for(let t of e.getAudioTracks())t.enabled=!f;let t=te??``,n;try{n=t?new MediaRecorder(e,{mimeType:t,videoBitsPerSecond:35e5}):new MediaRecorder(e)}catch{n=new MediaRecorder(e)}T.current=n,E.current=[],n.ondataavailable=e=>{e.data&&e.data.size>0&&E.current.push(e.data)},n.onstop=()=>{ce()},n.start(250),y(!0),D.current=performance.now(),O.current=requestAnimationFrame(se)}function P(e){if(!v)return;let t=T.current;if(t){try{t.state!==`inactive`&&t.stop()}catch{}y(!1),O.current!==null&&(cancelAnimationFrame(O.current),O.current=null),e&&(E.current=[],x(0),S(0))}}async function ce(){let e=E.current;if(E.current=[],!e.length)return;let t=Math.max(0,Math.min(i,performance.now()-D.current)),n=T.current?.mimeType||te||`video/webm`,a=new Blob(e,{type:n}),o=ne(),s=k(BigInt(o)),{width:c,height:l,thumbnailDataUrl:u}=await le(a),d=await pe(await a.arrayBuffer()),f=`story_${s.toString()}.${n.includes(`mp4`)?`mp4`:`webm`}`;r({blob:a,file:new File([a],f,{type:n,lastModified:o}),mimeType:n,durationMs:t,width:c,height:l,thumbnailDataUrl:u,sha256:d,createdAt:o})}async function le(e){let t=URL.createObjectURL(e);try{let e=document.createElement(`video`);e.src=t,e.muted=!0,await e.play().catch(()=>void 0),await new Promise(t=>{let n=()=>{e.pause(),e.currentTime=0},r=()=>{n(),t()};e.onloadeddata=r,setTimeout(r,250)});let n=e.videoWidth||1080,r=e.videoHeight||1920,i=document.createElement(`canvas`);i.width=n,i.height=r;let a=i.getContext(`2d`);return a&&a.drawImage(e,0,0,n,r),{width:n,height:r,thumbnailDataUrl:i.toDataURL(`image/png`,.9)}}finally{URL.revokeObjectURL(t)}}function F(){v||N()}function I(){v&&P(!1)}function L(){v?P(!1):N()}return t?(0,V.jsxs)(`div`,{className:`story-rec-overlay`,role:`dialog`,"aria-modal":`true`,"aria-label":`Story recorder`,children:[(0,V.jsx)(`div`,{className:`story-rec-video-wrap`,children:(0,V.jsx)(`video`,{ref:w,className:`story-rec-video ${u===`user`?`mirror`:``}`,playsInline:!0})}),(0,V.jsxs)(`div`,{className:`story-rec-topbar`,children:[(0,V.jsx)(`button`,{type:`button`,className:`story-btn top left`,"aria-label":`Close`,onClick:()=>{A(),n()},children:`✕`}),(0,V.jsx)(`div`,{className:`story-top-center`,children:(0,V.jsxs)(`div`,{className:`story-timer mono`,children:[he(ee),` / `,he(i)]})}),(0,V.jsxs)(`div`,{className:`story-top-actions`,children:[(0,V.jsx)(`button`,{type:`button`,className:`story-btn ${f?`active`:``}`,"aria-pressed":f,"aria-label":f?`Unmute microphone`:`Mute microphone`,onClick:ae,title:f?`Unmute mic`:`Mute mic`,children:f?`🔇`:`🎙️`}),(0,V.jsx)(`button`,{type:`button`,className:`story-btn ${u===`environment`&&g?``:`disabled`}`,disabled:!(u===`environment`&&g),onClick:()=>void oe(),"aria-label":`Toggle torch`,title:g?m?`Torch on`:`Torch off`:`Torch not supported`,children:m?`🔦`:`💡`}),(0,V.jsx)(`button`,{type:`button`,className:`story-btn`,"aria-label":`Flip camera`,onClick:M,title:`Flip camera`,children:`🔁`})]})]}),(0,V.jsxs)(`div`,{className:`story-rec-bottombar`,children:[(0,V.jsx)(`div`,{className:`record-wrap`,children:(0,V.jsxs)(`button`,{type:`button`,className:`record-btn ${v?`recording`:``}`,"aria-pressed":v,"aria-label":v?`Stop recording`:`Start recording`,onClick:L,onPointerDown:F,onPointerUp:I,onPointerLeave:I,children:[(0,V.jsx)(`span`,{className:`progress-ring`,style:{background:`conic-gradient(currentColor ${b*360}deg, transparent 0)`}}),(0,V.jsx)(`span`,{className:`dot`})]})}),o&&(0,V.jsx)(`div`,{className:`story-rec-error`,children:o}),c&&(0,V.jsx)(`div`,{className:`story-rec-hint`,children:`Initializing camera…`})]})]}):null}function he(e){let t=Math.floor(e/1e3);return`${Math.floor(t/60).toString().padStart(2,`0`)}:${(t%60).toString().padStart(2,`0`)}`}var G={phiKey:[`userPhiKey`,`phiKey`,`phikey`,`ΦKey`,`walletPhiKey`],kaiSig:[`kaiSignature`,`kaiSig`,`ksig`,`ΣSig`,`sig`,`signature`],sigilId:[`sigilId`,`sigilID`,`glyphId`,`glyphID`,`sigil_id`,`glyph_id`],url:[`sigilActionUrl`,`sigilUrl`,`actionUrl`,`url`,`claimedUrl`,`loginUrl`,`sourceUrl`,`originUrl`,`link`,`href`]};function ge(e){if(typeof e!=`string`||!e.trim())return!1;try{let t=new URL(e,globalThis.location?.origin??`https://example.org`);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}}function K(e,t){if(typeof e!=`object`||!e)return;let n=e;for(let e of t){let t=n[e];if(typeof t==`string`&&t.trim())return t.trim()}let r=n.meta;if(typeof r==`object`&&r){let e=r;for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim())return t.trim()}}}function _e(e){return e.replace(/^$/,``).trim()}function ve(e){let t=e.trim();if(!t)return;try{let e=JSON.parse(t);if(typeof e==`object`&&e)return e}catch{}let n=t.match(/\{[\s\S]*\}/);if(n)try{let e=JSON.parse(n[0]);if(typeof e==`object`&&e)return e}catch{}}function ye(e,t){let n=RegExp(`${t}"?\\s*[:=]\\s*"?([^"\\n\\r<>{}]+)"?`,`i`),r=e.match(n);if(r)return(r[1]??``).trim()||void 0}function be(e){let t={};for(let n of G.phiKey){let r=ye(e,n);if(r){t.userPhiKey=r;break}}for(let n of G.kaiSig){let r=ye(e,n);if(r){t.kaiSignature=r;break}}for(let n of G.sigilId){let r=ye(e,n);if(r){t.sigilId=r;break}}for(let n of G.url){let r=ye(e,n);if(r&&ge(r))return t.actionUrl=r,t}let n=e.match(/https?:\/\/[^\s"'<>)#]+/i);return n&&ge(n[0])&&(t.actionUrl=n[0]),t}function xe(e,t){return{userPhiKey:e.userPhiKey??t.userPhiKey,kaiSignature:e.kaiSignature??t.kaiSignature,sigilId:e.sigilId??t.sigilId,actionUrl:e.actionUrl??t.actionUrl,meta:e.meta??t.meta}}function Se(e){let t=(e??``).trim();if(!t)return{};try{let e=new DOMParser().parseFromString(t,`image/svg+xml`),n=e.getElementsByTagName(`parsererror`);if(n&&n.length>0)return be(t);let r=e.documentElement,i={};if(r&&r.attributes)for(let e of Array.from(r.attributes))i[e.name]=e.value;let a={userPhiKey:K(i,G.phiKey),kaiSignature:K(i,G.kaiSig),sigilId:K(i,G.sigilId),actionUrl:(()=>{let e=K(i,G.url);return e&&ge(e)?e:void 0})(),meta:void 0},o=Array.from(e.getElementsByTagName(`metadata`));for(let e of o){let t=_e((e.textContent??``).trim());if(!t)continue;let n=ve(t);if(n){let e={userPhiKey:K(n,G.phiKey),kaiSignature:K(n,G.kaiSig),sigilId:K(n,G.sigilId),actionUrl:(()=>{let e=K(n,G.url);return e&&ge(e)?e:void 0})(),meta:n};if(a=xe(a,e),a.userPhiKey&&a.kaiSignature)return a}else a=xe(a,be(t))}for(let t of Array.from(e.getElementsByTagName(`desc`))){let e=_e((t.textContent??``).trim());if(!e)continue;let n=ve(e);if(n){let e={userPhiKey:K(n,G.phiKey),kaiSignature:K(n,G.kaiSig),sigilId:K(n,G.sigilId),actionUrl:(()=>{let e=K(n,G.url);return e&&ge(e)?e:void 0})(),meta:n};a=xe(a,e)}else a=xe(a,be(e));if(a.userPhiKey&&a.kaiSignature)return a}for(let t of Array.from(e.getElementsByTagName(`a`))){let e=t.getAttribute(`href`)||t.getAttribute(`xlink:href`);if(e&&ge(e)){a.actionUrl=a.actionUrl??e;break}}return(!a.userPhiKey||!a.kaiSignature)&&(a=xe(a,be(t))),a}catch{return be(t)}}var Ce=new TextEncoder;function q(){if(typeof crypto>`u`||!crypto.subtle)throw Error(`WebCrypto subtle unavailable`);return crypto.subtle}function we(e){if(e.buffer instanceof ArrayBuffer)return e;let t=new Uint8Array(e.byteLength);return t.set(e),t}function J(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`).trim();if(!/^[A-Za-z0-9+/]*={0,2}$/.test(t))throw Error(`Invalid base64/base64url`);let n=(4-t.length%4)%4,r=t+`=`.repeat(n),i=new Int16Array(128).fill(-1);for(let e=0;e<64;e++)i[`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.charCodeAt(e)]=e;let a=Math.floor(r.length*3/4)-(r.endsWith(`==`)?2:r.endsWith(`=`)?1:0),o=new Uint8Array(a),s=0;for(let e=0;e>>16&255),s>>8&255),s>>18&63]+t[r>>>12&63]+t[r>>>6&63]+t[r&63])}let a=r-i;if(a===1){let r=e[i]<<16;n.push(t[r>>>18&63]+t[r>>>12&63]+`==`)}else if(a===2){let r=e[i]<<16|e[i+1]<<8;n.push(t[r>>>18&63]+t[r>>>12&63]+t[r>>>6&63]+`=`)}return n.join(``).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function Ee(e){let t=e.trim().toLowerCase();if(!/^[0-9a-f]+$/.test(t)||t.length%2!=0)throw Error(`Invalid hex`);let n=new Uint8Array(t.length/2);for(let e=0;e=32&&t.length%2==0&&/^[0-9a-fA-F]+$/.test(t)}function Y(e){let t=e.trim();return t.length>=16&&/^[A-Za-z0-9\-_]+$/.test(t)}function Oe(e){let t=e.trim();if(!t)throw Error(`Empty kaiSignature`);if(De(t))return Ee(t);if(Y(t))try{return J(t)}catch{}return we(Ce.encode(t))}async function ke(e){let t=q(),n=await t.importKey(`raw`,e.ikm,{name:`HKDF`},!1,[`deriveBits`]),r=await t.deriveBits({name:`HKDF`,hash:`SHA-256`,salt:e.salt,info:e.info},n,e.bits);return new Uint8Array(r)}async function Ae(e){let t=we(Oe(e.baseKaiSignature)),n=we(J(e.salt_b64url)),r=(e.context??`KaiVoh.deriveKaiSignature.v1`).trim();return await ke({ikm:t,salt:n,info:we(Ce.encode(r)),bits:256})}async function je(e){return Te(await Ae(e))}function Me(){return(0,V.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`ico`,"aria-hidden":`true`,focusable:`false`,children:[(0,V.jsx)(`rect`,{x:`3`,y:`6`,width:`14`,height:`12`,rx:`3`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,V.jsx)(`circle`,{cx:`10`,cy:`12`,r:`3`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,V.jsx)(`path`,{d:`M17 9l4-2v10l-4-2z`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,V.jsx)(`circle`,{cx:`18.5`,cy:`5.5`,r:`2.5`,fill:`currentColor`})]})}function Ne(){return(0,V.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`ico`,"aria-hidden":`true`,focusable:`false`,children:[(0,V.jsx)(`path`,{d:`M3 6h18M9 6V4h6v2M7 6l1 14h8l1-14`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,V.jsx)(`path`,{d:`M10 10v6M14 10v6`,stroke:`currentColor`,strokeWidth:`2`})]})}var Pe=6e3,Fe=1024,Ie=1024*Fe,Le=e=>e>=Ie?`${(e/Ie).toFixed(2)} MB`:e>=Fe?`${(e/Fe).toFixed(2)} KB`:`${e} B`,Re=(e,t=8,n=6)=>e.length<=t+n?e:`${e.slice(0,t)}…${e.slice(-n)}`,ze=e=>{if(typeof e!=`string`||!e)return!1;try{let t=new URL(e,globalThis.location?.origin??`https://example.org`);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}};function Be(e){try{let t=new URL(e,globalThis.location?.origin??`https://example.org`),n=new URLSearchParams(t.hash.replace(/^#/,``)).has(`t`),r=new URLSearchParams(t.search).has(`p`),i=t.pathname,a=/^\/(?:stream|feed)\/p\/[^/]+$/.test(i),o=/^\/p~[^/?#]+$/.test(i);return n||r||a||o}catch{return!1}}function Ve(e){let t=new Uint8Array(e),n=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,r=[],i=t.length,a=0;for(;a+2>>18&63]+n[e>>>12&63]+n[e>>>6&63]+n[e&63])}let o=i-a;if(o===1){let e=t[a]<<16;r.push(n[e>>>18&63]+n[e>>>12&63]+`==`)}else if(o===2){let e=t[a]<<16|t[a+1]<<8;r.push(n[e>>>18&63]+n[e>>>12&63]+n[e>>>6&63]+`=`)}return r.join(``).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function X(e,t){if(typeof e!=`object`||!e)return;let n=e,r=n[t];if(typeof r==`string`)return r;let i=n.meta;if(typeof i==`object`&&i){let e=i[t];if(typeof e==`string`)return e}}function He(e,t){if(typeof e!=`object`||!e)return;let n=e,r=n[t];if(typeof r==`number`&&Number.isFinite(r))return r;let i=n.meta;if(typeof i==`object`&&i){let e=i[t];if(typeof e==`number`&&Number.isFinite(e))return e}}function Ue(e,t){if(!e)return;let n=[`sigilActionUrl`,`sigilUrl`,`actionUrl`,`url`,`claimedUrl`,`loginUrl`,`sourceUrl`,`originUrl`,`link`,`href`];if(t)for(let e of n){let n=t[e];if(ze(n))return n}try{let t=new DOMParser().parseFromString(e,`image/svg+xml`);for(let e of Array.from(t.getElementsByTagName(`metadata`))){let t=(e.textContent??``).trim();if(!t)continue;let r=t.replace(/^$/,``);try{let e=JSON.parse(r);if(typeof e==`object`&&e)for(let t of n){let n=e[t];if(ze(n))return n}}catch{let e=r.match(/https?:\/\/[^\s"'<>)#]+/i);if(e&&ze(e[0]))return e[0]}}for(let e of Array.from(t.getElementsByTagName(`a`))){let t=e.getAttribute(`href`)||e.getAttribute(`xlink:href`);if(ze(t))return t}}catch{}}async function We(e,t,n={}){let r=n.cacheName??`sigil-attachments-v1`,i=(n.pathPrefix??`/att/`).replace(/\/+$/,``)+`/`;try{if(!(`caches`in globalThis)||typeof caches.open!=`function`)return;let n=await caches.open(r),a=`${i}${e}`;return await n.put(new Request(a,{method:`GET`}),new Response(t,{headers:{"Content-Type":t.type||`application/octet-stream`}})),a}catch{return}}function Ge(e){let t=Math.floor(e/1e3);return`${Math.floor(t/60).toString().padStart(2,`0`)}:${(t%60).toString().padStart(2,`0`)}`}function Ke(e){let t=e.indexOf(` `);return t>=0?e.slice(0,t):e}function qe(e,t){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}var Je=()=>{let e=Number(k());if(!Number.isSafeInteger(e))throw Error(`kairosEpochNow out of safe integer range`);return e},Z=()=>typeof performance<`u`&&typeof performance.now==`function`?performance.now():Je(),Ye=async()=>{await new Promise(e=>requestAnimationFrame(()=>e()))},Xe=async(e,t,n)=>{let r=null,i=new Promise((e,i)=>{r=window.setTimeout(()=>i(Error(`${n} timed out`)),t)});try{return await Promise.race([e,i])}finally{r!==null&&window.clearTimeout(r)}},Ze=()=>{let e=typeof crypto<`u`?crypto:void 0;return e&&`randomUUID`in e&&typeof e.randomUUID==`function`?e.randomUUID():`${Math.floor(Z()).toString(36)}-${Math.random().toString(36).slice(2)}`},Q=null,$=new Map;function Qe(){if(Q)return Q;if(typeof window>`u`)throw Error(`encode worker unavailable (no window)`);if(typeof Worker>`u`)throw Error(`encode worker unavailable (Worker not supported)`);let e=new URL(`data:video/mp2t;base64,Ly8vIDxyZWZlcmVuY2UgbGliPSJ3ZWJ3b3JrZXIiIC8+CgppbXBvcnQgewogIGVuY29kZVRva2VuV2l0aEJ1ZGdldHMsCiAgdHlwZSBGZWVkUG9zdFBheWxvYWQsCn0gZnJvbSAiLi4vLi4vdXRpbHMvZmVlZFBheWxvYWQiOwoKdHlwZSBFbmNvZGVXb3JrZXJSZXF1ZXN0ID0gewogIGlkOiBzdHJpbmc7CiAgcGF5bG9hZDogRmVlZFBvc3RQYXlsb2FkOwp9OwoKdHlwZSBFbmNvZGVXb3JrZXJSZXNwb25zZSA9CiAgfCB7IGlkOiBzdHJpbmc7IG9rOiB0cnVlOyB0b2tlbjogc3RyaW5nOyB3aXRoaW5IYXJkOiBib29sZWFuOyBtczogbnVtYmVyIH0KICB8IHsgaWQ6IHN0cmluZzsgb2s6IGZhbHNlOyBlcnJvcjogc3RyaW5nOyBtczogbnVtYmVyIH07Cgpjb25zdCBub3cgPSAoKTogbnVtYmVyID0+CiAgc2VsZi5wZXJmb3JtYW5jZSAmJiB0eXBlb2Ygc2VsZi5wZXJmb3JtYW5jZS5ub3cgPT09ICJmdW5jdGlvbiIKICAgID8gc2VsZi5wZXJmb3JtYW5jZS5ub3coKQogICAgOiAwOwoKc2VsZi5vbm1lc3NhZ2UgPSAoZXY6IE1lc3NhZ2VFdmVudDxFbmNvZGVXb3JrZXJSZXF1ZXN0PikgPT4gewogIGNvbnN0IHQwID0gbm93KCk7CiAgY29uc3QgZGF0YSA9IGV2LmRhdGE7CgogIHRyeSB7CiAgICBjb25zdCBvdXQgPSBlbmNvZGVUb2tlbldpdGhCdWRnZXRzKGRhdGEucGF5bG9hZCk7CiAgICBjb25zdCBtc2c6IEVuY29kZVdvcmtlclJlc3BvbnNlID0gewogICAgICBpZDogZGF0YS5pZCwKICAgICAgb2s6IHRydWUsCiAgICAgIHRva2VuOiBvdXQudG9rZW4sCiAgICAgIHdpdGhpbkhhcmQ6IG91dC53aXRoaW5IYXJkLAogICAgICBtczogbm93KCkgLSB0MCwKICAgIH07CiAgICBzZWxmLnBvc3RNZXNzYWdlKG1zZyk7CiAgfSBjYXRjaCAoZSkgewogICAgY29uc3QgbXNnOiBFbmNvZGVXb3JrZXJSZXNwb25zZSA9IHsKICAgICAgaWQ6IGRhdGEuaWQsCiAgICAgIG9rOiBmYWxzZSwKICAgICAgZXJyb3I6IGUgaW5zdGFuY2VvZiBFcnJvciA/IGUubWVzc2FnZSA6IFN0cmluZyhlKSwKICAgICAgbXM6IG5vdygpIC0gdDAsCiAgICB9OwogICAgc2VsZi5wb3N0TWVzc2FnZShtc2cpOwogIH0KfTsK`,``+import.meta.url);return Q=new Worker(e,{type:`module`,name:`kaiVohEncodeWorker`}),Q.onmessage=e=>{let t=e.data,n=$.get(t.id);n&&($.delete(t.id),n(t))},Q.onerror=()=>{for(let[e,t]of $)t({id:e,ok:!1,error:`encode worker crashed`,ms:0});$.clear();try{Q?.terminate()}catch{}Q=null},Q}async function $e(e){let t=Qe(),n=Ze();return new Promise(r=>{$.set(n,r);let i={id:n,payload:e};t.postMessage(i)})}async function et(e){let t=Z(),n=()=>{try{let n=ne(e);return{id:Ze(),ok:!0,token:n.token,withinHard:n.withinHard,ms:Z()-t}}catch(e){return{id:Ze(),ok:!1,error:e instanceof Error?e.message:String(e),ms:Z()-t}}};try{let t=await $e(e);if(!t.ok){let e=n();return e.ok?e:t}return t}catch{return n()}}function tt({initialCaption:e=``,initialAuthor:t=``,onExhale:n}){let{auth:r}=se(),i=r.meta,[a,o]=(0,B.useState)(e),[s,l]=(0,B.useState)(t),[u,d]=(0,B.useState)(`text`),[f,m]=(0,B.useState)(`tsx`),[h,g]=(0,B.useState)(`code`),[x,ee]=(0,B.useState)(``),[C,T]=(0,B.useState)(``),[E,D]=(0,B.useState)(``),[O,k]=(0,B.useState)([]),[ne,A]=(0,B.useState)([]),[M,ae]=(0,B.useState)({version:1,totalBytes:0,inlinedBytes:0,items:[]}),N=(0,B.useRef)(M),[F,I]=(0,B.useState)(!1),[L,R]=(0,B.useState)(null),[z,ue]=(0,B.useState)(!1),[de,H]=(0,B.useState)(``),[U,fe]=(0,B.useState)(null),[pe,W]=(0,B.useState)(null),[he,G]=(0,B.useState)(null),[ge,K]=(0,B.useState)(!1),[_e,ve]=(0,B.useState)(``),[ye,be]=(0,B.useState)(0),[xe,Ce]=(0,B.useState)(`path`),[q,we]=(0,B.useState)(!1),[J,Te]=(0,B.useState)(`derived`),[Ee,De]=(0,B.useState)(``),[Y,Oe]=(0,B.useState)(()=>le(18)),[ke,Ae]=(0,B.useState)([]),[Fe,Ie]=(0,B.useState)(!1),Ze=(0,B.useRef)(null),Q=!!i;(0,B.useEffect)(()=>o(e),[e]),(0,B.useEffect)(()=>l(t),[t]),(0,B.useEffect)(()=>{N.current=M},[M]),(0,B.useEffect)(()=>()=>{L&&URL.revokeObjectURL(L.url)},[]);let $=(0,B.useMemo)(()=>X(i,`sigilActionUrl`)||X(i,`sigilUrl`)||X(i,`actionUrl`)||X(i,`url`)||X(i,`claimedUrl`)||X(i,`loginUrl`)||X(i,`sourceUrl`)||X(i,`originUrl`)||X(i,`link`)||X(i,`href`)||Ue(r.svgText,i??{})||(globalThis.location?.origin??`https://kaiklok.com`),[i,r.svgText]);(0,B.useEffect)(()=>{i&&(ee(X(i,`userPhiKey`)??``),T(X(i,`kaiSignature`)??``))},[i]),(0,B.useEffect)(()=>{q&&(Y.trim()||Oe(le(18)))},[q,Y]);let Qe=()=>{let e=E.trim();if(!ze(e)){G(`Invalid URL. Enter a full http(s) link.`);return}k(t=>[...t,j({url:e})]),D(``),G(null)},$e=e=>{k(t=>t.filter((t,n)=>n!==e))};function tt(e){let t=e,n=typeof t.webkitRelativePath==`string`?t.webkitRelativePath:``;return n.trim()?n:e.name}async function nt(e){let t=await e.arrayBuffer(),n=await crypto.subtle.digest(`SHA-256`,t),r=new Uint8Array(n),i=``;for(let e=0;e{let t=N.current.items.slice(),n=[];for(let r of e){let e=tt(r);if(q&&r.size>Pe){n.push(e);continue}if(r.size<=Pe){let n=await r.arrayBuffer();t.push(oe({name:e,type:r.type||`application/octet-stream`,size:r.size,data_b64url:Ve(n)}))}else{let n=await nt(r),i=await We(n,r,{cacheName:`sigil-attachments-v1`,pathPrefix:`/att/`});t.push(y({sha256:n,name:e,type:r.type||`application/octet-stream`,size:r.size,url:i}))}}return n.length>0&&G(`Private (Sealed) mode cannot include cache-backed large files. Skipped: ${n.slice(0,3).join(`, `)}${n.length>3?` (+${n.length-3} more)`:``}. Attach as a URL instead (Drive/S3/IPFS/etc), or keep files ≤ ${Le(Pe)}.`),v(t)},it=async e=>{if(!e.target.files)return;let t=Array.from(e.target.files);A(e=>[...e,...t]),ae(await rt(t))},at=async e=>{if(e.preventDefault(),e.stopPropagation(),!e.dataTransfer?.files?.length)return;let t=Array.from(e.dataTransfer.files);A(e=>[...e,...t]),ae(await rt(t))},ot=e=>{e.preventDefault(),e.stopPropagation()},st=()=>{A([]);let e={version:1,totalBytes:0,inlinedBytes:0,items:[]};ae(e),N.current=e};function ct(e){let[,t]=e.split(`,`,2);return t?Math.ceil(t.length*3/4):0}async function lt(e){if(q){G(`Private (Sealed) mode cannot include recorded stories (cache-backed video refs). Upload as a URL instead.`),I(!1);return}let t=await We(e.sha256,e.file,{cacheName:`sigil-attachments-v1`,pathPrefix:`/att/`}),n=y({sha256:e.sha256,name:e.file.name,type:e.mimeType||e.file.type||`video/webm`,size:e.file.size,url:t}),r=(e.thumbnailDataUrl.split(`,`,2)[1]??``).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``),i=oe({name:e.file.name.replace(/\.(webm|mp4)$/i,``)+`_thumb.png`,type:`image/png`,size:ct(e.thumbnailDataUrl),data_b64url:r});ae(v([...N.current.items,n,i])),L&&URL.revokeObjectURL(L.url),R({url:URL.createObjectURL(e.file),durationMs:e.durationMs}),I(!1)}let ut=a.trim(),dt=(0,B.useMemo)(()=>ut?u===`text`?S(ut):u===`md`?b(ut):u===`html`?te(ut,h):ie(ut,f.trim()||void 0):void 0,[ut,u,f,h]),ft=(0,B.useMemo)(()=>{if(!ut)return;let e=Ke(ut).trim();if(e){if(u===`code`){let t=f.trim();return qe(`${t?`code:${t}`:`code`} — ${e}`,220)}return qe(u===`md`?`md — ${e}`:u===`html`?`html — ${e}`:e,220)}},[ut,u,f]),pt=(0,B.useMemo)(()=>N.current.items.some(e=>e.kind===`file-ref`),[M]),mt=(0,B.useMemo)(()=>{if(!q)return ft;let e=Ee.trim();return e?qe(e,220):`Sealed Memory`},[q,ft,Ee]),ht=q&&J===`derived`&&Q&&!!C.trim(),gt=q&&J===`glyph`&&ke.length>0,_t=(0,B.useMemo)(()=>q?Q?J===`derived`?C.trim()?Y.trim()?(0,V.jsxs)(`div`,{className:`composer-hint`,children:[`Mode: `,(0,V.jsx)(`strong`,{children:`Derived Glyph Access`}),` • Any derivative glyph exported from this issuer glyph can unlock • Salt length`,` `,(0,V.jsx)(`strong`,{children:Y.trim().length})]}):(0,V.jsx)(`div`,{className:`composer-hint warn`,children:`Derivation salt missing — rotate to generate.`}):(0,V.jsx)(`div`,{className:`composer-hint warn`,children:`Derived access requires ΣSig (kaiSignature) present in your verified glyph.`}):ke.length===0?(0,V.jsx)(`div`,{className:`composer-hint warn`,children:`Mode: Specific Glyph Access requires at least one allowed glyph SVG uploaded.`}):(0,V.jsxs)(`div`,{className:`composer-hint`,children:[`Mode: `,(0,V.jsx)(`strong`,{children:`Specific Glyph Access`}),` • Allowed glyphs `,(0,V.jsx)(`strong`,{children:ke.length})]}):(0,V.jsx)(`div`,{className:`composer-hint warn`,children:`Private (Sealed) requires a verified glyph session.`}):null,[q,Q,J,C,Y,ke.length]),vt=async e=>{if(e.length===0)return;let t=[],n=[];for(let r of e)try{let e=Se(await r.text()),i=(e.userPhiKey??``).trim(),a=(e.kaiSignature??``).trim();if(!i||!a){n.push(r.name);continue}t.push({label:r.name,phiKey:i,kaiSignature:a,sigilId:(e.sigilId??``).trim()?(e.sigilId??``).trim():void 0})}catch{n.push(r.name)}t.length>0&&(Ae(e=>{let n=e.slice(),r=new Set(e.map(e=>`${e.phiKey}:${e.kaiSignature}`));for(let e of t){let t=`${e.phiKey}:${e.kaiSignature}`;r.has(t)||(r.add(t),n.push(e))}return n}),G(null)),n.length>0&&G(`Some glyph SVGs were missing ΦKey/ΣSig metadata and were not added: ${n.slice(0,3).join(`, `)}${n.length>3?` (+${n.length-3} more)`:``}.`)},yt=e=>{Ae(t=>t.filter((t,n)=>n!==e))},bt=async()=>{if(z)return;W(null),G(null),K(!1),ve(``),be(0),Ce(`path`),fe(null);let e=($||``).trim(),t=Be(e);if(t||G(`Proof of Breath™ URL not detected; using fallback. Link generation will still work.`),q){if([...N.current.items,...O].some(e=>e.kind===`file-ref`)){W(`Private (Sealed) mode cannot include cache-backed file refs. Keep files ≤ ${Le(Pe)} (inline) or attach public URLs.`);return}if(J===`derived`&&!ht){W(`Private (Sealed) → Derived mode requires a verified glyph with ΣSig (kaiSignature) present.`);return}if(J===`glyph`&&!gt){W(`Private (Sealed) → Specific Glyph mode requires at least one allowed glyph SVG uploaded.`);return}}let r,a;try{a=Je(),r=_(new Date(a)).pulse}catch{W(`Failed to compute Kai pulse.`);return}let o=Z();try{ue(!0),H(`paint`),await Ye(),await Ye(),H(`assemble`);let l=[...N.current.items,...O],u=l.length>0?v(l):void 0,d=t?e:void 0,f=d?c(d)??d:void 0,m=X(i,`sigilId`)||X(i,`sigilID`)||X(i,`glyphId`)||void 0,h=re({url:e,pulse:r,caption:mt,body:dt,author:s.trim()?s.trim():void 0,source:`manual`,sigilId:m,phiKey:Q&&x?x:void 0,kaiSignature:Q&&C?C:void 0,ts:a,attachments:u,parentUrl:d,originUrl:f});H(`prepare`);let g=Z(),_=await Xe(w(h,{cacheName:`sigil-attachments-v1`,pathPrefix:`/att/`}),2e4,`preparePayloadForLink`),y=Z()-g,b=_;if(q){let e={body:_.body??null,attachments:_.attachments??null},t;if(J===`derived`){let n=Y.trim()?Y.trim():le(18);n!==Y&&Oe(n),t=await ce({inner:e,teaser:mt??void 0,derived:{issuerKaiSignature:C,issuerPhiKey:x||void 0,salt_b64url:n}})}else{let n=ke.map(e=>({phiKey:e.phiKey,kaiSignature:e.kaiSignature,sigilId:e.sigilId}));t=await ce({inner:e,teaser:mt??void 0,allowGlyphs:n})}b={..._,body:void 0,attachments:void 0,seal:t}}H(`encode(worker)`);let ee=Z(),S=await Xe(et(b),3e4,`encodeTokenWithBudgets(worker)`),T=Z()-ee;if(!S.ok){fe({stage:`encode(worker)`,totalMs:Z()-o,prepareMs:y,encodeMs:S.ms,items:l.length,inlinedBytes:u?.inlinedBytes,totalBytes:u?.totalBytes,note:S.error}),W(`Token encode failed: ${S.error}. If you have a strict CSP, allow module workers from 'self' (worker-src 'self'). This build uses a real worker file (no blob workers).`);return}let{token:E,withinHard:D}=S;be(E.length);let te=globalThis.location?.origin??`https://kaiklok.com`,k=D?`${te}/stream/p/${encodeURIComponent(E)}`:`${te}/stream#t=${E}`;Ce(D?`path`:`hash`),E.length>3500?G(`Token exceeds hard path limit (${E.length.toLocaleString()} > ${p.toLocaleString()}). Using hash URL to avoid request-line limits.`):E.length>1800&&G(`Token is large (${E.length.toLocaleString()} chars). Prefer trimming inlined files or relying on external URLs.`),H(`register`),P(k),H(`clipboard`);try{await navigator.clipboard.writeText(k),K(!0)}catch{K(!1)}ve(k),fe({stage:`done`,totalMs:Z()-o,prepareMs:y,encodeMs:T,tokenLen:E.length,items:l.length,inlinedBytes:u?.inlinedBytes,totalBytes:u?.totalBytes}),n&&n({shareUrl:k,token:E,payload:b})}catch(e){let t=e instanceof Error?e.message:typeof e==`string`?e:`Failed to generate link.`;W(t),fe({stage:de||`unknown`,totalMs:Z()-o,note:t})}finally{H(``),ue(!1)}},xt=()=>{o(e||``),l(t||``),d(`text`),m(`tsx`),g(`code`),D(``),k([]),st(),W(null),G(null),K(!1),ve(``),be(0),Ce(`path`),H(``),fe(null),De(``),Ie(!1),L&&(URL.revokeObjectURL(L.url),R(null))},St=e=>t=>e(t.target.value),Ct=(0,B.useMemo)(()=>{if(!Q)return null;let e=He(i,`pulse`);return(0,V.jsxs)(`div`,{className:`id-banner`,role:`status`,"aria-live":`polite`,children:[(0,V.jsx)(`span`,{className:`id-dot`}),(0,V.jsxs)(`span`,{className:`id-text`,children:[`Verified by Sigil — ΦKey `,(0,V.jsx)(`strong`,{children:Re(x)}),` • `,`Last verified pulse `,(0,V.jsx)(`strong`,{children:e??`—`})]}),(0,V.jsxs)(`span`,{className:`id-sub mono`,children:[`ΣSig `,Re(C)]})]})},[Q,x,C,i]),wt=(0,B.useMemo)(()=>$?(0,V.jsxs)(`div`,{className:`composer`,children:[(0,V.jsx)(`label`,{className:`composer-label`,children:`Proof Of Breath™ URL`}),(0,V.jsxs)(`div`,{className:`composer-input-row`,children:[(0,V.jsx)(`input`,{className:`composer-input locked`,type:`url`,value:$,readOnly:!0}),(0,V.jsx)(`button`,{type:`button`,className:`composer-aux`,onClick:async()=>{try{await navigator.clipboard.writeText($),K(!0),window.setTimeout(()=>K(!1),1200)}catch{}},title:`Remember Proof Of Breath™ URL`,children:ge?`Remembered ✓`:`Remember`})]}),!Be($)&&(0,V.jsx)(`div`,{className:`composer-hint warn`,children:`No canonical stream token detected in the URL. Fallback will still produce a valid post.`})]}):null,[$,ge]),Tt=(0,V.jsxs)(`div`,{className:`composer`,children:[(0,V.jsx)(`label`,{className:`composer-label`,children:`Privacy Seal`}),(0,V.jsxs)(`div`,{className:`story-actions`,style:{alignItems:`center`,gap:10},children:[(0,V.jsx)(`button`,{type:`button`,className:`pill ${q?`prim`:`subtle`}`,onClick:()=>{we(e=>!e),W(null),G(null)},title:`Toggle Private (Sealed)`,children:q?`Private: ON`:`Private: OFF`}),q&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`button`,{type:`button`,className:`pill ${J===`derived`?`prim`:`subtle`}`,onClick:()=>Te(`derived`),title:`Derived glyph access`,children:`Derived`}),(0,V.jsx)(`button`,{type:`button`,className:`pill ${J===`glyph`?`prim`:`subtle`}`,onClick:()=>Te(`glyph`),title:`Specific glyph allowlist`,children:`Specific Glyph`}),(0,V.jsx)(`button`,{type:`button`,className:`pill ${Fe?`prim`:`subtle`}`,onClick:()=>Ie(e=>!e),title:`Show advanced sealing details`,children:`Advanced`})]})]}),q&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`composer-hint`,children:[`Private (Sealed) encrypts `,(0,V.jsx)(`span`,{className:`mono`,children:`body + seals`}),` inside the token. The outer post remains verifiable (ΦKey/ΣSig) but does not contain plaintext content.`]}),(0,V.jsxs)(`div`,{className:`composer`,style:{padding:0,marginTop:10},children:[(0,V.jsx)(`label`,{className:`composer-label`,children:`Public teaser (optional)`}),(0,V.jsx)(`input`,{className:`composer-input`,type:`text`,value:Ee,onChange:St(De),placeholder:`What should be visible without unlocking?`,maxLength:240}),(0,V.jsxs)(`div`,{className:`composer-hint`,children:[`If empty, the public message becomes `,(0,V.jsx)(`span`,{className:`mono`,children:`Sealed Memory`}),`.`]})]}),J===`derived`&&(0,V.jsxs)(`div`,{className:`composer`,style:{padding:0,marginTop:10},children:[(0,V.jsx)(`label`,{className:`composer-label`,children:`Derivation salt (for verifier export)`}),(0,V.jsxs)(`div`,{className:`composer-input-row`,children:[(0,V.jsx)(`input`,{className:`composer-input mono`,type:`text`,readOnly:!0,value:Y}),(0,V.jsx)(`button`,{type:`button`,className:`composer-aux`,onClick:()=>Oe(le(18)),title:`Rotate derivation salt`,children:`Rotate`}),(0,V.jsx)(`button`,{type:`button`,className:`composer-aux`,onClick:async()=>{try{await navigator.clipboard.writeText(Y),K(!0),window.setTimeout(()=>K(!1),900)}catch{}},title:`remember salt`,children:`Remember`})]}),Fe&&(0,V.jsx)(`div`,{className:`composer-hint mono`,style:{marginTop:8},children:Q&&C.trim()?(0,V.jsxs)(V.Fragment,{children:[`Derived ΣSig (b64url, post-scoped): `,(0,V.jsx)(`button`,{type:`button`,className:`pill subtle`,onClick:async()=>{try{let e=await je({baseKaiSignature:C,salt_b64url:Y});await navigator.clipboard.writeText(e),K(!0),window.setTimeout(()=>K(!1),900)}catch{}},title:`Copy derived signature`,children:`Remember derived ΣSig`}),(0,V.jsx)(`span`,{className:`dim`,style:{marginLeft:8},children:`(secret-equivalent; only for issuer export workflows)`})]}):`Derived preview unavailable (missing verified ΣSig).`})]}),J===`glyph`&&(0,V.jsxs)(`div`,{className:`composer`,style:{padding:0,marginTop:10},children:[(0,V.jsx)(`label`,{className:`composer-label`,children:`Allowed glyphs (upload SVG)`}),(0,V.jsxs)(`div`,{className:`story-actions`,style:{alignItems:`center`},children:[(0,V.jsxs)(`label`,{className:`pill`,children:[(0,V.jsx)(`input`,{type:`file`,accept:`.svg,image/svg+xml`,multiple:!0,className:`visually-hidden`,onChange:async e=>{let t=e.target.files?Array.from(e.target.files):[];e.currentTarget.value=``,t.length!==0&&await vt(t)}}),`Seal allowed glyphs…`]}),ke.length>0&&(0,V.jsx)(`button`,{type:`button`,className:`pill subtle`,onClick:()=>Ae([]),title:`Clear allowlist`,children:`Clear`})]}),ke.length>0&&(0,V.jsx)(`ul`,{className:`url-list`,style:{marginTop:10},children:ke.map((e,t)=>(0,V.jsxs)(`li`,{className:`url-item`,style:{alignItems:`center`},children:[(0,V.jsx)(`span`,{className:`badge`,children:`glyph`}),(0,V.jsx)(`span`,{className:`mono`,children:qe(e.label,36)}),(0,V.jsxs)(`span`,{className:`dim`,style:{marginLeft:10},children:[`ΦKey `,Re(e.phiKey,10,8)]}),(0,V.jsx)(`button`,{type:`button`,className:`pill danger`,onClick:()=>yt(t),title:`Remove glyph`,children:`✕`})]},`${e.phiKey}:${e.kaiSignature}:${t}`))}),(0,V.jsxs)(`div`,{className:`composer-hint`,style:{marginTop:8},children:[`This is `,(0,V.jsx)(`strong`,{children:`not`}),` pulse-locked — if a user possesses an allowed glyph (its ΣSig), they can unlock sealed posts across pulses.`]})]}),(0,V.jsxs)(`div`,{className:`composer-hint warn`,style:{marginTop:10},children:[`Private (Sealed) hard-guard: no cache-backed `,(0,V.jsx)(`span`,{className:`mono`,children:`file-ref`}),` attachments. Use URLs or keep files ≤`,` `,(0,V.jsx)(`strong`,{children:Le(Pe)}),`.`]}),_t]})]}),Et=(0,V.jsxs)(`div`,{className:`attachments`,children:[(0,V.jsx)(`h3`,{className:`attachments-title`,children:`Seals`}),(0,V.jsxs)(`div`,{className:`composer`,children:[(0,V.jsx)(`label`,{className:`composer-label`,children:`Seal a memory`}),(0,V.jsxs)(`div`,{className:`story-actions`,children:[(0,V.jsx)(`button`,{type:`button`,className:`pill prim icon-only${q?` disabled`:``}`,"aria-label":`Open Memory Recorder`,title:q?`Private mode: story capture is disabled (cache-backed)`:`Record story`,onClick:()=>{if(q){G(`Private (Sealed) mode disables story recording (cache-backed file refs). Add as URL instead.`);return}I(!0)},disabled:q,children:(0,V.jsx)(Me,{})}),L&&(0,V.jsxs)(`div`,{className:`story-preview`,children:[(0,V.jsx)(`video`,{src:L.url,playsInline:!0,controls:!0,className:`story-preview-video`}),(0,V.jsx)(`div`,{className:`story-preview-meta mono`,children:Ge(L.durationMs)}),(0,V.jsx)(`button`,{type:`button`,className:`pill danger icon-only`,onClick:()=>{URL.revokeObjectURL(L.url),R(null)},"aria-label":`Remove recorded preview`,title:`Remove preview`,children:(0,V.jsx)(Ne,{})})]})]})]}),(0,V.jsxs)(`div`,{className:`composer`,children:[(0,V.jsx)(`label`,{className:`composer-label`,children:`Seal any URL`}),(0,V.jsxs)(`div`,{className:`composer-input-row`,children:[(0,V.jsx)(`input`,{className:`composer-input`,type:`url`,placeholder:`https://example.com/docs/your-file.pdf`,value:E,onChange:St(D),autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1}),(0,V.jsx)(`button`,{type:`button`,className:`composer-aux`,onClick:Qe,title:`Add URL`,children:`Seal`})]}),O.length>0&&(0,V.jsx)(`ul`,{className:`url-list`,children:O.map((e,t)=>(0,V.jsxs)(`li`,{className:`url-item`,children:[(0,V.jsx)(`span`,{className:`mono`,children:Re(e.url,28,16)}),(0,V.jsx)(`button`,{type:`button`,className:`pill danger`,onClick:()=>$e(t),title:`Remove URL`,children:`✕`})]},`${e.url}-${t}`))})]}),(0,V.jsx)(`div`,{ref:Ze,className:`dropzone`,onDragOver:ot,onDrop:at,"aria-label":`Drop files or folders here`,children:(0,V.jsxs)(`div`,{className:`dropzone-inner`,children:[(0,V.jsx)(`div`,{className:`dz-title`,children:`Seal files or folders`}),(0,V.jsxs)(`div`,{className:`dz-sub`,children:[`Tiny files get inlined; large files become cache-backed refs.`,q?(0,V.jsxs)(V.Fragment,{children:[` `,(0,V.jsx)(`strong`,{children:`(Private mode skips large files.)`})]}):null]}),(0,V.jsxs)(`div`,{className:`dz-actions`,children:[(0,V.jsxs)(`label`,{className:`pill`,children:[(0,V.jsx)(`input`,{type:`file`,multiple:!0,onChange:it,className:`visually-hidden`}),`Inhale files…`]}),(0,V.jsxs)(`label`,{className:`pill`,children:[(0,V.jsx)(`input`,{type:`file`,multiple:!0,webkitdirectory:``,onChange:it,className:`visually-hidden`}),`Inhale folder…`]}),ne.length>0&&(0,V.jsx)(`button`,{type:`button`,className:`pill subtle`,onClick:st,children:`Reset`})]})]})}),M.items.length>0&&(0,V.jsxs)(`div`,{className:`file-summary`,children:[(0,V.jsxs)(`div`,{className:`composer-hint`,children:[`Items: `,(0,V.jsx)(`strong`,{children:M.items.length}),` • Files total: `,(0,V.jsx)(`strong`,{children:Le(M.totalBytes??0)}),` • Inlined:`,` `,(0,V.jsx)(`strong`,{children:Le(M.inlinedBytes??0)}),` (≤ `,Le(Pe),` each)`]}),(0,V.jsx)(`ul`,{className:`file-list`,children:M.items.map((e,t)=>{if(e.kind===`url`)return(0,V.jsx)(`li`,{className:`file-item`,children:(0,V.jsxs)(`div`,{className:`file-row`,children:[(0,V.jsx)(`span`,{className:`badge`,children:`url`}),(0,V.jsx)(`span`,{className:`mono`,children:Re(e.url,34,18)})]})},`url-${t}`);let n=e.name??`file-${t}`,r=e.kind===`file-inline`,i=`type`in e&&typeof e.type==`string`?e.type:`application/octet-stream`,a=`size`in e&&typeof e.size==`number`?e.size:0;return(0,V.jsx)(`li`,{className:`file-item`,children:(0,V.jsxs)(`div`,{className:`file-row`,children:[(0,V.jsx)(`span`,{className:`badge`,children:r?`inline`:`file`}),(0,V.jsx)(`span`,{className:`mono`,children:n}),(0,V.jsxs)(`span`,{className:`dim`,children:[i,` • `,Le(a)]})]})},`${n}-${t}`)})}),M.items.some(e=>e.kind===`file-ref`)&&(0,V.jsxs)(`div`,{className:`composer-hint ${q?`warn`:``}`,children:[`Large files are cached and referenced by SHA-256.`,q?` Private (Sealed) will refuse these — attach public URLs instead.`:` You can also host publicly and attach the public URL above.`]})]})]}),Dt=u===`code`?10:3,Ot=u===`code`?`Paste your code…`:u===`md`?`Write markdown…`:u===`html`?`Write HTML… (default renders as escaped code unless sanitized by the stream UI)`:`What Resonants About This Moment…`,kt=z||q&&J===`derived`&&!ht||q&&J===`glyph`&&!gt||q&&pt;return(0,V.jsxs)(`div`,{className:`social-connector-container`,children:[(0,V.jsx)(`h2`,{className:`social-connector-title`,children:`KaiVoh`}),(0,V.jsxs)(`p`,{className:`social-connector-sub`,children:[`Exhale a sealed `,(0,V.jsx)(`strong`,{children:`Memory Stream`}),`.`]}),Ct,wt,Tt,(0,V.jsxs)(`div`,{className:`composer`,children:[(0,V.jsx)(`label`,{className:`composer-label`,children:`Body Format`}),(0,V.jsxs)(`div`,{className:`story-actions`,children:[(0,V.jsx)(`button`,{type:`button`,className:`pill ${u===`text`?`prim`:`subtle`}`,onClick:()=>d(`text`),title:`Text`,children:`Text`}),(0,V.jsx)(`button`,{type:`button`,className:`pill ${u===`code`?`prim`:`subtle`}`,onClick:()=>d(`code`),title:`Code`,children:`Code`}),(0,V.jsx)(`button`,{type:`button`,className:`pill ${u===`md`?`prim`:`subtle`}`,onClick:()=>d(`md`),title:`Markdown`,children:`MD`}),(0,V.jsx)(`button`,{type:`button`,className:`pill ${u===`html`?`prim`:`subtle`}`,onClick:()=>d(`html`),title:`HTML`,children:`HTML`}),u===`code`&&(0,V.jsx)(`input`,{className:`composer-input`,style:{maxWidth:160},value:f,onChange:St(m),placeholder:`lang (tsx)`,"aria-label":`Code language`,autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1}),u===`html`&&(0,V.jsxs)(`button`,{type:`button`,className:`pill ${h===`code`?`prim`:`subtle`}`,onClick:()=>g(e=>e===`code`?`sanitized`:`code`),title:`HTML mode (stream decides how to render)`,children:[`mode:`,h]})]}),(0,V.jsxs)(`div`,{className:`composer-hint`,children:[`v2 posts include `,(0,V.jsx)(`span`,{className:`mono`,children:`body.kind`}),` so the stream can render code as code (escaped) instead of treating everything as plain text.`,q?(0,V.jsx)(V.Fragment,{children:` In Private mode, the body is sealed and not visible until unlocked.`}):null]})]}),(0,V.jsxs)(`div`,{className:`composer two`,children:[(0,V.jsxs)(`div`,{className:`field`,children:[(0,V.jsxs)(`label`,{htmlFor:`caption`,className:`composer-label`,children:[`Memory `,(0,V.jsx)(`span`,{className:`muted`,children:`(Body)`})]}),(0,V.jsx)(`textarea`,{id:`caption`,className:`composer-textarea${u===`code`?` mono`:``}`,rows:Dt,placeholder:Ot,value:a,onChange:St(o),spellCheck:u!==`code`})]}),(0,V.jsxs)(`div`,{className:`field`,children:[(0,V.jsxs)(`label`,{htmlFor:`author`,className:`composer-label`,children:[`Author Handle `,(0,V.jsx)(`span`,{className:`muted`,children:`(optional, e.g., @KaiRexKlok)`})]}),(0,V.jsx)(`input`,{id:`author`,className:`composer-input`,type:`text`,placeholder:`@handle`,value:s,onChange:St(l),autoCorrect:`off`,autoCapitalize:`none`})]})]}),Et,pe&&(0,V.jsx)(`div`,{className:`composer-error`,children:pe}),he&&!pe&&(0,V.jsx)(`div`,{className:`composer-warn`,children:he}),(z||U)&&(0,V.jsxs)(`div`,{className:`composer-hint mono`,"aria-live":`polite`,children:[z&&de?`stage: ${de}`:null,U?(0,V.jsxs)(V.Fragment,{children:[z&&de?` • `:null,`total ${Math.round(U.totalMs)}ms`,typeof U.prepareMs==`number`?` • prepare ${Math.round(U.prepareMs)}ms`:``,typeof U.encodeMs==`number`?` • encode ${Math.round(U.encodeMs)}ms`:``,typeof U.tokenLen==`number`?` • token ${U.tokenLen.toLocaleString()}`:``,typeof U.items==`number`?` • items ${U.items}`:``,typeof U.inlinedBytes==`number`?` • inlined ${Le(U.inlinedBytes)}`:``,typeof U.totalBytes==`number`?` • bytes ${Le(U.totalBytes)}`:``,U.note?` • note: ${U.note}`:``]}):null]}),(0,V.jsxs)(`div`,{className:`composer-actions`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:bt,className:`composer-submit`,disabled:kt,title:kt?`Fix sealing requirements / attachments to proceed`:`Exhale Stream`,children:z?`Exhaling…${de?` (${de})`:``}`:q?`Exhale Sealed Stream`:`Exhale Stream`}),(0,V.jsx)(`button`,{type:`button`,className:`composer-reset`,onClick:xt,children:`Reset`})]}),_e&&(0,V.jsxs)(`div`,{className:`composer-result`,children:[(0,V.jsx)(`label`,{htmlFor:`gen-url`,className:`composer-label`,children:`Your shareable link`}),(0,V.jsx)(`input`,{id:`gen-url`,className:`composer-input`,type:`text`,readOnly:!0,value:_e,onFocus:e=>e.currentTarget.select()}),(0,V.jsxs)(`div`,{className:`composer-actions`,children:[(0,V.jsx)(`button`,{type:`button`,className:`composer-copy`,onClick:async()=>{try{await navigator.clipboard.writeText(_e),K(!0)}catch{K(!1)}},children:ge?`Remembered ✓`:`Remember`}),(0,V.jsx)(`a`,{className:`composer-open`,href:_e,target:`_blank`,rel:`noopener noreferrer`,children:`Open in new tab →`})]}),(0,V.jsxs)(`p`,{className:`composer-hint`,children:[`Token length: `,(0,V.jsx)(`strong`,{children:ye.toLocaleString()}),` chars • URL mode:`,` `,(0,V.jsx)(`strong`,{children:xe===`path`?`path`:`hash`}),` • soft `,1800 .toLocaleString(),` • hard`,` `,3500 .toLocaleString(),q?(0,V.jsxs)(V.Fragment,{children:[` `,`• `,(0,V.jsx)(`strong`,{children:`sealed`})]}):null]})]}),(0,V.jsx)(me,{isOpen:F,onClose:()=>I(!1),onCaptured:lt,maxDurationMs:15e3,preferredFacingMode:`user`})]})}var nt=50*1024*1024,rt=10;function it(e){if(e===0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=1024,r=Math.floor(Math.log(e)/Math.log(n)),i=e/n**+r;return`${i.toFixed(i>=10?0:1)} ${t[r]}`}function at(e){let{type:t,name:n}=e,r=n.toLowerCase();return t.startsWith(`image/`)?`image`:t.startsWith(`video/`)?`video`:t.startsWith(`audio/`)?`audio`:t===`application/pdf`||t.startsWith(`text/`)||t.includes(`word`)||t.includes(`officedocument`)||t.includes(`spreadsheet`)||t.includes(`presentation`)?`document`:r.endsWith(`.zip`)||r.endsWith(`.rar`)||r.endsWith(`.7z`)||r.endsWith(`.tar`)||r.endsWith(`.gz`)?`archive`:`other`}var ot={image:`Image`,video:`Video`,audio:`Audio`,document:`Document`,archive:`Archive`,other:`File`};function st(e){return[e.name,e.size,e.lastModified,k(),Math.random().toString(36).slice(2,8)].join(`-`)}function ct(e){return e.length===0?null:(e.find(e=>e.kind===`image`||e.kind===`video`)??e[0])?.id??null}function lt(e){return`${e.name}:${e.size}:${e.lastModified}`}function ut({onReady:e}){let t=(0,B.useRef)(null),n=(0,B.useRef)(null),r=(0,B.useRef)(null),[i,a]=(0,B.useState)([]),[o,s]=(0,B.useState)(null),[c,l]=(0,B.useState)(null),[u,d]=(0,B.useState)(`file`),[f,p]=(0,B.useState)(``),[m,h]=(0,B.useState)(``),[g,_]=(0,B.useState)(`general`),[v,y]=(0,B.useState)(``),[b,x]=(0,B.useState)(``),[ee,S]=(0,B.useState)(``),[C,w]=(0,B.useState)(``),[T,E]=(0,B.useState)(``),[D,O]=(0,B.useState)(``),[te,k]=(0,B.useState)(!1),[ne,re]=(0,B.useState)(!1),[A,j]=(0,B.useState)(null),[ie,M]=(0,B.useState)(!1),[ae,oe]=(0,B.useState)(!1),se=1e3,N=i.length>0,P=g===`legal-contract`,ce=(0,B.useMemo)(()=>i.reduce((e,t)=>e+t.file.size,0),[i]),le=(0,B.useMemo)(()=>N?it(ce):`0 B`,[N,ce]),F=(0,B.useMemo)(()=>P?v.trim().length>0&&b.trim().length>0:!0,[P,v,b]),I=(0,B.useMemo)(()=>N?F?3:2:1,[N,F]),L=(0,B.useMemo)(()=>I===1?P?`Attach your agreement, annexes, and evidence`:`Attach the media or files you want to seal`:I===2?P?`Describe the agreement and parties`:`Add context: caption, link, and tags`:P?`Review and seal as a legal record`:`Review and seal to the KaiVoh stream`,[I,P]),R=(0,B.useCallback)(()=>{n.current&&=(URL.revokeObjectURL(n.current),null),r.current=null},[]);(0,B.useEffect)(()=>()=>{R()},[R]);let z=(0,B.useCallback)((e,t)=>{let i=t!==null&&e.some(e=>e.id===t)?t:ct(e);if(s(i),!i){c&&(R(),l(null)),u!==`file`&&d(`file`);return}let a=e.find(e=>e.id===i)??null;if(!a){c&&(R(),l(null)),u!==`file`&&d(`file`);return}if(a.kind===`image`||a.kind===`video`){let e=a.kind;u!==e&&d(e);let t=lt(a.file);if(!(i===o&&r.current===t&&typeof c==`string`&&c.length>0)){R();let e=URL.createObjectURL(a.file);n.current=e,r.current=t,l(e)}return}u!==`file`&&d(`file`),c&&(R(),l(null))},[R,o,u,c,s,d,l]),ue=(0,B.useCallback)(()=>{a([]),s(null),R(),l(null),d(`file`),p(``),h(``),_(`general`),y(``),x(``),S(``),w(``),E(``),O(``),k(!1),re(!1),j(null),oe(!1),t.current&&(t.current.value=``)},[R]),de=(0,B.useCallback)(e=>{let t=Array.isArray(e)?e:Array.from(e);if(t.length===0)return;let n=!1,r=!1,s=[...i];for(let e of t){if(s.length>=rt){r=!0;break}if(e.size>nt){n=!0;continue}if(s.some(t=>t.file.name===e.name&&t.file.size===e.size&&t.file.lastModified===e.lastModified))continue;let t=at(e),i={id:st(e),file:e,kind:t};s=[...s,i]}s.length===i.length&&!n?r||j(`No new files were added (duplicates or all invalid).`):j(null),n?j(`Some files were too large. Max individual file size is ${it(nt)}.`):r&&j(`You can attach up to ${rt} files per sealed post. Remove one to add another.`),a(s),z(s,o)},[i,o,z]),H=e=>{let t=e.target.files;!t||t.length===0||de(t)},U=e=>{e.preventDefault(),e.stopPropagation(),M(!1);let t=e.dataTransfer.files;!t||t.length===0||de(t)},fe=e=>{e.preventDefault(),e.stopPropagation()},pe=e=>{e.preventDefault(),e.stopPropagation(),M(!0)},W=e=>{e.preventDefault(),e.stopPropagation(),e.currentTarget===e.target&&M(!1)},me=()=>{t.current?.click()},he=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),me())},G=e=>{let t=i.filter(t=>t.id!==e);a(t),z(t,o===e?null:o)},ge=e=>{s(e),z(i,e)},K=()=>{if(!N){j(`Attach at least one file to seal.`);return}if(P&&!F){j(`Fill in the agreement title and counterparty to seal legally.`);return}let t=m.trim();if(t.length>0)try{new URL(t)}catch{j(`The link URL looks invalid. Please check it.`);return}let n=(o?i.find(e=>e.id===o):null)??i[0]??null;if(!n){j(`Something went wrong selecting the primary attachment.`);return}let r=f.trim(),a=P?{agreementTitle:v.trim()||void 0,counterpartyName:b.trim()||void 0,counterpartyEmail:ee.trim()||void 0,jurisdiction:C.trim()||void 0,effectiveDateIso:T||void 0,referenceCode:D.trim()||void 0,isConfidential:te,includesPersonalData:ne}:void 0;oe(!0),e({mediaType:n.kind===`image`||n.kind===`video`?n.kind:`file`,file:n.file,caption:r.length>0?r:void 0,attachments:i,mainAttachmentId:n.id,postKind:g,legalMeta:a,linkUrl:t.length>0?t:void 0})},_e=(0,B.useMemo)(()=>{if(!N)return null;let e=i.length;return`${e===1?`1 attached file`:`${e} attached files total`} • ${le}`},[i,N,le]);return(0,V.jsxs)(`div`,{className:`kv-post-composer flex flex-col items-center gap-4 p-6 w-full`,children:[(0,V.jsxs)(`div`,{className:`kv-post-header w-full max-w-xl flex flex-col gap-2`,children:[(0,V.jsxs)(`div`,{className:`kv-post-step-row flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`kv-post-step-badge`,children:[(0,V.jsx)(`span`,{className:`kv-post-step-number`,children:I}),(0,V.jsx)(`span`,{className:`kv-post-step-label`,children:L})]}),N&&(0,V.jsx)(`button`,{type:`button`,className:`kv-post-reset-btn`,onClick:ue,children:`Reset`})]}),(0,V.jsx)(`p`,{className:`kv-post-subtitle`,children:`Attach images, videos, PDFs, DOCX, ZIPs—anything you want sealed to your Kai-Signature. For contracts, add parties and jurisdiction so this becomes a usable, timestamped record.`}),(0,V.jsxs)(`div`,{className:`kv-post-kind-row flex flex-wrap items-center gap-3 mt-1`,children:[(0,V.jsx)(`label`,{className:`kv-post-kind-label`,htmlFor:`kv-post-kind`,children:`Intent`}),(0,V.jsxs)(`select`,{id:`kv-post-kind`,className:`kv-post-kind-select`,value:g,onChange:e=>_(e.target.value),children:[(0,V.jsx)(`option`,{value:`general`,children:`General post / media`}),(0,V.jsx)(`option`,{value:`legal-contract`,children:`Legal contract / agreement`}),(0,V.jsx)(`option`,{value:`evidence`,children:`Evidence / proof bundle`}),(0,V.jsx)(`option`,{value:`announcement`,children:`Public announcement / notice`}),(0,V.jsx)(`option`,{value:`private-note`,children:`Private note / internal record`})]})]})]}),A&&(0,V.jsx)(`div`,{className:`kv-post-error w-full max-w-xl`,role:`alert`,children:A}),(0,V.jsx)(`div`,{className:`w-full max-w-xl`,children:(0,V.jsx)(`div`,{className:[`kv-post-dropzone`,ie?`kv-post-dropzone--dragging`:``,N?`kv-post-dropzone--has-media`:``].join(` `).trim(),tabIndex:0,role:`button`,"aria-label":`Choose or drop files to attach`,onClick:me,onKeyDown:he,onDragOver:fe,onDragEnter:pe,onDragLeave:W,onDrop:U,children:(0,V.jsxs)(`div`,{className:`kv-post-dropzone-inner`,children:[(0,V.jsx)(`div`,{className:`kv-post-dropzone-icon`,children:N?`🔄`:ie?`🌀`:`📁`}),(0,V.jsxs)(`div`,{className:`kv-post-dropzone-text`,children:[(0,V.jsx)(`div`,{className:`kv-post-dropzone-title`,children:N?`Add or replace attached files`:`Tap or drop files to start`}),(0,V.jsx)(`div`,{className:`kv-post-dropzone-hint`,children:`Images, videos, PDFs, DOCX, ZIPs, audio, and more • Drag & drop or tap to choose`}),(0,V.jsxs)(`div`,{className:`kv-post-dropzone-meta`,children:[`Max `,rt,` files • `,it(nt),` per file`]})]})]})})}),N&&(0,V.jsxs)(`div`,{className:`kv-post-body w-full max-w-xl mt-2`,children:[c&&(0,V.jsxs)(`div`,{className:`kv-post-preview`,children:[u===`image`&&(0,V.jsx)(`img`,{src:c,alt:`Primary attachment preview`,className:`kv-post-preview-media`}),u===`video`&&(0,V.jsx)(`video`,{src:c,controls:!0,className:`kv-post-preview-media`})]}),(0,V.jsxs)(`div`,{className:`kv-post-attachments`,children:[(0,V.jsxs)(`div`,{className:`kv-post-attachments-header flex justify-between items-center`,children:[(0,V.jsx)(`div`,{className:`kv-post-attachments-title`,children:`Attachments`}),_e&&(0,V.jsx)(`div`,{className:`kv-post-attachments-summary`,children:_e})]}),(0,V.jsx)(`ul`,{className:`kv-post-attachments-list`,children:i.map(e=>{let t=e.id===o;return(0,V.jsxs)(`li`,{className:[`kv-post-attachment-item`,t?`kv-post-attachment-item--primary`:``].join(` `).trim(),children:[(0,V.jsxs)(`div`,{className:`kv-post-attachment-main`,children:[(0,V.jsx)(`div`,{className:`kv-post-attachment-name`,children:e.file.name}),(0,V.jsxs)(`div`,{className:`kv-post-attachment-meta`,children:[(0,V.jsxs)(`span`,{children:[ot[e.kind],` • `,it(e.file.size)]}),t&&(0,V.jsx)(`span`,{className:`kv-post-attachment-pill`,children:`Primary`})]})]}),(0,V.jsxs)(`div`,{className:`kv-post-attachment-actions`,children:[!t&&(0,V.jsx)(`button`,{type:`button`,className:`kv-post-attachment-btn`,onClick:()=>ge(e.id),children:`Set as primary`}),(0,V.jsx)(`button`,{type:`button`,className:`kv-post-attachment-btn kv-post-attachment-btn--danger`,onClick:()=>G(e.id),children:`Remove`})]})]},e.id)})})]}),(0,V.jsxs)(`div`,{className:`kv-post-caption-block mt-4`,children:[(0,V.jsx)(`label`,{htmlFor:`kv-post-caption`,className:`kv-post-caption-label`,children:`Caption / description (optional)`}),(0,V.jsx)(`textarea`,{id:`kv-post-caption`,placeholder:P?`Summarize what this agreement covers, key obligations, or why you are sealing it now…`:`Describe the moment, the pulse, or what this bundle of files represents…`,className:`kv-post-caption-textarea`,rows:3,maxLength:se,value:f,onChange:e=>p(e.target.value)}),(0,V.jsx)(`div`,{className:`kv-post-caption-footer`,children:(0,V.jsxs)(`span`,{className:`kv-post-caption-count`,children:[f.length,`/`,se]})})]}),(0,V.jsxs)(`div`,{className:`kv-post-link-block mt-4`,children:[(0,V.jsx)(`label`,{htmlFor:`kv-post-link`,className:`kv-post-link-label`,children:`Canonical URL (optional)`}),(0,V.jsx)(`input`,{id:`kv-post-link`,type:`url`,inputMode:`url`,placeholder:`https://… (DMS link, IPFS URL, external system reference)`,className:`kv-post-link-input`,value:m,onChange:e=>h(e.target.value)}),(0,V.jsx)(`p`,{className:`kv-post-link-hint`,children:`This can point to the master copy of the contract, folder, or evidence bundle. It will be sealed alongside the files.`})]}),g===`legal-contract`&&(0,V.jsxs)(`div`,{className:`kv-post-legal-block mt-6`,children:[(0,V.jsx)(`div`,{className:`kv-post-legal-header`,children:`Legal details for this agreement`}),(0,V.jsxs)(`div`,{className:`kv-post-legal-grid`,children:[(0,V.jsxs)(`div`,{className:`kv-post-legal-field`,children:[(0,V.jsxs)(`label`,{htmlFor:`kv-legal-title`,className:`kv-post-legal-label`,children:[`Agreement title `,(0,V.jsx)(`span`,{className:`kv-post-legal-required`,children:`*`})]}),(0,V.jsx)(`input`,{id:`kv-legal-title`,type:`text`,className:`kv-post-legal-input`,placeholder:`e.g. Master Services Agreement, NDA, Licensing Deal…`,value:v,onChange:e=>y(e.target.value)})]}),(0,V.jsxs)(`div`,{className:`kv-post-legal-field`,children:[(0,V.jsxs)(`label`,{htmlFor:`kv-legal-counterparty`,className:`kv-post-legal-label`,children:[`Counterparty name `,(0,V.jsx)(`span`,{className:`kv-post-legal-required`,children:`*`})]}),(0,V.jsx)(`input`,{id:`kv-legal-counterparty`,type:`text`,className:`kv-post-legal-input`,placeholder:`Person or organization`,value:b,onChange:e=>x(e.target.value)})]}),(0,V.jsxs)(`div`,{className:`kv-post-legal-field`,children:[(0,V.jsx)(`label`,{htmlFor:`kv-legal-email`,className:`kv-post-legal-label`,children:`Counterparty contact (optional)`}),(0,V.jsx)(`input`,{id:`kv-legal-email`,type:`email`,className:`kv-post-legal-input`,placeholder:`Email or contact handle`,value:ee,onChange:e=>S(e.target.value)})]}),(0,V.jsxs)(`div`,{className:`kv-post-legal-field`,children:[(0,V.jsx)(`label`,{htmlFor:`kv-legal-jurisdiction`,className:`kv-post-legal-label`,children:`Jurisdiction (optional)`}),(0,V.jsx)(`input`,{id:`kv-legal-jurisdiction`,type:`text`,className:`kv-post-legal-input`,placeholder:`e.g. Ontario, Canada • Delaware, USA • EU-wide…`,value:C,onChange:e=>w(e.target.value)})]}),(0,V.jsxs)(`div`,{className:`kv-post-legal-field`,children:[(0,V.jsx)(`label`,{htmlFor:`kv-legal-effective`,className:`kv-post-legal-label`,children:`Effective date (optional)`}),(0,V.jsx)(`input`,{id:`kv-legal-effective`,type:`date`,className:`kv-post-legal-input`,value:T,onChange:e=>E(e.target.value)})]}),(0,V.jsxs)(`div`,{className:`kv-post-legal-field`,children:[(0,V.jsx)(`label`,{htmlFor:`kv-legal-ref`,className:`kv-post-legal-label`,children:`Reference code (optional)`}),(0,V.jsx)(`input`,{id:`kv-legal-ref`,type:`text`,className:`kv-post-legal-input`,placeholder:`Internal ID, contract number, matter code…`,value:D,onChange:e=>O(e.target.value)})]})]}),(0,V.jsxs)(`div`,{className:`kv-post-legal-flags mt-3`,children:[(0,V.jsxs)(`label`,{className:`kv-post-legal-flag`,children:[(0,V.jsx)(`input`,{type:`checkbox`,checked:te,onChange:e=>k(e.target.checked)}),(0,V.jsx)(`span`,{children:`This agreement is confidential`})]}),(0,V.jsxs)(`label`,{className:`kv-post-legal-flag`,children:[(0,V.jsx)(`input`,{type:`checkbox`,checked:ne,onChange:e=>re(e.target.checked)}),(0,V.jsx)(`span`,{children:`This bundle includes personal data (names, addresses, IDs, etc.)`})]})]}),(0,V.jsx)(`p`,{className:`kv-post-legal-hint mt-2`,children:`These details are sealed as metadata with the files and time pulse, creating a clear, timestamped record of what was agreed and with whom. This does not replace legal advice—use it as a hardened, auditable trail around your contracts.`})]})]}),(0,V.jsx)(`div`,{className:`kv-post-actions w-full max-w-xl mt-4 flex justify-end`,children:(0,V.jsx)(`button`,{type:`button`,className:`kv-post-submit-btn`,onClick:K,disabled:!N||ae,children:ae?`Sealing…`:`Seal with Breath`})}),(0,V.jsx)(`input`,{id:`kv-post-file-input`,type:`file`,multiple:!0,accept:`*/*`,ref:t,onChange:H,className:`kv-post-file-input`})]})}var dt=a(((e,t)=>{var n=`Input must be an string, Buffer or Uint8Array`;function r(e){let t;if(e instanceof Uint8Array)t=e;else if(typeof e==`string`)t=new TextEncoder().encode(e);else throw Error(n);return t}function i(e){return Array.prototype.map.call(e,function(e){return(e<16?`0`:``)+e.toString(16)}).join(``)}function a(e){return(4294967296+e).toString(16).substring(1)}function o(e,t,n){let r=` `+e+` = `;for(let i=0;i{var n=dt();function r(e,t,n){let r=e[t]+e[n],i=e[t+1]+e[n+1];r>=4294967296&&i++,e[t]=r,e[t+1]=i}function i(e,t,n,r){let i=e[t]+n;n<0&&(i+=4294967296);let a=e[t+1]+r;i>=4294967296&&a++,e[t]=i,e[t+1]=a}function a(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function o(e,t,n,a,o,s){let c=u[o],d=u[o+1],f=u[s],p=u[s+1];r(l,e,t),i(l,e,c,d);let m=l[a]^l[e],h=l[a+1]^l[e+1];l[a]=h,l[a+1]=m,r(l,n,a),m=l[t]^l[n],h=l[t+1]^l[n+1],l[t]=m>>>24^h<<8,l[t+1]=h>>>24^m<<8,r(l,e,t),i(l,e,f,p),m=l[a]^l[e],h=l[a+1]^l[e+1],l[a]=m>>>16^h<<16,l[a+1]=h>>>16^m<<16,r(l,n,a),m=l[t]^l[n],h=l[t+1]^l[n+1],l[t]=h>>>31^m<<1,l[t+1]=m>>>31^h<<1}var s=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),c=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map(function(e){return e*2})),l=new Uint32Array(32),u=new Uint32Array(32);function d(e,t){let n=0;for(n=0;n<16;n++)l[n]=e.h[n],l[n+16]=s[n];for(l[24]^=e.t,l[25]^=e.t/4294967296,t&&(l[28]=~l[28],l[29]=~l[29]),n=0;n<32;n++)u[n]=a(e.b,4*n);for(n=0;n<12;n++)o(0,8,16,24,c[n*16+0],c[n*16+1]),o(2,10,18,26,c[n*16+2],c[n*16+3]),o(4,12,20,28,c[n*16+4],c[n*16+5]),o(6,14,22,30,c[n*16+6],c[n*16+7]),o(0,10,20,30,c[n*16+8],c[n*16+9]),o(2,12,22,24,c[n*16+10],c[n*16+11]),o(4,14,16,26,c[n*16+12],c[n*16+13]),o(6,8,18,28,c[n*16+14],c[n*16+15]);for(n=0;n<16;n++)e.h[n]=e.h[n]^l[n]^l[n+16]}var f=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function p(e,t,n,r){if(e===0||e>64)throw Error(`Illegal output length, expected 0 < length <= 64`);if(t&&t.length>64)throw Error(`Illegal key, expected Uint8Array with 0 < length <= 64`);if(n&&n.length!==16)throw Error(`Illegal salt, expected Uint8Array with length is 16`);if(r&&r.length!==16)throw Error(`Illegal personal, expected Uint8Array with length is 16`);let i={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:e};f.fill(0),f[0]=e,t&&(f[1]=t.length),f[2]=1,f[3]=1,n&&f.set(n,32),r&&f.set(r,48);for(let e=0;e<16;e++)i.h[e]=s[e]^a(f,e*4);return t&&(m(i,t),i.c=128),i}function m(e,t){for(let n=0;n>2]>>8*(n&3);return t}function g(e,t,r,i,a){r||=64,e=n.normalizeInput(e),i&&=n.normalizeInput(i),a&&=n.normalizeInput(a);let o=p(r,t,i,a);return m(o,e),h(o)}function _(e,t,r,i,a){let o=g(e,t,r,i,a);return n.toHex(o)}t.exports={blake2b:g,blake2bHex:_,blake2bInit:p,blake2bUpdate:m,blake2bFinal:h}})),pt=a(((e,t)=>{var n=dt();function r(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function i(e,t,n,r,i,o){c[e]=c[e]+c[t]+i,c[r]=a(c[r]^c[e],16),c[n]=c[n]+c[r],c[t]=a(c[t]^c[n],12),c[e]=c[e]+c[t]+o,c[r]=a(c[r]^c[e],8),c[n]=c[n]+c[r],c[t]=a(c[t]^c[n],7)}function a(e,t){return e>>>t^e<<32-t}var o=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),s=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),c=new Uint32Array(16),l=new Uint32Array(16);function u(e,t){let n=0;for(n=0;n<8;n++)c[n]=e.h[n],c[n+8]=o[n];for(c[12]^=e.t,c[13]^=e.t/4294967296,t&&(c[14]=~c[14]),n=0;n<16;n++)l[n]=r(e.b,4*n);for(n=0;n<10;n++)i(0,4,8,12,l[s[n*16+0]],l[s[n*16+1]]),i(1,5,9,13,l[s[n*16+2]],l[s[n*16+3]]),i(2,6,10,14,l[s[n*16+4]],l[s[n*16+5]]),i(3,7,11,15,l[s[n*16+6]],l[s[n*16+7]]),i(0,5,10,15,l[s[n*16+8]],l[s[n*16+9]]),i(1,6,11,12,l[s[n*16+10]],l[s[n*16+11]]),i(2,7,8,13,l[s[n*16+12]],l[s[n*16+13]]),i(3,4,9,14,l[s[n*16+14]],l[s[n*16+15]]);for(n=0;n<8;n++)e.h[n]^=c[n]^c[n+8]}function d(e,t){if(!(e>0&&e<=32))throw Error(`Incorrect output length, should be in [1, 32]`);let n=t?t.length:0;if(t&&!(n>0&&n<=32))throw Error(`Incorrect key length, should be in [1, 32]`);let r={h:new Uint32Array(o),b:new Uint8Array(64),c:0,t:0,outlen:e};return r.h[0]^=16842752^n<<8^e,n>0&&(f(r,t),r.c=64),r}function f(e,t){for(let n=0;n>2]>>8*(n&3)&255;return t}function m(e,t,r){r||=32,e=n.normalizeInput(e);let i=d(r,t);return f(i,e),p(i)}function h(e,t,r){let i=m(e,t,r);return n.toHex(i)}t.exports={blake2s:m,blake2sHex:h,blake2sInit:d,blake2sUpdate:f,blake2sFinal:p}})),mt=E(a(((e,t)=>{var n=ft(),r=pt();t.exports={blake2b:n.blake2b,blake2bHex:n.blake2bHex,blake2bInit:n.blake2bInit,blake2bUpdate:n.blake2bUpdate,blake2bFinal:n.blake2bFinal,blake2s:r.blake2s,blake2sHex:r.blake2sHex,blake2sInit:r.blake2sInit,blake2sUpdate:r.blake2sUpdate,blake2sFinal:r.blake2sFinal}}))(),1),ht=5236,gt=50;function _t(e){return e===`root`||e===`sacral`||e===`solar`||e===`heart`||e===`throat`||e===`thirdEye`||e===`crown`||e===`krown`}function vt({post:e,identityKaiSignature:t,userPhiKey:n,onSealComplete:r}){let[i,a]=(0,B.useState)(`idle`),[o,s]=(0,B.useState)(0),[c,l]=(0,B.useState)(null),u=(0,B.useRef)(null),d=(0,B.useRef)(!1),f=(0,B.useRef)(0),p=(0,B.useRef)(!0),m=(0,B.useMemo)(()=>ht*2,[]);(0,B.useEffect)(()=>(p.current=!0,()=>{p.current=!1,u.current!=null&&window.clearInterval(u.current)}),[]);let h=()=>{u.current!=null&&(window.clearInterval(u.current),u.current=null)},g=()=>{if(!d.current){if(!t.trim()){l(`Missing identityKaiSignature (session signature). Please re-login.`),a(`idle`),s(0);return}h(),l(null),a(`inhale`),s(0),d.current=!1,f.current=0,u.current=window.setInterval(()=>{f.current+=gt;let e=f.current;if(e{if(!d.current){d.current=!0;try{let i=t.trim();if(!i)throw Error(`Missing identityKaiSignature (session signature).`);let o=await ee(),s=Number(o.pulse??0),c=_t(o.chakraDay)?o.chakraDay:null,l=e.file?.name??`unknown`,u=mt.default.blake2bHex(`${l}-${s}`,void 0,16);if(r({pulse:s,kaiSignature:i,chakraDay:c,post:e,userPhiKey:n??null,kksNonce:u}),!p.current)return;a(`sealed`)}catch(e){d.current=!1;let t=e instanceof Error?e.message:`Failed to seal with live Kai pulse. Please try again.`;if(!p.current)return;l(t),a(`idle`),s(0)}}},v=(()=>{if(c)return`Error`;switch(i){case`idle`:return`Ready to Breathe`;case`inhale`:return`Inhale`;case`exhale`:return`Exhale`;case`sealed`:return`Sealed in Kairos`;default:return`Breath`}})(),y=Math.round(Math.min(o,.5)*200),b=Math.round(Math.max(o-.5,0)*200),x=(()=>{if(c)return c;switch(i){case`idle`:return`Tap begin, inhale as the orb expands, exhale as it returns to stillness. We’ll seal at the end of your exhale.`;case`inhale`:return`Inhale slowly… ${y}%`;case`exhale`:return`Exhale and let go… ${50+b}% — sealing this breath into KaiOS.`;case`sealed`:return`Sealed on a live Kai pulse. Advancing to embed…`;default:return``}})(),S=(()=>{if(c)return`⚠️`;switch(i){case`idle`:return`🌬`;case`inhale`:return`🫁`;case`exhale`:return`🌀`;case`sealed`:return`✨`;default:return`🌬`}})(),C=e.file?.name&&e.file.name.length>40?`${e.file.name.slice(0,22)}…${e.file.name.slice(-12)}`:e.file?.name??`Unnamed glyph`;return(0,V.jsxs)(`div`,{className:`kv-breath-root`,"data-phase":i,"aria-live":`polite`,children:[(0,V.jsxs)(`div`,{className:`kv-breath-meta`,children:[(0,V.jsxs)(`div`,{className:`kv-breath-meta-left`,children:[(0,V.jsx)(`span`,{className:`kv-breath-pill`,children:`Breath Seal • φ 5.236s`}),(0,V.jsx)(`span`,{className:`kv-breath-file`,title:e.file?.name,children:C})]}),(0,V.jsx)(`div`,{className:`kv-breath-meta-right`,children:(0,V.jsx)(`span`,{className:`kv-breath-tag`,children:`Live Kai Pulse`})})]}),(0,V.jsxs)(`div`,{className:`kv-breath-orb-row`,children:[(0,V.jsxs)(`div`,{className:`kv-breath-orb`,"aria-label":`Breath phase: ${v}`,children:[(0,V.jsx)(`div`,{className:`kv-breath-orb-inner`,children:(0,V.jsx)(`span`,{className:`kv-breath-orb-emoji`,children:S})}),(0,V.jsx)(`div`,{className:`kv-breath-orb-ring`,style:{"--kv-breath-progress":o}})]}),(0,V.jsxs)(`div`,{className:`kv-breath-status`,children:[(0,V.jsxs)(`div`,{className:`kv-breath-status-row`,children:[(0,V.jsx)(`span`,{className:`kv-breath-status-label`,children:v}),(0,V.jsxs)(`span`,{className:`kv-breath-status-percent`,children:[Math.round(o*100),`%`]})]}),(0,V.jsx)(`p`,{className:`kv-breath-status-text`,children:x}),(0,V.jsxs)(`div`,{className:`kv-breath-bars`,children:[(0,V.jsxs)(`div`,{className:`kv-breath-bar`,children:[(0,V.jsx)(`span`,{className:`kv-breath-bar-label`,children:`Inhale`}),(0,V.jsx)(`div`,{className:`kv-breath-bar-track`,"aria-hidden":`true`,children:(0,V.jsx)(`div`,{className:`kv-breath-bar-fill kv-breath-bar-fill--inhale`,style:{width:`${y}%`}})})]}),(0,V.jsxs)(`div`,{className:`kv-breath-bar`,children:[(0,V.jsx)(`span`,{className:`kv-breath-bar-label`,children:`Exhale`}),(0,V.jsx)(`div`,{className:`kv-breath-bar-track`,"aria-hidden":`true`,children:(0,V.jsx)(`div`,{className:`kv-breath-bar-fill kv-breath-bar-fill--exhale`,style:{width:`${b}%`}})})]})]})]})]}),(0,V.jsxs)(`div`,{className:`kv-breath-actions`,children:[i===`idle`&&!d.current&&!c&&(0,V.jsx)(`button`,{type:`button`,onClick:g,className:`kv-breath-btn kv-breath-btn-primary`,children:`Begin Breath`}),c&&i===`idle`&&(0,V.jsx)(`button`,{type:`button`,onClick:g,className:`kv-breath-btn kv-breath-btn-warning`,children:`Retry Breath Seal`}),i!==`idle`&&i!==`sealed`&&!c&&(0,V.jsx)(`button`,{type:`button`,className:`kv-breath-btn kv-breath-btn-ghost`,disabled:!0,children:`Sealing on this exhale…`}),i===`sealed`&&(0,V.jsx)(`div`,{className:`kv-breath-sealed-note`,children:`Sealed. The stream will remember this breath forever.`})]})]})}function yt(e){let t=e.trim();return(t.startsWith(`0x`)||t.startsWith(`0X`))&&(t=t.slice(2)),/^[0-9a-fA-F]+$/.test(t)&&(t=t.toLowerCase()),t}var bt=`http://www.w3.org/2000/svg`;async function xt(e){let t=typeof e==`string`?e:JSON.stringify(e),n=new TextEncoder().encode(t),r=await crypto.subtle.digest(`SHA-256`,n),i=new Uint8Array(r),a=``;for(let e=0;e0?s=o.item(0):(s=t.createElementNS(bt,`metadata`),a.appendChild(s)),s.textContent=JSON.stringify(i,null,2);let c=new XMLSerializer().serializeToString(t);return{type:`image`,content:new Blob([c],{type:`image/svg+xml`}),filename:`sigil-${r}.svg`,metadata:i}}return n.mediaType===`image`?{type:`image`,content:n.file,filename:n.file.name,metadata:i}:{type:`video`,content:n.file,filename:n.file.name,metadata:i}}function Tt(e){let{baseCaption:t,phiKey:n,kaiSignature:r,pulse:i,chakraDay:a,verifierUrl:o}=e,s=[];return t&&t.trim().length>0&&s.push(t.trim(),``),s.push(`—`),s.push(`Kai-Sigil Proof of Origin`),n&&s.push(`Φ-Key: ${n}`),r&&s.push(`Kai Signature: ${r}`),typeof i==`number`&&s.push(`Pulse: ${i}`),a&&s.push(`Chakra Day: ${a}`),o&&(s.push(``),s.push(`Verify this post: ${o}`)),s.join(` diff --git a/dist/assets/KaiVohModal-_vPaKG1B.js b/dist/assets/KaiVohModal-CRpJD1P8.js similarity index 91% rename from dist/assets/KaiVohModal-_vPaKG1B.js rename to dist/assets/KaiVohModal-CRpJD1P8.js index c91ca185..40d34a47 100644 --- a/dist/assets/KaiVohModal-_vPaKG1B.js +++ b/dist/assets/KaiVohModal-CRpJD1P8.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KaiVohApp-gp6G11ut.js","assets/index-CgC-NZbJ.js","assets/index-BmaJNTKf.css","assets/prop-types-CRrLra82.js","assets/VerifierFrame-BP2mhmRz.js","assets/VerifierFrame-D0e_dB-R.css","assets/SigilAuthContext-CmP6HWSa.js","assets/sigilRegistry-D8l_pIbq.js","assets/sigilRegistry-Cw7cMZ5l.css","assets/postSeal-ClZBwRbf.js","assets/KaiVohApp-Brroi08x.css","assets/KaiRealms-BZxV3JLS.js","assets/x-n_FrfVOz.js","assets/KaiRealms-BZJvSAmB.css"])))=>i.map(i=>d[i]); -import{t as e}from"./x-n_FrfVOz.js";import{Sn as t,Tn as n,jn as r,tn as i,wn as a}from"./index-CgC-NZbJ.js";import{t as o}from"./SigilAuthContext-CmP6HWSa.js";import{t as s}from"./SigilAuthProvider-EaP0VeI7.js";var c=r(a(),1),l=r(n(),1),u=r(i(),1),d=class extends l.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[KaiVoh] render error:`,e,t)}render(){return this.state.error?(0,u.jsxs)(`div`,{style:{padding:`1rem`,textAlign:`center`},children:[(0,u.jsx)(`h2`,{style:{fontSize:18,fontWeight:600},children:`KaiVoh failed to load`}),(0,u.jsx)(`p`,{style:{opacity:.8,marginTop:8},children:this.state.error.message}),(0,u.jsxs)(`details`,{style:{opacity:.65,marginTop:12,textAlign:`left`},children:[(0,u.jsx)(`summary`,{children:`Details`}),(0,u.jsx)(`pre`,{style:{whiteSpace:`pre-wrap`},children:String(this.state.error.stack??``)})]})]}):this.props.children}};function f(){let e=(0,l.useContext)(o);if(!e)throw Error(`useSigilAuth must be used inside `);return e}var p=(0,l.lazy)(()=>t(()=>import(`./KaiVohApp-gp6G11ut.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]))),m=(0,l.lazy)(()=>t(()=>import(`./KaiRealms-BZxV3JLS.js`),__vite__mapDeps([11,1,2,12,13]))),h=(1+Math.sqrt(5))/2,g=5.236,_=610,v=377;function y({className:e}){let t=(0,l.useId)();return(0,u.jsxs)(`svg`,{className:e,width:_,height:v,viewBox:`0 0 ${_} ${v}`,"aria-hidden":`true`,children:[(0,u.jsx)(`defs`,{children:(0,u.jsxs)(`linearGradient`,{id:t,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,u.jsx)(`stop`,{offset:`0%`,stopColor:`currentColor`,stopOpacity:`0.0`}),(0,u.jsx)(`stop`,{offset:`40%`,stopColor:`currentColor`,stopOpacity:`0.5`}),(0,u.jsx)(`stop`,{offset:`100%`,stopColor:`currentColor`,stopOpacity:`0.0`})]})}),(0,u.jsxs)(`g`,{fill:`none`,stroke:`url(#${t})`,strokeWidth:`2`,children:[(0,u.jsx)(`path`,{d:`M377 0 A377 377 0 0 1 0 377`}),(0,u.jsx)(`path`,{d:`M233 0 A233 233 0 0 1 0 233`}),(0,u.jsx)(`path`,{d:`M144 0 A144 144 0 0 1 0 144`}),(0,u.jsx)(`path`,{d:`M89 0 A89 89 0 0 1 0 89`}),(0,u.jsx)(`path`,{d:`M55 0 A55 55 0 0 1 0 55`}),(0,u.jsx)(`path`,{d:`M34 0 A34 34 0 0 1 0 34`}),(0,u.jsx)(`path`,{d:`M21 0 A21 21 0 0 1 0 21`})]})]})}function b({className:e}){return(0,u.jsxs)(`div`,{className:`seal-emblem ${e??``}`,"aria-hidden":`true`,children:[(0,u.jsx)(`div`,{className:`seal-ring seal-ring--outer`}),(0,u.jsx)(`div`,{className:`seal-ring seal-ring--inner`}),(0,u.jsx)(`div`,{className:`seal-core`})]})}function x({className:e}){let{auth:t}=f(),n=t.meta;if(!n)return null;let r=[`Pulse: ${n.pulse}`,`Beat: ${n.beat}`,`Step: ${n.stepIndex}`,`Day: ${n.chakraDay}`];return n.sigilId&&r.push(`Sigil: ${n.sigilId}`),n.userPhiKey&&r.push(`PhiKey: ${n.userPhiKey}`),(0,u.jsxs)(`div`,{className:`sigil-auth-pill ${e??``}`,role:`status`,"aria-live":`polite`,title:r.join(` • `),style:{maxWidth:`100%`,overflowX:`auto`,whiteSpace:`nowrap`},children:[(0,u.jsx)(`span`,{className:`sigil-auth-pill__dot`,"aria-hidden":`true`}),(0,u.jsxs)(`span`,{className:`sigil-auth-pill__text mono`,children:[`Sealed • `,n.pulse,` • `,n.chakraDay,n.sigilId?` • ${n.sigilId}`:``]})]})}function S({open:t,onClose:n}){let r=(0,l.useRef)(null),i=(0,l.useRef)(null),a=(0,l.useRef)(0),[o,f]=(0,l.useState)(`voh`),[_,v]=(0,l.useState)(!1),S=(0,l.useCallback)(e=>{e===`realms`&&!_&&v(!0),f(e)},[_]);(0,l.useEffect)(()=>{if(!t)return;let e=document.body.style.overflow,n=document.documentElement.style.getPropertyValue(`overscroll-behavior`),o=document.body.style.getPropertyValue(`overscroll-behavior`),s=document.documentElement.style.overflow,c=document.body.style.height,l=document.documentElement.style.height,u=document.documentElement.style.touchAction,d=document.documentElement.style.getPropertyValue(`--kai-breath`),f=document.documentElement.style.getPropertyValue(`--kai-phi`);document.body.style.overflow=`hidden`,document.body.style.height=`100%`,document.documentElement.style.overflow=`hidden`,document.documentElement.style.height=`100%`,document.documentElement.style.setProperty(`overscroll-behavior`,`contain`),document.body.style.setProperty(`overscroll-behavior`,`contain`),document.documentElement.style.touchAction=`manipulation`,document.documentElement.style.setProperty(`--kai-breath`,`${g}s`),document.documentElement.style.setProperty(`--kai-phi`,`${h}`),r.current?.focus();let p=e=>{a.current=e.touches[0]?.clientY??0},m=e=>{if(e.touches.length!==1)return;let t=i.current;if(!t)return;let n=e.target;if(!(n&&t.contains(n))){e.preventDefault();return}let r=(e.touches[0]?.clientY??a.current)-a.current,o=t.scrollTop<=0,s=t.scrollTop+t.clientHeight>=t.scrollHeight;(o&&r>0||s&&r<0)&&e.preventDefault()};return window.addEventListener(`touchstart`,p,{passive:!0}),window.addEventListener(`touchmove`,m,{passive:!1}),()=>{window.removeEventListener(`touchstart`,p),window.removeEventListener(`touchmove`,m),document.body.style.overflow=e,document.body.style.height=c,n?document.documentElement.style.setProperty(`overscroll-behavior`,n):document.documentElement.style.removeProperty(`overscroll-behavior`),o?document.body.style.setProperty(`overscroll-behavior`,o):document.body.style.removeProperty(`overscroll-behavior`),document.documentElement.style.overflow=s,document.documentElement.style.height=l,document.documentElement.style.touchAction=u,d?document.documentElement.style.setProperty(`--kai-breath`,d):document.documentElement.style.removeProperty(`--kai-breath`),f?document.documentElement.style.setProperty(`--kai-phi`,f):document.documentElement.style.removeProperty(`--kai-phi`)}},[t,n]);let C=(0,l.useCallback)(e=>{e.stopPropagation(),n()},[n]),w=(0,l.useCallback)(e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),n())},[n]);return t?(0,c.createPortal)((0,u.jsxs)(`div`,{className:`kai-voh-modal-backdrop atlantean-veil`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`kaivoh-title`,"data-view":o,children:[(0,u.jsx)(`div`,{className:`atlantean-stars`,"aria-hidden":`true`}),(0,u.jsx)(`div`,{className:`atlantean-halo atlantean-halo--1`,"aria-hidden":`true`}),(0,u.jsx)(`div`,{className:`atlantean-halo atlantean-halo--2`,"aria-hidden":`true`}),(0,u.jsxs)(`div`,{className:`kai-voh-container kai-pulse-border glass-omni`,role:`document`,children:[(0,u.jsx)(`div`,{className:`breath-ring breath-ring--outer`,"aria-hidden":`true`}),(0,u.jsx)(`div`,{className:`breath-ring breath-ring--inner`,"aria-hidden":`true`}),(0,u.jsx)(`div`,{className:`phi-grid`,"aria-hidden":`true`}),(0,u.jsx)(y,{className:`phi-spiral phi-spiral--tl`}),(0,u.jsx)(y,{className:`phi-spiral phi-spiral--br`}),(0,u.jsxs)(s,{children:[o!==`realms`&&(0,u.jsx)(`button`,{ref:r,type:`button`,className:`kai-voh-close auric-btn`,"aria-label":`Close portal`,onPointerDown:C,onKeyDown:w,children:(0,u.jsx)(e,{size:22,"aria-hidden":`true`})}),o!==`realms`&&(0,u.jsx)(`div`,{className:`voh-top-orb`,"aria-hidden":`true`,children:(0,u.jsx)(b,{})}),(0,u.jsxs)(`div`,{className:`kai-voh-tabbar`,role:`tablist`,"aria-label":`Kai portal views`,children:[(0,u.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":o===`voh`,className:`kai-voh-tab auric-tab ${o===`voh`?`active`:``}`,onClick:()=>S(`voh`),children:[(0,u.jsx)(`span`,{className:`tab-glyph`,"aria-hidden":`true`,children:`🜂`}),` `,`Voh`]}),(0,u.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":o===`realms`,className:`kai-voh-tab auric-tab ${o===`realms`?`active`:``}`,onClick:()=>S(`realms`),children:[(0,u.jsx)(`span`,{className:`tab-glyph`,"aria-hidden":`true`,children:`⚚`}),` `,`Realms`]}),(0,u.jsx)(`div`,{className:`breath-meter`,"aria-hidden":`true`,children:(0,u.jsx)(`div`,{className:`breath-meter__dot`})}),(0,u.jsx)(x,{className:`sigil-auth-pill--tabbar`})]}),(0,u.jsxs)(`div`,{className:`kai-voh-body`,ref:i,children:[(0,u.jsx)(`h2`,{id:`kaivoh-title`,className:`sr-only`,children:`Kai Portal`}),(0,u.jsxs)(d,{children:[(0,u.jsx)(`section`,{className:`portal-pane`,style:{display:o===`voh`?`block`:`none`},"aria-hidden":o!==`voh`,children:(0,u.jsx)(l.Suspense,{fallback:(0,u.jsxs)(`div`,{className:`kai-voh-center`,children:[(0,u.jsx)(`div`,{className:`kai-voh-spinner`}),(0,u.jsx)(`div`,{children:`Summoning Voh…`})]}),children:(0,u.jsx)(p,{})})}),(0,u.jsx)(`section`,{className:`portal-pane`,style:{display:o===`realms`?`block`:`none`},"aria-hidden":o!==`realms`,children:_?(0,u.jsx)(l.Suspense,{fallback:(0,u.jsxs)(`div`,{className:`kai-voh-center`,children:[(0,u.jsx)(`div`,{className:`kai-voh-spinner`}),(0,u.jsx)(`div`,{children:`Opening Kai Realms…`})]}),children:(0,u.jsx)(m,{onClose:()=>S(`voh`)})}):null})]})]})]})]})]}),document.body):null}export{S as default}; \ No newline at end of file +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KaiVohApp-ShUUTiq2.js","assets/index-BlYU7j-M.js","assets/index-BmaJNTKf.css","assets/prop-types-BWhc8UTz.js","assets/VerifierFrame-a5dTHTgU.js","assets/VerifierFrame-D0e_dB-R.css","assets/SigilAuthContext-CIPXJp4C.js","assets/sigilRegistry-dB0OrrJi.js","assets/sigilRegistry-Cw7cMZ5l.css","assets/postSeal-ClZBwRbf.js","assets/KaiVohApp-Brroi08x.css","assets/KaiRealms-DO28buUy.js","assets/x-CaPcBV4E.js","assets/KaiRealms-BZJvSAmB.css"])))=>i.map(i=>d[i]); +import{t as e}from"./x-CaPcBV4E.js";import{Sn as t,Tn as n,jn as r,tn as i,wn as a}from"./index-BlYU7j-M.js";import{t as o}from"./SigilAuthContext-CIPXJp4C.js";import{t as s}from"./SigilAuthProvider-ea2w3ibF.js";var c=r(a(),1),l=r(n(),1),u=r(i(),1),d=class extends l.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[KaiVoh] render error:`,e,t)}render(){return this.state.error?(0,u.jsxs)(`div`,{style:{padding:`1rem`,textAlign:`center`},children:[(0,u.jsx)(`h2`,{style:{fontSize:18,fontWeight:600},children:`KaiVoh failed to load`}),(0,u.jsx)(`p`,{style:{opacity:.8,marginTop:8},children:this.state.error.message}),(0,u.jsxs)(`details`,{style:{opacity:.65,marginTop:12,textAlign:`left`},children:[(0,u.jsx)(`summary`,{children:`Details`}),(0,u.jsx)(`pre`,{style:{whiteSpace:`pre-wrap`},children:String(this.state.error.stack??``)})]})]}):this.props.children}};function f(){let e=(0,l.useContext)(o);if(!e)throw Error(`useSigilAuth must be used inside `);return e}var p=(0,l.lazy)(()=>t(()=>import(`./KaiVohApp-ShUUTiq2.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]))),m=(0,l.lazy)(()=>t(()=>import(`./KaiRealms-DO28buUy.js`),__vite__mapDeps([11,1,2,12,13]))),h=(1+Math.sqrt(5))/2,g=5.236,_=610,v=377;function y({className:e}){let t=(0,l.useId)();return(0,u.jsxs)(`svg`,{className:e,width:_,height:v,viewBox:`0 0 ${_} ${v}`,"aria-hidden":`true`,children:[(0,u.jsx)(`defs`,{children:(0,u.jsxs)(`linearGradient`,{id:t,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,u.jsx)(`stop`,{offset:`0%`,stopColor:`currentColor`,stopOpacity:`0.0`}),(0,u.jsx)(`stop`,{offset:`40%`,stopColor:`currentColor`,stopOpacity:`0.5`}),(0,u.jsx)(`stop`,{offset:`100%`,stopColor:`currentColor`,stopOpacity:`0.0`})]})}),(0,u.jsxs)(`g`,{fill:`none`,stroke:`url(#${t})`,strokeWidth:`2`,children:[(0,u.jsx)(`path`,{d:`M377 0 A377 377 0 0 1 0 377`}),(0,u.jsx)(`path`,{d:`M233 0 A233 233 0 0 1 0 233`}),(0,u.jsx)(`path`,{d:`M144 0 A144 144 0 0 1 0 144`}),(0,u.jsx)(`path`,{d:`M89 0 A89 89 0 0 1 0 89`}),(0,u.jsx)(`path`,{d:`M55 0 A55 55 0 0 1 0 55`}),(0,u.jsx)(`path`,{d:`M34 0 A34 34 0 0 1 0 34`}),(0,u.jsx)(`path`,{d:`M21 0 A21 21 0 0 1 0 21`})]})]})}function b({className:e}){return(0,u.jsxs)(`div`,{className:`seal-emblem ${e??``}`,"aria-hidden":`true`,children:[(0,u.jsx)(`div`,{className:`seal-ring seal-ring--outer`}),(0,u.jsx)(`div`,{className:`seal-ring seal-ring--inner`}),(0,u.jsx)(`div`,{className:`seal-core`})]})}function x({className:e}){let{auth:t}=f(),n=t.meta;if(!n)return null;let r=[`Pulse: ${n.pulse}`,`Beat: ${n.beat}`,`Step: ${n.stepIndex}`,`Day: ${n.chakraDay}`];return n.sigilId&&r.push(`Sigil: ${n.sigilId}`),n.userPhiKey&&r.push(`PhiKey: ${n.userPhiKey}`),(0,u.jsxs)(`div`,{className:`sigil-auth-pill ${e??``}`,role:`status`,"aria-live":`polite`,title:r.join(` • `),style:{maxWidth:`100%`,overflowX:`auto`,whiteSpace:`nowrap`},children:[(0,u.jsx)(`span`,{className:`sigil-auth-pill__dot`,"aria-hidden":`true`}),(0,u.jsxs)(`span`,{className:`sigil-auth-pill__text mono`,children:[`Sealed • `,n.pulse,` • `,n.chakraDay,n.sigilId?` • ${n.sigilId}`:``]})]})}function S({open:t,onClose:n}){let r=(0,l.useRef)(null),i=(0,l.useRef)(null),a=(0,l.useRef)(0),[o,f]=(0,l.useState)(`voh`),[_,v]=(0,l.useState)(!1),S=(0,l.useCallback)(e=>{e===`realms`&&!_&&v(!0),f(e)},[_]);(0,l.useEffect)(()=>{if(!t)return;let e=document.body.style.overflow,n=document.documentElement.style.getPropertyValue(`overscroll-behavior`),o=document.body.style.getPropertyValue(`overscroll-behavior`),s=document.documentElement.style.overflow,c=document.body.style.height,l=document.documentElement.style.height,u=document.documentElement.style.touchAction,d=document.documentElement.style.getPropertyValue(`--kai-breath`),f=document.documentElement.style.getPropertyValue(`--kai-phi`);document.body.style.overflow=`hidden`,document.body.style.height=`100%`,document.documentElement.style.overflow=`hidden`,document.documentElement.style.height=`100%`,document.documentElement.style.setProperty(`overscroll-behavior`,`contain`),document.body.style.setProperty(`overscroll-behavior`,`contain`),document.documentElement.style.touchAction=`manipulation`,document.documentElement.style.setProperty(`--kai-breath`,`${g}s`),document.documentElement.style.setProperty(`--kai-phi`,`${h}`),r.current?.focus();let p=e=>{a.current=e.touches[0]?.clientY??0},m=e=>{if(e.touches.length!==1)return;let t=i.current;if(!t)return;let n=e.target;if(!(n&&t.contains(n))){e.preventDefault();return}let r=(e.touches[0]?.clientY??a.current)-a.current,o=t.scrollTop<=0,s=t.scrollTop+t.clientHeight>=t.scrollHeight;(o&&r>0||s&&r<0)&&e.preventDefault()};return window.addEventListener(`touchstart`,p,{passive:!0}),window.addEventListener(`touchmove`,m,{passive:!1}),()=>{window.removeEventListener(`touchstart`,p),window.removeEventListener(`touchmove`,m),document.body.style.overflow=e,document.body.style.height=c,n?document.documentElement.style.setProperty(`overscroll-behavior`,n):document.documentElement.style.removeProperty(`overscroll-behavior`),o?document.body.style.setProperty(`overscroll-behavior`,o):document.body.style.removeProperty(`overscroll-behavior`),document.documentElement.style.overflow=s,document.documentElement.style.height=l,document.documentElement.style.touchAction=u,d?document.documentElement.style.setProperty(`--kai-breath`,d):document.documentElement.style.removeProperty(`--kai-breath`),f?document.documentElement.style.setProperty(`--kai-phi`,f):document.documentElement.style.removeProperty(`--kai-phi`)}},[t,n]);let C=(0,l.useCallback)(e=>{e.stopPropagation(),n()},[n]),w=(0,l.useCallback)(e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),n())},[n]);return t?(0,c.createPortal)((0,u.jsxs)(`div`,{className:`kai-voh-modal-backdrop atlantean-veil`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`kaivoh-title`,"data-view":o,children:[(0,u.jsx)(`div`,{className:`atlantean-stars`,"aria-hidden":`true`}),(0,u.jsx)(`div`,{className:`atlantean-halo atlantean-halo--1`,"aria-hidden":`true`}),(0,u.jsx)(`div`,{className:`atlantean-halo atlantean-halo--2`,"aria-hidden":`true`}),(0,u.jsxs)(`div`,{className:`kai-voh-container kai-pulse-border glass-omni`,role:`document`,children:[(0,u.jsx)(`div`,{className:`breath-ring breath-ring--outer`,"aria-hidden":`true`}),(0,u.jsx)(`div`,{className:`breath-ring breath-ring--inner`,"aria-hidden":`true`}),(0,u.jsx)(`div`,{className:`phi-grid`,"aria-hidden":`true`}),(0,u.jsx)(y,{className:`phi-spiral phi-spiral--tl`}),(0,u.jsx)(y,{className:`phi-spiral phi-spiral--br`}),(0,u.jsxs)(s,{children:[o!==`realms`&&(0,u.jsx)(`button`,{ref:r,type:`button`,className:`kai-voh-close auric-btn`,"aria-label":`Close portal`,onPointerDown:C,onKeyDown:w,children:(0,u.jsx)(e,{size:22,"aria-hidden":`true`})}),o!==`realms`&&(0,u.jsx)(`div`,{className:`voh-top-orb`,"aria-hidden":`true`,children:(0,u.jsx)(b,{})}),(0,u.jsxs)(`div`,{className:`kai-voh-tabbar`,role:`tablist`,"aria-label":`Kai portal views`,children:[(0,u.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":o===`voh`,className:`kai-voh-tab auric-tab ${o===`voh`?`active`:``}`,onClick:()=>S(`voh`),children:[(0,u.jsx)(`span`,{className:`tab-glyph`,"aria-hidden":`true`,children:`🜂`}),` `,`Voh`]}),(0,u.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":o===`realms`,className:`kai-voh-tab auric-tab ${o===`realms`?`active`:``}`,onClick:()=>S(`realms`),children:[(0,u.jsx)(`span`,{className:`tab-glyph`,"aria-hidden":`true`,children:`⚚`}),` `,`Realms`]}),(0,u.jsx)(`div`,{className:`breath-meter`,"aria-hidden":`true`,children:(0,u.jsx)(`div`,{className:`breath-meter__dot`})}),(0,u.jsx)(x,{className:`sigil-auth-pill--tabbar`})]}),(0,u.jsxs)(`div`,{className:`kai-voh-body`,ref:i,children:[(0,u.jsx)(`h2`,{id:`kaivoh-title`,className:`sr-only`,children:`Kai Portal`}),(0,u.jsxs)(d,{children:[(0,u.jsx)(`section`,{className:`portal-pane`,style:{display:o===`voh`?`block`:`none`},"aria-hidden":o!==`voh`,children:(0,u.jsx)(l.Suspense,{fallback:(0,u.jsxs)(`div`,{className:`kai-voh-center`,children:[(0,u.jsx)(`div`,{className:`kai-voh-spinner`}),(0,u.jsx)(`div`,{children:`Summoning Voh…`})]}),children:(0,u.jsx)(p,{})})}),(0,u.jsx)(`section`,{className:`portal-pane`,style:{display:o===`realms`?`block`:`none`},"aria-hidden":o!==`realms`,children:_?(0,u.jsx)(l.Suspense,{fallback:(0,u.jsxs)(`div`,{className:`kai-voh-center`,children:[(0,u.jsx)(`div`,{className:`kai-voh-spinner`}),(0,u.jsx)(`div`,{children:`Opening Kai Realms…`})]}),children:(0,u.jsx)(m,{onClose:()=>S(`voh`)})}):null})]})]})]})]})]}),document.body):null}export{S as default}; \ No newline at end of file diff --git a/dist/assets/PShort-v0v0Lc11.js b/dist/assets/PShort-C5MwlKSc.js similarity index 94% rename from dist/assets/PShort-v0v0Lc11.js rename to dist/assets/PShort-C5MwlKSc.js index dd7d10cd..9b1c450d 100644 --- a/dist/assets/PShort-v0v0Lc11.js +++ b/dist/assets/PShort-C5MwlKSc.js @@ -1 +1 @@ -import{Tn as e,bn as t,jn as n,tn as r,xn as i,yn as a}from"./index-CgC-NZbJ.js";var o=n(e(),1),s=n(r(),1);function c(e){let t=e.trim();return t=t.replace(/[)\].,;:!?]+$/g,``),t=t.replace(/^[([{"'`]+/g,``),t.trim()}function l(e){let t=c(e);if(/%[0-9A-Fa-f]{2}/.test(t))try{t=decodeURIComponent(t)}catch{}return t.includes(` `)&&(t=t.replaceAll(` `,`+`)),t=t.replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/g,``),c(t)}function u(){let e=t(),n=a(),r=i();return(0,o.useEffect)(()=>{let t=typeof r.token==`string`?r.token:``,i=typeof r[`*`]==`string`?r[`*`]:``,a=t&&i?`${t}/${i}`:t||i,o=new URLSearchParams(n.search),s=new URLSearchParams(n.hash.startsWith(`#`)?n.hash.slice(1):n.hash),c=o.get(`t`)||o.get(`p`)||o.get(`token`)||s.get(`t`)||s.get(`p`)||s.get(`token`)||``,u=a||c;u&&e(`/p~${l(u)}`,{replace:!0})},[e,n.search,n.hash,r]),(0,s.jsxs)(`div`,{className:`notfound`,role:`region`,"aria-label":`Redirecting`,children:[(0,s.jsx)(`div`,{className:`notfound__title`,children:`Redirecting…`}),(0,s.jsx)(`div`,{className:`notfound__hint`,children:`Normalizing payload token.`})]})}export{u as default}; \ No newline at end of file +import{Tn as e,bn as t,jn as n,tn as r,xn as i,yn as a}from"./index-BlYU7j-M.js";var o=n(e(),1),s=n(r(),1);function c(e){let t=e.trim();return t=t.replace(/[)\].,;:!?]+$/g,``),t=t.replace(/^[([{"'`]+/g,``),t.trim()}function l(e){let t=c(e);if(/%[0-9A-Fa-f]{2}/.test(t))try{t=decodeURIComponent(t)}catch{}return t.includes(` `)&&(t=t.replaceAll(` `,`+`)),t=t.replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/g,``),c(t)}function u(){let e=t(),n=a(),r=i();return(0,o.useEffect)(()=>{let t=typeof r.token==`string`?r.token:``,i=typeof r[`*`]==`string`?r[`*`]:``,a=t&&i?`${t}/${i}`:t||i,o=new URLSearchParams(n.search),s=new URLSearchParams(n.hash.startsWith(`#`)?n.hash.slice(1):n.hash),c=o.get(`t`)||o.get(`p`)||o.get(`token`)||s.get(`t`)||s.get(`p`)||s.get(`token`)||``,u=a||c;u&&e(`/p~${l(u)}`,{replace:!0})},[e,n.search,n.hash,r]),(0,s.jsxs)(`div`,{className:`notfound`,role:`region`,"aria-label":`Redirecting`,children:[(0,s.jsx)(`div`,{className:`notfound__title`,children:`Redirecting…`}),(0,s.jsx)(`div`,{className:`notfound__hint`,children:`Normalizing payload token.`})]})}export{u as default}; \ No newline at end of file diff --git a/dist/assets/SealMomentModal-Bn7w_Hvo.js b/dist/assets/SealMomentModal-C7mxkSGB.js similarity index 99% rename from dist/assets/SealMomentModal-Bn7w_Hvo.js rename to dist/assets/SealMomentModal-C7mxkSGB.js index b0323b62..aa3d5852 100644 --- a/dist/assets/SealMomentModal-Bn7w_Hvo.js +++ b/dist/assets/SealMomentModal-C7mxkSGB.js @@ -1 +1 @@ -import{Tn as e,jn as t,tn as n,wn as r}from"./index-CgC-NZbJ.js";var i=t(e(),1),a=t(r(),1),o=t(n(),1),s=`sigil:urls`;function c(e){if(!(typeof window>`u`))try{let t=window.localStorage.getItem(s),n=t?JSON.parse(t):[];n.includes(e)||(n.push(e),window.localStorage.setItem(s,JSON.stringify(n))),window.dispatchEvent(new CustomEvent(`sigil:url-registered`,{detail:{url:e}}))}catch{}}var l=({open:e,url:t,hash:n,onClose:r})=>{let s=(0,i.useRef)(null),l=(0,i.useRef)(null),m=(0,i.useRef)(null),[h,g]=(0,i.useState)(``),_=(0,i.useRef)(null);(0,i.useEffect)(()=>{if(!(!e||!t)&&_.current!==t){if(_.current=t,typeof window<`u`&&typeof window.__SIGIL__?.registerSigilUrl==`function`)try{window.__SIGIL__.registerSigilUrl(t)}catch{c(t)}else c(t);if(typeof window<`u`&&typeof window.__SIGIL__?.registerSend==`function`)try{window.__SIGIL__.registerSend({type:`sigil:mint`,url:t,hash:n})}catch{}}},[e,t,n]);let v=(0,i.useMemo)(()=>{if(typeof navigator>`u`)return!1;let e=navigator;return typeof e.share==`function`?t&&typeof e.canShare==`function`?e.canShare({url:t}):!0:!1},[t]),y=(0,i.useCallback)(e=>{let t=s.current;if(!t)return;let n=t.querySelectorAll([`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex='-1'])`].join(`,`));if(n.length===0)return;let r=n[0],i=n[n.length-1];!e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus())},[]);(0,i.useEffect)(()=>{if(!e)return;m.current=document.activeElement??null;let t=document.body.style.overflow;document.body.style.overflow=`hidden`;let n=window.setTimeout(()=>l.current?.focus({preventScroll:!0}),0),r=e=>{e.key===`Tab`&&y(e)};return document.addEventListener(`keydown`,r,!0),()=>{document.body.style.overflow=t,document.removeEventListener(`keydown`,r,!0),window.clearTimeout(n),m.current?.focus?.()}},[e,y]);let b=e=>{g(e),window.setTimeout(()=>g(``),900)},x=async(e,t)=>{try{if(typeof navigator>`u`)throw Error(`no navigator`);if(!navigator.clipboard?.writeText)throw Error(`no clipboard`);await navigator.clipboard.writeText(e),b(`${t} copied to clipboard`)}catch{b(`Could not copy ${t}`)}},S=async()=>{try{v&&typeof navigator<`u`?(await navigator.share?.({title:`Kairos Sigil-Glyph`,text:`Sealed Kairos Moment`,url:t}),b(`Share sheet opened`)):await x(t,`Link`)}catch{}},C=(0,i.useMemo)(()=>n?n.slice(0,16):`—`,[n]),w=e=>{e.preventDefault(),e.stopPropagation(),r?.()},T=e=>{e.target===e.currentTarget&&e.preventDefault()};return e?(0,a.createPortal)((0,o.jsxs)(`div`,{className:`seal-overlay`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`seal-title`,"aria-describedby":`seal-desc`,"data-state":`open`,onClick:e=>e.stopPropagation(),onPointerDown:T,children:[(0,o.jsx)(`div`,{className:`seal-veil`,"aria-hidden":`true`}),(0,o.jsxs)(`div`,{ref:s,className:`seal-card`,role:`document`,onClick:e=>e.stopPropagation(),children:[(0,o.jsx)(`div`,{className:`seal-ornament seal-ornament--tl`,"aria-hidden":`true`}),(0,o.jsx)(`div`,{className:`seal-ornament seal-ornament--tr`,"aria-hidden":`true`}),(0,o.jsx)(`div`,{className:`seal-ornament seal-ornament--bl`,"aria-hidden":`true`}),(0,o.jsx)(`div`,{className:`seal-ornament seal-ornament--br`,"aria-hidden":`true`}),(0,o.jsx)(`button`,{ref:l,className:`seal-close`,"aria-label":`Close`,onClick:w,type:`button`,children:(0,o.jsx)(u,{})}),(0,o.jsxs)(`header`,{className:`seal-header`,children:[(0,o.jsx)(`h3`,{id:`seal-title`,className:`seal-title`,children:`Moment Sealed`}),(0,o.jsx)(`p`,{id:`seal-desc`,className:`seal-subtitle`,children:`Your Kairos imprint is preserved. Proceed to the URL below to Inhale Claimed Ownership.`})]}),(0,o.jsxs)(`label`,{className:`field`,children:[(0,o.jsx)(`span`,{className:`field-label`,children:`Hash`}),(0,o.jsxs)(`div`,{className:`row`,children:[(0,o.jsx)(`code`,{className:`hash`,title:n||`—`,children:n?C:`—`}),(0,o.jsx)(`button`,{className:`icon-btn`,onClick:()=>x(n,`Hash`),disabled:!n,"aria-label":`Copy hash`,title:`Copy hash`,type:`button`,children:(0,o.jsx)(f,{})})]}),n&&(0,o.jsxs)(`p`,{className:`micro`,children:[`Full: `,(0,o.jsx)(`span`,{className:`mono`,children:n})]})]}),(0,o.jsxs)(`label`,{className:`field`,children:[(0,o.jsx)(`span`,{className:`field-label`,children:`URL`}),(0,o.jsxs)(`div`,{className:`row`,children:[(0,o.jsx)(`input`,{className:`url-input`,value:t,readOnly:!0,"aria-readonly":`true`,spellCheck:!1}),(0,o.jsx)(`button`,{className:`icon-btn`,onClick:()=>x(t,`Link`),disabled:!t,"aria-label":`Copy link`,title:`Copy link`,type:`button`,children:(0,o.jsx)(f,{})}),t&&(0,o.jsx)(`a`,{className:`open-link`,href:t,target:`_blank`,rel:`noopener`,"aria-label":`Open link in new tab`,title:`Open link`,children:(0,o.jsx)(p,{})})]})]}),(0,o.jsx)(`div`,{className:`cta-row`,children:(0,o.jsxs)(`button`,{className:`secondary cta`,onClick:S,type:`button`,children:[(0,o.jsx)(d,{}),(0,o.jsx)(`span`,{children:v?`Share`:`Remember Link`})]})}),(0,o.jsx)(`p`,{className:`fine`,children:`This moment is now sealed in time. Use the link above within the next 11 breaths to claim ownership & gain permanent access to this Kairos moment.`}),(0,o.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:h})]})]}),document.body):null},u=()=>(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`seal-close-ico`,children:[(0,o.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,opacity:`.35`}),(0,o.jsx)(`path`,{d:`M7 7l10 10M17 7L7 17`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`})]}),d=()=>(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,o.jsx)(`path`,{d:`M15 8a3 3 0 100-6 3 3 0 000 6zM6 14a3 3 0 100-6 3 3 0 000 6zm9 12a3 3 0 100-6 3 3 0 000 6z`,fill:`currentColor`}),(0,o.jsx)(`path`,{d:`M8.6 9.7l6.8-3.4M8.6 12.3l6.8 3.4`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`})]}),f=()=>(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,o.jsx)(`rect`,{x:`9`,y:`9`,width:`10`,height:`10`,rx:`2`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,o.jsx)(`rect`,{x:`5`,y:`5`,width:`10`,height:`10`,rx:`2`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`,opacity:`.5`})]}),p=()=>(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,o.jsx)(`path`,{d:`M10 14a5 5 0 007.07 0l1.41-1.41a5 5 0 00-7.07-7.07L10 6`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,o.jsx)(`path`,{d:`M14 10a5 5 0 00-7.07 0L5.5 11.43a5 5 0 007.07 7.07L14 18`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`})]}),m=l;export{m as t}; \ No newline at end of file +import{Tn as e,jn as t,tn as n,wn as r}from"./index-BlYU7j-M.js";var i=t(e(),1),a=t(r(),1),o=t(n(),1),s=`sigil:urls`;function c(e){if(!(typeof window>`u`))try{let t=window.localStorage.getItem(s),n=t?JSON.parse(t):[];n.includes(e)||(n.push(e),window.localStorage.setItem(s,JSON.stringify(n))),window.dispatchEvent(new CustomEvent(`sigil:url-registered`,{detail:{url:e}}))}catch{}}var l=({open:e,url:t,hash:n,onClose:r})=>{let s=(0,i.useRef)(null),l=(0,i.useRef)(null),m=(0,i.useRef)(null),[h,g]=(0,i.useState)(``),_=(0,i.useRef)(null);(0,i.useEffect)(()=>{if(!(!e||!t)&&_.current!==t){if(_.current=t,typeof window<`u`&&typeof window.__SIGIL__?.registerSigilUrl==`function`)try{window.__SIGIL__.registerSigilUrl(t)}catch{c(t)}else c(t);if(typeof window<`u`&&typeof window.__SIGIL__?.registerSend==`function`)try{window.__SIGIL__.registerSend({type:`sigil:mint`,url:t,hash:n})}catch{}}},[e,t,n]);let v=(0,i.useMemo)(()=>{if(typeof navigator>`u`)return!1;let e=navigator;return typeof e.share==`function`?t&&typeof e.canShare==`function`?e.canShare({url:t}):!0:!1},[t]),y=(0,i.useCallback)(e=>{let t=s.current;if(!t)return;let n=t.querySelectorAll([`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex='-1'])`].join(`,`));if(n.length===0)return;let r=n[0],i=n[n.length-1];!e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus())},[]);(0,i.useEffect)(()=>{if(!e)return;m.current=document.activeElement??null;let t=document.body.style.overflow;document.body.style.overflow=`hidden`;let n=window.setTimeout(()=>l.current?.focus({preventScroll:!0}),0),r=e=>{e.key===`Tab`&&y(e)};return document.addEventListener(`keydown`,r,!0),()=>{document.body.style.overflow=t,document.removeEventListener(`keydown`,r,!0),window.clearTimeout(n),m.current?.focus?.()}},[e,y]);let b=e=>{g(e),window.setTimeout(()=>g(``),900)},x=async(e,t)=>{try{if(typeof navigator>`u`)throw Error(`no navigator`);if(!navigator.clipboard?.writeText)throw Error(`no clipboard`);await navigator.clipboard.writeText(e),b(`${t} copied to clipboard`)}catch{b(`Could not copy ${t}`)}},S=async()=>{try{v&&typeof navigator<`u`?(await navigator.share?.({title:`Kairos Sigil-Glyph`,text:`Sealed Kairos Moment`,url:t}),b(`Share sheet opened`)):await x(t,`Link`)}catch{}},C=(0,i.useMemo)(()=>n?n.slice(0,16):`—`,[n]),w=e=>{e.preventDefault(),e.stopPropagation(),r?.()},T=e=>{e.target===e.currentTarget&&e.preventDefault()};return e?(0,a.createPortal)((0,o.jsxs)(`div`,{className:`seal-overlay`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`seal-title`,"aria-describedby":`seal-desc`,"data-state":`open`,onClick:e=>e.stopPropagation(),onPointerDown:T,children:[(0,o.jsx)(`div`,{className:`seal-veil`,"aria-hidden":`true`}),(0,o.jsxs)(`div`,{ref:s,className:`seal-card`,role:`document`,onClick:e=>e.stopPropagation(),children:[(0,o.jsx)(`div`,{className:`seal-ornament seal-ornament--tl`,"aria-hidden":`true`}),(0,o.jsx)(`div`,{className:`seal-ornament seal-ornament--tr`,"aria-hidden":`true`}),(0,o.jsx)(`div`,{className:`seal-ornament seal-ornament--bl`,"aria-hidden":`true`}),(0,o.jsx)(`div`,{className:`seal-ornament seal-ornament--br`,"aria-hidden":`true`}),(0,o.jsx)(`button`,{ref:l,className:`seal-close`,"aria-label":`Close`,onClick:w,type:`button`,children:(0,o.jsx)(u,{})}),(0,o.jsxs)(`header`,{className:`seal-header`,children:[(0,o.jsx)(`h3`,{id:`seal-title`,className:`seal-title`,children:`Moment Sealed`}),(0,o.jsx)(`p`,{id:`seal-desc`,className:`seal-subtitle`,children:`Your Kairos imprint is preserved. Proceed to the URL below to Inhale Claimed Ownership.`})]}),(0,o.jsxs)(`label`,{className:`field`,children:[(0,o.jsx)(`span`,{className:`field-label`,children:`Hash`}),(0,o.jsxs)(`div`,{className:`row`,children:[(0,o.jsx)(`code`,{className:`hash`,title:n||`—`,children:n?C:`—`}),(0,o.jsx)(`button`,{className:`icon-btn`,onClick:()=>x(n,`Hash`),disabled:!n,"aria-label":`Copy hash`,title:`Copy hash`,type:`button`,children:(0,o.jsx)(f,{})})]}),n&&(0,o.jsxs)(`p`,{className:`micro`,children:[`Full: `,(0,o.jsx)(`span`,{className:`mono`,children:n})]})]}),(0,o.jsxs)(`label`,{className:`field`,children:[(0,o.jsx)(`span`,{className:`field-label`,children:`URL`}),(0,o.jsxs)(`div`,{className:`row`,children:[(0,o.jsx)(`input`,{className:`url-input`,value:t,readOnly:!0,"aria-readonly":`true`,spellCheck:!1}),(0,o.jsx)(`button`,{className:`icon-btn`,onClick:()=>x(t,`Link`),disabled:!t,"aria-label":`Copy link`,title:`Copy link`,type:`button`,children:(0,o.jsx)(f,{})}),t&&(0,o.jsx)(`a`,{className:`open-link`,href:t,target:`_blank`,rel:`noopener`,"aria-label":`Open link in new tab`,title:`Open link`,children:(0,o.jsx)(p,{})})]})]}),(0,o.jsx)(`div`,{className:`cta-row`,children:(0,o.jsxs)(`button`,{className:`secondary cta`,onClick:S,type:`button`,children:[(0,o.jsx)(d,{}),(0,o.jsx)(`span`,{children:v?`Share`:`Remember Link`})]})}),(0,o.jsx)(`p`,{className:`fine`,children:`This moment is now sealed in time. Use the link above within the next 11 breaths to claim ownership & gain permanent access to this Kairos moment.`}),(0,o.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:h})]})]}),document.body):null},u=()=>(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`seal-close-ico`,children:[(0,o.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,opacity:`.35`}),(0,o.jsx)(`path`,{d:`M7 7l10 10M17 7L7 17`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`})]}),d=()=>(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,o.jsx)(`path`,{d:`M15 8a3 3 0 100-6 3 3 0 000 6zM6 14a3 3 0 100-6 3 3 0 000 6zm9 12a3 3 0 100-6 3 3 0 000 6z`,fill:`currentColor`}),(0,o.jsx)(`path`,{d:`M8.6 9.7l6.8-3.4M8.6 12.3l6.8 3.4`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`})]}),f=()=>(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,o.jsx)(`rect`,{x:`9`,y:`9`,width:`10`,height:`10`,rx:`2`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,o.jsx)(`rect`,{x:`5`,y:`5`,width:`10`,height:`10`,rx:`2`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`,opacity:`.5`})]}),p=()=>(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":!0,className:`ico`,children:[(0,o.jsx)(`path`,{d:`M10 14a5 5 0 007.07 0l1.41-1.41a5 5 0 00-7.07-7.07L10 6`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`}),(0,o.jsx)(`path`,{d:`M14 10a5 5 0 00-7.07 0L5.5 11.43a5 5 0 007.07 7.07L14 18`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`})]}),m=l;export{m as t}; \ No newline at end of file diff --git a/dist/assets/SigilAuthContext-CmP6HWSa.js b/dist/assets/SigilAuthContext-CIPXJp4C.js similarity index 73% rename from dist/assets/SigilAuthContext-CmP6HWSa.js rename to dist/assets/SigilAuthContext-CIPXJp4C.js index d9843d63..b0d1a607 100644 --- a/dist/assets/SigilAuthContext-CmP6HWSa.js +++ b/dist/assets/SigilAuthContext-CIPXJp4C.js @@ -1 +1 @@ -import{Tn as e,jn as t}from"./index-CgC-NZbJ.js";var n=t(e(),1);const r=(0,n.createContext)(null);function i(){let e=(0,n.useContext)(r);if(!e)throw Error(`useSigilAuth must be used within .`);return e}export{i as n,r as t}; \ No newline at end of file +import{Tn as e,jn as t}from"./index-BlYU7j-M.js";var n=t(e(),1);const r=(0,n.createContext)(null);function i(){let e=(0,n.useContext)(r);if(!e)throw Error(`useSigilAuth must be used within .`);return e}export{i as n,r as t}; \ No newline at end of file diff --git a/dist/assets/SigilAuthProvider-EaP0VeI7.js b/dist/assets/SigilAuthProvider-ea2w3ibF.js similarity index 91% rename from dist/assets/SigilAuthProvider-EaP0VeI7.js rename to dist/assets/SigilAuthProvider-ea2w3ibF.js index ce00a463..7450d612 100644 --- a/dist/assets/SigilAuthProvider-EaP0VeI7.js +++ b/dist/assets/SigilAuthProvider-ea2w3ibF.js @@ -1 +1 @@ -import{Tn as e,jn as t,tn as n}from"./index-CgC-NZbJ.js";import{t as r}from"./SigilAuthContext-CmP6HWSa.js";var i=t(e(),1),a=t(n(),1),o=`kai.sigilAuth.v1`,s={svgText:null,meta:null};function c(e){if(typeof e!=`object`||!e)return!1;let t=e;if(!(typeof t.pulse==`number`&&Number.isFinite(t.pulse)&&typeof t.beat==`number`&&Number.isFinite(t.beat)&&typeof t.stepIndex==`number`&&Number.isFinite(t.stepIndex)&&typeof t.chakraDay==`string`&&typeof t.kaiSignature==`string`))return!1;let n=e=>e===void 0||typeof e==`string`;return n(t.userPhiKey)&&n(t.sigilId)&&n(t.sigilActionUrl)}function l(e){if(typeof e!=`object`||!e)return!1;let t=e,n=t.svgText===null||typeof t.svgText==`string`,r=t.meta===null||typeof t.meta==`object`&&t.meta!==null&&c(t.meta);return n&&r}function u(){if(typeof window>`u`)return s;try{let e=window.localStorage.getItem(o);if(!e)return s;let t=JSON.parse(e);return l(t)?t:s}catch{return s}}function d(e){try{window.localStorage.setItem(o,JSON.stringify(e))}catch{}}function f(){try{window.localStorage.removeItem(o)}catch{}}function p({children:e}){let[t,n]=(0,i.useState)(()=>u()),c=(0,i.useCallback)((e,t)=>{let r={svgText:e,meta:t};n(r),typeof window<`u`&&d(r)},[]),l=(0,i.useCallback)(()=>{n(s),typeof window<`u`&&f()},[]);(0,i.useEffect)(()=>{let e=e=>{e.key===o&&n(u())};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]);let p=(0,i.useMemo)(()=>({auth:t,setAuth:c,clearAuth:l}),[t,c,l]);return(0,a.jsx)(r.Provider,{value:p,children:e})}export{p as t}; \ No newline at end of file +import{Tn as e,jn as t,tn as n}from"./index-BlYU7j-M.js";import{t as r}from"./SigilAuthContext-CIPXJp4C.js";var i=t(e(),1),a=t(n(),1),o=`kai.sigilAuth.v1`,s={svgText:null,meta:null};function c(e){if(typeof e!=`object`||!e)return!1;let t=e;if(!(typeof t.pulse==`number`&&Number.isFinite(t.pulse)&&typeof t.beat==`number`&&Number.isFinite(t.beat)&&typeof t.stepIndex==`number`&&Number.isFinite(t.stepIndex)&&typeof t.chakraDay==`string`&&typeof t.kaiSignature==`string`))return!1;let n=e=>e===void 0||typeof e==`string`;return n(t.userPhiKey)&&n(t.sigilId)&&n(t.sigilActionUrl)}function l(e){if(typeof e!=`object`||!e)return!1;let t=e,n=t.svgText===null||typeof t.svgText==`string`,r=t.meta===null||typeof t.meta==`object`&&t.meta!==null&&c(t.meta);return n&&r}function u(){if(typeof window>`u`)return s;try{let e=window.localStorage.getItem(o);if(!e)return s;let t=JSON.parse(e);return l(t)?t:s}catch{return s}}function d(e){try{window.localStorage.setItem(o,JSON.stringify(e))}catch{}}function f(){try{window.localStorage.removeItem(o)}catch{}}function p({children:e}){let[t,n]=(0,i.useState)(()=>u()),c=(0,i.useCallback)((e,t)=>{let r={svgText:e,meta:t};n(r),typeof window<`u`&&d(r)},[]),l=(0,i.useCallback)(()=>{n(s),typeof window<`u`&&f()},[]);(0,i.useEffect)(()=>{let e=e=>{e.key===o&&n(u())};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]);let p=(0,i.useMemo)(()=>({auth:t,setAuth:c,clearAuth:l}),[t,c,l]);return(0,a.jsx)(r.Provider,{value:p,children:e})}export{p as t}; \ No newline at end of file diff --git a/dist/assets/SigilExplorer-BX8oOgFy.js b/dist/assets/SigilExplorer-PXIdIaMp.js similarity index 99% rename from dist/assets/SigilExplorer-BX8oOgFy.js rename to dist/assets/SigilExplorer-PXIdIaMp.js index 0a1cf981..da31fc60 100644 --- a/dist/assets/SigilExplorer-BX8oOgFy.js +++ b/dist/assets/SigilExplorer-PXIdIaMp.js @@ -1,4 +1,4 @@ -import{K as e,Tn as t,W as n,X as r,gt as i,hn as a,jn as o,mn as s,nn as c,tn as l}from"./index-CgC-NZbJ.js";import{a as u,n as d,o as f,r as p,t as m}from"./usernameClaimRegistry-DYzaEFWn.js";var h=o(t(),1),g=o(l(),1),_=`https://align.kaiklok.com`,v=`http://m.kai`,y={root:`#ff3b3b`,sacral:`#ff8a3d`,solar:`#ffd54a`,heart:`#3dff9a`,throat:`#46d3ff`,thirdEye:`#6b6cff`,crown:`#c18bff`};function b(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();return t?t.includes(`root`)?`root`:t.includes(`sacral`)?`sacral`:t.includes(`solar`)||t.includes(`plexus`)||t.includes(`sun`)?`solar`:t.includes(`heart`)?`heart`:t.includes(`throat`)?`throat`:t.includes(`third`)||t.includes(`eye`)||t.includes(`indigo`)?`thirdEye`:t.includes(`crown`)||t.includes(`krown`)||t.includes(`violet`)?`crown`:t===`1`?`root`:t===`2`?`sacral`:t===`3`?`solar`:t===`4`?`heart`:t===`5`?`throat`:t===`6`?`thirdEye`:t===`7`?`crown`:null:null}function ee(e){let t=b(e),n=t?y[t]:`var(--sx-accent)`;return{"--sx-chakra":n}}var te=`kai:sigils:v1`,ne=`sigil:urls`,re=`kai-sigil-registry`,x=512,S=`/phi.svg`,C=typeof window<`u`,w=C&&window.localStorage!==void 0,T=1000000n,E=8,ie=2e4;function ae(){let e=s(),t=a(e),n=(t/T+1n)*T-t,r=a(e+1n)-t,i=r>0n?r:191n,o=(n+i-1n)/i,c=Number(o);return Math.min(ie,Math.max(E,c))}var D=5e3,oe=24,se=200,O=180,ce=1200,le=12e3,k=`kai:inhaleQueue:v1`,A=`kai:urlHealth:v1`,ue=18,de=2200,fe=`sigil-explorer-prefetch-v1`,pe=4200,me=`https://phi.network`,he=520,ge=900,_e=80;function j(){let e=s(),t=BigInt(2**53-1),n=e<0n?0n:e>t?t:e;return Number(n)}function ve(e){if(!C)return e;let t=window;return typeof t.CSS?.escape==`function`?t.CSS.escape(e):e.replace(/[^a-zA-Z0-9_-]/gu,e=>`\\${e}`)}var M=_,N=v,ye=`/sigils/seal`,be=`/sigils/urls`,xe=`/sigils/inhale`,Se=`kai:lahmahtorBase:v1`,Ce=`kai:lahmahtorBackupDeadUntil:v1`,we=120*1e3,P=0;function Te(){if(!w)return;let e=localStorage.getItem(Ce);if(!e)return;let t=Number(e);Number.isFinite(t)&&t>0&&(P=t)}function Ee(){if(w)try{localStorage.setItem(Ce,String(P))}catch{}}function De(){return j()e!==N):e;let t=window.location.protocol===`https:`?e.filter(e=>e.startsWith(`https://`)):e;return De()?t.filter(e=>e!==N):t}function Ne(e){return e===0||e===404||e===408||e===429||e>=500}async function Pe(e,t){let n=Me(),r=null;for(let i of n){let n=e(i);try{let e=await fetch(n,t);if(r=e,e.ok||e.status===304)return i===N&&Oe(),F=i,je(),e;if(i===N&&Ne(e.status)&&ke(),!Ne(e.status))return e}catch{i===N&&ke();continue}}return r}async function Fe(e,t){let n=await Pe(e,t);if(!n)return{ok:!1,status:0};if(!n.ok)return{ok:!1,status:n.status};try{return{ok:!0,value:await n.json(),status:n.status}}catch{return{ok:!1,status:0}}}function I(){return C?window.location.origin:me}function L(e){try{let t=I(),n=new URL(e,t);return new URL(`${n.pathname}${n.search}${n.hash}`,t).toString()}catch{return e}}function Ie(e){try{let t=new URL(e,I()).pathname.match(/\/s\/([^/]+)/u);return t?.[1]?decodeURIComponent(t[1]):void 0}catch{return}}function R(e){try{return new URL(e,I()).pathname.toLowerCase().startsWith(`/p~`)}catch{return e.toLowerCase().includes(`/p~`)}}function Le(e){try{return decodeURIComponent(e)}catch{return e}}function Re(e){let t=e.trim();return t.length<16?!1:/^[A-Za-z0-9_-]+$/u.test(t)}function ze(e){let t=I();return new URL(`/stream/p/${e}`,t).toString()}function Be(e){let t=I(),n=new URL(`/stream`,t),r=new URLSearchParams;return r.set(`p`,e),n.hash=`#${r.toString()}`,n.toString()}function Ve(e){try{let t=I(),n=new URL(e,t),r=n.pathname.match(/\/stream\/p\/([^/]+)/u);if(!r?.[1])return e;let i=decodeURIComponent(r[1]),a=new URL(`/stream`,t);a.search=n.search;let o=n.hash.startsWith(`#`)?n.hash.slice(1):``,s=new URLSearchParams(o);return s.set(`p`,i),a.hash=`#${s.toString()}`,a.toString()}catch{return e}}function z(e){try{let t=new URL(e,I()),n=t.pathname,r=n.match(/\/stream\/p\/([^/]+)/u);if(r?.[1])return decodeURIComponent(r[1]);let i=n.match(/^\/p~([^/]+)/u);if(i?.[1])return decodeURIComponent(i[1]);let a=t.searchParams.get(`p`);if(a)return a;let o=t.hash.startsWith(`#`)?t.hash.slice(1):``;return new URLSearchParams(o).get(`p`)||void 0}catch{let t=e.toLowerCase().match(/\/p~([^/?#]+)/u);return t?.[1]?Le(t[1]):void 0}}function B(e){let t=L(e);if(R(t)){let e=z(t);return e?L(Be(e)):t}let n=Ve(t);return n===t?t:L(n)}function He(e){if(!C)return B(e);let t=B(e),n=window.location.origin;try{let e=new URL(t,n);return`${n}${e.pathname}${e.search}${e.hash}`}catch{let e=t.match(/^(?:https?:\/\/[^/]+)?(\/.*)$/i);return`${n}${(e?.[1]??t).startsWith(`/`)?e?.[1]??t:`/${e?.[1]??t}`}`}}function Ue(e,t=10){return e?e.length<=t*2+3?e:`${e.slice(0,t)}…${e.slice(-t)}`:`—`}function V(e,t){return(e.pulse??0)===(t.pulse??0)?(e.beat??0)===(t.beat??0)?(e.stepIndex??0)-(t.stepIndex??0):(e.beat??0)-(t.beat??0):(e.pulse??0)-(t.pulse??0)}function We(e){return e.toFixed(6).replace(/0+$/u,``).replace(/\.$/u,``)}function H(){return C?typeof navigator>`u`?!0:navigator.onLine:!1}function Ge(){return C&&typeof window.crypto?.randomUUID==`function`?window.crypto.randomUUID():Math.random().toString(16).slice(2)}function U(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ke(e,t){if(!U(e))return;let n=e[t];return typeof n==`string`&&n.trim()||void 0}async function qe(e){if(!C||!H())return;let t=new AbortController,n=window.setTimeout(()=>t.abort(),pe);try{let n=await fetch(e,{method:`GET`,cache:`force-cache`,signal:t.signal});if(n&&n.ok&&`caches`in window&&typeof caches.open==`function`)try{await(await caches.open(fe)).put(new Request(e),n.clone())}catch{}}catch{}finally{window.clearTimeout(n)}}var W=new Map;function Je(){if(!w)return;let e=localStorage.getItem(A);if(e)try{let t=JSON.parse(e);if(!U(t))return;W.clear();for(let[e,n]of Object.entries(t))(n===1||n===-1)&&W.set(L(e),n)}catch{}}function Ye(){if(!w)return;let e={};for(let[t,n]of W)e[t]=n;try{localStorage.setItem(A,JSON.stringify(e))}catch{}}function Xe(e,t){let n=L(e);return W.get(n)===t?!1:(W.set(n,t),Ye(),!0)}function Ze(e){let t=new URL(_).host,n=new URL(v).host,r=new URL(I()).host,i=new URL(me).host;return e===t||e===n||e===r||e===i}async function Qe(e){if(!C)return`unknown`;let t=B(e),n;try{if(n=new URL(t,I()),!Ze(n.host))return`unknown`;if(n.pathname.toLowerCase()===`/stream`)return`ok`}catch{return`unknown`}try{let e=new AbortController,t=window.setTimeout(()=>e.abort(),de),r=t=>fetch(n.toString(),{method:t,cache:`no-store`,signal:e.signal,redirect:`follow`,mode:`cors`}),i;try{i=await r(`HEAD`)}catch{i=await r(`GET`)}finally{window.clearTimeout(t)}return i.ok?`ok`:`bad`}catch{return`unknown`}}function $e(e){try{let t=new URL(e,I()),n=t.pathname.toLowerCase();if(n.includes(`/s/`))return`postS`;if(n.startsWith(`/p~`))return`streamP`;if(!n.includes(`/stream`))return`other`;if(n.includes(`/stream/p/`))return`streamP`;let r=t.searchParams.get(`t`);if(r&&r.trim())return`streamT`;let i=t.hash.startsWith(`#`)?t.hash.slice(1):``,a=new URLSearchParams(i),o=a.get(`t`);if(o&&o.trim()||n.includes(`/stream/t`))return`streamT`;let s=t.searchParams.get(`p`);if(s&&s.trim())return`streamQ`;let c=a.get(`p`);return c&&c.trim()?`streamQ`:`stream`}catch{let t=e.toLowerCase();return t.includes(`/s/`)?`postS`:t.includes(`/p~`)||t.includes(`/stream/p/`)?`streamP`:t.includes(`/stream/t`)||/[?&#]t=/.test(t)?`streamT`:t.includes(`/stream`)&&/[?&#]p=/.test(t)?`streamQ`:t.includes(`/stream`)?`stream`:`other`}}function et(e){let t=$e(e);return t===`postS`?`post`:t.startsWith(`stream`)?`stream`:`other`}function tt(e){let t=e;return typeof t.userPhiKey==`string`&&t.userPhiKey||typeof t.phiKey==`string`&&t.phiKey||typeof t.phikey==`string`&&t.phikey||``}function nt(e,t){let n=tt(t),r=Number.isFinite(t.pulse??NaN)?t.pulse:null;if(n&&r!=null)return`k:${n}|${r}`;let i=typeof t.kaiSignature==`string`?t.kaiSignature.trim():``;if(i)return`sig:${i}`;let a=z(e);if(a&&a.trim())return`tok:${a.trim()}`;let o=Ie(e)??``;return o?`h:${o}`:`u:${L(e)}`}function rt(e,t){let n=et(e),r=Ie(e)??``;if(n===`post`&&r)return`post:${r}`;let i=tt(t),a=Number.isFinite(t.pulse??NaN)?t.pulse:null;if(n===`stream`&&i&&a!=null)return`stream:${i}|${a}`;let o=typeof t.kaiSignature==`string`?t.kaiSignature.trim():``;if(o)return`${n}:sig:${o}`;let s=z(e);return s&&s.trim()?`${n}:tok:${s.trim()}`:`${n}:u:${L(e)}`}var it=e=>{let t=e.toLowerCase();if(!t.includes(`/stream`))return!1;let n=t.includes(`root=`)||t.includes(`&seg=`)||t.includes(`&add=`),r=t.includes(`/stream#`)||t.includes(`#v=`);return n&&r};function G(e,t){if(R(e))return-1e9;let n=e.toLowerCase(),r=$e(e),i=0;it(n)&&(i-=1e4),t===`post`?r===`postS`?i+=220:i-=25:t===`stream`?r===`streamT`?i+=220:r===`streamP`?i+=190:r===`streamQ`?i+=175:r===`stream`?i+=160:r===`postS`?i+=80:i-=25:(r===`postS`&&(i+=120),r===`streamT`&&(i+=125),r===`streamP`&&(i+=105),(r===`streamQ`||r===`stream`)&&(i+=95));let a=I().toLowerCase();n.startsWith(a)&&(i+=12),n.startsWith(_.toLowerCase())&&(i+=10),n.startsWith(v.toLowerCase())&&(i+=10);let o=W.get(L(e));return o===1&&(i+=200),o===-1&&(i-=200),i+=Math.max(0,20-Math.floor(e.length/40)),i}function at(e,t){let n=e.filter(e=>!R(e)),r=n.length>0?n:e;if(n.length===0&&e.length>0){let t=z(e[0]??``);if(t)return L(Be(t))}let i=r[0]??``,a=-1e9;for(let e of r){let n=G(e,t);(n>a||n===a&&e.length=1e-12)return e}}}function ut(){if(!w)return;let e=Array.from(K.keys());try{localStorage.setItem(te,JSON.stringify(e))}catch{}}function J(e,t){let n=L(e);dt(n,t);let r=K.get(n);if(!r)return K.set(n,t),!0;let i=r.parentUrl??``,a=r.originUrl??``,o=t.parentUrl??``,s=t.originUrl??``,c=i!==o||a!==s,l=Object.keys(r).length,u=Object.keys(t).length!==l,d=V(r,t)!==0;return c||u||d?(K.set(n,t),!0):!1}function dt(e,t){let n=t.feed;if(!n)return;let r=n.usernameClaim,i=r?f(r.payload?.normalized||r.payload?.username||``):``,a=f(n.author??``),o=i||a;if(!o||!r)return;let s=u(r.hash??``),c=r.url?.trim()||e;if(!s||!c)return;let l=r.payload;if(!l||l.kind!==`username_claim`)return;let p=f(l.normalized||l.username||``)||o;if(p!==o)return;let m=r.ownerHint??l.ownerHint??null;d({hash:s,url:L(c),payload:{...l,normalized:p},ownerHint:m})}function ft(e){let t=L(e),r=n(t);return r?J(t,ct(r,st(t))):!1}function pt(e,t){if(e.length===0)return!1;let n=L(e[0]),r=!1;r=ft(n)||r;{let e=K.get(n);if(e){let t={...e};t.originUrl||=n,r=J(n,t)||r}}for(let t=1;t{X=null,Q()},O))}function vt(e,t){let n=L(e),r={url:n,...t};Y.set(n,r),Z(),C&&(X!=null&&window.clearTimeout(X),X=window.setTimeout(()=>{X=null,Q()},O))}function yt(){for(let[e,t]of K){let n=L(e),r=t;Y.set(n,{url:n,...r})}Z()}async function Q(){if(C&&H()&&!mt&&Y.size!==0){mt=!0;try{let e=[],t=[];for(let[n,r]of Y)if(e.push(r),t.push(n),e.length>=se)break;let n=JSON.stringify(e),r=new Blob([n],{type:`application/json`}),i=new FormData;i.append(`file`,r,`sigils_${Ge()}.json`);let a=await Pe(e=>{let t=new URL(xe,e);return t.searchParams.set(`include_state`,`false`),t.searchParams.set(`include_urls`,`false`),t.toString()},{method:`POST`,body:i});if(!a||!a.ok)throw Error(`inhale failed: ${a?.status??0}`);try{await a.json()}catch{}for(let e of t)Y.delete(e);Z(),ht=0,Y.size>0&&(X=window.setTimeout(()=>{X=null,Q()},10))}catch{ht=Math.min(ht?ht*2:ce,le),X=window.setTimeout(()=>{X=null,Q()},ht)}finally{mt=!1}}}function $(e,t){let i=L(e),a=n(i);if(!a)return!1;let o=t?.includeAncestry??!0,s=t?.broadcast??!0,c=t?.persist??!0,l=t?.source??`local`,u=t?.enqueueToApi??l===`local`,d=!1,f=st(i);if(d=J(i,ct(a,f))||d,o&&f.chain.length>0){for(let e of f.chain)d=ft(e)||d;d=pt(f.chain,i)||d}if(o){let e=r(i);for(let t of e){let e=L(t),r=n(e);r&&(d=J(e,ct(r,st(e)))||d)}}if(d&&(c&&ut(),q&&s&&q.postMessage({type:`sigil:add`,url:i}),u)){let e=K.get(i);e&&vt(i,e)}return d}function bt(e){let t=[],n=[],r=e=>{let n=L(e);t.includes(n)||t.push(n)};if(Array.isArray(e)){for(let i of e){if(typeof i==`string`){i.trim()&&r(i.trim());continue}if(U(i)){let e=i.url;if(typeof e==`string`&&e.trim()){let r=L(e.trim());t.includes(r)||t.push(r),n.push({...i,url:r})}}}return{urls:t,rawKrystals:n}}if(U(e)){let i=e.urls;if(Array.isArray(i))for(let e of i)typeof e==`string`&&e.trim()&&r(e.trim());let a=e.url;if(typeof a==`string`&&a.trim()){let r=L(a.trim());t.includes(r)||t.push(r),n.push({...e,url:r})}return{urls:t,rawKrystals:n}}return{urls:t,rawKrystals:n}}function xt(e){for(let t of e){let e=L(t),r=K.get(e)??n(e);r&&vt(e,ct(r,st(e)))}Q()}function St(){if(!w)return!1;let e=e=>{if(!e)return!1;try{let t=JSON.parse(e);if(!Array.isArray(t))return!1;let n=!1;for(let e of t)typeof e==`string`&&$(e,{includeAncestry:!0,broadcast:!1,persist:!1,source:`hydrate`,enqueueToApi:!1})&&(n=!0);return n}catch{return!1}},t=e(localStorage.getItem(te)),n=e(localStorage.getItem(ne));return(t||n)&&ut(),t||n}async function Ct(e){let t=0,n,r;for(let i=0;i{let t=new URL(be,e);return t.searchParams.set(`offset`,String(a)),t.searchParams.set(`limit`,String(D)),t.toString()},{method:`GET`,signal:e,cache:`no-store`});if(!o.ok)break;n=o.value.state_seal,r=o.value.total;let s=o.value.urls;if(!Array.isArray(s)||s.length===0)break;for(let e of s){if(typeof e!=`string`)continue;let n=L(e);K.has(n)||$(n,{includeAncestry:!0,broadcast:!1,persist:!1,source:`remote`,enqueueToApi:!1})&&(t+=1)}if(s.length=r)break}return t>0&&ut(),{imported:t,remoteSeal:n,remoteTotal:r}}function wt(t){let n=new Map,r=new Map;for(let[e,i]of t){let t=L(e),a=et(t),o=rt(t,i),s=nt(t,i);n.set(t,o);let c=r.get(o);if(!c){r.set(o,{payload:i,urls:new Set([t]),kind:a,momentKey:s});continue}V(i,c.payload)>0&&(c.payload=i),c.urls.add(t);let l=c.momentKey,u=s;l.startsWith(`u:`)&&!u.startsWith(`u:`)&&(c.momentKey=u),l.startsWith(`h:`)&&(u.startsWith(`k:`)||u.startsWith(`sig:`)||u.startsWith(`tok:`))&&(c.momentKey=u)}let i=new Map;for(let[e,t]of r){let n=at(Array.from(t.urls),t.kind);i.set(e,{id:e,payload:t.payload,urls:t.urls,primaryUrl:n,kind:t.kind,momentKey:t.momentKey})}let a=new Map;for(let e of i.values()){let t=e.momentKey;a.has(t)||a.set(t,[]),a.get(t).push(e.id)}let o=new Map,s=new Map,c=new Map;for(let[e,t]of a){let n=t.map(e=>i.get(e)).filter(Boolean),r=n.filter(e=>e.kind===`post`),a;a=r.length>0?r.slice().sort((e,t)=>G(t.primaryUrl,`post`)-G(e.primaryUrl,`post`))[0]:n.slice().sort((e,t)=>G(t.primaryUrl,t.kind)-G(e.primaryUrl,e.kind))[0];let l=a?.id??t[0];o.set(e,l);for(let e of t)s.set(e,l);for(let e of t){let t=i.get(e);if(t)for(let e of t.urls)c.set(e,l)}}let l=new Map;for(let t of i.values()){let r=s.get(t.id)??t.id;if(t.id!==r)continue;let i=Ke(t.payload,`originUrl`),a=i?L(i):e(t.primaryUrl)??t.primaryUrl,o=n.get(a),u=c.get(a)??(o?s.get(o):void 0);l.set(r,u??r)}let u=new Map;for(let e of i.values()){let t=s.get(e.id)??e.id,r=l.get(t)??t,i;if(e.id!==t)i=t;else{let t=Ke(e.payload,`parentUrl`);if(t){let r=L(t),a=n.get(r),o=c.get(r)??(a?s.get(a):void 0);o&&o!==e.id&&(i=o)}}u.set(e.id,{id:e.id,payload:e.payload,urls:e.urls,primaryUrl:e.primaryUrl,kind:e.kind,momentKey:e.momentKey,parentId:i,originId:r,momentParentId:t})}return u}function Tt(e,t){let n=[];for(let[r,i]of t)i.parentId===e&&n.push(r);return n.sort((e,n)=>V(t.get(n).payload,t.get(e).payload)),n}function Et(e,t,n=new Set){let r=t.get(e);if(!r)return null;if(n.has(e))return{id:r.id,url:r.primaryUrl,urls:Array.from(r.urls),payload:r.payload,children:[]};n.add(e);let i=Tt(e,t).map(e=>Et(e,t,n)).filter(Boolean);return{id:r.id,url:r.primaryUrl,urls:Array.from(r.urls),payload:r.payload,children:i}}function Dt(e){let t=0,n=e.payload,r=e=>{t+=1,V(e.payload,n)>0&&(n=e.payload),e.children.forEach(r)};return r(e),{nodeCount:t,latest:n}}function Ot(e){let t=wt(e),n=new Map;for(let[e,r]of t){let t=r.originId;n.has(t)||n.set(t,[]),n.get(t).push(e)}let r=[];for(let e of n.keys()){let n=Et(e,t);if(!n)continue;let i=Dt(n);r.push({root:n,nodeCount:i.nodeCount,latest:i.latest})}return r.sort((e,t)=>{let n=V(t.latest,e.latest);return n===0?t.nodeCount===e.nodeCount?V(t.root.payload,e.root.payload):t.nodeCount-e.nodeCount:n}),r.map(e=>e.root)}function kt(e,t){let n=e.payload,r=[],i=new Set,a=lt(e.payload);a!==void 0&&r.push({label:`This glyph Φ`,value:`${We(a)} Φ`});let o=n.feed,s=typeof o?.author==`string`?o.author:typeof n.author==`string`?n.author:void 0,c=o?o.usernameClaim:void 0,l=c?f(c.payload?.normalized||c.payload?.username||``):``,u=f(s??``),d=l||u;if(d){let e=t[d],n=typeof s==`string`&&s.trim().length>0?s.trim():`@${d}`;e?(r.push({label:`Username (claimed)`,value:`${n} → glyph ${Ue(e.claimHash,10)}`}),r.push({label:`Claim glyph`,value:B(e.claimUrl)})):r.push({label:`Username`,value:n})}let p=(e,t)=>{let a=n[e];typeof a==`string`&&a.trim().length>0&&!i.has(e)&&(r.push({label:t,value:a.trim()}),i.add(e))};p(`userPhiKey`,`PhiKey`),p(`phiKey`,`PhiKey`),p(`phikey`,`PhiKey`),p(`kaiSignature`,`Kai Signature`);let m=n.parentUrl;typeof m==`string`&&m.length>0&&(r.push({label:`Parent URL`,value:B(m)}),i.add(`parentUrl`));let h=n.originUrl;typeof h==`string`&&h.length>0&&(r.push({label:`Origin URL`,value:B(h)}),i.add(`originUrl`));let g=n.label??n.title??n.type??n.note??n.description;typeof g==`string`&&g.trim().length>0&&r.push({label:`Label / Type`,value:g.trim()});for(let e of[`memoryUrl`,`memory_url`,`streamUrl`,`stream_url`,`feedUrl`,`feed_url`,`stream`]){let t=n[e];typeof t==`string`&&t.trim().length>0&&!i.has(e)&&(r.push({label:e,value:B(t.trim())}),i.add(e))}for(let[e,t]of Object.entries(n)){if(r.length>=12)break;if(i.has(e)||t==null)continue;let n=e.toLowerCase();if(!(n.includes(`stream`)||n.includes(`memory`)||n.includes(`feed`))||typeof t==`string`&&t.trim().length===0)continue;let a=typeof t==`string`?B(t.trim()):JSON.stringify(t);r.push({label:e,value:a})}r.push({label:`Primary URL`,value:B(e.url)});let _=e.urls.filter(e=>!R(e)).map(e=>B(e));return e.urls.length>1&&r.push({label:`URL variants`,value:_.length===0?`${e.urls.length} urls (kept in data; hidden from browser view)`:_.length<=3?_.join(` | `):`${e.urls.length} urls (kept in data; rendered once)`}),r}async function At(e){if(C){try{if(navigator.clipboard&&typeof navigator.clipboard.writeText==`function`){await navigator.clipboard.writeText(e);return}}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,`true`),t.style.position=`fixed`,t.style.left=`-9999px`,t.style.top=`-9999px`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t)}catch{}}}var jt=()=>(0,g.jsx)(`style`,{children:` +import{K as e,Tn as t,W as n,X as r,gt as i,hn as a,jn as o,mn as s,nn as c,tn as l}from"./index-BlYU7j-M.js";import{a as u,n as d,o as f,r as p,t as m}from"./usernameClaimRegistry-B6UXZAUR.js";var h=o(t(),1),g=o(l(),1),_=`https://align.kaiklok.com`,v=`http://m.kai`,y={root:`#ff3b3b`,sacral:`#ff8a3d`,solar:`#ffd54a`,heart:`#3dff9a`,throat:`#46d3ff`,thirdEye:`#6b6cff`,crown:`#c18bff`};function b(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();return t?t.includes(`root`)?`root`:t.includes(`sacral`)?`sacral`:t.includes(`solar`)||t.includes(`plexus`)||t.includes(`sun`)?`solar`:t.includes(`heart`)?`heart`:t.includes(`throat`)?`throat`:t.includes(`third`)||t.includes(`eye`)||t.includes(`indigo`)?`thirdEye`:t.includes(`crown`)||t.includes(`krown`)||t.includes(`violet`)?`crown`:t===`1`?`root`:t===`2`?`sacral`:t===`3`?`solar`:t===`4`?`heart`:t===`5`?`throat`:t===`6`?`thirdEye`:t===`7`?`crown`:null:null}function ee(e){let t=b(e),n=t?y[t]:`var(--sx-accent)`;return{"--sx-chakra":n}}var te=`kai:sigils:v1`,ne=`sigil:urls`,re=`kai-sigil-registry`,x=512,S=`/phi.svg`,C=typeof window<`u`,w=C&&window.localStorage!==void 0,T=1000000n,E=8,ie=2e4;function ae(){let e=s(),t=a(e),n=(t/T+1n)*T-t,r=a(e+1n)-t,i=r>0n?r:191n,o=(n+i-1n)/i,c=Number(o);return Math.min(ie,Math.max(E,c))}var D=5e3,oe=24,se=200,O=180,ce=1200,le=12e3,k=`kai:inhaleQueue:v1`,A=`kai:urlHealth:v1`,ue=18,de=2200,fe=`sigil-explorer-prefetch-v1`,pe=4200,me=`https://phi.network`,he=520,ge=900,_e=80;function j(){let e=s(),t=BigInt(2**53-1),n=e<0n?0n:e>t?t:e;return Number(n)}function ve(e){if(!C)return e;let t=window;return typeof t.CSS?.escape==`function`?t.CSS.escape(e):e.replace(/[^a-zA-Z0-9_-]/gu,e=>`\\${e}`)}var M=_,N=v,ye=`/sigils/seal`,be=`/sigils/urls`,xe=`/sigils/inhale`,Se=`kai:lahmahtorBase:v1`,Ce=`kai:lahmahtorBackupDeadUntil:v1`,we=120*1e3,P=0;function Te(){if(!w)return;let e=localStorage.getItem(Ce);if(!e)return;let t=Number(e);Number.isFinite(t)&&t>0&&(P=t)}function Ee(){if(w)try{localStorage.setItem(Ce,String(P))}catch{}}function De(){return j()e!==N):e;let t=window.location.protocol===`https:`?e.filter(e=>e.startsWith(`https://`)):e;return De()?t.filter(e=>e!==N):t}function Ne(e){return e===0||e===404||e===408||e===429||e>=500}async function Pe(e,t){let n=Me(),r=null;for(let i of n){let n=e(i);try{let e=await fetch(n,t);if(r=e,e.ok||e.status===304)return i===N&&Oe(),F=i,je(),e;if(i===N&&Ne(e.status)&&ke(),!Ne(e.status))return e}catch{i===N&&ke();continue}}return r}async function Fe(e,t){let n=await Pe(e,t);if(!n)return{ok:!1,status:0};if(!n.ok)return{ok:!1,status:n.status};try{return{ok:!0,value:await n.json(),status:n.status}}catch{return{ok:!1,status:0}}}function I(){return C?window.location.origin:me}function L(e){try{let t=I(),n=new URL(e,t);return new URL(`${n.pathname}${n.search}${n.hash}`,t).toString()}catch{return e}}function Ie(e){try{let t=new URL(e,I()).pathname.match(/\/s\/([^/]+)/u);return t?.[1]?decodeURIComponent(t[1]):void 0}catch{return}}function R(e){try{return new URL(e,I()).pathname.toLowerCase().startsWith(`/p~`)}catch{return e.toLowerCase().includes(`/p~`)}}function Le(e){try{return decodeURIComponent(e)}catch{return e}}function Re(e){let t=e.trim();return t.length<16?!1:/^[A-Za-z0-9_-]+$/u.test(t)}function ze(e){let t=I();return new URL(`/stream/p/${e}`,t).toString()}function Be(e){let t=I(),n=new URL(`/stream`,t),r=new URLSearchParams;return r.set(`p`,e),n.hash=`#${r.toString()}`,n.toString()}function Ve(e){try{let t=I(),n=new URL(e,t),r=n.pathname.match(/\/stream\/p\/([^/]+)/u);if(!r?.[1])return e;let i=decodeURIComponent(r[1]),a=new URL(`/stream`,t);a.search=n.search;let o=n.hash.startsWith(`#`)?n.hash.slice(1):``,s=new URLSearchParams(o);return s.set(`p`,i),a.hash=`#${s.toString()}`,a.toString()}catch{return e}}function z(e){try{let t=new URL(e,I()),n=t.pathname,r=n.match(/\/stream\/p\/([^/]+)/u);if(r?.[1])return decodeURIComponent(r[1]);let i=n.match(/^\/p~([^/]+)/u);if(i?.[1])return decodeURIComponent(i[1]);let a=t.searchParams.get(`p`);if(a)return a;let o=t.hash.startsWith(`#`)?t.hash.slice(1):``;return new URLSearchParams(o).get(`p`)||void 0}catch{let t=e.toLowerCase().match(/\/p~([^/?#]+)/u);return t?.[1]?Le(t[1]):void 0}}function B(e){let t=L(e);if(R(t)){let e=z(t);return e?L(Be(e)):t}let n=Ve(t);return n===t?t:L(n)}function He(e){if(!C)return B(e);let t=B(e),n=window.location.origin;try{let e=new URL(t,n);return`${n}${e.pathname}${e.search}${e.hash}`}catch{let e=t.match(/^(?:https?:\/\/[^/]+)?(\/.*)$/i);return`${n}${(e?.[1]??t).startsWith(`/`)?e?.[1]??t:`/${e?.[1]??t}`}`}}function Ue(e,t=10){return e?e.length<=t*2+3?e:`${e.slice(0,t)}…${e.slice(-t)}`:`—`}function V(e,t){return(e.pulse??0)===(t.pulse??0)?(e.beat??0)===(t.beat??0)?(e.stepIndex??0)-(t.stepIndex??0):(e.beat??0)-(t.beat??0):(e.pulse??0)-(t.pulse??0)}function We(e){return e.toFixed(6).replace(/0+$/u,``).replace(/\.$/u,``)}function H(){return C?typeof navigator>`u`?!0:navigator.onLine:!1}function Ge(){return C&&typeof window.crypto?.randomUUID==`function`?window.crypto.randomUUID():Math.random().toString(16).slice(2)}function U(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ke(e,t){if(!U(e))return;let n=e[t];return typeof n==`string`&&n.trim()||void 0}async function qe(e){if(!C||!H())return;let t=new AbortController,n=window.setTimeout(()=>t.abort(),pe);try{let n=await fetch(e,{method:`GET`,cache:`force-cache`,signal:t.signal});if(n&&n.ok&&`caches`in window&&typeof caches.open==`function`)try{await(await caches.open(fe)).put(new Request(e),n.clone())}catch{}}catch{}finally{window.clearTimeout(n)}}var W=new Map;function Je(){if(!w)return;let e=localStorage.getItem(A);if(e)try{let t=JSON.parse(e);if(!U(t))return;W.clear();for(let[e,n]of Object.entries(t))(n===1||n===-1)&&W.set(L(e),n)}catch{}}function Ye(){if(!w)return;let e={};for(let[t,n]of W)e[t]=n;try{localStorage.setItem(A,JSON.stringify(e))}catch{}}function Xe(e,t){let n=L(e);return W.get(n)===t?!1:(W.set(n,t),Ye(),!0)}function Ze(e){let t=new URL(_).host,n=new URL(v).host,r=new URL(I()).host,i=new URL(me).host;return e===t||e===n||e===r||e===i}async function Qe(e){if(!C)return`unknown`;let t=B(e),n;try{if(n=new URL(t,I()),!Ze(n.host))return`unknown`;if(n.pathname.toLowerCase()===`/stream`)return`ok`}catch{return`unknown`}try{let e=new AbortController,t=window.setTimeout(()=>e.abort(),de),r=t=>fetch(n.toString(),{method:t,cache:`no-store`,signal:e.signal,redirect:`follow`,mode:`cors`}),i;try{i=await r(`HEAD`)}catch{i=await r(`GET`)}finally{window.clearTimeout(t)}return i.ok?`ok`:`bad`}catch{return`unknown`}}function $e(e){try{let t=new URL(e,I()),n=t.pathname.toLowerCase();if(n.includes(`/s/`))return`postS`;if(n.startsWith(`/p~`))return`streamP`;if(!n.includes(`/stream`))return`other`;if(n.includes(`/stream/p/`))return`streamP`;let r=t.searchParams.get(`t`);if(r&&r.trim())return`streamT`;let i=t.hash.startsWith(`#`)?t.hash.slice(1):``,a=new URLSearchParams(i),o=a.get(`t`);if(o&&o.trim()||n.includes(`/stream/t`))return`streamT`;let s=t.searchParams.get(`p`);if(s&&s.trim())return`streamQ`;let c=a.get(`p`);return c&&c.trim()?`streamQ`:`stream`}catch{let t=e.toLowerCase();return t.includes(`/s/`)?`postS`:t.includes(`/p~`)||t.includes(`/stream/p/`)?`streamP`:t.includes(`/stream/t`)||/[?&#]t=/.test(t)?`streamT`:t.includes(`/stream`)&&/[?&#]p=/.test(t)?`streamQ`:t.includes(`/stream`)?`stream`:`other`}}function et(e){let t=$e(e);return t===`postS`?`post`:t.startsWith(`stream`)?`stream`:`other`}function tt(e){let t=e;return typeof t.userPhiKey==`string`&&t.userPhiKey||typeof t.phiKey==`string`&&t.phiKey||typeof t.phikey==`string`&&t.phikey||``}function nt(e,t){let n=tt(t),r=Number.isFinite(t.pulse??NaN)?t.pulse:null;if(n&&r!=null)return`k:${n}|${r}`;let i=typeof t.kaiSignature==`string`?t.kaiSignature.trim():``;if(i)return`sig:${i}`;let a=z(e);if(a&&a.trim())return`tok:${a.trim()}`;let o=Ie(e)??``;return o?`h:${o}`:`u:${L(e)}`}function rt(e,t){let n=et(e),r=Ie(e)??``;if(n===`post`&&r)return`post:${r}`;let i=tt(t),a=Number.isFinite(t.pulse??NaN)?t.pulse:null;if(n===`stream`&&i&&a!=null)return`stream:${i}|${a}`;let o=typeof t.kaiSignature==`string`?t.kaiSignature.trim():``;if(o)return`${n}:sig:${o}`;let s=z(e);return s&&s.trim()?`${n}:tok:${s.trim()}`:`${n}:u:${L(e)}`}var it=e=>{let t=e.toLowerCase();if(!t.includes(`/stream`))return!1;let n=t.includes(`root=`)||t.includes(`&seg=`)||t.includes(`&add=`),r=t.includes(`/stream#`)||t.includes(`#v=`);return n&&r};function G(e,t){if(R(e))return-1e9;let n=e.toLowerCase(),r=$e(e),i=0;it(n)&&(i-=1e4),t===`post`?r===`postS`?i+=220:i-=25:t===`stream`?r===`streamT`?i+=220:r===`streamP`?i+=190:r===`streamQ`?i+=175:r===`stream`?i+=160:r===`postS`?i+=80:i-=25:(r===`postS`&&(i+=120),r===`streamT`&&(i+=125),r===`streamP`&&(i+=105),(r===`streamQ`||r===`stream`)&&(i+=95));let a=I().toLowerCase();n.startsWith(a)&&(i+=12),n.startsWith(_.toLowerCase())&&(i+=10),n.startsWith(v.toLowerCase())&&(i+=10);let o=W.get(L(e));return o===1&&(i+=200),o===-1&&(i-=200),i+=Math.max(0,20-Math.floor(e.length/40)),i}function at(e,t){let n=e.filter(e=>!R(e)),r=n.length>0?n:e;if(n.length===0&&e.length>0){let t=z(e[0]??``);if(t)return L(Be(t))}let i=r[0]??``,a=-1e9;for(let e of r){let n=G(e,t);(n>a||n===a&&e.length=1e-12)return e}}}function ut(){if(!w)return;let e=Array.from(K.keys());try{localStorage.setItem(te,JSON.stringify(e))}catch{}}function J(e,t){let n=L(e);dt(n,t);let r=K.get(n);if(!r)return K.set(n,t),!0;let i=r.parentUrl??``,a=r.originUrl??``,o=t.parentUrl??``,s=t.originUrl??``,c=i!==o||a!==s,l=Object.keys(r).length,u=Object.keys(t).length!==l,d=V(r,t)!==0;return c||u||d?(K.set(n,t),!0):!1}function dt(e,t){let n=t.feed;if(!n)return;let r=n.usernameClaim,i=r?f(r.payload?.normalized||r.payload?.username||``):``,a=f(n.author??``),o=i||a;if(!o||!r)return;let s=u(r.hash??``),c=r.url?.trim()||e;if(!s||!c)return;let l=r.payload;if(!l||l.kind!==`username_claim`)return;let p=f(l.normalized||l.username||``)||o;if(p!==o)return;let m=r.ownerHint??l.ownerHint??null;d({hash:s,url:L(c),payload:{...l,normalized:p},ownerHint:m})}function ft(e){let t=L(e),r=n(t);return r?J(t,ct(r,st(t))):!1}function pt(e,t){if(e.length===0)return!1;let n=L(e[0]),r=!1;r=ft(n)||r;{let e=K.get(n);if(e){let t={...e};t.originUrl||=n,r=J(n,t)||r}}for(let t=1;t{X=null,Q()},O))}function vt(e,t){let n=L(e),r={url:n,...t};Y.set(n,r),Z(),C&&(X!=null&&window.clearTimeout(X),X=window.setTimeout(()=>{X=null,Q()},O))}function yt(){for(let[e,t]of K){let n=L(e),r=t;Y.set(n,{url:n,...r})}Z()}async function Q(){if(C&&H()&&!mt&&Y.size!==0){mt=!0;try{let e=[],t=[];for(let[n,r]of Y)if(e.push(r),t.push(n),e.length>=se)break;let n=JSON.stringify(e),r=new Blob([n],{type:`application/json`}),i=new FormData;i.append(`file`,r,`sigils_${Ge()}.json`);let a=await Pe(e=>{let t=new URL(xe,e);return t.searchParams.set(`include_state`,`false`),t.searchParams.set(`include_urls`,`false`),t.toString()},{method:`POST`,body:i});if(!a||!a.ok)throw Error(`inhale failed: ${a?.status??0}`);try{await a.json()}catch{}for(let e of t)Y.delete(e);Z(),ht=0,Y.size>0&&(X=window.setTimeout(()=>{X=null,Q()},10))}catch{ht=Math.min(ht?ht*2:ce,le),X=window.setTimeout(()=>{X=null,Q()},ht)}finally{mt=!1}}}function $(e,t){let i=L(e),a=n(i);if(!a)return!1;let o=t?.includeAncestry??!0,s=t?.broadcast??!0,c=t?.persist??!0,l=t?.source??`local`,u=t?.enqueueToApi??l===`local`,d=!1,f=st(i);if(d=J(i,ct(a,f))||d,o&&f.chain.length>0){for(let e of f.chain)d=ft(e)||d;d=pt(f.chain,i)||d}if(o){let e=r(i);for(let t of e){let e=L(t),r=n(e);r&&(d=J(e,ct(r,st(e)))||d)}}if(d&&(c&&ut(),q&&s&&q.postMessage({type:`sigil:add`,url:i}),u)){let e=K.get(i);e&&vt(i,e)}return d}function bt(e){let t=[],n=[],r=e=>{let n=L(e);t.includes(n)||t.push(n)};if(Array.isArray(e)){for(let i of e){if(typeof i==`string`){i.trim()&&r(i.trim());continue}if(U(i)){let e=i.url;if(typeof e==`string`&&e.trim()){let r=L(e.trim());t.includes(r)||t.push(r),n.push({...i,url:r})}}}return{urls:t,rawKrystals:n}}if(U(e)){let i=e.urls;if(Array.isArray(i))for(let e of i)typeof e==`string`&&e.trim()&&r(e.trim());let a=e.url;if(typeof a==`string`&&a.trim()){let r=L(a.trim());t.includes(r)||t.push(r),n.push({...e,url:r})}return{urls:t,rawKrystals:n}}return{urls:t,rawKrystals:n}}function xt(e){for(let t of e){let e=L(t),r=K.get(e)??n(e);r&&vt(e,ct(r,st(e)))}Q()}function St(){if(!w)return!1;let e=e=>{if(!e)return!1;try{let t=JSON.parse(e);if(!Array.isArray(t))return!1;let n=!1;for(let e of t)typeof e==`string`&&$(e,{includeAncestry:!0,broadcast:!1,persist:!1,source:`hydrate`,enqueueToApi:!1})&&(n=!0);return n}catch{return!1}},t=e(localStorage.getItem(te)),n=e(localStorage.getItem(ne));return(t||n)&&ut(),t||n}async function Ct(e){let t=0,n,r;for(let i=0;i{let t=new URL(be,e);return t.searchParams.set(`offset`,String(a)),t.searchParams.set(`limit`,String(D)),t.toString()},{method:`GET`,signal:e,cache:`no-store`});if(!o.ok)break;n=o.value.state_seal,r=o.value.total;let s=o.value.urls;if(!Array.isArray(s)||s.length===0)break;for(let e of s){if(typeof e!=`string`)continue;let n=L(e);K.has(n)||$(n,{includeAncestry:!0,broadcast:!1,persist:!1,source:`remote`,enqueueToApi:!1})&&(t+=1)}if(s.length=r)break}return t>0&&ut(),{imported:t,remoteSeal:n,remoteTotal:r}}function wt(t){let n=new Map,r=new Map;for(let[e,i]of t){let t=L(e),a=et(t),o=rt(t,i),s=nt(t,i);n.set(t,o);let c=r.get(o);if(!c){r.set(o,{payload:i,urls:new Set([t]),kind:a,momentKey:s});continue}V(i,c.payload)>0&&(c.payload=i),c.urls.add(t);let l=c.momentKey,u=s;l.startsWith(`u:`)&&!u.startsWith(`u:`)&&(c.momentKey=u),l.startsWith(`h:`)&&(u.startsWith(`k:`)||u.startsWith(`sig:`)||u.startsWith(`tok:`))&&(c.momentKey=u)}let i=new Map;for(let[e,t]of r){let n=at(Array.from(t.urls),t.kind);i.set(e,{id:e,payload:t.payload,urls:t.urls,primaryUrl:n,kind:t.kind,momentKey:t.momentKey})}let a=new Map;for(let e of i.values()){let t=e.momentKey;a.has(t)||a.set(t,[]),a.get(t).push(e.id)}let o=new Map,s=new Map,c=new Map;for(let[e,t]of a){let n=t.map(e=>i.get(e)).filter(Boolean),r=n.filter(e=>e.kind===`post`),a;a=r.length>0?r.slice().sort((e,t)=>G(t.primaryUrl,`post`)-G(e.primaryUrl,`post`))[0]:n.slice().sort((e,t)=>G(t.primaryUrl,t.kind)-G(e.primaryUrl,e.kind))[0];let l=a?.id??t[0];o.set(e,l);for(let e of t)s.set(e,l);for(let e of t){let t=i.get(e);if(t)for(let e of t.urls)c.set(e,l)}}let l=new Map;for(let t of i.values()){let r=s.get(t.id)??t.id;if(t.id!==r)continue;let i=Ke(t.payload,`originUrl`),a=i?L(i):e(t.primaryUrl)??t.primaryUrl,o=n.get(a),u=c.get(a)??(o?s.get(o):void 0);l.set(r,u??r)}let u=new Map;for(let e of i.values()){let t=s.get(e.id)??e.id,r=l.get(t)??t,i;if(e.id!==t)i=t;else{let t=Ke(e.payload,`parentUrl`);if(t){let r=L(t),a=n.get(r),o=c.get(r)??(a?s.get(a):void 0);o&&o!==e.id&&(i=o)}}u.set(e.id,{id:e.id,payload:e.payload,urls:e.urls,primaryUrl:e.primaryUrl,kind:e.kind,momentKey:e.momentKey,parentId:i,originId:r,momentParentId:t})}return u}function Tt(e,t){let n=[];for(let[r,i]of t)i.parentId===e&&n.push(r);return n.sort((e,n)=>V(t.get(n).payload,t.get(e).payload)),n}function Et(e,t,n=new Set){let r=t.get(e);if(!r)return null;if(n.has(e))return{id:r.id,url:r.primaryUrl,urls:Array.from(r.urls),payload:r.payload,children:[]};n.add(e);let i=Tt(e,t).map(e=>Et(e,t,n)).filter(Boolean);return{id:r.id,url:r.primaryUrl,urls:Array.from(r.urls),payload:r.payload,children:i}}function Dt(e){let t=0,n=e.payload,r=e=>{t+=1,V(e.payload,n)>0&&(n=e.payload),e.children.forEach(r)};return r(e),{nodeCount:t,latest:n}}function Ot(e){let t=wt(e),n=new Map;for(let[e,r]of t){let t=r.originId;n.has(t)||n.set(t,[]),n.get(t).push(e)}let r=[];for(let e of n.keys()){let n=Et(e,t);if(!n)continue;let i=Dt(n);r.push({root:n,nodeCount:i.nodeCount,latest:i.latest})}return r.sort((e,t)=>{let n=V(t.latest,e.latest);return n===0?t.nodeCount===e.nodeCount?V(t.root.payload,e.root.payload):t.nodeCount-e.nodeCount:n}),r.map(e=>e.root)}function kt(e,t){let n=e.payload,r=[],i=new Set,a=lt(e.payload);a!==void 0&&r.push({label:`This glyph Φ`,value:`${We(a)} Φ`});let o=n.feed,s=typeof o?.author==`string`?o.author:typeof n.author==`string`?n.author:void 0,c=o?o.usernameClaim:void 0,l=c?f(c.payload?.normalized||c.payload?.username||``):``,u=f(s??``),d=l||u;if(d){let e=t[d],n=typeof s==`string`&&s.trim().length>0?s.trim():`@${d}`;e?(r.push({label:`Username (claimed)`,value:`${n} → glyph ${Ue(e.claimHash,10)}`}),r.push({label:`Claim glyph`,value:B(e.claimUrl)})):r.push({label:`Username`,value:n})}let p=(e,t)=>{let a=n[e];typeof a==`string`&&a.trim().length>0&&!i.has(e)&&(r.push({label:t,value:a.trim()}),i.add(e))};p(`userPhiKey`,`PhiKey`),p(`phiKey`,`PhiKey`),p(`phikey`,`PhiKey`),p(`kaiSignature`,`Kai Signature`);let m=n.parentUrl;typeof m==`string`&&m.length>0&&(r.push({label:`Parent URL`,value:B(m)}),i.add(`parentUrl`));let h=n.originUrl;typeof h==`string`&&h.length>0&&(r.push({label:`Origin URL`,value:B(h)}),i.add(`originUrl`));let g=n.label??n.title??n.type??n.note??n.description;typeof g==`string`&&g.trim().length>0&&r.push({label:`Label / Type`,value:g.trim()});for(let e of[`memoryUrl`,`memory_url`,`streamUrl`,`stream_url`,`feedUrl`,`feed_url`,`stream`]){let t=n[e];typeof t==`string`&&t.trim().length>0&&!i.has(e)&&(r.push({label:e,value:B(t.trim())}),i.add(e))}for(let[e,t]of Object.entries(n)){if(r.length>=12)break;if(i.has(e)||t==null)continue;let n=e.toLowerCase();if(!(n.includes(`stream`)||n.includes(`memory`)||n.includes(`feed`))||typeof t==`string`&&t.trim().length===0)continue;let a=typeof t==`string`?B(t.trim()):JSON.stringify(t);r.push({label:e,value:a})}r.push({label:`Primary URL`,value:B(e.url)});let _=e.urls.filter(e=>!R(e)).map(e=>B(e));return e.urls.length>1&&r.push({label:`URL variants`,value:_.length===0?`${e.urls.length} urls (kept in data; hidden from browser view)`:_.length<=3?_.join(` | `):`${e.urls.length} urls (kept in data; rendered once)`}),r}async function At(e){if(C){try{if(navigator.clipboard&&typeof navigator.clipboard.writeText==`function`){await navigator.clipboard.writeText(e);return}}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,`true`),t.style.position=`fixed`,t.style.left=`-9999px`,t.style.top=`-9999px`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t)}catch{}}}var jt=()=>(0,g.jsx)(`style`,{children:` /* glyph mark */ .kx-glyph{ display:flex; diff --git a/dist/assets/SigilFeedPage-BH0djxz4.js b/dist/assets/SigilFeedPage-C5nsUmbd.js similarity index 93% rename from dist/assets/SigilFeedPage-BH0djxz4.js rename to dist/assets/SigilFeedPage-C5nsUmbd.js index 92309524..5383daf9 100644 --- a/dist/assets/SigilFeedPage-BH0djxz4.js +++ b/dist/assets/SigilFeedPage-C5nsUmbd.js @@ -1 +1 @@ -import{Tn as e,jn as t,mn as n,tn as r}from"./index-CgC-NZbJ.js";import"./html2canvas-DKfOm221.js";import"./EternalKlock-BauRu4tr.js";import"./SigilModal-BVYbqxt6.js";import"./SealMomentModal-Bn7w_Hvo.js";import"./SigilAuthContext-CmP6HWSa.js";import"./sigilRegistry-D8l_pIbq.js";import"./SigilAuthProvider-EaP0VeI7.js";import"./usernameClaimRegistry-DYzaEFWn.js";import{t as i}from"./SigilStreamRoot-DhYXsfvl.js";import"./useFastPress-CiepkEei.js";e();var a=null,o=0n;function s(){if(typeof window>`u`)return null;let e=window;return e.AudioContext??e.webkitAudioContext??null}function c(){let e=s();return e?a||(a=new e,a):null}function l(){let e=c();e&&e.state!==`running`&&e.resume().catch(()=>{})}function u(){typeof navigator<`u`&&`vibrate`in navigator&&navigator.vibrate([8,13,21,34,55,89,55,34,21,13,8])}function d(e,t,n){let r=e.sampleRate,i=Math.max(1,Math.floor(r*t)),a=e.createBuffer(2,i,r);for(let e=0;e<2;e++){let t=a.getChannelData(e);for(let e=0;e{u(),y()},0))}function x(e){if(!e||!(e instanceof Element))return!1;let t=e.closest(`button.sf-btn, a.sf-btn`);return t?(t.textContent??``).trim().toLowerCase()===`remember`:!1}function S(){let e=()=>{l(),document.removeEventListener(`pointerdown`,e,!0),document.removeEventListener(`keydown`,e,!0),document.removeEventListener(`touchstart`,e,!0)};document.addEventListener(`pointerdown`,e,{capture:!0,passive:!0}),document.addEventListener(`keydown`,e,{capture:!0}),document.addEventListener(`touchstart`,e,{capture:!0,passive:!0})}function C(){typeof document>`u`||(S(),document.addEventListener(`click`,e=>{x(e.target)&&b()}))}typeof window<`u`&&(window.__kopy_feedback_installed__||(window.__kopy_feedback_installed__=!0,C()));var w=t(r(),1);function T(){return(0,w.jsx)(i,{})}export{T as default}; \ No newline at end of file +import{Tn as e,jn as t,mn as n,tn as r}from"./index-BlYU7j-M.js";import"./html2canvas-D-AxDBo3.js";import"./EternalKlock-CdflKbWu.js";import"./SigilModal-Dm4zpSIO.js";import"./SealMomentModal-C7mxkSGB.js";import"./SigilAuthContext-CIPXJp4C.js";import"./sigilRegistry-dB0OrrJi.js";import"./SigilAuthProvider-ea2w3ibF.js";import"./usernameClaimRegistry-B6UXZAUR.js";import{t as i}from"./SigilStreamRoot-LmEGlu4-.js";import"./useFastPress-MOMn9nZb.js";e();var a=null,o=0n;function s(){if(typeof window>`u`)return null;let e=window;return e.AudioContext??e.webkitAudioContext??null}function c(){let e=s();return e?a||(a=new e,a):null}function l(){let e=c();e&&e.state!==`running`&&e.resume().catch(()=>{})}function u(){typeof navigator<`u`&&`vibrate`in navigator&&navigator.vibrate([8,13,21,34,55,89,55,34,21,13,8])}function d(e,t,n){let r=e.sampleRate,i=Math.max(1,Math.floor(r*t)),a=e.createBuffer(2,i,r);for(let e=0;e<2;e++){let t=a.getChannelData(e);for(let e=0;e{u(),y()},0))}function x(e){if(!e||!(e instanceof Element))return!1;let t=e.closest(`button.sf-btn, a.sf-btn`);return t?(t.textContent??``).trim().toLowerCase()===`remember`:!1}function S(){let e=()=>{l(),document.removeEventListener(`pointerdown`,e,!0),document.removeEventListener(`keydown`,e,!0),document.removeEventListener(`touchstart`,e,!0)};document.addEventListener(`pointerdown`,e,{capture:!0,passive:!0}),document.addEventListener(`keydown`,e,{capture:!0}),document.addEventListener(`touchstart`,e,{capture:!0,passive:!0})}function C(){typeof document>`u`||(S(),document.addEventListener(`click`,e=>{x(e.target)&&b()}))}typeof window<`u`&&(window.__kopy_feedback_installed__||(window.__kopy_feedback_installed__=!0,C()));var w=t(r(),1);function T(){return(0,w.jsx)(i,{})}export{T as default}; \ No newline at end of file diff --git a/dist/assets/SigilModal-CEATeZhW.js b/dist/assets/SigilModal-CEATeZhW.js deleted file mode 100644 index 8fae2d8d..00000000 --- a/dist/assets/SigilModal-CEATeZhW.js +++ /dev/null @@ -1 +0,0 @@ -import"./html2canvas-DKfOm221.js";import{t as e}from"./SigilModal-BVYbqxt6.js";import"./SealMomentModal-Bn7w_Hvo.js";export{e as default}; \ No newline at end of file diff --git a/dist/assets/SigilModal-DLOp9UnU.js b/dist/assets/SigilModal-DLOp9UnU.js new file mode 100644 index 00000000..ef8fa215 --- /dev/null +++ b/dist/assets/SigilModal-DLOp9UnU.js @@ -0,0 +1 @@ +import"./html2canvas-D-AxDBo3.js";import{t as e}from"./SigilModal-Dm4zpSIO.js";import"./SealMomentModal-C7mxkSGB.js";export{e as default}; \ No newline at end of file diff --git a/dist/assets/SigilModal-BVYbqxt6.js b/dist/assets/SigilModal-Dm4zpSIO.js similarity index 99% rename from dist/assets/SigilModal-BVYbqxt6.js rename to dist/assets/SigilModal-Dm4zpSIO.js index 25a12cc2..04aba71b 100644 --- a/dist/assets/SigilModal-BVYbqxt6.js +++ b/dist/assets/SigilModal-Dm4zpSIO.js @@ -1,4 +1,4 @@ -import{J as e,Tn as t,_t as n,an as r,jn as i,ln as a,mn as o,tn as s,w as c,wn as l}from"./index-CgC-NZbJ.js";import{t as u}from"./html2canvas-DKfOm221.js";import{t as d}from"./SealMomentModal-Bn7w_Hvo.js";var f=i(t(),1),p=i(s(),1),m=e=>Math.max(0,Math.min(100,e));function h(e,t){let n=(e??``).toLowerCase().trim();return/(reflekt|reflect|reflektion|reflection)/i.test(n)?`#22c55e`:/(purify|purification|purifikation)/i.test(n)?`#3b82f6`:/dream/i.test(n)?`#7c3aed`:/(ignite|ignition)/i.test(n)?`#ff3b30`:/(integrate|integration)/i.test(n)?`#ff8a00`:/(solar\s*plexus)/i.test(n)?`#ffd600`:t}var g=({dateISO:e,onDateChange:t,secondsLeft:n,eternalPercent:r,eternalColor:i=`#8beaff`,eternalArkLabel:a=`Eternal Ark`})=>{let o=(0,f.useMemo)(()=>m(r),[r]),s=(0,f.useMemo)(()=>h(a,i),[a,i]),c={"--eternal-bar":s,"--pulse":`var(--kai-pulse, var(--pulse-dur, 5236ms))`},l=(0,f.useMemo)(()=>({"--fill":(o/100).toFixed(6)}),[o]),u=(0,f.useRef)(null),d=(0,f.useRef)(void 0),g=(0,f.useRef)(null),_=(0,f.useRef)(null);return(0,f.useEffect)(()=>()=>{g.current!==null&&window.clearTimeout(g.current),_.current!==null&&window.cancelAnimationFrame(_.current),u.current&&u.current.classList.remove(`is-boom`),g.current=null,_.current=null},[]),(0,f.useEffect)(()=>{let e=typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(typeof n!=`number`||e){d.current=n;return}let t=u.current,r=d.current;t&&typeof r==`number`&&n-r>1.2&&(t.classList.remove(`is-boom`),_.current!==null&&window.cancelAnimationFrame(_.current),_.current=window.requestAnimationFrame(()=>{t.classList.add(`is-boom`)}),g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{t.classList.remove(`is-boom`),g.current=null},420)),d.current=n},[n]),(0,p.jsxs)(`div`,{className:`sigil-scope`,style:c,children:[(0,p.jsx)(`h3`,{className:`sigil-title`,children:`Kairos Sigil-Glyph Inhaler`}),(0,p.jsx)(`div`,{className:`sigil-ribbon`,"aria-hidden":`true`}),(0,p.jsx)(`div`,{className:`input-row sigil-row`,children:(0,p.jsxs)(`label`,{className:`sigil-label`,children:[(0,p.jsx)(`span`,{className:`sigil-label__text`,children:`Select moment:`}),`\xA0`,(0,p.jsx)(`input`,{className:`sigil-input`,type:`datetime-local`,value:e,onChange:t})]})}),(0,p.jsx)(`div`,{className:`sigil-bars`,role:`group`,"aria-label":`Day progress`,children:(0,p.jsxs)(`div`,{className:`sigil-bar`,children:[(0,p.jsxs)(`div`,{className:`sigil-bar__head`,children:[(0,p.jsxs)(`span`,{className:`sigil-bar__label`,children:[`Unfoldment`,a?` — ${a}`:``]}),(0,p.jsxs)(`span`,{className:`sigil-bar__pct`,"aria-hidden":`true`,children:[o.toFixed(2),`%`]})]}),(0,p.jsx)(`div`,{className:`sigil-bar__track`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":+o.toFixed(2),role:`progressbar`,"aria-label":`Eternal day ${a||``}`,children:(0,p.jsx)(`div`,{ref:u,className:`sigil-bar__fill sigil-bar__fill--eternal`,style:l})})]})}),(0,p.jsx)(`style`,{children:` +import{J as e,Tn as t,_t as n,an as r,jn as i,ln as a,mn as o,tn as s,w as c,wn as l}from"./index-BlYU7j-M.js";import{t as u}from"./html2canvas-D-AxDBo3.js";import{t as d}from"./SealMomentModal-C7mxkSGB.js";var f=i(t(),1),p=i(s(),1),m=e=>Math.max(0,Math.min(100,e));function h(e,t){let n=(e??``).toLowerCase().trim();return/(reflekt|reflect|reflektion|reflection)/i.test(n)?`#22c55e`:/(purify|purification|purifikation)/i.test(n)?`#3b82f6`:/dream/i.test(n)?`#7c3aed`:/(ignite|ignition)/i.test(n)?`#ff3b30`:/(integrate|integration)/i.test(n)?`#ff8a00`:/(solar\s*plexus)/i.test(n)?`#ffd600`:t}var g=({dateISO:e,onDateChange:t,secondsLeft:n,eternalPercent:r,eternalColor:i=`#8beaff`,eternalArkLabel:a=`Eternal Ark`})=>{let o=(0,f.useMemo)(()=>m(r),[r]),s=(0,f.useMemo)(()=>h(a,i),[a,i]),c={"--eternal-bar":s,"--pulse":`var(--kai-pulse, var(--pulse-dur, 5236ms))`},l=(0,f.useMemo)(()=>({"--fill":(o/100).toFixed(6)}),[o]),u=(0,f.useRef)(null),d=(0,f.useRef)(void 0),g=(0,f.useRef)(null),_=(0,f.useRef)(null);return(0,f.useEffect)(()=>()=>{g.current!==null&&window.clearTimeout(g.current),_.current!==null&&window.cancelAnimationFrame(_.current),u.current&&u.current.classList.remove(`is-boom`),g.current=null,_.current=null},[]),(0,f.useEffect)(()=>{let e=typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(typeof n!=`number`||e){d.current=n;return}let t=u.current,r=d.current;t&&typeof r==`number`&&n-r>1.2&&(t.classList.remove(`is-boom`),_.current!==null&&window.cancelAnimationFrame(_.current),_.current=window.requestAnimationFrame(()=>{t.classList.add(`is-boom`)}),g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{t.classList.remove(`is-boom`),g.current=null},420)),d.current=n},[n]),(0,p.jsxs)(`div`,{className:`sigil-scope`,style:c,children:[(0,p.jsx)(`h3`,{className:`sigil-title`,children:`Kairos Sigil-Glyph Inhaler`}),(0,p.jsx)(`div`,{className:`sigil-ribbon`,"aria-hidden":`true`}),(0,p.jsx)(`div`,{className:`input-row sigil-row`,children:(0,p.jsxs)(`label`,{className:`sigil-label`,children:[(0,p.jsx)(`span`,{className:`sigil-label__text`,children:`Select moment:`}),`\xA0`,(0,p.jsx)(`input`,{className:`sigil-input`,type:`datetime-local`,value:e,onChange:t})]})}),(0,p.jsx)(`div`,{className:`sigil-bars`,role:`group`,"aria-label":`Day progress`,children:(0,p.jsxs)(`div`,{className:`sigil-bar`,children:[(0,p.jsxs)(`div`,{className:`sigil-bar__head`,children:[(0,p.jsxs)(`span`,{className:`sigil-bar__label`,children:[`Unfoldment`,a?` — ${a}`:``]}),(0,p.jsxs)(`span`,{className:`sigil-bar__pct`,"aria-hidden":`true`,children:[o.toFixed(2),`%`]})]}),(0,p.jsx)(`div`,{className:`sigil-bar__track`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":+o.toFixed(2),role:`progressbar`,"aria-label":`Eternal day ${a||``}`,children:(0,p.jsx)(`div`,{ref:u,className:`sigil-bar__fill sigil-bar__fill--eternal`,style:l})})]})}),(0,p.jsx)(`style`,{children:` .sigil-ribbon { height: 1px; margin: .35rem 0 .85rem 0; diff --git a/dist/assets/SigilPage-BGrlrrbK.js b/dist/assets/SigilPage-CGk_cWZs.js similarity index 99% rename from dist/assets/SigilPage-BGrlrrbK.js rename to dist/assets/SigilPage-CGk_cWZs.js index e8a21df5..c77c3d8c 100644 --- a/dist/assets/SigilPage-BGrlrrbK.js +++ b/dist/assets/SigilPage-CGk_cWZs.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/html2canvas-DNGmdnmT.js","assets/html2canvas-DKfOm221.js","assets/index-CgC-NZbJ.js","assets/index-BmaJNTKf.css","assets/svgMeta-C7DBvyS6.js","assets/svgMeta-iEfjcdB7.js"])))=>i.map(i=>d[i]); -import{An as e,At as t,B as n,Cn as r,Dt as i,En as a,Et as o,J as s,Mt as c,Nt as l,On as u,Ot as d,Pt as f,S as p,Sn as m,St as h,Tn as g,Tt as _,V as v,_ as y,_t as b,an as x,b as S,bn as C,bt as w,d as T,f as E,h as D,i as O,jn as k,jt as A,kt as j,m as M,mn as N,n as P,o as F,q as I,r as ee,s as L,tn as R,un as te,vn as z,w as ne,wn as re,wt as B,xn as ie,xt as ae,yn as oe,yt as se}from"./index-CgC-NZbJ.js";import{t as ce}from"./html2canvas-DKfOm221.js";import{t as V}from"./SealMomentModal-Bn7w_Hvo.js";import{t as le}from"./useFastPress-CiepkEei.js";import{a as H,d as ue,f as U,i as de,n as W,p as fe,r as G,s as pe,t as me,u as he}from"./svgMeta-iEfjcdB7.js";var ge=k(ce(),1),_e=k(re(),1),K=k(g(),1),q=k(R(),1);function ve(e){(0,K.useEffect)(()=>{let e=`sigilheader-authbadgefx-v3`;if(document.getElementById(e))return;let t=document.createElement(`style`);t.id=e,t.textContent=` +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/html2canvas-B1Qzm3Gx.js","assets/html2canvas-D-AxDBo3.js","assets/index-BlYU7j-M.js","assets/index-BmaJNTKf.css","assets/svgMeta-BZGc61ho.js","assets/svgMeta-Bpz7076A.js"])))=>i.map(i=>d[i]); +import{An as e,At as t,B as n,Cn as r,Dt as i,En as a,Et as o,J as s,Mt as c,Nt as l,On as u,Ot as d,Pt as f,S as p,Sn as m,St as h,Tn as g,Tt as _,V as v,_ as y,_t as b,an as x,b as S,bn as C,bt as w,d as T,f as E,h as D,i as O,jn as k,jt as A,kt as j,m as M,mn as N,n as P,o as F,q as I,r as ee,s as L,tn as R,un as te,vn as z,w as ne,wn as re,wt as B,xn as ie,xt as ae,yn as oe,yt as se}from"./index-BlYU7j-M.js";import{t as ce}from"./html2canvas-D-AxDBo3.js";import{t as V}from"./SealMomentModal-C7mxkSGB.js";import{t as le}from"./useFastPress-MOMn9nZb.js";import{a as H,d as ue,f as U,i as de,n as W,p as fe,r as G,s as pe,t as me,u as he}from"./svgMeta-Bpz7076A.js";var ge=k(ce(),1),_e=k(re(),1),K=k(g(),1),q=k(R(),1);function ve(e){(0,K.useEffect)(()=>{let e=`sigilheader-authbadgefx-v3`;if(document.getElementById(e))return;let t=document.createElement(`style`);t.id=e,t.textContent=` /* Shared tokens; Chakra accent flows from page */ .sp-header .auth-badge, .sp-header .link-badge { @@ -4724,7 +4724,7 @@ Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.expo The chosen QR Code version cannot contain this amount of data. Minimum version required to store current data is: `+c+`. `);let l=b(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),Yw=a((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||={};let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e=c&&n>=c&&e{var t=Yw();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o===void 0&&(!i||!i.getContext)&&(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i===void 0&&(!n||!n.getContext)&&(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),Zw=a((e=>{var t=Yw();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1`:``,d=``,f=`viewBox="0 0 `+l+` `+l+`"`,p=``+u+d+` -`;return typeof a==`function`&&a(null,p),p}})),Qw=k(a((e=>{var t=Tw(),n=Jw(),r=Xw(),i=Zw();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))(),1);const $w=1024,eT=2048,tT=1200;function nT(e,t){let n=e.querySelector(`defs`);n||(n=e.ownerDocument.createElementNS(me.SVG_NS,`defs`),e.insertBefore(n,e.firstChild));let r=`ep-neon-glow`;if(!e.querySelector(`#${r}`)){let t=e.ownerDocument.createElementNS(me.SVG_NS,`filter`);t.setAttribute(`id`,r),t.setAttribute(`x`,`-50%`),t.setAttribute(`y`,`-50%`),t.setAttribute(`width`,`200%`),t.setAttribute(`height`,`200%`);let i=e.ownerDocument.createElementNS(me.SVG_NS,`feGaussianBlur`);i.setAttribute(`stdDeviation`,`3`),i.setAttribute(`result`,`b1`);let a=e.ownerDocument.createElementNS(me.SVG_NS,`feGaussianBlur`);a.setAttribute(`in`,`SourceGraphic`),a.setAttribute(`stdDeviation`,`1.2`),a.setAttribute(`result`,`b2`);let o=e.ownerDocument.createElementNS(me.SVG_NS,`feMerge`),s=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);s.setAttribute(`in`,`b1`);let c=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);c.setAttribute(`in`,`b2`);let l=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);l.setAttribute(`in`,`SourceGraphic`),o.appendChild(s),o.appendChild(c),o.appendChild(l),t.appendChild(i),t.appendChild(a),t.appendChild(o),n.appendChild(t)}let i=`ep-gloss-gradient`;if(!e.querySelector(`#${i}`)){let t=e.ownerDocument.createElementNS(me.SVG_NS,`linearGradient`);t.setAttribute(`id`,i),t.setAttribute(`x1`,`0`),t.setAttribute(`y1`,`0`),t.setAttribute(`x2`,`0`),t.setAttribute(`y2`,`1`);let r=e.ownerDocument.createElementNS(me.SVG_NS,`stop`);r.setAttribute(`offset`,`0%`),r.setAttribute(`stop-color`,`rgba(255,255,255,0.15)`);let a=e.ownerDocument.createElementNS(me.SVG_NS,`stop`);a.setAttribute(`offset`,`100%`),a.setAttribute(`stop-color`,`rgba(255,255,255,0.05)`),t.appendChild(r),t.appendChild(a),n.appendChild(t)}let a=`ep-bar-outer-glow`;if(!e.querySelector(`#${a}`)){let r=e.ownerDocument.createElementNS(me.SVG_NS,`filter`);r.setAttribute(`id`,a),r.setAttribute(`x`,`-50%`),r.setAttribute(`y`,`-50%`),r.setAttribute(`width`,`200%`),r.setAttribute(`height`,`200%`);let i=e.ownerDocument.createElementNS(me.SVG_NS,`feFlood`);i.setAttribute(`flood-color`,t),i.setAttribute(`flood-opacity`,`0.5`),i.setAttribute(`result`,`c`);let o=e.ownerDocument.createElementNS(me.SVG_NS,`feComposite`);o.setAttribute(`in`,`c`),o.setAttribute(`in2`,`SourceAlpha`),o.setAttribute(`operator`,`in`),o.setAttribute(`result`,`glow`);let s=e.ownerDocument.createElementNS(me.SVG_NS,`feGaussianBlur`);s.setAttribute(`in`,`glow`),s.setAttribute(`stdDeviation`,`4`),s.setAttribute(`result`,`blurGlow`);let c=e.ownerDocument.createElementNS(me.SVG_NS,`feMerge`),l=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);l.setAttribute(`in`,`blurGlow`);let u=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);u.setAttribute(`in`,`SourceGraphic`),c.appendChild(l),c.appendChild(u),r.appendChild(i),r.appendChild(o),r.appendChild(s),r.appendChild(c),n.appendChild(r)}return{neonId:`ep-neon-glow`,glossId:`ep-gloss-gradient`,barGlowId:`ep-bar-outer-glow`}}async function rT(e,t){let{accent:n,qrUrl:r}=t,i=(e.getAttribute(`viewBox`)||`0 0 ${e.getAttribute(`width`)||1024} ${e.getAttribute(`height`)||1024}`).trim().split(/\s+/).map(Number),a=i[0]||0,o=i[1]||0,s=i[2]||1024,c=i[3]||1024,l=e.ownerDocument.createElementNS(me.SVG_NS,`g`);l.setAttribute(`data-export-qr`,`1`);let u=Math.min(s,c),d=Math.max(u*.035,18),f=Math.max(u*.1,96),p=await Qw.toDataURL(r,{margin:0,color:{dark:n,light:`#00000000`},scale:8}),m=e.ownerDocument.createElementNS(me.SVG_NS,`image`);m.setAttributeNS(me.XLINK_NS,`xlink:href`,p),m.setAttribute(`href`,p),m.setAttribute(`x`,String(a+d)),m.setAttribute(`y`,String(o+c-f-d)),m.setAttribute(`width`,String(f)),m.setAttribute(`height`,String(f)),m.setAttribute(`preserveAspectRatio`,`xMidYMid meet`),l.appendChild(m),e.appendChild(l)}async function iT(e,t=$w,n){let r=e.cloneNode(!0);if(de(r,t),H(r),G(r,n?.title||`Kairos Sigil-Glyph — Sealed Kairos Moment`,n?.desc||`Deterministic sigil-glyph with sovereign metadata.`),n?.metaOverride){let e=W(r);e.textContent=JSON.stringify(n.metaOverride)}if(r.querySelectorAll(`[data-export-qr="1"],[data-export-pulsebar="1"]`).forEach(e=>e.parentNode?.removeChild(e)),n?.addQR&&await rT(r,n.addQR),n?.addPulseBar){let{accent:e,pulseNumber:i}=n.addPulseBar,{barGlowId:a,neonId:o,glossId:s}=nT(r,e),c=(r.getAttribute(`viewBox`)||`0 0 ${t} ${t}`).split(/\s+/).map(Number),[l,u,d,f]=[c[0]||0,c[1]||0,c[2]||t,c[3]||t],p=r.ownerDocument.createElementNS(me.SVG_NS,`g`);p.setAttribute(`data-export-pulsebar`,`1`);let m=Math.min(d,f),h=Math.max(m*.035,18),g=Math.max(m*.34,320),_=Math.max(m*.085,96),v=Math.max(_*.22,18),y=l+d-g-h,b=u+f-_-h,x=r.ownerDocument.createElementNS(me.SVG_NS,`rect`);x.setAttribute(`x`,String(y)),x.setAttribute(`y`,String(b)),x.setAttribute(`rx`,String(v)),x.setAttribute(`ry`,String(v)),x.setAttribute(`width`,String(g)),x.setAttribute(`height`,String(_)),x.setAttribute(`fill`,`url(#${s})`),x.setAttribute(`stroke`,`rgba(255,255,255,0.16)`),x.setAttribute(`stroke-width`,String(Math.max(1.5,m*.0018))),x.setAttribute(`filter`,`url(#${a})`),p.appendChild(x);let S=r.ownerDocument.createElementNS(me.SVG_NS,`text`);S.setAttribute(`x`,String(y+g/2)),S.setAttribute(`y`,String(b+_/2+Math.max(6,_*.06))),S.setAttribute(`text-anchor`,`middle`),S.setAttribute(`dominant-baseline`,`middle`),S.setAttribute(`fill`,e),S.setAttribute(`filter`,`url(#${o})`),S.setAttribute(`font-weight`,`900`),S.setAttribute(`font-family`,`Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto, Helvetica Neue, Arial`),S.setAttribute(`font-size`,String(Math.floor(_*.46))),S.textContent=i.toLocaleString(),p.appendChild(S),r.appendChild(p)}let i=new XMLSerializer().serializeToString(r),a=i.startsWith(`\n${i}`;return new Blob([a],{type:`image/svg+xml;charset=utf-8`})}async function aT(e,t=$w){let n=URL.createObjectURL(e);try{let e=new Image;await new Promise((t,r)=>{e.onload=()=>t(),e.onerror=r,e.src=n});let r=document.createElement(`canvas`);r.width=t,r.height=t;let i=r.getContext(`2d`);if(!i)throw Error(`Canvas unsupported`);return i.drawImage(e,0,0,t,t),await new Promise((e,t)=>r.toBlob(n=>n?e(n):t(Error(`PNG encode failed`)),`image/png`))}finally{URL.revokeObjectURL(n)}}var oT=()=>{let e=N();return e<=0n?0:e>BigInt(2**53-1)?2**53-1:Number(e)};const sT=`sigil-debits-v1`,cT=(e,t)=>t?`sigil:debits:${e}:t:${t}`:`sigil:debits:${e}`,lT=(e,t)=>e===cT(t)||e.startsWith(`${cT(t)}:t:`),uT=(e,t)=>{let n=`sigil:debits:${t}`;if(e===n)return null;let r=`${n}:t:`;return e.startsWith(r)?e.slice(r.length):void 0};function dT(e){let t=new TextEncoder().encode(e),n=``;for(let e=0;e0&&typeof t.recipientPhiKey==`string`&&t.recipientPhiKey.length>0&&typeof t.amount==`number`&&Number.isFinite(t.amount)&&t.amount>0&&typeof t.timestamp==`number`&&Number.isFinite(t.timestamp)}function hT(e){if(!e)return null;try{let t=JSON.parse(fT(e));if(typeof t!=`object`||!t)return null;let n={},r=t;if(typeof r.originalAmount==`number`&&Number.isFinite(r.originalAmount)&&(n.originalAmount=r.originalAmount),Array.isArray(r.debits)){let e=[];for(let t of r.debits)mT(t)&&e.push(t);e.length&&(n.debits=e)}return n}catch{return null}}function gT(e,t){try{let n=new URL(window.location.href),r=typeof e.originalAmount==`number`&&Number.isFinite(e.originalAmount),i=Array.isArray(e.debits)&&e.debits.length>0;!r&&!i?n.searchParams.delete(`d`):n.searchParams.set(`d`,pT(e));let a=`${n.pathname}${n.search}${n.hash}`;t?.navigate?window.location.replace(a):window.history.replaceState(null,``,a)}catch{}}function _T(e,t){let n=(e||``).toLowerCase();if(!n)return null;try{let e=t?localStorage.getItem(cT(n,t)):null;if(e)return hT(e);let r=localStorage.getItem(cT(n));return r?hT(r):null}catch{return null}}function vT(e,t,n){let r=(e||``).toLowerCase();if(r)try{localStorage.setItem(cT(r,n??null),pT(t))}catch{}}function yT(e){let t=new Set,n=[];for(let r of e)!r||typeof r.nonce!=`string`||t.has(r.nonce)||(t.add(r.nonce),n.push(r));return n.sort((e,t)=>(e.timestamp||0)-(t.timestamp||0))}function bT(e,t){let n={},r=typeof e?.originalAmount==`number`?e.originalAmount:void 0,i=typeof t?.originalAmount==`number`?t.originalAmount:void 0;n.originalAmount=typeof r==`number`?r:typeof i==`number`?i:void 0;let a=Array.isArray(e?.debits)?e.debits:[],o=Array.isArray(t?.debits)?t.debits:[],s=yT([...a,...o]);return s.length&&(n.debits=s),n}function xT(e,t){let n=typeof e?.originalAmount==`number`&&Number.isFinite(e.originalAmount)?Number(e.originalAmount):NaN,r=typeof t?.originalAmount==`number`&&Number.isFinite(t.originalAmount)?Number(t.originalAmount):NaN,i=Number.isNaN(n)&&Number.isNaN(r)||Math.abs(n-r)<1e-12,a=new Set((Array.isArray(e?.debits)?e.debits:[]).map(e=>e?.nonce)),o=new Set((Array.isArray(t?.debits)?t.debits:[]).map(e=>e?.nonce));if(!i||a.size!==o.size)return!1;for(let e of a)if(!o.has(e))return!1;return!0}function ST(e,t,n,r){gT(e,{navigate:!!r?.navigate});let i=(t||``).toLowerCase();if(i&&(vT(i,e,n??null),r?.broadcast!==!1))try{let t=new BroadcastChannel(sT),r={type:`debits`,canonical:i,qs:pT(e),stamp:oT(),token:n??null};t.postMessage(r),t.close()}catch{}}function CT(e,t,n){let r=hT(t.get(`d`)),i=bT(n?_T(e,n):_T(e,null),r);return{merged:i,urlIsStale:!xT(i,r)}}function wT(e){try{let t=new URL(e,window.location.origin).pathname.match(/\/s\/([0-9a-fA-F]+)/);return t?t[1].toLowerCase():null}catch{return null}}function TT(e){if(typeof e==`string`)switch(e.trim().toLowerCase().replace(/\s+/g,` `)){case`root`:return`Root`;case`sacral`:return`Sacral`;case`solar plexus`:case`solarplexus`:return`Solar Plexus`;case`heart`:return`Heart`;case`throat`:return`Throat`;case`third eye`:case`thirdeye`:return`Third Eye`;case`crown`:return`Crown`;default:return}}function ET(e){return e===`breaths`||e===`steps`?e:void 0}var DT=e=>!!e&&typeof e==`object`,OT=e=>{if(!DT(e))return!1;let t=`u`in e&&`b`in e,n=`d`in e;return t||n},kT=e=>typeof e==`number`&&Number.isFinite(e)?e:void 0,AT=e=>typeof e==`string`&&e.trim()?e:void 0;function jT(e){if(!e)return{};try{let t=String(e).trim(),n=!1;/^c:/i.test(t)&&(t=t.slice(2),n=!0);let r=JSON.parse(fT(t));if(n||OT(r)){let e=r,t={},n=kT(e.u),i=kT(e.b),a=kT(e.d),o=kT(e.s),s=TT(e.c);return n!==void 0&&(t.pulse=n),i!==void 0&&(t.beat=i),a!==void 0&&(t.stepsPerBeat=a),o!==void 0&&(t.stepIndex=o),s!==void 0&&(t.chakraDay=s),t}if(DT(r)){let e=r,t={},n=kT(e.pulse),i=kT(e.beat),a=kT(e.stepsPerBeat),o=kT(e.stepIndex),s=TT(e.chakraDay),c=AT(e.canonicalHash),l=AT(e.kaiSignature),u=AT(e.userPhiKey),d=AT(e.transferNonce),f=kT(e.expiresAtPulse),p=ET(e.claimExtendUnit),m=kT(e.claimExtendAmount);return n!==void 0&&(t.pulse=n),i!==void 0&&(t.beat=i),a!==void 0&&(t.stepsPerBeat=a),o!==void 0&&(t.stepIndex=o),s!==void 0&&(t.chakraDay=s),c!==void 0&&(t.canonicalHash=c.toLowerCase()),l!==void 0&&(t.kaiSignature=l),u!==void 0&&(t.userPhiKey=u),d!==void 0&&(t.transferNonce=d),f!==void 0&&(t.expiresAtPulse=f),p!==void 0&&(t.claimExtendUnit=p),m!==void 0&&(t.claimExtendAmount=m),Array.isArray(e.lineage)&&(t.lineage=e.lineage),t}return{}}catch{return{}}}function MT(e,t){let n={...e};typeof t.expiresAtPulse==`number`&&(n.expiresAtPulse=t.expiresAtPulse),t.claimExtendUnit!=null&&(n.claimExtendUnit=t.claimExtendUnit),typeof t.claimExtendAmount==`number`&&(n.claimExtendAmount=t.claimExtendAmount),typeof t.pulse==`number`&&(n.pulse=t.pulse),typeof t.beat==`number`&&(n.beat=t.beat),typeof t.stepsPerBeat==`number`&&(n.stepsPerBeat=t.stepsPerBeat),t.chakraDay!==void 0&&(n.chakraDay=t.chakraDay),t.canonicalHash&&(n.canonicalHash=String(t.canonicalHash).toLowerCase()),t.kaiSignature&&(n.kaiSignature=t.kaiSignature),t.userPhiKey&&(n.userPhiKey=t.userPhiKey),t.transferNonce&&(n.transferNonce=t.transferNonce),Array.isArray(t.lineage)&&(n.lineage=t.lineage);let r=typeof n.stepsPerBeat==`number`&&Number.isFinite(n.stepsPerBeat)?n.stepsPerBeat:44,i=kT(t?.stepIndex),a=kT(n.stepIndex);return i===void 0?a===void 0?typeof n.pulse==`number`&&Number.isFinite(n.pulse)&&(n.stepIndex=p(n.pulse,r)):n.stepIndex=a:n.stepIndex=i,n}function NT(e,t){try{let n=new URL(e,window.location.origin),r=MT(jT(n.searchParams.get(`p`)),t);return r.canonicalHash&&=String(r.canonicalHash).toLowerCase(),n.searchParams.set(`p`,dT(JSON.stringify(r))),n.toString()}catch{return e}}function PT(e,t,n){let r=[e?.canonicalHash,t,n?.matchedHash];for(let e of r)if(typeof e==`string`&&e.trim())return e.toLowerCase();return null}function FT(e,t){return typeof e==`string`&&e.trim()?e:typeof t?.transferNonce==`string`&&t.transferNonce.trim()?t.transferNonce:null}async function IT(t){let{stageEl:n,payload:r,localHash:i,routeHash:a,qr:o,onToast:s}=t;if(!n)return s(`No stage found`);try{let t=(await m(async()=>{let{default:t}=await import(`./html2canvas-DNGmdnmT.js`).then(e(1));return{default:t}},__vite__mapDeps([0,1,2,3]))).default,l=await t(n,{backgroundColor:null}),u=document.createElement(`canvas`);u.width=eT,u.height=eT;let d=u.getContext(`2d`);if(!d)throw Error(`No canvas context`);d.clearRect(0,0,u.width,u.height);let f=Math.floor(eT*.06),p=eT-f*2,h=eT-f*2,g=l.width,_=l.height,v=Math.min(p/g,h/_),y=Math.floor(g*v),b=Math.floor(_*v),x=Math.floor((eT-y)/2),S=Math.floor((eT-b)/2);d.drawImage(l,x,S,y,b);let C=r?.chakraDay??`Throat`,w=dC[C]?.accent||`#00FFD0`,T=kC(C,typeof r?.stepPct==`number`?r.stepPct:r?r.pulse%11/11:0,i||void 0),E=Math.max(eT*.33,720),D=Math.max(eT*.08,160),O=Math.max(D*.24,30),k=eT-E-f,A=eT-D-f;d.save(),d.shadowColor=w,d.shadowBlur=Math.max(18,Math.floor(eT*.012));let j=d.createLinearGradient(0,A,0,A+D);j.addColorStop(0,`rgba(255,255,255,0.16)`),j.addColorStop(1,`rgba(255,255,255,0.05)`),c(d,k,A,E,D,O),d.fillStyle=j,d.fill(),d.shadowBlur=0,d.lineWidth=Math.max(2,Math.floor(eT*.0016)),d.strokeStyle=`rgba(255,255,255,0.18)`,d.stroke();let M=(r?.pulse??0).toLocaleString();d.textBaseline=`alphabetic`,d.fillStyle=T,d.font=`900 ${Math.floor(D*.48)}px Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto, Helvetica Neue, Arial`,d.shadowColor=T,d.shadowBlur=Math.max(16,Math.floor(eT*.008));let N=d.measureText(M).width,P=Math.floor(k+E/2-N/2),F=Math.floor(A+D/2+D*.18);d.fillText(M,P,F),d.restore();let I=Math.floor(eT*.32),ee=Math.floor((eT-I)/2),L=Math.floor((eT-I)/2),R=LT({provided:o.url,payload:r,localHash:i,routeHash:a}),te=(0,ZC.renderToStaticMarkup)((0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 1000 1000`,children:(0,q.jsx)(ww,{uid:o.uid,url:R,size:800,phaseHue:o.hue,phaseColor:o.accent,animate:!1,pulseMs:5236})})),z=new Blob([te],{type:`image/svg+xml;charset=utf-8`}),ne=URL.createObjectURL(z);await new Promise((e,t)=>{let n=new Image;n.onload=()=>{try{d.drawImage(n,ee,L,I,I)}finally{URL.revokeObjectURL(ne),e()}},n.onerror=e=>{URL.revokeObjectURL(ne),t(e)},n.src=ne});let re=u.toDataURL(`image/png`),B=document.createElement(`a`);B.href=re,B.download=`sigil_poster_${(i||a||`mint`).slice(0,16)}.png`,document.body.appendChild(B),B.click(),B.remove(),s(`Public key PNG saved`)}catch(e){console.error(e),s(`Poster export failed`)}function c(e,t,n,r,i,a){e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath()}}function LT(e){let{provided:t,payload:n,localHash:r,routeHash:i}=e,a=t&&RT(t)?t:(typeof window<`u`?window.location.href:``)||``;if(!n)return a;try{let e=(n.canonicalHash||r||i||``).toLowerCase();if(!e)return a;let t=new URL(a,typeof window<`u`?window.location.origin:`https://local.test`);t.pathname=`/s/${e}`;let o=n.transferNonce||t.searchParams.get(`t`);o&&t.searchParams.set(`t`,o);let s=`${t.pathname}${t.search}${t.hash}`;return NT(s,n)||s}catch{return a}}function RT(e){try{let t=new URL(e,typeof window<`u`?window.location.origin:`https://local.test`);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function zT(e){let t=JSON.stringify(e);return btoa(unescape(encodeURIComponent(t))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function BT(e,t,n){let r=new URL(e,typeof window<`u`?window.location.origin:`http://localhost`);return r.searchParams.set(`p`,zT(t)),n&&r.searchParams.set(`t`,n),r.toString()}function VT(e){switch(String(e??``).trim().toLowerCase()){case`root`:return`Root`;case`sacral`:return`Sacral`;case`solar plexus`:case`solar_plexus`:case`solar-plexus`:return`Solar Plexus`;case`heart`:return`Heart`;case`throat`:return`Throat`;case`third eye`:case`third_eye`:case`third-eye`:return`Third Eye`;case`crown`:return`Crown`;default:return`Root`}}function HT(e,t){let n={pulse:e.pulse,beat:e.beat,chakraDay:VT(e.chakraDay),stepsPerBeat:e.stepsPerBeat??void 0,stepIndex:t,userPhiKey:e.userPhiKey??void 0,kaiSignature:e.kaiSignature??void 0,canonicalHash:e.canonicalHash??void 0,transferNonce:e.transferNonce??void 0,expiresAtPulse:e.expiresAtPulse??void 0,claimExtendUnit:e.claimExtendUnit??void 0,claimExtendAmount:e.claimExtendAmount??void 0,attachment:e.attachment??void 0,provenance:e.provenance??void 0};return Object.keys(n).forEach(e=>{n[e]===void 0&&delete n[e]}),n}function UT(e){return{pulse:e.pulse,beat:e.beat,stepIndex:e.stepIndex,chakraDay:VT(e.chakraDay),stepsPerBeat:e.stepsPerBeat??void 0,userPhiKey:e.userPhiKey??void 0,kaiSignature:e.kaiSignature??void 0}}function WT(e,t){e.setAttribute(`data-share-url`,t),e.querySelectorAll(`a`).forEach(e=>{e.setAttribute(`href`,t);try{e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,t)}catch{}});let n=/\bu=([^·\n\r]+?)(?=\s*·|$)/;e.querySelectorAll(`text`).forEach(e=>{let r=e.textContent||``;n.test(r)&&(e.textContent=r.replace(n,`u=${t}`))})}async function GT(e){let{expired:t,exporting:n,setExporting:r,svgEl:i,payload:a,isFutureSealed:o,linkStatus:c,setToast:l,expiryUnit:u,expiryAmount:d,localHash:f,routeHash:p,transferToken:h,getKaiPulseEternalInt:g,stepIndexFromPulse:_,STEPS_PER_BEAT:v}=e;if(t)return SC(l,`Seal window closed`);if(!n){if(!i)return SC(l,`No SVG found`);if(!a)return SC(l,`No payload`);if(o)return SC(l,`Opens after the moment—claim unlocks then`);if(c!==`active`)return SC(l,`Archived link — cannot claim from here`);try{r(!0);let e=`sigil_${(f||p||`mint`).slice(0,16)}`,t=a.stepsPerBeat??v,n=_(a.pulse,t),o=g(new Date),c=_(o,t),y=HT(a,n),b={...iC(a.userPhiKey||``,a.kaiSignature??void 0,y,`claim`,a.attachment?.name??void 0,o),stepIndex:n,atStepIndex:c},x={...a,exportedAtPulse:o,stepIndex:n,stepsPerBeat:t,provenance:[...a.provenance??[],b],claimExtendUnit:a.claimExtendUnit??u,claimExtendAmount:a.claimExtendAmount??d,canonicalHash:(f||a.canonicalHash||p||null)?.toString()??null},S=await FC(zC(x.pulse,x.beat,n,String(x.chakraDay??``),BC(HT(x,n)))),C=await RC(S),w={...x,kaiSignature:S,userPhiKey:x.userPhiKey||C},T=(f||p||``).toLowerCase(),E=UT({pulse:w.pulse,beat:w.beat,stepIndex:n,chakraDay:w.chakraDay??null,stepsPerBeat:t,userPhiKey:w.userPhiKey??null,kaiSignature:w.kaiSignature??null}),D=BT(s(T,E),E,w.transferNonce??h??void 0),{putMetadata:O}=await m(async()=>{let{putMetadata:e}=await import(`./svgMeta-C7DBvyS6.js`);return{putMetadata:e}},__vite__mapDeps([4,5,2,3])),k={...w,stepsPerBeat:t,shareUrl:D,fullUrl:D};O(i,k);try{i.setAttribute(`data-step-index`,String(n));let e=i.querySelector(`metadata#sigil-display`);e||(e=document.createElementNS(`http://www.w3.org/2000/svg`,`metadata`),e.setAttribute(`id`,`sigil-display`),e.setAttribute(`data-noncanonical`,`1`),i.appendChild(e)),e.textContent=JSON.stringify({stepIndex:n,stepsPerBeat:t})}catch{console.debug(`Display metadata write failed`)}KC(i,w.pulse,w.beat,n),UC(i),WT(i,D);let A=null,j=null;try{let e=new URL(D);A=e.searchParams.get(`p`),j=e.searchParams.get(`t`)}catch{console.debug(`URL parse failed`)}let M=await iT(i,$w,{metaOverride:k,addQR:!1,addPulseBar:!1,title:`Kairos Sigil-Glyph — Sealed KairosMoment`,desc:`Deterministic sigil-glyph with sovereign metadata. Exported as archived key.`}),N=await aT(M,$w),P=new(await(CC()));P.file(`${e}.svg`,M),P.file(`${e}.png`,N);let F={hash:f||p||``,canonicalHash:w.canonicalHash??null,pulse:w.pulse,beat:w.beat,stepIndex:n,atStepIndex:c,chakraDay:w.chakraDay??null,userPhiKey:w.userPhiKey??null,kaiSignature:w.kaiSignature??null,transferNonce:w.transferNonce??null,expiresAtPulse:w.expiresAtPulse??null,exportedAtPulse:w.exportedAtPulse??null,claimedAtPulse:o,overlays:{qr:!1,eternalPulseBar:!1},claimExtendUnit:w.claimExtendUnit??null,claimExtendAmount:w.claimExtendAmount??null,fullUrl:D,p:A,urlQuery:{p:A,t:j}};P.file(`${e}.manifest.json`,JSON.stringify(F,null,2));let I=await P.generateAsync({type:`blob`}),ee=URL.createObjectURL(I),L=document.createElement(`a`);L.href=ee,L.download=`${e}.zip`,document.body.appendChild(L),L.click(),L.remove(),requestAnimationFrame(()=>URL.revokeObjectURL(ee)),SC(l,`Access key generated`)}catch(e){console.error(e),SC(l,`Claim failed`)}finally{r(!1)}}}function KT(){return(0,K.useMemo)(()=>async e=>{let t=new TextEncoder().encode(e),n=await crypto.subtle.digest(`SHA-256`,t);return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,`0`)).join(``)},[])}function qT({payload:e,urlSearchParams:n,currentPulse:r}){let[a,s]=(0,K.useState)(null),[u,p]=(0,K.useState)(null),[m,g]=(0,K.useState)(null),v=(0,K.useRef)(null),y=(0,K.useRef)(null),b=KT(),x=n?.get(`vpol`)??``;(0,K.useEffect)(()=>{let t=!0;return(async()=>{if(!e||!Number.isFinite(r??NaN)){if(!t)return;s(e=>e===null?e:null),p(e=>e===null?e:null),g(e=>e===null?e:null),v.current=null,y.current=null;return}let{seal:n}=await ae({pulse:e.pulse,kaiPulse:e.pulse,beat:e.beat,stepIndex:e.stepIndex,stepsPerBeat:e.stepsPerBeat,seriesSize:e.seriesSize,quality:e.quality,creatorVerified:e.creatorVerified,creatorRep:e.creatorRep,frequencyHz:e.frequencyHz,chakraDay:e.chakraDay,chakraGate:e.chakraGate,transfers:e.transfers,cumulativeTransfers:e.cumulativeTransfers,segments:e.segments,segmentsMerkleRoot:e.segmentsMerkleRoot,transfersWindowRoot:e.transfersWindowRoot,ip:e.ip,kaiSignature:e.kaiSignature,userPhiKey:e.userPhiKey,valuationPolicyId:x||void 0},r,b);if(!t)return;y.current!==n.stamp&&(s(e=>e&&e.stamp===n.stamp?e:n),y.current=n.stamp);let i=n.valuePhi,a=v.current;a!==i&&(p(e=>e===i?e:i),a!=null&&Math.abs(i-a)>1e-9?g(e=>e===`up`&&i>a?e:i>a?`up`:`down`):g(e=>e===null?e:null),v.current=i)})(),()=>{t=!1}},[e,r,x,b]);let S=(0,K.useMemo)(()=>e?.pulse,[e]),C=(0,K.useMemo)(()=>Number.isFinite(S??NaN)?{score:j(S),lines:i(S)}:{score:null,lines:[]},[S]),w=(0,K.useMemo)(()=>{if(!Number.isFinite(S??NaN)||!Number.isFinite(r??NaN))return null;let t=a?.inputs?.pulsesPerBeat?Math.max(1,Math.round(a.inputs.pulsesPerBeat/11)):e?.stepsPerBeat??44,n=a?.inputs?.cadenceRegularity??1,i=a?.inputs?.resonancePhi??.5,s=e?.stepIndex;return o(S,r,{stepsPerBeat:t,cadenceRegularity:n,resonancePhi:i,stepIndexClaimOverride:s})},[S,r,a,e]),T=(0,K.useMemo)(()=>{let t=e?.transfers;return!t||!t.length?[`No closed transfers yet — lineage still forming.`]:_(t,{stepsPerBeat:e?.stepsPerBeat??44})},[e]);return{valSeal:a,livePrice:u,priceFlash:m,rarity:C,oscillation:w,lineageNarrative:T,trust:(0,K.useMemo)(()=>a?B(a.inputs):null,[a]),marketTier:(0,K.useMemo)(()=>Number.isFinite(S??NaN)?h(S,a??void 0):null,[S,a]),kairos:(0,K.useMemo)(()=>Number.isFinite(r??NaN)?{window:l(r,144,1,{stepsPerBeat:e?.stepsPerBeat??44})}:{window:[]},[r,e]),visuals:(0,K.useMemo)(()=>{if(!a||!Number.isFinite(S??NaN))return{spiralSVG:null,scrollSVG:null,scrollText:null,scrollHTML:null};let e=t(S),{scrollSVG:n,scrollText:r}=f(a,{title:`Kai-Sigil Valuation Scroll`});return{spiralSVG:e,scrollSVG:n,scrollText:r,scrollHTML:A(a,{title:`Kai-Sigil Valuation Scroll`})}},[a,S]),audio:(0,K.useMemo)(()=>{if(!Number.isFinite(S??NaN))return{dataURI:null,renderWav:void 0};let{dataURI:e}=c(S,2,44100,{stereo:!0});return{dataURI:e,renderWav:(e=2,t=44100,n)=>c(S,e,t,n)}},[S]),motifSimilarityWith:(0,K.useMemo)(()=>e=>!Number.isFinite(e??NaN)||!Number.isFinite(S??NaN)?null:d(S,e),[S]),helpers:(0,K.useMemo)(()=>({explainRarity:()=>C.lines,explainLineage:()=>T,scanKairos:(t,n,r=1,i)=>l(t,n,r,{stepsPerBeat:i??e?.stepsPerBeat??44}),makeScroll:e=>a?f(a,{title:e??`Kai-Sigil Valuation Scroll`}):null,makeScrollHTML:e=>a?A(a,{title:e}):null,makeSpiral:e=>Number.isFinite(e??S)?t(e??S):null}),[C.lines,T,e,a,S])}}function JT(e){let{stageId:t,payload:n,localHash:r,setOgImgUrl:i,setMeta:a,seoTitle:o,seoDesc:s}=e,c=!1,l=null,u=async()=>{let e=document.getElementById(t);if(!e||!n){i(null),a(`property`,`og:image`,``),a(`property`,`og:image:alt`,``),a(`property`,`og:image:width`,``),a(`property`,`og:image:height`,``),a(`name`,`twitter:image`,``);return}try{let t=n.chakraDay??`Throat`,l=dC[t]?.accent||`#00FFD0`,u=n.pulse||0,f=n.stepsPerBeat??44,p=Math.floor(n.pulse%(f*11)/11),m=kC(t,typeof n.stepPct==`number`?n.stepPct:n.pulse%11/11,r||void 0),h=`Pulse ${u.toLocaleString()} • Beat ${n.beat}/36 • Step ${p+1}/${f} • ${t}`,g=await(0,ge.default)(e),_=document.createElement(`canvas`);_.width=tT,_.height=630;let v=_.getContext(`2d`);if(!v)throw Error(`Canvas unsupported`);let y=v.createLinearGradient(0,0,tT,630);y.addColorStop(0,`rgba(0,0,0,0.92)`),y.addColorStop(1,`rgba(0,0,0,0.70)`),v.fillStyle=y,v.fillRect(0,0,tT,630),v.save(),v.globalCompositeOperation=`lighter`;let b=v.createRadialGradient(tT*.8,630*.2,20,tT*.8,630*.2,600);b.addColorStop(0,`${l}CC`),b.addColorStop(1,`rgba(0,0,0,0)`),v.fillStyle=b,v.beginPath(),v.arc(tT*.8,630*.2,600,0,Math.PI*2),v.fill(),v.restore();let x=Math.floor(tT*.52),S=Math.min(x/g.width,558/g.height),C=Math.floor(g.width*S),w=Math.floor(g.height*S),T=36+Math.floor((x-C)/2),E=36+Math.floor((558-w)/2);v.drawImage(g,T,E,C,w);let D=36+x+32,O=tT-D-36;v.fillStyle=`#EAFBFF`,v.font=`700 38px Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto`,v.fillText(`Kairos Sigil-Glyph — Sealed Kairos Moment`,D,94),v.fillStyle=`rgba(255,255,255,0.82)`,v.font=`400 24px Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto`,d(v,`“${o}” — ${s}`,D,136,O,30);let k=`${u.toLocaleString()}`;v.textBaseline=`alphabetic`,v.font=`900 120px Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto`,v.shadowColor=m,v.shadowBlur=20,v.fillStyle=m;let A=v.measureText(k).width,j=D+Math.floor((O-A)/2);v.fillText(k,j,554),v.shadowBlur=0;let M=_.toDataURL(`image/png`);if(c)return;i(M),a(`property`,`og:image`,M),a(`property`,`og:image:alt`,h),a(`property`,`og:image:type`,`image/png`),a(`property`,`og:image:width`,`1200`),a(`property`,`og:image:height`,`630`),a(`name`,`twitter:image`,M)}catch{if(c)return;i(null)}};return l=wC(()=>{c||u()}),()=>{c=!0,l!=null&&TC(l)};function d(e,t,n,r,i,a){let o=t.split(` `),s=``;for(let t=0;ti&&t>0?(e.fillText(s,n,r),s=o[t]+` `,r+=a):s=c}e.fillText(s.trim(),n,r)}}function YT(e){switch(String(e??``).trim().toLowerCase()){case`root`:case`earth`:case`earth gate`:return`Root`;case`sacral`:return`Sacral`;case`solar plexus`:case`solar_plexus`:case`solar-plexus`:return`Solar Plexus`;case`heart`:return`Heart`;case`throat`:return`Throat`;case`third eye`:case`third_eye`:case`third-eye`:return`Third Eye`;case`crown`:return`Crown`;default:return`Root`}}function XT(){return crypto.getRandomValues(new Uint32Array(4)).join(``)}function ZT(e){let{meta:t,stepIndex:n,stepsPerBeat:r}=e;return{pulse:t.pulse,beat:t.beat,stepIndex:n,chakraDay:YT(t.chakraDay),stepsPerBeat:r,userPhiKey:t.userPhiKey??void 0,kaiSignature:t.kaiSignature??void 0}}function QT(e,t,n){let r=e.stepIndex;return typeof r==`number`&&Number.isFinite(r)&&r>=0&&rNumber(N()/1000n),rE=e=>JSON.stringify({canonicalHash:e.canonicalHash,token:e.token,expiresAtPulse:e.expiresAtPulse,issuedAt:e.issuedAt,version:e.version},tE),iE=e=>btoa(String.fromCharCode(...e)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``);const aE=e=>iE(new TextEncoder().encode(rE(e)));async function oE(e){try{let t=await fetch(`/api/sign-claim`,{method:`POST`,headers:{"content-type":`text/plain;charset=UTF-8`},body:rE(e)});if(!t.ok)return null;let n=await t.json();return!n||!n.s||!n.kid?null:{r:n.r??aE(e),s:n.s,kid:n.kid}}catch{return null}}function sE(e,t,n,r){e.searchParams.set(`r`,t),e.searchParams.set(`s`,n),e.searchParams.set(`kid`,r)}function cE(e,t,n,r){pe(e,{registryClaim:aE(t),registrySig:n,registryKid:r})}function lE(e,t,n){return{canonicalHash:t.toLowerCase(),token:n,expiresAtPulse:e.expiresAtPulse??null,issuedAt:nE(),version:1}}function uE(){if(typeof window>`u`||typeof document>`u`){let e=()=>{},t=()=>{};return{openModal:t,closeModal:t,disable:e,teardown:e,destroy:e}}let e=document,t=e.body,n=[`.sp-breathproof__backdrop`,`.stargate-overlay`,`.valuechart-backdrop`,`.sp-modal`,`.ownership-overlay`],r={".sp-breathproof__backdrop":`.sp-breathproof`,".valuechart-backdrop":`.valuechart`,".ownership-overlay":`.ownership-panel`,".stargate-overlay":`.stargate-content, .stargate-frame, .stargate__content`,".sp-modal":`.sp-modal__content, .sp-modal__card, .sp-card`},i={capture:!0,passive:!1},a={capture:!0},o=0,s=0,c=0,l=``,u=``,d=``,f=``,p=``,m=()=>{o===0&&(s=window.scrollY||e.documentElement.scrollTop||0,c=window.scrollX||e.documentElement.scrollLeft||0,l=t.style.top,u=t.style.left,d=t.style.width,f=t.style.position,p=t.style.overflow,t.style.position=`fixed`,t.style.top=`-${s}px`,t.style.left=`-${c}px`,t.style.width=`100%`,t.style.overflow=`hidden`,t.classList.add(`modal-open`,`bp-open`)),o++},h=()=>{o=Math.max(0,o-1),!(o>0)&&(t.style.position=f,t.style.top=l,t.style.left=u,t.style.width=d,t.style.overflow=p,requestAnimationFrame(()=>{window.scrollTo(c,s)}),t.classList.remove(`modal-open`),t.classList.remove(`bp-open`))},g=e=>{if(!e)return!1;let t=window.getComputedStyle(e);return!(t.display===`none`||t.visibility===`hidden`||e.hasAttribute(`hidden`))},_=()=>{let t=[];return n.forEach(n=>{e.querySelectorAll(n).forEach(e=>{g(e)&&t.push(e)})}),t},v=t=>{if(!t)return null;let r=t;for(;r&&r!==e.documentElement;){for(let e of n)if(r.matches(e))return r;r=r.parentElement}return null},y=(e,t)=>{if(!e||!t)return!1;let i=n.find(t=>e.matches(t))||``,a=i?r[i]:``;return a&&e.querySelector(a)?!t.closest(a):t===e},b=()=>{_().length>0?m():h()},x=e=>{e&&(e.classList.add(`is-open`),e.removeAttribute(`hidden`),b())},S=e=>{e&&(e.classList.remove(`is-open`),e.setAttribute(`hidden`,``),b())},C=e=>{let t=e.target;if(!t)return;let n=t.closest(`.sp-breathproof__close, .stargate-exit, .sp-modal__close, .sealmoment__close, [data-modal-close], [data-dismiss="modal"], button[aria-label="Close"], button[aria-label="close"]`);if(n){let t=v(n);t&&(S(t),e.preventDefault(),e.stopPropagation());return}let r=v(t);if(r&&y(r,t)&&r.getAttribute(`data-backdrop-dismiss`)!==`false`){S(r),e.preventDefault(),e.stopPropagation();return}},w=e=>{if(_().length===0)return;let t=e.target;if(!t)return;let n=t.closest(`[data-scroll], .sp-breathproof, .valuechart, .ownership-panel, .sp-modal__content, .sp-card, .stargate-content`);if(!n){e.preventDefault(),e.stopPropagation();return}if(!(n.scrollHeight>n.clientHeight)){e.preventDefault(),e.stopPropagation();return}},T=e=>{if(e.key!==`Escape`)return;let t=_();if(t.length===0)return;let n=t[t.length-1];n.getAttribute(`data-escape-dismiss`)!==`false`&&(S(n),e.preventDefault(),e.stopPropagation())};e.addEventListener(`click`,C,i),e.addEventListener(`pointerup`,C,i),e.addEventListener(`touchend`,C,i),e.addEventListener(`touchmove`,w,i),e.addEventListener(`keydown`,T,i),b();let E=()=>{e.removeEventListener(`click`,C,a),e.removeEventListener(`pointerup`,C,a),e.removeEventListener(`touchend`,C,a),e.removeEventListener(`touchmove`,w,a),e.removeEventListener(`keydown`,T,a);try{o=1,h()}catch{}};return{openModal:x,closeModal:S,disable:E,teardown:E,destroy:E}}var dE=k(ce(),1),fE=1e-9,pE=`sigil-sendlock-v1`,mE=(e,t)=>`sigil:sendlock:${e}:t:${t}`,hE=3,gE={"--phi-url":`url(/assets/phi.svg)`},_E=e=>{try{return new URL(e,window.location.origin).toString()}catch{return e}},vE=(e,t,n)=>{let r=crypto.getRandomValues(new Uint32Array(4)).join(``);if(!e||!t)return{ok:!1,id:r};let i=mE(e.toLowerCase(),t);try{let a=localStorage.getItem(i),o=a?JSON.parse(a):null,s=!o||!Number.isFinite(o.atPulse)||n-o.atPulse>hE;if(!o||s){localStorage.setItem(i,JSON.stringify({id:r,atPulse:n}));try{let i=new BroadcastChannel(pE),a={type:`lock`,canonical:e.toLowerCase(),token:t,id:r,atPulse:n};i.postMessage(a),i.close()}catch{}return{ok:!0,id:r}}}catch{}return{ok:!1,id:r}},yE=(e,t,n,r)=>{if(!e||!t)return;let i=mE(e.toLowerCase(),t);try{let a=localStorage.getItem(i),o=a?JSON.parse(a):null;if(!o||o.id===n){localStorage.removeItem(i);try{let i=new BroadcastChannel(pE),a={type:`unlock`,canonical:e.toLowerCase(),token:t,id:n,atPulse:r};i.postMessage(a),i.close()}catch{}}}catch{}},bE=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.amount==`number`&&Number.isFinite(t.amount)&&t.amount>0&&typeof t.nonce==`string`&&t.nonce.length>0&&typeof t.timestamp==`number`&&Number.isFinite(t.timestamp)&&(typeof t.recipientPhiKey==`string`||t.recipientPhiKey===void 0)},xE=e=>{if(!Array.isArray(e))return 0;let t=0;for(let n of e)bE(n)&&(t+=n.amount);return t},SE=e=>[...e].sort((e,t)=>{let n=(e.timestamp||0)-(t.timestamp||0);return n===0?e.nonce.localeCompare(t.nonce):n}),CE=e=>{let t=new Set,n=[];for(let r of e)bE(r)&&(t.has(r.nonce)||(t.add(r.nonce),n.push(r)));return n},wE=e=>{let t=typeof e.originalAmount==`number`&&Number.isFinite(e.originalAmount)?e.originalAmount:NaN,n=SE(Array.isArray(e.debits)?CE(e.debits):[]);if(!Number.isFinite(t))return{originalAmount:e.originalAmount,debits:n.length?n:void 0};let r=[],i=0;for(let e of n)bE(e)&&i+e.amount<=t+fE&&(r.push(e),i+=e.amount);return{originalAmount:t,debits:r.length?r:void 0}},TE=1000000n,EE=91536000n,DE=17491270421n,OE=e=>e<0n?-e:e,kE=(e,t)=>{let n=e/t,r=e%t*2n;return rt?n+1n:n%2n==0n?n:n+1n},AE=(e,t)=>{if(t<=0n)throw Error(`divRoundTiesToEven: den must be > 0`);return e===0n?0n:(e<0n?-1n:1n)*kE(OE(e),t)},jE=e=>AE(e*EE,DE),ME=e=>{let t=jE(e);return BigInt(x)+t},NE=e=>AE((e-BigInt(x))*DE,EE),PE=()=>{let e=N();return Number(e/TE)},FE=()=>{let e=ME(N());return Number(e)},IE=e=>{let t=NE(BigInt(e.getTime()));return Number(t/TE)};function LE(){let[e,t]=(0,K.useState)(()=>PE()),[n,r]=(0,K.useState)(0);return(0,K.useEffect)(()=>{let e=!0,n=null,i=()=>{if(!e)return;let a=N(),o=Number(a/TE),s=a%TE,c=jE(s===0n?TE:TE-s),l=Number(c);t(o),r(l);let u=Math.max(1,Math.min(6e4,l));n=window.setTimeout(i,u)};return i(),()=>{e=!1,n!=null&&window.clearTimeout(n)}},[]),{pulse:e,msToNextPulse:n}}var RE=e=>e===`breaths`||e===`steps`,zE=`sigil-lineage-v1`,BE=(e,t)=>t?`sigil:desc:${e}:t:${t}`:`sigil:desc:${e}`,VE=`sigil-xfer-v1`,HE=e=>`sigil:rotated:${e}`,UE=(e,t)=>{Array.from(new Set(e.map(e=>e.toLowerCase()).filter(Boolean))).forEach(e=>{try{localStorage.setItem(HE(e),`${t}@${FE()}`)}catch{}try{let n=new BroadcastChannel(VE);n.postMessage({type:`rotated`,canonical:e,token:t}),n.close()}catch{}try{window.dispatchEvent(new CustomEvent(`sigil:transfer-rotated`,{detail:{canonical:e,token:t}}))}catch{}})};function WE(e,t){let n=(e||``).toLowerCase();if(!n||!t)return[];try{let e=localStorage.getItem(BE(n,t));if(!e)return[];let r=JSON.parse(e);return Array.isArray(r)?r:[]}catch{return[]}}function GE(e,t,n){let r=(e||``).toLowerCase();if(!(!r||!t))try{localStorage.setItem(BE(r,t),JSON.stringify(n||[]))}catch{}}function KE(e,t,n){try{let r=new BroadcastChannel(zE),i={type:`descendants`,canonical:e.toLowerCase(),token:t,list:n,stamp:FE()};r.postMessage(i),r.close()}catch{}}function qE(){let{hash:e}=ie(),t=oe(),r=C(),i=(e??``).toLowerCase(),a=(0,K.useMemo)(()=>new URLSearchParams(t.search),[t.search]),o=a.get(`t`),[s,c]=(0,K.useState)(`checking`),[l,u]=(0,K.useState)(`checking`),[d,f]=(0,K.useState)(!1),[m,h]=(0,K.useState)(`Awaiting Proof Of Breath™`),[g,_]=(0,K.useState)(``),[v,y]=(0,K.useState)(320),b=(0,K.useRef)(null),{payload:x,setPayload:E,loading:D,setLoading:O}=yC(t.search),k=x,{pulse:A,msToNextPulse:j}=LE(),[M,N]=(0,K.useState)(null),[P,F]=(0,K.useState)(null),[I,L]=(0,K.useState)(!1),[R,te]=(0,K.useState)(``),[z,re]=(0,K.useState)(``),[B,ae]=(0,K.useState)(`breaths`),[ce,H]=(0,K.useState)(44),[U,de]=(0,K.useState)(``),[W,G]=(0,K.useState)(!1),me=(0,K.useRef)(``),ge=(0,K.useMemo)(()=>i?`sigil:legacy-upgraded:${i}`:``,[i]),[be,xe]=(0,K.useState)(!1),[Se,Ce]=(0,K.useState)(!1);(0,K.useEffect)(()=>{if(ge)try{Ce(localStorage.getItem(ge)===`1`)}catch{}},[ge]);let we=(0,K.useCallback)(()=>{if(ge){try{localStorage.setItem(ge,`1`)}catch{}Ce(!0),SC(_,`Upgraded — legacy link locked`)}},[ge]),[Te,Ee]=(0,K.useState)(!1),[De,Oe]=(0,K.useState)(``),[ke,Ae]=(0,K.useState)(``),[je,Me]=(0,K.useState)(`checking`),[Ne,Pe]=(0,K.useState)(null);(0,K.useEffect)(()=>{let e=Array.from(new Set([k?.canonicalHash,i,U].filter(Boolean).map(e=>e.toLowerCase())));if(e.length===0)return;let t=()=>{let t=null;try{for(let n of e){let e=localStorage.getItem(HE(n)),r=e?String(e).split(`@`)[0]:null;if(r){t=r;break}}}catch{}Pe(t)};t();let n=null;try{n=new BroadcastChannel(VE),n.onmessage=t=>{let n=t.data;if(n?.type===`rotated`){let t=(n.canonical||``).toLowerCase();e.includes(t)&&Pe(n.token||null)}}}catch{}let r=n=>{if(n.key){for(let r of e)if(n.key===HE(r)){t();break}}};return window.addEventListener(`storage`,r,{passive:!0}),()=>{if(window.removeEventListener(`storage`,r),n&&typeof n.close==`function`)try{n.close()}catch{}}},[k?.canonicalHash,i,U]);let Fe=(0,K.useCallback)(async(e,t,n,r,i)=>{try{let a=lE(e,t,n),o=await oE(a);if(!o)return r;let s=new URL(r,window.location.origin);return sE(s,o.r,o.s,o.kid),i&&cE(i,a,o.s,o.kid),s.toString()}catch{return r}},[]);(0,K.useEffect)(()=>{let e=null;try{e=new BroadcastChannel(pE),e.onmessage=()=>{}}catch{}return()=>{if(e&&typeof e.close==`function`)try{e.close()}catch{}}},[]),(0,K.useEffect)(()=>{let e=uE();return()=>{e.destroy?.(),e.teardown?.(),e.disable?.()}},[]);let[Ie,Le]=(0,K.useState)(0),[Re,Ve]=(0,K.useState)(!1),[He,Ue]=(0,K.useState)(null),We=(0,K.useMemo)(()=>{let e=[k?.canonicalHash,U,M?.canonicalHash,He?.matchedHash].filter(Boolean).map(e=>e.toLowerCase());return Array.from(new Set(e))},[k?.canonicalHash,U,M?.canonicalHash,He]);(0,K.useLayoutEffect)(()=>{qC()},[]),(0,K.useEffect)(()=>{let e=dC[k?.chakraDay??`Throat`]??{hue:180,accent:`#00FFD0`},t=document.querySelector(`.sigilpage`);t&&(t.style.setProperty(`--crystal-hue`,String(e.hue)),t.style.setProperty(`--crystal-accent`,e.accent))},[k?.chakraDay]);let[Ge,Ke]=(0,K.useState)(null),{valSeal:qe,livePrice:Je,priceFlash:Ye}=qT({payload:k,urlSearchParams:a,currentPulse:A,routeHash:i}),Xe=a.get(`h`)??``;(0,K.useEffect)(()=>{if(!Xe){Ke(e=>e===null?e:null);return}try{let e=n(jC(Xe.trim()));Ke(t=>Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)}catch{Ke(e=>e===null?e:null)}},[Xe]);let Ze=(0,K.useCallback)((e,t)=>{let n=e.stepsPerBeat??44,r=t.stepsPerBeat??44,i=p(e.pulse,n),a=p(t.pulse,r);return e.pulse===t.pulse&&e.beat===t.beat&&i===a&&e.chakraDay===t.chakraDay},[]),Qe=(0,K.useMemo)(()=>typeof window<`u`?new URL(window.location.href).toString():`${`/s/${encodeURIComponent(e??``)}`}${t.search||``}${t.hash||``}`,[e,t.search,t.hash]),$e=(0,K.useMemo)(()=>e?e.slice(0,16):`—`,[e]),et=(0,K.useCallback)(async(e,t=`Copied`)=>{try{return await navigator.clipboard.writeText(e),SC(_,t),!0}catch{return SC(_,`Copy failed`),!1}},[]),tt=(0,K.useCallback)(async()=>{try{let e=navigator;typeof e?.share==`function`?(await e.share({title:`Kairos Sigil-glyph`,text:`Sealed Kairos Moment`,url:Qe}),SC(_,`Share sheet opened`)):await et(Qe,`Link copied`)}catch{}},[Qe,et]);(0,K.useEffect)(()=>{let e=FE(),t=(i||``).toLowerCase();if(Ie>e||!t||We.length===0)return;let n=We.includes(t),r=l,a=s;!n&&U&&t!==U&&!He||!n&&(He||je===`archived`)?r=`authentic`:(r=n?`authentic`:`forged`,s!==`verified`&&(a=n?`ok`:`mismatch`)),r!==l&&u(r),a!==s&&c(a)},[We,i,je,Ie,He,U,l,s]);let[nt,rt]=(0,K.useState)(null),it=(0,K.useDeferredValue)(k),at=(0,K.useMemo)(()=>{let t=it?.stepsPerBeat??44,n=it?p(it.pulse,t):0,r=it?.chakraDay??`Throat`,i=(it?.userPhiKey??``).slice(0,12),a=(it?.pulse??0).toLocaleString();return{title:`Kai Sigil — ${e?e.slice(0,16):`—`}`,desc:it?`Sealed Sigil-Glyph • Pulse ${a} • Beat ${it.beat}/36 • Step ${n+1}/${t} • ${r}${i?` • Owner ${i}…`:``}.`:`Sealed Sigil-Glyph`}},[it,e]),{series:ot}=QS();(0,K.useEffect)(()=>{let e=Qe;document.title=at.title;let t=lC(`canonical`);t.href=e,sC(`name`,`theme-color`,dC[k?.chakraDay??`Throat`]?.accent||`#00FFD0`),sC(`property`,`og:title`,at.title),sC(`property`,`og:description`,at.desc),sC(`property`,`og:type`,`website`),sC(`property`,`og:url`,e),sC(`name`,`twitter:card`,`summary_large_image`),sC(`name`,`twitter:title`,at.title),sC(`name`,`twitter:description`,at.desc),sC(`property`,`og:site_name`,`Kairos Harmonik Kingdom`);let n=k?.stepsPerBeat??44,r=k?p(k.pulse,n):0,i=k,a=k??{},o={"@context":`https://schema.org`,"@type":`VisualArtwork`,name:at.title,description:at.desc,url:e,image:nt||void 0,genre:`Sigil-Glyph`,identifier:[{"@type":`PropertyValue`,name:`pulse`,value:k?.pulse??null},{"@type":`PropertyValue`,name:`beat`,value:k?.beat??null},{"@type":`PropertyValue`,name:`stepIndex`,value:r},{"@type":`PropertyValue`,name:`stepsPerBeat`,value:n},{"@type":`PropertyValue`,name:`chakraDay`,value:k?.chakraDay??null},{"@type":`PropertyValue`,name:`userPhiKey`,value:k?.userPhiKey??null},{"@type":`PropertyValue`,name:`kaiSignature`,value:k?.kaiSignature??null},{"@type":`PropertyValue`,name:`canonicalHash`,value:(k?.canonicalHash??U)||null},{"@type":`PropertyValue`,name:`expiresAtPulse`,value:k?.expiresAtPulse??null},{"@type":`PropertyValue`,name:`transferNonce`,value:new URLSearchParams(location.search).get(`t`)??k?.transferNonce??null},{"@type":`PropertyValue`,name:`claimExtendUnit`,value:RE(a.claimExtendUnit)?a.claimExtendUnit:null},{"@type":`PropertyValue`,name:`claimExtendAmount`,value:a.claimExtendAmount??null},{"@type":`PropertyValue`,name:`historyLiteCount`,value:Ge?.length??0}].filter(e=>e.value!=null)};i?.lineage?.length&&o.identifier.push({"@type":`PropertyValue`,name:`lineageDepth`,value:i.lineage.length}),uC(`sigil-jsonld`,o)},[Qe,at.title,at.desc,k,nt,U,Ge?.length]),(0,K.useEffect)(()=>JT({stageId:`sigil-stage`,payload:k?{...k}:null,localHash:U,setOgImgUrl:rt,setMeta:sC,seoTitle:at.title,seoDesc:at.desc}),[k,U,v,at.title,at.desc]),(0,K.useLayoutEffect)(()=>(document.documentElement.classList.add(`sigil-scroll`),()=>document.documentElement.classList.remove(`sigil-scroll`)),[]),(0,K.useEffect)(()=>{let e=0,t=()=>{cancelAnimationFrame(e),e=requestAnimationFrame(()=>{let e=window.innerWidth,t=window.innerHeight,n=e<640?Math.max(220,Math.min(360,t*.48)):Math.max(160,Math.min(320,t*.35)),r=Math.max(160,Math.min(640,Math.min(e,t-n))),i=b.current?.clientWidth??e,a=Math.max(160,Math.min(640,i-24));y(Math.round(Math.min(r,a)))})},n=b.current??document.body,r=new ResizeObserver(()=>t());return r.observe(n),window.addEventListener(`resize`,t,{passive:!0}),t(),()=>{r.disconnect(),window.removeEventListener(`resize`,t),cancelAnimationFrame(e)}},[]),(0,K.useEffect)(()=>{D?(c(e=>e===`verified`?`verified`:`checking`),u(e=>e===`authentic`?`authentic`:`checking`),f(!1),h(`Awaiting Verifikation`)):k||(c(e=>e===`verified`?`verified`:i?`notfound`:`checking`),u(e=>e===`authentic`?`authentic`:i?`forged`:`checking`))},[D,k,i]);let st=e=>Array.isArray(e)?[...e].map(e=>({nonce:e.nonce,amount:Number.isFinite(e.amount)?Number(e.amount):0,recipient:e.recipientPhiKey??``,ts:e.timestamp??``})).sort((e,t)=>e.nonce.localeCompare(t.nonce)).map(e=>`${e.nonce}:${e.amount}:${e.recipient}:${e.ts}`).join(`|`):``;(0,K.useEffect)(()=>{let e=hT(a.get(`d`));if(!e)return;let t=PT(k??null,U,He),n=FT(o,k??null),r=wE(e);t&&vT(t,r,n);let i=typeof r.originalAmount==`number`?r.originalAmount:void 0,s=Array.isArray(r.debits)?r.debits:void 0;E(e=>{if(!e)return e;let t=e,n=(t.originalAmount??void 0)===i,r=st(t.debits)===st(s);if(n&&r)return e;let a={...e};return i!==void 0&&(a.originalAmount=i),s&&(a.debits=s,a.totalDebited=xE(s)),a})},[a,k,U,He,o,E]);let[ct,lt]=(0,K.useState)(!1);(0,K.useEffect)(()=>{let e=PT(k??null,U,He);if(!e)return;let t=FT(o,k??null),{merged:n,urlIsStale:r}=CT(e,a,t),i=wE(n);r&<(!0),ST(i,e,t,{broadcast:!1,navigate:r});let s=typeof i.originalAmount==`number`?i.originalAmount:void 0,c=Array.isArray(i.debits)?i.debits:void 0;E(e=>{if(!e)return e;let t=e,n=(t.originalAmount??void 0)===s,r=st(t.debits)===st(c);if(n&&r)return e;let i={...e};return s!==void 0&&(i.originalAmount=s),c&&(i.debits=c,i.totalDebited=xE(c)),i})},[k?.canonicalHash,U,He,a,o,E]),(0,K.useEffect)(()=>{if(!k?.canonicalHash)return;let e=k.canonicalHash.toLowerCase();if(i&&e&&e!==i&&je===`active`&&!He){let t=new URL(window.location.href);t.pathname=`/s/${e}`,r(`${t.pathname}${t.search}${t.hash}`,{replace:!0})}},[k?.canonicalHash,i,je,He,r]),(0,K.useEffect)(()=>{if(k&&!k.canonicalHash&&U&&i&&U!==i&&je===`active`&&!He){let e=new URL(window.location.href);e.pathname=`/s/${U}`,r(`${e.pathname}${e.search}${e.hash}`,{replace:!0})}},[k?.canonicalHash,U,i,je,He,r]),(0,K.useEffect)(()=>{let e=We;if(!e.length)return;let t=FT(o,k??null),n=(e,t)=>{let n={};typeof e?.originalAmount==`number`&&(n.originalAmount=e.originalAmount),n.originalAmount===void 0&&typeof t?.originalAmount==`number`&&(n.originalAmount=t.originalAmount);let r=Array.isArray(e?.debits)?e.debits:[],i=Array.isArray(t?.debits)?t.debits:[],a=CE([...r,...i]);return wE({originalAmount:n.originalAmount,debits:a})},r=(e,t)=>{let n=wE(e??{}),r=wE(t??{}),i=typeof n.originalAmount==`number`?n.originalAmount:NaN,a=typeof r.originalAmount==`number`?r.originalAmount:NaN,o=Number.isNaN(i)&&Number.isNaN(a)||Math.abs(i-a)e.nonce)),c=new Set((Array.isArray(r.debits)?r.debits:[]).map(e=>e.nonce));if(!o||s.size!==c.size)return!1;for(let e of s)if(!c.has(e))return!1;return!0},i=(i,a,o)=>{let s=i.toLowerCase();if(!e.includes(s))return;let c=t??null;if(c!==(o??null))return;let l=hT(a);if(!l)return;let u=hT(new URLSearchParams(window.location.search).get(`d`)),d=n(u,l);r(u,d)||(ST(d,s,c,{broadcast:!1}),E(e=>{if(!e)return e;let t={...e};return typeof d.originalAmount==`number`&&(t.originalAmount=d.originalAmount),Array.isArray(d.debits)&&(t.debits=d.debits,t.totalDebited=xE(d.debits)),t}))},a=null;try{a=new BroadcastChannel(sT),a.onmessage=e=>{let t=e.data;t?.type===`debits`&&t.canonical&&t.qs&&i(t.canonical,t.qs,t.token)}}catch{}let s=t=>{if(!(!t.key||typeof t.newValue!=`string`))for(let n of e){if(!lT(t.key,n))continue;let e=uT(t.key,n);i(n,t.newValue,e);break}};return window.addEventListener(`storage`,s,{passive:!0}),()=>{if(window.removeEventListener(`storage`,s),a&&typeof a.close==`function`)try{a.close()}catch{}}},[We,o,k,E]);let ut=(0,K.useMemo)(()=>k?typeof k.expiresAtPulse==`number`?k.expiresAtPulse:k.pulse+11:null,[k]),dt=(0,K.useMemo)(()=>A==null||ut==null?null:Math.max(0,ut-A),[A,ut]),pt=(0,K.useMemo)(()=>dt===0,[dt]),mt=(0,K.useMemo)(()=>A==null||!k?null:Math.max(0,k.pulse-A),[k,A]),ht=(0,K.useMemo)(()=>A==null||!k?!1:k.pulse>A,[k,A]),gt=k?.chakraDay??`Throat`,_t=k?.stepsPerBeat??44,vt=p(k?.pulse??0,_t),yt=typeof k?.stepPct==`number`?Math.max(0,Math.min(1,k.stepPct)):S(k?.pulse??0),bt=(0,K.useMemo)(()=>`hsl(${((dC[gt]?.hue??180)+(U&&/^[0-9a-f]+$/i.test(U)?parseInt(U.slice(-2),16)%12:0)*2.5)%360} 100% ${50+15*Math.sin(yt*2*Math.PI)}%)`,[gt,yt,U]),xt=dC[gt]?.hue??180,St=(0,K.useMemo)(()=>`qr-${(U||i||`seed`).slice(0,12)}-${gt}-${vt}`,[U,i,gt,vt]),[Ct,wt]=(0,K.useState)(!1),[Tt,Dt]=(0,K.useState)(null);(0,K.useEffect)(()=>{let e=!1;return(async()=>{try{if(!k){Dt(null);return}let t=k.stepsPerBeat??44,n=p(k.pulse,t),r=BC(k),i=zC(k.pulse,k.beat,n,String(k.chakraDay??``),r),a=await FC(i),o=await RC(a),s=typeof k.kaiSignature==`string`?k.kaiSignature.toLowerCase()===a.toLowerCase():!0,c=typeof k.userPhiKey==`string`?k.userPhiKey.toLowerCase()===o.toLowerCase():!0,l={pulse:k.pulse,beat:k.beat,stepsPerBeat:t,stepIndex:n,chakraDay:String(k.chakraDay??``),intention:r??null,sigmaString:i,sigmaHash:a,derivedPhiKey:o,payloadKaiSignature:k.kaiSignature??null,payloadUserPhiKey:k.userPhiKey??null,matches:{sigma:s,phi:c}};e||Dt(l)}catch{e||Dt(null)}})(),()=>{e=!0}},[k]);let Ot=le(()=>{IT({stageEl:document.getElementById(`sigil-stage`),payload:k,localHash:U,routeHash:i,qr:{uid:St,url:Qe,hue:xt,accent:bt},onToast:e=>SC(_,e)})}),[kt,At]=(0,K.useState)(!1),[jt,Mt]=(0,K.useState)(``),Nt=(0,K.useCallback)(async()=>{let e=b.current;e&&(Mt((await(0,dE.default)(e,{backgroundColor:null})).toDataURL(`image/png`)),At(!0),fC()||document.querySelector(`.stargate-overlay`)?.requestFullscreen?.().catch(()=>{}))},[]),Pt=(0,K.useCallback)(()=>{At(!1),document.fullscreenElement&&!fC()&&document.exitFullscreen?.().catch(()=>{})},[]),Ft=le(()=>{Nt()}),It=le(()=>{Pt()}),Lt=le(()=>wt(e=>!e)),Rt=le(()=>Ve(!0)),zt=(0,K.useCallback)(async e=>{let t=await e.arrayBuffer(),n=e.type||`application/octet-stream`,r=`data:${n};base64,${xC(t)}`;F({name:e.name,mime:n,size:e.size,dataUri:r}),SC(_,`Remembered ${e.name}`)},[]),Bt=(0,K.useCallback)((e,t)=>{let n=e.stepsPerBeat??44,r=p(e.pulse,n),a=(e.canonicalHash||U||``).toLowerCase(),o=e.claimExtendUnit,s=RE(o)?o:null,c=e.claimExtendAmount,l=typeof c==`number`?c:null,u=$T({pulse:e.pulse,beat:e.beat,chakraDay:e.chakraDay??`Root`,stepsPerBeat:n,stepIndex:r,userPhiKey:e.userPhiKey??null,kaiSignature:e.kaiSignature??null,canonicalHash:a,transferNonce:e.transferNonce??null,expiresAtPulse:e.expiresAtPulse??null,claimExtendUnit:s,claimExtendAmount:l},t,{localHash:U,routeHash:i,stepsPerBeat:44,stepIndexFromPulse:p})?.url||`/s/${a}`;try{let e=new URL(u,window.location.origin);e.pathname=`/s/${a}`;let t=new URLSearchParams(window.location.search).get(`d`);t&&e.searchParams.set(`d`,t),new URL(window.location.href).searchParams.forEach((t,n)=>{n!==`d`&&e.searchParams.set(n,e.searchParams.get(n)??t)}),u=e.toString()}catch{}let d=new URL(u,window.location.origin);d.pathname=`/s/${a}`,new URL(window.location.href).searchParams.forEach((e,t)=>{t!==`d`&&d.searchParams.set(t,d.searchParams.get(t)??e)});let f=wT(u)||a;return Oe(u),Ae(f),Ee(!0),u},[U,i]),Vt=(0,K.useCallback)((e,t,n=!0)=>{let a=e.stepsPerBeat??44,o=p(e.pulse,a),s=e.claimExtendUnit,c=RE(s)?s:`breaths`,l=e.claimExtendAmount,u=typeof l==`number`?l:11;return eE({pulse:e.pulse,beat:e.beat,chakraDay:e.chakraDay??`Root`,stepsPerBeat:a,stepIndex:o,userPhiKey:e.userPhiKey??null,kaiSignature:e.kaiSignature??null,canonicalHash:t,transferNonce:e.transferNonce??null,expiresAtPulse:e.expiresAtPulse??null,claimExtendUnit:c,claimExtendAmount:u},t,{localHash:U,routeHash:i,stepsPerBeat:44,stepIndexFromPulse:p,getKaiPulseEternalInt:IE,breathsToPulses:ue,shareTransferLink:$T,publishRotation:UE,navigate:e=>{if(n)try{r(e)}catch{try{window.location.href=e}catch{}}}})??null},[U,i,r]),Ht=(0,K.useCallback)(async e=>{if(f(!1),h(`Verifying…`),!(/image\/svg\+xml/i.test(e.type)||/\.svg$/i.test(e.name))){h(`Unsupported file. Upload an SVG sigil (.svg) only.`);return}let t=null;try{let{ok:n,errors:r,payload:i,meta:a}=he(await e.text());if(!n||!i){h(r[0]||`Invalid SVG.`);return}t=i,N(a||{})}catch{h(`Invalid or unreadable SVG uploaded.`);return}if(!k||!t){h(`Load or link a sigil first, then verify stewardship.`);return}if(!Ze(k,t)){h(`File does not match this sealed kairos moment.`),f(!1);return}if(t.canonicalHash){let e=t.canonicalHash.toLowerCase(),n=(U||``).toLowerCase(),r=(i||``).toLowerCase(),a=n&&e===n,o=r&&e===r;if(!a&&!o){h(`SVG canonicalHash doesn’t match this link’s hash.`),f(!1);return}if(o&&!a){Ue({reason:`svg.canonicalHash matched route (legacy)`,matchedHash:e}),u(`authentic`),c(`ok`),Me(`archived`),f(!0),h(`Stewardship verified (legacy SVG). Issuing modern link…`),n&&(Vt({...k},n,!0),h(`Legacy verified. Modern transfer link ready.`));return}}if(new Set([o??void 0,k.transferNonce??void 0,t.transferNonce??void 0,Ne??void 0].filter(e=>!!e)).size>1){h(`This is not the active transfer link for that Φkey.`),f(!1);return}f(!0),h(`Stewardship verified`)},[k,Ze,U,i,o,Ne,Vt]),Ut=le(async()=>{if(I)return;let e=b.current?.querySelector(`svg`),t=k??{},n=RE(t.claimExtendUnit)?t.claimExtendUnit:void 0,r=typeof t.claimExtendAmount==`number`?t.claimExtendAmount:null;await GT({expired:!!pt,exporting:I,setExporting:L,svgEl:e,payload:k?{pulse:k.pulse,beat:k.beat,chakraDay:k.chakraDay??null,stepsPerBeat:k.stepsPerBeat??void 0,stepIndex:k.stepIndex??null,exportedAtPulse:k.exportedAtPulse??null,canonicalHash:k.canonicalHash??null,userPhiKey:k.userPhiKey??null,kaiSignature:k.kaiSignature??null,transferNonce:k.transferNonce??null,expiresAtPulse:k.expiresAtPulse??null,claimExtendUnit:n,claimExtendAmount:r,attachment:k.attachment??null,provenance:k.provenance??null}:null,isFutureSealed:ht,linkStatus:je,setToast:e=>SC(_,e),expiryUnit:B,expiryAmount:ce,localHash:U,routeHash:i,transferToken:o??null,getKaiPulseEternalInt:IE,stepIndexFromPulse:p,STEPS_PER_BEAT:44})}),Wt=(0,K.useCallback)(e=>{let t=typeof e==`string`?e:e?.hash;if(!t)return;let n=t.toLowerCase();de(e=>e===n?e:n)},[]),Gt=D&&!k,Kt=s===`notfound`||s===`error`,qt=k?.pulse??0,Jt=k?.beat??0,Yt=((j??0)/1e3).toFixed(3),Xt=je===`archived`,Zt=d&&!Xt,Qt=(0,K.useMemo)(()=>l===`authentic`&&Xt&&!o&&!!i&&!!U&&i!==U,[l,Xt,o,i,U]);(0,K.useEffect)(()=>{if(!k||l!==`authentic`||s===`mismatch`||s===`error`||s===`notfound`)return;let e=!1;return(async()=>{try{let t=k.stepsPerBeat??44,n=p(k.pulse,t),r=BC(k),i=await FC(zC(k.pulse,k.beat,n,String(k.chakraDay??``),r)),a=typeof k.kaiSignature==`string`?k.kaiSignature.toLowerCase()===i.toLowerCase():!0,o=await RC(i),l=typeof k.userPhiKey==`string`?k.userPhiKey.toLowerCase()===o.toLowerCase():!0;!e&&a&&l&&s!==`verified`&&c(`verified`)}catch{}})(),()=>{e=!0}},[k,l,s,je]),(0,K.useEffect)(()=>{let e=(i||``).toLowerCase(),t=o||null,n=k?.transferNonce||null,r=!!t&&!!n&&t===n&&(ut==null||A==null||A{let e=!0;return(async()=>{if(!k){en(``),nn(``);return}let t=(k.canonicalHash||U||``).toLowerCase(),n=A||PE(),r=await JC(k,t,n,T(n),p(n,k.stepsPerBeat??44));e&&(en(r.ownerPhiKey),nn(r.kaiSig))})(),()=>{e=!1}},[k,U]);let rn=(0,K.useCallback)(async e=>{if(e?.preventDefault?.(),e?.stopPropagation?.(),!k||!U||ht||Xt)return;let t=(k.canonicalHash||U||``).toLowerCase(),n=A||PE(),r=await JC(k,t,n,T(n),p(n,k.stepsPerBeat??44));te(r.ownerPhiKey),re(r.kaiSig),setTimeout(()=>{try{sn()}catch{}},0)},[k,U,ht,Xt]),an=(0,K.useCallback)(e=>{let t=`/${e}`;try{window.location.assign(t)}catch{window.location.href=t}},[]),on=(0,K.useCallback)(async()=>{try{let e=await(await fetch(`/verifier.inline.html`,{cache:`no-store`})).text(),t=new Blob([e],{type:`text/html`}),n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=`verifier.html`,document.body.appendChild(n),n.click(),setTimeout(()=>{URL.revokeObjectURL(n.href),n.remove()},0),SC(_,`Downloading verifier…`)}catch{SC(_,`Download failed`)}},[]);({...Lt});let sn=(0,K.useCallback)(()=>{if(!k)return SC(_,`Nothing to mint`);let e=b.current?.querySelector(`svg`);if(!e)return SC(_,`No Φkey in frame`);if(!U)return SC(_,`Glyph hash not ready yet`);if(je!==`active`)return SC(_,`Archived link — cannot exhale from here`);if(ht)return SC(_,`Opens after the moment—claim unlocks then`);let t=rC(M??{},k.pulse),n=(R||k.userPhiKey||``).trim();if(!n)return SC(_,`Owner ΦKey required`);let r=Math.max(0,Math.floor(ce||0)),a=B===`breaths`?ue(r):fe(r),o=A||PE(),s=o+a,c=U.toLowerCase(),l=crypto.getRandomValues(new Uint32Array(4)).join(``),u=k.stepsPerBeat??44,d=p(k.pulse,u),f=p(o,u),m={...iC(n,z||k.kaiSignature,k,t.length?`transfer`:`mint`,(P??k.attachment)?.name,o),stepIndex:d,atStepIndex:f},h={...k,userPhiKey:n,kaiSignature:z||k.kaiSignature,stepsPerBeat:k.stepsPerBeat??44,attachment:P??k.attachment??void 0,expiresAtPulse:s,canonicalHash:c,transferNonce:l,claimExtendUnit:B,claimExtendAmount:r,provenance:[...t,m]};(async()=>{let t=await FC(zC(h.pulse,h.beat,d,String(h.chakraDay??``),BC(h))),n=await RC(t);h.kaiSignature=t,h.userPhiKey=h.userPhiKey||n;let r=Array.from(new Set([k.canonicalHash,i,U].filter(Boolean).map(e=>e.toLowerCase())));r.length&&UE(r,l),Me(`archived`),Le(FE()+250),pe(e,h),UC(e),E(h),N(h),SC(_,`Sealed & archived`);let a=Bt(h,l)||`/s/${c}`;a=await Fe(h,c,l,a,e),Oe(_E(a)),h.canonicalHash&&UE([h.canonicalHash.toLowerCase()],l),setTimeout(()=>Le(0),0)})()},[k,M,R,z,P,ce,B,U,i,je,ht,Bt]),cn=k,ln=(0,K.useMemo)(()=>xE(cn?.debits??[]),[cn?.debits]),un=(0,K.useMemo)(()=>{let e=(typeof cn?.originalAmount==`number`?cn.originalAmount:qe?.valuePhi??0)-ln;return e>0?e:0},[cn?.originalAmount,qe?.valuePhi,ln]),dn=(cn?.debits?.length??0)>0||typeof cn?.originalAmount==`number`,fn=(0,K.useMemo)(()=>dn?un:Je??qe?.valuePhi??0,[dn,un,Je,qe?.valuePhi]),pn=se,{usdPerPhi:mn,phiPerUsd:hn}=(0,K.useMemo)(()=>{try{let e=w({meta:k||{},nowPulse:A||A,usd:100,currentStreakDays:0,lifetimeUsdSoFar:0},pn);return{usdPerPhi:e.usdPerPhi??0,phiPerUsd:e.phiPerUsd??0}}catch{return{usdPerPhi:0,phiPerUsd:0}}},[k,A,pn]),gn=(fn??0)*(mn||0),_n=(0,K.useCallback)(async()=>{if(!k)return``;let e=k.stepsPerBeat??44,t=p(k.pulse,e);return await RC(k.kaiSignature??await FC(zC(k.pulse,k.beat,t,String(k.chakraDay??``),BC(k))))},[k]),[vn,yn]=(0,K.useState)([]),bn=(0,K.useCallback)(()=>{yn(WE(PT(k??null,U,He),FT(o,k??null)))},[k,U,He,o]);(0,K.useEffect)(()=>{bn();let e=null;try{e=new BroadcastChannel(zE),e.onmessage=e=>{let t=e.data;if(!t||t.type!==`descendants`)return;let n=PT(k??null,U,He),r=FT(o,k??null);!n||!r||t.canonical!==n.toLowerCase()||t.token!==r||Array.isArray(t.list)&&yn(t.list)}}catch{}let t=e=>{if(!e.key||!e.newValue)return;let t=PT(k??null,U,He),n=FT(o,k??null);if(!(!t||!n)&&e.key===BE(t,n))try{let t=JSON.parse(e.newValue||`[]`);Array.isArray(t)&&yn(t)}catch{}};return window.addEventListener(`storage`,t,{passive:!0}),()=>{if(e&&typeof e.close==`function`)try{e.close()}catch{}window.removeEventListener(`storage`,t)}},[k,U,He,o,bn]);let xn=(0,K.useCallback)(async(e,t)=>{if(!k)return null;let n=A||PE(),r=crypto.getRandomValues(new Uint32Array(4)).join(``),i=k.stepsPerBeat??44,a=p(k.pulse,i),s=(U||k.canonicalHash||``).toLowerCase(),c=t??FT(o,k??null),l=Array.isArray(k.lineage)?[...k.lineage]:[],u=(l[l.length-1]?.depth??0)+1,d={token:r,parentToken:c??null,amount:Number(e.toFixed(6)),timestamp:n,depth:u,senderPhiKey:k.userPhiKey??null},f={...k,userPhiKey:void 0,originalAmount:Number(e.toFixed(6)),mintedAtPulse:n,transferNonce:r,expiresAtPulse:n+(B===`breaths`?ue(ce):fe(ce)),claimExtendUnit:B,claimExtendAmount:ce,canonicalHash:s,lineage:[...l,d]},m=await FC(zC(f.pulse,f.beat,a,String(f.chakraDay??``),BC(f))),h=await RC(m);f.kaiSignature=m,f.userPhiKey=h;let g=Bt(f,r)||`/s/${s}`;try{let t=new URL(g,window.location.origin);t.pathname=`/s/${s}`,t.searchParams.set(`d`,pT({originalAmount:f.originalAmount}));let i=NT(t.toString(),f);i=await Fe(f,s,r,i);let a=wT(i)||s;vT(a,hT(new URL(i).searchParams.get(`d`))??{},r);let o=PT(k??null,U,He),l=c??null;if(o&&l){let t=[...WE(o,l),{token:r,parentToken:l,amount:Number(e.toFixed(6)),timestamp:n,depth:1,recipientPhiKey:f.userPhiKey}];GE(o,l,t),KE(o,l,t),yn(t)}return Oe(_E(i)),Ae(a),Ee(!0),i}catch{let e=NT(g||`/s/${s}`,f);return Oe(e),Ae(s),Ee(!0),e||null}},[k,B,ce,U,Bt,He,o]);(0,K.useEffect)(()=>{let e=e=>{if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase();return t===`input`||t===`textarea`||e.isContentEditable},t=t=>{if(t.defaultPrevented||e(t.target))return;let n=t.key.toLowerCase();t.metaKey||t.ctrlKey||t.altKey||(n===`s`?tt():n===`l`?et(Qe,`Link copied`):n===`h`?U&&et(U,`Hash copied`):n===`z`?Ut.onClick?.(new MouseEvent(`click`)):n===`p`?Ot.onClick?.(new MouseEvent(`click`)):n===`g`&&Nt())};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[tt,et,Qe,U,Ut,Ot,Nt]);let Sn=(0,K.useCallback)(e=>{let t=e?.silent??!0;if(!PT(k??null,U,He))return null;let n=FT(o,k??null);if(n)return n;n=crypto.getRandomValues(new Uint32Array(4)).join(``);try{let e=new URL(window.location.href);e.searchParams.set(`t`,n),t?window.history.replaceState(null,``,`${e.pathname}${e.search}${e.hash}`):r(`${e.pathname}${e.search}${e.hash}`,{replace:!0})}catch{}return E(e=>e&&{...e,transferNonce:n}),Me(`active`),n},[k,U,He,o,E,r,Me]),[Cn,wn]=(0,K.useState)(0),Tn=(0,K.useCallback)(async()=>{if(!Zt)return SC(_,`Verify Stewardship first`);if(!k)return SC(_,`No payload`);if(W)return;let e=A||PE(),t=Number(Cn)||0;if(t<=0)return SC(_,`Enter an amount > 0`);let n=PT(k??null,U,He),r=FT(o,k??null);if(r||=Sn({silent:!0})||null,!n||!r)return SC(_,`Link not initialized`);if(Ne&&Ne!==r)return SC(_,`Archived link — cannot exhale from here`);G(!0);let{ok:i,id:a}=vE(n,r,e);if(me.current=a,!i)return G(!1),SC(_,`Another exhale is in progress`);try{let{merged:e}=CT(n,new URLSearchParams(window.location.search),r),i=wE({originalAmount:typeof e.originalAmount==`number`?e.originalAmount:typeof k?.originalAmount==`number`?k.originalAmount:qe?.valuePhi??0,debits:Array.isArray(e.debits)?e.debits:[]});if(t>Math.max(0,(i.originalAmount??0)-xE(i.debits||[]))+fE)return SC(_,`Amount exceeds available`);let a=await _n();if(!a)return SC(_,`Could not derive Φkey`);let o={amount:Number(t.toFixed(6)),nonce:crypto.getRandomValues(new Uint32Array(4)).join(``),recipientPhiKey:a,timestamp:A||PE()};ST(wE({originalAmount:i.originalAmount,debits:[...i.debits??[],o]}),n,r,{broadcast:!0});let{merged:s}=CT(n,new URLSearchParams(window.location.search),r),c=wE(s);if(!(c.debits??[]).some(e=>e.nonce===o.nonce)){SC(_,`Exhale conflicted — try again`);return}E(e=>{if(!e)return e;let t={...e};return t.originalAmount=typeof c.originalAmount==`number`?c.originalAmount:typeof t.originalAmount==`number`?t.originalAmount:qe?.valuePhi??0,t.debits=Array.isArray(c.debits)?c.debits:[],t.totalDebited=xE(t.debits),t}),wn(0),SC(_,`Sent ${AC(o.amount)} Φ`),xn(o.amount,r)}finally{yE(n,r,me.current,A),G(!1)}},[Zt,k,k?.originalAmount,qe?.valuePhi,Cn,Ne,U,He,o,E,_n,xn,wn,W,Sn]),En=Ct||Re||kt||Te||be&&Qt;(0,K.useEffect)(()=>{let e=`bp-open`;return En?document.body.classList.add(e):document.body.classList.remove(e),()=>document.body.classList.remove(e)},[En]);let[Dn,On]=(0,K.useState)(!1),kn=(0,K.useCallback)(()=>{On(!0),window.setTimeout(()=>On(!1),2e3)},[]),An=le(()=>{et(U||``,`Hash copied`)}),jn=le(async()=>{await et(Qe,`Link copied`)&&kn()}),Mn=le(()=>{tt()}),Nn=(0,q.jsxs)(ye,{frameRef:b,children:[!Gt&&!Kt&&k&&(0,q.jsx)(`div`,{id:`sigil-stage`,style:{position:`relative`,width:v,height:v,margin:`0 auto`},children:(0,q.jsx)(ne,{pulse:qt,beat:Jt,stepPct:yt,chakraDay:gt,size:v,hashMode:`deterministic`,origin:``,onReady:Wt})}),Gt&&(0,q.jsx)(`div`,{className:`sp-skeleton`,"aria-hidden":`true`}),Kt&&(0,q.jsx)(`div`,{className:`sp-error`,children:s===`notfound`?`Waiting for SVG upload or ?p= payload.`:`Unable to load sigil.`})]}),Pn=k?.lineage??[],Fn=(0,K.useCallback)((e,t)=>{let n=e=>typeof e==`object`&&!!e,r=e=>{if(typeof t==`string`)return t;if(!n(e))return``;let r=typeof e.reason==`string`?e.reason:``,i=n(e.detail)?e.detail:null,a=i&&typeof i.reason==`string`?i.reason:``;return r||a||``},i=e=>{if(!n(e))return null;let t=e.target;return t instanceof HTMLElement?t:null},a=r(e),o=i(e),s=a===`closeClick`||a===`close-button`||a===`explicit`||a===`close`,c=!!o?.closest?.(`[data-modal-close],[data-close],.sealmoment__close,.sp-modal__close,button[aria-label="Close"],button[aria-label="close"],button[title="Close"]`);if(s||c||e==null&&t==null){Ee(!1),Oe(``),Ae(``);return}},[]);return(0,q.jsxs)(`main`,{className:`sigilpage`,role:`main`,"aria-label":`Kai Sigil Page`,"data-owner-verified":Zt,"data-archived":Xt,"data-old-link":ct?`true`:`false`,"data-version":`v48`,children:[(0,q.jsx)(`div`,{className:`sp-veil`,"aria-hidden":`true`}),(0,q.jsx)(`div`,{className:`sp-veil-stars`,"aria-hidden":`true`}),(0,q.jsx)(`div`,{className:`sp-viewport`,"aria-hidden":!1,children:(0,q.jsxs)(`section`,{className:`sp-shell`,"data-center":!0,children:[(0,q.jsx)(ve,{glyphAuth:l,linkStatus:je,isArchived:Xt,localHash:U,copyHashPress:An}),(l===`authentic`||s===`verified`)&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`style`,{children:` +`;return typeof a==`function`&&a(null,p),p}})),Qw=k(a((e=>{var t=Tw(),n=Jw(),r=Xw(),i=Zw();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))(),1);const $w=1024,eT=2048,tT=1200;function nT(e,t){let n=e.querySelector(`defs`);n||(n=e.ownerDocument.createElementNS(me.SVG_NS,`defs`),e.insertBefore(n,e.firstChild));let r=`ep-neon-glow`;if(!e.querySelector(`#${r}`)){let t=e.ownerDocument.createElementNS(me.SVG_NS,`filter`);t.setAttribute(`id`,r),t.setAttribute(`x`,`-50%`),t.setAttribute(`y`,`-50%`),t.setAttribute(`width`,`200%`),t.setAttribute(`height`,`200%`);let i=e.ownerDocument.createElementNS(me.SVG_NS,`feGaussianBlur`);i.setAttribute(`stdDeviation`,`3`),i.setAttribute(`result`,`b1`);let a=e.ownerDocument.createElementNS(me.SVG_NS,`feGaussianBlur`);a.setAttribute(`in`,`SourceGraphic`),a.setAttribute(`stdDeviation`,`1.2`),a.setAttribute(`result`,`b2`);let o=e.ownerDocument.createElementNS(me.SVG_NS,`feMerge`),s=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);s.setAttribute(`in`,`b1`);let c=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);c.setAttribute(`in`,`b2`);let l=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);l.setAttribute(`in`,`SourceGraphic`),o.appendChild(s),o.appendChild(c),o.appendChild(l),t.appendChild(i),t.appendChild(a),t.appendChild(o),n.appendChild(t)}let i=`ep-gloss-gradient`;if(!e.querySelector(`#${i}`)){let t=e.ownerDocument.createElementNS(me.SVG_NS,`linearGradient`);t.setAttribute(`id`,i),t.setAttribute(`x1`,`0`),t.setAttribute(`y1`,`0`),t.setAttribute(`x2`,`0`),t.setAttribute(`y2`,`1`);let r=e.ownerDocument.createElementNS(me.SVG_NS,`stop`);r.setAttribute(`offset`,`0%`),r.setAttribute(`stop-color`,`rgba(255,255,255,0.15)`);let a=e.ownerDocument.createElementNS(me.SVG_NS,`stop`);a.setAttribute(`offset`,`100%`),a.setAttribute(`stop-color`,`rgba(255,255,255,0.05)`),t.appendChild(r),t.appendChild(a),n.appendChild(t)}let a=`ep-bar-outer-glow`;if(!e.querySelector(`#${a}`)){let r=e.ownerDocument.createElementNS(me.SVG_NS,`filter`);r.setAttribute(`id`,a),r.setAttribute(`x`,`-50%`),r.setAttribute(`y`,`-50%`),r.setAttribute(`width`,`200%`),r.setAttribute(`height`,`200%`);let i=e.ownerDocument.createElementNS(me.SVG_NS,`feFlood`);i.setAttribute(`flood-color`,t),i.setAttribute(`flood-opacity`,`0.5`),i.setAttribute(`result`,`c`);let o=e.ownerDocument.createElementNS(me.SVG_NS,`feComposite`);o.setAttribute(`in`,`c`),o.setAttribute(`in2`,`SourceAlpha`),o.setAttribute(`operator`,`in`),o.setAttribute(`result`,`glow`);let s=e.ownerDocument.createElementNS(me.SVG_NS,`feGaussianBlur`);s.setAttribute(`in`,`glow`),s.setAttribute(`stdDeviation`,`4`),s.setAttribute(`result`,`blurGlow`);let c=e.ownerDocument.createElementNS(me.SVG_NS,`feMerge`),l=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);l.setAttribute(`in`,`blurGlow`);let u=e.ownerDocument.createElementNS(me.SVG_NS,`feMergeNode`);u.setAttribute(`in`,`SourceGraphic`),c.appendChild(l),c.appendChild(u),r.appendChild(i),r.appendChild(o),r.appendChild(s),r.appendChild(c),n.appendChild(r)}return{neonId:`ep-neon-glow`,glossId:`ep-gloss-gradient`,barGlowId:`ep-bar-outer-glow`}}async function rT(e,t){let{accent:n,qrUrl:r}=t,i=(e.getAttribute(`viewBox`)||`0 0 ${e.getAttribute(`width`)||1024} ${e.getAttribute(`height`)||1024}`).trim().split(/\s+/).map(Number),a=i[0]||0,o=i[1]||0,s=i[2]||1024,c=i[3]||1024,l=e.ownerDocument.createElementNS(me.SVG_NS,`g`);l.setAttribute(`data-export-qr`,`1`);let u=Math.min(s,c),d=Math.max(u*.035,18),f=Math.max(u*.1,96),p=await Qw.toDataURL(r,{margin:0,color:{dark:n,light:`#00000000`},scale:8}),m=e.ownerDocument.createElementNS(me.SVG_NS,`image`);m.setAttributeNS(me.XLINK_NS,`xlink:href`,p),m.setAttribute(`href`,p),m.setAttribute(`x`,String(a+d)),m.setAttribute(`y`,String(o+c-f-d)),m.setAttribute(`width`,String(f)),m.setAttribute(`height`,String(f)),m.setAttribute(`preserveAspectRatio`,`xMidYMid meet`),l.appendChild(m),e.appendChild(l)}async function iT(e,t=$w,n){let r=e.cloneNode(!0);if(de(r,t),H(r),G(r,n?.title||`Kairos Sigil-Glyph — Sealed Kairos Moment`,n?.desc||`Deterministic sigil-glyph with sovereign metadata.`),n?.metaOverride){let e=W(r);e.textContent=JSON.stringify(n.metaOverride)}if(r.querySelectorAll(`[data-export-qr="1"],[data-export-pulsebar="1"]`).forEach(e=>e.parentNode?.removeChild(e)),n?.addQR&&await rT(r,n.addQR),n?.addPulseBar){let{accent:e,pulseNumber:i}=n.addPulseBar,{barGlowId:a,neonId:o,glossId:s}=nT(r,e),c=(r.getAttribute(`viewBox`)||`0 0 ${t} ${t}`).split(/\s+/).map(Number),[l,u,d,f]=[c[0]||0,c[1]||0,c[2]||t,c[3]||t],p=r.ownerDocument.createElementNS(me.SVG_NS,`g`);p.setAttribute(`data-export-pulsebar`,`1`);let m=Math.min(d,f),h=Math.max(m*.035,18),g=Math.max(m*.34,320),_=Math.max(m*.085,96),v=Math.max(_*.22,18),y=l+d-g-h,b=u+f-_-h,x=r.ownerDocument.createElementNS(me.SVG_NS,`rect`);x.setAttribute(`x`,String(y)),x.setAttribute(`y`,String(b)),x.setAttribute(`rx`,String(v)),x.setAttribute(`ry`,String(v)),x.setAttribute(`width`,String(g)),x.setAttribute(`height`,String(_)),x.setAttribute(`fill`,`url(#${s})`),x.setAttribute(`stroke`,`rgba(255,255,255,0.16)`),x.setAttribute(`stroke-width`,String(Math.max(1.5,m*.0018))),x.setAttribute(`filter`,`url(#${a})`),p.appendChild(x);let S=r.ownerDocument.createElementNS(me.SVG_NS,`text`);S.setAttribute(`x`,String(y+g/2)),S.setAttribute(`y`,String(b+_/2+Math.max(6,_*.06))),S.setAttribute(`text-anchor`,`middle`),S.setAttribute(`dominant-baseline`,`middle`),S.setAttribute(`fill`,e),S.setAttribute(`filter`,`url(#${o})`),S.setAttribute(`font-weight`,`900`),S.setAttribute(`font-family`,`Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto, Helvetica Neue, Arial`),S.setAttribute(`font-size`,String(Math.floor(_*.46))),S.textContent=i.toLocaleString(),p.appendChild(S),r.appendChild(p)}let i=new XMLSerializer().serializeToString(r),a=i.startsWith(`\n${i}`;return new Blob([a],{type:`image/svg+xml;charset=utf-8`})}async function aT(e,t=$w){let n=URL.createObjectURL(e);try{let e=new Image;await new Promise((t,r)=>{e.onload=()=>t(),e.onerror=r,e.src=n});let r=document.createElement(`canvas`);r.width=t,r.height=t;let i=r.getContext(`2d`);if(!i)throw Error(`Canvas unsupported`);return i.drawImage(e,0,0,t,t),await new Promise((e,t)=>r.toBlob(n=>n?e(n):t(Error(`PNG encode failed`)),`image/png`))}finally{URL.revokeObjectURL(n)}}var oT=()=>{let e=N();return e<=0n?0:e>BigInt(2**53-1)?2**53-1:Number(e)};const sT=`sigil-debits-v1`,cT=(e,t)=>t?`sigil:debits:${e}:t:${t}`:`sigil:debits:${e}`,lT=(e,t)=>e===cT(t)||e.startsWith(`${cT(t)}:t:`),uT=(e,t)=>{let n=`sigil:debits:${t}`;if(e===n)return null;let r=`${n}:t:`;return e.startsWith(r)?e.slice(r.length):void 0};function dT(e){let t=new TextEncoder().encode(e),n=``;for(let e=0;e0&&typeof t.recipientPhiKey==`string`&&t.recipientPhiKey.length>0&&typeof t.amount==`number`&&Number.isFinite(t.amount)&&t.amount>0&&typeof t.timestamp==`number`&&Number.isFinite(t.timestamp)}function hT(e){if(!e)return null;try{let t=JSON.parse(fT(e));if(typeof t!=`object`||!t)return null;let n={},r=t;if(typeof r.originalAmount==`number`&&Number.isFinite(r.originalAmount)&&(n.originalAmount=r.originalAmount),Array.isArray(r.debits)){let e=[];for(let t of r.debits)mT(t)&&e.push(t);e.length&&(n.debits=e)}return n}catch{return null}}function gT(e,t){try{let n=new URL(window.location.href),r=typeof e.originalAmount==`number`&&Number.isFinite(e.originalAmount),i=Array.isArray(e.debits)&&e.debits.length>0;!r&&!i?n.searchParams.delete(`d`):n.searchParams.set(`d`,pT(e));let a=`${n.pathname}${n.search}${n.hash}`;t?.navigate?window.location.replace(a):window.history.replaceState(null,``,a)}catch{}}function _T(e,t){let n=(e||``).toLowerCase();if(!n)return null;try{let e=t?localStorage.getItem(cT(n,t)):null;if(e)return hT(e);let r=localStorage.getItem(cT(n));return r?hT(r):null}catch{return null}}function vT(e,t,n){let r=(e||``).toLowerCase();if(r)try{localStorage.setItem(cT(r,n??null),pT(t))}catch{}}function yT(e){let t=new Set,n=[];for(let r of e)!r||typeof r.nonce!=`string`||t.has(r.nonce)||(t.add(r.nonce),n.push(r));return n.sort((e,t)=>(e.timestamp||0)-(t.timestamp||0))}function bT(e,t){let n={},r=typeof e?.originalAmount==`number`?e.originalAmount:void 0,i=typeof t?.originalAmount==`number`?t.originalAmount:void 0;n.originalAmount=typeof r==`number`?r:typeof i==`number`?i:void 0;let a=Array.isArray(e?.debits)?e.debits:[],o=Array.isArray(t?.debits)?t.debits:[],s=yT([...a,...o]);return s.length&&(n.debits=s),n}function xT(e,t){let n=typeof e?.originalAmount==`number`&&Number.isFinite(e.originalAmount)?Number(e.originalAmount):NaN,r=typeof t?.originalAmount==`number`&&Number.isFinite(t.originalAmount)?Number(t.originalAmount):NaN,i=Number.isNaN(n)&&Number.isNaN(r)||Math.abs(n-r)<1e-12,a=new Set((Array.isArray(e?.debits)?e.debits:[]).map(e=>e?.nonce)),o=new Set((Array.isArray(t?.debits)?t.debits:[]).map(e=>e?.nonce));if(!i||a.size!==o.size)return!1;for(let e of a)if(!o.has(e))return!1;return!0}function ST(e,t,n,r){gT(e,{navigate:!!r?.navigate});let i=(t||``).toLowerCase();if(i&&(vT(i,e,n??null),r?.broadcast!==!1))try{let t=new BroadcastChannel(sT),r={type:`debits`,canonical:i,qs:pT(e),stamp:oT(),token:n??null};t.postMessage(r),t.close()}catch{}}function CT(e,t,n){let r=hT(t.get(`d`)),i=bT(n?_T(e,n):_T(e,null),r);return{merged:i,urlIsStale:!xT(i,r)}}function wT(e){try{let t=new URL(e,window.location.origin).pathname.match(/\/s\/([0-9a-fA-F]+)/);return t?t[1].toLowerCase():null}catch{return null}}function TT(e){if(typeof e==`string`)switch(e.trim().toLowerCase().replace(/\s+/g,` `)){case`root`:return`Root`;case`sacral`:return`Sacral`;case`solar plexus`:case`solarplexus`:return`Solar Plexus`;case`heart`:return`Heart`;case`throat`:return`Throat`;case`third eye`:case`thirdeye`:return`Third Eye`;case`crown`:return`Crown`;default:return}}function ET(e){return e===`breaths`||e===`steps`?e:void 0}var DT=e=>!!e&&typeof e==`object`,OT=e=>{if(!DT(e))return!1;let t=`u`in e&&`b`in e,n=`d`in e;return t||n},kT=e=>typeof e==`number`&&Number.isFinite(e)?e:void 0,AT=e=>typeof e==`string`&&e.trim()?e:void 0;function jT(e){if(!e)return{};try{let t=String(e).trim(),n=!1;/^c:/i.test(t)&&(t=t.slice(2),n=!0);let r=JSON.parse(fT(t));if(n||OT(r)){let e=r,t={},n=kT(e.u),i=kT(e.b),a=kT(e.d),o=kT(e.s),s=TT(e.c);return n!==void 0&&(t.pulse=n),i!==void 0&&(t.beat=i),a!==void 0&&(t.stepsPerBeat=a),o!==void 0&&(t.stepIndex=o),s!==void 0&&(t.chakraDay=s),t}if(DT(r)){let e=r,t={},n=kT(e.pulse),i=kT(e.beat),a=kT(e.stepsPerBeat),o=kT(e.stepIndex),s=TT(e.chakraDay),c=AT(e.canonicalHash),l=AT(e.kaiSignature),u=AT(e.userPhiKey),d=AT(e.transferNonce),f=kT(e.expiresAtPulse),p=ET(e.claimExtendUnit),m=kT(e.claimExtendAmount);return n!==void 0&&(t.pulse=n),i!==void 0&&(t.beat=i),a!==void 0&&(t.stepsPerBeat=a),o!==void 0&&(t.stepIndex=o),s!==void 0&&(t.chakraDay=s),c!==void 0&&(t.canonicalHash=c.toLowerCase()),l!==void 0&&(t.kaiSignature=l),u!==void 0&&(t.userPhiKey=u),d!==void 0&&(t.transferNonce=d),f!==void 0&&(t.expiresAtPulse=f),p!==void 0&&(t.claimExtendUnit=p),m!==void 0&&(t.claimExtendAmount=m),Array.isArray(e.lineage)&&(t.lineage=e.lineage),t}return{}}catch{return{}}}function MT(e,t){let n={...e};typeof t.expiresAtPulse==`number`&&(n.expiresAtPulse=t.expiresAtPulse),t.claimExtendUnit!=null&&(n.claimExtendUnit=t.claimExtendUnit),typeof t.claimExtendAmount==`number`&&(n.claimExtendAmount=t.claimExtendAmount),typeof t.pulse==`number`&&(n.pulse=t.pulse),typeof t.beat==`number`&&(n.beat=t.beat),typeof t.stepsPerBeat==`number`&&(n.stepsPerBeat=t.stepsPerBeat),t.chakraDay!==void 0&&(n.chakraDay=t.chakraDay),t.canonicalHash&&(n.canonicalHash=String(t.canonicalHash).toLowerCase()),t.kaiSignature&&(n.kaiSignature=t.kaiSignature),t.userPhiKey&&(n.userPhiKey=t.userPhiKey),t.transferNonce&&(n.transferNonce=t.transferNonce),Array.isArray(t.lineage)&&(n.lineage=t.lineage);let r=typeof n.stepsPerBeat==`number`&&Number.isFinite(n.stepsPerBeat)?n.stepsPerBeat:44,i=kT(t?.stepIndex),a=kT(n.stepIndex);return i===void 0?a===void 0?typeof n.pulse==`number`&&Number.isFinite(n.pulse)&&(n.stepIndex=p(n.pulse,r)):n.stepIndex=a:n.stepIndex=i,n}function NT(e,t){try{let n=new URL(e,window.location.origin),r=MT(jT(n.searchParams.get(`p`)),t);return r.canonicalHash&&=String(r.canonicalHash).toLowerCase(),n.searchParams.set(`p`,dT(JSON.stringify(r))),n.toString()}catch{return e}}function PT(e,t,n){let r=[e?.canonicalHash,t,n?.matchedHash];for(let e of r)if(typeof e==`string`&&e.trim())return e.toLowerCase();return null}function FT(e,t){return typeof e==`string`&&e.trim()?e:typeof t?.transferNonce==`string`&&t.transferNonce.trim()?t.transferNonce:null}async function IT(t){let{stageEl:n,payload:r,localHash:i,routeHash:a,qr:o,onToast:s}=t;if(!n)return s(`No stage found`);try{let t=(await m(async()=>{let{default:t}=await import(`./html2canvas-B1Qzm3Gx.js`).then(e(1));return{default:t}},__vite__mapDeps([0,1,2,3]))).default,l=await t(n,{backgroundColor:null}),u=document.createElement(`canvas`);u.width=eT,u.height=eT;let d=u.getContext(`2d`);if(!d)throw Error(`No canvas context`);d.clearRect(0,0,u.width,u.height);let f=Math.floor(eT*.06),p=eT-f*2,h=eT-f*2,g=l.width,_=l.height,v=Math.min(p/g,h/_),y=Math.floor(g*v),b=Math.floor(_*v),x=Math.floor((eT-y)/2),S=Math.floor((eT-b)/2);d.drawImage(l,x,S,y,b);let C=r?.chakraDay??`Throat`,w=dC[C]?.accent||`#00FFD0`,T=kC(C,typeof r?.stepPct==`number`?r.stepPct:r?r.pulse%11/11:0,i||void 0),E=Math.max(eT*.33,720),D=Math.max(eT*.08,160),O=Math.max(D*.24,30),k=eT-E-f,A=eT-D-f;d.save(),d.shadowColor=w,d.shadowBlur=Math.max(18,Math.floor(eT*.012));let j=d.createLinearGradient(0,A,0,A+D);j.addColorStop(0,`rgba(255,255,255,0.16)`),j.addColorStop(1,`rgba(255,255,255,0.05)`),c(d,k,A,E,D,O),d.fillStyle=j,d.fill(),d.shadowBlur=0,d.lineWidth=Math.max(2,Math.floor(eT*.0016)),d.strokeStyle=`rgba(255,255,255,0.18)`,d.stroke();let M=(r?.pulse??0).toLocaleString();d.textBaseline=`alphabetic`,d.fillStyle=T,d.font=`900 ${Math.floor(D*.48)}px Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto, Helvetica Neue, Arial`,d.shadowColor=T,d.shadowBlur=Math.max(16,Math.floor(eT*.008));let N=d.measureText(M).width,P=Math.floor(k+E/2-N/2),F=Math.floor(A+D/2+D*.18);d.fillText(M,P,F),d.restore();let I=Math.floor(eT*.32),ee=Math.floor((eT-I)/2),L=Math.floor((eT-I)/2),R=LT({provided:o.url,payload:r,localHash:i,routeHash:a}),te=(0,ZC.renderToStaticMarkup)((0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 1000 1000`,children:(0,q.jsx)(ww,{uid:o.uid,url:R,size:800,phaseHue:o.hue,phaseColor:o.accent,animate:!1,pulseMs:5236})})),z=new Blob([te],{type:`image/svg+xml;charset=utf-8`}),ne=URL.createObjectURL(z);await new Promise((e,t)=>{let n=new Image;n.onload=()=>{try{d.drawImage(n,ee,L,I,I)}finally{URL.revokeObjectURL(ne),e()}},n.onerror=e=>{URL.revokeObjectURL(ne),t(e)},n.src=ne});let re=u.toDataURL(`image/png`),B=document.createElement(`a`);B.href=re,B.download=`sigil_poster_${(i||a||`mint`).slice(0,16)}.png`,document.body.appendChild(B),B.click(),B.remove(),s(`Public key PNG saved`)}catch(e){console.error(e),s(`Poster export failed`)}function c(e,t,n,r,i,a){e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath()}}function LT(e){let{provided:t,payload:n,localHash:r,routeHash:i}=e,a=t&&RT(t)?t:(typeof window<`u`?window.location.href:``)||``;if(!n)return a;try{let e=(n.canonicalHash||r||i||``).toLowerCase();if(!e)return a;let t=new URL(a,typeof window<`u`?window.location.origin:`https://local.test`);t.pathname=`/s/${e}`;let o=n.transferNonce||t.searchParams.get(`t`);o&&t.searchParams.set(`t`,o);let s=`${t.pathname}${t.search}${t.hash}`;return NT(s,n)||s}catch{return a}}function RT(e){try{let t=new URL(e,typeof window<`u`?window.location.origin:`https://local.test`);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function zT(e){let t=JSON.stringify(e);return btoa(unescape(encodeURIComponent(t))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function BT(e,t,n){let r=new URL(e,typeof window<`u`?window.location.origin:`http://localhost`);return r.searchParams.set(`p`,zT(t)),n&&r.searchParams.set(`t`,n),r.toString()}function VT(e){switch(String(e??``).trim().toLowerCase()){case`root`:return`Root`;case`sacral`:return`Sacral`;case`solar plexus`:case`solar_plexus`:case`solar-plexus`:return`Solar Plexus`;case`heart`:return`Heart`;case`throat`:return`Throat`;case`third eye`:case`third_eye`:case`third-eye`:return`Third Eye`;case`crown`:return`Crown`;default:return`Root`}}function HT(e,t){let n={pulse:e.pulse,beat:e.beat,chakraDay:VT(e.chakraDay),stepsPerBeat:e.stepsPerBeat??void 0,stepIndex:t,userPhiKey:e.userPhiKey??void 0,kaiSignature:e.kaiSignature??void 0,canonicalHash:e.canonicalHash??void 0,transferNonce:e.transferNonce??void 0,expiresAtPulse:e.expiresAtPulse??void 0,claimExtendUnit:e.claimExtendUnit??void 0,claimExtendAmount:e.claimExtendAmount??void 0,attachment:e.attachment??void 0,provenance:e.provenance??void 0};return Object.keys(n).forEach(e=>{n[e]===void 0&&delete n[e]}),n}function UT(e){return{pulse:e.pulse,beat:e.beat,stepIndex:e.stepIndex,chakraDay:VT(e.chakraDay),stepsPerBeat:e.stepsPerBeat??void 0,userPhiKey:e.userPhiKey??void 0,kaiSignature:e.kaiSignature??void 0}}function WT(e,t){e.setAttribute(`data-share-url`,t),e.querySelectorAll(`a`).forEach(e=>{e.setAttribute(`href`,t);try{e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,t)}catch{}});let n=/\bu=([^·\n\r]+?)(?=\s*·|$)/;e.querySelectorAll(`text`).forEach(e=>{let r=e.textContent||``;n.test(r)&&(e.textContent=r.replace(n,`u=${t}`))})}async function GT(e){let{expired:t,exporting:n,setExporting:r,svgEl:i,payload:a,isFutureSealed:o,linkStatus:c,setToast:l,expiryUnit:u,expiryAmount:d,localHash:f,routeHash:p,transferToken:h,getKaiPulseEternalInt:g,stepIndexFromPulse:_,STEPS_PER_BEAT:v}=e;if(t)return SC(l,`Seal window closed`);if(!n){if(!i)return SC(l,`No SVG found`);if(!a)return SC(l,`No payload`);if(o)return SC(l,`Opens after the moment—claim unlocks then`);if(c!==`active`)return SC(l,`Archived link — cannot claim from here`);try{r(!0);let e=`sigil_${(f||p||`mint`).slice(0,16)}`,t=a.stepsPerBeat??v,n=_(a.pulse,t),o=g(new Date),c=_(o,t),y=HT(a,n),b={...iC(a.userPhiKey||``,a.kaiSignature??void 0,y,`claim`,a.attachment?.name??void 0,o),stepIndex:n,atStepIndex:c},x={...a,exportedAtPulse:o,stepIndex:n,stepsPerBeat:t,provenance:[...a.provenance??[],b],claimExtendUnit:a.claimExtendUnit??u,claimExtendAmount:a.claimExtendAmount??d,canonicalHash:(f||a.canonicalHash||p||null)?.toString()??null},S=await FC(zC(x.pulse,x.beat,n,String(x.chakraDay??``),BC(HT(x,n)))),C=await RC(S),w={...x,kaiSignature:S,userPhiKey:x.userPhiKey||C},T=(f||p||``).toLowerCase(),E=UT({pulse:w.pulse,beat:w.beat,stepIndex:n,chakraDay:w.chakraDay??null,stepsPerBeat:t,userPhiKey:w.userPhiKey??null,kaiSignature:w.kaiSignature??null}),D=BT(s(T,E),E,w.transferNonce??h??void 0),{putMetadata:O}=await m(async()=>{let{putMetadata:e}=await import(`./svgMeta-BZGc61ho.js`);return{putMetadata:e}},__vite__mapDeps([4,5,2,3])),k={...w,stepsPerBeat:t,shareUrl:D,fullUrl:D};O(i,k);try{i.setAttribute(`data-step-index`,String(n));let e=i.querySelector(`metadata#sigil-display`);e||(e=document.createElementNS(`http://www.w3.org/2000/svg`,`metadata`),e.setAttribute(`id`,`sigil-display`),e.setAttribute(`data-noncanonical`,`1`),i.appendChild(e)),e.textContent=JSON.stringify({stepIndex:n,stepsPerBeat:t})}catch{console.debug(`Display metadata write failed`)}KC(i,w.pulse,w.beat,n),UC(i),WT(i,D);let A=null,j=null;try{let e=new URL(D);A=e.searchParams.get(`p`),j=e.searchParams.get(`t`)}catch{console.debug(`URL parse failed`)}let M=await iT(i,$w,{metaOverride:k,addQR:!1,addPulseBar:!1,title:`Kairos Sigil-Glyph — Sealed KairosMoment`,desc:`Deterministic sigil-glyph with sovereign metadata. Exported as archived key.`}),N=await aT(M,$w),P=new(await(CC()));P.file(`${e}.svg`,M),P.file(`${e}.png`,N);let F={hash:f||p||``,canonicalHash:w.canonicalHash??null,pulse:w.pulse,beat:w.beat,stepIndex:n,atStepIndex:c,chakraDay:w.chakraDay??null,userPhiKey:w.userPhiKey??null,kaiSignature:w.kaiSignature??null,transferNonce:w.transferNonce??null,expiresAtPulse:w.expiresAtPulse??null,exportedAtPulse:w.exportedAtPulse??null,claimedAtPulse:o,overlays:{qr:!1,eternalPulseBar:!1},claimExtendUnit:w.claimExtendUnit??null,claimExtendAmount:w.claimExtendAmount??null,fullUrl:D,p:A,urlQuery:{p:A,t:j}};P.file(`${e}.manifest.json`,JSON.stringify(F,null,2));let I=await P.generateAsync({type:`blob`}),ee=URL.createObjectURL(I),L=document.createElement(`a`);L.href=ee,L.download=`${e}.zip`,document.body.appendChild(L),L.click(),L.remove(),requestAnimationFrame(()=>URL.revokeObjectURL(ee)),SC(l,`Access key generated`)}catch(e){console.error(e),SC(l,`Claim failed`)}finally{r(!1)}}}function KT(){return(0,K.useMemo)(()=>async e=>{let t=new TextEncoder().encode(e),n=await crypto.subtle.digest(`SHA-256`,t);return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,`0`)).join(``)},[])}function qT({payload:e,urlSearchParams:n,currentPulse:r}){let[a,s]=(0,K.useState)(null),[u,p]=(0,K.useState)(null),[m,g]=(0,K.useState)(null),v=(0,K.useRef)(null),y=(0,K.useRef)(null),b=KT(),x=n?.get(`vpol`)??``;(0,K.useEffect)(()=>{let t=!0;return(async()=>{if(!e||!Number.isFinite(r??NaN)){if(!t)return;s(e=>e===null?e:null),p(e=>e===null?e:null),g(e=>e===null?e:null),v.current=null,y.current=null;return}let{seal:n}=await ae({pulse:e.pulse,kaiPulse:e.pulse,beat:e.beat,stepIndex:e.stepIndex,stepsPerBeat:e.stepsPerBeat,seriesSize:e.seriesSize,quality:e.quality,creatorVerified:e.creatorVerified,creatorRep:e.creatorRep,frequencyHz:e.frequencyHz,chakraDay:e.chakraDay,chakraGate:e.chakraGate,transfers:e.transfers,cumulativeTransfers:e.cumulativeTransfers,segments:e.segments,segmentsMerkleRoot:e.segmentsMerkleRoot,transfersWindowRoot:e.transfersWindowRoot,ip:e.ip,kaiSignature:e.kaiSignature,userPhiKey:e.userPhiKey,valuationPolicyId:x||void 0},r,b);if(!t)return;y.current!==n.stamp&&(s(e=>e&&e.stamp===n.stamp?e:n),y.current=n.stamp);let i=n.valuePhi,a=v.current;a!==i&&(p(e=>e===i?e:i),a!=null&&Math.abs(i-a)>1e-9?g(e=>e===`up`&&i>a?e:i>a?`up`:`down`):g(e=>e===null?e:null),v.current=i)})(),()=>{t=!1}},[e,r,x,b]);let S=(0,K.useMemo)(()=>e?.pulse,[e]),C=(0,K.useMemo)(()=>Number.isFinite(S??NaN)?{score:j(S),lines:i(S)}:{score:null,lines:[]},[S]),w=(0,K.useMemo)(()=>{if(!Number.isFinite(S??NaN)||!Number.isFinite(r??NaN))return null;let t=a?.inputs?.pulsesPerBeat?Math.max(1,Math.round(a.inputs.pulsesPerBeat/11)):e?.stepsPerBeat??44,n=a?.inputs?.cadenceRegularity??1,i=a?.inputs?.resonancePhi??.5,s=e?.stepIndex;return o(S,r,{stepsPerBeat:t,cadenceRegularity:n,resonancePhi:i,stepIndexClaimOverride:s})},[S,r,a,e]),T=(0,K.useMemo)(()=>{let t=e?.transfers;return!t||!t.length?[`No closed transfers yet — lineage still forming.`]:_(t,{stepsPerBeat:e?.stepsPerBeat??44})},[e]);return{valSeal:a,livePrice:u,priceFlash:m,rarity:C,oscillation:w,lineageNarrative:T,trust:(0,K.useMemo)(()=>a?B(a.inputs):null,[a]),marketTier:(0,K.useMemo)(()=>Number.isFinite(S??NaN)?h(S,a??void 0):null,[S,a]),kairos:(0,K.useMemo)(()=>Number.isFinite(r??NaN)?{window:l(r,144,1,{stepsPerBeat:e?.stepsPerBeat??44})}:{window:[]},[r,e]),visuals:(0,K.useMemo)(()=>{if(!a||!Number.isFinite(S??NaN))return{spiralSVG:null,scrollSVG:null,scrollText:null,scrollHTML:null};let e=t(S),{scrollSVG:n,scrollText:r}=f(a,{title:`Kai-Sigil Valuation Scroll`});return{spiralSVG:e,scrollSVG:n,scrollText:r,scrollHTML:A(a,{title:`Kai-Sigil Valuation Scroll`})}},[a,S]),audio:(0,K.useMemo)(()=>{if(!Number.isFinite(S??NaN))return{dataURI:null,renderWav:void 0};let{dataURI:e}=c(S,2,44100,{stereo:!0});return{dataURI:e,renderWav:(e=2,t=44100,n)=>c(S,e,t,n)}},[S]),motifSimilarityWith:(0,K.useMemo)(()=>e=>!Number.isFinite(e??NaN)||!Number.isFinite(S??NaN)?null:d(S,e),[S]),helpers:(0,K.useMemo)(()=>({explainRarity:()=>C.lines,explainLineage:()=>T,scanKairos:(t,n,r=1,i)=>l(t,n,r,{stepsPerBeat:i??e?.stepsPerBeat??44}),makeScroll:e=>a?f(a,{title:e??`Kai-Sigil Valuation Scroll`}):null,makeScrollHTML:e=>a?A(a,{title:e}):null,makeSpiral:e=>Number.isFinite(e??S)?t(e??S):null}),[C.lines,T,e,a,S])}}function JT(e){let{stageId:t,payload:n,localHash:r,setOgImgUrl:i,setMeta:a,seoTitle:o,seoDesc:s}=e,c=!1,l=null,u=async()=>{let e=document.getElementById(t);if(!e||!n){i(null),a(`property`,`og:image`,``),a(`property`,`og:image:alt`,``),a(`property`,`og:image:width`,``),a(`property`,`og:image:height`,``),a(`name`,`twitter:image`,``);return}try{let t=n.chakraDay??`Throat`,l=dC[t]?.accent||`#00FFD0`,u=n.pulse||0,f=n.stepsPerBeat??44,p=Math.floor(n.pulse%(f*11)/11),m=kC(t,typeof n.stepPct==`number`?n.stepPct:n.pulse%11/11,r||void 0),h=`Pulse ${u.toLocaleString()} • Beat ${n.beat}/36 • Step ${p+1}/${f} • ${t}`,g=await(0,ge.default)(e),_=document.createElement(`canvas`);_.width=tT,_.height=630;let v=_.getContext(`2d`);if(!v)throw Error(`Canvas unsupported`);let y=v.createLinearGradient(0,0,tT,630);y.addColorStop(0,`rgba(0,0,0,0.92)`),y.addColorStop(1,`rgba(0,0,0,0.70)`),v.fillStyle=y,v.fillRect(0,0,tT,630),v.save(),v.globalCompositeOperation=`lighter`;let b=v.createRadialGradient(tT*.8,630*.2,20,tT*.8,630*.2,600);b.addColorStop(0,`${l}CC`),b.addColorStop(1,`rgba(0,0,0,0)`),v.fillStyle=b,v.beginPath(),v.arc(tT*.8,630*.2,600,0,Math.PI*2),v.fill(),v.restore();let x=Math.floor(tT*.52),S=Math.min(x/g.width,558/g.height),C=Math.floor(g.width*S),w=Math.floor(g.height*S),T=36+Math.floor((x-C)/2),E=36+Math.floor((558-w)/2);v.drawImage(g,T,E,C,w);let D=36+x+32,O=tT-D-36;v.fillStyle=`#EAFBFF`,v.font=`700 38px Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto`,v.fillText(`Kairos Sigil-Glyph — Sealed Kairos Moment`,D,94),v.fillStyle=`rgba(255,255,255,0.82)`,v.font=`400 24px Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto`,d(v,`“${o}” — ${s}`,D,136,O,30);let k=`${u.toLocaleString()}`;v.textBaseline=`alphabetic`,v.font=`900 120px Inter, ui-sans-serif, -apple-system, Segoe UI, Roboto`,v.shadowColor=m,v.shadowBlur=20,v.fillStyle=m;let A=v.measureText(k).width,j=D+Math.floor((O-A)/2);v.fillText(k,j,554),v.shadowBlur=0;let M=_.toDataURL(`image/png`);if(c)return;i(M),a(`property`,`og:image`,M),a(`property`,`og:image:alt`,h),a(`property`,`og:image:type`,`image/png`),a(`property`,`og:image:width`,`1200`),a(`property`,`og:image:height`,`630`),a(`name`,`twitter:image`,M)}catch{if(c)return;i(null)}};return l=wC(()=>{c||u()}),()=>{c=!0,l!=null&&TC(l)};function d(e,t,n,r,i,a){let o=t.split(` `),s=``;for(let t=0;ti&&t>0?(e.fillText(s,n,r),s=o[t]+` `,r+=a):s=c}e.fillText(s.trim(),n,r)}}function YT(e){switch(String(e??``).trim().toLowerCase()){case`root`:case`earth`:case`earth gate`:return`Root`;case`sacral`:return`Sacral`;case`solar plexus`:case`solar_plexus`:case`solar-plexus`:return`Solar Plexus`;case`heart`:return`Heart`;case`throat`:return`Throat`;case`third eye`:case`third_eye`:case`third-eye`:return`Third Eye`;case`crown`:return`Crown`;default:return`Root`}}function XT(){return crypto.getRandomValues(new Uint32Array(4)).join(``)}function ZT(e){let{meta:t,stepIndex:n,stepsPerBeat:r}=e;return{pulse:t.pulse,beat:t.beat,stepIndex:n,chakraDay:YT(t.chakraDay),stepsPerBeat:r,userPhiKey:t.userPhiKey??void 0,kaiSignature:t.kaiSignature??void 0}}function QT(e,t,n){let r=e.stepIndex;return typeof r==`number`&&Number.isFinite(r)&&r>=0&&rNumber(N()/1000n),rE=e=>JSON.stringify({canonicalHash:e.canonicalHash,token:e.token,expiresAtPulse:e.expiresAtPulse,issuedAt:e.issuedAt,version:e.version},tE),iE=e=>btoa(String.fromCharCode(...e)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``);const aE=e=>iE(new TextEncoder().encode(rE(e)));async function oE(e){try{let t=await fetch(`/api/sign-claim`,{method:`POST`,headers:{"content-type":`text/plain;charset=UTF-8`},body:rE(e)});if(!t.ok)return null;let n=await t.json();return!n||!n.s||!n.kid?null:{r:n.r??aE(e),s:n.s,kid:n.kid}}catch{return null}}function sE(e,t,n,r){e.searchParams.set(`r`,t),e.searchParams.set(`s`,n),e.searchParams.set(`kid`,r)}function cE(e,t,n,r){pe(e,{registryClaim:aE(t),registrySig:n,registryKid:r})}function lE(e,t,n){return{canonicalHash:t.toLowerCase(),token:n,expiresAtPulse:e.expiresAtPulse??null,issuedAt:nE(),version:1}}function uE(){if(typeof window>`u`||typeof document>`u`){let e=()=>{},t=()=>{};return{openModal:t,closeModal:t,disable:e,teardown:e,destroy:e}}let e=document,t=e.body,n=[`.sp-breathproof__backdrop`,`.stargate-overlay`,`.valuechart-backdrop`,`.sp-modal`,`.ownership-overlay`],r={".sp-breathproof__backdrop":`.sp-breathproof`,".valuechart-backdrop":`.valuechart`,".ownership-overlay":`.ownership-panel`,".stargate-overlay":`.stargate-content, .stargate-frame, .stargate__content`,".sp-modal":`.sp-modal__content, .sp-modal__card, .sp-card`},i={capture:!0,passive:!1},a={capture:!0},o=0,s=0,c=0,l=``,u=``,d=``,f=``,p=``,m=()=>{o===0&&(s=window.scrollY||e.documentElement.scrollTop||0,c=window.scrollX||e.documentElement.scrollLeft||0,l=t.style.top,u=t.style.left,d=t.style.width,f=t.style.position,p=t.style.overflow,t.style.position=`fixed`,t.style.top=`-${s}px`,t.style.left=`-${c}px`,t.style.width=`100%`,t.style.overflow=`hidden`,t.classList.add(`modal-open`,`bp-open`)),o++},h=()=>{o=Math.max(0,o-1),!(o>0)&&(t.style.position=f,t.style.top=l,t.style.left=u,t.style.width=d,t.style.overflow=p,requestAnimationFrame(()=>{window.scrollTo(c,s)}),t.classList.remove(`modal-open`),t.classList.remove(`bp-open`))},g=e=>{if(!e)return!1;let t=window.getComputedStyle(e);return!(t.display===`none`||t.visibility===`hidden`||e.hasAttribute(`hidden`))},_=()=>{let t=[];return n.forEach(n=>{e.querySelectorAll(n).forEach(e=>{g(e)&&t.push(e)})}),t},v=t=>{if(!t)return null;let r=t;for(;r&&r!==e.documentElement;){for(let e of n)if(r.matches(e))return r;r=r.parentElement}return null},y=(e,t)=>{if(!e||!t)return!1;let i=n.find(t=>e.matches(t))||``,a=i?r[i]:``;return a&&e.querySelector(a)?!t.closest(a):t===e},b=()=>{_().length>0?m():h()},x=e=>{e&&(e.classList.add(`is-open`),e.removeAttribute(`hidden`),b())},S=e=>{e&&(e.classList.remove(`is-open`),e.setAttribute(`hidden`,``),b())},C=e=>{let t=e.target;if(!t)return;let n=t.closest(`.sp-breathproof__close, .stargate-exit, .sp-modal__close, .sealmoment__close, [data-modal-close], [data-dismiss="modal"], button[aria-label="Close"], button[aria-label="close"]`);if(n){let t=v(n);t&&(S(t),e.preventDefault(),e.stopPropagation());return}let r=v(t);if(r&&y(r,t)&&r.getAttribute(`data-backdrop-dismiss`)!==`false`){S(r),e.preventDefault(),e.stopPropagation();return}},w=e=>{if(_().length===0)return;let t=e.target;if(!t)return;let n=t.closest(`[data-scroll], .sp-breathproof, .valuechart, .ownership-panel, .sp-modal__content, .sp-card, .stargate-content`);if(!n){e.preventDefault(),e.stopPropagation();return}if(!(n.scrollHeight>n.clientHeight)){e.preventDefault(),e.stopPropagation();return}},T=e=>{if(e.key!==`Escape`)return;let t=_();if(t.length===0)return;let n=t[t.length-1];n.getAttribute(`data-escape-dismiss`)!==`false`&&(S(n),e.preventDefault(),e.stopPropagation())};e.addEventListener(`click`,C,i),e.addEventListener(`pointerup`,C,i),e.addEventListener(`touchend`,C,i),e.addEventListener(`touchmove`,w,i),e.addEventListener(`keydown`,T,i),b();let E=()=>{e.removeEventListener(`click`,C,a),e.removeEventListener(`pointerup`,C,a),e.removeEventListener(`touchend`,C,a),e.removeEventListener(`touchmove`,w,a),e.removeEventListener(`keydown`,T,a);try{o=1,h()}catch{}};return{openModal:x,closeModal:S,disable:E,teardown:E,destroy:E}}var dE=k(ce(),1),fE=1e-9,pE=`sigil-sendlock-v1`,mE=(e,t)=>`sigil:sendlock:${e}:t:${t}`,hE=3,gE={"--phi-url":`url(/assets/phi.svg)`},_E=e=>{try{return new URL(e,window.location.origin).toString()}catch{return e}},vE=(e,t,n)=>{let r=crypto.getRandomValues(new Uint32Array(4)).join(``);if(!e||!t)return{ok:!1,id:r};let i=mE(e.toLowerCase(),t);try{let a=localStorage.getItem(i),o=a?JSON.parse(a):null,s=!o||!Number.isFinite(o.atPulse)||n-o.atPulse>hE;if(!o||s){localStorage.setItem(i,JSON.stringify({id:r,atPulse:n}));try{let i=new BroadcastChannel(pE),a={type:`lock`,canonical:e.toLowerCase(),token:t,id:r,atPulse:n};i.postMessage(a),i.close()}catch{}return{ok:!0,id:r}}}catch{}return{ok:!1,id:r}},yE=(e,t,n,r)=>{if(!e||!t)return;let i=mE(e.toLowerCase(),t);try{let a=localStorage.getItem(i),o=a?JSON.parse(a):null;if(!o||o.id===n){localStorage.removeItem(i);try{let i=new BroadcastChannel(pE),a={type:`unlock`,canonical:e.toLowerCase(),token:t,id:n,atPulse:r};i.postMessage(a),i.close()}catch{}}}catch{}},bE=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.amount==`number`&&Number.isFinite(t.amount)&&t.amount>0&&typeof t.nonce==`string`&&t.nonce.length>0&&typeof t.timestamp==`number`&&Number.isFinite(t.timestamp)&&(typeof t.recipientPhiKey==`string`||t.recipientPhiKey===void 0)},xE=e=>{if(!Array.isArray(e))return 0;let t=0;for(let n of e)bE(n)&&(t+=n.amount);return t},SE=e=>[...e].sort((e,t)=>{let n=(e.timestamp||0)-(t.timestamp||0);return n===0?e.nonce.localeCompare(t.nonce):n}),CE=e=>{let t=new Set,n=[];for(let r of e)bE(r)&&(t.has(r.nonce)||(t.add(r.nonce),n.push(r)));return n},wE=e=>{let t=typeof e.originalAmount==`number`&&Number.isFinite(e.originalAmount)?e.originalAmount:NaN,n=SE(Array.isArray(e.debits)?CE(e.debits):[]);if(!Number.isFinite(t))return{originalAmount:e.originalAmount,debits:n.length?n:void 0};let r=[],i=0;for(let e of n)bE(e)&&i+e.amount<=t+fE&&(r.push(e),i+=e.amount);return{originalAmount:t,debits:r.length?r:void 0}},TE=1000000n,EE=91536000n,DE=17491270421n,OE=e=>e<0n?-e:e,kE=(e,t)=>{let n=e/t,r=e%t*2n;return rt?n+1n:n%2n==0n?n:n+1n},AE=(e,t)=>{if(t<=0n)throw Error(`divRoundTiesToEven: den must be > 0`);return e===0n?0n:(e<0n?-1n:1n)*kE(OE(e),t)},jE=e=>AE(e*EE,DE),ME=e=>{let t=jE(e);return BigInt(x)+t},NE=e=>AE((e-BigInt(x))*DE,EE),PE=()=>{let e=N();return Number(e/TE)},FE=()=>{let e=ME(N());return Number(e)},IE=e=>{let t=NE(BigInt(e.getTime()));return Number(t/TE)};function LE(){let[e,t]=(0,K.useState)(()=>PE()),[n,r]=(0,K.useState)(0);return(0,K.useEffect)(()=>{let e=!0,n=null,i=()=>{if(!e)return;let a=N(),o=Number(a/TE),s=a%TE,c=jE(s===0n?TE:TE-s),l=Number(c);t(o),r(l);let u=Math.max(1,Math.min(6e4,l));n=window.setTimeout(i,u)};return i(),()=>{e=!1,n!=null&&window.clearTimeout(n)}},[]),{pulse:e,msToNextPulse:n}}var RE=e=>e===`breaths`||e===`steps`,zE=`sigil-lineage-v1`,BE=(e,t)=>t?`sigil:desc:${e}:t:${t}`:`sigil:desc:${e}`,VE=`sigil-xfer-v1`,HE=e=>`sigil:rotated:${e}`,UE=(e,t)=>{Array.from(new Set(e.map(e=>e.toLowerCase()).filter(Boolean))).forEach(e=>{try{localStorage.setItem(HE(e),`${t}@${FE()}`)}catch{}try{let n=new BroadcastChannel(VE);n.postMessage({type:`rotated`,canonical:e,token:t}),n.close()}catch{}try{window.dispatchEvent(new CustomEvent(`sigil:transfer-rotated`,{detail:{canonical:e,token:t}}))}catch{}})};function WE(e,t){let n=(e||``).toLowerCase();if(!n||!t)return[];try{let e=localStorage.getItem(BE(n,t));if(!e)return[];let r=JSON.parse(e);return Array.isArray(r)?r:[]}catch{return[]}}function GE(e,t,n){let r=(e||``).toLowerCase();if(!(!r||!t))try{localStorage.setItem(BE(r,t),JSON.stringify(n||[]))}catch{}}function KE(e,t,n){try{let r=new BroadcastChannel(zE),i={type:`descendants`,canonical:e.toLowerCase(),token:t,list:n,stamp:FE()};r.postMessage(i),r.close()}catch{}}function qE(){let{hash:e}=ie(),t=oe(),r=C(),i=(e??``).toLowerCase(),a=(0,K.useMemo)(()=>new URLSearchParams(t.search),[t.search]),o=a.get(`t`),[s,c]=(0,K.useState)(`checking`),[l,u]=(0,K.useState)(`checking`),[d,f]=(0,K.useState)(!1),[m,h]=(0,K.useState)(`Awaiting Proof Of Breath™`),[g,_]=(0,K.useState)(``),[v,y]=(0,K.useState)(320),b=(0,K.useRef)(null),{payload:x,setPayload:E,loading:D,setLoading:O}=yC(t.search),k=x,{pulse:A,msToNextPulse:j}=LE(),[M,N]=(0,K.useState)(null),[P,F]=(0,K.useState)(null),[I,L]=(0,K.useState)(!1),[R,te]=(0,K.useState)(``),[z,re]=(0,K.useState)(``),[B,ae]=(0,K.useState)(`breaths`),[ce,H]=(0,K.useState)(44),[U,de]=(0,K.useState)(``),[W,G]=(0,K.useState)(!1),me=(0,K.useRef)(``),ge=(0,K.useMemo)(()=>i?`sigil:legacy-upgraded:${i}`:``,[i]),[be,xe]=(0,K.useState)(!1),[Se,Ce]=(0,K.useState)(!1);(0,K.useEffect)(()=>{if(ge)try{Ce(localStorage.getItem(ge)===`1`)}catch{}},[ge]);let we=(0,K.useCallback)(()=>{if(ge){try{localStorage.setItem(ge,`1`)}catch{}Ce(!0),SC(_,`Upgraded — legacy link locked`)}},[ge]),[Te,Ee]=(0,K.useState)(!1),[De,Oe]=(0,K.useState)(``),[ke,Ae]=(0,K.useState)(``),[je,Me]=(0,K.useState)(`checking`),[Ne,Pe]=(0,K.useState)(null);(0,K.useEffect)(()=>{let e=Array.from(new Set([k?.canonicalHash,i,U].filter(Boolean).map(e=>e.toLowerCase())));if(e.length===0)return;let t=()=>{let t=null;try{for(let n of e){let e=localStorage.getItem(HE(n)),r=e?String(e).split(`@`)[0]:null;if(r){t=r;break}}}catch{}Pe(t)};t();let n=null;try{n=new BroadcastChannel(VE),n.onmessage=t=>{let n=t.data;if(n?.type===`rotated`){let t=(n.canonical||``).toLowerCase();e.includes(t)&&Pe(n.token||null)}}}catch{}let r=n=>{if(n.key){for(let r of e)if(n.key===HE(r)){t();break}}};return window.addEventListener(`storage`,r,{passive:!0}),()=>{if(window.removeEventListener(`storage`,r),n&&typeof n.close==`function`)try{n.close()}catch{}}},[k?.canonicalHash,i,U]);let Fe=(0,K.useCallback)(async(e,t,n,r,i)=>{try{let a=lE(e,t,n),o=await oE(a);if(!o)return r;let s=new URL(r,window.location.origin);return sE(s,o.r,o.s,o.kid),i&&cE(i,a,o.s,o.kid),s.toString()}catch{return r}},[]);(0,K.useEffect)(()=>{let e=null;try{e=new BroadcastChannel(pE),e.onmessage=()=>{}}catch{}return()=>{if(e&&typeof e.close==`function`)try{e.close()}catch{}}},[]),(0,K.useEffect)(()=>{let e=uE();return()=>{e.destroy?.(),e.teardown?.(),e.disable?.()}},[]);let[Ie,Le]=(0,K.useState)(0),[Re,Ve]=(0,K.useState)(!1),[He,Ue]=(0,K.useState)(null),We=(0,K.useMemo)(()=>{let e=[k?.canonicalHash,U,M?.canonicalHash,He?.matchedHash].filter(Boolean).map(e=>e.toLowerCase());return Array.from(new Set(e))},[k?.canonicalHash,U,M?.canonicalHash,He]);(0,K.useLayoutEffect)(()=>{qC()},[]),(0,K.useEffect)(()=>{let e=dC[k?.chakraDay??`Throat`]??{hue:180,accent:`#00FFD0`},t=document.querySelector(`.sigilpage`);t&&(t.style.setProperty(`--crystal-hue`,String(e.hue)),t.style.setProperty(`--crystal-accent`,e.accent))},[k?.chakraDay]);let[Ge,Ke]=(0,K.useState)(null),{valSeal:qe,livePrice:Je,priceFlash:Ye}=qT({payload:k,urlSearchParams:a,currentPulse:A,routeHash:i}),Xe=a.get(`h`)??``;(0,K.useEffect)(()=>{if(!Xe){Ke(e=>e===null?e:null);return}try{let e=n(jC(Xe.trim()));Ke(t=>Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)}catch{Ke(e=>e===null?e:null)}},[Xe]);let Ze=(0,K.useCallback)((e,t)=>{let n=e.stepsPerBeat??44,r=t.stepsPerBeat??44,i=p(e.pulse,n),a=p(t.pulse,r);return e.pulse===t.pulse&&e.beat===t.beat&&i===a&&e.chakraDay===t.chakraDay},[]),Qe=(0,K.useMemo)(()=>typeof window<`u`?new URL(window.location.href).toString():`${`/s/${encodeURIComponent(e??``)}`}${t.search||``}${t.hash||``}`,[e,t.search,t.hash]),$e=(0,K.useMemo)(()=>e?e.slice(0,16):`—`,[e]),et=(0,K.useCallback)(async(e,t=`Copied`)=>{try{return await navigator.clipboard.writeText(e),SC(_,t),!0}catch{return SC(_,`Copy failed`),!1}},[]),tt=(0,K.useCallback)(async()=>{try{let e=navigator;typeof e?.share==`function`?(await e.share({title:`Kairos Sigil-glyph`,text:`Sealed Kairos Moment`,url:Qe}),SC(_,`Share sheet opened`)):await et(Qe,`Link copied`)}catch{}},[Qe,et]);(0,K.useEffect)(()=>{let e=FE(),t=(i||``).toLowerCase();if(Ie>e||!t||We.length===0)return;let n=We.includes(t),r=l,a=s;!n&&U&&t!==U&&!He||!n&&(He||je===`archived`)?r=`authentic`:(r=n?`authentic`:`forged`,s!==`verified`&&(a=n?`ok`:`mismatch`)),r!==l&&u(r),a!==s&&c(a)},[We,i,je,Ie,He,U,l,s]);let[nt,rt]=(0,K.useState)(null),it=(0,K.useDeferredValue)(k),at=(0,K.useMemo)(()=>{let t=it?.stepsPerBeat??44,n=it?p(it.pulse,t):0,r=it?.chakraDay??`Throat`,i=(it?.userPhiKey??``).slice(0,12),a=(it?.pulse??0).toLocaleString();return{title:`Kai Sigil — ${e?e.slice(0,16):`—`}`,desc:it?`Sealed Sigil-Glyph • Pulse ${a} • Beat ${it.beat}/36 • Step ${n+1}/${t} • ${r}${i?` • Owner ${i}…`:``}.`:`Sealed Sigil-Glyph`}},[it,e]),{series:ot}=QS();(0,K.useEffect)(()=>{let e=Qe;document.title=at.title;let t=lC(`canonical`);t.href=e,sC(`name`,`theme-color`,dC[k?.chakraDay??`Throat`]?.accent||`#00FFD0`),sC(`property`,`og:title`,at.title),sC(`property`,`og:description`,at.desc),sC(`property`,`og:type`,`website`),sC(`property`,`og:url`,e),sC(`name`,`twitter:card`,`summary_large_image`),sC(`name`,`twitter:title`,at.title),sC(`name`,`twitter:description`,at.desc),sC(`property`,`og:site_name`,`Kairos Harmonik Kingdom`);let n=k?.stepsPerBeat??44,r=k?p(k.pulse,n):0,i=k,a=k??{},o={"@context":`https://schema.org`,"@type":`VisualArtwork`,name:at.title,description:at.desc,url:e,image:nt||void 0,genre:`Sigil-Glyph`,identifier:[{"@type":`PropertyValue`,name:`pulse`,value:k?.pulse??null},{"@type":`PropertyValue`,name:`beat`,value:k?.beat??null},{"@type":`PropertyValue`,name:`stepIndex`,value:r},{"@type":`PropertyValue`,name:`stepsPerBeat`,value:n},{"@type":`PropertyValue`,name:`chakraDay`,value:k?.chakraDay??null},{"@type":`PropertyValue`,name:`userPhiKey`,value:k?.userPhiKey??null},{"@type":`PropertyValue`,name:`kaiSignature`,value:k?.kaiSignature??null},{"@type":`PropertyValue`,name:`canonicalHash`,value:(k?.canonicalHash??U)||null},{"@type":`PropertyValue`,name:`expiresAtPulse`,value:k?.expiresAtPulse??null},{"@type":`PropertyValue`,name:`transferNonce`,value:new URLSearchParams(location.search).get(`t`)??k?.transferNonce??null},{"@type":`PropertyValue`,name:`claimExtendUnit`,value:RE(a.claimExtendUnit)?a.claimExtendUnit:null},{"@type":`PropertyValue`,name:`claimExtendAmount`,value:a.claimExtendAmount??null},{"@type":`PropertyValue`,name:`historyLiteCount`,value:Ge?.length??0}].filter(e=>e.value!=null)};i?.lineage?.length&&o.identifier.push({"@type":`PropertyValue`,name:`lineageDepth`,value:i.lineage.length}),uC(`sigil-jsonld`,o)},[Qe,at.title,at.desc,k,nt,U,Ge?.length]),(0,K.useEffect)(()=>JT({stageId:`sigil-stage`,payload:k?{...k}:null,localHash:U,setOgImgUrl:rt,setMeta:sC,seoTitle:at.title,seoDesc:at.desc}),[k,U,v,at.title,at.desc]),(0,K.useLayoutEffect)(()=>(document.documentElement.classList.add(`sigil-scroll`),()=>document.documentElement.classList.remove(`sigil-scroll`)),[]),(0,K.useEffect)(()=>{let e=0,t=()=>{cancelAnimationFrame(e),e=requestAnimationFrame(()=>{let e=window.innerWidth,t=window.innerHeight,n=e<640?Math.max(220,Math.min(360,t*.48)):Math.max(160,Math.min(320,t*.35)),r=Math.max(160,Math.min(640,Math.min(e,t-n))),i=b.current?.clientWidth??e,a=Math.max(160,Math.min(640,i-24));y(Math.round(Math.min(r,a)))})},n=b.current??document.body,r=new ResizeObserver(()=>t());return r.observe(n),window.addEventListener(`resize`,t,{passive:!0}),t(),()=>{r.disconnect(),window.removeEventListener(`resize`,t),cancelAnimationFrame(e)}},[]),(0,K.useEffect)(()=>{D?(c(e=>e===`verified`?`verified`:`checking`),u(e=>e===`authentic`?`authentic`:`checking`),f(!1),h(`Awaiting Verifikation`)):k||(c(e=>e===`verified`?`verified`:i?`notfound`:`checking`),u(e=>e===`authentic`?`authentic`:i?`forged`:`checking`))},[D,k,i]);let st=e=>Array.isArray(e)?[...e].map(e=>({nonce:e.nonce,amount:Number.isFinite(e.amount)?Number(e.amount):0,recipient:e.recipientPhiKey??``,ts:e.timestamp??``})).sort((e,t)=>e.nonce.localeCompare(t.nonce)).map(e=>`${e.nonce}:${e.amount}:${e.recipient}:${e.ts}`).join(`|`):``;(0,K.useEffect)(()=>{let e=hT(a.get(`d`));if(!e)return;let t=PT(k??null,U,He),n=FT(o,k??null),r=wE(e);t&&vT(t,r,n);let i=typeof r.originalAmount==`number`?r.originalAmount:void 0,s=Array.isArray(r.debits)?r.debits:void 0;E(e=>{if(!e)return e;let t=e,n=(t.originalAmount??void 0)===i,r=st(t.debits)===st(s);if(n&&r)return e;let a={...e};return i!==void 0&&(a.originalAmount=i),s&&(a.debits=s,a.totalDebited=xE(s)),a})},[a,k,U,He,o,E]);let[ct,lt]=(0,K.useState)(!1);(0,K.useEffect)(()=>{let e=PT(k??null,U,He);if(!e)return;let t=FT(o,k??null),{merged:n,urlIsStale:r}=CT(e,a,t),i=wE(n);r&<(!0),ST(i,e,t,{broadcast:!1,navigate:r});let s=typeof i.originalAmount==`number`?i.originalAmount:void 0,c=Array.isArray(i.debits)?i.debits:void 0;E(e=>{if(!e)return e;let t=e,n=(t.originalAmount??void 0)===s,r=st(t.debits)===st(c);if(n&&r)return e;let i={...e};return s!==void 0&&(i.originalAmount=s),c&&(i.debits=c,i.totalDebited=xE(c)),i})},[k?.canonicalHash,U,He,a,o,E]),(0,K.useEffect)(()=>{if(!k?.canonicalHash)return;let e=k.canonicalHash.toLowerCase();if(i&&e&&e!==i&&je===`active`&&!He){let t=new URL(window.location.href);t.pathname=`/s/${e}`,r(`${t.pathname}${t.search}${t.hash}`,{replace:!0})}},[k?.canonicalHash,i,je,He,r]),(0,K.useEffect)(()=>{if(k&&!k.canonicalHash&&U&&i&&U!==i&&je===`active`&&!He){let e=new URL(window.location.href);e.pathname=`/s/${U}`,r(`${e.pathname}${e.search}${e.hash}`,{replace:!0})}},[k?.canonicalHash,U,i,je,He,r]),(0,K.useEffect)(()=>{let e=We;if(!e.length)return;let t=FT(o,k??null),n=(e,t)=>{let n={};typeof e?.originalAmount==`number`&&(n.originalAmount=e.originalAmount),n.originalAmount===void 0&&typeof t?.originalAmount==`number`&&(n.originalAmount=t.originalAmount);let r=Array.isArray(e?.debits)?e.debits:[],i=Array.isArray(t?.debits)?t.debits:[],a=CE([...r,...i]);return wE({originalAmount:n.originalAmount,debits:a})},r=(e,t)=>{let n=wE(e??{}),r=wE(t??{}),i=typeof n.originalAmount==`number`?n.originalAmount:NaN,a=typeof r.originalAmount==`number`?r.originalAmount:NaN,o=Number.isNaN(i)&&Number.isNaN(a)||Math.abs(i-a)e.nonce)),c=new Set((Array.isArray(r.debits)?r.debits:[]).map(e=>e.nonce));if(!o||s.size!==c.size)return!1;for(let e of s)if(!c.has(e))return!1;return!0},i=(i,a,o)=>{let s=i.toLowerCase();if(!e.includes(s))return;let c=t??null;if(c!==(o??null))return;let l=hT(a);if(!l)return;let u=hT(new URLSearchParams(window.location.search).get(`d`)),d=n(u,l);r(u,d)||(ST(d,s,c,{broadcast:!1}),E(e=>{if(!e)return e;let t={...e};return typeof d.originalAmount==`number`&&(t.originalAmount=d.originalAmount),Array.isArray(d.debits)&&(t.debits=d.debits,t.totalDebited=xE(d.debits)),t}))},a=null;try{a=new BroadcastChannel(sT),a.onmessage=e=>{let t=e.data;t?.type===`debits`&&t.canonical&&t.qs&&i(t.canonical,t.qs,t.token)}}catch{}let s=t=>{if(!(!t.key||typeof t.newValue!=`string`))for(let n of e){if(!lT(t.key,n))continue;let e=uT(t.key,n);i(n,t.newValue,e);break}};return window.addEventListener(`storage`,s,{passive:!0}),()=>{if(window.removeEventListener(`storage`,s),a&&typeof a.close==`function`)try{a.close()}catch{}}},[We,o,k,E]);let ut=(0,K.useMemo)(()=>k?typeof k.expiresAtPulse==`number`?k.expiresAtPulse:k.pulse+11:null,[k]),dt=(0,K.useMemo)(()=>A==null||ut==null?null:Math.max(0,ut-A),[A,ut]),pt=(0,K.useMemo)(()=>dt===0,[dt]),mt=(0,K.useMemo)(()=>A==null||!k?null:Math.max(0,k.pulse-A),[k,A]),ht=(0,K.useMemo)(()=>A==null||!k?!1:k.pulse>A,[k,A]),gt=k?.chakraDay??`Throat`,_t=k?.stepsPerBeat??44,vt=p(k?.pulse??0,_t),yt=typeof k?.stepPct==`number`?Math.max(0,Math.min(1,k.stepPct)):S(k?.pulse??0),bt=(0,K.useMemo)(()=>`hsl(${((dC[gt]?.hue??180)+(U&&/^[0-9a-f]+$/i.test(U)?parseInt(U.slice(-2),16)%12:0)*2.5)%360} 100% ${50+15*Math.sin(yt*2*Math.PI)}%)`,[gt,yt,U]),xt=dC[gt]?.hue??180,St=(0,K.useMemo)(()=>`qr-${(U||i||`seed`).slice(0,12)}-${gt}-${vt}`,[U,i,gt,vt]),[Ct,wt]=(0,K.useState)(!1),[Tt,Dt]=(0,K.useState)(null);(0,K.useEffect)(()=>{let e=!1;return(async()=>{try{if(!k){Dt(null);return}let t=k.stepsPerBeat??44,n=p(k.pulse,t),r=BC(k),i=zC(k.pulse,k.beat,n,String(k.chakraDay??``),r),a=await FC(i),o=await RC(a),s=typeof k.kaiSignature==`string`?k.kaiSignature.toLowerCase()===a.toLowerCase():!0,c=typeof k.userPhiKey==`string`?k.userPhiKey.toLowerCase()===o.toLowerCase():!0,l={pulse:k.pulse,beat:k.beat,stepsPerBeat:t,stepIndex:n,chakraDay:String(k.chakraDay??``),intention:r??null,sigmaString:i,sigmaHash:a,derivedPhiKey:o,payloadKaiSignature:k.kaiSignature??null,payloadUserPhiKey:k.userPhiKey??null,matches:{sigma:s,phi:c}};e||Dt(l)}catch{e||Dt(null)}})(),()=>{e=!0}},[k]);let Ot=le(()=>{IT({stageEl:document.getElementById(`sigil-stage`),payload:k,localHash:U,routeHash:i,qr:{uid:St,url:Qe,hue:xt,accent:bt},onToast:e=>SC(_,e)})}),[kt,At]=(0,K.useState)(!1),[jt,Mt]=(0,K.useState)(``),Nt=(0,K.useCallback)(async()=>{let e=b.current;e&&(Mt((await(0,dE.default)(e,{backgroundColor:null})).toDataURL(`image/png`)),At(!0),fC()||document.querySelector(`.stargate-overlay`)?.requestFullscreen?.().catch(()=>{}))},[]),Pt=(0,K.useCallback)(()=>{At(!1),document.fullscreenElement&&!fC()&&document.exitFullscreen?.().catch(()=>{})},[]),Ft=le(()=>{Nt()}),It=le(()=>{Pt()}),Lt=le(()=>wt(e=>!e)),Rt=le(()=>Ve(!0)),zt=(0,K.useCallback)(async e=>{let t=await e.arrayBuffer(),n=e.type||`application/octet-stream`,r=`data:${n};base64,${xC(t)}`;F({name:e.name,mime:n,size:e.size,dataUri:r}),SC(_,`Remembered ${e.name}`)},[]),Bt=(0,K.useCallback)((e,t)=>{let n=e.stepsPerBeat??44,r=p(e.pulse,n),a=(e.canonicalHash||U||``).toLowerCase(),o=e.claimExtendUnit,s=RE(o)?o:null,c=e.claimExtendAmount,l=typeof c==`number`?c:null,u=$T({pulse:e.pulse,beat:e.beat,chakraDay:e.chakraDay??`Root`,stepsPerBeat:n,stepIndex:r,userPhiKey:e.userPhiKey??null,kaiSignature:e.kaiSignature??null,canonicalHash:a,transferNonce:e.transferNonce??null,expiresAtPulse:e.expiresAtPulse??null,claimExtendUnit:s,claimExtendAmount:l},t,{localHash:U,routeHash:i,stepsPerBeat:44,stepIndexFromPulse:p})?.url||`/s/${a}`;try{let e=new URL(u,window.location.origin);e.pathname=`/s/${a}`;let t=new URLSearchParams(window.location.search).get(`d`);t&&e.searchParams.set(`d`,t),new URL(window.location.href).searchParams.forEach((t,n)=>{n!==`d`&&e.searchParams.set(n,e.searchParams.get(n)??t)}),u=e.toString()}catch{}let d=new URL(u,window.location.origin);d.pathname=`/s/${a}`,new URL(window.location.href).searchParams.forEach((e,t)=>{t!==`d`&&d.searchParams.set(t,d.searchParams.get(t)??e)});let f=wT(u)||a;return Oe(u),Ae(f),Ee(!0),u},[U,i]),Vt=(0,K.useCallback)((e,t,n=!0)=>{let a=e.stepsPerBeat??44,o=p(e.pulse,a),s=e.claimExtendUnit,c=RE(s)?s:`breaths`,l=e.claimExtendAmount,u=typeof l==`number`?l:11;return eE({pulse:e.pulse,beat:e.beat,chakraDay:e.chakraDay??`Root`,stepsPerBeat:a,stepIndex:o,userPhiKey:e.userPhiKey??null,kaiSignature:e.kaiSignature??null,canonicalHash:t,transferNonce:e.transferNonce??null,expiresAtPulse:e.expiresAtPulse??null,claimExtendUnit:c,claimExtendAmount:u},t,{localHash:U,routeHash:i,stepsPerBeat:44,stepIndexFromPulse:p,getKaiPulseEternalInt:IE,breathsToPulses:ue,shareTransferLink:$T,publishRotation:UE,navigate:e=>{if(n)try{r(e)}catch{try{window.location.href=e}catch{}}}})??null},[U,i,r]),Ht=(0,K.useCallback)(async e=>{if(f(!1),h(`Verifying…`),!(/image\/svg\+xml/i.test(e.type)||/\.svg$/i.test(e.name))){h(`Unsupported file. Upload an SVG sigil (.svg) only.`);return}let t=null;try{let{ok:n,errors:r,payload:i,meta:a}=he(await e.text());if(!n||!i){h(r[0]||`Invalid SVG.`);return}t=i,N(a||{})}catch{h(`Invalid or unreadable SVG uploaded.`);return}if(!k||!t){h(`Load or link a sigil first, then verify stewardship.`);return}if(!Ze(k,t)){h(`File does not match this sealed kairos moment.`),f(!1);return}if(t.canonicalHash){let e=t.canonicalHash.toLowerCase(),n=(U||``).toLowerCase(),r=(i||``).toLowerCase(),a=n&&e===n,o=r&&e===r;if(!a&&!o){h(`SVG canonicalHash doesn’t match this link’s hash.`),f(!1);return}if(o&&!a){Ue({reason:`svg.canonicalHash matched route (legacy)`,matchedHash:e}),u(`authentic`),c(`ok`),Me(`archived`),f(!0),h(`Stewardship verified (legacy SVG). Issuing modern link…`),n&&(Vt({...k},n,!0),h(`Legacy verified. Modern transfer link ready.`));return}}if(new Set([o??void 0,k.transferNonce??void 0,t.transferNonce??void 0,Ne??void 0].filter(e=>!!e)).size>1){h(`This is not the active transfer link for that Φkey.`),f(!1);return}f(!0),h(`Stewardship verified`)},[k,Ze,U,i,o,Ne,Vt]),Ut=le(async()=>{if(I)return;let e=b.current?.querySelector(`svg`),t=k??{},n=RE(t.claimExtendUnit)?t.claimExtendUnit:void 0,r=typeof t.claimExtendAmount==`number`?t.claimExtendAmount:null;await GT({expired:!!pt,exporting:I,setExporting:L,svgEl:e,payload:k?{pulse:k.pulse,beat:k.beat,chakraDay:k.chakraDay??null,stepsPerBeat:k.stepsPerBeat??void 0,stepIndex:k.stepIndex??null,exportedAtPulse:k.exportedAtPulse??null,canonicalHash:k.canonicalHash??null,userPhiKey:k.userPhiKey??null,kaiSignature:k.kaiSignature??null,transferNonce:k.transferNonce??null,expiresAtPulse:k.expiresAtPulse??null,claimExtendUnit:n,claimExtendAmount:r,attachment:k.attachment??null,provenance:k.provenance??null}:null,isFutureSealed:ht,linkStatus:je,setToast:e=>SC(_,e),expiryUnit:B,expiryAmount:ce,localHash:U,routeHash:i,transferToken:o??null,getKaiPulseEternalInt:IE,stepIndexFromPulse:p,STEPS_PER_BEAT:44})}),Wt=(0,K.useCallback)(e=>{let t=typeof e==`string`?e:e?.hash;if(!t)return;let n=t.toLowerCase();de(e=>e===n?e:n)},[]),Gt=D&&!k,Kt=s===`notfound`||s===`error`,qt=k?.pulse??0,Jt=k?.beat??0,Yt=((j??0)/1e3).toFixed(3),Xt=je===`archived`,Zt=d&&!Xt,Qt=(0,K.useMemo)(()=>l===`authentic`&&Xt&&!o&&!!i&&!!U&&i!==U,[l,Xt,o,i,U]);(0,K.useEffect)(()=>{if(!k||l!==`authentic`||s===`mismatch`||s===`error`||s===`notfound`)return;let e=!1;return(async()=>{try{let t=k.stepsPerBeat??44,n=p(k.pulse,t),r=BC(k),i=await FC(zC(k.pulse,k.beat,n,String(k.chakraDay??``),r)),a=typeof k.kaiSignature==`string`?k.kaiSignature.toLowerCase()===i.toLowerCase():!0,o=await RC(i),l=typeof k.userPhiKey==`string`?k.userPhiKey.toLowerCase()===o.toLowerCase():!0;!e&&a&&l&&s!==`verified`&&c(`verified`)}catch{}})(),()=>{e=!0}},[k,l,s,je]),(0,K.useEffect)(()=>{let e=(i||``).toLowerCase(),t=o||null,n=k?.transferNonce||null,r=!!t&&!!n&&t===n&&(ut==null||A==null||A{let e=!0;return(async()=>{if(!k){en(``),nn(``);return}let t=(k.canonicalHash||U||``).toLowerCase(),n=A||PE(),r=await JC(k,t,n,T(n),p(n,k.stepsPerBeat??44));e&&(en(r.ownerPhiKey),nn(r.kaiSig))})(),()=>{e=!1}},[k,U]);let rn=(0,K.useCallback)(async e=>{if(e?.preventDefault?.(),e?.stopPropagation?.(),!k||!U||ht||Xt)return;let t=(k.canonicalHash||U||``).toLowerCase(),n=A||PE(),r=await JC(k,t,n,T(n),p(n,k.stepsPerBeat??44));te(r.ownerPhiKey),re(r.kaiSig),setTimeout(()=>{try{sn()}catch{}},0)},[k,U,ht,Xt]),an=(0,K.useCallback)(e=>{let t=`/${e}`;try{window.location.assign(t)}catch{window.location.href=t}},[]),on=(0,K.useCallback)(async()=>{try{let e=await(await fetch(`/verifier.inline.html`,{cache:`no-store`})).text(),t=new Blob([e],{type:`text/html`}),n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=`verifier.html`,document.body.appendChild(n),n.click(),setTimeout(()=>{URL.revokeObjectURL(n.href),n.remove()},0),SC(_,`Downloading verifier…`)}catch{SC(_,`Download failed`)}},[]);({...Lt});let sn=(0,K.useCallback)(()=>{if(!k)return SC(_,`Nothing to mint`);let e=b.current?.querySelector(`svg`);if(!e)return SC(_,`No Φkey in frame`);if(!U)return SC(_,`Glyph hash not ready yet`);if(je!==`active`)return SC(_,`Archived link — cannot exhale from here`);if(ht)return SC(_,`Opens after the moment—claim unlocks then`);let t=rC(M??{},k.pulse),n=(R||k.userPhiKey||``).trim();if(!n)return SC(_,`Owner ΦKey required`);let r=Math.max(0,Math.floor(ce||0)),a=B===`breaths`?ue(r):fe(r),o=A||PE(),s=o+a,c=U.toLowerCase(),l=crypto.getRandomValues(new Uint32Array(4)).join(``),u=k.stepsPerBeat??44,d=p(k.pulse,u),f=p(o,u),m={...iC(n,z||k.kaiSignature,k,t.length?`transfer`:`mint`,(P??k.attachment)?.name,o),stepIndex:d,atStepIndex:f},h={...k,userPhiKey:n,kaiSignature:z||k.kaiSignature,stepsPerBeat:k.stepsPerBeat??44,attachment:P??k.attachment??void 0,expiresAtPulse:s,canonicalHash:c,transferNonce:l,claimExtendUnit:B,claimExtendAmount:r,provenance:[...t,m]};(async()=>{let t=await FC(zC(h.pulse,h.beat,d,String(h.chakraDay??``),BC(h))),n=await RC(t);h.kaiSignature=t,h.userPhiKey=h.userPhiKey||n;let r=Array.from(new Set([k.canonicalHash,i,U].filter(Boolean).map(e=>e.toLowerCase())));r.length&&UE(r,l),Me(`archived`),Le(FE()+250),pe(e,h),UC(e),E(h),N(h),SC(_,`Sealed & archived`);let a=Bt(h,l)||`/s/${c}`;a=await Fe(h,c,l,a,e),Oe(_E(a)),h.canonicalHash&&UE([h.canonicalHash.toLowerCase()],l),setTimeout(()=>Le(0),0)})()},[k,M,R,z,P,ce,B,U,i,je,ht,Bt]),cn=k,ln=(0,K.useMemo)(()=>xE(cn?.debits??[]),[cn?.debits]),un=(0,K.useMemo)(()=>{let e=(typeof cn?.originalAmount==`number`?cn.originalAmount:qe?.valuePhi??0)-ln;return e>0?e:0},[cn?.originalAmount,qe?.valuePhi,ln]),dn=(cn?.debits?.length??0)>0||typeof cn?.originalAmount==`number`,fn=(0,K.useMemo)(()=>dn?un:Je??qe?.valuePhi??0,[dn,un,Je,qe?.valuePhi]),pn=se,{usdPerPhi:mn,phiPerUsd:hn}=(0,K.useMemo)(()=>{try{let e=w({meta:k||{},nowPulse:A||A,usd:100,currentStreakDays:0,lifetimeUsdSoFar:0},pn);return{usdPerPhi:e.usdPerPhi??0,phiPerUsd:e.phiPerUsd??0}}catch{return{usdPerPhi:0,phiPerUsd:0}}},[k,A,pn]),gn=(fn??0)*(mn||0),_n=(0,K.useCallback)(async()=>{if(!k)return``;let e=k.stepsPerBeat??44,t=p(k.pulse,e);return await RC(k.kaiSignature??await FC(zC(k.pulse,k.beat,t,String(k.chakraDay??``),BC(k))))},[k]),[vn,yn]=(0,K.useState)([]),bn=(0,K.useCallback)(()=>{yn(WE(PT(k??null,U,He),FT(o,k??null)))},[k,U,He,o]);(0,K.useEffect)(()=>{bn();let e=null;try{e=new BroadcastChannel(zE),e.onmessage=e=>{let t=e.data;if(!t||t.type!==`descendants`)return;let n=PT(k??null,U,He),r=FT(o,k??null);!n||!r||t.canonical!==n.toLowerCase()||t.token!==r||Array.isArray(t.list)&&yn(t.list)}}catch{}let t=e=>{if(!e.key||!e.newValue)return;let t=PT(k??null,U,He),n=FT(o,k??null);if(!(!t||!n)&&e.key===BE(t,n))try{let t=JSON.parse(e.newValue||`[]`);Array.isArray(t)&&yn(t)}catch{}};return window.addEventListener(`storage`,t,{passive:!0}),()=>{if(e&&typeof e.close==`function`)try{e.close()}catch{}window.removeEventListener(`storage`,t)}},[k,U,He,o,bn]);let xn=(0,K.useCallback)(async(e,t)=>{if(!k)return null;let n=A||PE(),r=crypto.getRandomValues(new Uint32Array(4)).join(``),i=k.stepsPerBeat??44,a=p(k.pulse,i),s=(U||k.canonicalHash||``).toLowerCase(),c=t??FT(o,k??null),l=Array.isArray(k.lineage)?[...k.lineage]:[],u=(l[l.length-1]?.depth??0)+1,d={token:r,parentToken:c??null,amount:Number(e.toFixed(6)),timestamp:n,depth:u,senderPhiKey:k.userPhiKey??null},f={...k,userPhiKey:void 0,originalAmount:Number(e.toFixed(6)),mintedAtPulse:n,transferNonce:r,expiresAtPulse:n+(B===`breaths`?ue(ce):fe(ce)),claimExtendUnit:B,claimExtendAmount:ce,canonicalHash:s,lineage:[...l,d]},m=await FC(zC(f.pulse,f.beat,a,String(f.chakraDay??``),BC(f))),h=await RC(m);f.kaiSignature=m,f.userPhiKey=h;let g=Bt(f,r)||`/s/${s}`;try{let t=new URL(g,window.location.origin);t.pathname=`/s/${s}`,t.searchParams.set(`d`,pT({originalAmount:f.originalAmount}));let i=NT(t.toString(),f);i=await Fe(f,s,r,i);let a=wT(i)||s;vT(a,hT(new URL(i).searchParams.get(`d`))??{},r);let o=PT(k??null,U,He),l=c??null;if(o&&l){let t=[...WE(o,l),{token:r,parentToken:l,amount:Number(e.toFixed(6)),timestamp:n,depth:1,recipientPhiKey:f.userPhiKey}];GE(o,l,t),KE(o,l,t),yn(t)}return Oe(_E(i)),Ae(a),Ee(!0),i}catch{let e=NT(g||`/s/${s}`,f);return Oe(e),Ae(s),Ee(!0),e||null}},[k,B,ce,U,Bt,He,o]);(0,K.useEffect)(()=>{let e=e=>{if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase();return t===`input`||t===`textarea`||e.isContentEditable},t=t=>{if(t.defaultPrevented||e(t.target))return;let n=t.key.toLowerCase();t.metaKey||t.ctrlKey||t.altKey||(n===`s`?tt():n===`l`?et(Qe,`Link copied`):n===`h`?U&&et(U,`Hash copied`):n===`z`?Ut.onClick?.(new MouseEvent(`click`)):n===`p`?Ot.onClick?.(new MouseEvent(`click`)):n===`g`&&Nt())};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[tt,et,Qe,U,Ut,Ot,Nt]);let Sn=(0,K.useCallback)(e=>{let t=e?.silent??!0;if(!PT(k??null,U,He))return null;let n=FT(o,k??null);if(n)return n;n=crypto.getRandomValues(new Uint32Array(4)).join(``);try{let e=new URL(window.location.href);e.searchParams.set(`t`,n),t?window.history.replaceState(null,``,`${e.pathname}${e.search}${e.hash}`):r(`${e.pathname}${e.search}${e.hash}`,{replace:!0})}catch{}return E(e=>e&&{...e,transferNonce:n}),Me(`active`),n},[k,U,He,o,E,r,Me]),[Cn,wn]=(0,K.useState)(0),Tn=(0,K.useCallback)(async()=>{if(!Zt)return SC(_,`Verify Stewardship first`);if(!k)return SC(_,`No payload`);if(W)return;let e=A||PE(),t=Number(Cn)||0;if(t<=0)return SC(_,`Enter an amount > 0`);let n=PT(k??null,U,He),r=FT(o,k??null);if(r||=Sn({silent:!0})||null,!n||!r)return SC(_,`Link not initialized`);if(Ne&&Ne!==r)return SC(_,`Archived link — cannot exhale from here`);G(!0);let{ok:i,id:a}=vE(n,r,e);if(me.current=a,!i)return G(!1),SC(_,`Another exhale is in progress`);try{let{merged:e}=CT(n,new URLSearchParams(window.location.search),r),i=wE({originalAmount:typeof e.originalAmount==`number`?e.originalAmount:typeof k?.originalAmount==`number`?k.originalAmount:qe?.valuePhi??0,debits:Array.isArray(e.debits)?e.debits:[]});if(t>Math.max(0,(i.originalAmount??0)-xE(i.debits||[]))+fE)return SC(_,`Amount exceeds available`);let a=await _n();if(!a)return SC(_,`Could not derive Φkey`);let o={amount:Number(t.toFixed(6)),nonce:crypto.getRandomValues(new Uint32Array(4)).join(``),recipientPhiKey:a,timestamp:A||PE()};ST(wE({originalAmount:i.originalAmount,debits:[...i.debits??[],o]}),n,r,{broadcast:!0});let{merged:s}=CT(n,new URLSearchParams(window.location.search),r),c=wE(s);if(!(c.debits??[]).some(e=>e.nonce===o.nonce)){SC(_,`Exhale conflicted — try again`);return}E(e=>{if(!e)return e;let t={...e};return t.originalAmount=typeof c.originalAmount==`number`?c.originalAmount:typeof t.originalAmount==`number`?t.originalAmount:qe?.valuePhi??0,t.debits=Array.isArray(c.debits)?c.debits:[],t.totalDebited=xE(t.debits),t}),wn(0),SC(_,`Sent ${AC(o.amount)} Φ`),xn(o.amount,r)}finally{yE(n,r,me.current,A),G(!1)}},[Zt,k,k?.originalAmount,qe?.valuePhi,Cn,Ne,U,He,o,E,_n,xn,wn,W,Sn]),En=Ct||Re||kt||Te||be&&Qt;(0,K.useEffect)(()=>{let e=`bp-open`;return En?document.body.classList.add(e):document.body.classList.remove(e),()=>document.body.classList.remove(e)},[En]);let[Dn,On]=(0,K.useState)(!1),kn=(0,K.useCallback)(()=>{On(!0),window.setTimeout(()=>On(!1),2e3)},[]),An=le(()=>{et(U||``,`Hash copied`)}),jn=le(async()=>{await et(Qe,`Link copied`)&&kn()}),Mn=le(()=>{tt()}),Nn=(0,q.jsxs)(ye,{frameRef:b,children:[!Gt&&!Kt&&k&&(0,q.jsx)(`div`,{id:`sigil-stage`,style:{position:`relative`,width:v,height:v,margin:`0 auto`},children:(0,q.jsx)(ne,{pulse:qt,beat:Jt,stepPct:yt,chakraDay:gt,size:v,hashMode:`deterministic`,origin:``,onReady:Wt})}),Gt&&(0,q.jsx)(`div`,{className:`sp-skeleton`,"aria-hidden":`true`}),Kt&&(0,q.jsx)(`div`,{className:`sp-error`,children:s===`notfound`?`Waiting for SVG upload or ?p= payload.`:`Unable to load sigil.`})]}),Pn=k?.lineage??[],Fn=(0,K.useCallback)((e,t)=>{let n=e=>typeof e==`object`&&!!e,r=e=>{if(typeof t==`string`)return t;if(!n(e))return``;let r=typeof e.reason==`string`?e.reason:``,i=n(e.detail)?e.detail:null,a=i&&typeof i.reason==`string`?i.reason:``;return r||a||``},i=e=>{if(!n(e))return null;let t=e.target;return t instanceof HTMLElement?t:null},a=r(e),o=i(e),s=a===`closeClick`||a===`close-button`||a===`explicit`||a===`close`,c=!!o?.closest?.(`[data-modal-close],[data-close],.sealmoment__close,.sp-modal__close,button[aria-label="Close"],button[aria-label="close"],button[title="Close"]`);if(s||c||e==null&&t==null){Ee(!1),Oe(``),Ae(``);return}},[]);return(0,q.jsxs)(`main`,{className:`sigilpage`,role:`main`,"aria-label":`Kai Sigil Page`,"data-owner-verified":Zt,"data-archived":Xt,"data-old-link":ct?`true`:`false`,"data-version":`v48`,children:[(0,q.jsx)(`div`,{className:`sp-veil`,"aria-hidden":`true`}),(0,q.jsx)(`div`,{className:`sp-veil-stars`,"aria-hidden":`true`}),(0,q.jsx)(`div`,{className:`sp-viewport`,"aria-hidden":!1,children:(0,q.jsxs)(`section`,{className:`sp-shell`,"data-center":!0,children:[(0,q.jsx)(ve,{glyphAuth:l,linkStatus:je,isArchived:Xt,localHash:U,copyHashPress:An}),(l===`authentic`||s===`verified`)&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`style`,{children:` /* ===== Divine Authority Seal — Ultra-Sleek, Compact, Centered ===== */ .authority-seal{ --gold:#ffd76e; --mint:#00ffc6; --aqua:#8ab4ff; --ink:#061012; --glass:rgba(10,14,15,.86); diff --git a/dist/assets/SigilStreamRoot-BAeCOlJX.js b/dist/assets/SigilStreamRoot-BAeCOlJX.js new file mode 100644 index 00000000..b3d7d817 --- /dev/null +++ b/dist/assets/SigilStreamRoot-BAeCOlJX.js @@ -0,0 +1 @@ +import"./html2canvas-D-AxDBo3.js";import"./EternalKlock-CdflKbWu.js";import"./SigilModal-Dm4zpSIO.js";import"./SealMomentModal-C7mxkSGB.js";import"./SigilAuthContext-CIPXJp4C.js";import"./sigilRegistry-dB0OrrJi.js";import"./SigilAuthProvider-ea2w3ibF.js";import"./usernameClaimRegistry-B6UXZAUR.js";import{n as e,t}from"./SigilStreamRoot-LmEGlu4-.js";import"./useFastPress-MOMn9nZb.js";export{t as SigilStreamRoot,e as default}; \ No newline at end of file diff --git a/dist/assets/SigilStreamRoot-CTqcQRVp.js b/dist/assets/SigilStreamRoot-CTqcQRVp.js deleted file mode 100644 index c2be4549..00000000 --- a/dist/assets/SigilStreamRoot-CTqcQRVp.js +++ /dev/null @@ -1 +0,0 @@ -import"./html2canvas-DKfOm221.js";import"./EternalKlock-BauRu4tr.js";import"./SigilModal-BVYbqxt6.js";import"./SealMomentModal-Bn7w_Hvo.js";import"./SigilAuthContext-CmP6HWSa.js";import"./sigilRegistry-D8l_pIbq.js";import"./SigilAuthProvider-EaP0VeI7.js";import"./usernameClaimRegistry-DYzaEFWn.js";import{n as e,t}from"./SigilStreamRoot-DhYXsfvl.js";import"./useFastPress-CiepkEei.js";export{t as SigilStreamRoot,e as default}; \ No newline at end of file diff --git a/dist/assets/SigilStreamRoot-DhYXsfvl.js b/dist/assets/SigilStreamRoot-LmEGlu4-.js similarity index 99% rename from dist/assets/SigilStreamRoot-DhYXsfvl.js rename to dist/assets/SigilStreamRoot-LmEGlu4-.js index 8604a814..9c3c3341 100644 --- a/dist/assets/SigilStreamRoot-DhYXsfvl.js +++ b/dist/assets/SigilStreamRoot-LmEGlu4-.js @@ -1,5 +1,5 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/postSeal-D7PFnOMd.js","assets/postSeal-ClZBwRbf.js"])))=>i.map(i=>d[i]); -import{Q as e,Sn as t,Tn as n,at as r,bn as i,ct as a,dn as o,et as s,gn as c,gt as l,hn as u,in as d,it as f,jn as p,mn as m,on as h,ot as g,pt as _,rn as v,rt as y,sn as b,tn as x,tt as S,un as C,ut as w,vn as T,w as E,wn as D,yn as O}from"./index-CgC-NZbJ.js";import{n as k}from"./EternalKlock-BauRu4tr.js";import{n as A}from"./SigilAuthContext-CmP6HWSa.js";import{n as ee,t as j}from"./sigilRegistry-D8l_pIbq.js";import{t as M}from"./SigilAuthProvider-EaP0VeI7.js";import{a as te,i as N,n as ne,o as re,r as ie,t as ae}from"./usernameClaimRegistry-DYzaEFWn.js";import{t as oe}from"./useFastPress-CiepkEei.js";var P=p(n(),1);const se=(0,P.createContext)(null);function ce(){let e=(0,P.useContext)(se);if(!e)throw Error(`useToasts() must be used within `);return e}var F=p(x(),1);function le({children:e}){let[t,n]=(0,P.useState)([]),r=(0,P.useRef)(new Map),i=(0,P.useRef)(1),a=(0,P.useCallback)(e=>{let t=r.current.get(e);typeof t==`number`&&(window.clearTimeout(t),r.current.delete(e))},[]),o=(0,P.useCallback)(e=>{a(e),n(t=>t.filter(t=>t.id!==e))},[a]),s=(0,P.useCallback)((e,t)=>{let s=i.current++;n(n=>{let r=[{id:s,kind:e,text:t},...n],i=r.slice(0,3),o=r.slice(3);for(let e of o)a(e.id);return i});let c=window.setTimeout(()=>o(s),2600);r.current.set(s,c)},[a,o]),c=(0,P.useMemo)(()=>({push:s}),[s]);(0,P.useEffect)(()=>()=>{for(let e of r.current.values())window.clearTimeout(e);r.current.clear()},[]);let l=e=>{switch(e){case`success`:return`rgba(16,28,22,.88)`;case`warn`:return`rgba(28,24,12,.88)`;case`error`:return`rgba(36,16,16,.88)`;case`info`:default:return`rgba(12,18,28,.88)`}};return(0,F.jsxs)(se.Provider,{value:c,children:[e,(0,F.jsx)(`div`,{"aria-live":`polite`,"aria-atomic":`false`,style:{position:`fixed`,left:0,right:0,bottom:0,padding:`8px 12px`,display:`grid`,gap:8,zIndex:1e3,pointerEvents:`none`},children:t.map(e=>(0,F.jsx)(`div`,{role:`status`,style:{pointerEvents:`auto`,marginInline:`auto`,maxWidth:`min(720px, 100%)`,width:`100%`,background:l(e.kind),border:`1px solid rgba(255,255,255,.12)`,borderRadius:12,padding:`10px 12px`,color:`rgb(236,241,251)`,boxShadow:`0 8px 28px rgba(0,0,0,.35)`,backdropFilter:`blur(6px)`,fontVariantNumeric:`tabular-nums`},children:e.text},e.id))})]})}var I=le;function L(e){return String(e).padStart(2,`0`)}function R(e,t){let n=e%t;return n<0n?n+(t<0n?-t:t):n}function z(e,t){let n=e/t,r=e%t;return r!==0n&&r>0n!=t>0n?n-1n:n}function ue(e){if(!Number.isFinite(e))return 0n;let t=e<0?-1:1,n=Math.abs(e),r=Math.trunc(n),i=n-r;return i<.5?BigInt(t*r):i>.5?BigInt(t*(r+1)):BigInt(t*(r%2==0?r:r+1))}function B(e,t){try{let n=t instanceof Error?t.message:String(t);console.warn(`[SigilStream:${e}] ${n}`)}catch{}}function V(e){return typeof e==`object`&&!!e}function de(e){try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}}function H(e,t){if(!V(e))return;let n=e[t];if(typeof n==`string`)return n;let r=e.meta;if(V(r)){let e=r[t];if(typeof e==`string`)return e}}function fe(e){let t=e;if(V(t)&&`auth`in t&&(t=t.auth),V(t)){let e=t.meta,n=t.svgText;return{meta:V(e)?e:null,svgText:typeof n==`string`?n:null}}return{meta:null,svgText:null}}async function pe(){try{let e=await fetch(`/links.json`,{cache:`no-store`});if(!e.ok||!(e.headers.get(`content-type`)??``).toLowerCase().includes(`application/json`))return[];let t=await e.text(),n=JSON.parse(t);if(!Array.isArray(n))return[];let r=[];for(let e of n)V(e)&&typeof e.url==`string`&&e.url.trim().length&&r.push({url:e.url});return r}catch(e){return B(`loadLinksJson`,e),[]}}const U=`sf-links`;function W(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)&&t.every(e=>typeof e==`string`)?t:[]}catch(e){return B(`parseStringArray`,e),[]}}function G(e){try{if(typeof window>`u`)return;let t=W(localStorage.getItem(U)),n=e.filter(e=>typeof e==`string`&&e.trim().length);if(n.length===0)return;let r=new Set(t),i=n.filter(e=>!r.has(e));if(i.length===0)return;let a=[...i,...t];localStorage.setItem(U,JSON.stringify(a))}catch(e){B(`prependUniqueToStorage`,e)}}const me=(()=>{try{return((typeof window<`u`?window.__PSHORT__:void 0)?.trim()||(void 0)?.trim()||``).replace(/\s+/g,``)}catch(e){return B(`Resolve PSHORT`,e),``}})();function he(){try{if(me)return new URL(`/`,me)}catch(e){B(`Invalid PSHORT`,e)}let e=typeof window<`u`?window.location.href:`https://example.com`;return new URL(`/`,e)}function K(){let e=typeof window<`u`?window.location.href:`https://example.com`;return new URL(`/`,e)}function ge(e){try{let t=new URL(e);if(!(t.protocol===`https:`||t.protocol===`http:`))return!1;let n=t.pathname;if(n.startsWith(`/stream/p/`)||n.startsWith(`/p~`)&&n.length>3)return!0;if(n===`/p`){let e=t.hash.includes(`t=`),n=t.searchParams.has(`t`);return e||n}return t.search.includes(`p=`)}catch{return!1}}function _e(e){try{let t=he(),n=new URL(e,t),r=K();if(n.pathname.startsWith(`/p~`)&&n.pathname.length>3){r.pathname=`/stream/p/${n.pathname.slice(3)}`;let e=n.searchParams.get(`add`)||(n.hash.startsWith(`#add=`)?new URLSearchParams(n.hash.slice(1)).get(`add`):null);return e&&r.searchParams.set(`add`,ve(e)),r.toString()}if(n.pathname===`/p`){let t=n.hash.startsWith(`#`)?n.hash.slice(1):n.hash,i=new URLSearchParams(t),a=i.get(`t`),o=n.searchParams.get(`t`),s=a||o;if(!s)return e;r.pathname=`/stream/p/${s}`;let c=i.get(`add`),l=n.searchParams.get(`add`),u=c||l;return u&&r.searchParams.set(`add`,ve(u)),r.toString()}return e}catch(t){return B(`expandShortAliasToCanonical`,t),e}}function ve(e){let t=e.trim();if(!t)return t;try{if(t.startsWith(`/p~`))return _e(`${he().origin}${t}`);if(t.startsWith(`/p#t=`)||t.startsWith(`#t=`)||t.includes(`/p?t=`))return _e(t.startsWith(`#t=`)?`${he().origin}/p${t}`:t.startsWith(`/p`)?`${he().origin}${t}`:t);if(de(t)){let e=new URL(t);return e.pathname===`/p`||e.pathname.startsWith(`/p~`)?_e(t):t}return t}catch(e){return B(`normalizeAddParam`,e),t}}function ye(e){let t=K();return t.pathname=`/stream/p/${e}`.replace(/\/{2,}/g,`/`),t.search=``,t.hash=``,t.toString()}function be(e){let t=e.trim();if(t.startsWith(`#`)&&(t=t.slice(1)),t.length===3&&(t=t.split(``).map(e=>e+e).join(``)),t.length!==6)return null;let n=parseInt(t,16);return[n>>16&255,n>>8&255,n&255]}var xe=(e,t=0,n=255)=>Math.max(t,Math.min(n,e));function Se(e,t,n){return[xe(e[0]+(t[0]-e[0])*n),xe(e[1]+(t[1]-e[1])*n),xe(e[2]+(t[2]-e[2])*n)]}var Ce=e=>`${e[0]}, ${e[1]}, ${e[2]}`,we={root:`#FF3B3B`,sacral:`#FF8A33`,solar:`#FFD60A`,heart:`#22C55E`,throat:`#0EA5E9`,thirdEye:`#6366F1`,crown:`#C084FC`},Te=`crown`;function Ee(e){if(e==null)return null;let t;return t=typeof e==`number`?[`root`,`sacral`,`solar`,`heart`,`throat`,`thirdEye`,`crown`][Math.min(7,Math.max(1,e))-1]:e===`krown`?Te:e,be(we[t]??we.crown)}function De(e){let t=Ee(e);if(!t)return null;let n=[255,255,255],r=[255,215,128],i=Se(t,n,.28),a=Se(t,r,.42);return{s1:Ce(t),s2:Ce(i),s3:Ce(a)}}var Oe={s1:`154, 230, 255`,s2:`196, 181, 253`,s3:`255, 215, 128`};function ke(e,t){let n=De(e);if(n)return n;if(t?.primary){let e=be(t.primary)??be(`#9AE6FF`),n=t.secondary?be(t.secondary)??e:Se(e,[255,255,255],.28),r=[255,215,128],i=t.accent?be(t.accent)??r:Se(e,r,.45);return{s1:Ce(e),s2:Ce(n),s3:Ce(i)}}return Oe}function Ae(e){if(!e)return;let t=e.trim();if(t)return t.startsWith(`@`),t}function je({username:e,phiKey:t,kaiSignature:n,sigilColors:r,chakra:i}){let a=ke(i,r),o=Ae(e),s={"--sigil-1":a.s1,"--sigil-2":a.s2,"--sigil-3":a.s3},c=!o&&!t&&!n;return(0,F.jsx)(`div`,{className:`sf-identity`,style:s,...c?{"data-empty":``}:{},children:(0,F.jsxs)(`div`,{className:`sf-reply-id`,style:{rowGap:`.4rem`,columnGap:`.4rem`,display:`flex`,flexWrap:`wrap`},"aria-label":c?`No identity loaded`:`Identity chips`,children:[c&&(0,F.jsx)(`span`,{className:`sf-muted`,children:`No identity loaded this session.`}),o&&(0,F.jsxs)(`span`,{className:`sf-pill sf-pill--user`,title:`Username (session)`,children:[(0,F.jsx)(`strong`,{className:`sf-pill__label`,children:`User`}),`\xA0`,(0,F.jsx)(`span`,{className:`sf-key`,children:o})]}),t&&(0,F.jsxs)(`span`,{className:`sf-pill sf-pill--phikey`,title:`Your ΦKey (session)`,children:[(0,F.jsx)(`strong`,{className:`sf-pill__label`,children:`ΦKey`}),`\xA0`,(0,F.jsx)(`span`,{className:`sf-key`,children:t})]}),n&&(0,F.jsxs)(`span`,{className:`sf-pill sf-pill--ksig`,title:`Kai Signature (session)`,children:[(0,F.jsx)(`strong`,{className:`sf-pill__label`,children:`ΣSig`}),`\xA0`,(0,F.jsx)(`span`,{className:`sf-key`,children:n})]})]})})}var Me=[`sigilActionUrl`,`sigilUrl`,`actionUrl`,`claimedUrl`,`loginUrl`,`sourceUrl`,`originUrl`,`url`,`link`,`href`];function Ne(e){if(!e||!V(e))return[];let t=[],n=new Set;for(let r of Me){let i=H(e,r);if(typeof i!=`string`)continue;let a=i.trim();a&&(n.has(a)||(n.add(a),t.push(a)))}return t}function Pe(e){if(!e)return[];try{let t=e.match(/https?:\/\/[^\s"'<>)#]+/gi)??[],n=[],r=new Set;for(let e of t){let t=(e??``).trim();t&&(r.has(t)||(r.add(t),n.push(t)))}return n}catch{return[]}}function Fe(e){return/^https?:\/\//i.test((e??``).trim())}function Ie(e){try{return new URL(e)}catch{return null}}function Le(e){let t=(e??``).trim();if(!t)return``;let n=t;n=n.replace(/\/stream\/v=/gi,`/stream/t=`),n=n.replace(/\/stream\/v\//gi,`/stream/t/`),n=n.replace(/\/stream\/v(\?|&|#)/gi,`/stream/t$1`),n=n.replace(/([?&#])v=/gi,`$1t=`);let r=Ie(n);if(!r)return n.replace(/([?&#])v=/gi,`$1t=`);let i=r.searchParams,a=(i.get(`t`)??``).trim().length>0,o=(i.get(`v`)??``).trim();if(!a&&o&&i.set(`t`,o),i.delete(`v`),(i.get(`t`)??``).trim().length>0&&i.delete(`p`),r.hash&&r.hash.length>1){let e=r.hash.startsWith(`#`)?r.hash.slice(1):r.hash;if(e.includes(`=`)&&!e.startsWith(`/`)){let t=e.split(`&`).filter(Boolean),n=[],i=!1;for(let e of t){let t=e.indexOf(`=`);if(t<=0){n.push(e);continue}let r=e.slice(0,t),a=e.slice(t+1),o=r.toLowerCase();if(o===`v`){!i&&a.trim().length&&(n.push(`t=${a}`),i=!0);continue}o===`t`&&(i=!0),n.push(e)}if(i){let e=[];for(let t of n){let n=t.indexOf(`=`);(n>0?t.slice(0,n).toLowerCase():``)!==`p`&&e.push(t)}r.hash=e.length?`#${e.join(`&`)}`:``}else r.hash=n.length?`#${n.join(`&`)}`:``}else r.hash=r.hash.replace(/([?&#])v=/gi,`$1t=`)}return r.toString()}function Re(e){let t=(e??``).trim();if(!t)return-1;let n=t.toLowerCase(),r=0;return(/[?&#]v=/.test(n)||n.includes(`/stream/v`))&&(r-=1e4),(/[?&#]t=/.test(n)||n.includes(`/stream/t`)||n.includes(`stream/t=`))&&(r+=500),(/[?&#]p=/.test(n)||n.includes(`/stream/p`)||n.includes(`stream/p=`))&&(r+=280),ge(t)&&(r+=160),n.startsWith(`https://`)?r+=20:n.startsWith(`http://`)&&(r+=10),r+=Math.max(0,120-Math.min(120,Math.floor(t.length/6))),r}function ze(e){let t=``,n=-1;for(let r of e){let e=Le(r),i=Re(e);i>n&&(n=i,t=e)}return t}async function Be(e){let t=e??``;if(!t)return!1;try{if(typeof navigator<`u`&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(t),!0}catch{}try{let e=document.createElement(`textarea`);e.value=t,e.setAttribute(`readonly`,`true`),e.style.position=`fixed`,e.style.left=`-9999px`,e.style.top=`-9999px`,document.body.appendChild(e),e.select(),e.setSelectionRange(0,e.value.length);let n=document.execCommand(`copy`);return document.body.removeChild(e),n}catch{return!1}}function Ve({value:e,isCanonical:t}){let n=(0,P.useMemo)(()=>Ie(e),[e]),r=(0,P.useMemo)(()=>Fe(e)?e:``,[e]),[i,a]=(0,P.useState)(!1),[o,s]=(0,P.useState)(!1),c=(0,P.useRef)(null);(0,P.useEffect)(()=>()=>{c.current&&window.clearTimeout(c.current)},[]);let l=(0,P.useCallback)(e=>{c.current&&window.clearTimeout(c.current),a(e),s(!e),c.current=window.setTimeout(()=>{a(!1),s(!1),c.current=null},1400)},[]),u=(0,P.useCallback)(async()=>{l(await Be(e))},[l,e]),d=(0,P.useCallback)(e=>{let t=e.currentTarget;try{t.focus(),t.select(),t.setSelectionRange(0,t.value.length)}catch{}},[]),f=n?.host??``,p=n?`${n.hostname}${n.pathname}${n.search}${n.hash}`.replace(/\/{2,}/g,`/`):e;return(0,F.jsxs)(`div`,{className:`sf-reply-row sf-actionurl`,children:[(0,F.jsxs)(`div`,{className:`sf-actionurl__head`,children:[(0,F.jsxs)(`label`,{className:`sf-label sf-actionurl__label`,children:[`Proof of Breath™ `,(0,F.jsx)(`span`,{className:`sf-muted`,children:`(Sigil-Glyph)`})]}),(0,F.jsx)(`span`,{className:`sf-actionurl__pill ${t?`is-ok`:`is-warn`}`,children:t?`SIGNED`:`EXTERNAL`})]}),(0,F.jsxs)(`div`,{className:`sf-actionurl__field`,children:[(0,F.jsxs)(`div`,{className:`sf-actionurl__inputWrap`,children:[(0,F.jsx)(`input`,{className:`sf-input sf-input--locked sf-actionurl__input`,type:`url`,value:e,readOnly:!0,onClick:d,onFocus:d,"aria-label":`Proof of Breath™ Sigil-Glyph`}),(0,F.jsxs)(`div`,{className:`sf-actionurl__meta`,"aria-hidden":`true`,children:[f?(0,F.jsx)(`span`,{className:`sf-actionurl__host`,children:f}):(0,F.jsx)(`span`,{className:`sf-actionurl__host`,children:`URL`}),(0,F.jsx)(`span`,{className:`sf-actionurl__dot`,children:`•`}),(0,F.jsx)(`span`,{className:`sf-actionurl__pretty`,children:p})]})]}),(0,F.jsxs)(`div`,{className:`sf-actionurl__btns`,children:[(0,F.jsx)(`button`,{type:`button`,className:`sf-actionurl__btn ${i?`is-copied`:``} ${o?`is-fail`:``}`,onClick:u,"aria-live":`polite`,children:i?`✓ Remembered`:o?`Remember failed`:`Remember`}),r?(0,F.jsx)(`a`,{className:`sf-actionurl__btn sf-actionurl__btn--link`,href:r,target:`_blank`,rel:`noreferrer noopener`,"aria-label":`Open Proof of Breath URL in a new tab`,children:`↗`}):(0,F.jsx)(`button`,{type:`button`,className:`sf-actionurl__btn sf-actionurl__btn--disabled`,disabled:!0,children:`↗`})]})]}),!t&&(0,F.jsx)(`div`,{className:`sf-warn sf-actionurl__warn`,role:`status`,children:`Not recognized as a sealed Proof of Breath™ link; fallback rules may apply.`})]})}function He(){return(0,F.jsxs)(`div`,{className:`sf-reply-row sf-actionurl sf-actionurl--empty`,children:[(0,F.jsxs)(`div`,{className:`sf-actionurl__head`,children:[(0,F.jsxs)(`label`,{className:`sf-label sf-actionurl__label`,children:[`Proof of Breath™ `,(0,F.jsx)(`span`,{className:`sf-muted`,children:`(Sigil-Glyph)`})]}),(0,F.jsx)(`span`,{className:`sf-actionurl__pill is-warn`,children:`MISSING`})]}),(0,F.jsx)(`div`,{className:`sf-warn sf-actionurl__warn`,role:`status`,children:`No Proof of Breath™ sigil-glyph detected; a fallback will be used.`})]})}function Ue({meta:e,svgText:t}){let n=Ne(e),r=Pe(t),i=[...n,...r],a=i.length?ze(i):``,o=a.length>0&&ge(a);return{value:a,isCanonical:o,node:a?(0,F.jsx)(Ve,{value:a,isCanonical:o}):(0,F.jsx)(He,{})}}function We(e){let t=e.trim();if(!t)return null;let n=t.replace(/^(kai|sigil):\/\//i,`https://`);try{if(de(n))return n;if(/^[a-z0-9.-]+\.[a-z]{2,}(?:\/.*)?$/i.test(n))return`https://${n}`}catch{}return null}function Ge({onAdd:e,placeholder:t=`Paste any message (https://… or domain.tld)`,title:n=`Inhale a memory`}){let r=ce(),[i,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(null),c=(0,P.useCallback)(t=>{s(null);let n=We(t);if(!n){s(`Enter a valid URL (https://… or domain.tld).`);return}e(n),a(``),r.push(`success`,`Link inhaled.`)},[e,r]),l=(0,P.useCallback)(async()=>{s(null);try{let e=(await navigator.clipboard.readText()).trim();if(!e){s(`Memory is empty.`);return}let t=We(e);if(!t){s(`Memory does not contain a valid link.`);return}a(t),c(t)}catch{s(`Memory read is not permitted.`)}},[c]);return(0,F.jsxs)(`section`,{className:`sf-inhaler`,"aria-labelledby":`inhaler-title`,style:{marginTop:`1rem`},children:[(0,F.jsx)(`h2`,{id:`inhaler-title`,className:`sf-reply-title`,children:n}),(0,F.jsxs)(`div`,{className:`sf-reply-row`,style:{display:`grid`,gap:`.5rem`},children:[(0,F.jsx)(`input`,{className:`sf-input`,type:`url`,placeholder:t,value:i,onChange:e=>a(e.target.value),autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,inputMode:`url`,enterKeyHint:`go`,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),c(i))}}),(0,F.jsxs)(`div`,{className:`sf-reply-actions`,style:{gap:`.5rem`,display:`flex`,flexWrap:`wrap`},children:[(0,F.jsx)(`button`,{className:`sf-btn`,onClick:()=>c(i),children:`Inhale`}),(0,F.jsx)(`button`,{className:`sf-btn sf-btn--ghost`,onClick:l,children:`Inhale from memory`})]}),o&&(0,F.jsx)(`div`,{className:`sf-error`,role:`alert`,children:o})]})]})}const Ke=[`Solhara`,`Aquaris`,`Flamora`,`Verdari`,`Sonari`,`Kaelith`],qe={Solhara:`Root`,Aquaris:`Sacral`,Flamora:`Solar Plexus`,Verdari:`Heart`,Sonari:`Throat`,Kaelith:`Krown`},Je=[`Aethon`,`Virelai`,`Solari`,`Amarin`,`Kaelus`,`Umbriel`,`Noktura`,`Liora`],Ye=[`Awakening Flame`,`Flowing Heart`,`Radiant Will`,`Harmonic Voh`,`Inner Mirror`,`Dreamfire Memory`,`Krowned Light`],Xe=Date.UTC(2024,4,10,6,45,41,888),Ze=3+Math.sqrt(5),Qe=Ze*1e3,$e=1000000n,et=17491270421n,tt=11000000n,nt=(et+18n)/36n;function rt(e){return ue((e.getTime()-Xe)/1e3/Ze*1e6)}function it(e){let t=rt(e),n=R(t,et),r=z(t,et),i=Number(z(n,nt)),a=n-BigInt(i)*nt,o=Number(a/tt),s=Math.min(Math.max(o,0),43),c=a-BigInt(s)*tt,l=Number(c)/Number(tt),u=Number(z(t,$e)),d=Number(a/$e),f=Number(n/$e),p=Ke[Number(R(r,BigInt(6)))],m=qe[p],h=Number(r),g=(h%42+42)%42+1,_=(Math.floor(h/42)%8+8)%8,v=_+1,y=Je[_],b=Math.floor(h/336),x=Math.floor((g-1)/6),S=Ye[x];return{pulse:u,beat:i,step:s,stepPct:l,pulsesIntoBeat:d,pulsesIntoDay:f,harmonicDay:p,chakraDay:m,chakraStepString:`${i}:${L(s)}`,dayOfMonth:g,monthIndex0:_,monthIndex1:v,monthName:y,yearIndex:b,weekIndex:x,weekName:S,_pμ_in_day:n,_pμ_in_beat:a}}function at(e){try{let t=new URL(e).pathname.split(`/`).pop()||``,n=t.lastIndexOf(`.`);return n>=0?t.slice(n+1).toLowerCase():``}catch{return``}}function ot(e){return[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`bmp`].includes(e)}function st(e){return[`mp4`,`webm`,`ogg`,`ogv`,`mov`,`m4v`].includes(e)}function ct(e){return e===`pdf`}function lt(e){try{return new URL(e).host}catch{return``}}function ut(e){try{let t=new URL(e),n=t.host,r=t.pathname||``;r===`/`&&(r=``),r.endsWith(`/`)&&r.length>1&&(r=r.slice(0,-1));let i=t.search||``;return`${n}${r}${i}`}catch{return e.replace(/^https?:\/\//i,``).replace(/\/+$/g,``)}}function dt(e){try{let t=new URL(e);if(t.hostname.includes(`youtu.be`))return t.pathname.slice(1)||null;if(t.hostname.includes(`youtube.com`)){let e=t.searchParams.get(`v`);if(e)return e;let n=t.pathname.split(`/`).filter(Boolean),r=n.indexOf(`embed`);if(r>=0&&n[r+1])return n[r+1]}return null}catch{return null}}function ft(e){try{let t=new URL(e);return t.hostname.includes(`vimeo.com`)&&t.pathname.split(`/`).filter(Boolean).find(e=>/^\d+$/.test(e))||null}catch{return null}}function pt(e){try{let t=new URL(e);return t.hostname.includes(`spotify.com`)&&(t.pathname.startsWith(`/track/`)||t.pathname.startsWith(`/album/`)||t.pathname.startsWith(`/playlist/`))?`https://open.spotify.com/embed${t.pathname}${t.search}`:null}catch{return null}}function mt({host:e}){return(0,F.jsx)(`img`,{className:`sf-favicon`,src:`https://${e}/favicon.ico`,alt:``,width:16,height:16,loading:`eager`,decoding:`async`,onError:e=>{e.currentTarget.style.visibility=`hidden`}})}function ht(e){let{url:t,title:n,children:r}=e,i=lt(t),a=(n&&n.trim().length?n.trim():``)||ut(t);return(0,F.jsxs)(`div`,{className:`sf-att-card`,children:[(0,F.jsx)(`div`,{className:`sf-att-head`,children:(0,F.jsxs)(`a`,{className:`sf-att-head__hit`,href:t,target:`_blank`,rel:`noopener noreferrer`,title:t,children:[i?(0,F.jsx)(mt,{host:i}):(0,F.jsx)(`span`,{className:`sf-favicon sf-favicon--blank`,"aria-hidden":`true`}),(0,F.jsx)(`div`,{className:`sf-att-head__text`,children:(0,F.jsx)(`div`,{className:`sf-att-head__title`,children:a})}),(0,F.jsx)(`span`,{className:`sf-att-open`,"aria-hidden":`true`,children:`↗`})]})}),r?(0,F.jsx)(`div`,{className:`sf-att-body`,children:r}):null]})}function gt({src:e,title:t}){return(0,F.jsx)(`div`,{className:`sf-embed`,children:(0,F.jsx)(`iframe`,{className:`sf-embed__frame`,src:e,title:t,loading:`eager`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share`,allowFullScreen:!0,sandbox:`allow-same-origin allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox`})})}function _t({url:e,title:t}){return(0,F.jsx)(ht,{url:e,title:t})}function vt({url:e,title:t}){let n=dt(e);if(n)return(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(gt,{src:`https://www.youtube.com/embed/${n}`,title:t||`YouTube`})});let r=ft(e);if(r)return(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(gt,{src:`https://player.vimeo.com/video/${r}`,title:t||`Vimeo`})});let i=pt(e);if(i)return(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(gt,{src:i,title:t||`Spotify`})});let a=at(e);return ot(a)?(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(`div`,{className:`sf-media sf-media--image`,children:(0,F.jsx)(`img`,{className:`sf-media__img`,src:e,alt:t||`image`,loading:`eager`,decoding:`async`})})}):st(a)?(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(`div`,{className:`sf-media sf-media--video`,children:(0,F.jsx)(`video`,{className:`sf-media__video`,src:e,controls:!0,playsInline:!0,preload:`metadata`})})}):ct(a)?(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(`div`,{className:`sf-embed sf-embed--doc`,children:(0,F.jsx)(`iframe`,{className:`sf-embed__frame`,src:e,title:t||`Document`,loading:`eager`})})}):(0,F.jsx)(_t,{url:e,title:t})}function yt(e){let t=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`)),n=``;for(let r=0;r`data:${t};base64,${xt(e)}`;async function Ct(e){let t=typeof crypto<`u`&&crypto.subtle||typeof window<`u`&&window.crypto&&window.crypto.webkitSubtle;if(!t)throw Error(`WebCrypto.subtle is not available in this context.`);let n=await t.digest(`SHA-256`,e);return yt(new Uint8Array(n))}async function wt(e,t=524288){let n=[],r=0,i=0;for(let a of Array.from(e)){r+=a.size;try{let e=await a.arrayBuffer(),r=await Ct(e),o=a.type||`application/octet-stream`;if(a.size<=t){let t=bt(new Uint8Array(e)),s={kind:`file-inline`,name:a.name,type:o,size:a.size,sha256:r,data_b64url:t};i+=a.size,n.push(s)}else{let e={kind:`file-ref`,name:a.name,type:o,size:a.size,sha256:r};n.push(e)}}catch(e){B(`filesToManifest: read/hash failed`,e)}}return{version:1,totalBytes:r,inlinedBytes:i,items:n}}function Tt({n:e}){if(typeof e!=`number`||!Number.isFinite(e)||e<0)return(0,F.jsx)(F.Fragment,{children:`—`});let t=1024,n=t*1024,r=n*1024;return(0,F.jsx)(F.Fragment,{children:e>=r?`${(e/r).toFixed(2)} GB`:e>=n?`${(e/n).toFixed(2)} MB`:e>=t?`${(e/t).toFixed(2)} KB`:`${Math.round(e)} B`})}function Et({it:e}){let t=e.type||`application/octet-stream`,n=St(e.data_b64url,t),r=e.name||`file`;if(t.startsWith(`image/`))return(0,F.jsxs)(`div`,{className:`sf-media sf-media--image`,children:[(0,F.jsx)(`img`,{src:n,alt:r,loading:`eager`,decoding:`async`}),(0,F.jsxs)(`div`,{className:`sf-file-meta`,children:[(0,F.jsx)(`span`,{children:r}),(0,F.jsx)(`span`,{children:(0,F.jsx)(Tt,{n:e.size})})]}),(0,F.jsx)(`a`,{className:`sf-file-dl`,href:n,download:r,children:`Download`})]});if(t.startsWith(`video/`))return(0,F.jsxs)(`div`,{className:`sf-media sf-media--video`,children:[(0,F.jsx)(`video`,{src:n,controls:!0,playsInline:!0,preload:`metadata`}),(0,F.jsxs)(`div`,{className:`sf-file-meta`,children:[(0,F.jsx)(`span`,{children:r}),(0,F.jsx)(`span`,{children:(0,F.jsx)(Tt,{n:e.size})})]}),(0,F.jsx)(`a`,{className:`sf-file-dl`,href:n,download:r,children:`Download`})]});if(t.startsWith(`audio/`))return(0,F.jsxs)(`div`,{className:`sf-media sf-media--audio`,children:[(0,F.jsx)(`audio`,{src:n,controls:!0,preload:`metadata`}),(0,F.jsxs)(`div`,{className:`sf-file-meta`,children:[(0,F.jsx)(`span`,{children:r}),(0,F.jsx)(`span`,{children:(0,F.jsx)(Tt,{n:e.size})})]}),(0,F.jsx)(`a`,{className:`sf-file-dl`,href:n,download:r,children:`Download`})]});let i=t.startsWith(`text/`)||[`application/json`,`application/xml`,`application/svg+xml`].includes(t),a=null;if(i)try{a=atob(e.data_b64url.replace(/-/g,`+`).replace(/_/g,`/`)).slice(0,1200)}catch{a=null}return(0,F.jsxs)(`div`,{className:`sf-file`,children:[(0,F.jsxs)(`div`,{className:`sf-file-head`,children:[(0,F.jsx)(`div`,{className:`sf-file-name`,children:e.relPath||r}),(0,F.jsx)(`div`,{className:`sf-file-size`,children:(0,F.jsx)(Tt,{n:e.size})})]}),a&&(0,F.jsxs)(`pre`,{className:`sf-file-pre`,"aria-label":`${r} preview`,children:[a,a.length>=1200?` +import{Q as e,Sn as t,Tn as n,at as r,bn as i,ct as a,dn as o,et as s,gn as c,gt as l,hn as u,in as d,it as f,jn as p,mn as m,on as h,ot as g,pt as _,rn as v,rt as y,sn as b,tn as x,tt as S,un as C,ut as w,vn as T,w as E,wn as D,yn as O}from"./index-BlYU7j-M.js";import{n as k}from"./EternalKlock-CdflKbWu.js";import{n as A}from"./SigilAuthContext-CIPXJp4C.js";import{n as ee,t as j}from"./sigilRegistry-dB0OrrJi.js";import{t as M}from"./SigilAuthProvider-ea2w3ibF.js";import{a as te,i as N,n as ne,o as re,r as ie,t as ae}from"./usernameClaimRegistry-B6UXZAUR.js";import{t as oe}from"./useFastPress-MOMn9nZb.js";var P=p(n(),1);const se=(0,P.createContext)(null);function ce(){let e=(0,P.useContext)(se);if(!e)throw Error(`useToasts() must be used within `);return e}var F=p(x(),1);function le({children:e}){let[t,n]=(0,P.useState)([]),r=(0,P.useRef)(new Map),i=(0,P.useRef)(1),a=(0,P.useCallback)(e=>{let t=r.current.get(e);typeof t==`number`&&(window.clearTimeout(t),r.current.delete(e))},[]),o=(0,P.useCallback)(e=>{a(e),n(t=>t.filter(t=>t.id!==e))},[a]),s=(0,P.useCallback)((e,t)=>{let s=i.current++;n(n=>{let r=[{id:s,kind:e,text:t},...n],i=r.slice(0,3),o=r.slice(3);for(let e of o)a(e.id);return i});let c=window.setTimeout(()=>o(s),2600);r.current.set(s,c)},[a,o]),c=(0,P.useMemo)(()=>({push:s}),[s]);(0,P.useEffect)(()=>()=>{for(let e of r.current.values())window.clearTimeout(e);r.current.clear()},[]);let l=e=>{switch(e){case`success`:return`rgba(16,28,22,.88)`;case`warn`:return`rgba(28,24,12,.88)`;case`error`:return`rgba(36,16,16,.88)`;case`info`:default:return`rgba(12,18,28,.88)`}};return(0,F.jsxs)(se.Provider,{value:c,children:[e,(0,F.jsx)(`div`,{"aria-live":`polite`,"aria-atomic":`false`,style:{position:`fixed`,left:0,right:0,bottom:0,padding:`8px 12px`,display:`grid`,gap:8,zIndex:1e3,pointerEvents:`none`},children:t.map(e=>(0,F.jsx)(`div`,{role:`status`,style:{pointerEvents:`auto`,marginInline:`auto`,maxWidth:`min(720px, 100%)`,width:`100%`,background:l(e.kind),border:`1px solid rgba(255,255,255,.12)`,borderRadius:12,padding:`10px 12px`,color:`rgb(236,241,251)`,boxShadow:`0 8px 28px rgba(0,0,0,.35)`,backdropFilter:`blur(6px)`,fontVariantNumeric:`tabular-nums`},children:e.text},e.id))})]})}var I=le;function L(e){return String(e).padStart(2,`0`)}function R(e,t){let n=e%t;return n<0n?n+(t<0n?-t:t):n}function z(e,t){let n=e/t,r=e%t;return r!==0n&&r>0n!=t>0n?n-1n:n}function ue(e){if(!Number.isFinite(e))return 0n;let t=e<0?-1:1,n=Math.abs(e),r=Math.trunc(n),i=n-r;return i<.5?BigInt(t*r):i>.5?BigInt(t*(r+1)):BigInt(t*(r%2==0?r:r+1))}function B(e,t){try{let n=t instanceof Error?t.message:String(t);console.warn(`[SigilStream:${e}] ${n}`)}catch{}}function V(e){return typeof e==`object`&&!!e}function de(e){try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}}function H(e,t){if(!V(e))return;let n=e[t];if(typeof n==`string`)return n;let r=e.meta;if(V(r)){let e=r[t];if(typeof e==`string`)return e}}function fe(e){let t=e;if(V(t)&&`auth`in t&&(t=t.auth),V(t)){let e=t.meta,n=t.svgText;return{meta:V(e)?e:null,svgText:typeof n==`string`?n:null}}return{meta:null,svgText:null}}async function pe(){try{let e=await fetch(`/links.json`,{cache:`no-store`});if(!e.ok||!(e.headers.get(`content-type`)??``).toLowerCase().includes(`application/json`))return[];let t=await e.text(),n=JSON.parse(t);if(!Array.isArray(n))return[];let r=[];for(let e of n)V(e)&&typeof e.url==`string`&&e.url.trim().length&&r.push({url:e.url});return r}catch(e){return B(`loadLinksJson`,e),[]}}const U=`sf-links`;function W(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)&&t.every(e=>typeof e==`string`)?t:[]}catch(e){return B(`parseStringArray`,e),[]}}function G(e){try{if(typeof window>`u`)return;let t=W(localStorage.getItem(U)),n=e.filter(e=>typeof e==`string`&&e.trim().length);if(n.length===0)return;let r=new Set(t),i=n.filter(e=>!r.has(e));if(i.length===0)return;let a=[...i,...t];localStorage.setItem(U,JSON.stringify(a))}catch(e){B(`prependUniqueToStorage`,e)}}const me=(()=>{try{return((typeof window<`u`?window.__PSHORT__:void 0)?.trim()||(void 0)?.trim()||``).replace(/\s+/g,``)}catch(e){return B(`Resolve PSHORT`,e),``}})();function he(){try{if(me)return new URL(`/`,me)}catch(e){B(`Invalid PSHORT`,e)}let e=typeof window<`u`?window.location.href:`https://example.com`;return new URL(`/`,e)}function K(){let e=typeof window<`u`?window.location.href:`https://example.com`;return new URL(`/`,e)}function ge(e){try{let t=new URL(e);if(!(t.protocol===`https:`||t.protocol===`http:`))return!1;let n=t.pathname;if(n.startsWith(`/stream/p/`)||n.startsWith(`/p~`)&&n.length>3)return!0;if(n===`/p`){let e=t.hash.includes(`t=`),n=t.searchParams.has(`t`);return e||n}return t.search.includes(`p=`)}catch{return!1}}function _e(e){try{let t=he(),n=new URL(e,t),r=K();if(n.pathname.startsWith(`/p~`)&&n.pathname.length>3){r.pathname=`/stream/p/${n.pathname.slice(3)}`;let e=n.searchParams.get(`add`)||(n.hash.startsWith(`#add=`)?new URLSearchParams(n.hash.slice(1)).get(`add`):null);return e&&r.searchParams.set(`add`,ve(e)),r.toString()}if(n.pathname===`/p`){let t=n.hash.startsWith(`#`)?n.hash.slice(1):n.hash,i=new URLSearchParams(t),a=i.get(`t`),o=n.searchParams.get(`t`),s=a||o;if(!s)return e;r.pathname=`/stream/p/${s}`;let c=i.get(`add`),l=n.searchParams.get(`add`),u=c||l;return u&&r.searchParams.set(`add`,ve(u)),r.toString()}return e}catch(t){return B(`expandShortAliasToCanonical`,t),e}}function ve(e){let t=e.trim();if(!t)return t;try{if(t.startsWith(`/p~`))return _e(`${he().origin}${t}`);if(t.startsWith(`/p#t=`)||t.startsWith(`#t=`)||t.includes(`/p?t=`))return _e(t.startsWith(`#t=`)?`${he().origin}/p${t}`:t.startsWith(`/p`)?`${he().origin}${t}`:t);if(de(t)){let e=new URL(t);return e.pathname===`/p`||e.pathname.startsWith(`/p~`)?_e(t):t}return t}catch(e){return B(`normalizeAddParam`,e),t}}function ye(e){let t=K();return t.pathname=`/stream/p/${e}`.replace(/\/{2,}/g,`/`),t.search=``,t.hash=``,t.toString()}function be(e){let t=e.trim();if(t.startsWith(`#`)&&(t=t.slice(1)),t.length===3&&(t=t.split(``).map(e=>e+e).join(``)),t.length!==6)return null;let n=parseInt(t,16);return[n>>16&255,n>>8&255,n&255]}var xe=(e,t=0,n=255)=>Math.max(t,Math.min(n,e));function Se(e,t,n){return[xe(e[0]+(t[0]-e[0])*n),xe(e[1]+(t[1]-e[1])*n),xe(e[2]+(t[2]-e[2])*n)]}var Ce=e=>`${e[0]}, ${e[1]}, ${e[2]}`,we={root:`#FF3B3B`,sacral:`#FF8A33`,solar:`#FFD60A`,heart:`#22C55E`,throat:`#0EA5E9`,thirdEye:`#6366F1`,crown:`#C084FC`},Te=`crown`;function Ee(e){if(e==null)return null;let t;return t=typeof e==`number`?[`root`,`sacral`,`solar`,`heart`,`throat`,`thirdEye`,`crown`][Math.min(7,Math.max(1,e))-1]:e===`krown`?Te:e,be(we[t]??we.crown)}function De(e){let t=Ee(e);if(!t)return null;let n=[255,255,255],r=[255,215,128],i=Se(t,n,.28),a=Se(t,r,.42);return{s1:Ce(t),s2:Ce(i),s3:Ce(a)}}var Oe={s1:`154, 230, 255`,s2:`196, 181, 253`,s3:`255, 215, 128`};function ke(e,t){let n=De(e);if(n)return n;if(t?.primary){let e=be(t.primary)??be(`#9AE6FF`),n=t.secondary?be(t.secondary)??e:Se(e,[255,255,255],.28),r=[255,215,128],i=t.accent?be(t.accent)??r:Se(e,r,.45);return{s1:Ce(e),s2:Ce(n),s3:Ce(i)}}return Oe}function Ae(e){if(!e)return;let t=e.trim();if(t)return t.startsWith(`@`),t}function je({username:e,phiKey:t,kaiSignature:n,sigilColors:r,chakra:i}){let a=ke(i,r),o=Ae(e),s={"--sigil-1":a.s1,"--sigil-2":a.s2,"--sigil-3":a.s3},c=!o&&!t&&!n;return(0,F.jsx)(`div`,{className:`sf-identity`,style:s,...c?{"data-empty":``}:{},children:(0,F.jsxs)(`div`,{className:`sf-reply-id`,style:{rowGap:`.4rem`,columnGap:`.4rem`,display:`flex`,flexWrap:`wrap`},"aria-label":c?`No identity loaded`:`Identity chips`,children:[c&&(0,F.jsx)(`span`,{className:`sf-muted`,children:`No identity loaded this session.`}),o&&(0,F.jsxs)(`span`,{className:`sf-pill sf-pill--user`,title:`Username (session)`,children:[(0,F.jsx)(`strong`,{className:`sf-pill__label`,children:`User`}),`\xA0`,(0,F.jsx)(`span`,{className:`sf-key`,children:o})]}),t&&(0,F.jsxs)(`span`,{className:`sf-pill sf-pill--phikey`,title:`Your ΦKey (session)`,children:[(0,F.jsx)(`strong`,{className:`sf-pill__label`,children:`ΦKey`}),`\xA0`,(0,F.jsx)(`span`,{className:`sf-key`,children:t})]}),n&&(0,F.jsxs)(`span`,{className:`sf-pill sf-pill--ksig`,title:`Kai Signature (session)`,children:[(0,F.jsx)(`strong`,{className:`sf-pill__label`,children:`ΣSig`}),`\xA0`,(0,F.jsx)(`span`,{className:`sf-key`,children:n})]})]})})}var Me=[`sigilActionUrl`,`sigilUrl`,`actionUrl`,`claimedUrl`,`loginUrl`,`sourceUrl`,`originUrl`,`url`,`link`,`href`];function Ne(e){if(!e||!V(e))return[];let t=[],n=new Set;for(let r of Me){let i=H(e,r);if(typeof i!=`string`)continue;let a=i.trim();a&&(n.has(a)||(n.add(a),t.push(a)))}return t}function Pe(e){if(!e)return[];try{let t=e.match(/https?:\/\/[^\s"'<>)#]+/gi)??[],n=[],r=new Set;for(let e of t){let t=(e??``).trim();t&&(r.has(t)||(r.add(t),n.push(t)))}return n}catch{return[]}}function Fe(e){return/^https?:\/\//i.test((e??``).trim())}function Ie(e){try{return new URL(e)}catch{return null}}function Le(e){let t=(e??``).trim();if(!t)return``;let n=t;n=n.replace(/\/stream\/v=/gi,`/stream/t=`),n=n.replace(/\/stream\/v\//gi,`/stream/t/`),n=n.replace(/\/stream\/v(\?|&|#)/gi,`/stream/t$1`),n=n.replace(/([?&#])v=/gi,`$1t=`);let r=Ie(n);if(!r)return n.replace(/([?&#])v=/gi,`$1t=`);let i=r.searchParams,a=(i.get(`t`)??``).trim().length>0,o=(i.get(`v`)??``).trim();if(!a&&o&&i.set(`t`,o),i.delete(`v`),(i.get(`t`)??``).trim().length>0&&i.delete(`p`),r.hash&&r.hash.length>1){let e=r.hash.startsWith(`#`)?r.hash.slice(1):r.hash;if(e.includes(`=`)&&!e.startsWith(`/`)){let t=e.split(`&`).filter(Boolean),n=[],i=!1;for(let e of t){let t=e.indexOf(`=`);if(t<=0){n.push(e);continue}let r=e.slice(0,t),a=e.slice(t+1),o=r.toLowerCase();if(o===`v`){!i&&a.trim().length&&(n.push(`t=${a}`),i=!0);continue}o===`t`&&(i=!0),n.push(e)}if(i){let e=[];for(let t of n){let n=t.indexOf(`=`);(n>0?t.slice(0,n).toLowerCase():``)!==`p`&&e.push(t)}r.hash=e.length?`#${e.join(`&`)}`:``}else r.hash=n.length?`#${n.join(`&`)}`:``}else r.hash=r.hash.replace(/([?&#])v=/gi,`$1t=`)}return r.toString()}function Re(e){let t=(e??``).trim();if(!t)return-1;let n=t.toLowerCase(),r=0;return(/[?&#]v=/.test(n)||n.includes(`/stream/v`))&&(r-=1e4),(/[?&#]t=/.test(n)||n.includes(`/stream/t`)||n.includes(`stream/t=`))&&(r+=500),(/[?&#]p=/.test(n)||n.includes(`/stream/p`)||n.includes(`stream/p=`))&&(r+=280),ge(t)&&(r+=160),n.startsWith(`https://`)?r+=20:n.startsWith(`http://`)&&(r+=10),r+=Math.max(0,120-Math.min(120,Math.floor(t.length/6))),r}function ze(e){let t=``,n=-1;for(let r of e){let e=Le(r),i=Re(e);i>n&&(n=i,t=e)}return t}async function Be(e){let t=e??``;if(!t)return!1;try{if(typeof navigator<`u`&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(t),!0}catch{}try{let e=document.createElement(`textarea`);e.value=t,e.setAttribute(`readonly`,`true`),e.style.position=`fixed`,e.style.left=`-9999px`,e.style.top=`-9999px`,document.body.appendChild(e),e.select(),e.setSelectionRange(0,e.value.length);let n=document.execCommand(`copy`);return document.body.removeChild(e),n}catch{return!1}}function Ve({value:e,isCanonical:t}){let n=(0,P.useMemo)(()=>Ie(e),[e]),r=(0,P.useMemo)(()=>Fe(e)?e:``,[e]),[i,a]=(0,P.useState)(!1),[o,s]=(0,P.useState)(!1),c=(0,P.useRef)(null);(0,P.useEffect)(()=>()=>{c.current&&window.clearTimeout(c.current)},[]);let l=(0,P.useCallback)(e=>{c.current&&window.clearTimeout(c.current),a(e),s(!e),c.current=window.setTimeout(()=>{a(!1),s(!1),c.current=null},1400)},[]),u=(0,P.useCallback)(async()=>{l(await Be(e))},[l,e]),d=(0,P.useCallback)(e=>{let t=e.currentTarget;try{t.focus(),t.select(),t.setSelectionRange(0,t.value.length)}catch{}},[]),f=n?.host??``,p=n?`${n.hostname}${n.pathname}${n.search}${n.hash}`.replace(/\/{2,}/g,`/`):e;return(0,F.jsxs)(`div`,{className:`sf-reply-row sf-actionurl`,children:[(0,F.jsxs)(`div`,{className:`sf-actionurl__head`,children:[(0,F.jsxs)(`label`,{className:`sf-label sf-actionurl__label`,children:[`Proof of Breath™ `,(0,F.jsx)(`span`,{className:`sf-muted`,children:`(Sigil-Glyph)`})]}),(0,F.jsx)(`span`,{className:`sf-actionurl__pill ${t?`is-ok`:`is-warn`}`,children:t?`SIGNED`:`EXTERNAL`})]}),(0,F.jsxs)(`div`,{className:`sf-actionurl__field`,children:[(0,F.jsxs)(`div`,{className:`sf-actionurl__inputWrap`,children:[(0,F.jsx)(`input`,{className:`sf-input sf-input--locked sf-actionurl__input`,type:`url`,value:e,readOnly:!0,onClick:d,onFocus:d,"aria-label":`Proof of Breath™ Sigil-Glyph`}),(0,F.jsxs)(`div`,{className:`sf-actionurl__meta`,"aria-hidden":`true`,children:[f?(0,F.jsx)(`span`,{className:`sf-actionurl__host`,children:f}):(0,F.jsx)(`span`,{className:`sf-actionurl__host`,children:`URL`}),(0,F.jsx)(`span`,{className:`sf-actionurl__dot`,children:`•`}),(0,F.jsx)(`span`,{className:`sf-actionurl__pretty`,children:p})]})]}),(0,F.jsxs)(`div`,{className:`sf-actionurl__btns`,children:[(0,F.jsx)(`button`,{type:`button`,className:`sf-actionurl__btn ${i?`is-copied`:``} ${o?`is-fail`:``}`,onClick:u,"aria-live":`polite`,children:i?`✓ Remembered`:o?`Remember failed`:`Remember`}),r?(0,F.jsx)(`a`,{className:`sf-actionurl__btn sf-actionurl__btn--link`,href:r,target:`_blank`,rel:`noreferrer noopener`,"aria-label":`Open Proof of Breath URL in a new tab`,children:`↗`}):(0,F.jsx)(`button`,{type:`button`,className:`sf-actionurl__btn sf-actionurl__btn--disabled`,disabled:!0,children:`↗`})]})]}),!t&&(0,F.jsx)(`div`,{className:`sf-warn sf-actionurl__warn`,role:`status`,children:`Not recognized as a sealed Proof of Breath™ link; fallback rules may apply.`})]})}function He(){return(0,F.jsxs)(`div`,{className:`sf-reply-row sf-actionurl sf-actionurl--empty`,children:[(0,F.jsxs)(`div`,{className:`sf-actionurl__head`,children:[(0,F.jsxs)(`label`,{className:`sf-label sf-actionurl__label`,children:[`Proof of Breath™ `,(0,F.jsx)(`span`,{className:`sf-muted`,children:`(Sigil-Glyph)`})]}),(0,F.jsx)(`span`,{className:`sf-actionurl__pill is-warn`,children:`MISSING`})]}),(0,F.jsx)(`div`,{className:`sf-warn sf-actionurl__warn`,role:`status`,children:`No Proof of Breath™ sigil-glyph detected; a fallback will be used.`})]})}function Ue({meta:e,svgText:t}){let n=Ne(e),r=Pe(t),i=[...n,...r],a=i.length?ze(i):``,o=a.length>0&&ge(a);return{value:a,isCanonical:o,node:a?(0,F.jsx)(Ve,{value:a,isCanonical:o}):(0,F.jsx)(He,{})}}function We(e){let t=e.trim();if(!t)return null;let n=t.replace(/^(kai|sigil):\/\//i,`https://`);try{if(de(n))return n;if(/^[a-z0-9.-]+\.[a-z]{2,}(?:\/.*)?$/i.test(n))return`https://${n}`}catch{}return null}function Ge({onAdd:e,placeholder:t=`Paste any message (https://… or domain.tld)`,title:n=`Inhale a memory`}){let r=ce(),[i,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(null),c=(0,P.useCallback)(t=>{s(null);let n=We(t);if(!n){s(`Enter a valid URL (https://… or domain.tld).`);return}e(n),a(``),r.push(`success`,`Link inhaled.`)},[e,r]),l=(0,P.useCallback)(async()=>{s(null);try{let e=(await navigator.clipboard.readText()).trim();if(!e){s(`Memory is empty.`);return}let t=We(e);if(!t){s(`Memory does not contain a valid link.`);return}a(t),c(t)}catch{s(`Memory read is not permitted.`)}},[c]);return(0,F.jsxs)(`section`,{className:`sf-inhaler`,"aria-labelledby":`inhaler-title`,style:{marginTop:`1rem`},children:[(0,F.jsx)(`h2`,{id:`inhaler-title`,className:`sf-reply-title`,children:n}),(0,F.jsxs)(`div`,{className:`sf-reply-row`,style:{display:`grid`,gap:`.5rem`},children:[(0,F.jsx)(`input`,{className:`sf-input`,type:`url`,placeholder:t,value:i,onChange:e=>a(e.target.value),autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,inputMode:`url`,enterKeyHint:`go`,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),c(i))}}),(0,F.jsxs)(`div`,{className:`sf-reply-actions`,style:{gap:`.5rem`,display:`flex`,flexWrap:`wrap`},children:[(0,F.jsx)(`button`,{className:`sf-btn`,onClick:()=>c(i),children:`Inhale`}),(0,F.jsx)(`button`,{className:`sf-btn sf-btn--ghost`,onClick:l,children:`Inhale from memory`})]}),o&&(0,F.jsx)(`div`,{className:`sf-error`,role:`alert`,children:o})]})]})}const Ke=[`Solhara`,`Aquaris`,`Flamora`,`Verdari`,`Sonari`,`Kaelith`],qe={Solhara:`Root`,Aquaris:`Sacral`,Flamora:`Solar Plexus`,Verdari:`Heart`,Sonari:`Throat`,Kaelith:`Krown`},Je=[`Aethon`,`Virelai`,`Solari`,`Amarin`,`Kaelus`,`Umbriel`,`Noktura`,`Liora`],Ye=[`Awakening Flame`,`Flowing Heart`,`Radiant Will`,`Harmonic Voh`,`Inner Mirror`,`Dreamfire Memory`,`Krowned Light`],Xe=Date.UTC(2024,4,10,6,45,41,888),Ze=3+Math.sqrt(5),Qe=Ze*1e3,$e=1000000n,et=17491270421n,tt=11000000n,nt=(et+18n)/36n;function rt(e){return ue((e.getTime()-Xe)/1e3/Ze*1e6)}function it(e){let t=rt(e),n=R(t,et),r=z(t,et),i=Number(z(n,nt)),a=n-BigInt(i)*nt,o=Number(a/tt),s=Math.min(Math.max(o,0),43),c=a-BigInt(s)*tt,l=Number(c)/Number(tt),u=Number(z(t,$e)),d=Number(a/$e),f=Number(n/$e),p=Ke[Number(R(r,BigInt(6)))],m=qe[p],h=Number(r),g=(h%42+42)%42+1,_=(Math.floor(h/42)%8+8)%8,v=_+1,y=Je[_],b=Math.floor(h/336),x=Math.floor((g-1)/6),S=Ye[x];return{pulse:u,beat:i,step:s,stepPct:l,pulsesIntoBeat:d,pulsesIntoDay:f,harmonicDay:p,chakraDay:m,chakraStepString:`${i}:${L(s)}`,dayOfMonth:g,monthIndex0:_,monthIndex1:v,monthName:y,yearIndex:b,weekIndex:x,weekName:S,_pμ_in_day:n,_pμ_in_beat:a}}function at(e){try{let t=new URL(e).pathname.split(`/`).pop()||``,n=t.lastIndexOf(`.`);return n>=0?t.slice(n+1).toLowerCase():``}catch{return``}}function ot(e){return[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`bmp`].includes(e)}function st(e){return[`mp4`,`webm`,`ogg`,`ogv`,`mov`,`m4v`].includes(e)}function ct(e){return e===`pdf`}function lt(e){try{return new URL(e).host}catch{return``}}function ut(e){try{let t=new URL(e),n=t.host,r=t.pathname||``;r===`/`&&(r=``),r.endsWith(`/`)&&r.length>1&&(r=r.slice(0,-1));let i=t.search||``;return`${n}${r}${i}`}catch{return e.replace(/^https?:\/\//i,``).replace(/\/+$/g,``)}}function dt(e){try{let t=new URL(e);if(t.hostname.includes(`youtu.be`))return t.pathname.slice(1)||null;if(t.hostname.includes(`youtube.com`)){let e=t.searchParams.get(`v`);if(e)return e;let n=t.pathname.split(`/`).filter(Boolean),r=n.indexOf(`embed`);if(r>=0&&n[r+1])return n[r+1]}return null}catch{return null}}function ft(e){try{let t=new URL(e);return t.hostname.includes(`vimeo.com`)&&t.pathname.split(`/`).filter(Boolean).find(e=>/^\d+$/.test(e))||null}catch{return null}}function pt(e){try{let t=new URL(e);return t.hostname.includes(`spotify.com`)&&(t.pathname.startsWith(`/track/`)||t.pathname.startsWith(`/album/`)||t.pathname.startsWith(`/playlist/`))?`https://open.spotify.com/embed${t.pathname}${t.search}`:null}catch{return null}}function mt({host:e}){return(0,F.jsx)(`img`,{className:`sf-favicon`,src:`https://${e}/favicon.ico`,alt:``,width:16,height:16,loading:`eager`,decoding:`async`,onError:e=>{e.currentTarget.style.visibility=`hidden`}})}function ht(e){let{url:t,title:n,children:r}=e,i=lt(t),a=(n&&n.trim().length?n.trim():``)||ut(t);return(0,F.jsxs)(`div`,{className:`sf-att-card`,children:[(0,F.jsx)(`div`,{className:`sf-att-head`,children:(0,F.jsxs)(`a`,{className:`sf-att-head__hit`,href:t,target:`_blank`,rel:`noopener noreferrer`,title:t,children:[i?(0,F.jsx)(mt,{host:i}):(0,F.jsx)(`span`,{className:`sf-favicon sf-favicon--blank`,"aria-hidden":`true`}),(0,F.jsx)(`div`,{className:`sf-att-head__text`,children:(0,F.jsx)(`div`,{className:`sf-att-head__title`,children:a})}),(0,F.jsx)(`span`,{className:`sf-att-open`,"aria-hidden":`true`,children:`↗`})]})}),r?(0,F.jsx)(`div`,{className:`sf-att-body`,children:r}):null]})}function gt({src:e,title:t}){return(0,F.jsx)(`div`,{className:`sf-embed`,children:(0,F.jsx)(`iframe`,{className:`sf-embed__frame`,src:e,title:t,loading:`eager`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share`,allowFullScreen:!0,sandbox:`allow-same-origin allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox`})})}function _t({url:e,title:t}){return(0,F.jsx)(ht,{url:e,title:t})}function vt({url:e,title:t}){let n=dt(e);if(n)return(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(gt,{src:`https://www.youtube.com/embed/${n}`,title:t||`YouTube`})});let r=ft(e);if(r)return(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(gt,{src:`https://player.vimeo.com/video/${r}`,title:t||`Vimeo`})});let i=pt(e);if(i)return(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(gt,{src:i,title:t||`Spotify`})});let a=at(e);return ot(a)?(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(`div`,{className:`sf-media sf-media--image`,children:(0,F.jsx)(`img`,{className:`sf-media__img`,src:e,alt:t||`image`,loading:`eager`,decoding:`async`})})}):st(a)?(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(`div`,{className:`sf-media sf-media--video`,children:(0,F.jsx)(`video`,{className:`sf-media__video`,src:e,controls:!0,playsInline:!0,preload:`metadata`})})}):ct(a)?(0,F.jsx)(ht,{url:e,title:t,children:(0,F.jsx)(`div`,{className:`sf-embed sf-embed--doc`,children:(0,F.jsx)(`iframe`,{className:`sf-embed__frame`,src:e,title:t||`Document`,loading:`eager`})})}):(0,F.jsx)(_t,{url:e,title:t})}function yt(e){let t=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`)),n=``;for(let r=0;r`data:${t};base64,${xt(e)}`;async function Ct(e){let t=typeof crypto<`u`&&crypto.subtle||typeof window<`u`&&window.crypto&&window.crypto.webkitSubtle;if(!t)throw Error(`WebCrypto.subtle is not available in this context.`);let n=await t.digest(`SHA-256`,e);return yt(new Uint8Array(n))}async function wt(e,t=524288){let n=[],r=0,i=0;for(let a of Array.from(e)){r+=a.size;try{let e=await a.arrayBuffer(),r=await Ct(e),o=a.type||`application/octet-stream`;if(a.size<=t){let t=bt(new Uint8Array(e)),s={kind:`file-inline`,name:a.name,type:o,size:a.size,sha256:r,data_b64url:t};i+=a.size,n.push(s)}else{let e={kind:`file-ref`,name:a.name,type:o,size:a.size,sha256:r};n.push(e)}}catch(e){B(`filesToManifest: read/hash failed`,e)}}return{version:1,totalBytes:r,inlinedBytes:i,items:n}}function Tt({n:e}){if(typeof e!=`number`||!Number.isFinite(e)||e<0)return(0,F.jsx)(F.Fragment,{children:`—`});let t=1024,n=t*1024,r=n*1024;return(0,F.jsx)(F.Fragment,{children:e>=r?`${(e/r).toFixed(2)} GB`:e>=n?`${(e/n).toFixed(2)} MB`:e>=t?`${(e/t).toFixed(2)} KB`:`${Math.round(e)} B`})}function Et({it:e}){let t=e.type||`application/octet-stream`,n=St(e.data_b64url,t),r=e.name||`file`;if(t.startsWith(`image/`))return(0,F.jsxs)(`div`,{className:`sf-media sf-media--image`,children:[(0,F.jsx)(`img`,{src:n,alt:r,loading:`eager`,decoding:`async`}),(0,F.jsxs)(`div`,{className:`sf-file-meta`,children:[(0,F.jsx)(`span`,{children:r}),(0,F.jsx)(`span`,{children:(0,F.jsx)(Tt,{n:e.size})})]}),(0,F.jsx)(`a`,{className:`sf-file-dl`,href:n,download:r,children:`Download`})]});if(t.startsWith(`video/`))return(0,F.jsxs)(`div`,{className:`sf-media sf-media--video`,children:[(0,F.jsx)(`video`,{src:n,controls:!0,playsInline:!0,preload:`metadata`}),(0,F.jsxs)(`div`,{className:`sf-file-meta`,children:[(0,F.jsx)(`span`,{children:r}),(0,F.jsx)(`span`,{children:(0,F.jsx)(Tt,{n:e.size})})]}),(0,F.jsx)(`a`,{className:`sf-file-dl`,href:n,download:r,children:`Download`})]});if(t.startsWith(`audio/`))return(0,F.jsxs)(`div`,{className:`sf-media sf-media--audio`,children:[(0,F.jsx)(`audio`,{src:n,controls:!0,preload:`metadata`}),(0,F.jsxs)(`div`,{className:`sf-file-meta`,children:[(0,F.jsx)(`span`,{children:r}),(0,F.jsx)(`span`,{children:(0,F.jsx)(Tt,{n:e.size})})]}),(0,F.jsx)(`a`,{className:`sf-file-dl`,href:n,download:r,children:`Download`})]});let i=t.startsWith(`text/`)||[`application/json`,`application/xml`,`application/svg+xml`].includes(t),a=null;if(i)try{a=atob(e.data_b64url.replace(/-/g,`+`).replace(/_/g,`/`)).slice(0,1200)}catch{a=null}return(0,F.jsxs)(`div`,{className:`sf-file`,children:[(0,F.jsxs)(`div`,{className:`sf-file-head`,children:[(0,F.jsx)(`div`,{className:`sf-file-name`,children:e.relPath||r}),(0,F.jsx)(`div`,{className:`sf-file-size`,children:(0,F.jsx)(Tt,{n:e.size})})]}),a&&(0,F.jsxs)(`pre`,{className:`sf-file-pre`,"aria-label":`${r} preview`,children:[a,a.length>=1200?` … (truncated preview)`:``]}),(0,F.jsxs)(`div`,{className:`sf-file-foot`,children:[(0,F.jsxs)(`code`,{className:`sf-hash mono`,children:[`sha256:`,e.sha256]}),(0,F.jsx)(`a`,{className:`sf-file-dl`,href:n,download:r,children:`Download`})]})]})}function Dt({it:e}){let t=e.name||`file`;return(0,F.jsxs)(`div`,{className:`sf-fileref`,children:[(0,F.jsxs)(`div`,{className:`sf-file-head`,children:[(0,F.jsx)(`div`,{className:`sf-file-name`,children:e.relPath||t}),(0,F.jsx)(`div`,{className:`sf-file-size`,children:(0,F.jsx)(Tt,{n:e.size})})]}),(0,F.jsxs)(`div`,{className:`sf-file-foot`,children:[(0,F.jsx)(`div`,{className:`sf-file-type`,children:e.type||`application/octet-stream`}),(0,F.jsxs)(`code`,{className:`sf-hash mono`,children:[`sha256:`,e.sha256]})]}),(0,F.jsx)(`div`,{className:`sf-note`,children:`Large file not inlined. Host by hash anywhere and add the public URL as an attachment link.`})]})}function Ot({item:e}){return e.kind===`url`?(0,F.jsx)(vt,{url:e.url,title:e.title}):e.kind===`file-inline`?(0,F.jsx)(Et,{it:e}):(0,F.jsx)(Dt,{it:e})}function kt({manifest:e}){return e.items.length?(0,F.jsxs)(`section`,{className:`sf-attachments`,"aria-labelledby":`sf-att-title`,children:[(0,F.jsx)(`h3`,{id:`sf-att-title`,className:`sf-att-title`,children:`Attachments`}),(0,F.jsx)(`div`,{className:`sf-att-grid`,children:e.items.map((e,t)=>(0,F.jsx)(`div`,{className:`sf-att-item`,children:(0,F.jsx)(Ot,{item:e})},t))}),(0,F.jsxs)(`div`,{className:`sf-att-foot`,children:[(0,F.jsxs)(`span`,{children:[`Total:`,` `,(0,F.jsx)(`strong`,{children:(0,F.jsx)(Tt,{n:e.totalBytes})})]}),typeof e.inlinedBytes==`number`&&e.inlinedBytes>0&&(0,F.jsxs)(`span`,{children:[` `,`• Inlined:`,` `,(0,F.jsx)(`strong`,{children:(0,F.jsx)(Tt,{n:e.inlinedBytes})})]})]})]}):null}function At(e){let t=e.trim();if(!t)return null;if(/^(kai|sigil):\/\//i.test(t))return t.replace(/^(kai|sigil):\/\//i,`https://`);try{if(de(t))return t;if(/^[a-z0-9.-]+\.[a-z]{2,}(\/.*)?$/i.test(t))return`https://${t}`}catch{}return null}function jt(e,t){if(!t)return{next:e,error:`Missing URL.`};if(e.some(e=>e.url===t))return{next:e,error:`Link already added.`};let n={kind:`url`,url:t};return{next:[...e,n],added:n}}function Mt(e,t){return t<0||t>=e.length?e:[...e.slice(0,t),...e.slice(t+1)]}var Nt=512,Pt=`sigil:urls`,Ft=`sigil:feed`,It=`kai-sigil-registry`,Lt=`kai-feed-registry`;function Rt(e){try{return decodeURIComponent(e)}catch{return e}}function zt(e){let t=e.trim();return t.length<16?!1:/^[A-Za-z0-9_-]+$/u.test(t)}function Bt(e){let t=e.trim();if(!t)return``;try{return new URL(t,K().origin).toString()}catch{return t}}function Vt(e){let t=f(e);return t?`t:${t}`:null}function Ht(e){try{let t=new URL(e,K().origin),n=t.hash.startsWith(`#`)?t.hash.slice(1):``;return new URLSearchParams(n).getAll(`add`).length+t.searchParams.getAll(`add`).length}catch{return 0}}function Ut(e){return Ht(e)*1e5+e.length}function Wt(e,t){if(typeof window>`u`||window.localStorage===void 0)return{changed:!1,value:t};let n=Bt(t);if(!n)return{changed:!1,value:t};try{let t=window.localStorage.getItem(e),r=[];if(t){let e=JSON.parse(t);if(Array.isArray(e))for(let t of e)typeof t==`string`&&r.push(t)}let i=[],a=new Map,o=e=>Vt(e)??`u:${Bt(e)}`;for(let e of r){let t=Bt(e);if(!t)continue;let n=o(t),r=Ut(t);a.has(n)?r>a.get(n).score&&a.set(n,{url:t,score:r}):(a.set(n,{url:t,score:r}),i.push(n))}let s=o(n),c=Ut(n);a.has(s)?c>a.get(s).score&&a.set(s,{url:n,score:c}):(a.set(s,{url:n,score:c}),i.push(s));let l=[];for(let e of i){let t=a.get(e);t&&l.push(t.url)}let u=JSON.stringify(r),d=JSON.stringify(l);return u===d?{changed:!1,value:n}:(window.localStorage.setItem(e,d),{changed:!0,value:n})}catch{return{changed:!1,value:n}}}function Gt(e){if(!(typeof window>`u`)){try{window.__SIGIL__?.registerSigilUrl?.(e)}catch{}try{window.dispatchEvent(new CustomEvent(`sigil:url-registered`,{detail:{url:e}}))}catch{}try{if(`BroadcastChannel`in window){let t=new BroadcastChannel(It);t.postMessage({type:`sigil:add`,url:e}),t.close()}}catch{}}}function Kt(e){if(!(typeof window>`u`)){try{window.__FEED__?.registerFeedUrl?.(e)}catch{}try{window.dispatchEvent(new CustomEvent(`feed:url-registered`,{detail:{url:e}}))}catch{}try{if(`BroadcastChannel`in window){let t=new BroadcastChannel(Lt);t.postMessage({type:`feed:add`,url:e}),t.close()}}catch{}}}function qt(e){try{let t=new URL(e,K().origin),n=t.hash.startsWith(`#`)?t.hash.slice(1):``,r=new URLSearchParams(n),i=[...t.searchParams.getAll(`add`),...r.getAll(`add`)],a=[];for(let e of i){let t=Rt(String(e)).trim();if(t){if(t.startsWith(`j:`)&&t.length>10){a.includes(t)||a.push(t);continue}if(zt(t))try{let e=_e(ye(t));e&&!a.includes(e)&&a.push(e);continue}catch{}try{let e=_e(t);e&&!a.includes(e)&&a.push(e)}catch{}}}return a.slice(-Nt)}catch{return[]}}function Jt(e,t){let n=new URL(e,K().origin),r=n.hash.startsWith(`#`)?n.hash.slice(1):``,i=new URLSearchParams(r);i.delete(`add`);for(let e of t)i.append(`add`,e);n.search=``;let a=i.toString();return n.hash=a?`#${a}`:``,n.toString()}function Yt(e){return`${K().origin.replace(/\/+$/g,``)}/stream/p/${encodeURIComponent(e)}`}function Xt(e){try{let t=new URL(e,K().origin),n=t.hash.startsWith(`#`)?t.hash.slice(1):``,r=new URLSearchParams(n).get(`root`)??t.searchParams.get(`root`);if(!r)return null;let i=Rt(String(r)).trim();return i?i.startsWith(`j:`)&&i.length>10?i:/^[A-Za-z0-9_-]{16,}$/u.test(i)?`j:${i}`:null:null}catch{return null}}function Zt(){if(typeof window>`u`)return{replyToUrl:null,originUrl:null,addChain:[]};let e=window.location.href,t=qt(e),n=f(e)??y(window.location),r=n?(()=>{try{return _e(Yt(n))}catch{return Yt(n)}})():null,i=Xt(e),a=!r&&!i&&t.length?t[t.length-1]:null,o=r??i??a;return{replyToUrl:o,originUrl:t.length?t[0]:o,addChain:(a&&t.length?t.slice(0,-1):t.slice(0)).slice(-Nt)}}function Qt({meta:e,svgText:t,onUseDifferentKey:n,inlineLimitBytes:i=512*1024}){let o=ce(),{meta:c,svgText:u}=(0,P.useMemo)(()=>fe({meta:e,svgText:t}),[e,t]),d=(0,P.useMemo)(()=>c?H(c,`userPhiKey`):void 0,[c]),p=(0,P.useMemo)(()=>c?H(c,`kaiSignature`):void 0,[c]),{value:m}=Ue({meta:c,svgText:u}),[h,v]=(0,P.useState)(``),[b,x]=(0,P.useState)(``),[C,T]=(0,P.useState)(``),[E,D]=(0,P.useState)({version:1,totalBytes:0,inlinedBytes:0,items:[]}),[O,k]=(0,P.useState)(``),[A,ee]=(0,P.useState)([]),j=(0,P.useId)(),M=(0,P.useId)(),oe=(0,P.useRef)(null),se=(0,P.useRef)(null),[le,I]=(0,P.useState)(!1),[L,R]=(0,P.useState)(``),[z,ue]=(0,P.useState)(!1),[B,V]=(0,P.useState)(()=>ae()),[de,pe]=(0,P.useState)(null);(0,P.useEffect)(()=>{if(!(typeof window>`u`))try{let e=Zt();if(!e.replyToUrl)return;let t=f(e.replyToUrl)??y(window.location);if(!t)return;let n=s(t);n&&pe(n)}catch{}},[]);let U=(0,P.useMemo)(()=>{if(!de)return null;let e=de.body,t=de.caption??``;e&&(e.kind===`text`?t=e.text:e.kind===`md`?t=e.md:e.kind===`code`?t=e.code:e.kind===`html`&&(t=e.html));let n=t.trim();if(!n)return{author:de.author,url:de.url,snippet:`(Previous memory has no visible text content.)`};let r=n.length>280?`${n.slice(0,279)}…`:n;return{author:de.author,url:de.url,snippet:r}},[de]);(0,P.useEffect)(()=>{V(ae());let e=ie((e,t)=>{V(t=>({...t,[e.normalized]:e}))});return()=>e()},[]);let W=(0,P.useMemo)(()=>re(b),[b]),G=W?B[W]:void 0,me=(0,P.useMemo)(()=>te(C),[C]),he=(0,P.useMemo)(()=>W?G?G.claimHash===me||G.ownerHint&&d&&G.ownerHint===d?`Username claimed by you`:`Username claimed by another`:`Username available`:``,[G,me,W,d]),_e=(0,P.useCallback)(async e=>{let t=e.currentTarget.files;if(!(!t||t.length===0))try{let n=await wt(t,i);D(e=>({version:1,totalBytes:e.totalBytes+n.totalBytes,inlinedBytes:e.inlinedBytes+n.inlinedBytes,items:[...n.items,...e.items]})),e.currentTarget.value=``,o.push(`success`,`Attached.`)}catch(e){console.error(`[Composer] onPickFiles:`,e),o.push(`error`,`Attach failed.`)}},[i,o]),ve=(0,P.useCallback)(e=>{D(t=>{let n=[...t.items],r=n.splice(e,1)[0],i=r&&(r.kind===`file-inline`||r.kind===`file-ref`)?r.size??0:0,a=r&&r.kind===`file-inline`?r.size??0:0;return{version:1,totalBytes:Math.max(0,t.totalBytes-i),inlinedBytes:Math.max(0,t.inlinedBytes-a),items:n}})},[]),ye=e=>{let t=At(e);if(!t){o.push(`warn`,`Invalid URL. Use https://example.com`);return}let{next:n,added:r,error:i}=jt(A,t);if(i){o.push(`warn`,i);return}ee(n),k(``),r&&o.push(`success`,`Link added.`)},be=e=>{ee(t=>Mt(t,e))},xe=async()=>{if(!le){I(!0);try{let e=(m||``).trim();(!e||!ge(e))&&o.push(`info`,`No sigil URL detected; using fallback.`);let t=h.trim(),n=b.trim(),i=re(n),s=A.map(e=>_({url:e.url,title:e.title})),u=E.items.map(e=>e.kind===`file-ref`?a({sha256:e.sha256,name:e.name,type:e.type,size:e.size,url:void 0}):e.kind===`file-inline`?w({name:e.name,type:e.type,size:e.size,data_b64url:e.data_b64url,thumbnail_b64:void 0}):e),v=[...s,...u],y=v.length>0?r(v):void 0,x=it(new Date).pulse,C=t.length>0?{kind:`text`,text:t}:void 0,T;if(i)if(G){if(!me){o.push(`warn`,`Username is claimed. Provide your claim glyph token to seal.`);return}if(me!==G.claimHash){o.push(`warn`,`Claim glyph mismatch. Memory not sealed.`);return}T={hash:G.claimHash,url:G.claimUrl,payload:{kind:l,username:G.username,normalized:G.normalized,originHash:G.originHash,ownerHint:G.ownerHint??null},ownerHint:G.ownerHint??null}}else{if(!c||!p){o.push(`warn`,`Inhale your sigil to mint a username claim.`);return}let e=N({origin:{hash:p,pulseCreated:c?.pulse??x,pulseGenesis:c?.pulse??x,value:1,sentTo:[],receivedFrom:[],metadata:{kaiSignature:p,creator:d??void 0}},username:n,pulse:x,ownerHint:d??null}),t=e.metadata?.usernameClaim;if(t)T={hash:e.hash,payload:t,ownerHint:t.ownerHint??null};else{o.push(`warn`,`Could not mint username-claim glyph.`);return}}let D=Yt(S({...g({url:e||K().origin,pulse:x,caption:t||void 0,body:C,author:n||void 0,sigilId:void 0,phiKey:d??void 0,kaiSignature:p??void 0,parent:void 0,parentUrl:void 0,originUrl:void 0,ts:void 0,attachments:y,usernameClaim:T}),kind:`post`})),O=Zt(),k=[];for(let e of O.addChain){let t=f(e);t&&!k.includes(t)&&k.push(t)}let ee=O.replyToUrl?f(O.replyToUrl):null,j=[...k];ee&&!j.includes(ee)&&j.push(ee);let M=j.length?Jt(D,j.slice(-Nt)):D;if(T){let e=ne({...T,url:T.url??M});if(!e.accepted){o.push(`warn`,e.reason||`Unable to register username claim.`);return}V(e.registry)}await navigator.clipboard.writeText(M),o.push(`success`,`Link kopied. Kai-sealed.`),R(M);try{for(let e of j){let t=Wt(Pt,Yt(e));t.changed&&Gt(t.value)}let e=Wt(Pt,M);e.changed&&Gt(e.value);let t=Wt(Ft,M);t.changed&&Kt(t.value)}catch{}}catch(e){console.error(`[Composer] onGenerateReply:`,e),o.push(`error`,`Could not seal reply.`)}finally{I(!1)}}};return(0,F.jsxs)(`section`,{className:`sf-reply`,"aria-labelledby":`reply-title`,children:[U&&(0,F.jsxs)(`aside`,{className:`sf-reply-context`,"aria-label":`Replying to previous memory`,children:[(0,F.jsxs)(`div`,{className:`sf-reply-context-header`,children:[(0,F.jsx)(`span`,{className:`sf-pill`,children:`Replying to`}),U.author&&(0,F.jsx)(`span`,{className:`sf-reply-context-author`,children:U.author})]}),(0,F.jsx)(`p`,{className:`sf-reply-context-body`,children:U.snippet})]}),(0,F.jsxs)(`div`,{className:`sf-reply-row`,children:[(0,F.jsx)(`label`,{className:`sf-label`,children:`Attach`}),(0,F.jsxs)(`div`,{className:`sf-reply-row-inline`,children:[(0,F.jsx)(`label`,{className:`sf-btn`,htmlFor:M,children:`Record Memory`}),(0,F.jsx)(`label`,{className:`sf-btn sf-btn--ghost`,htmlFor:j,children:`Inhale files`})]}),(0,F.jsx)(`input`,{id:M,ref:se,type:`file`,accept:`image/*,video/*`,capture:`environment`,multiple:!0,onChange:_e,style:{position:`absolute`,opacity:0,pointerEvents:`none`}}),(0,F.jsx)(`input`,{id:j,ref:oe,type:`file`,accept:`image/*,video/*,audio/*,application/pdf,text/plain,application/json,application/xml,application/svg+xml`,multiple:!0,onChange:_e,style:{position:`absolute`,opacity:0,pointerEvents:`none`}}),E.items.length>0&&(0,F.jsx)(`div`,{className:`sf-att-grid`,children:E.items.map((e,t)=>(0,F.jsxs)(`div`,{className:`sf-att-item`,style:{position:`relative`},children:[(0,F.jsx)(Ot,{item:e}),(0,F.jsx)(`button`,{className:`sf-btn sf-btn--icon`,onClick:()=>ve(t),style:{position:`absolute`,top:8,right:8},type:`button`,"aria-label":`Remove attachment`,children:`✕`})]},`${e.kind}:${t}`))})]}),(0,F.jsxs)(`div`,{className:`sf-reply-row`,children:[(0,F.jsx)(`label`,{className:`sf-label`,children:`Add links`}),(0,F.jsxs)(`div`,{className:`sf-reply-row-inline`,children:[(0,F.jsx)(`input`,{className:`sf-input`,type:`url`,placeholder:`https://example.com`,value:O,onChange:e=>k(e.target.value)}),(0,F.jsx)(`button`,{className:`sf-btn`,onClick:()=>ye(O),type:`button`,children:`Add`})]}),A.length>0&&(0,F.jsx)(`div`,{className:`sf-att-grid`,children:A.map((e,t)=>(0,F.jsxs)(`div`,{className:`sf-att-item`,style:{position:`relative`},children:[(0,F.jsx)(Ot,{item:e}),(0,F.jsx)(`button`,{className:`sf-btn sf-btn--icon`,onClick:()=>be(t),style:{position:`absolute`,top:8,right:8},type:`button`,"aria-label":`Remove link`,children:`✕`})]},`${e.kind}:${e.url}:${t}`))})]}),(0,F.jsxs)(`div`,{className:`sf-reply-row`,children:[(0,F.jsx)(`label`,{className:`sf-label`,children:`Author`}),(0,F.jsx)(`input`,{className:`sf-input`,type:`text`,value:b,onChange:e=>x(e.target.value),placeholder:`@you`,"aria-describedby":he?`username-claim-status`:void 0}),he?(0,F.jsx)(`div`,{id:`username-claim-status`,className:`sf-sub`,role:`status`,"aria-live":`polite`,children:he}):null]}),W?(0,F.jsxs)(`div`,{className:`sf-reply-row`,children:[(0,F.jsx)(`label`,{className:`sf-label`,children:`Claim glyph`}),(0,F.jsx)(`input`,{className:`sf-input`,type:`text`,value:C,onChange:e=>T(e.target.value),placeholder:`Paste claim glyph hash or Memory Stream link`})]}):null,(0,F.jsxs)(`div`,{className:`sf-reply-row`,children:[(0,F.jsx)(`label`,{className:`sf-label`,children:`Memory`}),(0,F.jsx)(`textarea`,{className:`sf-textarea`,rows:3,value:h,onChange:e=>v(e.target.value),placeholder:`What do you want this moment to remember?`})]}),(0,F.jsxs)(`div`,{className:`sf-reply-actions`,children:[(0,F.jsx)(`button`,{className:`sf-btn`,onClick:()=>void xe(),disabled:le,type:`button`,children:le?`Sealing…`:`Exhale Reply`}),n&&(0,F.jsx)(`button`,{className:`sf-btn sf-btn--ghost`,onClick:n,type:`button`,children:`Use a different ΦKey`})]}),L&&(0,F.jsxs)(`div`,{className:`sf-reply-result`,children:[(0,F.jsx)(`label`,{className:`sf-label`,children:`Share this link`}),(0,F.jsx)(`input`,{className:`sf-input`,readOnly:!0,value:L,onFocus:e=>e.currentTarget.select()}),(0,F.jsxs)(`div`,{className:`sf-reply-actions`,children:[(0,F.jsx)(`a`,{className:`sf-link`,href:L,target:`_blank`,rel:`noreferrer`,children:`Open →`}),(0,F.jsx)(`button`,{className:`sf-btn`,type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(L),o.push(`success`,`Link remembered.`),ue(!0),window.setTimeout(()=>ue(!1),1200)}catch{o.push(`warn`,`Copy failed.`)}},children:z?`Remembered`:`Remember`})]})]})]})}var $t=()=>{let e=m();return e<=0n?0:e>BigInt(2**53-1)?2**53-1:Number(e)};function en(e){let[t,n]=(0,P.useState)(e?Ze:null),r=(0,P.useRef)(null),i=(0,P.useRef)(null),a=()=>{let e=$t()-Xe;i.current=Xe+Math.max(0,Math.ceil(e/Qe))*Qe};return(0,P.useEffect)(()=>{if(!e){r.current!=null&&window.cancelAnimationFrame(r.current),r.current=null,i.current=null,n(null);return}a();let t=()=>{let e=i.current;if(e==null)n(null);else{let t=$t();t>=e?(a(),n(0)):n((e-t)/1e3)}r.current=window.requestAnimationFrame(t)};r.current=window.requestAnimationFrame(t);let o=()=>{document.visibilityState===`visible`&&a()};return document.addEventListener(`visibilitychange`,o),()=>{r.current!=null&&window.cancelAnimationFrame(r.current),r.current=null,document.removeEventListener(`visibilitychange`,o)}},[e]),t}function tn(){let[e,t]=(0,P.useState)(()=>it(new Date($t()))),n=(0,P.useRef)(null),r=()=>{if(typeof document>`u`)return;let e=document.documentElement,t=(Qe-($t()-Xe)%Qe)%Qe;e.style.setProperty(`--pulse-dur`,`${Qe}ms`),e.style.setProperty(`--pulse-offset`,`-${Math.round(t)}ms`)},i=()=>{n.current!=null&&window.clearTimeout(n.current);let e=$t(),a=e-Xe,o=Xe+Math.max(0,Math.ceil(a/Qe))*Qe,s=Math.max(0,o-e);r(),n.current=window.setTimeout(()=>{t(it(new Date($t()))),i()},s)};return(0,P.useEffect)(()=>{i();let e=()=>{document.visibilityState===`visible`&&(t(it(new Date($t()))),i())};return document.addEventListener(`visibilitychange`,e),()=>{n.current!=null&&window.clearTimeout(n.current),n.current=null,document.removeEventListener(`visibilitychange`,e)}},[]),e}var nn=p(D(),1),rn=3+Math.sqrt(5);function an(e){return e<0?0:e>1?1:e}function on(e){if(!e)return rn;let t=window.getComputedStyle(e).getPropertyValue(`--pulse-dur`).trim(),n=Number.parseFloat(t);return Number.isFinite(n)&&n>0?n:rn}function sn(e){return e>0&&e<360?`nano`:e>0&&e<520?`tiny`:e>0&&e<760?`tight`:`wide`}function cn(e){switch(e){case`nano`:return .84;case`tiny`:return .9;case`tight`:return .95;default:return 1}}function ln(e){return e===`nano`?`stack`:`row`}function un(e){let[t,n]=P.useState(0);return P.useLayoutEffect(()=>{let t=e.current;if(!t)return;let r=()=>{n(Math.round(t.getBoundingClientRect().width))};if(r(),typeof ResizeObserver<`u`){let e=new ResizeObserver(()=>r());return e.observe(t),()=>e.disconnect()}let i=()=>r();return window.addEventListener(`resize`,i,{passive:!0}),()=>window.removeEventListener(`resize`,i)},[e]),t}var dn=[`Ignite`,`Integrate`,`Harmonize`,`Reflekt`,`Purify`,`Dream`];function fn(e){let t=Number.isFinite(e)?Math.floor(e):0;return dn[Math.max(0,Math.min(5,Math.floor(t/6)))]}var pn=(e,t)=>{let n=e%t;return n>=0n?n:n+t},mn=(e,t)=>{if(t===0n)throw Error(`Division by zero`);let n=e/t;return e%t===0n||e>=0n?n:n-1n},hn=e=>{let t=BigInt(2**53-1),n=BigInt(-(2**53-1));return e>t?2**53-1:er(!0),[]),a=P.useCallback(()=>r(!1),[]),o=P.useCallback(e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),r(!0))},[]),s=P.useRef(null),c=sn(un(s)),l=ln(c),u=c===`wide`||c===`tight`,[d,f]=P.useState(rn);P.useEffect(()=>{f(on(s.current))},[e.pulse]);let[p,m]=P.useState(!1),h=P.useRef(null);P.useEffect(()=>{let e=h.current;if(h.current=t,e!=null&&t!=null&&t>e+.25){m(!0);let e=window.setTimeout(()=>m(!1),180);return()=>window.clearTimeout(e)}},[t]);let g=`${e.beat}:${L(e.step)}`,_=P.useMemo(()=>t==null?0:an(1-t/d),[t,d]),v=t===null?`—`:t.toFixed(6),y=t===null?`—`:t.toFixed(6),b=String(e.harmonicDay),x=typeof e.beat==`number`?e.beat:Number.parseInt(String(e.beat),10)||0,S=typeof e.step==`number`?e.step:Number.parseInt(String(e.step),10)||0,C=fn(x),w=En[C]??`Heart`,T=typeof e.pulse==`number`?e.pulse:Number.parseInt(String(e.pulse),10)||0,E=P.useMemo(()=>gn(T),[T]),D=P.useMemo(()=>Cn(e.harmonicDay,E.day),[e.harmonicDay,E.day]),O=P.useMemo(()=>xn(E.month),[E.month]),k=P.useMemo(()=>Tn(E.month),[E.month]),A=`D${E.day}/M${E.month}/Y${E.year}`,ee=vn(D),j=vn(O),M=P.useMemo(()=>({"--kai-progress":_,"--kai-ui-scale":cn(c)}),[_,c]),te=1584,N=Math.max(0,Math.min(te-1,x*44+S))/te*100,ne=_*100,re=String(Math.round(x/36*360));P.useEffect(()=>{if(!n||typeof document>`u`)return;let e=document.documentElement.style.overflow;document.documentElement.style.overflow=`hidden`;let t=e=>{e.key===`Escape`&&a()};return window.addEventListener(`keydown`,t),()=>{document.documentElement.style.overflow=e,window.removeEventListener(`keydown`,t)}},[n,a]);let ie=(0,F.jsxs)(`div`,{className:`kai-status__countdown`,"aria-label":`Next pulse`,children:[(0,F.jsx)(`span`,{className:`kai-status__nLabel`,children:`NEXT`}),(0,F.jsxs)(`span`,{className:`kai-status__nVal`,title:v,"aria-label":`Next pulse in ${v} seconds`,children:[y,` `,(0,F.jsx)(`span`,{className:`kai-status__nUnit`,children:`s`})]})]}),ae=(0,F.jsxs)(`span`,{className:`kai-pill kai-pill--pulse`,title:`Pulse ${T}`,"aria-label":`Pulse ${T}`,"data-chakra":`Pulse`,children:[`☤KAI: `,(0,F.jsx)(`strong`,{className:`kai-pill__num`,children:T})]}),oe=(0,F.jsxs)(`span`,{className:`kai-pill kai-pill--dmy`,title:A,"aria-label":`Date ${A}`,children:[(0,F.jsxs)(`span`,{className:`kai-dmy__seg kai-dmy__seg--day`,"data-chakra":D,children:[`D`,(0,F.jsx)(`span`,{className:`kai-dmy__num`,children:E.day})]}),(0,F.jsx)(`span`,{className:`kai-dmy__sep`,children:`/`}),(0,F.jsxs)(`span`,{className:`kai-dmy__seg kai-dmy__seg--month`,"data-chakra":O,children:[`M`,(0,F.jsx)(`span`,{className:`kai-dmy__num`,children:E.month})]}),(0,F.jsx)(`span`,{className:`kai-dmy__sep`,children:`/`}),(0,F.jsxs)(`span`,{className:`kai-dmy__seg kai-dmy__seg--year`,"data-chakra":`Year`,children:[`Y`,(0,F.jsx)(`span`,{className:`kai-dmy__num`,children:E.year})]})]}),se=(0,F.jsx)(`span`,{className:`kai-pill kai-pill--day`,title:b,"aria-label":`Day ${b}`,"data-chakra":D,children:b}),ce=(0,F.jsx)(`span`,{className:`kai-pill kai-pill--dayChakra`,title:`Day chakra ${ee}`,"aria-label":`Day chakra ${ee}`,"data-chakra":D,children:ee}),le=(0,F.jsx)(`span`,{className:`kai-pill kai-pill--monthName`,title:k,"aria-label":`Month ${k}`,"data-chakra":O,children:k}),I=(0,F.jsx)(`span`,{className:`kai-pill kai-pill--monthChakra`,title:`Month chakra ${j}`,"aria-label":`Month chakra ${j}`,"data-chakra":O,children:j}),R=(0,F.jsx)(`span`,{className:`kai-pill kai-pill--ark`,title:C,"aria-label":`Ark ${C}`,"data-chakra":w,children:C}),z=n&&typeof document<`u`?(0,nn.createPortal)((0,F.jsxs)(`div`,{className:`kk-pop`,role:`dialog`,"aria-modal":`true`,"aria-label":`Kai-Klok`,children:[(0,F.jsx)(`button`,{type:`button`,className:`kk-pop__backdrop`,"aria-label":`Close Kai-Klok`,onClick:a}),(0,F.jsxs)(`div`,{className:`kk-pop__panel`,role:`document`,children:[(0,F.jsxs)(`div`,{className:`kk-pop__head`,children:[(0,F.jsx)(`div`,{className:`kk-pop__title`,children:`Kai-Klok`}),(0,F.jsx)(`button`,{type:`button`,className:`kk-pop__close`,onClick:a,"aria-label":`Close`,children:`✕`})]}),(0,F.jsxs)(`div`,{className:`kk-pop__meta`,"aria-label":`Kai summary`,children:[(0,F.jsx)(`span`,{className:`kk-pop__pill`,children:g}),(0,F.jsx)(`span`,{className:`kk-pop__pill`,children:A}),(0,F.jsx)(`span`,{className:`kk-pop__pill`,children:k}),(0,F.jsx)(`span`,{className:`kk-pop__pill`,children:C})]}),(0,F.jsx)(`div`,{className:`kk-pop__dial`,"aria-label":`Kai-Klok dial`,children:(0,F.jsx)(`div`,{className:`klock-stage`,"data-klock-stage":`1`,children:(0,F.jsx)(`div`,{className:`klock-stage__inner`,children:(0,F.jsx)(Dn,{hue:re,pulse:T,harmonicDayPercent:N,microCyclePercent:ne,dayLabel:b,monthLabel:k,monthDay:E.day,kaiPulseEternal:T,glowPulse:!0,pulseIntervalSec:d,rimFlash:p,solarSpiralStepString:`${L(x)}:${L(S)}`,eternalBeatIndex:x,eternalStepIndex:S})})})}),(0,F.jsx)(`div`,{className:`kk-pop__foot`,children:(0,F.jsx)(`span`,{className:`kk-pop__hint`,children:`Tap the Klok for more details or press x to return.`})})]})]}),document.body):null;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{ref:s,className:`kai-feed-status kai-feed-status--slim${p?` kai-feed-status--flash`:``}`,onClick:i,onKeyDown:o,tabIndex:0,role:`button`,"aria-haspopup":`dialog`,"aria-expanded":n,"aria-label":`Kai status (open Kai-Klok)`,"data-layout":c,"data-bottom":l,"data-kai-bsi":g,"data-kai-ark":C,"data-kai-dmy":A,"data-day-chakra":D,"data-month-chakra":O,"data-ark-chakra":w,"data-day-num":E.day,"data-month-num":E.month,"data-year-num":E.year,style:M,children:[(0,F.jsxs)(`div`,{className:`kai-status__top`,"aria-label":`Kai timeline (day row)`,children:[(0,F.jsxs)(`span`,{className:`kai-status__bsiWrap`,"aria-label":`Beat step ${g}`,children:[(0,F.jsx)(`span`,{className:`kai-status__kLabel`,"aria-hidden":`true`,children:`KAIROS`}),(0,F.jsx)(`span`,{className:`kai-status__bsi`,title:g,children:g})]}),oe,se,ce,u?ae:null]}),(0,F.jsxs)(`div`,{className:`kai-status__mid`,"aria-label":`Kai timeline (month/ark row)`,children:[le,I,R]}),(0,F.jsxs)(`div`,{className:`kai-status__bottom`,"aria-label":`Next pulse row`,children:[u?null:ae,ie]}),(0,F.jsxs)(`div`,{className:`kai-feed-status__bar`,"aria-hidden":`true`,children:[(0,F.jsx)(`div`,{className:`kai-feed-status__barFill`}),(0,F.jsx)(`div`,{className:`kai-feed-status__barSpark`})]})]}),z]})}function kn(e){return typeof e==`object`&&!!e}function q(e){return typeof e==`number`&&Number.isFinite(e)}function J(e){return typeof e==`string`}function An(e){if(!Array.isArray(e))return!1;for(let t of e)if(!J(t))return!1;return!0}function jn(e){let t=e.trim();return t=t.replace(/[)\].,;:!?]+$/g,``),t=t.replace(/^[([{"'`]+/g,``),t.trim()}function Mn(){let e=globalThis.location?.origin;return typeof e==`string`&&e.length>0?e:`https://phi.network`}function Nn(e){let t=jn(e);try{return new URL(t)}catch{}try{return new URL(t,Mn())}catch{return null}}function Pn(e){let t=jn(e);if(/%[0-9A-Fa-f]{2}/.test(t))try{t=decodeURIComponent(t)}catch(e){let t=e instanceof Error?e.message:`decodeURIComponent failed`;throw Error(t)}return t.includes(` `)&&(t=t.replaceAll(` `,`+`)),/[+/=]/.test(t)&&(t=t.replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/g,``)),jn(t)}function Fn(e){let t=e.startsWith(`j:`)||e.startsWith(`c:`)?e.slice(2):e;return/^[A-Za-z0-9_-]{16,}$/.test(t)}function In(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=t.length%4;return n===2?t+=`==`:n===3&&(t+=`=`),t}function Ln(e){let t=jn(e),n=In(t.startsWith(`j:`)||t.startsWith(`c:`)?t.slice(2):t),r=globalThis;if(typeof r.atob!=`function`)throw Error(`Base64 decode failure: atob() unavailable`);if(r.TextDecoder===void 0)throw Error(`Base64 decode failure: TextDecoder unavailable`);try{let e=r.atob(n),t=new Uint8Array(e.length);for(let n=0;n{if(!e)return;let t=Pn(e);Fn(t)&&(n.includes(t)||n.push(t))},i=jn(e);Fn(i)&&r(i);let a=Nn(i);if(!a)return n;r(Bn(a.hash));let o=a.hash&&a.hash.startsWith(`#`)?a.hash.slice(1):a.hash,s=new URLSearchParams(o),c=a.searchParams,l=[`p`,`t`,`token`,`capsule`];r(Vn(c,s,l));for(let e of l)r(s.get(e)),r(c.get(e));if(r(zn(a.pathname)),t<1){let e=[...c.getAll(`add`),...s.getAll(`add`)];for(let n of e){let e=jn(n);if(!e)continue;let i=e;if(/%[0-9A-Fa-f]{2}/.test(i))try{i=decodeURIComponent(i)}catch(e){let t=e instanceof Error?e.message:`decodeURIComponent(add) failed`;throw Error(t)}for(let e of Hn(i,t+1))r(e)}}return n}function Un(e){let t=jn(e);if(t.startsWith(`j:`)||t.startsWith(`c:`))return{rootRef:t,addRefs:[]};let n=Nn(t);if(!n)return{rootRef:null,addRefs:[]};let r=n.hash&&n.hash.startsWith(`#`)?n.hash.slice(1):n.hash,i=new URLSearchParams(r),a=n.searchParams,o=i.get(`root`)??a.get(`root`),s=i.get(`v`)??a.get(`v`),c=[...i.getAll(`add`),...a.getAll(`add`)].map(e=>jn(e)).filter(e=>e.length>0),l=o?jn(o):null;return{v:s?jn(s):void 0,rootRef:l,addRefs:c}}function Wn(e){if(kn(e)&&kn(e.capsule))return e.capsule;if(kn(e)&&kn(e.data)){let t=e.data;if(kn(t)&&kn(t.capsule))return t.capsule;if(kn(t)&&(`post`in t||`message`in t||`share`in t||`reaction`in t))return t}return kn(e)&&(`post`in e||`message`in e||`share`in e||`reaction`in e)||kn(e)&&(`pulse`in e||`u`in e||`kind`in e||`userId`in e||`userPhiKey`in e)?e:null}function Gn(e){let t=q(e.pulse)?e.pulse:q(e.u)?e.u:void 0,n=q(e.beat)?e.beat:q(e.b)?e.b:void 0,r=q(e.stepIndex)?e.stepIndex:q(e.s)?e.s:void 0,i=J(e.chakraDay)||q(e.chakraDay)?e.chakraDay:J(e.c)||q(e.c)?e.c:void 0;return{...e,pulse:t,beat:n,stepIndex:r,chakraDay:i}}function Kn(e){return Rn(Ln(jn(e)))}function qn(e,t){let n=Wn(e);if(!n)throw Error(`Invalid payload (missing capsule)`);let r=Gn(n),i=kn(e)?e:null,a=i&&kn(i.data)?i.data:null,o=Nn(t),s=(()=>{let e=i?.path;if(An(e))return e;let t=a?.path;return An(t)?t:o?o.pathname.split(`/`).filter(Boolean):[]})();return{url:t,appId:(i&&J(i.appId)?i.appId:void 0)??(a&&J(a.appId)?a.appId:void 0)??(s[0]===`s`&&s.length>=2?s[1]:void 0),userId:(i&&J(i.userId)?i.userId:void 0)??(a&&J(a.userId)?a.userId:void 0)??(J(r.userId)?r.userId:J(r.userPhiKey)?r.userPhiKey:void 0),kind:(i&&J(i.kind)?i.kind:void 0)??(a&&J(a.kind)?a.kind:void 0)??(J(r.kind)?r.kind:r.post?`post`:r.message?`message`:r.share?`share`:r.reaction?`reaction`:void 0),pulse:(i&&q(i.pulse)?i.pulse:void 0)??(a&&q(a.pulse)?a.pulse:void 0)??(q(r.pulse)?r.pulse:void 0),beat:(i&&q(i.beat)?i.beat:void 0)??(a&&q(a.beat)?a.beat:void 0)??(q(r.beat)?r.beat:void 0),stepIndex:(i&&q(i.stepIndex)?i.stepIndex:void 0)??(a&&q(a.stepIndex)?a.stepIndex:void 0)??(q(r.stepIndex)?r.stepIndex:void 0),chakraDay:(i&&(J(i.chakraDay)||q(i.chakraDay))?i.chakraDay:void 0)??(a&&(J(a.chakraDay)||q(a.chakraDay))?a.chakraDay:void 0)??(J(r.chakraDay)||q(r.chakraDay)?r.chakraDay:void 0),capsule:r,path:s}}function Jn(e){try{let t=jn(e),n=Un(t);if(n.rootRef){let t=qn(Kn(n.rootRef),e),r=[];for(let e of n.addRefs)if(!(!e.startsWith(`j:`)&&!e.startsWith(`c:`)))try{let t=Kn(e);r.push(qn(t,e))}catch{}return{ok:!0,data:{...t,url:e,stream:{v:n.v,rootRef:n.rootRef,addRefs:n.addRefs,addData:r}}}}let r=Hn(t)[0]??null;if(!r)return{ok:!1,error:`No capsule token found (expected /s/, /p~, /stream/p/, ?p=, #t=, #/p~, a raw token, or a Memory Stream with #root=j:).`};let i=Rn(Ln(r));if(!kn(i))return{ok:!1,error:`Payload is not an object`};let a=Gn(i),o=Nn(t),s=o?o.pathname.split(`/`).filter(Boolean):[],c=s[0]===`s`&&s.length>=2?s[1]:void 0,l=J(a.userId)?a.userId:J(a.userPhiKey)?a.userPhiKey:void 0,u=J(a.kind)?a.kind:a.post?`post`:a.message?`message`:a.share?`share`:a.reaction?`reaction`:void 0,d=s.length>=8?s[6]:void 0;return{ok:!0,data:{url:e,appId:c,userId:l,kind:u??d,pulse:a.pulse,beat:a.beat,stepIndex:a.stepIndex,chakraDay:a.chakraDay,capsule:a,path:s}}}catch(e){return{ok:!1,error:e instanceof Error?e.message:`Decode error`}}}const Yn=`/stream`,Xn=(()=>{if(typeof window>`u`)return Yn;let e=window.location?.origin;return!e||e===`null`?Yn:`${e.replace(/\/+$/g,``)}${Yn}`})();(()=>{if(typeof window>`u`)return`/s`;let e=window.location?.origin;return!e||e===`null`?`/s`:`${e.replace(/\/+$/g,``)}/s`})();function Zn(e){let t=String(e??``).trim();return t=t.replace(/[)\].,;:!?]+$/g,``),t=t.replace(/^[([{"'`]+/g,``),t.trim()}function Qn(e){let t=Zn(e);if(/%[0-9A-Fa-f]{2}/.test(t))try{t=decodeURIComponent(t)}catch{}return t.includes(` `)&&(t=t.replaceAll(` `,`+`)),/[+/=]/.test(t)&&(t=t.replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/g,``)),Zn(t)}function $n(e){let t=Qn(e);return`${Xn||`/stream`}#t=${encodeURIComponent(t)}`}function er(e){return $n(e)}var tr=(e,t=8,n=4)=>e.length<=t+n?e:`${e.slice(0,t)}…${e.slice(-n)}`,nr=e=>{if(e)try{return new URL(e).host}catch{return}},rr=e=>typeof e==`string`&&e.trim().length>0,ir=e=>String(e??``).toUpperCase(),Y=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function ar(e){let t=String(e??``),n=t.length;return{lines:t.length?t.split(/\r\n|\r|\n/).length:0,chars:n}}function or(e,t){let{lines:n,chars:r}=ar(e);return{shouldCollapse:n>(t===`code`?18:10)||r>(t===`code`?1400:700),lines:n,chars:r,maxHeightPx:t===`code`?320:240}}function sr(e){return e instanceof HTMLElement?!!e.closest(`a,button,input,textarea,select,summary,[role="button"],[role="link"],[data-no-open="true"]`):!1}var cr=`/stream`,lr=`/s`,ur=`2`,dr=12e4,X=`j:`,fr=`s:`;function Z(e){let t=e.trim();return t=t.replace(/[)\].,;:!?]+$/g,``),t=t.replace(/^[([{"'`]+/g,``),t.trim()}function pr(e){let t=Z(e);if(/%[0-9A-Fa-f]{2}/.test(t))try{t=decodeURIComponent(t)}catch{}return t.includes(` `)&&(t=t.replaceAll(` `,`+`)),/[+/=]/.test(t)&&(t=t.replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/g,``)),Z(t)}function mr(e){return/^[A-Za-z0-9_-]{16,}$/.test(e)}function hr(){let e=typeof Xn==`string`?Xn.trim():``;if(e)return e.replace(/\/+$/g,``).replace(/\/stream\/?$/g,``);if(typeof window>`u`)return``;let t=window.location?.origin;return t&&t!==`null`?t.replace(/\/+$/g,``):``}function gr(){return hr()||`https://x.invalid`}function _r(){let e=hr();return e?`${e}${cr}`:cr}function vr(){let e=hr();return e?`${e}${lr}`:lr}function yr(e){let t=e.trim();try{return new URL(t)}catch{try{return new URL(t,gr())}catch{return null}}}function br(e){let t=Z(e),n=yr(t),r=n?n.pathname:t;return/^\/s(?:\/|$)/.test(r)}function xr(e){{let t=e.match(/\/s\/([^/?#]+)/);if(t?.[1])return t[1]}{let t=e.match(/\/p(?:\u007e|%7[Ee])\/?([^/?#]+)/);if(t?.[1])return t[1]}{let t=e.match(/\/(?:stream|feed)\/p\/([^/?#]+)/);if(t?.[1])return t[1]}{let t=e.match(/\/p\/([^/?#]+)/);if(t?.[1])return t[1]}return null}function Sr(e,t=0){let n=[],r=e=>{if(!e)return;let t=pr(e);t&&mr(t)&&(n.includes(t)||n.push(t))},i=Z(e);mr(i)&&r(i);let a=yr(i);if(!a)return n;let o=a.hash&&a.hash.startsWith(`#`)?a.hash.slice(1):``,s=new URLSearchParams(o),c=a.searchParams;for(let e of[`t`,`p`,`token`,`capsule`])r(s.get(e)),r(c.get(e));let l=s.get(`v`),u=c.get(`v`);for(let e of[l,u]){if(!e)continue;let t=pr(e);/^\d{1,4}$/.test(t)||t!==ur&&r(t)}if(r(xr(a.pathname)),t<1){let e=[...c.getAll(`add`),...s.getAll(`add`)];for(let n of e){let e=Z(n);if(e){if(/%[0-9A-Fa-f]{2}/.test(e))try{e=decodeURIComponent(e)}catch{}for(let n of Sr(e,t+1))r(n)}}}return n}function Cr(e){let t=_r(),n=pr(e);return`${t}#t=${encodeURIComponent(n)}`}function wr(e){let t=Sr(Z(e))[0];return t?Cr(t):null}function Q(e){let t=Z(e),n=yr(t);if(n){let e=n.hash&&n.hash.startsWith(`#`)?n.hash.slice(1):``,t=new URLSearchParams(e),r=n.searchParams;if(t.get(`root`)||r.get(`root`)){let e=_r(),n=new URL(e||cr,gr()),i=new URLSearchParams;for(let[e,n]of t.entries())i.append(e,n);for(let[e,t]of r.entries())i.append(e,t);return n.hash=i.toString()?`#${i.toString()}`:``,n.search=``,n.toString()}}if(br(t))return t;let r=Sr(t)[0];return r?Cr(r):t}function Tr(e){let t=_r().replace(/\/stream\/?$/g,``),n=pr(e);return[n,`${t}/stream#t=${n}`,`${t}/stream?t=${n}`,`${t}/stream/t=${n}`,`${t}/p#t=${n}`,`${t}/p?t=${n}`,`${t}/stream/p/${n}`,`${t}/p#p=${n}`,`${t}/p?p=${n}`,`${t}/p#token=${n}`,`${t}/p?token=${n}`,`${t}/stream#v=${n}`,`${t}/stream?v=${n}`]}function Er(e){let t=new Set,n=e=>{let n=e.trim();if(!n||t.has(n))return null;t.add(n);let r=Jn(n);return r.ok?r:null},r=Z(e),i=n(r);if(i)return{decoded:i,resolvedUrl:Q(r)};let a=Sr(r);for(let e of a)for(let t of Tr(e)){let r=n(t);if(r)return{decoded:r,resolvedUrl:Cr(e)}}return{decoded:Jn(r),resolvedUrl:Q(r)}}function Dr(e){if(!Y(e))return null;let t=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==void 0,n=e=>t(e,`post`)||t(e,`message`)||t(e,`share`)||t(e,`reaction`),r=(e,n)=>{for(let r of[`post`,`message`,`share`,`reaction`])t(n,r)&&e[r]===void 0&&(e[r]=n[r])},i=e,a=Y(i.data)?i.data:null,o=n(i),s=!!a&&n(a),c=Y(i.capsule)?i.capsule:null,l=a&&Y(a.capsule)?a.capsule:null,u=c??l;if(u&&(o||s)){let e={...u};return s&&a&&r(e,a),o&&r(e,i),e}return u||(o?i:s&&a?a:i)}function Or(e){if(e===null)return null;if(typeof e==`number`)return Number.isFinite(e)?e:null;if(typeof e==`string`||typeof e==`boolean`)return e;if(typeof e==`bigint`)return e.toString();if(Array.isArray(e))return e.map(Or);if(e&&typeof e==`object`){let t=e,n=Object.keys(t).sort((e,t)=>e.localeCompare(t)),r={};for(let e of n)r[e]=Or(t[e]);return r}return null}function kr(e){let t=``,n=32768;for(let r=0;rFr(`leaf:${e}`));for(;t.length>1;){let e=[];for(let n=0;n0)return`p:${Math.floor(a)}`;let o=t.kaiSignature;if(typeof o==`string`&&o.trim())return`ks:${o.trim()}`}return`h:${Fr(JSON.stringify(Or(e)))}`}function Rr(e){return`${fr}${jr(JSON.stringify(Or(e)))}`}function zr(e){let t=Z(e),n=t.startsWith(fr)?t.slice(2):t;if(!/^[A-Za-z0-9_-]{16,}$/.test(n))return null;try{let e=Mr(n),t=JSON.parse(e);if(!t||typeof t!=`object`)return null;let r=t,i=r.v,a=r.id,o=r.m,s=r.n,c=r.a,l=r.r;return typeof i!=`string`||typeof a!=`string`||typeof o!=`string`||typeof s!=`number`||typeof c!=`number`||typeof l!=`string`?null:{v:i,id:a,m:o,n:s,a:c,r:l}}catch{return null}}var Br=(e,t)=>{let n=e%t;return n>=0n?n:n+t},Vr=(e,t)=>{if(t===0n)throw Error(`Division by zero`);let n=e/t;return e%t===0n||e>=0n?n:n-1n},Hr=e=>{let t=BigInt(2**53-1),n=BigInt(-(2**53-1));return e>t?2**53-1:eString(Math.max(0,Math.floor(e))).padStart(2,`0`);function qr(e,t,n,r,i,a){let o=Gr(t),s=`${Kr(t)}:${Kr(n)}`;return{arc:o,label:s,line:`☤KAI:${e} • ${s} D${Math.max(1,Math.floor(r))}/M${Math.max(1,Math.floor(i))}/Y${Math.floor(a)}`}}function Jr(e){let t=Math.max(0,Math.min(43,Math.floor(e)))/44;return t>=1?.999999999999:t}var Yr={Root:[255,88,88],Sacral:[255,146,88],"Solar Plexus":[255,215,128],Heart:[88,255,174],Throat:[42,197,255],"Third Eye":[164,126,255],Crown:[238,241,251],Krown:[238,241,251]};function Xr(e){if(e&&typeof e==`object`&&`source`in e){let t=e.source;return typeof t==`string`?t:void 0}}function Zr(e,t){if(e&&typeof e==`object`&&`kind`in e){let t=e.kind;if(typeof t==`string`&&t.trim().length>0)return t}return t}var Qr=256;function $r(e){let t=yr(Z(e));if(!t)return[];let n=t.hash&&t.hash.startsWith(`#`)?t.hash.slice(1):``,r=new URLSearchParams(n),i=t.searchParams,a=[...r.getAll(`add`),...i.getAll(`add`)],o=[];for(let e of a){let t=Z(e);if(!t)continue;if(/%[0-9A-Fa-f]{2}/.test(t))try{t=decodeURIComponent(t)}catch{}if(t.startsWith(X)&&t.length>10){o.push(t);continue}let n=Pr(t);if(n&&Dr(n)){let e=Z(t.startsWith(X)?t.slice(2):t);o.push(`${X}${e}`);continue}let r=Sr(t)[0];if(r){o.push(Cr(r));continue}if(br(t)){o.push(t);continue}o.push(Q(t))}return o.slice(-Qr)}function ei(e){let t=yr(Z(e));if(!t)return null;let n=t.hash&&t.hash.startsWith(`#`)?t.hash.slice(1):``,r=new URLSearchParams(n),i=t.searchParams,a=r.get(`root`)??i.get(`root`);if(!a)return null;if(a=Z(a),/%[0-9A-Fa-f]{2}/.test(a))try{a=decodeURIComponent(a)}catch{}if(a.startsWith(X))return a;let o=Pr(a);return o&&Dr(o)?`${X}${Z(a)}`:null}function ti(e){let t=yr(Z(e));if(!t)return null;let n=t.hash&&t.hash.startsWith(`#`)?t.hash.slice(1):``,r=new URLSearchParams(n),i=t.searchParams,a=r.get(`seg`)??i.get(`seg`);if(!a)return null;let o=Z(a);if(/%[0-9A-Fa-f]{2}/.test(o))try{o=decodeURIComponent(o)}catch{}return zr(o)}function ni(e){let t=Z(e);if(!t)return null;if(t.startsWith(X)||br(t))return t;{let e=yr(t);if(e){let n=e.hash&&e.hash.startsWith(`#`)?e.hash.slice(1):``,r=new URLSearchParams(n),i=e.searchParams;if(r.get(`root`)||i.get(`root`))return Q(t)}}let n=Sr(t)[0];return n?Cr(n):null}function ri(e){if(typeof e==`string`)return ni(e);if(e&&typeof e==`object`){let t=e;if(typeof t.url==`string`)return ni(t.url);if(typeof t.href==`string`)return ni(t.href)}return null}function ii(e,t=0){if(!e||typeof e!=`object`||Array.isArray(e)||t>4)return null;let n=e,r=n.skip;if(Array.isArray(r)&&typeof r[1]==`string`){let e=ni(r[1]);if(e)return e}for(let e of`prevUrl.prevURL.prev.prevId.prev_id.previousUrl.previousURL.previous.previousId.previous_id.parentUrl.parentURL.parent.parentId.parent_id.replyToUrl.replyToURL.replyTo.replyToId.replyTo_id.inReplyToUrl.inReplyToURL.inReplyTo.inReplyToId.inReplyTo_id.refUrl.ref_url.ref`.split(`.`)){let t=ri(n[e]);if(t)return t}for(let e of[`capsule`,`data`,`payload`]){let r=ii(n[e],t+1);if(r)return r}return null}function ai(e){let t=Math.max(0,Math.floor(e));if(t<=2)return t;let n=1,r=2;for(;;){let e=n+r;if(e>t)return r;n=r,r=e}}function oi(e,t){let n=_r(),r=new URL(n||cr,gr()),i=[e,...t],a=Ir(i),o={v:ur,id:`seg:${a}:${i.length}`,m:a,n:i.length,a:t.length,r:tr(e,8,6)},s=new URLSearchParams;s.set(`v`,ur),s.set(`root`,e),s.set(`seg`,Rr(o));for(let e of t)s.append(`add`,e);return r.hash=s.toString()?`#${s.toString()}`:``,r.search=``,{url:r.toString(),rootRef:e,adds:[...t],meta:o}}function si(e,t){let n=0,r=t.length;for(;n0?a:i)),s=t.length-o;return{keepFrom:s,kept:t.slice(s)}}function ci(e,t,n=0){if(n>64)return{primary:oi(e,[]),archives:[]};let r=oi(e,t);if(r.url.length<=dr)return{primary:r,archives:[]};let{keepFrom:i,kept:a}=si(e,t),o=oi(e,a);if(o.url.length>dr)return{primary:oi(e,[]),archives:[]};if(i<=0)return{primary:o,archives:[]};let s=t.slice(0,i),c=a[0];if(!c)return{primary:o,archives:[]};let l=ci(c,s,n+1);return{primary:o,archives:[l.primary,...l.archives]}}function li(e){let t=[],n=new Set;for(let r of e){let e=String(r??``).trim();e&&(n.has(e)||(n.add(e),t.push(e)))}return t}function ui(e){let t=0;for(let n of e)Z(n).startsWith(X)&&t++;return t}function di(e,t){let n=Z(e);if(t)return`k:${Lr(t)}`;if(n.startsWith(X)){let e=Pr(n);return e?`k:${Lr(e)}`:`k:${Fr(n)}`}let r=Sr(n)[0];return r?`t:${pr(r)}`:`u:${Q(n)}`}var fi=4096,pi=new Map,mi=0,hi=0,gi=!1,_i=new Set;function vi(){if(gi)return;gi=!0;let e=()=>{gi=!1,hi++;for(let e of _i)e()};typeof queueMicrotask==`function`?queueMicrotask(e):Promise.resolve().then(e)}function yi(e){return _i.add(e),()=>_i.delete(e)}function bi(){return hi}function xi(){return 0}function Si(e){let t=pi.get(e.key);if(!(t&&t.prevKey===e.prevKey&&t.payloadRef===e.payloadRef&&t.fallbackRef===e.fallbackRef))for(pi.has(e.key)&&pi.delete(e.key),pi.set(e.key,{...e,tick:++mi}),vi();pi.size>fi;){let e=pi.keys().next().value;if(!e)break;pi.delete(e),vi()}}function Ci(e,t){let n=[],r=new Set,i=pi.get(e)?.prevKey??null,a=0;for(;i&&atypeof e==`string`&&e.trim().toLowerCase()===`manual`,Oi=e=>{if(rr(e))return Di(e)?Ti:e};function ki(e,t=0){if(t>5)return!1;if(Di(e))return!0;if(Array.isArray(e)){for(let n of e)if(ki(n,t+1))return!0;return!1}if(e&&typeof e==`object`){let n=e;for(let e of Object.keys(n))if(ki(n[e],t+1))return!0}return!1}function Ai(e,t){if(!Y(e))return;let n=e[t];return typeof n==`string`&&n.trim()?n.trim():void 0}function ji(e,t){if(!Y(e))return[];let n=e[t];if(!Array.isArray(n))return[];let r=[];for(let e of n)typeof e==`string`&&e.trim()&&r.push(e.trim());return r}function Mi(e){if(!Y(e))return{};let t=Ai(e,`caption`),n=e.body;if(Y(n)){let e=Ai(n,`kind`),r=e===`text`||e===`md`||e===`code`||e===`html`?e:void 0;if(r===`text`)return{text:Ai(n,`text`)??t,kind:r};if(r===`md`)return{text:Ai(n,`md`)??t,kind:r};if(r===`code`)return{text:Ai(n,`code`)??t,kind:r};if(r===`html`)return{text:Ai(n,`html`)??t,kind:r}}return{text:t,kind:void 0}}function Ni(e){if(!Y(e))return[];let t=e.attachments;if(!Y(t))return[];let n=t.items;if(!Array.isArray(n))return[];let r=[];for(let e of n){if(!Y(e))continue;let t=Ai(e,`url`);if(t){r.push({url:t});continue}let n=Ai(e,`href`);n&&r.push({url:n})}return r}function Pi(e,t){let n=e??t;if(!n)return{};let{text:r,kind:i}=Mi(n),a=ji(n,`tags`),o=Ni(n),s=typeof r==`string`&&r.trim().length>0,c=o.length>0,l=a.length>0;return!s&&!c&&!l?{}:{post:{title:void 0,text:s?r:void 0,tags:l?a:void 0,media:c?o.map(e=>({kind:`url`,url:e.url})):void 0},bodyKind:i}}function Fi(e){if(typeof document>`u`)return!1;try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,`true`),t.style.position=`fixed`,t.style.left=`-9999px`,t.style.top=`0`,document.body.appendChild(t);let n=document.activeElement instanceof HTMLElement?document.activeElement:null;t.focus(),t.select();let r=document.execCommand(`copy`);return document.body.removeChild(t),n&&n.focus(),r}catch{return!1}}function Ii(e){if(typeof window>`u`)return null;let t=window.navigator;return t!==void 0&&t.clipboard!==void 0&&typeof t.clipboard.writeText==`function`&&window.isSecureContext?t.clipboard.writeText(e):null}function Li(e,t,n){if(Fi(e)){t();return}let r=Ii(e);if(r){t(),r.catch(e=>n(e));return}n()}var Ri=`sigil:urls`,zi=`sigil:feed`,Bi=`kai-sigil-registry`,Vi=`kai:sigils:v1`,Hi=`kai-feed-registry`,Ui=0,Wi=!1,Gi=new Set,Ki=!1,qi=null,Ji=null;function Yi(){if(Wi)return;Wi=!0;let e=()=>{Wi=!1,Ui++;for(let e of Gi)e()};typeof queueMicrotask==`function`?queueMicrotask(e):Promise.resolve().then(e)}function Xi(e){return Gi.add(e),()=>Gi.delete(e)}function Zi(){return Ui}function Qi(){return 0}function $i(e){let t=[];if(Array.isArray(e)){for(let n of e)typeof n==`string`&&n.trim()&&t.push(n.trim());return t}if(Y(e)){let n=e.urls;if(Array.isArray(n)){for(let e of n)typeof e==`string`&&e.trim()&&t.push(e.trim());return t}let r=Object.keys(e).filter(e=>e.startsWith(`http`)||e.startsWith(`/`)||e.includes(`/stream`)||e.includes(`/s/`));if(r.length)return r;for(let n of Object.values(e))Y(n)&&typeof n.url==`string`&&n.url.trim()&&t.push(n.url.trim());return t}return t}function ea(e){if(typeof window>`u`||window.localStorage===void 0)return[];let t=window.localStorage.getItem(e);if(!t)return[];try{return $i(JSON.parse(t))}catch{return[]}}function ta(e){let t=e.trim();if(!t)return``;try{return new URL(t,gr()).toString()}catch{return t}}function na(){let e=li([...ea(zi),...ea(Ri),...ea(Vi)]),t=[];for(let n of e){let e=ta(n);e&&t.push(e)}return li(t)}function ra(e){let t=Z(e);return t?t.startsWith(X)?oi(t,[]).url:wr(t)??Q(t):``}function ia(e){let t=li($r(e))[0]??e;return di(t,(t.startsWith(X)?Pr(t):null)??void 0)}function aa(e){let t=Z(e);if(!t)return null;if(t.startsWith(X))return Pr(t);let n=Er(t);return n.decoded.ok?n.decoded.data:null}function oa(e,t){let n=Z(e);if(!n)return e;let r=li($r(n));if(r.length>0)return r[0];let i=n,a=t===void 0?null:t;a||=aa(i);let o=new Set;for(let e=0;e<48;e++){let e=di(i,a??void 0);if(o.has(e))break;o.add(e);let t=a?ii(a):null;if(!t)return i;i=t,a=aa(i)}return i}function sa(e,t){let n=oa(e,t);return di(n,(n.startsWith(X)?Pr(n):aa(n))??void 0)}function ca(e){let t=Z(e);if(/^[0-9a-fA-F]{64}$/.test(t))try{return er(t.toLowerCase())}catch{}return`${vr()}/${encodeURIComponent(t)}`}function la(e,t){if(!Y(e))return null;for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim())return t.trim()}return null}function ua(e,t){let n=Z(e);if(br(n))return n;let r=la(t,[`sigilUrl`,`sigilURL`,`sigil_url`,`sigilHref`,`sigil_href`,`sUrl`,`s_url`,`s`])??null;if(r&&br(r))return Q(r);let i=la(t,[`id`,`contentId`,`cid`,`hash`,`contentHash`])??null;if(i&&/^[0-9a-fA-F]{64}$/.test(i))return ca(i);let a=Y(t)?t.sigilId:void 0;if(typeof a==`string`&&a.trim())return ca(a);let o=Sr(n)[0];return o?ca(o):null}function da(e,t){let n=oa(e,t),r=aa(n),i=ua(n,r?Dr(r):null);return i?Q(i):ra(n)}function fa(e){let t=yr(e);if(!t)return 0;let n=t.hash&&t.hash.startsWith(`#`)?t.hash.slice(1):``,r=new URLSearchParams(n),i=t.searchParams;return r.getAll(`add`).length+i.getAll(`add`).length}function pa(e){let t=fa(e),n=e.length;return t*1e5+n}function ma(e){let t=Sr(e)[0];if(t)return`t:${pr(t)}`;let n=ei(e);if(n){let e=Pr(n);return e?`r:${Lr(e)}`:`r:${Fr(n)}`}return`u:${Q(e)}`}function ha(e,t){if(typeof window>`u`||window.localStorage===void 0)return{changed:!1,added:!1,updated:!1,value:t};let n=ta(t);if(!n)return{changed:!1,added:!1,updated:!1,value:t};try{let t=window.localStorage.getItem(e),r=[];if(t){let e=JSON.parse(t);if(Array.isArray(e))for(let t of e)typeof t==`string`&&r.push(t)}let i=new Map,a=[];for(let e of r){let t=ta(e);if(!t)continue;let n=ma(t),r=pa(t),o=i.get(n);o?r>o.score&&i.set(n,{url:t,score:r,index:o.index}):(i.set(n,{url:t,score:r,index:a.length}),a.push(n))}let o=ma(n),s=pa(n),c=i.get(o),l=!1,u=!1;c?s>c.score&&(i.set(o,{url:n,score:s,index:c.index}),u=!0):(i.set(o,{url:n,score:s,index:a.length}),a.push(o),l=!0);let d=[];for(let e of a){let t=i.get(e);t&&d.push(t.url)}let f=JSON.stringify(r),p=JSON.stringify(d);return f===p?{changed:!1,added:l,updated:u,value:n}:(window.localStorage.setItem(e,p),{changed:!0,added:l,updated:u,value:n})}catch{return{changed:!1,added:!1,updated:!1,value:n}}}function ga(e){if(!(typeof window>`u`)){try{window.__SIGIL__?.registerSigilUrl?.(e)}catch{}try{window.dispatchEvent(new CustomEvent(`sigil:url-registered`,{detail:{url:e}}))}catch{}try{if(`BroadcastChannel`in window){let t=new BroadcastChannel(Bi);t.postMessage({type:`sigil:add`,url:e}),t.close()}}catch{}}}function _a(e){if(!(typeof window>`u`)){try{window.dispatchEvent(new CustomEvent(`sigil:feed-registered`,{detail:{url:e}}))}catch{}try{if(`BroadcastChannel`in window){let t=new BroadcastChannel(Hi);t.postMessage({type:`feed:add`,url:e}),t.close()}}catch{}}}function va(e){let t=0,n=e.toLowerCase();return br(e)&&(t+=5e6),(/[?&#]t=/.test(n)||n.includes(`/stream/t`))&&(t+=2e6),n.includes(`/stream/p/`)&&(t-=5e5),/[?&#]v=/.test(n)&&(t-=25e4),t+=pa(e),t}function ya(e,t){if(typeof window>`u`||window.localStorage===void 0)return;let n=ea(zi);if(!n.length)return;let r=[],i=null,a=-1/0;for(let t of n){let n=ta(t);if(!n)continue;if(sa(n)!==e){r.push(n);continue}let o=va(n);o>a&&(a=o,i=n)}if(t){let e=ta(t);if(e){let t=va(e);t>a&&(a=t,i=e)}}i&&r.push(i);let o=li(r);try{let e=window.localStorage.getItem(zi)??`[]`,t=JSON.stringify($i(JSON.parse(e))),n=JSON.stringify(o);t!==n&&window.localStorage.setItem(zi,n)}catch{}}function ba(){if(typeof window>`u`||Ki)return;Ki=!0;let e=e=>{let t=e.key??``;(t===Ri||t===zi||t===Vi)&&Yi()};try{window.addEventListener(`storage`,e)}catch{}try{`BroadcastChannel`in window&&(qi=new BroadcastChannel(Bi),qi.onmessage=e=>{let t=e.data,n=Y(t)&&typeof t.url==`string`?t.url:null;n&&(ha(Ri,n),Yi())},Ji=new BroadcastChannel(Hi),Ji.onmessage=e=>{let t=e.data,n=Y(t)&&typeof t.url==`string`?t.url:null;n&&(ha(zi,n),Yi())})}catch{}Yi()}function xa(e){return Y(e)&&typeof e.pulse==`number`&&Number.isFinite(e.pulse)?e.pulse:Y(e)&&Y(e.data)&&typeof e.data.pulse==`number`&&Number.isFinite(e.data.pulse)?e.data.pulse:0}function Sa(e){let t=Y(e)?e.appId:void 0;if(typeof t==`string`&&t.trim())return t;let n=Y(e)&&Y(e.data)?e.data.appId:void 0;if(typeof n==`string`&&n.trim())return n}function Ca(e){let t=Y(e)?e.userId:void 0;return t===void 0?Y(e)&&Y(e.data)?e.data.userId:void 0:t}function wa(e){let t=Z(e);if(t.startsWith(X)){let e=Pr(t);if(e){let n=t.startsWith(X)?t:`${X}${t}`;return{kind:`embedded`,rootRef:n,payload:e,openUrl:oi(n,[]).url}}}let n=ei(t);if(n){let e=Pr(n);if(e)return{kind:`embedded`,rootRef:n,payload:e,openUrl:oi(n,[]).url}}return{kind:`sigilUrl`,openUrl:Q(t)}}var Ta=({url:e,depth:t=0,seen:n=[],addChain:r,addIndex:i,threadMode:a=`thread`})=>{let[o,s]=(0,P.useState)(!1),[l,u]=(0,P.useState)(!1),[d,f]=(0,P.useState)(!1),p=(0,P.useSyncExternalStore)(yi,bi,xi),m=(0,P.useMemo)(()=>wa(e),[e]),h=(0,P.useMemo)(()=>Er(e),[e]),g=(0,P.useMemo)(()=>{if(m.kind===`embedded`){let e=m.payload,t=Dr(e);if(!t)return{ok:!1,openUrl:m.openUrl,error:`Invalid embedded payload (missing capsule).`};let n=xa(e),r=Sa(e),i=Ca(e);return{ok:!0,openUrl:m.openUrl,dataRaw:e,storePayload:e,pulse:n,appId:r,userId:i,capsule:t}}let t=h.decoded,n=Q(h.resolvedUrl||e);if(!t.ok)return{ok:!1,openUrl:n,error:(`error`in t?t.error:void 0)??`Decode failed.`};let r=t.data,i=Dr(r);if(!i)return{ok:!1,openUrl:n,error:`Decode ok, but capsule missing.`};let a=typeof t.data.pulse==`number`&&Number.isFinite(t.data.pulse)?t.data.pulse:xa(t.data),o=typeof t.data.appId==`string`&&t.data.appId?t.data.appId:Sa(t.data),s=t.data.userId??Ca(t.data);return{ok:!0,openUrl:n,dataRaw:r,storePayload:t.data,pulse:a,appId:o,userId:s,capsule:i}},[m,h.decoded,h.resolvedUrl,e]),_=g.ok,v=_?g:null,y=_?v.storePayload:null,b=_?v.capsule:null,x=(0,P.useMemo)(()=>ua(e,b),[e,b]),S=(0,P.useMemo)(()=>li(r?[...r]:$r(e)).slice(-Qr),[r,e]),C=(0,P.useMemo)(()=>typeof i==`number`&&Number.isFinite(i)?i:S.length-1,[i,S.length]),w=(0,P.useMemo)(()=>!S.length||C<0||C>=S.length?null:S[C]??null,[S,C]),T=(0,P.useMemo)(()=>_&&y?di(e,y):di(e),[_,y,e]),D=(0,P.useMemo)(()=>[...n,T],[n,T]),O=(0,P.useMemo)(()=>{if(t>=Qr)return null;let e=_?v.dataRaw??y:null,n=w??(e?ii(e):null);if(!n)return null;let r=di(n,(n.startsWith(X)?Pr(n):null)??void 0);return D.includes(r)?null:n},[w,t,D,_,v,y]),k=(0,P.useMemo)(()=>{if(!_||!y)return null;try{return Nr(y)}catch{return null}},[_,y]),A=(0,P.useMemo)(()=>S.length?li(S.slice(0,Math.max(0,C+1))).slice(-Qr):[],[S,C]);(0,P.useLayoutEffect)(()=>{if(!_)return;let e=k,t=Q(g.openUrl),n=null;if(O){let e=null;if(O.startsWith(X))e=Pr(O);else{let t=Er(O);t.decoded.ok&&(e=t.decoded.data)}n=di(O,e??void 0)}Si({key:T,prevKey:n,payloadRef:e??null,fallbackRef:t})},[_,g.openUrl,T,O,k]);let ee=(0,P.useSyncExternalStore)(Xi,Zi,Qi);(0,P.useEffect)(()=>{ba()},[]);let j=(0,P.useMemo)(()=>ia(ra(x??g.openUrl??e)),[x,g.openUrl,e]),M=(0,P.useMemo)(()=>{if(!_)return{origin:null,replies:[]};let t=ra(S.length>0?S[0]:x??e),n=ia(t),r=li([ra(e),ra(g.openUrl),...S.map(e=>ra(e)),...na()]).filter(Boolean),i=new Map,a=(e,t)=>{let n=0,r=e.toLowerCase();return t?br(e)?n+=260:n+=40:((/[?&#]t=/.test(r)||r.includes(`/stream/t`))&&(n+=240),r.includes(`/stream/p/`)&&(n-=25),/[?&#]v=/.test(r)&&(n-=20),br(e)&&(n-=40)),n+=Math.max(0,20-Math.floor(e.length/40)),n+=Math.min(2e5,pa(e)),n};for(let e of r){let t=ta(e);if(!t)continue;let r=ia(t);if(!r)continue;let o=li($r(t)),s=r===n;if(!s&&o.length>0){for(let e of o)if(ia(ra(e))===n){s=!0;break}}if(!s)continue;let c=Er(t),l=c.decoded.ok?xa(c.decoded.data):0,u=a(t,r===n),d=i.get(r);if(!d||u>d.score){let e=wr(t)??t;i.set(r,{url:e,score:u,pulse:l})}}let o=i.get(n)?.url??t,s={key:n,url:o,pulse:(()=>{let e=Er(o);return e.decoded.ok?xa(e.decoded.data):0})()},c=[];for(let[e,t]of i.entries())e!==n&&e!==j&&(br(t.url)||c.push({key:e,url:t.url,pulse:t.pulse}));return c.sort((e,t)=>(t.pulse??0)-(e.pulse??0)),{origin:s,replies:c}},[_,S,x,e,g.openUrl,j,ee]),te=(0,P.useCallback)(()=>{if(!_||!y)return{primary:{url:Q(g.openUrl),rootRef:``,adds:[],meta:{v:ur,id:`seg:none`,m:``,n:0,a:0,r:``}},archives:[]};let e=k??Nr(y),t=li(Ci(T,Qr)),n=li(A),r=ui(n),i=ui(t),a=r>i?n:rt.length?n:t.length>n.length?t:n,o=[];for(let e of a){let t=Z(e);if(!t)continue;if(t.startsWith(X)){o.push(t);continue}let n=Er(t),r=n.decoded.ok?n.decoded.data:null;if(r){let e=di(t,r),n=pi.get(e);if(n?.payloadRef){o.push(n.payloadRef);continue}try{o.push(Nr(r));continue}catch{}}o.push(Q(t))}return ci(e,li(o).slice(-Qr))},[_,y,g.openUrl,k,T,A]),N=(0,P.useMemo)(()=>te(),[te,p]),ne=N.primary.url,re=N.archives.length>0,ie=(0,P.useMemo)(()=>wr(e)??wr(g.openUrl),[e,g.openUrl]),ae=(0,P.useMemo)(()=>Pi(b,_?v.dataRaw:null),[b,_,v]),oe=!!O,se=(0,P.useMemo)(()=>{if(!_||!b)return!1;let e=b;return!!(e.post||e.message||e.share||e.reaction)},[_,b]),ce=(0,P.useMemo)(()=>{if(!_||!b)return!1;let e=b,t=Zr(v.dataRaw,``),n=(rr(e.source)?e.source:void 0)??Xr(v.dataRaw);return Di(t)||Di(n)||ki(e)},[_,b,v]),le=(0,P.useMemo)(()=>se||!!ae.post,[se,ae.post]),I=(0,P.useMemo)(()=>ce||le||oe,[ce,le,oe]),L=I;(0,P.useEffect)(()=>{if(typeof window>`u`||t!==0)return;ba();let n=wr(window.location.href)??ie??wr(g.openUrl)??ne??Q(e),r=li([n,...S.map(e=>ra(e)).filter(Boolean)]);for(let e of r){let t=ha(Ri,e);t.changed&&ga(t.value)}if(L){let e=_?v.dataRaw??y:void 0,t=da(n,e),r=ha(zi,t);r.changed&&_a(r.value),ya(sa(n,e),t)}Yi()},[t,e,g.openUrl,ie,ne,L,S,_,v,y]);let R=(0,P.useMemo)(()=>ie??ne,[ie,ne]),z=(0,P.useMemo)(()=>_?I?R:x??R:g.openUrl,[_,g.openUrl,I,R,x]),ue=(0,P.useMemo)(()=>z,[z]),B=(0,P.useCallback)(()=>{let e=te();return[e.primary.url,...e.archives.map(e=>e.url)].join(` `)},[te]),V=(0,P.useCallback)(()=>{Li(ue,()=>{s(!0),typeof window<`u`&&window.setTimeout(()=>s(!1),1100)},e=>{s(!1)})},[ue]),de=(0,P.useCallback)(()=>{Li(B(),()=>{u(!0),typeof window<`u`&&window.setTimeout(()=>u(!1),1100)},e=>{u(!1)})},[B]);if(!g.ok)return(0,F.jsxs)(`article`,{className:`fc fc--error`,role:`group`,"aria-label":`Invalid Sigil-Glyph`,children:[(0,F.jsx)(`div`,{className:`fc-crystal`,"aria-hidden":`true`}),(0,F.jsxs)(`div`,{className:`fc-shell`,children:[(0,F.jsx)(`header`,{className:`fc-head`,children:(0,F.jsxs)(`div`,{className:`fc-titleRow`,children:[(0,F.jsx)(`span`,{className:`fc-chip fc-chip--danger`,children:`INVALID`}),(0,F.jsx)(`span`,{className:`fc-muted`,children:`Sigil-Glyph capsule could not be resolved`})]})}),(0,F.jsx)(`div`,{className:`fc-error`,role:`alert`,children:g.error}),(0,F.jsxs)(`footer`,{className:`fc-actions`,role:`group`,"aria-label":`Actions`,children:[(0,F.jsx)(`a`,{className:`fc-btn`,href:z,target:`_blank`,rel:`noreferrer`,onClick:e=>e.stopPropagation(),title:`Open the best available href for this capsule`,children:`↗ Open`}),(0,F.jsx)(`button`,{className:`fc-btn`,type:`button`,onClick:V,"aria-pressed":o,"data-state":o?`remembered`:`idle`,title:`Copies the same href as Open for this block.`,children:o?`Remembered`:`Remember`})]})]})]});let H=v.capsule,fe=H.post,pe=H.message,U=H.share,W=H.reaction,G=fe??ae.post,me=typeof v.pulse==`number`&&Number.isFinite(v.pulse)?v.pulse:0,he=c(me),K=Math.max(0,Math.floor(he.beat)),ge=Math.max(0,Math.floor(he.stepIndex)),_e=Wr(he.chakraDay,he.chakraDay),ve=_e===`Crown`?`Krown`:String(_e),{day:ye,month:be,year:xe}=Ur(me),Se=G?`post`:pe?`message`:U?`share`:W?`reaction`:`sigil`,Ce=Zr(v.dataRaw,Se),we=String(Ce),Te=typeof v.appId==`string`&&v.appId?`app ${tr(v.appId,10,4)}`:void 0,Ee=v.userId!==void 0&&v.userId!==null?`user ${tr(String(v.userId),10,4)}`:void 0,De=rr(H.sigilId)?H.sigilId:void 0,Oe=rr(H.phiKey)?H.phiKey:void 0,ke=rr(H.kaiSignature),Ae=ke?`Signature present (Kai Signature)`:`Unsigned capsule`,je=rr(H.author)?H.author:void 0,Me=(rr(H.source)?H.source:void 0)??Xr(v.dataRaw),Ne=ir(I?Ti:Ei),Pe=I?Ti:Ei,Fe=Me?Di(Me)?ir(Ti):ir(Me):void 0,Ie=!!Fe&&Fe!==Ne,Le=Oi(G?.title),Re=Oi(G?.text),ze=Oi(pe?.text),Be=Oi(U?.note),Ve=qr(me,K,ge,ye,be,xe),He=Jr(ge),[Ue,We,Ge]=Yr[ve]??Yr.Crown??[238,241,251],Ke=(me%13+13)%13,qe={"--fc-accent-r":String(Ue),"--fc-accent-g":String(We),"--fc-accent-b":String(Ge),"--fc-pulse-dur":`5236ms`,"--fc-pulse-offset":`${-(Ke*120)}ms`,"--fc-thread-depth":String(t)},Je=I?`memory`:we,Ye=I?`↗ Proof of Memory™`:`↗ Proof of Breath™`,Xe=I?`Open ${Ti}`:`Open ${Ei}`,Ze=t===0&&a!==`self`,Qe=(Re??ze??Be??``)||``,$e=ae.bodyKind===`code`||ae.bodyKind===`html`?`code`:`text`,et=Qe?or(Qe,$e):null,tt=!!et?.shouldCollapse,nt=tt&&!d,rt=`fc-body-${Fr(T).slice(0,10)}`,it=e=>{e.preventDefault(),e.stopPropagation(),f(e=>!e)},at=e=>{if(!Ze&&!sr(e.target??null)){if(`key`in e){let t=e.key;if(t!==`Enter`&&t!==` `)return;e.preventDefault()}try{window.open(z,`_blank`,`noopener,noreferrer`)}catch{}}},ot=C-1;return(0,F.jsxs)(F.Fragment,{children:[a!==`self`&&O?(0,F.jsx)(Ta,{url:O,depth:t+1,seen:D,addChain:S,addIndex:ot,threadMode:a}):null,(0,F.jsxs)(`article`,{className:`fc fc--crystal ${ke?`fc--signed`:`fc--unsigned`} ${Ze?`fc--primary`:`fc--preview`}`,role:Ze?`article`:`link`,tabIndex:Ze?-1:0,onClick:at,onKeyDown:at,"aria-label":`${Pe} glyph`,"data-kind":Je,"data-chakra":ve,"data-signed":ke?`true`:`false`,"data-beat":Kr(K),"data-step":Kr(ge),"data-collapsed":nt?`true`:`false`,style:qe,children:[(0,F.jsx)(`div`,{className:`fc-crystal`,"aria-hidden":`true`}),(0,F.jsx)(`div`,{className:`fc-rim`,"aria-hidden":`true`}),(0,F.jsx)(`div`,{className:`fc-veil`,"aria-hidden":`true`}),(0,F.jsxs)(`div`,{className:`fc-shell`,children:[(0,F.jsx)(`aside`,{className:`fc-left`,"aria-label":I?Ti:Ei,children:(0,F.jsxs)(`div`,{className:`fc-sigilStage`,children:[(0,F.jsx)(`div`,{className:`fc-sigilGlass`,"aria-hidden":`true`}),(0,F.jsx)(`div`,{className:`fc-sigil`,"aria-label":I?Ti:Ei,children:(0,F.jsx)(E,{pulse:me,beat:K,stepPct:He,chakraDay:_e})}),(0,F.jsxs)(`div`,{className:`fc-stamp mono`,"aria-label":`Kai stamp`,children:[(0,F.jsx)(`span`,{className:`fc-stamp__pulse`,title:`Pulse`,children:me}),(0,F.jsx)(`span`,{className:`fc-stamp__sep`,children:`•`}),(0,F.jsx)(`span`,{className:`fc-stamp__bbss`,title:`Beat:Step (zero-based)`,children:Ve.label})]})]})}),(0,F.jsxs)(`section`,{className:`fc-right`,children:[(0,F.jsxs)(`header`,{className:`fc-head`,"aria-label":`Glyph metadata`,children:[(0,F.jsxs)(`div`,{className:`fc-metaRow`,children:[(0,F.jsx)(`span`,{className:`fc-chip fc-chip--kind`,title:I?`${Ti} • type: ${we}`:`${Ei} • type: ${we}`,children:Ne}),Te&&(0,F.jsx)(`span`,{className:`fc-chip`,children:Te}),Ee&&(0,F.jsx)(`span`,{className:`fc-chip`,children:Ee}),!I&&De?(0,F.jsxs)(`span`,{className:`fc-chip fc-chip--sigil`,title:`Sigil-Glyph: ${De}`,children:[`SIGIL-GLYPH `,tr(De,6,4)]}):null,Oe&&(0,F.jsxs)(`span`,{className:`fc-chip fc-chip--phikey`,title:`ΦKey: ${Oe}`,children:[`ΦKEY `,tr(Oe,6,4)]}),je&&(0,F.jsx)(`span`,{className:`fc-chip fc-chip--author`,title:`Author handle / origin`,children:je}),Ie&&Fe&&(0,F.jsx)(`span`,{className:`fc-chip fc-chip--source`,title:`Source`,children:Fe}),(0,F.jsx)(`span`,{className:`fc-chip fc-chip--chakra`,title:`Chakra day`,children:ve}),(0,F.jsx)(`span`,{className:`fc-sig ${ke?`fc-sig--ok`:`fc-sig--warn`}`,title:Ae,"aria-label":Ae,children:ke?`SIGNED`:`UNSIGNED`}),(()=>{let e=ti(ne);return e?(0,F.jsxs)(`span`,{className:`fc-chip`,title:`Merkle: ${e.m}`,children:[`SEG `,tr(e.id,10,6)]}):null})()]}),(0,F.jsxs)(`div`,{className:`fc-kaiRow`,"aria-label":`Kai meta`,children:[(0,F.jsx)(`span`,{className:`fc-kai mono`,title:`Kai meta line`,children:Ve.line}),(0,F.jsx)(`span`,{className:`fc-arc`,title:`Arc`,children:Ve.arc})]})]}),G&&(0,F.jsxs)(`section`,{className:`fc-bodywrap`,"aria-label":`Post body`,children:[rr(Le)&&(0,F.jsx)(`h3`,{className:`fc-title`,children:Le}),rr(Re)?(0,F.jsxs)(`div`,{className:`fc-collapse`,"data-open":d?`true`:`false`,children:[(0,F.jsx)(`div`,{id:rt,className:`fc-collapse__content`,style:{maxHeight:nt?`${et?.maxHeightPx??240}px`:`none`,overflow:nt?`hidden`:`visible`},children:ae.bodyKind===`code`||ae.bodyKind===`html`?(0,F.jsx)(`pre`,{className:`fc-body`,style:{whiteSpace:`pre-wrap`},children:Re}):(0,F.jsx)(`p`,{className:`fc-body`,children:Re})}),tt?(0,F.jsx)(`button`,{className:`fc-btn fc-btn--ghost fc-collapse__toggle`,type:`button`,onClick:it,"aria-expanded":d,"aria-controls":rt,"data-no-open":`true`,title:`Expand/collapse long content`,children:d?`Collapse`:`Expand${et?.lines?` • ${et.lines} lines`:``}`}):null]}):null,Array.isArray(G.tags)&&G.tags.length>0&&(0,F.jsx)(`div`,{className:`fc-tags`,"aria-label":`Tags`,children:G.tags.map(e=>(0,F.jsxs)(`span`,{className:`fc-tag`,children:[`#`,e]},e))}),Array.isArray(G.media)&&G.media.length>0&&(0,F.jsx)(`div`,{className:`fc-media`,"aria-label":`Attached media`,children:G.media.map(e=>{let t=`${e.kind}:${e.url}`,n=nr(e.url)??e.kind;return(0,F.jsx)(`a`,{className:`fc-btn fc-btn--ghost`,href:e.url,target:`_blank`,rel:`noreferrer`,title:e.url,onClick:e=>e.stopPropagation(),children:n},t)})})]}),pe&&(0,F.jsxs)(`section`,{className:`fc-bodywrap`,"aria-label":`Message body`,children:[(0,F.jsxs)(`h3`,{className:`fc-title`,children:[`Message → `,tr(String(pe.toUserId??`recipient`),10,4)]}),rr(ze)?(0,F.jsxs)(`div`,{className:`fc-collapse`,"data-open":d?`true`:`false`,children:[(0,F.jsx)(`div`,{id:`${rt}-m`,className:`fc-collapse__content`,style:{maxHeight:nt?`${et?.maxHeightPx??240}px`:`none`,overflow:nt?`hidden`:`visible`},children:(0,F.jsx)(`p`,{className:`fc-body`,children:ze})}),tt?(0,F.jsx)(`button`,{className:`fc-btn fc-btn--ghost fc-collapse__toggle`,type:`button`,onClick:it,"aria-expanded":d,"aria-controls":`${rt}-m`,"data-no-open":`true`,children:d?`Collapse`:`Expand`}):null]}):null]}),U&&(0,F.jsxs)(`section`,{className:`fc-bodywrap`,"aria-label":`Share body`,children:[(0,F.jsx)(`h3`,{className:`fc-title`,children:`Share`}),(0,F.jsx)(`a`,{className:`fc-link`,href:U.refUrl,target:`_blank`,rel:`noreferrer`,title:U.refUrl,onClick:e=>e.stopPropagation(),children:nr(U.refUrl)??U.refUrl}),rr(Be)?(0,F.jsxs)(`div`,{className:`fc-collapse`,"data-open":d?`true`:`false`,children:[(0,F.jsx)(`div`,{id:`${rt}-s`,className:`fc-collapse__content`,style:{maxHeight:nt?`${et?.maxHeightPx??240}px`:`none`,overflow:nt?`hidden`:`visible`},children:(0,F.jsx)(`p`,{className:`fc-body`,children:Be})}),tt?(0,F.jsx)(`button`,{className:`fc-btn fc-btn--ghost fc-collapse__toggle`,type:`button`,onClick:it,"aria-expanded":d,"aria-controls":`${rt}-s`,"data-no-open":`true`,children:d?`Collapse`:`Expand`}):null]}):null]}),W&&(0,F.jsxs)(`section`,{className:`fc-bodywrap`,"aria-label":`Reaction body`,children:[(0,F.jsx)(`h3`,{className:`fc-title`,children:`Reaction`}),(0,F.jsxs)(`div`,{className:`fc-body`,children:[rr(W.emoji)?W.emoji:`❤️`,typeof W.value==`number`?` × ${W.value}`:null]}),(0,F.jsx)(`a`,{className:`fc-link`,href:W.refUrl,target:`_blank`,rel:`noreferrer`,title:W.refUrl,onClick:e=>e.stopPropagation(),children:nr(W.refUrl)??W.refUrl})]}),!G&&!pe&&!U&&!W&&(0,F.jsx)(`section`,{className:`fc-bodywrap`,"aria-label":`Sigil body`,children:I&&re?(0,F.jsxs)(`div`,{className:`fc-muted`,style:{marginTop:8},children:[`Archive segments: `,N.archives.length,` (use `,(0,F.jsx)(`b`,{children:`Pack`}),` to copy them)`]}):null}),a!==`self`&&t===0?(0,F.jsxs)(`section`,{className:`fc-bodywrap`,"aria-label":`Thread`,children:[(0,F.jsx)(`h3`,{className:`fc-title`,children:`Thread`}),M.origin&&M.origin.key!==j?(0,F.jsxs)(`div`,{style:{marginTop:10},children:[(0,F.jsx)(`div`,{className:`fc-muted`,style:{marginBottom:10},children:`Origin`}),(0,F.jsx)(Ta,{url:M.origin.url,threadMode:`self`,depth:1,seen:[T]})]}):null,(0,F.jsxs)(`div`,{style:{marginTop:14},children:[(0,F.jsxs)(`div`,{className:`fc-muted`,style:{marginBottom:10},children:[`Replies (`,M.replies.length,`)`]}),M.replies.length?M.replies.map(e=>(0,F.jsx)(Ta,{url:e.url,threadMode:`self`,depth:1,seen:[T]},e.key)):(0,F.jsx)(`div`,{className:`fc-muted`,children:`No replies captured locally yet.`})]})]}):null,(0,F.jsxs)(`footer`,{className:`fc-actions`,role:`group`,"aria-label":`Actions`,children:[(0,F.jsx)(`a`,{className:`fc-btn`,href:z,target:`_blank`,rel:`noreferrer`,title:Xe,onClick:e=>e.stopPropagation(),children:Ye}),(0,F.jsx)(`button`,{className:`fc-btn`,type:`button`,onClick:e=>{e.stopPropagation(),V()},"aria-pressed":o,"data-state":o?`remembered`:`idle`,title:`Copies the same href as Open for this block. If overflow exists, use Pack.`,children:o?`Remembered`:`Remember`}),re?(0,F.jsx)(`button`,{className:`fc-btn`,type:`button`,onClick:e=>{e.stopPropagation(),de()},"aria-pressed":l,"data-state":l?`packed`:`idle`,title:`Copies the full segment pack (primary + archive segments) as newline-separated URLs.`,children:l?`Packed`:`Pack ${1+N.archives.length}`}):null,(0,F.jsx)(`span`,{className:`fc-live`,"aria-live":`polite`,children:o?`Inhaled to Memory`:l?`Packed to Memory`:``})]})]})]})]})]})},Ea=({url:e,threadMode:t=`thread`})=>{let n=(0,P.useMemo)(()=>ei(e),[e]),r=(0,P.useMemo)(()=>li($r(e)),[e]);return n?(0,F.jsx)(Ta,{url:n,threadMode:t,addChain:r,addIndex:r.length-1}):(0,F.jsx)(Ta,{url:e,threadMode:t})};function Da({urls:e}){return!e||e.length===0?(0,F.jsx)(`section`,{className:`sf-list`,children:(0,F.jsxs)(`div`,{className:`sf-empty`,children:[`No items yet. Paste a link above or open a `,(0,F.jsx)(`code`,{children:`/stream/p/`}),` link and reply to start a thread.`]})}):(0,F.jsx)(`section`,{className:`sf-list`,"aria-label":`Memory Stream`,children:e.map(e=>(0,F.jsx)(Ea,{url:e},e))})}function Oa(e){return V(e)&&e.kind===`url`&&typeof e.url==`string`&&(e.title===void 0||typeof e.title==`string`)}function ka(e){return V(e)&&e.kind===`file-inline`&&typeof e.data_b64url==`string`&&(e.name===void 0||typeof e.name==`string`)&&(e.type===void 0||typeof e.type==`string`)&&(e.size===void 0||typeof e.size==`number`)&&(e.sha256===void 0||typeof e.sha256==`string`)&&(e.thumbnail_b64===void 0||typeof e.thumbnail_b64==`string`)&&(e.relPath===void 0||typeof e.relPath==`string`)}function Aa(e){return V(e)&&e.kind===`file-ref`&&typeof e.sha256==`string`&&(e.name===void 0||typeof e.name==`string`)&&(e.type===void 0||typeof e.type==`string`)&&(e.size===void 0||typeof e.size==`number`)&&(e.url===void 0||typeof e.url==`string`)&&(e.relPath===void 0||typeof e.relPath==`string`)}function ja(e){return Oa(e)||ka(e)||Aa(e)}function Ma(e){return V(e)&&e.version===1&&typeof e.totalBytes==`number`&&typeof e.inlinedBytes==`number`&&Array.isArray(e.items)&&e.items.every(ja)}var Na=`Φ Memory added to PhiStream.`;function Pa(e){let t=(e||``).trim();return t?t.length<=140?t:`${t.slice(0,96)}:${t.slice(-32)}`:`root`}function Fa(e){return`sf.phistream.autoadd.notified:${Pa(e)}`}function Ia(){return typeof window<`u`&&typeof document<`u`}function La(e){let t=(e||``).trim();if(!t||!Ia())return null;try{if(t.startsWith(`/`)){let e=window.location?.origin??`https://kaiklok.com`,n=new URL(t,e);return n.protocol===`http:`||n.protocol===`https:`?n.toString():null}let e=new URL(t);return e.protocol===`http:`||e.protocol===`https:`?e.toString():null}catch{return null}}function Ra(){return W(localStorage.getItem(U))}function za(e){try{return Ra().includes(e)}catch{return!1}}function Ba(e){try{return sessionStorage.getItem(Fa(e))===`1`}catch{return!1}}function Va(e){try{sessionStorage.setItem(Fa(e),`1`)}catch{}}function Ha(e){let{token:t,payloadUrl:n,fallbackUrl:r,toast:i}=e;if(!Ia())return{ok:!1,added:!1,url:null,reason:`no_window`};let a=(n&&n.trim().length?n:r)??``;if(!a.trim())return{ok:!1,added:!1,url:null,reason:`no_url`};let o=La(a);if(!o)return{ok:!1,added:!1,url:null,reason:`invalid_url`};try{j(o)}catch{}let s=Ba(t);try{return za(o)?{ok:!0,added:!1,url:o,reason:`already_present`}:(G([o]),s?{ok:!0,added:!1,url:o,reason:`already_notified`}:(Va(t),i?.(`success`,Na),{ok:!0,added:!0,url:o,reason:`added`}))}catch{return{ok:!1,added:!1,url:null,reason:`storage_unavailable`}}}var Ua=17491.270421,Wa=36,Ga=44,Ka=Wa*Ga,qa=6,Ja=7,Ya=8,Xa=qa*Ja,Za=Xa*Ya;function Qa(e,t){let n=e%t;return n<0?n+t:n}function $a(e){return Number.isFinite(e)?e<0?0:e>1?1:e:0}function eo(e){return Number.isFinite(e)?e:0}function to(e){let t=eo(e);return Math.floor(t/Ua)}function no(e){let t=eo(e),n=(t-to(t)*Ua)%Ua,r=n<0?n+Ua:n;return r>=Ua?0:r}function ro(e){let t=$a(no(e)/Ua),n=Math.floor(t*Ka);return{beat:Math.floor(n/Ga),step:n%Ga}}function io(e){let t=to(e),n=Math.floor(t/Za),r=Qa(t,Za),i=Math.floor(r/Xa);return{d:r%Xa+1,m:i+1,y:n}}var ao=[`Solhara`,`Aquaris`,`Flamora`,`Verdari`,`Sonari`,`Kaelith`],oo=[`Root`,`Sacral`,`Solar`,`Heart`,`Throat`,`Third Eye`,`Crown`];function so(e){return ao[Qa(to(e),ao.length)]??`Kaelith`}function co(e){return oo[Qa(to(e),oo.length)]??`Crown`}var lo=[`Aethon`,`Virelai`,`Solari`,`Amarin`,`Kaelus`,`Umbriel`,`Noktura`,`Liora`];function uo(e){if(typeof window>`u`)return;let t=window.requestIdleCallback;if(typeof t==`function`){t(t=>{if(t.timeRemaining()<=0){e();return}e()});return}window.setTimeout(e,0)}function fo(e){let t=Qa(to(e),Za),n=Math.floor(t/Xa);return lo[n]??`Month ${n+1}`}function po(e){let t=e.trim();return t&&(/^caelith$/i.test(t)||/^kaelith$/i.test(t)?`Kaelith`:t.charAt(0).toUpperCase()+t.slice(1))}function mo(e){let t=e.trim();if(!t)return t;let n=t.toLowerCase();return n===`third-eye`||n===`third eye`||n===`ajna`?`Third Eye`:n===`solar plexus`||n===`solar-plexus`||n===`solar`?`Solar`:n===`root`?`Root`:n===`sacral`?`Sacral`:n===`heart`?`Heart`:n===`throat`?`Throat`:n===`crown`?`Krown`:t.charAt(0).toUpperCase()+t.slice(1)}function ho(e){let t=e.trim();return t&&(/^manual$/i.test(t)?`Proof of Memory™`:t.charAt(0).toUpperCase()+t.slice(1))}var go=Wa/6,_o=[`Ignite`,`Integrate`,`Harmonize`,`Reflekt`,`Purify`,`Dream`];function vo(e){let{beat:t}=ro(e),n=Math.floor(t/go);return n<0?0:n>=_o.length?_o.length-1:n}function yo(e){return _o[vo(e)]??`Dream`}function bo(e){let t=Number.isFinite(e)?Math.trunc(e):0;return String(t).padStart(2,`0`)}function xo(e){return e.length<=140?e:`${e.slice(0,96)}:${e.slice(-32)}`}function So(){let e=globalThis.location?.origin;return e&&typeof e==`string`&&e.length?e:`https://kaiklok.com`}function Co(e){let t=So().replace(/\/+$/,``);return e.length<=3500?`${t}/stream/p/${encodeURIComponent(e)}`:`${t}/stream#t=${e}`}function wo(e){return`${So().replace(/\/+$/,``)}/stream?p=${encodeURIComponent(e)}`}function To(e){return`${So().replace(/\/+$/,``)}/p~${e}`}function Eo(e){return e.length<=3500?To(e):wo(e)}function Do(e){let t=e.trim();try{let e=new URL(t),n=new URLSearchParams(e.hash.startsWith(`#`)?e.hash.slice(1):e.hash),r=new URLSearchParams(e.search),i=n.get(`t`)??n.get(`p`)??n.get(`token`)??r.get(`t`)??r.get(`p`)??r.get(`token`);i?t=i:/\/p~/.test(e.pathname)?t=e.pathname.split(`/p~`)[1]??t:/\/stream\/p\//.test(e.pathname)&&(t=e.pathname.split(`/stream/p/`)[1]??t)}catch{}if(/%[0-9A-Fa-f]{2}/.test(t))try{t=decodeURIComponent(t)}catch{}return t.includes(` `)&&(t=t.replaceAll(` `,`+`)),/[+/=]/.test(t)&&(t=t.replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/g,``)),t}function $(e){return/^[A-Za-z0-9_-]{16,}$/.test(e)}function Oo(e){let t=e.trim();try{return new URL(t)}catch{try{return new URL(t,So())}catch{return null}}}function ko(e){let t=e.trim();if(!t)return null;if($(t))return t;let n=Oo(t);if(!n)return null;let r=n.hash&&n.hash.startsWith(`#`)?n.hash.slice(1):``,i=new URLSearchParams(r),a=n.searchParams,o=i.get(`t`)??i.get(`p`)??i.get(`token`)??i.get(`capsule`)??a.get(`t`)??a.get(`p`)??a.get(`token`)??a.get(`capsule`);if(o&&o.trim().length)return o.trim();if(n.pathname.includes(`/p~`)){let e=n.pathname.indexOf(`/p~`),t=n.pathname.slice(e+3);if(t&&t.length)return t.startsWith(`/`)?t.slice(1):t}{let e=n.pathname.match(/\/stream\/p\/([^/?#]+)/);if(e?.[1])return e[1]}{let e=n.pathname.match(/\/p\/([^/?#]+)/);if(e?.[1])return e[1]}{let e=n.pathname.match(/\/s\/([^/?#]+)/);if(e?.[1])return e[1]}return null}function Ao(t){if(typeof window>`u`)return`/stream/p/${encodeURIComponent(t)}`;let n=new URLSearchParams(window.location.search),r=new URLSearchParams(window.location.hash.startsWith(`#`)?window.location.hash.slice(1):window.location.hash),i=[...n.getAll(`add`),...r.getAll(`add`)].map(ve).filter(e=>typeof e==`string`&&e.trim().length>0),a=[];for(let e of i){let t=jo(e);a.includes(t)||a.push(t)}let o=new URLSearchParams;for(let[e,t]of n.entries())e===`p`||e===`t`||e===`token`||e===`capsule`||e!==`add`&&o.append(e,t);for(let e of a)o.append(`add`,e);let s=new URLSearchParams;for(let[e,t]of r.entries())e===`p`||e===`t`||e===`token`||e===`capsule`||e!==`add`&&s.append(e,t);let c=t.length<=e,l=c?`/stream/p/${encodeURIComponent(t)}`:`/stream`,u=o.toString(),d=u.length?`?${u}`:``;if(c){let e=s.toString();return`${l}${d}${e.length?`#${e}`:``}`}let f=new URLSearchParams;f.set(`t`,t);for(let[e,t]of s.entries())f.append(e,t);return`${l}${d}#${f.toString()}`}function jo(e){let t=e.trim();if(!t)return t;let n=ko(t);if(!n){let e=Oo(t);return e?e.toString():t}return Co(Do(n))}function Mo(e,t){let n=new URL(e,So()),r=n.hash.startsWith(`#`)?n.hash.slice(1):n.hash,i=new URLSearchParams(r);i.delete(`add`);for(let e of t)i.append(`add`,e);n.search=``;let a=i.toString();return n.hash=a?`#${a}`:``,n.toString()}var No=`sf:memoryStream:v2`,Po=2e4,Fo=4096,Io=4096,Lo=2048;function Ro(){return{v:2,parentOf:{},childrenOf:{},pulseOf:{}}}function zo(){if(typeof window>`u`)return Ro();try{let e=window.localStorage.getItem(No);if(!e)return Ro();let t=JSON.parse(e);if(!V(t)||t.v!==2)return Ro();let n=V(t.parentOf)?t.parentOf:{},r=V(t.childrenOf)?t.childrenOf:{},i=V(t.pulseOf)?t.pulseOf:{},a=Ro();for(let[e,t]of Object.entries(n))typeof e==`string`&&typeof t==`string`&&$(e)&&$(t)&&(a.parentOf[e]=t);for(let[e,t]of Object.entries(r)){if(!$(e)||!Array.isArray(t))continue;let n=t.filter(e=>typeof e==`string`&&$(e));a.childrenOf[e]=Array.from(new Set(n)).slice(0,Fo)}for(let[e,t]of Object.entries(i))if($(e)){if(typeof t==`number`&&Number.isFinite(t))a.pulseOf[e]=t;else if(typeof t==`string`&&t.trim().length){let n=Number(t.trim());Number.isFinite(n)&&(a.pulseOf[e]=n)}}return a}catch{return Ro()}}function Bo(e){if(!(typeof window>`u`))try{window.localStorage.setItem(No,JSON.stringify(e))}catch(e){B(`ms2Save`,e)}}function Vo(e,t,n){let r=e.childrenOf[t]??[];if(r.includes(n))return!1;let i=[...r,n].slice(-Fo);return e.childrenOf[t]=i,!0}function Ho(e,t,n){return!$(t)||!$(n)||t===n||e.parentOf[t]===n?!1:(e.parentOf[t]=n,Vo(e,n,t),!0)}function Uo(e,t,n){return!$(t)||!Number.isFinite(n)||e.pulseOf[t]===n?!1:(e.pulseOf[t]=n,!0)}function Wo(e){let t=Oo(e);if(!t)return[];let n=t.hash&&t.hash.startsWith(`#`)?t.hash.slice(1):``,r=new URLSearchParams(n),i=[...t.searchParams.getAll(`add`),...r.getAll(`add`)];if(i.length===0)return[];let a=[];for(let e of i){let t=ve(e);if(!t||!t.trim().length)continue;let n=ko(t)??($(t)?t:null);if(!n)continue;let r=Do(n);$(r)&&(a.includes(r)||a.push(r))}return a}function Go(e,t){let n=ko(t);if(!n)return!1;let r=Do(n);if(!$(r))return!1;let i=Wo(t),a=i.length?i[i.length-1]:null,o=!1;if(a&&(o=Ho(e,r,a)||o),Object.keys(e.parentOf).length+Object.keys(e.childrenOf).length>Po){let t=Object.keys(e.childrenOf);for(let n=0;n{let r=e.pulseOf[t],i=e.pulseOf[n],a=typeof r==`number`&&Number.isFinite(r),o=typeof i==`number`&&Number.isFinite(i);return a&&o?r-i:a?-1:o?1:tn?1:0}),r}function Yo(e,t){let n=Co(t),r=qo(e,t);return r.length?Mo(n,r):n}function Xo(e){if(typeof document>`u`)return!1;try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,`true`),t.style.position=`fixed`,t.style.left=`-9999px`,t.style.top=`0`,document.body.appendChild(t);let n=document.activeElement instanceof HTMLElement?document.activeElement:null;t.focus(),t.select();let r=document.execCommand(`copy`);return document.body.removeChild(t),n&&n.focus(),r}catch{return!1}}function Zo(e){if(typeof window>`u`)return null;let t=window.navigator;return t!==void 0&&t.clipboard!==void 0&&typeof t.clipboard.writeText==`function`&&window.isSecureContext?t.clipboard.writeText(e):null}function Qo(e){return e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`"`,`"`).replaceAll(`'`,`'`)}function $o(e){try{let t=new DOMParser().parseFromString(e,`text/html`);return t.querySelectorAll(`script,style,iframe,object,embed`).forEach(e=>e.remove()),t.querySelectorAll(`*`).forEach(e=>{for(let t of Array.from(e.attributes)){let n=t.name.toLowerCase(),r=t.value;if(n.startsWith(`on`)){e.removeAttribute(t.name);continue}if(n===`href`||n===`src`){let n=r.trim().toLowerCase();(n.startsWith(`javascript:`)||n.startsWith(`data:`))&&e.removeAttribute(t.name)}}}),t.body.innerHTML}catch{return Qo(e)}}function es(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`?t.toString():null}catch{return null}}function ts(e){let t=Qo(e).replace(/```(\w+)?\n([\s\S]*?)```/g,(e,t,n)=>{let r=(t||``).trim();return`
${n}
`});return t=t.replace(/^####\s(.+)$/gm,`

$1

`),t=t.replace(/^###\s(.+)$/gm,`

$1

`),t=t.replace(/^##\s(.+)$/gm,`

$1

`),t=t.replace(/^#\s(.+)$/gm,`

$1

`),t=t.replace(/\*\*(.+?)\*\*/g,`$1`),t=t.replace(/\*(.+?)\*/g,`$1`),t=t.replace(/`([^`]+)`/g,`$1`),t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(e,t,n)=>{let r=es(n);return r?`${t}`:`${t} (${Qo(n)})`}),t=t.split(/\n{2,}/g).map(e=>{let t=e.trim();return t?t.startsWith(``)?t:`

${t.replace(/\n/g,`
`)}

`:``}).filter(Boolean).join(` `),t}function ns(e){let t=0,n=0;for(let r of e){if(r.kind===`file-inline`){typeof r.size==`number`&&Number.isFinite(r.size)&&r.size>=0&&(t+=r.size,n+=r.size);continue}if(r.kind===`file-ref`){typeof r.size==`number`&&Number.isFinite(r.size)&&r.size>=0&&(t+=r.size);continue}}return{total:t,inlined:n}}function rs(e){if(Ma(e))return e;if(!V(e))return null;let t=e.version,n=e.items;if(t!==1||!Array.isArray(n))return null;let r=n.filter(ja),i=ns(r);return{version:1,totalBytes:typeof e.totalBytes==`number`&&Number.isFinite(e.totalBytes)?e.totalBytes:i.total,inlinedBytes:typeof e.inlinedBytes==`number`&&Number.isFinite(e.inlinedBytes)?e.inlinedBytes:i.inlined,items:r}}function is({body:e,caption:t,isSealed:n}){let r=e??(!n&&t&&t.trim().length?{kind:`text`,text:t}:null);return r?r.kind===`text`?(0,F.jsxs)(`div`,{className:`sf-text`,children:[`— `,`"${r.text}"`]}):r.kind===`code`?(0,F.jsx)(`pre`,{className:`sf-code`,children:(0,F.jsx)(`code`,{children:r.code})}):r.kind===`md`?(0,F.jsx)(`div`,{className:`sf-md`,dangerouslySetInnerHTML:{__html:ts(r.md)}}):(r.mode??`code`)===`code`?(0,F.jsx)(`pre`,{className:`sf-code sf-code--html`,children:(0,F.jsx)(`code`,{children:r.html})}):(0,F.jsx)(`div`,{className:`sf-html`,dangerouslySetInnerHTML:{__html:$o(r.html)}}):(0,F.jsx)(F.Fragment,{})}function as(e,t){if(!e||typeof e!=`object`)return null;let n=e;for(let e of t){let t=n[e];if(typeof t==`string`&&t.trim().length)return t.trim()}return null}function os(e,t){if(!e||typeof e!=`object`)return null;let n=e[t];if(typeof n==`number`&&Number.isFinite(n))return n;if(typeof n==`string`&&n.trim().length){let e=Number(n.trim());return Number.isFinite(e)?e:null}return null}function ss(e){return Math.max(0,Math.min(255,Math.round(e)))}function cs(e){if(!V(e))return!1;let t=e.body,n=e.attachments,r=e.caption,i=t===void 0||V(t),a=r===void 0||typeof r==`string`,o=n===void 0||V(n)||Array.isArray(n);return i&&a&&o}function ls(e){return typeof e==`function`}function us(e){return V(e)&&e.ok===!0&&`inner`in e}function ds(e){let t=V(e)?e.seal:void 0;return t?as(t,[`teaser`,`preview`,`hint`,`caption`])??null:null}async function fs(e){let n=await t(()=>import(`./postSeal-D7PFnOMd.js`),__vite__mapDeps([0,1])),r=V(n)?n:{},i=r.openSealedEnvelope??r.openSealedPayload??r.unsealEnvelope??r.unsealPayload??r.unsealEnvelopeV1??null;if(!ls(i))throw Error(`postSeal module is missing an unseal function.`);if(((V(r)&&Object.entries(r).find(([,e])=>e===i)?.[0])??`unseal`)===`unsealEnvelopeV1`){let t=typeof e.meta==`object`&&e.meta!==null?H(e.meta,`kaiSignature`):void 0,n=typeof e.meta==`object`&&e.meta!==null?H(e.meta,`userPhiKey`):void 0;if(!t)throw Error(`Missing kaiSignature in meta (cannot unlock sealed envelope).`);let r=await Promise.resolve(i(e.seal,{kaiSignature:t,phiKey:n}));if(us(r)){let e=r.inner;if(!V(e))throw Error(`Unseal returned non-object inner payload.`);let t=e.body,n=e.attachments,i=e.caption,a={};return t!==void 0&&V(t)&&(a.body=t),n!==void 0&&(a.attachments=n),typeof i==`string`&&(a.caption=i),a}if(cs(r))return r;throw Error(`Unseal returned an unexpected shape.`)}let a=await Promise.resolve(i(e.seal,{meta:e.meta,svgText:e.svgText??void 0}));if(!cs(a))throw Error(`Unseal returned an unexpected shape.`);return a}function ps(e){let{token:t,payload:n,manifest:r,copied:i,onKopy:a,isSealed:o,unsealState:s,canUnseal:c,verifiedThisSession:l,hasComposerMeta:u,onVerifiedNow:d,onResetVerified:f,onUnseal:p,onForgetUnsealed:m,body:h,caption:g}=e,_=(0,P.useRef)(null),v=(0,P.useCallback)(()=>{let e=_.current;if(!e)return;try{e.scrollIntoView({behavior:`smooth`,block:`center`})}catch{}let t=e.querySelector(`input[type="file"]`);if(t){t.click();return}e.querySelector(`button`)?.click()},[]),y=s.status===`opening`?`UNSEALING…`:c?`UNSEAL`:l?u?`UNSEAL`:`RE-INHALE`:`🔐 Sealed`,b=(0,P.useCallback)(()=>{if(!c){v();return}p()},[c,p,v]),x=eo(n.pulse),{beat:S,step:C}=ro(x),{d:w,m:T,y:E}=io(x),D=fo(x),O=po(so(x)),k=yo(x),A=as(n,[`userPhiKey`,`phiKey`,`phikey`,`authorPhiKey`])??as(n.meta,[`userPhiKey`,`phiKey`,`phikey`])??``,M=ho(as(n,[`mode`,`source`,`origin`,`transport`])??as(n.meta,[`mode`,`source`,`origin`])??`Manual`);(0,P.useEffect)(()=>{try{j(Eo(t))}catch(e){B(`register share url (PayloadCard)`,e)}if(typeof n.url==`string`&&n.url.length)try{j(n.url)}catch(e){B(`register payload.url (PayloadCard)`,e)}},[t,n.url]);let te=o&&s.status!==`open`,N=(0,P.useMemo)(()=>o?ds(n):null,[o,n]),ne=o?(0,F.jsx)(`span`,{className:`sf-pill sf-pill--sealed`,title:`Private (Sealed)`,children:`🔒 SEALED`}):null;return(0,F.jsxs)(`section`,{className:`sf-payload`,role:`region`,"aria-label":`Loaded payload`,children:[(0,F.jsxs)(`div`,{className:`sf-payload-line sf-tags`,children:[(0,F.jsx)(`span`,{className:`sf-pill sf-pill--mode`,children:M||`Proof of Memory™`}),ne,A?(0,F.jsxs)(`span`,{className:`sf-pill sf-pill--phikey`,title:A,children:[`ΦKey `,(0,F.jsx)(`span`,{className:`sf-key`,children:A})]}):null]}),(0,F.jsxs)(`div`,{className:`sf-payload-core`,children:[(0,F.jsxs)(`span`,{children:[`☤Kai: `,x]}),(0,F.jsx)(`span`,{className:`sf-muted`,children:` · `}),(0,F.jsxs)(`span`,{className:`sf-kai-label`,children:[bo(S),`:`,bo(C),` — D`,w,`/M`,T,`/Y`,E,` · `,k]}),(0,F.jsx)(`span`,{className:`sf-muted`,children:` · `}),(0,F.jsxs)(`span`,{className:`sf-kai-label`,children:[O,` · `,D]})]}),o?(0,F.jsx)(`div`,{className:`sf-seal`,role:`group`,"aria-label":`Private sealed content`,children:s.status===`open`?(0,F.jsxs)(`div`,{className:`sf-seal__row`,children:[(0,F.jsx)(`span`,{className:`sf-seal__label`,children:`Unsealed`}),(0,F.jsx)(`button`,{type:`button`,className:`sf-seal__btn`,onClick:m,"aria-label":`Seal view`,children:`SEAL`})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`sf-seal__row`,children:[(0,F.jsx)(`span`,{className:`sf-seal__label`,children:`Private`}),(0,F.jsx)(`button`,{type:`button`,className:`sf-seal__btn`,onClick:b,disabled:s.status===`opening`,"aria-label":`Unseal private content`,children:y})]}),N?(0,F.jsx)(`div`,{className:`sf-seal__hint`,role:`note`,children:N}):null,(0,F.jsxs)(`div`,{ref:_,className:`sf-seal__gate`,role:`region`,"aria-label":`Unlock gate`,children:[l?u?c?null:(0,F.jsx)(`div`,{className:`sf-seal__hint`,role:`note`,children:`Inhale your ΦKey to unseal.`}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`sf-seal__hint`,role:`note`,children:`Verified session detected, but no sigil metadata is present. Re-inhale your glyph.`}),(0,F.jsx)(`div`,{className:`sf-seal__login`,"aria-label":`Glyph re-upload`,children:(0,F.jsx)(ee,{onVerified:d})}),(0,F.jsx)(`div`,{className:`sf-seal__row`,children:(0,F.jsx)(`button`,{type:`button`,className:`sf-seal__btn`,onClick:f,"aria-label":`Use a different key`,children:`USE DIFFERENT ΦKEY`})})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`sf-seal__hint`,role:`note`,children:`Inhale your ΦKey, then unseal.`}),(0,F.jsx)(`div`,{className:`sf-seal__login`,"aria-label":`Glyph upload`,children:(0,F.jsx)(ee,{onVerified:d})})]}),s.status===`error`?(0,F.jsx)(`div`,{className:`sf-seal__hint`,role:`note`,children:s.message}):null]})]})}):null,te?null:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(is,{body:h,caption:g,isSealed:!1}),r?(0,F.jsx)(kt,{manifest:r}):null]}),(0,F.jsx)(`div`,{className:`sf-reply-actions`,children:(0,F.jsx)(`button`,{type:`button`,className:`sf-kopyBtn`,onClick:a,disabled:i,"data-state":i?`copied`:`idle`,"aria-label":`Remember share link`,children:i?`REMEMBERED`:`REMEMBER`})})]})}function ms(){return(0,F.jsx)(I,{children:(0,F.jsx)(M,{children:(0,F.jsx)(hs,{})})})}function hs(){let e=ce(),t=O(),n=i(),r=oe(e=>{e.preventDefault(),n(`/keystream`)}),[a,o]=(0,P.useState)([]),c=(0,P.useRef)(new Set),l=(0,P.useRef)(zo()),u=(0,P.useRef)(new Set),[d,f]=(0,P.useState)(0),p=(0,P.useRef)(!1),m=(0,P.useCallback)((e,t)=>{uo(()=>{let t=l.current,n=!1;for(let r of e)!r||!r.trim().length||(n=Go(t,r)||n);n&&(Bo(t),f(e=>e+1))})},[]),h=(0,P.useCallback)(e=>{if(!p.current){p.current=!0;try{let t=new Set,n=e=>{if(!e)return;let n=Do(e);$(n)&&t.add(n)},r=l.current;for(let e of Object.keys(r.parentOf))n(e);for(let e of Object.keys(r.childrenOf)){n(e);for(let t of r.childrenOf[e]??[])n(t)}for(let e of Object.keys(r.pulseOf))n(e);for(let t of e){n(ko(t));for(let e of Wo(t))n(e)}let i=0;for(let e of t){if(i>=Lo)break;i+=1;let t=s(e);if(!t)continue;let n=t.usernameClaim;if(!n)continue;let r=te(n.hash??``),a=n.payload;if(!r||!a||a.kind!==`username_claim`)continue;let o=re(a.normalized||a.username||``),c=re(t.author??``),l=o||c;if(!l)continue;let u=n.url?.trim()||Co(e);if(!u)continue;let d=n.ownerHint??a.ownerHint??null;ne({hash:r,url:u,payload:{...a,normalized:o||l},ownerHint:d})}}catch(e){B(`rehydrate username claims`,e)}}},[]);(0,P.useEffect)(()=>{if(typeof window>`u`)return;let e=e=>{o(t=>{let n=new Set(t.map(({url:e})=>e)),r=[...t],i=[];for(let{url:t}of e){let e=t.trim();!e||n.has(e)||(n.add(e),r.push({url:e}),i.push(e))}if(i.length>0){for(let e of i)j(e);m(i),h(i)}return r})};uo(()=>{let t=W(localStorage.getItem(U));t.length&&e(t.map(e=>({url:e})))});let t=!1;return uo(()=>{(async()=>{try{let n=await pe();!t&&n.length&&e(n)}catch(e){B(`initial seed load`,e)}})().catch(e=>B(`initial seed load outer`,e))}),()=>{t=!0}},[m,h]),(0,P.useEffect)(()=>{if(!(typeof window>`u`))try{let e=new URLSearchParams(window.location.search),t=new URLSearchParams(window.location.hash.startsWith(`#`)?window.location.hash.slice(1):window.location.hash),n=[...e.getAll(`add`),...t.getAll(`add`)].map(ve).filter(e=>typeof e==`string`&&e.trim().length>0).map(jo);if(n.length===0)return;m([window.location.href,...n]),o(e=>{let t=new Set(e.map(e=>e.url)),r=n.filter(e=>!t.has(e));if(r.length){G(r);for(let e of r)j(e);return[...r.map(e=>({url:e})),...e]}return e})}catch(e){B(`add ingestion (location)`,e)}},[t.pathname,t.search,t.hash,m]),(0,P.useEffect)(()=>{typeof window>`u`||uo(()=>{let e=c.current,t=[],n=e=>{e.trim().length&&(t.includes(e)||t.push(e))};for(let t of a){let r=t.url;if(!r||e.has(r))continue;e.add(r);let i=Oo(r);if(!i)continue;let a=i.hash&&i.hash.startsWith(`#`)?i.hash.slice(1):``,o=new URLSearchParams(a),s=[...i.searchParams.getAll(`add`),...o.getAll(`add`)];if(s.length===0)continue;let c=s.map(ve).filter(e=>typeof e==`string`&&e.trim().length>0).map(jo);for(let e of c)n(e)}t.length!==0&&(m(t),o(e=>{let n=new Set(e.map(e=>e.url)),r=t.filter(e=>!n.has(e));if(!r.length)return e;try{G(r)}catch(e){B(`prependUniqueToStorage (infinite replies)`,e)}for(let e of r)try{j(e)}catch(e){B(`registerSigilUrl (infinite replies)`,e)}return[...r.map(e=>({url:e})),...e]}))})},[a,m]),(0,P.useEffect)(()=>{typeof window>`u`||uo(()=>{let e=u.current,t=[];for(let n of a){let r=n.url;if(!(!r||e.has(r))&&(e.add(r),t.push(r),t.length>=256))break}t.length&&m(t)})},[a,m]);let[g,_]=(0,P.useState)(null),[v,b]=(0,P.useState)(null),[x,S]=(0,P.useState)(null),C=(0,P.useRef)(null),[w,E]=(0,P.useState)({status:`none`});(0,P.useEffect)(()=>{if(!v){E({status:`none`});return}E(V(v)&&v.seal!==void 0?{status:`sealed`}:{status:`none`})},[v]);let D=(0,P.useCallback)(async()=>{if(typeof window>`u`)return;let t=y(),n=t?Do(t):null;if(n)try{let e=Ao(n);e!==`${window.location.pathname}${window.location.search}${window.location.hash}`&&window.history.replaceState(null,``,e)}catch(e){B(`canonicalizeLocationRel`,e)}if(_(n),!n){b(null),S(null),C.current=null;return}try{let e=Co(n),t=Eo(n);j(e),t!==e&&j(t)}catch(e){B(`register current stream url (pre-decode)`,e)}try{let e=Co(n);o(t=>{if(new Set(t.map(e=>e.url)).has(e))return t;try{G([e])}catch(e){B(`prependUniqueToStorage (visited stream)`,e)}try{j(e)}catch(e){B(`registerSigilUrl (visited stream)`,e)}return[{url:e},...t]}),m([window.location.href,e])}catch(e){B(`ms2 ingest visited stream`,e)}try{let r=await s(n)||(t&&t!==n?await s(t):null);if(!r){b(null),S(`Invalid or unreadable payload token.`);return}let i=r.usernameClaim,a=i?re(i.payload?.normalized||i.payload?.username||``):``,c=re(r.author??``),u=a||c;if(i){let e=te(i.hash??``),t=i.url?.trim()||Co(n);if(!e||!t){b(null),S(`Username claim missing glyph reference.`);return}if(!u){b(null),S(`Username claim missing normalized username.`);return}let r=ae()[u];if(r&&r.claimHash!==e){b(null),S(`Username claimed by another glyph.`);return}let a=i.payload;if(!a||a.kind!==`username_claim`){b(null),S(`Invalid username-claim payload.`);return}let o=re(a.normalized||a.username||``)||u;if(o!==u){b(null),S(`Username claim does not match author.`);return}let s=ne({hash:e,url:t,payload:{...a,normalized:o},ownerHint:i.ownerHint??a.ownerHint??null});if(!s.accepted){b(null),S(`Username claim rejected: ${s.reason??`unknown`}.`);return}}else if(u&&ae()[u]){b(null),S(`Claim glyph is required for this username.`);return}b(r),S(null);try{let e=l.current;Uo(e,n,eo(r.pulse))&&(Bo(e),f(e=>e+1))}catch(e){B(`ms2SetPulse`,e)}if(r.url&&typeof r.url==`string`&&r.url.length){if(C.current!==n){C.current=n;try{G([r.url])}catch(e){B(`prependUniqueToStorage (payload url)`,e)}let t=Ha({token:n,payloadUrl:r.url,toast:(t,n)=>e.push(t,n)});o(e=>new Set(e.map(e=>e.url)).has(r.url)?e:[{url:r.url},...e]),t.ok||B(`phistream auto-add`,t.reason)}else o(e=>new Set(e.map(e=>e.url)).has(r.url)?e:[{url:r.url},...e]);try{j(r.url)}catch(e){B(`register payload.url (post-decode)`,e)}}try{j(To(n))}catch(e){B(`register short alias url`,e)}}catch(e){B(`payload decode`,e),b(null),S(`Payload decode failed.`)}},[e,m]);(0,P.useEffect)(()=>{D()},[t.pathname,t.search,t.hash,D]);let k=(0,P.useMemo)(()=>{if(!v)return{weekday:void 0,chakra:void 0};let e=eo(v.pulse);return{weekday:po(so(e)),chakra:mo(co(e))}},[v]),M=(0,P.useMemo)(()=>`sf.verifiedSession:${xo(g??(typeof window<`u`?y():null)??`root`)}`,[g]),[N,ie]=(0,P.useState)(()=>{try{if(typeof window>`u`)return!1;let e=`sf.verifiedSession:${xo(y()||`root`)}`;return sessionStorage.getItem(e)===`1`}catch(e){return B(`sessionStorage.getItem (init)`,e),!1}});(0,P.useEffect)(()=>{try{if(typeof window>`u`)return;ie(sessionStorage.getItem(M)===`1`)}catch(e){B(`sessionStorage.getItem (sync)`,e),ie(!1)}},[M]);let se=()=>{ie(!0);try{sessionStorage.setItem(M,`1`)}catch(e){B(`sessionStorage.setItem`,e)}e.push(`success`,`ΦKey inhaled.`)},le=()=>{ie(!1);try{sessionStorage.removeItem(M)}catch(e){B(`sessionStorage.removeItem`,e)}},I=A(),L=(0,P.useMemo)(()=>fe(I),[I]),R=(0,P.useMemo)(()=>N?L.meta:null,[N,L.meta]),z=(0,P.useMemo)(()=>N?L.svgText:null,[N,L.svgText]),ue=(0,P.useMemo)(()=>R?H(R,`userPhiKey`):void 0,[R]),de=(0,P.useMemo)(()=>R?H(R,`kaiSignature`):void 0,[R]),me=(0,P.useMemo)(()=>{let e=os(R,`sigil_r`)??os(R,`sigilR`)??os(R,`tintR`)??null,t=os(R,`sigil_g`)??os(R,`sigilG`)??os(R,`tintG`)??null,n=os(R,`sigil_b`)??os(R,`sigilB`)??os(R,`tintB`)??null;if(e===null||t===null||n===null)return{};let r={};return r[`--sigil-r`]=String(ss(e)),r[`--sigil-g`]=String(ss(t)),r[`--sigil-b`]=String(ss(n)),r},[R]),he=e=>{o(t=>new Set(t.map(e=>e.url)).has(e)?t:(G([e]),j(e),m([e]),[{url:e},...t]))},K=(0,P.useMemo)(()=>v?V(v)&&v.seal!==void 0:!1,[v]),ge=(0,P.useMemo)(()=>!!(K&&N&&R),[K,N,R]),_e=(0,P.useCallback)(()=>{v&&(E(K?{status:`sealed`}:{status:`none`}),e.push(`success`,`Sealed`))},[v,K,e]),ye=(0,P.useCallback)(async()=>{if(!v)return;let t=v.seal;if(!t){E({status:`error`,message:`No seal present on this payload.`});return}if(!N||!R){E({status:`error`,message:`Inhale your ΦKey to unseal.`});return}E({status:`opening`});try{E({status:`open`,content:await fs({seal:t,meta:R,svgText:z??null})}),e.push(`success`,`Unsealed`)}catch(t){B(`unseal`,t),E({status:`error`,message:`Unseal failed. Wrong key, wrong seal, or missing postSeal implementation.`}),e.push(`warn`,`Unseal failed.`)}},[v,N,R,z,e]),be=(0,P.useMemo)(()=>K&&w.status!==`open`,[K,w.status]),xe=(0,P.useMemo)(()=>w.status===`open`?w.content.body:v?.body,[v,w]),Se=(0,P.useMemo)(()=>w.status===`open`?w.content.caption??v?.caption:v?.caption,[v,w]),Ce=(0,P.useMemo)(()=>w.status===`open`?w.content.attachments??v?.attachments:v?.attachments,[v,w]),we=(0,P.useMemo)(()=>Ce?rs(Ce):null,[Ce]),[Te,Ee]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>()=>{De.current!==null&&window.clearTimeout(De.current)},[]);let Oe=(0,P.useCallback)(()=>{let t=g??(typeof window<`u`?y():null),n=t?Do(t):null;if(!n)return;let r=Co(n),i=typeof window<`u`?Wo(window.location.href):[],a=i.length?Mo(r,i):r;if(Xo(a)){Ee(!0),De.current!==null&&window.clearTimeout(De.current),De.current=window.setTimeout(()=>Ee(!1),1200),e.push(`success`,`Remembered`);return}let o=Zo(a);if(o){Ee(!0),De.current!==null&&window.clearTimeout(De.current),De.current=window.setTimeout(()=>Ee(!1),1200),e.push(`success`,`Remembered`),o.catch(t=>{B(`kopy clipboard.writeText`,t),Ee(!1),e.push(`warn`,`Remember failed. Select the address bar.`)});return}e.push(`warn`,`Remember failed. Select the address bar.`)},[g,e]),ke=(0,P.useMemo)(()=>{if(!g)return[];let e=l.current;return Jo(e,g).map(t=>Yo(e,t))},[g,d]);(0,P.useEffect)(()=>{g&&ke.length!==0&&o(e=>{let t=new Set(e.map(e=>e.url)),n=ke.filter(e=>!t.has(e));if(!n.length)return e;try{G(n)}catch(e){B(`prependUniqueToStorage (thread hydrate)`,e)}for(let e of n)try{j(e)}catch(e){B(`registerSigilUrl (thread hydrate)`,e)}return[...n.map(e=>({url:e})),...e]})},[g,ke]);let Ae=(0,P.useMemo)(()=>{let e=a.map(e=>e.url);if(!g||ke.length===0)return e;let t=new Set,n=[];for(let e of ke)t.has(e)||(t.add(e),n.push(e));for(let r of e)t.has(r)||(t.add(r),n.push(r));return n},[a,g,ke]),Me=N&&(R||z)?Ue({meta:R,svgText:z||``}):null;return(0,F.jsxs)(`main`,{className:`sf`,"data-weekday":k.weekday,"data-chakra":k.chakra,style:me,children:[(0,F.jsxs)(`header`,{className:`sf-head`,role:`region`,"aria-labelledby":`glyph-stream-title`,children:[(0,F.jsx)(`nav`,{className:`sf-topnav`,"aria-label":`Back navigation`,children:(0,F.jsx)(T,{className:`sf-back`,to:`/keystream`,...r,children:`← Back to Keystream`})}),(0,F.jsx)(`h1`,{id:`glyph-stream-title`,children:`Memory Stream`}),(0,F.jsx)(On,{}),v&&g?(0,F.jsx)(ps,{token:g,payload:v,manifest:we,copied:Te,onKopy:Oe,isSealed:K,unsealState:w,canUnseal:ge,verifiedThisSession:N,hasComposerMeta:!!R,onVerifiedNow:se,onResetVerified:le,onUnseal:ye,onForgetUnsealed:_e,body:xe,caption:Se}):x?(0,F.jsx)(`div`,{className:`sf-error`,role:`alert`,children:x}):(0,F.jsxs)(`p`,{className:`sf-sub`,children:[`Open a payload link at `,(0,F.jsx)(`code`,{children:`/stream/p/`}),` (or `,(0,F.jsx)(`code`,{children:`/stream#t=`}),`). Replies are Kai-sealed and thread via `,(0,F.jsx)(`code`,{children:`#add=`}),`. Short alias accepted: `,(0,F.jsx)(`code`,{children:`/p~`}),` `,`(and legacy `,(0,F.jsx)(`code`,{children:`/p#t=`}),`, `,(0,F.jsx)(`code`,{children:`/p?t=`}),`, `,(0,F.jsx)(`code`,{children:`/stream?p=`}),`).`]}),!v&&(0,F.jsx)(`section`,{className:`sf-inhaler`,"aria-labelledby":`inhaler-title`,children:(0,F.jsx)(Ge,{onAdd:he})}),(0,F.jsx)(je,{phiKey:ue,kaiSignature:de}),Me?.node?(0,F.jsx)(`section`,{className:`sf-sigilWrap`,"aria-label":`Sigil stage`,children:(0,F.jsx)(`div`,{className:`sf-sigilWrap__inner`,children:Me.node})}):null,v&&!be?(0,F.jsxs)(`section`,{className:`sf-reply`,"aria-labelledby":`reply-title`,children:[(0,F.jsx)(`h2`,{id:`reply-title`,className:`sf-reply-title`,children:`Reply`}),N?R?(0,F.jsx)(Qt,{meta:R,svgText:z,onUseDifferentKey:le}):(0,F.jsx)(`div`,{className:`sf-error`,role:`alert`,children:`Verified, but no sigil metadata found. Re-inhale your glyph.`}):(0,F.jsxs)(`div`,{className:`sf-reply-login`,children:[(0,F.jsx)(`p`,{className:`sf-sub`,children:`Inhale ΦKey to resonate a reply.`}),(0,F.jsx)(ee,{onVerified:se})]})]}):null]}),(0,F.jsx)(`section`,{className:`sf-list`,children:Ae.length===0?(0,F.jsxs)(`div`,{className:`sf-empty`,children:[`No items yet. Paste a link above or open a `,(0,F.jsx)(`code`,{children:`/stream/p/`}),` link and reply to start a thread.`]}):(0,F.jsx)(Da,{urls:Ae})})]})}var gs=ms;export{gs as n,ms as t}; \ No newline at end of file diff --git a/dist/assets/VerifierFrame-BP2mhmRz.js b/dist/assets/VerifierFrame-a5dTHTgU.js similarity index 99% rename from dist/assets/VerifierFrame-BP2mhmRz.js rename to dist/assets/VerifierFrame-a5dTHTgU.js index 4637a493..6e8bf33f 100644 --- a/dist/assets/VerifierFrame-BP2mhmRz.js +++ b/dist/assets/VerifierFrame-a5dTHTgU.js @@ -1 +1 @@ -import{En as e,Tn as t,jn as n,pn as r,tn as i}from"./index-CgC-NZbJ.js";import{t as a}from"./prop-types-CRrLra82.js";function o(e){return e.replace(/^\/+|\/+$/g,``)}function s(){try{return`/`}catch{}return`/`}function c(){if(typeof window>`u`)return`/verify`;let e=window.location.origin,t=o(s());return`${e}${t.length>0?`/${t}`:``}/verify`}function l(e){let t=typeof e==`string`?e.trim():``,n=t.length>0?t:`unknown-signature`;return n.length>10?n.slice(0,10):n}function u(e,t){return`${e}-${l(t)}`}function d(e,t,n){return`${(n??c()).replace(/\/+$/,``)}/${encodeURIComponent(u(e,t))}`}var f={root:`Root`,sacral:`Sacral`,solar:`Solar Plexus`,solarp:`Solar Plexus`,solarplexus:`Solar Plexus`,heart:`Heart`,throat:`Throat`,thirdeye:`Third Eye`,crown:`Crown`,krown:`Crown`};function p(e){if(typeof e!=`string`)return;let t=e.trim();if(t)return f[t.toLowerCase().replace(/[\s_-]/g,``)]}function m(e){let t=``;for(let n of e)t+=n.toString(16).padStart(2,`0`);return t}async function h(e){if(typeof crypto>`u`||!crypto.subtle)throw Error(`crypto.subtle unavailable; cannot compute proofHash.`);let t=new TextEncoder().encode(e),n=await crypto.subtle.digest(`SHA-256`,t);return m(new Uint8Array(n))}function g(e){return JSON.stringify({v:e.v,pulse:e.pulse,chakraDay:e.chakraDay,kaiSignature:e.kaiSignature,phiKey:e.phiKey,verifierSlug:e.verifierSlug})}async function _(e){return await h(g(e))}var v=e(((e,t)=>{t.exports={L:1,M:0,Q:3,H:2}})),y=e(((e,t)=>{t.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}})),b=e(((e,t)=>{var n=y();function r(e){this.mode=n.MODE_8BIT_BYTE,this.data=e}r.prototype={getLength:function(e){return this.data.length},write:function(e){for(var t=0;t{var n=v();function r(e,t){this.totalCount=e,this.dataCount=t}r.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],r.getRSBlocks=function(e,t){var n=r.getRsBlockTable(e,t);if(n==null)throw Error(`bad rs block @ typeNumber:`+e+`/errorCorrectLevel:`+t);for(var i=n.length/3,a=[],o=0;o{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){var t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(var n=0;n>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),C=e(((e,t)=>{for(var n={glog:function(e){if(e<1)throw Error(`glog(`+e+`)`);return n.LOG_TABLE[e]},gexp:function(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return n.EXP_TABLE[e]},EXP_TABLE:Array(256),LOG_TABLE:Array(256)},r=0;r<8;r++)n.EXP_TABLE[r]=1<{var n=C();function r(e,t){if(e.length==null)throw Error(e.length+`/`+t);for(var n=0;n{var n=y(),r=w(),i=C(),a={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},o={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(e){for(var t=e<<10;o.getBCHDigit(t)-o.getBCHDigit(o.G15)>=0;)t^=o.G15<=0;)t^=o.G18<>>=1;return t},getPatternPosition:function(e){return o.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,n){switch(e){case a.PATTERN000:return(t+n)%2==0;case a.PATTERN001:return t%2==0;case a.PATTERN010:return n%3==0;case a.PATTERN011:return(t+n)%3==0;case a.PATTERN100:return(Math.floor(t/2)+Math.floor(n/3))%2==0;case a.PATTERN101:return t*n%2+t*n%3==0;case a.PATTERN110:return(t*n%2+t*n%3)%2==0;case a.PATTERN111:return(t*n%3+(t+n)%2)%2==0;default:throw Error(`bad maskPattern:`+e)}},getErrorCorrectPolynomial:function(e){for(var t=new r([1],0),n=0;n5&&(n+=3+a-5)}for(var r=0;r{var n=b(),r=x(),i=S(),a=T(),o=w();function s(e,t){this.typeNumber=e,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var c=s.prototype;c.addData=function(e){var t=new n(e);this.dataList.push(t),this.dataCache=null},c.isDark=function(e,t){if(e<0||this.moduleCount<=e||t<0||this.moduleCount<=t)throw Error(e+`,`+t);return this.modules[e][t]},c.getModuleCount=function(){return this.moduleCount},c.make=function(){if(this.typeNumber<1){var e=1;for(e=1;e<40;e++){for(var t=r.getRSBlocks(e,this.errorCorrectLevel),n=new i,o=0,s=0;s=7&&this.setupTypeNumber(e),this.dataCache??=s.createData(this.typeNumber,this.errorCorrectLevel,this.dataList),this.mapData(this.dataCache,t)},c.setupPositionProbePattern=function(e,t){for(var n=-1;n<=7;n++)if(!(e+n<=-1||this.moduleCount<=e+n))for(var r=-1;r<=7;r++)t+r<=-1||this.moduleCount<=t+r||(0<=n&&n<=6&&(r==0||r==6)||0<=r&&r<=6&&(n==0||n==6)||2<=n&&n<=4&&2<=r&&r<=4?this.modules[e+n][t+r]=!0:this.modules[e+n][t+r]=!1)},c.getBestMaskPattern=function(){for(var e=0,t=0,n=0;n<8;n++){this.makeImpl(!0,n);var r=a.getLostPoint(this);(n==0||e>r)&&(e=r,t=n)}return t},c.createMovieClip=function(e,t,n){var r=e.createEmptyMovieClip(t,n),i=1;this.make();for(var a=0;a>n&1)==1;this.modules[Math.floor(n/3)][n%3+this.moduleCount-8-3]=r}for(var n=0;n<18;n++){var r=!e&&(t>>n&1)==1;this.modules[n%3+this.moduleCount-8-3][Math.floor(n/3)]=r}},c.setupTypeInfo=function(e,t){for(var n=this.errorCorrectLevel<<3|t,r=a.getBCHTypeInfo(n),i=0;i<15;i++){var o=!e&&(r>>i&1)==1;i<6?this.modules[i][8]=o:i<8?this.modules[i+1][8]=o:this.modules[this.moduleCount-15+i][8]=o}for(var i=0;i<15;i++){var o=!e&&(r>>i&1)==1;i<8?this.modules[8][this.moduleCount-i-1]=o:i<9?this.modules[8][15-i-1+1]=o:this.modules[8][15-i-1]=o}this.modules[this.moduleCount-8][8]=!e},c.mapData=function(e,t){for(var n=-1,r=this.moduleCount-1,i=7,o=0,s=this.moduleCount-1;s>0;s-=2)for(s==6&&s--;;){for(var c=0;c<2;c++)if(this.modules[r][s-c]==null){var l=!1;o>>i&1)==1),a.getMask(t,r,s-c)&&(l=!l),this.modules[r][s-c]=l,i--,i==-1&&(o++,i=7)}if(r+=n,r<0||this.moduleCount<=r){r-=n,n=-n;break}}},s.PAD0=236,s.PAD1=17,s.createData=function(e,t,n){for(var o=r.getRSBlocks(e,t),c=new i,l=0;ld*8)throw Error(`code length overflow. (`+c.getLengthInBits()+`>`+d*8+`)`);for(c.getLengthInBits()+4<=d*8&&c.put(0,4);c.getLengthInBits()%8!=0;)c.putBit(!1);for(;!(c.getLengthInBits()>=d*8||(c.put(s.PAD0,8),c.getLengthInBits()>=d*8));)c.put(s.PAD1,8);return s.createBytes(c,o)},s.createBytes=function(e,t){for(var n=0,r=0,i=0,s=Array(t.length),c=Array(t.length),l=0;l=0?m.get(h):0}}for(var g=0,f=0;f{Object.defineProperty(e,`__esModule`,{value:!0});var n=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}var l={bgColor:r.default.oneOfType([r.default.object,r.default.string]).isRequired,bgD:r.default.string.isRequired,fgColor:r.default.oneOfType([r.default.object,r.default.string]).isRequired,fgD:r.default.string.isRequired,size:r.default.number.isRequired,title:r.default.string,viewBoxSize:r.default.number.isRequired,xmlns:r.default.string},u=(0,i.forwardRef)(function(e,t){var r=e.bgColor,i=e.bgD,a=e.fgD,s=e.fgColor,l=e.size,u=e.title,d=e.viewBoxSize,f=e.xmlns,p=f===void 0?`http://www.w3.org/2000/svg`:f,m=c(e,[`bgColor`,`bgD`,`fgD`,`fgColor`,`size`,`title`,`viewBoxSize`,`xmlns`]);return o.default.createElement(`svg`,n({},m,{height:l,ref:t,viewBox:`0 0 `+d+` `+d,width:l,xmlns:p}),u?o.default.createElement(`title`,null,u):null,o.default.createElement(`path`,{d:i,fill:r}),o.default.createElement(`path`,{d:a,fill:s}))});u.displayName=`QRCodeSvg`,u.propTypes=l,e.default=u})),O=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.QRCode=void 0;var n=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}var f={bgColor:r.default.oneOfType([r.default.object,r.default.string]),fgColor:r.default.oneOfType([r.default.object,r.default.string]),level:r.default.string,size:r.default.number,value:r.default.string.isRequired},p=(0,s.forwardRef)(function(e,t){var r=e.bgColor,a=r===void 0?`#FFFFFF`:r,s=e.fgColor,u=s===void 0?`#000000`:s,f=e.level,p=f===void 0?`L`:f,m=e.size,h=m===void 0?256:m,g=e.value,_=d(e,[`bgColor`,`fgColor`,`level`,`size`,`value`]),v=new o.default(-1,i.default[p]);v.addData(g),v.make();var y=v.modules;return c.default.createElement(l.default,n({},_,{bgColor:a,bgD:y.map(function(e,t){return e.map(function(e,n){return e?``:`M `+n+` `+t+` l 1 0 0 1 -1 0 Z`}).join(` `)}).join(` `),fgColor:u,fgD:y.map(function(e,t){return e.map(function(e,n){return e?`M `+n+` `+t+` l 1 0 0 1 -1 0 Z`:``}).join(` `)}).join(` `),ref:t,size:h,viewBoxSize:y.length}))});e.QRCode=p,p.displayName=`QRCode`,p.propTypes=f,e.default=p})),k=n(t(),1),A=n(O(),1),j=n(i(),1);function M(e){return typeof e==`object`&&!!e}function N(e){return typeof e==`function`}function P(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`bigint`){let t=BigInt(2**53-1),n=BigInt(-(2**53-1));return e>t||e0?n:null}function I(e){if(M(e)){let t=e.default;if(N(t))return t;let n=e.QRCode;if(N(n))return n}return N(e)?e:function({value:e}){return(0,j.jsx)(`div`,{className:`kv-verifier__qr-fallback`,"aria-label":`QR unavailable`,children:e})}}var L=I(A);function R(e,t=6,n=6){return e?e.length<=t+n+3?e:`${e.slice(0,t)}…${e.slice(-n)}`:``}function z(e,t=10,n=10){return e?e.length<=t+n+3?e:`${e.slice(0,t)}…${e.slice(-n)}`:``}function B(){let e=r;for(let t of[`kaiPulseNow`,`getKaiPulseNow`,`pulseNow`]){let n=e[t];if(N(n)){let e=F(P(n()));if(e)return e}}let t=e.kairosEpochNow,n=P(e.GENESIS_TS),i=P(e.PULSE_MS);if(N(t)&&n!==null&&i!==null&&Number.isFinite(i)&&i>0){let e=P(t());if(e!==null){let t=e-n;if(Number.isFinite(t)){let e=Math.floor(t/i)+1;return e>0?e:null}}}return null}function V(){let e=r,t=e.kairosEpochNow,n=P(e.GENESIS_TS),i=P(e.PULSE_MS);if(!N(t)||n===null||i===null||!(i>0))return null;let a=P(t());if(a===null)return null;let o=a-n;if(!Number.isFinite(o))return null;let s=n+(Math.max(0,Math.floor(o/i))+1)*i-a,c=Math.ceil(Math.max(25,Math.min(6e4,s)));return Number.isFinite(c)?c:null}function H(e){let[t,n]=(0,k.useState)(()=>B()??0);return(0,k.useEffect)(()=>{if(!e)return;let t=!1,r=null,i=()=>{if(t)return;let e=B();e&&e>0&&n(e);let a=V()??1e3;r=window.setTimeout(i,a)};return i(),()=>{t=!0,r!==null&&window.clearTimeout(r)}},[e]),t}function U({pulse:e,kaiSignature:t,phiKey:n,caption:r,chakraDay:i,compact:a=!1,verifierBaseUrl:o}){let[s,f]=(0,k.useState)(`idle`),[m,h]=(0,k.useState)(`idle`),[g,v]=(0,k.useState)(null),y=F(e),b=H(y===null),x=y??b,S=(0,k.useMemo)(()=>{let e=o??c(),r=String(e).replace(/\/+$/,``)||`/verify`,a=typeof t==`string`?t.trim():``,s=l(a),f=Number.isFinite(x)&&x>0?Math.floor(x):0,m=u(f,a),h=d(f,a,r),g=p(typeof i==`string`?i:String(i??``)),_=typeof n==`string`?n.trim():``;return{verifierUrl:h,verifierBaseUrl:r,verifierSlug:m,pulse:f,chakraDay:g,kaiSignature:a,kaiSignatureShort:s,phiKey:_,proofCapsule:f>0&&a.length>0&&_.length>0&&g?{v:`KPV-1`,pulse:f,chakraDay:g,kaiSignature:a,phiKey:_,verifierSlug:m}:null,proofHash:void 0}},[i,t,n,x,o]);(0,k.useEffect)(()=>{let e=!1;return(async()=>{if(!S.proofCapsule){v(null);return}try{let t=await _(S.proofCapsule);e||v(t)}catch{e||v(null)}})(),()=>{e=!0}},[S.proofCapsule]);let C=a?96:160,w=async()=>{if(typeof navigator>`u`||!navigator.clipboard){f(`error`);return}try{await navigator.clipboard.writeText(S.verifierUrl),f(`ok`),window.setTimeout(()=>f(`idle`),2e3)}catch{f(`error`)}},T=async()=>{if(typeof navigator>`u`||!navigator.clipboard){h(`error`);return}try{let e=g??void 0;!e&&S.proofCapsule&&(e=await _(S.proofCapsule),v(e));let t={...S,proofHash:e};await navigator.clipboard.writeText(JSON.stringify(t,null,2)),h(`ok`),window.setTimeout(()=>h(`idle`),2e3)}catch{h(`error`)}},E=a?`kv-verifier kv-verifier--compact`:`kv-verifier`,D=Number.isFinite(S.pulse)&&S.pulse>0?String(S.pulse):`—`,O=typeof r==`string`?r.trim():``,A=R(S.phiKey),M=g?z(g):`—`;return(0,j.jsxs)(`section`,{className:E,"aria-label":`Kai-Sigil verification frame`,"data-role":`verifier-frame`,children:[(0,j.jsx)(`div`,{className:`kv-verifier__qr-shell`,role:`img`,"aria-label":`QR code linking to Kai-Sigil verifier for pulse ${D} and signature ${S.kaiSignatureShort}`,children:(0,j.jsx)(`div`,{className:`kv-verifier__qr-inner`,children:(0,j.jsx)(L,{value:S.verifierUrl,size:C,bgColor:`#00000000`,fgColor:`#ffffff`})})}),(0,j.jsxs)(`div`,{className:`kv-verifier__content`,children:[(0,j.jsxs)(`header`,{className:`kv-verifier__header`,children:[(0,j.jsx)(`h3`,{className:`kv-verifier__title`,children:`Kai-Sigil Verifier`}),(0,j.jsx)(`p`,{className:`kv-verifier__subtitle`,children:`Scan or open the verifier link to confirm this post was sealed by this Φ-Key (KPV-1 payload-bound proof).`})]}),(0,j.jsxs)(`dl`,{className:`kv-verifier__meta`,children:[(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`🌀 Pulse`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value`,children:D})]}),(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`Kai Signature`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value kv-verifier__mono`,children:S.kaiSignatureShort})]}),(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`Φ-Key`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value kv-verifier__mono`,title:S.phiKey,children:A||`—`})]}),S.chakraDay?(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`🧬 Chakra Day`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value`,children:S.chakraDay})]}):null,(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`🔒 Proof Hash`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value kv-verifier__mono`,title:g??``,children:M})]})]}),O.length>0?(0,j.jsxs)(`p`,{className:`kv-verifier__caption`,"aria-label":`Post caption`,children:[`“`,O,`”`]}):null,(0,j.jsxs)(`div`,{className:`kv-verifier__actions`,children:[(0,j.jsx)(`a`,{href:S.verifierUrl,target:`_blank`,rel:`noopener noreferrer`,className:`kv-verifier__btn kv-verifier__btn--primary`,"data-role":`verifier-open-link`,children:`Open Verifier`}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>void w(),className:`kv-verifier__btn kv-verifier__btn--ghost`,"data-role":`verifier-copy-link`,children:s===`ok`?`Remembered!`:s===`error`?`Remember failed`:`Remember Link`}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>void T(),className:`kv-verifier__btn kv-verifier__btn--ghost`,"data-role":`verifier-copy-proof`,children:m===`ok`?`Proof Remembered!`:m===`error`?`Remember failed`:`Remember Proof`})]}),(0,j.jsxs)(`p`,{className:`kv-verifier__url`,"aria-label":`Verifier URL`,children:[(0,j.jsx)(`span`,{className:`kv-verifier__url-label`,children:`Verifier URL:`}),(0,j.jsx)(`span`,{className:`kv-verifier__url-value`,children:S.verifierUrl})]})]})]})}export{p as a,_ as i,u as n,d as r,U as t}; \ No newline at end of file +import{En as e,Tn as t,jn as n,pn as r,tn as i}from"./index-BlYU7j-M.js";import{t as a}from"./prop-types-BWhc8UTz.js";function o(e){return e.replace(/^\/+|\/+$/g,``)}function s(){try{return`/`}catch{}return`/`}function c(){if(typeof window>`u`)return`/verify`;let e=window.location.origin,t=o(s());return`${e}${t.length>0?`/${t}`:``}/verify`}function l(e){let t=typeof e==`string`?e.trim():``,n=t.length>0?t:`unknown-signature`;return n.length>10?n.slice(0,10):n}function u(e,t){return`${e}-${l(t)}`}function d(e,t,n){return`${(n??c()).replace(/\/+$/,``)}/${encodeURIComponent(u(e,t))}`}var f={root:`Root`,sacral:`Sacral`,solar:`Solar Plexus`,solarp:`Solar Plexus`,solarplexus:`Solar Plexus`,heart:`Heart`,throat:`Throat`,thirdeye:`Third Eye`,crown:`Crown`,krown:`Crown`};function p(e){if(typeof e!=`string`)return;let t=e.trim();if(t)return f[t.toLowerCase().replace(/[\s_-]/g,``)]}function m(e){let t=``;for(let n of e)t+=n.toString(16).padStart(2,`0`);return t}async function h(e){if(typeof crypto>`u`||!crypto.subtle)throw Error(`crypto.subtle unavailable; cannot compute proofHash.`);let t=new TextEncoder().encode(e),n=await crypto.subtle.digest(`SHA-256`,t);return m(new Uint8Array(n))}function g(e){return JSON.stringify({v:e.v,pulse:e.pulse,chakraDay:e.chakraDay,kaiSignature:e.kaiSignature,phiKey:e.phiKey,verifierSlug:e.verifierSlug})}async function _(e){return await h(g(e))}var v=e(((e,t)=>{t.exports={L:1,M:0,Q:3,H:2}})),y=e(((e,t)=>{t.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}})),b=e(((e,t)=>{var n=y();function r(e){this.mode=n.MODE_8BIT_BYTE,this.data=e}r.prototype={getLength:function(e){return this.data.length},write:function(e){for(var t=0;t{var n=v();function r(e,t){this.totalCount=e,this.dataCount=t}r.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],r.getRSBlocks=function(e,t){var n=r.getRsBlockTable(e,t);if(n==null)throw Error(`bad rs block @ typeNumber:`+e+`/errorCorrectLevel:`+t);for(var i=n.length/3,a=[],o=0;o{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){var t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(var n=0;n>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),C=e(((e,t)=>{for(var n={glog:function(e){if(e<1)throw Error(`glog(`+e+`)`);return n.LOG_TABLE[e]},gexp:function(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return n.EXP_TABLE[e]},EXP_TABLE:Array(256),LOG_TABLE:Array(256)},r=0;r<8;r++)n.EXP_TABLE[r]=1<{var n=C();function r(e,t){if(e.length==null)throw Error(e.length+`/`+t);for(var n=0;n{var n=y(),r=w(),i=C(),a={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},o={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(e){for(var t=e<<10;o.getBCHDigit(t)-o.getBCHDigit(o.G15)>=0;)t^=o.G15<=0;)t^=o.G18<>>=1;return t},getPatternPosition:function(e){return o.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,n){switch(e){case a.PATTERN000:return(t+n)%2==0;case a.PATTERN001:return t%2==0;case a.PATTERN010:return n%3==0;case a.PATTERN011:return(t+n)%3==0;case a.PATTERN100:return(Math.floor(t/2)+Math.floor(n/3))%2==0;case a.PATTERN101:return t*n%2+t*n%3==0;case a.PATTERN110:return(t*n%2+t*n%3)%2==0;case a.PATTERN111:return(t*n%3+(t+n)%2)%2==0;default:throw Error(`bad maskPattern:`+e)}},getErrorCorrectPolynomial:function(e){for(var t=new r([1],0),n=0;n5&&(n+=3+a-5)}for(var r=0;r{var n=b(),r=x(),i=S(),a=T(),o=w();function s(e,t){this.typeNumber=e,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var c=s.prototype;c.addData=function(e){var t=new n(e);this.dataList.push(t),this.dataCache=null},c.isDark=function(e,t){if(e<0||this.moduleCount<=e||t<0||this.moduleCount<=t)throw Error(e+`,`+t);return this.modules[e][t]},c.getModuleCount=function(){return this.moduleCount},c.make=function(){if(this.typeNumber<1){var e=1;for(e=1;e<40;e++){for(var t=r.getRSBlocks(e,this.errorCorrectLevel),n=new i,o=0,s=0;s=7&&this.setupTypeNumber(e),this.dataCache??=s.createData(this.typeNumber,this.errorCorrectLevel,this.dataList),this.mapData(this.dataCache,t)},c.setupPositionProbePattern=function(e,t){for(var n=-1;n<=7;n++)if(!(e+n<=-1||this.moduleCount<=e+n))for(var r=-1;r<=7;r++)t+r<=-1||this.moduleCount<=t+r||(0<=n&&n<=6&&(r==0||r==6)||0<=r&&r<=6&&(n==0||n==6)||2<=n&&n<=4&&2<=r&&r<=4?this.modules[e+n][t+r]=!0:this.modules[e+n][t+r]=!1)},c.getBestMaskPattern=function(){for(var e=0,t=0,n=0;n<8;n++){this.makeImpl(!0,n);var r=a.getLostPoint(this);(n==0||e>r)&&(e=r,t=n)}return t},c.createMovieClip=function(e,t,n){var r=e.createEmptyMovieClip(t,n),i=1;this.make();for(var a=0;a>n&1)==1;this.modules[Math.floor(n/3)][n%3+this.moduleCount-8-3]=r}for(var n=0;n<18;n++){var r=!e&&(t>>n&1)==1;this.modules[n%3+this.moduleCount-8-3][Math.floor(n/3)]=r}},c.setupTypeInfo=function(e,t){for(var n=this.errorCorrectLevel<<3|t,r=a.getBCHTypeInfo(n),i=0;i<15;i++){var o=!e&&(r>>i&1)==1;i<6?this.modules[i][8]=o:i<8?this.modules[i+1][8]=o:this.modules[this.moduleCount-15+i][8]=o}for(var i=0;i<15;i++){var o=!e&&(r>>i&1)==1;i<8?this.modules[8][this.moduleCount-i-1]=o:i<9?this.modules[8][15-i-1+1]=o:this.modules[8][15-i-1]=o}this.modules[this.moduleCount-8][8]=!e},c.mapData=function(e,t){for(var n=-1,r=this.moduleCount-1,i=7,o=0,s=this.moduleCount-1;s>0;s-=2)for(s==6&&s--;;){for(var c=0;c<2;c++)if(this.modules[r][s-c]==null){var l=!1;o>>i&1)==1),a.getMask(t,r,s-c)&&(l=!l),this.modules[r][s-c]=l,i--,i==-1&&(o++,i=7)}if(r+=n,r<0||this.moduleCount<=r){r-=n,n=-n;break}}},s.PAD0=236,s.PAD1=17,s.createData=function(e,t,n){for(var o=r.getRSBlocks(e,t),c=new i,l=0;ld*8)throw Error(`code length overflow. (`+c.getLengthInBits()+`>`+d*8+`)`);for(c.getLengthInBits()+4<=d*8&&c.put(0,4);c.getLengthInBits()%8!=0;)c.putBit(!1);for(;!(c.getLengthInBits()>=d*8||(c.put(s.PAD0,8),c.getLengthInBits()>=d*8));)c.put(s.PAD1,8);return s.createBytes(c,o)},s.createBytes=function(e,t){for(var n=0,r=0,i=0,s=Array(t.length),c=Array(t.length),l=0;l=0?m.get(h):0}}for(var g=0,f=0;f{Object.defineProperty(e,`__esModule`,{value:!0});var n=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}var l={bgColor:r.default.oneOfType([r.default.object,r.default.string]).isRequired,bgD:r.default.string.isRequired,fgColor:r.default.oneOfType([r.default.object,r.default.string]).isRequired,fgD:r.default.string.isRequired,size:r.default.number.isRequired,title:r.default.string,viewBoxSize:r.default.number.isRequired,xmlns:r.default.string},u=(0,i.forwardRef)(function(e,t){var r=e.bgColor,i=e.bgD,a=e.fgD,s=e.fgColor,l=e.size,u=e.title,d=e.viewBoxSize,f=e.xmlns,p=f===void 0?`http://www.w3.org/2000/svg`:f,m=c(e,[`bgColor`,`bgD`,`fgD`,`fgColor`,`size`,`title`,`viewBoxSize`,`xmlns`]);return o.default.createElement(`svg`,n({},m,{height:l,ref:t,viewBox:`0 0 `+d+` `+d,width:l,xmlns:p}),u?o.default.createElement(`title`,null,u):null,o.default.createElement(`path`,{d:i,fill:r}),o.default.createElement(`path`,{d:a,fill:s}))});u.displayName=`QRCodeSvg`,u.propTypes=l,e.default=u})),O=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.QRCode=void 0;var n=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}var f={bgColor:r.default.oneOfType([r.default.object,r.default.string]),fgColor:r.default.oneOfType([r.default.object,r.default.string]),level:r.default.string,size:r.default.number,value:r.default.string.isRequired},p=(0,s.forwardRef)(function(e,t){var r=e.bgColor,a=r===void 0?`#FFFFFF`:r,s=e.fgColor,u=s===void 0?`#000000`:s,f=e.level,p=f===void 0?`L`:f,m=e.size,h=m===void 0?256:m,g=e.value,_=d(e,[`bgColor`,`fgColor`,`level`,`size`,`value`]),v=new o.default(-1,i.default[p]);v.addData(g),v.make();var y=v.modules;return c.default.createElement(l.default,n({},_,{bgColor:a,bgD:y.map(function(e,t){return e.map(function(e,n){return e?``:`M `+n+` `+t+` l 1 0 0 1 -1 0 Z`}).join(` `)}).join(` `),fgColor:u,fgD:y.map(function(e,t){return e.map(function(e,n){return e?`M `+n+` `+t+` l 1 0 0 1 -1 0 Z`:``}).join(` `)}).join(` `),ref:t,size:h,viewBoxSize:y.length}))});e.QRCode=p,p.displayName=`QRCode`,p.propTypes=f,e.default=p})),k=n(t(),1),A=n(O(),1),j=n(i(),1);function M(e){return typeof e==`object`&&!!e}function N(e){return typeof e==`function`}function P(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`bigint`){let t=BigInt(2**53-1),n=BigInt(-(2**53-1));return e>t||e0?n:null}function I(e){if(M(e)){let t=e.default;if(N(t))return t;let n=e.QRCode;if(N(n))return n}return N(e)?e:function({value:e}){return(0,j.jsx)(`div`,{className:`kv-verifier__qr-fallback`,"aria-label":`QR unavailable`,children:e})}}var L=I(A);function R(e,t=6,n=6){return e?e.length<=t+n+3?e:`${e.slice(0,t)}…${e.slice(-n)}`:``}function z(e,t=10,n=10){return e?e.length<=t+n+3?e:`${e.slice(0,t)}…${e.slice(-n)}`:``}function B(){let e=r;for(let t of[`kaiPulseNow`,`getKaiPulseNow`,`pulseNow`]){let n=e[t];if(N(n)){let e=F(P(n()));if(e)return e}}let t=e.kairosEpochNow,n=P(e.GENESIS_TS),i=P(e.PULSE_MS);if(N(t)&&n!==null&&i!==null&&Number.isFinite(i)&&i>0){let e=P(t());if(e!==null){let t=e-n;if(Number.isFinite(t)){let e=Math.floor(t/i)+1;return e>0?e:null}}}return null}function V(){let e=r,t=e.kairosEpochNow,n=P(e.GENESIS_TS),i=P(e.PULSE_MS);if(!N(t)||n===null||i===null||!(i>0))return null;let a=P(t());if(a===null)return null;let o=a-n;if(!Number.isFinite(o))return null;let s=n+(Math.max(0,Math.floor(o/i))+1)*i-a,c=Math.ceil(Math.max(25,Math.min(6e4,s)));return Number.isFinite(c)?c:null}function H(e){let[t,n]=(0,k.useState)(()=>B()??0);return(0,k.useEffect)(()=>{if(!e)return;let t=!1,r=null,i=()=>{if(t)return;let e=B();e&&e>0&&n(e);let a=V()??1e3;r=window.setTimeout(i,a)};return i(),()=>{t=!0,r!==null&&window.clearTimeout(r)}},[e]),t}function U({pulse:e,kaiSignature:t,phiKey:n,caption:r,chakraDay:i,compact:a=!1,verifierBaseUrl:o}){let[s,f]=(0,k.useState)(`idle`),[m,h]=(0,k.useState)(`idle`),[g,v]=(0,k.useState)(null),y=F(e),b=H(y===null),x=y??b,S=(0,k.useMemo)(()=>{let e=o??c(),r=String(e).replace(/\/+$/,``)||`/verify`,a=typeof t==`string`?t.trim():``,s=l(a),f=Number.isFinite(x)&&x>0?Math.floor(x):0,m=u(f,a),h=d(f,a,r),g=p(typeof i==`string`?i:String(i??``)),_=typeof n==`string`?n.trim():``;return{verifierUrl:h,verifierBaseUrl:r,verifierSlug:m,pulse:f,chakraDay:g,kaiSignature:a,kaiSignatureShort:s,phiKey:_,proofCapsule:f>0&&a.length>0&&_.length>0&&g?{v:`KPV-1`,pulse:f,chakraDay:g,kaiSignature:a,phiKey:_,verifierSlug:m}:null,proofHash:void 0}},[i,t,n,x,o]);(0,k.useEffect)(()=>{let e=!1;return(async()=>{if(!S.proofCapsule){v(null);return}try{let t=await _(S.proofCapsule);e||v(t)}catch{e||v(null)}})(),()=>{e=!0}},[S.proofCapsule]);let C=a?96:160,w=async()=>{if(typeof navigator>`u`||!navigator.clipboard){f(`error`);return}try{await navigator.clipboard.writeText(S.verifierUrl),f(`ok`),window.setTimeout(()=>f(`idle`),2e3)}catch{f(`error`)}},T=async()=>{if(typeof navigator>`u`||!navigator.clipboard){h(`error`);return}try{let e=g??void 0;!e&&S.proofCapsule&&(e=await _(S.proofCapsule),v(e));let t={...S,proofHash:e};await navigator.clipboard.writeText(JSON.stringify(t,null,2)),h(`ok`),window.setTimeout(()=>h(`idle`),2e3)}catch{h(`error`)}},E=a?`kv-verifier kv-verifier--compact`:`kv-verifier`,D=Number.isFinite(S.pulse)&&S.pulse>0?String(S.pulse):`—`,O=typeof r==`string`?r.trim():``,A=R(S.phiKey),M=g?z(g):`—`;return(0,j.jsxs)(`section`,{className:E,"aria-label":`Kai-Sigil verification frame`,"data-role":`verifier-frame`,children:[(0,j.jsx)(`div`,{className:`kv-verifier__qr-shell`,role:`img`,"aria-label":`QR code linking to Kai-Sigil verifier for pulse ${D} and signature ${S.kaiSignatureShort}`,children:(0,j.jsx)(`div`,{className:`kv-verifier__qr-inner`,children:(0,j.jsx)(L,{value:S.verifierUrl,size:C,bgColor:`#00000000`,fgColor:`#ffffff`})})}),(0,j.jsxs)(`div`,{className:`kv-verifier__content`,children:[(0,j.jsxs)(`header`,{className:`kv-verifier__header`,children:[(0,j.jsx)(`h3`,{className:`kv-verifier__title`,children:`Kai-Sigil Verifier`}),(0,j.jsx)(`p`,{className:`kv-verifier__subtitle`,children:`Scan or open the verifier link to confirm this post was sealed by this Φ-Key (KPV-1 payload-bound proof).`})]}),(0,j.jsxs)(`dl`,{className:`kv-verifier__meta`,children:[(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`🌀 Pulse`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value`,children:D})]}),(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`Kai Signature`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value kv-verifier__mono`,children:S.kaiSignatureShort})]}),(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`Φ-Key`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value kv-verifier__mono`,title:S.phiKey,children:A||`—`})]}),S.chakraDay?(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`🧬 Chakra Day`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value`,children:S.chakraDay})]}):null,(0,j.jsxs)(`div`,{className:`kv-verifier__meta-row`,children:[(0,j.jsx)(`dt`,{className:`kv-verifier__meta-label`,children:`🔒 Proof Hash`}),(0,j.jsx)(`dd`,{className:`kv-verifier__meta-value kv-verifier__mono`,title:g??``,children:M})]})]}),O.length>0?(0,j.jsxs)(`p`,{className:`kv-verifier__caption`,"aria-label":`Post caption`,children:[`“`,O,`”`]}):null,(0,j.jsxs)(`div`,{className:`kv-verifier__actions`,children:[(0,j.jsx)(`a`,{href:S.verifierUrl,target:`_blank`,rel:`noopener noreferrer`,className:`kv-verifier__btn kv-verifier__btn--primary`,"data-role":`verifier-open-link`,children:`Open Verifier`}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>void w(),className:`kv-verifier__btn kv-verifier__btn--ghost`,"data-role":`verifier-copy-link`,children:s===`ok`?`Remembered!`:s===`error`?`Remember failed`:`Remember Link`}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>void T(),className:`kv-verifier__btn kv-verifier__btn--ghost`,"data-role":`verifier-copy-proof`,children:m===`ok`?`Proof Remembered!`:m===`error`?`Remember failed`:`Remember Proof`})]}),(0,j.jsxs)(`p`,{className:`kv-verifier__url`,"aria-label":`Verifier URL`,children:[(0,j.jsx)(`span`,{className:`kv-verifier__url-label`,children:`Verifier URL:`}),(0,j.jsx)(`span`,{className:`kv-verifier__url-value`,children:S.verifierUrl})]})]})]})}export{p as a,_ as i,u as n,d as r,U as t}; \ No newline at end of file diff --git a/dist/assets/VerifyPage-LdgLj3ti.js b/dist/assets/VerifyPage-CexUA7n1.js similarity index 97% rename from dist/assets/VerifyPage-LdgLj3ti.js rename to dist/assets/VerifyPage-CexUA7n1.js index 48ad4c49..6a3f2e2c 100644 --- a/dist/assets/VerifyPage-LdgLj3ti.js +++ b/dist/assets/VerifyPage-CexUA7n1.js @@ -1 +1 @@ -import{Ht as e,Tn as t,jn as n,tn as r}from"./index-CgC-NZbJ.js";import"./prop-types-CRrLra82.js";import{t as i}from"./VerifierFrame-BP2mhmRz.js";var a=n(t(),1),o=n(r(),1);function s(e){return typeof e==`object`&&!!e}function c(e){let t=decodeURIComponent(e||``).trim(),n=t.match(/^(\d+)-([A-Za-z0-9]+)$/);if(!n)return{raw:t,pulse:null,shortSig:null};let r=Number(n[1]);return{raw:t,pulse:Number.isFinite(r)&&r>0?r:null,shortSig:n[2]?String(n[2]):null}}function l(){if(typeof window>`u`)return``;let e=window.location.pathname||``,t=window.location.hash||``,n=e.match(/\/verify\/([^/?#]+)/);if(n&&n[1])return n[1];let r=t.match(/\/verify\/([^/?#]+)/);return r&&r[1]?r[1]:``}function u(e){let t=e.match(/]*>([\s\S]*?)<\/metadata>/i);return t?(t[1]??``).trim():null}function d(e){let t=e.trim();if(!t)return null;try{return JSON.parse(t)}catch{return null}}function f(e){if(!s(e))return{raw:e};let t=typeof e.kaiSignature==`string`?e.kaiSignature:void 0,n=typeof e.pulse==`number`&&Number.isFinite(e.pulse)?e.pulse:void 0,r=typeof e.chakraDay==`string`?e.chakraDay:void 0,i=typeof e.timestamp==`string`?e.timestamp:void 0,a=typeof e.phiKey==`string`?e.phiKey:void 0,o=typeof e.userPhiKey==`string`?e.userPhiKey:void 0;return{pulse:n,chakraDay:r,kaiSignature:t,phiKey:a&&!a.startsWith(`φK-`)?a:o,timestamp:i,verifierUrl:typeof e.verifierUrl==`string`?e.verifierUrl:void 0,raw:e}}function p(e){let t=u(e);if(t){let e=d(t);if(e)return f(e)}let n=e.indexOf(`"kaiSignature"`);if(n>=0){let t=e.slice(Math.max(0,n-800),Math.min(e.length,n+2e3)).match(/\{[\s\S]*\}/);if(t&&t[0]){let e=d(t[0]);if(e)return f(e)}}return{}}function m(e,t){return e.length<=t?e:e.slice(0,t)}async function h(e){return await new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(Error(`Failed to read file.`)),r.onload=()=>t(String(r.result??``)),r.readAsText(e)})}function g(){let t=(0,a.useMemo)(()=>l(),[]),n=(0,a.useMemo)(()=>c(t),[t]),[r,s]=(0,a.useState)(``),[u,d]=(0,a.useState)({status:`idle`}),[f,g]=(0,a.useState)(!1),_=(0,a.useMemo)(()=>({pulse:n.pulse??0,kaiSignature:n.shortSig??`unknown-signature`,phiKey:`—`}),[n.pulse,n.shortSig]),v=(0,a.useCallback)(async()=>{let t=r.trim();if(!t){d({status:`error`,message:`Paste the sealed SVG text or upload the sealed SVG file first.`,slug:n});return}g(!0);try{let r=p(t),i=(r.kaiSignature??``).trim();if(!i){d({status:`error`,message:`No kaiSignature found in the SVG metadata.`,slug:n,embedded:r});return}let a=await e(i),o=(r.phiKey??``).trim(),s=r.pulse,c={hasSignature:!0,slugPulseMatches:n.pulse==null||s==null?null:n.pulse===s,slugShortSigMatches:n.shortSig==null?null:n.shortSig===m(i,n.shortSig.length),derivedPhiKeyMatchesEmbedded:o.length===0?null:a===o};if(c.slugPulseMatches===!1||c.slugShortSigMatches===!1||c.derivedPhiKeyMatchesEmbedded===!1){d({status:`error`,message:`Verification failed: one or more checks did not match.`,slug:n,embedded:r,derivedPhiKey:a,checks:c});return}d({status:`ok`,slug:n,embedded:{...r,phiKey:o.length>0?o:a},derivedPhiKey:a,checks:c})}catch(e){d({status:`error`,message:e instanceof Error?e.message:`Verification failed.`,slug:n})}finally{g(!1)}},[n,r]),y=(0,a.useCallback)(async e=>{if(!e.name.toLowerCase().endsWith(`.svg`)){d({status:`error`,message:`Upload a sealed .svg (this verifier reads embedded JSON).`,slug:n});return}s(await h(e)),d({status:`idle`})},[n]);return(0,o.jsxs)(`div`,{className:`verify-page`,children:[(0,o.jsxs)(`header`,{className:`verify-hero`,children:[(0,o.jsx)(`h1`,{className:`verify-title`,children:`Kai-Sigil Verifier`}),(0,o.jsx)(`p`,{className:`verify-subtitle`,children:`Open a sealed memory and verify its human origin by Kai Signature → Φ-Key.`}),(0,o.jsxs)(`div`,{className:`verify-slug`,children:[(0,o.jsx)(`span`,{className:`verify-slug-label`,children:`Link:`}),(0,o.jsxs)(`code`,{className:`verify-slug-value`,children:[`/verify/`,n.raw||`—`]})]})]}),(0,o.jsxs)(`main`,{className:`verify-main`,children:[(0,o.jsxs)(`section`,{className:`verify-card`,children:[(0,o.jsx)(`h2`,{className:`verify-card-title`,children:`1) Provide the sealed post`}),(0,o.jsxs)(`div`,{className:`verify-upload-row`,children:[(0,o.jsxs)(`label`,{className:`verify-upload`,children:[(0,o.jsx)(`input`,{type:`file`,accept:`.svg,image/svg+xml`,onChange:e=>{let t=e.currentTarget.files?.[0];t&&y(t),e.currentTarget.value=``}}),`Upload sealed SVG`]}),(0,o.jsx)(`button`,{type:`button`,className:`verify-btn`,onClick:()=>void v(),disabled:f,children:f?`Verifying…`:`Verify`})]}),(0,o.jsx)(`textarea`,{className:`verify-textarea`,value:r,onChange:e=>s(e.currentTarget.value),placeholder:`Or paste the sealed SVG text here (must include {...} with kaiSignature + pulse + userPhiKey/phiKey).`,spellCheck:!1})]}),(0,o.jsxs)(`section`,{className:`verify-card`,children:[(0,o.jsx)(`h2`,{className:`verify-card-title`,children:`2) Proof capsule`}),u.status===`ok`?(0,o.jsx)(i,{pulse:u.embedded.pulse??n.pulse??0,kaiSignature:u.embedded.kaiSignature??n.shortSig??`unknown`,phiKey:u.derivedPhiKey,chakraDay:u.embedded.chakraDay,compact:!1}):(0,o.jsx)(i,{pulse:_.pulse,kaiSignature:_.kaiSignature,phiKey:_.phiKey,compact:!1}),(0,o.jsx)(`div`,{className:`verify-status`,children:u.status===`idle`?(0,o.jsx)(`p`,{className:`verify-muted`,children:`Upload/paste a sealed SVG, then click Verify.`}):u.status===`ok`?(0,o.jsxs)(`div`,{className:`verify-ok`,children:[(0,o.jsx)(`div`,{className:`verify-badge verify-badge--ok`,children:`Verified`}),(0,o.jsxs)(`p`,{className:`verify-line`,children:[`Sealed by Φ-Key: `,(0,o.jsx)(`code`,{children:u.derivedPhiKey})]}),(0,o.jsxs)(`ul`,{className:`verify-checks`,children:[(0,o.jsxs)(`li`,{children:[`slug pulse match:`,` `,(0,o.jsx)(`strong`,{children:u.checks.slugPulseMatches===null?`n/a`:String(u.checks.slugPulseMatches)})]}),(0,o.jsxs)(`li`,{children:[`slug shortSig match:`,` `,(0,o.jsx)(`strong`,{children:u.checks.slugShortSigMatches===null?`n/a`:String(u.checks.slugShortSigMatches)})]}),(0,o.jsxs)(`li`,{children:[`derived Φ-Key matches embedded:`,` `,(0,o.jsx)(`strong`,{children:u.checks.derivedPhiKeyMatchesEmbedded===null?`n/a (embed omitted phiKey)`:String(u.checks.derivedPhiKeyMatchesEmbedded)})]})]})]}):(0,o.jsxs)(`div`,{className:`verify-fail`,children:[(0,o.jsx)(`div`,{className:`verify-badge verify-badge--fail`,children:`Not verified`}),(0,o.jsx)(`p`,{className:`verify-line`,children:u.message}),u.checks?(0,o.jsxs)(`ul`,{className:`verify-checks`,children:[(0,o.jsxs)(`li`,{children:[`slug pulse match:`,` `,(0,o.jsx)(`strong`,{children:u.checks.slugPulseMatches===null?`n/a`:String(u.checks.slugPulseMatches)})]}),(0,o.jsxs)(`li`,{children:[`slug shortSig match:`,` `,(0,o.jsx)(`strong`,{children:u.checks.slugShortSigMatches===null?`n/a`:String(u.checks.slugShortSigMatches)})]}),(0,o.jsxs)(`li`,{children:[`derived Φ-Key matches embedded:`,` `,(0,o.jsx)(`strong`,{children:u.checks.derivedPhiKeyMatchesEmbedded===null?`n/a (embed omitted phiKey)`:String(u.checks.derivedPhiKeyMatchesEmbedded)})]})]}):null]})})]})]})]})}export{g as default}; \ No newline at end of file +import{Ht as e,Tn as t,jn as n,tn as r}from"./index-BlYU7j-M.js";import"./prop-types-BWhc8UTz.js";import{t as i}from"./VerifierFrame-a5dTHTgU.js";var a=n(t(),1),o=n(r(),1);function s(e){return typeof e==`object`&&!!e}function c(e){let t=decodeURIComponent(e||``).trim(),n=t.match(/^(\d+)-([A-Za-z0-9]+)$/);if(!n)return{raw:t,pulse:null,shortSig:null};let r=Number(n[1]);return{raw:t,pulse:Number.isFinite(r)&&r>0?r:null,shortSig:n[2]?String(n[2]):null}}function l(){if(typeof window>`u`)return``;let e=window.location.pathname||``,t=window.location.hash||``,n=e.match(/\/verify\/([^/?#]+)/);if(n&&n[1])return n[1];let r=t.match(/\/verify\/([^/?#]+)/);return r&&r[1]?r[1]:``}function u(e){let t=e.match(/]*>([\s\S]*?)<\/metadata>/i);return t?(t[1]??``).trim():null}function d(e){let t=e.trim();if(!t)return null;try{return JSON.parse(t)}catch{return null}}function f(e){if(!s(e))return{raw:e};let t=typeof e.kaiSignature==`string`?e.kaiSignature:void 0,n=typeof e.pulse==`number`&&Number.isFinite(e.pulse)?e.pulse:void 0,r=typeof e.chakraDay==`string`?e.chakraDay:void 0,i=typeof e.timestamp==`string`?e.timestamp:void 0,a=typeof e.phiKey==`string`?e.phiKey:void 0,o=typeof e.userPhiKey==`string`?e.userPhiKey:void 0;return{pulse:n,chakraDay:r,kaiSignature:t,phiKey:a&&!a.startsWith(`φK-`)?a:o,timestamp:i,verifierUrl:typeof e.verifierUrl==`string`?e.verifierUrl:void 0,raw:e}}function p(e){let t=u(e);if(t){let e=d(t);if(e)return f(e)}let n=e.indexOf(`"kaiSignature"`);if(n>=0){let t=e.slice(Math.max(0,n-800),Math.min(e.length,n+2e3)).match(/\{[\s\S]*\}/);if(t&&t[0]){let e=d(t[0]);if(e)return f(e)}}return{}}function m(e,t){return e.length<=t?e:e.slice(0,t)}async function h(e){return await new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(Error(`Failed to read file.`)),r.onload=()=>t(String(r.result??``)),r.readAsText(e)})}function g(){let t=(0,a.useMemo)(()=>l(),[]),n=(0,a.useMemo)(()=>c(t),[t]),[r,s]=(0,a.useState)(``),[u,d]=(0,a.useState)({status:`idle`}),[f,g]=(0,a.useState)(!1),_=(0,a.useMemo)(()=>({pulse:n.pulse??0,kaiSignature:n.shortSig??`unknown-signature`,phiKey:`—`}),[n.pulse,n.shortSig]),v=(0,a.useCallback)(async()=>{let t=r.trim();if(!t){d({status:`error`,message:`Paste the sealed SVG text or upload the sealed SVG file first.`,slug:n});return}g(!0);try{let r=p(t),i=(r.kaiSignature??``).trim();if(!i){d({status:`error`,message:`No kaiSignature found in the SVG metadata.`,slug:n,embedded:r});return}let a=await e(i),o=(r.phiKey??``).trim(),s=r.pulse,c={hasSignature:!0,slugPulseMatches:n.pulse==null||s==null?null:n.pulse===s,slugShortSigMatches:n.shortSig==null?null:n.shortSig===m(i,n.shortSig.length),derivedPhiKeyMatchesEmbedded:o.length===0?null:a===o};if(c.slugPulseMatches===!1||c.slugShortSigMatches===!1||c.derivedPhiKeyMatchesEmbedded===!1){d({status:`error`,message:`Verification failed: one or more checks did not match.`,slug:n,embedded:r,derivedPhiKey:a,checks:c});return}d({status:`ok`,slug:n,embedded:{...r,phiKey:o.length>0?o:a},derivedPhiKey:a,checks:c})}catch(e){d({status:`error`,message:e instanceof Error?e.message:`Verification failed.`,slug:n})}finally{g(!1)}},[n,r]),y=(0,a.useCallback)(async e=>{if(!e.name.toLowerCase().endsWith(`.svg`)){d({status:`error`,message:`Upload a sealed .svg (this verifier reads embedded JSON).`,slug:n});return}s(await h(e)),d({status:`idle`})},[n]);return(0,o.jsxs)(`div`,{className:`verify-page`,children:[(0,o.jsxs)(`header`,{className:`verify-hero`,children:[(0,o.jsx)(`h1`,{className:`verify-title`,children:`Kai-Sigil Verifier`}),(0,o.jsx)(`p`,{className:`verify-subtitle`,children:`Open a sealed memory and verify its human origin by Kai Signature → Φ-Key.`}),(0,o.jsxs)(`div`,{className:`verify-slug`,children:[(0,o.jsx)(`span`,{className:`verify-slug-label`,children:`Link:`}),(0,o.jsxs)(`code`,{className:`verify-slug-value`,children:[`/verify/`,n.raw||`—`]})]})]}),(0,o.jsxs)(`main`,{className:`verify-main`,children:[(0,o.jsxs)(`section`,{className:`verify-card`,children:[(0,o.jsx)(`h2`,{className:`verify-card-title`,children:`1) Provide the sealed post`}),(0,o.jsxs)(`div`,{className:`verify-upload-row`,children:[(0,o.jsxs)(`label`,{className:`verify-upload`,children:[(0,o.jsx)(`input`,{type:`file`,accept:`.svg,image/svg+xml`,onChange:e=>{let t=e.currentTarget.files?.[0];t&&y(t),e.currentTarget.value=``}}),`Upload sealed SVG`]}),(0,o.jsx)(`button`,{type:`button`,className:`verify-btn`,onClick:()=>void v(),disabled:f,children:f?`Verifying…`:`Verify`})]}),(0,o.jsx)(`textarea`,{className:`verify-textarea`,value:r,onChange:e=>s(e.currentTarget.value),placeholder:`Or paste the sealed SVG text here (must include {...} with kaiSignature + pulse + userPhiKey/phiKey).`,spellCheck:!1})]}),(0,o.jsxs)(`section`,{className:`verify-card`,children:[(0,o.jsx)(`h2`,{className:`verify-card-title`,children:`2) Proof capsule`}),u.status===`ok`?(0,o.jsx)(i,{pulse:u.embedded.pulse??n.pulse??0,kaiSignature:u.embedded.kaiSignature??n.shortSig??`unknown`,phiKey:u.derivedPhiKey,chakraDay:u.embedded.chakraDay,compact:!1}):(0,o.jsx)(i,{pulse:_.pulse,kaiSignature:_.kaiSignature,phiKey:_.phiKey,compact:!1}),(0,o.jsx)(`div`,{className:`verify-status`,children:u.status===`idle`?(0,o.jsx)(`p`,{className:`verify-muted`,children:`Upload/paste a sealed SVG, then click Verify.`}):u.status===`ok`?(0,o.jsxs)(`div`,{className:`verify-ok`,children:[(0,o.jsx)(`div`,{className:`verify-badge verify-badge--ok`,children:`Verified`}),(0,o.jsxs)(`p`,{className:`verify-line`,children:[`Sealed by Φ-Key: `,(0,o.jsx)(`code`,{children:u.derivedPhiKey})]}),(0,o.jsxs)(`ul`,{className:`verify-checks`,children:[(0,o.jsxs)(`li`,{children:[`slug pulse match:`,` `,(0,o.jsx)(`strong`,{children:u.checks.slugPulseMatches===null?`n/a`:String(u.checks.slugPulseMatches)})]}),(0,o.jsxs)(`li`,{children:[`slug shortSig match:`,` `,(0,o.jsx)(`strong`,{children:u.checks.slugShortSigMatches===null?`n/a`:String(u.checks.slugShortSigMatches)})]}),(0,o.jsxs)(`li`,{children:[`derived Φ-Key matches embedded:`,` `,(0,o.jsx)(`strong`,{children:u.checks.derivedPhiKeyMatchesEmbedded===null?`n/a (embed omitted phiKey)`:String(u.checks.derivedPhiKeyMatchesEmbedded)})]})]})]}):(0,o.jsxs)(`div`,{className:`verify-fail`,children:[(0,o.jsx)(`div`,{className:`verify-badge verify-badge--fail`,children:`Not verified`}),(0,o.jsx)(`p`,{className:`verify-line`,children:u.message}),u.checks?(0,o.jsxs)(`ul`,{className:`verify-checks`,children:[(0,o.jsxs)(`li`,{children:[`slug pulse match:`,` `,(0,o.jsx)(`strong`,{children:u.checks.slugPulseMatches===null?`n/a`:String(u.checks.slugPulseMatches)})]}),(0,o.jsxs)(`li`,{children:[`slug shortSig match:`,` `,(0,o.jsx)(`strong`,{children:u.checks.slugShortSigMatches===null?`n/a`:String(u.checks.slugShortSigMatches)})]}),(0,o.jsxs)(`li`,{children:[`derived Φ-Key matches embedded:`,` `,(0,o.jsx)(`strong`,{children:u.checks.derivedPhiKeyMatchesEmbedded===null?`n/a (embed omitted phiKey)`:String(u.checks.derivedPhiKeyMatchesEmbedded)})]})]}):null]})})]})]})]})}export{g as default}; \ No newline at end of file diff --git a/dist/assets/__vite-browser-external-CIGk_S08.js b/dist/assets/__vite-browser-external-CIGk_S08.js deleted file mode 100644 index 9715332f..00000000 --- a/dist/assets/__vite-browser-external-CIGk_S08.js +++ /dev/null @@ -1 +0,0 @@ -import{En as e}from"./index-CgC-NZbJ.js";var t=e(((e,t)=>{t.exports={}}));export default t(); \ No newline at end of file diff --git a/dist/assets/__vite-browser-external-PL03eeJm.js b/dist/assets/__vite-browser-external-PL03eeJm.js new file mode 100644 index 00000000..8e551963 --- /dev/null +++ b/dist/assets/__vite-browser-external-PL03eeJm.js @@ -0,0 +1 @@ +import{En as e}from"./index-BlYU7j-M.js";var t=e(((e,t)=>{t.exports={}}));export default t(); \ No newline at end of file diff --git a/dist/assets/bundler-BoMe-K_2.js b/dist/assets/bundler-BiZDI_w8.js similarity index 99% rename from dist/assets/bundler-BoMe-K_2.js rename to dist/assets/bundler-BiZDI_w8.js index 3d4f368c..f61d8b42 100644 --- a/dist/assets/bundler-BoMe-K_2.js +++ b/dist/assets/bundler-BiZDI_w8.js @@ -1,4 +1,4 @@ -import{En as e,On as t,jn as n}from"./index-CgC-NZbJ.js";var r=class{constructor(){this.encoder=new TextEncoder,this._pieces=[],this._parts=[]}append_buffer(e){this.flush(),this._parts.push(e)}append(e){this._pieces.push(e)}flush(){if(this._pieces.length>0){let e=new Uint8Array(this._pieces);this._parts.push(e),this._pieces=[]}}toArrayBuffer(){let e=[];for(let t of this._parts)e.push(t);return i(e).buffer}};function i(e){let t=0;for(let n of e)t+=n.byteLength;let n=new Uint8Array(t),r=0;for(let t of e){let e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);n.set(e,r),r+=t.byteLength}return n}function a(e){return new s(e).unpack()}function o(e){let t=new c,n=t.pack(e);return n instanceof Promise?n.then(()=>t.getBuffer()):t.getBuffer()}var s=class{constructor(e){this.index=0,this.dataBuffer=e,this.dataView=new Uint8Array(this.dataBuffer),this.length=this.dataBuffer.byteLength}unpack(){let e=this.unpack_uint8();if(e<128)return e;if((e^224)<32)return(e^224)-32;let t;if((t=e^160)<=15)return this.unpack_raw(t);if((t=e^176)<=15)return this.unpack_string(t);if((t=e^144)<=15)return this.unpack_array(t);if((t=e^128)<=15)return this.unpack_map(t);switch(e){case 192:return null;case 193:return;case 194:return!1;case 195:return!0;case 202:return this.unpack_float();case 203:return this.unpack_double();case 204:return this.unpack_uint8();case 205:return this.unpack_uint16();case 206:return this.unpack_uint32();case 207:return this.unpack_uint64();case 208:return this.unpack_int8();case 209:return this.unpack_int16();case 210:return this.unpack_int32();case 211:return this.unpack_int64();case 212:return;case 213:return;case 214:return;case 215:return;case 216:return t=this.unpack_uint16(),this.unpack_string(t);case 217:return t=this.unpack_uint32(),this.unpack_string(t);case 218:return t=this.unpack_uint16(),this.unpack_raw(t);case 219:return t=this.unpack_uint32(),this.unpack_raw(t);case 220:return t=this.unpack_uint16(),this.unpack_array(t);case 221:return t=this.unpack_uint32(),this.unpack_array(t);case 222:return t=this.unpack_uint16(),this.unpack_map(t);case 223:return t=this.unpack_uint32(),this.unpack_map(t)}}unpack_uint8(){let e=this.dataView[this.index]&255;return this.index++,e}unpack_uint16(){let e=this.read(2),t=(e[0]&255)*256+(e[1]&255);return this.index+=2,t}unpack_uint32(){let e=this.read(4),t=((e[0]*256+e[1])*256+e[2])*256+e[3];return this.index+=4,t}unpack_uint64(){let e=this.read(8),t=((((((e[0]*256+e[1])*256+e[2])*256+e[3])*256+e[4])*256+e[5])*256+e[6])*256+e[7];return this.index+=8,t}unpack_int8(){let e=this.unpack_uint8();return e<128?e:e-256}unpack_int16(){let e=this.unpack_uint16();return e<32768?e:e-65536}unpack_int32(){let e=this.unpack_uint32();return e<2**31?e:e-2**32}unpack_int64(){let e=this.unpack_uint64();return e<2**63?e:e-2**64}unpack_raw(e){if(this.length>31,n=(e>>23&255)-127,r=e&8388607|8388608;return(t===0?1:-1)*r*2**(n-23)}unpack_double(){let e=this.unpack_uint32(),t=this.unpack_uint32(),n=e>>31,r=(e>>20&2047)-1023,i=(e&1048575|1048576)*2**(r-20)+t*2**(r-52);return(n===0?1:-1)*i}read(e){let t=this.index;if(t+e<=this.length)return this.dataView.subarray(t,t+e);throw Error(`BinaryPackFailure: read index out of range`)}},c=class{getBuffer(){return this._bufferBuilder.toArrayBuffer()}pack(e){if(typeof e==`string`)this.pack_string(e);else if(typeof e==`number`)Math.floor(e)===e?this.pack_integer(e):this.pack_double(e);else if(typeof e==`boolean`)e===!0?this._bufferBuilder.append(195):e===!1&&this._bufferBuilder.append(194);else if(e===void 0)this._bufferBuilder.append(192);else if(typeof e==`object`)if(e===null)this._bufferBuilder.append(192);else{let t=e.constructor;if(e instanceof Array){let t=this.pack_array(e);if(t instanceof Promise)return t.then(()=>this._bufferBuilder.flush())}else if(e instanceof ArrayBuffer)this.pack_bin(new Uint8Array(e));else if(`BYTES_PER_ELEMENT`in e){let t=e;this.pack_bin(new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}else if(e instanceof Date)this.pack_string(e.toString());else if(e instanceof Blob)return e.arrayBuffer().then(e=>{this.pack_bin(new Uint8Array(e)),this._bufferBuilder.flush()});else if(t==Object||t.toString().startsWith(`class`)){let t=this.pack_object(e);if(t instanceof Promise)return t.then(()=>this._bufferBuilder.flush())}else throw Error(`Type "${t.toString()}" not yet supported`)}else throw Error(`Type "${typeof e}" not yet supported`);this._bufferBuilder.flush()}pack_bin(e){let t=e.length;if(t<=15)this.pack_uint8(160+t);else if(t<=65535)this._bufferBuilder.append(218),this.pack_uint16(t);else if(t<=4294967295)this._bufferBuilder.append(219),this.pack_uint32(t);else throw Error(`Invalid length`);this._bufferBuilder.append_buffer(e)}pack_string(e){let t=this._textEncoder.encode(e),n=t.length;if(n<=15)this.pack_uint8(176+n);else if(n<=65535)this._bufferBuilder.append(216),this.pack_uint16(n);else if(n<=4294967295)this._bufferBuilder.append(217),this.pack_uint32(n);else throw Error(`Invalid length`);this._bufferBuilder.append_buffer(t)}pack_array(e){let t=e.length;if(t<=15)this.pack_uint8(144+t);else if(t<=65535)this._bufferBuilder.append(220),this.pack_uint16(t);else if(t<=4294967295)this._bufferBuilder.append(221),this.pack_uint32(t);else throw Error(`Invalid length`);let n=r=>{if(rn(r+1)):n(r+1)}};return n(0)}pack_integer(e){if(e>=-32&&e<=127)this._bufferBuilder.append(e&255);else if(e>=0&&e<=255)this._bufferBuilder.append(204),this.pack_uint8(e);else if(e>=-128&&e<=127)this._bufferBuilder.append(208),this.pack_int8(e);else if(e>=0&&e<=65535)this._bufferBuilder.append(205),this.pack_uint16(e);else if(e>=-32768&&e<=32767)this._bufferBuilder.append(209),this.pack_int16(e);else if(e>=0&&e<=4294967295)this._bufferBuilder.append(206),this.pack_uint32(e);else if(e>=-2147483648&&e<=2147483647)this._bufferBuilder.append(210),this.pack_int32(e);else if(e>=-0x8000000000000000&&e<=0x8000000000000000)this._bufferBuilder.append(211),this.pack_int64(e);else if(e>=0&&e<=0x10000000000000000)this._bufferBuilder.append(207),this.pack_uint64(e);else throw Error(`Invalid integer`)}pack_double(e){let t=0;e<0&&(t=1,e=-e);let n=Math.floor(Math.log(e)/Math.LN2),r=e/2**n-1,i=Math.floor(r*2**52),a=2**32,o=t<<31|n+1023<<20|i/a&1048575,s=i%a;this._bufferBuilder.append(203),this.pack_int32(o),this.pack_int32(s)}pack_object(e){let t=Object.keys(e),n=t.length;if(n<=15)this.pack_uint8(128+n);else if(n<=65535)this._bufferBuilder.append(222),this.pack_uint16(n);else if(n<=4294967295)this._bufferBuilder.append(223),this.pack_uint32(n);else throw Error(`Invalid length`);let r=n=>{if(nr(n+1))}return r(n+1)}};return r(0)}pack_uint8(e){this._bufferBuilder.append(e)}pack_uint16(e){this._bufferBuilder.append(e>>8),this._bufferBuilder.append(e&255)}pack_uint32(e){let t=e&4294967295;this._bufferBuilder.append((t&4278190080)>>>24),this._bufferBuilder.append((t&16711680)>>>16),this._bufferBuilder.append((t&65280)>>>8),this._bufferBuilder.append(t&255)}pack_uint64(e){let t=e/2**32,n=e%2**32;this._bufferBuilder.append((t&4278190080)>>>24),this._bufferBuilder.append((t&16711680)>>>16),this._bufferBuilder.append((t&65280)>>>8),this._bufferBuilder.append(t&255),this._bufferBuilder.append((n&4278190080)>>>24),this._bufferBuilder.append((n&16711680)>>>16),this._bufferBuilder.append((n&65280)>>>8),this._bufferBuilder.append(n&255)}pack_int8(e){this._bufferBuilder.append(e&255)}pack_int16(e){this._bufferBuilder.append((e&65280)>>8),this._bufferBuilder.append(e&255)}pack_int32(e){this._bufferBuilder.append(e>>>24&255),this._bufferBuilder.append((e&16711680)>>>16),this._bufferBuilder.append((e&65280)>>>8),this._bufferBuilder.append(e&255)}pack_int64(e){let t=Math.floor(e/2**32),n=e%2**32;this._bufferBuilder.append((t&4278190080)>>>24),this._bufferBuilder.append((t&16711680)>>>16),this._bufferBuilder.append((t&65280)>>>8),this._bufferBuilder.append(t&255),this._bufferBuilder.append((n&4278190080)>>>24),this._bufferBuilder.append((n&16711680)>>>16),this._bufferBuilder.append((n&65280)>>>8),this._bufferBuilder.append(n&255)}constructor(){this._bufferBuilder=new r,this._textEncoder=new TextEncoder}},l=!0,u=!0;function d(e,t,n){let r=e.match(t);return r&&r.length>=n&&parseFloat(r[n],10)}function f(e,t,n){if(!e.RTCPeerConnection)return;let r=e.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return i.apply(this,arguments);let a=e=>{let t=n(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,a),i.apply(this,[e,a])};let a=r.removeEventListener;r.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t]||!this._eventMap[t].has(n))return a.apply(this,arguments);let r=this._eventMap[t].get(n);return this._eventMap[t].delete(n),this._eventMap[t].size===0&&delete this._eventMap[t],Object.keys(this._eventMap).length===0&&delete this._eventMap,a.apply(this,[e,r])},Object.defineProperty(r,`on`+t,{get(){return this[`_on`+t]},set(e){this[`_on`+t]&&(this.removeEventListener(t,this[`_on`+t]),delete this[`_on`+t]),e&&this.addEventListener(t,this[`_on`+t]=e)},enumerable:!0,configurable:!0})}function p(e){return typeof e==`boolean`?(l=e,e?`adapter.js logging disabled`:`adapter.js logging enabled`):Error(`Argument type: `+typeof e+`. Please use a boolean.`)}function ee(e){return typeof e==`boolean`?(u=!e,`adapter.js deprecation warnings `+(e?`disabled`:`enabled`)):Error(`Argument type: `+typeof e+`. Please use a boolean.`)}function te(){if(typeof window==`object`){if(l)return;typeof console<`u`&&typeof console.log==`function`&&console.log.apply(console,arguments)}}function m(e,t){u&&console.warn(e+` is deprecated, please use `+t+` instead.`)}function ne(e){let t={browser:null,version:null};if(e===void 0||!e.navigator||!e.navigator.userAgent)return t.browser=`Not a browser.`,t;let{navigator:n}=e;if(n.userAgentData&&n.userAgentData.brands){let e=n.userAgentData.brands.find(e=>e.brand===`Chromium`);if(e)return{browser:`chrome`,version:parseInt(e.version,10)}}if(n.mozGetUserMedia)t.browser=`firefox`,t.version=parseInt(d(n.userAgent,/Firefox\/(\d+)\./,1));else if(n.webkitGetUserMedia||e.isSecureContext===!1&&e.webkitRTCPeerConnection)t.browser=`chrome`,t.version=parseInt(d(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2));else if(e.RTCPeerConnection&&n.userAgent.match(/AppleWebKit\/(\d+)\./))t.browser=`safari`,t.version=parseInt(d(n.userAgent,/AppleWebKit\/(\d+)\./,1)),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&`currentDirection`in e.RTCRtpTransceiver.prototype,t._safariVersion=d(n.userAgent,/Version\/(\d+(\.?\d+))/,1);else return t.browser=`Not a supported browser.`,t;return t}function re(e){return Object.prototype.toString.call(e)===`[object Object]`}function ie(e){return re(e)?Object.keys(e).reduce(function(t,n){let r=re(e[n]),i=r?ie(e[n]):e[n],a=r&&!Object.keys(i).length;return i===void 0||a?t:Object.assign(t,{[n]:i})},{}):e}function ae(e,t,n){!t||n.has(t.id)||(n.set(t.id,t),Object.keys(t).forEach(r=>{r.endsWith(`Id`)?ae(e,e.get(t[r]),n):r.endsWith(`Ids`)&&t[r].forEach(t=>{ae(e,e.get(t),n)})}))}function oe(e,t,n){let r=n?`outbound-rtp`:`inbound-rtp`,i=new Map;if(t===null)return i;let a=[];return e.forEach(e=>{e.type===`track`&&e.trackIdentifier===t.id&&a.push(e)}),a.forEach(t=>{e.forEach(n=>{n.type===r&&n.trackId===t.id&&ae(e,n,i)})}),i}var se=te;function ce(e,t){let n=e&&e.navigator;if(!n.mediaDevices)return;let r=function(e){if(typeof e!=`object`||e.mandatory||e.optional)return e;let t={};return Object.keys(e).forEach(n=>{if(n===`require`||n===`advanced`||n===`mediaSource`)return;let r=typeof e[n]==`object`?e[n]:{ideal:e[n]};r.exact!==void 0&&typeof r.exact==`number`&&(r.min=r.max=r.exact);let i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):t===`deviceId`?`sourceId`:t};if(r.ideal!==void 0){t.optional=t.optional||[];let e={};typeof r.ideal==`number`?(e[i(`min`,n)]=r.ideal,t.optional.push(e),e={},e[i(`max`,n)]=r.ideal,t.optional.push(e)):(e[i(``,n)]=r.ideal,t.optional.push(e))}r.exact!==void 0&&typeof r.exact!=`number`?(t.mandatory=t.mandatory||{},t.mandatory[i(``,n)]=r.exact):[`min`,`max`].forEach(e=>{r[e]!==void 0&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])})}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if(e=JSON.parse(JSON.stringify(e)),e&&typeof e.audio==`object`){let t=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};e=JSON.parse(JSON.stringify(e)),t(e.audio,`autoGainControl`,`googAutoGainControl`),t(e.audio,`noiseSuppression`,`googNoiseSuppression`),e.audio=r(e.audio)}if(e&&typeof e.video==`object`){let a=e.video.facingMode;a&&=typeof a==`object`?a:{ideal:a};let o=t.version<66;if(a&&(a.exact===`user`||a.exact===`environment`||a.ideal===`user`||a.ideal===`environment`)&&!(n.mediaDevices.getSupportedConstraints&&n.mediaDevices.getSupportedConstraints().facingMode&&!o)){delete e.video.facingMode;let t;if(a.exact===`environment`||a.ideal===`environment`?t=[`back`,`rear`]:(a.exact===`user`||a.ideal===`user`)&&(t=[`front`]),t)return n.mediaDevices.enumerateDevices().then(n=>{n=n.filter(e=>e.kind===`videoinput`);let o=n.find(e=>t.some(t=>e.label.toLowerCase().includes(t)));return!o&&n.length&&t.includes(`back`)&&(o=n[n.length-1]),o&&(e.video.deviceId=a.exact?{exact:o.deviceId}:{ideal:o.deviceId}),e.video=r(e.video),se(`chrome: `+JSON.stringify(e)),i(e)})}e.video=r(e.video)}return se(`chrome: `+JSON.stringify(e)),i(e)},a=function(e){return t.version>=64?e:{name:{PermissionDeniedError:`NotAllowedError`,PermissionDismissedError:`NotAllowedError`,InvalidStateError:`NotAllowedError`,DevicesNotFoundError:`NotFoundError`,ConstraintNotSatisfiedError:`OverconstrainedError`,TrackStartError:`NotReadableError`,MediaDeviceFailedDueToShutdown:`NotAllowedError`,MediaDeviceKillSwitchOn:`NotAllowedError`,TabCaptureError:`AbortError`,ScreenCaptureError:`AbortError`,DeviceCaptureError:`AbortError`}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&`: `)+this.message}}};if(n.getUserMedia=function(e,t,r){i(e,e=>{n.webkitGetUserMedia(e,t,e=>{r&&r(a(e))})})}.bind(n),n.mediaDevices.getUserMedia){let e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(t){return i(t,t=>e(t).then(e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach(e=>{e.stop()}),new DOMException(``,`NotFoundError`);return e},e=>Promise.reject(a(e))))}}}var le=t({fixNegotiationNeeded:()=>_e,shimAddTrackRemoveTrack:()=>he,shimAddTrackRemoveTrackWithNative:()=>me,shimGetSendersWithDtmf:()=>fe,shimGetUserMedia:()=>ce,shimMediaStream:()=>ue,shimOnTrack:()=>de,shimPeerConnection:()=>ge,shimSenderReceiverGetStats:()=>pe});function ue(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function de(e){if(typeof e==`object`&&e.RTCPeerConnection&&!(`ontrack`in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,`ontrack`,{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener(`track`,this._ontrack),this.addEventListener(`track`,this._ontrack=e)},enumerable:!0,configurable:!0});let t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener(`addtrack`,n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.track.id):{track:n.track};let i=new Event(`track`);i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)}),t.stream.getTracks().forEach(n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.id):{track:n};let i=new Event(`track`);i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)})},this.addEventListener(`addstream`,this._ontrackpoly)),t.apply(this,arguments)}}else f(e,`track`,e=>(e.transceiver||Object.defineProperty(e,`transceiver`,{value:{receiver:e.receiver}}),e))}function fe(e){if(typeof e==`object`&&e.RTCPeerConnection&&!(`getSenders`in e.RTCPeerConnection.prototype)&&`createDTMFSender`in e.RTCPeerConnection.prototype){let t=function(e,t){return{track:t,get dtmf(){return this._dtmf===void 0&&(t.kind===`audio`?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};let n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){let i=n.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};let r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);let t=this._senders.indexOf(e);t!==-1&&this._senders.splice(t,1)}}let n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach(e=>{this._senders.push(t(this,e))})};let r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach(e=>{let t=this._senders.find(t=>t.track===e);t&&this._senders.splice(this._senders.indexOf(t),1)})}}else if(typeof e==`object`&&e.RTCPeerConnection&&`getSenders`in e.RTCPeerConnection.prototype&&`createDTMFSender`in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!(`dtmf`in e.RTCRtpSender.prototype)){let t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e},Object.defineProperty(e.RTCRtpSender.prototype,`dtmf`,{get(){return this._dtmf===void 0&&(this.track.kind===`audio`?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function pe(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!(`getStats`in e.RTCRtpSender.prototype)){let t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});let n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){let e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){let e=this;return this._pc.getStats().then(t=>oe(t,e.track,!0))}}if(!(`getStats`in e.RTCRtpReceiver.prototype)){let t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),f(e,`track`,e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){let e=this;return this._pc.getStats().then(t=>oe(t,e.track,!1))}}if(!(`getStats`in e.RTCRtpSender.prototype&&`getStats`in e.RTCRtpReceiver.prototype))return;let t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){let e=arguments[0],t,n,r;return this.getSenders().forEach(n=>{n.track===e&&(t?r=!0:t=n)}),this.getReceivers().forEach(t=>(t.track===e&&(n?r=!0:n=t),t.track===e)),r||t&&n?Promise.reject(new DOMException(`There are more than one sender or receiver for the track.`,`InvalidAccessError`)):t?t.getStats():n?n.getStats():Promise.reject(new DOMException(`There is no sender or receiver for the track.`,`InvalidAccessError`))}return t.apply(this,arguments)}}function me(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(e=>this._shimmedLocalStreams[e][0])};let t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};let r=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?this._shimmedLocalStreams[n.id].indexOf(r)===-1&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};let n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException(`Track already exists.`,`InvalidAccessError`)});let t=this.getSenders();n.apply(this,arguments);let r=this.getSenders().filter(e=>t.indexOf(e)===-1);this._shimmedLocalStreams[e.id]=[e].concat(r)};let r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};let i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(t=>{let n=this._shimmedLocalStreams[t].indexOf(e);n!==-1&&this._shimmedLocalStreams[t].splice(n,1),this._shimmedLocalStreams[t].length===1&&delete this._shimmedLocalStreams[t]}),i.apply(this,arguments)}}function he(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return me(e);let n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){let e=n.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map(e=>this._reverseStreams[e.id])};let r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException(`Track already exists.`,`InvalidAccessError`)}),!this._reverseStreams[t.id]){let n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};let i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,n){if(this.signalingState===`closed`)throw new DOMException(`The RTCPeerConnection's signalingState is 'closed'.`,`InvalidStateError`);let r=[].slice.call(arguments,1);if(r.length!==1||!r[0].getTracks().find(e=>e===t))throw new DOMException(`The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.`,`NotSupportedError`);if(this.getSenders().find(e=>e.track===t))throw new DOMException(`Track already exists.`,`InvalidAccessError`);this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};let i=this._streams[n.id];if(i)i.addTrack(t),Promise.resolve().then(()=>{this.dispatchEvent(new Event(`negotiationneeded`))});else{let r=new e.MediaStream([t]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find(e=>e.track===t)};function a(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{let r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(i.id,`g`),r.id)}),new RTCSessionDescription({type:t.type,sdp:n})}function o(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{let r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(r.id,`g`),i.id)}),new RTCSessionDescription({type:t.type,sdp:n})}[`createOffer`,`createAnswer`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){let e=arguments;return arguments.length&&typeof arguments[0]==`function`?n.apply(this,[t=>{let n=a(this,t);e[0].apply(null,[n])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):n.apply(this,arguments).then(e=>a(this,e))}};e.RTCPeerConnection.prototype[t]=r[t]});let s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type||(arguments[0]=o(this,arguments[0])),s.apply(this,arguments)};let c=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,`localDescription`);Object.defineProperty(e.RTCPeerConnection.prototype,`localDescription`,{get(){let e=c.get.apply(this);return e.type===``?e:a(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if(this.signalingState===`closed`)throw new DOMException(`The RTCPeerConnection's signalingState is 'closed'.`,`InvalidStateError`);if(!e._pc)throw new DOMException(`Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.`,`TypeError`);if(e._pc!==this)throw new DOMException(`Sender was not created by this connection.`,`InvalidAccessError`);this._streams=this._streams||{};let t;Object.keys(this._streams).forEach(n=>{this._streams[n].getTracks().find(t=>e.track===t)&&(t=this._streams[n])}),t&&(t.getTracks().length===1?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event(`negotiationneeded`)))}}function ge(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&[`setLocalDescription`,`setRemoteDescription`,`addIceCandidate`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new(t===`addIceCandidate`?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]})}function _e(e,t){f(e,`negotiationneeded`,e=>{let n=e.target;if(!((t.version<72||n.getConfiguration&&n.getConfiguration().sdpSemantics===`plan-b`)&&n.signalingState!==`stable`))return e})}function ve(e,t){let n=e&&e.navigator,r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){m(`navigator.getUserMedia`,`navigator.mediaDevices.getUserMedia`),n.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&`autoGainControl`in n.mediaDevices.getSupportedConstraints())){let e=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return typeof n==`object`&&typeof n.audio==`object`&&(n=JSON.parse(JSON.stringify(n)),e(n.audio,`autoGainControl`,`mozAutoGainControl`),e(n.audio,`noiseSuppression`,`mozNoiseSuppression`)),t(n)},r&&r.prototype.getSettings){let t=r.prototype.getSettings;r.prototype.getSettings=function(){let n=t.apply(this,arguments);return e(n,`mozAutoGainControl`,`autoGainControl`),e(n,`mozNoiseSuppression`,`noiseSuppression`),n}}if(r&&r.prototype.applyConstraints){let t=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return this.kind===`audio`&&typeof n==`object`&&(n=JSON.parse(JSON.stringify(n)),e(n,`autoGainControl`,`mozAutoGainControl`),e(n,`noiseSuppression`,`mozNoiseSuppression`)),t.apply(this,[n])}}}}function ye(e,t){e.navigator.mediaDevices&&`getDisplayMedia`in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!(n&&n.video)){let e=new DOMException(`getDisplayMedia without video constraints is undefined`);return e.name=`NotFoundError`,e.code=8,Promise.reject(e)}return n.video===!0?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)})}var be=t({shimAddTransceiver:()=>Ee,shimCreateAnswer:()=>ke,shimCreateOffer:()=>Oe,shimGetDisplayMedia:()=>ye,shimGetParameters:()=>De,shimGetUserMedia:()=>ve,shimOnTrack:()=>xe,shimPeerConnection:()=>h,shimRTCDataChannel:()=>Te,shimReceiverGetStats:()=>Ce,shimRemoveStream:()=>we,shimSenderGetStats:()=>Se});function xe(e){typeof e==`object`&&e.RTCTrackEvent&&`receiver`in e.RTCTrackEvent.prototype&&!(`transceiver`in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,`transceiver`,{get(){return{receiver:this.receiver}}})}function h(e,t){if(typeof e!=`object`||!(e.RTCPeerConnection||e.mozRTCPeerConnection))return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&[`setLocalDescription`,`setRemoteDescription`,`addIceCandidate`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new(t===`addIceCandidate`?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]});let n={inboundrtp:`inbound-rtp`,outboundrtp:`outbound-rtp`,candidatepair:`candidate-pair`,localcandidate:`local-candidate`,remotecandidate:`remote-candidate`},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){let[e,i,a]=arguments;return r.apply(this,[e||null]).then(e=>{if(t.version<53&&!i)try{e.forEach(e=>{e.type=n[e.type]||e.type})}catch(t){if(t.name!==`TypeError`)throw t;e.forEach((t,r)=>{e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))})}return e}).then(i,a)}}function Se(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&`getStats`in e.RTCRtpSender.prototype)return;let t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});let n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){let e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function Ce(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&`getStats`in e.RTCRtpReceiver.prototype)return;let t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),f(e,`track`,e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function we(e){!e.RTCPeerConnection||`removeStream`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){m(`removeStream`,`removeTrack`),this.getSenders().forEach(t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)})})}function Te(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function Ee(e){if(!(typeof e==`object`&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;e===void 0&&(e=[]),e=[...e];let n=e.length>0;n&&e.forEach(e=>{if(`rid`in e&&!/^[a-z0-9]{0,16}$/i.test(e.rid))throw TypeError(`Invalid RID value provided.`);if(`scaleResolutionDownBy`in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw RangeError(`scale_resolution_down_by must be >= 1.0`);if(`maxFramerate`in e&&!(parseFloat(e.maxFramerate)>=0))throw RangeError(`max_framerate must be >= 0.0`)});let r=t.apply(this,arguments);if(n){let{sender:t}=r,n=t.getParameters();(!(`encodings`in n)||n.encodings.length===1&&Object.keys(n.encodings[0]).length===0)&&(n.encodings=e,t.sendEncodings=e,this.setParametersPromises.push(t.setParameters(n).then(()=>{delete t.sendEncodings}).catch(()=>{delete t.sendEncodings})))}return r})}function De(e){if(!(typeof e==`object`&&e.RTCRtpSender))return;let t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){let e=t.apply(this,arguments);return`encodings`in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function Oe(e){if(!(typeof e==`object`&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function ke(e){if(!(typeof e==`object`&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}var Ae=t({shimAudioContext:()=>ze,shimCallbacksAPI:()=>Ne,shimConstraints:()=>Fe,shimCreateOfferLegacy:()=>Re,shimGetUserMedia:()=>Pe,shimLocalStreamsAPI:()=>je,shimRTCIceServerUrls:()=>Ie,shimRemoteStreamsAPI:()=>Me,shimTrackEventTransceiver:()=>Le});function je(e){if(!(typeof e!=`object`||!e.RTCPeerConnection)){if(`getLocalStreams`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||=[],this._localStreams}),!(`addStream`in e.RTCPeerConnection.prototype)){let t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||=[],this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(n=>t.call(this,n,e)),e.getVideoTracks().forEach(n=>t.call(this,n,e))},e.RTCPeerConnection.prototype.addTrack=function(e,...n){return n&&n.forEach(e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]}),t.apply(this,arguments)}}`removeStream`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||=[];let t=this._localStreams.indexOf(e);if(t===-1)return;this._localStreams.splice(t,1);let n=e.getTracks();this.getSenders().forEach(e=>{n.includes(e.track)&&this.removeTrack(e)})})}}function Me(e){if(!(typeof e!=`object`||!e.RTCPeerConnection)&&(`getRemoteStreams`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!(`onaddstream`in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,`onaddstream`,{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener(`addstream`,this._onaddstream),this.removeEventListener(`track`,this._onaddstreampoly)),this.addEventListener(`addstream`,this._onaddstream=e),this.addEventListener(`track`,this._onaddstreampoly=e=>{e.streams.forEach(e=>{if(this._remoteStreams||=[],this._remoteStreams.includes(e))return;this._remoteStreams.push(e);let t=new Event(`addstream`);t.stream=e,this.dispatchEvent(t)})})}});let t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){let e=this;return this._onaddstreampoly||this.addEventListener(`track`,this._onaddstreampoly=function(t){t.streams.forEach(t=>{if(e._remoteStreams||=[],e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);let n=new Event(`addstream`);n.stream=t,e.dispatchEvent(n)})}),t.apply(e,arguments)}}}function Ne(e){if(typeof e!=`object`||!e.RTCPeerConnection)return;let t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,a=t.setRemoteDescription,o=t.addIceCandidate;t.createOffer=function(e,t){let r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){let n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};let s=function(e,t,n){let r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=s,s=function(e,t,n){let r=a.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=s,s=function(e,t,n){let r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=s}function Pe(e){let t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){let e=t.mediaDevices,n=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>n(Fe(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t))}function Fe(e){return e&&e.video!==void 0?Object.assign({},e,{video:ie(e.video)}):e}function Ie(e){if(!e.RTCPeerConnection)return;let t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){let t=[];for(let n=0;ne.receiver.track.kind===`audio`);e.offerToReceiveAudio===!1&&t?t.direction===`sendrecv`?t.setDirection?t.setDirection(`sendonly`):t.direction=`sendonly`:t.direction===`recvonly`&&(t.setDirection?t.setDirection(`inactive`):t.direction=`inactive`):e.offerToReceiveAudio===!0&&!t&&this.addTransceiver(`audio`,{direction:`recvonly`}),e.offerToReceiveVideo!==void 0&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);let n=this.getTransceivers().find(e=>e.receiver.track.kind===`video`);e.offerToReceiveVideo===!1&&n?n.direction===`sendrecv`?n.setDirection?n.setDirection(`sendonly`):n.direction=`sendonly`:n.direction===`recvonly`&&(n.setDirection?n.setDirection(`inactive`):n.direction=`inactive`):e.offerToReceiveVideo===!0&&!n&&this.addTransceiver(`video`,{direction:`recvonly`})}return t.apply(this,arguments)}}function ze(e){typeof e!=`object`||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Be=e(((e,t)=>{var n={};n.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},n.localCName=n.generateIdentifier(),n.splitLines=function(e){return e.trim().split(` +import{En as e,On as t,jn as n}from"./index-BlYU7j-M.js";var r=class{constructor(){this.encoder=new TextEncoder,this._pieces=[],this._parts=[]}append_buffer(e){this.flush(),this._parts.push(e)}append(e){this._pieces.push(e)}flush(){if(this._pieces.length>0){let e=new Uint8Array(this._pieces);this._parts.push(e),this._pieces=[]}}toArrayBuffer(){let e=[];for(let t of this._parts)e.push(t);return i(e).buffer}};function i(e){let t=0;for(let n of e)t+=n.byteLength;let n=new Uint8Array(t),r=0;for(let t of e){let e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);n.set(e,r),r+=t.byteLength}return n}function a(e){return new s(e).unpack()}function o(e){let t=new c,n=t.pack(e);return n instanceof Promise?n.then(()=>t.getBuffer()):t.getBuffer()}var s=class{constructor(e){this.index=0,this.dataBuffer=e,this.dataView=new Uint8Array(this.dataBuffer),this.length=this.dataBuffer.byteLength}unpack(){let e=this.unpack_uint8();if(e<128)return e;if((e^224)<32)return(e^224)-32;let t;if((t=e^160)<=15)return this.unpack_raw(t);if((t=e^176)<=15)return this.unpack_string(t);if((t=e^144)<=15)return this.unpack_array(t);if((t=e^128)<=15)return this.unpack_map(t);switch(e){case 192:return null;case 193:return;case 194:return!1;case 195:return!0;case 202:return this.unpack_float();case 203:return this.unpack_double();case 204:return this.unpack_uint8();case 205:return this.unpack_uint16();case 206:return this.unpack_uint32();case 207:return this.unpack_uint64();case 208:return this.unpack_int8();case 209:return this.unpack_int16();case 210:return this.unpack_int32();case 211:return this.unpack_int64();case 212:return;case 213:return;case 214:return;case 215:return;case 216:return t=this.unpack_uint16(),this.unpack_string(t);case 217:return t=this.unpack_uint32(),this.unpack_string(t);case 218:return t=this.unpack_uint16(),this.unpack_raw(t);case 219:return t=this.unpack_uint32(),this.unpack_raw(t);case 220:return t=this.unpack_uint16(),this.unpack_array(t);case 221:return t=this.unpack_uint32(),this.unpack_array(t);case 222:return t=this.unpack_uint16(),this.unpack_map(t);case 223:return t=this.unpack_uint32(),this.unpack_map(t)}}unpack_uint8(){let e=this.dataView[this.index]&255;return this.index++,e}unpack_uint16(){let e=this.read(2),t=(e[0]&255)*256+(e[1]&255);return this.index+=2,t}unpack_uint32(){let e=this.read(4),t=((e[0]*256+e[1])*256+e[2])*256+e[3];return this.index+=4,t}unpack_uint64(){let e=this.read(8),t=((((((e[0]*256+e[1])*256+e[2])*256+e[3])*256+e[4])*256+e[5])*256+e[6])*256+e[7];return this.index+=8,t}unpack_int8(){let e=this.unpack_uint8();return e<128?e:e-256}unpack_int16(){let e=this.unpack_uint16();return e<32768?e:e-65536}unpack_int32(){let e=this.unpack_uint32();return e<2**31?e:e-2**32}unpack_int64(){let e=this.unpack_uint64();return e<2**63?e:e-2**64}unpack_raw(e){if(this.length>31,n=(e>>23&255)-127,r=e&8388607|8388608;return(t===0?1:-1)*r*2**(n-23)}unpack_double(){let e=this.unpack_uint32(),t=this.unpack_uint32(),n=e>>31,r=(e>>20&2047)-1023,i=(e&1048575|1048576)*2**(r-20)+t*2**(r-52);return(n===0?1:-1)*i}read(e){let t=this.index;if(t+e<=this.length)return this.dataView.subarray(t,t+e);throw Error(`BinaryPackFailure: read index out of range`)}},c=class{getBuffer(){return this._bufferBuilder.toArrayBuffer()}pack(e){if(typeof e==`string`)this.pack_string(e);else if(typeof e==`number`)Math.floor(e)===e?this.pack_integer(e):this.pack_double(e);else if(typeof e==`boolean`)e===!0?this._bufferBuilder.append(195):e===!1&&this._bufferBuilder.append(194);else if(e===void 0)this._bufferBuilder.append(192);else if(typeof e==`object`)if(e===null)this._bufferBuilder.append(192);else{let t=e.constructor;if(e instanceof Array){let t=this.pack_array(e);if(t instanceof Promise)return t.then(()=>this._bufferBuilder.flush())}else if(e instanceof ArrayBuffer)this.pack_bin(new Uint8Array(e));else if(`BYTES_PER_ELEMENT`in e){let t=e;this.pack_bin(new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}else if(e instanceof Date)this.pack_string(e.toString());else if(e instanceof Blob)return e.arrayBuffer().then(e=>{this.pack_bin(new Uint8Array(e)),this._bufferBuilder.flush()});else if(t==Object||t.toString().startsWith(`class`)){let t=this.pack_object(e);if(t instanceof Promise)return t.then(()=>this._bufferBuilder.flush())}else throw Error(`Type "${t.toString()}" not yet supported`)}else throw Error(`Type "${typeof e}" not yet supported`);this._bufferBuilder.flush()}pack_bin(e){let t=e.length;if(t<=15)this.pack_uint8(160+t);else if(t<=65535)this._bufferBuilder.append(218),this.pack_uint16(t);else if(t<=4294967295)this._bufferBuilder.append(219),this.pack_uint32(t);else throw Error(`Invalid length`);this._bufferBuilder.append_buffer(e)}pack_string(e){let t=this._textEncoder.encode(e),n=t.length;if(n<=15)this.pack_uint8(176+n);else if(n<=65535)this._bufferBuilder.append(216),this.pack_uint16(n);else if(n<=4294967295)this._bufferBuilder.append(217),this.pack_uint32(n);else throw Error(`Invalid length`);this._bufferBuilder.append_buffer(t)}pack_array(e){let t=e.length;if(t<=15)this.pack_uint8(144+t);else if(t<=65535)this._bufferBuilder.append(220),this.pack_uint16(t);else if(t<=4294967295)this._bufferBuilder.append(221),this.pack_uint32(t);else throw Error(`Invalid length`);let n=r=>{if(rn(r+1)):n(r+1)}};return n(0)}pack_integer(e){if(e>=-32&&e<=127)this._bufferBuilder.append(e&255);else if(e>=0&&e<=255)this._bufferBuilder.append(204),this.pack_uint8(e);else if(e>=-128&&e<=127)this._bufferBuilder.append(208),this.pack_int8(e);else if(e>=0&&e<=65535)this._bufferBuilder.append(205),this.pack_uint16(e);else if(e>=-32768&&e<=32767)this._bufferBuilder.append(209),this.pack_int16(e);else if(e>=0&&e<=4294967295)this._bufferBuilder.append(206),this.pack_uint32(e);else if(e>=-2147483648&&e<=2147483647)this._bufferBuilder.append(210),this.pack_int32(e);else if(e>=-0x8000000000000000&&e<=0x8000000000000000)this._bufferBuilder.append(211),this.pack_int64(e);else if(e>=0&&e<=0x10000000000000000)this._bufferBuilder.append(207),this.pack_uint64(e);else throw Error(`Invalid integer`)}pack_double(e){let t=0;e<0&&(t=1,e=-e);let n=Math.floor(Math.log(e)/Math.LN2),r=e/2**n-1,i=Math.floor(r*2**52),a=2**32,o=t<<31|n+1023<<20|i/a&1048575,s=i%a;this._bufferBuilder.append(203),this.pack_int32(o),this.pack_int32(s)}pack_object(e){let t=Object.keys(e),n=t.length;if(n<=15)this.pack_uint8(128+n);else if(n<=65535)this._bufferBuilder.append(222),this.pack_uint16(n);else if(n<=4294967295)this._bufferBuilder.append(223),this.pack_uint32(n);else throw Error(`Invalid length`);let r=n=>{if(nr(n+1))}return r(n+1)}};return r(0)}pack_uint8(e){this._bufferBuilder.append(e)}pack_uint16(e){this._bufferBuilder.append(e>>8),this._bufferBuilder.append(e&255)}pack_uint32(e){let t=e&4294967295;this._bufferBuilder.append((t&4278190080)>>>24),this._bufferBuilder.append((t&16711680)>>>16),this._bufferBuilder.append((t&65280)>>>8),this._bufferBuilder.append(t&255)}pack_uint64(e){let t=e/2**32,n=e%2**32;this._bufferBuilder.append((t&4278190080)>>>24),this._bufferBuilder.append((t&16711680)>>>16),this._bufferBuilder.append((t&65280)>>>8),this._bufferBuilder.append(t&255),this._bufferBuilder.append((n&4278190080)>>>24),this._bufferBuilder.append((n&16711680)>>>16),this._bufferBuilder.append((n&65280)>>>8),this._bufferBuilder.append(n&255)}pack_int8(e){this._bufferBuilder.append(e&255)}pack_int16(e){this._bufferBuilder.append((e&65280)>>8),this._bufferBuilder.append(e&255)}pack_int32(e){this._bufferBuilder.append(e>>>24&255),this._bufferBuilder.append((e&16711680)>>>16),this._bufferBuilder.append((e&65280)>>>8),this._bufferBuilder.append(e&255)}pack_int64(e){let t=Math.floor(e/2**32),n=e%2**32;this._bufferBuilder.append((t&4278190080)>>>24),this._bufferBuilder.append((t&16711680)>>>16),this._bufferBuilder.append((t&65280)>>>8),this._bufferBuilder.append(t&255),this._bufferBuilder.append((n&4278190080)>>>24),this._bufferBuilder.append((n&16711680)>>>16),this._bufferBuilder.append((n&65280)>>>8),this._bufferBuilder.append(n&255)}constructor(){this._bufferBuilder=new r,this._textEncoder=new TextEncoder}},l=!0,u=!0;function d(e,t,n){let r=e.match(t);return r&&r.length>=n&&parseFloat(r[n],10)}function f(e,t,n){if(!e.RTCPeerConnection)return;let r=e.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return i.apply(this,arguments);let a=e=>{let t=n(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,a),i.apply(this,[e,a])};let a=r.removeEventListener;r.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t]||!this._eventMap[t].has(n))return a.apply(this,arguments);let r=this._eventMap[t].get(n);return this._eventMap[t].delete(n),this._eventMap[t].size===0&&delete this._eventMap[t],Object.keys(this._eventMap).length===0&&delete this._eventMap,a.apply(this,[e,r])},Object.defineProperty(r,`on`+t,{get(){return this[`_on`+t]},set(e){this[`_on`+t]&&(this.removeEventListener(t,this[`_on`+t]),delete this[`_on`+t]),e&&this.addEventListener(t,this[`_on`+t]=e)},enumerable:!0,configurable:!0})}function p(e){return typeof e==`boolean`?(l=e,e?`adapter.js logging disabled`:`adapter.js logging enabled`):Error(`Argument type: `+typeof e+`. Please use a boolean.`)}function ee(e){return typeof e==`boolean`?(u=!e,`adapter.js deprecation warnings `+(e?`disabled`:`enabled`)):Error(`Argument type: `+typeof e+`. Please use a boolean.`)}function te(){if(typeof window==`object`){if(l)return;typeof console<`u`&&typeof console.log==`function`&&console.log.apply(console,arguments)}}function m(e,t){u&&console.warn(e+` is deprecated, please use `+t+` instead.`)}function ne(e){let t={browser:null,version:null};if(e===void 0||!e.navigator||!e.navigator.userAgent)return t.browser=`Not a browser.`,t;let{navigator:n}=e;if(n.userAgentData&&n.userAgentData.brands){let e=n.userAgentData.brands.find(e=>e.brand===`Chromium`);if(e)return{browser:`chrome`,version:parseInt(e.version,10)}}if(n.mozGetUserMedia)t.browser=`firefox`,t.version=parseInt(d(n.userAgent,/Firefox\/(\d+)\./,1));else if(n.webkitGetUserMedia||e.isSecureContext===!1&&e.webkitRTCPeerConnection)t.browser=`chrome`,t.version=parseInt(d(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2));else if(e.RTCPeerConnection&&n.userAgent.match(/AppleWebKit\/(\d+)\./))t.browser=`safari`,t.version=parseInt(d(n.userAgent,/AppleWebKit\/(\d+)\./,1)),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&`currentDirection`in e.RTCRtpTransceiver.prototype,t._safariVersion=d(n.userAgent,/Version\/(\d+(\.?\d+))/,1);else return t.browser=`Not a supported browser.`,t;return t}function re(e){return Object.prototype.toString.call(e)===`[object Object]`}function ie(e){return re(e)?Object.keys(e).reduce(function(t,n){let r=re(e[n]),i=r?ie(e[n]):e[n],a=r&&!Object.keys(i).length;return i===void 0||a?t:Object.assign(t,{[n]:i})},{}):e}function ae(e,t,n){!t||n.has(t.id)||(n.set(t.id,t),Object.keys(t).forEach(r=>{r.endsWith(`Id`)?ae(e,e.get(t[r]),n):r.endsWith(`Ids`)&&t[r].forEach(t=>{ae(e,e.get(t),n)})}))}function oe(e,t,n){let r=n?`outbound-rtp`:`inbound-rtp`,i=new Map;if(t===null)return i;let a=[];return e.forEach(e=>{e.type===`track`&&e.trackIdentifier===t.id&&a.push(e)}),a.forEach(t=>{e.forEach(n=>{n.type===r&&n.trackId===t.id&&ae(e,n,i)})}),i}var se=te;function ce(e,t){let n=e&&e.navigator;if(!n.mediaDevices)return;let r=function(e){if(typeof e!=`object`||e.mandatory||e.optional)return e;let t={};return Object.keys(e).forEach(n=>{if(n===`require`||n===`advanced`||n===`mediaSource`)return;let r=typeof e[n]==`object`?e[n]:{ideal:e[n]};r.exact!==void 0&&typeof r.exact==`number`&&(r.min=r.max=r.exact);let i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):t===`deviceId`?`sourceId`:t};if(r.ideal!==void 0){t.optional=t.optional||[];let e={};typeof r.ideal==`number`?(e[i(`min`,n)]=r.ideal,t.optional.push(e),e={},e[i(`max`,n)]=r.ideal,t.optional.push(e)):(e[i(``,n)]=r.ideal,t.optional.push(e))}r.exact!==void 0&&typeof r.exact!=`number`?(t.mandatory=t.mandatory||{},t.mandatory[i(``,n)]=r.exact):[`min`,`max`].forEach(e=>{r[e]!==void 0&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])})}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if(e=JSON.parse(JSON.stringify(e)),e&&typeof e.audio==`object`){let t=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};e=JSON.parse(JSON.stringify(e)),t(e.audio,`autoGainControl`,`googAutoGainControl`),t(e.audio,`noiseSuppression`,`googNoiseSuppression`),e.audio=r(e.audio)}if(e&&typeof e.video==`object`){let a=e.video.facingMode;a&&=typeof a==`object`?a:{ideal:a};let o=t.version<66;if(a&&(a.exact===`user`||a.exact===`environment`||a.ideal===`user`||a.ideal===`environment`)&&!(n.mediaDevices.getSupportedConstraints&&n.mediaDevices.getSupportedConstraints().facingMode&&!o)){delete e.video.facingMode;let t;if(a.exact===`environment`||a.ideal===`environment`?t=[`back`,`rear`]:(a.exact===`user`||a.ideal===`user`)&&(t=[`front`]),t)return n.mediaDevices.enumerateDevices().then(n=>{n=n.filter(e=>e.kind===`videoinput`);let o=n.find(e=>t.some(t=>e.label.toLowerCase().includes(t)));return!o&&n.length&&t.includes(`back`)&&(o=n[n.length-1]),o&&(e.video.deviceId=a.exact?{exact:o.deviceId}:{ideal:o.deviceId}),e.video=r(e.video),se(`chrome: `+JSON.stringify(e)),i(e)})}e.video=r(e.video)}return se(`chrome: `+JSON.stringify(e)),i(e)},a=function(e){return t.version>=64?e:{name:{PermissionDeniedError:`NotAllowedError`,PermissionDismissedError:`NotAllowedError`,InvalidStateError:`NotAllowedError`,DevicesNotFoundError:`NotFoundError`,ConstraintNotSatisfiedError:`OverconstrainedError`,TrackStartError:`NotReadableError`,MediaDeviceFailedDueToShutdown:`NotAllowedError`,MediaDeviceKillSwitchOn:`NotAllowedError`,TabCaptureError:`AbortError`,ScreenCaptureError:`AbortError`,DeviceCaptureError:`AbortError`}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&`: `)+this.message}}};if(n.getUserMedia=function(e,t,r){i(e,e=>{n.webkitGetUserMedia(e,t,e=>{r&&r(a(e))})})}.bind(n),n.mediaDevices.getUserMedia){let e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(t){return i(t,t=>e(t).then(e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach(e=>{e.stop()}),new DOMException(``,`NotFoundError`);return e},e=>Promise.reject(a(e))))}}}var le=t({fixNegotiationNeeded:()=>_e,shimAddTrackRemoveTrack:()=>he,shimAddTrackRemoveTrackWithNative:()=>me,shimGetSendersWithDtmf:()=>fe,shimGetUserMedia:()=>ce,shimMediaStream:()=>ue,shimOnTrack:()=>de,shimPeerConnection:()=>ge,shimSenderReceiverGetStats:()=>pe});function ue(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function de(e){if(typeof e==`object`&&e.RTCPeerConnection&&!(`ontrack`in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,`ontrack`,{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener(`track`,this._ontrack),this.addEventListener(`track`,this._ontrack=e)},enumerable:!0,configurable:!0});let t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener(`addtrack`,n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.track.id):{track:n.track};let i=new Event(`track`);i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)}),t.stream.getTracks().forEach(n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.id):{track:n};let i=new Event(`track`);i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)})},this.addEventListener(`addstream`,this._ontrackpoly)),t.apply(this,arguments)}}else f(e,`track`,e=>(e.transceiver||Object.defineProperty(e,`transceiver`,{value:{receiver:e.receiver}}),e))}function fe(e){if(typeof e==`object`&&e.RTCPeerConnection&&!(`getSenders`in e.RTCPeerConnection.prototype)&&`createDTMFSender`in e.RTCPeerConnection.prototype){let t=function(e,t){return{track:t,get dtmf(){return this._dtmf===void 0&&(t.kind===`audio`?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};let n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){let i=n.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};let r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);let t=this._senders.indexOf(e);t!==-1&&this._senders.splice(t,1)}}let n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach(e=>{this._senders.push(t(this,e))})};let r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach(e=>{let t=this._senders.find(t=>t.track===e);t&&this._senders.splice(this._senders.indexOf(t),1)})}}else if(typeof e==`object`&&e.RTCPeerConnection&&`getSenders`in e.RTCPeerConnection.prototype&&`createDTMFSender`in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!(`dtmf`in e.RTCRtpSender.prototype)){let t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e},Object.defineProperty(e.RTCRtpSender.prototype,`dtmf`,{get(){return this._dtmf===void 0&&(this.track.kind===`audio`?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function pe(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!(`getStats`in e.RTCRtpSender.prototype)){let t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});let n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){let e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){let e=this;return this._pc.getStats().then(t=>oe(t,e.track,!0))}}if(!(`getStats`in e.RTCRtpReceiver.prototype)){let t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),f(e,`track`,e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){let e=this;return this._pc.getStats().then(t=>oe(t,e.track,!1))}}if(!(`getStats`in e.RTCRtpSender.prototype&&`getStats`in e.RTCRtpReceiver.prototype))return;let t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){let e=arguments[0],t,n,r;return this.getSenders().forEach(n=>{n.track===e&&(t?r=!0:t=n)}),this.getReceivers().forEach(t=>(t.track===e&&(n?r=!0:n=t),t.track===e)),r||t&&n?Promise.reject(new DOMException(`There are more than one sender or receiver for the track.`,`InvalidAccessError`)):t?t.getStats():n?n.getStats():Promise.reject(new DOMException(`There is no sender or receiver for the track.`,`InvalidAccessError`))}return t.apply(this,arguments)}}function me(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(e=>this._shimmedLocalStreams[e][0])};let t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};let r=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?this._shimmedLocalStreams[n.id].indexOf(r)===-1&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};let n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException(`Track already exists.`,`InvalidAccessError`)});let t=this.getSenders();n.apply(this,arguments);let r=this.getSenders().filter(e=>t.indexOf(e)===-1);this._shimmedLocalStreams[e.id]=[e].concat(r)};let r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};let i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(t=>{let n=this._shimmedLocalStreams[t].indexOf(e);n!==-1&&this._shimmedLocalStreams[t].splice(n,1),this._shimmedLocalStreams[t].length===1&&delete this._shimmedLocalStreams[t]}),i.apply(this,arguments)}}function he(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return me(e);let n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){let e=n.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map(e=>this._reverseStreams[e.id])};let r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException(`Track already exists.`,`InvalidAccessError`)}),!this._reverseStreams[t.id]){let n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};let i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,n){if(this.signalingState===`closed`)throw new DOMException(`The RTCPeerConnection's signalingState is 'closed'.`,`InvalidStateError`);let r=[].slice.call(arguments,1);if(r.length!==1||!r[0].getTracks().find(e=>e===t))throw new DOMException(`The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.`,`NotSupportedError`);if(this.getSenders().find(e=>e.track===t))throw new DOMException(`Track already exists.`,`InvalidAccessError`);this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};let i=this._streams[n.id];if(i)i.addTrack(t),Promise.resolve().then(()=>{this.dispatchEvent(new Event(`negotiationneeded`))});else{let r=new e.MediaStream([t]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find(e=>e.track===t)};function a(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{let r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(i.id,`g`),r.id)}),new RTCSessionDescription({type:t.type,sdp:n})}function o(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{let r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(r.id,`g`),i.id)}),new RTCSessionDescription({type:t.type,sdp:n})}[`createOffer`,`createAnswer`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){let e=arguments;return arguments.length&&typeof arguments[0]==`function`?n.apply(this,[t=>{let n=a(this,t);e[0].apply(null,[n])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):n.apply(this,arguments).then(e=>a(this,e))}};e.RTCPeerConnection.prototype[t]=r[t]});let s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type||(arguments[0]=o(this,arguments[0])),s.apply(this,arguments)};let c=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,`localDescription`);Object.defineProperty(e.RTCPeerConnection.prototype,`localDescription`,{get(){let e=c.get.apply(this);return e.type===``?e:a(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if(this.signalingState===`closed`)throw new DOMException(`The RTCPeerConnection's signalingState is 'closed'.`,`InvalidStateError`);if(!e._pc)throw new DOMException(`Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.`,`TypeError`);if(e._pc!==this)throw new DOMException(`Sender was not created by this connection.`,`InvalidAccessError`);this._streams=this._streams||{};let t;Object.keys(this._streams).forEach(n=>{this._streams[n].getTracks().find(t=>e.track===t)&&(t=this._streams[n])}),t&&(t.getTracks().length===1?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event(`negotiationneeded`)))}}function ge(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&[`setLocalDescription`,`setRemoteDescription`,`addIceCandidate`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new(t===`addIceCandidate`?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]})}function _e(e,t){f(e,`negotiationneeded`,e=>{let n=e.target;if(!((t.version<72||n.getConfiguration&&n.getConfiguration().sdpSemantics===`plan-b`)&&n.signalingState!==`stable`))return e})}function ve(e,t){let n=e&&e.navigator,r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){m(`navigator.getUserMedia`,`navigator.mediaDevices.getUserMedia`),n.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&`autoGainControl`in n.mediaDevices.getSupportedConstraints())){let e=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return typeof n==`object`&&typeof n.audio==`object`&&(n=JSON.parse(JSON.stringify(n)),e(n.audio,`autoGainControl`,`mozAutoGainControl`),e(n.audio,`noiseSuppression`,`mozNoiseSuppression`)),t(n)},r&&r.prototype.getSettings){let t=r.prototype.getSettings;r.prototype.getSettings=function(){let n=t.apply(this,arguments);return e(n,`mozAutoGainControl`,`autoGainControl`),e(n,`mozNoiseSuppression`,`noiseSuppression`),n}}if(r&&r.prototype.applyConstraints){let t=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return this.kind===`audio`&&typeof n==`object`&&(n=JSON.parse(JSON.stringify(n)),e(n,`autoGainControl`,`mozAutoGainControl`),e(n,`noiseSuppression`,`mozNoiseSuppression`)),t.apply(this,[n])}}}}function ye(e,t){e.navigator.mediaDevices&&`getDisplayMedia`in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!(n&&n.video)){let e=new DOMException(`getDisplayMedia without video constraints is undefined`);return e.name=`NotFoundError`,e.code=8,Promise.reject(e)}return n.video===!0?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)})}var be=t({shimAddTransceiver:()=>Ee,shimCreateAnswer:()=>ke,shimCreateOffer:()=>Oe,shimGetDisplayMedia:()=>ye,shimGetParameters:()=>De,shimGetUserMedia:()=>ve,shimOnTrack:()=>xe,shimPeerConnection:()=>h,shimRTCDataChannel:()=>Te,shimReceiverGetStats:()=>Ce,shimRemoveStream:()=>we,shimSenderGetStats:()=>Se});function xe(e){typeof e==`object`&&e.RTCTrackEvent&&`receiver`in e.RTCTrackEvent.prototype&&!(`transceiver`in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,`transceiver`,{get(){return{receiver:this.receiver}}})}function h(e,t){if(typeof e!=`object`||!(e.RTCPeerConnection||e.mozRTCPeerConnection))return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&[`setLocalDescription`,`setRemoteDescription`,`addIceCandidate`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new(t===`addIceCandidate`?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]});let n={inboundrtp:`inbound-rtp`,outboundrtp:`outbound-rtp`,candidatepair:`candidate-pair`,localcandidate:`local-candidate`,remotecandidate:`remote-candidate`},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){let[e,i,a]=arguments;return r.apply(this,[e||null]).then(e=>{if(t.version<53&&!i)try{e.forEach(e=>{e.type=n[e.type]||e.type})}catch(t){if(t.name!==`TypeError`)throw t;e.forEach((t,r)=>{e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))})}return e}).then(i,a)}}function Se(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&`getStats`in e.RTCRtpSender.prototype)return;let t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});let n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){let e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function Ce(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&`getStats`in e.RTCRtpReceiver.prototype)return;let t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),f(e,`track`,e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function we(e){!e.RTCPeerConnection||`removeStream`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){m(`removeStream`,`removeTrack`),this.getSenders().forEach(t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)})})}function Te(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function Ee(e){if(!(typeof e==`object`&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;e===void 0&&(e=[]),e=[...e];let n=e.length>0;n&&e.forEach(e=>{if(`rid`in e&&!/^[a-z0-9]{0,16}$/i.test(e.rid))throw TypeError(`Invalid RID value provided.`);if(`scaleResolutionDownBy`in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw RangeError(`scale_resolution_down_by must be >= 1.0`);if(`maxFramerate`in e&&!(parseFloat(e.maxFramerate)>=0))throw RangeError(`max_framerate must be >= 0.0`)});let r=t.apply(this,arguments);if(n){let{sender:t}=r,n=t.getParameters();(!(`encodings`in n)||n.encodings.length===1&&Object.keys(n.encodings[0]).length===0)&&(n.encodings=e,t.sendEncodings=e,this.setParametersPromises.push(t.setParameters(n).then(()=>{delete t.sendEncodings}).catch(()=>{delete t.sendEncodings})))}return r})}function De(e){if(!(typeof e==`object`&&e.RTCRtpSender))return;let t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){let e=t.apply(this,arguments);return`encodings`in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function Oe(e){if(!(typeof e==`object`&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function ke(e){if(!(typeof e==`object`&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}var Ae=t({shimAudioContext:()=>ze,shimCallbacksAPI:()=>Ne,shimConstraints:()=>Fe,shimCreateOfferLegacy:()=>Re,shimGetUserMedia:()=>Pe,shimLocalStreamsAPI:()=>je,shimRTCIceServerUrls:()=>Ie,shimRemoteStreamsAPI:()=>Me,shimTrackEventTransceiver:()=>Le});function je(e){if(!(typeof e!=`object`||!e.RTCPeerConnection)){if(`getLocalStreams`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||=[],this._localStreams}),!(`addStream`in e.RTCPeerConnection.prototype)){let t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||=[],this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(n=>t.call(this,n,e)),e.getVideoTracks().forEach(n=>t.call(this,n,e))},e.RTCPeerConnection.prototype.addTrack=function(e,...n){return n&&n.forEach(e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]}),t.apply(this,arguments)}}`removeStream`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||=[];let t=this._localStreams.indexOf(e);if(t===-1)return;this._localStreams.splice(t,1);let n=e.getTracks();this.getSenders().forEach(e=>{n.includes(e.track)&&this.removeTrack(e)})})}}function Me(e){if(!(typeof e!=`object`||!e.RTCPeerConnection)&&(`getRemoteStreams`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!(`onaddstream`in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,`onaddstream`,{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener(`addstream`,this._onaddstream),this.removeEventListener(`track`,this._onaddstreampoly)),this.addEventListener(`addstream`,this._onaddstream=e),this.addEventListener(`track`,this._onaddstreampoly=e=>{e.streams.forEach(e=>{if(this._remoteStreams||=[],this._remoteStreams.includes(e))return;this._remoteStreams.push(e);let t=new Event(`addstream`);t.stream=e,this.dispatchEvent(t)})})}});let t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){let e=this;return this._onaddstreampoly||this.addEventListener(`track`,this._onaddstreampoly=function(t){t.streams.forEach(t=>{if(e._remoteStreams||=[],e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);let n=new Event(`addstream`);n.stream=t,e.dispatchEvent(n)})}),t.apply(e,arguments)}}}function Ne(e){if(typeof e!=`object`||!e.RTCPeerConnection)return;let t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,a=t.setRemoteDescription,o=t.addIceCandidate;t.createOffer=function(e,t){let r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){let n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};let s=function(e,t,n){let r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=s,s=function(e,t,n){let r=a.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=s,s=function(e,t,n){let r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=s}function Pe(e){let t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){let e=t.mediaDevices,n=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>n(Fe(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t))}function Fe(e){return e&&e.video!==void 0?Object.assign({},e,{video:ie(e.video)}):e}function Ie(e){if(!e.RTCPeerConnection)return;let t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){let t=[];for(let n=0;ne.receiver.track.kind===`audio`);e.offerToReceiveAudio===!1&&t?t.direction===`sendrecv`?t.setDirection?t.setDirection(`sendonly`):t.direction=`sendonly`:t.direction===`recvonly`&&(t.setDirection?t.setDirection(`inactive`):t.direction=`inactive`):e.offerToReceiveAudio===!0&&!t&&this.addTransceiver(`audio`,{direction:`recvonly`}),e.offerToReceiveVideo!==void 0&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);let n=this.getTransceivers().find(e=>e.receiver.track.kind===`video`);e.offerToReceiveVideo===!1&&n?n.direction===`sendrecv`?n.setDirection?n.setDirection(`sendonly`):n.direction=`sendonly`:n.direction===`recvonly`&&(n.setDirection?n.setDirection(`inactive`):n.direction=`inactive`):e.offerToReceiveVideo===!0&&!n&&this.addTransceiver(`video`,{direction:`recvonly`})}return t.apply(this,arguments)}}function ze(e){typeof e!=`object`||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Be=e(((e,t)=>{var n={};n.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},n.localCName=n.generateIdentifier(),n.splitLines=function(e){return e.trim().split(` `).map(e=>e.trim())},n.splitSections=function(e){return e.split(` m=`).map((e,t)=>(t>0?`m=`+e:e).trim()+`\r `)},n.getDescription=function(e){let t=n.splitSections(e);return t&&t[0]},n.getMediaSections=function(e){let t=n.splitSections(e);return t.shift(),t},n.matchPrefix=function(e,t){return n.splitLines(e).filter(e=>e.indexOf(t)===0)},n.parseCandidate=function(e){let t;t=e.indexOf(`a=candidate:`)===0?e.substring(12).split(` `):e.substring(10).split(` `);let n={foundation:t[0],component:{1:`rtp`,2:`rtcp`}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let e=8;e{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self,n.html2canvas=r())})(e,(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}var n=function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&a[a.length-1]))&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]=55296&&i<=56319&&n>10)+55296,a%1024+56320)),(r+1===t||n.length>16384)&&(i+=String.fromCharCode.apply(String,n),n.length=0)}return i},d=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,f=typeof Uint8Array>`u`?[]:new Uint8Array(256),p=0;p`u`?[]:new Uint8Array(256),g=0;g>4,u[i++]=(o&15)<<4|s>>2,u[i++]=(s&3)<<6|c&63;return l},v=function(e){for(var t=e.length,n=[],r=0;r>b,T=(1<>b)+32,D=65536>>x,O=(1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>b],t=(t<>b)],t=(t<>x),t=this.index[t],t+=e>>b&O,t=this.index[t],t=(t<`u`?[]:new Uint8Array(256),oe=0;oece?(i.push(!0),o-=ce):i.push(!1),[`normal`,`auto`,`loose`].indexOf(t)!==-1&&[8208,8211,12316,12448].indexOf(e)!==-1)return r.push(a),n.push(Ce);if(o===fe||o===ve){if(a===0)return r.push(a),n.push(Ie);var s=n[a-1];return rt.indexOf(s)===-1?(r.push(r[a-1]),n.push(s)):(r.push(a),n.push(Ie))}if(r.push(a),o===Le)return n.push(t===`strict`?Oe:Ue);if(o===Je||o===Fe)return n.push(Ie);if(o===Ye)return e>=131072&&e<=196605||e>=196608&&e<=262141?n.push(Ue):n.push(Ie);n.push(o)}),[r,n,i]},st=function(e,t,n,r){var i=r[n];if(Array.isArray(e)?e.indexOf(i)!==-1:e===i)for(var a=n;a<=r.length;){a++;var o=r[a];if(o===t)return!0;if(o!==_e)break}if(i===_e)for(var a=n;a>0;){a--;var s=r[a];if(Array.isArray(e)?e.indexOf(s)!==-1:e===s)for(var c=n;c<=r.length;){c++;var o=r[c];if(o===t)return!0;if(o!==_e)break}if(s!==_e)break}return!1},ct=function(e,t){for(var n=e;n>=0;){var r=t[n];if(r===_e)n--;else return r}return 0},lt=function(e,t,n,r,i){if(n[r]===0)return A;var a=r-1;if(Array.isArray(i)&&i[a]===!0)return A;var o=a-1,s=a+1,c=t[a],l=o>=0?t[o]:0,u=t[s];if(c===ue&&u===de)return A;if(et.indexOf(c)!==-1)return Ze;if(et.indexOf(u)!==-1||tt.indexOf(u)!==-1)return A;if(ct(a,t)===he)return Qe;if($e.get(e[a])===ve||(c===Re||c===ze)&&$e.get(e[s])===ve||c===me||u===me||c===ge||[_e,be,Se].indexOf(c)===-1&&u===ge||[we,Te,Ee,je,Pe].indexOf(u)!==-1||ct(a,t)===ke||st(Ae,ke,a,t)||st([we,Te],Oe,a,t)||st(ye,ye,a,t))return A;if(c===_e)return Qe;if(c===Ae||u===Ae)return A;if(u===Ce||c===Ce)return Qe;if([be,Se,Oe].indexOf(u)!==-1||c===xe||l===He&&at.indexOf(c)!==-1||c===Pe&&u===He||u===De||j.indexOf(u)!==-1&&c===k||j.indexOf(c)!==-1&&u===k||c===Ne&&[Ue,Re,ze].indexOf(u)!==-1||[Ue,Re,ze].indexOf(c)!==-1&&u===Me||j.indexOf(c)!==-1&&nt.indexOf(u)!==-1||nt.indexOf(c)!==-1&&j.indexOf(u)!==-1||[Ne,Me].indexOf(c)!==-1&&(u===k||[ke,Se].indexOf(u)!==-1&&t[s+1]===k)||[ke,Se].indexOf(c)!==-1&&u===k||c===k&&[k,Pe,je].indexOf(u)!==-1)return A;if([k,Pe,je,we,Te].indexOf(u)!==-1)for(var d=a;d>=0;){var f=t[d];if(f===k)return A;if([Pe,je].indexOf(f)!==-1)d--;else break}if([Ne,Me].indexOf(u)!==-1)for(var d=[we,Te].indexOf(c)===-1?a:o;d>=0;){var f=t[d];if(f===k)return A;if([Pe,je].indexOf(f)!==-1)d--;else break}if(We===c&&[We,Ge,Be,Ve].indexOf(u)!==-1||[Ge,Be].indexOf(c)!==-1&&[Ge,Ke].indexOf(u)!==-1||[Ke,Ve].indexOf(c)!==-1&&u===Ke||it.indexOf(c)!==-1&&[De,Me].indexOf(u)!==-1||it.indexOf(u)!==-1&&c===Ne||j.indexOf(c)!==-1&&j.indexOf(u)!==-1||c===je&&j.indexOf(u)!==-1||j.concat(k).indexOf(c)!==-1&&u===ke&&Xe.indexOf(e[s])===-1||j.concat(k).indexOf(u)!==-1&&c===Te)return A;if(c===qe&&u===qe){for(var p=n[a],m=1;p>0&&(p--,t[p]===qe);)m++;if(m%2!=0)return A}return c===Re&&u===ze?A:Qe},ut=function(e,t){t||={lineBreak:`normal`,wordBreak:`normal`};var n=ot(e,t.lineBreak),r=n[0],i=n[1],a=n[2];(t.wordBreak===`break-all`||t.wordBreak===`break-word`)&&(i=i.map(function(e){return[k,Ie,Je].indexOf(e)===-1?e:Ue}));var o=t.wordBreak===`keep-all`?a.map(function(t,n){return t&&e[n]>=19968&&e[n]<=40959}):void 0;return[r,i,o]},dt=function(){function e(e,t,n,r){this.codePoints=e,this.required=t===Ze,this.start=n,this.end=r}return e.prototype.slice=function(){return u.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),ft=function(e,t){var n=l(e),r=ut(n,t),i=r[0],a=r[1],o=r[2],s=n.length,c=0,u=0;return{next:function(){if(u>=s)return{done:!0,value:null};for(var e=A;u=rn&&e<=57},hn=function(e){return e>=55296&&e<=57343},gn=function(e){return P(e)||e>=un&&e<=fn||e>=an&&e<=sn},_n=function(e){return e>=an&&e<=ln},vn=function(e){return e>=un&&e<=mn},yn=function(e){return _n(e)||vn(e)},bn=function(e){return e>=Ut},xn=function(e){return e===_t||e===bt||e===xt},Sn=function(e){return yn(e)||bn(e)||e===At},Cn=function(e){return Sn(e)||P(e)||e===M},wn=function(e){return e>=Zt&&e<=Qt||e===$t||e>=en&&e<=tn||e===nn},Tn=function(e,t){return e===yt?t!==_t:!1},En=function(e,t,n){return e===M?Sn(t)||Tn(t,n):Sn(e)?!0:!!(e===yt&&Tn(e,t))},Dn=function(e,t,n){return e===Kt||e===M?P(t)?!0:t===Xt&&P(n):P(e===Xt?t:e)},On=function(e){var t=0,n=1;(e[t]===Kt||e[t]===M)&&(e[t]===M&&(n=-1),t++);for(var r=[];P(e[t]);)r.push(e[t++]);var i=r.length?parseInt(u.apply(void 0,r),10):0;e[t]===Xt&&t++;for(var a=[];P(e[t]);)a.push(e[t++]);var o=a.length,s=o?parseInt(u.apply(void 0,a),10):0;(e[t]===dn||e[t]===on)&&t++;var c=1;(e[t]===Kt||e[t]===M)&&(e[t]===M&&(c=-1),t++);for(var l=[];P(e[t]);)l.push(e[t++]);var d=l.length?parseInt(u.apply(void 0,l),10):0;return n*(i+s*10**-o)*10**(c*d)},kn={type:2},An={type:3},jn={type:4},Mn={type:13},Nn={type:8},Pn={type:21},Fn={type:9},In={type:10},Ln={type:11},Rn={type:12},zn={type:14},Bn={type:23},Vn={type:1},Hn={type:25},Un={type:24},Wn={type:26},Gn={type:27},Kn={type:28},qn={type:29},Jn={type:31},Yn={type:32},Xn=function(){function e(){this._value=[]}return e.prototype.write=function(e){this._value=this._value.concat(l(e))},e.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==Yn;)e.push(t),t=this.consumeToken();return e},e.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case St:return this.consumeStringToken(St);case wt:var t=this.peekCodePoint(0),n=this.peekCodePoint(1),r=this.peekCodePoint(2);if(Cn(t)||Tn(n,r)){var i=En(t,n,r)?mt:pt,a=this.consumeName();return{type:5,value:a,flags:i}}break;case Tt:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),Mn;break;case Dt:return this.consumeStringToken(Dt);case Ot:return kn;case kt:return An;case Gt:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),zn;break;case Kt:if(Dn(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case qt:return jn;case M:var o=e,s=this.peekCodePoint(0),c=this.peekCodePoint(1);if(Dn(o,s,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(En(o,s,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(s===M&&c===Nt)return this.consumeCodePoint(),this.consumeCodePoint(),Un;break;case Xt:if(Dn(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case vt:if(this.peekCodePoint(0)===Gt)for(this.consumeCodePoint();;){var l=this.consumeCodePoint();if(l===Gt&&(l=this.consumeCodePoint(),l===vt)||l===N)return this.consumeToken()}break;case Jt:return Wn;case Yt:return Gn;case Mt:if(this.peekCodePoint(0)===jt&&this.peekCodePoint(1)===M&&this.peekCodePoint(2)===M)return this.consumeCodePoint(),this.consumeCodePoint(),Hn;break;case Pt:if(En(this.peekCodePoint(0),this.peekCodePoint(1),this.peekCodePoint(2))){var a=this.consumeName();return{type:7,value:a}}break;case Ft:return Kn;case yt:if(Tn(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case It:return qn;case Lt:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),Nn;break;case Rt:return Ln;case Bt:return Rn;case cn:case pn:var d=this.peekCodePoint(0),f=this.peekCodePoint(1);return d===Kt&&(gn(f)||f===zt)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case Vt:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),Fn;if(this.peekCodePoint(0)===Vt)return this.consumeCodePoint(),Pn;break;case Ht:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),In;break;case N:return Yn}return xn(e)?(this.consumeWhiteSpace(),Jn):P(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):Sn(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:u(e)}},e.prototype.consumeCodePoint=function(){var e=this._value.shift();return e===void 0?-1:e},e.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},e.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},e.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();gn(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var n=!1;t===zt&&e.length<6;)e.push(t),t=this.consumeCodePoint(),n=!0;if(n){var r=parseInt(u.apply(void 0,e.map(function(e){return e===zt?rn:e})),16),i=parseInt(u.apply(void 0,e.map(function(e){return e===zt?fn:e})),16);return{type:30,start:r,end:i}}var a=parseInt(u.apply(void 0,e),16);if(this.peekCodePoint(0)===M&&gn(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];gn(t)&&o.length<6;)o.push(t),t=this.consumeCodePoint();var i=parseInt(u.apply(void 0,o),16);return{type:30,start:a,end:i}}else return{type:30,start:a,end:a}},e.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()===`url`&&this.peekCodePoint(0)===Ot?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===Ot?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},e.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===N)return{type:22,value:``};var t=this.peekCodePoint(0);if(t===Dt||t===St){var n=this.consumeStringToken(this.consumeCodePoint());return n.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===N||this.peekCodePoint(0)===kt)?(this.consumeCodePoint(),{type:22,value:n.value}):(this.consumeBadUrlRemnants(),Bn)}for(;;){var r=this.consumeCodePoint();if(r===N||r===kt)return{type:22,value:u.apply(void 0,e)};if(xn(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===N||this.peekCodePoint(0)===kt?(this.consumeCodePoint(),{type:22,value:u.apply(void 0,e)}):(this.consumeBadUrlRemnants(),Bn);if(r===St||r===Dt||r===Ot||wn(r))return this.consumeBadUrlRemnants(),Bn;if(r===yt)if(Tn(r,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),Bn;else e.push(r)}},e.prototype.consumeWhiteSpace=function(){for(;xn(this.peekCodePoint(0));)this.consumeCodePoint()},e.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===kt||e===N)return;Tn(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},e.prototype.consumeStringSlice=function(e){for(var t=5e4,n=``;e>0;){var r=Math.min(t,e);n+=u.apply(void 0,this._value.splice(0,r)),e-=r}return this._value.shift(),n},e.prototype.consumeStringToken=function(e){var t=``,n=0;do{var r=this._value[n];if(r===N||r===void 0||r===e)return t+=this.consumeStringSlice(n),{type:0,value:t};if(r===_t)return this._value.splice(0,n),Vn;if(r===yt){var i=this._value[n+1];i!==N&&i!==void 0&&(i===_t?(t+=this.consumeStringSlice(n),n=-1,this._value.shift()):Tn(r,i)&&(t+=this.consumeStringSlice(n),t+=u(this.consumeEscapedCodePoint()),n=-1))}n++}while(!0)},e.prototype.consumeNumber=function(){var e=[],t=ht,n=this.peekCodePoint(0);for((n===Kt||n===M)&&e.push(this.consumeCodePoint());P(this.peekCodePoint(0));)e.push(this.consumeCodePoint());n=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(n===Xt&&P(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=gt;P(this.peekCodePoint(0));)e.push(this.consumeCodePoint());n=this.peekCodePoint(0),r=this.peekCodePoint(1);var i=this.peekCodePoint(2);if((n===dn||n===on)&&((r===Kt||r===M)&&P(i)||P(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=gt;P(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[On(e),t]},e.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],n=e[1],r=this.peekCodePoint(0);return En(r,this.peekCodePoint(1),this.peekCodePoint(2))?{type:15,number:t,flags:n,unit:this.consumeName()}:r===Et?(this.consumeCodePoint(),{type:16,number:t,flags:n}):{type:17,number:t,flags:n}},e.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(gn(e)){for(var t=u(e);gn(this.peekCodePoint(0))&&t.length<6;)t+=u(this.consumeCodePoint());xn(this.peekCodePoint(0))&&this.consumeCodePoint();var n=parseInt(t,16);return n===0||hn(n)||n>1114111?Wt:n}return e===N?Wt:e},e.prototype.consumeName=function(){for(var e=``;;){var t=this.consumeCodePoint();if(Cn(t))e+=u(t);else if(Tn(t,this.peekCodePoint(0)))e+=u(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},e}(),Zn=function(){function e(e){this._tokens=e}return e.create=function(t){var n=new Xn;return n.write(t),new e(n.read())},e.parseValue=function(t){return e.create(t).parseComponentValue()},e.parseValues=function(t){return e.create(t).parseComponentValues()},e.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw SyntaxError(`Error parsing CSS component value, unexpected EOF`);this.reconsumeToken(e);var t=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return t;throw SyntaxError(`Error parsing CSS component value, multiple values found when expecting only one`)},e.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},e.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},e.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},n=this.consumeToken();;){if(n.type===32||ir(n,e))return t;this.reconsumeToken(n),t.values.push(this.consumeComponentValue()),n=this.consumeToken()}},e.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var n=this.consumeToken();if(n.type===32||n.type===3)return t;this.reconsumeToken(n),t.values.push(this.consumeComponentValue())}},e.prototype.consumeToken=function(){var e=this._tokens.shift();return e===void 0?Yn:e},e.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},e}(),Qn=function(e){return e.type===15},$n=function(e){return e.type===17},F=function(e){return e.type===20},er=function(e){return e.type===0},tr=function(e,t){return F(e)&&e.value===t},nr=function(e){return e.type!==31},rr=function(e){return e.type!==31&&e.type!==4},I=function(e){var t=[],n=[];return e.forEach(function(e){if(e.type===4){if(n.length===0)throw Error(`Error parsing function args, zero tokens for arg`);t.push(n),n=[];return}e.type!==31&&n.push(e)}),n.length&&t.push(n),t},ir=function(e,t){return t===11&&e.type===12||t===28&&e.type===29?!0:t===2&&e.type===3},ar=function(e){return e.type===17||e.type===15},L=function(e){return e.type===16||ar(e)},or=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},R={type:17,number:0,flags:ht},sr={type:16,number:50,flags:ht},cr={type:16,number:100,flags:ht},lr=function(e,t,n){var r=e[0],i=e[1];return[z(r,t),z(i===void 0?r:i,n)]},z=function(e,t){if(e.type===16)return e.number/100*t;if(Qn(e))switch(e.unit){case`rem`:case`em`:return 16*e.number;case`px`:default:return e.number}return e.number},ur=`deg`,dr=`grad`,fr=`rad`,pr=`turn`,mr={name:`angle`,parse:function(e,t){if(t.type===15)switch(t.unit){case ur:return Math.PI*t.number/180;case dr:return Math.PI/200*t.number;case fr:return t.number;case pr:return Math.PI*2*t.number}throw Error(`Unsupported angle type`)}},hr=function(e){return e.type===15&&(e.unit===ur||e.unit===dr||e.unit===fr||e.unit===pr)},gr=function(e){switch(e.filter(F).map(function(e){return e.value}).join(` `)){case`to bottom right`:case`to right bottom`:case`left top`:case`top left`:return[R,R];case`to top`:case`bottom`:return B(0);case`to bottom left`:case`to left bottom`:case`right top`:case`top right`:return[R,cr];case`to right`:case`left`:return B(90);case`to top left`:case`to left top`:case`right bottom`:case`bottom right`:return[cr,cr];case`to bottom`:case`top`:return B(180);case`to top right`:case`to right top`:case`left bottom`:case`bottom left`:return[cr,R];case`to left`:case`right`:return B(270)}return 0},B=function(e){return Math.PI*e/180},_r={name:`color`,parse:function(e,t){if(t.type===18){var n=wr[t.name];if(n===void 0)throw Error(`Attempting to parse an unsupported color function "`+t.name+`"`);return n(e,t.values)}if(t.type===5){if(t.value.length===3){var r=t.value.substring(0,1),i=t.value.substring(1,2),a=t.value.substring(2,3);return yr(parseInt(r+r,16),parseInt(i+i,16),parseInt(a+a,16),1)}if(t.value.length===4){var r=t.value.substring(0,1),i=t.value.substring(1,2),a=t.value.substring(2,3),o=t.value.substring(3,4);return yr(parseInt(r+r,16),parseInt(i+i,16),parseInt(a+a,16),parseInt(o+o,16)/255)}if(t.value.length===6){var r=t.value.substring(0,2),i=t.value.substring(2,4),a=t.value.substring(4,6);return yr(parseInt(r,16),parseInt(i,16),parseInt(a,16),1)}if(t.value.length===8){var r=t.value.substring(0,2),i=t.value.substring(2,4),a=t.value.substring(4,6),o=t.value.substring(6,8);return yr(parseInt(r,16),parseInt(i,16),parseInt(a,16),parseInt(o,16)/255)}}if(t.type===20){var s=H[t.value.toUpperCase()];if(s!==void 0)return s}return H.TRANSPARENT}},vr=function(e){return(255&e)==0},V=function(e){var t=255&e,n=255&e>>8,r=255&e>>16,i=255&e>>24;return t<255?`rgba(`+i+`,`+r+`,`+n+`,`+t/255+`)`:`rgb(`+i+`,`+r+`,`+n+`)`},yr=function(e,t,n,r){return(e<<24|t<<16|n<<8|Math.round(r*255)<<0)>>>0},br=function(e,t){if(e.type===17)return e.number;if(e.type===16){var n=t===3?1:255;return t===3?e.number/100*n:Math.round(e.number/100*n)}return 0},xr=function(e,t){var n=t.filter(rr);if(n.length===3){var r=n.map(br),i=r[0],a=r[1],o=r[2];return yr(i,a,o,1)}if(n.length===4){var s=n.map(br),i=s[0],a=s[1],o=s[2],c=s[3];return yr(i,a,o,c)}return 0};function Sr(e,t,n){return n<0&&(n+=1),n>=1&&--n,n<1/6?(t-e)*n*6+e:n<1/2?t:n<2/3?(t-e)*6*(2/3-n)+e:e}var Cr=function(e,t){var n=t.filter(rr),r=n[0],i=n[1],a=n[2],o=n[3],s=(r.type===17?B(r.number):mr.parse(e,r))/(Math.PI*2),c=L(i)?i.number/100:0,l=L(a)?a.number/100:0,u=o!==void 0&&L(o)?z(o,1):1;if(c===0)return yr(l*255,l*255,l*255,1);var d=l<=.5?l*(c+1):l+c-l*c,f=l*2-d,p=Sr(f,d,s+1/3),m=Sr(f,d,s),h=Sr(f,d,s-1/3);return yr(p*255,m*255,h*255,u)},wr={hsl:Cr,hsla:Cr,rgb:xr,rgba:xr},Tr=function(e,t){return _r.parse(e,Zn.create(t).parseComponentValue())},H={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},Er={name:`background-clip`,initialValue:`border-box`,prefix:!1,type:1,parse:function(e,t){return t.map(function(e){if(F(e))switch(e.value){case`padding-box`:return 1;case`content-box`:return 2}return 0})}},Dr={name:`background-color`,initialValue:`transparent`,prefix:!1,type:3,format:`color`},Or=function(e,t){var n=_r.parse(e,t[0]),r=t[1];return r&&L(r)?{color:n,stop:r}:{color:n,stop:null}},kr=function(e,t){var n=e[0],r=e[e.length-1];n.stop===null&&(n.stop=R),r.stop===null&&(r.stop=cr);for(var i=[],a=0,o=0;oa?i.push(c):i.push(a),a=c}else i.push(null)}for(var l=null,o=0;oe.optimumDistance)?{optimumCorner:t,optimumDistance:s}:e},{optimumDistance:i?1/0:-1/0,optimumCorner:null}).optimumCorner},Nr=function(e,t,n,r,i){var a=0,o=0;switch(e.size){case 0:e.shape===0?a=o=Math.min(Math.abs(t),Math.abs(t-r),Math.abs(n),Math.abs(n-i)):e.shape===1&&(a=Math.min(Math.abs(t),Math.abs(t-r)),o=Math.min(Math.abs(n),Math.abs(n-i)));break;case 2:if(e.shape===0)a=o=Math.min(U(t,n),U(t,n-i),U(t-r,n),U(t-r,n-i));else if(e.shape===1){var s=Math.min(Math.abs(n),Math.abs(n-i))/Math.min(Math.abs(t),Math.abs(t-r)),c=Mr(r,i,t,n,!0),l=c[0],u=c[1];a=U(l-t,(u-n)/s),o=s*a}break;case 1:e.shape===0?a=o=Math.max(Math.abs(t),Math.abs(t-r),Math.abs(n),Math.abs(n-i)):e.shape===1&&(a=Math.max(Math.abs(t),Math.abs(t-r)),o=Math.max(Math.abs(n),Math.abs(n-i)));break;case 3:if(e.shape===0)a=o=Math.max(U(t,n),U(t,n-i),U(t-r,n),U(t-r,n-i));else if(e.shape===1){var s=Math.max(Math.abs(n),Math.abs(n-i))/Math.max(Math.abs(t),Math.abs(t-r)),d=Mr(r,i,t,n,!1),l=d[0],u=d[1];a=U(l-t,(u-n)/s),o=s*a}break}return Array.isArray(e.size)&&(a=z(e.size[0],r),o=e.size.length===2?z(e.size[1],i):a),[a,o]},Pr=function(e,t){var n=B(180),r=[];return I(t).forEach(function(t,i){if(i===0){var a=t[0];if(a.type===20&&a.value===`to`){n=gr(t);return}else if(hr(a)){n=mr.parse(e,a);return}}var o=Or(e,t);r.push(o)}),{angle:n,stops:r,type:1}},Fr=function(e,t){var n=B(180),r=[];return I(t).forEach(function(t,i){if(i===0){var a=t[0];if(a.type===20&&[`top`,`left`,`right`,`bottom`].indexOf(a.value)!==-1){n=gr(t);return}else if(hr(a)){n=(mr.parse(e,a)+B(270))%B(360);return}}var o=Or(e,t);r.push(o)}),{angle:n,stops:r,type:1}},Ir=function(e,t){var n=B(180),r=[],i=1;return I(t).forEach(function(t,n){var a=t[0];if(n===0){if(F(a)&&a.value===`linear`){i=1;return}else if(F(a)&&a.value===`radial`){i=2;return}}if(a.type===18){if(a.name===`from`){var o=_r.parse(e,a.values[0]);r.push({stop:R,color:o})}else if(a.name===`to`){var o=_r.parse(e,a.values[0]);r.push({stop:cr,color:o})}else if(a.name===`color-stop`){var s=a.values.filter(rr);if(s.length===2){var o=_r.parse(e,s[1]),c=s[0];$n(c)&&r.push({stop:{type:16,number:c.number*100,flags:c.flags},color:o})}}}}),i===1?{angle:(n+B(180))%B(360),stops:r,type:i}:{size:3,shape:0,stops:r,position:[],type:i}},Lr=`closest-side`,Rr=`farthest-side`,zr=`closest-corner`,Br=`farthest-corner`,Vr=`circle`,Hr=`ellipse`,Ur=`cover`,Wr=`contain`,Gr=function(e,t){var n=0,r=3,i=[],a=[];return I(t).forEach(function(t,o){var s=!0;if(o===0){var c=!1;s=t.reduce(function(e,t){if(c)if(F(t))switch(t.value){case`center`:return a.push(sr),e;case`top`:case`left`:return a.push(R),e;case`right`:case`bottom`:return a.push(cr),e}else (L(t)||ar(t))&&a.push(t);else if(F(t))switch(t.value){case Vr:return n=0,!1;case Hr:return n=1,!1;case`at`:return c=!0,!1;case Lr:return r=0,!1;case Ur:case Rr:return r=1,!1;case Wr:case zr:return r=2,!1;case Br:return r=3,!1}else if(ar(t)||L(t))return Array.isArray(r)||(r=[]),r.push(t),!1;return e},s)}if(s){var l=Or(e,t);i.push(l)}}),{size:r,shape:n,stops:i,position:a,type:2}},Kr=function(e,t){var n=0,r=3,i=[],a=[];return I(t).forEach(function(t,o){var s=!0;if(o===0?s=t.reduce(function(e,t){if(F(t))switch(t.value){case`center`:return a.push(sr),!1;case`top`:case`left`:return a.push(R),!1;case`right`:case`bottom`:return a.push(cr),!1}else if(L(t)||ar(t))return a.push(t),!1;return e},s):o===1&&(s=t.reduce(function(e,t){if(F(t))switch(t.value){case Vr:return n=0,!1;case Hr:return n=1,!1;case Wr:case Lr:return r=0,!1;case Rr:return r=1,!1;case zr:return r=2,!1;case Ur:case Br:return r=3,!1}else if(ar(t)||L(t))return Array.isArray(r)||(r=[]),r.push(t),!1;return e},s)),s){var c=Or(e,t);i.push(c)}}),{size:r,shape:n,stops:i,position:a,type:2}},qr=function(e){return e.type===1},Jr=function(e){return e.type===2},Yr={name:`image`,parse:function(e,t){if(t.type===22){var n={url:t.value,type:0};return e.cache.addImage(t.value),n}if(t.type===18){var r=Zr[t.name];if(r===void 0)throw Error(`Attempting to parse an unsupported image function "`+t.name+`"`);return r(e,t.values)}throw Error(`Unsupported image type `+t.type)}};function Xr(e){return!(e.type===20&&e.value===`none`)&&(e.type!==18||!!Zr[e.name])}var Zr={"linear-gradient":Pr,"-moz-linear-gradient":Fr,"-ms-linear-gradient":Fr,"-o-linear-gradient":Fr,"-webkit-linear-gradient":Fr,"radial-gradient":Gr,"-moz-radial-gradient":Kr,"-ms-radial-gradient":Kr,"-o-radial-gradient":Kr,"-webkit-radial-gradient":Kr,"-webkit-gradient":Ir},Qr={name:`background-image`,initialValue:`none`,type:1,prefix:!1,parse:function(e,t){if(t.length===0)return[];var n=t[0];return n.type===20&&n.value===`none`?[]:t.filter(function(e){return rr(e)&&Xr(e)}).map(function(t){return Yr.parse(e,t)})}},$r={name:`background-origin`,initialValue:`border-box`,prefix:!1,type:1,parse:function(e,t){return t.map(function(e){if(F(e))switch(e.value){case`padding-box`:return 1;case`content-box`:return 2}return 0})}},ei={name:`background-position`,initialValue:`0% 0%`,type:1,prefix:!1,parse:function(e,t){return I(t).map(function(e){return e.filter(L)}).map(or)}},ti={name:`background-repeat`,initialValue:`repeat`,prefix:!1,type:1,parse:function(e,t){return I(t).map(function(e){return e.filter(F).map(function(e){return e.value}).join(` `)}).map(ni)}},ni=function(e){switch(e){case`no-repeat`:return 1;case`repeat-x`:case`repeat no-repeat`:return 2;case`repeat-y`:case`no-repeat repeat`:return 3;case`repeat`:default:return 0}},ri;(function(e){e.AUTO=`auto`,e.CONTAIN=`contain`,e.COVER=`cover`})(ri||={});var ii={name:`background-size`,initialValue:`0`,prefix:!1,type:1,parse:function(e,t){return I(t).map(function(e){return e.filter(ai)})}},ai=function(e){return F(e)||L(e)},oi=function(e){return{name:`border-`+e+`-color`,initialValue:`transparent`,prefix:!1,type:3,format:`color`}},si=oi(`top`),ci=oi(`right`),li=oi(`bottom`),ui=oi(`left`),di=function(e){return{name:`border-radius-`+e,initialValue:`0 0`,prefix:!1,type:1,parse:function(e,t){return or(t.filter(L))}}},fi=di(`top-left`),pi=di(`top-right`),mi=di(`bottom-right`),hi=di(`bottom-left`),gi=function(e){return{name:`border-`+e+`-style`,initialValue:`solid`,prefix:!1,type:2,parse:function(e,t){switch(t){case`none`:return 0;case`dashed`:return 2;case`dotted`:return 3;case`double`:return 4}return 1}}},_i=gi(`top`),vi=gi(`right`),yi=gi(`bottom`),bi=gi(`left`),xi=function(e){return{name:`border-`+e+`-width`,initialValue:`0`,type:0,prefix:!1,parse:function(e,t){return Qn(t)?t.number:0}}},Si=xi(`top`),Ci=xi(`right`),wi=xi(`bottom`),Ti=xi(`left`),Ei={name:`color`,initialValue:`transparent`,prefix:!1,type:3,format:`color`},Di={name:`direction`,initialValue:`ltr`,prefix:!1,type:2,parse:function(e,t){switch(t){case`rtl`:return 1;case`ltr`:default:return 0}}},Oi={name:`display`,initialValue:`inline-block`,prefix:!1,type:1,parse:function(e,t){return t.filter(F).reduce(function(e,t){return e|ki(t.value)},0)}},ki=function(e){switch(e){case`block`:case`-webkit-box`:return 2;case`inline`:return 4;case`run-in`:return 8;case`flow`:return 16;case`flow-root`:return 32;case`table`:return 64;case`flex`:case`-webkit-flex`:return 128;case`grid`:case`-ms-grid`:return 256;case`ruby`:return 512;case`subgrid`:return 1024;case`list-item`:return 2048;case`table-row-group`:return 4096;case`table-header-group`:return 8192;case`table-footer-group`:return 16384;case`table-row`:return 32768;case`table-cell`:return 65536;case`table-column-group`:return 131072;case`table-column`:return 262144;case`table-caption`:return 524288;case`ruby-base`:return 1048576;case`ruby-text`:return 2097152;case`ruby-base-container`:return 4194304;case`ruby-text-container`:return 8388608;case`contents`:return 16777216;case`inline-block`:return 33554432;case`inline-list-item`:return 67108864;case`inline-table`:return 134217728;case`inline-flex`:return 268435456;case`inline-grid`:return 536870912}return 0},Ai={name:`float`,initialValue:`none`,prefix:!1,type:2,parse:function(e,t){switch(t){case`left`:return 1;case`right`:return 2;case`inline-start`:return 3;case`inline-end`:return 4}return 0}},ji={name:`letter-spacing`,initialValue:`0`,prefix:!1,type:0,parse:function(e,t){return t.type===20&&t.value===`normal`?0:t.type===17||t.type===15?t.number:0}},Mi;(function(e){e.NORMAL=`normal`,e.STRICT=`strict`})(Mi||={});var Ni={name:`line-break`,initialValue:`normal`,prefix:!1,type:2,parse:function(e,t){switch(t){case`strict`:return Mi.STRICT;case`normal`:default:return Mi.NORMAL}}},Pi={name:`line-height`,initialValue:`normal`,prefix:!1,type:4},Fi=function(e,t){return F(e)&&e.value===`normal`?1.2*t:e.type===17?t*e.number:L(e)?z(e,t):t},Ii={name:`list-style-image`,initialValue:`none`,type:0,prefix:!1,parse:function(e,t){return t.type===20&&t.value===`none`?null:Yr.parse(e,t)}},Li={name:`list-style-position`,initialValue:`outside`,prefix:!1,type:2,parse:function(e,t){switch(t){case`inside`:return 0;case`outside`:default:return 1}}},Ri={name:`list-style-type`,initialValue:`none`,prefix:!1,type:2,parse:function(e,t){switch(t){case`disc`:return 0;case`circle`:return 1;case`square`:return 2;case`decimal`:return 3;case`cjk-decimal`:return 4;case`decimal-leading-zero`:return 5;case`lower-roman`:return 6;case`upper-roman`:return 7;case`lower-greek`:return 8;case`lower-alpha`:return 9;case`upper-alpha`:return 10;case`arabic-indic`:return 11;case`armenian`:return 12;case`bengali`:return 13;case`cambodian`:return 14;case`cjk-earthly-branch`:return 15;case`cjk-heavenly-stem`:return 16;case`cjk-ideographic`:return 17;case`devanagari`:return 18;case`ethiopic-numeric`:return 19;case`georgian`:return 20;case`gujarati`:return 21;case`gurmukhi`:return 22;case`hebrew`:return 22;case`hiragana`:return 23;case`hiragana-iroha`:return 24;case`japanese-formal`:return 25;case`japanese-informal`:return 26;case`kannada`:return 27;case`katakana`:return 28;case`katakana-iroha`:return 29;case`khmer`:return 30;case`korean-hangul-formal`:return 31;case`korean-hanja-formal`:return 32;case`korean-hanja-informal`:return 33;case`lao`:return 34;case`lower-armenian`:return 35;case`malayalam`:return 36;case`mongolian`:return 37;case`myanmar`:return 38;case`oriya`:return 39;case`persian`:return 40;case`simp-chinese-formal`:return 41;case`simp-chinese-informal`:return 42;case`tamil`:return 43;case`telugu`:return 44;case`thai`:return 45;case`tibetan`:return 46;case`trad-chinese-formal`:return 47;case`trad-chinese-informal`:return 48;case`upper-armenian`:return 49;case`disclosure-open`:return 50;case`disclosure-closed`:return 51;case`none`:default:return-1}}},zi=function(e){return{name:`margin-`+e,initialValue:`0`,prefix:!1,type:4}},Bi=zi(`top`),Vi=zi(`right`),Hi=zi(`bottom`),Ui=zi(`left`),Wi={name:`overflow`,initialValue:`visible`,prefix:!1,type:1,parse:function(e,t){return t.filter(F).map(function(e){switch(e.value){case`hidden`:return 1;case`scroll`:return 2;case`clip`:return 3;case`auto`:return 4;case`visible`:default:return 0}})}},Gi={name:`overflow-wrap`,initialValue:`normal`,prefix:!1,type:2,parse:function(e,t){switch(t){case`break-word`:return`break-word`;case`normal`:default:return`normal`}}},Ki=function(e){return{name:`padding-`+e,initialValue:`0`,prefix:!1,type:3,format:`length-percentage`}},qi=Ki(`top`),Ji=Ki(`right`),Yi=Ki(`bottom`),Xi=Ki(`left`),Zi={name:`text-align`,initialValue:`left`,prefix:!1,type:2,parse:function(e,t){switch(t){case`right`:return 2;case`center`:case`justify`:return 1;case`left`:default:return 0}}},Qi={name:`position`,initialValue:`static`,prefix:!1,type:2,parse:function(e,t){switch(t){case`relative`:return 1;case`absolute`:return 2;case`fixed`:return 3;case`sticky`:return 4}return 0}},$i={name:`text-shadow`,initialValue:`none`,type:1,prefix:!1,parse:function(e,t){return t.length===1&&tr(t[0],`none`)?[]:I(t).map(function(t){for(var n={color:H.TRANSPARENT,offsetX:R,offsetY:R,blur:R},r=0,i=0;i1?1:0],this.overflowWrap=G(e,Gi,t.overflowWrap),this.paddingTop=G(e,qi,t.paddingTop),this.paddingRight=G(e,Ji,t.paddingRight),this.paddingBottom=G(e,Yi,t.paddingBottom),this.paddingLeft=G(e,Xi,t.paddingLeft),this.paintOrder=G(e,Ea,t.paintOrder),this.position=G(e,Qi,t.position),this.textAlign=G(e,Zi,t.textAlign),this.textDecorationColor=G(e,fa,t.textDecorationColor??t.color),this.textDecorationLine=G(e,pa,t.textDecorationLine??t.textDecoration),this.textShadow=G(e,$i,t.textShadow),this.textTransform=G(e,ea,t.textTransform),this.transform=G(e,ta,t.transform),this.transformOrigin=G(e,aa,t.transformOrigin),this.visibility=G(e,oa,t.visibility),this.webkitTextStrokeColor=G(e,Da,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=G(e,Oa,t.webkitTextStrokeWidth),this.wordBreak=G(e,ca,t.wordBreak),this.zIndex=G(e,la,t.zIndex)}return e.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},e.prototype.isTransparent=function(){return vr(this.backgroundColor)},e.prototype.isTransformed=function(){return this.transform!==null},e.prototype.isPositioned=function(){return this.position!==0},e.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},e.prototype.isFloating=function(){return this.float!==0},e.prototype.isInlineLevel=function(){return W(this.display,4)||W(this.display,33554432)||W(this.display,268435456)||W(this.display,536870912)||W(this.display,67108864)||W(this.display,134217728)},e}(),Aa=function(){function e(e,t){this.content=G(e,ya,t.content),this.quotes=G(e,Ca,t.quotes)}return e}(),ja=function(){function e(e,t){this.counterIncrement=G(e,ba,t.counterIncrement),this.counterReset=G(e,xa,t.counterReset)}return e}(),G=function(e,t,n){var r=new Xn,i=n==null?t.initialValue:n.toString();r.write(i);var a=new Zn(r.read());switch(t.type){case 2:var o=a.parseComponentValue();return t.parse(e,F(o)?o.value:t.initialValue);case 0:return t.parse(e,a.parseComponentValue());case 1:return t.parse(e,a.parseComponentValues());case 4:return a.parseComponentValue();case 3:switch(t.format){case`angle`:return mr.parse(e,a.parseComponentValue());case`color`:return _r.parse(e,a.parseComponentValue());case`image`:return Yr.parse(e,a.parseComponentValue());case`length`:var s=a.parseComponentValue();return ar(s)?s:R;case`length-percentage`:var c=a.parseComponentValue();return L(c)?c:R;case`time`:return ua.parse(e,a.parseComponentValue())}break}},Ma=`data-html2canvas-debug`,Na=function(e){switch(e.getAttribute(Ma)){case`all`:return 1;case`clone`:return 2;case`parse`:return 3;case`render`:return 4;default:return 0}},Pa=function(e,t){var n=Na(e);return n===1||t===n},K=function(){function e(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Pa(t,3))debugger;this.styles=new ka(e,window.getComputedStyle(t,null)),xs(t)&&(this.styles.animationDuration.some(function(e){return e>0})&&(t.style.animationDuration=`0s`),this.styles.transform!==null&&(t.style.transform=`none`)),this.bounds=s(this.context,t),Pa(t,4)&&(this.flags|=16)}return e}(),Fa=`AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=`,Ia=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,La=typeof Uint8Array>`u`?[]:new Uint8Array(256),Ra=0;Ra>4,u[i++]=(o&15)<<4|s>>2,u[i++]=(s&3)<<6|c&63;return l},Ba=function(e){for(var t=e.length,n=[],r=0;r>Ha,qa=(1<>Ha)+32,Ya=65536>>Ua,Xa=(1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Ha],t=(t<>Ha)],t=(t<>Ua),t=this.index[t],t+=e>>Ha&Xa,t=this.index[t],t=(t<`u`?[]:new Uint8Array(256),ro=0;ro=55296&&i<=56319&&n>10)+55296,a%1024+56320)),(r+1===t||n.length>16384)&&(i+=String.fromCharCode.apply(String,n),n.length=0)}return i},xo=$a(Fa),So=`×`,Co=`÷`,wo=function(e){return xo.get(e)},To=function(e,t,n){var r=n-2,i=t[r],a=t[n-1],o=t[n];if(a===ao&&o===oo)return So;if(a===ao||a===oo||a===so||o===ao||o===oo||o===so)return Co;if(a===uo&&[uo,fo,mo,ho].indexOf(o)!==-1||(a===mo||a===fo)&&(o===fo||o===po)||(a===ho||a===po)&&o===po||o===go||o===co||o===lo||a===io)return So;if(a===go&&o===_o){for(;i===co;)i=t[--r];if(i===_o)return So}if(a===vo&&o===vo){for(var s=0;i===vo;)s++,i=t[--r];if(s%2==0)return So}return Co},Eo=function(e){var t=yo(e),n=t.length,r=0,i=0,a=t.map(wo);return{next:function(){if(r>=n)return{done:!0,value:null};for(var e=So;ro.x||i.y>o.y;return o=i,t===0?!0:s});return e.body.removeChild(t),s},Ao=function(){return new Image().crossOrigin!==void 0},jo=function(){return typeof new XMLHttpRequest().responseType==`string`},Mo=function(e){var t=new Image,n=e.createElement(`canvas`),r=n.getContext(`2d`);if(!r)return!1;t.src=`data:image/svg+xml,`;try{r.drawImage(t,0,0),n.toDataURL()}catch{return!1}return!0},No=function(e){return e[0]===0&&e[1]===255&&e[2]===0&&e[3]===255},Po=function(e){var t=e.createElement(`canvas`),n=100;t.width=n,t.height=n;var r=t.getContext(`2d`);if(!r)return Promise.reject(!1);r.fillStyle=`rgb(0, 255, 0)`,r.fillRect(0,0,n,n);var i=new Image,a=t.toDataURL();i.src=a;var o=Fo(n,n,0,0,i);return r.fillStyle=`red`,r.fillRect(0,0,n,n),Io(o).then(function(t){r.drawImage(t,0,0);var i=r.getImageData(0,0,n,n).data;r.fillStyle=`red`,r.fillRect(0,0,n,n);var o=e.createElement(`div`);return o.style.backgroundImage=`url(`+a+`)`,o.style.height=n+`px`,No(i)?Io(Fo(n,n,0,0,o)):Promise.reject(!1)}).then(function(e){return r.drawImage(e,0,0),No(r.getImageData(0,0,n,n).data)}).catch(function(){return!1})},Fo=function(e,t,n,r,i){var a=`http://www.w3.org/2000/svg`,o=document.createElementNS(a,`svg`),s=document.createElementNS(a,`foreignObject`);return o.setAttributeNS(null,`width`,e.toString()),o.setAttributeNS(null,`height`,t.toString()),s.setAttributeNS(null,`width`,`100%`),s.setAttributeNS(null,`height`,`100%`),s.setAttributeNS(null,`x`,n.toString()),s.setAttributeNS(null,`y`,r.toString()),s.setAttributeNS(null,`externalResourcesRequired`,`true`),o.appendChild(s),s.appendChild(i),o},Io=function(e){return new Promise(function(t,n){var r=new Image;r.onload=function(){return t(r)},r.onerror=n,r.src=`data:image/svg+xml;charset=utf-8,`+encodeURIComponent(new XMLSerializer().serializeToString(e))})},q={get SUPPORT_RANGE_BOUNDS(){var e=Oo(document);return Object.defineProperty(q,`SUPPORT_RANGE_BOUNDS`,{value:e}),e},get SUPPORT_WORD_BREAKING(){var e=q.SUPPORT_RANGE_BOUNDS&&ko(document);return Object.defineProperty(q,`SUPPORT_WORD_BREAKING`,{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=Mo(document);return Object.defineProperty(q,`SUPPORT_SVG_DRAWING`,{value:e}),e},get SUPPORT_FOREIGNOBJECT_DRAWING(){var e=typeof Array.from==`function`&&typeof window.fetch==`function`?Po(document):Promise.resolve(!1);return Object.defineProperty(q,`SUPPORT_FOREIGNOBJECT_DRAWING`,{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=Ao();return Object.defineProperty(q,`SUPPORT_CORS_IMAGES`,{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e=jo();return Object.defineProperty(q,`SUPPORT_RESPONSE_TYPE`,{value:e}),e},get SUPPORT_CORS_XHR(){var e=`withCredentials`in new XMLHttpRequest;return Object.defineProperty(q,`SUPPORT_CORS_XHR`,{value:e}),e},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var e=!!(typeof Intl<`u`&&Intl.Segmenter);return Object.defineProperty(q,`SUPPORT_NATIVE_TEXT_SEGMENTATION`,{value:e}),e}},Lo=function(){function e(e,t){this.text=e,this.bounds=t}return e}(),Ro=function(e,t,n,r){var i=Uo(t,n),a=[],s=0;return i.forEach(function(t){if(n.textDecorationLine.length||t.trim().length>0)if(q.SUPPORT_RANGE_BOUNDS){var i=Bo(r,s,t.length).getClientRects();if(i.length>1){var c=Vo(t),l=0;c.forEach(function(t){a.push(new Lo(t,o.fromDOMRectList(e,Bo(r,l+s,t.length).getClientRects()))),l+=t.length})}else a.push(new Lo(t,o.fromDOMRectList(e,i)))}else{var u=r.splitText(t.length);a.push(new Lo(t,zo(e,r))),r=u}else q.SUPPORT_RANGE_BOUNDS||(r=r.splitText(t.length));s+=t.length}),a},zo=function(e,t){var n=t.ownerDocument;if(n){var r=n.createElement(`html2canvaswrapper`);r.appendChild(t.cloneNode(!0));var i=t.parentNode;if(i){i.replaceChild(r,t);var a=s(e,r);return r.firstChild&&i.replaceChild(r.firstChild,r),a}}return o.EMPTY},Bo=function(e,t,n){var r=e.ownerDocument;if(!r)throw Error(`Node has no owner document`);var i=r.createRange();return i.setStart(e,t),i.setEnd(e,t+n),i},Vo=function(e){if(q.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:`grapheme`});return Array.from(t.segment(e)).map(function(e){return e.segment})}return Do(e)},Ho=function(e,t){if(q.SUPPORT_NATIVE_TEXT_SEGMENTATION){var n=new Intl.Segmenter(void 0,{granularity:`word`});return Array.from(n.segment(e)).map(function(e){return e.segment})}return Go(e,t)},Uo=function(e,t){return t.letterSpacing===0?Ho(e,t):Vo(e)},Wo=[32,160,4961,65792,65793,4153,4241],Go=function(e,t){for(var n=ft(e,{lineBreak:t.lineBreak,wordBreak:t.overflowWrap===`break-word`?`break-word`:t.wordBreak}),r=[],i,a=function(){if(i.value){var e=l(i.value.slice()),t=``;e.forEach(function(e){Wo.indexOf(e)===-1?t+=u(e):(t.length&&r.push(t),r.push(u(e)),t=``)}),t.length&&r.push(t)}};!(i=n.next()).done;)a();return r},Ko=function(){function e(e,t,n){this.text=qo(t.data,n.textTransform),this.textBounds=Ro(e,this.text,n,t)}return e}(),qo=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(Jo,Yo);case 2:return e.toUpperCase();default:return e}},Jo=/(^|\s|:|-|\(|\))([a-z])/g,Yo=function(e,t,n){return e.length>0?t+n.toUpperCase():e},Xo=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.src=n.currentSrc||n.src,r.intrinsicWidth=n.naturalWidth,r.intrinsicHeight=n.naturalHeight,r.context.cache.addImage(r.src),r}return n}(K),Zo=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.canvas=n,r.intrinsicWidth=n.width,r.intrinsicHeight=n.height,r}return n}(K),Qo=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this,i=new XMLSerializer,a=s(t,n);return n.setAttribute(`width`,a.width+`px`),n.setAttribute(`height`,a.height+`px`),r.svg=`data:image/svg+xml,`+encodeURIComponent(i.serializeToString(n)),r.intrinsicWidth=n.width.baseVal.value,r.intrinsicHeight=n.height.baseVal.value,r.context.cache.addImage(r.svg),r}return n}(K),$o=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.value=n.value,r}return n}(K),es=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.start=n.start,r.reversed=typeof n.reversed==`boolean`&&n.reversed===!0,r}return n}(K),ts=[{type:15,flags:0,unit:`px`,number:3}],ns=[{type:16,flags:0,number:50}],rs=function(e){return e.width>e.height?new o(e.left+(e.width-e.height)/2,e.top,e.height,e.height):e.width0)n.textNodes.push(new Ko(e,i,n.styles));else if(bs(i))if(Ls(i)&&i.assignedNodes)i.assignedNodes().forEach(function(t){return ms(e,t,n,r)});else{var o=hs(e,i);o.styles.isVisible()&&(_s(i,o,r)?o.flags|=4:vs(o.styles)&&(o.flags|=2),ps.indexOf(i.tagName)!==-1&&(o.flags|=8),n.elements.push(o),i.slot,i.shadowRoot?ms(e,i.shadowRoot,o,r):!Fs(i)&&!Ds(i)&&!Is(i)&&ms(e,i,o,r))}},hs=function(e,t){return js(t)?new Xo(e,t):ks(t)?new Zo(e,t):Ds(t)?new Qo(e,t):Cs(t)?new $o(e,t):ws(t)?new es(e,t):Ts(t)?new ls(e,t):Is(t)?new us(e,t):Fs(t)?new ds(e,t):Ms(t)?new fs(e,t):new K(e,t)},gs=function(e,t){var n=hs(e,t);return n.flags|=4,ms(e,t,n,n),n},_s=function(e,t,n){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||Os(e)&&n.styles.isTransparent()},vs=function(e){return e.isPositioned()||e.isFloating()},ys=function(e){return e.nodeType===Node.TEXT_NODE},bs=function(e){return e.nodeType===Node.ELEMENT_NODE},xs=function(e){return bs(e)&&e.style!==void 0&&!Ss(e)},Ss=function(e){return typeof e.className==`object`},Cs=function(e){return e.tagName===`LI`},ws=function(e){return e.tagName===`OL`},Ts=function(e){return e.tagName===`INPUT`},Es=function(e){return e.tagName===`HTML`},Ds=function(e){return e.tagName===`svg`},Os=function(e){return e.tagName===`BODY`},ks=function(e){return e.tagName===`CANVAS`},As=function(e){return e.tagName===`VIDEO`},js=function(e){return e.tagName===`IMG`},Ms=function(e){return e.tagName===`IFRAME`},Ns=function(e){return e.tagName===`STYLE`},Ps=function(e){return e.tagName===`SCRIPT`},Fs=function(e){return e.tagName===`TEXTAREA`},Is=function(e){return e.tagName===`SELECT`},Ls=function(e){return e.tagName===`SLOT`},Rs=function(e){return e.tagName.indexOf(`-`)>0},zs=function(){function e(){this.counters={}}return e.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},e.prototype.getCounterValues=function(e){return this.counters[e]||[]},e.prototype.pop=function(e){var t=this;e.forEach(function(e){return t.counters[e].pop()})},e.prototype.parse=function(e){var t=this,n=e.counterIncrement,r=e.counterReset,i=!0;n!==null&&n.forEach(function(e){var n=t.counters[e.counter];n&&e.increment!==0&&(i=!1,n.length||n.push(1),n[Math.max(0,n.length-1)]+=e.increment)});var a=[];return i&&r.forEach(function(e){var n=t.counters[e.counter];a.push(e.counter),n||=t.counters[e.counter]=[],n.push(e.reset)}),a},e}(),Bs={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:[`M`,`CM`,`D`,`CD`,`C`,`XC`,`L`,`XL`,`X`,`IX`,`V`,`IV`,`I`]},Vs={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:`Ք.Փ.Ւ.Ց.Ր.Տ.Վ.Ս.Ռ.Ջ.Պ.Չ.Ո.Շ.Ն.Յ.Մ.Ճ.Ղ.Ձ.Հ.Կ.Ծ.Խ.Լ.Ի.Ժ.Թ.Ը.Է.Զ.Ե.Դ.Գ.Բ.Ա`.split(`.`)},Hs={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:`י׳.ט׳.ח׳.ז׳.ו׳.ה׳.ד׳.ג׳.ב׳.א׳.ת.ש.ר.ק.צ.פ.ע.ס.נ.מ.ל.כ.יט.יח.יז.טז.טו.י.ט.ח.ז.ו.ה.ד.ג.ב.א`.split(`.`)},Us={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:`ჵ.ჰ.ჯ.ჴ.ხ.ჭ.წ.ძ.ც.ჩ.შ.ყ.ღ.ქ.ფ.ჳ.ტ.ს.რ.ჟ.პ.ო.ჲ.ნ.მ.ლ.კ.ი.თ.ჱ.ზ.ვ.ე.დ.გ.ბ.ა`.split(`.`)},Ws=function(e,t,n,r,i,a){return en?nc(e,i,a.length>0):r.integers.reduce(function(t,n,i){for(;e>=n;)e-=n,t+=r.values[i];return t},``)+a},Gs=function(e,t,n,r){var i=``;do n||e--,i=r(e)+i,e/=t;while(e*t>=t);return i},J=function(e,t,n,r,i){var a=n-t+1;return(e<0?`-`:``)+(Gs(Math.abs(e),a,r,function(e){return u(Math.floor(e%a)+t)})+i)},Ks=function(e,t,n){n===void 0&&(n=`. `);var r=t.length;return Gs(Math.abs(e),r,!1,function(e){return t[Math.floor(e%r)]})+n},qs=1,Js=2,Ys=4,Xs=8,Zs=function(e,t,n,r,i,a){if(e<-9999||e>9999)return nc(e,4,i.length>0);var o=Math.abs(e),s=i;if(o===0)return t[0]+s;for(var c=0;o>0&&c<=4;c++){var l=o%10;l===0&&W(a,qs)&&s!==``?s=t[l]+s:l>1||l===1&&c===0||l===1&&c===1&&W(a,Js)||l===1&&c===1&&W(a,Ys)&&e>100||l===1&&c>1&&W(a,Xs)?s=t[l]+(c>0?n[c-1]:``)+s:l===1&&c>0&&(s=n[c-1]+s),o=Math.floor(o/10)}return(e<0?r:``)+s},Qs=`十百千萬`,$s=`拾佰仟萬`,ec=`マイナス`,tc=`마이너스`,nc=function(e,t,n){var r=n?`. `:``,i=n?`、`:``,a=n?`, `:``,o=n?` `:``;switch(t){case 0:return`•`+o;case 1:return`◦`+o;case 2:return`◾`+o;case 5:var s=J(e,48,57,!0,r);return s.length<4?`0`+s:s;case 4:return Ks(e,`〇一二三四五六七八九`,i);case 6:return Ws(e,1,3999,Bs,3,r).toLowerCase();case 7:return Ws(e,1,3999,Bs,3,r);case 8:return J(e,945,969,!1,r);case 9:return J(e,97,122,!1,r);case 10:return J(e,65,90,!1,r);case 11:return J(e,1632,1641,!0,r);case 12:case 49:return Ws(e,1,9999,Vs,3,r);case 35:return Ws(e,1,9999,Vs,3,r).toLowerCase();case 13:return J(e,2534,2543,!0,r);case 14:case 30:return J(e,6112,6121,!0,r);case 15:return Ks(e,`子丑寅卯辰巳午未申酉戌亥`,i);case 16:return Ks(e,`甲乙丙丁戊己庚辛壬癸`,i);case 17:case 48:return Zs(e,`零一二三四五六七八九`,Qs,`負`,i,Js|Ys|Xs);case 47:return Zs(e,`零壹貳參肆伍陸柒捌玖`,$s,`負`,i,qs|Js|Ys|Xs);case 42:return Zs(e,`零一二三四五六七八九`,Qs,`负`,i,Js|Ys|Xs);case 41:return Zs(e,`零壹贰叁肆伍陆柒捌玖`,$s,`负`,i,qs|Js|Ys|Xs);case 26:return Zs(e,`〇一二三四五六七八九`,`十百千万`,ec,i,0);case 25:return Zs(e,`零壱弐参四伍六七八九`,`拾百千万`,ec,i,qs|Js|Ys);case 31:return Zs(e,`영일이삼사오육칠팔구`,`십백천만`,tc,a,qs|Js|Ys);case 33:return Zs(e,`零一二三四五六七八九`,`十百千萬`,tc,a,0);case 32:return Zs(e,`零壹貳參四五六七八九`,`拾百千`,tc,a,qs|Js|Ys);case 18:return J(e,2406,2415,!0,r);case 20:return Ws(e,1,19999,Us,3,r);case 21:return J(e,2790,2799,!0,r);case 22:return J(e,2662,2671,!0,r);case 22:return Ws(e,1,10999,Hs,3,r);case 23:return Ks(e,`あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん`);case 24:return Ks(e,`いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす`);case 27:return J(e,3302,3311,!0,r);case 28:return Ks(e,`アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン`,i);case 29:return Ks(e,`イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス`,i);case 34:return J(e,3792,3801,!0,r);case 37:return J(e,6160,6169,!0,r);case 38:return J(e,4160,4169,!0,r);case 39:return J(e,2918,2927,!0,r);case 40:return J(e,1776,1785,!0,r);case 43:return J(e,3046,3055,!0,r);case 44:return J(e,3174,3183,!0,r);case 45:return J(e,3664,3673,!0,r);case 46:return J(e,3872,3881,!0,r);case 3:default:return J(e,48,57,!0,r)}},rc=`data-html2canvas-ignore`,ic=function(){function e(e,t,n){if(this.context=e,this.options=n,this.scrolledElements=[],this.referenceElement=t,this.counters=new zs,this.quoteDepth=0,!t.ownerDocument)throw Error(`Cloned element does not have an owner document`);this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return e.prototype.toIFrame=function(e,t){var n=this,a=oc(e,t);if(!a.contentWindow)return Promise.reject(`Unable to find iframe window`);var o=e.defaultView.pageXOffset,s=e.defaultView.pageYOffset,c=a.contentWindow,l=c.document,u=lc(a).then(function(){return r(n,void 0,void 0,function(){var e,n;return i(this,function(r){switch(r.label){case 0:return this.scrolledElements.forEach(mc),c&&(c.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(c.scrollY!==t.top||c.scrollX!==t.left)&&(this.context.logger.warn(`Unable to restore scroll position for cloned document`),this.context.windowBounds=this.context.windowBounds.add(c.scrollX-t.left,c.scrollY-t.top,0,0))),e=this.options.onclone,n=this.clonedReferenceElement,n===void 0?[2,Promise.reject(`Error finding the `+this.referenceElement.nodeName+` in the cloned document`)]:l.fonts&&l.fonts.ready?[4,l.fonts.ready]:[3,2];case 1:r.sent(),r.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,cc(l)]:[3,4];case 3:r.sent(),r.label=4;case 4:return typeof e==`function`?[2,Promise.resolve().then(function(){return e(l,n)}).then(function(){return a})]:[2,a]}})})});return l.open(),l.write(fc(document.doctype)+``),pc(this.referenceElement.ownerDocument,o,s),l.replaceChild(l.adoptNode(this.documentElement),l.documentElement),l.close(),u},e.prototype.createElementClone=function(e){if(Pa(e,2))debugger;if(ks(e))return this.createCanvasClone(e);if(As(e))return this.createVideoClone(e);if(Ns(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return js(t)&&(js(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=``),t.loading===`lazy`&&(t.loading=`eager`)),Rs(t)?this.createCustomElementClone(t):t},e.prototype.createCustomElementClone=function(e){var t=document.createElement(`html2canvascustomelement`);return dc(e.style,t),t},e.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var n=[].slice.call(t.cssRules,0).reduce(function(e,t){return t&&typeof t.cssText==`string`?e+t.cssText:e},``),r=e.cloneNode(!1);return r.textContent=n,r}}catch(e){if(this.context.logger.error(`Unable to access cssRules property`,e),e.name!==`SecurityError`)throw e}return e.cloneNode(!1)},e.prototype.createCanvasClone=function(e){if(this.options.inlineImages&&e.ownerDocument){var t=e.ownerDocument.createElement(`img`);try{return t.src=e.toDataURL(),t}catch{this.context.logger.info(`Unable to inline canvas contents, canvas is tainted`,e)}}var n=e.cloneNode(!1);try{n.width=e.width,n.height=e.height;var r=e.getContext(`2d`),i=n.getContext(`2d`);if(i)if(!this.options.allowTaint&&r)i.putImageData(r.getImageData(0,0,e.width,e.height),0,0);else{var a=e.getContext(`webgl2`)??e.getContext(`webgl`);a&&a.getContextAttributes()?.preserveDrawingBuffer===!1&&this.context.logger.warn(`Unable to clone WebGL context as it has preserveDrawingBuffer=false`,e),i.drawImage(e,0,0)}return n}catch{this.context.logger.info(`Unable to clone canvas as it is tainted`,e)}return n},e.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement(`canvas`);t.width=e.offsetWidth,t.height=e.offsetHeight;var n=t.getContext(`2d`);try{return n&&(n.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||n.getImageData(0,0,t.width,t.height)),t}catch{this.context.logger.info(`Unable to clone video as it is tainted`,e)}var r=e.ownerDocument.createElement(`canvas`);return r.width=e.offsetWidth,r.height=e.offsetHeight,r},e.prototype.appendChildNode=function(e,t,n){(!bs(t)||!Ps(t)&&!t.hasAttribute(rc)&&(typeof this.options.ignoreElements!=`function`||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!bs(t)||!Ns(t))&&e.appendChild(this.cloneNode(t,n))},e.prototype.cloneChildNodes=function(e,t,n){for(var r=this,i=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;i;i=i.nextSibling)if(bs(i)&&Ls(i)&&typeof i.assignedNodes==`function`){var a=i.assignedNodes();a.length&&a.forEach(function(e){return r.appendChildNode(t,e,n)})}else this.appendChildNode(t,i,n)},e.prototype.cloneNode=function(e,t){if(ys(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var n=e.ownerDocument.defaultView;if(n&&bs(e)&&(xs(e)||Ss(e))){var r=this.createElementClone(e);r.style.transitionProperty=`none`;var i=n.getComputedStyle(e),a=n.getComputedStyle(e,`:before`),o=n.getComputedStyle(e,`:after`);this.referenceElement===e&&xs(r)&&(this.clonedReferenceElement=r),Os(r)&&bc(r);var s=this.counters.parse(new ja(this.context,i)),c=this.resolvePseudoContent(e,r,a,ac.BEFORE);Rs(e)&&(t=!0),As(e)||this.cloneChildNodes(e,r,t),c&&r.insertBefore(c,r.firstChild);var l=this.resolvePseudoContent(e,r,o,ac.AFTER);return l&&r.appendChild(l),this.counters.pop(s),(i&&(this.options.copyStyles||Ss(e))&&!Ms(e)||t)&&dc(i,r),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(Fs(e)||Is(e))&&(Fs(r)||Is(r))&&(r.value=e.value),r}return e.cloneNode(!1)},e.prototype.resolvePseudoContent=function(e,t,n,r){var i=this;if(n){var a=n.content,o=t.ownerDocument;if(!(!o||!a||a===`none`||a===`-moz-alt-content`||n.display===`none`)){this.counters.parse(new ja(this.context,n));var s=new Aa(this.context,n),c=o.createElement(`html2canvaspseudoelement`);dc(n,c),s.content.forEach(function(t){if(t.type===0)c.appendChild(o.createTextNode(t.value));else if(t.type===22){var n=o.createElement(`img`);n.src=t.value,n.style.opacity=`1`,c.appendChild(n)}else if(t.type===18){if(t.name===`attr`){var r=t.values.filter(F);r.length&&c.appendChild(o.createTextNode(e.getAttribute(r[0].value)||``))}else if(t.name===`counter`){var a=t.values.filter(rr),l=a[0],u=a[1];if(l&&F(l)){var d=i.counters.getCounterValue(l.value),f=u&&F(u)?Ri.parse(i.context,u.value):3;c.appendChild(o.createTextNode(nc(d,f,!1)))}}else if(t.name===`counters`){var p=t.values.filter(rr),l=p[0],m=p[1],u=p[2];if(l&&F(l)){var h=i.counters.getCounterValues(l.value),g=u&&F(u)?Ri.parse(i.context,u.value):3,_=m&&m.type===0?m.value:``,v=h.map(function(e){return nc(e,g,!1)}).join(_);c.appendChild(o.createTextNode(v))}}}else if(t.type===20)switch(t.value){case`open-quote`:c.appendChild(o.createTextNode(wa(s.quotes,i.quoteDepth++,!0)));break;case`close-quote`:c.appendChild(o.createTextNode(wa(s.quotes,--i.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(t.value))}}),c.className=_c+` `+vc;var l=r===ac.BEFORE?` `+_c:` `+vc;return Ss(t)?t.className.baseValue+=l:t.className+=l,c}}},e.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},e}(),ac;(function(e){e[e.BEFORE=0]=`BEFORE`,e[e.AFTER=1]=`AFTER`})(ac||={});var oc=function(e,t){var n=e.createElement(`iframe`);return n.className=`html2canvas-container`,n.style.visibility=`hidden`,n.style.position=`fixed`,n.style.left=`-10000px`,n.style.top=`0px`,n.style.border=`0`,n.width=t.width.toString(),n.height=t.height.toString(),n.scrolling=`no`,n.setAttribute(rc,`true`),e.body.appendChild(n),n},sc=function(e){return new Promise(function(t){if(e.complete){t();return}if(!e.src){t();return}e.onload=t,e.onerror=t})},cc=function(e){return Promise.all([].slice.call(e.images,0).map(sc))},lc=function(e){return new Promise(function(t,n){var r=e.contentWindow;if(!r)return n(`No window assigned for iframe`);var i=r.document;r.onload=e.onload=function(){r.onload=e.onload=null;var n=setInterval(function(){i.body.childNodes.length>0&&i.readyState===`complete`&&(clearInterval(n),t(e))},50)}})},uc=[`all`,`d`,`content`],dc=function(e,t){for(var n=e.length-1;n>=0;n--){var r=e.item(n);uc.indexOf(r)===-1&&t.style.setProperty(r,e.getPropertyValue(r))}return t},fc=function(e){var t=``;return e&&(t+=``),t},pc=function(e,t,n){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||n!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,n)},mc=function(e){var t=e[0],n=e[1],r=e[2];t.scrollLeft=n,t.scrollTop=r},hc=`:before`,gc=`:after`,_c=`___html2canvas___pseudoelement_before`,vc=`___html2canvas___pseudoelement_after`,yc=`{ +import{En as e}from"./index-BlYU7j-M.js";var t=e(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self,n.html2canvas=r())})(e,(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}var n=function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&a[a.length-1]))&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]=55296&&i<=56319&&n>10)+55296,a%1024+56320)),(r+1===t||n.length>16384)&&(i+=String.fromCharCode.apply(String,n),n.length=0)}return i},d=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,f=typeof Uint8Array>`u`?[]:new Uint8Array(256),p=0;p`u`?[]:new Uint8Array(256),g=0;g>4,u[i++]=(o&15)<<4|s>>2,u[i++]=(s&3)<<6|c&63;return l},v=function(e){for(var t=e.length,n=[],r=0;r>b,T=(1<>b)+32,D=65536>>x,O=(1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>b],t=(t<>b)],t=(t<>x),t=this.index[t],t+=e>>b&O,t=this.index[t],t=(t<`u`?[]:new Uint8Array(256),oe=0;oece?(i.push(!0),o-=ce):i.push(!1),[`normal`,`auto`,`loose`].indexOf(t)!==-1&&[8208,8211,12316,12448].indexOf(e)!==-1)return r.push(a),n.push(Ce);if(o===fe||o===ve){if(a===0)return r.push(a),n.push(Ie);var s=n[a-1];return rt.indexOf(s)===-1?(r.push(r[a-1]),n.push(s)):(r.push(a),n.push(Ie))}if(r.push(a),o===Le)return n.push(t===`strict`?Oe:Ue);if(o===Je||o===Fe)return n.push(Ie);if(o===Ye)return e>=131072&&e<=196605||e>=196608&&e<=262141?n.push(Ue):n.push(Ie);n.push(o)}),[r,n,i]},st=function(e,t,n,r){var i=r[n];if(Array.isArray(e)?e.indexOf(i)!==-1:e===i)for(var a=n;a<=r.length;){a++;var o=r[a];if(o===t)return!0;if(o!==_e)break}if(i===_e)for(var a=n;a>0;){a--;var s=r[a];if(Array.isArray(e)?e.indexOf(s)!==-1:e===s)for(var c=n;c<=r.length;){c++;var o=r[c];if(o===t)return!0;if(o!==_e)break}if(s!==_e)break}return!1},ct=function(e,t){for(var n=e;n>=0;){var r=t[n];if(r===_e)n--;else return r}return 0},lt=function(e,t,n,r,i){if(n[r]===0)return A;var a=r-1;if(Array.isArray(i)&&i[a]===!0)return A;var o=a-1,s=a+1,c=t[a],l=o>=0?t[o]:0,u=t[s];if(c===ue&&u===de)return A;if(et.indexOf(c)!==-1)return Ze;if(et.indexOf(u)!==-1||tt.indexOf(u)!==-1)return A;if(ct(a,t)===he)return Qe;if($e.get(e[a])===ve||(c===Re||c===ze)&&$e.get(e[s])===ve||c===me||u===me||c===ge||[_e,be,Se].indexOf(c)===-1&&u===ge||[we,Te,Ee,je,Pe].indexOf(u)!==-1||ct(a,t)===ke||st(Ae,ke,a,t)||st([we,Te],Oe,a,t)||st(ye,ye,a,t))return A;if(c===_e)return Qe;if(c===Ae||u===Ae)return A;if(u===Ce||c===Ce)return Qe;if([be,Se,Oe].indexOf(u)!==-1||c===xe||l===He&&at.indexOf(c)!==-1||c===Pe&&u===He||u===De||j.indexOf(u)!==-1&&c===k||j.indexOf(c)!==-1&&u===k||c===Ne&&[Ue,Re,ze].indexOf(u)!==-1||[Ue,Re,ze].indexOf(c)!==-1&&u===Me||j.indexOf(c)!==-1&&nt.indexOf(u)!==-1||nt.indexOf(c)!==-1&&j.indexOf(u)!==-1||[Ne,Me].indexOf(c)!==-1&&(u===k||[ke,Se].indexOf(u)!==-1&&t[s+1]===k)||[ke,Se].indexOf(c)!==-1&&u===k||c===k&&[k,Pe,je].indexOf(u)!==-1)return A;if([k,Pe,je,we,Te].indexOf(u)!==-1)for(var d=a;d>=0;){var f=t[d];if(f===k)return A;if([Pe,je].indexOf(f)!==-1)d--;else break}if([Ne,Me].indexOf(u)!==-1)for(var d=[we,Te].indexOf(c)===-1?a:o;d>=0;){var f=t[d];if(f===k)return A;if([Pe,je].indexOf(f)!==-1)d--;else break}if(We===c&&[We,Ge,Be,Ve].indexOf(u)!==-1||[Ge,Be].indexOf(c)!==-1&&[Ge,Ke].indexOf(u)!==-1||[Ke,Ve].indexOf(c)!==-1&&u===Ke||it.indexOf(c)!==-1&&[De,Me].indexOf(u)!==-1||it.indexOf(u)!==-1&&c===Ne||j.indexOf(c)!==-1&&j.indexOf(u)!==-1||c===je&&j.indexOf(u)!==-1||j.concat(k).indexOf(c)!==-1&&u===ke&&Xe.indexOf(e[s])===-1||j.concat(k).indexOf(u)!==-1&&c===Te)return A;if(c===qe&&u===qe){for(var p=n[a],m=1;p>0&&(p--,t[p]===qe);)m++;if(m%2!=0)return A}return c===Re&&u===ze?A:Qe},ut=function(e,t){t||={lineBreak:`normal`,wordBreak:`normal`};var n=ot(e,t.lineBreak),r=n[0],i=n[1],a=n[2];(t.wordBreak===`break-all`||t.wordBreak===`break-word`)&&(i=i.map(function(e){return[k,Ie,Je].indexOf(e)===-1?e:Ue}));var o=t.wordBreak===`keep-all`?a.map(function(t,n){return t&&e[n]>=19968&&e[n]<=40959}):void 0;return[r,i,o]},dt=function(){function e(e,t,n,r){this.codePoints=e,this.required=t===Ze,this.start=n,this.end=r}return e.prototype.slice=function(){return u.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),ft=function(e,t){var n=l(e),r=ut(n,t),i=r[0],a=r[1],o=r[2],s=n.length,c=0,u=0;return{next:function(){if(u>=s)return{done:!0,value:null};for(var e=A;u=rn&&e<=57},hn=function(e){return e>=55296&&e<=57343},gn=function(e){return P(e)||e>=un&&e<=fn||e>=an&&e<=sn},_n=function(e){return e>=an&&e<=ln},vn=function(e){return e>=un&&e<=mn},yn=function(e){return _n(e)||vn(e)},bn=function(e){return e>=Ut},xn=function(e){return e===_t||e===bt||e===xt},Sn=function(e){return yn(e)||bn(e)||e===At},Cn=function(e){return Sn(e)||P(e)||e===M},wn=function(e){return e>=Zt&&e<=Qt||e===$t||e>=en&&e<=tn||e===nn},Tn=function(e,t){return e===yt?t!==_t:!1},En=function(e,t,n){return e===M?Sn(t)||Tn(t,n):Sn(e)?!0:!!(e===yt&&Tn(e,t))},Dn=function(e,t,n){return e===Kt||e===M?P(t)?!0:t===Xt&&P(n):P(e===Xt?t:e)},On=function(e){var t=0,n=1;(e[t]===Kt||e[t]===M)&&(e[t]===M&&(n=-1),t++);for(var r=[];P(e[t]);)r.push(e[t++]);var i=r.length?parseInt(u.apply(void 0,r),10):0;e[t]===Xt&&t++;for(var a=[];P(e[t]);)a.push(e[t++]);var o=a.length,s=o?parseInt(u.apply(void 0,a),10):0;(e[t]===dn||e[t]===on)&&t++;var c=1;(e[t]===Kt||e[t]===M)&&(e[t]===M&&(c=-1),t++);for(var l=[];P(e[t]);)l.push(e[t++]);var d=l.length?parseInt(u.apply(void 0,l),10):0;return n*(i+s*10**-o)*10**(c*d)},kn={type:2},An={type:3},jn={type:4},Mn={type:13},Nn={type:8},Pn={type:21},Fn={type:9},In={type:10},Ln={type:11},Rn={type:12},zn={type:14},Bn={type:23},Vn={type:1},Hn={type:25},Un={type:24},Wn={type:26},Gn={type:27},Kn={type:28},qn={type:29},Jn={type:31},Yn={type:32},Xn=function(){function e(){this._value=[]}return e.prototype.write=function(e){this._value=this._value.concat(l(e))},e.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==Yn;)e.push(t),t=this.consumeToken();return e},e.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case St:return this.consumeStringToken(St);case wt:var t=this.peekCodePoint(0),n=this.peekCodePoint(1),r=this.peekCodePoint(2);if(Cn(t)||Tn(n,r)){var i=En(t,n,r)?mt:pt,a=this.consumeName();return{type:5,value:a,flags:i}}break;case Tt:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),Mn;break;case Dt:return this.consumeStringToken(Dt);case Ot:return kn;case kt:return An;case Gt:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),zn;break;case Kt:if(Dn(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case qt:return jn;case M:var o=e,s=this.peekCodePoint(0),c=this.peekCodePoint(1);if(Dn(o,s,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(En(o,s,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(s===M&&c===Nt)return this.consumeCodePoint(),this.consumeCodePoint(),Un;break;case Xt:if(Dn(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case vt:if(this.peekCodePoint(0)===Gt)for(this.consumeCodePoint();;){var l=this.consumeCodePoint();if(l===Gt&&(l=this.consumeCodePoint(),l===vt)||l===N)return this.consumeToken()}break;case Jt:return Wn;case Yt:return Gn;case Mt:if(this.peekCodePoint(0)===jt&&this.peekCodePoint(1)===M&&this.peekCodePoint(2)===M)return this.consumeCodePoint(),this.consumeCodePoint(),Hn;break;case Pt:if(En(this.peekCodePoint(0),this.peekCodePoint(1),this.peekCodePoint(2))){var a=this.consumeName();return{type:7,value:a}}break;case Ft:return Kn;case yt:if(Tn(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case It:return qn;case Lt:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),Nn;break;case Rt:return Ln;case Bt:return Rn;case cn:case pn:var d=this.peekCodePoint(0),f=this.peekCodePoint(1);return d===Kt&&(gn(f)||f===zt)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case Vt:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),Fn;if(this.peekCodePoint(0)===Vt)return this.consumeCodePoint(),Pn;break;case Ht:if(this.peekCodePoint(0)===Ct)return this.consumeCodePoint(),In;break;case N:return Yn}return xn(e)?(this.consumeWhiteSpace(),Jn):P(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):Sn(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:u(e)}},e.prototype.consumeCodePoint=function(){var e=this._value.shift();return e===void 0?-1:e},e.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},e.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},e.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();gn(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var n=!1;t===zt&&e.length<6;)e.push(t),t=this.consumeCodePoint(),n=!0;if(n){var r=parseInt(u.apply(void 0,e.map(function(e){return e===zt?rn:e})),16),i=parseInt(u.apply(void 0,e.map(function(e){return e===zt?fn:e})),16);return{type:30,start:r,end:i}}var a=parseInt(u.apply(void 0,e),16);if(this.peekCodePoint(0)===M&&gn(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];gn(t)&&o.length<6;)o.push(t),t=this.consumeCodePoint();var i=parseInt(u.apply(void 0,o),16);return{type:30,start:a,end:i}}else return{type:30,start:a,end:a}},e.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()===`url`&&this.peekCodePoint(0)===Ot?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===Ot?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},e.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===N)return{type:22,value:``};var t=this.peekCodePoint(0);if(t===Dt||t===St){var n=this.consumeStringToken(this.consumeCodePoint());return n.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===N||this.peekCodePoint(0)===kt)?(this.consumeCodePoint(),{type:22,value:n.value}):(this.consumeBadUrlRemnants(),Bn)}for(;;){var r=this.consumeCodePoint();if(r===N||r===kt)return{type:22,value:u.apply(void 0,e)};if(xn(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===N||this.peekCodePoint(0)===kt?(this.consumeCodePoint(),{type:22,value:u.apply(void 0,e)}):(this.consumeBadUrlRemnants(),Bn);if(r===St||r===Dt||r===Ot||wn(r))return this.consumeBadUrlRemnants(),Bn;if(r===yt)if(Tn(r,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),Bn;else e.push(r)}},e.prototype.consumeWhiteSpace=function(){for(;xn(this.peekCodePoint(0));)this.consumeCodePoint()},e.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===kt||e===N)return;Tn(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},e.prototype.consumeStringSlice=function(e){for(var t=5e4,n=``;e>0;){var r=Math.min(t,e);n+=u.apply(void 0,this._value.splice(0,r)),e-=r}return this._value.shift(),n},e.prototype.consumeStringToken=function(e){var t=``,n=0;do{var r=this._value[n];if(r===N||r===void 0||r===e)return t+=this.consumeStringSlice(n),{type:0,value:t};if(r===_t)return this._value.splice(0,n),Vn;if(r===yt){var i=this._value[n+1];i!==N&&i!==void 0&&(i===_t?(t+=this.consumeStringSlice(n),n=-1,this._value.shift()):Tn(r,i)&&(t+=this.consumeStringSlice(n),t+=u(this.consumeEscapedCodePoint()),n=-1))}n++}while(!0)},e.prototype.consumeNumber=function(){var e=[],t=ht,n=this.peekCodePoint(0);for((n===Kt||n===M)&&e.push(this.consumeCodePoint());P(this.peekCodePoint(0));)e.push(this.consumeCodePoint());n=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(n===Xt&&P(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=gt;P(this.peekCodePoint(0));)e.push(this.consumeCodePoint());n=this.peekCodePoint(0),r=this.peekCodePoint(1);var i=this.peekCodePoint(2);if((n===dn||n===on)&&((r===Kt||r===M)&&P(i)||P(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=gt;P(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[On(e),t]},e.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],n=e[1],r=this.peekCodePoint(0);return En(r,this.peekCodePoint(1),this.peekCodePoint(2))?{type:15,number:t,flags:n,unit:this.consumeName()}:r===Et?(this.consumeCodePoint(),{type:16,number:t,flags:n}):{type:17,number:t,flags:n}},e.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(gn(e)){for(var t=u(e);gn(this.peekCodePoint(0))&&t.length<6;)t+=u(this.consumeCodePoint());xn(this.peekCodePoint(0))&&this.consumeCodePoint();var n=parseInt(t,16);return n===0||hn(n)||n>1114111?Wt:n}return e===N?Wt:e},e.prototype.consumeName=function(){for(var e=``;;){var t=this.consumeCodePoint();if(Cn(t))e+=u(t);else if(Tn(t,this.peekCodePoint(0)))e+=u(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},e}(),Zn=function(){function e(e){this._tokens=e}return e.create=function(t){var n=new Xn;return n.write(t),new e(n.read())},e.parseValue=function(t){return e.create(t).parseComponentValue()},e.parseValues=function(t){return e.create(t).parseComponentValues()},e.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw SyntaxError(`Error parsing CSS component value, unexpected EOF`);this.reconsumeToken(e);var t=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return t;throw SyntaxError(`Error parsing CSS component value, multiple values found when expecting only one`)},e.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},e.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},e.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},n=this.consumeToken();;){if(n.type===32||ir(n,e))return t;this.reconsumeToken(n),t.values.push(this.consumeComponentValue()),n=this.consumeToken()}},e.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var n=this.consumeToken();if(n.type===32||n.type===3)return t;this.reconsumeToken(n),t.values.push(this.consumeComponentValue())}},e.prototype.consumeToken=function(){var e=this._tokens.shift();return e===void 0?Yn:e},e.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},e}(),Qn=function(e){return e.type===15},$n=function(e){return e.type===17},F=function(e){return e.type===20},er=function(e){return e.type===0},tr=function(e,t){return F(e)&&e.value===t},nr=function(e){return e.type!==31},rr=function(e){return e.type!==31&&e.type!==4},I=function(e){var t=[],n=[];return e.forEach(function(e){if(e.type===4){if(n.length===0)throw Error(`Error parsing function args, zero tokens for arg`);t.push(n),n=[];return}e.type!==31&&n.push(e)}),n.length&&t.push(n),t},ir=function(e,t){return t===11&&e.type===12||t===28&&e.type===29?!0:t===2&&e.type===3},ar=function(e){return e.type===17||e.type===15},L=function(e){return e.type===16||ar(e)},or=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},R={type:17,number:0,flags:ht},sr={type:16,number:50,flags:ht},cr={type:16,number:100,flags:ht},lr=function(e,t,n){var r=e[0],i=e[1];return[z(r,t),z(i===void 0?r:i,n)]},z=function(e,t){if(e.type===16)return e.number/100*t;if(Qn(e))switch(e.unit){case`rem`:case`em`:return 16*e.number;case`px`:default:return e.number}return e.number},ur=`deg`,dr=`grad`,fr=`rad`,pr=`turn`,mr={name:`angle`,parse:function(e,t){if(t.type===15)switch(t.unit){case ur:return Math.PI*t.number/180;case dr:return Math.PI/200*t.number;case fr:return t.number;case pr:return Math.PI*2*t.number}throw Error(`Unsupported angle type`)}},hr=function(e){return e.type===15&&(e.unit===ur||e.unit===dr||e.unit===fr||e.unit===pr)},gr=function(e){switch(e.filter(F).map(function(e){return e.value}).join(` `)){case`to bottom right`:case`to right bottom`:case`left top`:case`top left`:return[R,R];case`to top`:case`bottom`:return B(0);case`to bottom left`:case`to left bottom`:case`right top`:case`top right`:return[R,cr];case`to right`:case`left`:return B(90);case`to top left`:case`to left top`:case`right bottom`:case`bottom right`:return[cr,cr];case`to bottom`:case`top`:return B(180);case`to top right`:case`to right top`:case`left bottom`:case`bottom left`:return[cr,R];case`to left`:case`right`:return B(270)}return 0},B=function(e){return Math.PI*e/180},_r={name:`color`,parse:function(e,t){if(t.type===18){var n=wr[t.name];if(n===void 0)throw Error(`Attempting to parse an unsupported color function "`+t.name+`"`);return n(e,t.values)}if(t.type===5){if(t.value.length===3){var r=t.value.substring(0,1),i=t.value.substring(1,2),a=t.value.substring(2,3);return yr(parseInt(r+r,16),parseInt(i+i,16),parseInt(a+a,16),1)}if(t.value.length===4){var r=t.value.substring(0,1),i=t.value.substring(1,2),a=t.value.substring(2,3),o=t.value.substring(3,4);return yr(parseInt(r+r,16),parseInt(i+i,16),parseInt(a+a,16),parseInt(o+o,16)/255)}if(t.value.length===6){var r=t.value.substring(0,2),i=t.value.substring(2,4),a=t.value.substring(4,6);return yr(parseInt(r,16),parseInt(i,16),parseInt(a,16),1)}if(t.value.length===8){var r=t.value.substring(0,2),i=t.value.substring(2,4),a=t.value.substring(4,6),o=t.value.substring(6,8);return yr(parseInt(r,16),parseInt(i,16),parseInt(a,16),parseInt(o,16)/255)}}if(t.type===20){var s=H[t.value.toUpperCase()];if(s!==void 0)return s}return H.TRANSPARENT}},vr=function(e){return(255&e)==0},V=function(e){var t=255&e,n=255&e>>8,r=255&e>>16,i=255&e>>24;return t<255?`rgba(`+i+`,`+r+`,`+n+`,`+t/255+`)`:`rgb(`+i+`,`+r+`,`+n+`)`},yr=function(e,t,n,r){return(e<<24|t<<16|n<<8|Math.round(r*255)<<0)>>>0},br=function(e,t){if(e.type===17)return e.number;if(e.type===16){var n=t===3?1:255;return t===3?e.number/100*n:Math.round(e.number/100*n)}return 0},xr=function(e,t){var n=t.filter(rr);if(n.length===3){var r=n.map(br),i=r[0],a=r[1],o=r[2];return yr(i,a,o,1)}if(n.length===4){var s=n.map(br),i=s[0],a=s[1],o=s[2],c=s[3];return yr(i,a,o,c)}return 0};function Sr(e,t,n){return n<0&&(n+=1),n>=1&&--n,n<1/6?(t-e)*n*6+e:n<1/2?t:n<2/3?(t-e)*6*(2/3-n)+e:e}var Cr=function(e,t){var n=t.filter(rr),r=n[0],i=n[1],a=n[2],o=n[3],s=(r.type===17?B(r.number):mr.parse(e,r))/(Math.PI*2),c=L(i)?i.number/100:0,l=L(a)?a.number/100:0,u=o!==void 0&&L(o)?z(o,1):1;if(c===0)return yr(l*255,l*255,l*255,1);var d=l<=.5?l*(c+1):l+c-l*c,f=l*2-d,p=Sr(f,d,s+1/3),m=Sr(f,d,s),h=Sr(f,d,s-1/3);return yr(p*255,m*255,h*255,u)},wr={hsl:Cr,hsla:Cr,rgb:xr,rgba:xr},Tr=function(e,t){return _r.parse(e,Zn.create(t).parseComponentValue())},H={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},Er={name:`background-clip`,initialValue:`border-box`,prefix:!1,type:1,parse:function(e,t){return t.map(function(e){if(F(e))switch(e.value){case`padding-box`:return 1;case`content-box`:return 2}return 0})}},Dr={name:`background-color`,initialValue:`transparent`,prefix:!1,type:3,format:`color`},Or=function(e,t){var n=_r.parse(e,t[0]),r=t[1];return r&&L(r)?{color:n,stop:r}:{color:n,stop:null}},kr=function(e,t){var n=e[0],r=e[e.length-1];n.stop===null&&(n.stop=R),r.stop===null&&(r.stop=cr);for(var i=[],a=0,o=0;oa?i.push(c):i.push(a),a=c}else i.push(null)}for(var l=null,o=0;oe.optimumDistance)?{optimumCorner:t,optimumDistance:s}:e},{optimumDistance:i?1/0:-1/0,optimumCorner:null}).optimumCorner},Nr=function(e,t,n,r,i){var a=0,o=0;switch(e.size){case 0:e.shape===0?a=o=Math.min(Math.abs(t),Math.abs(t-r),Math.abs(n),Math.abs(n-i)):e.shape===1&&(a=Math.min(Math.abs(t),Math.abs(t-r)),o=Math.min(Math.abs(n),Math.abs(n-i)));break;case 2:if(e.shape===0)a=o=Math.min(U(t,n),U(t,n-i),U(t-r,n),U(t-r,n-i));else if(e.shape===1){var s=Math.min(Math.abs(n),Math.abs(n-i))/Math.min(Math.abs(t),Math.abs(t-r)),c=Mr(r,i,t,n,!0),l=c[0],u=c[1];a=U(l-t,(u-n)/s),o=s*a}break;case 1:e.shape===0?a=o=Math.max(Math.abs(t),Math.abs(t-r),Math.abs(n),Math.abs(n-i)):e.shape===1&&(a=Math.max(Math.abs(t),Math.abs(t-r)),o=Math.max(Math.abs(n),Math.abs(n-i)));break;case 3:if(e.shape===0)a=o=Math.max(U(t,n),U(t,n-i),U(t-r,n),U(t-r,n-i));else if(e.shape===1){var s=Math.max(Math.abs(n),Math.abs(n-i))/Math.max(Math.abs(t),Math.abs(t-r)),d=Mr(r,i,t,n,!1),l=d[0],u=d[1];a=U(l-t,(u-n)/s),o=s*a}break}return Array.isArray(e.size)&&(a=z(e.size[0],r),o=e.size.length===2?z(e.size[1],i):a),[a,o]},Pr=function(e,t){var n=B(180),r=[];return I(t).forEach(function(t,i){if(i===0){var a=t[0];if(a.type===20&&a.value===`to`){n=gr(t);return}else if(hr(a)){n=mr.parse(e,a);return}}var o=Or(e,t);r.push(o)}),{angle:n,stops:r,type:1}},Fr=function(e,t){var n=B(180),r=[];return I(t).forEach(function(t,i){if(i===0){var a=t[0];if(a.type===20&&[`top`,`left`,`right`,`bottom`].indexOf(a.value)!==-1){n=gr(t);return}else if(hr(a)){n=(mr.parse(e,a)+B(270))%B(360);return}}var o=Or(e,t);r.push(o)}),{angle:n,stops:r,type:1}},Ir=function(e,t){var n=B(180),r=[],i=1;return I(t).forEach(function(t,n){var a=t[0];if(n===0){if(F(a)&&a.value===`linear`){i=1;return}else if(F(a)&&a.value===`radial`){i=2;return}}if(a.type===18){if(a.name===`from`){var o=_r.parse(e,a.values[0]);r.push({stop:R,color:o})}else if(a.name===`to`){var o=_r.parse(e,a.values[0]);r.push({stop:cr,color:o})}else if(a.name===`color-stop`){var s=a.values.filter(rr);if(s.length===2){var o=_r.parse(e,s[1]),c=s[0];$n(c)&&r.push({stop:{type:16,number:c.number*100,flags:c.flags},color:o})}}}}),i===1?{angle:(n+B(180))%B(360),stops:r,type:i}:{size:3,shape:0,stops:r,position:[],type:i}},Lr=`closest-side`,Rr=`farthest-side`,zr=`closest-corner`,Br=`farthest-corner`,Vr=`circle`,Hr=`ellipse`,Ur=`cover`,Wr=`contain`,Gr=function(e,t){var n=0,r=3,i=[],a=[];return I(t).forEach(function(t,o){var s=!0;if(o===0){var c=!1;s=t.reduce(function(e,t){if(c)if(F(t))switch(t.value){case`center`:return a.push(sr),e;case`top`:case`left`:return a.push(R),e;case`right`:case`bottom`:return a.push(cr),e}else (L(t)||ar(t))&&a.push(t);else if(F(t))switch(t.value){case Vr:return n=0,!1;case Hr:return n=1,!1;case`at`:return c=!0,!1;case Lr:return r=0,!1;case Ur:case Rr:return r=1,!1;case Wr:case zr:return r=2,!1;case Br:return r=3,!1}else if(ar(t)||L(t))return Array.isArray(r)||(r=[]),r.push(t),!1;return e},s)}if(s){var l=Or(e,t);i.push(l)}}),{size:r,shape:n,stops:i,position:a,type:2}},Kr=function(e,t){var n=0,r=3,i=[],a=[];return I(t).forEach(function(t,o){var s=!0;if(o===0?s=t.reduce(function(e,t){if(F(t))switch(t.value){case`center`:return a.push(sr),!1;case`top`:case`left`:return a.push(R),!1;case`right`:case`bottom`:return a.push(cr),!1}else if(L(t)||ar(t))return a.push(t),!1;return e},s):o===1&&(s=t.reduce(function(e,t){if(F(t))switch(t.value){case Vr:return n=0,!1;case Hr:return n=1,!1;case Wr:case Lr:return r=0,!1;case Rr:return r=1,!1;case zr:return r=2,!1;case Ur:case Br:return r=3,!1}else if(ar(t)||L(t))return Array.isArray(r)||(r=[]),r.push(t),!1;return e},s)),s){var c=Or(e,t);i.push(c)}}),{size:r,shape:n,stops:i,position:a,type:2}},qr=function(e){return e.type===1},Jr=function(e){return e.type===2},Yr={name:`image`,parse:function(e,t){if(t.type===22){var n={url:t.value,type:0};return e.cache.addImage(t.value),n}if(t.type===18){var r=Zr[t.name];if(r===void 0)throw Error(`Attempting to parse an unsupported image function "`+t.name+`"`);return r(e,t.values)}throw Error(`Unsupported image type `+t.type)}};function Xr(e){return!(e.type===20&&e.value===`none`)&&(e.type!==18||!!Zr[e.name])}var Zr={"linear-gradient":Pr,"-moz-linear-gradient":Fr,"-ms-linear-gradient":Fr,"-o-linear-gradient":Fr,"-webkit-linear-gradient":Fr,"radial-gradient":Gr,"-moz-radial-gradient":Kr,"-ms-radial-gradient":Kr,"-o-radial-gradient":Kr,"-webkit-radial-gradient":Kr,"-webkit-gradient":Ir},Qr={name:`background-image`,initialValue:`none`,type:1,prefix:!1,parse:function(e,t){if(t.length===0)return[];var n=t[0];return n.type===20&&n.value===`none`?[]:t.filter(function(e){return rr(e)&&Xr(e)}).map(function(t){return Yr.parse(e,t)})}},$r={name:`background-origin`,initialValue:`border-box`,prefix:!1,type:1,parse:function(e,t){return t.map(function(e){if(F(e))switch(e.value){case`padding-box`:return 1;case`content-box`:return 2}return 0})}},ei={name:`background-position`,initialValue:`0% 0%`,type:1,prefix:!1,parse:function(e,t){return I(t).map(function(e){return e.filter(L)}).map(or)}},ti={name:`background-repeat`,initialValue:`repeat`,prefix:!1,type:1,parse:function(e,t){return I(t).map(function(e){return e.filter(F).map(function(e){return e.value}).join(` `)}).map(ni)}},ni=function(e){switch(e){case`no-repeat`:return 1;case`repeat-x`:case`repeat no-repeat`:return 2;case`repeat-y`:case`no-repeat repeat`:return 3;case`repeat`:default:return 0}},ri;(function(e){e.AUTO=`auto`,e.CONTAIN=`contain`,e.COVER=`cover`})(ri||={});var ii={name:`background-size`,initialValue:`0`,prefix:!1,type:1,parse:function(e,t){return I(t).map(function(e){return e.filter(ai)})}},ai=function(e){return F(e)||L(e)},oi=function(e){return{name:`border-`+e+`-color`,initialValue:`transparent`,prefix:!1,type:3,format:`color`}},si=oi(`top`),ci=oi(`right`),li=oi(`bottom`),ui=oi(`left`),di=function(e){return{name:`border-radius-`+e,initialValue:`0 0`,prefix:!1,type:1,parse:function(e,t){return or(t.filter(L))}}},fi=di(`top-left`),pi=di(`top-right`),mi=di(`bottom-right`),hi=di(`bottom-left`),gi=function(e){return{name:`border-`+e+`-style`,initialValue:`solid`,prefix:!1,type:2,parse:function(e,t){switch(t){case`none`:return 0;case`dashed`:return 2;case`dotted`:return 3;case`double`:return 4}return 1}}},_i=gi(`top`),vi=gi(`right`),yi=gi(`bottom`),bi=gi(`left`),xi=function(e){return{name:`border-`+e+`-width`,initialValue:`0`,type:0,prefix:!1,parse:function(e,t){return Qn(t)?t.number:0}}},Si=xi(`top`),Ci=xi(`right`),wi=xi(`bottom`),Ti=xi(`left`),Ei={name:`color`,initialValue:`transparent`,prefix:!1,type:3,format:`color`},Di={name:`direction`,initialValue:`ltr`,prefix:!1,type:2,parse:function(e,t){switch(t){case`rtl`:return 1;case`ltr`:default:return 0}}},Oi={name:`display`,initialValue:`inline-block`,prefix:!1,type:1,parse:function(e,t){return t.filter(F).reduce(function(e,t){return e|ki(t.value)},0)}},ki=function(e){switch(e){case`block`:case`-webkit-box`:return 2;case`inline`:return 4;case`run-in`:return 8;case`flow`:return 16;case`flow-root`:return 32;case`table`:return 64;case`flex`:case`-webkit-flex`:return 128;case`grid`:case`-ms-grid`:return 256;case`ruby`:return 512;case`subgrid`:return 1024;case`list-item`:return 2048;case`table-row-group`:return 4096;case`table-header-group`:return 8192;case`table-footer-group`:return 16384;case`table-row`:return 32768;case`table-cell`:return 65536;case`table-column-group`:return 131072;case`table-column`:return 262144;case`table-caption`:return 524288;case`ruby-base`:return 1048576;case`ruby-text`:return 2097152;case`ruby-base-container`:return 4194304;case`ruby-text-container`:return 8388608;case`contents`:return 16777216;case`inline-block`:return 33554432;case`inline-list-item`:return 67108864;case`inline-table`:return 134217728;case`inline-flex`:return 268435456;case`inline-grid`:return 536870912}return 0},Ai={name:`float`,initialValue:`none`,prefix:!1,type:2,parse:function(e,t){switch(t){case`left`:return 1;case`right`:return 2;case`inline-start`:return 3;case`inline-end`:return 4}return 0}},ji={name:`letter-spacing`,initialValue:`0`,prefix:!1,type:0,parse:function(e,t){return t.type===20&&t.value===`normal`?0:t.type===17||t.type===15?t.number:0}},Mi;(function(e){e.NORMAL=`normal`,e.STRICT=`strict`})(Mi||={});var Ni={name:`line-break`,initialValue:`normal`,prefix:!1,type:2,parse:function(e,t){switch(t){case`strict`:return Mi.STRICT;case`normal`:default:return Mi.NORMAL}}},Pi={name:`line-height`,initialValue:`normal`,prefix:!1,type:4},Fi=function(e,t){return F(e)&&e.value===`normal`?1.2*t:e.type===17?t*e.number:L(e)?z(e,t):t},Ii={name:`list-style-image`,initialValue:`none`,type:0,prefix:!1,parse:function(e,t){return t.type===20&&t.value===`none`?null:Yr.parse(e,t)}},Li={name:`list-style-position`,initialValue:`outside`,prefix:!1,type:2,parse:function(e,t){switch(t){case`inside`:return 0;case`outside`:default:return 1}}},Ri={name:`list-style-type`,initialValue:`none`,prefix:!1,type:2,parse:function(e,t){switch(t){case`disc`:return 0;case`circle`:return 1;case`square`:return 2;case`decimal`:return 3;case`cjk-decimal`:return 4;case`decimal-leading-zero`:return 5;case`lower-roman`:return 6;case`upper-roman`:return 7;case`lower-greek`:return 8;case`lower-alpha`:return 9;case`upper-alpha`:return 10;case`arabic-indic`:return 11;case`armenian`:return 12;case`bengali`:return 13;case`cambodian`:return 14;case`cjk-earthly-branch`:return 15;case`cjk-heavenly-stem`:return 16;case`cjk-ideographic`:return 17;case`devanagari`:return 18;case`ethiopic-numeric`:return 19;case`georgian`:return 20;case`gujarati`:return 21;case`gurmukhi`:return 22;case`hebrew`:return 22;case`hiragana`:return 23;case`hiragana-iroha`:return 24;case`japanese-formal`:return 25;case`japanese-informal`:return 26;case`kannada`:return 27;case`katakana`:return 28;case`katakana-iroha`:return 29;case`khmer`:return 30;case`korean-hangul-formal`:return 31;case`korean-hanja-formal`:return 32;case`korean-hanja-informal`:return 33;case`lao`:return 34;case`lower-armenian`:return 35;case`malayalam`:return 36;case`mongolian`:return 37;case`myanmar`:return 38;case`oriya`:return 39;case`persian`:return 40;case`simp-chinese-formal`:return 41;case`simp-chinese-informal`:return 42;case`tamil`:return 43;case`telugu`:return 44;case`thai`:return 45;case`tibetan`:return 46;case`trad-chinese-formal`:return 47;case`trad-chinese-informal`:return 48;case`upper-armenian`:return 49;case`disclosure-open`:return 50;case`disclosure-closed`:return 51;case`none`:default:return-1}}},zi=function(e){return{name:`margin-`+e,initialValue:`0`,prefix:!1,type:4}},Bi=zi(`top`),Vi=zi(`right`),Hi=zi(`bottom`),Ui=zi(`left`),Wi={name:`overflow`,initialValue:`visible`,prefix:!1,type:1,parse:function(e,t){return t.filter(F).map(function(e){switch(e.value){case`hidden`:return 1;case`scroll`:return 2;case`clip`:return 3;case`auto`:return 4;case`visible`:default:return 0}})}},Gi={name:`overflow-wrap`,initialValue:`normal`,prefix:!1,type:2,parse:function(e,t){switch(t){case`break-word`:return`break-word`;case`normal`:default:return`normal`}}},Ki=function(e){return{name:`padding-`+e,initialValue:`0`,prefix:!1,type:3,format:`length-percentage`}},qi=Ki(`top`),Ji=Ki(`right`),Yi=Ki(`bottom`),Xi=Ki(`left`),Zi={name:`text-align`,initialValue:`left`,prefix:!1,type:2,parse:function(e,t){switch(t){case`right`:return 2;case`center`:case`justify`:return 1;case`left`:default:return 0}}},Qi={name:`position`,initialValue:`static`,prefix:!1,type:2,parse:function(e,t){switch(t){case`relative`:return 1;case`absolute`:return 2;case`fixed`:return 3;case`sticky`:return 4}return 0}},$i={name:`text-shadow`,initialValue:`none`,type:1,prefix:!1,parse:function(e,t){return t.length===1&&tr(t[0],`none`)?[]:I(t).map(function(t){for(var n={color:H.TRANSPARENT,offsetX:R,offsetY:R,blur:R},r=0,i=0;i1?1:0],this.overflowWrap=G(e,Gi,t.overflowWrap),this.paddingTop=G(e,qi,t.paddingTop),this.paddingRight=G(e,Ji,t.paddingRight),this.paddingBottom=G(e,Yi,t.paddingBottom),this.paddingLeft=G(e,Xi,t.paddingLeft),this.paintOrder=G(e,Ea,t.paintOrder),this.position=G(e,Qi,t.position),this.textAlign=G(e,Zi,t.textAlign),this.textDecorationColor=G(e,fa,t.textDecorationColor??t.color),this.textDecorationLine=G(e,pa,t.textDecorationLine??t.textDecoration),this.textShadow=G(e,$i,t.textShadow),this.textTransform=G(e,ea,t.textTransform),this.transform=G(e,ta,t.transform),this.transformOrigin=G(e,aa,t.transformOrigin),this.visibility=G(e,oa,t.visibility),this.webkitTextStrokeColor=G(e,Da,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=G(e,Oa,t.webkitTextStrokeWidth),this.wordBreak=G(e,ca,t.wordBreak),this.zIndex=G(e,la,t.zIndex)}return e.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},e.prototype.isTransparent=function(){return vr(this.backgroundColor)},e.prototype.isTransformed=function(){return this.transform!==null},e.prototype.isPositioned=function(){return this.position!==0},e.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},e.prototype.isFloating=function(){return this.float!==0},e.prototype.isInlineLevel=function(){return W(this.display,4)||W(this.display,33554432)||W(this.display,268435456)||W(this.display,536870912)||W(this.display,67108864)||W(this.display,134217728)},e}(),Aa=function(){function e(e,t){this.content=G(e,ya,t.content),this.quotes=G(e,Ca,t.quotes)}return e}(),ja=function(){function e(e,t){this.counterIncrement=G(e,ba,t.counterIncrement),this.counterReset=G(e,xa,t.counterReset)}return e}(),G=function(e,t,n){var r=new Xn,i=n==null?t.initialValue:n.toString();r.write(i);var a=new Zn(r.read());switch(t.type){case 2:var o=a.parseComponentValue();return t.parse(e,F(o)?o.value:t.initialValue);case 0:return t.parse(e,a.parseComponentValue());case 1:return t.parse(e,a.parseComponentValues());case 4:return a.parseComponentValue();case 3:switch(t.format){case`angle`:return mr.parse(e,a.parseComponentValue());case`color`:return _r.parse(e,a.parseComponentValue());case`image`:return Yr.parse(e,a.parseComponentValue());case`length`:var s=a.parseComponentValue();return ar(s)?s:R;case`length-percentage`:var c=a.parseComponentValue();return L(c)?c:R;case`time`:return ua.parse(e,a.parseComponentValue())}break}},Ma=`data-html2canvas-debug`,Na=function(e){switch(e.getAttribute(Ma)){case`all`:return 1;case`clone`:return 2;case`parse`:return 3;case`render`:return 4;default:return 0}},Pa=function(e,t){var n=Na(e);return n===1||t===n},K=function(){function e(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Pa(t,3))debugger;this.styles=new ka(e,window.getComputedStyle(t,null)),xs(t)&&(this.styles.animationDuration.some(function(e){return e>0})&&(t.style.animationDuration=`0s`),this.styles.transform!==null&&(t.style.transform=`none`)),this.bounds=s(this.context,t),Pa(t,4)&&(this.flags|=16)}return e}(),Fa=`AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=`,Ia=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,La=typeof Uint8Array>`u`?[]:new Uint8Array(256),Ra=0;Ra>4,u[i++]=(o&15)<<4|s>>2,u[i++]=(s&3)<<6|c&63;return l},Ba=function(e){for(var t=e.length,n=[],r=0;r>Ha,qa=(1<>Ha)+32,Ya=65536>>Ua,Xa=(1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Ha],t=(t<>Ha)],t=(t<>Ua),t=this.index[t],t+=e>>Ha&Xa,t=this.index[t],t=(t<`u`?[]:new Uint8Array(256),ro=0;ro=55296&&i<=56319&&n>10)+55296,a%1024+56320)),(r+1===t||n.length>16384)&&(i+=String.fromCharCode.apply(String,n),n.length=0)}return i},xo=$a(Fa),So=`×`,Co=`÷`,wo=function(e){return xo.get(e)},To=function(e,t,n){var r=n-2,i=t[r],a=t[n-1],o=t[n];if(a===ao&&o===oo)return So;if(a===ao||a===oo||a===so||o===ao||o===oo||o===so)return Co;if(a===uo&&[uo,fo,mo,ho].indexOf(o)!==-1||(a===mo||a===fo)&&(o===fo||o===po)||(a===ho||a===po)&&o===po||o===go||o===co||o===lo||a===io)return So;if(a===go&&o===_o){for(;i===co;)i=t[--r];if(i===_o)return So}if(a===vo&&o===vo){for(var s=0;i===vo;)s++,i=t[--r];if(s%2==0)return So}return Co},Eo=function(e){var t=yo(e),n=t.length,r=0,i=0,a=t.map(wo);return{next:function(){if(r>=n)return{done:!0,value:null};for(var e=So;ro.x||i.y>o.y;return o=i,t===0?!0:s});return e.body.removeChild(t),s},Ao=function(){return new Image().crossOrigin!==void 0},jo=function(){return typeof new XMLHttpRequest().responseType==`string`},Mo=function(e){var t=new Image,n=e.createElement(`canvas`),r=n.getContext(`2d`);if(!r)return!1;t.src=`data:image/svg+xml,`;try{r.drawImage(t,0,0),n.toDataURL()}catch{return!1}return!0},No=function(e){return e[0]===0&&e[1]===255&&e[2]===0&&e[3]===255},Po=function(e){var t=e.createElement(`canvas`),n=100;t.width=n,t.height=n;var r=t.getContext(`2d`);if(!r)return Promise.reject(!1);r.fillStyle=`rgb(0, 255, 0)`,r.fillRect(0,0,n,n);var i=new Image,a=t.toDataURL();i.src=a;var o=Fo(n,n,0,0,i);return r.fillStyle=`red`,r.fillRect(0,0,n,n),Io(o).then(function(t){r.drawImage(t,0,0);var i=r.getImageData(0,0,n,n).data;r.fillStyle=`red`,r.fillRect(0,0,n,n);var o=e.createElement(`div`);return o.style.backgroundImage=`url(`+a+`)`,o.style.height=n+`px`,No(i)?Io(Fo(n,n,0,0,o)):Promise.reject(!1)}).then(function(e){return r.drawImage(e,0,0),No(r.getImageData(0,0,n,n).data)}).catch(function(){return!1})},Fo=function(e,t,n,r,i){var a=`http://www.w3.org/2000/svg`,o=document.createElementNS(a,`svg`),s=document.createElementNS(a,`foreignObject`);return o.setAttributeNS(null,`width`,e.toString()),o.setAttributeNS(null,`height`,t.toString()),s.setAttributeNS(null,`width`,`100%`),s.setAttributeNS(null,`height`,`100%`),s.setAttributeNS(null,`x`,n.toString()),s.setAttributeNS(null,`y`,r.toString()),s.setAttributeNS(null,`externalResourcesRequired`,`true`),o.appendChild(s),s.appendChild(i),o},Io=function(e){return new Promise(function(t,n){var r=new Image;r.onload=function(){return t(r)},r.onerror=n,r.src=`data:image/svg+xml;charset=utf-8,`+encodeURIComponent(new XMLSerializer().serializeToString(e))})},q={get SUPPORT_RANGE_BOUNDS(){var e=Oo(document);return Object.defineProperty(q,`SUPPORT_RANGE_BOUNDS`,{value:e}),e},get SUPPORT_WORD_BREAKING(){var e=q.SUPPORT_RANGE_BOUNDS&&ko(document);return Object.defineProperty(q,`SUPPORT_WORD_BREAKING`,{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=Mo(document);return Object.defineProperty(q,`SUPPORT_SVG_DRAWING`,{value:e}),e},get SUPPORT_FOREIGNOBJECT_DRAWING(){var e=typeof Array.from==`function`&&typeof window.fetch==`function`?Po(document):Promise.resolve(!1);return Object.defineProperty(q,`SUPPORT_FOREIGNOBJECT_DRAWING`,{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=Ao();return Object.defineProperty(q,`SUPPORT_CORS_IMAGES`,{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e=jo();return Object.defineProperty(q,`SUPPORT_RESPONSE_TYPE`,{value:e}),e},get SUPPORT_CORS_XHR(){var e=`withCredentials`in new XMLHttpRequest;return Object.defineProperty(q,`SUPPORT_CORS_XHR`,{value:e}),e},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var e=!!(typeof Intl<`u`&&Intl.Segmenter);return Object.defineProperty(q,`SUPPORT_NATIVE_TEXT_SEGMENTATION`,{value:e}),e}},Lo=function(){function e(e,t){this.text=e,this.bounds=t}return e}(),Ro=function(e,t,n,r){var i=Uo(t,n),a=[],s=0;return i.forEach(function(t){if(n.textDecorationLine.length||t.trim().length>0)if(q.SUPPORT_RANGE_BOUNDS){var i=Bo(r,s,t.length).getClientRects();if(i.length>1){var c=Vo(t),l=0;c.forEach(function(t){a.push(new Lo(t,o.fromDOMRectList(e,Bo(r,l+s,t.length).getClientRects()))),l+=t.length})}else a.push(new Lo(t,o.fromDOMRectList(e,i)))}else{var u=r.splitText(t.length);a.push(new Lo(t,zo(e,r))),r=u}else q.SUPPORT_RANGE_BOUNDS||(r=r.splitText(t.length));s+=t.length}),a},zo=function(e,t){var n=t.ownerDocument;if(n){var r=n.createElement(`html2canvaswrapper`);r.appendChild(t.cloneNode(!0));var i=t.parentNode;if(i){i.replaceChild(r,t);var a=s(e,r);return r.firstChild&&i.replaceChild(r.firstChild,r),a}}return o.EMPTY},Bo=function(e,t,n){var r=e.ownerDocument;if(!r)throw Error(`Node has no owner document`);var i=r.createRange();return i.setStart(e,t),i.setEnd(e,t+n),i},Vo=function(e){if(q.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:`grapheme`});return Array.from(t.segment(e)).map(function(e){return e.segment})}return Do(e)},Ho=function(e,t){if(q.SUPPORT_NATIVE_TEXT_SEGMENTATION){var n=new Intl.Segmenter(void 0,{granularity:`word`});return Array.from(n.segment(e)).map(function(e){return e.segment})}return Go(e,t)},Uo=function(e,t){return t.letterSpacing===0?Ho(e,t):Vo(e)},Wo=[32,160,4961,65792,65793,4153,4241],Go=function(e,t){for(var n=ft(e,{lineBreak:t.lineBreak,wordBreak:t.overflowWrap===`break-word`?`break-word`:t.wordBreak}),r=[],i,a=function(){if(i.value){var e=l(i.value.slice()),t=``;e.forEach(function(e){Wo.indexOf(e)===-1?t+=u(e):(t.length&&r.push(t),r.push(u(e)),t=``)}),t.length&&r.push(t)}};!(i=n.next()).done;)a();return r},Ko=function(){function e(e,t,n){this.text=qo(t.data,n.textTransform),this.textBounds=Ro(e,this.text,n,t)}return e}(),qo=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(Jo,Yo);case 2:return e.toUpperCase();default:return e}},Jo=/(^|\s|:|-|\(|\))([a-z])/g,Yo=function(e,t,n){return e.length>0?t+n.toUpperCase():e},Xo=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.src=n.currentSrc||n.src,r.intrinsicWidth=n.naturalWidth,r.intrinsicHeight=n.naturalHeight,r.context.cache.addImage(r.src),r}return n}(K),Zo=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.canvas=n,r.intrinsicWidth=n.width,r.intrinsicHeight=n.height,r}return n}(K),Qo=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this,i=new XMLSerializer,a=s(t,n);return n.setAttribute(`width`,a.width+`px`),n.setAttribute(`height`,a.height+`px`),r.svg=`data:image/svg+xml,`+encodeURIComponent(i.serializeToString(n)),r.intrinsicWidth=n.width.baseVal.value,r.intrinsicHeight=n.height.baseVal.value,r.context.cache.addImage(r.svg),r}return n}(K),$o=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.value=n.value,r}return n}(K),es=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.start=n.start,r.reversed=typeof n.reversed==`boolean`&&n.reversed===!0,r}return n}(K),ts=[{type:15,flags:0,unit:`px`,number:3}],ns=[{type:16,flags:0,number:50}],rs=function(e){return e.width>e.height?new o(e.left+(e.width-e.height)/2,e.top,e.height,e.height):e.width0)n.textNodes.push(new Ko(e,i,n.styles));else if(bs(i))if(Ls(i)&&i.assignedNodes)i.assignedNodes().forEach(function(t){return ms(e,t,n,r)});else{var o=hs(e,i);o.styles.isVisible()&&(_s(i,o,r)?o.flags|=4:vs(o.styles)&&(o.flags|=2),ps.indexOf(i.tagName)!==-1&&(o.flags|=8),n.elements.push(o),i.slot,i.shadowRoot?ms(e,i.shadowRoot,o,r):!Fs(i)&&!Ds(i)&&!Is(i)&&ms(e,i,o,r))}},hs=function(e,t){return js(t)?new Xo(e,t):ks(t)?new Zo(e,t):Ds(t)?new Qo(e,t):Cs(t)?new $o(e,t):ws(t)?new es(e,t):Ts(t)?new ls(e,t):Is(t)?new us(e,t):Fs(t)?new ds(e,t):Ms(t)?new fs(e,t):new K(e,t)},gs=function(e,t){var n=hs(e,t);return n.flags|=4,ms(e,t,n,n),n},_s=function(e,t,n){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||Os(e)&&n.styles.isTransparent()},vs=function(e){return e.isPositioned()||e.isFloating()},ys=function(e){return e.nodeType===Node.TEXT_NODE},bs=function(e){return e.nodeType===Node.ELEMENT_NODE},xs=function(e){return bs(e)&&e.style!==void 0&&!Ss(e)},Ss=function(e){return typeof e.className==`object`},Cs=function(e){return e.tagName===`LI`},ws=function(e){return e.tagName===`OL`},Ts=function(e){return e.tagName===`INPUT`},Es=function(e){return e.tagName===`HTML`},Ds=function(e){return e.tagName===`svg`},Os=function(e){return e.tagName===`BODY`},ks=function(e){return e.tagName===`CANVAS`},As=function(e){return e.tagName===`VIDEO`},js=function(e){return e.tagName===`IMG`},Ms=function(e){return e.tagName===`IFRAME`},Ns=function(e){return e.tagName===`STYLE`},Ps=function(e){return e.tagName===`SCRIPT`},Fs=function(e){return e.tagName===`TEXTAREA`},Is=function(e){return e.tagName===`SELECT`},Ls=function(e){return e.tagName===`SLOT`},Rs=function(e){return e.tagName.indexOf(`-`)>0},zs=function(){function e(){this.counters={}}return e.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},e.prototype.getCounterValues=function(e){return this.counters[e]||[]},e.prototype.pop=function(e){var t=this;e.forEach(function(e){return t.counters[e].pop()})},e.prototype.parse=function(e){var t=this,n=e.counterIncrement,r=e.counterReset,i=!0;n!==null&&n.forEach(function(e){var n=t.counters[e.counter];n&&e.increment!==0&&(i=!1,n.length||n.push(1),n[Math.max(0,n.length-1)]+=e.increment)});var a=[];return i&&r.forEach(function(e){var n=t.counters[e.counter];a.push(e.counter),n||=t.counters[e.counter]=[],n.push(e.reset)}),a},e}(),Bs={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:[`M`,`CM`,`D`,`CD`,`C`,`XC`,`L`,`XL`,`X`,`IX`,`V`,`IV`,`I`]},Vs={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:`Ք.Փ.Ւ.Ց.Ր.Տ.Վ.Ս.Ռ.Ջ.Պ.Չ.Ո.Շ.Ն.Յ.Մ.Ճ.Ղ.Ձ.Հ.Կ.Ծ.Խ.Լ.Ի.Ժ.Թ.Ը.Է.Զ.Ե.Դ.Գ.Բ.Ա`.split(`.`)},Hs={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:`י׳.ט׳.ח׳.ז׳.ו׳.ה׳.ד׳.ג׳.ב׳.א׳.ת.ש.ר.ק.צ.פ.ע.ס.נ.מ.ל.כ.יט.יח.יז.טז.טו.י.ט.ח.ז.ו.ה.ד.ג.ב.א`.split(`.`)},Us={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:`ჵ.ჰ.ჯ.ჴ.ხ.ჭ.წ.ძ.ც.ჩ.შ.ყ.ღ.ქ.ფ.ჳ.ტ.ს.რ.ჟ.პ.ო.ჲ.ნ.მ.ლ.კ.ი.თ.ჱ.ზ.ვ.ე.დ.გ.ბ.ა`.split(`.`)},Ws=function(e,t,n,r,i,a){return en?nc(e,i,a.length>0):r.integers.reduce(function(t,n,i){for(;e>=n;)e-=n,t+=r.values[i];return t},``)+a},Gs=function(e,t,n,r){var i=``;do n||e--,i=r(e)+i,e/=t;while(e*t>=t);return i},J=function(e,t,n,r,i){var a=n-t+1;return(e<0?`-`:``)+(Gs(Math.abs(e),a,r,function(e){return u(Math.floor(e%a)+t)})+i)},Ks=function(e,t,n){n===void 0&&(n=`. `);var r=t.length;return Gs(Math.abs(e),r,!1,function(e){return t[Math.floor(e%r)]})+n},qs=1,Js=2,Ys=4,Xs=8,Zs=function(e,t,n,r,i,a){if(e<-9999||e>9999)return nc(e,4,i.length>0);var o=Math.abs(e),s=i;if(o===0)return t[0]+s;for(var c=0;o>0&&c<=4;c++){var l=o%10;l===0&&W(a,qs)&&s!==``?s=t[l]+s:l>1||l===1&&c===0||l===1&&c===1&&W(a,Js)||l===1&&c===1&&W(a,Ys)&&e>100||l===1&&c>1&&W(a,Xs)?s=t[l]+(c>0?n[c-1]:``)+s:l===1&&c>0&&(s=n[c-1]+s),o=Math.floor(o/10)}return(e<0?r:``)+s},Qs=`十百千萬`,$s=`拾佰仟萬`,ec=`マイナス`,tc=`마이너스`,nc=function(e,t,n){var r=n?`. `:``,i=n?`、`:``,a=n?`, `:``,o=n?` `:``;switch(t){case 0:return`•`+o;case 1:return`◦`+o;case 2:return`◾`+o;case 5:var s=J(e,48,57,!0,r);return s.length<4?`0`+s:s;case 4:return Ks(e,`〇一二三四五六七八九`,i);case 6:return Ws(e,1,3999,Bs,3,r).toLowerCase();case 7:return Ws(e,1,3999,Bs,3,r);case 8:return J(e,945,969,!1,r);case 9:return J(e,97,122,!1,r);case 10:return J(e,65,90,!1,r);case 11:return J(e,1632,1641,!0,r);case 12:case 49:return Ws(e,1,9999,Vs,3,r);case 35:return Ws(e,1,9999,Vs,3,r).toLowerCase();case 13:return J(e,2534,2543,!0,r);case 14:case 30:return J(e,6112,6121,!0,r);case 15:return Ks(e,`子丑寅卯辰巳午未申酉戌亥`,i);case 16:return Ks(e,`甲乙丙丁戊己庚辛壬癸`,i);case 17:case 48:return Zs(e,`零一二三四五六七八九`,Qs,`負`,i,Js|Ys|Xs);case 47:return Zs(e,`零壹貳參肆伍陸柒捌玖`,$s,`負`,i,qs|Js|Ys|Xs);case 42:return Zs(e,`零一二三四五六七八九`,Qs,`负`,i,Js|Ys|Xs);case 41:return Zs(e,`零壹贰叁肆伍陆柒捌玖`,$s,`负`,i,qs|Js|Ys|Xs);case 26:return Zs(e,`〇一二三四五六七八九`,`十百千万`,ec,i,0);case 25:return Zs(e,`零壱弐参四伍六七八九`,`拾百千万`,ec,i,qs|Js|Ys);case 31:return Zs(e,`영일이삼사오육칠팔구`,`십백천만`,tc,a,qs|Js|Ys);case 33:return Zs(e,`零一二三四五六七八九`,`十百千萬`,tc,a,0);case 32:return Zs(e,`零壹貳參四五六七八九`,`拾百千`,tc,a,qs|Js|Ys);case 18:return J(e,2406,2415,!0,r);case 20:return Ws(e,1,19999,Us,3,r);case 21:return J(e,2790,2799,!0,r);case 22:return J(e,2662,2671,!0,r);case 22:return Ws(e,1,10999,Hs,3,r);case 23:return Ks(e,`あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん`);case 24:return Ks(e,`いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす`);case 27:return J(e,3302,3311,!0,r);case 28:return Ks(e,`アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン`,i);case 29:return Ks(e,`イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス`,i);case 34:return J(e,3792,3801,!0,r);case 37:return J(e,6160,6169,!0,r);case 38:return J(e,4160,4169,!0,r);case 39:return J(e,2918,2927,!0,r);case 40:return J(e,1776,1785,!0,r);case 43:return J(e,3046,3055,!0,r);case 44:return J(e,3174,3183,!0,r);case 45:return J(e,3664,3673,!0,r);case 46:return J(e,3872,3881,!0,r);case 3:default:return J(e,48,57,!0,r)}},rc=`data-html2canvas-ignore`,ic=function(){function e(e,t,n){if(this.context=e,this.options=n,this.scrolledElements=[],this.referenceElement=t,this.counters=new zs,this.quoteDepth=0,!t.ownerDocument)throw Error(`Cloned element does not have an owner document`);this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return e.prototype.toIFrame=function(e,t){var n=this,a=oc(e,t);if(!a.contentWindow)return Promise.reject(`Unable to find iframe window`);var o=e.defaultView.pageXOffset,s=e.defaultView.pageYOffset,c=a.contentWindow,l=c.document,u=lc(a).then(function(){return r(n,void 0,void 0,function(){var e,n;return i(this,function(r){switch(r.label){case 0:return this.scrolledElements.forEach(mc),c&&(c.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(c.scrollY!==t.top||c.scrollX!==t.left)&&(this.context.logger.warn(`Unable to restore scroll position for cloned document`),this.context.windowBounds=this.context.windowBounds.add(c.scrollX-t.left,c.scrollY-t.top,0,0))),e=this.options.onclone,n=this.clonedReferenceElement,n===void 0?[2,Promise.reject(`Error finding the `+this.referenceElement.nodeName+` in the cloned document`)]:l.fonts&&l.fonts.ready?[4,l.fonts.ready]:[3,2];case 1:r.sent(),r.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,cc(l)]:[3,4];case 3:r.sent(),r.label=4;case 4:return typeof e==`function`?[2,Promise.resolve().then(function(){return e(l,n)}).then(function(){return a})]:[2,a]}})})});return l.open(),l.write(fc(document.doctype)+``),pc(this.referenceElement.ownerDocument,o,s),l.replaceChild(l.adoptNode(this.documentElement),l.documentElement),l.close(),u},e.prototype.createElementClone=function(e){if(Pa(e,2))debugger;if(ks(e))return this.createCanvasClone(e);if(As(e))return this.createVideoClone(e);if(Ns(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return js(t)&&(js(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=``),t.loading===`lazy`&&(t.loading=`eager`)),Rs(t)?this.createCustomElementClone(t):t},e.prototype.createCustomElementClone=function(e){var t=document.createElement(`html2canvascustomelement`);return dc(e.style,t),t},e.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var n=[].slice.call(t.cssRules,0).reduce(function(e,t){return t&&typeof t.cssText==`string`?e+t.cssText:e},``),r=e.cloneNode(!1);return r.textContent=n,r}}catch(e){if(this.context.logger.error(`Unable to access cssRules property`,e),e.name!==`SecurityError`)throw e}return e.cloneNode(!1)},e.prototype.createCanvasClone=function(e){if(this.options.inlineImages&&e.ownerDocument){var t=e.ownerDocument.createElement(`img`);try{return t.src=e.toDataURL(),t}catch{this.context.logger.info(`Unable to inline canvas contents, canvas is tainted`,e)}}var n=e.cloneNode(!1);try{n.width=e.width,n.height=e.height;var r=e.getContext(`2d`),i=n.getContext(`2d`);if(i)if(!this.options.allowTaint&&r)i.putImageData(r.getImageData(0,0,e.width,e.height),0,0);else{var a=e.getContext(`webgl2`)??e.getContext(`webgl`);a&&a.getContextAttributes()?.preserveDrawingBuffer===!1&&this.context.logger.warn(`Unable to clone WebGL context as it has preserveDrawingBuffer=false`,e),i.drawImage(e,0,0)}return n}catch{this.context.logger.info(`Unable to clone canvas as it is tainted`,e)}return n},e.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement(`canvas`);t.width=e.offsetWidth,t.height=e.offsetHeight;var n=t.getContext(`2d`);try{return n&&(n.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||n.getImageData(0,0,t.width,t.height)),t}catch{this.context.logger.info(`Unable to clone video as it is tainted`,e)}var r=e.ownerDocument.createElement(`canvas`);return r.width=e.offsetWidth,r.height=e.offsetHeight,r},e.prototype.appendChildNode=function(e,t,n){(!bs(t)||!Ps(t)&&!t.hasAttribute(rc)&&(typeof this.options.ignoreElements!=`function`||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!bs(t)||!Ns(t))&&e.appendChild(this.cloneNode(t,n))},e.prototype.cloneChildNodes=function(e,t,n){for(var r=this,i=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;i;i=i.nextSibling)if(bs(i)&&Ls(i)&&typeof i.assignedNodes==`function`){var a=i.assignedNodes();a.length&&a.forEach(function(e){return r.appendChildNode(t,e,n)})}else this.appendChildNode(t,i,n)},e.prototype.cloneNode=function(e,t){if(ys(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var n=e.ownerDocument.defaultView;if(n&&bs(e)&&(xs(e)||Ss(e))){var r=this.createElementClone(e);r.style.transitionProperty=`none`;var i=n.getComputedStyle(e),a=n.getComputedStyle(e,`:before`),o=n.getComputedStyle(e,`:after`);this.referenceElement===e&&xs(r)&&(this.clonedReferenceElement=r),Os(r)&&bc(r);var s=this.counters.parse(new ja(this.context,i)),c=this.resolvePseudoContent(e,r,a,ac.BEFORE);Rs(e)&&(t=!0),As(e)||this.cloneChildNodes(e,r,t),c&&r.insertBefore(c,r.firstChild);var l=this.resolvePseudoContent(e,r,o,ac.AFTER);return l&&r.appendChild(l),this.counters.pop(s),(i&&(this.options.copyStyles||Ss(e))&&!Ms(e)||t)&&dc(i,r),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(Fs(e)||Is(e))&&(Fs(r)||Is(r))&&(r.value=e.value),r}return e.cloneNode(!1)},e.prototype.resolvePseudoContent=function(e,t,n,r){var i=this;if(n){var a=n.content,o=t.ownerDocument;if(!(!o||!a||a===`none`||a===`-moz-alt-content`||n.display===`none`)){this.counters.parse(new ja(this.context,n));var s=new Aa(this.context,n),c=o.createElement(`html2canvaspseudoelement`);dc(n,c),s.content.forEach(function(t){if(t.type===0)c.appendChild(o.createTextNode(t.value));else if(t.type===22){var n=o.createElement(`img`);n.src=t.value,n.style.opacity=`1`,c.appendChild(n)}else if(t.type===18){if(t.name===`attr`){var r=t.values.filter(F);r.length&&c.appendChild(o.createTextNode(e.getAttribute(r[0].value)||``))}else if(t.name===`counter`){var a=t.values.filter(rr),l=a[0],u=a[1];if(l&&F(l)){var d=i.counters.getCounterValue(l.value),f=u&&F(u)?Ri.parse(i.context,u.value):3;c.appendChild(o.createTextNode(nc(d,f,!1)))}}else if(t.name===`counters`){var p=t.values.filter(rr),l=p[0],m=p[1],u=p[2];if(l&&F(l)){var h=i.counters.getCounterValues(l.value),g=u&&F(u)?Ri.parse(i.context,u.value):3,_=m&&m.type===0?m.value:``,v=h.map(function(e){return nc(e,g,!1)}).join(_);c.appendChild(o.createTextNode(v))}}}else if(t.type===20)switch(t.value){case`open-quote`:c.appendChild(o.createTextNode(wa(s.quotes,i.quoteDepth++,!0)));break;case`close-quote`:c.appendChild(o.createTextNode(wa(s.quotes,--i.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(t.value))}}),c.className=_c+` `+vc;var l=r===ac.BEFORE?` `+_c:` `+vc;return Ss(t)?t.className.baseValue+=l:t.className+=l,c}}},e.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},e}(),ac;(function(e){e[e.BEFORE=0]=`BEFORE`,e[e.AFTER=1]=`AFTER`})(ac||={});var oc=function(e,t){var n=e.createElement(`iframe`);return n.className=`html2canvas-container`,n.style.visibility=`hidden`,n.style.position=`fixed`,n.style.left=`-10000px`,n.style.top=`0px`,n.style.border=`0`,n.width=t.width.toString(),n.height=t.height.toString(),n.scrolling=`no`,n.setAttribute(rc,`true`),e.body.appendChild(n),n},sc=function(e){return new Promise(function(t){if(e.complete){t();return}if(!e.src){t();return}e.onload=t,e.onerror=t})},cc=function(e){return Promise.all([].slice.call(e.images,0).map(sc))},lc=function(e){return new Promise(function(t,n){var r=e.contentWindow;if(!r)return n(`No window assigned for iframe`);var i=r.document;r.onload=e.onload=function(){r.onload=e.onload=null;var n=setInterval(function(){i.body.childNodes.length>0&&i.readyState===`complete`&&(clearInterval(n),t(e))},50)}})},uc=[`all`,`d`,`content`],dc=function(e,t){for(var n=e.length-1;n>=0;n--){var r=e.item(n);uc.indexOf(r)===-1&&t.style.setProperty(r,e.getPropertyValue(r))}return t},fc=function(e){var t=``;return e&&(t+=``),t},pc=function(e,t,n){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||n!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,n)},mc=function(e){var t=e[0],n=e[1],r=e[2];t.scrollLeft=n,t.scrollTop=r},hc=`:before`,gc=`:after`,_c=`___html2canvas___pseudoelement_before`,vc=`___html2canvas___pseudoelement_after`,yc=`{ content: "" !important; display: none !important; }`,bc=function(e){xc(e,`.`+_c+hc+yc+` diff --git a/dist/assets/html2canvas-DNGmdnmT.js b/dist/assets/html2canvas-DNGmdnmT.js deleted file mode 100644 index 82552fb0..00000000 --- a/dist/assets/html2canvas-DNGmdnmT.js +++ /dev/null @@ -1 +0,0 @@ -import{t as e}from"./html2canvas-DKfOm221.js";export default e(); \ No newline at end of file diff --git a/dist/assets/index-BlYU7j-M.js b/dist/assets/index-BlYU7j-M.js new file mode 100644 index 00000000..9bdfe60e --- /dev/null +++ b/dist/assets/index-BlYU7j-M.js @@ -0,0 +1,668 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KaiVohModal-CRpJD1P8.js","assets/x-CaPcBV4E.js","assets/SigilAuthContext-CIPXJp4C.js","assets/SigilAuthProvider-ea2w3ibF.js","assets/KaiVohModal-BoBXtABf.css","assets/SigilModal-DLOp9UnU.js","assets/html2canvas-D-AxDBo3.js","assets/SealMomentModal-C7mxkSGB.js","assets/SigilModal-Dm4zpSIO.js","assets/SigilModal-DGdZ8fUg.css","assets/HomePriceChartCard-B_k89uIK.js","assets/prop-types-BWhc8UTz.js","assets/HomePriceChartCard-CJ53Phm1.css","assets/SigilExplorer-PXIdIaMp.js","assets/usernameClaimRegistry-B6UXZAUR.js","assets/SigilExplorer-Cps9vI9P.css","assets/EternalKlock-xlhlR_nN.js","assets/EternalKlock-CdflKbWu.js","assets/EternalKlock-6uoAd3Qk.css","assets/SigilStreamRoot-BAeCOlJX.js","assets/SigilStreamRoot-LmEGlu4-.js","assets/sigilRegistry-dB0OrrJi.js","assets/sigilRegistry-Cw7cMZ5l.css","assets/useFastPress-MOMn9nZb.js","assets/SigilStreamRoot-w6_y4vVF.css","assets/SigilFeedPage-C5nsUmbd.js","assets/SigilFeedPage-CqIDmlsu.css","assets/SigilPage-CGk_cWZs.js","assets/svgMeta-Bpz7076A.js","assets/SigilPage-BE_ftg2I.css","assets/VerifyPage-CexUA7n1.js","assets/VerifierFrame-a5dTHTgU.js","assets/VerifierFrame-D0e_dB-R.css","assets/VerifyPage-jbjk8aGt.css"])))=>i.map(i=>d[i]); +var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(e&&(t=e(e=0)),t),s=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),c=e=>{let n={};for(var r in e)t(n,r,{get:e[r],enumerable:!0});return n},l=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},u=(n,r,a)=>(a=n==null?{}:e(i(n)),l(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),d=e=>l(t({},`__esModule`,{value:!0}),e),f=e=>t=>u(t.default,e),p=(e=>typeof require<`u`?require:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof require<`u`?require:e)[t]}):e)(function(e){if(typeof require<`u`)return require.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function.")});(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var m=s((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u{t.exports=m()})),g=s((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-Tt&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),_=s(((e,t)=>{t.exports=g()})),v=s((e=>{var t=h();function n(e){var t=`https://react.dev/errors/`+e;if(1{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=v()})),b=s((e=>{var t=_(),n=h(),r=y();function i(e){var t=`https://react.dev/errors/`+e;if(1B||(e.current=z[B],z[B]=null,B--)}function U(e,t){B++,z[B]=e.current,e.current=t}var ee=V(null),te=V(null),ne=V(null),re=V(null);function ie(e,t){switch(U(ne,t),U(te,e),U(ee,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Jd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Jd(t),e=Yd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}H(ee),U(ee,e)}function ae(){H(ee),H(te),H(ne)}function oe(e){e.memoizedState!==null&&U(re,e);var t=ee.current,n=Yd(t,e.type);t!==n&&(U(te,e),U(ee,n))}function se(e){te.current===e&&(H(ee),H(te)),re.current===e&&(H(re),ap._currentValue=R)}var ce,le;function ue(e){if(ce===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ce=t&&t[1]||``,le=-1)`:-1i||c[r]!==l[i]){var u=` +`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{de=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ue(n):``}function pe(e,t){switch(e.tag){case 26:case 27:case 5:return ue(e.type);case 16:return ue(`Lazy`);case 13:return e.child!==t&&t!==null?ue(`Suspense Fallback`):ue(`Suspense`);case 19:return ue(`SuspenseList`);case 0:case 15:return fe(e.type,!1);case 11:return fe(e.type.render,!1);case 1:return fe(e.type,!0);case 31:return ue(`Activity`);default:return``}}function me(e){try{var t=``,n=null;do t+=pe(e,n),n=e,e=e.return;while(e);return t}catch(e){return` +Error generating stack: `+e.message+` +`+e.stack}}var he=Object.prototype.hasOwnProperty,ge=t.unstable_scheduleCallback,_e=t.unstable_cancelCallback,ve=t.unstable_shouldYield,ye=t.unstable_requestPaint,be=t.unstable_now,xe=t.unstable_getCurrentPriorityLevel,Se=t.unstable_ImmediatePriority,Ce=t.unstable_UserBlockingPriority,we=t.unstable_NormalPriority,Te=t.unstable_LowPriority,Ee=t.unstable_IdlePriority,De=t.log,Oe=t.unstable_setDisableYieldValue,ke=null,Ae=null;function je(e){if(typeof De==`function`&&Oe(e),Ae&&typeof Ae.setStrictMode==`function`)try{Ae.setStrictMode(ke,e)}catch{}}var Me=Math.clz32?Math.clz32:W,Ne=Math.log,Pe=Math.LN2;function W(e){return e>>>=0,e===0?32:31-(Ne(e)/Pe|0)|0}var Fe=256,Ie=262144,Le=4194304;function Re(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ze(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Re(n))):i=Re(o):i=Re(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Re(n))):i=Re(o)):i=Re(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Be(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ve(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function He(){var e=Le;return Le<<=1,!(Le&62914560)&&(Le=4194304),e}function Ue(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function We(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ge(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0`u`||window.document===void 0||window.document.createElement===void 0),rn=!1;if(nn)try{var an={};Object.defineProperty(an,`passive`,{get:function(){rn=!0}}),window.addEventListener(`test`,an,an),window.removeEventListener(`test`,an,an)}catch{rn=!1}var on=null,sn=null,cn=null;function ln(){if(cn)return cn;var e,t=sn,n=t.length,r,i=`value`in on?on.value:on.textContent,a=i.length;for(e=0;e=Vn),Wn=` `,Gn=!1;function Kn(e,t){switch(e){case`keyup`:return zn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function qn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Jn=!1;function Yn(e,t){switch(e){case`compositionend`:return qn(t);case`keypress`:return t.which===32?(Gn=!0,Wn):null;case`textInput`:return e=t.data,e===Wn&&Gn?null:e;default:return null}}function Xn(e,t){if(Jn)return e===`compositionend`||!Bn&&Kn(e,t)?(e=ln(),cn=sn=on=null,Jn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=vr(n)}}function br(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?br(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function xr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=At(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=At(e.document)}return t}function Sr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Cr=nn&&`documentMode`in document&&11>=document.documentMode,wr=null,Tr=null,Er=null,Dr=!1;function Or(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Dr||wr==null||wr!==At(r)||(r=wr,`selectionStart`in r&&Sr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Er&&_r(Er,r)||(Er=r,r=Md(Tr,`onSelect`),0>=o,i-=o,bi=1<<32-Me(t)+i|n<m?(g=d,d=null):g=d.sibling;var _=p(i,d,s[m],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,m),u===null?l=_:u.sibling=_,u=_,d=g}if(m===s.length)return n(i,d),ki&&Si(i,m),l;if(d===null){for(;mg?(_=m,m=null):_=m.sibling;var y=p(a,m,v.value,l);if(y===null){m===null&&(m=_);break}e&&m&&y.alternate===null&&t(a,m),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,m=_}if(v.done)return n(a,m),ki&&Si(a,g),u;if(m===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return ki&&Si(a,g),u}for(m=r(m);!v.done;g++,v=c.next())v=h(m,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&m.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&m.forEach(function(e){return t(a,e)}),ki&&Si(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===v&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case m:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===v){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&Sa(l)===r.type){n(e,r.sibling),c=a(r,o.props),ka(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===v?(c=si(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=oi(o.type,o.key,o.props,null,e.mode,c),ka(c,o),c.return=e,e=c)}return s(e);case g:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=ui(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=Sa(o),b(e,r,o,c)}if(F(o))return _(e,r,o,c);if(M(o)){if(l=M(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Oa(o),c);if(o.$$typeof===C)return b(e,r,Xi(e,o),c);Aa(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=ci(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Da=0;var i=b(e,t,n,r);return Ea=null,i}catch(t){if(t===ga||t===va)throw t;var a=ni(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ma=ja(!0),Na=ja(!1),Pa=!1;function Fa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ia(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function La(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ra(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Rl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=$r(e),Qr(e,null,n),t}return Yr(e,r,t,n),$r(e)}function za(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,qe(e,n)}}function Ba(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Va=!1;function Ha(){if(Va){var e=sa;if(e!==null)throw e}}function Ua(e,t,n,r){Va=!1;var i=e.updateQueue;Pa=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(Vl&p)===p:(r&p)===p){p!==0&&p===oa&&(Va=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:Pa=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Yl|=o,e.lanes=o,e.memoizedState=d}}function Wa(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Ga(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=I.T,s={};I.T=s,Ms(e,!1,t,n);try{var c=i(),l=I.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?js(e,t,ua(c,r),_u(e)):js(e,t,r,_u(e))}catch(n){js(e,t,{then:function(){},status:`rejected`,reason:n},_u())}finally{L.p=a,o!==null&&s.types!==null&&(o.types=s.types),I.T=o}}function xs(){}function Ss(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Cs(e).queue;bs(e,a,t,R,n===null?xs:function(){return ws(e),n(r)})}function Cs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:R,baseState:R,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:R},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ws(e){var t=Cs(e);t.next===null&&(t=e.alternate.memoizedState),js(e,t.next.queue,{},_u())}function Ts(){return Yi(ap)}function Es(){return Oo().memoizedState}function Ds(){return Oo().memoizedState}function Os(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=_u();e=La(n);var r=Ra(t,e,n);r!==null&&(yu(r,t,n),za(r,t,n)),t={cache:na()},e.payload=t;return}t=t.return}}function ks(e,t,n){var r=_u();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ns(e)?Ps(t,n):(n=Xr(e,t,n,r),n!==null&&(yu(n,e,r),Fs(n,t,r)))}function As(e,t,n){js(e,t,n,_u())}function js(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ns(e))Ps(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,gr(s,o))return Yr(e,t,i,0),zl===null&&Jr(),!1}catch{}if(n=Xr(e,t,i,r),n!==null)return yu(n,e,r),Fs(n,t,r),!0}return!1}function Ms(e,t,n,r){if(r={lane:2,revertLane:gd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ns(e)){if(t)throw Error(i(479))}else t=Xr(e,n,r,2),t!==null&&yu(t,e,2)}function Ns(e){var t=e.alternate;return e===so||t!==null&&t===so}function Ps(e,t){fo=uo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Fs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,qe(e,n)}}var Is={readContext:Yi,use:jo,useCallback:vo,useContext:vo,useEffect:vo,useImperativeHandle:vo,useLayoutEffect:vo,useInsertionEffect:vo,useMemo:vo,useReducer:vo,useRef:vo,useState:vo,useDebugValue:vo,useDeferredValue:vo,useTransition:vo,useSyncExternalStore:vo,useId:vo,useHostTransitionStatus:vo,useFormState:vo,useActionState:vo,useOptimistic:vo,useMemoCache:vo,useCacheRefresh:vo};Is.useEffectEvent=vo;var Ls={readContext:Yi,use:jo,useCallback:function(e,t){return Do().memoizedState=[e,t===void 0?null:t],e},useContext:Yi,useEffect:ss,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),as(4194308,4,ps.bind(null,t,e),n)},useLayoutEffect:function(e,t){return as(4194308,4,e,t)},useInsertionEffect:function(e,t){as(4,2,e,t)},useMemo:function(e,t){var n=Do();t=t===void 0?null:t;var r=e();if(po){je(!0);try{e()}finally{je(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Do();if(n!==void 0){var i=n(t);if(po){je(!0);try{n(t)}finally{je(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=ks.bind(null,so,e),[r.memoizedState,e]},useRef:function(e){var t=Do();return e={current:e},t.memoizedState=e},useState:function(e){e=Uo(e);var t=e.queue,n=As.bind(null,so,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:hs,useDeferredValue:function(e,t){return vs(Do(),e,t)},useTransition:function(){var e=Uo(!1);return e=bs.bind(null,so,e.queue,!0,!1),Do().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=so,a=Do();if(ki){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),zl===null)throw Error(i(349));Vl&127||Ro(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ss(Bo.bind(null,r,o,e),[e]),r.flags|=2048,rs(9,{destroy:void 0},zo.bind(null,r,o,n,t),null),n},useId:function(){var e=Do(),t=zl.identifierPrefix;if(ki){var n=xi,r=bi;n=(r&~(1<<32-Me(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=mo++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[et]=t,o[tt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Vd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Ac(t)}}return Fc(t),jc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ac(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=ne.current,Fi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Di,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[et]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Rd(e.nodeValue,n)),e||Mi(t,!0)}else e=qd(e).createTextNode(r),e[et]=t,t.stateNode=e}return Fc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Fi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[et]=t}else Ii(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Fc(t),e=!1}else n=Li(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ro(t),t):(ro(t),null);if(t.flags&128)throw Error(i(558))}return Fc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Fi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[et]=t}else Ii(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Fc(t),a=!1}else a=Li(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(ro(t),t):(ro(t),null)}return ro(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Nc(t,t.updateQueue),Fc(t),null);case 4:return ae(),e===null&&Od(t.stateNode.containerInfo),Fc(t),null;case 10:return Ui(t.type),Fc(t),null;case 19:if(H(io),r=t.memoizedState,r===null)return Fc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Pc(r,!1);else{if(Jl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=ao(e),o!==null){for(t.flags|=128,Pc(r,!1),e=o.updateQueue,t.updateQueue=e,Nc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ai(n,e),n=n.sibling;return U(io,io.current&1|2),ki&&Si(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&be()>au&&(t.flags|=128,a=!0,Pc(r,!1),t.lanes=4194304)}else{if(!a)if(e=ao(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Nc(t,e),Pc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!ki)return Fc(t),null}else 2*be()-r.renderingStartTime>au&&n!==536870912&&(t.flags|=128,a=!0,Pc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Fc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=be(),e.sibling=null,n=io.current,U(io,a?n&1|2:n&1),ki&&Si(t,r.treeForkCount),e);case 22:case 23:return ro(t),Xa(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Fc(t),t.subtreeFlags&6&&(t.flags|=8192)):Fc(t),n=t.updateQueue,n!==null&&Nc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&H(fa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ui(ta),Fc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Lc(e,t){switch(Ti(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ui(ta),ae(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return se(t),null;case 31:if(t.memoizedState!==null){if(ro(t),t.alternate===null)throw Error(i(340));Ii()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ro(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ii()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return H(io),null;case 4:return ae(),null;case 10:return Ui(t.type),null;case 22:case 23:return ro(t),Xa(),e!==null&&H(fa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ui(ta),null;case 25:return null;default:return null}}function Rc(e,t){switch(Ti(t),t.tag){case 3:Ui(ta),ae();break;case 26:case 27:case 5:se(t);break;case 4:ae();break;case 31:t.memoizedState!==null&&ro(t);break;case 13:ro(t);break;case 19:H(io);break;case 10:Ui(t.type);break;case 22:case 23:ro(t),Xa(),e!==null&&H(fa);break;case 24:Ui(ta)}}function zc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Yu(t,t.return,e)}}function Bc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Yu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Yu(t,t.return,e)}}function Vc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ga(t,n)}catch(t){Yu(e,e.return,t)}}}function Hc(e,t,n){n.props=Ws(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Yu(e,t,n)}}function Uc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Yu(e,t,n)}}function Wc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Yu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Yu(e,t,n)}else n.current=null}function Gc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Yu(e,e.return,t)}}function Kc(e,t,n){try{var r=e.stateNode;Hd(r,e.type,n,t),r[tt]=t}catch(t){Yu(e,e.return,t)}}function qc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&af(e.type)||e.tag===4}function Jc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||qc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&af(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Yc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=qt));else if(r!==4&&(r===27&&af(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Yc(e,t,n),e=e.sibling;e!==null;)Yc(e,t,n),e=e.sibling}function Xc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&af(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Xc(e,t,n),e=e.sibling;e!==null;)Xc(e,t,n),e=e.sibling}function Zc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Vd(t,r,n),t[et]=e,t[tt]=n}catch(t){Yu(e,e.return,t)}}var Qc=!1,$c=!1,el=!1,tl=typeof WeakSet==`function`?WeakSet:Set,nl=null;function rl(e,t){if(e=e.containerInfo,Gd=mp,e=xr(e),Sr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Kd={focusedElem:e,selectionRange:n},mp=!1,nl=t;nl!==null;)if(t=nl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,nl=e;else for(;nl!==null;){switch(t=nl,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),Vd(o,r,n),o[et]=e,pt(o),r=o;break a;case`link`:var s=Jf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=yr(s,h),v=yr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,I.T=null,n=pu,pu=null;var o=lu,s=du;if(cu=0,uu=lu=null,du=0,Rl&6)throw Error(i(331));var c=Rl;if(Rl|=4,Nl(o.current),Tl(o,o.current,s,n),Rl=c,ld(0,!1),Ae&&typeof Ae.onPostCommitFiberRoot==`function`)try{Ae.onPostCommitFiberRoot(ke,o)}catch{}return!0}finally{L.p=a,I.T=r,Gu(e,t)}}function Ju(e,t,n){t=fi(n,t),t=Xs(e.stateNode,t,2),e=Ra(e,t,2),e!==null&&(We(e,2),cd(e))}function Yu(e,t,n){if(e.tag===3)Ju(e,e,n);else for(;t!==null;){if(t.tag===3){Ju(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(su===null||!su.has(r))){e=fi(n,e),n=Zs(2),r=Ra(t,n,2),r!==null&&(Qs(n,r,t,e),We(r,2),cd(r));break}}t=t.return}}function Xu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ll;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Kl=!0,i.add(n),e=Zu.bind(null,e,t,n),t.then(e,e))}function Zu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,zl===e&&(Vl&n)===n&&(Jl===4||Jl===3&&(Vl&62914560)===Vl&&300>be()-ru?!(Rl&2)&&Eu(e,0):Zl|=n,$l===Vl&&($l=0)),cd(e)}function Qu(e,t){t===0&&(t=He()),e=Zr(e,t),e!==null&&(We(e,t),cd(e))}function $u(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Qu(e,n)}function ed(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Qu(e,n)}function td(e,t){return ge(e,t)}var nd=null,rd=null,id=!1,ad=!1,od=!1,sd=0;function cd(e){e!==rd&&e.next===null&&(rd===null?nd=rd=e:rd=rd.next=e),ad=!0,id||(id=!0,hd())}function ld(e,t){if(!od&&ad){od=!0;do for(var n=!1,r=nd;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Me(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,md(r,a))}else a=Vl,a=ze(r,r===zl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Be(r,a)||(n=!0,md(r,a));r=r.next}while(n);od=!1}}function ud(){dd()}function dd(){ad=id=!1;var e=0;sd!==0&&Qd()&&(e=sd);for(var t=be(),n=null,r=nd;r!==null;){var i=r.next,a=fd(r,t);a===0?(r.next=null,n===null?nd=i:n.next=i,i===null&&(rd=n)):(n=r,(e!==0||a&3)&&(ad=!0)),r=i}cu!==0&&cu!==5||ld(e,!1),sd!==0&&(sd=0)}function fd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&Ud(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function Of(e,t,n){var r=Df;if(r&&typeof t==`string`&&t){var i=Mt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Sf.has(i)||(Sf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Vd(t,`link`,e),pt(t),r.head.appendChild(t)))}}function kf(e){wf.D(e),Of(`dns-prefetch`,e,null)}function Af(e,t){wf.C(e,t),Of(`preconnect`,e,t)}function jf(e,t,n){wf.L(e,t,n);var r=Df;if(r&&e&&t){var i=`link[rel="preload"][as="`+Mt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Mt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Mt(n.imageSizes)+`"]`)):i+=`[href="`+Mt(e)+`"]`;var a=i;switch(t){case`style`:a=Lf(e);break;case`script`:a=Vf(e)}xf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),xf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Rf(a))||t===`script`&&r.querySelector(Hf(a))||(t=r.createElement(`link`),Vd(t,`link`,e),pt(t),r.head.appendChild(t)))}}function Mf(e,t){wf.m(e,t);var n=Df;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Mt(r)+`"][href="`+Mt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Vf(e)}if(!xf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),xf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Hf(a)))return}r=n.createElement(`link`),Vd(r,`link`,e),pt(r),n.head.appendChild(r)}}}function Nf(e,t,n){wf.S(e,t,n);var r=Df;if(r&&e){var i=ft(r).hoistableStyles,a=Lf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Rf(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=xf.get(a))&&Gf(e,n);var c=o=r.createElement(`link`);pt(c),Vd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Wf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Pf(e,t){wf.X(e,t);var n=Df;if(n&&e){var r=ft(n).hoistableScripts,i=Vf(e),a=r.get(i);a||(a=n.querySelector(Hf(i)),a||(e=f({src:e,async:!0},t),(t=xf.get(i))&&Kf(e,t),a=n.createElement(`script`),pt(a),Vd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Ff(e,t){wf.M(e,t);var n=Df;if(n&&e){var r=ft(n).hoistableScripts,i=Vf(e),a=r.get(i);a||(a=n.querySelector(Hf(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=xf.get(i))&&Kf(e,t),a=n.createElement(`script`),pt(a),Vd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function If(e,t,n,r){var a=(a=ne.current)?Cf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Lf(n.href),n=ft(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Lf(n.href);var o=ft(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Rf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),xf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},xf.set(e,n),o||Bf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Vf(n),n=ft(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Lf(e){return`href="`+Mt(e)+`"`}function Rf(e){return`link[rel="stylesheet"][`+e+`]`}function zf(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Bf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Vd(t,`link`,n),pt(t),e.head.appendChild(t))}function Vf(e){return`[src="`+Mt(e)+`"]`}function Hf(e){return`script[async]`+e}function Uf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Mt(n.href)+`"]`);if(r)return t.instance=r,pt(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),pt(r),Vd(r,`style`,a),Wf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Lf(n.href);var o=e.querySelector(Rf(a));if(o)return t.state.loading|=4,t.instance=o,pt(o),o;r=zf(n),(a=xf.get(a))&&Gf(r,a),o=(e.ownerDocument||e).createElement(`link`),pt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Vd(o,`link`,r),t.state.loading|=4,Wf(o,n.precedence,e),t.instance=o;case`script`:return o=Vf(n.src),(a=e.querySelector(Hf(o)))?(t.instance=a,pt(a),a):(r=n,(a=xf.get(o))&&(r=f({},n),Kf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),pt(a),Vd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Wf(r,n.precedence,e));return t.instance}function Wf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function Xf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Zf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Qf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Lf(r.href),a=t.querySelector(Rf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=tp.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,pt(a);return}a=t.ownerDocument||t,r=zf(r),(i=xf.get(i))&&Gf(r,i),a=a.createElement(`link`),pt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Vd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=tp.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var $f=0;function ep(e,t){return e.stylesheets&&e.count===0&&rp(e,e.stylesheets),0$f?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function tp(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)rp(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var np=null;function rp(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,np=new Map,t.forEach(ip,e),np=null,tp.call(e))}function ip(e,t){if(!(t.state.loading&4)){var n=np.get(e);if(n)var r=n.get(null);else{n=new Map,np.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=b()})),S=u(x(),1),C=u(h(),1),w=u(y(),1),T=`modulepreload`,E=function(e){return`/`+e},D={};const O=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=E(t,n),t in D)return;D[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:T,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};var k=`popstate`;function A(e={}){function t(e,t){let{pathname:n,search:r,hash:i}=e.location;return F(``,{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||`default`)}function n(e,t){return typeof t==`string`?t:I(t)}return R(t,n,null,e)}function j(e,t){if(e===!1||e==null)throw Error(t)}function M(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function N(){return Math.random().toString(36).substring(2,10)}function P(e,t){return{usr:e.state,key:e.key,idx:t}}function F(e,t,n=null,r){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?L(t):t,state:n,key:t&&t.key||r||N()}}function I({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function L(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function R(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=F(h.location,e,t);n&&n(r,e),l=u()+1;let d=P(r,l),f=h.createHref(r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=F(h.location,e,t);n&&n(r,e),l=u();let i=P(r,l),d=h.createHref(r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return z(e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(k,d),c=e,()=>{i.removeEventListener(k,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function z(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),j(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:I(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}function B(e,t,n=`/`){return V(e,t,n,!1)}function V(e,t,n,r){let i=he((typeof t==`string`?L(t):t).pathname||`/`,n);if(i==null)return null;let a=U(e);te(a);let o=null;for(let e=0;o==null&&e{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;j(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=we([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(j(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),U(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:le(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of ee(e.path))a(e,t,!0,n)}),t}function ee(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=ee(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function te(e){e.sort((e,t)=>e.score===t.score?ue(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var ne=/^:[\w-]+$/,re=3,ie=2,ae=1,oe=10,se=-2,ce=e=>e===`*`;function le(e,t){let n=e.split(`/`),r=n.length;return n.some(ce)&&(r+=se),t&&(r+=ie),n.filter(e=>!ce(e)).reduce((e,t)=>e+(ne.test(t)?re:t===``?ae:oe),r)}function ue(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function de(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function pe(e,t=!1,n=!0){M(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n)=>(r.push({paramName:t,isOptional:n!=null}),n?`/?([^\\/]+)?`:`/([^\\/]+)`)).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function me(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return M(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function he(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var ge=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_e=e=>ge.test(e);function ve(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?L(e):e,a;if(n)if(_e(n))a=n;else{if(n.includes(`//`)){let e=n;n=n.replace(/\/\/+/g,`/`),M(!1,`Pathnames cannot have embedded double slashes - normalizing ${e} -> ${n}`)}a=n.startsWith(`/`)?ye(n.substring(1),`/`):ye(n,t)}else a=t;return{pathname:a,search:Ee(r),hash:De(i)}}function ye(e,t){let n=t.replace(/\/+$/,``).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function be(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function xe(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Se(e){let t=xe(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Ce(e,t,n,r=!1){let i;typeof e==`string`?i=L(e):(i={...e},j(!i.pathname||!i.pathname.includes(`?`),be(`?`,`pathname`,`search`,i)),j(!i.pathname||!i.pathname.includes(`#`),be(`#`,`pathname`,`hash`,i)),j(!i.search||!i.search.includes(`#`),be(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=ve(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var we=e=>e.join(`/`).replace(/\/\/+/g,`/`),Te=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),Ee=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,De=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e;function Oe(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function ke(e){return e.map(e=>e.route.path).filter(Boolean).join(`/`).replace(/\/\/*/g,`/`)||`/`}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Ae=C.createContext(null);Ae.displayName=`DataRouter`;var je=C.createContext(null);je.displayName=`DataRouterState`,C.createContext(!1);var Me=C.createContext({isTransitioning:!1});Me.displayName=`ViewTransition`;var Ne=C.createContext(new Map);Ne.displayName=`Fetchers`;var Pe=C.createContext(null);Pe.displayName=`Await`;var W=C.createContext(null);W.displayName=`Navigation`;var Fe=C.createContext(null);Fe.displayName=`Location`;var Ie=C.createContext({outlet:null,matches:[],isDataRoute:!1});Ie.displayName=`Route`;var Le=C.createContext(null);Le.displayName=`RouteError`;function Re(e,{relative:t}={}){j(ze(),`useHref() may be used only in the context of a component.`);let{basename:n,navigator:r}=C.useContext(W),{hash:i,pathname:a,search:o}=Je(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:we([n,a])),r.createHref({pathname:s,search:o,hash:i})}function ze(){return C.useContext(Fe)!=null}function Be(){return j(ze(),`useLocation() may be used only in the context of a component.`),C.useContext(Fe).location}var Ve=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function He(e){C.useContext(W).static||C.useLayoutEffect(e)}function Ue(){let{isDataRoute:e}=C.useContext(Ie);return e?dt():We()}function We(){j(ze(),`useNavigate() may be used only in the context of a component.`);let e=C.useContext(Ae),{basename:t,navigator:n}=C.useContext(W),{matches:r}=C.useContext(Ie),{pathname:i}=Be(),a=JSON.stringify(Se(r)),o=C.useRef(!1);return He(()=>{o.current=!0}),C.useCallback((r,s={})=>{if(M(o.current,Ve),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Ce(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:we([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var Ge=C.createContext(null);function Ke(e){let t=C.useContext(Ie).outlet;return C.useMemo(()=>t&&C.createElement(Ge.Provider,{value:e},t),[t,e])}function qe(){let{matches:e}=C.useContext(Ie),t=e[e.length-1];return t?t.params:{}}function Je(e,{relative:t}={}){let{matches:n}=C.useContext(Ie),{pathname:r}=Be(),i=JSON.stringify(Se(n));return C.useMemo(()=>Ce(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Ye(e,t){return Xe(e,t)}function Xe(e,t,n,r,i){j(ze(),`useRoutes() may be used only in the context of a component.`);let{navigator:a}=C.useContext(W),{matches:o}=C.useContext(Ie),s=o[o.length-1],c=s?s.params:{},l=s?s.pathname:`/`,u=s?s.pathnameBase:`/`,d=s&&s.route;{let e=d&&d.path||``;pt(l,!d||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant (or called \`useRoutes()\`) at "${l}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. + +Please change the parent to .`)}let f=Be(),p;if(t){let e=typeof t==`string`?L(t):t;j(u===`/`||e.pathname?.startsWith(u),`When overriding the location using \`\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${u}" but pathname "${e.pathname}" was given in the \`location\` prop.`),p=e}else p=f;let m=p.pathname||`/`,h=m;if(u!==`/`){let e=u.replace(/^\//,``).split(`/`);h=`/`+m.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let g=B(e,{pathname:h});M(d||g!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),M(g==null||g[g.length-1].route.element!==void 0||g[g.length-1].route.Component!==void 0||g[g.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`);let _=tt(g&&g.map(e=>Object.assign({},e,{params:Object.assign({},c,e.params),pathname:we([u,a.encodeLocation?a.encodeLocation(e.pathname.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?u:we([u,a.encodeLocation?a.encodeLocation(e.pathnameBase.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),o,n,r,i);return t&&_?C.createElement(Fe.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,...p},navigationType:`POP`}},_):_}function Ze(){let e=ut(),t=Oe(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=C.createElement(C.Fragment,null,C.createElement(`p`,null,`💿 Hey developer 👋`),C.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,C.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,C.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),C.createElement(C.Fragment,null,C.createElement(`h2`,null,`Unexpected Application Error!`),C.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?C.createElement(`pre`,{style:i},n):null,o)}var Qe=C.createElement(Ze,null),$e=class extends C.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){return this.state.error===void 0?this.props.children:C.createElement(Ie.Provider,{value:this.props.routeContext},C.createElement(Le.Provider,{value:this.state.error,children:this.props.component}))}};function et({routeContext:e,match:t,children:n}){let r=C.useContext(Ae);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),C.createElement(Ie.Provider,{value:e},n)}function tt(e,t=[],n=null,r=null,i=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,o=n?.errors;if(o!=null){let e=a.findIndex(e=>e.route.id&&o?.[e.route.id]!==void 0);j(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(`,`)}`),a=a.slice(0,Math.min(a.length,e+1))}let s=!1,c=-1;if(n)for(let e=0;e=0?a.slice(0,c+1):[a[0]];break}}}let l=n&&r?(e,t)=>{r(e,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:ke(n.matches),errorInfo:t})}:void 0;return a.reduceRight((e,r,i)=>{let u,d=!1,f=null,p=null;n&&(u=o&&r.route.id?o[r.route.id]:void 0,f=r.route.errorElement||Qe,s&&(c<0&&i===0?(pt(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):c===i&&(d=!0,p=r.route.hydrateFallbackElement||null)));let m=t.concat(a.slice(0,i+1)),h=()=>{let t;return t=u?f:d?p:r.route.Component?C.createElement(r.route.Component,null):r.route.element?r.route.element:e,C.createElement(et,{match:r,routeContext:{outlet:e,matches:m,isDataRoute:n!=null},children:t})};return n&&(r.route.ErrorBoundary||r.route.errorElement||i===0)?C.createElement($e,{location:n.location,revalidation:n.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function nt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function rt(e){let t=C.useContext(Ae);return j(t,nt(e)),t}function it(e){let t=C.useContext(je);return j(t,nt(e)),t}function at(e){let t=C.useContext(Ie);return j(t,nt(e)),t}function ot(e){let t=at(e),n=t.matches[t.matches.length-1];return j(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function st(){return ot(`useRouteId`)}function ct(){return it(`useNavigation`).navigation}function lt(){let{matches:e,loaderData:t}=it(`useMatches`);return C.useMemo(()=>e.map(e=>H(e,t)),[e,t])}function ut(){let e=C.useContext(Le),t=it(`useRouteError`),n=ot(`useRouteError`);return e===void 0?t.errors?.[n]:e}function dt(){let{router:e}=rt(`useNavigate`),t=ot(`useNavigate`),n=C.useRef(!1);return He(()=>{n.current=!0}),C.useCallback(async(r,i={})=>{M(n.current,Ve),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var ft={};function pt(e,t,n){!t&&!ft[e]&&(ft[e]=!0,M(!1,n))}C.useOptimistic,C.memo(mt);function mt({routes:e,future:t,state:n,unstable_onError:r}){return Xe(e,void 0,n,r,t)}function ht(e){return Ke(e.context)}function gt(e){j(!1,`A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .`)}function _t({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){j(!ze(),`You cannot render a inside another . You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=C.useMemo(()=>({basename:s,navigator:i,static:a,unstable_useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=L(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`}=n,m=C.useMemo(()=>{let e=he(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p},navigationType:r}},[s,l,u,d,f,p,r]);return M(m!=null,` is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the won't render anything.`),m==null?null:C.createElement(W.Provider,{value:c},C.createElement(Fe.Provider,{children:t,value:m}))}function vt({children:e,location:t}){return Ye(yt(e),t)}function yt(e,t=[]){let n=[];return C.Children.forEach(e,(e,r)=>{if(!C.isValidElement(e))return;let i=[...t,r];if(e.type===C.Fragment){n.push.apply(n,yt(e.props.children,i));return}j(e.type===gt,`[${typeof e.type==`string`?e.type:e.type.name}] is not a component. All component children of must be a or `),j(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=yt(e.props.children,i)),n.push(a)}),n}var bt=`get`,xt=`application/x-www-form-urlencoded`;function St(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Ct(e){return St(e)&&e.tagName.toLowerCase()===`button`}function wt(e){return St(e)&&e.tagName.toLowerCase()===`form`}function Tt(e){return St(e)&&e.tagName.toLowerCase()===`input`}function Et(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Dt(e,t){return e.button===0&&(!t||t===`_self`)&&!Et(e)}var Ot=null;function kt(){if(Ot===null)try{new FormData(document.createElement(`form`),0),Ot=!1}catch{Ot=!0}return Ot}var At=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function jt(e){return e!=null&&!At.has(e)?(M(!1,`"${e}" is not a valid \`encType\` for \`\`/\`\` and will default to "${xt}"`),null):e}function Mt(e,t){let n,r,i,a,o;if(wt(e)){let o=e.getAttribute(`action`);r=o?he(o,t):null,n=e.getAttribute(`method`)||bt,i=jt(e.getAttribute(`enctype`))||xt,a=new FormData(e)}else if(Ct(e)||Tt(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a