PageSourceSearch

https://strongwall.ai/assets/Spinner-D3e4HwcO.js

js strongwall.ai collected 2026-10-02 00:42:16 UTC 137,468 bytes, 29 lines download raw bytes

vendor: 6,971 bytes, line 1
1import{p,a as y,y as Gr}from"./chunk-QUQL4437-Q-bCYtDy.js";import{a as ir}from"./index-DSszVeBq.js";function ar(e){var t,r,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(r=ar(e[t]))&&(o&&(o+=" "),o+=r)}else for(r in e)e[r]&&(o&&(o+=" "),o+=r);return o}function qr(){for(var e,t,r=0,o="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=ar(e))&&(o&&(o+=" "),o+=t);return o}const Yr=(e,t)=>{const r=new Array(e.length+t.length);for(let o=0;o<e.length;o++)r[o]=e[o];for(let o=0;o<t.length;o++)r[e.length+o]=t[o];return r},Jr=(e,t)=>({classGroupId:e,validator:t}),cr=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Je="-",Et=[],Xr="arbitrary..",Qr=e=>{const t=to(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:s=>{if(s.startsWith("[")&&s.endsWith("]"))return eo(s);const a=s.split(Je),c=a[0]===""&&a.length>1?1:0;return lr(a,c,t)},getConflictingClassGroupIds:(s,a)=>{if(a){const c=o[s],l=r[s];return c?l?Yr(l,c):c:l||Et}return r[s]||Et}}},lr=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const n=e[t],i=r.nextPart.get(n);if(i){const l=lr(e,t+1,i);if(l)return l}const s=r.validators;if(s===null)return;const a=t===0?e.join(Je):e.slice(t).join(Je),c=s.length;for(let l=0;l<c;l++){const d=s[l];if(d.validator(a))return d.classGroupId}},eo=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),o=t.slice(0,r);return o?Xr+o:void 0})(),to=e=>{const{theme:t,classGroups:r}=e;return ro(r,t)},ro=(e,t)=>{const r=cr();for(const o in e){const n=e[o];wt(n,r,o,t)}return r},wt=(e,t,r,o)=>{const n=e.length;for(let i=0;i<n;i++){const s=e[i];oo(s,t,r,o)}},oo=(e,t,r,o)=>{if(typeof e=="string"){no(e,t,r);return}if(typeof e=="function"){so(e,t,r,o);return}io(e,t,r,o)},no=(e,t,r)=>{const o=e===""?t:ur(t,e);o.classGroupId=r},so=(e,t,r,o)=>{if(ao(e)){wt(e(o),t,r,o);return}t.validators===null&&(t.validators=[]),t.validators.push(Jr(r,e))},io=(e,t,r,o)=>{const n=Object.entries(e),i=n.length;for(let s=0;s<i;s++){const[a,c]=n[s];wt(c,ur(t,a),r,o)}},ur=(e,t)=>{let r=e;const o=t.split(Je),n=o.length;for(let i=0;i<n;i++){const s=o[i];let a=r.nextPart.get(s);a||(a=cr(),r.nextPart.set(s,a)),r=a}return r},ao=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,co=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),o=Object.create(null);const n=(i,s)=>{r[i]=s,t++,t>e&&(t=0,o=r,r=Object.create(null))};return{get(i){let s=r[i];if(s!==void 0)return s;if((s=o[i])!==void 0)return n(i,s),s},set(i,s){i in r?r[i]=s:n(i,s)}}},dt="!",At=":",lo=[],Zt=(e,t,r,o,n)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:o,isExternal:n}),uo=e=>{const{prefix:t,experimentalParseClassName:r}=e;let o=n=>{const i=[];let s=0,a=0,c=0,l;const d=n.length;for(let C=0;C<d;C++){const j=n[C];if(s===0&&a===0){if(j===At){i.push(n.slice(c,C)),c=C+1;continue}if(j==="/"){l=C;continue}}j==="["?s++:j==="]"?s--:j==="("?a++:j===")"&&a--}const v=i.length===0?n:n.slice(c);let g=v,_=!1;v.endsWith(dt)?(g=v.slice(0,-1),_=!0):v.startsWith(dt)&&(g=v.slice(1),_=!0);const x=l&&l>c?l-c:void 0;return Zt(i,_,g,x)};if(t){const n=t+At,i=o;o=s=>s.startsWith(n)?i(s.slice(n.length)):Zt(lo,!1,s,void 0,!0)}if(r){const n=o;o=i=>r({className:i,parseClassName:n})}return o},po=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,o)=>{t.set(r,1e6+o)}),r=>{const o=[];let n=[];for(let i=0;i<r.length;i++){const s=r[i],a=s[0]==="[",c=t.has(s);a||c?(n.length>0&&(n.sort(),o.push(...n),n=[]),o.push(s)):n.push(s)}return n.length>0&&(n.sort(),o.push(...n)),o}},ho=e=>({cache:co(e.cacheSize),parseClassName:uo(e),sortModifiers:po(e),...Qr(e)}),mo=/\s+/,fo=(e,t)=>{const{parseClassName:r,getClassGroupId:o,getConflictingClassGroupIds:n,sortModifiers:i}=t,s=[],a=e.trim().split(mo);let c="";for(let l=a.length-1;l>=0;l-=1){const d=a[l],{isExternal:v,modifiers:g,hasImportantModifier:_,baseClassName:x,maybePostfixModifierPosition:C}=r(d);if(v){c=d+(c.length>0?" "+c:c);continue}let j=!!C,K=o(j?x.substring(0,C):x);if(!K){if(!j){c=d+(c.length>0?" "+c:c);continue}if(K=o(x),!K){c=d+(c.length>0?" "+c:c);continue}j=!1}const J=g.length===0?"":g.length===1?g[0]:i(g).join(":"),A=_?J+dt:J,Z=A+K;if(s.indexOf(Z)>-1)continue;s.push(Z);const V=n(K,j);for(let H=0;H<V.length;++H){const B=V[H];s.push(A+B)}c=d+(c.length>0?" "+c:c)}return c},go=(...e)=>{let t=0,r,o,n="";for(;t<e.length;)(r=e[t++])&&(o=dr(r))&&(n&&(n+=" "),n+=o);return n},dr=e=>{if(typeof e=="string")return e;let t,r="";for(let o=0;o<e.length;o++)e[o]&&(t=dr(e[o]))&&(r&&(r+=" "),r+=t);return r},bo=(e,...t)=>{let r,o,n,i;const s=c=>{const l=t.reduce((d,v)=>v(d),e());return r=ho(l),o=r.cache.get,n=r.cache.set,i=a,a(c)},a=c=>{const l=o(c);if(l)return l;const d=fo(c,r);return n(c,d),d};return i=s,(...c)=>i(go(...c))},wo=[],D=e=>{const t=r=>r[e]||wo;return t.isThemeGetter=!0,t},pr=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,hr=/^\((?:(\w[\w-]*):)?(.+)\)$/i,yo=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,vo=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,_o=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ko=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,xo=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,So=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,le=e=>yo.test(e),k=e=>!!e&&!Number.isNaN(Number(e)),ue=e=>!!e&&Number.isInteger(Number(e)),ct=e=>e.endsWith("%")&&k(e.slice(0,-1)),se=e=>vo.test(e),mr=()=>!0,zo=e=>_o.test(e)&&!ko.test(e),yt=()=>!1,Co=e=>xo.test(e),Io=e=>So.test(e),jo=e=>!m(e)&&!f(e),$o=e=>he(e,br,yt),m=e=>pr.test(e),ge=e=>he(e,wr,zo),Pt=e=>he(e,Ro,k),Eo=e=>he(e,vr,mr),Ao=e=>he(e,yr,yt),Tt=e=>he(e,fr,yt),Zo=e=>he(e,gr,Io),Fe=e=>he(e,_r,Co),f=e=>hr.test(e),je=e=>we(e,wr),Po=e=>we(e,yr),Ut=e=>we(e,fr),To=e=>we(e,br),Uo=e=>we(e,gr),Be=e=>we(e,_r,!0),No=e=>we(e,vr,!0),he=(e,t,r)=>{const o=pr.exec(e);return o?o[1]?t(o[1]):r(o[2]):!1},we=(e,t,r=!1)=>{const o=hr.exec(e);return o?o[1]?t(o[1]):r:!1},fr=e=>e==="position"||e==="percentage",gr=e=>e==="image"||e==="url",br=e=>e==="length"||e==="size"||e==="bg-size",wr=e=>e==="length",Ro=e=>e==="number",yr=e=>e==="family-name",vr=e=>e==="number"||e==="weight",_r=e=>e==="shadow",Oo=()=>{const e=D("color"),t=D("font"),r=D("text"),o=D("font-weight"),n=D("tracking"),i=D("leading"),s=D("breakpoint"),a=D("container"),c=D("spacing"),l=D("radius"),d=D("shadow"),v=D("inset-shadow"),g=D("text-shadow"),_=D("drop-shadow"),x=D("blur"),C=D("perspective"),j=D("aspect"),K=D("ease"),J=D("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Z=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],V=()=>[...Z(),f,m],H=()=>["auto","hidden","clip","visible","scroll"],B=()=>["auto","contain","none"],b=()=>[f,m,c],I=()=>[le,"full","auto",...b()],ae=()=>
vendor: 7,845 bytes, line 1
1[ue,"none","subgrid",f,m],ce=()=>["auto",{span:["full",ue,f,m]},ue,f,m],ee=()=>[ue,"auto",f,m],fe=()=>["auto","min","max","fr",f,m],oe=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],X=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...b()],q=()=>[le,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...b()],Ie=()=>[le,"screen","full","dvw","lvw","svw","min","max","fit",...b()],z=()=>[le,"screen","full","lh","dvh","lvh","svh","min","max","fit",...b()],h=()=>[e,f,m],R=()=>[...Z(),Ut,Tt,{position:[f,m]}],L=()=>["no-repeat",{repeat:["","x","y","space","round"]}],G=()=>["auto","cover","contain",To,$o,{size:[f,m]}],ne=()=>[ct,je,ge],O=()=>["","none","full",l,f,m],F=()=>["",k,je,ge],De=()=>["solid","dashed","dotted","double"],jt=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],M=()=>[k,ct,Ut,Tt],$t=()=>["","none",x,f,m],Ve=()=>["none",k,f,m],Me=()=>["none",k,f,m],at=()=>[k,f,m],Ke=()=>[le,"full",...b()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[se],breakpoint:[se],color:[mr],container:[se],"drop-shadow":[se],ease:["in","out","in-out"],font:[jo],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[se],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[se],shadow:[se],spacing:["px",k],text:[se],"text-shadow":[se],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",le,m,f,j]}],container:["container"],columns:[{columns:[k,m,f,a]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:V()}],overflow:[{overflow:H()}],"overflow-x":[{"overflow-x":H()}],"overflow-y":[{"overflow-y":H()}],overscroll:[{overscroll:B()}],"overscroll-x":[{"overscroll-x":B()}],"overscroll-y":[{"overscroll-y":B()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{"inset-s":I(),start:I()}],end:[{"inset-e":I(),end:I()}],"inset-bs":[{"inset-bs":I()}],"inset-be":[{"inset-be":I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[ue,"auto",f,m]}],basis:[{basis:[le,"full","auto",a,...b()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[k,le,"auto","initial","none",m]}],grow:[{grow:["",k,f,m]}],shrink:[{shrink:["",k,f,m]}],order:[{order:[ue,"first","last","none",f,m]}],"grid-cols":[{"grid-cols":ae()}],"col-start-end":[{col:ce()}],"col-start":[{"col-start":ee()}],"col-end":[{"col-end":ee()}],"grid-rows":[{"grid-rows":ae()}],"row-start-end":[{row:ce()}],"row-start":[{"row-start":ee()}],"row-end":[{"row-end":ee()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":fe()}],"auto-rows":[{"auto-rows":fe()}],gap:[{gap:b()}],"gap-x":[{"gap-x":b()}],"gap-y":[{"gap-y":b()}],"justify-content":[{justify:[...oe(),"normal"]}],"justify-items":[{"justify-items":[...X(),"normal"]}],"justify-self":[{"justify-self":["auto",...X()]}],"align-content":[{content:["normal",...oe()]}],"align-items":[{items:[...X(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...X(),{baseline:["","last"]}]}],"place-content":[{"place-content":oe()}],"place-items":[{"place-items":[...X(),"baseline"]}],"place-self":[{"place-self":["auto",...X()]}],p:[{p:b()}],px:[{px:b()}],py:[{py:b()}],ps:[{ps:b()}],pe:[{pe:b()}],pbs:[{pbs:b()}],pbe:[{pbe:b()}],pt:[{pt:b()}],pr:[{pr:b()}],pb:[{pb:b()}],pl:[{pl:b()}],m:[{m:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mbs:[{mbs:$()}],mbe:[{mbe:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":b()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":b()}],"space-y-reverse":["space-y-reverse"],size:[{size:q()}],"inline-size":[{inline:["auto",...Ie()]}],"min-inline-size":[{"min-inline":["auto",...Ie()]}],"max-inline-size":[{"max-inline":["none",...Ie()]}],"block-size":[{block:["auto",...z()]}],"min-block-size":[{"min-block":["auto",...z()]}],"max-block-size":[{"max-block":["none",...z()]}],w:[{w:[a,"screen",...q()]}],"min-w":[{"min-w":[a,"screen","none",...q()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[s]},...q()]}],h:[{h:["screen","lh",...q()]}],"min-h":[{"min-h":["screen","lh","none",...q()]}],"max-h":[{"max-h":["screen","lh",...q()]}],"font-size":[{text:["base",r,je,ge]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,No,Eo]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ct,m]}],"font-family":[{font:[Po,Ao,t]}],"font-features":[{"font-features":[m]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,f,m]}],"line-clamp":[{"line-clamp":[k,"none",f,Pt]}],leading:[{leading:[i,...b()]}],"list-image":[{"list-image":["none",f,m]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",f,m]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:h()}],"text-color":[{text:h()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...De(),"wavy"]}],"text-decoration-thickness":[{decoration:[k,"from-font","auto",f,ge]}],"text-decoration-color":[{decoration:h()}],"underline-offset":[{"underline-offset":[k,"auto",f,m]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:b()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",f,m]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",f,m]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:R()}],"bg-repeat":[{bg:L()}],"bg-size":[{bg:G()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ue,f,m],radial:["",f,m],conic:[ue,f,m]},Uo,Zo]}],"bg-color":[{bg:h()}],"gradient-from-pos":[{from:ne()}
vendor: 7,275 bytes, line 1
1],"gradient-via-pos":[{via:ne()}],"gradient-to-pos":[{to:ne()}],"gradient-from":[{from:h()}],"gradient-via":[{via:h()}],"gradient-to":[{to:h()}],rounded:[{rounded:O()}],"rounded-s":[{"rounded-s":O()}],"rounded-e":[{"rounded-e":O()}],"rounded-t":[{"rounded-t":O()}],"rounded-r":[{"rounded-r":O()}],"rounded-b":[{"rounded-b":O()}],"rounded-l":[{"rounded-l":O()}],"rounded-ss":[{"rounded-ss":O()}],"rounded-se":[{"rounded-se":O()}],"rounded-ee":[{"rounded-ee":O()}],"rounded-es":[{"rounded-es":O()}],"rounded-tl":[{"rounded-tl":O()}],"rounded-tr":[{"rounded-tr":O()}],"rounded-br":[{"rounded-br":O()}],"rounded-bl":[{"rounded-bl":O()}],"border-w":[{border:F()}],"border-w-x":[{"border-x":F()}],"border-w-y":[{"border-y":F()}],"border-w-s":[{"border-s":F()}],"border-w-e":[{"border-e":F()}],"border-w-bs":[{"border-bs":F()}],"border-w-be":[{"border-be":F()}],"border-w-t":[{"border-t":F()}],"border-w-r":[{"border-r":F()}],"border-w-b":[{"border-b":F()}],"border-w-l":[{"border-l":F()}],"divide-x":[{"divide-x":F()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":F()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...De(),"hidden","none"]}],"divide-style":[{divide:[...De(),"hidden","none"]}],"border-color":[{border:h()}],"border-color-x":[{"border-x":h()}],"border-color-y":[{"border-y":h()}],"border-color-s":[{"border-s":h()}],"border-color-e":[{"border-e":h()}],"border-color-bs":[{"border-bs":h()}],"border-color-be":[{"border-be":h()}],"border-color-t":[{"border-t":h()}],"border-color-r":[{"border-r":h()}],"border-color-b":[{"border-b":h()}],"border-color-l":[{"border-l":h()}],"divide-color":[{divide:h()}],"outline-style":[{outline:[...De(),"none","hidden"]}],"outline-offset":[{"outline-offset":[k,f,m]}],"outline-w":[{outline:["",k,je,ge]}],"outline-color":[{outline:h()}],shadow:[{shadow:["","none",d,Be,Fe]}],"shadow-color":[{shadow:h()}],"inset-shadow":[{"inset-shadow":["none",v,Be,Fe]}],"inset-shadow-color":[{"inset-shadow":h()}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:h()}],"ring-offset-w":[{"ring-offset":[k,ge]}],"ring-offset-color":[{"ring-offset":h()}],"inset-ring-w":[{"inset-ring":F()}],"inset-ring-color":[{"inset-ring":h()}],"text-shadow":[{"text-shadow":["none",g,Be,Fe]}],"text-shadow-color":[{"text-shadow":h()}],opacity:[{opacity:[k,f,m]}],"mix-blend":[{"mix-blend":[...jt(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":jt()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[k]}],"mask-image-linear-from-pos":[{"mask-linear-from":M()}],"mask-image-linear-to-pos":[{"mask-linear-to":M()}],"mask-image-linear-from-color":[{"mask-linear-from":h()}],"mask-image-linear-to-color":[{"mask-linear-to":h()}],"mask-image-t-from-pos":[{"mask-t-from":M()}],"mask-image-t-to-pos":[{"mask-t-to":M()}],"mask-image-t-from-color":[{"mask-t-from":h()}],"mask-image-t-to-color":[{"mask-t-to":h()}],"mask-image-r-from-pos":[{"mask-r-from":M()}],"mask-image-r-to-pos":[{"mask-r-to":M()}],"mask-image-r-from-color":[{"mask-r-from":h()}],"mask-image-r-to-color":[{"mask-r-to":h()}],"mask-image-b-from-pos":[{"mask-b-from":M()}],"mask-image-b-to-pos":[{"mask-b-to":M()}],"mask-image-b-from-color":[{"mask-b-from":h()}],"mask-image-b-to-color":[{"mask-b-to":h()}],"mask-image-l-from-pos":[{"mask-l-from":M()}],"mask-image-l-to-pos":[{"mask-l-to":M()}],"mask-image-l-from-color":[{"mask-l-from":h()}],"mask-image-l-to-color":[{"mask-l-to":h()}],"mask-image-x-from-pos":[{"mask-x-from":M()}],"mask-image-x-to-pos":[{"mask-x-to":M()}],"mask-image-x-from-color":[{"mask-x-from":h()}],"mask-image-x-to-color":[{"mask-x-to":h()}],"mask-image-y-from-pos":[{"mask-y-from":M()}],"mask-image-y-to-pos":[{"mask-y-to":M()}],"mask-image-y-from-color":[{"mask-y-from":h()}],"mask-image-y-to-color":[{"mask-y-to":h()}],"mask-image-radial":[{"mask-radial":[f,m]}],"mask-image-radial-from-pos":[{"mask-radial-from":M()}],"mask-image-radial-to-pos":[{"mask-radial-to":M()}],"mask-image-radial-from-color":[{"mask-radial-from":h()}],"mask-image-radial-to-color":[{"mask-radial-to":h()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":Z()}],"mask-image-conic-pos":[{"mask-conic":[k]}],"mask-image-conic-from-pos":[{"mask-conic-from":M()}],"mask-image-conic-to-pos":[{"mask-conic-to":M()}],"mask-image-conic-from-color":[{"mask-conic-from":h()}],"mask-image-conic-to-color":[{"mask-conic-to":h()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:R()}],"mask-repeat":[{mask:L()}],"mask-size":[{mask:G()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",f,m]}],filter:[{filter:["","none",f,m]}],blur:[{blur:$t()}],brightness:[{brightness:[k,f,m]}],contrast:[{contrast:[k,f,m]}],"drop-shadow":[{"drop-shadow":["","none",_,Be,Fe]}],"drop-shadow-color":[{"drop-shadow":h()}],grayscale:[{grayscale:["",k,f,m]}],"hue-rotate":[{"hue-rotate":[k,f,m]}],invert:[{invert:["",k,f,m]}],saturate:[{saturate:[k,f,m]}],sepia:[{sepia:["",k,f,m]}],"backdrop-filter":[{"backdrop-filter":["","none",f,m]}],"backdrop-blur":[{"backdrop-blur":$t()}],"backdrop-brightness":[{"backdrop-brightness":[k,f,m]}],"backdrop-contrast":[{"backdrop-contrast":[k,f,m]}],"backdrop-grayscale":[{"backdrop-grayscale":["",k,f,m]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[k,f,m]}],"backdrop-invert":[{"backdrop-invert":["",k,f,m]}],"backdrop-opacity":[{"backdrop-opacity":[k,f,m]}],"backdrop-saturate":[{"backdrop-saturate":[k,f,m]}],"backdrop-sepia":[{"backdrop-sepia":["",k,f,m]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":b()}],"border-spacing-x":[{"border-spacing-x":b()}],"border-spacing-y":[{"border-spacing-y":b()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",f,m]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[k,"initial",f,m]}],ease:[{ease:["linear","initial",K,f,m]}],delay:[{delay:[k,f,m]}],animate:[{animate:["none",J,f,m]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[C,f,m]}],"perspective-origin":[{"perspective-origin":V()}],rotate:[{rotate:Ve()}],"rotate-x":[{"rotate-x":Ve()}],"rotate-y":[{"rotate-y":Ve()}],"rotate-z":[{"rotate-z":Ve()}],scale:[{scale:Me()}],"scale-x":[{"scale-x":Me()}],"scale-y":[{"scale-y":Me()}],"scale-z":[{"scale-z":Me()}],"scale-3d":["scale-3d"],skew:[{skew:at()}],"skew-x":[{"skew-x":at()}],"skew-y":[{"skew-y":at()}],transform:[{transform:[f,m,"","none","gpu","cpu"]}],"transform-origin":[{origin:V()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ke()}],"translate-x":[{"translate-x":Ke()}],"translate-y":[{"translate-y":Ke()}],"translate-z":[{"translate-z":Ke()}],"translate-none":["translate-none"],accent:[{accent:h()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:h()}
vendor: 5,077 bytes, line 1
1],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",f,m]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":b()}],"scroll-mx":[{"scroll-mx":b()}],"scroll-my":[{"scroll-my":b()}],"scroll-ms":[{"scroll-ms":b()}],"scroll-me":[{"scroll-me":b()}],"scroll-mbs":[{"scroll-mbs":b()}],"scroll-mbe":[{"scroll-mbe":b()}],"scroll-mt":[{"scroll-mt":b()}],"scroll-mr":[{"scroll-mr":b()}],"scroll-mb":[{"scroll-mb":b()}],"scroll-ml":[{"scroll-ml":b()}],"scroll-p":[{"scroll-p":b()}],"scroll-px":[{"scroll-px":b()}],"scroll-py":[{"scroll-py":b()}],"scroll-ps":[{"scroll-ps":b()}],"scroll-pe":[{"scroll-pe":b()}],"scroll-pbs":[{"scroll-pbs":b()}],"scroll-pbe":[{"scroll-pbe":b()}],"scroll-pt":[{"scroll-pt":b()}],"scroll-pr":[{"scroll-pr":b()}],"scroll-pb":[{"scroll-pb":b()}],"scroll-pl":[{"scroll-pl":b()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",f,m]}],fill:[{fill:["none",...h()]}],"stroke-w":[{stroke:[k,je,ge,Pt]}],stroke:[{stroke:["none",...h()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Lo=bo(Oo);function ye(...e){return Lo(qr(e))}const Do={id:"strongwall",name:"Strongwall.ai",productName:"Strongwall",siteUrl:"https://strongwall.ai",tagline:"Privacy-first AI",orgDescription:"Privacy-first AI platform. No data retention. No training on your conversations. No behavioral profiling.",promoCode:"TRYSTRONGWALL",themeColor:"#0891b2",bootBackgroun
1d:["#ffffff","#f9feff"],bootSpinner:"#0891b2",twitterSite:"@StrongwallAi",supportEmail:"[email protected]",legalEmail:"[email protected]",socials:[{label:"X",url:"https://x.com/StrongwallAi",icon:"x"},{label:"Facebook",url:"https://www.facebook.com/profile.php?id=61583299945684",icon:"facebook"},{label:"Instagram",url:"https://www.instagram.com/strongwallai/",icon:"instagram"}],pricing:{saveTag:"SAVE 25%",monthlyPayments:"Pay Via Card, Cash or Check",annualPayments:"Pay Via Card, Crypto, Cash or Check",amounts:{usd:{monthly:16,annual:144}}}},rl=(e,t="usd")=>{const r=Math.round(e*100),o=r%100===0;return new Intl.NumberFormat("en",{style:"currency",currency:t.toUpperCase(),minimumFractionDigits:o?0:2,maximumFractionDigits:o?0:2}).format(r/100)},Xe=Do,Vo=Xe.id==="private",Ae=e=>{const{children:t,variant:r="primary",size:o="default",disabled:n,className:i="",noMinWidth:s=!1,icon:a,iconPlacement:c="before",...l}=e,_=[ye("font-semibold leading-[18px] cursor-pointer transition-colors duration-200 disabled:opacity-70 disabled:cursor-not-allowed outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",Vo,{default:"h-11 md:h-9 px-3 text-sm",lg:"h-[51px] px-8 text-md md:text-lg"}[o],!s&&"min-w-[120px]",a&&"flex items-center gap-2"),{primary:"bg-primary border border-primary text-primary-foreground hover:enabled:bg-primary-hover",secondary:"bg-surface border text-foreground shadow-sm hover:enabled:bg-background",error:"bg-error border border-error-emphasis text-primary-foreground hover:enabled:bg-error-hover",ghost:"bg-transparent border-none text-foreground hover:enabled:bg-muted",outline:"bg-transparent border border-surface text-primary-foreground hover:enabled:bg-primary-hover"}[r],i].filter(Boolean).join(" ");return p.jsxs("button",{...l,disabled:n,className:_,children:[a&&c==="before"&&p.jsx("span",{className:"flex items-center",children:a}),t,a&&c==="after"&&p.jsx("span",{className:"flex items-center",children:a})]})},Mo=({children:e,className:t="",variant:r="default",isLoading:o=!1,onClick:n,...i})=>{const l=["border border-border rounded-sm p-5 box-border shadow-sm","bg-surface/75",n?"cursor-pointer transition-[background-color,border-color] duration-200 hover:bg-surface/90 hover:border-border":"",t].filter(Boolean).join(" ");return p.jsx("div",{className:l,onClick:n,...i,children:o?p.jsx("div",{className:"flex justify-center items-center min-h-[100px]",children:p.jsx(Qc,{})}):e})};const Ko=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Fo=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,o)=>o?o.toUpperCase():r.toLowerCase()),Nt=e=>{const t=Fo(e);return t.charAt(0).toUpperCase()+t.slice(1)},kr=(...e)=>e.filter((t,r,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===r).join(" ").trim(),Bo=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var Wo={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Ho=y.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:n="",children:i,iconNode:s,...a},c)=>y.createElement("svg",{ref:c,...Wo,width:t,height:t,stroke:e,strokeWidth:o?Number(r)*24/Number(t):r,className:kr("lucide",n),...!i&&!Bo(a)&&{"aria-hidden":"true"},...a},[...s.map(([l,d])=>y.createElement(l,d)),...Array.isArray(i)?i:[i]]));const Re=(e,t)=>{const r=y.forwardRef(({className:o,...n},i)=>y.createElement(Ho,{ref:i,iconNode:t,className:kr(`lucide-${Ko(Nt(e))}`,`lucide-${e}`,o),...n}));return r.displayName=Nt(e),r};const Go=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],qo=Re("check",Go);const Yo=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Jo=Re("eye-off",Yo);const Xo=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Qo=Re("eye",Xo);const en=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],tn=Re("triangle-alert",en);const rn=[["path",{d:"M18 6 6 18",key:"1bl5f8"}
1],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],on=Re("x",rn),nn=({checked:e,onChange:t,label:r})=>p.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none",onClick:()=>t(!e),children:[p.jsx("div",{className:`
2                    w-4 h-4
3                    border border-border
4                    flex items-center justify-center
5                    transition-all duration-200
6                    flex-shrink-0
7                    hover:border-border
8                    
9                    ${e?"bg-primary !border-primary-hover hover:bg-primary-hover hover:border-primary-hover":"bg-surface"}
10                `.trim().replace(/\s+/g," "),children:e&&p.jsx(qo,{size:12,className:"text-primary-foreground",strokeWidth:3})}),r&&p.jsx("span",{className:"text-foreground text-sm font-normal leading-5",children:r})]}),sn=({isOpen:e,onClose:t,children:r,showCloseButton:o=!1,size:n="default",mobileFullHeight:i=!1})=>{if(y.useEffect(()=>{if(!e)return;const d=v=>{v.key==="Escape"&&t()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e,t]),!e)return null;const s={small:"max-w-md",default:"max-w-2xl"},l=i?`flex flex-col overflow-hidden w-full h-[100dvh] rounded-none md:rounded-3xl md:w-[90%] md:h-[80dvh] ${s[n]}`:`overflow-y-auto rounded-3xl w-[90%] max-h-[80dvh] ${s[n]}`;return ir.createPortal(p.jsx("div",{className:"fixed inset-0 z-[1000] flex items-center justify-center bg-gradient-to-b from-surface/0 to-surface backdrop-blur-md animate-in fade-in duration-200",onClick:t,children:p.jsxs("div",{className:`relative bg-surface border shadow-md animate-in slide-in-from-bottom-5 duration-300 ${l}`,onClick:d=>d.stopPropagation(),children:[o&&p.jsx("button",{className:"absolute top-4 right-4 bg-transparent border-0 cursor-pointer p-1 flex items-center justify-center rounded-full transition-colors duration-200 hover:bg-muted active:bg-surface-muted text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",onClick:t,"aria-label":"Close modal",children:p.jsx(on,{size:20})}),r]})}),document.body)},an={between:"justify-between",center:"justify-center",start:"justify-start",end:"justify-end",around:"justify-around"},cn={center:"items-center","flex-start":"items-start","flex-end":"items-end",stretch:"items-stretch",baseline:"items-baseline"},Rt={0:"gap-0",1:"gap-0.5",2:"gap-0.5",4:"gap-1",6:"gap-1.5",8:"gap-2",10:"gap-2.5",12:"gap-3",16:"gap-4",20:"gap-5",24:"gap-6",28:"gap-7",32:"gap-8",40:"gap-10",48:"gap-12",56:"gap-14",64:"gap-16"},Pe=y.forwardRef((e,t)=>{const{alignItems:r="center",children:o,justify:n="start",space:i=10,wrap:s=!0,className:a="",style:c,...l}=e,d=r&&typeof r=="string"&&cn[r]||"",v=an[n],g=Rt[i]||"",x=["flex","flex-row",v,d,g,s?"flex-wrap":"flex-nowrap",a].filter(Boolean).join(" "),C=Rt[i]?c:{gap:`${i}px`,...c};return p.jsx("div",{ref:t,...l,className:x,style:C,children:o})});Pe.displayName="HStack";const ln={between:"justify-between",center:"justify-center",start:"justify-start",end:"justify-end",around:"justify-around"},un={center:"items-center","flex-start":"items-start","flex-end":"items-end",stretch:"items-stretch",baseline:"items-baseline"},Ot={0:"gap-0",1:"gap-0.5",2:"gap-0.5",4:"gap-1",6:"gap-1.5",8:"gap-2",10:"gap-2.5",12:"gap-3",16:"gap-4",20:"gap-5",24:"gap-6",28:"gap-7",32:"gap-8",40:"gap-10",48:"gap-12",56:"gap-14",64:"gap-16"},Q=y.forwardRef((e,t)=>{const{children:r,alignItems:o,space:n=10,justify:i="start",className:s="",style:a,...c}=e,l=o&&typeof o=="string"&&un[o]||"",d=ln[i],v=Ot[n]||"",g=["flex","flex-col",d,l,v,s].filter(Boolean).join(" "),_=Ot[n]?a:{gap:`${n}px`,...a};return p.jsx("div",{ref:t,...c,className:g,style:_,children:r})});Q.displayName="Stack";const dn={muted:"text-muted-foreground",error:"text-error",supporting:"text-sm leading-5 font-medium uppercase text-primary tracking-[1.4px]"},Lt={xs:"text-xs leading-5",sm:"text-sm leading-5",normal:"text-base leading-6",lg:"text-lg leading-6",xl:"text-2xl leading-[30px]",xxl:"text-2xl md:text-[30px] leading-8",h1:"text-[50px] leading-[52px] md:text-[60px] md:leading-[64px] lg:text-[72px] lg:leading-[75px] tracking-[-1.8px]",h2:"text-[32px] leading-[38px] md:text-[45px] md:leading-[56px] lg:text-[50px] lg:leading-[62px] tracking-[-1.8px]",h3:"text-[20px] leading-[28px] md:text-[25px] md:leading-[33px] lg:text-[27px] lg:leading-[35px]",h4:"text-[24px] leading-[32px] md:text-[30px] md:leading-[40px] lg:text-[33px] lg:leading-[42px]",h5:"text-[20px] leading-[28px] md:text-[25px] md:leading-[33px] lg:text-[27px] lg:leading-[35px]",h6:"text-[18px] leading-normal md:text-[20px]"},pn={xs:"md:text-xs md:leading-5",sm:"md:text-sm md:leading-5",normal:"md:text-base md:leading-6",lg:"md:text-lg md:leading-6",xl:"md:text-2xl md:leading-[30px]",xxl:"md:text-[30px] md:leading-8"},hn={400:"font-normal",500:"font-medium",600:"font-semibold",700:"font-bold",800:"font-extrabold",900:"font-black"},mn={constrained:"max-w-[90%]",readable:"max-w-[65ch]",full:""},te=e=>{const{children:t,weight:r=400,size:o="normal",mobileSize:n,as:i="span",theme:s,width:a="full",centered:c=!1,family:l="inter",uppercase:d=!1,truncated:v=!1,className:g="",..._}=e,x=ye(n?Lt[n]:Lt[o],n&&pn[o],hn[r],mn[a],s&&dn[s],c&&"text-center",d&&"uppercase",v&&"block whitespace-nowrap overflow-hidden text-ellipsis",l==="geist"&&"font-mono",g);return p.jsx(i,{..._,className:x,children:t})},fn=e=>{const{title:t,message:r,showIcon:o=!1,slim:n=!1}=e;return p.jsx("div",{className:ye("p-3 bg-error-subtle","",!n&&"border border-error-emphasis"),children:p.jsxs(Pe,{space:16,alignItems:"flex-start",children:[o&&p.jsx(tn,{size:32,className:"text-error-emphasis"}),p.jsxs(Q,{space:4,children:[t&&p.jsx(te,{weight:600,size:"sm",theme:"error",children:t}),p.jsx(te,{size:"sm",theme:"error",children:r})]})]})})},gn=({children:e,label:t,htmlFor:r,className:o="",...n})=>p.jsxs("div",{className:ye("flex flex-col gap-2",o),...n,children:[t&&p.jsx("label",{htmlFor:r,className:"font-inter font-semibold text-sm leading-[18px] text-foreground",children:t}),e]}),xr=y.forwardRef(({className:e="",showEyeButton:t=!1,isErrored:r,type:o,onBlur:n,...i},s)=>{const[a,c]=y.useState(!1),l=t?a?"text":"password":o,d=v=>{setTimeout(()=>{document.activeElement?.tagName!=="INPUT"&&window.scrollTo({top:0,behavior:"smooth"})},100),n&&n(v)};return p.jsxs("div",{className:"relative flex items-center",children:[p.jsx("input",{ref:s,t
10ype:l,className:ye("w-full h-11 md:h-9 px-3 bg-background border-none font-inter font-normal text-md md:text-sm leading-5 text-foreground box-border shadow-[inset_0px_0px_0px_1px_rgba(0,0,0,0.12)]","placeholder:text-subtle-foreground","focus:outline-none focus:shadow-[inset_0px_0px_0px_1px_rgba(0,0,0,0.24)]","disabled:opacity-50 disabled:cursor-not-allowed",t&&"pr-11",e),onBlur:d,...i}),t&&p.jsx("button",{type:"button",className:"absolute right-3 bg-transparent border-none p-0 w-5 h-5 flex items-center justify-center cursor-pointer text-muted-foreground hover:text-foreground",onClick:()=>c(!a),tabIndex:-1,children:a?p.jsx(Jo,{size:20}):p.jsx(Qo,{size:20})})]})});xr.displayName="Input";const $e=1;class vt extends Error{constructor(){super("Saved conversations cannot be unlocked with this password"),this.name="StorageKeyMismatchError"}}class Ye extends Error{constructor(t,r){super(r||"Your saved conversations could not be opened. Close any other tabs with this app open, then try again."),this.name="StorageUnavailableError",this.cause=t}}function Dt(e){return e instanceof DOMException&&e.name==="InvalidStateError"}class bn{constructor(){this.dbName="strongwall-secure-storage",this.dbVersion=1,this.db=null,this.currentUserId=null,this.masterKey=null,this.decryptionWorker=null,this.workerRequestId=0,this.workerCallbacks=new Map,this.progressCallbacks=new Map,this._upgradePromise=null,this._initPromise=null,this._reopenPromise=null,this._initialized=!1}async _acquireUpgradeLock(){for(;this._upgradePromise;)await this._upgradePromise}async _ready(){await this._acquireUpgradeLock(),await this._ensureOpen()}async _withUpgradeLock(t){await this._acquireUpgradeLock();let r;this._upgradePromise=new Promise(o=>{r=o});try{return await t()}finally{this._upgradePromise=null,r()}}_openDb({version:t,onUpgrade:r,timeoutMs:o=15e3}={}){return new Promise((n,i)=>{const s=t===void 0?indexedDB.open(this.dbName):indexedDB.open(this.dbName,t),a=setTimeout(()=>{i(new Error("IndexedDB open timed out. Another browser tab may have this app open. Please close other tabs of this app and try again."))},o);s.onerror=()=>{clearTimeout(a),i(new Ye(s.error))},s.onblocked=()=>{clearTimeout(a),i(new Error("Another browser tab has this app open and is preventing the database from upgrading. Please close other tabs of this app and reload."))},s.onsuccess=()=>{clearTimeout(a);const c=s.result;c.onversionchange=()=>{c.close(),this.db===c&&(this.db=null),console.warn("[Storage] Closed IndexedDB connection: another tab requested an upgrade")},n(c)},r&&(s.onupgradeneeded=c=>r(c.target.result,c))})}async initialize(){return this._initPromise?this._initPromise:(this._initPromise=this._initializeOnce().finally(()=>{this._initPromise=null}),this._initPromise)}async _initializeOnce(){this._initialized=!1;let t=await this._openDb();this.db=t,this.dbVersion=t.version,(!t.objectStoreNames.contains("user_keys")||!t.objectStoreNames.contains("metadata"))&&await this._withUpgradeLock(async()=>{this.db=null,t.close(),t=await this._openDb({version:this.dbVersion+1,onUpgrade:o=>{o.objectStoreNames.contains("user_keys")||o.createObjectStore("user_keys",{keyPath:"userId"}),o.objectStoreNames.contains("metadata")||o.createObjectStore("metadata")}}),this.db=t,this.dbVersion=t.version}),await this.validateSchemaVersion(),this._initialized=!0}_readSchemaVersionRaw(t){return t.objectStoreNames.contains("metadata")?new Promise((r,o)=>{let n;try{n=t.transaction(["metadata"],"readonly")}catch(s){o(s);return}const i=n.objectStore("metadata").get("schemaVersion");i.onsuccess=()=>r(i.result??null),i.onerror=()=>o(i.error)}):Promise.resolve(null)}_reopen(){return this._reopenPromise||(this._reopenPromise=(async()=>{const t=await this._openDb();let r=null;try{r=await this._readSchemaVersionRaw(t)}catch(o){console.warn("[Storage] Could not read schema version on reopen:",o)}if(r!==null&&r!==$e)throw t.close(),new Error(`Incompatible data format (version ${r}, expected ${$e}). Please reload the page.`);this.db=t,this.dbVersion=t.version})().finally(()=>{this._reopenPromise=null})),this._reopenPromise}async _ensureOpen(){return this.db||await this._reopen(),this.db}async _runTx(t,r,o){for(let n=0;;n++){await this._acquireUpgradeLock(),await this._ensureOpen();let i;try{i=this.db.transaction(t,r)}catch(s){if(n===0&&Dt(s)){console.warn("[Storage] Reopening IndexedDB: connection was closed mid-flight"),this.db=null;continue}throw console.error("[Storage] Could not start transaction:",s),s instanceof DOMException?Dt(s)||s.name==="TransactionInactiveError"?new Ye(s):new Ye(s,`Your saved conversations could not be opened (${s.name}). Reloading the page may help; if it keeps happening, contact support.`):s}return o(i)}}async validateSchemaVersion(){if(await this._ensureOpen(),!this.db.objectStoreNames.contains("metadata"))try{await this.createMetadataStore()}catch(r){console.warn("Could not create metadata store, proceeding without schema validation:",r);return}let t;
10try{t=await this.getSchemaVersion()}catch(r){console.warn("Could not read schema version:",r);return}if(t===null){try{await this.setSchemaVersion($e)}catch(r){console.warn("Could not set schema version:",r)}return}if(t!==$e)throw new Error(`Incompatible data format (version ${t}, expected ${$e}). Please clear your browser data for this site.`)}async createMetadataStore(){return this._withUpgradeLock(async()=>{await this._ensureOpen();const t=this.dbVersion,r=this.db;this.db=null,r?.close();const o=await this._openDb({version:t+1,onUpgrade:n=>{n.objectStoreNames.contains("user_keys")||n.createObjectStore("user_keys",{keyPath:"userId"}),n.objectStoreNames.contains("metadata")||n.createObjectStore("metadata")}});this.db=o,this.dbVersion=o.version})}async getSchemaVersion(){return this._runTx(["metadata"],"readonly",t=>new Promise((r,o)=>{const i=t.objectStore("metadata").get("schemaVersion");i.onsuccess=()=>{r(i.result??null)},i.onerror=()=>o(i.error)}))}async setSchemaVersion(t){return this._runTx(["metadata"],"readwrite",r=>new Promise((o,n)=>{const s=r.objectStore("metadata").put(t,"schemaVersion");s.onsuccess=()=>o(),s.onerror=()=>n(s.error)}))}async initializeUser(t,r){if(!t||!r)throw new Error("User identifier and credential are required");(!this._initialized||!this.db)&&(console.log("[Storage] Initializing database..."),await this.initialize(),console.log("[Storage] Database initialized, version:",this.dbVersion)),this.currentUserId=await this.hashIdentifier(t),console.log("[Storage] User ID hash computed"),console.log("[Storage] Checking for existing wrapped key...");const o=await this.getWrappedKey();if(console.log("[Storage] Existing key found:",!!o),o)try{console.log("[Storage] Attempting to unwrap existing key..."),this.masterKey=await this.unwrapMasterKey(o.wrappedKey,r,o.salt),console.log("[Storage] Successfully unwrapped existing key")}catch{throw console.warn("[Storage] Stored key cannot be unwrapped with this credential"),new vt}if(console.log("[Storage] Ensuring user store exists..."),await this.ensureUserStore(),console.log("[Storage] User store ensured"),(!this.db||!this.db.objectStoreNames)&&(console.log("[Storage] Re-initializing database after store creation..."),await this.initialize()),!this.masterKey){console.log("[Storage] Generating new master key..."),this.masterKey=await this.generateMasterKey();const n=crypto.getRandomValues(new Uint8Array(16)),i=await this.wrapMasterKey(this.masterKey,r,n);console.log("[Storage] Saving wrapped key..."),await this.saveWrappedKey({userId:this.currentUserId,wrappedKey:this.arrayBufferToBase64(i),salt:this.arrayBufferToBase64(n),keyVersion:1,createdAt:new Date().toISOString()}),console.log("[Storage] Wrapped key saved")}console.log("[Storage] Persisting master key for session..."),await this.persistMasterKeyForSession(),console.log("[Storage] Initializing decryption worker..."),await this.initializeWorker(),console.log("[Storage] User initialization complete")}async resetLocalDataAndReinitialize(t,r){(!this._initialized||!this.db)&&await this.initialize(),this.currentUserId=await this.hashIdentifier(t),await this.clearCurrentUserData(),this.masterKey=null,await this.initializeUser(t,r)}async ensureUserStore(){await this._ensureOpen();const t=`user_${this.currentUserId}_conversations`;if(!this.db.objectStoreNames.contains(t))return this._withUpgradeLock(async()=>{if(await this._ensureOpen(),this.db.objectStoreNames.contains(t))return;const r=this.dbVersion,o=this.db;this.db=null,o?.close();const n=`user_${this.currentUserId}_folders`,i=`user_${this.currentUserId}_prompts`,s=`user_${this.currentUserId}_memories`,a=await this._openDb({version:r+1,onUpgrade:c=>{c.objectStoreNames.contains("user_keys")||c.createObjectStore("user_keys",{keyPath:"userId"}),c.objectStoreNames.contains(t)||c.createObjectStore(t,{keyPath:"id"}).createIndex("updatedAt","updatedAt",{unique:!1}),c.objectStoreNames.contains(n)||c.createObjectStore(n,{keyPath:"id"}).createIndex("order","order",{unique:!1}),c.objectStoreNames.contains(i)||c.createObjectStore(i,{keyPath:"id"}).createIndex("updatedAt","updatedAt",{unique:!1}),c.objectStoreNames.contains(s)||c.createObjectStore(s,{keyPath:"id"}).createIndex("updatedAt","updatedAt",{unique:!1})}});this.db=a,this.dbVersion=a.version})}async ensureFolderStore(){await this._ensureOpen();const t=`user_${this.currentUserId}_folders`;if(!this.db.objectStoreNames.contains(t))return this._withUpgradeLock(async()=>
10{if(await this._ensureOpen(),this.db.objectStoreNames.contains(t))return;const r=this.dbVersion,o=this.db;this.db=null,o?.close();const n=await this._openDb({version:r+1,onUpgrade:i=>{i.objectStoreNames.contains(t)||i.createObjectStore(t,{keyPath:"id"}).createIndex("order","order",{unique:!1})}});this.db=n,this.dbVersion=n.version})}async ensurePromptStore(){await this._ensureOpen();const t=`user_${this.currentUserId}_prompts`;if(!this.db.objectStoreNames.contains(t))return this._withUpgradeLock(async()=>{if(await this._ensureOpen(),this.db.objectStoreNames.contains(t))return;const r=this.dbVersion,o=this.db;this.db=null,o?.close();const n=await this._openDb({version:r+1,onUpgrade:i=>{i.objectStoreNames.contains(t)||i.createObjectStore(t,{keyPath:"id"}).createIndex("updatedAt","updatedAt",{unique:!1})}});this.db=n,this.dbVersion=n.version})}async ensureMemoryStore(){await this._ensureOpen();const t=`user_${this.currentUserId}_memories`;if(!this.db.objectStoreNames.contains(t))return this._withUpgradeLock(async()=>{if(await this._ensureOpen(),this.db.objectStoreNames.contains(t))return;const r=this.dbVersion,o=this.db;this.db=null,o?.close();const n=await this._openDb({version:r+1,onUpgrade:i=>{i.objectStoreNames.contains(t)||i.createObjectStore(t,{keyPath:"id"}).createIndex("updatedAt","updatedAt",{unique:!1})}});this.db=n,this.dbVersion=n.version})}async initializeWorker(){if(this.decryptionWorker&&this.decryptionWorker.terminate(),this.decryptionWorker=new Worker(new URL("/assets/decryptionWorker-XHpjfUA2.js",import.meta.url),{type:"module"}),this.decryptionWorker.onmessage=o=>{const{type:n,requestId:i,payload:s}=o.data;if(n==="DECRYPT_PROGRESS"){const c=this.progressCallbacks.get(i);c&&c(s);return}const a=this.workerCallbacks.get(i);a&&(n==="ERROR"?a.reject(new Error(s.error)):a.resolve(s),this.workerCallbacks.delete(i),this.progressCallbacks.delete(i))},this.decryptionWorker.onerror=o=>{console.error("Worker error:",o)},!this.masterKey)throw new Error("No master key available");const t=await crypto.subtle.exportKey("raw",this.masterKey),r=this.arrayBufferToBase64(t);return this.sendWorkerMessage("INIT_KEY",{keyBase64:r})}sendWorkerMessage(t,r,o=null){return new Promise((n,i)=>{const s=this.workerRequestId++,a=setTimeout(()=>{this.workerCallbacks.delete(s),this.progressCallbacks.delete(s),i(new Error(`Worker request ${t} timed out`))},3e4);this.workerCallbacks.set(s,{resolve:c=>{clearTimeout(a),n(c)},reject:c=>{clearTimeout(a),i(c)}}),o&&this.progressCallbacks.set(s,o),this.decryptionWorker.postMessage({type:t,payload:r,requestId:s})})}terminateWorker(){this.decryptionWorker&&(this.decryptionWorker.terminate(),this.decryptionWorker=null,this.workerCallbacks.clear(),this.progressCallbacks.clear())}async hashIdentifier(t){const o=new TextEncoder().encode(t.toLowerCase()),n=await crypto.subtle.digest("SHA-256",o);return this.arrayBufferToHex(n)}async generateMasterKey(){return await crypto.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"])}async deriveKeyFromCredential(t,r){const o=new TextEncoder,n=await crypto.subtle.importKey("raw",o.encode(t),"PBKDF2",!1,["deriveBits","deriveKey"]);return await crypto.subtle.deriveKey({name:"PBKDF2",salt:r,iterations:1e5,hash:"SHA-256"},n,{name:"AES-GCM",length:256},!1,["wrapKey","unwrapKey"])}async wrapMasterKey(t,r,o){const n=await this.deriveKeyFromCredential(r,o),i=crypto.getRandomValues(new Uint8Array(12)),s=await crypto.subtle.wrapKey("raw",t,n,{name:"AES-GCM",iv:i}),a=new Uint8Array(i.length+s.byteLength);return a.set(i),a.set(new Uint8Array(s),i.length),a.buffer}async unwrapMasterKey(t,r,o){const n=this.base64ToArrayBuffer(t),i=this.base64ToArrayBuffer(o),s=new Uint8Array(n,0,12),a=new Uint8Array(n,12),c=await this.deriveKeyFromCredential(r,i);return await crypto.subtle.unwrapKey("raw",a,c,{name:"AES-GCM",iv:s},{name:"AES-GCM",length:256},!0,["encrypt","decrypt"])}async rewrapMasterKey(t,r){if(!this.currentUserId)throw new Error("No user initialized");const o=await this.getWrappedKey();if(!o)throw new Error("No existing key to rewrap");const n=await this.unwrapMasterKey(o.wrappedKey,t,o.salt),i=crypto.getRandomValues(new Uint8Array(16)),s=await this.wrapMasterKey(n,r,i);await this.saveWrappedKey({userId:this.currentUserId,wrappedKey:this.arrayBufferToBase64(s),salt:this.arrayBufferToBase64(i),keyVersion:(o.keyVersion||1)+1,createdAt:o.createdAt,updatedAt:new Date().toISOString()}),this.masterKey=n}async encryptData(t){if(!this.masterKey)throw new Error("No master key available");const o=new TextEncoder().encode(JSON.stringify(t)),n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.encrypt({name:"AES-GCM",iv:n},this.masterKey,o);return{iv:this.arrayBufferToBase64(n),data:this.arrayBufferToBase64(i)}}async decryptData(t){if(!this.masterKey)throw new Error("No master key available");const r=this.base64ToArrayBuffer(t.iv),o=this.base64ToArrayBuffer(t.data),n=await crypto.subtle.decrypt({
10name:"AES-GCM",iv:r},this.masterKey,o),s=new TextDecoder().decode(n);return JSON.parse(s)}async saveConversation(t,r){if(!this.currentUserId||!this.masterKey)throw new Error("User not initialized");await this._ready();const o=`user_${this.currentUserId}_conversations`;try{if(!r.messages||r.messages.length===0)return;const n=await this.encryptData(r),i={id:t,encryptedData:n.data,iv:n.iv,updatedAt:r.updatedAt||new Date().toISOString()};return this._runTx([o],"readwrite",s=>new Promise((a,c)=>{const l=s.objectStore(o);s.oncomplete=()=>a(),s.onerror=()=>c(s.error),l.put(i)}))}catch(n){throw n}}async saveConversationsIncremental(t){if(!this.currentUserId||!this.masterKey)throw new Error("User not initialized");await this._ready();const r=`user_${this.currentUserId}_conversations`;try{const o=[];for(const[n,i]of Object.entries(t))if(i.messages&&i.messages.length>0){const s=await this.encryptData(i);o.push({id:n,encryptedData:s.data,iv:s.iv,updatedAt:i.updatedAt||new Date().toISOString()})}return o.length===0?void 0:this._runTx([r],"readwrite",n=>new Promise((i,s)=>{const a=n.objectStore(r);n.oncomplete=()=>i(),n.onerror=()=>s(n.error);for(const c of o)a.put(c)}))}catch(o){throw o}}async deleteConversationFromStorage(t){if(!this.currentUserId)throw new Error("User not initialized");const r=`user_${this.currentUserId}_conversations`;return this._runTx([r],"readwrite",o=>new Promise((n,i)=>{const s=o.objectStore(r);o.oncomplete=()=>n(),o.onerror=()=>i(o.error),s.delete(t)}))}async saveFolder(t,r){if(!this.currentUserId||!this.masterKey)throw new Error("User not initialized");const o=`user_${this.currentUserId}_folders`;try{const n=await this.encryptData(r),i={id:t,encryptedData:n.data,iv:n.iv,order:r.order||0};return this._runTx([o],"readwrite",s=>new Promise((a,c)=>{const l=s.objectStore(o);s.oncomplete=()=>a(),s.onerror=()=>c(s.error),l.put(i)}))}catch(n){throw n}}async loadFolders(){if(!this.currentUserId||!this.masterKey)throw new Error("User not initialized");await this._ready();const t=`user_${this.currentUserId}_folders`;return this.db.objectStoreNames.contains(t)||await this.ensureFolderStore(),this._runTx([t],"readonly",r=>new Promise((o,n)=>{try{const s=r.objectStore(t).getAll();s.onsuccess=async()=>{try{const a=s.result||[],c={};for(const l of a)try{const d=await this.decryptData({iv:l.iv,data:l.encryptedData});c[l.id]=d}catch(d){console.error(`Error decrypting folder ${l.id}, skipping:`,d)}o(c)}catch(a){console.error("Error loading folders:",a),n(a)}},s.onerror=()=>{console.error("Error getting folders from store:",s.error),n(s.error)}}catch(i){console.error("Error creating transaction:",i),n(i)}}))}async saveFolders(t){if(!this.currentUserId||!this.masterKey)throw new Error("User not initialized");await this._ready();const r=`user_${this.currentUserId}_folders`;try{const o=[];for(const[n,i]of Object.entries(t)){const s=await this.encryptData(i);o.push({id:n,encryptedData:s.data,iv:s.iv,order:i.order||0})}return this._runTx([r],"readwrite",n=>new Promise((i,s)=>{const a=n.objectStore(r);n.oncomplete=()=>i(),n.onerror=()=>s(n.error),a.clear(),o.forEach(c=>a.put(c))}))}catch(o){throw o}}async deleteFolder(t){if(!this.currentUserId)throw new Error("User not initialized");const r=`user_${this.currentUserId}_folders`;return this._runTx([r],"readwrite",o=>new Promise((n,i)=>{const s=o.objectStore(r);o.oncomplete=()=>n(),o.onerror=()=>i(o.error),s.delete(t)}))}async savePrompt(t,r){if(!this.currentUserId||!this.masterKey)throw new Error("User not initialized");await this._ready();const o=`user_${this.currentUserId}_prompts`;this.db.objectStoreNames.contains(o)||await this.ensurePromptStore();try{const n=await this.encryptData(r),i={id:t,encryptedData:n.data,iv:n.iv,updatedAt:r.updatedAt||new Date().toISOString()};return this._runTx([o],"readwrite",s=>new Promise((a,c)=>{const l=s.objectStore(o);s.oncomplete=()=>a(),s.onerror=()=>c(s.error),l.put(i)}))}catch(n){throw n}}async loadPrompts(){if(!this.currentUserId||!this.masterKey)throw new Error("User not initialized");await this._ready();const t=`user_${this.currentUserId}_prompts`;return this.db.objectStoreNames.contains(t)||await this.ensurePromptStore(
10),this._runTx([t],"readonly",r=>new Promise((o,n)=>{try{const s=r.objectStore(t).getAll();s.onsuccess=async()=>{try{const a=s.result||[],c={};for(const l of a)try{const d=await this.decryptData({iv:l.iv,data:l.encryptedData});c[l.id]=d}catch(d){console.error(`Error decrypting prompt ${l.id}, skipping:`,d)}o(c)}catch(a){console.error("Error loading prompts:",a),n(a)}},s.onerror=()=>{console.error("Error getting prompts from store:",s.error),n(s.error)}}catch(i){console.error("Error creating transaction:",i),n(i)}}))}async savePrompts(t){if(!this.currentUserId||!this.masterKey)throw new Error("User not initialized");await this._ready();const r=`user_${this.currentUserId}_prompts`;this.db.objectStoreNames.contains(r)||await this.ensurePromptStore();try{const o=[];for(const[n,i]of Object.entries(t)){const s=await this.encryptData(i);o.push({id:n,encryptedData:s.data,iv:s.iv,updatedAt:i.updatedAt||new Date().toISOString()})}return this._runTx([r],"readwrite",n=>new Promise((i,s)=>{const a=n.objectStore(r);n.oncomplete=()=>i(),n.onerror=()=>s(n.error),a.clear(),o.forEach(c=>a.put(c))}))}catch(o){throw o}}async deletePrompt(t){if(!this.currentUserId)throw new Error("User not initialized");await this._ready();const r=`user_${this.currentUserId}_prompts`;if(this.db.objectStoreNames.contains(r))return this._runTx([r],"readwrite",o=>new Promise((n,i)=>{const s=o.objectStore(r);o.oncomplete=()=>n(),o.onerror=()=>i(o.error),s.delete(t)}))}async saveMemory(t,r){if(!this.currentUserId||!this.masterKey)throw new Error("User not initialized");await this._ready();const o=`user_${this.currentUserId}_memories`;this.db.objectStoreNames.contains(o)||await this.ensureMemoryStore();try{const n=await this.encryptData(r),i={id:t,encryptedData:n.data,iv:n.iv,updatedAt:r.updatedAt||new Date().toISOString()};return this._runTx([o],"readwrite",s=>new Promise((a,c)=>{const l=s.objectStore(o);s.oncomplete=()=>a(),s.onerror=()=>c(s.error),l.put(i)}))}catch(n){throw n}}async loadMemories(){if(!this.currentUserId||!this.masterKey)throw new Error("User not initialized");await this._ready();const t=`user_${this.currentUserId}_memories`;return this.db.objectStoreNames.contains(t)||await this.ensureMemoryStore(),this._runTx([t],"readonly",r=>new Promise((o,n)=>{try{const s=r.objectStore(t).getAll();s.onsuccess=async()=>{try{const a=s.result||[],c={};for(const l of a)try{const d=await this.decryptData({iv:l.iv,data:l.encryptedData});c[l.id]=d}catch(d){console.error(`Error decrypting memory ${l.id}, skipping:`,d)}o(c)}catch(a){console.error("Error loading memories:",a),n(a)}},s.onerror=()=>{console.error("Error getting memories from store:",s.error),n(s.error)}}catch(i){console.error("Error creating transaction:",i),n(i)}}))}async saveMemories(t){if(!this.currentUserId||!this.masterKey)throw new Error("User not initialized");await this._ready();const r=`user_${this.currentUserId}_memories`;this.db.objectStoreNames.contains(r)||await this.ensureMemoryStore();try{const o=[];for(const[n,i]of Object.entries(t)){const s=await this.encryptData(i);o.push({id:n,encryptedData:s.data,iv:s.iv,updatedAt:i.updatedAt||new Date().toISOString()})}return this._runTx([r],"readwrite",n=>new Promise((i,s)=>{const a=n.objectStore(r);n.oncomplete=()=>i(),n.onerror=()=>s(n.error),a.clear(),o.forEach(c=>a.put(c))}))}catch(o){throw o}}async deleteMemory(t){if(!this.currentUserId)throw new Error("User not initialized");await this._ready();const r=`user_${this.currentUserId}_memories`;if(this.db.objectStoreNames.contains(r))return this._runTx([r],"readwrite",o=>new Promise((n,i)=>{const s=o.objectStore(r);o.oncomplete=()=>n(),o.onerror=()=>i(o.error),s.delete(t)}))}async saveConversations(t){if(!this.currentUserId||!this.masterKey)throw new Error("User not initialized");await this._ready();const r=`user_${this.currentUserId}_conversations`;try{const o=[];for(const[n,i]of Object.entries(t))if(i.messages&&i.messages.length>0){const s=await this.encryptData(i);o.push({id:n,encryptedData:s.data,iv:s.iv,updatedAt:i.updatedAt||new Date().toISOString()})}return this._runTx([r],"readwrite",n=>new Promise((i,s)=>{const a=n.objectStore(r);n.oncomplete=()=>i(),n.onerror=()=>s(n.error),a.clear();for(const c of o)a.put(c)}))}catch(o){throw o}}async loadConversations(t=null){if(!this.currentUserId||!this.masterKey)throw new Error("User not initialized");await this._ready();const r=`user_${this.currentUserId}_conversations`;return await this._ensureOpen(),this.db.objectStoreNames.contains(r)?this._runTx([r],"readonly",o=>new Promise((n,i)=>{const a=o.objectStore(r).getAll();a.onsuccess=async()=>{const c=a.result;if(c.length===0){n({});return}try{const{conversations:l}=await this.sendWorkerMessage("DECRYPT_BATCH",{records:c},t),d={};for(const{id:v,conversation:g}of l)d[v]=g;n(d)}catch(l){console.error("Failed to decrypt conversations:",l),i(l)}},a.onerror=()=>i(a.error)})):{}}async loadConversationMetadata(){if(!this.currentUserId)throw new Error("User not initialized");await this._ready();const t=`user_${this.currentUserId}_conversations`;return await this._ensureOpen(),this.db.objectStoreNames.contains(t)?this._runTx([t],"readonly",r=>new Promise((o,n)=>{const s=r.objectStore(t).getAll();s.onsuccess=()=>{const a={};for(const c of s.result)a[c.id]={id:c.id,updatedAt:c.updatedAt,isDecrypting:!0,title:"Decrypting..."};o(a)},s.onerror=()=>n(s.error)})):{}}async getWrappedKey(){return this.currentUserId?(await this._ensureOpen(),this.db.objectStoreNames.contains("user_keys")?this._runTx(["user_keys"],"readonly",t=>new Promise((r,o)=>{const i=t.objectStore("user_keys").get(this.currentUserId);t.onabort=()=>{console.error("getWrappedKey transaction aborted:",t.error),o(t.error||new Error("Transaction aborted"))},i.onsuccess=()=>r(i.result),i.onerror=()=>o(i.error)})):(console.warn("user_keys store does not exist yet"),null)):null}async saveWrappedKey(t){return this._runTx(["user_keys"],"readwrite",r=>new Promise((o,n)=>{const s=r.objectStore("user_keys").put(t);r.onabort=()=>n(r.error||new Error("Transaction aborted")),s.onsuccess=()=>o(),s.onerror=()=>n(s.error)}))}async clearCurrentUser(){if(!this.currentUserId)return;const t=`user_${this.currentUserId}_conversations`;await this._ensureOpen(),this.db.objectStoreNames.contains(t)&&await this._runTx([t],"readwrite",r=>new Promise((o,n)=>{r.oncomplete=()=>o(),r.onerror=()=>n(r.error),r.objectStore(t).clear()}
10)),await this._runTx(["user_keys"],"readwrite",r=>new Promise((o,n)=>{r.oncomplete=()=>o(),r.onerror=()=>n(r.error),r.objectStore("user_keys").delete(this.currentUserId)})),this.currentUserId=null,this.masterKey=null}async clearCurrentUserData(){if(!this.currentUserId)return;sessionStorage.removeItem(`masterKey_${this.currentUserId}`);try{await this._ensureOpen(),this.db.objectStoreNames.contains("user_keys")&&await this._runTx(["user_keys"],"readwrite",r=>new Promise((o,n)=>{r.oncomplete=()=>o(),r.onerror=()=>n(r.error),r.objectStore("user_keys").delete(this.currentUserId)}))}catch(r){console.warn("Failed to clear wrapped key:",r)}const t=[`user_${this.currentUserId}_conversations`,`user_${this.currentUserId}_folders`,`user_${this.currentUserId}_prompts`,`user_${this.currentUserId}_memories`];for(const r of t)try{await this._ensureOpen(),this.db.objectStoreNames.contains(r)&&await this._runTx([r],"readwrite",o=>new Promise((n,i)=>{o.oncomplete=()=>n(),o.onerror=()=>i(o.error),o.objectStore(r).clear()}))}catch(o){console.warn(`Failed to clear ${r}:`,o)}}async persistMasterKeyForSession(){if(!(!this.masterKey||!this.currentUserId))try{const t=await crypto.subtle.exportKey("raw",this.masterKey),r=this.arrayBufferToBase64(t);sessionStorage.setItem(`masterKey_${this.currentUserId}`,r)}catch(t){console.error("Failed to persist master key for session:",t)}}async restoreMasterKeyFromSession(){if(!this.currentUserId)return!1;try{const t=sessionStorage.getItem(`masterKey_${this.currentUserId}`);if(!t)return!1;const r=this.base64ToArrayBuffer(t);return this.masterKey=await crypto.subtle.importKey("raw",r,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),!0}catch(t){return console.error("Failed to restore master key from session:",t),sessionStorage.removeItem(`masterKey_${this.currentUserId}`),!1}}logout(){this.currentUserId&&sessionStorage.removeItem(`masterKey_${this.currentUserId}`),this.terminateWorker(),this.currentUserId=null,this.masterKey=null}lock(){this.currentUserId&&sessionStorage.removeItem(`masterKey_${this.currentUserId}`),this.terminateWorker(),this.masterKey=null}arrayBufferToBase64(t){const r=new Uint8Array(t);let o="";for(let n=0;n<r.byteLength;n++)o+=String.fromCharCode(r[n]);return btoa(o)}base64ToArrayBuffer(t){const r=atob(t),o=new Uint8Array(r.length);for(let n=0;n<r.length;n++)o[n]=r.charCodeAt(n);return o.buffer}arrayBufferToHex(t){const r=new Uint8Array(t);return Array.from(r).map(o=>o.toString(16).padStart(2,"0")).join("")}}const W=new bn,wn=({isOpen:e,onCancel:t,onConfirmErase:r,isErasing:o})=>{const[n,i]=y.useState(!1);return p.jsx(sn,{isOpen:e,onClose:t,showCloseButton:!0,size:"small",children:p.jsxs(Q,{space:20,className:"p-6",children:[p.jsxs(Q,{space:8,children:[p.jsx(te,{size:"lg",weight:600,children:"Your saved conversations can't be unlocked"}),p.jsx(te,{theme:"muted",children:"Your password changed, so the conversations saved on this device can't be unlocked with it. You can erase them and start fresh, or cancel and try a different password. Erasing is permanent — there's no way to get them back."})]}),p.jsx(nn,{checked:n,onChange:i,label:"I understand my saved conversations will be destroyed"}),p.jsxs(Pe,{space:10,justify:"end",children:[p.jsx(Ae,{variant:"secondary",noMinWidth:!0,onClick:t,disabled:o,children:"Cancel"}),p.jsx(Ae,{variant:"error",noMinWidth:!0,disabled:!n||o,onClick:r,children:o?"Erasing...":"Erase and start fresh"})]})]})})},yn=({className:e})=>p.jsxs("svg",{width:"152",height:"20",viewBox:"0 0 152 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:ye(e),children:[p.jsx("path",{d:"M12.459 3.6612C12.459 3.6914 12.4834 3.7158 12.5136 3.7158H14.5901C14.6203 3.7158 14.6448 3.6914 14.6448 3.6612V1.5847C14.6448 1.55452 14.6692 1.53005 14.6994 1.53005H19.1803C19.2105 1.53005 19.2349 1.55452 19.2349 1.5847V11.927C19.2349 11.9691 19.1893 11.9954 19.1529 11.9743L9.6995 6.4956C9.6631 6.4745 9.6175 6.5008 9.6175 6.5429V8.821C9.6175 8.8405 9.6278 8.8585 9.6447 8.8682L19.1534 14.379C19.1897 14.4 19.1897 14.4525 19.1534 14.4735L9.6449 19.9841C9.6279 19.9939 9.607 19.9939 9.5901 19.9841L0.0272026 14.442C0.010302
106 14.4322 0 14.4142 0 14.3947V8.9473C0 8.9052 0.0456007 8.8789 0.0820007 8.9L9.5354 14.3787C9.5718 14.3998 9.6175 14.3735 9.6175 14.3314V12.0533C9.6175 12.0339 9.6071 12.0158 9.5902 12.0061L0.0272026 6.4639C0.0103026 6.4541 0 6.4361 0 6.4166V1.5847C0 1.55452 0.0243998 1.53005 0.0545998 1.53005H4.5355C4.5657 1.53005 4.5901 1.55452 4.5901 1.5847V3.6612C4.5901 3.6914 4.6146 3.7158 4.6448 3.7158H6.7213C6.7515 3.7158 6.7759 3.6914 6.7759 3.6612V0.0546398C6.7759 0.0244698 6.8004 0 6.8306 0H12.4043C12.4345 0 12.459 0.0244698 12.459 0.0546398V3.6612Z",className:"fill-primary-hover dark:fill-foreground"}),p.jsx("path",{d:"M32.1468 16.256C29.6348 16.256 28.0988 14.704 27.9068 12.224L29.9228 12.112C30.1308 13.664 30.9468 14.464 32.2428 14.464C33.4428 14.464 34.1468 13.968 34.1468 13.056C34.1468 12.112 33.6028 11.568 31.4748 10.976C29.1708 10.368 28.1468 9.584 28.1468 7.76C28.1468 5.728 29.5868 4.384 32.0188 4.384C34.4188 4.384 35.7948 5.824 36.0028 8.128L33.9708 8.224C33.8108 6.976 33.1388 6.176 31.9388 6.176C30.8668 6.176 30.1628 6.768 30.1628 7.648C30.1628 8.56 30.7068 8.944 32.6108 9.44C35.2508 10.144 36.1628 11.184 36.1628 13.008C36.1628 14.976 34.6108 16.256 32.1468 16.256ZM42.8286 16C40.9886 16 40.1406 15.184 40.1406 13.44V8.992H37.5646V7.456H40.1406V5.456H42.0286V7.456H45.2766V8.992H42.0286V13.296C42.0286 14.08 42.3966 14.464 43.1646 14.464H45.2766V16H42.8286ZM47.6703 16V14.464H49.7823V8.992H47.6703V7.456H51.2223L51.3343 9.104C51.6063 8 52.2623 7.456 53.3823 7.456H55.2544V9.04H53.4943C52.2783 9.04 51.6703 9.712 51.6703 11.008V14.464H54.3104V16H47.6703ZM60.8164 16.192C58.4004 16.192 56.8164 14.448 56.8164 11.728C56.8164 9.008 58.4004 7.264 60.8164 7.264C63.2164 7.264 64.8164 9.008 64.8164 11.728C64.8164 14.448 63.2164 16.192 60.8164 16.192ZM60.8164 14.496C62.1124 14.496 62.8484 13.488 62.8484 11.728C62.8484 9.968 62.1124 8.96 60.8164 8.96C59.5204 8.96 58.7844 9.968 58.7844 11.728C58.7844 13.488 59.5204 14.496 60.8164 14.496ZM66.8254 16V7.456H68.5534L68.6014 8.992C69.0494 7.808 70.0414 7.264 71.2254 7.264C73.0974 7.264 73.9934 8.624 73.9934 10.48V16H72.1054V10.928C72.1054 9.552 71.6094 8.88 70.5854 8.88C69.5614 8.88 68.7134 9.616 68.7134 10.992V16H66.8254ZM79.9554 18.592C77.9394 18.592 76.6274 17.616 76.2594 16.128L78.2434 16C78.4514 16.624 78.9314 16.992 79.9554 16.992C81.2674 16.992 81.9874 16.416 81.9874 15.296V14.176C81.5714 15.008 80.7394 15.552 79.5714 15.552C77.4754 15.552 75.9714 13.872 75.9714 11.456C75.9714 8.928 77.4434 7.264 79.5234 7.264C80.6754 7.264 81.6034 7.824 82.0194 8.768L82.0514 7.456H83.8754V15.12C83.8754 17.376 82.3554 18.592 79.9554 18.592ZM79.9554 13.968C81.1554 13.968 81.9714 13.056 81.9874 11.424C82.0034 9.792 81.1714 8.864 79.9554 8.864C78.6754 8.864 77.9394 9.792 77.9394 11.424C77.9394 13.056 78.6914 13.968 79.9554 13.968ZM86.6694 16L85.0534 7.456H86.9894L87.8854 13.536L88.8774 8.672H90.3174L91.3094 13.536L92.2054 7.456H94.1414L92.5414 16H90.5734L89.5974 11.392L88.6214 16H86.6694ZM98.0074 16.192C96.4234 16.192 95.1594 15.28 95.1594 13.808C95.1594 12.368 96.1034 11.6 97.7994 11.248L100.471 10.688C100.471 9.488 99.9754 8.848 98.9194 8.848C97.9434 8.848 97.4314 9.36 97.2554 10.128L95.2874 10.016C95.6074 8.368 96.9354 7.264 98.8874 7.264C101.223 7.264 102.359 8.576 102.359 10.784V13.968C102.359 14.384 102.519 14.528 102.839 14.528H103.255V16C103.127 16.016 102.791 16.064 102.503 16.064C101.479 16.064 100.855 15.616 100.647 14.752C100.247 15.6 99.2554 16.192 98.0074 16.192ZM98.3434 14.72C99.7354 14.72 100.471 13.936 100.471 12.672V12.096L98.3434 12.544C97.4314 12.736 97.1274 13.072 97.1274 13.696C97.1274 14.336 97.5594 14.72 98.3434 14.72ZM104.816 16V14.464H108.064V7.2C108.064 6.544 107.696 6.176 107.04 6.176H105.136V4.64H107.328C109.072 4.64 109.952 5.536 109.952 7.28V14.464H112.752V16H104.816ZM114.41 16V14.464H117.658V7.2C117.658 6.544 117.29 6.176 116.634 6.176H114.73V4.64H116.922C118.666 4.64 119.546 5.536 119.546 7.28V14.464H122.346V16H114.41ZM126.804 16V13.744H129.14V16H126.804ZM136.382 16.192C134.798 16.192 133.534 15.28 133.534 13.808C133.534 12.368 134.478 11.6 136.174 11.248L138.846 10.688C138.846 9.488 138.35 8.848 137.294 8.848C136.318 8.848 135.806 9.36 135.63 10.128L133.662 10.016C133.982 8.368 135.31 7.264 137.262 7.264C139.598 7.264 140.734 8.576 140.734 10.784V13.968C140.734 14.384 140.894 14.528 141.214 14.528H141.63V16C141.502 16.016 141.166 16.064 140.878 16.064C139.854 16.064 139.23 15.616 139.022 14.752C138.622 15.6 137.63 16.192 136.382 16.192ZM136.718 14.72C138.11 14.72 138.846 13.936 138.846 12.672V12.096L136.718 12.544C135.806 12.736 135.502 13.072 135.502 13.696C135.502 14.336 135.934 14.72 136.718 14.72ZM146.695 6.32V4.528H148.615V6.32H146.695ZM143.511 16V14.464H146.775V8.992H143.671V7.456H148.663V14.464H151.447V16H143.511Z",className:"fill-primary-hover dark:fill-foreground"})]}),vn=({className:e,withTagline:t=!1})=>p.jsx(yn,{className:e}),_n=({className:e})=>p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"42",viewBox:"0 0 40 42",fill:"none",className:e,children:p.jsx("path",{d:"M25.9091 6.72727C25.9091 7.27956 26.3568 7.72727 26.9091 7.72727H29.4545C30.0068 7.72727 30.4545 7.27956 30.4545 6.72727V4.18182C30.4545 3.62953 30.9023 3.18182 31.4545 3.18182H39C39.5523 3.18182 40 3.62953 40 4.18182V23.2647C40 24.0352 39.1652 24.5162 38.4986 24.1299L21.5014 14.2792C20.8348 13.8929 20 14.3739 20 15.1444V17.8328C20 18.1895 20.19 18.5192 20.4986 18.698L38.5071 29.1348C39.1719 29.5201 39.1719 30.4799 38.5071 30.8652L20.5014 41.3003C20.1913 41.48 19.8087 41.48 19.4986 41.3003L0.498576 30.2889C0.189978 30.1101 0 29.7804 0 29.4237V20.1444C0 19.3739 0.834758 18.8929 1.50142 19.2792L18.4986 29.1299C19.1652 29.5162 20 29.0352 20 28.2647V25.5763C20 25.2196 19.81 24.8899 19.5014 24.7111L0.498576 13.698C0.189978 13.5192 0 13.1895 0 12.8328V4.18182C0 3.62953 0.447715 3.18182 1 3.18182H8.54545C9.09774 3.18182 9.54545 3.62953 9.54545 4.18182V6.72727C9.54545 7.27956 9.99317 7.72727 10.5455 7.72727H13.0909C13.6432 7.72727 14.0909 7.27956 14.0909 6.72727V0.999999C14.0909 0.447714 14.5386 0 15.0909 0H24.9091C25.4614 0 25.9091 0.447715 25.9091 1V6.72727Z",className:"fill-primary-hover dark:fill-foreground"})}),kn=({className:e})=>p.jsx(_n,{className:e}),xn=({children:e,title:t,subtitle:r,showLogo:o=!1})=>(y.useEffect(()=>(document.body.classList.add("session"),()=>{document.body.classList.remove("session")}),[]),p.jsxs("div",{className:"relative flex justify-center items-start py-10 md:py-20 box-border z-[2] md:min-
10h-screen",children:[p.jsx(ut,{to:`${Xe.siteUrl}/terms`,target:"_blank",className:"hidden md:block absolute bottom-8 left-1/2 -translate-x-1/2",children:"Privacy policy"}),p.jsxs(Q,{space:32,className:"w-full max-w-[500px] px-5 sm:px-0 relative",children:[o&&p.jsxs("div",{className:"flex flex-col items-center justify-center w-full relative",children:[p.jsx("div",{className:"absolute top-1/2 left-0 w-full h-px",style:{background:"radial-gradient(50% 50% at 50% 50%, rgba(0, 0, 0, 0.12) 0%, rgba(60, 60, 60, 0.12) 50%, rgba(250, 250, 250, 0.12) 100%)"}}),p.jsx(ut,{to:"/",children:p.jsx(Q,{alignItems:"center",justify:"center",className:"bg-surface border rounded-sm pt-5 pb-4 w-20 relative z-[2]",children:p.jsx(kn,{})})})]}),p.jsxs(Q,{space:14,children:[p.jsx(te,{size:"xxl",weight:600,centered:!0,children:t}),p.jsx(te,{theme:"muted",centered:!0,children:r})]}),e,p.jsx(ut,{to:`${Xe.siteUrl}/terms`,target:"_blank",className:"md:hidden text-center",children:"Privacy policy"})]})]})),Oe=typeof window<"u"&&typeof document<"u",Sn=15,zn=3e4,Cn=1e4,In=1e3,_t="appLockLastActivity",Qe="appLockLocked",pt=()=>{const e=localStorage.getItem("appLockMinutes");if(e===null)return null;if(e==="leave")return{kind:"leave"};const t=Number(e);return Number.isFinite(t)?t>0?{kind:"idle",minutes:t}:{kind:"off"}:null},Sr=()=>{const e=sessionStorage.getItem(_t);if(e===null)return null;const t=Number(e);return Number.isFinite(t)?t:null},Ee=e=>sessionStorage.setItem(_t,String(e)),ht=()=>sessionStorage.getItem(Qe)==="1",lt=e=>{e?sessionStorage.setItem(Qe,"1"):sessionStorage.removeItem(Qe)},Vt=()=>{Oe&&(sessionStorage.removeItem(_t),sessionStorage.removeItem(Qe))},jn=(e,t,r)=>e?.kind==="idle"&&r-t>=e.minutes*6e4,$n=()=>{if(!Oe)return!1;if(ht())return!0;const e=Sr();return e!==null&&jn(pt(),e,Date.now())},En=()=>{const{isAuthenticated:e,user:t,userIdentifier:r,storageService:o,logout:n}=Gc(),[i,s]=y.useState($n),[a,c]=y.useState(!1),[l,d]=y.useState(""),[v,g]=y.useState(""),[_,x]=y.useState(!1),C=y.useRef(Date.now()),j=y.useRef(!1),K=y.useRef(!1),J=y.useRef(!1),A=y.useRef(null);j.current=i,K.current=a;const Z=y.useCallback(()=>{lt(!0),o.lock(),!j.current&&(d(""),g(""),s(!0))},[o]),V=y.useCallback(()=>{j.current||(lt(!0),d(""),g(""),ir.flushSync(()=>s(!0)),A.current!==null&&window.clearTimeout(A.current),A.current=window.setTimeout(()=>{A.current=null,ht()&&o.lock()},In))},[o]);if(y.useEffect(()=>{if(!e){J.current&&s(!1);return}J.current=!0;let I=0;const ae=()=>Ee(C.current),ce=()=>{if(j.current)return;const $=Date.now();C.current=$,$-I>=Cn&&(I=$,Ee($))},ee=()=>{if(j.current||K.current)return;const $=Date.now()-C.current,q=pt();if(q?.kind==="idle"){$>=q.minutes*6e4&&Z();return}q===null&&localStorage.getItem("appLockPromptSeen")!=="true"&&$>=Sn*6e4&&c(!0)},fe=()=>{if(document.visibilityState==="hidden"){ae(),pt()?.kind==="leave"&&V();return}ee()};if(j.current||ht())Z();else{const $=Sr();$===null?Ee(C.current):C.current=$,ee()}const oe=["pointerdown","pointermove","keydown","wheel","touchstart"];oe.forEach($=>window.addEventListener($,ce,{passive:!0})),document.addEventListener("visibilitychange",fe),window.addEventListener("pagehide",ae),window.addEventListener("app-lock-now",Z);const X=setInterval(ee,zn);return()=>{oe.forEach($=>window.removeEventListener($,ce)),document.removeEventListener("visibilitychange",fe),window.removeEventListener("pagehide",ae),window.removeEventListener("app-lock-now",Z),clearInterval(X),A.current!==null&&(window.clearTimeout(A.current),A.current=null)}},[e,Z,V]),!e)return null;const H=t?.account_type==="account_number",B=I=>{localStorage.setItem("appLockPromptSeen","true"),localStorage.setItem("appLockMinutes",I?"15":"0"),window.dispatchEvent(new Event("privacy-settings-changed")),C.current=Date.now(),Ee(C.current),c(!1)},b=async()=>{if(r){if(g(""),H&&l!==r){g("That's not the right account number.");return}x(!0);try{await o.initializeUser(r,l),lt(!1),C.current=Date.now(),Ee(C.current),d(""),s(!1)}catch(I){I instanceof vt?g("That's not the right password."):I instanceof Ye?g(I.message):g("Something went wrong unlocking. Try again.")}finally{x(!1)}}};return i?p.jsx("div",{className:"fixed inset-0 z-[1200] overflow-y-auto bg-background",children:p.jsxs(xn,{title:"Locked",subtitle:`You were away, so we locked things up. ${H?"Enter your account number to unlock.":"Enter your password to unlock."}`,showLogo:!0,children:[p.jsxs(Q,{space:16,children:[v&&p.jsx(fn,{message:v,slim:!0}),p.jsx(Mo,{children:p.jsxs(Q,{space:20,children:[p.jsx(gn,{label:H?"Account number":"Password",htmlFor:"unlock-credential",children:p.jsx(xr,{id:"unlock-credential",autoFocus:!0,autoComplete:"off",placeholder:H?"Account number":"Password",value:l,onCh
10ange:I=>d(I.target.value),onKeyDown:I=>{I.key==="Enter"&&b()},showEyeButton:!0})}),p.jsx(Ae,{type:"submit",disabled:!l||_,size:"lg",onClick:()=>{b()},children:_?"Unlocking...":"Unlock"})]})})]}),p.jsxs(Pe,{space:4,justify:"center",children:[p.jsx(te,{theme:"muted",size:"sm",children:"Everything stays encrypted on this device."}),p.jsx("button",{className:"text-sm text-muted-foreground underline decoration-dotted hover:text-foreground cursor-pointer",onClick:n,children:"Log out"})]})]})}):a?p.jsx("div",{className:"fixed inset-0 z-[1200] flex items-center justify-center bg-background/95 backdrop-blur-md",children:p.jsxs(Q,{space:24,alignItems:"center",className:"w-full max-w-md px-6",children:[p.jsx(vn,{className:"h-8"}),p.jsxs(Q,{space:8,alignItems:"center",children:[p.jsx(te,{size:"xl",weight:600,centered:!0,children:"You stepped away for a bit"}),p.jsxs(te,{theme:"muted",centered:!0,children:["If you'd like, ",Xe.productName," can lock itself whenever you're away, so no one at your screen can read anything. This time it's just asking — nothing is locked."]})]}),p.jsxs(Pe,{space:10,children:[p.jsx(Ae,{variant:"secondary",noMinWidth:!0,onClick:()=>B(!1),children:"No thanks"}),p.jsx(Ae,{variant:"secondary",noMinWidth:!0,onClick:()=>B(!0),children:"Lock when I'm away"})]}),p.jsx(te,{size:"sm",theme:"muted",children:"You can change this anytime in Settings → Privacy."})]})}):null},Mt=new Map;function An(e){e?.startsWith("blob:")&&URL.revokeObjectURL(e)}function Zn(){for(const e of Mt.values())An(e);Mt.clear()}function u(e,t,r){function o(a,c){var l;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(l=a._zod).traits??(l.traits=new Set),a._zod.traits.add(e),t(a,c);for(const d in s.prototype)d in a||Object.defineProperty(a,d,{value:s.prototype[d].bind(a)});a._zod.constr=s,a._zod.def=c}const n=r?.Parent??Object;class i extends n{}Object.defineProperty(i,"name",{value:e});function s(a){var c;const l=r?.Parent?new i:this;o(l,a),(c=l._zod).deferred??(c.deferred=[]);for(const d of l._zod.deferred)d();return l}return Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class Se extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class zr extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Cr={};function de(e){return Cr}function Pn(e){const t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function mt(e,t){return typeof t=="bigint"?t.toString():t}function rt(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function kt(e){return e==null}function xt(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const Kt=Symbol("evaluating");function E(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==Kt)return o===void 0&&(o=Kt,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function ve(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function _e(...e){const t={};for(const r of e){const o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function Ft(e){return JSON.stringify(e)}const Ir="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Te(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Tn=rt(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function ze(e){if(Te(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(Te(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function jr(e){return ze(e)?{...e}:Array.isArray(e)?[...e]:e}const Un=new Set(["string","number","symbol"]);function Ce(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function me(e,t,r){const o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function w(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Nn(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}
vendor: 5,363 bytes, line 10
10function Rn(e,t){const r=e._zod.def,o=_e(e._zod.def,{get shape(){const n={};for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(n[i]=r.shape[i])}return ve(this,"shape",n),n},checks:[]});return me(e,o)}function On(e,t){const r=e._zod.def,o=_e(e._zod.def,{get shape(){const n={...e._zod.def.shape};for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&delete n[i]}return ve(this,"shape",n),n},checks:[]});return me(e,o)}function Ln(e,t){if(!ze(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const n=_e(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return ve(this,"shape",i),i},checks:[]});return me(e,n)}function Dn(e,t){if(!ze(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r={...e._zod.def,get shape(){const o={...e._zod.def.shape,...t};return ve(this,"shape",o),o},checks:e._zod.def.checks};return me(e,r)}function Vn(e,t){const r=_e(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t._zod.def.shape};return ve(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:[]});return me(e,r)}function Mn(e,t,r){const o=_e(t._zod.def,{get shape(){const n=t._zod.def.shape,i={...n};if(r)for(const s in r){if(!(s in n))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=e?new e({type:"optional",innerType:n[s]}):n[s])}else for(const s in n)i[s]=e?new e({type:"optional",innerType:n[s]}):n[s];return ve(this,"shape",i),i},checks:[]});return me(t,o)}function Kn(e,t,r){const o=_e(t._zod.def,{get shape(){const n=t._zod.def.shape,i={...n};if(r)for(const s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=new e({type:"nonoptional",innerType:n[s]}))}else for(const s in n)i[s]=new e({type:"nonoptional",innerType:n[s]});return ve(this,"shape",i),i},checks:[]});return me(t,o)}function ke(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function xe(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function We(e){return typeof e=="string"?e:e?.message}function pe(e,t,r){const o={...e,path:e.path??[]};if(!e.message){const n=We(e.inst?._zod.def?.error?.(e))??We(t?.error?.(e))??We(r.customError?.(e))??We(r.localeError?.(e))??"Invalid input";o.message=n}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}function St(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ue(...e){const[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}const $r=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,mt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Er=u("$ZodError",$r),Ar=u("$ZodError",$r,{Parent:Error});function Fn(e,t=r=>r.message){const r={},o=[];for(const n of e.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n))):o.push(t(n));return{formErrors:o,fieldErrors:r}}function Bn(e,t=r=>r.message){const r={_errors:[]},o=n=>{for(const i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>o({issues:s}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let s=r,a=0;for(;a<i.path.length;){const c=i.path[a];a===i.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(i))):s[c]=s[c]||{_errors:[]},s=s[c],a++}}};return o(e),r}const zt=e=>(t,r,o,n)=>{const i=o?Object.assign(o,{async:!1}):{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new Se;if(s.issues.length){const a=new(n?.Err??e)(s.issues.map(c=>pe(c,i,de())));throw Ir(a,n?.callee),a}return s.value},Ct=e=>async(t,r,o,n)=>{const i=o?Object.assign(o,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const a=new(n?.Err??e)(s.issues.map(c=>pe(c,i,de())));throw Ir(a,n?.callee),a}return s.value},ot=e=>(t,r,o)=>{const n=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)throw new Se;return i.issues.length?{success:!1,error:new(e??Er)(i.issues.map(s=>pe(s,n,de())))}:{success:!0,data:i.value}},Wn=ot(Ar),nt=e=>async(t,r,o)=>{const n=o?Object.assign(o,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},n);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>pe(s,n,de())))}:{success:!0,data:i.value}},Hn=nt(Ar),Gn=e=>(t,r,o)=>{const n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return zt(e)(t,r,n)},qn=e=>(t,r,o)=>zt(e)(t,r,o),Yn=e=>async(t,r,o)=>{const n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Ct(e)(t,r,n)},Jn=e=>async(t,r,o)=>Ct(e)(t,r,o),Xn=e=>(t,r,o)=>{const n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return ot(e)(t,r,n)},Qn=e=>(t,r,o)=>ot(e)(t,r,o),es=e=>async(t,r,o)=>{const n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return nt(e)(t,r,n)},ts=e=>async(t,r,o)=>nt(e)(t,r,o),rs=/^[cC][^\s-]{8,}
vendor: 5,353 bytes, line 10
10$/,os=/^[0-9a-z]+$/,ns=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ss=/^[0-9a-vA-V]{20}$/,is=/^[A-Za-z0-9]{27}$/,as=/^[a-zA-Z0-9_-]{21}$/,cs=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ls=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Bt=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,us=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ds="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function ps(){return new RegExp(ds,"u")}const hs=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ms=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,fs=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,gs=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,bs=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Zr=/^[A-Za-z0-9_-]*$/,ws=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,ys=/^\+(?:[0-9]){6,14}[0-9]$/,Pr="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",vs=new RegExp(`^${Pr}$`);function Tr(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function _s(e){return new RegExp(`^${Tr(e)}$`)}function ks(e){const t=Tr({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const o=`${t}(?:${r.join("|")})`;return new RegExp(`^${Pr}T(?:${o})$`)}const xs=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Ss=/^(?:true|false)$/i,zs=/^[^A-Z]*$/,Cs=/^[^a-z]*$/,re=u("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Is=u("$ZodCheckMaxLength",(e,t)=>{var r;re.init(e,t),(r=e._zod.def).when??(r.when=o=>{const n=o.value;return!kt(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{const n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{const n=o.value;if(n.length<=t.maximum)return;const s=St(n);o.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),js=u("$ZodCheckMinLength",(e,t)=>{var r;re.init(e,t),(r=e._zod.def).when??(r.when=o=>{const n=o.value;return!kt(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{const n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{const n=o.value;if(n.length>=t.minimum)return;const s=St(n);o.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),$s=u("$ZodCheckLengthEquals",(e,t)=>{var r;re.init(e,t),(r=e._zod.def).when??(r.when=o=>{const n=o.value;return!kt(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{const n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=o=>{const n=o.value,i=n.length;if(i===t.length)return;const s=St(n),a=i>t.length;o.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),st=u("$ZodCheckStringFormat",(e,t)=>{var r,o;re.init(e,t),e._zod.onattach.push(n=>{const i=n._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),Es=u("$ZodCheckRegex",(e,t)=>{st.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),As=u("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=zs),st.init(e,t)}),Zs=u("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Cs),st.init(e,t)}),Ps=u("$ZodCheckIncludes",(e,t)=>{re.init(e,t);const r=Ce(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push(n=>{const i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(o)}),e._zod.check=n=>
vendor: 14,522 bytes, lines 10-29
10{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Ts=u("$ZodCheckStartsWith",(e,t)=>{re.init(e,t);const r=new RegExp(`^${Ce(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{const n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Us=u("$ZodCheckEndsWith",(e,t)=>{re.init(e,t);const r=new RegExp(`.*${Ce(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{const n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}}),Ns=u("$ZodCheckOverwrite",(e,t)=>{re.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class Rs{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const o=t.split(`
11`).filter(s=>s),n=Math.min(...o.map(s=>s.length-s.trimStart().length)),i=o.map(s=>s.slice(n)).map(s=>" ".repeat(this.indent*2)+s);for(const s of i)this.content.push(s)}compile(){const t=Function,r=this?.args,n=[...(this?.content??[""]).map(i=>`  ${i}`)];return new t(...r,n.join(`
12`))}}const Os={major:4,minor:1,patch:12},T=u("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Os;const o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(const n of o)for(const i of n._zod.onattach)i(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const n=(s,a,c)=>{let l=ke(s),d;for(const v of a){if(v._zod.def.when){if(!v._zod.def.when(s))continue}else if(l)continue;const g=s.issues.length,_=v._zod.check(s);if(_ instanceof Promise&&c?.async===!1)throw new Se;if(d||_ instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await _,s.issues.length!==g&&(l||(l=ke(s,g)))});else{if(s.issues.length===g)continue;l||(l=ke(s,g))}}return d?d.then(()=>s):s},i=(s,a,c)=>{if(ke(s))return s.aborted=!0,s;const l=n(a,o,c);if(l instanceof Promise){if(c.async===!1)throw new Se;return l.then(d=>e._zod.parse(d,c))}return e._zod.parse(l,c)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction==="backward"){const l=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(d=>i(d,s,a)):i(l,s,a)}const c=e._zod.parse(s,a);if(c instanceof Promise){if(a.async===!1)throw new Se;return c.then(l=>n(l,o,a))}return n(c,o,a)}}e["~standard"]={validate:n=>{try{const i=Wn(e,n);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Hn(e,n).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),It=u("$ZodString",(e,t)=>{T.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??xs(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),P=u("$ZodStringFormat",(e,t)=>{st.init(e,t),It.init(e,t)}),Ls=u("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ls),P.init(e,t)}),Ds=u("$ZodUUID",(e,t)=>{if(t.version){const o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Bt(o))}else t.pattern??(t.pattern=Bt());P.init(e,t)}),Vs=u("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=us),P.init(e,t)}),Ms=u("$ZodURL",(e,t)=>{P.init(e,t),e._zod.check=r=>{try{const o=r.value.trim(),n=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:ws.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=n.href:r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Ks=u("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ps()),P.init(e,t)}),Fs=u("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=as),P.init(e,t)}),Bs=u("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=rs),P.init(e,t)}),Ws=u("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=os),P.init(e,t)}),Hs=u("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ns),P.init(e,t)}),Gs=u("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ss),P.init(e,t)}),qs=u("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=is),P.init(e,t)}),Ys=u("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=ks(t)),P.init(e,t)}),Js=u("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=vs),P.init(e,t)}),Xs=u("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=_s(t)),P.init(e,t)}),Qs=u("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=cs),P.init(e,t)}),ei=u("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=hs),P.init(e,t),e._zod.onattach.push(r=>{const o=r._zod.bag;o.format="ipv4"})}),ti=u("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ms),P.init(e,t),e._zod.onattach.push(r=>{const o=r._zod.bag;o.format="ipv6"}),e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),ri=u("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=fs),P.init(e,t)}),oi=u("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=gs),P.init(e,t),e._zod.check=r=>{const o=r.value.split("/");try{if(o.length!==2)throw new Error;const[n,i]=o;if(!i)throw new Error;const s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Ur(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const ni=u("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=bs),P.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),e._zod.check=r=>{Ur(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function si(e){if(!Zr.test(e))return!1;const t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ur(r)}const ii=u("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Zr),P.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),e._zod.check=r=>{si(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ai=u("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ys),P.init(e,t)});function ci(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[o]=r;if(!o)return!1;const n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}const li=u("$ZodJWT",(e,t)=>{P.init(e,t),e._zod.check=r=>{ci(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),ui=u("$ZodBoolean",(e,t)=>{T.init(e,t),e._zod.pattern=Ss,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}const n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),di=u("$ZodAny",(e,t)=>{T.init(e,t),e._zod.parse=r=>r}),pi=u("$ZodUnknown",(e,t)=>{T.init(e,t),e._zod.parse=r=>r}),hi=u("$ZodNever",(e,t)=>{T.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Wt(e,t,r){e.issues.length&&t.issues.push(...xe(r,e.issues)),t.value[r]=e.value}const mi=u("$ZodArray",(e,t)=>{T.init(e,t),e._zod.parse=(r,o)=>{const n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);const i=[];for(let s=0;s<n.length;s++){const a=n[s],c=t.element._zod.run({value:a,issues:[]},o);c instanceof Promise?i.push(c.then(l=>Wt(l,r,s))):Wt(c,r,s)}return i.length?Promise.all(i).then(()=>r):r}});function et(e,t,r,o){e.issues.length&&t.issues.push(...xe(r,e.issues)),e.value===void 0?r in o&&(t.value[r]=void 0):t.value[r]=e.value}function Nr(e){const t=Object.keys(e.shape);for(const o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);const r=Nn(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Rr(e,t,r,o,n,i){const s=[],a=n.keySet,c=n.catchall._zod,l=c.def.type;for(const d of Object.keys(t)){if(a.has(d))continue;if(l==="never"){s.push(d);continue}const v=c.run({value:t[d],issues:[]},o);v instanceof Promise?e.push(v.then(g=>et(g,r,d,t))):et(v,r,d,t)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}const fi=u("$ZodObject",(e,t)=>{if(T.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}const o=rt(()=>Nr(t));E(e._zod,"propValues",()=>{const a=t.shape,c={};for(const l in a){const d=a[l]._zod;if(d.values){c[l]??(c[l]=new Set);for(const v of d.values)c[l].add(v)}}return c});const n=Te,i=t.catchall;let s;e._zod.parse=(a,c)=>{s??(s=o.value);const l=a.value;if(!n(l))return a.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),a;a.value={};const d=[],v=s.shape;for(const g of s.keys){const x=v[g]._zod.run({value:l[g],issues:[]},c);x instanceof Promise?d.push(x.then(C=>et(C,a,g,l))):et(x,a,g,l)}return i?Rr(d,l,a,c,o.value,e):d.length?Promise.all(d).then(()=>a):a}}),gi=u("$ZodObjectJIT",(e,t)=>{fi.init(e,t);const r=e._zod.parse,o=rt(()=>Nr(t)),n=g=>{const _=new Rs(["shape","payload","ctx"]),x=o.value,C=A=>{const Z=Ft(A);return`shape[${Z}]._zod.run({ value: input[${Z}], issues: [] }, ctx)`};_.write("const input = payload.value;");const j=Object.create(null);let K=0;for(const A of x.keys)j[A]=`key_${K++}`;_.write("const newResult = {};");for(const A of x.keys){const Z=j[A],V=Ft(A);_.write(`const ${Z} = ${C(A)};`),_.write(`
13        if (${Z}.issues.length) {
14          payload.issues = payload.issues.concat(${Z}.issues.map(iss => ({
15            ...iss,
16            path: iss.path ? [${V}, ...iss.path] : [${V}]
17          })));
18        }
19        
20        
21        if (${Z}.value === undefined) {
22          if (${V} in input) {
23            newResult[${V}] = undefined;
24          }
25        } else {
26          newResult[${V}] = ${Z}.value;
27        }
28        
29      `)}_.write("payload.value = newResult;"),_.write("return payload;");const J=_.compile();return(A,Z)=>J(g,A,Z)};let i;const s=Te,a=!Cr.jitless,l=a&&Tn.value,d=t.catchall;let v;e._zod.parse=(g,_)=>{v??(v=o.value);const x=g.value;return s(x)?a&&l&&_?.async===!1&&_.jitless!==!0?(i||(i=n(t.shape)),g=i(g,_),d?Rr([],x,g,_,v,e):g):r(g,_):(g.issues.push({expected:"object",code:"invalid_type",input:x,inst:e}),g)}});function Ht(e,t,r,o){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const n=e.filter(i=>!ke(i));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(s=>pe(s,o,de())))}),t)}const Or=u("$ZodUnion",(e,t)=>{T.init(e,t),E(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),E(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),E(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),E(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){const n=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${n.map(i=>xt(i.source)).join("|")})$`)}});const r=t.options.length===1,o=t.options[0]._zod.run;e._zod.parse=(n,i)=>{if(r)return o(n,i);let s=!1;const a=[];for(const c of t.options){const l=c._zod.run({value:n.value,issues:[]},i);if(l instanceof Promise)a.push(l),s=!0;else{if(l.issues.length===0)return l;a.push(l)}}return s?Promise.all(a).then(c=>Ht(c,n,e,i)):Ht(a,n,e,i)}}),bi=u("$ZodDiscriminatedUnion",(e,t)=>{Or.init(e,t);const r=e._zod.parse;E(e._zod,"propValues",()=>{const n={};for(const i of t.options){const s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const[a,c]of Object.entries(s)){n[a]||(n[a]=new Set);for(const l of c)n[a].add(l)}}return n});const o=rt(()=>{const n=t.options,i=new Map;for(const s of n){const a=s._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const c of a){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,s)}}return i});e._zod.parse=(n,i)=>{const s=n.value;if(!Te(s))return n.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),n;const a=o.value.get(s?.[t.discriminator]);return a?a._zod.run(n,i):t.unionFallback?r(n,i):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:s,path:[t.discriminator],inst:e}),n)}}),wi=u("$ZodIntersection",(e,t)=>{T.init(e,t),e._zod.parse=(r,o)=>{const n=r.value,i=t.left._zod.run({value:n,issues:[]},o),s=t.right._zod.run({value:n,issues:[]},o);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,l])=>Gt(r,c,l)):Gt(r,i,s)}});function ft(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ze(e)&&ze(t)){const r=Object.keys(t),o=Object.keys(e).filter(i=>r.indexOf(i)!==-1),n={...e,...t};for(const i of o){const s=ft(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};n[i]=s.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let o=0;o<e.length;o++){const n=e[o],i=t[o],s=ft(n,i);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Gt(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),ke(e))return e;const o=ft(t.value,r.value);
vendor: 10,643 bytes, line 29
29if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const yi=u("$ZodRecord",(e,t)=>{T.init(e,t),e._zod.parse=(r,o)=>{const n=r.value;if(!ze(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;const i=[];if(t.keyType._zod.values){const s=t.keyType._zod.values;r.value={};for(const c of s)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){const l=t.valueType._zod.run({value:n[c],issues:[]},o);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...xe(c,d.issues)),r.value[c]=d.value})):(l.issues.length&&r.issues.push(...xe(c,l.issues)),r.value[c]=l.value)}let a;for(const c in n)s.has(c)||(a=a??[],a.push(c));a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:a})}else{r.value={};for(const s of Reflect.ownKeys(n)){if(s==="__proto__")continue;const a=t.keyType._zod.run({value:s,issues:[]},o);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(l=>pe(l,o,de())),input:s,path:[s],inst:e}),r.value[a.value]=a.value;continue}const c=t.valueType._zod.run({value:n[s],issues:[]},o);c instanceof Promise?i.push(c.then(l=>{l.issues.length&&r.issues.push(...xe(s,l.issues)),r.value[a.value]=l.value})):(c.issues.length&&r.issues.push(...xe(s,c.issues)),r.value[a.value]=c.value)}}return i.length?Promise.all(i).then(()=>r):r}}),vi=u("$ZodEnum",(e,t)=>{T.init(e,t);const r=Pn(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter(n=>Un.has(typeof n)).map(n=>typeof n=="string"?Ce(n):n.toString()).join("|")})$`),e._zod.parse=(n,i)=>{const s=n.value;return o.has(s)||n.issues.push({code:"invalid_value",values:r,input:s,inst:e}),n}}),_i=u("$ZodLiteral",(e,t)=>{if(T.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Ce(r):r?Ce(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const n=r.value;return e._zod.values.has(n)||r.issues.push({code:"invalid_value",values:t.values,input:n,inst:e}),r}}),ki=u("$ZodTransform",(e,t)=>{T.init(e,t),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new zr(e.constructor.name);const n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(s=>(r.value=s,r));if(n instanceof Promise)throw new Se;return r.value=n,r}});function qt(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const xi=u("$ZodOptional",(e,t)=>{T.init(e,t),e._zod.optin="optional",e._zod.optout="optional",E(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),E(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${xt(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){const n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>qt(i,r.value)):qt(n,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,o)}}),Si=u("$ZodNullable",(e,t)=>{T.init(e,t),E(e._zod,"optin",()=>t.innerType._zod.optin),E(e._zod,"optout",()=>t.innerType._zod.optout),E(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${xt(r.source)}|null)$`):void 0}),E(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>r.value===null?r:t.innerType._zod.run(r,o)}),zi=u("$ZodDefault",(e,t)=>{T.init(e,t),e._zod.optin="optional",E(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;const n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>Yt(i,t)):Yt(n,t)}});function Yt(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Ci=u("$ZodPrefault",(e,t)=>{T.init(e,t),e._zod.optin="optional",E(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,o))}),Ii=u("$ZodNonOptional",(e,t)=>{T.init(e,t),E(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{const n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>Jt(i,e)):Jt(n,e)}});function Jt(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const ji=u("$ZodCatch",(e,t)=>{T.init(e,t),E(e._zod,"optin",()=>t.innerType._zod.optin),E(e._zod,"optout",()=>t.innerType._zod.optout),E(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);const n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(s=>pe(s,o,de()))},input:r.value}),r.issues=[]),r)):(r.value=n.value,n.issues.length&&(r.value=t.catchValue({...r,error:{issues:n.issues.map(i=>pe(i,o,de()))},input:r.value}),r.issues=[]),r)}}),$i=u("$ZodPipe",(e,t)=>{T.init(e,t),E(e._zod,"values",()=>t.in._zod.values),E(e._zod,"optin",()=>t.in._zod.optin),E(e._zod,"optout",()=>t.out._zod.optout),E(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){const i=t.out._zod.run(r,o);return i instanceof Promise?i.then(s=>He(s,t.in,o)):He(i,t.in,o)}const n=t.in._zod.run(r,o);return n instanceof Promise?n.then(i=>He(i,t.out,o)):He(n,t.out,o)}});function He(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const Ei=u("$ZodReadonly",(e,t)=>{T.init(e,t),E(e._zod,"propValues",()=>t.innerType._zod.propValues),E(e._zod,"values",()=>t.innerType._zod.values),E(e._zod,"optin",()=>t.innerType._zod.optin),E(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);const n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(Xt):Xt(n)}});function Xt(e){return e.value=Object.freeze(e.value),e}const Ai=u("$ZodCustom",(e,t)=>{re.init(e,t),T.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{const o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then(i=>Qt(i,r,o,e));Qt(n,r,o,e)}});function Qt(e,t,r,o){if(!e){const n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),t.issues.push(Ue(n))}}class Zi{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const o=r[0];if(this._map.set(t,o),o&&typeof o=="object"&&"id"in o){if(this._idmap.has(o.id))throw new Error(`ID ${o.id} already exists in the registry`);this._idmap.set(o.id,t)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const o={...this.get(r)??{}};delete o.id;const n={...o,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Pi(){return new Zi}const Ge=Pi();function Ti(e,t){return new e({type:"string",...w(t)})}function Ui(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...w(t)})}function er(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...w(t)})}function Ni(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...w(t)})}function Ri(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...w(t)})}function Oi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...w(t)})}function Li(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...w(t)})}function Di(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...w(t)})}function Vi(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...w(t)})}function Mi(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...w(t)})}function Ki(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...w(t)})}function Fi(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...w(t)})}function Bi(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...w(t)})}function Wi(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...w(t)})}function Hi(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...w(t)})}function Gi(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...w(t)})}function qi(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...w(t)})}function Yi(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...w(t)})}function Ji(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...w(t)})}function Xi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...w(t)})}function Qi(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...w(t)})}function ea(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...w(t)})}function ta(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...w(t)})}function ra(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...w(t)})}function oa(e,t){return new e({type:"string",format:"date",check:"string_format",...w(t)})}function na(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...w(t)})}function sa(e,t){return new e({type:"string",format:"duration",check:"string_format",...w(t)})}function ia(e,t){return new e({type:"boolean",...w(t)})}function aa(e){return new e({type:"any"})}function ca(e){return new e({type:"unknown"})}function la(e,t){return new e({type:"never",...w(t)})}function Lr(e,t){return new Is({check:"max_length",...w(t),maximum:e})}function tt(e,t){return new js({check:"min_length",...w(t),minimum:e})}function Dr(e,t){return new $s({check:"length_equals",...w(t),length:e})}function ua(e,t){return new Es({check:"string_format",format:"regex",...w(t),pattern:e})}function da(e){return new As({check:"string_format",format:"lowercase",...w(e)})}
vendor: 5,393 bytes, line 29
29function pa(e){return new Zs({check:"string_format",format:"uppercase",...w(e)})}function ha(e,t){return new Ps({check:"string_format",format:"includes",...w(t),includes:e})}function ma(e,t){return new Ts({check:"string_format",format:"starts_with",...w(t),prefix:e})}function fa(e,t){return new Us({check:"string_format",format:"ends_with",...w(t),suffix:e})}function Le(e){return new Ns({check:"overwrite",tx:e})}function ga(e){return Le(t=>t.normalize(e))}function ba(){return Le(e=>e.trim())}function wa(){return Le(e=>e.toLowerCase())}function ya(){return Le(e=>e.toUpperCase())}function va(e,t,r){return new e({type:"array",element:t,...w(r)})}function _a(e,t,r){return new e({type:"custom",check:"custom",fn:t,...w(r)})}function ka(e){const t=xa(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(Ue(o,r.value,t._zod.def));else{const n=o;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(Ue(n))}},e(r.value,r)));return t}function xa(e,t){const r=new re({check:"custom",...w(t)});return r._zod.check=e,r}const Sa=u("ZodISODateTime",(e,t)=>{Ys.init(e,t),U.init(e,t)});function za(e){return ra(Sa,e)}const Ca=u("ZodISODate",(e,t)=>{Js.init(e,t),U.init(e,t)});function Ia(e){return oa(Ca,e)}const ja=u("ZodISOTime",(e,t)=>{Xs.init(e,t),U.init(e,t)});function $a(e){return na(ja,e)}const Ea=u("ZodISODuration",(e,t)=>{Qs.init(e,t),U.init(e,t)});function Aa(e){return sa(Ea,e)}const Za=(e,t)=>{Er.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Bn(e,r)},flatten:{value:r=>Fn(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,mt,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,mt,2)}},isEmpty:{get(){return e.issues.length===0}}})},Y=u("ZodError",Za,{Parent:Error}),Pa=zt(Y),Ta=Ct(Y),Ua=ot(Y),Na=nt(Y),Ra=Gn(Y),Oa=qn(Y),La=Yn(Y),Da=Jn(Y),Va=Xn(Y),Ma=Qn(Y),Ka=es(Y),Fa=ts(Y),N=u("ZodType",(e,t)=>(T.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(_e(t,{checks:[...t.checks??[],...r.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]})),e.clone=(r,o)=>me(e,r,o),e.brand=()=>e,e.register=((r,o)=>(r.add(e,o),e)),e.parse=(r,o)=>Pa(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>Ua(e,r,o),e.parseAsync=async(r,o)=>Ta(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>Na(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>Ra(e,r,o),e.decode=(r,o)=>Oa(e,r,o),e.encodeAsync=async(r,o)=>La(e,r,o),e.decodeAsync=async(r,o)=>Da(e,r,o),e.safeEncode=(r,o)=>Va(e,r,o),e.safeDecode=(r,o)=>Ma(e,r,o),e.safeEncodeAsync=async(r,o)=>Ka(e,r,o),e.safeDecodeAsync=async(r,o)=>Fa(e,r,o),e.refine=(r,o)=>e.check(Oc(r,o)),e.superRefine=r=>e.check(Lc(r)),e.overwrite=r=>e.check(Le(r)),e.optional=()=>or(e),e.nullable=()=>nr(e),e.nullish=()=>or(nr(e)),e.nonoptional=r=>Ac(e,r),e.array=()=>Ne(e),e.or=r=>Kr([e,r]),e.and=r=>vc(e,r),e.transform=r=>sr(e,zc(r)),e.default=r=>jc(e,r),e.prefault=r=>Ec(e,r),e.catch=r=>Pc(e,r),e.pipe=r=>sr(e,r),e.readonly=()=>Nc(e),e.describe=r=>{const o=e.clone();return Ge.add(o,{description:r}),o},Object.defineProperty(e,"description",{get(){return Ge.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ge.get(e);const o=e.clone();return Ge.add(o,r[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Vr=u("_ZodString",(e,t)=>{It.init(e,t),N.init(e,t);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...o)=>e.check(ua(...o)),e.includes=(...o)=>e.check(ha(...o)),e.startsWith=(...o)=>e.check(ma(...o)),e.endsWith=(...o)=>e.check(fa(...o)),e.min=(...o)=>e.check(tt(...o)),e.max=(...o)=>e.check(Lr(...o)),e.length=(...o)=>e.check(Dr(...o)),e.nonempty=(...o)=>e.check(tt(1,...o)),e.lowercase=o=>e.check(da(o)),e.uppercase=o=>e.check(pa(o)),e.trim=()=>e.check(ba()),e.normalize=(...o)=>e.check(ga(...o)),e.toLowerCase=()=>e.check(wa()),e.toUpperCase=()=>e.check(ya())}),Ba=u("ZodString",(e,t)=>{It.init(e,t),Vr.init(e,t),e.email=r=>e.check(Ui(Wa,r)),e.url=r=>e.check(Di(Ha,r)),e.jwt=r=>e.check(ta(cc,r)),e.emoji=r=>e.check(Vi(Ga,r)),e.guid=r=>e.check(er(tr,r)),e.uuid=r=>e.check(Ni(qe,r)),e.uuidv4=r=>e.check(Ri(qe,r)),e.uuidv6=r=>e.check(Oi(qe,r)),e.uuidv7=r=>e.check(Li(qe,r)),e.nanoid=r=>e.check(Mi(qa,r)),e.guid=r=>e.check(er(tr,r)),e.cuid=r=>e.check(Ki(Ya,r)),e.cuid2=r=>e.check(Fi(Ja,r)),e.ulid=r=>e.check(Bi(Xa,r)),e.base64=r=>e.check(Xi(sc,r)),e.base64url=r=>e.check(Qi(ic,r)),e.xid=r=>e.check(Wi(Qa,r)),e.ksuid=r=>e.check(Hi(ec,r)),e.ipv4=r=>e.check(Gi(tc,r)),e.ipv6=r=>e.check(qi(rc,r)),e.cidrv4=r=>e.check(Yi(oc,r)),e.cidrv6=r=>e.check(Ji(nc,r)),e.e164=r=>e.check(ea(ac,r)),e.datetime=r=>e.check(za(r)),e.date=r=>e.check(Ia(r)),e.time=r=>e.check($a(r)),e.duration=r=>e.check(Aa(r))});function S(e){return Ti(Ba,e)}const U=u("ZodStringFormat",(e,t)=>{P.init(e,t),Vr.init(e,t)}),Wa=u("ZodEmail",(e,t)=>{Vs.init(e,t),U.init(e,t)}),tr=u("ZodGUID",(e,t)=>{Ls.init(e,t),U.init(e,t)}),qe=u("ZodUUID",(e,t)=>{Ds.init(e,t),U.init(e,t)}),Ha=u("ZodURL",(e,t)=>{Ms.init(e,t),U.init(e,t)}),Ga=u("ZodEmoji",(e,t)=>{Ks.init(e,t),U.init(e,t)}),qa=u("ZodNanoID",(e,t)=>{Fs.init(e,t),U.init(e,t)}),Ya=u("ZodCUID",(e,t)=>{Bs.init(e,t),U.init(e,t)}),Ja=u("ZodCUID2",(e,t)=>{Ws.init(e,t),U.init(e,t)}
vendor: 3,170 bytes, line 29
29),Xa=u("ZodULID",(e,t)=>{Hs.init(e,t),U.init(e,t)}),Qa=u("ZodXID",(e,t)=>{Gs.init(e,t),U.init(e,t)}),ec=u("ZodKSUID",(e,t)=>{qs.init(e,t),U.init(e,t)}),tc=u("ZodIPv4",(e,t)=>{ei.init(e,t),U.init(e,t)}),rc=u("ZodIPv6",(e,t)=>{ti.init(e,t),U.init(e,t)}),oc=u("ZodCIDRv4",(e,t)=>{ri.init(e,t),U.init(e,t)}),nc=u("ZodCIDRv6",(e,t)=>{oi.init(e,t),U.init(e,t)}),sc=u("ZodBase64",(e,t)=>{ni.init(e,t),U.init(e,t)}),ic=u("ZodBase64URL",(e,t)=>{ii.init(e,t),U.init(e,t)}),ac=u("ZodE164",(e,t)=>{ai.init(e,t),U.init(e,t)}),cc=u("ZodJWT",(e,t)=>{li.init(e,t),U.init(e,t)}),lc=u("ZodBoolean",(e,t)=>{ui.init(e,t),N.init(e,t)});function Ze(e){return ia(lc,e)}const uc=u("ZodAny",(e,t)=>{di.init(e,t),N.init(e,t)});function dc(){return aa(uc)}const pc=u("ZodUnknown",(e,t)=>{pi.init(e,t),N.init(e,t)});function rr(){return ca(pc)}const hc=u("ZodNever",(e,t)=>{hi.init(e,t),N.init(e,t)});function mc(e){return la(hc,e)}const fc=u("ZodArray",(e,t)=>{mi.init(e,t),N.init(e,t),e.element=t.element,e.min=(r,o)=>e.check(tt(r,o)),e.nonempty=r=>e.check(tt(1,r)),e.max=(r,o)=>e.check(Lr(r,o)),e.length=(r,o)=>e.check(Dr(r,o)),e.unwrap=()=>e.element});function Ne(e,t){return va(fc,e,t)}const gc=u("ZodObject",(e,t)=>{gi.init(e,t),N.init(e,t),E(e,"shape",()=>t.shape),e.keyof=()=>be(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:rr()}),e.loose=()=>e.clone({...e._zod.def,catchall:rr()}),e.strict=()=>e.clone({...e._zod.def,catchall:mc()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>Ln(e,r),e.safeExtend=r=>Dn(e,r),e.merge=r=>Vn(e,r),e.pick=r=>Rn(e,r),e.omit=r=>On(e,r),e.partial=(...r)=>Mn(Fr,e,r[0]),e.required=(...r)=>Kn(Br,e,r[0])});function ie(e,t){const r={type:"object",shape:e??{},...w(t)};return new gc(r)}const Mr=u("ZodUnion",(e,t)=>{Or.init(e,t),N.init(e,t),e.options=t.options});function Kr(e,t){return new Mr({type:"union",options:e,...w(t)})}const bc=u("ZodDiscriminatedUnion",(e,t)=>{Mr.init(e,t),bi.init(e,t)});function wc(e,t,r){return new bc({type:"union",options:t,discriminator:e,...w(r)})}const yc=u("ZodIntersection",(e,t)=>{wi.init(e,t),N.init(e,t)});function vc(e,t){return new yc({type:"intersection",left:e,right:t})}const _c=u("ZodRecord",(e,t)=>{yi.init(e,t),N.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function kc(e,t,r){return new _c({type:"record",keyType:e,valueType:t,...w(r)})}const gt=u("ZodEnum",(e,t)=>{vi.init(e,t),N.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{const i={};for(const s of o)if(r.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new gt({...t,checks:[],...w(n),entries:i})},e.exclude=(o,n)=>{const i={...t.entries};for(const s of o)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new gt({...t,checks:[],...w(n),entries:i})}});function be(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new gt({type:"enum",entries:r,...w(t)})}const xc=u("ZodLiteral",(e,t)=>{_i.init(e,t),N.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if
29(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function it(e,t){return new xc({type:"literal",values:Array.isArray(e)?e:[e],...w(t)})}const Sc=u("ZodTransform",(e,t)=>{ki.init(e,t),N.init(e,t),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new zr(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(Ue(i,r.value,t));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(Ue(s))}};const n=t.transform(r.value,r);return n instanceof Promise?n.then(i=>(r.value=i,r)):(r.value=n,r)}});function zc(e){return new Sc({type:"transform",transform:e})}const Fr=u("ZodOptional",(e,t)=>{xi.init(e,t),N.init(e,t),e.unwrap=()=>e._zod.def.innerType});function or(e){return new Fr({type:"optional",innerType:e})}const Cc=u("ZodNullable",(e,t)=>{Si.init(e,t),N.init(e,t),e.unwrap=()=>e._zod.def.innerType});function nr(e){return new Cc({type:"nullable",innerType:e})}const Ic=u("ZodDefault",(e,t)=>{zi.init(e,t),N.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function jc(e,t){return new Ic({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():jr(t)}})}const $c=u("ZodPrefault",(e,t)=>{Ci.init(e,t),N.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Ec(e,t){return new $c({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():jr(t)}})}const Br=u("ZodNonOptional",(e,t)=>{Ii.init(e,t),N.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Ac(e,t){return new Br({type:"nonoptional",innerType:e,...w(t)})}const Zc=u("ZodCatch",(e,t)=>{ji.init(e,t),N.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Pc(e,t){return new Zc({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Tc=u("ZodPipe",(e,t)=>{$i.init(e,t),N.init(e,t),e.in=t.in,e.out=t.out});function sr(e,t){return new Tc({type:"pipe",in:e,out:t})}const Uc=u("ZodReadonly",(e,t)=>{Ei.init(e,t),N.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Nc(e){return new Uc({type:"readonly",innerType:e})}const Rc=u("ZodCustom",(e,t)=>{Ai.init(e,t),N.init(e,t)});function Oc(e,t={}){return _a(Rc,e,t)}function Lc(e){return ka(e)}const Dc=ie({status:be(["active","canceled","expired","pending","none"]),type:be(["stripe","manual","system","coinbase","none"]),billing_interval:be(["monthly","yearly"]).nullable().optional(),current_period_end:S().nullable().optional(),cancel_at_period_end:Ze().nullable().optional()}),Vc=ie({account_id:S().uuid(),identifier:S(),account_type:be(["email","account_number"]),subscription:Dc,created_at:S(),feature_flags:kc(S(),Ze()).default({})}),Mc=ie({type:it("image_attachment"),imageId:S(),cekB64u:S(),ivB64u:S(),mimeType:S()}),Kc=ie({type:it("text"),text:S()}),Fc=ie({type:it("doc_attachment"),docId:S(),fileName:S(),mimeType:S(),cekB64u:S(),ivB64u:S()}),Bc=ie({type:it("doc_text"),text:S(),docId:S()}),Wc=wc("type",[Kc,Mc,Fc,Bc]),Hc=ie({role:be(["user","assistant","tool"]),content:Kr([S(),Ne(Wc)]).optional(),tool_calls:Ne(dc()).optional(),tool_call_id:S().optional(),name:S().optional(),timestamp:S().optional(),reaction:S().optional()});ie({id:S(),title:S(),messages:Ne(Hc),createdAt:S(),updatedAt:S(),folderId:S().optional(),isDecrypting:Ze().optional(),systemPrompt:S().optional(),memoriesEnabled:Ze().optional(),webSearchEnabled:Ze().optional(),bookmarks:Ne(S()).optional()});ie({id:S(),content:S(),createdAt:S(),updatedAt:S(),source:be(["tool","manual","summary"]),toolCallId:S().optional(),conversationId:S().optional(),deletedAt:S().optional()});const Wr=y.createContext(null),Gc=()=>{const e=y.useContext(Wr);if(!e)throw new Error("useAuth must be used within AuthProvider");return e};function ol({children:e}){const[t,r]=y.useState(null),[o,n]=y.useState(null),[i,s]=y.useState(!1),[a,c]=y.useState(!0),[l,d]=y.useState(null),[v,g]=y.useState(null),[_,x]=y.useState(!1),[C,j]=y.useState(null),[K]=y.useState(()=>Oe&&"BroadcastChannel"in window?new BroadcastChannel("strongwall-auth"):null),J=(()=>
29{if(!C?.subscription)return!1;const{status:z,current_period_end:h}=C.subscription;return z==="active"?!0:z==="canceled"&&h?new Date(h)>new Date:!1})();y.useEffect(()=>{(async()=>{try{await W.initialize()}catch(O){console.error("Failed to initialize storage:",O)}const L=localStorage.getItem("authToken"),G=localStorage.getItem("authExpiry"),ne=localStorage.getItem("userIdentifier");L&&G&&(new Date(G)>new Date?(r(L),n(G),d(ne),ne&&(await Z(ne)?s(!0):(r(null),n(null),d(null),localStorage.removeItem("authToken"),localStorage.removeItem("authExpiry"),localStorage.removeItem("userIdentifier")))):(localStorage.removeItem("authToken"),localStorage.removeItem("authExpiry"),localStorage.removeItem("userIdentifier"))),c(!1)})();const h=L=>{L.storageArea===localStorage&&L.key==="authToken"&&!L.newValue&&(r(null),n(null),s(!1),d(null),g(null),x(!1),W.logout())},R=L=>{L.data.type==="AUTH_LOGOUT"&&(r(null),n(null),s(!1),d(null),g(null),x(!1),W.logout())};return window.addEventListener("storage",h),K?.addEventListener("message",R),()=>{window.removeEventListener("storage",h),K?.removeEventListener("message",R)}},[K]),y.useEffect(()=>{i&&t&&!a&&A()},[i,t,a]);const A=async z=>{const h=z||t;if(!h||!z&&X()){j(null);return}try{const R=await fetch("https://api.strongwall.ai/api/me",{headers:{Authorization:`Bearer ${h}`,"Content-Type":"application/json"}});if(R.ok){const L=await R.json(),G=Vc.safeParse(L);G.success?j(G.data):(console.error("Invalid user data format from API:",G.error),j(null))}else R.status===401?oe():console.error("Failed to fetch user data:",R.status)}catch(R){console.error("Error fetching user data:",R)}},Z=async z=>{try{const h=await W.hashIdentifier(z);return W.currentUserId===h&&W.masterKey?(_||x(!0),!0):(x(!1),await W.initialize(),W.currentUserId=h,await W.ensureUserStore(),await W.restoreMasterKeyFromSession()?(await W.initializeWorker(),x(!0),console.log("Successfully restored encrypted storage from session"),!0):(console.log("No session key found - storage will remain unavailable until next login"),!1))}catch(h){return console.error("Failed to restore storage from session:",h),x(!1),!1}},V=(z,h,R,L)=>{Vt(),r(z),n(h),s(!0),d(R),g(L),x(!0),localStorage.setItem("authToken",z),localStorage.setItem("authExpiry",h),localStorage.setItem("userIdentifier",R)},H=async(z,h,R,L)=>{try{sessionStorage.removeItem("lastConversationId")}catch{}x(!1);try{await W.initializeUser(R,L)}catch(G){if(G instanceof vt){await new Promise((ne,O)=>{B.current={resolve:ne,reject:O,token:z,expiry:h,identifier:R,credential:L},I(!0)});return}throw G}V(z,h,R,L)},B=y.useRef(null),[b,I]=y.useState(!1),[ae,ce]=y.useState(!1),ee=()=>{const z=B.current;B.current=null,I(!1),z?.reject(new Error("Login cancelled — your saved conversations were left untouched."))},fe=async()=>{const z=B.current;if(z){ce(!0);try{await W.resetLocalDataAndReinitialize(z.identifier,z.credential),V(z.token,z.expiry,z.identifier,z.credential),B.current=null,I(!1),z.resolve()}catch(h){B.current=null,I(!1),z.reject(h instanceof Error?h:new Error("Failed to reset local storage"))}finally{ce(!1)}}},oe=()=>{r(null),n(null),s(!1),d(null),g(null),x(!1),j(null),localStorage.removeItem("authToken"),localStorage.removeItem("authExpiry"),localStorage.removeItem("userIdentifier"),sessionStorage.removeItem("signupFlow"),Vt(),W.logout(),Zn(),K?.postMessage({type:"AUTH_LOGOUT"})},X=()=>o?new Date(o)<=new Date:!0,Ie={authToken:t,authExpiry:o,isAuthenticated:i,isLoading:a,userIdentifier:l,userCredential:v,storageReady:_,user:C,hasActiveSubscription:J,login:H,logout:oe,isTokenExpired:X,getAuthHeaders:()=>t?{Authorization:`Bearer ${t}`}:{},storageService:W,refreshUser:A,updateAuthToken:(z,h)=>{r(z),n(h),localStorage.setItem("authToken",z),localStorage.setItem("authExpiry",h)}};return p.jsxs(Wr.Provider,{value:Ie,children:[e,p.jsx(wn,{isOpen:b,onCancel:ee,onConfirmErase:()=>{fe()},isErasing:ae}),p.jsx(En,{})]})}const bt="themePreference",Hr=y.createContext(void 0);function qc(){return Oe&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Yc(){if(!Oe)return"system";const e=localStorage.getItem(bt);return e==="light"||e==="dark"?e:"system"}const nl=({children:e})=>{const[t,r]=y.useState(Yc),[o,n]=y.useState(qc);y.useEffect(()=>{const c=window.matchMedia("(prefers-color-scheme: dark)"),l=()=>
29n(c.matches?"dark":"light");return c.addEventListener("change",l),()=>c.removeEventListener("change",l)},[]);const i=t==="system"?o:t,s=c=>{r(c),c==="system"?localStorage.removeItem(bt):localStorage.setItem(bt,c)},a=y.useMemo(()=>({preference:t,resolved:i,system:o,setPreference:s}),[t,i,o]);return p.jsx(Hr.Provider,{value:a,children:e})},sl=()=>{const e=y.useContext(Hr);if(!e)throw new Error("useTheme must be used inside ThemeProvider");return e},Jc={xs:"text-xs leading-5",sm:"text-sm leading-5"},Xc={default:"font-semibold text-foreground decoration-dotted decoration-inverse/25 underline-offset-[16%] hover:decoration-solid hover:text-primary",navigation:"font-medium text-muted-foreground hover:text-primary-emphasis"},ut=({to:e,children:t,underline:r,size:o="sm",theme:n="default",className:i="",onClick:s,...a})=>{const c=ye("cursor-pointer","transition-colors",Jc[o],Xc[n],r&&"underline",i);return s&&!e?p.jsx("a",{className:c,onClick:d=>{d.preventDefault(),s(d)},role:"button",tabIndex:0,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),s(d))},...a,children:t}):e&&/^(https?:\/\/|mailto:)/.test(e)?p.jsx("a",{href:e,className:c,target:"_blank",rel:"noopener noreferrer",...a,children:t}):p.jsx(Gr,{to:e,className:c,...a,children:t})},Qc=({size:e=24})=>p.jsx("div",{className:"border-[3px] border-inverse/10 border-t-primary rounded-full animate-spin",style:{width:e,height:e}});export{ol as A,Xe as B,Mo as C,fn as E,gn as F,Pe as H,Vo as I,ut as L,sn as M,Q as S,nl as T,on as X,sl as a,Qc as b,te as c,Re as d,Ae as e,rl as f,ye as g,vn as h,Oe as i,xr as j,xn as k,Gc as u};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.