diff --git a/.DS_Store b/.DS_Store index 49a06645..96a5fc3f 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..dfe07704 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/README.md b/README.md index d2a644f1..2d632e3a 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,21 @@ +# OFFICIAL NOTICE — REPOSITORY RELOCATED + +This repository is **no longer the canonical source of truth** for **Verify.Kai**. + +✅ **New official repository:** https://github.com/kojibai/phi_network + +## Effective Immediately + +All **development**, **releases**, **issues**, and **pull requests** must be directed to the new repository. + +## Status of This Repository + +This repository is retained for **historical reference only** and will receive **no further updates**. + + + + + # ΦNet Sovereign Gate — `verify.kai` > **verify.kai** is the primary entry into the ΦNet Sovereign Gate: 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-DJuhZsZB.js b/dist/assets/EternalKlock-CdflKbWu.js similarity index 99% rename from dist/assets/EternalKlock-DJuhZsZB.js rename to dist/assets/EternalKlock-CdflKbWu.js index 442ad5c2..8ef25c9f 100644 --- a/dist/assets/EternalKlock-DJuhZsZB.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-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-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-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-CMBb8I-f.js b/dist/assets/HomePriceChartCard-B_k89uIK.js similarity index 99% rename from dist/assets/HomePriceChartCard-CMBb8I-f.js rename to dist/assets/HomePriceChartCard-B_k89uIK.js index 9e3b834e..4dded055 100644 --- a/dist/assets/HomePriceChartCard-CMBb8I-f.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-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-DO28buUy.js similarity index 99% rename from dist/assets/KaiRealms-DsvdKMyp.js rename to dist/assets/KaiRealms-DO28buUy.js index 2c87a259..ddd84085 100644 --- a/dist/assets/KaiRealms-DsvdKMyp.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-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-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-cvlNRmVv.js b/dist/assets/KaiVohApp-ShUUTiq2.js similarity index 99% rename from dist/assets/KaiVohApp-cvlNRmVv.js rename to dist/assets/KaiVohApp-ShUUTiq2.js index 807335c9..593fb25c 100644 --- a/dist/assets/KaiVohApp-cvlNRmVv.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-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-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-DRgYu3Ad.js b/dist/assets/KaiVohModal-CRpJD1P8.js similarity index 91% rename from dist/assets/KaiVohModal-DRgYu3Ad.js rename to dist/assets/KaiVohModal-CRpJD1P8.js index 32fff3bd..40d34a47 100644 --- a/dist/assets/KaiVohModal-DRgYu3Ad.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-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-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-CHrK750U.js b/dist/assets/PShort-C5MwlKSc.js similarity index 94% rename from dist/assets/PShort-CHrK750U.js rename to dist/assets/PShort-C5MwlKSc.js index 0db87011..9b1c450d 100644 --- a/dist/assets/PShort-CHrK750U.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-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-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-S7F0w9ki.js b/dist/assets/SealMomentModal-C7mxkSGB.js similarity index 99% rename from dist/assets/SealMomentModal-S7F0w9ki.js rename to dist/assets/SealMomentModal-C7mxkSGB.js index 66af06f3..aa3d5852 100644 --- a/dist/assets/SealMomentModal-S7F0w9ki.js +++ b/dist/assets/SealMomentModal-C7mxkSGB.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-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-Bpha3aI1.js b/dist/assets/SigilAuthContext-CIPXJp4C.js similarity index 73% rename from dist/assets/SigilAuthContext-Bpha3aI1.js rename to dist/assets/SigilAuthContext-CIPXJp4C.js index 8855475b..b0d1a607 100644 --- a/dist/assets/SigilAuthContext-Bpha3aI1.js +++ b/dist/assets/SigilAuthContext-CIPXJp4C.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-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-Bf4S4o9t.js b/dist/assets/SigilAuthProvider-ea2w3ibF.js similarity index 91% rename from dist/assets/SigilAuthProvider-Bf4S4o9t.js rename to dist/assets/SigilAuthProvider-ea2w3ibF.js index 1a27e603..7450d612 100644 --- a/dist/assets/SigilAuthProvider-Bf4S4o9t.js +++ b/dist/assets/SigilAuthProvider-ea2w3ibF.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-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-Be22x_Dh.js b/dist/assets/SigilExplorer-PXIdIaMp.js similarity index 99% rename from dist/assets/SigilExplorer-Be22x_Dh.js rename to dist/assets/SigilExplorer-PXIdIaMp.js index 53661cc8..da31fc60 100644 --- a/dist/assets/SigilExplorer-Be22x_Dh.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-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-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-CYooRvDo.js b/dist/assets/SigilFeedPage-C5nsUmbd.js similarity index 93% rename from dist/assets/SigilFeedPage-CYooRvDo.js rename to dist/assets/SigilFeedPage-C5nsUmbd.js index 7d104851..5383daf9 100644 --- a/dist/assets/SigilFeedPage-CYooRvDo.js +++ b/dist/assets/SigilFeedPage-C5nsUmbd.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-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-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/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-Dtnhs3XF.js b/dist/assets/SigilModal-Dm4zpSIO.js similarity index 99% rename from dist/assets/SigilModal-Dtnhs3XF.js rename to dist/assets/SigilModal-Dm4zpSIO.js index 9febd9fc..04aba71b 100644 --- a/dist/assets/SigilModal-Dtnhs3XF.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-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-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-ECNAzu9S.js b/dist/assets/SigilPage-CGk_cWZs.js similarity index 99% rename from dist/assets/SigilPage-ECNAzu9S.js rename to dist/assets/SigilPage-CGk_cWZs.js index c188068a..c77c3d8c 100644 --- a/dist/assets/SigilPage-ECNAzu9S.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-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-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-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-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-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-LmEGlu4-.js similarity index 99% rename from dist/assets/SigilStreamRoot-lWOSVrBM.js rename to dist/assets/SigilStreamRoot-LmEGlu4-.js index a9de5cb4..9c3c3341 100644 --- a/dist/assets/SigilStreamRoot-lWOSVrBM.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-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-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-CwEJNPi9.js b/dist/assets/VerifierFrame-a5dTHTgU.js similarity index 99% rename from dist/assets/VerifierFrame-CwEJNPi9.js rename to dist/assets/VerifierFrame-a5dTHTgU.js index 3bed1065..6e8bf33f 100644 --- a/dist/assets/VerifierFrame-CwEJNPi9.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-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-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-Qyj4E4nU.js b/dist/assets/VerifyPage-CexUA7n1.js similarity index 97% rename from dist/assets/VerifyPage-Qyj4E4nU.js rename to dist/assets/VerifyPage-CexUA7n1.js index 24571e56..6a3f2e2c 100644 --- a/dist/assets/VerifyPage-Qyj4E4nU.js +++ b/dist/assets/VerifyPage-CexUA7n1.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-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-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-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-DKFgLeD8.js b/dist/assets/bundler-BiZDI_w8.js similarity index 99% rename from dist/assets/bundler-DKFgLeD8.js rename to dist/assets/bundler-BiZDI_w8.js index e1d0fe3e..f61d8b42 100644 --- a/dist/assets/bundler-DKFgLeD8.js +++ b/dist/assets/bundler-BiZDI_w8.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-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-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-BGzUQCv_.js deleted file mode 100644 index 81fc7d27..00000000 --- a/dist/assets/index-BGzUQCv_.js +++ /dev/null @@ -1,668 +0,0 @@ -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]); -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)`:-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:Fe,Ne=Math.log,Pe=Math.LN2;function Fe(e){return e>>>=0,e===0?32:31-(Ne(e)/Pe|0)|0}var Ie=256,Le=262144,Re=4194304;function ze(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 Be(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=ze(n))):i=ze(o):i=ze(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=ze(n))):i=ze(o)):i=ze(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 Ve(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function He(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 Ue(){var e=Re;return Re<<=1,!(Re&62914560)&&(Re=4194304),e}function We(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ge(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ke(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),an=!1;if(rn)try{var on={};Object.defineProperty(on,`passive`,{get:function(){an=!0}}),window.addEventListener(`test`,on,on),window.removeEventListener(`test`,on,on)}catch{an=!1}var sn=null,cn=null,ln=null;function un(){if(ln)return ln;var e,t=cn,n=t.length,r,i=`value`in sn?sn.value:sn.textContent,a=i.length;for(e=0;e=Hn),Gn=` `,Kn=!1;function qn(e,t){switch(e){case`keyup`:return Bn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Jn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Yn=!1;function Xn(e,t){switch(e){case`compositionend`:return Jn(t);case`keypress`:return t.which===32?(Kn=!0,Gn):null;case`textInput`:return e=t.data,e===Gn&&Kn?null:e;default:return null}}function Zn(e,t){if(Yn)return e===`compositionend`||!Vn&&qn(e,t)?(e=un(),ln=cn=sn=null,Yn=!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=yr(n)}}function xr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?xr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Sr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=jt(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=jt(e.document)}return t}function Cr(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 wr=rn&&`documentMode`in document&&11>=document.documentMode,Tr=null,Er=null,Dr=null,Or=!1;function kr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Or||Tr==null||Tr!==jt(r)||(r=Tr,`selectionStart`in r&&Cr(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}),Dr&&vr(Dr,r)||(Dr=r,r=Nd(Er,`onSelect`),0>=o,i-=o,xi=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),Ai&&Ci(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),Ai&&Ci(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 Ai&&Ci(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)}),Ai&&Ci(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&&Ca(l)===r.type){n(e,r.sibling),c=a(r,o.props),Aa(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===v?(c=ci(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=si(o.type,o.key,o.props,null,e.mode,c),Aa(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=di(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=Ca(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,ka(o),c);if(o.$$typeof===C)return b(e,r,Zi(e,o),c);ja(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=li(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Oa=0;var i=b(e,t,n,r);return Da=null,i}catch(t){if(t===_a||t===ya)throw t;var a=ri(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Na=Ma(!0),Pa=Ma(!1),Fa=!1;function Ia(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function La(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 Ra(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function za(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,zl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ei(e),$r(e,null,n),t}return Xr(e,r,t,n),ei(e)}function Ba(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,Je(e,n)}}function Va(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 Ha=!1;function Ua(){if(Ha){var e=ca;if(e!==null)throw e}}function Wa(e,t,n,r){Ha=!1;var i=e.updateQueue;Fa=!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?(Hl&p)===p:(r&p)===p){p!==0&&p===sa&&(Ha=!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:Fa=!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),Xl|=o,e.lanes=o,e.memoizedState=d}}function Ga(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Ka(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,Ns(e,!1,t,n);try{var c=i(),l=I.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ms(e,t,da(c,r),vu(e)):Ms(e,t,r,vu(e))}catch(n){Ms(e,t,{then:function(){},status:`rejected`,reason:n},vu())}finally{L.p=a,o!==null&&s.types!==null&&(o.types=s.types),I.T=o}}function Ss(){}function Cs(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=ws(e).queue;xs(e,a,t,R,n===null?Ss:function(){return Ts(e),n(r)})}function ws(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:Po,lastRenderedState:R},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Po,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ts(e){var t=ws(e);t.next===null&&(t=e.alternate.memoizedState),Ms(e,t.next.queue,{},vu())}function Es(){return Xi(op)}function Ds(){return ko().memoizedState}function Os(){return ko().memoizedState}function ks(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=vu();e=Ra(n);var r=za(t,e,n);r!==null&&(bu(r,t,n),Ba(r,t,n)),t={cache:ra()},e.payload=t;return}t=t.return}}function As(e,t,n){var r=vu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ps(e)?Fs(t,n):(n=Zr(e,t,n,r),n!==null&&(bu(n,e,r),Is(n,t,r)))}function js(e,t,n){Ms(e,t,n,vu())}function Ms(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ps(e))Fs(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,_r(s,o))return Xr(e,t,i,0),Bl===null&&Yr(),!1}catch{}if(n=Zr(e,t,i,r),n!==null)return bu(n,e,r),Is(n,t,r),!0}return!1}function Ns(e,t,n,r){if(r={lane:2,revertLane:_d(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ps(e)){if(t)throw Error(i(479))}else t=Zr(e,n,r,2),t!==null&&bu(t,e,2)}function Ps(e){var t=e.alternate;return e===co||t!==null&&t===co}function Fs(e,t){po=fo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Is(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Je(e,n)}}var Ls={readContext:Xi,use:Mo,useCallback:yo,useContext:yo,useEffect:yo,useImperativeHandle:yo,useLayoutEffect:yo,useInsertionEffect:yo,useMemo:yo,useReducer:yo,useRef:yo,useState:yo,useDebugValue:yo,useDeferredValue:yo,useTransition:yo,useSyncExternalStore:yo,useId:yo,useHostTransitionStatus:yo,useFormState:yo,useActionState:yo,useOptimistic:yo,useMemoCache:yo,useCacheRefresh:yo};Ls.useEffectEvent=yo;var Rs={readContext:Xi,use:Mo,useCallback:function(e,t){return Oo().memoizedState=[e,t===void 0?null:t],e},useContext:Xi,useEffect:cs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),os(4194308,4,ms.bind(null,t,e),n)},useLayoutEffect:function(e,t){return os(4194308,4,e,t)},useInsertionEffect:function(e,t){os(4,2,e,t)},useMemo:function(e,t){var n=Oo();t=t===void 0?null:t;var r=e();if(mo){je(!0);try{e()}finally{je(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Oo();if(n!==void 0){var i=n(t);if(mo){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=As.bind(null,co,e),[r.memoizedState,e]},useRef:function(e){var t=Oo();return e={current:e},t.memoizedState=e},useState:function(e){e=Wo(e);var t=e.queue,n=js.bind(null,co,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:gs,useDeferredValue:function(e,t){return ys(Oo(),e,t)},useTransition:function(){var e=Wo(!1);return e=xs.bind(null,co,e.queue,!0,!1),Oo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=co,a=Oo();if(Ai){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Bl===null)throw Error(i(349));Hl&127||zo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,cs(Vo.bind(null,r,o,e),[e]),r.flags|=2048,is(9,{destroy:void 0},Bo.bind(null,r,o,n,t),null),n},useId:function(){var e=Oo(),t=Bl.identifierPrefix;if(Ai){var n=Si,r=xi;n=(r&~(1<<32-Me(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=ho++,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[tt]=t,o[nt]=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(Hd(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&&jc(t)}}return Ic(t),Mc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&jc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=ne.current,Li(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Oi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[tt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||zd(e.nodeValue,n)),e||Pi(t,!0)}else e=Jd(e).createTextNode(r),e[tt]=t,t.stateNode=e}return Ic(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Li(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[tt]=t}else Ri(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ic(t),e=!1}else n=zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(io(t),t):(io(t),null);if(t.flags&128)throw Error(i(558))}return Ic(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Li(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[tt]=t}else Ri(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ic(t),a=!1}else a=zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(io(t),t):(io(t),null)}return io(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),Pc(t,t.updateQueue),Ic(t),null);case 4:return ae(),e===null&&kd(t.stateNode.containerInfo),Ic(t),null;case 10:return Wi(t.type),Ic(t),null;case 19:if(H(ao),r=t.memoizedState,r===null)return Ic(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Fc(r,!1);else{if(Yl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=oo(e),o!==null){for(t.flags|=128,Fc(r,!1),e=o.updateQueue,t.updateQueue=e,Pc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)oi(n,e),n=n.sibling;return U(ao,ao.current&1|2),Ai&&Ci(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&be()>ou&&(t.flags|=128,a=!0,Fc(r,!1),t.lanes=4194304)}else{if(!a)if(e=oo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Pc(t,e),Fc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Ai)return Ic(t),null}else 2*be()-r.renderingStartTime>ou&&n!==536870912&&(t.flags|=128,a=!0,Fc(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?(Ic(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=be(),e.sibling=null,n=ao.current,U(ao,a?n&1|2:n&1),Ai&&Ci(t,r.treeForkCount),e);case 22:case 23:return io(t),Za(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Ic(t),t.subtreeFlags&6&&(t.flags|=8192)):Ic(t),n=t.updateQueue,n!==null&&Pc(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(pa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Wi(na),Ic(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Rc(e,t){switch(Ei(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Wi(na),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(io(t),t.alternate===null)throw Error(i(340));Ri()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(io(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ri()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return H(ao),null;case 4:return ae(),null;case 10:return Wi(t.type),null;case 22:case 23:return io(t),Za(),e!==null&&H(pa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Wi(na),null;case 25:return null;default:return null}}function zc(e,t){switch(Ei(t),t.tag){case 3:Wi(na),ae();break;case 26:case 27:case 5:se(t);break;case 4:ae();break;case 31:t.memoizedState!==null&&io(t);break;case 13:io(t);break;case 19:H(ao);break;case 10:Wi(t.type);break;case 22:case 23:io(t),Za(),e!==null&&H(pa);break;case 24:Wi(na)}}function Bc(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){Xu(t,t.return,e)}}function Vc(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){Xu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Xu(t,t.return,e)}}function Hc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ka(t,n)}catch(t){Xu(e,e.return,t)}}}function Uc(e,t,n){n.props=Gs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Xu(e,t,n)}}function Wc(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){Xu(e,t,n)}}function Gc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Xu(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){Xu(e,t,n)}else n.current=null}function Kc(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){Xu(e,e.return,t)}}function qc(e,t,n){try{var r=e.stateNode;Ud(r,e.type,n,t),r[nt]=t}catch(t){Xu(e,e.return,t)}}function Jc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&of(e.type)||e.tag===4}function Yc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Jc(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&&of(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 Xc(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=Jt));else if(r!==4&&(r===27&&of(e.type)&&(n=e.stateNode,t=null),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,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&&of(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Zc(e,t,n),e=e.sibling;e!==null;)Zc(e,t,n),e=e.sibling}function Qc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Hd(t,r,n),t[tt]=e,t[nt]=n}catch(t){Xu(e,e.return,t)}}var $c=!1,el=!1,tl=!1,nl=typeof WeakSet==`function`?WeakSet:Set,rl=null;function il(e,t){if(e=e.containerInfo,Kd=hp,e=Sr(e),Cr(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(qd={focusedElem:e,selectionRange:n},hp=!1,rl=t;rl!==null;)if(t=rl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,rl=e;else for(;rl!==null;){switch(t=rl,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`))),Hd(o,r,n),o[tt]=e,mt(o),r=o;break a;case`link`:var s=Yf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=br(s,h),v=br(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=mu,mu=null;var o=uu,s=fu;if(lu=0,du=uu=null,fu=0,zl&6)throw Error(i(331));var c=zl;if(zl|=4,Pl(o.current),El(o,o.current,s,n),zl=c,ud(0,!1),Ae&&typeof Ae.onPostCommitFiberRoot==`function`)try{Ae.onPostCommitFiberRoot(ke,o)}catch{}return!0}finally{L.p=a,I.T=r,Ku(e,t)}}function Yu(e,t,n){t=pi(n,t),t=Zs(e.stateNode,t,2),e=za(e,t,2),e!==null&&(Ge(e,2),ld(e))}function Xu(e,t,n){if(e.tag===3)Yu(e,e,n);else for(;t!==null;){if(t.tag===3){Yu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(cu===null||!cu.has(r))){e=pi(n,e),n=Qs(2),r=za(t,n,2),r!==null&&($s(n,r,t,e),Ge(r,2),ld(r));break}}t=t.return}}function Zu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Rl;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)||(ql=!0,i.add(n),e=Qu.bind(null,e,t,n),t.then(e,e))}function Qu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Bl===e&&(Hl&n)===n&&(Yl===4||Yl===3&&(Hl&62914560)===Hl&&300>be()-iu?!(zl&2)&&Du(e,0):Ql|=n,eu===Hl&&(eu=0)),ld(e)}function $u(e,t){t===0&&(t=Ue()),e=Qr(e,t),e!==null&&(Ge(e,t),ld(e))}function ed(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),$u(e,n)}function td(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),$u(e,n)}function nd(e,t){return ge(e,t)}var rd=null,id=null,ad=!1,od=!1,sd=!1,cd=0;function ld(e){e!==id&&e.next===null&&(id===null?rd=id=e:id=id.next=e),od=!0,ad||(ad=!0,gd())}function ud(e,t){if(!sd&&od){sd=!0;do for(var n=!1,r=rd;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,hd(r,a))}else a=Hl,a=Be(r,r===Bl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ve(r,a)||(n=!0,hd(r,a));r=r.next}while(n);sd=!1}}function dd(){fd()}function fd(){od=ad=!1;var e=0;cd!==0&&$d()&&(e=cd);for(var t=be(),n=null,r=rd;r!==null;){var i=r.next,a=pd(r,t);a===0?(r.next=null,n===null?rd=i:n.next=i,i===null&&(id=n)):(n=r,(e!==0||a&3)&&(od=!0)),r=i}lu!==0&&lu!==5||ud(e,!1),cd!==0&&(cd=0)}function pd(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&&Wd(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function kf(e,t,n){var r=Of;if(r&&typeof t==`string`&&t){var i=Nt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Cf.has(i)||(Cf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Hd(t,`link`,e),mt(t),r.head.appendChild(t)))}}function Af(e){Tf.D(e),kf(`dns-prefetch`,e,null)}function jf(e,t){Tf.C(e,t),kf(`preconnect`,e,t)}function Mf(e,t,n){Tf.L(e,t,n);var r=Of;if(r&&e&&t){var i=`link[rel="preload"][as="`+Nt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Nt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Nt(n.imageSizes)+`"]`)):i+=`[href="`+Nt(e)+`"]`;var a=i;switch(t){case`style`:a=Rf(e);break;case`script`:a=Hf(e)}Sf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Sf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(zf(a))||t===`script`&&r.querySelector(Uf(a))||(t=r.createElement(`link`),Hd(t,`link`,e),mt(t),r.head.appendChild(t)))}}function Nf(e,t){Tf.m(e,t);var n=Of;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Nt(r)+`"][href="`+Nt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Hf(e)}if(!Sf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),Sf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Uf(a)))return}r=n.createElement(`link`),Hd(r,`link`,e),mt(r),n.head.appendChild(r)}}}function Pf(e,t,n){Tf.S(e,t,n);var r=Of;if(r&&e){var i=pt(r).hoistableStyles,a=Rf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(zf(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Sf.get(a))&&Kf(e,n);var c=o=r.createElement(`link`);mt(c),Hd(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,Gf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Ff(e,t){Tf.X(e,t);var n=Of;if(n&&e){var r=pt(n).hoistableScripts,i=Hf(e),a=r.get(i);a||(a=n.querySelector(Uf(i)),a||(e=f({src:e,async:!0},t),(t=Sf.get(i))&&qf(e,t),a=n.createElement(`script`),mt(a),Hd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function If(e,t){Tf.M(e,t);var n=Of;if(n&&e){var r=pt(n).hoistableScripts,i=Hf(e),a=r.get(i);a||(a=n.querySelector(Uf(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=Sf.get(i))&&qf(e,t),a=n.createElement(`script`),mt(a),Hd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Lf(e,t,n,r){var a=(a=ne.current)?wf(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=Rf(n.href),n=pt(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=Rf(n.href);var o=pt(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(zf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),Sf.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},Sf.set(e,n),o||Vf(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=Hf(n),n=pt(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 Rf(e){return`href="`+Nt(e)+`"`}function zf(e){return`link[rel="stylesheet"][`+e+`]`}function Bf(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Vf(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}),Hd(t,`link`,n),mt(t),e.head.appendChild(t))}function Hf(e){return`[src="`+Nt(e)+`"]`}function Uf(e){return`script[async]`+e}function Wf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Nt(n.href)+`"]`);if(r)return t.instance=r,mt(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`),mt(r),Hd(r,`style`,a),Gf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Rf(n.href);var o=e.querySelector(zf(a));if(o)return t.state.loading|=4,t.instance=o,mt(o),o;r=Bf(n),(a=Sf.get(a))&&Kf(r,a),o=(e.ownerDocument||e).createElement(`link`),mt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Hd(o,`link`,r),t.state.loading|=4,Gf(o,n.precedence,e),t.instance=o;case`script`:return o=Hf(n.src),(a=e.querySelector(Uf(o)))?(t.instance=a,mt(a),a):(r=n,(a=Sf.get(o))&&(r=f({},n),qf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),mt(a),Hd(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,Gf(r,n.precedence,e));return t.instance}function Gf(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 Zf(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 Qf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function $f(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=Rf(r.href),a=t.querySelector(zf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=np.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,mt(a);return}a=t.ownerDocument||t,r=Bf(r),(i=Sf.get(i))&&Kf(r,i),a=a.createElement(`link`),mt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Hd(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=np.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var ep=0;function tp(e,t){return e.stylesheets&&e.count===0&&ip(e,e.stylesheets),0ep?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function np(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ip(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var rp=null;function ip(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,rp=new Map,t.forEach(ap,e),rp=null,np.call(e))}function ap(e,t){if(!(t.state.loading&4)){var n=rp.get(e);if(n)var r=n.get(null);else{n=new Map,rp.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,Oe=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function ke(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Ae(e){return e.map(e=>e.route.path).filter(Boolean).join(`/`).replace(/\/\/*/g,`/`)||`/`}var je=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Me(e,t){let n=e;if(typeof n!=`string`||!ge.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(je)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=he(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{M(!1,` contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Ne=C.createContext(null);Ne.displayName=`DataRouter`;var Pe=C.createContext(null);Pe.displayName=`DataRouterState`;var Fe=C.createContext(!1),Ie=C.createContext({isTransitioning:!1});Ie.displayName=`ViewTransition`;var Le=C.createContext(new Map);Le.displayName=`Fetchers`;var Re=C.createContext(null);Re.displayName=`Await`;var ze=C.createContext(null);ze.displayName=`Navigation`;var Be=C.createContext(null);Be.displayName=`Location`;var Ve=C.createContext({outlet:null,matches:[],isDataRoute:!1});Ve.displayName=`Route`;var He=C.createContext(null);He.displayName=`RouteError`;var Ue=`REACT_ROUTER_ERROR`,We=`REDIRECT`,Ge=`ROUTE_ERROR_RESPONSE`;function Ke(e){if(e.startsWith(`${Ue}:${We}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function qe(e){if(e.startsWith(`${Ue}:${Ge}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Oe(t.status,t.statusText,t.data)}catch{}}function Je(e,{relative:t}={}){j(Ye(),`useHref() may be used only in the context of a component.`);let{basename:n,navigator:r}=C.useContext(ze),{hash:i,pathname:a,search:o}=it(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:we([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Ye(){return C.useContext(Be)!=null}function Xe(){return j(Ye(),`useLocation() may be used only in the context of a component.`),C.useContext(Be).location}var Ze=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Qe(e){C.useContext(ze).static||C.useLayoutEffect(e)}function $e(){let{isDataRoute:e}=C.useContext(Ve);return e?Ct():et()}function et(){j(Ye(),`useNavigate() may be used only in the context of a component.`);let e=C.useContext(Ne),{basename:t,navigator:n}=C.useContext(ze),{matches:r}=C.useContext(Ve),{pathname:i}=Xe(),a=JSON.stringify(Se(r)),o=C.useRef(!1);return Qe(()=>{o.current=!0}),C.useCallback((r,s={})=>{if(M(o.current,Ze),!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 tt=C.createContext(null);function nt(e){let t=C.useContext(Ve).outlet;return C.useMemo(()=>t&&C.createElement(tt.Provider,{value:e},t),[t,e])}function rt(){let{matches:e}=C.useContext(Ve),t=e[e.length-1];return t?t.params:{}}function it(e,{relative:t}={}){let{matches:n}=C.useContext(Ve),{pathname:r}=Xe(),i=JSON.stringify(Se(n));return C.useMemo(()=>Ce(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function at(e,t){return ot(e,t)}function ot(e,t,n,r,i){j(Ye(),`useRoutes() may be used only in the context of a component.`);let{navigator:a}=C.useContext(ze),{matches:o}=C.useContext(Ve),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||``;Tt(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=Xe(),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 _=pt(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(Be.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,...p},navigationType:`POP`}},_):_}function st(){let e=St(),t=ke(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 ct=C.createElement(st,null),lt=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(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=qe(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:C.createElement(Ve.Provider,{value:this.props.routeContext},C.createElement(He.Provider,{value:e,children:this.props.component}));return this.context?C.createElement(dt,{error:e},t):t}};lt.contextType=Fe;var ut=new WeakMap;function dt({children:e,error:t}){let{basename:n}=C.useContext(ze);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Ke(t.digest);if(e){let r=ut.get(t);if(r)throw r;let i=Me(e.location,n);if(je&&!ut.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw ut.set(t,n),n}return C.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function ft({routeContext:e,match:t,children:n}){let r=C.useContext(Ne);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),C.createElement(Ve.Provider,{value:e},n)}function pt(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:Ae(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||ct,s&&(c<0&&i===0?(Tt(`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(ft,{match:r,routeContext:{outlet:e,matches:m,isDataRoute:n!=null},children:t})};return n&&(r.route.ErrorBoundary||r.route.errorElement||i===0)?C.createElement(lt,{location:n.location,revalidation:n.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function mt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ht(e){let t=C.useContext(Ne);return j(t,mt(e)),t}function gt(e){let t=C.useContext(Pe);return j(t,mt(e)),t}function _t(e){let t=C.useContext(Ve);return j(t,mt(e)),t}function vt(e){let t=_t(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 yt(){return vt(`useRouteId`)}function bt(){return gt(`useNavigation`).navigation}function xt(){let{matches:e,loaderData:t}=gt(`useMatches`);return C.useMemo(()=>e.map(e=>H(e,t)),[e,t])}function St(){let e=C.useContext(He),t=gt(`useRouteError`),n=vt(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Ct(){let{router:e}=ht(`useNavigate`),t=vt(`useNavigate`),n=C.useRef(!1);return Qe(()=>{n.current=!0}),C.useCallback(async(r,i={})=>{M(n.current,Ze),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var wt={};function Tt(e,t,n){!t&&!wt[e]&&(wt[e]=!0,M(!1,n))}C.useOptimistic,C.memo(Et);function Et({routes:e,future:t,state:n,onError:r}){return ot(e,void 0,n,r,t)}function Dt(e){return nt(e.context)}function Ot(e){j(!1,`A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .`)}function kt({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){j(!Ye(),`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(ze.Provider,{value:c},C.createElement(Be.Provider,{children:t,value:m}))}function At({children:e,location:t}){return at(jt(e),t)}function jt(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,jt(e.props.children,i));return}j(e.type===Ot,`[${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=jt(e.props.children,i)),n.push(a)}),n}var Mt=`get`,Nt=`application/x-www-form-urlencoded`;function Pt(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Ft(e){return Pt(e)&&e.tagName.toLowerCase()===`button`}function It(e){return Pt(e)&&e.tagName.toLowerCase()===`form`}function Lt(e){return Pt(e)&&e.tagName.toLowerCase()===`input`}function Rt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function zt(e,t){return e.button===0&&(!t||t===`_self`)&&!Rt(e)}var Bt=null;function Vt(){if(Bt===null)try{new FormData(document.createElement(`form`),0),Bt=!1}catch{Bt=!0}return Bt}var Ht=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Ut(e){return e!=null&&!Ht.has(e)?(M(!1,`"${e}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${Nt}"`),null):e}function Wt(e,t){let n,r,i,a,o;if(It(e)){let o=e.getAttribute(`action`);r=o?he(o,t):null,n=e.getAttribute(`method`)||Mt,i=Ut(e.getAttribute(`enctype`))||Nt,a=new FormData(e)}else if(Ft(e)||Lt(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a