@karmaniverous/jeeves-server 3.3.1 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -59,4 +59,4 @@ You can add a description to the \`${Kl}\` by passing a \`${qy}\` component as a
59
59
 
60
60
  Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Kl}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
61
61
 
62
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return g.useEffect(()=>{document.getElementById(n.current?.getAttribute("aria-describedby"))||console.warn(r)},[r,n]),null},sC=Ly,cC=Uy,Qy=Hy,Zy=By,Fy=$y,Py=Ky,Jy=Yy,Iy=Vy;function Wy(n){var r,o,i="";if(typeof n=="string"||typeof n=="number")i+=n;else if(typeof n=="object")if(Array.isArray(n)){var c=n.length;for(r=0;r<c;r++)n[r]&&(o=Wy(n[r]))&&(i&&(i+=" "),i+=o)}else for(o in n)n[o]&&(i&&(i+=" "),i+=o);return i}function uC(){for(var n,r,o=0,i="",c=arguments.length;o<c;o++)(n=arguments[o])&&(r=Wy(n))&&(i&&(i+=" "),i+=r);return i}const fC=(n,r)=>{const o=new Array(n.length+r.length);for(let i=0;i<n.length;i++)o[i]=n[i];for(let i=0;i<r.length;i++)o[n.length+i]=r[i];return o},dC=(n,r)=>({classGroupId:n,validator:r}),eb=(n=new Map,r=null,o)=>({nextPart:n,validators:r,classGroupId:o}),ns="-",Qg=[],mC="arbitrary..",hC=n=>{const r=gC(n),{conflictingClassGroups:o,conflictingClassGroupModifiers:i}=n;return{getClassGroupId:d=>{if(d.startsWith("[")&&d.endsWith("]"))return pC(d);const h=d.split(ns),y=h[0]===""&&h.length>1?1:0;return tb(h,y,r)},getConflictingClassGroupIds:(d,h)=>{if(h){const y=i[d],p=o[d];return y?p?fC(p,y):y:p||Qg}return o[d]||Qg}}},tb=(n,r,o)=>{if(n.length-r===0)return o.classGroupId;const c=n[r],f=o.nextPart.get(c);if(f){const p=tb(n,r+1,f);if(p)return p}const d=o.validators;if(d===null)return;const h=r===0?n.join(ns):n.slice(r).join(ns),y=d.length;for(let p=0;p<y;p++){const x=d[p];if(x.validator(h))return x.classGroupId}},pC=n=>n.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const r=n.slice(1,-1),o=r.indexOf(":"),i=r.slice(0,o);return i?mC+i:void 0})(),gC=n=>{const{theme:r,classGroups:o}=n;return vC(o,r)},vC=(n,r)=>{const o=eb();for(const i in n){const c=n[i];Qf(c,o,i,r)}return o},Qf=(n,r,o,i)=>{const c=n.length;for(let f=0;f<c;f++){const d=n[f];yC(d,r,o,i)}},yC=(n,r,o,i)=>{if(typeof n=="string"){bC(n,r,o);return}if(typeof n=="function"){xC(n,r,o,i);return}wC(n,r,o,i)},bC=(n,r,o)=>{const i=n===""?r:nb(r,n);i.classGroupId=o},xC=(n,r,o,i)=>{if(SC(n)){Qf(n(i),r,o,i);return}r.validators===null&&(r.validators=[]),r.validators.push(dC(o,n))},wC=(n,r,o,i)=>{const c=Object.entries(n),f=c.length;for(let d=0;d<f;d++){const[h,y]=c[d];Qf(y,nb(r,h),o,i)}},nb=(n,r)=>{let o=n;const i=r.split(ns),c=i.length;for(let f=0;f<c;f++){const d=i[f];let h=o.nextPart.get(d);h||(h=eb(),o.nextPart.set(d,h)),o=h}return o},SC=n=>"isThemeGetter"in n&&n.isThemeGetter===!0,EC=n=>{if(n<1)return{get:()=>{},set:()=>{}};let r=0,o=Object.create(null),i=Object.create(null);const c=(f,d)=>{o[f]=d,r++,r>n&&(r=0,i=o,o=Object.create(null))};return{get(f){let d=o[f];if(d!==void 0)return d;if((d=i[f])!==void 0)return c(f,d),d},set(f,d){f in o?o[f]=d:c(f,d)}}},Ef="!",Zg=":",CC=[],Fg=(n,r,o,i,c)=>({modifiers:n,hasImportantModifier:r,baseClassName:o,maybePostfixModifierPosition:i,isExternal:c}),NC=n=>{const{prefix:r,experimentalParseClassName:o}=n;let i=c=>{const f=[];let d=0,h=0,y=0,p;const x=c.length;for(let C=0;C<x;C++){const N=c[C];if(d===0&&h===0){if(N===Zg){f.push(c.slice(y,C)),y=C+1;continue}if(N==="/"){p=C;continue}}N==="["?d++:N==="]"?d--:N==="("?h++:N===")"&&h--}const b=f.length===0?c:c.slice(y);let S=b,E=!1;b.endsWith(Ef)?(S=b.slice(0,-1),E=!0):b.startsWith(Ef)&&(S=b.slice(1),E=!0);const A=p&&p>y?p-y:void 0;return Fg(f,E,S,A)};if(r){const c=r+Zg,f=i;i=d=>d.startsWith(c)?f(d.slice(c.length)):Fg(CC,!1,d,void 0,!0)}if(o){const c=i;i=f=>o({className:f,parseClassName:c})}return i},RC=n=>{const r=new Map;return n.orderSensitiveModifiers.forEach((o,i)=>{r.set(o,1e6+i)}),o=>{const i=[];let c=[];for(let f=0;f<o.length;f++){const d=o[f],h=d[0]==="[",y=r.has(d);h||y?(c.length>0&&(c.sort(),i.push(...c),c=[]),i.push(d)):c.push(d)}return c.length>0&&(c.sort(),i.push(...c)),i}},AC=n=>({cache:EC(n.cacheSize),parseClassName:NC(n),sortModifiers:RC(n),...hC(n)}),TC=/\s+/,_C=(n,r)=>{const{parseClassName:o,getClassGroupId:i,getConflictingClassGroupIds:c,sortModifiers:f}=r,d=[],h=n.trim().split(TC);let y="";for(let p=h.length-1;p>=0;p-=1){const x=h[p],{isExternal:b,modifiers:S,hasImportantModifier:E,baseClassName:A,maybePostfixModifierPosition:C}=o(x);if(b){y=x+(y.length>0?" "+y:y);continue}let N=!!C,_=i(N?A.substring(0,C):A);if(!_){if(!N){y=x+(y.length>0?" "+y:y);continue}if(_=i(A),!_){y=x+(y.length>0?" "+y:y);continue}N=!1}const H=S.length===0?"":S.length===1?S[0]:f(S).join(":"),D=E?H+Ef:H,B=D+_;if(d.indexOf(B)>-1)continue;d.push(B);const Q=c(_,N);for(let W=0;W<Q.length;++W){const X=Q[W];d.push(D+X)}y=x+(y.length>0?" "+y:y)}return y},MC=(...n)=>{let r=0,o,i,c="";for(;r<n.length;)(o=n[r++])&&(i=ab(o))&&(c&&(c+=" "),c+=i);return c},ab=n=>{if(typeof n=="string")return n;let r,o="";for(let i=0;i<n.length;i++)n[i]&&(r=ab(n[i]))&&(o&&(o+=" "),o+=r);return o},jC=(n,...r)=>{let o,i,c,f;const d=y=>{const p=r.reduce((x,b)=>b(x),n());return o=AC(p),i=o.cache.get,c=o.cache.set,f=h,h(y)},h=y=>{const p=i(y);if(p)return p;const x=_C(y,o);return c(y,x),x};return f=d,(...y)=>f(MC(...y))},OC=[],rt=n=>{const r=o=>o[n]||OC;return r.isThemeGetter=!0,r},lb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,rb=/^\((?:(\w[\w-]*):)?(.+)\)$/i,DC=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,zC=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,kC=/\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$/,LC=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,UC=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,HC=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,va=n=>DC.test(n),Ne=n=>!!n&&!Number.isNaN(Number(n)),ya=n=>!!n&&Number.isInteger(Number(n)),lf=n=>n.endsWith("%")&&Ne(n.slice(0,-1)),kn=n=>zC.test(n),ob=()=>!0,BC=n=>kC.test(n)&&!LC.test(n),Zf=()=>!1,GC=n=>UC.test(n),YC=n=>HC.test(n),qC=n=>!ie(n)&&!se(n),VC=n=>Ra(n,cb,Zf),ie=n=>lb.test(n),Xa=n=>Ra(n,ub,BC),Pg=n=>Ra(n,JC,Ne),$C=n=>Ra(n,db,ob),XC=n=>Ra(n,fb,Zf),Jg=n=>Ra(n,ib,Zf),KC=n=>Ra(n,sb,YC),Gi=n=>Ra(n,mb,GC),se=n=>rb.test(n),Fr=n=>Ja(n,ub),QC=n=>Ja(n,fb),Ig=n=>Ja(n,ib),ZC=n=>Ja(n,cb),FC=n=>Ja(n,sb),Yi=n=>Ja(n,mb,!0),PC=n=>Ja(n,db,!0),Ra=(n,r,o)=>{const i=lb.exec(n);return i?i[1]?r(i[1]):o(i[2]):!1},Ja=(n,r,o=!1)=>{const i=rb.exec(n);return i?i[1]?r(i[1]):o:!1},ib=n=>n==="position"||n==="percentage",sb=n=>n==="image"||n==="url",cb=n=>n==="length"||n==="size"||n==="bg-size",ub=n=>n==="length",JC=n=>n==="number",fb=n=>n==="family-name",db=n=>n==="number"||n==="weight",mb=n=>n==="shadow",IC=()=>{const n=rt("color"),r=rt("font"),o=rt("text"),i=rt("font-weight"),c=rt("tracking"),f=rt("leading"),d=rt("breakpoint"),h=rt("container"),y=rt("spacing"),p=rt("radius"),x=rt("shadow"),b=rt("inset-shadow"),S=rt("text-shadow"),E=rt("drop-shadow"),A=rt("blur"),C=rt("perspective"),N=rt("aspect"),_=rt("ease"),H=rt("animate"),D=()=>["auto","avoid","all","avoid-page","page","left","right","column"],B=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],Q=()=>[...B(),se,ie],W=()=>["auto","hidden","clip","visible","scroll"],X=()=>["auto","contain","none"],q=()=>[se,ie,y],ne=()=>[va,"full","auto",...q()],ce=()=>[ya,"none","subgrid",se,ie],me=()=>["auto",{span:["full",ya,se,ie]},ya,se,ie],re=()=>[ya,"auto",se,ie],ge=()=>["auto","min","max","fr",se,ie],fe=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],de=()=>["start","end","center","stretch","center-safe","end-safe"],j=()=>["auto",...q()],Z=()=>[va,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...q()],ee=()=>[va,"screen","full","dvw","lvw","svw","min","max","fit",...q()],z=()=>[va,"screen","full","lh","dvh","lvh","svh","min","max","fit",...q()],G=()=>[n,se,ie],R=()=>[...B(),Ig,Jg,{position:[se,ie]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],V=()=>["auto","cover","contain",ZC,VC,{size:[se,ie]}],P=()=>[lf,Fr,Xa],I=()=>["","none","full",p,se,ie],ae=()=>["",Ne,Fr,Xa],le=()=>["solid","dashed","dotted","double"],De=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ye=()=>[Ne,lf,Ig,Jg],te=()=>["","none",A,se,ie],pe=()=>["none",Ne,se,ie],be=()=>["none",Ne,se,ie],Se=()=>[Ne,se,ie],Re=()=>[va,"full",...q()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[kn],breakpoint:[kn],color:[ob],container:[kn],"drop-shadow":[kn],ease:["in","out","in-out"],font:[qC],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[kn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[kn],shadow:[kn],spacing:["px",Ne],text:[kn],"text-shadow":[kn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",va,ie,se,N]}],container:["container"],columns:[{columns:[Ne,ie,se,h]}],"break-after":[{"break-after":D()}],"break-before":[{"break-before":D()}],"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:Q()}],overflow:[{overflow:W()}],"overflow-x":[{"overflow-x":W()}],"overflow-y":[{"overflow-y":W()}],overscroll:[{overscroll:X()}],"overscroll-x":[{"overscroll-x":X()}],"overscroll-y":[{"overscroll-y":X()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ne()}],"inset-x":[{"inset-x":ne()}],"inset-y":[{"inset-y":ne()}],start:[{"inset-s":ne(),start:ne()}],end:[{"inset-e":ne(),end:ne()}],"inset-bs":[{"inset-bs":ne()}],"inset-be":[{"inset-be":ne()}],top:[{top:ne()}],right:[{right:ne()}],bottom:[{bottom:ne()}],left:[{left:ne()}],visibility:["visible","invisible","collapse"],z:[{z:[ya,"auto",se,ie]}],basis:[{basis:[va,"full","auto",h,...q()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ne,va,"auto","initial","none",ie]}],grow:[{grow:["",Ne,se,ie]}],shrink:[{shrink:["",Ne,se,ie]}],order:[{order:[ya,"first","last","none",se,ie]}],"grid-cols":[{"grid-cols":ce()}],"col-start-end":[{col:me()}],"col-start":[{"col-start":re()}],"col-end":[{"col-end":re()}],"grid-rows":[{"grid-rows":ce()}],"row-start-end":[{row:me()}],"row-start":[{"row-start":re()}],"row-end":[{"row-end":re()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ge()}],"auto-rows":[{"auto-rows":ge()}],gap:[{gap:q()}],"gap-x":[{"gap-x":q()}],"gap-y":[{"gap-y":q()}],"justify-content":[{justify:[...fe(),"normal"]}],"justify-items":[{"justify-items":[...de(),"normal"]}],"justify-self":[{"justify-self":["auto",...de()]}],"align-content":[{content:["normal",...fe()]}],"align-items":[{items:[...de(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...de(),{baseline:["","last"]}]}],"place-content":[{"place-content":fe()}],"place-items":[{"place-items":[...de(),"baseline"]}],"place-self":[{"place-self":["auto",...de()]}],p:[{p:q()}],px:[{px:q()}],py:[{py:q()}],ps:[{ps:q()}],pe:[{pe:q()}],pbs:[{pbs:q()}],pbe:[{pbe:q()}],pt:[{pt:q()}],pr:[{pr:q()}],pb:[{pb:q()}],pl:[{pl:q()}],m:[{m:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mbs:[{mbs:j()}],mbe:[{mbe:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":q()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":q()}],"space-y-reverse":["space-y-reverse"],size:[{size:Z()}],"inline-size":[{inline:["auto",...ee()]}],"min-inline-size":[{"min-inline":["auto",...ee()]}],"max-inline-size":[{"max-inline":["none",...ee()]}],"block-size":[{block:["auto",...z()]}],"min-block-size":[{"min-block":["auto",...z()]}],"max-block-size":[{"max-block":["none",...z()]}],w:[{w:[h,"screen",...Z()]}],"min-w":[{"min-w":[h,"screen","none",...Z()]}],"max-w":[{"max-w":[h,"screen","none","prose",{screen:[d]},...Z()]}],h:[{h:["screen","lh",...Z()]}],"min-h":[{"min-h":["screen","lh","none",...Z()]}],"max-h":[{"max-h":["screen","lh",...Z()]}],"font-size":[{text:["base",o,Fr,Xa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,PC,$C]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",lf,ie]}],"font-family":[{font:[QC,XC,r]}],"font-features":[{"font-features":[ie]}],"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:[c,se,ie]}],"line-clamp":[{"line-clamp":[Ne,"none",se,Pg]}],leading:[{leading:[f,...q()]}],"list-image":[{"list-image":["none",se,ie]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",se,ie]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:G()}],"text-color":[{text:G()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...le(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ne,"from-font","auto",se,Xa]}],"text-decoration-color":[{decoration:G()}],"underline-offset":[{"underline-offset":[Ne,"auto",se,ie]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:q()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",se,ie]}],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",se,ie]}],"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:U()}],"bg-size":[{bg:V()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ya,se,ie],radial:["",se,ie],conic:[ya,se,ie]},FC,KC]}],"bg-color":[{bg:G()}],"gradient-from-pos":[{from:P()}],"gradient-via-pos":[{via:P()}],"gradient-to-pos":[{to:P()}],"gradient-from":[{from:G()}],"gradient-via":[{via:G()}],"gradient-to":[{to:G()}],rounded:[{rounded:I()}],"rounded-s":[{"rounded-s":I()}],"rounded-e":[{"rounded-e":I()}],"rounded-t":[{"rounded-t":I()}],"rounded-r":[{"rounded-r":I()}],"rounded-b":[{"rounded-b":I()}],"rounded-l":[{"rounded-l":I()}],"rounded-ss":[{"rounded-ss":I()}],"rounded-se":[{"rounded-se":I()}],"rounded-ee":[{"rounded-ee":I()}],"rounded-es":[{"rounded-es":I()}],"rounded-tl":[{"rounded-tl":I()}],"rounded-tr":[{"rounded-tr":I()}],"rounded-br":[{"rounded-br":I()}],"rounded-bl":[{"rounded-bl":I()}],"border-w":[{border:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-bs":[{"border-bs":ae()}],"border-w-be":[{"border-be":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...le(),"hidden","none"]}],"divide-style":[{divide:[...le(),"hidden","none"]}],"border-color":[{border:G()}],"border-color-x":[{"border-x":G()}],"border-color-y":[{"border-y":G()}],"border-color-s":[{"border-s":G()}],"border-color-e":[{"border-e":G()}],"border-color-bs":[{"border-bs":G()}],"border-color-be":[{"border-be":G()}],"border-color-t":[{"border-t":G()}],"border-color-r":[{"border-r":G()}],"border-color-b":[{"border-b":G()}],"border-color-l":[{"border-l":G()}],"divide-color":[{divide:G()}],"outline-style":[{outline:[...le(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ne,se,ie]}],"outline-w":[{outline:["",Ne,Fr,Xa]}],"outline-color":[{outline:G()}],shadow:[{shadow:["","none",x,Yi,Gi]}],"shadow-color":[{shadow:G()}],"inset-shadow":[{"inset-shadow":["none",b,Yi,Gi]}],"inset-shadow-color":[{"inset-shadow":G()}],"ring-w":[{ring:ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:G()}],"ring-offset-w":[{"ring-offset":[Ne,Xa]}],"ring-offset-color":[{"ring-offset":G()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":G()}],"text-shadow":[{"text-shadow":["none",S,Yi,Gi]}],"text-shadow-color":[{"text-shadow":G()}],opacity:[{opacity:[Ne,se,ie]}],"mix-blend":[{"mix-blend":[...De(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":De()}],"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":[Ne]}],"mask-image-linear-from-pos":[{"mask-linear-from":ye()}],"mask-image-linear-to-pos":[{"mask-linear-to":ye()}],"mask-image-linear-from-color":[{"mask-linear-from":G()}],"mask-image-linear-to-color":[{"mask-linear-to":G()}],"mask-image-t-from-pos":[{"mask-t-from":ye()}],"mask-image-t-to-pos":[{"mask-t-to":ye()}],"mask-image-t-from-color":[{"mask-t-from":G()}],"mask-image-t-to-color":[{"mask-t-to":G()}],"mask-image-r-from-pos":[{"mask-r-from":ye()}],"mask-image-r-to-pos":[{"mask-r-to":ye()}],"mask-image-r-from-color":[{"mask-r-from":G()}],"mask-image-r-to-color":[{"mask-r-to":G()}],"mask-image-b-from-pos":[{"mask-b-from":ye()}],"mask-image-b-to-pos":[{"mask-b-to":ye()}],"mask-image-b-from-color":[{"mask-b-from":G()}],"mask-image-b-to-color":[{"mask-b-to":G()}],"mask-image-l-from-pos":[{"mask-l-from":ye()}],"mask-image-l-to-pos":[{"mask-l-to":ye()}],"mask-image-l-from-color":[{"mask-l-from":G()}],"mask-image-l-to-color":[{"mask-l-to":G()}],"mask-image-x-from-pos":[{"mask-x-from":ye()}],"mask-image-x-to-pos":[{"mask-x-to":ye()}],"mask-image-x-from-color":[{"mask-x-from":G()}],"mask-image-x-to-color":[{"mask-x-to":G()}],"mask-image-y-from-pos":[{"mask-y-from":ye()}],"mask-image-y-to-pos":[{"mask-y-to":ye()}],"mask-image-y-from-color":[{"mask-y-from":G()}],"mask-image-y-to-color":[{"mask-y-to":G()}],"mask-image-radial":[{"mask-radial":[se,ie]}],"mask-image-radial-from-pos":[{"mask-radial-from":ye()}],"mask-image-radial-to-pos":[{"mask-radial-to":ye()}],"mask-image-radial-from-color":[{"mask-radial-from":G()}],"mask-image-radial-to-color":[{"mask-radial-to":G()}],"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":B()}],"mask-image-conic-pos":[{"mask-conic":[Ne]}],"mask-image-conic-from-pos":[{"mask-conic-from":ye()}],"mask-image-conic-to-pos":[{"mask-conic-to":ye()}],"mask-image-conic-from-color":[{"mask-conic-from":G()}],"mask-image-conic-to-color":[{"mask-conic-to":G()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:R()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:V()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",se,ie]}],filter:[{filter:["","none",se,ie]}],blur:[{blur:te()}],brightness:[{brightness:[Ne,se,ie]}],contrast:[{contrast:[Ne,se,ie]}],"drop-shadow":[{"drop-shadow":["","none",E,Yi,Gi]}],"drop-shadow-color":[{"drop-shadow":G()}],grayscale:[{grayscale:["",Ne,se,ie]}],"hue-rotate":[{"hue-rotate":[Ne,se,ie]}],invert:[{invert:["",Ne,se,ie]}],saturate:[{saturate:[Ne,se,ie]}],sepia:[{sepia:["",Ne,se,ie]}],"backdrop-filter":[{"backdrop-filter":["","none",se,ie]}],"backdrop-blur":[{"backdrop-blur":te()}],"backdrop-brightness":[{"backdrop-brightness":[Ne,se,ie]}],"backdrop-contrast":[{"backdrop-contrast":[Ne,se,ie]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ne,se,ie]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ne,se,ie]}],"backdrop-invert":[{"backdrop-invert":["",Ne,se,ie]}],"backdrop-opacity":[{"backdrop-opacity":[Ne,se,ie]}],"backdrop-saturate":[{"backdrop-saturate":[Ne,se,ie]}],"backdrop-sepia":[{"backdrop-sepia":["",Ne,se,ie]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":q()}],"border-spacing-x":[{"border-spacing-x":q()}],"border-spacing-y":[{"border-spacing-y":q()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",se,ie]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ne,"initial",se,ie]}],ease:[{ease:["linear","initial",_,se,ie]}],delay:[{delay:[Ne,se,ie]}],animate:[{animate:["none",H,se,ie]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[C,se,ie]}],"perspective-origin":[{"perspective-origin":Q()}],rotate:[{rotate:pe()}],"rotate-x":[{"rotate-x":pe()}],"rotate-y":[{"rotate-y":pe()}],"rotate-z":[{"rotate-z":pe()}],scale:[{scale:be()}],"scale-x":[{"scale-x":be()}],"scale-y":[{"scale-y":be()}],"scale-z":[{"scale-z":be()}],"scale-3d":["scale-3d"],skew:[{skew:Se()}],"skew-x":[{"skew-x":Se()}],"skew-y":[{"skew-y":Se()}],transform:[{transform:[se,ie,"","none","gpu","cpu"]}],"transform-origin":[{origin:Q()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Re()}],"translate-x":[{"translate-x":Re()}],"translate-y":[{"translate-y":Re()}],"translate-z":[{"translate-z":Re()}],"translate-none":["translate-none"],accent:[{accent:G()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:G()}],"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",se,ie]}],"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":q()}],"scroll-mx":[{"scroll-mx":q()}],"scroll-my":[{"scroll-my":q()}],"scroll-ms":[{"scroll-ms":q()}],"scroll-me":[{"scroll-me":q()}],"scroll-mbs":[{"scroll-mbs":q()}],"scroll-mbe":[{"scroll-mbe":q()}],"scroll-mt":[{"scroll-mt":q()}],"scroll-mr":[{"scroll-mr":q()}],"scroll-mb":[{"scroll-mb":q()}],"scroll-ml":[{"scroll-ml":q()}],"scroll-p":[{"scroll-p":q()}],"scroll-px":[{"scroll-px":q()}],"scroll-py":[{"scroll-py":q()}],"scroll-ps":[{"scroll-ps":q()}],"scroll-pe":[{"scroll-pe":q()}],"scroll-pbs":[{"scroll-pbs":q()}],"scroll-pbe":[{"scroll-pbe":q()}],"scroll-pt":[{"scroll-pt":q()}],"scroll-pr":[{"scroll-pr":q()}],"scroll-pb":[{"scroll-pb":q()}],"scroll-pl":[{"scroll-pl":q()}],"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",se,ie]}],fill:[{fill:["none",...G()]}],"stroke-w":[{stroke:[Ne,Fr,Xa,Pg]}],stroke:[{stroke:["none",...G()]}],"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"]}},WC=jC(IC);function an(...n){return WC(uC(n))}const eN=sC,tN=cC,hb=g.forwardRef(({className:n,...r},o)=>m.jsx(Qy,{className:an("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...r,ref:o}));hb.displayName=Qy.displayName;const pb=g.forwardRef(({className:n,...r},o)=>m.jsxs(tN,{children:[m.jsx(hb,{}),m.jsx(Zy,{ref:o,className:an("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n),...r})]}));pb.displayName=Zy.displayName;const gb=g.forwardRef(({className:n,...r},o)=>m.jsx(Jy,{ref:o,className:an("text-lg font-semibold",n),...r}));gb.displayName=Jy.displayName;const vb=g.forwardRef(({className:n,...r},o)=>m.jsx(Iy,{ref:o,className:an("text-sm text-muted-foreground",n),...r}));vb.displayName=Iy.displayName;const yb=g.forwardRef(({className:n,...r},o)=>m.jsx(Fy,{ref:o,className:an("inline-flex h-10 items-center justify-center rounded-md bg-destructive px-4 py-2 text-sm font-semibold text-white ring-offset-background transition-colors hover:bg-destructive/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",n),...r}));yb.displayName=Fy.displayName;const bb=g.forwardRef(({className:n,...r},o)=>m.jsx(Py,{ref:o,className:an("inline-flex h-10 items-center justify-center rounded-md border border-border bg-background px-4 py-2 text-sm font-semibold ring-offset-background transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",n),...r}));bb.displayName=Py.displayName;function nN({open:n,onOpenChange:r,title:o,description:i,confirmLabel:c="Continue",onConfirm:f}){return m.jsx(eN,{open:n,onOpenChange:r,children:m.jsxs(pb,{children:[m.jsx(gb,{children:o}),m.jsx(vb,{children:i}),m.jsxs("div",{className:"flex justify-end gap-2 mt-2",children:[m.jsx(bb,{children:"Cancel"}),m.jsx(yb,{onClick:f,children:c})]})]})})}const xb=(...n)=>n.filter((r,o,i)=>!!r&&r.trim()!==""&&i.indexOf(r)===o).join(" ").trim();const aN=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const lN=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(r,o,i)=>i?i.toUpperCase():o.toLowerCase());const Wg=n=>{const r=lN(n);return r.charAt(0).toUpperCase()+r.slice(1)};var rN={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 oN=n=>{for(const r in n)if(r.startsWith("aria-")||r==="role"||r==="title")return!0;return!1};const iN=g.forwardRef(({color:n="currentColor",size:r=24,strokeWidth:o=2,absoluteStrokeWidth:i,className:c="",children:f,iconNode:d,...h},y)=>g.createElement("svg",{ref:y,...rN,width:r,height:r,stroke:n,strokeWidth:i?Number(o)*24/Number(r):o,className:xb("lucide",c),...!f&&!oN(h)&&{"aria-hidden":"true"},...h},[...d.map(([p,x])=>g.createElement(p,x)),...Array.isArray(f)?f:[f]]));const Oe=(n,r)=>{const o=g.forwardRef(({className:i,...c},f)=>g.createElement(iN,{ref:f,iconNode:r,className:xb(`lucide-${aN(Wg(n))}`,`lucide-${n}`,i),...c}));return o.displayName=Wg(n),o};const sN=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],ev=Oe("activity",sN);const cN=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],uN=Oe("arrow-down",cN);const fN=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],dN=Oe("arrow-left",fN);const mN=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],hN=Oe("arrow-up-down",mN);const pN=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],gN=Oe("arrow-up",pN);const vN=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],tv=Oe("book-open",vN);const yN=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],bN=Oe("check",yN);const xN=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ff=Oe("chevron-down",xN);const wN=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],wb=Oe("chevron-right",wN);const SN=[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]],EN=Oe("cloud-download",SN);const CN=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],nv=Oe("external-link",CN);const NN=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Sb=Oe("file-text",NN);const RN=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],AN=Oe("folder-open",RN);const TN=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],av=Oe("github",TN);const _N=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],lv=Oe("key-round",_N);const MN=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],jN=Oe("link",MN);const ON=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ji=Oe("loader-circle",ON);const DN=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],zN=Oe("log-out",DN);const kN=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],LN=Oe("maximize-2",kN);const UN=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],HN=Oe("menu",UN);const BN=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],GN=Oe("minimize-2",BN);const YN=[["path",{d:"M5 12h14",key:"1ays0h"}]],qN=Oe("minus",YN);const VN=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],rv=Oe("moon",VN);const $N=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],XN=Oe("pencil",$N);const KN=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Eb=Oe("play",KN);const QN=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ZN=Oe("plus",QN);const FN=[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],PN=Oe("power-off",FN);const JN=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],IN=Oe("power",JN);const WN=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],eR=Oe("refresh-cw",WN);const tR=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],nR=Oe("rotate-ccw",tR);const aR=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Cb=Oe("search",aR);const lR=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],ov=Oe("sun",lR);const rR=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],oR=Oe("user",rR);const iR=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Za=Oe("x",iR);function Nb(n){const r=n+"CollectionProvider",[o,i]=Pa(r),[c,f]=o(r,{collectionRef:{current:null},itemMap:new Map}),d=C=>{const{scope:N,children:_}=C,H=ba.useRef(null),D=ba.useRef(new Map).current;return m.jsx(c,{scope:N,itemMap:D,collectionRef:H,children:_})};d.displayName=r;const h=n+"CollectionSlot",y=to(h),p=ba.forwardRef((C,N)=>{const{scope:_,children:H}=C,D=f(h,_),B=it(N,D.collectionRef);return m.jsx(y,{ref:B,children:H})});p.displayName=h;const x=n+"CollectionItemSlot",b="data-radix-collection-item",S=to(x),E=ba.forwardRef((C,N)=>{const{scope:_,children:H,...D}=C,B=ba.useRef(null),Q=it(N,B),W=f(x,_);return ba.useEffect(()=>(W.itemMap.set(B,{ref:B,...D}),()=>{W.itemMap.delete(B)})),m.jsx(S,{[b]:"",ref:Q,children:H})});E.displayName=x;function A(C){const N=f(n+"CollectionConsumer",C);return ba.useCallback(()=>{const H=N.collectionRef.current;if(!H)return[];const D=Array.from(H.querySelectorAll(`[${b}]`));return Array.from(N.itemMap.values()).sort((W,X)=>D.indexOf(W.ref.current)-D.indexOf(X.ref.current))},[N.collectionRef,N.itemMap])}return[{Provider:d,Slot:p,ItemSlot:E},A,i]}var sR=g.createContext(void 0);function Rb(n){const r=g.useContext(sR);return n||r||"ltr"}const cR=["top","right","bottom","left"],Ea=Math.min,kt=Math.max,as=Math.round,qi=Math.floor,dn=n=>({x:n,y:n}),uR={left:"right",right:"left",bottom:"top",top:"bottom"};function Cf(n,r,o){return kt(n,Ea(r,o))}function Bn(n,r){return typeof n=="function"?n(r):n}function Gn(n){return n.split("-")[0]}function Il(n){return n.split("-")[1]}function Pf(n){return n==="x"?"y":"x"}function Jf(n){return n==="y"?"height":"width"}function un(n){const r=n[0];return r==="t"||r==="b"?"y":"x"}function If(n){return Pf(un(n))}function fR(n,r,o){o===void 0&&(o=!1);const i=Il(n),c=If(n),f=Jf(c);let d=c==="x"?i===(o?"end":"start")?"right":"left":i==="start"?"bottom":"top";return r.reference[f]>r.floating[f]&&(d=ls(d)),[d,ls(d)]}function dR(n){const r=ls(n);return[Nf(n),r,Nf(r)]}function Nf(n){return n.includes("start")?n.replace("start","end"):n.replace("end","start")}const iv=["left","right"],sv=["right","left"],mR=["top","bottom"],hR=["bottom","top"];function pR(n,r,o){switch(n){case"top":case"bottom":return o?r?sv:iv:r?iv:sv;case"left":case"right":return r?mR:hR;default:return[]}}function gR(n,r,o,i){const c=Il(n);let f=pR(Gn(n),o==="start",i);return c&&(f=f.map(d=>d+"-"+c),r&&(f=f.concat(f.map(Nf)))),f}function ls(n){const r=Gn(n);return uR[r]+n.slice(r.length)}function vR(n){return{top:0,right:0,bottom:0,left:0,...n}}function Ab(n){return typeof n!="number"?vR(n):{top:n,right:n,bottom:n,left:n}}function rs(n){const{x:r,y:o,width:i,height:c}=n;return{width:i,height:c,top:o,left:r,right:r+i,bottom:o+c,x:r,y:o}}function cv(n,r,o){let{reference:i,floating:c}=n;const f=un(r),d=If(r),h=Jf(d),y=Gn(r),p=f==="y",x=i.x+i.width/2-c.width/2,b=i.y+i.height/2-c.height/2,S=i[h]/2-c[h]/2;let E;switch(y){case"top":E={x,y:i.y-c.height};break;case"bottom":E={x,y:i.y+i.height};break;case"right":E={x:i.x+i.width,y:b};break;case"left":E={x:i.x-c.width,y:b};break;default:E={x:i.x,y:i.y}}switch(Il(r)){case"start":E[d]-=S*(o&&p?-1:1);break;case"end":E[d]+=S*(o&&p?-1:1);break}return E}async function yR(n,r){var o;r===void 0&&(r={});const{x:i,y:c,platform:f,rects:d,elements:h,strategy:y}=n,{boundary:p="clippingAncestors",rootBoundary:x="viewport",elementContext:b="floating",altBoundary:S=!1,padding:E=0}=Bn(r,n),A=Ab(E),N=h[S?b==="floating"?"reference":"floating":b],_=rs(await f.getClippingRect({element:(o=await(f.isElement==null?void 0:f.isElement(N)))==null||o?N:N.contextElement||await(f.getDocumentElement==null?void 0:f.getDocumentElement(h.floating)),boundary:p,rootBoundary:x,strategy:y})),H=b==="floating"?{x:i,y:c,width:d.floating.width,height:d.floating.height}:d.reference,D=await(f.getOffsetParent==null?void 0:f.getOffsetParent(h.floating)),B=await(f.isElement==null?void 0:f.isElement(D))?await(f.getScale==null?void 0:f.getScale(D))||{x:1,y:1}:{x:1,y:1},Q=rs(f.convertOffsetParentRelativeRectToViewportRelativeRect?await f.convertOffsetParentRelativeRectToViewportRelativeRect({elements:h,rect:H,offsetParent:D,strategy:y}):H);return{top:(_.top-Q.top+A.top)/B.y,bottom:(Q.bottom-_.bottom+A.bottom)/B.y,left:(_.left-Q.left+A.left)/B.x,right:(Q.right-_.right+A.right)/B.x}}const bR=50,xR=async(n,r,o)=>{const{placement:i="bottom",strategy:c="absolute",middleware:f=[],platform:d}=o,h=d.detectOverflow?d:{...d,detectOverflow:yR},y=await(d.isRTL==null?void 0:d.isRTL(r));let p=await d.getElementRects({reference:n,floating:r,strategy:c}),{x,y:b}=cv(p,i,y),S=i,E=0;const A={};for(let C=0;C<f.length;C++){const N=f[C];if(!N)continue;const{name:_,fn:H}=N,{x:D,y:B,data:Q,reset:W}=await H({x,y:b,initialPlacement:i,placement:S,strategy:c,middlewareData:A,rects:p,platform:h,elements:{reference:n,floating:r}});x=D??x,b=B??b,A[_]={...A[_],...Q},W&&E<bR&&(E++,typeof W=="object"&&(W.placement&&(S=W.placement),W.rects&&(p=W.rects===!0?await d.getElementRects({reference:n,floating:r,strategy:c}):W.rects),{x,y:b}=cv(p,S,y)),C=-1)}return{x,y:b,placement:S,strategy:c,middlewareData:A}},wR=n=>({name:"arrow",options:n,async fn(r){const{x:o,y:i,placement:c,rects:f,platform:d,elements:h,middlewareData:y}=r,{element:p,padding:x=0}=Bn(n,r)||{};if(p==null)return{};const b=Ab(x),S={x:o,y:i},E=If(c),A=Jf(E),C=await d.getDimensions(p),N=E==="y",_=N?"top":"left",H=N?"bottom":"right",D=N?"clientHeight":"clientWidth",B=f.reference[A]+f.reference[E]-S[E]-f.floating[A],Q=S[E]-f.reference[E],W=await(d.getOffsetParent==null?void 0:d.getOffsetParent(p));let X=W?W[D]:0;(!X||!await(d.isElement==null?void 0:d.isElement(W)))&&(X=h.floating[D]||f.floating[A]);const q=B/2-Q/2,ne=X/2-C[A]/2-1,ce=Ea(b[_],ne),me=Ea(b[H],ne),re=ce,ge=X-C[A]-me,fe=X/2-C[A]/2+q,de=Cf(re,fe,ge),j=!y.arrow&&Il(c)!=null&&fe!==de&&f.reference[A]/2-(fe<re?ce:me)-C[A]/2<0,Z=j?fe<re?fe-re:fe-ge:0;return{[E]:S[E]+Z,data:{[E]:de,centerOffset:fe-de-Z,...j&&{alignmentOffset:Z}},reset:j}}}),SR=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(r){var o,i;const{placement:c,middlewareData:f,rects:d,initialPlacement:h,platform:y,elements:p}=r,{mainAxis:x=!0,crossAxis:b=!0,fallbackPlacements:S,fallbackStrategy:E="bestFit",fallbackAxisSideDirection:A="none",flipAlignment:C=!0,...N}=Bn(n,r);if((o=f.arrow)!=null&&o.alignmentOffset)return{};const _=Gn(c),H=un(h),D=Gn(h)===h,B=await(y.isRTL==null?void 0:y.isRTL(p.floating)),Q=S||(D||!C?[ls(h)]:dR(h)),W=A!=="none";!S&&W&&Q.push(...gR(h,C,A,B));const X=[h,...Q],q=await y.detectOverflow(r,N),ne=[];let ce=((i=f.flip)==null?void 0:i.overflows)||[];if(x&&ne.push(q[_]),b){const fe=fR(c,d,B);ne.push(q[fe[0]],q[fe[1]])}if(ce=[...ce,{placement:c,overflows:ne}],!ne.every(fe=>fe<=0)){var me,re;const fe=(((me=f.flip)==null?void 0:me.index)||0)+1,de=X[fe];if(de&&(!(b==="alignment"?H!==un(de):!1)||ce.every(ee=>un(ee.placement)===H?ee.overflows[0]>0:!0)))return{data:{index:fe,overflows:ce},reset:{placement:de}};let j=(re=ce.filter(Z=>Z.overflows[0]<=0).sort((Z,ee)=>Z.overflows[1]-ee.overflows[1])[0])==null?void 0:re.placement;if(!j)switch(E){case"bestFit":{var ge;const Z=(ge=ce.filter(ee=>{if(W){const z=un(ee.placement);return z===H||z==="y"}return!0}).map(ee=>[ee.placement,ee.overflows.filter(z=>z>0).reduce((z,G)=>z+G,0)]).sort((ee,z)=>ee[1]-z[1])[0])==null?void 0:ge[0];Z&&(j=Z);break}case"initialPlacement":j=h;break}if(c!==j)return{reset:{placement:j}}}return{}}}};function uv(n,r){return{top:n.top-r.height,right:n.right-r.width,bottom:n.bottom-r.height,left:n.left-r.width}}function fv(n){return cR.some(r=>n[r]>=0)}const ER=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(r){const{rects:o,platform:i}=r,{strategy:c="referenceHidden",...f}=Bn(n,r);switch(c){case"referenceHidden":{const d=await i.detectOverflow(r,{...f,elementContext:"reference"}),h=uv(d,o.reference);return{data:{referenceHiddenOffsets:h,referenceHidden:fv(h)}}}case"escaped":{const d=await i.detectOverflow(r,{...f,altBoundary:!0}),h=uv(d,o.floating);return{data:{escapedOffsets:h,escaped:fv(h)}}}default:return{}}}}},Tb=new Set(["left","top"]);async function CR(n,r){const{placement:o,platform:i,elements:c}=n,f=await(i.isRTL==null?void 0:i.isRTL(c.floating)),d=Gn(o),h=Il(o),y=un(o)==="y",p=Tb.has(d)?-1:1,x=f&&y?-1:1,b=Bn(r,n);let{mainAxis:S,crossAxis:E,alignmentAxis:A}=typeof b=="number"?{mainAxis:b,crossAxis:0,alignmentAxis:null}:{mainAxis:b.mainAxis||0,crossAxis:b.crossAxis||0,alignmentAxis:b.alignmentAxis};return h&&typeof A=="number"&&(E=h==="end"?A*-1:A),y?{x:E*x,y:S*p}:{x:S*p,y:E*x}}const NR=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(r){var o,i;const{x:c,y:f,placement:d,middlewareData:h}=r,y=await CR(r,n);return d===((o=h.offset)==null?void 0:o.placement)&&(i=h.arrow)!=null&&i.alignmentOffset?{}:{x:c+y.x,y:f+y.y,data:{...y,placement:d}}}}},RR=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(r){const{x:o,y:i,placement:c,platform:f}=r,{mainAxis:d=!0,crossAxis:h=!1,limiter:y={fn:_=>{let{x:H,y:D}=_;return{x:H,y:D}}},...p}=Bn(n,r),x={x:o,y:i},b=await f.detectOverflow(r,p),S=un(Gn(c)),E=Pf(S);let A=x[E],C=x[S];if(d){const _=E==="y"?"top":"left",H=E==="y"?"bottom":"right",D=A+b[_],B=A-b[H];A=Cf(D,A,B)}if(h){const _=S==="y"?"top":"left",H=S==="y"?"bottom":"right",D=C+b[_],B=C-b[H];C=Cf(D,C,B)}const N=y.fn({...r,[E]:A,[S]:C});return{...N,data:{x:N.x-o,y:N.y-i,enabled:{[E]:d,[S]:h}}}}}},AR=function(n){return n===void 0&&(n={}),{options:n,fn(r){const{x:o,y:i,placement:c,rects:f,middlewareData:d}=r,{offset:h=0,mainAxis:y=!0,crossAxis:p=!0}=Bn(n,r),x={x:o,y:i},b=un(c),S=Pf(b);let E=x[S],A=x[b];const C=Bn(h,r),N=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:0,crossAxis:0,...C};if(y){const D=S==="y"?"height":"width",B=f.reference[S]-f.floating[D]+N.mainAxis,Q=f.reference[S]+f.reference[D]-N.mainAxis;E<B?E=B:E>Q&&(E=Q)}if(p){var _,H;const D=S==="y"?"width":"height",B=Tb.has(Gn(c)),Q=f.reference[b]-f.floating[D]+(B&&((_=d.offset)==null?void 0:_[b])||0)+(B?0:N.crossAxis),W=f.reference[b]+f.reference[D]+(B?0:((H=d.offset)==null?void 0:H[b])||0)-(B?N.crossAxis:0);A<Q?A=Q:A>W&&(A=W)}return{[S]:E,[b]:A}}}},TR=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(r){var o,i;const{placement:c,rects:f,platform:d,elements:h}=r,{apply:y=()=>{},...p}=Bn(n,r),x=await d.detectOverflow(r,p),b=Gn(c),S=Il(c),E=un(c)==="y",{width:A,height:C}=f.floating;let N,_;b==="top"||b==="bottom"?(N=b,_=S===(await(d.isRTL==null?void 0:d.isRTL(h.floating))?"start":"end")?"left":"right"):(_=b,N=S==="end"?"top":"bottom");const H=C-x.top-x.bottom,D=A-x.left-x.right,B=Ea(C-x[N],H),Q=Ea(A-x[_],D),W=!r.middlewareData.shift;let X=B,q=Q;if((o=r.middlewareData.shift)!=null&&o.enabled.x&&(q=D),(i=r.middlewareData.shift)!=null&&i.enabled.y&&(X=H),W&&!S){const ce=kt(x.left,0),me=kt(x.right,0),re=kt(x.top,0),ge=kt(x.bottom,0);E?q=A-2*(ce!==0||me!==0?ce+me:kt(x.left,x.right)):X=C-2*(re!==0||ge!==0?re+ge:kt(x.top,x.bottom))}await y({...r,availableWidth:q,availableHeight:X});const ne=await d.getDimensions(h.floating);return A!==ne.width||C!==ne.height?{reset:{rects:!0}}:{}}}};function gs(){return typeof window<"u"}function Wl(n){return _b(n)?(n.nodeName||"").toLowerCase():"#document"}function Lt(n){var r;return(n==null||(r=n.ownerDocument)==null?void 0:r.defaultView)||window}function gn(n){var r;return(r=(_b(n)?n.ownerDocument:n.document)||window.document)==null?void 0:r.documentElement}function _b(n){return gs()?n instanceof Node||n instanceof Lt(n).Node:!1}function en(n){return gs()?n instanceof Element||n instanceof Lt(n).Element:!1}function Vn(n){return gs()?n instanceof HTMLElement||n instanceof Lt(n).HTMLElement:!1}function dv(n){return!gs()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Lt(n).ShadowRoot}function fo(n){const{overflow:r,overflowX:o,overflowY:i,display:c}=tn(n);return/auto|scroll|overlay|hidden|clip/.test(r+i+o)&&c!=="inline"&&c!=="contents"}function _R(n){return/^(table|td|th)$/.test(Wl(n))}function vs(n){try{if(n.matches(":popover-open"))return!0}catch{}try{return n.matches(":modal")}catch{return!1}}const MR=/transform|translate|scale|rotate|perspective|filter/,jR=/paint|layout|strict|content/,Ka=n=>!!n&&n!=="none";let rf;function Wf(n){const r=en(n)?tn(n):n;return Ka(r.transform)||Ka(r.translate)||Ka(r.scale)||Ka(r.rotate)||Ka(r.perspective)||!ed()&&(Ka(r.backdropFilter)||Ka(r.filter))||MR.test(r.willChange||"")||jR.test(r.contain||"")}function OR(n){let r=Ca(n);for(;Vn(r)&&!Zl(r);){if(Wf(r))return r;if(vs(r))return null;r=Ca(r)}return null}function ed(){return rf==null&&(rf=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),rf}function Zl(n){return/^(html|body|#document)$/.test(Wl(n))}function tn(n){return Lt(n).getComputedStyle(n)}function ys(n){return en(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Ca(n){if(Wl(n)==="html")return n;const r=n.assignedSlot||n.parentNode||dv(n)&&n.host||gn(n);return dv(r)?r.host:r}function Mb(n){const r=Ca(n);return Zl(r)?n.ownerDocument?n.ownerDocument.body:n.body:Vn(r)&&fo(r)?r:Mb(r)}function no(n,r,o){var i;r===void 0&&(r=[]),o===void 0&&(o=!0);const c=Mb(n),f=c===((i=n.ownerDocument)==null?void 0:i.body),d=Lt(c);if(f){const h=Rf(d);return r.concat(d,d.visualViewport||[],fo(c)?c:[],h&&o?no(h):[])}else return r.concat(c,no(c,[],o))}function Rf(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function jb(n){const r=tn(n);let o=parseFloat(r.width)||0,i=parseFloat(r.height)||0;const c=Vn(n),f=c?n.offsetWidth:o,d=c?n.offsetHeight:i,h=as(o)!==f||as(i)!==d;return h&&(o=f,i=d),{width:o,height:i,$:h}}function td(n){return en(n)?n:n.contextElement}function Ql(n){const r=td(n);if(!Vn(r))return dn(1);const o=r.getBoundingClientRect(),{width:i,height:c,$:f}=jb(r);let d=(f?as(o.width):o.width)/i,h=(f?as(o.height):o.height)/c;return(!d||!Number.isFinite(d))&&(d=1),(!h||!Number.isFinite(h))&&(h=1),{x:d,y:h}}const DR=dn(0);function Ob(n){const r=Lt(n);return!ed()||!r.visualViewport?DR:{x:r.visualViewport.offsetLeft,y:r.visualViewport.offsetTop}}function zR(n,r,o){return r===void 0&&(r=!1),!o||r&&o!==Lt(n)?!1:r}function Fa(n,r,o,i){r===void 0&&(r=!1),o===void 0&&(o=!1);const c=n.getBoundingClientRect(),f=td(n);let d=dn(1);r&&(i?en(i)&&(d=Ql(i)):d=Ql(n));const h=zR(f,o,i)?Ob(f):dn(0);let y=(c.left+h.x)/d.x,p=(c.top+h.y)/d.y,x=c.width/d.x,b=c.height/d.y;if(f){const S=Lt(f),E=i&&en(i)?Lt(i):i;let A=S,C=Rf(A);for(;C&&i&&E!==A;){const N=Ql(C),_=C.getBoundingClientRect(),H=tn(C),D=_.left+(C.clientLeft+parseFloat(H.paddingLeft))*N.x,B=_.top+(C.clientTop+parseFloat(H.paddingTop))*N.y;y*=N.x,p*=N.y,x*=N.x,b*=N.y,y+=D,p+=B,A=Lt(C),C=Rf(A)}}return rs({width:x,height:b,x:y,y:p})}function bs(n,r){const o=ys(n).scrollLeft;return r?r.left+o:Fa(gn(n)).left+o}function Db(n,r){const o=n.getBoundingClientRect(),i=o.left+r.scrollLeft-bs(n,o),c=o.top+r.scrollTop;return{x:i,y:c}}function kR(n){let{elements:r,rect:o,offsetParent:i,strategy:c}=n;const f=c==="fixed",d=gn(i),h=r?vs(r.floating):!1;if(i===d||h&&f)return o;let y={scrollLeft:0,scrollTop:0},p=dn(1);const x=dn(0),b=Vn(i);if((b||!b&&!f)&&((Wl(i)!=="body"||fo(d))&&(y=ys(i)),b)){const E=Fa(i);p=Ql(i),x.x=E.x+i.clientLeft,x.y=E.y+i.clientTop}const S=d&&!b&&!f?Db(d,y):dn(0);return{width:o.width*p.x,height:o.height*p.y,x:o.x*p.x-y.scrollLeft*p.x+x.x+S.x,y:o.y*p.y-y.scrollTop*p.y+x.y+S.y}}function LR(n){return Array.from(n.getClientRects())}function UR(n){const r=gn(n),o=ys(n),i=n.ownerDocument.body,c=kt(r.scrollWidth,r.clientWidth,i.scrollWidth,i.clientWidth),f=kt(r.scrollHeight,r.clientHeight,i.scrollHeight,i.clientHeight);let d=-o.scrollLeft+bs(n);const h=-o.scrollTop;return tn(i).direction==="rtl"&&(d+=kt(r.clientWidth,i.clientWidth)-c),{width:c,height:f,x:d,y:h}}const mv=25;function HR(n,r){const o=Lt(n),i=gn(n),c=o.visualViewport;let f=i.clientWidth,d=i.clientHeight,h=0,y=0;if(c){f=c.width,d=c.height;const x=ed();(!x||x&&r==="fixed")&&(h=c.offsetLeft,y=c.offsetTop)}const p=bs(i);if(p<=0){const x=i.ownerDocument,b=x.body,S=getComputedStyle(b),E=x.compatMode==="CSS1Compat"&&parseFloat(S.marginLeft)+parseFloat(S.marginRight)||0,A=Math.abs(i.clientWidth-b.clientWidth-E);A<=mv&&(f-=A)}else p<=mv&&(f+=p);return{width:f,height:d,x:h,y}}function BR(n,r){const o=Fa(n,!0,r==="fixed"),i=o.top+n.clientTop,c=o.left+n.clientLeft,f=Vn(n)?Ql(n):dn(1),d=n.clientWidth*f.x,h=n.clientHeight*f.y,y=c*f.x,p=i*f.y;return{width:d,height:h,x:y,y:p}}function hv(n,r,o){let i;if(r==="viewport")i=HR(n,o);else if(r==="document")i=UR(gn(n));else if(en(r))i=BR(r,o);else{const c=Ob(n);i={x:r.x-c.x,y:r.y-c.y,width:r.width,height:r.height}}return rs(i)}function zb(n,r){const o=Ca(n);return o===r||!en(o)||Zl(o)?!1:tn(o).position==="fixed"||zb(o,r)}function GR(n,r){const o=r.get(n);if(o)return o;let i=no(n,[],!1).filter(h=>en(h)&&Wl(h)!=="body"),c=null;const f=tn(n).position==="fixed";let d=f?Ca(n):n;for(;en(d)&&!Zl(d);){const h=tn(d),y=Wf(d);!y&&h.position==="fixed"&&(c=null),(f?!y&&!c:!y&&h.position==="static"&&!!c&&(c.position==="absolute"||c.position==="fixed")||fo(d)&&!y&&zb(n,d))?i=i.filter(x=>x!==d):c=h,d=Ca(d)}return r.set(n,i),i}function YR(n){let{element:r,boundary:o,rootBoundary:i,strategy:c}=n;const d=[...o==="clippingAncestors"?vs(r)?[]:GR(r,this._c):[].concat(o),i],h=hv(r,d[0],c);let y=h.top,p=h.right,x=h.bottom,b=h.left;for(let S=1;S<d.length;S++){const E=hv(r,d[S],c);y=kt(E.top,y),p=Ea(E.right,p),x=Ea(E.bottom,x),b=kt(E.left,b)}return{width:p-b,height:x-y,x:b,y}}function qR(n){const{width:r,height:o}=jb(n);return{width:r,height:o}}function VR(n,r,o){const i=Vn(r),c=gn(r),f=o==="fixed",d=Fa(n,!0,f,r);let h={scrollLeft:0,scrollTop:0};const y=dn(0);function p(){y.x=bs(c)}if(i||!i&&!f)if((Wl(r)!=="body"||fo(c))&&(h=ys(r)),i){const E=Fa(r,!0,f,r);y.x=E.x+r.clientLeft,y.y=E.y+r.clientTop}else c&&p();f&&!i&&c&&p();const x=c&&!i&&!f?Db(c,h):dn(0),b=d.left+h.scrollLeft-y.x-x.x,S=d.top+h.scrollTop-y.y-x.y;return{x:b,y:S,width:d.width,height:d.height}}function of(n){return tn(n).position==="static"}function pv(n,r){if(!Vn(n)||tn(n).position==="fixed")return null;if(r)return r(n);let o=n.offsetParent;return gn(n)===o&&(o=o.ownerDocument.body),o}function kb(n,r){const o=Lt(n);if(vs(n))return o;if(!Vn(n)){let c=Ca(n);for(;c&&!Zl(c);){if(en(c)&&!of(c))return c;c=Ca(c)}return o}let i=pv(n,r);for(;i&&_R(i)&&of(i);)i=pv(i,r);return i&&Zl(i)&&of(i)&&!Wf(i)?o:i||OR(n)||o}const $R=async function(n){const r=this.getOffsetParent||kb,o=this.getDimensions,i=await o(n.floating);return{reference:VR(n.reference,await r(n.floating),n.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function XR(n){return tn(n).direction==="rtl"}const KR={convertOffsetParentRelativeRectToViewportRelativeRect:kR,getDocumentElement:gn,getClippingRect:YR,getOffsetParent:kb,getElementRects:$R,getClientRects:LR,getDimensions:qR,getScale:Ql,isElement:en,isRTL:XR};function Lb(n,r){return n.x===r.x&&n.y===r.y&&n.width===r.width&&n.height===r.height}function QR(n,r){let o=null,i;const c=gn(n);function f(){var h;clearTimeout(i),(h=o)==null||h.disconnect(),o=null}function d(h,y){h===void 0&&(h=!1),y===void 0&&(y=1),f();const p=n.getBoundingClientRect(),{left:x,top:b,width:S,height:E}=p;if(h||r(),!S||!E)return;const A=qi(b),C=qi(c.clientWidth-(x+S)),N=qi(c.clientHeight-(b+E)),_=qi(x),D={rootMargin:-A+"px "+-C+"px "+-N+"px "+-_+"px",threshold:kt(0,Ea(1,y))||1};let B=!0;function Q(W){const X=W[0].intersectionRatio;if(X!==y){if(!B)return d();X?d(!1,X):i=setTimeout(()=>{d(!1,1e-7)},1e3)}X===1&&!Lb(p,n.getBoundingClientRect())&&d(),B=!1}try{o=new IntersectionObserver(Q,{...D,root:c.ownerDocument})}catch{o=new IntersectionObserver(Q,D)}o.observe(n)}return d(!0),f}function ZR(n,r,o,i){i===void 0&&(i={});const{ancestorScroll:c=!0,ancestorResize:f=!0,elementResize:d=typeof ResizeObserver=="function",layoutShift:h=typeof IntersectionObserver=="function",animationFrame:y=!1}=i,p=td(n),x=c||f?[...p?no(p):[],...r?no(r):[]]:[];x.forEach(_=>{c&&_.addEventListener("scroll",o,{passive:!0}),f&&_.addEventListener("resize",o)});const b=p&&h?QR(p,o):null;let S=-1,E=null;d&&(E=new ResizeObserver(_=>{let[H]=_;H&&H.target===p&&E&&r&&(E.unobserve(r),cancelAnimationFrame(S),S=requestAnimationFrame(()=>{var D;(D=E)==null||D.observe(r)})),o()}),p&&!y&&E.observe(p),r&&E.observe(r));let A,C=y?Fa(n):null;y&&N();function N(){const _=Fa(n);C&&!Lb(C,_)&&o(),C=_,A=requestAnimationFrame(N)}return o(),()=>{var _;x.forEach(H=>{c&&H.removeEventListener("scroll",o),f&&H.removeEventListener("resize",o)}),b?.(),(_=E)==null||_.disconnect(),E=null,y&&cancelAnimationFrame(A)}}const FR=NR,PR=RR,JR=SR,IR=TR,WR=ER,gv=wR,eA=AR,tA=(n,r,o)=>{const i=new Map,c={platform:KR,...o},f={...c.platform,_c:i};return xR(n,r,{...c,platform:f})};var nA=typeof document<"u",aA=function(){},Ii=nA?g.useLayoutEffect:aA;function os(n,r){if(n===r)return!0;if(typeof n!=typeof r)return!1;if(typeof n=="function"&&n.toString()===r.toString())return!0;let o,i,c;if(n&&r&&typeof n=="object"){if(Array.isArray(n)){if(o=n.length,o!==r.length)return!1;for(i=o;i--!==0;)if(!os(n[i],r[i]))return!1;return!0}if(c=Object.keys(n),o=c.length,o!==Object.keys(r).length)return!1;for(i=o;i--!==0;)if(!{}.hasOwnProperty.call(r,c[i]))return!1;for(i=o;i--!==0;){const f=c[i];if(!(f==="_owner"&&n.$$typeof)&&!os(n[f],r[f]))return!1}return!0}return n!==n&&r!==r}function Ub(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function vv(n,r){const o=Ub(n);return Math.round(r*o)/o}function sf(n){const r=g.useRef(n);return Ii(()=>{r.current=n}),r}function lA(n){n===void 0&&(n={});const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:c,elements:{reference:f,floating:d}={},transform:h=!0,whileElementsMounted:y,open:p}=n,[x,b]=g.useState({x:0,y:0,strategy:o,placement:r,middlewareData:{},isPositioned:!1}),[S,E]=g.useState(i);os(S,i)||E(i);const[A,C]=g.useState(null),[N,_]=g.useState(null),H=g.useCallback(ee=>{ee!==W.current&&(W.current=ee,C(ee))},[]),D=g.useCallback(ee=>{ee!==X.current&&(X.current=ee,_(ee))},[]),B=f||A,Q=d||N,W=g.useRef(null),X=g.useRef(null),q=g.useRef(x),ne=y!=null,ce=sf(y),me=sf(c),re=sf(p),ge=g.useCallback(()=>{if(!W.current||!X.current)return;const ee={placement:r,strategy:o,middleware:S};me.current&&(ee.platform=me.current),tA(W.current,X.current,ee).then(z=>{const G={...z,isPositioned:re.current!==!1};fe.current&&!os(q.current,G)&&(q.current=G,Hf.flushSync(()=>{b(G)}))})},[S,r,o,me,re]);Ii(()=>{p===!1&&q.current.isPositioned&&(q.current.isPositioned=!1,b(ee=>({...ee,isPositioned:!1})))},[p]);const fe=g.useRef(!1);Ii(()=>(fe.current=!0,()=>{fe.current=!1}),[]),Ii(()=>{if(B&&(W.current=B),Q&&(X.current=Q),B&&Q){if(ce.current)return ce.current(B,Q,ge);ge()}},[B,Q,ge,ce,ne]);const de=g.useMemo(()=>({reference:W,floating:X,setReference:H,setFloating:D}),[H,D]),j=g.useMemo(()=>({reference:B,floating:Q}),[B,Q]),Z=g.useMemo(()=>{const ee={position:o,left:0,top:0};if(!j.floating)return ee;const z=vv(j.floating,x.x),G=vv(j.floating,x.y);return h?{...ee,transform:"translate("+z+"px, "+G+"px)",...Ub(j.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:z,top:G}},[o,h,j.floating,x.x,x.y]);return g.useMemo(()=>({...x,update:ge,refs:de,elements:j,floatingStyles:Z}),[x,ge,de,j,Z])}const rA=n=>{function r(o){return{}.hasOwnProperty.call(o,"current")}return{name:"arrow",options:n,fn(o){const{element:i,padding:c}=typeof n=="function"?n(o):n;return i&&r(i)?i.current!=null?gv({element:i.current,padding:c}).fn(o):{}:i?gv({element:i,padding:c}).fn(o):{}}}},oA=(n,r)=>{const o=FR(n);return{name:o.name,fn:o.fn,options:[n,r]}},iA=(n,r)=>{const o=PR(n);return{name:o.name,fn:o.fn,options:[n,r]}},sA=(n,r)=>({fn:eA(n).fn,options:[n,r]}),cA=(n,r)=>{const o=JR(n);return{name:o.name,fn:o.fn,options:[n,r]}},uA=(n,r)=>{const o=IR(n);return{name:o.name,fn:o.fn,options:[n,r]}},fA=(n,r)=>{const o=WR(n);return{name:o.name,fn:o.fn,options:[n,r]}},dA=(n,r)=>{const o=rA(n);return{name:o.name,fn:o.fn,options:[n,r]}};var mA="Arrow",Hb=g.forwardRef((n,r)=>{const{children:o,width:i=10,height:c=5,...f}=n;return m.jsx(at.svg,{...f,ref:r,width:i,height:c,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?o:m.jsx("polygon",{points:"0,0 30,0 15,10"})})});Hb.displayName=mA;var hA=Hb;function pA(n){const[r,o]=g.useState(void 0);return Sa(()=>{if(n){o({width:n.offsetWidth,height:n.offsetHeight});const i=new ResizeObserver(c=>{if(!Array.isArray(c)||!c.length)return;const f=c[0];let d,h;if("borderBoxSize"in f){const y=f.borderBoxSize,p=Array.isArray(y)?y[0]:y;d=p.inlineSize,h=p.blockSize}else d=n.offsetWidth,h=n.offsetHeight;o({width:d,height:h})});return i.observe(n,{box:"border-box"}),()=>i.unobserve(n)}else o(void 0)},[n]),r}var nd="Popper",[Bb,Gb]=Pa(nd),[gA,Yb]=Bb(nd),qb=n=>{const{__scopePopper:r,children:o}=n,[i,c]=g.useState(null);return m.jsx(gA,{scope:r,anchor:i,onAnchorChange:c,children:o})};qb.displayName=nd;var Vb="PopperAnchor",$b=g.forwardRef((n,r)=>{const{__scopePopper:o,virtualRef:i,...c}=n,f=Yb(Vb,o),d=g.useRef(null),h=it(r,d),y=g.useRef(null);return g.useEffect(()=>{const p=y.current;y.current=i?.current||d.current,p!==y.current&&f.onAnchorChange(y.current)}),i?null:m.jsx(at.div,{...c,ref:h})});$b.displayName=Vb;var ad="PopperContent",[vA,yA]=Bb(ad),Xb=g.forwardRef((n,r)=>{const{__scopePopper:o,side:i="bottom",sideOffset:c=0,align:f="center",alignOffset:d=0,arrowPadding:h=0,avoidCollisions:y=!0,collisionBoundary:p=[],collisionPadding:x=0,sticky:b="partial",hideWhenDetached:S=!1,updatePositionStrategy:E="optimized",onPlaced:A,...C}=n,N=Yb(ad,o),[_,H]=g.useState(null),D=it(r,le=>H(le)),[B,Q]=g.useState(null),W=pA(B),X=W?.width??0,q=W?.height??0,ne=i+(f!=="center"?"-"+f:""),ce=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},me=Array.isArray(p)?p:[p],re=me.length>0,ge={padding:ce,boundary:me.filter(xA),altBoundary:re},{refs:fe,floatingStyles:de,placement:j,isPositioned:Z,middlewareData:ee}=lA({strategy:"fixed",placement:ne,whileElementsMounted:(...le)=>ZR(...le,{animationFrame:E==="always"}),elements:{reference:N.anchor},middleware:[oA({mainAxis:c+q,alignmentAxis:d}),y&&iA({mainAxis:!0,crossAxis:!1,limiter:b==="partial"?sA():void 0,...ge}),y&&cA({...ge}),uA({...ge,apply:({elements:le,rects:De,availableWidth:ye,availableHeight:te})=>{const{width:pe,height:be}=De.reference,Se=le.floating.style;Se.setProperty("--radix-popper-available-width",`${ye}px`),Se.setProperty("--radix-popper-available-height",`${te}px`),Se.setProperty("--radix-popper-anchor-width",`${pe}px`),Se.setProperty("--radix-popper-anchor-height",`${be}px`)}}),B&&dA({element:B,padding:h}),wA({arrowWidth:X,arrowHeight:q}),S&&fA({strategy:"referenceHidden",...ge})]}),[z,G]=Zb(j),R=Hn(A);Sa(()=>{Z&&R?.()},[Z,R]);const U=ee.arrow?.x,V=ee.arrow?.y,P=ee.arrow?.centerOffset!==0,[I,ae]=g.useState();return Sa(()=>{_&&ae(window.getComputedStyle(_).zIndex)},[_]),m.jsx("div",{ref:fe.setFloating,"data-radix-popper-content-wrapper":"",style:{...de,transform:Z?de.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:I,"--radix-popper-transform-origin":[ee.transformOrigin?.x,ee.transformOrigin?.y].join(" "),...ee.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:m.jsx(vA,{scope:o,placedSide:z,onArrowChange:Q,arrowX:U,arrowY:V,shouldHideArrow:P,children:m.jsx(at.div,{"data-side":z,"data-align":G,...C,ref:D,style:{...C.style,animation:Z?void 0:"none"}})})})});Xb.displayName=ad;var Kb="PopperArrow",bA={top:"bottom",right:"left",bottom:"top",left:"right"},Qb=g.forwardRef(function(r,o){const{__scopePopper:i,...c}=r,f=yA(Kb,i),d=bA[f.placedSide];return m.jsx("span",{ref:f.onArrowChange,style:{position:"absolute",left:f.arrowX,top:f.arrowY,[d]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[f.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[f.placedSide],visibility:f.shouldHideArrow?"hidden":void 0},children:m.jsx(hA,{...c,ref:o,style:{...c.style,display:"block"}})})});Qb.displayName=Kb;function xA(n){return n!==null}var wA=n=>({name:"transformOrigin",options:n,fn(r){const{placement:o,rects:i,middlewareData:c}=r,d=c.arrow?.centerOffset!==0,h=d?0:n.arrowWidth,y=d?0:n.arrowHeight,[p,x]=Zb(o),b={start:"0%",center:"50%",end:"100%"}[x],S=(c.arrow?.x??0)+h/2,E=(c.arrow?.y??0)+y/2;let A="",C="";return p==="bottom"?(A=d?b:`${S}px`,C=`${-y}px`):p==="top"?(A=d?b:`${S}px`,C=`${i.floating.height+y}px`):p==="right"?(A=`${-y}px`,C=d?b:`${E}px`):p==="left"&&(A=`${i.floating.width+y}px`,C=d?b:`${E}px`),{data:{x:A,y:C}}}});function Zb(n){const[r,o="center"]=n.split("-");return[r,o]}var SA=qb,EA=$b,CA=Xb,NA=Qb,cf="rovingFocusGroup.onEntryFocus",RA={bubbles:!1,cancelable:!0},mo="RovingFocusGroup",[Af,Fb,AA]=Nb(mo),[TA,Pb]=Pa(mo,[AA]),[_A,MA]=TA(mo),Jb=g.forwardRef((n,r)=>m.jsx(Af.Provider,{scope:n.__scopeRovingFocusGroup,children:m.jsx(Af.Slot,{scope:n.__scopeRovingFocusGroup,children:m.jsx(jA,{...n,ref:r})})}));Jb.displayName=mo;var jA=g.forwardRef((n,r)=>{const{__scopeRovingFocusGroup:o,orientation:i,loop:c=!1,dir:f,currentTabStopId:d,defaultCurrentTabStopId:h,onCurrentTabStopIdChange:y,onEntryFocus:p,preventScrollOnEntryFocus:x=!1,...b}=n,S=g.useRef(null),E=it(r,S),A=Rb(f),[C,N]=Bf({prop:d,defaultProp:h??null,onChange:y,caller:mo}),[_,H]=g.useState(!1),D=Hn(p),B=Fb(o),Q=g.useRef(!1),[W,X]=g.useState(0);return g.useEffect(()=>{const q=S.current;if(q)return q.addEventListener(cf,D),()=>q.removeEventListener(cf,D)},[D]),m.jsx(_A,{scope:o,orientation:i,dir:A,loop:c,currentTabStopId:C,onItemFocus:g.useCallback(q=>N(q),[N]),onItemShiftTab:g.useCallback(()=>H(!0),[]),onFocusableItemAdd:g.useCallback(()=>X(q=>q+1),[]),onFocusableItemRemove:g.useCallback(()=>X(q=>q-1),[]),children:m.jsx(at.div,{tabIndex:_||W===0?-1:0,"data-orientation":i,...b,ref:E,style:{outline:"none",...n.style},onMouseDown:Ce(n.onMouseDown,()=>{Q.current=!0}),onFocus:Ce(n.onFocus,q=>{const ne=!Q.current;if(q.target===q.currentTarget&&ne&&!_){const ce=new CustomEvent(cf,RA);if(q.currentTarget.dispatchEvent(ce),!ce.defaultPrevented){const me=B().filter(j=>j.focusable),re=me.find(j=>j.active),ge=me.find(j=>j.id===C),de=[re,ge,...me].filter(Boolean).map(j=>j.ref.current);ex(de,x)}}Q.current=!1}),onBlur:Ce(n.onBlur,()=>H(!1))})})}),Ib="RovingFocusGroupItem",Wb=g.forwardRef((n,r)=>{const{__scopeRovingFocusGroup:o,focusable:i=!0,active:c=!1,tabStopId:f,children:d,...h}=n,y=$l(),p=f||y,x=MA(Ib,o),b=x.currentTabStopId===p,S=Fb(o),{onFocusableItemAdd:E,onFocusableItemRemove:A,currentTabStopId:C}=x;return g.useEffect(()=>{if(i)return E(),()=>A()},[i,E,A]),m.jsx(Af.ItemSlot,{scope:o,id:p,focusable:i,active:c,children:m.jsx(at.span,{tabIndex:b?0:-1,"data-orientation":x.orientation,...h,ref:r,onMouseDown:Ce(n.onMouseDown,N=>{i?x.onItemFocus(p):N.preventDefault()}),onFocus:Ce(n.onFocus,()=>x.onItemFocus(p)),onKeyDown:Ce(n.onKeyDown,N=>{if(N.key==="Tab"&&N.shiftKey){x.onItemShiftTab();return}if(N.target!==N.currentTarget)return;const _=zA(N,x.orientation,x.dir);if(_!==void 0){if(N.metaKey||N.ctrlKey||N.altKey||N.shiftKey)return;N.preventDefault();let D=S().filter(B=>B.focusable).map(B=>B.ref.current);if(_==="last")D.reverse();else if(_==="prev"||_==="next"){_==="prev"&&D.reverse();const B=D.indexOf(N.currentTarget);D=x.loop?kA(D,B+1):D.slice(B+1)}setTimeout(()=>ex(D))}}),children:typeof d=="function"?d({isCurrentTabStop:b,hasTabStop:C!=null}):d})})});Wb.displayName=Ib;var OA={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function DA(n,r){return r!=="rtl"?n:n==="ArrowLeft"?"ArrowRight":n==="ArrowRight"?"ArrowLeft":n}function zA(n,r,o){const i=DA(n.key,o);if(!(r==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(r==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return OA[i]}function ex(n,r=!1){const o=document.activeElement;for(const i of n)if(i===o||(i.focus({preventScroll:r}),document.activeElement!==o))return}function kA(n,r){return n.map((o,i)=>n[(r+i)%n.length])}var LA=Jb,UA=Wb,Tf=["Enter"," "],HA=["ArrowDown","PageUp","Home"],tx=["ArrowUp","PageDown","End"],BA=[...HA,...tx],GA={ltr:[...Tf,"ArrowRight"],rtl:[...Tf,"ArrowLeft"]},YA={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ho="Menu",[ao,qA,VA]=Nb(ho),[Ia,nx]=Pa(ho,[VA,Gb,Pb]),xs=Gb(),ax=Pb(),[$A,Wa]=Ia(ho),[XA,po]=Ia(ho),lx=n=>{const{__scopeMenu:r,open:o=!1,children:i,dir:c,onOpenChange:f,modal:d=!0}=n,h=xs(r),[y,p]=g.useState(null),x=g.useRef(!1),b=Hn(f),S=Rb(c);return g.useEffect(()=>{const E=()=>{x.current=!0,document.addEventListener("pointerdown",A,{capture:!0,once:!0}),document.addEventListener("pointermove",A,{capture:!0,once:!0})},A=()=>x.current=!1;return document.addEventListener("keydown",E,{capture:!0}),()=>{document.removeEventListener("keydown",E,{capture:!0}),document.removeEventListener("pointerdown",A,{capture:!0}),document.removeEventListener("pointermove",A,{capture:!0})}},[]),m.jsx(SA,{...h,children:m.jsx($A,{scope:r,open:o,onOpenChange:b,content:y,onContentChange:p,children:m.jsx(XA,{scope:r,onClose:g.useCallback(()=>b(!1),[b]),isUsingKeyboardRef:x,dir:S,modal:d,children:i})})})};lx.displayName=ho;var KA="MenuAnchor",ld=g.forwardRef((n,r)=>{const{__scopeMenu:o,...i}=n,c=xs(o);return m.jsx(EA,{...c,...i,ref:r})});ld.displayName=KA;var rd="MenuPortal",[QA,rx]=Ia(rd,{forceMount:void 0}),ox=n=>{const{__scopeMenu:r,forceMount:o,children:i,container:c}=n,f=Wa(rd,r);return m.jsx(QA,{scope:r,forceMount:o,children:m.jsx(Na,{present:o||f.open,children:m.jsx(qf,{asChild:!0,container:c,children:i})})})};ox.displayName=rd;var Zt="MenuContent",[ZA,od]=Ia(Zt),ix=g.forwardRef((n,r)=>{const o=rx(Zt,n.__scopeMenu),{forceMount:i=o.forceMount,...c}=n,f=Wa(Zt,n.__scopeMenu),d=po(Zt,n.__scopeMenu);return m.jsx(ao.Provider,{scope:n.__scopeMenu,children:m.jsx(Na,{present:i||f.open,children:m.jsx(ao.Slot,{scope:n.__scopeMenu,children:d.modal?m.jsx(FA,{...c,ref:r}):m.jsx(PA,{...c,ref:r})})})})}),FA=g.forwardRef((n,r)=>{const o=Wa(Zt,n.__scopeMenu),i=g.useRef(null),c=it(r,i);return g.useEffect(()=>{const f=i.current;if(f)return gy(f)},[]),m.jsx(id,{...n,ref:c,trapFocus:o.open,disableOutsidePointerEvents:o.open,disableOutsideScroll:!0,onFocusOutside:Ce(n.onFocusOutside,f=>f.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>o.onOpenChange(!1)})}),PA=g.forwardRef((n,r)=>{const o=Wa(Zt,n.__scopeMenu);return m.jsx(id,{...n,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>o.onOpenChange(!1)})}),JA=to("MenuContent.ScrollLock"),id=g.forwardRef((n,r)=>{const{__scopeMenu:o,loop:i=!1,trapFocus:c,onOpenAutoFocus:f,onCloseAutoFocus:d,disableOutsidePointerEvents:h,onEntryFocus:y,onEscapeKeyDown:p,onPointerDownOutside:x,onFocusOutside:b,onInteractOutside:S,onDismiss:E,disableOutsideScroll:A,...C}=n,N=Wa(Zt,o),_=po(Zt,o),H=xs(o),D=ax(o),B=qA(o),[Q,W]=g.useState(null),X=g.useRef(null),q=it(r,X,N.onContentChange),ne=g.useRef(0),ce=g.useRef(""),me=g.useRef(0),re=g.useRef(null),ge=g.useRef("right"),fe=g.useRef(0),de=A?Vf:g.Fragment,j=A?{as:JA,allowPinchZoom:!0}:void 0,Z=z=>{const G=ce.current+z,R=B().filter(le=>!le.disabled),U=document.activeElement,V=R.find(le=>le.ref.current===U)?.textValue,P=R.map(le=>le.textValue),I=cT(P,G,V),ae=R.find(le=>le.textValue===I)?.ref.current;(function le(De){ce.current=De,window.clearTimeout(ne.current),De!==""&&(ne.current=window.setTimeout(()=>le(""),1e3))})(G),ae&&setTimeout(()=>ae.focus())};g.useEffect(()=>()=>window.clearTimeout(ne.current),[]),iy();const ee=g.useCallback(z=>ge.current===re.current?.side&&fT(z,re.current?.area),[]);return m.jsx(ZA,{scope:o,searchRef:ce,onItemEnter:g.useCallback(z=>{ee(z)&&z.preventDefault()},[ee]),onItemLeave:g.useCallback(z=>{ee(z)||(X.current?.focus(),W(null))},[ee]),onTriggerLeave:g.useCallback(z=>{ee(z)&&z.preventDefault()},[ee]),pointerGraceTimerRef:me,onPointerGraceIntentChange:g.useCallback(z=>{re.current=z},[]),children:m.jsx(de,{...j,children:m.jsx(Yf,{asChild:!0,trapped:c,onMountAutoFocus:Ce(f,z=>{z.preventDefault(),X.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:d,children:m.jsx(Gf,{asChild:!0,disableOutsidePointerEvents:h,onEscapeKeyDown:p,onPointerDownOutside:x,onFocusOutside:b,onInteractOutside:S,onDismiss:E,children:m.jsx(LA,{asChild:!0,...D,dir:_.dir,orientation:"vertical",loop:i,currentTabStopId:Q,onCurrentTabStopIdChange:W,onEntryFocus:Ce(y,z=>{_.isUsingKeyboardRef.current||z.preventDefault()}),preventScrollOnEntryFocus:!0,children:m.jsx(CA,{role:"menu","aria-orientation":"vertical","data-state":Ex(N.open),"data-radix-menu-content":"",dir:_.dir,...H,...C,ref:q,style:{outline:"none",...C.style},onKeyDown:Ce(C.onKeyDown,z=>{const R=z.target.closest("[data-radix-menu-content]")===z.currentTarget,U=z.ctrlKey||z.altKey||z.metaKey,V=z.key.length===1;R&&(z.key==="Tab"&&z.preventDefault(),!U&&V&&Z(z.key));const P=X.current;if(z.target!==P||!BA.includes(z.key))return;z.preventDefault();const ae=B().filter(le=>!le.disabled).map(le=>le.ref.current);tx.includes(z.key)&&ae.reverse(),iT(ae)}),onBlur:Ce(n.onBlur,z=>{z.currentTarget.contains(z.target)||(window.clearTimeout(ne.current),ce.current="")}),onPointerMove:Ce(n.onPointerMove,lo(z=>{const G=z.target,R=fe.current!==z.clientX;if(z.currentTarget.contains(G)&&R){const U=z.clientX>fe.current?"right":"left";ge.current=U,fe.current=z.clientX}}))})})})})})})});ix.displayName=Zt;var IA="MenuGroup",sd=g.forwardRef((n,r)=>{const{__scopeMenu:o,...i}=n;return m.jsx(at.div,{role:"group",...i,ref:r})});sd.displayName=IA;var WA="MenuLabel",sx=g.forwardRef((n,r)=>{const{__scopeMenu:o,...i}=n;return m.jsx(at.div,{...i,ref:r})});sx.displayName=WA;var is="MenuItem",yv="menu.itemSelect",ws=g.forwardRef((n,r)=>{const{disabled:o=!1,onSelect:i,...c}=n,f=g.useRef(null),d=po(is,n.__scopeMenu),h=od(is,n.__scopeMenu),y=it(r,f),p=g.useRef(!1),x=()=>{const b=f.current;if(!o&&b){const S=new CustomEvent(yv,{bubbles:!0,cancelable:!0});b.addEventListener(yv,E=>i?.(E),{once:!0}),ay(b,S),S.defaultPrevented?p.current=!1:d.onClose()}};return m.jsx(cx,{...c,ref:y,disabled:o,onClick:Ce(n.onClick,x),onPointerDown:b=>{n.onPointerDown?.(b),p.current=!0},onPointerUp:Ce(n.onPointerUp,b=>{p.current||b.currentTarget?.click()}),onKeyDown:Ce(n.onKeyDown,b=>{const S=h.searchRef.current!=="";o||S&&b.key===" "||Tf.includes(b.key)&&(b.currentTarget.click(),b.preventDefault())})})});ws.displayName=is;var cx=g.forwardRef((n,r)=>{const{__scopeMenu:o,disabled:i=!1,textValue:c,...f}=n,d=od(is,o),h=ax(o),y=g.useRef(null),p=it(r,y),[x,b]=g.useState(!1),[S,E]=g.useState("");return g.useEffect(()=>{const A=y.current;A&&E((A.textContent??"").trim())},[f.children]),m.jsx(ao.ItemSlot,{scope:o,disabled:i,textValue:c??S,children:m.jsx(UA,{asChild:!0,...h,focusable:!i,children:m.jsx(at.div,{role:"menuitem","data-highlighted":x?"":void 0,"aria-disabled":i||void 0,"data-disabled":i?"":void 0,...f,ref:p,onPointerMove:Ce(n.onPointerMove,lo(A=>{i?d.onItemLeave(A):(d.onItemEnter(A),A.defaultPrevented||A.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ce(n.onPointerLeave,lo(A=>d.onItemLeave(A))),onFocus:Ce(n.onFocus,()=>b(!0)),onBlur:Ce(n.onBlur,()=>b(!1))})})})}),eT="MenuCheckboxItem",ux=g.forwardRef((n,r)=>{const{checked:o=!1,onCheckedChange:i,...c}=n;return m.jsx(px,{scope:n.__scopeMenu,checked:o,children:m.jsx(ws,{role:"menuitemcheckbox","aria-checked":ss(o)?"mixed":o,...c,ref:r,"data-state":ud(o),onSelect:Ce(c.onSelect,()=>i?.(ss(o)?!0:!o),{checkForDefaultPrevented:!1})})})});ux.displayName=eT;var fx="MenuRadioGroup",[tT,nT]=Ia(fx,{value:void 0,onValueChange:()=>{}}),dx=g.forwardRef((n,r)=>{const{value:o,onValueChange:i,...c}=n,f=Hn(i);return m.jsx(tT,{scope:n.__scopeMenu,value:o,onValueChange:f,children:m.jsx(sd,{...c,ref:r})})});dx.displayName=fx;var mx="MenuRadioItem",hx=g.forwardRef((n,r)=>{const{value:o,...i}=n,c=nT(mx,n.__scopeMenu),f=o===c.value;return m.jsx(px,{scope:n.__scopeMenu,checked:f,children:m.jsx(ws,{role:"menuitemradio","aria-checked":f,...i,ref:r,"data-state":ud(f),onSelect:Ce(i.onSelect,()=>c.onValueChange?.(o),{checkForDefaultPrevented:!1})})})});hx.displayName=mx;var cd="MenuItemIndicator",[px,aT]=Ia(cd,{checked:!1}),gx=g.forwardRef((n,r)=>{const{__scopeMenu:o,forceMount:i,...c}=n,f=aT(cd,o);return m.jsx(Na,{present:i||ss(f.checked)||f.checked===!0,children:m.jsx(at.span,{...c,ref:r,"data-state":ud(f.checked)})})});gx.displayName=cd;var lT="MenuSeparator",vx=g.forwardRef((n,r)=>{const{__scopeMenu:o,...i}=n;return m.jsx(at.div,{role:"separator","aria-orientation":"horizontal",...i,ref:r})});vx.displayName=lT;var rT="MenuArrow",yx=g.forwardRef((n,r)=>{const{__scopeMenu:o,...i}=n,c=xs(o);return m.jsx(NA,{...c,...i,ref:r})});yx.displayName=rT;var oT="MenuSub",[JM,bx]=Ia(oT),Jr="MenuSubTrigger",xx=g.forwardRef((n,r)=>{const o=Wa(Jr,n.__scopeMenu),i=po(Jr,n.__scopeMenu),c=bx(Jr,n.__scopeMenu),f=od(Jr,n.__scopeMenu),d=g.useRef(null),{pointerGraceTimerRef:h,onPointerGraceIntentChange:y}=f,p={__scopeMenu:n.__scopeMenu},x=g.useCallback(()=>{d.current&&window.clearTimeout(d.current),d.current=null},[]);return g.useEffect(()=>x,[x]),g.useEffect(()=>{const b=h.current;return()=>{window.clearTimeout(b),y(null)}},[h,y]),m.jsx(ld,{asChild:!0,...p,children:m.jsx(cx,{id:c.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":c.contentId,"data-state":Ex(o.open),...n,ref:ms(r,c.onTriggerChange),onClick:b=>{n.onClick?.(b),!(n.disabled||b.defaultPrevented)&&(b.currentTarget.focus(),o.open||o.onOpenChange(!0))},onPointerMove:Ce(n.onPointerMove,lo(b=>{f.onItemEnter(b),!b.defaultPrevented&&!n.disabled&&!o.open&&!d.current&&(f.onPointerGraceIntentChange(null),d.current=window.setTimeout(()=>{o.onOpenChange(!0),x()},100))})),onPointerLeave:Ce(n.onPointerLeave,lo(b=>{x();const S=o.content?.getBoundingClientRect();if(S){const E=o.content?.dataset.side,A=E==="right",C=A?-5:5,N=S[A?"left":"right"],_=S[A?"right":"left"];f.onPointerGraceIntentChange({area:[{x:b.clientX+C,y:b.clientY},{x:N,y:S.top},{x:_,y:S.top},{x:_,y:S.bottom},{x:N,y:S.bottom}],side:E}),window.clearTimeout(h.current),h.current=window.setTimeout(()=>f.onPointerGraceIntentChange(null),300)}else{if(f.onTriggerLeave(b),b.defaultPrevented)return;f.onPointerGraceIntentChange(null)}})),onKeyDown:Ce(n.onKeyDown,b=>{const S=f.searchRef.current!=="";n.disabled||S&&b.key===" "||GA[i.dir].includes(b.key)&&(o.onOpenChange(!0),o.content?.focus(),b.preventDefault())})})})});xx.displayName=Jr;var wx="MenuSubContent",Sx=g.forwardRef((n,r)=>{const o=rx(Zt,n.__scopeMenu),{forceMount:i=o.forceMount,...c}=n,f=Wa(Zt,n.__scopeMenu),d=po(Zt,n.__scopeMenu),h=bx(wx,n.__scopeMenu),y=g.useRef(null),p=it(r,y);return m.jsx(ao.Provider,{scope:n.__scopeMenu,children:m.jsx(Na,{present:i||f.open,children:m.jsx(ao.Slot,{scope:n.__scopeMenu,children:m.jsx(id,{id:h.contentId,"aria-labelledby":h.triggerId,...c,ref:p,align:"start",side:d.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:x=>{d.isUsingKeyboardRef.current&&y.current?.focus(),x.preventDefault()},onCloseAutoFocus:x=>x.preventDefault(),onFocusOutside:Ce(n.onFocusOutside,x=>{x.target!==h.trigger&&f.onOpenChange(!1)}),onEscapeKeyDown:Ce(n.onEscapeKeyDown,x=>{d.onClose(),x.preventDefault()}),onKeyDown:Ce(n.onKeyDown,x=>{const b=x.currentTarget.contains(x.target),S=YA[d.dir].includes(x.key);b&&S&&(f.onOpenChange(!1),h.trigger?.focus(),x.preventDefault())})})})})})});Sx.displayName=wx;function Ex(n){return n?"open":"closed"}function ss(n){return n==="indeterminate"}function ud(n){return ss(n)?"indeterminate":n?"checked":"unchecked"}function iT(n){const r=document.activeElement;for(const o of n)if(o===r||(o.focus(),document.activeElement!==r))return}function sT(n,r){return n.map((o,i)=>n[(r+i)%n.length])}function cT(n,r,o){const c=r.length>1&&Array.from(r).every(p=>p===r[0])?r[0]:r,f=o?n.indexOf(o):-1;let d=sT(n,Math.max(f,0));c.length===1&&(d=d.filter(p=>p!==o));const y=d.find(p=>p.toLowerCase().startsWith(c.toLowerCase()));return y!==o?y:void 0}function uT(n,r){const{x:o,y:i}=n;let c=!1;for(let f=0,d=r.length-1;f<r.length;d=f++){const h=r[f],y=r[d],p=h.x,x=h.y,b=y.x,S=y.y;x>i!=S>i&&o<(b-p)*(i-x)/(S-x)+p&&(c=!c)}return c}function fT(n,r){if(!r)return!1;const o={x:n.clientX,y:n.clientY};return uT(o,r)}function lo(n){return r=>r.pointerType==="mouse"?n(r):void 0}var dT=lx,mT=ld,hT=ox,pT=ix,gT=sd,vT=sx,yT=ws,bT=ux,xT=dx,wT=hx,ST=gx,ET=vx,CT=yx,NT=xx,RT=Sx,Ss="DropdownMenu",[AT]=Pa(Ss,[nx]),vt=nx(),[TT,Cx]=AT(Ss),Nx=n=>{const{__scopeDropdownMenu:r,children:o,dir:i,open:c,defaultOpen:f,onOpenChange:d,modal:h=!0}=n,y=vt(r),p=g.useRef(null),[x,b]=Bf({prop:c,defaultProp:f??!1,onChange:d,caller:Ss});return m.jsx(TT,{scope:r,triggerId:$l(),triggerRef:p,contentId:$l(),open:x,onOpenChange:b,onOpenToggle:g.useCallback(()=>b(S=>!S),[b]),modal:h,children:m.jsx(dT,{...y,open:x,onOpenChange:b,dir:i,modal:h,children:o})})};Nx.displayName=Ss;var Rx="DropdownMenuTrigger",Ax=g.forwardRef((n,r)=>{const{__scopeDropdownMenu:o,disabled:i=!1,...c}=n,f=Cx(Rx,o),d=vt(o);return m.jsx(mT,{asChild:!0,...d,children:m.jsx(at.button,{type:"button",id:f.triggerId,"aria-haspopup":"menu","aria-expanded":f.open,"aria-controls":f.open?f.contentId:void 0,"data-state":f.open?"open":"closed","data-disabled":i?"":void 0,disabled:i,...c,ref:ms(r,f.triggerRef),onPointerDown:Ce(n.onPointerDown,h=>{!i&&h.button===0&&h.ctrlKey===!1&&(f.onOpenToggle(),f.open||h.preventDefault())}),onKeyDown:Ce(n.onKeyDown,h=>{i||(["Enter"," "].includes(h.key)&&f.onOpenToggle(),h.key==="ArrowDown"&&f.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(h.key)&&h.preventDefault())})})})});Ax.displayName=Rx;var _T="DropdownMenuPortal",Tx=n=>{const{__scopeDropdownMenu:r,...o}=n,i=vt(r);return m.jsx(hT,{...i,...o})};Tx.displayName=_T;var _x="DropdownMenuContent",Mx=g.forwardRef((n,r)=>{const{__scopeDropdownMenu:o,...i}=n,c=Cx(_x,o),f=vt(o),d=g.useRef(!1);return m.jsx(pT,{id:c.contentId,"aria-labelledby":c.triggerId,...f,...i,ref:r,onCloseAutoFocus:Ce(n.onCloseAutoFocus,h=>{d.current||c.triggerRef.current?.focus(),d.current=!1,h.preventDefault()}),onInteractOutside:Ce(n.onInteractOutside,h=>{const y=h.detail.originalEvent,p=y.button===0&&y.ctrlKey===!0,x=y.button===2||p;(!c.modal||x)&&(d.current=!0)}),style:{...n.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Mx.displayName=_x;var MT="DropdownMenuGroup",jT=g.forwardRef((n,r)=>{const{__scopeDropdownMenu:o,...i}=n,c=vt(o);return m.jsx(gT,{...c,...i,ref:r})});jT.displayName=MT;var OT="DropdownMenuLabel",jx=g.forwardRef((n,r)=>{const{__scopeDropdownMenu:o,...i}=n,c=vt(o);return m.jsx(vT,{...c,...i,ref:r})});jx.displayName=OT;var DT="DropdownMenuItem",Ox=g.forwardRef((n,r)=>{const{__scopeDropdownMenu:o,...i}=n,c=vt(o);return m.jsx(yT,{...c,...i,ref:r})});Ox.displayName=DT;var zT="DropdownMenuCheckboxItem",kT=g.forwardRef((n,r)=>{const{__scopeDropdownMenu:o,...i}=n,c=vt(o);return m.jsx(bT,{...c,...i,ref:r})});kT.displayName=zT;var LT="DropdownMenuRadioGroup",UT=g.forwardRef((n,r)=>{const{__scopeDropdownMenu:o,...i}=n,c=vt(o);return m.jsx(xT,{...c,...i,ref:r})});UT.displayName=LT;var HT="DropdownMenuRadioItem",BT=g.forwardRef((n,r)=>{const{__scopeDropdownMenu:o,...i}=n,c=vt(o);return m.jsx(wT,{...c,...i,ref:r})});BT.displayName=HT;var GT="DropdownMenuItemIndicator",YT=g.forwardRef((n,r)=>{const{__scopeDropdownMenu:o,...i}=n,c=vt(o);return m.jsx(ST,{...c,...i,ref:r})});YT.displayName=GT;var qT="DropdownMenuSeparator",Dx=g.forwardRef((n,r)=>{const{__scopeDropdownMenu:o,...i}=n,c=vt(o);return m.jsx(ET,{...c,...i,ref:r})});Dx.displayName=qT;var VT="DropdownMenuArrow",$T=g.forwardRef((n,r)=>{const{__scopeDropdownMenu:o,...i}=n,c=vt(o);return m.jsx(CT,{...c,...i,ref:r})});$T.displayName=VT;var XT="DropdownMenuSubTrigger",KT=g.forwardRef((n,r)=>{const{__scopeDropdownMenu:o,...i}=n,c=vt(o);return m.jsx(NT,{...c,...i,ref:r})});KT.displayName=XT;var QT="DropdownMenuSubContent",ZT=g.forwardRef((n,r)=>{const{__scopeDropdownMenu:o,...i}=n,c=vt(o);return m.jsx(RT,{...c,...i,ref:r,style:{...n.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ZT.displayName=QT;var FT=Nx,PT=Ax,JT=Tx,zx=Mx,kx=jx,Lx=Ox,Ux=Dx;const IT=FT,WT=PT,Hx=g.forwardRef(({className:n,sideOffset:r=4,...o},i)=>m.jsx(JT,{children:m.jsx(zx,{ref:i,sideOffset:r,className:an("z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...o})}));Hx.displayName=zx.displayName;const cs=g.forwardRef(({className:n,inset:r,...o},i)=>m.jsx(Lx,{ref:i,className:an("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r&&"pl-8",n),...o}));cs.displayName=Lx.displayName;const e_=g.forwardRef(({className:n,inset:r,...o},i)=>m.jsx(kx,{ref:i,className:an("px-2 py-1.5 text-sm font-semibold",r&&"pl-8",n),...o}));e_.displayName=kx.displayName;const Es=g.forwardRef(({className:n,...r},o)=>m.jsx(Ux,{ref:o,className:an("-mx-1 my-1 h-px bg-muted",n),...r}));Es.displayName=Ux.displayName;const Qt=g.forwardRef(({className:n,variant:r="default",size:o="default",...i},c)=>m.jsx("button",{className:an("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50",{"bg-primary text-primary-foreground hover:bg-primary/90":r==="default","border border-border bg-background hover:bg-accent hover:text-accent-foreground":r==="outline","hover:bg-accent hover:text-accent-foreground":r==="ghost","text-primary underline-offset-4 hover:underline":r==="link"},{"h-10 px-4 py-2":o==="default","h-9 rounded-md px-3":o==="sm","h-11 rounded-md px-8":o==="lg","h-10 w-10":o==="icon"},n),ref:c,...i}));Qt.displayName="Button";function Bx({icon:n,label:r,title:o,variant:i="default",compact:c,state:f,disabled:d,children:h,errorSlot:y,align:p="end",contentClass:x,onOpenChange:b}){const S=f??"idle",E=i==="menuItem",A=c?"h-3.5 w-3.5":"h-4 w-4",C=c?"h-7 w-7":"h-8 w-8",N=S==="done"?bN:S==="error"?Za:S==="loading"?Ji:n,_=S==="done"?"text-green-500":S==="error"?"text-red-500":"",H=E?m.jsxs("button",{className:"flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-accent transition-colors w-full text-left",disabled:d||S==="loading",children:[m.jsx(N,{className:`h-4 w-4 shrink-0 ${_} ${S==="loading"?"animate-spin":""}`}),r]}):m.jsx(Qt,{variant:"ghost",size:"icon",className:`${C} ${_||(i==="header"?"text-zinc-300 hover:text-white hover:bg-white/10":"text-muted-foreground hover:text-foreground")}`,disabled:d||S==="loading",title:o,children:m.jsx(N,{className:`${A} ${S==="loading"?"animate-spin":""}`})});return m.jsxs(IT,{onOpenChange:b,children:[m.jsx(WT,{asChild:!0,children:H}),m.jsxs(Hx,{align:p,className:x,children:[y&&m.jsxs(m.Fragment,{children:[y,m.jsx(Es,{})]}),h]})]})}function Gx({message:n}){return n?m.jsx("div",{className:"px-2 py-1.5 text-xs text-red-500 bg-red-500/10 rounded mx-1 mb-1",children:n}):null}function Yx(n,r){const[o,i]=g.useState("idle"),[c,f]=g.useState(null),d=p=>{i(p),r?.(p)};return{state:o,errorMsg:c,handleAction:async p=>{d("loading"),f(null);try{await p(),d("done"),setTimeout(()=>d("idle"),1500)}catch(x){const b=x instanceof Error?x.message:"Action failed";f(b),d("error"),n?.(b)}},resetOnClose:p=>{!p&&o==="error"&&(d("idle"),f(null))}}}function t_(n,r,o){const i=[];if(o||!r)return i.push({label:"ZIP",href:`/api/export/${n}?format=zip`,filename:`${n.split("/").pop()??"archive"}.zip`}),i;const c=r.fileName.replace(/\.[^.]+$/,"");return i.push({label:"Raw",href:`/api/raw/${n}`,filename:r.fileName}),(r.type==="markdown"||r.type===".md")&&(i.push({label:"PDF",href:`/api/export/${n}?format=pdf`,filename:`${c}.pdf`}),i.push({label:"DOCX",href:`/api/export/${n}?format=docx`,filename:`${c}.docx`})),(r.type==="mermaid"||r.type===".mmd")&&(i.push({label:"SVG",href:`/api/mermaid-export/${n}?format=svg`,filename:`${c}.svg`}),i.push({label:"PNG",href:`/api/mermaid-export/${n}?format=png`,filename:`${c}.png`}),i.push({label:"PDF",href:`/api/mermaid-export/${n}?format=pdf`,filename:`${c}.pdf`})),(r.type==="plantuml"||[".puml",".plantuml",".pu"].includes(r.type))&&(i.push({label:"SVG",href:`/api/plantuml-export/${n}?format=svg`,filename:`${c}.svg`}),i.push({label:"PNG",href:`/api/plantuml-export/${n}?format=png`,filename:`${c}.png`}),i.push({label:"PDF",href:`/api/plantuml-export/${n}?format=pdf`,filename:`${c}.pdf`}),i.push({label:"EPS",href:`/api/plantuml-export/${n}?format=eps`,filename:`${c}.eps`})),i}async function n_(n,r){const o=await fetch(Jl(n),{credentials:"include"});if(!o.ok){const d=await o.text().catch(()=>"");throw new Error(d||`Download failed (${String(o.status)})`)}const i=await o.blob(),c=URL.createObjectURL(i),f=document.createElement("a");f.href=c,f.download=r,document.body.appendChild(f),f.click(),document.body.removeChild(f),URL.revokeObjectURL(c)}function Ir({reqPath:n,file:r,isDirectory:o,isInsider:i,compact:c,variant:f="default",onError:d,onStateChange:h}){const{state:y,errorMsg:p,handleAction:x,resetOnClose:b}=Yx(E=>{d?.(E),alert(`Download failed: ${E}`)},h),S=t_(n,r,o);return S.length===0?null:m.jsxs(Bx,{icon:EN,label:"Download",title:"Download",variant:f,compact:c,state:y,onOpenChange:b,errorSlot:m.jsx(Gx,{message:p}),children:[S.map(E=>m.jsx(cs,{onSelect:()=>{x(()=>n_(E.href,E.filename))},className:"cursor-pointer",children:E.label},E.label)),i&&!o&&m.jsxs(m.Fragment,{children:[m.jsx(Es,{}),m.jsx(cs,{onSelect:()=>{x(async()=>{await gE(n)})},className:"cursor-pointer text-muted-foreground",children:"Clear Cache"})]})]})}async function a_(n,r,o,i){let c;if(r.expiry){const p=r.expiry.match(/^(\d+)([hdw])$/i);if(p){const x=parseInt(p[1],10),b=p[2].toLowerCase(),S={h:36e5,d:864e5,w:6048e5};c=String(Date.now()+x*S[b])}}const f=!i&&r.depth>0?r.depth:void 0,d=!i&&r.dirs?!0:void 0,h=await dE(n,c,f,d);if(!h.url)throw new Error("No URL returned");let y=window.location.origin+h.url;if(o==="raw"){const p=new URL(y);p.pathname=p.pathname.replace("/browse/","/api/raw/"),y=p.toString()}else o==="event"&&(y=window.location.origin+"/event?key="+h.url.split("key=")[1]);await navigator.clipboard.writeText(y)}const l_=[{label:"Never",value:""},{label:"1 hour",value:"1h"},{label:"24 hours",value:"24h"},{label:"7 days",value:"7d"},{label:"30 days",value:"30d"}];function us({path:n,shareSettings:r,onShareSettingsChange:o,showEvent:i,showRaw:c,compact:f,isDirectory:d,variant:h="default",onError:y,onStateChange:p}){const{state:x,errorMsg:b,handleAction:S,resetOnClose:E}=Yx(y,p),A=[{label:"Page",type:"page"}];return c&&A.push({label:"Raw",type:"raw"}),i&&A.push({label:"Event",type:"event"}),m.jsxs(Bx,{icon:jN,label:"Share",title:"Copy share link",variant:h,compact:f,state:x,contentClass:"w-52",onOpenChange:E,errorSlot:m.jsx(Gx,{message:b}),children:[A.map(C=>m.jsxs(cs,{onSelect:()=>{S(()=>a_(n,r,C.type,d))},className:"cursor-pointer",children:["Copy ",C.label," Link"]},C.type)),m.jsx(Es,{}),m.jsxs("div",{className:"px-2 py-1 flex items-center justify-between gap-2",children:[m.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"Expires"}),m.jsx("select",{className:"text-xs bg-popover text-popover-foreground border border-border rounded px-1 py-0.5 focus:outline-none focus:ring-1 focus:ring-ring min-w-0",value:r.expiry,onChange:C=>o({...r,expiry:C.target.value}),onClick:C=>C.stopPropagation(),children:l_.map(C=>m.jsx("option",{value:C.value,children:C.label},C.value))})]}),!d&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"px-2 py-1 flex items-center justify-between gap-2",children:[m.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"Depth"}),m.jsx("input",{type:"number",min:0,max:10,className:"text-xs bg-popover text-popover-foreground border border-border rounded px-1 py-0.5 w-14 text-right focus:outline-none focus:ring-1 focus:ring-ring",value:r.depth,onChange:C=>o({...r,depth:Math.max(0,parseInt(C.target.value,10)||0)}),onClick:C=>C.stopPropagation()})]}),m.jsxs("div",{className:"px-2 py-1 flex items-center justify-between gap-2",children:[m.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"Directories"}),m.jsx("input",{type:"checkbox",className:"rounded border-border",checked:r.dirs,onChange:C=>o({...r,dirs:C.target.checked}),onClick:C=>C.stopPropagation()})]})]})]})}function r_(n){if(n===null)return"-";if(n===0)return"0 B";const r=["B","KB","MB","GB"],o=Math.floor(Math.log(n)/Math.log(1024)),i=n/Math.pow(1024,o);return`${i<10?i.toFixed(1):Math.round(i)} ${r[o]}`}function o_({entry:n,basePath:r,isInsider:o,shareSettings:i,onShareSettingsChange:c}){const f=r?`${r}/${n.name}`:n.name,d=n.type==="directory",h=!d,y=`/${f}`,p=d?"Directory":n.ext?n.ext.slice(1).toUpperCase():"File";return m.jsxs("tr",{className:"border-b border-border last:border-0 hover:bg-accent/50 transition-colors",children:[m.jsx("td",{className:"px-4 py-2.5",children:m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsxs(Ln,{to:`/browse/${f}`,className:"text-blue-500 hover:underline flex items-center gap-2 min-w-0",children:[d?m.jsx(AN,{className:"h-4 w-4 text-yellow-500 shrink-0"}):m.jsx(Sb,{className:"h-4 w-4 text-zinc-400 shrink-0"}),m.jsx("span",{className:"truncate",children:n.name})]}),o&&m.jsxs("div",{className:"ml-auto flex items-center gap-0.5 shrink-0",children:[m.jsx(us,{path:y,shareSettings:i,onShareSettingsChange:c,showRaw:h,compact:!0,isDirectory:d}),m.jsx(Ir,{reqPath:f,file:d?null:{fileName:n.name,type:n.ext},isDirectory:d,isInsider:o,compact:!0})]})]})}),m.jsx("td",{className:"px-4 py-2.5 text-muted-foreground text-sm",children:p}),m.jsx("td",{className:"px-4 py-2.5 text-muted-foreground text-sm",children:r_(n.size)}),m.jsx("td",{className:"px-4 py-2.5 text-muted-foreground text-sm",children:n.mtime??"-"})]})}function i_({entries:n,basePath:r,isInsider:o,shareSettings:i,onShareSettingsChange:c}){return m.jsxs("div",{children:[m.jsxs("p",{className:"text-muted-foreground text-sm mb-4",children:[n.length," items"]}),m.jsx("div",{className:"bg-muted/50 rounded-lg overflow-hidden border border-border",children:m.jsxs("table",{className:"w-full",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"border-b border-border",children:[m.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Name"}),m.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Type"}),m.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Size"}),m.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Modified"})]})}),m.jsx("tbody",{children:n.map(f=>m.jsx(o_,{entry:f,basePath:r,isInsider:o,shareSettings:i,onShareSettingsChange:c},f.name))})]})})]})}function s_({drives:n,isInsider:r,shareSettings:o,onShareSettingsChange:i}){return m.jsxs("div",{children:[m.jsxs("p",{className:"text-muted-foreground text-sm mb-4",children:[n.length," drives"]}),m.jsx("div",{className:"bg-muted/50 rounded-lg overflow-hidden border border-border",children:m.jsxs("table",{className:"w-full",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"border-b border-border",children:[m.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Name"}),m.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Type"})]})}),m.jsx("tbody",{children:n.map(c=>{const f=`/${c.letter.toLowerCase()}`;return m.jsxs("tr",{className:"border-b border-border last:border-0 hover:bg-accent/50 transition-colors",children:[m.jsx("td",{className:"px-4 py-2.5",children:m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsxs(Ln,{to:`/browse/${c.letter.toLowerCase()}`,className:"text-blue-500 hover:underline flex items-center gap-2 min-w-0",children:["💾 ",c.letter,":\\",c.label?` (${c.label})`:""]}),r&&m.jsx("div",{className:"ml-auto flex items-center gap-0.5 shrink-0",children:m.jsx(us,{path:f,shareSettings:o,onShareSettingsChange:i,compact:!0,isDirectory:!0})})]})}),m.jsx("td",{className:"px-4 py-2.5 text-muted-foreground text-sm",children:"Drive"})]},c.letter)})})]})})]})}const c_="modulepreload",u_=function(n){return"/app/"+n},bv={},nt=function(r,o,i){let c=Promise.resolve();if(o&&o.length>0){let y=function(p){return Promise.all(p.map(x=>Promise.resolve(x).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),h=d?.nonce||d?.getAttribute("nonce");c=y(o.map(p=>{if(p=u_(p),p in bv)return;bv[p]=!0;const x=p.endsWith(".css"),b=x?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${b}`))return;const S=document.createElement("link");if(S.rel=x?"stylesheet":c_,x||(S.as="script"),S.crossOrigin="",S.href=p,h&&S.setAttribute("nonce",h),document.head.appendChild(S),x)return new Promise((E,A)=>{S.addEventListener("load",E),S.addEventListener("error",()=>A(new Error(`Unable to preload CSS for ${p}`)))})}))}function f(d){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=d,window.dispatchEvent(h),!h.defaultPrevented)throw d}return c.then(d=>{for(const h of d||[])h.status==="rejected"&&f(h.reason);return r().catch(f)})};var ot=function(){return ot=Object.assign||function(r){for(var o,i=1,c=arguments.length;i<c;i++){o=arguments[i];for(var f in o)Object.prototype.hasOwnProperty.call(o,f)&&(r[f]=o[f])}return r},ot.apply(this,arguments)};typeof window<"u"&&(window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),typeof window.CustomEvent!="function"&&(window.CustomEvent=function(r,o){o=o||{bubbles:!1,cancelable:!1,detail:null};var i=document.createEvent("CustomEvent");return i.initCustomEvent(r,o.bubbles,o.cancelable,o.detail),i}));var f_=typeof document<"u"&&!!document.documentMode,uf;function d_(){return uf||(uf=document.createElement("div").style)}var xv=["webkit","moz","ms"],Vi={};function fd(n){if(Vi[n])return Vi[n];var r=d_();if(n in r)return Vi[n]=n;for(var o=n[0].toUpperCase()+n.slice(1),i=xv.length;i--;){var c="".concat(xv[i]).concat(o);if(c in r)return Vi[n]=c}}function $i(n,r){return parseFloat(r[fd(n)])||0}function Xi(n,r,o){o===void 0&&(o=window.getComputedStyle(n));var i=r==="border"?"Width":"";return{left:$i("".concat(r,"Left").concat(i),o),right:$i("".concat(r,"Right").concat(i),o),top:$i("".concat(r,"Top").concat(i),o),bottom:$i("".concat(r,"Bottom").concat(i),o)}}function ql(n,r,o){n.style[fd(r)]=o}function m_(n,r){var o=fd("transform");ql(n,"transition","".concat(o," ").concat(r.duration,"ms ").concat(r.easing))}function h_(n,r,o){var i=r.x,c=r.y,f=r.scale,d=r.isSVG;if(ql(n,"transform","scale(".concat(f,") translate(").concat(i,"px, ").concat(c,"px)")),d&&f_){var h=window.getComputedStyle(n).getPropertyValue("transform");n.setAttribute("transform",h)}}function ff(n){var r=n.parentNode,o=window.getComputedStyle(n),i=window.getComputedStyle(r),c=n.getBoundingClientRect(),f=r.getBoundingClientRect();return{elem:{style:o,width:c.width,height:c.height,top:c.top,bottom:c.bottom,left:c.left,right:c.right,margin:Xi(n,"margin",o),border:Xi(n,"border",o)},parent:{style:i,width:f.width,height:f.height,top:f.top,bottom:f.bottom,left:f.left,right:f.right,padding:Xi(r,"padding",i),border:Xi(r,"border",i)}}}var ro={down:"mousedown",move:"mousemove",up:"mouseup mouseleave"};typeof window<"u"&&(typeof window.PointerEvent=="function"?ro={down:"pointerdown",move:"pointermove",up:"pointerup pointerleave pointercancel"}:typeof window.TouchEvent=="function"&&(ro={down:"touchstart",move:"touchmove",up:"touchend touchcancel"}));function df(n,r,o,i){ro[n].split(" ").forEach(function(c){r.addEventListener(c,o,i)})}function mf(n,r,o){ro[n].split(" ").forEach(function(i){r.removeEventListener(i,o)})}function qx(n,r){for(var o=n.length;o--;)if(n[o].pointerId===r.pointerId)return o;return-1}function _f(n,r){var o;if(r.touches){o=0;for(var i=0,c=r.touches;i<c.length;i++){var f=c[i];f.pointerId=o++,_f(n,f)}return}o=qx(n,r),o>-1&&n.splice(o,1),n.push(r)}function p_(n,r){if(r.touches){for(;n.length;)n.pop();return}var o=qx(n,r);o>-1&&n.splice(o,1)}function wv(n){n=n.slice(0);for(var r=n.pop(),o;o=n.pop();)r={clientX:(o.clientX-r.clientX)/2+r.clientX,clientY:(o.clientY-r.clientY)/2+r.clientY};return r}function hf(n){if(n.length<2)return 0;var r=n[0],o=n[1];return Math.sqrt(Math.pow(Math.abs(o.clientX-r.clientX),2)+Math.pow(Math.abs(o.clientY-r.clientY),2))}function g_(n){for(var r=n;r&&r.parentNode;){if(r.parentNode===document)return!0;r=r.parentNode instanceof ShadowRoot?r.parentNode.host:r.parentNode}return!1}function v_(n){return(n.getAttribute("class")||"").trim()}function y_(n,r){return n.nodeType===1&&" ".concat(v_(n)," ").indexOf(" ".concat(r," "))>-1}function b_(n,r){for(var o=n;o!=null;o=o.parentNode)if(y_(o,r.excludeClass)||r.exclude.indexOf(o)>-1)return!0;return!1}var x_=/^http:[\w\.\/]+svg$/;function w_(n){return x_.test(n.namespaceURI)&&n.nodeName.toLowerCase()!=="svg"}function S_(n){var r={};for(var o in n)n.hasOwnProperty(o)&&(r[o]=n[o]);return r}var Vx={animate:!1,canvas:!1,cursor:"move",disablePan:!1,disableZoom:!1,disableXAxis:!1,disableYAxis:!1,duration:200,easing:"ease-in-out",exclude:[],excludeClass:"panzoom-exclude",handleStartEvent:function(n){n.preventDefault(),n.stopPropagation()},maxScale:4,minScale:.125,overflow:"hidden",panOnlyWhenZoomed:!1,pinchAndPan:!1,relative:!1,setTransform:h_,startX:0,startY:0,startScale:1,step:.3,touchAction:"none"};function Vl(n,r){if(!n)throw new Error("Panzoom requires an element as an argument");if(n.nodeType!==1)throw new Error("Panzoom requires an element with a nodeType of 1");if(!g_(n))throw new Error("Panzoom should be called on elements that have been attached to the DOM");r=ot(ot({},Vx),r);var o=w_(n),i=n.parentNode;i.style.overflow=r.overflow,i.style.userSelect="none",i.style.touchAction=r.touchAction,(r.canvas?i:n).style.cursor=r.cursor,n.style.userSelect="none",n.style.touchAction=r.touchAction,ql(n,"transformOrigin",typeof r.origin=="string"?r.origin:o?"0 0":"50% 50%");function c(){i.style.overflow="",i.style.userSelect="",i.style.touchAction="",i.style.cursor="",n.style.cursor="",n.style.userSelect="",n.style.touchAction="",ql(n,"transformOrigin","")}function f(z){z===void 0&&(z={});for(var G in z)z.hasOwnProperty(G)&&(r[G]=z[G]);(z.hasOwnProperty("cursor")||z.hasOwnProperty("canvas"))&&(i.style.cursor=n.style.cursor="",(r.canvas?i:n).style.cursor=r.cursor),z.hasOwnProperty("overflow")&&(i.style.overflow=z.overflow),z.hasOwnProperty("touchAction")&&(i.style.touchAction=z.touchAction,n.style.touchAction=z.touchAction)}var d=0,h=0,y=1,p=!1;C(r.startScale,{animate:!1,force:!0}),setTimeout(function(){A(r.startX,r.startY,{animate:!1,force:!0})});function x(z,G,R){if(!R.silent){var U=new CustomEvent(z,{detail:G});n.dispatchEvent(U)}}function b(z,G,R){var U={x:d,y:h,scale:y,isSVG:o,originalEvent:R};return requestAnimationFrame(function(){typeof G.animate=="boolean"&&(G.animate?m_(n,G):ql(n,"transition","none")),G.setTransform(n,U,G),x(z,U,G),x("panzoomchange",U,G)}),U}function S(z,G,R,U){var V=ot(ot({},r),U),P={x:d,y:h,opts:V};if(!U?.force&&(V.disablePan||V.panOnlyWhenZoomed&&y===V.startScale))return P;if(z=parseFloat(z),G=parseFloat(G),V.disableXAxis||(P.x=(V.relative?d:0)+z),V.disableYAxis||(P.y=(V.relative?h:0)+G),V.contain){var I=ff(n),ae=I.elem.width/y,le=I.elem.height/y,De=ae*R,ye=le*R,te=(De-ae)/2,pe=(ye-le)/2;if(V.contain==="inside"){var be=(-I.elem.margin.left-I.parent.padding.left+te)/R,Se=(I.parent.width-De-I.parent.padding.left-I.elem.margin.left-I.parent.border.left-I.parent.border.right+te)/R;P.x=Math.max(Math.min(P.x,Se),be);var Re=(-I.elem.margin.top-I.parent.padding.top+pe)/R,Xe=(I.parent.height-ye-I.parent.padding.top-I.elem.margin.top-I.parent.border.top-I.parent.border.bottom+pe)/R;P.y=Math.max(Math.min(P.y,Xe),Re)}else if(V.contain==="outside"){var be=(-(De-I.parent.width)-I.parent.padding.left-I.parent.border.left-I.parent.border.right+te)/R,Se=(te-I.parent.padding.left)/R;P.x=Math.max(Math.min(P.x,Se),be);var Re=(-(ye-I.parent.height)-I.parent.padding.top-I.parent.border.top-I.parent.border.bottom+pe)/R,Xe=(pe-I.parent.padding.top)/R;P.y=Math.max(Math.min(P.y,Xe),Re)}}return V.roundPixels&&(P.x=Math.round(P.x),P.y=Math.round(P.y)),P}function E(z,G){var R=ot(ot({},r),G),U={scale:y,opts:R};if(!G?.force&&R.disableZoom)return U;var V=r.minScale,P=r.maxScale;if(R.contain){var I=ff(n),ae=I.elem.width/y,le=I.elem.height/y;if(ae>1&&le>1){var De=I.parent.width-I.parent.border.left-I.parent.border.right,ye=I.parent.height-I.parent.border.top-I.parent.border.bottom,te=De/ae,pe=ye/le;r.contain==="inside"?P=Math.min(P,te,pe):r.contain==="outside"&&(V=Math.max(V,te,pe))}}return U.scale=Math.min(Math.max(z,V),P),U}function A(z,G,R,U){var V=S(z,G,y,R);return d!==V.x||h!==V.y?(d=V.x,h=V.y,b("panzoompan",V.opts,U)):{x:d,y:h,scale:y,isSVG:o,originalEvent:U}}function C(z,G,R){var U=E(z,G),V=U.opts;if(!(!G?.force&&V.disableZoom)){z=U.scale;var P=d,I=h;if(V.focal){var ae=V.focal;P=(ae.x/z-ae.x/y+d*z)/z,I=(ae.y/z-ae.y/y+h*z)/z}var le=S(P,I,z,{relative:!1,force:!0});return d=le.x,h=le.y,y=z,b("panzoomzoom",V,R)}}function N(z,G){var R=ot(ot(ot({},r),{animate:!0}),G);return C(y*Math.exp((z?1:-1)*R.step),R)}function _(z){return N(!0,z)}function H(z){return N(!1,z)}function D(z,G,R,U){var V=ff(n),P={width:V.parent.width-V.parent.padding.left-V.parent.padding.right-V.parent.border.left-V.parent.border.right,height:V.parent.height-V.parent.padding.top-V.parent.padding.bottom-V.parent.border.top-V.parent.border.bottom},I=G.clientX-V.parent.left-V.parent.padding.left-V.parent.border.left-V.elem.margin.left,ae=G.clientY-V.parent.top-V.parent.padding.top-V.parent.border.top-V.elem.margin.top;o||(I-=V.elem.width/y/2,ae-=V.elem.height/y/2);var le={x:I/P.width*(P.width*z),y:ae/P.height*(P.height*z)};return C(z,ot(ot({},R),{animate:!1,focal:le}),U)}function B(z,G){z.preventDefault();var R=ot(ot(ot({},r),G),{animate:!1}),U=z.deltaY===0&&z.deltaX?z.deltaX:z.deltaY,V=U<0?1:-1,P=E(y*Math.exp(V*R.step/3),R).scale;return D(P,z,R,z)}function Q(z){var G=ot(ot(ot({},r),{animate:!0,force:!0}),z);y=E(G.startScale,G).scale;var R=S(G.startX,G.startY,y,G);return d=R.x,h=R.y,b("panzoomreset",G)}var W,X,q,ne,ce,me,re=[];function ge(z){if(!b_(z.target,r)){_f(re,z),p=!0,r.handleStartEvent(z),W=d,X=h,x("panzoomstart",{x:d,y:h,scale:y,isSVG:o,originalEvent:z},r);var G=wv(re);q=G.clientX,ne=G.clientY,ce=y,me=hf(re)}}function fe(z){if(!(!p||W===void 0||X===void 0||q===void 0||ne===void 0)){_f(re,z);var G=wv(re),R=re.length>1,U=y;if(R){me===0&&(me=hf(re));var V=hf(re)-me;U=E(V*r.step/80+ce).scale,D(U,G,{animate:!1},z)}(!R||r.pinchAndPan)&&A(W+(G.clientX-q)/U,X+(G.clientY-ne)/U,{animate:!1},z)}}function de(z){re.length===1&&x("panzoomend",{x:d,y:h,scale:y,isSVG:o,originalEvent:z},r),p_(re,z),p&&(p=!1,W=X=q=ne=void 0)}var j=!1;function Z(){j||(j=!0,df("down",r.canvas?i:n,ge),df("move",document,fe,{passive:!0}),df("up",document,de,{passive:!0}))}function ee(){j=!1,mf("down",r.canvas?i:n,ge),mf("move",document,fe),mf("up",document,de)}return r.noBind||Z(),{bind:Z,destroy:ee,eventNames:ro,getPan:function(){return{x:d,y:h}},getScale:function(){return y},getOptions:function(){return S_(r)},handleDown:ge,handleMove:fe,handleUp:de,pan:A,reset:Q,resetStyle:c,setOptions:f,setStyle:function(z,G){return ql(n,z,G)},zoom:C,zoomIn:_,zoomOut:H,zoomToPoint:D,zoomWithWheel:B}}Vl.defaultOptions=Vx;function $x(n){const o=new DOMParser().parseFromString(n,"image/svg+xml"),i=o.querySelector("svg");if(!i)return n;let c=0,f=0;const d=i.getAttribute("viewBox");if(d){const h=d.split(/[\s,]+/).map(Number);h.length===4&&(c=h[2],f=h[3])}return(c<=0||f<=0)&&(c=parseFloat(i.getAttribute("width")??"0"),f=parseFloat(i.getAttribute("height")??"0")),!i.getAttribute("viewBox")&&c>0&&f>0&&i.setAttribute("viewBox",`0 0 ${c} ${f}`),i.getAttribute("preserveAspectRatio")==="none"&&i.setAttribute("preserveAspectRatio","xMidYMid meet"),i.removeAttribute("height"),i.style.removeProperty("width"),i.style.removeProperty("height"),i.style.removeProperty("background"),i.setAttribute("width","100%"),new XMLSerializer().serializeToString(o)}function E_(n){const r=$x(n),i=new DOMParser().parseFromString(r,"image/svg+xml"),c=i.querySelector("svg");return c?(c.setAttribute("preserveAspectRatio","xMidYMid meet"),c.setAttribute("height","100%"),c.style.display="block",new XMLSerializer().serializeToString(i)):r}function dd({content:n}){const r=g.useRef(null),o=g.useRef(null),i=g.useRef(null),c=g.useRef(null),[f,d]=g.useState(!1),h=g.useMemo(()=>E_(n),[n]),y=g.useCallback(()=>{if(c.current?.(),c.current=null,i.current&&(i.current.destroy(),i.current=null),!o.current||!r.current)return;const p=r.current,x=o.current,b=p.clientWidth,S=p.clientHeight;if(b===0||S===0)return;x.style.width=`${b}px`,x.style.height=`${S}px`;const E=Vl(x,{maxScale:20,minScale:.1,startScale:1});i.current=E;const A=C=>{E.zoomWithWheel(C)};p.addEventListener("wheel",A,{passive:!1}),c.current=()=>p.removeEventListener("wheel",A),d(!0)},[]);return g.useEffect(()=>{const p=r.current;if(!p)return;const x=new ResizeObserver(()=>{y()});return x.observe(p),()=>{x.disconnect(),c.current?.(),i.current?.destroy()}},[h,y]),m.jsx("div",{className:"relative bg-white rounded-lg border border-border overflow-hidden",children:m.jsx("div",{ref:r,className:"overflow-hidden cursor-grab active:cursor-grabbing w-full h-[calc(100vh-8rem)]",children:m.jsx("div",{ref:o,className:f?"":"invisible",dangerouslySetInnerHTML:{__html:h}})})})}function C_({html:n,content:r}){return n?m.jsx(dd,{content:n}):m.jsxs("div",{className:"p-4 bg-red-950/20 border border-red-800 rounded-lg",children:[m.jsx("div",{className:"text-red-400 text-sm font-medium mb-2",children:"Mermaid render failed"}),m.jsx("pre",{className:"text-red-300 text-xs overflow-x-auto",children:r})]})}function N_({html:n,content:r}){return n?m.jsx(dd,{content:n}):m.jsxs("div",{className:"p-4 bg-red-950/20 border border-red-800 rounded-lg",children:[m.jsx("div",{className:"text-red-400 text-sm font-medium mb-2",children:"PlantUML render failed"}),m.jsx("pre",{className:"text-red-300 text-xs overflow-x-auto",children:r})]})}const R_={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};const Xx=([n,r,o])=>{const i=document.createElementNS("http://www.w3.org/2000/svg",n);return Object.keys(r).forEach(c=>{i.setAttribute(c,String(r[c]))}),o?.length&&o.forEach(c=>{const f=Xx(c);i.appendChild(f)}),i},Kx=(n,r={})=>{const i={...R_,...r};return Xx(["svg",i,n])};const A_=[["path",{d:"M20 6 9 17l-5-5"}]];const Sv=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}]];const Ev=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3"}]];const T_=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3"}]],Cv="relative bg-white rounded-lg border border-border overflow-hidden my-4",__="fixed inset-0 z-[100] bg-white flex flex-col",Nv="overflow-hidden w-full",M_="overflow-hidden w-full h-full flex-1",Rv="flex items-center justify-center p-4 [&>svg]:max-w-full [&>svg]:h-auto",j_="p-4",O_="absolute top-2 right-2 z-10 p-1.5 bg-zinc-800/70 hover:bg-zinc-700 text-white rounded transition-colors",Av="text-xs text-muted-foreground text-center py-1 opacity-60",D_="text-muted-foreground text-xs text-center py-2 pointer-events-none",Tv="Scroll to zoom · Drag to pan",z_="Scroll to zoom · Drag to pan · Esc to close";function k_(n){return Kx(n,{size:16})}function pf(n,r){n.innerHTML="",n.appendChild(k_(r))}function L_(n){const r=n.getAttribute("viewBox");if(r){const o=r.split(/[\s,]+/).map(Number);if(o[2]&&o[3])return{w:o[2],h:o[3]}}return{w:n.clientWidth||1e3,h:n.clientHeight||800}}function U_(n,r,o,i){const c=Math.min(o/n,i/r,1),f=n*c,d=r*c;return{fitScale:c,fittedW:f,fittedH:d,startX:(o-f)/2,startY:(i-d)/2}}function md(n,r,o){const i=o?.wrapperExtraClass?`${o.wrapperExtraClass} ${Cv}`:Cv,c=document.createElement("div");c.className=i,c.style.cursor="grab";const f=document.createElement("div");f.className=Nv,o?.viewportMinHeight&&(f.style.minHeight=o.viewportMinHeight);const d=document.createElement("div");d.className=Rv,d.appendChild(n),f.appendChild(d);const h=document.createElement("button");h.className=O_,h.title="Fullscreen",pf(h,Ev);const y=document.createElement("div");y.className=Av,y.textContent=Tv,c.appendChild(f),c.appendChild(h),c.appendChild(y);let p=null;const x=_=>{p?.zoomWithWheel(_)};f.addEventListener("wheel",x,{passive:!1});const b=()=>{p||(p=Vl(d,{maxScale:20,contain:"outside"}))};let S=!1;const E=()=>{S=!0,c.dataset.origClass=c.className,c.className=__,c.style.cursor="grab",f.className=M_,o?.viewportMinHeight&&(f.style.minHeight=""),d.className=j_,y.textContent=z_,y.className=D_,h.title="Exit fullscreen",pf(h,T_),p?.destroy(),p=null,requestAnimationFrame(()=>{requestAnimationFrame(()=>{setTimeout(()=>{const _=d.querySelector("svg");if(_&&f.clientWidth&&f.clientHeight){const{w:H,h:D}=L_(_),{fitScale:B,fittedW:Q,fittedH:W,startX:X,startY:q}=U_(H,D,f.clientWidth,f.clientHeight);_.setAttribute("width",String(Math.round(Q))),_.setAttribute("height",String(Math.round(W))),_.style.width=`${String(Math.round(Q))}px`,_.style.height=`${String(Math.round(W))}px`,p=Vl(d,{maxScale:20/B,minScale:.5,startScale:1,startX:X,startY:q})}else p=Vl(d,{maxScale:20,minScale:.1})},50)})})},A=()=>{S=!1;const _=d.querySelector("svg");_&&(_.setAttribute("width","100%"),_.removeAttribute("height"),_.style.width="",_.style.height=""),c.className=c.dataset.origClass??i,c.style.cursor="grab",f.className=Nv,o?.viewportMinHeight&&(f.style.minHeight=o.viewportMinHeight),d.className=Rv,y.textContent=Tv,y.className=Av,h.title="Fullscreen",pf(h,Ev),p?.destroy(),p=Vl(d,{maxScale:20,contain:"outside",startScale:1})};h.addEventListener("click",()=>{S?A():E()});const C=_=>{_.key==="Escape"&&S&&A()};return document.addEventListener("keydown",C),{wrapper:c,initPanzoom:b,enterFullscreen:E,exitFullscreen:A,cleanup:()=>{f.removeEventListener("wheel",x),document.removeEventListener("keydown",C),p?.destroy()}}}function H_(n){const r=[],o=n.querySelectorAll(".embedded-diagram-rendered");for(const i of o){const c=i.querySelector("svg");if(!c)continue;const{wrapper:f,initPanzoom:d,cleanup:h}=md(c,i,{wrapperExtraClass:"embedded-diagram-panzoom"});i.replaceWith(f),d(),r.push(h)}return()=>{for(const i of r)i()}}function B_(n){const r=[],o=n.querySelectorAll(".embedded-diagram-lazy");if(o.length===0)return()=>{};for(const i of o){const c=i.dataset.diagramType??"diagram";i.innerHTML=`<div class="embedded-diagram-loading"><div class="diagram-spinner"></div><span>Rendering ${c} diagram…</span></div>`,Qx(i,r)}return()=>{for(const i of r)i()}}async function Qx(n,r){const o=n.dataset.diagramType,i=n.dataset.diagramHash;if(!(!o||!i))try{const c=Jl(`/api/diagram/${o}/${i}.svg`),f=await fetch(c);if(!f.ok){const E=await f.json().catch(()=>({error:"Render failed"}));throw new Error(E.error??`HTTP ${String(f.status)}`)}const d=await f.text(),h=$x(d),y=document.createElement("div");y.className="embedded-diagram-rendered",y.dataset.type=o,y.innerHTML=h;const p=y.querySelector("svg");if(!p){n.replaceWith(y);return}const{wrapper:x,initPanzoom:b,cleanup:S}=md(p,y,{wrapperExtraClass:"embedded-diagram-panzoom"});n.replaceWith(x),b(),r.push(S)}catch(c){const f=c instanceof Error?c.message:"Unknown error",d=o?o.charAt(0).toUpperCase()+o.slice(1):"Diagram",h=Number(n.dataset.retryCount??"0"),y=h>0?'<div class="diagram-reload-hint">Still failing? Try reloading the page — the diagram source may have changed.</div>':"";n.innerHTML=`<div class="embedded-diagram-error" data-type="${o}"><div class="diagram-error-label">${d} render failed: ${G_(f)}</div>${y}<button class="diagram-retry-btn">Retry</button></div>`,n.querySelector(".diagram-retry-btn")?.addEventListener("click",()=>{n.dataset.retryCount=String(h+1),n.innerHTML=`<div class="embedded-diagram-loading"><div class="diagram-spinner"></div><span>Rendering ${o} diagram…</span></div>`,Qx(n,r)})}}function G_(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Y_(n){const r=[],o=Array.from(n.querySelectorAll("img")).filter(i=>/\.svg(\?|&|$)/i.test(i.getAttribute("src")??""));for(const i of o){const c=i.getAttribute("src");if(!c)continue;const f=c.includes("raw=1")?c:c.includes("?")?`${c}&raw=1`:`${c}?raw=1`,d=document.createElement("div");d.className="inline-svg-panzoom relative bg-white rounded-lg border border-border overflow-hidden my-4",d.style.cursor="grab",d.innerHTML='<div class="overflow-hidden w-full min-h-[200px]"><div class="flex items-center justify-center p-4">Loading SVG…</div></div>',i.parentElement?.replaceChild(d,i),fetch(Jl(f)).then(h=>{if(!h.ok)throw new Error(`Failed to fetch SVG: ${String(h.status)}`);return h.text()}).then(h=>{const y=document.createElement("div");y.innerHTML=h;const p=y.querySelector("svg");if(!p)throw new Error("No SVG element found");const{wrapper:x,initPanzoom:b,cleanup:S}=md(p,d,{wrapperExtraClass:"inline-svg-panzoom",viewportMinHeight:"200px"});d.replaceWith(x),b(),r.push(S)}).catch(()=>{d.replaceWith(i)})}return()=>{for(const i of r)i()}}async function q_(){const[{EditorView:n,basicSetup:r},{EditorState:o},{keymap:i},{oneDark:c}]=await Promise.all([nt(()=>import("./index-FlCUvrjv.js"),__vite__mapDeps([0,1,2,3,4])),nt(()=>import("./index-Cs5oz2oJ.js"),[]),nt(()=>import("./index-Dw7rDFmE.js").then(f=>f.u),__vite__mapDeps([1,2])),nt(()=>import("./index-MLwyFRN0.js"),__vite__mapDeps([5,1,2,3]))]);return{EditorView:n,EditorState:o,basicSetup:r,keymap:i,oneDark:c}}async function V_(n){switch(n.toLowerCase()){case"js":case"jsx":case"mjs":case"cjs":return(await nt(async()=>{const{javascript:r}=await import("./index-DC4HMHxY.js");return{javascript:r}},__vite__mapDeps([6,7,3,2,1,4]))).javascript({jsx:n.includes("x")});case"ts":case"tsx":case"mts":case"cts":return(await nt(async()=>{const{javascript:r}=await import("./index-DC4HMHxY.js");return{javascript:r}},__vite__mapDeps([6,7,3,2,1,4]))).javascript({jsx:n.includes("x"),typescript:!0});case"html":case"htm":return(await nt(async()=>{const{html:r}=await import("./index-D8KZVveX.js");return{html:r}},__vite__mapDeps([8,7,3,2,1,9,6,4]))).html();case"css":case"scss":return(await nt(async()=>{const{css:r}=await import("./index-uQa2yckk.js");return{css:r}},__vite__mapDeps([9,7,3,2,1]))).css();case"json":case"jsonl":return(await nt(async()=>{const{json:r}=await import("./index-SsHei0HE.js");return{json:r}},__vite__mapDeps([10,7,3,2,1]))).json();case"md":case"mdx":case"markdown":return(await nt(async()=>{const{markdown:r}=await import("./index-BdV9g5AM.js");return{markdown:r}},__vite__mapDeps([11,2,1,3,4,8,7,9,6]))).markdown();case"py":case"pyw":return(await nt(async()=>{const{python:r}=await import("./index-BqbhWo2I.js");return{python:r}},__vite__mapDeps([12,7,3,2,1,4]))).python();case"xml":case"svg":case"xsl":case"xhtml":return(await nt(async()=>{const{xml:r}=await import("./index-udkXoIER.js");return{xml:r}},__vite__mapDeps([13,7,3,2,1]))).xml();case"yaml":case"yml":return(await nt(async()=>{const{yaml:r}=await import("./index--MBieNJA.js");return{yaml:r}},__vite__mapDeps([14,7,3,2,1]))).yaml();case"c":case"h":case"cpp":case"hpp":case"cc":case"cxx":return(await nt(async()=>{const{cpp:r}=await import("./index-BbBpoOxz.js");return{cpp:r}},__vite__mapDeps([15,7,3,2,1]))).cpp();case"java":return(await nt(async()=>{const{java:r}=await import("./index-DcY2RXqX.js");return{java:r}},__vite__mapDeps([16,7,3,2,1]))).java();case"rs":return(await nt(async()=>{const{rust:r}=await import("./index-BENeXQI_.js");return{rust:r}},__vite__mapDeps([17,7,3,2,1]))).rust();case"sql":return(await nt(async()=>{const{sql:r}=await import("./index-BjAilRri.js");return{sql:r}},__vite__mapDeps([18,3,2,1,7,4]))).sql();case"php":return(await nt(async()=>{const{php:r}=await import("./index-Duy-tZYV.js");return{php:r}},__vite__mapDeps([19,7,3,2,1,8,9,6,4]))).php();default:return null}}function $_(n){const r=/language-(\w+)/.exec(n);if(!r)return null;const o=r[1];return{javascript:"js",typescript:"ts",python:"py",json:"json",yaml:"yaml",yml:"yaml",html:"html",css:"css",xml:"xml",java:"java",rust:"rs",sql:"sql",php:"php",cpp:"cpp",c:"c",markdown:"md",jsx:"jsx",tsx:"tsx",scss:"scss",bash:"sh",shell:"sh",sh:"sh",plaintext:"",text:""}[o]??o}function X_(n,r="dark"){const o=[],i=n.querySelectorAll("pre"),c=[];for(const f of i){const d=f.querySelector("code");if(!d||f.closest(".embedded-diagram-lazy")||f.closest(".embedded-diagram-rendered"))continue;const h=$_(d.className)??"",y=d.textContent??"";if(!y.trim())continue;const p=document.createElement("div");p.className="cm6-embedded-code",f.replaceWith(p),c.push(K_(p,y,h,r,o))}return Promise.all(c).then(()=>{n.setAttribute("data-cm6-ready","true")}),()=>{for(const f of o)f()}}async function K_(n,r,o,i,c){try{const{EditorView:f,EditorState:d,basicSetup:h,oneDark:y}=await q_(),p=await V_(o);if(!n.isConnected)return;const x=[h,d.readOnly.of(!0),f.editable.of(!1),...i==="dark"?[y]:[],f.theme({"&":{fontSize:"14px",borderRadius:"0.5rem",overflow:"hidden",border:"1px solid var(--color-border)"},".cm-scroller":{overflow:"auto"},".cm-content":{fontFamily:"'JetBrains Mono', 'Fira Code', 'Consolas', monospace",padding:"0.75rem 0"},".cm-gutters":{fontFamily:"'JetBrains Mono', 'Fira Code', 'Consolas', monospace",backgroundColor:"var(--color-muted)",borderRight:"1px solid var(--color-border)",color:"var(--color-muted-foreground)"},"&.cm-editor":{backgroundColor:"var(--color-muted)"},".cm-cursor":{display:"none"},".cm-activeLineGutter":{backgroundColor:"transparent"},".cm-activeLine":{backgroundColor:"transparent"}})];p&&x.push(p);const b=d.create({doc:r,extensions:x}),S=new f({state:b,parent:n});c.push(()=>S.destroy())}catch{n.innerHTML=`<pre class="hljs rounded-lg overflow-x-auto text-sm border border-border p-4 bg-muted text-foreground"><code>${Q_(r)}</code></pre>`}}function Q_(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function gf(n,r=14){return Kx(n,{size:r})}function Z_(n){n.querySelectorAll("pre").forEach(o=>{if(o.querySelector(".code-copy-btn"))return;o.style.position="relative";const i=document.createElement("button");i.className="code-copy-btn",i.title="Copy to clipboard",i.innerHTML="",i.appendChild(gf(Sv)),i.addEventListener("click",()=>{const f=o.querySelector("code")?.textContent??o.textContent??"";navigator.clipboard.writeText(f).then(()=>{i.innerHTML="";const d=gf(A_);i.appendChild(d),i.style.color="#4ade80",setTimeout(()=>{i.innerHTML="",i.appendChild(gf(Sv)),i.style.color=""},1500)})}),o.appendChild(i)})}function _v(n){n==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")}function Cs(){const[n,r]=g.useState(()=>{const c=localStorage.getItem("jeeves-theme")==="dark"?"dark":"light";return _v(c),c});g.useEffect(()=>{_v(n)},[n]);const o=g.useCallback(()=>{r(i=>{const c=i==="dark"?"light":"dark";return localStorage.setItem("jeeves-theme",c),c})},[]);return[n,o]}const F_=600;function P_(n,r){const o=n===window,i=o?window.scrollY:n.scrollTop,c=r-i;if(Math.abs(c)<2)return;const f=performance.now();function d(h){const y=h-f,p=Math.min(y/F_,1),x=p<.5?4*p*p*p:1-Math.pow(-2*p+2,3)/2;o?window.scrollTo(0,i+c*x):n.scrollTop=i+c*x,p<1&&requestAnimationFrame(d)}requestAnimationFrame(d)}function Wi(n,r){const o=document.getElementById(r);if(o&&n){const i=o.getBoundingClientRect(),c=n.getBoundingClientRect(),f=n.scrollTop+(i.top-c.top)-16;P_(n,f),window.history.replaceState(null,"",`#${r}`)}}function J_({fileRendered:n,proseWidth:r,topBarHeight:o,mainRef:i,mobileTocOpen:c,setMobileTocOpen:f}){const[d]=Cs(),h=new URLSearchParams(window.location.search).has("plain_code"),y=n.headings&&n.headings.length>2;return m.jsxs(m.Fragment,{children:[c&&y&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"lg:hidden fixed inset-0 z-40",onClick:()=>f(!1)}),m.jsx("div",{className:"lg:hidden fixed left-2 right-2 z-50 bg-popover text-popover-foreground border border-border rounded-lg shadow-lg max-h-[60vh] overflow-y-auto px-4 py-3",style:{top:`${o+4}px`},children:m.jsx("nav",{children:n.headings.map(p=>m.jsx("button",{type:"button",onClick:()=>{Wi(i.current,p.slug),f(!1)},className:"block text-left text-sm text-muted-foreground hover:text-foreground cursor-pointer py-1 transition-colors w-full",style:{paddingLeft:`${(p.level-1)*.75}rem`},children:p.text},p.slug))})})]}),m.jsxs("div",{className:"flex gap-6",children:[y&&m.jsxs("aside",{className:"toc-sidebar hidden lg:block w-56 shrink-0",style:{maxHeight:`calc(100vh - ${o+32}px)`},children:[m.jsx("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2",children:"Contents"}),m.jsx("nav",{className:"border-l border-border pl-3",children:n.headings.map(p=>m.jsx("button",{type:"button",onClick:()=>Wi(i.current,p.slug),className:"block text-left text-sm text-muted-foreground hover:text-foreground cursor-pointer py-0.5 transition-colors",style:{paddingLeft:`${(p.level-1)*.75}rem`},children:p.text},p.slug))})]}),m.jsx("article",{ref:p=>{p&&(h||X_(p,d),Z_(p),Y_(p),H_(p),B_(p))},className:`prose bg-background p-6 rounded-lg border border-border min-w-0 flex-1 ${r==="narrow"?"max-w-prose":r==="medium"?"max-w-5xl":"max-w-none"}`,style:{"--tw-prose-body":"var(--foreground)","--tw-prose-headings":"var(--foreground)","--tw-prose-bold":"var(--foreground)","--tw-prose-links":"#3b82f6","--tw-prose-code":"var(--foreground)","--tw-prose-pre-bg":"var(--muted)","--tw-prose-pre-code":"var(--foreground)","--tw-prose-hr":"var(--border)","--tw-prose-quotes":"var(--muted-foreground)","--tw-prose-quote-borders":"var(--border)","--tw-prose-th-borders":"var(--border)","--tw-prose-td-borders":"var(--border)"},dangerouslySetInnerHTML:{__html:n.html},onClick:p=>{const S=p.target.closest("a")?.getAttribute("href");S?.startsWith("#")&&(p.preventDefault(),Wi(i.current,S.slice(1)))}})]})]})}const I_=new Set([".md",".svg",".mmd",".puml",".plantuml",".pu"]);function Mf(n){return n.type==="markdown"||n.type==="svg"||n.type==="mermaid"||n.type==="plantuml"||!!n.html}function W_(n){const r=n?`.${n.split(".").pop()?.toLowerCase()}`:"";return I_.has(r)}function eM(n,r,o=!0){const i=g.useRef(0),c=g.useRef(0);g.useEffect(()=>{const f=n.current,d=r.current;if(!f||!d||!o)return;i.current=d.scrollHeight,c.current=f.scrollTop;const h=()=>{c.current=f.scrollTop};f.addEventListener("scroll",h,{passive:!0});const y=new ResizeObserver(()=>{const p=d.scrollHeight,x=i.current,b=p-x;if(Math.abs(b)>0&&c.current>0){const S=f.scrollTop;S===c.current&&b>0&&(f.scrollTop=S+b),c.current=f.scrollTop}i.current=p});return y.observe(d),()=>{f.removeEventListener("scroll",h),y.disconnect()}},[n,r,o])}const tM=g.lazy(()=>nt(()=>import("./CodeEditor-BKFEoNHo.js"),[]).then(n=>({default:n.CodeEditor}))),nM=g.lazy(()=>nt(()=>import("./CodeViewer-ykQDxC2m.js"),[]).then(n=>({default:n.CodeViewer})));function aM({reqPath:n,file:r,fileRaw:o,fileRendered:i,viewTab:c,editing:f,setEditing:d,proseWidth:h,topBarHeight:y,mainRef:p,mobileTocOpen:x,setMobileTocOpen:b,onSave:S}){const E=g.useRef(null);eM(p,E);const A=r?Mf(r):!1,C=A?c:"raw",N=!r;return g.useEffect(()=>{const _=window.location.hash.slice(1);if(_&&r){const H=setTimeout(()=>Wi(p.current,_),100);return()=>clearTimeout(H)}},[r,p]),m.jsxs("div",{ref:E,className:"px-4 md:px-6 pt-4",children:[N&&m.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground text-sm py-8 justify-center",children:[m.jsx(Ji,{className:"h-4 w-4 animate-spin"})," Loading..."]}),(o??r)?.content&&C==="raw"&&!f&&m.jsx(g.Suspense,{fallback:m.jsx("pre",{className:"rounded-lg overflow-x-auto text-sm border border-border p-4 bg-muted text-foreground",children:m.jsxs("code",{children:[(o??r).content.slice(0,500),"…"]})}),children:m.jsx(nM,{content:(o??r).content,fileName:(o??r).fileName})}),f&&(o??r)?.content!=null&&C==="raw"&&m.jsx(g.Suspense,{fallback:m.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground text-sm py-8 justify-center",children:[m.jsx(Ji,{className:"h-4 w-4 animate-spin"})," Loading editor…"]}),children:m.jsx("div",{style:{height:`calc(100vh - ${y+16}px)`},children:m.jsx(tM,{content:(o??r).content,fileName:(o??r).fileName,onSave:S,onCancel:()=>d(!1)})})}),!i&&A&&C==="rendered"&&!N&&m.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground text-sm py-8 justify-center",children:[m.jsx(Ji,{className:"h-4 w-4 animate-spin"})," Rendering..."]}),i?.type==="markdown"&&i.html&&C==="rendered"&&m.jsx(J_,{fileRendered:i,proseWidth:h,topBarHeight:y,mainRef:p,mobileTocOpen:x,setMobileTocOpen:b}),i?.type==="svg"&&i.content&&C==="rendered"&&m.jsx(dd,{content:i.content}),i?.type==="mermaid"&&C==="rendered"&&m.jsx(C_,{html:i.html??null,content:i.content??""}),i?.type==="plantuml"&&C==="rendered"&&m.jsx(N_,{html:i.html??null,content:i.content??""}),r?.type==="image"&&m.jsx("div",{className:"flex justify-center p-4",children:m.jsx("img",{src:`/api/raw/${n}`,alt:r.fileName,className:"max-w-full rounded-lg shadow-md"})}),r?.type==="binary"&&m.jsxs("div",{className:"text-center p-8",children:[m.jsx("p",{className:"text-muted-foreground mb-4",children:r.fileName}),m.jsx("a",{href:`/api/raw/${n}`,download:r.fileName,className:"inline-flex items-center gap-2 px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90",children:"Download"})]})]})}const lM={"bp-400":"min-[400px]:hidden","bp-480":"min-[480px]:hidden",sm:"sm:hidden",md:"md:hidden",lg:"lg:hidden"};function rM({collapsedItems:n=[]}){const{authenticated:r,email:o,picture:i}=uo(),[c,f]=g.useState(!1),d=g.useRef(null),[h,y]=g.useState(null),[p,x]=g.useState(null);g.useEffect(()=>{fetch("/api/content-link/privacy").then(E=>E.json()).then(E=>{E.url&&y(E.url)}).catch(()=>{}),fetch("/api/content-link/terms").then(E=>E.json()).then(E=>{E.url&&x(E.url)}).catch(()=>{})},[]);const b=g.useCallback(()=>!!document.querySelector("[data-radix-popper-content-wrapper]"),[]);if(g.useEffect(()=>{if(!c)return;function E(A){const C=A.target;d.current?.contains(C)||b()||C.closest?.("[data-radix-popper-content-wrapper]")||C.closest?.('[role="menu"]')||f(!1)}return document.addEventListener("pointerdown",E,!0),document.addEventListener("mousedown",E,!0),()=>{document.removeEventListener("pointerdown",E,!0),document.removeEventListener("mousedown",E,!0)}},[c,b]),!r)return null;const S=o?o[0].toUpperCase():"?";return m.jsxs("div",{className:"relative",ref:d,children:[m.jsx("button",{onClick:()=>f(!c),className:"flex items-center gap-2 px-2 py-1 rounded-md hover:bg-zinc-700 transition-colors",title:o??"Account",children:i?m.jsx("img",{src:i,alt:"",className:"h-7 w-7 rounded-full",referrerPolicy:"no-referrer"}):m.jsx("div",{className:"h-7 w-7 rounded-full bg-blue-600 flex items-center justify-center text-white text-xs font-semibold",children:S})}),c&&m.jsxs("div",{className:"absolute right-0 top-full mt-1 w-56 bg-popover border border-border rounded-lg shadow-lg z-50 py-1",children:[m.jsxs("a",{href:"https://myaccount.google.com/",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 px-3 py-2 border-b border-border hover:bg-accent transition-colors",children:[m.jsx(oR,{className:"h-4 w-4 text-foreground"}),m.jsx("span",{className:"text-sm text-foreground truncate",children:o})]}),n.map((E,A)=>m.jsx("div",{className:lM[E.breakpoint],children:typeof E.node=="function"?E.node(()=>f(!1)):E.node},A)),n.length>0&&m.jsx("div",{className:"border-b border-border"}),m.jsxs("a",{href:"/auth/logout",className:"flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-accent transition-colors",children:[m.jsx(zN,{className:"h-4 w-4"}),"Sign out"]}),(h??p)&&m.jsxs("div",{className:"border-t border-border mt-1 pt-1",children:[h&&m.jsxs("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 px-3 py-1.5 text-xs text-muted-foreground hover:bg-accent transition-colors",children:[m.jsx(nv,{className:"h-3 w-3"}),"Privacy"]}),p&&m.jsxs("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 px-3 py-1.5 text-xs text-muted-foreground hover:bg-accent transition-colors",children:[m.jsx(nv,{className:"h-3 w-3"}),"Terms"]})]})]})]})}const oM=8;function iM(n){return n.filter(r=>{const o=String(r??"");return!(!o||!o.trim()||o.includes("[object Object]")||/^\$\{.*\}$/.test(o))})}function Wr(n){return n.replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase())}function sM({label:n,values:r,selected:o,onToggle:i,onRemove:c}){return m.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[m.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[n,":"]}),r.map(f=>m.jsx("button",{onClick:()=>i(f),className:`text-xs px-2 py-0.5 rounded-full border transition-colors ${o.has(f)?"bg-primary text-primary-foreground border-primary":"bg-muted text-muted-foreground border-border hover:bg-accent"}`,children:f},f)),m.jsx("button",{onClick:c,className:"text-muted-foreground hover:text-foreground ml-0.5",title:`Remove ${n} filter`,children:m.jsx(Za,{className:"h-3 w-3"})})]})}function cM({label:n,values:r,selected:o,onToggle:i,multi:c,onRemove:f}){const[d,h]=g.useState(!1),[y,p]=g.useState(""),x=g.useRef(null);g.useEffect(()=>{if(!d)return;const E=A=>{x.current&&!x.current.contains(A.target)&&(h(!1),p(""))};return document.addEventListener("mousedown",E,!0),()=>document.removeEventListener("mousedown",E,!0)},[d]);const b=y?r.filter(E=>E.toLowerCase().includes(y.toLowerCase())):r,S=o.size===0?"All":o.size<=2?[...o].join(", "):`${o.size} selected`;return m.jsxs("div",{className:"flex items-center gap-1.5",ref:x,children:[m.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[n,":"]}),m.jsxs("div",{className:"relative",children:[m.jsxs("button",{onClick:()=>h(!d),className:`text-xs px-2 py-0.5 rounded border transition-colors flex items-center gap-1 min-w-[100px] ${o.size>0?"bg-primary/10 text-primary border-primary":"bg-muted text-muted-foreground border-border hover:bg-accent"}`,children:[m.jsx("span",{className:"truncate max-w-[200px]",children:S}),m.jsx(Ff,{className:"h-3 w-3 shrink-0"})]}),d&&m.jsxs("div",{className:"absolute top-full left-0 mt-1 z-50 bg-background border border-border rounded shadow-lg w-64 max-h-48 flex flex-col",children:[m.jsx("div",{className:"p-1.5 border-b border-border",children:m.jsx("input",{type:"text",value:y,onChange:E=>p(E.target.value),placeholder:"Search...",className:"text-xs w-full px-2 py-1 rounded border border-border bg-muted text-foreground placeholder:text-muted-foreground outline-none focus:border-primary",autoFocus:!0})}),m.jsxs("div",{className:"overflow-y-auto flex-1",children:[b.length===0&&m.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No matches"}),b.map(E=>m.jsxs("button",{onClick:()=>{i(E),c||(h(!1),p(""))},className:`w-full text-left text-xs px-3 py-1.5 hover:bg-accent transition-colors flex items-center gap-2 ${o.has(E)?"bg-primary/10 text-primary":"text-foreground"}`,children:[c&&m.jsx("span",{className:`w-3 h-3 rounded-sm border flex items-center justify-center shrink-0 ${o.has(E)?"bg-primary border-primary":"border-border"}`,children:o.has(E)&&m.jsx("span",{className:"text-[8px] text-primary-foreground",children:"✓"})}),m.jsx("span",{className:"truncate",children:E})]},E))]})]})]}),o.size>0&&o.size<=5&&[...o].map(E=>m.jsxs("button",{onClick:()=>i(E),className:"text-xs px-1.5 py-0.5 rounded-full bg-primary/10 text-primary border border-primary/30 hover:bg-primary/20 flex items-center gap-0.5",title:`Remove ${E}`,children:[m.jsx("span",{className:"truncate max-w-[120px]",children:E}),m.jsx(Za,{className:"h-2.5 w-2.5 shrink-0"})]},E)),m.jsx("button",{onClick:f,className:"text-muted-foreground hover:text-foreground ml-0.5",title:`Remove ${n} filter`,children:m.jsx(Za,{className:"h-3 w-3"})})]})}function uM({label:n,value:r,onChange:o,inputType:i="text",onRemove:c}){return m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[n,":"]}),m.jsx("input",{type:i,value:r,onChange:f=>o(f.target.value),placeholder:`Filter by ${n.toLowerCase()}...`,className:"text-xs px-2 py-0.5 rounded border border-border bg-muted text-foreground placeholder:text-muted-foreground w-64 outline-none focus:border-primary"}),m.jsx("button",{onClick:c,className:"text-muted-foreground hover:text-foreground",title:`Remove ${n} filter`,children:m.jsx(Za,{className:"h-3 w-3"})})]})}const vf=4,fM=new Set(["file_path","chunk_text","chunk_index","total_chunks","content_hash","embedded_at"]);function dM(n,r){const o=n.metadata??{},i=[],c=new Map(r.map(f=>[f.field,f]));for(const[f,d]of Object.entries(o)){if(fM.has(f))continue;const h=c.get(f);if(!h)continue;const y=Array.isArray(d)?d.map(String):[String(d)],x=h.uiHint!=="text"&&h.uiHint!=="number"?h.values.length:1/0;for(const b of y)!b||b==="undefined"||b==="null"||i.push({field:f,label:Wr(f),value:b,cardinality:x})}return i.sort((f,d)=>f.cardinality-d.cardinality),i}function mM({result:n,facets:r,onNavigate:o,onChipClick:i}){const[c,f]=g.useState(!1),d=n.chunks[0]?.text??"",h=d.length>150?d.slice(0,150)+"…":d,y=dM(n,r),p=y.slice(0,vf),x=y.length>vf,b=(S,E)=>{const A=S.value.length>30?S.value.slice(0,28)+"…":S.value;return m.jsxs("button",{onClick:C=>{C.stopPropagation(),i(S.field,S.value)},className:"text-[10px] px-1.5 py-0.5 rounded bg-muted text-foreground border border-border hover:bg-primary/10 hover:border-primary/30 transition-colors cursor-pointer truncate max-w-[200px]",title:`${S.label}: ${S.value} — click to filter`,children:[m.jsxs("span",{className:"text-muted-foreground",children:[S.label,":"]})," ",A]},`${S.field}-${E}`)};return m.jsx("div",{className:"border-b border-border last:border-0 px-4 py-2",children:m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsx(Sb,{className:"h-4 w-4 text-zinc-400 shrink-0 mt-1"}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("button",{onClick:()=>o(`/browse/${n.browsePath}`),className:"text-blue-500 hover:underline text-sm font-medium truncate",children:n.fileName}),m.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0",children:[(n.bestScore*100).toFixed(0),"%"]}),m.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0",children:[n.chunks.length," chunk",n.chunks.length!==1?"s":""]}),n.mtime&&m.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:new Date(n.mtime).toLocaleDateString()}),m.jsx("button",{onClick:()=>f(!c),className:"ml-auto text-muted-foreground hover:text-foreground shrink-0",title:c?"Collapse chunks":"Expand chunks",children:c?m.jsx(Ff,{className:"h-4 w-4"}):m.jsx(wb,{className:"h-4 w-4"})})]}),m.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 break-words leading-relaxed",children:n.browsePath}),!c&&p.length>0&&m.jsxs("div",{className:"flex flex-wrap items-center gap-1 mt-1",children:[p.map((S,E)=>b(S,E)),x&&m.jsxs("button",{onClick:()=>f(!0),className:"text-[10px] text-blue-500 hover:underline cursor-pointer",children:["+",y.length-vf," more"]})]}),!c&&p.length===0&&m.jsx("div",{className:"text-sm text-foreground/70 mt-1 truncate",children:h}),c&&m.jsxs(m.Fragment,{children:[y.length>0&&m.jsx("div",{className:"flex flex-wrap items-center gap-1 mt-1.5 mb-2",children:y.map((S,E)=>b(S,E))}),m.jsx("div",{className:"max-h-48 overflow-y-auto border border-border rounded bg-muted/30 divide-y divide-border",children:n.chunks.map((S,E)=>m.jsxs("div",{className:"px-3 py-2 text-sm text-foreground/80 leading-relaxed",children:[m.jsxs("span",{className:"text-[10px] text-muted-foreground mr-2",children:["#",S.index]}),S.text]},E))})]})]})]})})}function hM({open:n,onClose:r}){const[o,i]=g.useState(""),[c,f]=g.useState([]),[d,h]=g.useState(!1),[y,p]=g.useState(null),[x,b]=g.useState([]),[S,E]=g.useState(!1),A=g.useRef(!1),[C,N]=g.useState({}),[_,H]=g.useState({}),[D,B]=g.useState(new Set),[Q,W]=g.useState([]),[X,q]=g.useState(!1),[ne,ce]=g.useState(!1),[me,re]=g.useState(""),ge=g.useRef(null),fe=g.useRef(null),de=so(),j=g.useRef(void 0);g.useEffect(()=>{if(!ne)return;const te=pe=>{ge.current&&!ge.current.contains(pe.target)&&(ce(!1),re(""))};return document.addEventListener("mousedown",te),()=>document.removeEventListener("mousedown",te)},[ne]);const Z=g.useCallback(async()=>{if(!A.current){A.current=!0,E(!0);try{const te=await pE(),pe=[],be=[];for(const Se of te.facets){if(Se.uiHint==="hidden")continue;if(Se.uiHint==="text"||Se.uiHint==="number"){pe.push({...Se,values:[]});continue}const Re=iM(Se.values),Xe=Se.values.filter($n=>!Re.includes($n));if(Xe.length>0){const $n=Xe.map(Xn=>!Xn||!String(Xn).trim()?"empty":String(Xn).includes("[object Object]")?"object-to-string":/^\$\{.*\}$/.test(String(Xn))?"unresolved-template":"unknown");be.push({field:Se.field,removed:Xe.map((Xn,go)=>`${JSON.stringify(Xn)} (${$n[go]})`),reason:[...new Set($n)].join(", ")})}Re.length>0?pe.push({...Se,values:Re}):be.push({field:Se.field,removed:Xe.length>0?["(all values filtered)"]:["(no values)"],reason:Xe.length>0?"no valid values remain":"empty values array"})}console.log("[SearchModal] Loaded facets:",pe.length,"clean,",be.length,"garbage entries"),b(pe),W(be)}catch(te){console.error("Failed to load facets:",te),b([])}finally{E(!1)}}},[]);g.useEffect(()=>{n&&(setTimeout(()=>fe.current?.focus(),50),Z())},[n,Z]);const ee=g.useCallback(()=>{i(""),f([]),p(null),N({}),H({}),B(new Set),q(!1),fe.current?.focus()},[]),z=g.useCallback(async te=>{if(!te.trim()){f([]);return}h(!0),p(null);try{const pe=[];for(const[Re,Xe]of Object.entries(C))Xe.size>0&&pe.push({key:Re,match:{any:[...Xe]}});for(const[Re,Xe]of Object.entries(_))Xe.trim()&&pe.push({key:Re,match:{text:Xe.trim()}});const be=pe.length>0?{must:pe}:void 0,Se=await hE(te,30,be);f(Se.results)}catch(pe){p(String(pe))}finally{h(!1)}},[C,_]),G=g.useCallback(te=>{i(te),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{z(te)},400)},[z]),R=g.useCallback(te=>{r(),de(te)},[de,r]),U=g.useCallback((te,pe)=>{B(Se=>new Set([...Se,te]));const be=x.find(Se=>Se.field===te);be&&(be.uiHint==="text"||be.uiHint==="number")?H(Se=>({...Se,[te]:pe})):N(Se=>{const Re=Se[te]??new Set,Xe=new Set(Re);return Xe.add(pe),{...Se,[te]:Xe}})},[x]),V=g.useCallback((te,pe)=>{N(be=>{const Se=be[te]??new Set,Re=new Set(Se);return Re.has(pe)?Re.delete(pe):Re.add(pe),{...be,[te]:Re}})},[]),P=g.useCallback(te=>{B(pe=>new Set([...pe,te]))},[]),I=g.useCallback(te=>{B(pe=>{const be=new Set(pe);return be.delete(te),be}),N(pe=>{const be={...pe};return delete be[te],be}),H(pe=>{const be={...pe};return delete be[te],be})},[]);g.useEffect(()=>{o.trim()&&z(o)},[C,_]);const ae=x.filter(te=>D.has(te.field)),le=x.filter(te=>!D.has(te.field)),De=me?le.filter(te=>Wr(te.field).toLowerCase().includes(me.toLowerCase())):le;function ye(te){const pe=Wr(te.field),be=()=>I(te.field);if(te.uiHint==="text"||te.uiHint==="number")return m.jsx(uM,{label:pe,value:_[te.field]??"",onChange:Re=>H(Xe=>({...Xe,[te.field]:Re})),inputType:te.uiHint==="number"?"number":"text",onRemove:be},te.field);const Se=C[te.field]??new Set;return te.values.length<=oM?m.jsx(sM,{label:pe,values:te.values,selected:Se,onToggle:Re=>V(te.field,Re),onRemove:be},te.field):m.jsx(cM,{label:pe,values:te.values,selected:Se,onToggle:Re=>V(te.field,Re),multi:te.uiHint==="multiselect",onRemove:be},te.field)}return n?m.jsxs("div",{className:"fixed inset-0 z-[100] flex items-start justify-center pt-[5vh]",onClick:r,children:[m.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm"}),m.jsxs("div",{className:"relative bg-background border border-border rounded-lg shadow-2xl w-full max-w-4xl max-h-[85vh] flex flex-col",onClick:te=>te.stopPropagation(),children:[m.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border",children:[m.jsx(Cb,{className:"h-5 w-5 text-muted-foreground shrink-0"}),m.jsx("input",{ref:fe,type:"text",value:o,onChange:te=>G(te.target.value),onKeyDown:te=>{te.key==="Escape"&&r()},placeholder:"Search documents...",className:"flex-1 bg-transparent outline-none text-foreground placeholder:text-muted-foreground"}),d&&m.jsx("div",{className:"h-4 w-4 border-2 border-primary border-t-transparent rounded-full animate-spin"}),(o||c.length>0)&&m.jsx("button",{onClick:ee,className:"text-muted-foreground hover:text-foreground",title:"Reset search",children:m.jsx(nR,{className:"h-4 w-4"})}),m.jsx("button",{onClick:r,className:"text-muted-foreground hover:text-foreground",title:"Close (Esc)",children:m.jsx(Za,{className:"h-5 w-5"})})]}),m.jsxs("div",{className:"px-4 py-2 border-b border-border flex flex-col gap-1.5",children:[ae.map(ye),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsxs("div",{className:"relative",ref:ge,children:[m.jsxs("button",{onClick:()=>{ne||Z(),ce(!ne)},className:"text-xs px-2 py-0.5 rounded border border-dashed border-border text-muted-foreground hover:text-foreground hover:border-foreground transition-colors flex items-center gap-1",children:[m.jsx(ZN,{className:"h-3 w-3"}),S?"Loading filters...":"Add filter"]}),ne&&m.jsxs("div",{className:"absolute top-full left-0 mt-1 z-50 bg-background border border-border rounded shadow-lg w-56 max-h-48 flex flex-col",children:[m.jsx("div",{className:"p-1.5 border-b border-border",children:m.jsx("input",{type:"text",value:me,onChange:te=>re(te.target.value),placeholder:"Search filters...",className:"text-xs w-full px-2 py-1 rounded border border-border bg-muted text-foreground placeholder:text-muted-foreground outline-none focus:border-primary",autoFocus:!0})}),m.jsxs("div",{className:"overflow-y-auto flex-1",children:[S&&m.jsxs("div",{className:"px-3 py-2 text-xs text-muted-foreground flex items-center gap-2",children:[m.jsx("div",{className:"h-3 w-3 border-2 border-primary border-t-transparent rounded-full animate-spin"}),"Loading..."]}),!S&&De.length===0&&m.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:x.length===0?"No filters available":"All filters active"}),De.map(te=>m.jsxs("button",{onClick:()=>{P(te.field),ce(!1),re("")},className:"w-full text-left text-xs px-3 py-1.5 hover:bg-accent transition-colors flex items-center justify-between",children:[m.jsx("span",{className:"text-foreground",children:Wr(te.field)}),m.jsx("span",{className:"text-[10px] text-muted-foreground",children:te.uiHint==="text"||te.uiHint==="number"?te.uiHint:`${te.values.length}`})]},te.field))]})]})]}),Q.length>0&&m.jsxs("button",{onClick:()=>q(!X),className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/10 text-amber-600 border border-amber-500/30 hover:bg-amber-500/20 transition-colors",title:"Show inference rule issues",children:[Q.length," issue",Q.length!==1?"s":""]})]}),X&&Q.length>0&&m.jsxs("div",{className:"mt-1 p-2 rounded border border-amber-500/30 bg-amber-500/5 text-xs max-h-32 overflow-y-auto",children:[m.jsx("div",{className:"text-amber-600 font-medium mb-1",children:"Filtered facet values (inference rule issues):"}),Q.map(te=>m.jsxs("div",{className:"mb-1",children:[m.jsx("span",{className:"text-foreground font-medium",children:Wr(te.field)}),m.jsx("span",{className:"text-muted-foreground",children:": "}),te.removed.map((pe,be)=>m.jsxs("span",{className:"text-amber-700",children:[be>0&&", ",m.jsx("code",{className:"bg-amber-500/10 px-0.5 rounded",children:pe})]},be))]},te.field))]})]}),m.jsxs("div",{className:"overflow-y-auto flex-1",children:[y&&m.jsx("div",{className:"px-4 py-3 text-sm text-red-500",children:y}),!y&&c.length===0&&o.trim()&&!d&&m.jsx("div",{className:"px-4 py-8 text-center text-muted-foreground text-sm",children:"No results found"}),!y&&!o.trim()&&!d&&m.jsx("div",{className:"px-4 py-8 text-center text-muted-foreground text-sm",children:"Type a query to search across all documents"}),c.map(te=>m.jsx(mM,{result:te,facets:x,onNavigate:R,onChipClick:U},te.browsePath))]}),c.length>0&&m.jsxs("div",{className:"px-4 py-2 border-t border-border text-xs text-muted-foreground",children:[c.length," result",c.length!==1?"s":""]})]})]}):null}const Mv="https://github.com/karmaniverous/jeeves-server";function hd({breadcrumbs:n=[],isInsider:r,searchEnabled:o,theme:i,onToggleTheme:c,keyAge:f,onRotateKey:d,downloadDropdown:h,linkControls:y,downloadMenuItem:p,linkMenuItem:x}){const b=r&&d,[S,E]=g.useState(null),[A,C]=g.useState(!1),N=g.useCallback(D=>{(D.metaKey||D.ctrlKey)&&D.key==="k"&&(D.preventDefault(),C(!0))},[]);g.useEffect(()=>{if(o&&r)return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[o,r,N]),g.useEffect(()=>{fetch("/api/readme-link").then(D=>D.ok?D.json():null).then(D=>{D?.url&&E(D.url)}).catch(()=>{})},[]);const _=[],H="flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-accent transition-colors w-full text-left cursor-pointer";return x&&_.push({breakpoint:"bp-400",node:x,hasNestedDropdown:!0}),p&&_.push({breakpoint:"bp-480",node:p,hasNestedDropdown:!0}),b&&_.push({breakpoint:"sm",node:m.jsxs("button",{onClick:d,className:H,children:[m.jsx(lv,{className:"h-4 w-4 shrink-0"}),"Rotate key",f?` (${f})`:""]})}),r&&_.push({breakpoint:"md",node:m.jsxs(Ln,{to:"/runner",className:H,children:[m.jsx(ev,{className:"h-4 w-4 shrink-0"}),"Runner"]})}),S&&_.push({breakpoint:"md",node:m.jsxs("a",{href:S,className:H,children:[m.jsx(tv,{className:"h-4 w-4 shrink-0"}),"README"]})}),_.push({breakpoint:"md",node:m.jsxs("a",{href:Mv,target:"_blank",rel:"noopener noreferrer",className:H,children:[m.jsx(av,{className:"h-4 w-4 shrink-0"}),"GitHub"]})}),_.push({breakpoint:"md",node:m.jsxs("button",{onClick:c,className:H,children:[i==="dark"?m.jsx(ov,{className:"h-4 w-4 shrink-0"}):m.jsx(rv,{className:"h-4 w-4 shrink-0"}),i==="dark"?"Light mode":"Dark mode"]})}),m.jsxs("header",{className:"bg-zinc-800 text-white px-4 py-2",children:[m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsxs("div",{className:"flex items-center min-w-0 flex-1",children:[m.jsx(Ln,{to:"/browse",className:"text-3xl no-underline shrink-0 mr-1",title:"Jeeves Server",children:"🎩"}),m.jsx("nav",{className:"flex items-center gap-1 min-w-0 overflow-x-auto overflow-y-hidden scrollbar-thin",children:n.map((D,B)=>m.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[m.jsx("span",{className:"text-zinc-500 mx-0.5",children:"/"}),B===n.length-1?m.jsx("span",{className:"text-zinc-300 truncate max-w-48",children:D.label}):m.jsx(Ln,{to:`/browse/${D.path}`,className:"text-blue-400 hover:underline truncate max-w-48",children:D.label})]},D.path))})]}),m.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[o&&r&&m.jsx(Qt,{variant:"ghost",size:"icon",className:"text-zinc-300 hover:text-white hover:bg-white/10 h-8 w-8",title:"Search (Ctrl+K)",onClick:()=>C(!0),children:m.jsx(Cb,{className:"h-4 w-4"})}),y&&m.jsx("div",{className:"hidden min-[400px]:flex items-center",children:y}),h&&m.jsx("div",{className:"hidden min-[480px]:flex items-center",children:h}),b&&m.jsxs("div",{className:"hidden sm:flex items-center gap-1",children:[m.jsx(Qt,{variant:"ghost",size:"icon",className:"text-zinc-300 hover:text-white hover:bg-white/10 h-8 w-8",title:"Rotate key (invalidates all your shares)",onClick:d,children:m.jsx(lv,{className:"h-4 w-4"})}),f&&m.jsx("span",{className:"text-xs text-zinc-500",children:f})]}),r&&m.jsx(Ln,{to:"/runner",title:"Runner Dashboard",className:"hidden md:inline-flex",children:m.jsx(Qt,{variant:"ghost",size:"icon",className:"text-zinc-300 hover:text-white hover:bg-white/10 h-8 w-8",children:m.jsx(ev,{className:"h-4 w-4"})})}),S&&m.jsx("a",{href:S,title:"README",className:"hidden md:inline-flex",children:m.jsx(Qt,{variant:"ghost",size:"icon",className:"text-zinc-300 hover:text-white hover:bg-white/10 h-8 w-8",children:m.jsx(tv,{className:"h-4 w-4"})})}),m.jsx("a",{href:Mv,target:"_blank",rel:"noopener noreferrer",title:"GitHub",className:"hidden md:inline-flex",children:m.jsx(Qt,{variant:"ghost",size:"icon",className:"text-zinc-300 hover:text-white hover:bg-white/10 h-8 w-8",children:m.jsx(av,{className:"h-4 w-4"})})}),m.jsx(Qt,{variant:"ghost",size:"icon",className:"text-zinc-300 hover:text-white hover:bg-white/10 h-8 w-8 hidden md:inline-flex",title:"Toggle theme",onClick:c,children:i==="dark"?m.jsx(ov,{className:"h-4 w-4"}):m.jsx(rv,{className:"h-4 w-4"})}),m.jsx(rM,{theme:i,onToggleTheme:c,collapsedItems:_})]})]}),o&&r&&m.jsx(hM,{open:A,onClose:()=>C(!1)})]})}function pM({reqPath:n,file:r,fileRendered:o,viewTab:i,setViewTab:c,proseWidth:f,toggleProseWidth:d,isInsider:h,editing:y,setEditing:p,mobileTocOpen:x,setMobileTocOpen:b,loading:S}){if(!r&&!S)return null;const E=(o?Mf(o):!1)||(r?Mf(r):W_(n)),A=E?i:"raw";return m.jsxs("div",{className:"flex items-center gap-1 border-b border-border bg-background px-4 md:px-6",children:[o?.headings&&o.headings.length>2&&m.jsx("button",{onClick:()=>b(!x),className:"lg:hidden p-1.5 mr-1 text-muted-foreground hover:text-foreground transition-colors",title:"Table of contents",children:x?m.jsx(Za,{className:"h-4 w-4"}):m.jsx(HN,{className:"h-4 w-4"})}),E&&m.jsx("button",{onClick:()=>c("rendered"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${A==="rendered"?"border-blue-500 text-blue-500":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Rendered"}),m.jsx("button",{onClick:()=>c("raw"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${A==="raw"?"border-blue-500 text-blue-500":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Raw"}),r?.type==="markdown"&&A==="rendered"&&m.jsx("div",{className:"hidden md:flex items-center ml-2 border border-border rounded-md overflow-hidden",children:["narrow","medium","wide"].map(C=>m.jsx("button",{onClick:()=>d(C),className:`p-1.5 transition-colors ${f===C?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,title:`${C.charAt(0).toUpperCase()+C.slice(1)} width`,children:C==="narrow"?m.jsx(GN,{className:"h-3.5 w-3.5"}):C==="medium"?m.jsx(qN,{className:"h-3.5 w-3.5"}):m.jsx(LN,{className:"h-3.5 w-3.5"})},C))}),h&&A==="raw"&&r?.content!=null&&!y&&m.jsxs("button",{onClick:()=>p(!0),className:"ml-2 flex items-center gap-1 px-2 py-1 text-sm text-muted-foreground hover:text-foreground border border-border rounded transition-colors",title:"Edit file",children:[m.jsx(XN,{className:"h-3.5 w-3.5"})," Edit"]})]})}function gM(n,r){const[o,i]=g.useState(null),[c,f]=g.useState(null),[d,h]=g.useState(null),[y,p]=g.useState(null),[x,b]=g.useState(!0),[S,E]=g.useState(null),[A,C]=g.useState(!1),N=r.get("tab")==="raw"?"raw":"rendered",[_,H]=g.useState(N),D=y??d,B=g.useCallback(async(W,X)=>{if(b(!0),E(null),i(null),f(null),h(null),p(null),C(!1),H(X.get("tab")==="raw"?"raw":"rendered"),W)try{const q=await uE(W);"entries"in q?(f(q),b(!1)):(Pu(W).then(ne=>{h(ne),b(!1)}).catch(()=>{}),Fu(W).then(p).catch(()=>{}))}catch{Pu(W).then(q=>{h(q),b(!1)}).catch(q=>{E(q.message),b(!1)}),Fu(W).then(p).catch(()=>{})}else try{const q=await cE();i(q)}catch(q){E(q.message)}finally{b(!1)}},[]);return g.useEffect(()=>{B(n,r)},[B,n]),{drives:o,directory:c,fileRaw:d,fileRendered:y,file:D,loading:x,error:S,editing:A,setEditing:C,viewTab:_,setViewTab:H,handleSave:async W=>{await mE(n,W);const X=await Pu(n);h(X);try{const q=await Fu(n);p(q)}catch{}C(!1)}}}function vM(){const n=localStorage.getItem("jeeves-share-settings");if(n)try{return JSON.parse(n)}catch{}return{expiry:localStorage.getItem("jeeves-share-expiry")??"",depth:0,dirs:!1}}function yM(){const[n,r]=g.useState(vM);return g.useEffect(()=>{localStorage.setItem("jeeves-share-settings",JSON.stringify(n))},[n]),{shareSettings:n,setShareSettings:r}}function bM(n=""){const r=g.useRef(null),o=g.useRef(null),[i,c]=g.useState(96),f=g.useCallback(()=>{r.current&&c(r.current.offsetHeight)},[]);return g.useEffect(()=>(f(),window.addEventListener("resize",f),()=>window.removeEventListener("resize",f)),[f]),g.useEffect(()=>{f()},[f,n]),{topBarRef:r,mainRef:o,topBarHeight:i}}function xM(n){const r=Date.now()-new Date(n).getTime(),o=Math.floor(r/6e4);if(o<60)return`${String(o)}m ago`;const i=Math.floor(o/60);if(i<24)return`${String(i)}h ago`;const c=Math.floor(i/24);return`${String(c)}d ago`}function wM(){const r=Kv()["*"]??"",[o,i]=tE(),[c,f]=Cs();g.useEffect(()=>{const P="Jeeves Server",I=r.split("/").filter(Boolean),ae=I.length?I[I.length-1]:"",le=ae?decodeURIComponent(ae):"";document.title=le?`${le} - ${P}`:P},[r]);const{drives:d,directory:h,fileRaw:y,fileRendered:p,file:x,loading:b,error:S,editing:E,setEditing:A,viewTab:C,setViewTab:N,handleSave:_}=gM(r,o),H=P=>{N(P),i(I=>{const ae=new URLSearchParams(I);return P==="rendered"?ae.delete("tab"):ae.set("tab",P),ae},{replace:!0})},{shareSettings:D,setShareSettings:B}=yM(),[Q,W]=g.useState(!1),[X,q]=g.useState(()=>localStorage.getItem("jeeves-prose-width")??"medium"),ne=P=>{q(P),localStorage.setItem("jeeves-prose-width",P)},{isInsider:ce,searchEnabled:me,keyCreatedAt:re,rotateKey:ge}=uo(),fe=h?.breadcrumbs??x?.breadcrumbs??[],de=h?.isInsider??x?.isInsider??ce,j=re?xM(re):null,[Z,ee]=g.useState(!1),z=()=>ee(!0),G=async()=>{ee(!1),await ge()},{topBarRef:R,mainRef:U,topBarHeight:V}=bM(JSON.stringify([x,h,d]));return{reqPath:r,theme:c,toggleTheme:f,shareSettings:D,setShareSettings:B,mobileTocOpen:Q,setMobileTocOpen:W,proseWidth:X,toggleProseWidth:ne,drives:d,directory:h,fileRaw:y,fileRendered:p,file:x,loading:b,error:S,editing:E,setEditing:A,viewTab:C,setViewTab:H,breadcrumbs:fe,isInsider:de,searchEnabled:me,keyAge:j,rotateKeyDialogOpen:Z,setRotateKeyDialogOpen:ee,handleRotateKey:z,confirmRotateKey:G,topBarRef:R,mainRef:U,topBarHeight:V,handleSave:_}}function SM(){const{reqPath:n,theme:r,toggleTheme:o,shareSettings:i,setShareSettings:c,mobileTocOpen:f,setMobileTocOpen:d,proseWidth:h,toggleProseWidth:y,drives:p,directory:x,fileRaw:b,fileRendered:S,file:E,loading:A,error:C,editing:N,setEditing:_,viewTab:H,setViewTab:D,breadcrumbs:B,isInsider:Q,searchEnabled:W,keyAge:X,rotateKeyDialogOpen:q,setRotateKeyDialogOpen:ne,handleRotateKey:ce,confirmRotateKey:me,topBarRef:re,mainRef:ge,topBarHeight:fe,handleSave:de}=wM(),j=E||A&&!!n;return m.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[m.jsxs("div",{ref:re,className:"fixed top-0 left-0 right-0 z-50",children:[m.jsx(hd,{breadcrumbs:B,isInsider:Q,searchEnabled:W,theme:r,onToggleTheme:o,keyAge:N?void 0:X,onRotateKey:N?void 0:ce,downloadDropdown:N?void 0:E?m.jsx(Ir,{reqPath:n,file:E,isInsider:Q,variant:"header"}):x?m.jsx(Ir,{reqPath:n,file:null,isDirectory:!0,isInsider:Q,variant:"header"}):void 0,downloadMenuItem:N?void 0:E?(Z=>m.jsx(Ir,{reqPath:n,file:E,isInsider:Q,variant:"menuItem",onStateChange:ee=>{ee==="done"&&setTimeout(Z,800)}})):x?(Z=>m.jsx(Ir,{reqPath:n,file:null,isDirectory:!0,isInsider:Q,variant:"menuItem",onStateChange:ee=>{ee==="done"&&setTimeout(Z,800)}})):void 0,linkControls:N?void 0:Q?m.jsx(us,{path:`/${n}`,shareSettings:i,onShareSettingsChange:c,showEvent:!0,showRaw:!!E,variant:"header",isDirectory:!E}):void 0,linkMenuItem:N?void 0:Q?(Z=>m.jsx(us,{path:`/${n}`,shareSettings:i,onShareSettingsChange:c,showEvent:!0,showRaw:!!E,variant:"menuItem",isDirectory:!E,onStateChange:ee=>{ee==="done"&&setTimeout(Z,800)}})):void 0}),j&&m.jsx(pM,{reqPath:n,file:E,fileRendered:S,viewTab:H,setViewTab:D,proseWidth:h,toggleProseWidth:y,isInsider:Q,editing:N,setEditing:_,mobileTocOpen:f,setMobileTocOpen:d,loading:A})]}),m.jsxs("main",{ref:ge,className:j?"px-0 pb-32 overflow-y-auto":"p-4 pb-32 md:px-6 md:pt-6 overflow-y-auto",style:{marginTop:`${fe}px`,height:`calc(100vh - ${fe}px)`},children:[A&&!n&&m.jsx("div",{className:"text-muted-foreground text-sm",children:"Loading..."}),C&&m.jsxs("div",{className:"text-destructive text-sm",children:["Error: ",C]}),!A&&!C&&p&&m.jsx(s_,{drives:p,isInsider:Q,shareSettings:i,onShareSettingsChange:c}),!A&&!C&&x&&m.jsx(i_,{entries:x.entries,basePath:n,isInsider:Q,shareSettings:i,onShareSettingsChange:c}),!C&&j&&m.jsx(aM,{reqPath:n,file:E,fileRaw:b,fileRendered:S,viewTab:H,editing:N,setEditing:_,proseWidth:h,topBarHeight:fe,mainRef:ge,mobileTocOpen:f,setMobileTocOpen:d,onSave:de,loading:A})]}),m.jsx(nN,{open:q,onOpenChange:ne,title:"Rotate insider key?",description:"This will invalidate ALL existing share links generated with your current key. This action cannot be undone.",confirmLabel:"Rotate Key",onConfirm:()=>{me()}})]})}function EM(){const{loading:n,authenticated:r}=uo(),o=so();return g.useEffect(()=>{!n&&r&&o("/browse",{replace:!0})},[n,r,o]),n?m.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:m.jsx("div",{className:"text-muted-foreground text-sm",children:"Loading..."})}):m.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:m.jsxs("div",{className:"text-center space-y-6",children:[m.jsx("div",{className:"text-6xl mb-2",children:"🎩"}),m.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:"Jeeves"}),m.jsx("p",{className:"text-muted-foreground text-sm max-w-xs mx-auto",children:"File browser and document server"}),m.jsxs("a",{href:"/auth/login?returnTo=/browse",className:"inline-flex items-center gap-3 px-6 py-3 bg-white text-zinc-800 rounded-lg shadow-md hover:shadow-lg transition-shadow font-medium text-sm border border-zinc-200",children:[m.jsxs("svg",{viewBox:"0 0 24 24",width:"20",height:"20",className:"shrink-0",children:[m.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z"}),m.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),m.jsx("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),m.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]}),"Sign in with Google"]})]})})}const CM={ok:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",error:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400",running:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400",disabled:"bg-zinc-100 text-zinc-500 dark:bg-zinc-800 dark:text-zinc-400",pending:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400"},NM="bg-zinc-100 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-300";function pd({status:n}){const r=n??"pending",o=CM[r]??NM;return m.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${o}`,children:r})}const wa={name:"w-[30%] px-3 py-2",type:"w-[10%] px-3 py-2",schedule:"w-[15%] px-3 py-2",status:"w-[12%] px-3 py-2",lastRun:"w-[25%] px-3 py-2",action:"w-[8%] px-3 py-2"};function RM(n){if(!n)return"—";try{return new Date(n).toLocaleString()}catch{return n}}function AM({column:n,sort:r}){return r.column!==n?m.jsx(hN,{className:"h-3 w-3 opacity-40"}):r.direction==="asc"?m.jsx(gN,{className:"h-3 w-3"}):m.jsx(uN,{className:"h-3 w-3"})}const TM=[{key:"name",label:"Name"},{key:"type",label:"Type"},{key:"schedule",label:"Schedule"},{key:"status",label:"Status"},{key:"lastRun",label:"Last Run"}];function _M({sort:n,onSort:r}){return m.jsx("div",{className:"overflow-x-auto",children:m.jsx("table",{className:"w-full text-sm",children:m.jsx("thead",{children:m.jsxs("tr",{className:"border-b border-border text-left",children:[TM.map(o=>m.jsx("th",{className:`${wa[o.key]} font-medium text-muted-foreground cursor-pointer select-none hover:text-foreground transition-colors`,onClick:()=>r(o.key),children:m.jsxs("span",{className:"inline-flex items-center gap-1",children:[o.label,m.jsx(AM,{column:o.key,sort:n})]})},o.key)),m.jsx("th",{className:`${wa.action} font-medium text-muted-foreground`})]})})})})}function MM({jobs:n,onRunNow:r}){const o=so();return n.length===0?m.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No jobs found"}):m.jsx("div",{className:"overflow-x-auto",children:m.jsx("table",{className:"w-full text-sm",children:m.jsx("tbody",{children:n.map(i=>m.jsxs("tr",{className:"border-b border-border hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>o(`/runner/${i.id}`),children:[m.jsx("td",{className:`${wa.name} font-medium`,children:i.name}),m.jsx("td",{className:`${wa.type} text-muted-foreground`,children:i.type}),m.jsx("td",{className:`${wa.schedule} font-mono text-xs text-muted-foreground`,children:i.schedule}),m.jsx("td",{className:wa.status,children:m.jsx(pd,{status:i.enabled?i.status:"disabled"})}),m.jsx("td",{className:`${wa.lastRun} text-muted-foreground text-xs`,children:RM(i.lastRun)}),m.jsx("td",{className:wa.action,children:m.jsx(Qt,{variant:"ghost",size:"icon",className:"h-7 w-7",title:"Run Now",onClick:c=>{c.stopPropagation(),r(i.id)},children:m.jsx(Eb,{className:"h-3.5 w-3.5"})})})]},i.id))})})})}function jM(n,r){return[...n].sort((o,i)=>{if(r.column){const f=OM(o,i,r.column);if(f!==0)return r.direction==="asc"?f:-f}const c=Zx(o.lastRun,i.lastRun);return c!==0?-c:o.name.localeCompare(i.name)})}function OM(n,r,o){switch(o){case"name":return n.name.localeCompare(r.name);case"type":return n.type.localeCompare(r.type);case"schedule":return n.schedule.localeCompare(r.schedule);case"status":{const i=n.enabled?n.status??"":"disabled",c=r.enabled?r.status??"":"disabled";return i.localeCompare(c)}case"lastRun":return Zx(n.lastRun,r.lastRun);default:return 0}}function Zx(n,r){return!n&&!r?0:n?r?n<r?-1:n>r?1:0:1:-1}function DM(n,r){return n.column===r?n.direction==="desc"?{column:r,direction:"asc"}:{column:null,direction:"desc"}:{column:r,direction:"desc"}}function Ki({label:n,value:r,color:o}){return m.jsxs("div",{className:"flex flex-col items-center px-3 py-1",children:[m.jsx("span",{className:`text-lg font-bold leading-tight ${o}`,children:r}),m.jsx("span",{className:"text-xs text-muted-foreground",children:n})]})}function zM({stats:n}){return n?m.jsxs("div",{className:"flex flex-wrap items-center gap-1 px-2 py-1 bg-muted/50 rounded-lg",children:[m.jsx(Ki,{label:"Total",value:n.totalJobs,color:"text-foreground"}),m.jsx(Ki,{label:"Running",value:n.running,color:"text-yellow-600 dark:text-yellow-400"}),m.jsx(Ki,{label:"OK (1h)",value:n.okLastHour,color:"text-green-600 dark:text-green-400"}),m.jsx(Ki,{label:"Errors (1h)",value:n.errorsLastHour,color:"text-red-600 dark:text-red-400"})]}):m.jsx("div",{className:"flex items-center gap-4 p-4 bg-muted/50 rounded-lg",children:m.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading stats..."})})}const kM="/api/runner";async function el(n,r){const o=await fetch(Jl(`${kM}${n}`),{...r,credentials:"same-origin"});if(o.status===401)throw window.location.href=`/auth/login?returnTo=${encodeURIComponent(window.location.pathname)}`,new Error("Unauthorized");if(!o.ok){const i=await o.text();throw new Error(`Runner API error ${String(o.status)}: ${i}`)}return o.json()}function Fx(n){return{id:n.id,name:n.name,type:n.type,schedule:n.schedule,enabled:n.enabled===1,overlapPolicy:n.overlap_policy,status:n.last_status,lastRun:n.last_run,description:n.description}}function LM(n){return{id:n.id,jobId:n.job_id,status:n.status,trigger:n.trigger,startedAt:n.started_at,finishedAt:n.finished_at,durationMs:n.duration_ms,exitCode:n.exit_code,stdoutTail:n.stdout_tail,stderrTail:n.stderr_tail}}async function UM(){return await el("/stats")}async function HM(){return(await el("/jobs")).jobs.map(Fx)}async function BM(n){const r=await el(`/jobs/${encodeURIComponent(n)}`);return Fx(r.job)}async function GM(n,r=20){return(await el(`/jobs/${encodeURIComponent(n)}/runs?limit=${String(r)}`)).runs.map(LM)}async function Px(n){return el(`/jobs/${encodeURIComponent(n)}/run`,{method:"POST"})}async function YM(n){return el(`/jobs/${encodeURIComponent(n)}/enable`,{method:"POST"})}async function qM(n){return el(`/jobs/${encodeURIComponent(n)}/disable`,{method:"POST"})}const VM=1e4;function $M(){const[n,r]=g.useState([]),[o,i]=g.useState(null),[c,f]=g.useState(null),[d,h]=g.useState(!0),[y,p]=g.useState(!0),[x,b]=g.useState({column:null,direction:"desc"}),S=g.useRef(null),[E,A]=Cs(),{isInsider:C,searchEnabled:N,keyCreatedAt:_,rotateKey:H}=uo(),D=_?`${Math.floor((Date.now()-new Date(_).getTime())/864e5)}d`:null,B=g.useCallback(async()=>{try{const[ne,ce]=await Promise.all([HM(),UM()]);r(ne),i(ce),f(null)}catch(ne){f(ne instanceof Error?ne.message:"Failed to fetch runner data")}finally{h(!1)}},[]);g.useEffect(()=>{B()},[B]),g.useEffect(()=>(y&&(S.current=setInterval(()=>{B()},VM)),()=>{S.current&&clearInterval(S.current)}),[y,B]);const Q=g.useCallback(async ne=>{try{await Px(ne),await B()}catch{await B()}},[B]),W=g.useCallback(ne=>{b(ce=>DM(ce,ne))},[]),X=g.useMemo(()=>jM(n,x),[n,x]),q=[{label:"Runner",path:"runner"}];return m.jsx("div",{className:`h-screen overflow-hidden ${E==="dark"?"dark":""}`,children:m.jsxs("div",{className:"h-full flex flex-col bg-background text-foreground",children:[m.jsx(hd,{breadcrumbs:q,isInsider:C,searchEnabled:N,theme:E,onToggleTheme:A,keyAge:D,onRotateKey:H}),m.jsxs("div",{className:"shrink-0 max-w-6xl mx-auto w-full px-4 pt-2 pb-1 flex items-center justify-between",children:[!d&&m.jsx(zM,{stats:o}),m.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[m.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground cursor-pointer",children:[m.jsx("input",{type:"checkbox",checked:y,onChange:ne=>p(ne.target.checked),className:"rounded"}),"Auto-refresh"]}),m.jsx(Qt,{variant:"ghost",size:"icon",className:"h-7 w-7",title:"Refresh now",onClick:()=>{B()},children:m.jsx(eR,{className:"h-3.5 w-3.5"})})]})]}),c&&m.jsx("div",{className:"shrink-0 max-w-6xl mx-auto w-full px-4 pt-2",children:m.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 text-red-700 dark:text-red-400 px-4 py-3 rounded-lg text-sm",children:c})}),d?m.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Loading..."}):m.jsx("div",{className:"flex-1 min-h-0 max-w-6xl mx-auto w-full px-4 pt-1 flex flex-col",children:m.jsxs("div",{className:"flex-1 min-h-0 bg-card border border-border rounded-lg flex flex-col",children:[m.jsx("div",{className:"shrink-0",children:m.jsx(_M,{sort:x,onSort:W})}),m.jsx("div",{className:"flex-1 overflow-y-auto pb-32",children:m.jsx(MM,{jobs:X,onRunNow:ne=>{Q(ne)}})})]})})]})})}function XM(n){if(n===null)return"—";if(n<1e3)return`${String(n)}ms`;const r=n/1e3;if(r<60)return`${r.toFixed(1)}s`;const o=Math.floor(r/60),i=Math.round(r%60);return`${String(o)}m ${String(i)}s`}function KM(n){if(!n)return"—";try{return new Date(n).toLocaleString()}catch{return n}}function QM({runs:n}){const[r,o]=g.useState(new Set),i=c=>{const f=String(c);o(d=>{const h=new Set(d);return h.has(f)?h.delete(f):h.add(f),h})};return n.length===0?m.jsx("div",{className:"text-center py-6 text-muted-foreground text-sm",children:"No runs yet"}):m.jsx("div",{className:"overflow-x-auto",children:m.jsxs("table",{className:"w-full text-sm",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"border-b border-border text-left",children:[m.jsx("th",{className:"px-3 py-2 w-8"}),m.jsx("th",{className:"px-3 py-2 font-medium text-muted-foreground",children:"Status"}),m.jsx("th",{className:"px-3 py-2 font-medium text-muted-foreground",children:"Trigger"}),m.jsx("th",{className:"px-3 py-2 font-medium text-muted-foreground",children:"Started"}),m.jsx("th",{className:"px-3 py-2 font-medium text-muted-foreground",children:"Duration"}),m.jsx("th",{className:"px-3 py-2 font-medium text-muted-foreground",children:"Exit"})]})}),m.jsx("tbody",{children:n.map(c=>m.jsx(ZM,{run:c,isExpanded:r.has(String(c.id)),onToggle:()=>i(c.id)},c.id))})]})})}function ZM({run:n,isExpanded:r,onToggle:o}){const i=n.stdoutTail||n.stderrTail;return m.jsxs(m.Fragment,{children:[m.jsxs("tr",{className:`border-b border-border transition-colors ${i?"cursor-pointer hover:bg-muted/50":""}`,onClick:i?o:void 0,children:[m.jsx("td",{className:"px-3 py-2",children:i&&(r?m.jsx(Ff,{className:"h-4 w-4 text-muted-foreground"}):m.jsx(wb,{className:"h-4 w-4 text-muted-foreground"}))}),m.jsx("td",{className:"px-3 py-2",children:m.jsx(pd,{status:n.status})}),m.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:n.trigger}),m.jsx("td",{className:"px-3 py-2 text-muted-foreground text-xs",children:KM(n.startedAt)}),m.jsx("td",{className:"px-3 py-2 text-muted-foreground text-xs",children:XM(n.durationMs)}),m.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:n.exitCode!==null?String(n.exitCode):"—"})]}),r&&i&&m.jsx("tr",{children:m.jsxs("td",{colSpan:6,className:"px-3 py-2 bg-muted/30",children:[m.jsx(jv,{label:"stdout",content:n.stdoutTail}),m.jsx(jv,{label:"stderr",content:n.stderrTail})]})})]})}function jv({label:n,content:r}){return r?m.jsxs("div",{className:"mb-2 last:mb-0",children:[m.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:n}),m.jsx("pre",{className:"text-xs bg-zinc-900 text-zinc-200 p-2 rounded overflow-x-auto max-h-48 whitespace-pre-wrap",children:r})]}):null}function FM(){const{jobId:n}=Kv(),[r,o]=g.useState(null),[i,c]=g.useState([]),[f,d]=g.useState(null),[h,y]=g.useState(!0),[p,x]=Cs(),{isInsider:b,searchEnabled:S,keyCreatedAt:E,rotateKey:A}=uo(),C=E?`${Math.floor((Date.now()-new Date(E).getTime())/864e5)}d`:null,N=g.useCallback(async()=>{if(n)try{const[B,Q]=await Promise.all([BM(n),GM(n,50)]);o(B),c(Q),d(null)}catch(B){d(B instanceof Error?B.message:"Failed to fetch job")}finally{y(!1)}},[n]);g.useEffect(()=>{N()},[N]);const _=g.useCallback(async()=>{if(r)try{r.enabled?await qM(r.id):await YM(r.id),await N()}catch{await N()}},[r,N]),H=g.useCallback(async()=>{if(r)try{await Px(r.id),setTimeout(()=>{N()},500)}catch{await N()}},[r,N]),D=[{label:"Runner",path:"runner"},{label:r?.name??n??"",path:`runner/${n}`}];return m.jsx("div",{className:`h-screen overflow-hidden ${p==="dark"?"dark":""}`,children:m.jsxs("div",{className:"h-full flex flex-col bg-background text-foreground",children:[m.jsx(hd,{breadcrumbs:D,isInsider:b,searchEnabled:S,theme:p,onToggleTheme:x,keyAge:C,onRotateKey:A}),m.jsxs("div",{className:"flex-1 overflow-y-auto max-w-4xl mx-auto px-4 py-6 pb-32 space-y-6 w-full",children:[m.jsxs(Ln,{to:"/runner",className:"inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[m.jsx(dN,{className:"h-4 w-4"}),"Back to jobs"]}),f&&m.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 text-red-700 dark:text-red-400 px-4 py-3 rounded-lg text-sm",children:f}),h?m.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}):r?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"bg-card border border-border rounded-lg p-4 space-y-4",children:[m.jsxs("div",{className:"flex items-start justify-between",children:[m.jsxs("div",{children:[m.jsx("h1",{className:"text-xl font-semibold",children:r.name}),m.jsxs("div",{className:"flex items-center gap-3 mt-2 text-sm text-muted-foreground",children:[m.jsxs("span",{children:["Type: ",m.jsx("span",{className:"text-foreground",children:r.type})]}),m.jsxs("span",{children:["Schedule: ",m.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:r.schedule})]}),m.jsxs("span",{children:["Overlap: ",m.jsx("span",{className:"text-foreground",children:r.overlapPolicy})]})]})]}),m.jsx(pd,{status:r.enabled?r.status:"disabled"})]}),m.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-border",children:[m.jsx(Qt,{variant:"outline",size:"sm",onClick:()=>{_()},className:"gap-1.5",children:r.enabled?m.jsxs(m.Fragment,{children:[m.jsx(PN,{className:"h-3.5 w-3.5"})," Disable"]}):m.jsxs(m.Fragment,{children:[m.jsx(IN,{className:"h-3.5 w-3.5"})," Enable"]})}),m.jsxs(Qt,{variant:"outline",size:"sm",onClick:()=>{H()},className:"gap-1.5",children:[m.jsx(Eb,{className:"h-3.5 w-3.5"}),"Run Now"]})]})]}),m.jsxs("div",{className:"bg-card border border-border rounded-lg overflow-hidden",children:[m.jsx("div",{className:"px-4 py-3 border-b border-border",children:m.jsx("h2",{className:"text-sm font-medium text-muted-foreground",children:"Run History"})}),m.jsx(QM,{runs:i})]})]}):m.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Job not found"})]})]})})}function PM(){return m.jsx(vE,{children:m.jsx(PS,{children:m.jsxs(NS,{children:[m.jsx(Pr,{path:"/runner/:jobId",element:m.jsx(FM,{})}),m.jsx(Pr,{path:"/runner",element:m.jsx($M,{})}),m.jsx(Pr,{path:"/browse/*",element:m.jsx(SM,{})}),m.jsx(Pr,{path:"/",element:m.jsx(EM,{})})]})})})}Tw.createRoot(document.getElementById("root")).render(m.jsx(g.StrictMode,{children:m.jsx(PM,{})}));export{bN as C,Oe as c,V_ as g,m as j,q_ as l,g as r,Cs as u};
62
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return g.useEffect(()=>{document.getElementById(n.current?.getAttribute("aria-describedby"))||console.warn(r)},[r,n]),null},sC=Ly,cC=Uy,Qy=Hy,Zy=By,Fy=$y,Py=Ky,Jy=Yy,Iy=Vy;function Wy(n){var r,o,i="";if(typeof n=="string"||typeof n=="number")i+=n;else if(typeof n=="object")if(Array.isArray(n)){var c=n.length;for(r=0;r<c;r++)n[r]&&(o=Wy(n[r]))&&(i&&(i+=" "),i+=o)}else for(o in n)n[o]&&(i&&(i+=" "),i+=o);return i}function uC(){for(var n,r,o=0,i="",c=arguments.length;o<c;o++)(n=arguments[o])&&(r=Wy(n))&&(i&&(i+=" "),i+=r);return i}const fC=(n,r)=>{const o=new Array(n.length+r.length);for(let i=0;i<n.length;i++)o[i]=n[i];for(let i=0;i<r.length;i++)o[n.length+i]=r[i];return o},dC=(n,r)=>({classGroupId:n,validator:r}),eb=(n=new Map,r=null,o)=>({nextPart:n,validators:r,classGroupId:o}),ns="-",Qg=[],mC="arbitrary..",hC=n=>{const r=gC(n),{conflictingClassGroups:o,conflictingClassGroupModifiers:i}=n;return{getClassGroupId:d=>{if(d.startsWith("[")&&d.endsWith("]"))return pC(d);const h=d.split(ns),y=h[0]===""&&h.length>1?1:0;return tb(h,y,r)},getConflictingClassGroupIds:(d,h)=>{if(h){const y=i[d],p=o[d];return y?p?fC(p,y):y:p||Qg}return o[d]||Qg}}},tb=(n,r,o)=>{if(n.length-r===0)return o.classGroupId;const c=n[r],f=o.nextPart.get(c);if(f){const p=tb(n,r+1,f);if(p)return p}const d=o.validators;if(d===null)return;const h=r===0?n.join(ns):n.slice(r).join(ns),y=d.length;for(let p=0;p<y;p++){const x=d[p];if(x.validator(h))return x.classGroupId}},pC=n=>n.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const r=n.slice(1,-1),o=r.indexOf(":"),i=r.slice(0,o);return i?mC+i:void 0})(),gC=n=>{const{theme:r,classGroups:o}=n;return vC(o,r)},vC=(n,r)=>{const o=eb();for(const i in n){const c=n[i];Qf(c,o,i,r)}return o},Qf=(n,r,o,i)=>{const c=n.length;for(let f=0;f<c;f++){const d=n[f];yC(d,r,o,i)}},yC=(n,r,o,i)=>{if(typeof n=="string"){bC(n,r,o);return}if(typeof n=="function"){xC(n,r,o,i);return}wC(n,r,o,i)},bC=(n,r,o)=>{const i=n===""?r:nb(r,n);i.classGroupId=o},xC=(n,r,o,i)=>{if(SC(n)){Qf(n(i),r,o,i);return}r.validators===null&&(r.validators=[]),r.validators.push(dC(o,n))},wC=(n,r,o,i)=>{const c=Object.entries(n),f=c.length;for(let d=0;d<f;d++){const[h,y]=c[d];Qf(y,nb(r,h),o,i)}},nb=(n,r)=>{let o=n;const i=r.split(ns),c=i.length;for(let f=0;f<c;f++){const d=i[f];let h=o.nextPart.get(d);h||(h=eb(),o.nextPart.set(d,h)),o=h}return o},SC=n=>"isThemeGetter"in n&&n.isThemeGetter===!0,EC=n=>{if(n<1)return{get:()=>{},set:()=>{}};let r=0,o=Object.create(null),i=Object.create(null);const c=(f,d)=>{o[f]=d,r++,r>n&&(r=0,i=o,o=Object.create(null))};return{get(f){let d=o[f];if(d!==void 0)return d;if((d=i[f])!==void 0)return c(f,d),d},set(f,d){f in o?o[f]=d:c(f,d)}}},Ef="!",Zg=":",CC=[],Fg=(n,r,o,i,c)=>({modifiers:n,hasImportantModifier:r,baseClassName:o,maybePostfixModifierPosition:i,isExternal:c}),NC=n=>{const{prefix:r,experimentalParseClassName:o}=n;let i=c=>{const f=[];let d=0,h=0,y=0,p;const x=c.length;for(let C=0;C<x;C++){const N=c[C];if(d===0&&h===0){if(N===Zg){f.push(c.slice(y,C)),y=C+1;continue}if(N==="/"){p=C;continue}}N==="["?d++:N==="]"?d--:N==="("?h++:N===")"&&h--}const b=f.length===0?c:c.slice(y);let S=b,E=!1;b.endsWith(Ef)?(S=b.slice(0,-1),E=!0):b.startsWith(Ef)&&(S=b.slice(1),E=!0);const A=p&&p>y?p-y:void 0;return Fg(f,E,S,A)};if(r){const c=r+Zg,f=i;i=d=>d.startsWith(c)?f(d.slice(c.length)):Fg(CC,!1,d,void 0,!0)}if(o){const c=i;i=f=>o({className:f,parseClassName:c})}return i},RC=n=>{const r=new Map;return n.orderSensitiveModifiers.forEach((o,i)=>{r.set(o,1e6+i)}),o=>{const i=[];let c=[];for(let f=0;f<o.length;f++){const d=o[f],h=d[0]==="[",y=r.has(d);h||y?(c.length>0&&(c.sort(),i.push(...c),c=[]),i.push(d)):c.push(d)}return c.length>0&&(c.sort(),i.push(...c)),i}},AC=n=>({cache:EC(n.cacheSize),parseClassName:NC(n),sortModifiers:RC(n),...hC(n)}),TC=/\s+/,_C=(n,r)=>{const{parseClassName:o,getClassGroupId:i,getConflictingClassGroupIds:c,sortModifiers:f}=r,d=[],h=n.trim().split(TC);let y="";for(let p=h.length-1;p>=0;p-=1){const x=h[p],{isExternal:b,modifiers:S,hasImportantModifier:E,baseClassName:A,maybePostfixModifierPosition:C}=o(x);if(b){y=x+(y.length>0?" "+y:y);continue}let N=!!C,_=i(N?A.substring(0,C):A);if(!_){if(!N){y=x+(y.length>0?" "+y:y);continue}if(_=i(A),!_){y=x+(y.length>0?" "+y:y);continue}N=!1}const H=S.length===0?"":S.length===1?S[0]:f(S).join(":"),D=E?H+Ef:H,B=D+_;if(d.indexOf(B)>-1)continue;d.push(B);const Q=c(_,N);for(let W=0;W<Q.length;++W){const X=Q[W];d.push(D+X)}y=x+(y.length>0?" "+y:y)}return y},MC=(...n)=>{let r=0,o,i,c="";for(;r<n.length;)(o=n[r++])&&(i=ab(o))&&(c&&(c+=" "),c+=i);return c},ab=n=>{if(typeof n=="string")return n;let r,o="";for(let i=0;i<n.length;i++)n[i]&&(r=ab(n[i]))&&(o&&(o+=" "),o+=r);return o},jC=(n,...r)=>{let o,i,c,f;const d=y=>{const p=r.reduce((x,b)=>b(x),n());return o=AC(p),i=o.cache.get,c=o.cache.set,f=h,h(y)},h=y=>{const p=i(y);if(p)return p;const x=_C(y,o);return c(y,x),x};return f=d,(...y)=>f(MC(...y))},OC=[],rt=n=>{const r=o=>o[n]||OC;return r.isThemeGetter=!0,r},lb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,rb=/^\((?:(\w[\w-]*):)?(.+)\)$/i,DC=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,zC=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,kC=/\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$/,LC=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,UC=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,HC=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,va=n=>DC.test(n),Ne=n=>!!n&&!Number.isNaN(Number(n)),ya=n=>!!n&&Number.isInteger(Number(n)),lf=n=>n.endsWith("%")&&Ne(n.slice(0,-1)),kn=n=>zC.test(n),ob=()=>!0,BC=n=>kC.test(n)&&!LC.test(n),Zf=()=>!1,GC=n=>UC.test(n),YC=n=>HC.test(n),qC=n=>!ie(n)&&!se(n),VC=n=>Ra(n,cb,Zf),ie=n=>lb.test(n),Xa=n=>Ra(n,ub,BC),Pg=n=>Ra(n,JC,Ne),$C=n=>Ra(n,db,ob),XC=n=>Ra(n,fb,Zf),Jg=n=>Ra(n,ib,Zf),KC=n=>Ra(n,sb,YC),Gi=n=>Ra(n,mb,GC),se=n=>rb.test(n),Fr=n=>Ja(n,ub),QC=n=>Ja(n,fb),Ig=n=>Ja(n,ib),ZC=n=>Ja(n,cb),FC=n=>Ja(n,sb),Yi=n=>Ja(n,mb,!0),PC=n=>Ja(n,db,!0),Ra=(n,r,o)=>{const i=lb.exec(n);return i?i[1]?r(i[1]):o(i[2]):!1},Ja=(n,r,o=!1)=>{const i=rb.exec(n);return i?i[1]?r(i[1]):o:!1},ib=n=>n==="position"||n==="percentage",sb=n=>n==="image"||n==="url",cb=n=>n==="length"||n==="size"||n==="bg-size",ub=n=>n==="length",JC=n=>n==="number",fb=n=>n==="family-name",db=n=>n==="number"||n==="weight",mb=n=>n==="shadow",IC=()=>{const n=rt("color"),r=rt("font"),o=rt("text"),i=rt("font-weight"),c=rt("tracking"),f=rt("leading"),d=rt("breakpoint"),h=rt("container"),y=rt("spacing"),p=rt("radius"),x=rt("shadow"),b=rt("inset-shadow"),S=rt("text-shadow"),E=rt("drop-shadow"),A=rt("blur"),C=rt("perspective"),N=rt("aspect"),_=rt("ease"),H=rt("animate"),D=()=>["auto","avoid","all","avoid-page","page","left","right","column"],B=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],Q=()=>[...B(),se,ie],W=()=>["auto","hidden","clip","visible","scroll"],X=()=>["auto","contain","none"],q=()=>[se,ie,y],ne=()=>[va,"full","auto",...q()],ce=()=>[ya,"none","subgrid",se,ie],me=()=>["auto",{span:["full",ya,se,ie]},ya,se,ie],re=()=>[ya,"auto",se,ie],ge=()=>["auto","min","max","fr",se,ie],fe=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],de=()=>["start","end","center","stretch","center-safe","end-safe"],j=()=>["auto",...q()],Z=()=>[va,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...q()],ee=()=>[va,"screen","full","dvw","lvw","svw","min","max","fit",...q()],z=()=>[va,"screen","full","lh","dvh","lvh","svh","min","max","fit",...q()],G=()=>[n,se,ie],R=()=>[...B(),Ig,Jg,{position:[se,ie]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],V=()=>["auto","cover","contain",ZC,VC,{size:[se,ie]}],P=()=>[lf,Fr,Xa],I=()=>["","none","full",p,se,ie],ae=()=>["",Ne,Fr,Xa],le=()=>["solid","dashed","dotted","double"],De=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ye=()=>[Ne,lf,Ig,Jg],te=()=>["","none",A,se,ie],pe=()=>["none",Ne,se,ie],be=()=>["none",Ne,se,ie],Se=()=>[Ne,se,ie],Re=()=>[va,"full",...q()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[kn],breakpoint:[kn],color:[ob],container:[kn],"drop-shadow":[kn],ease:["in","out","in-out"],font:[qC],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[kn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[kn],shadow:[kn],spacing:["px",Ne],text:[kn],"text-shadow":[kn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",va,ie,se,N]}],container:["container"],columns:[{columns:[Ne,ie,se,h]}],"break-after":[{"break-after":D()}],"break-before":[{"break-before":D()}],"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:Q()}],overflow:[{overflow:W()}],"overflow-x":[{"overflow-x":W()}],"overflow-y":[{"overflow-y":W()}],overscroll:[{overscroll:X()}],"overscroll-x":[{"overscroll-x":X()}],"overscroll-y":[{"overscroll-y":X()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ne()}],"inset-x":[{"inset-x":ne()}],"inset-y":[{"inset-y":ne()}],start:[{"inset-s":ne(),start:ne()}],end:[{"inset-e":ne(),end:ne()}],"inset-bs":[{"inset-bs":ne()}],"inset-be":[{"inset-be":ne()}],top:[{top:ne()}],right:[{right:ne()}],bottom:[{bottom:ne()}],left:[{left:ne()}],visibility:["visible","invisible","collapse"],z:[{z:[ya,"auto",se,ie]}],basis:[{basis:[va,"full","auto",h,...q()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ne,va,"auto","initial","none",ie]}],grow:[{grow:["",Ne,se,ie]}],shrink:[{shrink:["",Ne,se,ie]}],order:[{order:[ya,"first","last","none",se,ie]}],"grid-cols":[{"grid-cols":ce()}],"col-start-end":[{col:me()}],"col-start":[{"col-start":re()}],"col-end":[{"col-end":re()}],"grid-rows":[{"grid-rows":ce()}],"row-start-end":[{row:me()}],"row-start":[{"row-start":re()}],"row-end":[{"row-end":re()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ge()}],"auto-rows":[{"auto-rows":ge()}],gap:[{gap:q()}],"gap-x":[{"gap-x":q()}],"gap-y":[{"gap-y":q()}],"justify-content":[{justify:[...fe(),"normal"]}],"justify-items":[{"justify-items":[...de(),"normal"]}],"justify-self":[{"justify-self":["auto",...de()]}],"align-content":[{content:["normal",...fe()]}],"align-items":[{items:[...de(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...de(),{baseline:["","last"]}]}],"place-content":[{"place-content":fe()}],"place-items":[{"place-items":[...de(),"baseline"]}],"place-self":[{"place-self":["auto",...de()]}],p:[{p:q()}],px:[{px:q()}],py:[{py:q()}],ps:[{ps:q()}],pe:[{pe:q()}],pbs:[{pbs:q()}],pbe:[{pbe:q()}],pt:[{pt:q()}],pr:[{pr:q()}],pb:[{pb:q()}],pl:[{pl:q()}],m:[{m:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mbs:[{mbs:j()}],mbe:[{mbe:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":q()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":q()}],"space-y-reverse":["space-y-reverse"],size:[{size:Z()}],"inline-size":[{inline:["auto",...ee()]}],"min-inline-size":[{"min-inline":["auto",...ee()]}],"max-inline-size":[{"max-inline":["none",...ee()]}],"block-size":[{block:["auto",...z()]}],"min-block-size":[{"min-block":["auto",...z()]}],"max-block-size":[{"max-block":["none",...z()]}],w:[{w:[h,"screen",...Z()]}],"min-w":[{"min-w":[h,"screen","none",...Z()]}],"max-w":[{"max-w":[h,"screen","none","prose",{screen:[d]},...Z()]}],h:[{h:["screen","lh",...Z()]}],"min-h":[{"min-h":["screen","lh","none",...Z()]}],"max-h":[{"max-h":["screen","lh",...Z()]}],"font-size":[{text:["base",o,Fr,Xa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,PC,$C]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",lf,ie]}],"font-family":[{font:[QC,XC,r]}],"font-features":[{"font-features":[ie]}],"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:[c,se,ie]}],"line-clamp":[{"line-clamp":[Ne,"none",se,Pg]}],leading:[{leading:[f,...q()]}],"list-image":[{"list-image":["none",se,ie]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",se,ie]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:G()}],"text-color":[{text:G()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...le(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ne,"from-font","auto",se,Xa]}],"text-decoration-color":[{decoration:G()}],"underline-offset":[{"underline-offset":[Ne,"auto",se,ie]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:q()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",se,ie]}],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",se,ie]}],"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:U()}],"bg-size":[{bg:V()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ya,se,ie],radial:["",se,ie],conic:[ya,se,ie]},FC,KC]}],"bg-color":[{bg:G()}],"gradient-from-pos":[{from:P()}],"gradient-via-pos":[{via:P()}],"gradient-to-pos":[{to:P()}],"gradient-from":[{from:G()}],"gradient-via":[{via:G()}],"gradient-to":[{to:G()}],rounded:[{rounded:I()}],"rounded-s":[{"rounded-s":I()}],"rounded-e":[{"rounded-e":I()}],"rounded-t":[{"rounded-t":I()}],"rounded-r":[{"rounded-r":I()}],"rounded-b":[{"rounded-b":I()}],"rounded-l":[{"rounded-l":I()}],"rounded-ss":[{"rounded-ss":I()}],"rounded-se":[{"rounded-se":I()}],"rounded-ee":[{"rounded-ee":I()}],"rounded-es":[{"rounded-es":I()}],"rounded-tl":[{"rounded-tl":I()}],"rounded-tr":[{"rounded-tr":I()}],"rounded-br":[{"rounded-br":I()}],"rounded-bl":[{"rounded-bl":I()}],"border-w":[{border:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-bs":[{"border-bs":ae()}],"border-w-be":[{"border-be":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...le(),"hidden","none"]}],"divide-style":[{divide:[...le(),"hidden","none"]}],"border-color":[{border:G()}],"border-color-x":[{"border-x":G()}],"border-color-y":[{"border-y":G()}],"border-color-s":[{"border-s":G()}],"border-color-e":[{"border-e":G()}],"border-color-bs":[{"border-bs":G()}],"border-color-be":[{"border-be":G()}],"border-color-t":[{"border-t":G()}],"border-color-r":[{"border-r":G()}],"border-color-b":[{"border-b":G()}],"border-color-l":[{"border-l":G()}],"divide-color":[{divide:G()}],"outline-style":[{outline:[...le(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ne,se,ie]}],"outline-w":[{outline:["",Ne,Fr,Xa]}],"outline-color":[{outline:G()}],shadow:[{shadow:["","none",x,Yi,Gi]}],"shadow-color":[{shadow:G()}],"inset-shadow":[{"inset-shadow":["none",b,Yi,Gi]}],"inset-shadow-color":[{"inset-shadow":G()}],"ring-w":[{ring:ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:G()}],"ring-offset-w":[{"ring-offset":[Ne,Xa]}],"ring-offset-color":[{"ring-offset":G()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":G()}],"text-shadow":[{"text-shadow":["none",S,Yi,Gi]}],"text-shadow-color":[{"text-shadow":G()}],opacity:[{opacity:[Ne,se,ie]}],"mix-blend":[{"mix-blend":[...De(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":De()}],"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":[Ne]}],"mask-image-linear-from-pos":[{"mask-linear-from":ye()}],"mask-image-linear-to-pos":[{"mask-linear-to":ye()}],"mask-image-linear-from-color":[{"mask-linear-from":G()}],"mask-image-linear-to-color":[{"mask-linear-to":G()}],"mask-image-t-from-pos":[{"mask-t-from":ye()}],"mask-image-t-to-pos":[{"mask-t-to":ye()}],"mask-image-t-from-color":[{"mask-t-from":G()}],"mask-image-t-to-color":[{"mask-t-to":G()}],"mask-image-r-from-pos":[{"mask-r-from":ye()}],"mask-image-r-to-pos":[{"mask-r-to":ye()}],"mask-image-r-from-color":[{"mask-r-from":G()}],"mask-image-r-to-color":[{"mask-r-to":G()}],"mask-image-b-from-pos":[{"mask-b-from":ye()}],"mask-image-b-to-pos":[{"mask-b-to":ye()}],"mask-image-b-from-color":[{"mask-b-from":G()}],"mask-image-b-to-color":[{"mask-b-to":G()}],"mask-image-l-from-pos":[{"mask-l-from":ye()}],"mask-image-l-to-pos":[{"mask-l-to":ye()}],"mask-image-l-from-color":[{"mask-l-from":G()}],"mask-image-l-to-color":[{"mask-l-to":G()}],"mask-image-x-from-pos":[{"mask-x-from":ye()}],"mask-image-x-to-pos":[{"mask-x-to":ye()}],"mask-image-x-from-color":[{"mask-x-from":G()}],"mask-image-x-to-color":[{"mask-x-to":G()}],"mask-image-y-from-pos":[{"mask-y-from":ye()}],"mask-image-y-to-pos":[{"mask-y-to":ye()}],"mask-image-y-from-color":[{"mask-y-from":G()}],"mask-image-y-to-color":[{"mask-y-to":G()}],"mask-image-radial":[{"mask-radial":[se,ie]}],"mask-image-radial-from-pos":[{"mask-radial-from":ye()}],"mask-image-radial-to-pos":[{"mask-radial-to":ye()}],"mask-image-radial-from-color":[{"mask-radial-from":G()}],"mask-image-radial-to-color":[{"mask-radial-to":G()}],"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":B()}],"mask-image-conic-pos":[{"mask-conic":[Ne]}],"mask-image-conic-from-pos":[{"mask-conic-from":ye()}],"mask-image-conic-to-pos":[{"mask-conic-to":ye()}],"mask-image-conic-from-color":[{"mask-conic-from":G()}],"mask-image-conic-to-color":[{"mask-conic-to":G()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:R()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:V()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",se,ie]}],filter:[{filter:["","none",se,ie]}],blur:[{blur:te()}],brightness:[{brightness:[Ne,se,ie]}],contrast:[{contrast:[Ne,se,ie]}],"drop-shadow":[{"drop-shadow":["","none",E,Yi,Gi]}],"drop-shadow-color":[{"drop-shadow":G()}],grayscale:[{grayscale:["",Ne,se,ie]}],"hue-rotate":[{"hue-rotate":[Ne,se,ie]}],invert:[{invert:["",Ne,se,ie]}],saturate:[{saturate:[Ne,se,ie]}],sepia:[{sepia:["",Ne,se,ie]}],"backdrop-filter":[{"backdrop-filter":["","none",se,ie]}],"backdrop-blur":[{"backdrop-blur":te()}],"backdrop-brightness":[{"backdrop-brightness":[Ne,se,ie]}],"backdrop-contrast":[{"backdrop-contrast":[Ne,se,ie]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ne,se,ie]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ne,se,ie]}],"backdrop-invert":[{"backdrop-invert":["",Ne,se,ie]}],"backdrop-opacity":[{"backdrop-opacity":[Ne,se,ie]}],"backdrop-saturate":[{"backdrop-saturate":[Ne,se,ie]}],"backdrop-sepia":[{"backdrop-sepia":["",Ne,se,ie]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":q()}],"border-spacing-x":[{"border-spacing-x":q()}],"border-spacing-y":[{"border-spacing-y":q()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",se,ie]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ne,"initial",se,ie]}],ease:[{ease:["linear","initial",_,se,ie]}],delay:[{delay:[Ne,se,ie]}],animate:[{animate:["none",H,se,ie]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[C,se,ie]}],"perspective-origin":[{"perspective-origin":Q()}],rotate:[{rotate:pe()}],"rotate-x":[{"rotate-x":pe()}],"rotate-y":[{"rotate-y":pe()}],"rotate-z":[{"rotate-z":pe()}],scale:[{scale:be()}],"scale-x":[{"scale-x":be()}],"scale-y":[{"scale-y":be()}],"scale-z":[{"scale-z":be()}],"scale-3d":["scale-3d"],skew:[{skew:Se()}],"skew-x":[{"skew-x":Se()}],"skew-y":[{"skew-y":Se()}],transform:[{transform:[se,ie,"","none","gpu","cpu"]}],"transform-origin":[{origin:Q()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Re()}],"translate-x":[{"translate-x":Re()}],"translate-y":[{"translate-y":Re()}],"translate-z":[{"translate-z":Re()}],"translate-none":["translate-none"],accent:[{accent:G()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:G()}],"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",se,ie]}],"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":q()}],"scroll-mx":[{"scroll-mx":q()}],"scroll-my":[{"scroll-my":q()}],"scroll-ms":[{"scroll-ms":q()}],"scroll-me":[{"scroll-me":q()}],"scroll-mbs":[{"scroll-mbs":q()}],"scroll-mbe":[{"scroll-mbe":q()}],"scroll-mt":[{"scroll-mt":q()}],"scroll-mr":[{"scroll-mr":q()}],"scroll-mb":[{"scroll-mb":q()}],"scroll-ml":[{"scroll-ml":q()}],"scroll-p":[{"scroll-p":q()}],"scroll-px":[{"scroll-px":q()}],"scroll-py":[{"scroll-py":q()}],"scroll-ps":[{"scroll-ps":q()}],"scroll-pe":[{"scroll-pe":q()}],"scroll-pbs":[{"scroll-pbs":q()}],"scroll-pbe":[{"scroll-pbe":q()}],"scroll-pt":[{"scroll-pt":q()}],"scroll-pr":[{"scroll-pr":q()}],"scroll-pb":[{"scroll-pb":q()}],"scroll-pl":[{"scroll-pl":q()}],"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",se,ie]}],fill:[{fill:["none",...G()]}],"stroke-w":[{stroke:[Ne,Fr,Xa,Pg]}],stroke:[{stroke:["none",...G()]}],"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"]}},WC=jC(IC);function an(...n){return WC(uC(n))}const eN=sC,tN=cC,hb=g.forwardRef(({className:n,...r},o)=>m.jsx(Qy,{className:an("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...r,ref:o}));hb.displayName=Qy.displayName;const pb=g.forwardRef(({className:n,...r},o)=>m.jsxs(tN,{children:[m.jsx(hb,{}),m.jsx(Zy,{ref:o,className:an("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n),...r})]}));pb.displayName=Zy.displayName;const gb=g.forwardRef(({className:n,...r},o)=>m.jsx(Jy,{ref:o,className:an("text-lg font-semibold",n),...r}));gb.displayName=Jy.displayName;const vb=g.forwardRef(({className:n,...r},o)=>m.jsx(Iy,{ref:o,className:an("text-sm text-muted-foreground",n),...r}));vb.displayName=Iy.displayName;const yb=g.forwardRef(({className:n,...r},o)=>m.jsx(Fy,{ref:o,className:an("inline-flex h-10 items-center justify-center rounded-md bg-destructive px-4 py-2 text-sm font-semibold text-white ring-offset-background transition-colors hover:bg-destructive/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",n),...r}));yb.displayName=Fy.displayName;const bb=g.forwardRef(({className:n,...r},o)=>m.jsx(Py,{ref:o,className:an("inline-flex h-10 items-center justify-center rounded-md border border-border bg-background px-4 py-2 text-sm font-semibold ring-offset-background transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",n),...r}));bb.displayName=Py.displayName;function nN({open:n,onOpenChange:r,title:o,description:i,confirmLabel:c="Continue",onConfirm:f}){return m.jsx(eN,{open:n,onOpenChange:r,children:m.jsxs(pb,{children:[m.jsx(gb,{children:o}),m.jsx(vb,{children:i}),m.jsxs("div",{className:"flex justify-end gap-2 mt-2",children:[m.jsx(bb,{children:"Cancel"}),m.jsx(yb,{onClick:f,children:c})]})]})})}const xb=(...n)=>n.filter((r,o,i)=>!!r&&r.trim()!==""&&i.indexOf(r)===o).join(" ").trim();const aN=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const lN=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(r,o,i)=>i?i.toUpperCase():o.toLowerCase());const Wg=n=>{const r=lN(n);return r.charAt(0).toUpperCase()+r.slice(1)};var rN={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 oN=n=>{for(const r in n)if(r.startsWith("aria-")||r==="role"||r==="title")return!0;return!1};const iN=g.forwardRef(({color:n="currentColor",size:r=24,strokeWidth:o=2,absoluteStrokeWidth:i,className:c="",children:f,iconNode:d,...h},y)=>g.createElement("svg",{ref:y,...rN,width:r,height:r,stroke:n,strokeWidth:i?Number(o)*24/Number(r):o,className:xb("lucide",c),...!f&&!oN(h)&&{"aria-hidden":"true"},...h},[...d.map(([p,x])=>g.createElement(p,x)),...Array.isArray(f)?f:[f]]));const Oe=(n,r)=>{const o=g.forwardRef(({className:i,...c},f)=>g.createElement(iN,{ref:f,iconNode:r,className:xb(`lucide-${aN(Wg(n))}`,`lucide-${n}`,i),...c}));return o.displayName=Wg(n),o};const sN=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],ev=Oe("activity",sN);const cN=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],uN=Oe("arrow-down",cN);const fN=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],dN=Oe("arrow-left",fN);const mN=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],hN=Oe("arrow-up-down",mN);const pN=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],gN=Oe("arrow-up",pN);const vN=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],tv=Oe("book-open",vN);const yN=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],bN=Oe("check",yN);const xN=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ff=Oe("chevron-down",xN);const wN=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],wb=Oe("chevron-right",wN);const SN=[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]],EN=Oe("cloud-download",SN);const CN=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],nv=Oe("external-link",CN);const NN=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Sb=Oe("file-text",NN);const RN=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],AN=Oe("folder-open",RN);const TN=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],av=Oe("github",TN);const _N=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],lv=Oe("key-round",_N);const MN=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],jN=Oe("link",MN);const ON=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ji=Oe("loader-circle",ON);const DN=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],zN=Oe("log-out",DN);const kN=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],LN=Oe("maximize-2",kN);const UN=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],HN=Oe("menu",UN);const BN=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],GN=Oe("minimize-2",BN);const YN=[["path",{d:"M5 12h14",key:"1ays0h"}]],qN=Oe("minus",YN);const VN=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],rv=Oe("moon",VN);const $N=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],XN=Oe("pencil",$N);const KN=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Eb=Oe("play",KN);const QN=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ZN=Oe("plus",QN);const FN=[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],PN=Oe("power-off",FN);const JN=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],IN=Oe("power",JN);const WN=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],eR=Oe("refresh-cw",WN);const tR=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],nR=Oe("rotate-ccw",tR);const aR=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Cb=Oe("search",aR);const lR=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],ov=Oe("sun",lR);const rR=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],oR=Oe("user",rR);const iR=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Za=Oe("x",iR);function Nb(n){const r=n+"CollectionProvider",[o,i]=Pa(r),[c,f]=o(r,{collectionRef:{current:null},itemMap:new Map}),d=C=>{const{scope:N,children:_}=C,H=ba.useRef(null),D=ba.useRef(new Map).current;return m.jsx(c,{scope:N,itemMap:D,collectionRef:H,children:_})};d.displayName=r;const h=n+"CollectionSlot",y=to(h),p=ba.forwardRef((C,N)=>{const{scope:_,children:H}=C,D=f(h,_),B=it(N,D.collectionRef);return m.jsx(y,{ref:B,children:H})});p.displayName=h;const x=n+"CollectionItemSlot",b="data-radix-collection-item",S=to(x),E=ba.forwardRef((C,N)=>{const{scope:_,children:H,...D}=C,B=ba.useRef(null),Q=it(N,B),W=f(x,_);return ba.useEffect(()=>(W.itemMap.set(B,{ref:B,...D}),()=>{W.itemMap.delete(B)})),m.jsx(S,{[b]:"",ref:Q,children:H})});E.displayName=x;function A(C){const N=f(n+"CollectionConsumer",C);return ba.useCallback(()=>{const H=N.collectionRef.current;if(!H)return[];const D=Array.from(H.querySelectorAll(`[${b}]`));return Array.from(N.itemMap.values()).sort((W,X)=>D.indexOf(W.ref.current)-D.indexOf(X.ref.current))},[N.collectionRef,N.itemMap])}return[{Provider:d,Slot:p,ItemSlot:E},A,i]}var sR=g.createContext(void 0);function Rb(n){const r=g.useContext(sR);return n||r||"ltr"}const cR=["top","right","bottom","left"],Ea=Math.min,kt=Math.max,as=Math.round,qi=Math.floor,dn=n=>({x:n,y:n}),uR={left:"right",right:"left",bottom:"top",top:"bottom"};function Cf(n,r,o){return kt(n,Ea(r,o))}function Bn(n,r){return typeof n=="function"?n(r):n}function Gn(n){return n.split("-")[0]}function Il(n){return n.split("-")[1]}function Pf(n){return n==="x"?"y":"x"}function Jf(n){return n==="y"?"height":"width"}function un(n){const r=n[0];return r==="t"||r==="b"?"y":"x"}function If(n){return Pf(un(n))}function fR(n,r,o){o===void 0&&(o=!1);const i=Il(n),c=If(n),f=Jf(c);let d=c==="x"?i===(o?"end":"start")?"right":"left":i==="start"?"bottom":"top";return r.reference[f]>r.floating[f]&&(d=ls(d)),[d,ls(d)]}function dR(n){const r=ls(n);return[Nf(n),r,Nf(r)]}function Nf(n){return n.includes("start")?n.replace("start","end"):n.replace("end","start")}const iv=["left","right"],sv=["right","left"],mR=["top","bottom"],hR=["bottom","top"];function pR(n,r,o){switch(n){case"top":case"bottom":return o?r?sv:iv:r?iv:sv;case"left":case"right":return r?mR:hR;default:return[]}}function gR(n,r,o,i){const c=Il(n);let f=pR(Gn(n),o==="start",i);return c&&(f=f.map(d=>d+"-"+c),r&&(f=f.concat(f.map(Nf)))),f}function ls(n){const r=Gn(n);return uR[r]+n.slice(r.length)}function vR(n){return{top:0,right:0,bottom:0,left:0,...n}}function Ab(n){return typeof n!="number"?vR(n):{top:n,right:n,bottom:n,left:n}}function rs(n){const{x:r,y:o,width:i,height:c}=n;return{width:i,height:c,top:o,left:r,right:r+i,bottom:o+c,x:r,y:o}}function cv(n,r,o){let{reference:i,floating:c}=n;const f=un(r),d=If(r),h=Jf(d),y=Gn(r),p=f==="y",x=i.x+i.width/2-c.width/2,b=i.y+i.height/2-c.height/2,S=i[h]/2-c[h]/2;let E;switch(y){case"top":E={x,y:i.y-c.height};break;case"bottom":E={x,y:i.y+i.height};break;case"right":E={x:i.x+i.width,y:b};break;case"left":E={x:i.x-c.width,y:b};break;default:E={x:i.x,y:i.y}}switch(Il(r)){case"start":E[d]-=S*(o&&p?-1:1);break;case"end":E[d]+=S*(o&&p?-1:1);break}return E}async function yR(n,r){var o;r===void 0&&(r={});const{x:i,y:c,platform:f,rects:d,elements:h,strategy:y}=n,{boundary:p="clippingAncestors",rootBoundary:x="viewport",elementContext:b="floating",altBoundary:S=!1,padding:E=0}=Bn(r,n),A=Ab(E),N=h[S?b==="floating"?"reference":"floating":b],_=rs(await f.getClippingRect({element:(o=await(f.isElement==null?void 0:f.isElement(N)))==null||o?N:N.contextElement||await(f.getDocumentElement==null?void 0:f.getDocumentElement(h.floating)),boundary:p,rootBoundary:x,strategy:y})),H=b==="floating"?{x:i,y:c,width:d.floating.width,height:d.floating.height}:d.reference,D=await(f.getOffsetParent==null?void 0:f.getOffsetParent(h.floating)),B=await(f.isElement==null?void 0:f.isElement(D))?await(f.getScale==null?void 0:f.getScale(D))||{x:1,y:1}:{x:1,y:1},Q=rs(f.convertOffsetParentRelativeRectToViewportRelativeRect?await f.convertOffsetParentRelativeRectToViewportRelativeRect({elements:h,rect:H,offsetParent:D,strategy:y}):H);return{top:(_.top-Q.top+A.top)/B.y,bottom:(Q.bottom-_.bottom+A.bottom)/B.y,left:(_.left-Q.left+A.left)/B.x,right:(Q.right-_.right+A.right)/B.x}}const bR=50,xR=async(n,r,o)=>{const{placement:i="bottom",strategy:c="absolute",middleware:f=[],platform:d}=o,h=d.detectOverflow?d:{...d,detectOverflow:yR},y=await(d.isRTL==null?void 0:d.isRTL(r));let p=await d.getElementRects({reference:n,floating:r,strategy:c}),{x,y:b}=cv(p,i,y),S=i,E=0;const A={};for(let C=0;C<f.length;C++){const N=f[C];if(!N)continue;const{name:_,fn:H}=N,{x:D,y:B,data:Q,reset:W}=await H({x,y:b,initialPlacement:i,placement:S,strategy:c,middlewareData:A,rects:p,platform:h,elements:{reference:n,floating:r}});x=D??x,b=B??b,A[_]={...A[_],...Q},W&&E<bR&&(E++,typeof W=="object"&&(W.placement&&(S=W.placement),W.rects&&(p=W.rects===!0?await d.getElementRects({reference:n,floating:r,strategy:c}):W.rects),{x,y:b}=cv(p,S,y)),C=-1)}return{x,y:b,placement:S,strategy:c,middlewareData:A}},wR=n=>({name:"arrow",options:n,async fn(r){const{x:o,y:i,placement:c,rects:f,platform:d,elements:h,middlewareData:y}=r,{element:p,padding:x=0}=Bn(n,r)||{};if(p==null)return{};const b=Ab(x),S={x:o,y:i},E=If(c),A=Jf(E),C=await d.getDimensions(p),N=E==="y",_=N?"top":"left",H=N?"bottom":"right",D=N?"clientHeight":"clientWidth",B=f.reference[A]+f.reference[E]-S[E]-f.floating[A],Q=S[E]-f.reference[E],W=await(d.getOffsetParent==null?void 0:d.getOffsetParent(p));let X=W?W[D]:0;(!X||!await(d.isElement==null?void 0:d.isElement(W)))&&(X=h.floating[D]||f.floating[A]);const q=B/2-Q/2,ne=X/2-C[A]/2-1,ce=Ea(b[_],ne),me=Ea(b[H],ne),re=ce,ge=X-C[A]-me,fe=X/2-C[A]/2+q,de=Cf(re,fe,ge),j=!y.arrow&&Il(c)!=null&&fe!==de&&f.reference[A]/2-(fe<re?ce:me)-C[A]/2<0,Z=j?fe<re?fe-re:fe-ge:0;return{[E]:S[E]+Z,data:{[E]:de,centerOffset:fe-de-Z,...j&&{alignmentOffset:Z}},reset:j}}}),SR=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(r){var o,i;const{placement:c,middlewareData:f,rects:d,initialPlacement:h,platform:y,elements:p}=r,{mainAxis:x=!0,crossAxis:b=!0,fallbackPlacements:S,fallbackStrategy:E="bestFit",fallbackAxisSideDirection:A="none",flipAlignment:C=!0,...N}=Bn(n,r);if((o=f.arrow)!=null&&o.alignmentOffset)return{};const _=Gn(c),H=un(h),D=Gn(h)===h,B=await(y.isRTL==null?void 0:y.isRTL(p.floating)),Q=S||(D||!C?[ls(h)]:dR(h)),W=A!=="none";!S&&W&&Q.push(...gR(h,C,A,B));const X=[h,...Q],q=await y.detectOverflow(r,N),ne=[];let ce=((i=f.flip)==null?void 0:i.overflows)||[];if(x&&ne.push(q[_]),b){const fe=fR(c,d,B);ne.push(q[fe[0]],q[fe[1]])}if(ce=[...ce,{placement:c,overflows:ne}],!ne.every(fe=>fe<=0)){var me,re;const fe=(((me=f.flip)==null?void 0:me.index)||0)+1,de=X[fe];if(de&&(!(b==="alignment"?H!==un(de):!1)||ce.every(ee=>un(ee.placement)===H?ee.overflows[0]>0:!0)))return{data:{index:fe,overflows:ce},reset:{placement:de}};let j=(re=ce.filter(Z=>Z.overflows[0]<=0).sort((Z,ee)=>Z.overflows[1]-ee.overflows[1])[0])==null?void 0:re.placement;if(!j)switch(E){case"bestFit":{var ge;const Z=(ge=ce.filter(ee=>{if(W){const z=un(ee.placement);return z===H||z==="y"}return!0}).map(ee=>[ee.placement,ee.overflows.filter(z=>z>0).reduce((z,G)=>z+G,0)]).sort((ee,z)=>ee[1]-z[1])[0])==null?void 0:ge[0];Z&&(j=Z);break}case"initialPlacement":j=h;break}if(c!==j)return{reset:{placement:j}}}return{}}}};function uv(n,r){return{top:n.top-r.height,right:n.right-r.width,bottom:n.bottom-r.height,left:n.left-r.width}}function fv(n){return cR.some(r=>n[r]>=0)}const ER=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(r){const{rects:o,platform:i}=r,{strategy:c="referenceHidden",...f}=Bn(n,r);switch(c){case"referenceHidden":{const d=await i.detectOverflow(r,{...f,elementContext:"reference"}),h=uv(d,o.reference);return{data:{referenceHiddenOffsets:h,referenceHidden:fv(h)}}}case"escaped":{const d=await i.detectOverflow(r,{...f,altBoundary:!0}),h=uv(d,o.floating);return{data:{escapedOffsets:h,escaped:fv(h)}}}default:return{}}}}},Tb=new Set(["left","top"]);async function CR(n,r){const{placement:o,platform:i,elements:c}=n,f=await(i.isRTL==null?void 0:i.isRTL(c.floating)),d=Gn(o),h=Il(o),y=un(o)==="y",p=Tb.has(d)?-1:1,x=f&&y?-1:1,b=Bn(r,n);let{mainAxis:S,crossAxis:E,alignmentAxis:A}=typeof b=="number"?{mainAxis:b,crossAxis:0,alignmentAxis:null}:{mainAxis:b.mainAxis||0,crossAxis:b.crossAxis||0,alignmentAxis:b.alignmentAxis};return h&&typeof A=="number"&&(E=h==="end"?A*-1:A),y?{x:E*x,y:S*p}:{x:S*p,y:E*x}}const NR=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(r){var o,i;const{x:c,y:f,placement:d,middlewareData:h}=r,y=await CR(r,n);return d===((o=h.offset)==null?void 0:o.placement)&&(i=h.arrow)!=null&&i.alignmentOffset?{}:{x:c+y.x,y:f+y.y,data:{...y,placement:d}}}}},RR=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(r){const{x:o,y:i,placement:c,platform:f}=r,{mainAxis:d=!0,crossAxis:h=!1,limiter:y={fn:_=>{let{x:H,y:D}=_;return{x:H,y:D}}},...p}=Bn(n,r),x={x:o,y:i},b=await f.detectOverflow(r,p),S=un(Gn(c)),E=Pf(S);let A=x[E],C=x[S];if(d){const _=E==="y"?"top":"left",H=E==="y"?"bottom":"right",D=A+b[_],B=A-b[H];A=Cf(D,A,B)}if(h){const _=S==="y"?"top":"left",H=S==="y"?"bottom":"right",D=C+b[_],B=C-b[H];C=Cf(D,C,B)}const N=y.fn({...r,[E]:A,[S]:C});return{...N,data:{x:N.x-o,y:N.y-i,enabled:{[E]:d,[S]:h}}}}}},AR=function(n){return n===void 0&&(n={}),{options:n,fn(r){const{x:o,y:i,placement:c,rects:f,middlewareData:d}=r,{offset:h=0,mainAxis:y=!0,crossAxis:p=!0}=Bn(n,r),x={x:o,y:i},b=un(c),S=Pf(b);let E=x[S],A=x[b];const C=Bn(h,r),N=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:0,crossAxis:0,...C};if(y){const D=S==="y"?"height":"width",B=f.reference[S]-f.floating[D]+N.mainAxis,Q=f.reference[S]+f.reference[D]-N.mainAxis;E<B?E=B:E>Q&&(E=Q)}if(p){var _,H;const D=S==="y"?"width":"height",B=Tb.has(Gn(c)),Q=f.reference[b]-f.floating[D]+(B&&((_=d.offset)==null?void 0:_[b])||0)+(B?0:N.crossAxis),W=f.reference[b]+f.reference[D]+(B?0:((H=d.offset)==null?void 0:H[b])||0)-(B?N.crossAxis:0);A<Q?A=Q:A>W&&(A=W)}return{[S]:E,[b]:A}}}},TR=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(r){var o,i;const{placement:c,rects:f,platform:d,elements:h}=r,{apply:y=()=>{},...p}=Bn(n,r),x=await d.detectOverflow(r,p),b=Gn(c),S=Il(c),E=un(c)==="y",{width:A,height:C}=f.floating;let N,_;b==="top"||b==="bottom"?(N=b,_=S===(await(d.isRTL==null?void 0:d.isRTL(h.floating))?"start":"end")?"left":"right"):(_=b,N=S==="end"?"top":"bottom");const H=C-x.top-x.bottom,D=A-x.left-x.right,B=Ea(C-x[N],H),Q=Ea(A-x[_],D),W=!r.middlewareData.shift;let X=B,q=Q;if((o=r.middlewareData.shift)!=null&&o.enabled.x&&(q=D),(i=r.middlewareData.shift)!=null&&i.enabled.y&&(X=H),W&&!S){const ce=kt(x.left,0),me=kt(x.right,0),re=kt(x.top,0),ge=kt(x.bottom,0);E?q=A-2*(ce!==0||me!==0?ce+me:kt(x.left,x.right)):X=C-2*(re!==0||ge!==0?re+ge:kt(x.top,x.bottom))}await y({...r,availableWidth:q,availableHeight:X});const ne=await d.getDimensions(h.floating);return A!==ne.width||C!==ne.height?{reset:{rects:!0}}:{}}}};function gs(){return typeof window<"u"}function Wl(n){return _b(n)?(n.nodeName||"").toLowerCase():"#document"}function Lt(n){var r;return(n==null||(r=n.ownerDocument)==null?void 0:r.defaultView)||window}function gn(n){var r;return(r=(_b(n)?n.ownerDocument:n.document)||window.document)==null?void 0:r.documentElement}function _b(n){return gs()?n instanceof Node||n instanceof Lt(n).Node:!1}function en(n){return gs()?n instanceof Element||n instanceof Lt(n).Element:!1}function Vn(n){return gs()?n instanceof HTMLElement||n instanceof Lt(n).HTMLElement:!1}function dv(n){return!gs()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Lt(n).ShadowRoot}function fo(n){const{overflow:r,overflowX:o,overflowY:i,display:c}=tn(n);return/auto|scroll|overlay|hidden|clip/.test(r+i+o)&&c!=="inline"&&c!=="contents"}function _R(n){return/^(table|td|th)$/.test(Wl(n))}function vs(n){try{if(n.matches(":popover-open"))return!0}catch{}try{return n.matches(":modal")}catch{return!1}}const MR=/transform|translate|scale|rotate|perspective|filter/,jR=/paint|layout|strict|content/,Ka=n=>!!n&&n!=="none";let rf;function Wf(n){const r=en(n)?tn(n):n;return Ka(r.transform)||Ka(r.translate)||Ka(r.scale)||Ka(r.rotate)||Ka(r.perspective)||!ed()&&(Ka(r.backdropFilter)||Ka(r.filter))||MR.test(r.willChange||"")||jR.test(r.contain||"")}function OR(n){let r=Ca(n);for(;Vn(r)&&!Zl(r);){if(Wf(r))return r;if(vs(r))return null;r=Ca(r)}return null}function ed(){return rf==null&&(rf=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),rf}function Zl(n){return/^(html|body|#document)$/.test(Wl(n))}function tn(n){return Lt(n).getComputedStyle(n)}function ys(n){return en(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Ca(n){if(Wl(n)==="html")return n;const r=n.assignedSlot||n.parentNode||dv(n)&&n.host||gn(n);return dv(r)?r.host:r}function Mb(n){const r=Ca(n);return Zl(r)?n.ownerDocument?n.ownerDocument.body:n.body:Vn(r)&&fo(r)?r:Mb(r)}function no(n,r,o){var i;r===void 0&&(r=[]),o===void 0&&(o=!0);const c=Mb(n),f=c===((i=n.ownerDocument)==null?void 0:i.body),d=Lt(c);if(f){const h=Rf(d);return r.concat(d,d.visualViewport||[],fo(c)?c:[],h&&o?no(h):[])}else return r.concat(c,no(c,[],o))}function Rf(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function jb(n){const r=tn(n);let o=parseFloat(r.width)||0,i=parseFloat(r.height)||0;const c=Vn(n),f=c?n.offsetWidth:o,d=c?n.offsetHeight:i,h=as(o)!==f||as(i)!==d;return h&&(o=f,i=d),{width:o,height:i,$:h}}function td(n){return en(n)?n:n.contextElement}function Ql(n){const r=td(n);if(!Vn(r))return dn(1);const o=r.getBoundingClientRect(),{width:i,height:c,$:f}=jb(r);let d=(f?as(o.width):o.width)/i,h=(f?as(o.height):o.height)/c;return(!d||!Number.isFinite(d))&&(d=1),(!h||!Number.isFinite(h))&&(h=1),{x:d,y:h}}const DR=dn(0);function Ob(n){const r=Lt(n);return!ed()||!r.visualViewport?DR:{x:r.visualViewport.offsetLeft,y:r.visualViewport.offsetTop}}function zR(n,r,o){return r===void 0&&(r=!1),!o||r&&o!==Lt(n)?!1:r}function Fa(n,r,o,i){r===void 0&&(r=!1),o===void 0&&(o=!1);const c=n.getBoundingClientRect(),f=td(n);let d=dn(1);r&&(i?en(i)&&(d=Ql(i)):d=Ql(n));const h=zR(f,o,i)?Ob(f):dn(0);let y=(c.left+h.x)/d.x,p=(c.top+h.y)/d.y,x=c.width/d.x,b=c.height/d.y;if(f){const S=Lt(f),E=i&&en(i)?Lt(i):i;let A=S,C=Rf(A);for(;C&&i&&E!==A;){const N=Ql(C),_=C.getBoundingClientRect(),H=tn(C),D=_.left+(C.clientLeft+parseFloat(H.paddingLeft))*N.x,B=_.top+(C.clientTop+parseFloat(H.paddingTop))*N.y;y*=N.x,p*=N.y,x*=N.x,b*=N.y,y+=D,p+=B,A=Lt(C),C=Rf(A)}}return rs({width:x,height:b,x:y,y:p})}function bs(n,r){const o=ys(n).scrollLeft;return r?r.left+o:Fa(gn(n)).left+o}function Db(n,r){const o=n.getBoundingClientRect(),i=o.left+r.scrollLeft-bs(n,o),c=o.top+r.scrollTop;return{x:i,y:c}}function kR(n){let{elements:r,rect:o,offsetParent:i,strategy:c}=n;const f=c==="fixed",d=gn(i),h=r?vs(r.floating):!1;if(i===d||h&&f)return o;let y={scrollLeft:0,scrollTop:0},p=dn(1);const x=dn(0),b=Vn(i);if((b||!b&&!f)&&((Wl(i)!=="body"||fo(d))&&(y=ys(i)),b)){const E=Fa(i);p=Ql(i),x.x=E.x+i.clientLeft,x.y=E.y+i.clientTop}const S=d&&!b&&!f?Db(d,y):dn(0);return{width:o.width*p.x,height:o.height*p.y,x:o.x*p.x-y.scrollLeft*p.x+x.x+S.x,y:o.y*p.y-y.scrollTop*p.y+x.y+S.y}}function LR(n){return Array.from(n.getClientRects())}function UR(n){const r=gn(n),o=ys(n),i=n.ownerDocument.body,c=kt(r.scrollWidth,r.clientWidth,i.scrollWidth,i.clientWidth),f=kt(r.scrollHeight,r.clientHeight,i.scrollHeight,i.clientHeight);let d=-o.scrollLeft+bs(n);const h=-o.scrollTop;return tn(i).direction==="rtl"&&(d+=kt(r.clientWidth,i.clientWidth)-c),{width:c,height:f,x:d,y:h}}const mv=25;function HR(n,r){const o=Lt(n),i=gn(n),c=o.visualViewport;let f=i.clientWidth,d=i.clientHeight,h=0,y=0;if(c){f=c.width,d=c.height;const x=ed();(!x||x&&r==="fixed")&&(h=c.offsetLeft,y=c.offsetTop)}const p=bs(i);if(p<=0){const x=i.ownerDocument,b=x.body,S=getComputedStyle(b),E=x.compatMode==="CSS1Compat"&&parseFloat(S.marginLeft)+parseFloat(S.marginRight)||0,A=Math.abs(i.clientWidth-b.clientWidth-E);A<=mv&&(f-=A)}else p<=mv&&(f+=p);return{width:f,height:d,x:h,y}}function BR(n,r){const o=Fa(n,!0,r==="fixed"),i=o.top+n.clientTop,c=o.left+n.clientLeft,f=Vn(n)?Ql(n):dn(1),d=n.clientWidth*f.x,h=n.clientHeight*f.y,y=c*f.x,p=i*f.y;return{width:d,height:h,x:y,y:p}}function hv(n,r,o){let i;if(r==="viewport")i=HR(n,o);else if(r==="document")i=UR(gn(n));else if(en(r))i=BR(r,o);else{const c=Ob(n);i={x:r.x-c.x,y:r.y-c.y,width:r.width,height:r.height}}return rs(i)}function zb(n,r){const o=Ca(n);return o===r||!en(o)||Zl(o)?!1:tn(o).position==="fixed"||zb(o,r)}function GR(n,r){const o=r.get(n);if(o)return o;let i=no(n,[],!1).filter(h=>en(h)&&Wl(h)!=="body"),c=null;const f=tn(n).position==="fixed";let d=f?Ca(n):n;for(;en(d)&&!Zl(d);){const h=tn(d),y=Wf(d);!y&&h.position==="fixed"&&(c=null),(f?!y&&!c:!y&&h.position==="static"&&!!c&&(c.position==="absolute"||c.position==="fixed")||fo(d)&&!y&&zb(n,d))?i=i.filter(x=>x!==d):c=h,d=Ca(d)}return r.set(n,i),i}function YR(n){let{element:r,boundary:o,rootBoundary:i,strategy:c}=n;const d=[...o==="clippingAncestors"?vs(r)?[]:GR(r,this._c):[].concat(o),i],h=hv(r,d[0],c);let y=h.top,p=h.right,x=h.bottom,b=h.left;for(let S=1;S<d.length;S++){const E=hv(r,d[S],c);y=kt(E.top,y),p=Ea(E.right,p),x=Ea(E.bottom,x),b=kt(E.left,b)}return{width:p-b,height:x-y,x:b,y}}function qR(n){const{width:r,height:o}=jb(n);return{width:r,height:o}}function VR(n,r,o){const i=Vn(r),c=gn(r),f=o==="fixed",d=Fa(n,!0,f,r);let h={scrollLeft:0,scrollTop:0};const y=dn(0);function p(){y.x=bs(c)}if(i||!i&&!f)if((Wl(r)!=="body"||fo(c))&&(h=ys(r)),i){const E=Fa(r,!0,f,r);y.x=E.x+r.clientLeft,y.y=E.y+r.clientTop}else c&&p();f&&!i&&c&&p();const x=c&&!i&&!f?Db(c,h):dn(0),b=d.left+h.scrollLeft-y.x-x.x,S=d.top+h.scrollTop-y.y-x.y;return{x:b,y:S,width:d.width,height:d.height}}function of(n){return tn(n).position==="static"}function pv(n,r){if(!Vn(n)||tn(n).position==="fixed")return null;if(r)return r(n);let o=n.offsetParent;return gn(n)===o&&(o=o.ownerDocument.body),o}function kb(n,r){const o=Lt(n);if(vs(n))return o;if(!Vn(n)){let c=Ca(n);for(;c&&!Zl(c);){if(en(c)&&!of(c))return c;c=Ca(c)}return o}let i=pv(n,r);for(;i&&_R(i)&&of(i);)i=pv(i,r);return i&&Zl(i)&&of(i)&&!Wf(i)?o:i||OR(n)||o}const $R=async function(n){const r=this.getOffsetParent||kb,o=this.getDimensions,i=await o(n.floating);return{reference:VR(n.reference,await r(n.floating),n.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function XR(n){return tn(n).direction==="rtl"}const KR={convertOffsetParentRelativeRectToViewportRelativeRect:kR,getDocumentElement:gn,getClippingRect:YR,getOffsetParent:kb,getElementRects:$R,getClientRects:LR,getDimensions:qR,getScale:Ql,isElement:en,isRTL:XR};function Lb(n,r){return n.x===r.x&&n.y===r.y&&n.width===r.width&&n.height===r.height}function QR(n,r){let o=null,i;const c=gn(n);function f(){var h;clearTimeout(i),(h=o)==null||h.disconnect(),o=null}function d(h,y){h===void 0&&(h=!1),y===void 0&&(y=1),f();const p=n.getBoundingClientRect(),{left:x,top:b,width:S,height:E}=p;if(h||r(),!S||!E)return;const A=qi(b),C=qi(c.clientWidth-(x+S)),N=qi(c.clientHeight-(b+E)),_=qi(x),D={rootMargin:-A+"px "+-C+"px "+-N+"px "+-_+"px",threshold:kt(0,Ea(1,y))||1};let B=!0;function Q(W){const X=W[0].intersectionRatio;if(X!==y){if(!B)return d();X?d(!1,X):i=setTimeout(()=>{d(!1,1e-7)},1e3)}X===1&&!Lb(p,n.getBoundingClientRect())&&d(),B=!1}try{o=new IntersectionObserver(Q,{...D,root:c.ownerDocument})}catch{o=new IntersectionObserver(Q,D)}o.observe(n)}return d(!0),f}function ZR(n,r,o,i){i===void 0&&(i={});const{ancestorScroll:c=!0,ancestorResize:f=!0,elementResize:d=typeof ResizeObserver=="function",layoutShift:h=typeof IntersectionObserver=="function",animationFrame:y=!1}=i,p=td(n),x=c||f?[...p?no(p):[],...r?no(r):[]]:[];x.forEach(_=>{c&&_.addEventListener("scroll",o,{passive:!0}),f&&_.addEventListener("resize",o)});const b=p&&h?QR(p,o):null;let S=-1,E=null;d&&(E=new ResizeObserver(_=>{let[H]=_;H&&H.target===p&&E&&r&&(E.unobserve(r),cancelAnimationFrame(S),S=requestAnimationFrame(()=>{var D;(D=E)==null||D.observe(r)})),o()}),p&&!y&&E.observe(p),r&&E.observe(r));let A,C=y?Fa(n):null;y&&N();function N(){const _=Fa(n);C&&!Lb(C,_)&&o(),C=_,A=requestAnimationFrame(N)}return o(),()=>{var _;x.forEach(H=>{c&&H.removeEventListener("scroll",o),f&&H.removeEventListener("resize",o)}),b?.(),(_=E)==null||_.disconnect(),E=null,y&&cancelAnimationFrame(A)}}const FR=NR,PR=RR,JR=SR,IR=TR,WR=ER,gv=wR,eA=AR,tA=(n,r,o)=>{const i=new Map,c={platform:KR,...o},f={...c.platform,_c:i};return xR(n,r,{...c,platform:f})};var nA=typeof document<"u",aA=function(){},Ii=nA?g.useLayoutEffect:aA;function os(n,r){if(n===r)return!0;if(typeof n!=typeof r)return!1;if(typeof n=="function"&&n.toString()===r.toString())return!0;let o,i,c;if(n&&r&&typeof n=="object"){if(Array.isArray(n)){if(o=n.length,o!==r.length)return!1;for(i=o;i--!==0;)if(!os(n[i],r[i]))return!1;return!0}if(c=Object.keys(n),o=c.length,o!==Object.keys(r).length)return!1;for(i=o;i--!==0;)if(!{}.hasOwnProperty.call(r,c[i]))return!1;for(i=o;i--!==0;){const f=c[i];if(!(f==="_owner"&&n.$$typeof)&&!os(n[f],r[f]))return!1}return!0}return n!==n&&r!==r}function Ub(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function vv(n,r){const o=Ub(n);return Math.round(r*o)/o}function sf(n){const r=g.useRef(n);return Ii(()=>{r.current=n}),r}function lA(n){n===void 0&&(n={});const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:c,elements:{reference:f,floating:d}={},transform:h=!0,whileElementsMounted:y,open:p}=n,[x,b]=g.useState({x:0,y:0,strategy:o,placement:r,middlewareData:{},isPositioned:!1}),[S,E]=g.useState(i);os(S,i)||E(i);const[A,C]=g.useState(null),[N,_]=g.useState(null),H=g.useCallback(ee=>{ee!==W.current&&(W.current=ee,C(ee))},[]),D=g.useCallback(ee=>{ee!==X.current&&(X.current=ee,_(ee))},[]),B=f||A,Q=d||N,W=g.useRef(null),X=g.useRef(null),q=g.useRef(x),ne=y!=null,ce=sf(y),me=sf(c),re=sf(p),ge=g.useCallback(()=>{if(!W.current||!X.current)return;const ee={placement:r,strategy:o,middleware:S};me.current&&(ee.platform=me.current),tA(W.current,X.current,ee).then(z=>{const G={...z,isPositioned:re.current!==!1};fe.current&&!os(q.current,G)&&(q.current=G,Hf.flushSync(()=>{b(G)}))})},[S,r,o,me,re]);Ii(()=>{p===!1&&q.current.isPositioned&&(q.current.isPositioned=!1,b(ee=>({...ee,isPositioned:!1})))},[p]);const fe=g.useRef(!1);Ii(()=>(fe.current=!0,()=>{fe.current=!1}),[]),Ii(()=>{if(B&&(W.current=B),Q&&(X.current=Q),B&&Q){if(ce.current)return ce.current(B,Q,ge);ge()}},[B,Q,ge,ce,ne]);const de=g.useMemo(()=>({reference:W,floating:X,setReference:H,setFloating:D}),[H,D]),j=g.useMemo(()=>({reference:B,floating:Q}),[B,Q]),Z=g.useMemo(()=>{const ee={position:o,left:0,top:0};if(!j.floating)return ee;const z=vv(j.floating,x.x),G=vv(j.floating,x.y);return h?{...ee,transform:"translate("+z+"px, "+G+"px)",...Ub(j.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:z,top:G}},[o,h,j.floating,x.x,x.y]);return g.useMemo(()=>({...x,update:ge,refs:de,elements:j,floatingStyles:Z}),[x,ge,de,j,Z])}const rA=n=>{function r(o){return{}.hasOwnProperty.call(o,"current")}return{name:"arrow",options:n,fn(o){const{element:i,padding:c}=typeof n=="function"?n(o):n;return i&&r(i)?i.current!=null?gv({element:i.current,padding:c}).fn(o):{}:i?gv({element:i,padding:c}).fn(o):{}}}},oA=(n,r)=>{const o=FR(n);return{name:o.name,fn:o.fn,options:[n,r]}},iA=(n,r)=>{const o=PR(n);return{name:o.name,fn:o.fn,options:[n,r]}},sA=(n,r)=>({fn:eA(n).fn,options:[n,r]}),cA=(n,r)=>{const o=JR(n);return{name:o.name,fn:o.fn,options:[n,r]}},uA=(n,r)=>{const o=IR(n);return{name:o.name,fn:o.fn,options:[n,r]}},fA=(n,r)=>{const o=WR(n);return{name:o.name,fn:o.fn,options:[n,r]}},dA=(n,r)=>{const o=rA(n);return{name:o.name,fn:o.fn,options:[n,r]}};var mA="Arrow",Hb=g.forwardRef((n,r)=>{const{children:o,width:i=10,height:c=5,...f}=n;return m.jsx(at.svg,{...f,ref:r,width:i,height:c,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?o:m.jsx("polygon",{points:"0,0 30,0 15,10"})})});Hb.displayName=mA;var hA=Hb;function pA(n){const[r,o]=g.useState(void 0);return Sa(()=>{if(n){o({width:n.offsetWidth,height:n.offsetHeight});const i=new ResizeObserver(c=>{if(!Array.isArray(c)||!c.length)return;const f=c[0];let d,h;if("borderBoxSize"in f){const y=f.borderBoxSize,p=Array.isArray(y)?y[0]:y;d=p.inlineSize,h=p.blockSize}else d=n.offsetWidth,h=n.offsetHeight;o({width:d,height:h})});return i.observe(n,{box:"border-box"}),()=>i.unobserve(n)}else o(void 0)},[n]),r}var nd="Popper",[Bb,Gb]=Pa(nd),[gA,Yb]=Bb(nd),qb=n=>{const{__scopePopper:r,children:o}=n,[i,c]=g.useState(null);return m.jsx(gA,{scope:r,anchor:i,onAnchorChange:c,children:o})};qb.displayName=nd;var Vb="PopperAnchor",$b=g.forwardRef((n,r)=>{const{__scopePopper:o,virtualRef:i,...c}=n,f=Yb(Vb,o),d=g.useRef(null),h=it(r,d),y=g.useRef(null);return g.useEffect(()=>{const p=y.current;y.current=i?.current||d.current,p!==y.current&&f.onAnchorChange(y.current)}),i?null:m.jsx(at.div,{...c,ref:h})});$b.displayName=Vb;var ad="PopperContent",[vA,yA]=Bb(ad),Xb=g.forwardRef((n,r)=>{const{__scopePopper:o,side:i="bottom",sideOffset:c=0,align:f="center",alignOffset:d=0,arrowPadding:h=0,avoidCollisions:y=!0,collisionBoundary:p=[],collisionPadding:x=0,sticky:b="partial",hideWhenDetached:S=!1,updatePositionStrategy:E="optimized",onPlaced:A,...C}=n,N=Yb(ad,o),[_,H]=g.useState(null),D=it(r,le=>H(le)),[B,Q]=g.useState(null),W=pA(B),X=W?.width??0,q=W?.height??0,ne=i+(f!=="center"?"-"+f:""),ce=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},me=Array.isArray(p)?p:[p],re=me.length>0,ge={padding:ce,boundary:me.filter(xA),altBoundary:re},{refs:fe,floatingStyles:de,placement:j,isPositioned:Z,middlewareData:ee}=lA({strategy:"fixed",placement:ne,whileElementsMounted:(...le)=>ZR(...le,{animationFrame:E==="always"}),elements:{reference:N.anchor},middleware:[oA({mainAxis:c+q,alignmentAxis:d}),y&&iA({mainAxis:!0,crossAxis:!1,limiter:b==="partial"?sA():void 0,...ge}),y&&cA({...ge}),uA({...ge,apply:({elements:le,rects:De,availableWidth:ye,availableHeight:te})=>{const{width:pe,height:be}=De.reference,Se=le.floating.style;Se.setProperty("--radix-popper-available-width",`${ye}px`),Se.setProperty("--radix-popper-available-height",`${te}px`),Se.setProperty("--radix-popper-anchor-width",`${pe}px`),Se.setProperty("--radix-popper-anchor-height",`${be}px`)}}),B&&dA({element:B,padding:h}),wA({arrowWidth:X,arrowHeight:q}),S&&fA({strategy:"referenceHidden",...ge})]}),[z,G]=Zb(j),R=Hn(A);Sa(()=>{Z&&R?.()},[Z,R]);const U=ee.arrow?.x,V=ee.arrow?.y,P=ee.arrow?.centerOffset!==0,[I,ae]=g.useState();return Sa(()=>{_&&ae(window.getComputedStyle(_).zIndex)},[_]),m.jsx("div",{ref:fe.setFloating,"data-radix-popper-content-wrapper":"",style:{...de,transform:Z?de.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:I,"--radix-popper-transform-origin":[ee.transformOrigin?.x,ee.transformOrigin?.y].join(" "),...ee.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:m.jsx(vA,{scope:o,placedSide:z,onArrowChange:Q,arrowX:U,arrowY:V,shouldHideArrow:P,children:m.jsx(at.div,{"data-side":z,"data-align":G,...C,ref:D,style:{...C.style,animation:Z?void 0:"none"}})})})});Xb.displayName=ad;var Kb="PopperArrow",bA={top:"bottom",right:"left",bottom:"top",left:"right"},Qb=g.forwardRef(function(r,o){const{__scopePopper:i,...c}=r,f=yA(Kb,i),d=bA[f.placedSide];return m.jsx("span",{ref:f.onArrowChange,style:{position:"absolute",left:f.arrowX,top:f.arrowY,[d]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[f.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[f.placedSide],visibility:f.shouldHideArrow?"hidden":void 0},children:m.jsx(hA,{...c,ref:o,style:{...c.style,display:"block"}})})});Qb.displayName=Kb;function xA(n){return n!==null}var wA=n=>({name:"transformOrigin",options:n,fn(r){const{placement:o,rects:i,middlewareData:c}=r,d=c.arrow?.centerOffset!==0,h=d?0:n.arrowWidth,y=d?0:n.arrowHeight,[p,x]=Zb(o),b={start:"0%",center:"50%",end:"100%"}[x],S=(c.arrow?.x??0)+h/2,E=(c.arrow?.y??0)+y/2;let A="",C="";return p==="bottom"?(A=d?b:`${S}px`,C=`${-y}px`):p==="top"?(A=d?b:`${S}px`,C=`${i.floating.height+y}px`):p==="right"?(A=`${-y}px`,C=d?b:`${E}px`):p==="left"&&(A=`${i.floating.width+y}px`,C=d?b:`${E}px`),{data:{x:A,y:C}}}});function Zb(n){const[r,o="center"]=n.split("-");return[r,o]}var SA=qb,EA=$b,CA=Xb,NA=Qb,cf="rovingFocusGroup.onEntryFocus",RA={bubbles:!1,cancelable:!0},mo="RovingFocusGroup",[Af,Fb,AA]=Nb(mo),[TA,Pb]=Pa(mo,[AA]),[_A,MA]=TA(mo),Jb=g.forwardRef((n,r)=>m.jsx(Af.Provider,{scope:n.__scopeRovingFocusGroup,children:m.jsx(Af.Slot,{scope:n.__scopeRovingFocusGroup,children:m.jsx(jA,{...n,ref:r})})}));Jb.displayName=mo;var jA=g.forwardRef((n,r)=>{const{__scopeRovingFocusGroup:o,orientation:i,loop:c=!1,dir:f,currentTabStopId:d,defaultCurrentTabStopId:h,onCurrentTabStopIdChange:y,onEntryFocus:p,preventScrollOnEntryFocus:x=!1,...b}=n,S=g.useRef(null),E=it(r,S),A=Rb(f),[C,N]=Bf({prop:d,defaultProp:h??null,onChange:y,caller:mo}),[_,H]=g.useState(!1),D=Hn(p),B=Fb(o),Q=g.useRef(!1),[W,X]=g.useState(0);return g.useEffect(()=>{const q=S.current;if(q)return q.addEventListener(cf,D),()=>q.removeEventListener(cf,D)},[D]),m.jsx(_A,{scope:o,orientation:i,dir:A,loop:c,currentTabStopId:C,onItemFocus:g.useCallback(q=>N(q),[N]),onItemShiftTab:g.useCallback(()=>H(!0),[]),onFocusableItemAdd:g.useCallback(()=>X(q=>q+1),[]),onFocusableItemRemove:g.useCallback(()=>X(q=>q-1),[]),children:m.jsx(at.div,{tabIndex:_||W===0?-1:0,"data-orientation":i,...b,ref:E,style:{outline:"none",...n.style},onMouseDown:Ce(n.onMouseDown,()=>{Q.current=!0}),onFocus:Ce(n.onFocus,q=>{const ne=!Q.current;if(q.target===q.currentTarget&&ne&&!_){const ce=new CustomEvent(cf,RA);if(q.currentTarget.dispatchEvent(ce),!ce.defaultPrevented){const me=B().filter(j=>j.focusable),re=me.find(j=>j.active),ge=me.find(j=>j.id===C),de=[re,ge,...me].filter(Boolean).map(j=>j.ref.current);ex(de,x)}}Q.current=!1}),onBlur:Ce(n.onBlur,()=>H(!1))})})}),Ib="RovingFocusGroupItem",Wb=g.forwardRef((n,r)=>{const{__scopeRovingFocusGroup:o,focusable:i=!0,active:c=!1,tabStopId:f,children:d,...h}=n,y=$l(),p=f||y,x=MA(Ib,o),b=x.currentTabStopId===p,S=Fb(o),{onFocusableItemAdd:E,onFocusableItemRemove:A,currentTabStopId:C}=x;return g.useEffect(()=>{if(i)return E(),()=>A()},[i,E,A]),m.jsx(Af.ItemSlot,{scope:o,id:p,focusable:i,active:c,children:m.jsx(at.span,{tabIndex:b?0:-1,"data-orientation":x.orientation,...h,ref:r,onMouseDown:Ce(n.onMouseDown,N=>{i?x.onItemFocus(p):N.preventDefault()}),onFocus:Ce(n.onFocus,()=>x.onItemFocus(p)),onKeyDown:Ce(n.onKeyDown,N=>{if(N.key==="Tab"&&N.shiftKey){x.onItemShiftTab();return}if(N.target!==N.currentTarget)return;const _=zA(N,x.orientation,x.dir);if(_!==void 0){if(N.metaKey||N.ctrlKey||N.altKey||N.shiftKey)return;N.preventDefault();let D=S().filter(B=>B.focusable).map(B=>B.ref.current);if(_==="last")D.reverse();else if(_==="prev"||_==="next"){_==="prev"&&D.reverse();const B=D.indexOf(N.currentTarget);D=x.loop?kA(D,B+1):D.slice(B+1)}setTimeout(()=>ex(D))}}),children:typeof d=="function"?d({isCurrentTabStop:b,hasTabStop:C!=null}):d})})});Wb.displayName=Ib;var OA={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function DA(n,r){return r!=="rtl"?n:n==="ArrowLeft"?"ArrowRight":n==="ArrowRight"?"ArrowLeft":n}function zA(n,r,o){const i=DA(n.key,o);if(!(r==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(r==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return OA[i]}function ex(n,r=!1){const o=document.activeElement;for(const i of n)if(i===o||(i.focus({preventScroll:r}),document.activeElement!==o))return}function kA(n,r){return n.map((o,i)=>n[(r+i)%n.length])}var LA=Jb,UA=Wb,Tf=["Enter"," "],HA=["ArrowDown","PageUp","Home"],tx=["ArrowUp","PageDown","End"],BA=[...HA,...tx],GA={ltr:[...Tf,"ArrowRight"],rtl:[...Tf,"ArrowLeft"]},YA={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ho="Menu",[ao,qA,VA]=Nb(ho),[Ia,nx]=Pa(ho,[VA,Gb,Pb]),xs=Gb(),ax=Pb(),[$A,Wa]=Ia(ho),[XA,po]=Ia(ho),lx=n=>{const{__scopeMenu:r,open:o=!1,children:i,dir:c,onOpenChange:f,modal:d=!0}=n,h=xs(r),[y,p]=g.useState(null),x=g.useRef(!1),b=Hn(f),S=Rb(c);return g.useEffect(()=>{const E=()=>{x.current=!0,document.addEventListener("pointerdown",A,{capture:!0,once:!0}),document.addEventListener("pointermove",A,{capture:!0,once:!0})},A=()=>x.current=!1;return document.addEventListener("keydown",E,{capture:!0}),()=>{document.removeEventListener("keydown",E,{capture:!0}),document.removeEventListener("pointerdown",A,{capture:!0}),document.removeEventListener("pointermove",A,{capture:!0})}},[]),m.jsx(SA,{...h,children:m.jsx($A,{scope:r,open:o,onOpenChange:b,content:y,onContentChange:p,children:m.jsx(XA,{scope:r,onClose:g.useCallback(()=>b(!1),[b]),isUsingKeyboardRef:x,dir:S,modal:d,children:i})})})};lx.displayName=ho;var KA="MenuAnchor",ld=g.forwardRef((n,r)=>{const{__scopeMenu:o,...i}=n,c=xs(o);return m.jsx(EA,{...c,...i,ref:r})});ld.displayName=KA;var rd="MenuPortal",[QA,rx]=Ia(rd,{forceMount:void 0}),ox=n=>{const{__scopeMenu:r,forceMount:o,children:i,container:c}=n,f=Wa(rd,r);return m.jsx(QA,{scope:r,forceMount:o,children:m.jsx(Na,{present:o||f.open,children:m.jsx(qf,{asChild:!0,container:c,children:i})})})};ox.displayName=rd;var Zt="MenuContent",[ZA,od]=Ia(Zt),ix=g.forwardRef((n,r)=>{const o=rx(Zt,n.__scopeMenu),{forceMount:i=o.forceMount,...c}=n,f=Wa(Zt,n.__scopeMenu),d=po(Zt,n.__scopeMenu);return m.jsx(ao.Provider,{scope:n.__scopeMenu,children:m.jsx(Na,{present:i||f.open,children:m.jsx(ao.Slot,{scope:n.__scopeMenu,children:d.modal?m.jsx(FA,{...c,ref:r}):m.jsx(PA,{...c,ref:r})})})})}),FA=g.forwardRef((n,r)=>{const o=Wa(Zt,n.__scopeMenu),i=g.useRef(null),c=it(r,i);return g.useEffect(()=>{const f=i.current;if(f)return gy(f)},[]),m.jsx(id,{...n,ref:c,trapFocus:o.open,disableOutsidePointerEvents:o.open,disableOutsideScroll:!0,onFocusOutside:Ce(n.onFocusOutside,f=>f.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>o.onOpenChange(!1)})}),PA=g.forwardRef((n,r)=>{const o=Wa(Zt,n.__scopeMenu);return m.jsx(id,{...n,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>o.onOpenChange(!1)})}),JA=to("MenuContent.ScrollLock"),id=g.forwardRef((n,r)=>{const{__scopeMenu:o,loop:i=!1,trapFocus:c,onOpenAutoFocus:f,onCloseAutoFocus:d,disableOutsidePointerEvents:h,onEntryFocus:y,onEscapeKeyDown:p,onPointerDownOutside:x,onFocusOutside:b,onInteractOutside:S,onDismiss:E,disableOutsideScroll:A,...C}=n,N=Wa(Zt,o),_=po(Zt,o),H=xs(o),D=ax(o),B=qA(o),[Q,W]=g.useState(null),X=g.useRef(null),q=it(r,X,N.onContentChange),ne=g.useRef(0),ce=g.useRef(""),me=g.useRef(0),re=g.useRef(null),ge=g.useRef("right"),fe=g.useRef(0),de=A?Vf:g.Fragment,j=A?{as:JA,allowPinchZoom:!0}:void 0,Z=z=>{const G=ce.current+z,R=B().filter(le=>!le.disabled),U=document.activeElement,V=R.find(le=>le.ref.current===U)?.textValue,P=R.map(le=>le.textValue),I=cT(P,G,V),ae=R.find(le=>le.textValue===I)?.ref.current;(function le(De){ce.current=De,window.clearTimeout(ne.current),De!==""&&(ne.current=window.setTimeout(()=>le(""),1e3))})(G),ae&&setTimeout(()=>ae.focus())};g.useEffect(()=>()=>window.clearTimeout(ne.current),[]),iy();const ee=g.useCallback(z=>ge.current===re.current?.side&&fT(z,re.current?.area),[]);return m.jsx(ZA,{scope:o,searchRef:ce,onItemEnter:g.useCallback(z=>{ee(z)&&z.preventDefault()},[ee]),onItemLeave:g.useCallback(z=>{ee(z)||(X.current?.focus(),W(null))},[ee]),onTriggerLeave:g.useCallback(z=>{ee(z)&&z.preventDefault()},[ee]),pointerGraceTimerRef:me,onPointerGraceIntentChange:g.useCallback(z=>{re.current=z},[]),children:m.jsx(de,{...j,children:m.jsx(Yf,{asChild:!0,trapped:c,onMountAutoFocus:Ce(f,z=>{z.preventDefault(),X.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:d,children:m.jsx(Gf,{asChild:!0,disableOutsidePointerEvents:h,onEscapeKeyDown:p,onPointerDownOutside:x,onFocusOutside:b,onInteractOutside:S,onDismiss:E,children:m.jsx(LA,{asChild:!0,...D,dir:_.dir,orientation:"vertical",loop:i,currentTabStopId:Q,onCurrentTabStopIdChange:W,onEntryFocus:Ce(y,z=>{_.isUsingKeyboardRef.current||z.preventDefault()}),preventScrollOnEntryFocus:!0,children:m.jsx(CA,{role:"menu","aria-orientation":"vertical","data-state":Ex(N.open),"data-radix-menu-content":"",dir:_.dir,...H,...C,ref:q,style:{outline:"none",...C.style},onKeyDown:Ce(C.onKeyDown,z=>{const R=z.target.closest("[data-radix-menu-content]")===z.currentTarget,U=z.ctrlKey||z.altKey||z.metaKey,V=z.key.length===1;R&&(z.key==="Tab"&&z.preventDefault(),!U&&V&&Z(z.key));const P=X.current;if(z.target!==P||!BA.includes(z.key))return;z.preventDefault();const ae=B().filter(le=>!le.disabled).map(le=>le.ref.current);tx.includes(z.key)&&ae.reverse(),iT(ae)}),onBlur:Ce(n.onBlur,z=>{z.currentTarget.contains(z.target)||(window.clearTimeout(ne.current),ce.current="")}),onPointerMove:Ce(n.onPointerMove,lo(z=>{const G=z.target,R=fe.current!==z.clientX;if(z.currentTarget.contains(G)&&R){const U=z.clientX>fe.current?"right":"left";ge.current=U,fe.current=z.clientX}}))})})})})})})});ix.displayName=Zt;var IA="MenuGroup",sd=g.forwardRef((n,r)=>{const{__scopeMenu:o,...i}=n;return m.jsx(at.div,{role:"group",...i,ref:r})});sd.displayName=IA;var WA="MenuLabel",sx=g.forwardRef((n,r)=>{const{__scopeMenu:o,...i}=n;return m.jsx(at.div,{...i,ref:r})});sx.displayName=WA;var is="MenuItem",yv="menu.itemSelect",ws=g.forwardRef((n,r)=>{const{disabled:o=!1,onSelect:i,...c}=n,f=g.useRef(null),d=po(is,n.__scopeMenu),h=od(is,n.__scopeMenu),y=it(r,f),p=g.useRef(!1),x=()=>{const b=f.current;if(!o&&b){const S=new CustomEvent(yv,{bubbles:!0,cancelable:!0});b.addEventListener(yv,E=>i?.(E),{once:!0}),ay(b,S),S.defaultPrevented?p.current=!1:d.onClose()}};return m.jsx(cx,{...c,ref:y,disabled:o,onClick:Ce(n.onClick,x),onPointerDown:b=>{n.onPointerDown?.(b),p.current=!0},onPointerUp:Ce(n.onPointerUp,b=>{p.current||b.currentTarget?.click()}),onKeyDown:Ce(n.onKeyDown,b=>{const S=h.searchRef.current!=="";o||S&&b.key===" "||Tf.includes(b.key)&&(b.currentTarget.click(),b.preventDefault())})})});ws.displayName=is;var cx=g.forwardRef((n,r)=>{const{__scopeMenu:o,disabled:i=!1,textValue:c,...f}=n,d=od(is,o),h=ax(o),y=g.useRef(null),p=it(r,y),[x,b]=g.useState(!1),[S,E]=g.useState("");return g.useEffect(()=>{const A=y.current;A&&E((A.textContent??"").trim())},[f.children]),m.jsx(ao.ItemSlot,{scope:o,disabled:i,textValue:c??S,children:m.jsx(UA,{asChild:!0,...h,focusable:!i,children:m.jsx(at.div,{role:"menuitem","data-highlighted":x?"":void 0,"aria-disabled":i||void 0,"data-disabled":i?"":void 0,...f,ref:p,onPointerMove:Ce(n.onPointerMove,lo(A=>{i?d.onItemLeave(A):(d.onItemEnter(A),A.defaultPrevented||A.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ce(n.onPointerLeave,lo(A=>d.onItemLeave(A))),onFocus:Ce(n.onFocus,()=>b(!0)),onBlur:Ce(n.onBlur,()=>b(!1))})})})}),eT="MenuCheckboxItem",ux=g.forwardRef((n,r)=>{const{checked:o=!1,onCheckedChange:i,...c}=n;return m.jsx(px,{scope:n.__scopeMenu,checked:o,children:m.jsx(ws,{role:"menuitemcheckbox","aria-checked":ss(o)?"mixed":o,...c,ref:r,"data-state":ud(o),onSelect:Ce(c.onSelect,()=>i?.(ss(o)?!0:!o),{checkForDefaultPrevented:!1})})})});ux.displayName=eT;var fx="MenuRadioGroup",[tT,nT]=Ia(fx,{value:void 0,onValueChange:()=>{}}),dx=g.forwardRef((n,r)=>{const{value:o,onValueChange:i,...c}=n,f=Hn(i);return m.jsx(tT,{scope:n.__scopeMenu,value:o,onValueChange:f,children:m.jsx(sd,{...c,ref:r})})});dx.displayName=fx;var mx="MenuRadioItem",hx=g.forwardRef((n,r)=>{const{value:o,...i}=n,c=nT(mx,n.__scopeMenu),f=o===c.value;return m.jsx(px,{scope:n.__scopeMenu,checked:f,children:m.jsx(ws,{role:"menuitemradio","aria-checked":f,...i,ref:r,"data-state":ud(f),onSelect:Ce(i.onSelect,()=>c.onValueChange?.(o),{checkForDefaultPrevented:!1})})})});hx.displayName=mx;var cd="MenuItemIndicator",[px,aT]=Ia(cd,{checked:!1}),gx=g.forwardRef((n,r)=>{const{__scopeMenu:o,forceMount:i,...c}=n,f=aT(cd,o);return m.jsx(Na,{present:i||ss(f.checked)||f.checked===!0,children:m.jsx(at.span,{...c,ref:r,"data-state":ud(f.checked)})})});gx.displayName=cd;var lT="MenuSeparator",vx=g.forwardRef((n,r)=>{const{__scopeMenu:o,...i}=n;return m.jsx(at.div,{role:"separator","aria-orientation":"horizontal",...i,ref:r})});vx.displayName=lT;var rT="MenuArrow",yx=g.forwardRef((n,r)=>{const{__scopeMenu:o,...i}=n,c=xs(o);return m.jsx(NA,{...c,...i,ref:r})});yx.displayName=rT;var oT="MenuSub",[JM,bx]=Ia(oT),Jr="MenuSubTrigger",xx=g.forwardRef((n,r)=>{const o=Wa(Jr,n.__scopeMenu),i=po(Jr,n.__scopeMenu),c=bx(Jr,n.__scopeMenu),f=od(Jr,n.__scopeMenu),d=g.useRef(null),{pointerGraceTimerRef:h,onPointerGraceIntentChange:y}=f,p={__scopeMenu:n.__scopeMenu},x=g.useCallback(()=>{d.current&&window.clearTimeout(d.current),d.current=null},[]);return g.useEffect(()=>x,[x]),g.useEffect(()=>{const b=h.current;return()=>{window.clearTimeout(b),y(null)}},[h,y]),m.jsx(ld,{asChild:!0,...p,children:m.jsx(cx,{id:c.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":c.contentId,"data-state":Ex(o.open),...n,ref:ms(r,c.onTriggerChange),onClick:b=>{n.onClick?.(b),!(n.disabled||b.defaultPrevented)&&(b.currentTarget.focus(),o.open||o.onOpenChange(!0))},onPointerMove:Ce(n.onPointerMove,lo(b=>{f.onItemEnter(b),!b.defaultPrevented&&!n.disabled&&!o.open&&!d.current&&(f.onPointerGraceIntentChange(null),d.current=window.setTimeout(()=>{o.onOpenChange(!0),x()},100))})),onPointerLeave:Ce(n.onPointerLeave,lo(b=>{x();const S=o.content?.getBoundingClientRect();if(S){const E=o.content?.dataset.side,A=E==="right",C=A?-5:5,N=S[A?"left":"right"],_=S[A?"right":"left"];f.onPointerGraceIntentChange({area:[{x:b.clientX+C,y:b.clientY},{x:N,y:S.top},{x:_,y:S.top},{x:_,y:S.bottom},{x:N,y:S.bottom}],side:E}),window.clearTimeout(h.current),h.current=window.setTimeout(()=>f.onPointerGraceIntentChange(null),300)}else{if(f.onTriggerLeave(b),b.defaultPrevented)return;f.onPointerGraceIntentChange(null)}})),onKeyDown:Ce(n.onKeyDown,b=>{const S=f.searchRef.current!=="";n.disabled||S&&b.key===" "||GA[i.dir].includes(b.key)&&(o.onOpenChange(!0),o.content?.focus(),b.preventDefault())})})})});xx.displayName=Jr;var wx="MenuSubContent",Sx=g.forwardRef((n,r)=>{const o=rx(Zt,n.__scopeMenu),{forceMount:i=o.forceMount,...c}=n,f=Wa(Zt,n.__scopeMenu),d=po(Zt,n.__scopeMenu),h=bx(wx,n.__scopeMenu),y=g.useRef(null),p=it(r,y);return m.jsx(ao.Provider,{scope:n.__scopeMenu,children:m.jsx(Na,{present:i||f.open,children:m.jsx(ao.Slot,{scope:n.__scopeMenu,children:m.jsx(id,{id:h.contentId,"aria-labelledby":h.triggerId,...c,ref:p,align:"start",side:d.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:x=>{d.isUsingKeyboardRef.current&&y.current?.focus(),x.preventDefault()},onCloseAutoFocus:x=>x.preventDefault(),onFocusOutside:Ce(n.onFocusOutside,x=>{x.target!==h.trigger&&f.onOpenChange(!1)}),onEscapeKeyDown:Ce(n.onEscapeKeyDown,x=>{d.onClose(),x.preventDefault()}),onKeyDown:Ce(n.onKeyDown,x=>{const b=x.currentTarget.contains(x.target),S=YA[d.dir].includes(x.key);b&&S&&(f.onOpenChange(!1),h.trigger?.focus(),x.preventDefault())})})})})})});Sx.displayName=wx;function Ex(n){return n?"open":"closed"}function ss(n){return n==="indeterminate"}function ud(n){return ss(n)?"indeterminate":n?"checked":"unchecked"}function iT(n){const r=document.activeElement;for(const o of n)if(o===r||(o.focus(),document.activeElement!==r))return}function sT(n,r){return n.map((o,i)=>n[(r+i)%n.length])}function cT(n,r,o){const c=r.length>1&&Array.from(r).every(p=>p===r[0])?r[0]:r,f=o?n.indexOf(o):-1;let d=sT(n,Math.max(f,0));c.length===1&&(d=d.filter(p=>p!==o));const y=d.find(p=>p.toLowerCase().startsWith(c.toLowerCase()));return y!==o?y:void 0}function uT(n,r){const{x:o,y:i}=n;let c=!1;for(let f=0,d=r.length-1;f<r.length;d=f++){const h=r[f],y=r[d],p=h.x,x=h.y,b=y.x,S=y.y;x>i!=S>i&&o<(b-p)*(i-x)/(S-x)+p&&(c=!c)}return c}function fT(n,r){if(!r)return!1;const o={x:n.clientX,y:n.clientY};return uT(o,r)}function lo(n){return r=>r.pointerType==="mouse"?n(r):void 0}var dT=lx,mT=ld,hT=ox,pT=ix,gT=sd,vT=sx,yT=ws,bT=ux,xT=dx,wT=hx,ST=gx,ET=vx,CT=yx,NT=xx,RT=Sx,Ss="DropdownMenu",[AT]=Pa(Ss,[nx]),vt=nx(),[TT,Cx]=AT(Ss),Nx=n=>{const{__scopeDropdownMenu:r,children:o,dir:i,open:c,defaultOpen:f,onOpenChange:d,modal:h=!0}=n,y=vt(r),p=g.useRef(null),[x,b]=Bf({prop:c,defaultProp:f??!1,onChange:d,caller:Ss});return m.jsx(TT,{scope:r,triggerId:$l(),triggerRef:p,contentId:$l(),open:x,onOpenChange:b,onOpenToggle:g.useCallback(()=>b(S=>!S),[b]),modal:h,children:m.jsx(dT,{...y,open:x,onOpenChange:b,dir:i,modal:h,children:o})})};Nx.displayName=Ss;var Rx="DropdownMenuTrigger",Ax=g.forwardRef((n,r)=>{const{__scopeDropdownMenu:o,disabled:i=!1,...c}=n,f=Cx(Rx,o),d=vt(o);return m.jsx(mT,{asChild:!0,...d,children:m.jsx(at.button,{type:"button",id:f.triggerId,"aria-haspopup":"menu","aria-expanded":f.open,"aria-controls":f.open?f.contentId:void 0,"data-state":f.open?"open":"closed","data-disabled":i?"":void 0,disabled:i,...c,ref:ms(r,f.triggerRef),onPointerDown:Ce(n.onPointerDown,h=>{!i&&h.button===0&&h.ctrlKey===!1&&(f.onOpenToggle(),f.open||h.preventDefault())}),onKeyDown:Ce(n.onKeyDown,h=>{i||(["Enter"," "].includes(h.key)&&f.onOpenToggle(),h.key==="ArrowDown"&&f.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(h.key)&&h.preventDefault())})})})});Ax.displayName=Rx;var _T="DropdownMenuPortal",Tx=n=>{const{__scopeDropdownMenu:r,...o}=n,i=vt(r);return m.jsx(hT,{...i,...o})};Tx.displayName=_T;var _x="DropdownMenuContent",Mx=g.forwardRef((n,r)=>{const{__scopeDropdownMenu:o,...i}=n,c=Cx(_x,o),f=vt(o),d=g.useRef(!1);return m.jsx(pT,{id:c.contentId,"aria-labelledby":c.triggerId,...f,...i,ref:r,onCloseAutoFocus:Ce(n.onCloseAutoFocus,h=>{d.current||c.triggerRef.current?.focus(),d.current=!1,h.preventDefault()}),onInteractOutside:Ce(n.onInteractOutside,h=>{const y=h.detail.originalEvent,p=y.button===0&&y.ctrlKey===!0,x=y.button===2||p;(!c.modal||x)&&(d.current=!0)}),style:{...n.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Mx.displayName=_x;var MT="DropdownMenuGroup",jT=g.forwardRef((n,r)=>{const{__scopeDropdownMenu:o,...i}=n,c=vt(o);return m.jsx(gT,{...c,...i,ref:r})});jT.displayName=MT;var OT="DropdownMenuLabel",jx=g.forwardRef((n,r)=>{const{__scopeDropdownMenu:o,...i}=n,c=vt(o);return m.jsx(vT,{...c,...i,ref:r})});jx.displayName=OT;var DT="DropdownMenuItem",Ox=g.forwardRef((n,r)=>{const{__scopeDropdownMenu:o,...i}=n,c=vt(o);return m.jsx(yT,{...c,...i,ref:r})});Ox.displayName=DT;var zT="DropdownMenuCheckboxItem",kT=g.forwardRef((n,r)=>{const{__scopeDropdownMenu:o,...i}=n,c=vt(o);return m.jsx(bT,{...c,...i,ref:r})});kT.displayName=zT;var LT="DropdownMenuRadioGroup",UT=g.forwardRef((n,r)=>{const{__scopeDropdownMenu:o,...i}=n,c=vt(o);return m.jsx(xT,{...c,...i,ref:r})});UT.displayName=LT;var HT="DropdownMenuRadioItem",BT=g.forwardRef((n,r)=>{const{__scopeDropdownMenu:o,...i}=n,c=vt(o);return m.jsx(wT,{...c,...i,ref:r})});BT.displayName=HT;var GT="DropdownMenuItemIndicator",YT=g.forwardRef((n,r)=>{const{__scopeDropdownMenu:o,...i}=n,c=vt(o);return m.jsx(ST,{...c,...i,ref:r})});YT.displayName=GT;var qT="DropdownMenuSeparator",Dx=g.forwardRef((n,r)=>{const{__scopeDropdownMenu:o,...i}=n,c=vt(o);return m.jsx(ET,{...c,...i,ref:r})});Dx.displayName=qT;var VT="DropdownMenuArrow",$T=g.forwardRef((n,r)=>{const{__scopeDropdownMenu:o,...i}=n,c=vt(o);return m.jsx(CT,{...c,...i,ref:r})});$T.displayName=VT;var XT="DropdownMenuSubTrigger",KT=g.forwardRef((n,r)=>{const{__scopeDropdownMenu:o,...i}=n,c=vt(o);return m.jsx(NT,{...c,...i,ref:r})});KT.displayName=XT;var QT="DropdownMenuSubContent",ZT=g.forwardRef((n,r)=>{const{__scopeDropdownMenu:o,...i}=n,c=vt(o);return m.jsx(RT,{...c,...i,ref:r,style:{...n.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ZT.displayName=QT;var FT=Nx,PT=Ax,JT=Tx,zx=Mx,kx=jx,Lx=Ox,Ux=Dx;const IT=FT,WT=PT,Hx=g.forwardRef(({className:n,sideOffset:r=4,...o},i)=>m.jsx(JT,{children:m.jsx(zx,{ref:i,sideOffset:r,className:an("z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...o})}));Hx.displayName=zx.displayName;const cs=g.forwardRef(({className:n,inset:r,...o},i)=>m.jsx(Lx,{ref:i,className:an("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r&&"pl-8",n),...o}));cs.displayName=Lx.displayName;const e_=g.forwardRef(({className:n,inset:r,...o},i)=>m.jsx(kx,{ref:i,className:an("px-2 py-1.5 text-sm font-semibold",r&&"pl-8",n),...o}));e_.displayName=kx.displayName;const Es=g.forwardRef(({className:n,...r},o)=>m.jsx(Ux,{ref:o,className:an("-mx-1 my-1 h-px bg-muted",n),...r}));Es.displayName=Ux.displayName;const Qt=g.forwardRef(({className:n,variant:r="default",size:o="default",...i},c)=>m.jsx("button",{className:an("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50",{"bg-primary text-primary-foreground hover:bg-primary/90":r==="default","border border-border bg-background hover:bg-accent hover:text-accent-foreground":r==="outline","hover:bg-accent hover:text-accent-foreground":r==="ghost","text-primary underline-offset-4 hover:underline":r==="link"},{"h-10 px-4 py-2":o==="default","h-9 rounded-md px-3":o==="sm","h-11 rounded-md px-8":o==="lg","h-10 w-10":o==="icon"},n),ref:c,...i}));Qt.displayName="Button";function Bx({icon:n,label:r,title:o,variant:i="default",compact:c,state:f,disabled:d,children:h,errorSlot:y,align:p="end",contentClass:x,onOpenChange:b}){const S=f??"idle",E=i==="menuItem",A=c?"h-3.5 w-3.5":"h-4 w-4",C=c?"h-7 w-7":"h-8 w-8",N=S==="done"?bN:S==="error"?Za:S==="loading"?Ji:n,_=S==="done"?"text-green-500":S==="error"?"text-red-500":"",H=E?m.jsxs("button",{className:"flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-accent transition-colors w-full text-left",disabled:d||S==="loading",children:[m.jsx(N,{className:`h-4 w-4 shrink-0 ${_} ${S==="loading"?"animate-spin":""}`}),r]}):m.jsx(Qt,{variant:"ghost",size:"icon",className:`${C} ${_||(i==="header"?"text-zinc-300 hover:text-white hover:bg-white/10":"text-muted-foreground hover:text-foreground")}`,disabled:d||S==="loading",title:o,children:m.jsx(N,{className:`${A} ${S==="loading"?"animate-spin":""}`})});return m.jsxs(IT,{onOpenChange:b,children:[m.jsx(WT,{asChild:!0,children:H}),m.jsxs(Hx,{align:p,className:x,children:[y&&m.jsxs(m.Fragment,{children:[y,m.jsx(Es,{})]}),h]})]})}function Gx({message:n}){return n?m.jsx("div",{className:"px-2 py-1.5 text-xs text-red-500 bg-red-500/10 rounded mx-1 mb-1",children:n}):null}function Yx(n,r){const[o,i]=g.useState("idle"),[c,f]=g.useState(null),d=p=>{i(p),r?.(p)};return{state:o,errorMsg:c,handleAction:async p=>{d("loading"),f(null);try{await p(),d("done"),setTimeout(()=>d("idle"),1500)}catch(x){const b=x instanceof Error?x.message:"Action failed";f(b),d("error"),n?.(b)}},resetOnClose:p=>{!p&&o==="error"&&(d("idle"),f(null))}}}function t_(n,r,o){const i=[];if(o||!r)return i.push({label:"ZIP",href:`/api/export/${n}?format=zip`,filename:`${n.split("/").pop()??"archive"}.zip`}),i;const c=r.fileName.replace(/\.[^.]+$/,"");return i.push({label:"Raw",href:`/api/raw/${n}`,filename:r.fileName}),(r.type==="markdown"||r.type===".md")&&(i.push({label:"PDF",href:`/api/export/${n}?format=pdf`,filename:`${c}.pdf`}),i.push({label:"DOCX",href:`/api/export/${n}?format=docx`,filename:`${c}.docx`})),(r.type==="mermaid"||r.type===".mmd")&&(i.push({label:"SVG",href:`/api/mermaid-export/${n}?format=svg`,filename:`${c}.svg`}),i.push({label:"PNG",href:`/api/mermaid-export/${n}?format=png`,filename:`${c}.png`}),i.push({label:"PDF",href:`/api/mermaid-export/${n}?format=pdf`,filename:`${c}.pdf`})),(r.type==="plantuml"||[".puml",".plantuml",".pu"].includes(r.type))&&(i.push({label:"SVG",href:`/api/plantuml-export/${n}?format=svg`,filename:`${c}.svg`}),i.push({label:"PNG",href:`/api/plantuml-export/${n}?format=png`,filename:`${c}.png`}),i.push({label:"PDF",href:`/api/plantuml-export/${n}?format=pdf`,filename:`${c}.pdf`}),i.push({label:"EPS",href:`/api/plantuml-export/${n}?format=eps`,filename:`${c}.eps`})),i}async function n_(n,r){const o=await fetch(Jl(n),{credentials:"include"});if(!o.ok){const d=await o.text().catch(()=>"");throw new Error(d||`Download failed (${String(o.status)})`)}const i=await o.blob(),c=URL.createObjectURL(i),f=document.createElement("a");f.href=c,f.download=r,document.body.appendChild(f),f.click(),document.body.removeChild(f),URL.revokeObjectURL(c)}function Ir({reqPath:n,file:r,isDirectory:o,isInsider:i,compact:c,variant:f="default",onError:d,onStateChange:h}){const{state:y,errorMsg:p,handleAction:x,resetOnClose:b}=Yx(E=>{d?.(E),alert(`Download failed: ${E}`)},h),S=t_(n,r,o);return S.length===0?null:m.jsxs(Bx,{icon:EN,label:"Download",title:"Download",variant:f,compact:c,state:y,onOpenChange:b,errorSlot:m.jsx(Gx,{message:p}),children:[S.map(E=>m.jsx(cs,{onSelect:()=>{x(()=>n_(E.href,E.filename))},className:"cursor-pointer",children:E.label},E.label)),i&&!o&&m.jsxs(m.Fragment,{children:[m.jsx(Es,{}),m.jsx(cs,{onSelect:()=>{x(async()=>{await gE(n)})},className:"cursor-pointer text-muted-foreground",children:"Clear Cache"})]})]})}async function a_(n,r,o,i){let c;if(r.expiry){const p=r.expiry.match(/^(\d+)([hdw])$/i);if(p){const x=parseInt(p[1],10),b=p[2].toLowerCase(),S={h:36e5,d:864e5,w:6048e5};c=String(Date.now()+x*S[b])}}const f=!i&&r.depth>0?r.depth:void 0,d=!i&&r.dirs?!0:void 0,h=await dE(n,c,f,d);if(!h.url)throw new Error("No URL returned");let y=window.location.origin+h.url;if(o==="raw"){const p=new URL(y);p.pathname=p.pathname.replace("/browse/","/api/raw/"),y=p.toString()}else o==="event"&&(y=window.location.origin+"/event?key="+h.url.split("key=")[1]);await navigator.clipboard.writeText(y)}const l_=[{label:"Never",value:""},{label:"1 hour",value:"1h"},{label:"24 hours",value:"24h"},{label:"7 days",value:"7d"},{label:"30 days",value:"30d"}];function us({path:n,shareSettings:r,onShareSettingsChange:o,showEvent:i,showRaw:c,compact:f,isDirectory:d,variant:h="default",onError:y,onStateChange:p}){const{state:x,errorMsg:b,handleAction:S,resetOnClose:E}=Yx(y,p),A=[{label:"Page",type:"page"}];return c&&A.push({label:"Raw",type:"raw"}),i&&A.push({label:"Event",type:"event"}),m.jsxs(Bx,{icon:jN,label:"Share",title:"Copy share link",variant:h,compact:f,state:x,contentClass:"w-52",onOpenChange:E,errorSlot:m.jsx(Gx,{message:b}),children:[A.map(C=>m.jsxs(cs,{onSelect:()=>{S(()=>a_(n,r,C.type,d))},className:"cursor-pointer",children:["Copy ",C.label," Link"]},C.type)),m.jsx(Es,{}),m.jsxs("div",{className:"px-2 py-1 flex items-center justify-between gap-2",children:[m.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"Expires"}),m.jsx("select",{className:"text-xs bg-popover text-popover-foreground border border-border rounded px-1 py-0.5 focus:outline-none focus:ring-1 focus:ring-ring min-w-0",value:r.expiry,onChange:C=>o({...r,expiry:C.target.value}),onClick:C=>C.stopPropagation(),children:l_.map(C=>m.jsx("option",{value:C.value,children:C.label},C.value))})]}),!d&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"px-2 py-1 flex items-center justify-between gap-2",children:[m.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"Depth"}),m.jsx("input",{type:"number",min:0,max:10,className:"text-xs bg-popover text-popover-foreground border border-border rounded px-1 py-0.5 w-14 text-right focus:outline-none focus:ring-1 focus:ring-ring",value:r.depth,onChange:C=>o({...r,depth:Math.max(0,parseInt(C.target.value,10)||0)}),onClick:C=>C.stopPropagation()})]}),m.jsxs("div",{className:"px-2 py-1 flex items-center justify-between gap-2",children:[m.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"Directories"}),m.jsx("input",{type:"checkbox",className:"rounded border-border",checked:r.dirs,onChange:C=>o({...r,dirs:C.target.checked}),onClick:C=>C.stopPropagation()})]})]})]})}function r_(n){if(n===null)return"-";if(n===0)return"0 B";const r=["B","KB","MB","GB"],o=Math.floor(Math.log(n)/Math.log(1024)),i=n/Math.pow(1024,o);return`${i<10?i.toFixed(1):Math.round(i)} ${r[o]}`}function o_({entry:n,basePath:r,isInsider:o,shareSettings:i,onShareSettingsChange:c}){const f=r?`${r}/${n.name}`:n.name,d=n.type==="directory",h=!d,y=`/${f}`,p=d?"Directory":n.ext?n.ext.slice(1).toUpperCase():"File";return m.jsxs("tr",{className:"border-b border-border last:border-0 hover:bg-accent/50 transition-colors",children:[m.jsx("td",{className:"px-4 py-2.5",children:m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsxs(Ln,{to:`/browse/${f}`,className:"text-blue-500 hover:underline flex items-center gap-2 min-w-0",children:[d?m.jsx(AN,{className:"h-4 w-4 text-yellow-500 shrink-0"}):m.jsx(Sb,{className:"h-4 w-4 text-zinc-400 shrink-0"}),m.jsx("span",{className:"truncate",children:n.name})]}),o&&m.jsxs("div",{className:"ml-auto flex items-center gap-0.5 shrink-0",children:[m.jsx(us,{path:y,shareSettings:i,onShareSettingsChange:c,showRaw:h,compact:!0,isDirectory:d}),m.jsx(Ir,{reqPath:f,file:d?null:{fileName:n.name,type:n.ext},isDirectory:d,isInsider:o,compact:!0})]})]})}),m.jsx("td",{className:"px-4 py-2.5 text-muted-foreground text-sm",children:p}),m.jsx("td",{className:"px-4 py-2.5 text-muted-foreground text-sm",children:r_(n.size)}),m.jsx("td",{className:"px-4 py-2.5 text-muted-foreground text-sm",children:n.mtime??"-"})]})}function i_({entries:n,basePath:r,isInsider:o,shareSettings:i,onShareSettingsChange:c}){return m.jsxs("div",{children:[m.jsxs("p",{className:"text-muted-foreground text-sm mb-4",children:[n.length," items"]}),m.jsx("div",{className:"bg-muted/50 rounded-lg overflow-hidden border border-border",children:m.jsxs("table",{className:"w-full",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"border-b border-border",children:[m.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Name"}),m.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Type"}),m.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Size"}),m.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Modified"})]})}),m.jsx("tbody",{children:n.map(f=>m.jsx(o_,{entry:f,basePath:r,isInsider:o,shareSettings:i,onShareSettingsChange:c},f.name))})]})})]})}function s_({drives:n,isInsider:r,shareSettings:o,onShareSettingsChange:i}){return m.jsxs("div",{children:[m.jsxs("p",{className:"text-muted-foreground text-sm mb-4",children:[n.length," drives"]}),m.jsx("div",{className:"bg-muted/50 rounded-lg overflow-hidden border border-border",children:m.jsxs("table",{className:"w-full",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"border-b border-border",children:[m.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Name"}),m.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Type"})]})}),m.jsx("tbody",{children:n.map(c=>{const f=`/${c.letter.toLowerCase()}`;return m.jsxs("tr",{className:"border-b border-border last:border-0 hover:bg-accent/50 transition-colors",children:[m.jsx("td",{className:"px-4 py-2.5",children:m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsxs(Ln,{to:`/browse/${c.letter.toLowerCase()}`,className:"text-blue-500 hover:underline flex items-center gap-2 min-w-0",children:["💾 ",c.letter,":\\",c.label?` (${c.label})`:""]}),r&&m.jsx("div",{className:"ml-auto flex items-center gap-0.5 shrink-0",children:m.jsx(us,{path:f,shareSettings:o,onShareSettingsChange:i,compact:!0,isDirectory:!0})})]})}),m.jsx("td",{className:"px-4 py-2.5 text-muted-foreground text-sm",children:"Drive"})]},c.letter)})})]})})]})}const c_="modulepreload",u_=function(n){return"/app/"+n},bv={},nt=function(r,o,i){let c=Promise.resolve();if(o&&o.length>0){let y=function(p){return Promise.all(p.map(x=>Promise.resolve(x).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),h=d?.nonce||d?.getAttribute("nonce");c=y(o.map(p=>{if(p=u_(p),p in bv)return;bv[p]=!0;const x=p.endsWith(".css"),b=x?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${b}`))return;const S=document.createElement("link");if(S.rel=x?"stylesheet":c_,x||(S.as="script"),S.crossOrigin="",S.href=p,h&&S.setAttribute("nonce",h),document.head.appendChild(S),x)return new Promise((E,A)=>{S.addEventListener("load",E),S.addEventListener("error",()=>A(new Error(`Unable to preload CSS for ${p}`)))})}))}function f(d){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=d,window.dispatchEvent(h),!h.defaultPrevented)throw d}return c.then(d=>{for(const h of d||[])h.status==="rejected"&&f(h.reason);return r().catch(f)})};var ot=function(){return ot=Object.assign||function(r){for(var o,i=1,c=arguments.length;i<c;i++){o=arguments[i];for(var f in o)Object.prototype.hasOwnProperty.call(o,f)&&(r[f]=o[f])}return r},ot.apply(this,arguments)};typeof window<"u"&&(window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),typeof window.CustomEvent!="function"&&(window.CustomEvent=function(r,o){o=o||{bubbles:!1,cancelable:!1,detail:null};var i=document.createEvent("CustomEvent");return i.initCustomEvent(r,o.bubbles,o.cancelable,o.detail),i}));var f_=typeof document<"u"&&!!document.documentMode,uf;function d_(){return uf||(uf=document.createElement("div").style)}var xv=["webkit","moz","ms"],Vi={};function fd(n){if(Vi[n])return Vi[n];var r=d_();if(n in r)return Vi[n]=n;for(var o=n[0].toUpperCase()+n.slice(1),i=xv.length;i--;){var c="".concat(xv[i]).concat(o);if(c in r)return Vi[n]=c}}function $i(n,r){return parseFloat(r[fd(n)])||0}function Xi(n,r,o){o===void 0&&(o=window.getComputedStyle(n));var i=r==="border"?"Width":"";return{left:$i("".concat(r,"Left").concat(i),o),right:$i("".concat(r,"Right").concat(i),o),top:$i("".concat(r,"Top").concat(i),o),bottom:$i("".concat(r,"Bottom").concat(i),o)}}function ql(n,r,o){n.style[fd(r)]=o}function m_(n,r){var o=fd("transform");ql(n,"transition","".concat(o," ").concat(r.duration,"ms ").concat(r.easing))}function h_(n,r,o){var i=r.x,c=r.y,f=r.scale,d=r.isSVG;if(ql(n,"transform","scale(".concat(f,") translate(").concat(i,"px, ").concat(c,"px)")),d&&f_){var h=window.getComputedStyle(n).getPropertyValue("transform");n.setAttribute("transform",h)}}function ff(n){var r=n.parentNode,o=window.getComputedStyle(n),i=window.getComputedStyle(r),c=n.getBoundingClientRect(),f=r.getBoundingClientRect();return{elem:{style:o,width:c.width,height:c.height,top:c.top,bottom:c.bottom,left:c.left,right:c.right,margin:Xi(n,"margin",o),border:Xi(n,"border",o)},parent:{style:i,width:f.width,height:f.height,top:f.top,bottom:f.bottom,left:f.left,right:f.right,padding:Xi(r,"padding",i),border:Xi(r,"border",i)}}}var ro={down:"mousedown",move:"mousemove",up:"mouseup mouseleave"};typeof window<"u"&&(typeof window.PointerEvent=="function"?ro={down:"pointerdown",move:"pointermove",up:"pointerup pointerleave pointercancel"}:typeof window.TouchEvent=="function"&&(ro={down:"touchstart",move:"touchmove",up:"touchend touchcancel"}));function df(n,r,o,i){ro[n].split(" ").forEach(function(c){r.addEventListener(c,o,i)})}function mf(n,r,o){ro[n].split(" ").forEach(function(i){r.removeEventListener(i,o)})}function qx(n,r){for(var o=n.length;o--;)if(n[o].pointerId===r.pointerId)return o;return-1}function _f(n,r){var o;if(r.touches){o=0;for(var i=0,c=r.touches;i<c.length;i++){var f=c[i];f.pointerId=o++,_f(n,f)}return}o=qx(n,r),o>-1&&n.splice(o,1),n.push(r)}function p_(n,r){if(r.touches){for(;n.length;)n.pop();return}var o=qx(n,r);o>-1&&n.splice(o,1)}function wv(n){n=n.slice(0);for(var r=n.pop(),o;o=n.pop();)r={clientX:(o.clientX-r.clientX)/2+r.clientX,clientY:(o.clientY-r.clientY)/2+r.clientY};return r}function hf(n){if(n.length<2)return 0;var r=n[0],o=n[1];return Math.sqrt(Math.pow(Math.abs(o.clientX-r.clientX),2)+Math.pow(Math.abs(o.clientY-r.clientY),2))}function g_(n){for(var r=n;r&&r.parentNode;){if(r.parentNode===document)return!0;r=r.parentNode instanceof ShadowRoot?r.parentNode.host:r.parentNode}return!1}function v_(n){return(n.getAttribute("class")||"").trim()}function y_(n,r){return n.nodeType===1&&" ".concat(v_(n)," ").indexOf(" ".concat(r," "))>-1}function b_(n,r){for(var o=n;o!=null;o=o.parentNode)if(y_(o,r.excludeClass)||r.exclude.indexOf(o)>-1)return!0;return!1}var x_=/^http:[\w\.\/]+svg$/;function w_(n){return x_.test(n.namespaceURI)&&n.nodeName.toLowerCase()!=="svg"}function S_(n){var r={};for(var o in n)n.hasOwnProperty(o)&&(r[o]=n[o]);return r}var Vx={animate:!1,canvas:!1,cursor:"move",disablePan:!1,disableZoom:!1,disableXAxis:!1,disableYAxis:!1,duration:200,easing:"ease-in-out",exclude:[],excludeClass:"panzoom-exclude",handleStartEvent:function(n){n.preventDefault(),n.stopPropagation()},maxScale:4,minScale:.125,overflow:"hidden",panOnlyWhenZoomed:!1,pinchAndPan:!1,relative:!1,setTransform:h_,startX:0,startY:0,startScale:1,step:.3,touchAction:"none"};function Vl(n,r){if(!n)throw new Error("Panzoom requires an element as an argument");if(n.nodeType!==1)throw new Error("Panzoom requires an element with a nodeType of 1");if(!g_(n))throw new Error("Panzoom should be called on elements that have been attached to the DOM");r=ot(ot({},Vx),r);var o=w_(n),i=n.parentNode;i.style.overflow=r.overflow,i.style.userSelect="none",i.style.touchAction=r.touchAction,(r.canvas?i:n).style.cursor=r.cursor,n.style.userSelect="none",n.style.touchAction=r.touchAction,ql(n,"transformOrigin",typeof r.origin=="string"?r.origin:o?"0 0":"50% 50%");function c(){i.style.overflow="",i.style.userSelect="",i.style.touchAction="",i.style.cursor="",n.style.cursor="",n.style.userSelect="",n.style.touchAction="",ql(n,"transformOrigin","")}function f(z){z===void 0&&(z={});for(var G in z)z.hasOwnProperty(G)&&(r[G]=z[G]);(z.hasOwnProperty("cursor")||z.hasOwnProperty("canvas"))&&(i.style.cursor=n.style.cursor="",(r.canvas?i:n).style.cursor=r.cursor),z.hasOwnProperty("overflow")&&(i.style.overflow=z.overflow),z.hasOwnProperty("touchAction")&&(i.style.touchAction=z.touchAction,n.style.touchAction=z.touchAction)}var d=0,h=0,y=1,p=!1;C(r.startScale,{animate:!1,force:!0}),setTimeout(function(){A(r.startX,r.startY,{animate:!1,force:!0})});function x(z,G,R){if(!R.silent){var U=new CustomEvent(z,{detail:G});n.dispatchEvent(U)}}function b(z,G,R){var U={x:d,y:h,scale:y,isSVG:o,originalEvent:R};return requestAnimationFrame(function(){typeof G.animate=="boolean"&&(G.animate?m_(n,G):ql(n,"transition","none")),G.setTransform(n,U,G),x(z,U,G),x("panzoomchange",U,G)}),U}function S(z,G,R,U){var V=ot(ot({},r),U),P={x:d,y:h,opts:V};if(!U?.force&&(V.disablePan||V.panOnlyWhenZoomed&&y===V.startScale))return P;if(z=parseFloat(z),G=parseFloat(G),V.disableXAxis||(P.x=(V.relative?d:0)+z),V.disableYAxis||(P.y=(V.relative?h:0)+G),V.contain){var I=ff(n),ae=I.elem.width/y,le=I.elem.height/y,De=ae*R,ye=le*R,te=(De-ae)/2,pe=(ye-le)/2;if(V.contain==="inside"){var be=(-I.elem.margin.left-I.parent.padding.left+te)/R,Se=(I.parent.width-De-I.parent.padding.left-I.elem.margin.left-I.parent.border.left-I.parent.border.right+te)/R;P.x=Math.max(Math.min(P.x,Se),be);var Re=(-I.elem.margin.top-I.parent.padding.top+pe)/R,Xe=(I.parent.height-ye-I.parent.padding.top-I.elem.margin.top-I.parent.border.top-I.parent.border.bottom+pe)/R;P.y=Math.max(Math.min(P.y,Xe),Re)}else if(V.contain==="outside"){var be=(-(De-I.parent.width)-I.parent.padding.left-I.parent.border.left-I.parent.border.right+te)/R,Se=(te-I.parent.padding.left)/R;P.x=Math.max(Math.min(P.x,Se),be);var Re=(-(ye-I.parent.height)-I.parent.padding.top-I.parent.border.top-I.parent.border.bottom+pe)/R,Xe=(pe-I.parent.padding.top)/R;P.y=Math.max(Math.min(P.y,Xe),Re)}}return V.roundPixels&&(P.x=Math.round(P.x),P.y=Math.round(P.y)),P}function E(z,G){var R=ot(ot({},r),G),U={scale:y,opts:R};if(!G?.force&&R.disableZoom)return U;var V=r.minScale,P=r.maxScale;if(R.contain){var I=ff(n),ae=I.elem.width/y,le=I.elem.height/y;if(ae>1&&le>1){var De=I.parent.width-I.parent.border.left-I.parent.border.right,ye=I.parent.height-I.parent.border.top-I.parent.border.bottom,te=De/ae,pe=ye/le;r.contain==="inside"?P=Math.min(P,te,pe):r.contain==="outside"&&(V=Math.max(V,te,pe))}}return U.scale=Math.min(Math.max(z,V),P),U}function A(z,G,R,U){var V=S(z,G,y,R);return d!==V.x||h!==V.y?(d=V.x,h=V.y,b("panzoompan",V.opts,U)):{x:d,y:h,scale:y,isSVG:o,originalEvent:U}}function C(z,G,R){var U=E(z,G),V=U.opts;if(!(!G?.force&&V.disableZoom)){z=U.scale;var P=d,I=h;if(V.focal){var ae=V.focal;P=(ae.x/z-ae.x/y+d*z)/z,I=(ae.y/z-ae.y/y+h*z)/z}var le=S(P,I,z,{relative:!1,force:!0});return d=le.x,h=le.y,y=z,b("panzoomzoom",V,R)}}function N(z,G){var R=ot(ot(ot({},r),{animate:!0}),G);return C(y*Math.exp((z?1:-1)*R.step),R)}function _(z){return N(!0,z)}function H(z){return N(!1,z)}function D(z,G,R,U){var V=ff(n),P={width:V.parent.width-V.parent.padding.left-V.parent.padding.right-V.parent.border.left-V.parent.border.right,height:V.parent.height-V.parent.padding.top-V.parent.padding.bottom-V.parent.border.top-V.parent.border.bottom},I=G.clientX-V.parent.left-V.parent.padding.left-V.parent.border.left-V.elem.margin.left,ae=G.clientY-V.parent.top-V.parent.padding.top-V.parent.border.top-V.elem.margin.top;o||(I-=V.elem.width/y/2,ae-=V.elem.height/y/2);var le={x:I/P.width*(P.width*z),y:ae/P.height*(P.height*z)};return C(z,ot(ot({},R),{animate:!1,focal:le}),U)}function B(z,G){z.preventDefault();var R=ot(ot(ot({},r),G),{animate:!1}),U=z.deltaY===0&&z.deltaX?z.deltaX:z.deltaY,V=U<0?1:-1,P=E(y*Math.exp(V*R.step/3),R).scale;return D(P,z,R,z)}function Q(z){var G=ot(ot(ot({},r),{animate:!0,force:!0}),z);y=E(G.startScale,G).scale;var R=S(G.startX,G.startY,y,G);return d=R.x,h=R.y,b("panzoomreset",G)}var W,X,q,ne,ce,me,re=[];function ge(z){if(!b_(z.target,r)){_f(re,z),p=!0,r.handleStartEvent(z),W=d,X=h,x("panzoomstart",{x:d,y:h,scale:y,isSVG:o,originalEvent:z},r);var G=wv(re);q=G.clientX,ne=G.clientY,ce=y,me=hf(re)}}function fe(z){if(!(!p||W===void 0||X===void 0||q===void 0||ne===void 0)){_f(re,z);var G=wv(re),R=re.length>1,U=y;if(R){me===0&&(me=hf(re));var V=hf(re)-me;U=E(V*r.step/80+ce).scale,D(U,G,{animate:!1},z)}(!R||r.pinchAndPan)&&A(W+(G.clientX-q)/U,X+(G.clientY-ne)/U,{animate:!1},z)}}function de(z){re.length===1&&x("panzoomend",{x:d,y:h,scale:y,isSVG:o,originalEvent:z},r),p_(re,z),p&&(p=!1,W=X=q=ne=void 0)}var j=!1;function Z(){j||(j=!0,df("down",r.canvas?i:n,ge),df("move",document,fe,{passive:!0}),df("up",document,de,{passive:!0}))}function ee(){j=!1,mf("down",r.canvas?i:n,ge),mf("move",document,fe),mf("up",document,de)}return r.noBind||Z(),{bind:Z,destroy:ee,eventNames:ro,getPan:function(){return{x:d,y:h}},getScale:function(){return y},getOptions:function(){return S_(r)},handleDown:ge,handleMove:fe,handleUp:de,pan:A,reset:Q,resetStyle:c,setOptions:f,setStyle:function(z,G){return ql(n,z,G)},zoom:C,zoomIn:_,zoomOut:H,zoomToPoint:D,zoomWithWheel:B}}Vl.defaultOptions=Vx;function $x(n){const o=new DOMParser().parseFromString(n,"image/svg+xml"),i=o.querySelector("svg");if(!i)return n;let c=0,f=0;const d=i.getAttribute("viewBox");if(d){const h=d.split(/[\s,]+/).map(Number);h.length===4&&(c=h[2],f=h[3])}return(c<=0||f<=0)&&(c=parseFloat(i.getAttribute("width")??"0"),f=parseFloat(i.getAttribute("height")??"0")),!i.getAttribute("viewBox")&&c>0&&f>0&&i.setAttribute("viewBox",`0 0 ${c} ${f}`),i.getAttribute("preserveAspectRatio")==="none"&&i.setAttribute("preserveAspectRatio","xMidYMid meet"),i.removeAttribute("height"),i.style.removeProperty("width"),i.style.removeProperty("height"),i.style.removeProperty("background"),i.setAttribute("width","100%"),new XMLSerializer().serializeToString(o)}function E_(n){const r=$x(n),i=new DOMParser().parseFromString(r,"image/svg+xml"),c=i.querySelector("svg");return c?(c.setAttribute("preserveAspectRatio","xMidYMid meet"),c.setAttribute("height","100%"),c.style.display="block",new XMLSerializer().serializeToString(i)):r}function dd({content:n}){const r=g.useRef(null),o=g.useRef(null),i=g.useRef(null),c=g.useRef(null),[f,d]=g.useState(!1),h=g.useMemo(()=>E_(n),[n]),y=g.useCallback(()=>{if(c.current?.(),c.current=null,i.current&&(i.current.destroy(),i.current=null),!o.current||!r.current)return;const p=r.current,x=o.current,b=p.clientWidth,S=p.clientHeight;if(b===0||S===0)return;x.style.width=`${b}px`,x.style.height=`${S}px`;const E=Vl(x,{maxScale:20,minScale:.1,startScale:1});i.current=E;const A=C=>{E.zoomWithWheel(C)};p.addEventListener("wheel",A,{passive:!1}),c.current=()=>p.removeEventListener("wheel",A),d(!0)},[]);return g.useEffect(()=>{const p=r.current;if(!p)return;const x=new ResizeObserver(()=>{y()});return x.observe(p),()=>{x.disconnect(),c.current?.(),i.current?.destroy()}},[h,y]),m.jsx("div",{className:"relative bg-white rounded-lg border border-border overflow-hidden",children:m.jsx("div",{ref:r,className:"overflow-hidden cursor-grab active:cursor-grabbing w-full h-[calc(100vh-8rem)]",children:m.jsx("div",{ref:o,className:f?"":"invisible",dangerouslySetInnerHTML:{__html:h}})})})}function C_({html:n,content:r}){return n?m.jsx(dd,{content:n}):m.jsxs("div",{className:"p-4 bg-red-950/20 border border-red-800 rounded-lg",children:[m.jsx("div",{className:"text-red-400 text-sm font-medium mb-2",children:"Mermaid render failed"}),m.jsx("pre",{className:"text-red-300 text-xs overflow-x-auto",children:r})]})}function N_({html:n,content:r}){return n?m.jsx(dd,{content:n}):m.jsxs("div",{className:"p-4 bg-red-950/20 border border-red-800 rounded-lg",children:[m.jsx("div",{className:"text-red-400 text-sm font-medium mb-2",children:"PlantUML render failed"}),m.jsx("pre",{className:"text-red-300 text-xs overflow-x-auto",children:r})]})}const R_={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};const Xx=([n,r,o])=>{const i=document.createElementNS("http://www.w3.org/2000/svg",n);return Object.keys(r).forEach(c=>{i.setAttribute(c,String(r[c]))}),o?.length&&o.forEach(c=>{const f=Xx(c);i.appendChild(f)}),i},Kx=(n,r={})=>{const i={...R_,...r};return Xx(["svg",i,n])};const A_=[["path",{d:"M20 6 9 17l-5-5"}]];const Sv=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}]];const Ev=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3"}]];const T_=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3"}]],Cv="relative bg-white rounded-lg border border-border overflow-hidden my-4",__="fixed inset-0 z-[100] bg-white flex flex-col",Nv="overflow-hidden w-full",M_="overflow-hidden w-full h-full flex-1",Rv="flex items-center justify-center p-4 [&>svg]:max-w-full [&>svg]:h-auto",j_="p-4",O_="absolute top-2 right-2 z-10 p-1.5 bg-zinc-800/70 hover:bg-zinc-700 text-white rounded transition-colors",Av="text-xs text-muted-foreground text-center py-1 opacity-60",D_="text-muted-foreground text-xs text-center py-2 pointer-events-none",Tv="Scroll to zoom · Drag to pan",z_="Scroll to zoom · Drag to pan · Esc to close";function k_(n){return Kx(n,{size:16})}function pf(n,r){n.innerHTML="",n.appendChild(k_(r))}function L_(n){const r=n.getAttribute("viewBox");if(r){const o=r.split(/[\s,]+/).map(Number);if(o[2]&&o[3])return{w:o[2],h:o[3]}}return{w:n.clientWidth||1e3,h:n.clientHeight||800}}function U_(n,r,o,i){const c=Math.min(o/n,i/r,1),f=n*c,d=r*c;return{fitScale:c,fittedW:f,fittedH:d,startX:(o-f)/2,startY:(i-d)/2}}function md(n,r,o){const i=o?.wrapperExtraClass?`${o.wrapperExtraClass} ${Cv}`:Cv,c=document.createElement("div");c.className=i,c.style.cursor="grab";const f=document.createElement("div");f.className=Nv,o?.viewportMinHeight&&(f.style.minHeight=o.viewportMinHeight);const d=document.createElement("div");d.className=Rv,d.appendChild(n),f.appendChild(d);const h=document.createElement("button");h.className=O_,h.title="Fullscreen",pf(h,Ev);const y=document.createElement("div");y.className=Av,y.textContent=Tv,c.appendChild(f),c.appendChild(h),c.appendChild(y);let p=null;const x=_=>{p?.zoomWithWheel(_)};f.addEventListener("wheel",x,{passive:!1});const b=()=>{p||(p=Vl(d,{maxScale:20,contain:"outside"}))};let S=!1;const E=()=>{S=!0,c.dataset.origClass=c.className,c.className=__,c.style.cursor="grab",f.className=M_,o?.viewportMinHeight&&(f.style.minHeight=""),d.className=j_,y.textContent=z_,y.className=D_,h.title="Exit fullscreen",pf(h,T_),p?.destroy(),p=null,requestAnimationFrame(()=>{requestAnimationFrame(()=>{setTimeout(()=>{const _=d.querySelector("svg");if(_&&f.clientWidth&&f.clientHeight){const{w:H,h:D}=L_(_),{fitScale:B,fittedW:Q,fittedH:W,startX:X,startY:q}=U_(H,D,f.clientWidth,f.clientHeight);_.setAttribute("width",String(Math.round(Q))),_.setAttribute("height",String(Math.round(W))),_.style.width=`${String(Math.round(Q))}px`,_.style.height=`${String(Math.round(W))}px`,p=Vl(d,{maxScale:20/B,minScale:.5,startScale:1,startX:X,startY:q})}else p=Vl(d,{maxScale:20,minScale:.1})},50)})})},A=()=>{S=!1;const _=d.querySelector("svg");_&&(_.setAttribute("width","100%"),_.removeAttribute("height"),_.style.width="",_.style.height=""),c.className=c.dataset.origClass??i,c.style.cursor="grab",f.className=Nv,o?.viewportMinHeight&&(f.style.minHeight=o.viewportMinHeight),d.className=Rv,y.textContent=Tv,y.className=Av,h.title="Fullscreen",pf(h,Ev),p?.destroy(),p=Vl(d,{maxScale:20,contain:"outside",startScale:1})};h.addEventListener("click",()=>{S?A():E()});const C=_=>{_.key==="Escape"&&S&&A()};return document.addEventListener("keydown",C),{wrapper:c,initPanzoom:b,enterFullscreen:E,exitFullscreen:A,cleanup:()=>{f.removeEventListener("wheel",x),document.removeEventListener("keydown",C),p?.destroy()}}}function H_(n){const r=[],o=n.querySelectorAll(".embedded-diagram-rendered");for(const i of o){const c=i.querySelector("svg");if(!c)continue;const{wrapper:f,initPanzoom:d,cleanup:h}=md(c,i,{wrapperExtraClass:"embedded-diagram-panzoom"});i.replaceWith(f),d(),r.push(h)}return()=>{for(const i of r)i()}}function B_(n){const r=[],o=n.querySelectorAll(".embedded-diagram-lazy");if(o.length===0)return()=>{};for(const i of o){const c=i.dataset.diagramType??"diagram";i.innerHTML=`<div class="embedded-diagram-loading"><div class="diagram-spinner"></div><span>Rendering ${c} diagram…</span></div>`,Qx(i,r)}return()=>{for(const i of r)i()}}async function Qx(n,r){const o=n.dataset.diagramType,i=n.dataset.diagramHash;if(!(!o||!i))try{const c=Jl(`/api/diagram/${o}/${i}.svg`),f=await fetch(c);if(!f.ok){const E=await f.json().catch(()=>({error:"Render failed"}));throw new Error(E.error??`HTTP ${String(f.status)}`)}const d=await f.text(),h=$x(d),y=document.createElement("div");y.className="embedded-diagram-rendered",y.dataset.type=o,y.innerHTML=h;const p=y.querySelector("svg");if(!p){n.replaceWith(y);return}const{wrapper:x,initPanzoom:b,cleanup:S}=md(p,y,{wrapperExtraClass:"embedded-diagram-panzoom"});n.replaceWith(x),b(),r.push(S)}catch(c){const f=c instanceof Error?c.message:"Unknown error",d=o?o.charAt(0).toUpperCase()+o.slice(1):"Diagram",h=Number(n.dataset.retryCount??"0"),y=h>0?'<div class="diagram-reload-hint">Still failing? Try reloading the page — the diagram source may have changed.</div>':"";n.innerHTML=`<div class="embedded-diagram-error" data-type="${o}"><div class="diagram-error-label">${d} render failed: ${G_(f)}</div>${y}<button class="diagram-retry-btn">Retry</button></div>`,n.querySelector(".diagram-retry-btn")?.addEventListener("click",()=>{n.dataset.retryCount=String(h+1),n.innerHTML=`<div class="embedded-diagram-loading"><div class="diagram-spinner"></div><span>Rendering ${o} diagram…</span></div>`,Qx(n,r)})}}function G_(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Y_(n){const r=[],o=Array.from(n.querySelectorAll("img")).filter(i=>/\.svg(\?|&|$)/i.test(i.getAttribute("src")??""));for(const i of o){const c=i.getAttribute("src");if(!c)continue;const f=c.includes("raw=1")?c:c.includes("?")?`${c}&raw=1`:`${c}?raw=1`,d=document.createElement("div");d.className="inline-svg-panzoom relative bg-white rounded-lg border border-border overflow-hidden my-4",d.style.cursor="grab",d.innerHTML='<div class="overflow-hidden w-full min-h-[200px]"><div class="flex items-center justify-center p-4">Loading SVG…</div></div>',i.parentElement?.replaceChild(d,i),fetch(Jl(f)).then(h=>{if(!h.ok)throw new Error(`Failed to fetch SVG: ${String(h.status)}`);return h.text()}).then(h=>{const y=document.createElement("div");y.innerHTML=h;const p=y.querySelector("svg");if(!p)throw new Error("No SVG element found");const{wrapper:x,initPanzoom:b,cleanup:S}=md(p,d,{wrapperExtraClass:"inline-svg-panzoom",viewportMinHeight:"200px"});d.replaceWith(x),b(),r.push(S)}).catch(()=>{d.replaceWith(i)})}return()=>{for(const i of r)i()}}async function q_(){const[{EditorView:n,basicSetup:r},{EditorState:o},{keymap:i},{oneDark:c}]=await Promise.all([nt(()=>import("./index-FlCUvrjv.js"),__vite__mapDeps([0,1,2,3,4])),nt(()=>import("./index-Cs5oz2oJ.js"),[]),nt(()=>import("./index-Dw7rDFmE.js").then(f=>f.u),__vite__mapDeps([1,2])),nt(()=>import("./index-MLwyFRN0.js"),__vite__mapDeps([5,1,2,3]))]);return{EditorView:n,EditorState:o,basicSetup:r,keymap:i,oneDark:c}}async function V_(n){switch(n.toLowerCase()){case"js":case"jsx":case"mjs":case"cjs":return(await nt(async()=>{const{javascript:r}=await import("./index-DC4HMHxY.js");return{javascript:r}},__vite__mapDeps([6,7,3,2,1,4]))).javascript({jsx:n.includes("x")});case"ts":case"tsx":case"mts":case"cts":return(await nt(async()=>{const{javascript:r}=await import("./index-DC4HMHxY.js");return{javascript:r}},__vite__mapDeps([6,7,3,2,1,4]))).javascript({jsx:n.includes("x"),typescript:!0});case"html":case"htm":return(await nt(async()=>{const{html:r}=await import("./index-D8KZVveX.js");return{html:r}},__vite__mapDeps([8,7,3,2,1,9,6,4]))).html();case"css":case"scss":return(await nt(async()=>{const{css:r}=await import("./index-uQa2yckk.js");return{css:r}},__vite__mapDeps([9,7,3,2,1]))).css();case"json":case"jsonl":return(await nt(async()=>{const{json:r}=await import("./index-SsHei0HE.js");return{json:r}},__vite__mapDeps([10,7,3,2,1]))).json();case"md":case"mdx":case"markdown":return(await nt(async()=>{const{markdown:r}=await import("./index-BdV9g5AM.js");return{markdown:r}},__vite__mapDeps([11,2,1,3,4,8,7,9,6]))).markdown();case"py":case"pyw":return(await nt(async()=>{const{python:r}=await import("./index-BqbhWo2I.js");return{python:r}},__vite__mapDeps([12,7,3,2,1,4]))).python();case"xml":case"svg":case"xsl":case"xhtml":return(await nt(async()=>{const{xml:r}=await import("./index-udkXoIER.js");return{xml:r}},__vite__mapDeps([13,7,3,2,1]))).xml();case"yaml":case"yml":return(await nt(async()=>{const{yaml:r}=await import("./index--MBieNJA.js");return{yaml:r}},__vite__mapDeps([14,7,3,2,1]))).yaml();case"c":case"h":case"cpp":case"hpp":case"cc":case"cxx":return(await nt(async()=>{const{cpp:r}=await import("./index-BbBpoOxz.js");return{cpp:r}},__vite__mapDeps([15,7,3,2,1]))).cpp();case"java":return(await nt(async()=>{const{java:r}=await import("./index-DcY2RXqX.js");return{java:r}},__vite__mapDeps([16,7,3,2,1]))).java();case"rs":return(await nt(async()=>{const{rust:r}=await import("./index-BENeXQI_.js");return{rust:r}},__vite__mapDeps([17,7,3,2,1]))).rust();case"sql":return(await nt(async()=>{const{sql:r}=await import("./index-BjAilRri.js");return{sql:r}},__vite__mapDeps([18,3,2,1,7,4]))).sql();case"php":return(await nt(async()=>{const{php:r}=await import("./index-Duy-tZYV.js");return{php:r}},__vite__mapDeps([19,7,3,2,1,8,9,6,4]))).php();default:return null}}function $_(n){const r=/language-(\w+)/.exec(n);if(!r)return null;const o=r[1];return{javascript:"js",typescript:"ts",python:"py",json:"json",yaml:"yaml",yml:"yaml",html:"html",css:"css",xml:"xml",java:"java",rust:"rs",sql:"sql",php:"php",cpp:"cpp",c:"c",markdown:"md",jsx:"jsx",tsx:"tsx",scss:"scss",bash:"sh",shell:"sh",sh:"sh",plaintext:"",text:""}[o]??o}function X_(n,r="dark"){const o=[],i=n.querySelectorAll("pre"),c=[];for(const f of i){const d=f.querySelector("code");if(!d||f.closest(".embedded-diagram-lazy")||f.closest(".embedded-diagram-rendered"))continue;const h=$_(d.className)??"",y=d.textContent??"";if(!y.trim())continue;const p=document.createElement("div");p.className="cm6-embedded-code",f.replaceWith(p),c.push(K_(p,y,h,r,o))}return Promise.all(c).then(()=>{n.setAttribute("data-cm6-ready","true")}),()=>{for(const f of o)f()}}async function K_(n,r,o,i,c){try{const{EditorView:f,EditorState:d,basicSetup:h,oneDark:y}=await q_(),p=await V_(o);if(!n.isConnected)return;const x=[h,d.readOnly.of(!0),f.editable.of(!1),...i==="dark"?[y]:[],f.theme({"&":{fontSize:"14px",borderRadius:"0.5rem",overflow:"hidden",border:"1px solid var(--color-border)"},".cm-scroller":{overflow:"auto"},".cm-content":{fontFamily:"'JetBrains Mono', 'Fira Code', 'Consolas', monospace",padding:"0.75rem 0"},".cm-gutters":{fontFamily:"'JetBrains Mono', 'Fira Code', 'Consolas', monospace",backgroundColor:"var(--color-muted)",borderRight:"1px solid var(--color-border)",color:"var(--color-muted-foreground)"},"&.cm-editor":{backgroundColor:"var(--color-muted)"},".cm-cursor":{display:"none"},".cm-activeLineGutter":{backgroundColor:"transparent"},".cm-activeLine":{backgroundColor:"transparent"}})];p&&x.push(p);const b=d.create({doc:r,extensions:x}),S=new f({state:b,parent:n});c.push(()=>S.destroy())}catch{n.innerHTML=`<pre class="hljs rounded-lg overflow-x-auto text-sm border border-border p-4 bg-muted text-foreground"><code>${Q_(r)}</code></pre>`}}function Q_(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function gf(n,r=14){return Kx(n,{size:r})}function Z_(n){n.querySelectorAll("pre").forEach(o=>{if(o.querySelector(".code-copy-btn"))return;o.style.position="relative";const i=document.createElement("button");i.className="code-copy-btn",i.title="Copy to clipboard",i.innerHTML="",i.appendChild(gf(Sv)),i.addEventListener("click",()=>{const f=o.querySelector("code")?.textContent??o.textContent??"";navigator.clipboard.writeText(f).then(()=>{i.innerHTML="";const d=gf(A_);i.appendChild(d),i.style.color="#4ade80",setTimeout(()=>{i.innerHTML="",i.appendChild(gf(Sv)),i.style.color=""},1500)})}),o.appendChild(i)})}function _v(n){n==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")}function Cs(){const[n,r]=g.useState(()=>{const c=localStorage.getItem("jeeves-theme")==="dark"?"dark":"light";return _v(c),c});g.useEffect(()=>{_v(n)},[n]);const o=g.useCallback(()=>{r(i=>{const c=i==="dark"?"light":"dark";return localStorage.setItem("jeeves-theme",c),c})},[]);return[n,o]}const F_=600;function P_(n,r){const o=n===window,i=o?window.scrollY:n.scrollTop,c=r-i;if(Math.abs(c)<2)return;const f=performance.now();function d(h){const y=h-f,p=Math.min(y/F_,1),x=p<.5?4*p*p*p:1-Math.pow(-2*p+2,3)/2;o?window.scrollTo(0,i+c*x):n.scrollTop=i+c*x,p<1&&requestAnimationFrame(d)}requestAnimationFrame(d)}function Wi(n,r){const o=document.getElementById(r);if(o&&n){const i=o.getBoundingClientRect(),c=n.getBoundingClientRect(),f=n.scrollTop+(i.top-c.top)-16;P_(n,f),window.history.replaceState(null,"",`#${r}`)}}function J_({fileRendered:n,proseWidth:r,topBarHeight:o,mainRef:i,mobileTocOpen:c,setMobileTocOpen:f}){const[d]=Cs(),h=new URLSearchParams(window.location.search).has("plain_code"),y=n.headings&&n.headings.length>2;return m.jsxs(m.Fragment,{children:[c&&y&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"lg:hidden fixed inset-0 z-40",onClick:()=>f(!1)}),m.jsx("div",{className:"lg:hidden fixed left-2 right-2 z-50 bg-popover text-popover-foreground border border-border rounded-lg shadow-lg max-h-[60vh] overflow-y-auto px-4 py-3",style:{top:`${o+4}px`},children:m.jsx("nav",{children:n.headings.map(p=>m.jsx("button",{type:"button",onClick:()=>{Wi(i.current,p.slug),f(!1)},className:"block text-left text-sm text-muted-foreground hover:text-foreground cursor-pointer py-1 transition-colors w-full",style:{paddingLeft:`${(p.level-1)*.75}rem`},children:p.text},p.slug))})})]}),m.jsxs("div",{className:"flex gap-6",children:[y&&m.jsxs("aside",{className:"toc-sidebar hidden lg:block w-56 shrink-0",style:{maxHeight:`calc(100vh - ${o+32}px)`},children:[m.jsx("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2",children:"Contents"}),m.jsx("nav",{className:"border-l border-border pl-3",children:n.headings.map(p=>m.jsx("button",{type:"button",onClick:()=>Wi(i.current,p.slug),className:"block text-left text-sm text-muted-foreground hover:text-foreground cursor-pointer py-0.5 transition-colors",style:{paddingLeft:`${(p.level-1)*.75}rem`},children:p.text},p.slug))})]}),m.jsx("article",{ref:p=>{p&&(h||X_(p,d),Z_(p),Y_(p),H_(p),B_(p))},className:`prose bg-background p-6 rounded-lg border border-border min-w-0 flex-1 ${r==="narrow"?"max-w-prose":r==="medium"?"max-w-5xl":"max-w-none"}`,style:{"--tw-prose-body":"var(--foreground)","--tw-prose-headings":"var(--foreground)","--tw-prose-bold":"var(--foreground)","--tw-prose-links":"#3b82f6","--tw-prose-code":"var(--foreground)","--tw-prose-pre-bg":"var(--muted)","--tw-prose-pre-code":"var(--foreground)","--tw-prose-hr":"var(--border)","--tw-prose-quotes":"var(--muted-foreground)","--tw-prose-quote-borders":"var(--border)","--tw-prose-th-borders":"var(--border)","--tw-prose-td-borders":"var(--border)"},dangerouslySetInnerHTML:{__html:n.html},onClick:p=>{const S=p.target.closest("a")?.getAttribute("href");S?.startsWith("#")&&(p.preventDefault(),Wi(i.current,S.slice(1)))}})]})]})}const I_=new Set([".md",".svg",".mmd",".puml",".plantuml",".pu"]);function Mf(n){return n.type==="markdown"||n.type==="svg"||n.type==="mermaid"||n.type==="plantuml"||!!n.html}function W_(n){const r=n?`.${n.split(".").pop()?.toLowerCase()}`:"";return I_.has(r)}function eM(n,r,o=!0){const i=g.useRef(0),c=g.useRef(0);g.useEffect(()=>{const f=n.current,d=r.current;if(!f||!d||!o)return;i.current=d.scrollHeight,c.current=f.scrollTop;const h=()=>{c.current=f.scrollTop};f.addEventListener("scroll",h,{passive:!0});const y=new ResizeObserver(()=>{const p=d.scrollHeight,x=i.current,b=p-x;if(Math.abs(b)>0&&c.current>0){const S=f.scrollTop;S===c.current&&b>0&&(f.scrollTop=S+b),c.current=f.scrollTop}i.current=p});return y.observe(d),()=>{f.removeEventListener("scroll",h),y.disconnect()}},[n,r,o])}const tM=g.lazy(()=>nt(()=>import("./CodeEditor-DQZZL5Rq.js"),[]).then(n=>({default:n.CodeEditor}))),nM=g.lazy(()=>nt(()=>import("./CodeViewer-ofJVD1Vn.js"),[]).then(n=>({default:n.CodeViewer})));function aM({reqPath:n,file:r,fileRaw:o,fileRendered:i,viewTab:c,editing:f,setEditing:d,proseWidth:h,topBarHeight:y,mainRef:p,mobileTocOpen:x,setMobileTocOpen:b,onSave:S}){const E=g.useRef(null);eM(p,E);const A=r?Mf(r):!1,C=A?c:"raw",N=!r;return g.useEffect(()=>{const _=window.location.hash.slice(1);if(_&&r){const H=setTimeout(()=>Wi(p.current,_),100);return()=>clearTimeout(H)}},[r,p]),m.jsxs("div",{ref:E,className:"px-4 md:px-6 pt-4",children:[N&&m.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground text-sm py-8 justify-center",children:[m.jsx(Ji,{className:"h-4 w-4 animate-spin"})," Loading..."]}),(o??r)?.content&&C==="raw"&&!f&&m.jsx(g.Suspense,{fallback:m.jsx("pre",{className:"rounded-lg overflow-x-auto text-sm border border-border p-4 bg-muted text-foreground",children:m.jsxs("code",{children:[(o??r).content.slice(0,500),"…"]})}),children:m.jsx(nM,{content:(o??r).content,fileName:(o??r).fileName})}),f&&(o??r)?.content!=null&&C==="raw"&&m.jsx(g.Suspense,{fallback:m.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground text-sm py-8 justify-center",children:[m.jsx(Ji,{className:"h-4 w-4 animate-spin"})," Loading editor…"]}),children:m.jsx("div",{style:{height:`calc(100vh - ${y+16}px)`},children:m.jsx(tM,{content:(o??r).content,fileName:(o??r).fileName,onSave:S,onCancel:()=>d(!1)})})}),!i&&A&&C==="rendered"&&!N&&m.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground text-sm py-8 justify-center",children:[m.jsx(Ji,{className:"h-4 w-4 animate-spin"})," Rendering..."]}),i?.type==="markdown"&&i.html&&C==="rendered"&&m.jsx(J_,{fileRendered:i,proseWidth:h,topBarHeight:y,mainRef:p,mobileTocOpen:x,setMobileTocOpen:b}),i?.type==="svg"&&i.content&&C==="rendered"&&m.jsx(dd,{content:i.content}),i?.type==="mermaid"&&C==="rendered"&&m.jsx(C_,{html:i.html??null,content:i.content??""}),i?.type==="plantuml"&&C==="rendered"&&m.jsx(N_,{html:i.html??null,content:i.content??""}),r?.type==="image"&&m.jsx("div",{className:"flex justify-center p-4",children:m.jsx("img",{src:`/api/raw/${n}`,alt:r.fileName,className:"max-w-full rounded-lg shadow-md"})}),r?.type==="binary"&&m.jsxs("div",{className:"text-center p-8",children:[m.jsx("p",{className:"text-muted-foreground mb-4",children:r.fileName}),m.jsx("a",{href:`/api/raw/${n}`,download:r.fileName,className:"inline-flex items-center gap-2 px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90",children:"Download"})]})]})}const lM={"bp-400":"min-[400px]:hidden","bp-480":"min-[480px]:hidden",sm:"sm:hidden",md:"md:hidden",lg:"lg:hidden"};function rM({collapsedItems:n=[]}){const{authenticated:r,email:o,picture:i}=uo(),[c,f]=g.useState(!1),d=g.useRef(null),[h,y]=g.useState(null),[p,x]=g.useState(null);g.useEffect(()=>{fetch("/api/content-link/privacy").then(E=>E.json()).then(E=>{E.url&&y(E.url)}).catch(()=>{}),fetch("/api/content-link/terms").then(E=>E.json()).then(E=>{E.url&&x(E.url)}).catch(()=>{})},[]);const b=g.useCallback(()=>!!document.querySelector("[data-radix-popper-content-wrapper]"),[]);if(g.useEffect(()=>{if(!c)return;function E(A){const C=A.target;d.current?.contains(C)||b()||C.closest?.("[data-radix-popper-content-wrapper]")||C.closest?.('[role="menu"]')||f(!1)}return document.addEventListener("pointerdown",E,!0),document.addEventListener("mousedown",E,!0),()=>{document.removeEventListener("pointerdown",E,!0),document.removeEventListener("mousedown",E,!0)}},[c,b]),!r)return null;const S=o?o[0].toUpperCase():"?";return m.jsxs("div",{className:"relative",ref:d,children:[m.jsx("button",{onClick:()=>f(!c),className:"flex items-center gap-2 px-2 py-1 rounded-md hover:bg-zinc-700 transition-colors",title:o??"Account",children:i?m.jsx("img",{src:i,alt:"",className:"h-7 w-7 rounded-full",referrerPolicy:"no-referrer"}):m.jsx("div",{className:"h-7 w-7 rounded-full bg-blue-600 flex items-center justify-center text-white text-xs font-semibold",children:S})}),c&&m.jsxs("div",{className:"absolute right-0 top-full mt-1 w-56 bg-popover border border-border rounded-lg shadow-lg z-50 py-1",children:[m.jsxs("a",{href:"https://myaccount.google.com/",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 px-3 py-2 border-b border-border hover:bg-accent transition-colors",children:[m.jsx(oR,{className:"h-4 w-4 text-foreground"}),m.jsx("span",{className:"text-sm text-foreground truncate",children:o})]}),n.map((E,A)=>m.jsx("div",{className:lM[E.breakpoint],children:typeof E.node=="function"?E.node(()=>f(!1)):E.node},A)),n.length>0&&m.jsx("div",{className:"border-b border-border"}),m.jsxs("a",{href:"/auth/logout",className:"flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-accent transition-colors",children:[m.jsx(zN,{className:"h-4 w-4"}),"Sign out"]}),(h??p)&&m.jsxs("div",{className:"border-t border-border mt-1 pt-1",children:[h&&m.jsxs("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 px-3 py-1.5 text-xs text-muted-foreground hover:bg-accent transition-colors",children:[m.jsx(nv,{className:"h-3 w-3"}),"Privacy"]}),p&&m.jsxs("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 px-3 py-1.5 text-xs text-muted-foreground hover:bg-accent transition-colors",children:[m.jsx(nv,{className:"h-3 w-3"}),"Terms"]})]})]})]})}const oM=8;function iM(n){return n.filter(r=>{const o=String(r??"");return!(!o||!o.trim()||o.includes("[object Object]")||/^\$\{.*\}$/.test(o))})}function Wr(n){return n.replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase())}function sM({label:n,values:r,selected:o,onToggle:i,onRemove:c}){return m.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[m.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[n,":"]}),r.map(f=>m.jsx("button",{onClick:()=>i(f),className:`text-xs px-2 py-0.5 rounded-full border transition-colors ${o.has(f)?"bg-primary text-primary-foreground border-primary":"bg-muted text-muted-foreground border-border hover:bg-accent"}`,children:f},f)),m.jsx("button",{onClick:c,className:"text-muted-foreground hover:text-foreground ml-0.5",title:`Remove ${n} filter`,children:m.jsx(Za,{className:"h-3 w-3"})})]})}function cM({label:n,values:r,selected:o,onToggle:i,multi:c,onRemove:f}){const[d,h]=g.useState(!1),[y,p]=g.useState(""),x=g.useRef(null);g.useEffect(()=>{if(!d)return;const E=A=>{x.current&&!x.current.contains(A.target)&&(h(!1),p(""))};return document.addEventListener("mousedown",E,!0),()=>document.removeEventListener("mousedown",E,!0)},[d]);const b=y?r.filter(E=>E.toLowerCase().includes(y.toLowerCase())):r,S=o.size===0?"All":o.size<=2?[...o].join(", "):`${o.size} selected`;return m.jsxs("div",{className:"flex items-center gap-1.5",ref:x,children:[m.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[n,":"]}),m.jsxs("div",{className:"relative",children:[m.jsxs("button",{onClick:()=>h(!d),className:`text-xs px-2 py-0.5 rounded border transition-colors flex items-center gap-1 min-w-[100px] ${o.size>0?"bg-primary/10 text-primary border-primary":"bg-muted text-muted-foreground border-border hover:bg-accent"}`,children:[m.jsx("span",{className:"truncate max-w-[200px]",children:S}),m.jsx(Ff,{className:"h-3 w-3 shrink-0"})]}),d&&m.jsxs("div",{className:"absolute top-full left-0 mt-1 z-50 bg-background border border-border rounded shadow-lg w-64 max-h-48 flex flex-col",children:[m.jsx("div",{className:"p-1.5 border-b border-border",children:m.jsx("input",{type:"text",value:y,onChange:E=>p(E.target.value),placeholder:"Search...",className:"text-xs w-full px-2 py-1 rounded border border-border bg-muted text-foreground placeholder:text-muted-foreground outline-none focus:border-primary",autoFocus:!0})}),m.jsxs("div",{className:"overflow-y-auto flex-1",children:[b.length===0&&m.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No matches"}),b.map(E=>m.jsxs("button",{onClick:()=>{i(E),c||(h(!1),p(""))},className:`w-full text-left text-xs px-3 py-1.5 hover:bg-accent transition-colors flex items-center gap-2 ${o.has(E)?"bg-primary/10 text-primary":"text-foreground"}`,children:[c&&m.jsx("span",{className:`w-3 h-3 rounded-sm border flex items-center justify-center shrink-0 ${o.has(E)?"bg-primary border-primary":"border-border"}`,children:o.has(E)&&m.jsx("span",{className:"text-[8px] text-primary-foreground",children:"✓"})}),m.jsx("span",{className:"truncate",children:E})]},E))]})]})]}),o.size>0&&o.size<=5&&[...o].map(E=>m.jsxs("button",{onClick:()=>i(E),className:"text-xs px-1.5 py-0.5 rounded-full bg-primary/10 text-primary border border-primary/30 hover:bg-primary/20 flex items-center gap-0.5",title:`Remove ${E}`,children:[m.jsx("span",{className:"truncate max-w-[120px]",children:E}),m.jsx(Za,{className:"h-2.5 w-2.5 shrink-0"})]},E)),m.jsx("button",{onClick:f,className:"text-muted-foreground hover:text-foreground ml-0.5",title:`Remove ${n} filter`,children:m.jsx(Za,{className:"h-3 w-3"})})]})}function uM({label:n,value:r,onChange:o,inputType:i="text",onRemove:c}){return m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[n,":"]}),m.jsx("input",{type:i,value:r,onChange:f=>o(f.target.value),placeholder:`Filter by ${n.toLowerCase()}...`,className:"text-xs px-2 py-0.5 rounded border border-border bg-muted text-foreground placeholder:text-muted-foreground w-64 outline-none focus:border-primary"}),m.jsx("button",{onClick:c,className:"text-muted-foreground hover:text-foreground",title:`Remove ${n} filter`,children:m.jsx(Za,{className:"h-3 w-3"})})]})}const vf=4,fM=new Set(["file_path","chunk_text","chunk_index","total_chunks","content_hash","embedded_at"]);function dM(n,r){const o=n.metadata??{},i=[],c=new Map(r.map(f=>[f.field,f]));for(const[f,d]of Object.entries(o)){if(fM.has(f))continue;const h=c.get(f);if(!h)continue;const y=Array.isArray(d)?d.map(String):[String(d)],x=h.uiHint!=="text"&&h.uiHint!=="number"?h.values.length:1/0;for(const b of y)!b||b==="undefined"||b==="null"||i.push({field:f,label:Wr(f),value:b,cardinality:x})}return i.sort((f,d)=>f.cardinality-d.cardinality),i}function mM({result:n,facets:r,onNavigate:o,onChipClick:i}){const[c,f]=g.useState(!1),d=n.chunks[0]?.text??"",h=d.length>150?d.slice(0,150)+"…":d,y=dM(n,r),p=y.slice(0,vf),x=y.length>vf,b=(S,E)=>{const A=S.value.length>30?S.value.slice(0,28)+"…":S.value;return m.jsxs("button",{onClick:C=>{C.stopPropagation(),i(S.field,S.value)},className:"text-[10px] px-1.5 py-0.5 rounded bg-muted text-foreground border border-border hover:bg-primary/10 hover:border-primary/30 transition-colors cursor-pointer truncate max-w-[200px]",title:`${S.label}: ${S.value} — click to filter`,children:[m.jsxs("span",{className:"text-muted-foreground",children:[S.label,":"]})," ",A]},`${S.field}-${E}`)};return m.jsx("div",{className:"border-b border-border last:border-0 px-4 py-2",children:m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsx(Sb,{className:"h-4 w-4 text-zinc-400 shrink-0 mt-1"}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("button",{onClick:()=>o(`/browse/${n.browsePath}`),className:"text-blue-500 hover:underline text-sm font-medium truncate",children:n.fileName}),m.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0",children:[(n.bestScore*100).toFixed(0),"%"]}),m.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0",children:[n.chunks.length," chunk",n.chunks.length!==1?"s":""]}),n.mtime&&m.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:new Date(n.mtime).toLocaleDateString()}),m.jsx("button",{onClick:()=>f(!c),className:"ml-auto text-muted-foreground hover:text-foreground shrink-0",title:c?"Collapse chunks":"Expand chunks",children:c?m.jsx(Ff,{className:"h-4 w-4"}):m.jsx(wb,{className:"h-4 w-4"})})]}),m.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 break-words leading-relaxed",children:n.browsePath}),!c&&p.length>0&&m.jsxs("div",{className:"flex flex-wrap items-center gap-1 mt-1",children:[p.map((S,E)=>b(S,E)),x&&m.jsxs("button",{onClick:()=>f(!0),className:"text-[10px] text-blue-500 hover:underline cursor-pointer",children:["+",y.length-vf," more"]})]}),!c&&p.length===0&&m.jsx("div",{className:"text-sm text-foreground/70 mt-1 truncate",children:h}),c&&m.jsxs(m.Fragment,{children:[y.length>0&&m.jsx("div",{className:"flex flex-wrap items-center gap-1 mt-1.5 mb-2",children:y.map((S,E)=>b(S,E))}),m.jsx("div",{className:"max-h-48 overflow-y-auto border border-border rounded bg-muted/30 divide-y divide-border",children:n.chunks.map((S,E)=>m.jsxs("div",{className:"px-3 py-2 text-sm text-foreground/80 leading-relaxed",children:[m.jsxs("span",{className:"text-[10px] text-muted-foreground mr-2",children:["#",S.index]}),S.text]},E))})]})]})]})})}function hM({open:n,onClose:r}){const[o,i]=g.useState(""),[c,f]=g.useState([]),[d,h]=g.useState(!1),[y,p]=g.useState(null),[x,b]=g.useState([]),[S,E]=g.useState(!1),A=g.useRef(!1),[C,N]=g.useState({}),[_,H]=g.useState({}),[D,B]=g.useState(new Set),[Q,W]=g.useState([]),[X,q]=g.useState(!1),[ne,ce]=g.useState(!1),[me,re]=g.useState(""),ge=g.useRef(null),fe=g.useRef(null),de=so(),j=g.useRef(void 0);g.useEffect(()=>{if(!ne)return;const te=pe=>{ge.current&&!ge.current.contains(pe.target)&&(ce(!1),re(""))};return document.addEventListener("mousedown",te),()=>document.removeEventListener("mousedown",te)},[ne]);const Z=g.useCallback(async()=>{if(!A.current){A.current=!0,E(!0);try{const te=await pE(),pe=[],be=[];for(const Se of te.facets){if(Se.uiHint==="hidden")continue;if(Se.uiHint==="text"||Se.uiHint==="number"){pe.push({...Se,values:[]});continue}const Re=iM(Se.values),Xe=Se.values.filter($n=>!Re.includes($n));if(Xe.length>0){const $n=Xe.map(Xn=>!Xn||!String(Xn).trim()?"empty":String(Xn).includes("[object Object]")?"object-to-string":/^\$\{.*\}$/.test(String(Xn))?"unresolved-template":"unknown");be.push({field:Se.field,removed:Xe.map((Xn,go)=>`${JSON.stringify(Xn)} (${$n[go]})`),reason:[...new Set($n)].join(", ")})}Re.length>0?pe.push({...Se,values:Re}):be.push({field:Se.field,removed:Xe.length>0?["(all values filtered)"]:["(no values)"],reason:Xe.length>0?"no valid values remain":"empty values array"})}console.log("[SearchModal] Loaded facets:",pe.length,"clean,",be.length,"garbage entries"),b(pe),W(be)}catch(te){console.error("Failed to load facets:",te),b([])}finally{E(!1)}}},[]);g.useEffect(()=>{n&&(setTimeout(()=>fe.current?.focus(),50),Z())},[n,Z]);const ee=g.useCallback(()=>{i(""),f([]),p(null),N({}),H({}),B(new Set),q(!1),fe.current?.focus()},[]),z=g.useCallback(async te=>{if(!te.trim()){f([]);return}h(!0),p(null);try{const pe=[];for(const[Re,Xe]of Object.entries(C))Xe.size>0&&pe.push({key:Re,match:{any:[...Xe]}});for(const[Re,Xe]of Object.entries(_))Xe.trim()&&pe.push({key:Re,match:{text:Xe.trim()}});const be=pe.length>0?{must:pe}:void 0,Se=await hE(te,30,be);f(Se.results)}catch(pe){p(String(pe))}finally{h(!1)}},[C,_]),G=g.useCallback(te=>{i(te),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{z(te)},400)},[z]),R=g.useCallback(te=>{r(),de(te)},[de,r]),U=g.useCallback((te,pe)=>{B(Se=>new Set([...Se,te]));const be=x.find(Se=>Se.field===te);be&&(be.uiHint==="text"||be.uiHint==="number")?H(Se=>({...Se,[te]:pe})):N(Se=>{const Re=Se[te]??new Set,Xe=new Set(Re);return Xe.add(pe),{...Se,[te]:Xe}})},[x]),V=g.useCallback((te,pe)=>{N(be=>{const Se=be[te]??new Set,Re=new Set(Se);return Re.has(pe)?Re.delete(pe):Re.add(pe),{...be,[te]:Re}})},[]),P=g.useCallback(te=>{B(pe=>new Set([...pe,te]))},[]),I=g.useCallback(te=>{B(pe=>{const be=new Set(pe);return be.delete(te),be}),N(pe=>{const be={...pe};return delete be[te],be}),H(pe=>{const be={...pe};return delete be[te],be})},[]);g.useEffect(()=>{o.trim()&&z(o)},[C,_]);const ae=x.filter(te=>D.has(te.field)),le=x.filter(te=>!D.has(te.field)),De=me?le.filter(te=>Wr(te.field).toLowerCase().includes(me.toLowerCase())):le;function ye(te){const pe=Wr(te.field),be=()=>I(te.field);if(te.uiHint==="text"||te.uiHint==="number")return m.jsx(uM,{label:pe,value:_[te.field]??"",onChange:Re=>H(Xe=>({...Xe,[te.field]:Re})),inputType:te.uiHint==="number"?"number":"text",onRemove:be},te.field);const Se=C[te.field]??new Set;return te.values.length<=oM?m.jsx(sM,{label:pe,values:te.values,selected:Se,onToggle:Re=>V(te.field,Re),onRemove:be},te.field):m.jsx(cM,{label:pe,values:te.values,selected:Se,onToggle:Re=>V(te.field,Re),multi:te.uiHint==="multiselect",onRemove:be},te.field)}return n?m.jsxs("div",{className:"fixed inset-0 z-[100] flex items-start justify-center pt-[5vh]",onClick:r,children:[m.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm"}),m.jsxs("div",{className:"relative bg-background border border-border rounded-lg shadow-2xl w-full max-w-4xl max-h-[85vh] flex flex-col",onClick:te=>te.stopPropagation(),children:[m.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border",children:[m.jsx(Cb,{className:"h-5 w-5 text-muted-foreground shrink-0"}),m.jsx("input",{ref:fe,type:"text",value:o,onChange:te=>G(te.target.value),onKeyDown:te=>{te.key==="Escape"&&r()},placeholder:"Search documents...",className:"flex-1 bg-transparent outline-none text-foreground placeholder:text-muted-foreground"}),d&&m.jsx("div",{className:"h-4 w-4 border-2 border-primary border-t-transparent rounded-full animate-spin"}),(o||c.length>0)&&m.jsx("button",{onClick:ee,className:"text-muted-foreground hover:text-foreground",title:"Reset search",children:m.jsx(nR,{className:"h-4 w-4"})}),m.jsx("button",{onClick:r,className:"text-muted-foreground hover:text-foreground",title:"Close (Esc)",children:m.jsx(Za,{className:"h-5 w-5"})})]}),m.jsxs("div",{className:"px-4 py-2 border-b border-border flex flex-col gap-1.5",children:[ae.map(ye),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsxs("div",{className:"relative",ref:ge,children:[m.jsxs("button",{onClick:()=>{ne||Z(),ce(!ne)},className:"text-xs px-2 py-0.5 rounded border border-dashed border-border text-muted-foreground hover:text-foreground hover:border-foreground transition-colors flex items-center gap-1",children:[m.jsx(ZN,{className:"h-3 w-3"}),S?"Loading filters...":"Add filter"]}),ne&&m.jsxs("div",{className:"absolute top-full left-0 mt-1 z-50 bg-background border border-border rounded shadow-lg w-56 max-h-48 flex flex-col",children:[m.jsx("div",{className:"p-1.5 border-b border-border",children:m.jsx("input",{type:"text",value:me,onChange:te=>re(te.target.value),placeholder:"Search filters...",className:"text-xs w-full px-2 py-1 rounded border border-border bg-muted text-foreground placeholder:text-muted-foreground outline-none focus:border-primary",autoFocus:!0})}),m.jsxs("div",{className:"overflow-y-auto flex-1",children:[S&&m.jsxs("div",{className:"px-3 py-2 text-xs text-muted-foreground flex items-center gap-2",children:[m.jsx("div",{className:"h-3 w-3 border-2 border-primary border-t-transparent rounded-full animate-spin"}),"Loading..."]}),!S&&De.length===0&&m.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:x.length===0?"No filters available":"All filters active"}),De.map(te=>m.jsxs("button",{onClick:()=>{P(te.field),ce(!1),re("")},className:"w-full text-left text-xs px-3 py-1.5 hover:bg-accent transition-colors flex items-center justify-between",children:[m.jsx("span",{className:"text-foreground",children:Wr(te.field)}),m.jsx("span",{className:"text-[10px] text-muted-foreground",children:te.uiHint==="text"||te.uiHint==="number"?te.uiHint:`${te.values.length}`})]},te.field))]})]})]}),Q.length>0&&m.jsxs("button",{onClick:()=>q(!X),className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/10 text-amber-600 border border-amber-500/30 hover:bg-amber-500/20 transition-colors",title:"Show inference rule issues",children:[Q.length," issue",Q.length!==1?"s":""]})]}),X&&Q.length>0&&m.jsxs("div",{className:"mt-1 p-2 rounded border border-amber-500/30 bg-amber-500/5 text-xs max-h-32 overflow-y-auto",children:[m.jsx("div",{className:"text-amber-600 font-medium mb-1",children:"Filtered facet values (inference rule issues):"}),Q.map(te=>m.jsxs("div",{className:"mb-1",children:[m.jsx("span",{className:"text-foreground font-medium",children:Wr(te.field)}),m.jsx("span",{className:"text-muted-foreground",children:": "}),te.removed.map((pe,be)=>m.jsxs("span",{className:"text-amber-700",children:[be>0&&", ",m.jsx("code",{className:"bg-amber-500/10 px-0.5 rounded",children:pe})]},be))]},te.field))]})]}),m.jsxs("div",{className:"overflow-y-auto flex-1",children:[y&&m.jsx("div",{className:"px-4 py-3 text-sm text-red-500",children:y}),!y&&c.length===0&&o.trim()&&!d&&m.jsx("div",{className:"px-4 py-8 text-center text-muted-foreground text-sm",children:"No results found"}),!y&&!o.trim()&&!d&&m.jsx("div",{className:"px-4 py-8 text-center text-muted-foreground text-sm",children:"Type a query to search across all documents"}),c.map(te=>m.jsx(mM,{result:te,facets:x,onNavigate:R,onChipClick:U},te.browsePath))]}),c.length>0&&m.jsxs("div",{className:"px-4 py-2 border-t border-border text-xs text-muted-foreground",children:[c.length," result",c.length!==1?"s":""]})]})]}):null}const Mv="https://github.com/karmaniverous/jeeves-server";function hd({breadcrumbs:n=[],isInsider:r,searchEnabled:o,theme:i,onToggleTheme:c,keyAge:f,onRotateKey:d,downloadDropdown:h,linkControls:y,downloadMenuItem:p,linkMenuItem:x}){const b=r&&d,[S,E]=g.useState(null),[A,C]=g.useState(!1),N=g.useCallback(D=>{(D.metaKey||D.ctrlKey)&&D.key==="k"&&(D.preventDefault(),C(!0))},[]);g.useEffect(()=>{if(o&&r)return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[o,r,N]),g.useEffect(()=>{fetch("/api/readme-link").then(D=>D.ok?D.json():null).then(D=>{D?.url&&E(D.url)}).catch(()=>{})},[]);const _=[],H="flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-accent transition-colors w-full text-left cursor-pointer";return x&&_.push({breakpoint:"bp-400",node:x,hasNestedDropdown:!0}),p&&_.push({breakpoint:"bp-480",node:p,hasNestedDropdown:!0}),b&&_.push({breakpoint:"sm",node:m.jsxs("button",{onClick:d,className:H,children:[m.jsx(lv,{className:"h-4 w-4 shrink-0"}),"Rotate key",f?` (${f})`:""]})}),r&&_.push({breakpoint:"md",node:m.jsxs(Ln,{to:"/runner",className:H,children:[m.jsx(ev,{className:"h-4 w-4 shrink-0"}),"Runner"]})}),S&&_.push({breakpoint:"md",node:m.jsxs("a",{href:S,className:H,children:[m.jsx(tv,{className:"h-4 w-4 shrink-0"}),"README"]})}),_.push({breakpoint:"md",node:m.jsxs("a",{href:Mv,target:"_blank",rel:"noopener noreferrer",className:H,children:[m.jsx(av,{className:"h-4 w-4 shrink-0"}),"GitHub"]})}),_.push({breakpoint:"md",node:m.jsxs("button",{onClick:c,className:H,children:[i==="dark"?m.jsx(ov,{className:"h-4 w-4 shrink-0"}):m.jsx(rv,{className:"h-4 w-4 shrink-0"}),i==="dark"?"Light mode":"Dark mode"]})}),m.jsxs("header",{className:"bg-zinc-800 text-white px-4 py-2",children:[m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsxs("div",{className:"flex items-center min-w-0 flex-1",children:[m.jsx(Ln,{to:"/browse",className:"text-3xl no-underline shrink-0 mr-1",title:"Jeeves Server",children:"🎩"}),m.jsx("nav",{className:"flex items-center gap-1 min-w-0 overflow-x-auto overflow-y-hidden scrollbar-thin",children:n.map((D,B)=>m.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[m.jsx("span",{className:"text-zinc-500 mx-0.5",children:"/"}),B===n.length-1?m.jsx("span",{className:"text-zinc-300 truncate max-w-48",children:D.label}):m.jsx(Ln,{to:`/browse/${D.path}`,className:"text-blue-400 hover:underline truncate max-w-48",children:D.label})]},D.path))})]}),m.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[o&&r&&m.jsx(Qt,{variant:"ghost",size:"icon",className:"text-zinc-300 hover:text-white hover:bg-white/10 h-8 w-8",title:"Search (Ctrl+K)",onClick:()=>C(!0),children:m.jsx(Cb,{className:"h-4 w-4"})}),y&&m.jsx("div",{className:"hidden min-[400px]:flex items-center",children:y}),h&&m.jsx("div",{className:"hidden min-[480px]:flex items-center",children:h}),b&&m.jsxs("div",{className:"hidden sm:flex items-center gap-1",children:[m.jsx(Qt,{variant:"ghost",size:"icon",className:"text-zinc-300 hover:text-white hover:bg-white/10 h-8 w-8",title:"Rotate key (invalidates all your shares)",onClick:d,children:m.jsx(lv,{className:"h-4 w-4"})}),f&&m.jsx("span",{className:"text-xs text-zinc-500",children:f})]}),r&&m.jsx(Ln,{to:"/runner",title:"Runner Dashboard",className:"hidden md:inline-flex",children:m.jsx(Qt,{variant:"ghost",size:"icon",className:"text-zinc-300 hover:text-white hover:bg-white/10 h-8 w-8",children:m.jsx(ev,{className:"h-4 w-4"})})}),S&&m.jsx("a",{href:S,title:"README",className:"hidden md:inline-flex",children:m.jsx(Qt,{variant:"ghost",size:"icon",className:"text-zinc-300 hover:text-white hover:bg-white/10 h-8 w-8",children:m.jsx(tv,{className:"h-4 w-4"})})}),m.jsx("a",{href:Mv,target:"_blank",rel:"noopener noreferrer",title:"GitHub",className:"hidden md:inline-flex",children:m.jsx(Qt,{variant:"ghost",size:"icon",className:"text-zinc-300 hover:text-white hover:bg-white/10 h-8 w-8",children:m.jsx(av,{className:"h-4 w-4"})})}),m.jsx(Qt,{variant:"ghost",size:"icon",className:"text-zinc-300 hover:text-white hover:bg-white/10 h-8 w-8 hidden md:inline-flex",title:"Toggle theme",onClick:c,children:i==="dark"?m.jsx(ov,{className:"h-4 w-4"}):m.jsx(rv,{className:"h-4 w-4"})}),m.jsx(rM,{theme:i,onToggleTheme:c,collapsedItems:_})]})]}),o&&r&&m.jsx(hM,{open:A,onClose:()=>C(!1)})]})}function pM({reqPath:n,file:r,fileRendered:o,viewTab:i,setViewTab:c,proseWidth:f,toggleProseWidth:d,isInsider:h,editing:y,setEditing:p,mobileTocOpen:x,setMobileTocOpen:b,loading:S}){if(!r&&!S)return null;const E=(o?Mf(o):!1)||(r?Mf(r):W_(n)),A=E?i:"raw";return m.jsxs("div",{className:"flex items-center gap-1 border-b border-border bg-background px-4 md:px-6",children:[o?.headings&&o.headings.length>2&&m.jsx("button",{onClick:()=>b(!x),className:"lg:hidden p-1.5 mr-1 text-muted-foreground hover:text-foreground transition-colors",title:"Table of contents",children:x?m.jsx(Za,{className:"h-4 w-4"}):m.jsx(HN,{className:"h-4 w-4"})}),E&&m.jsx("button",{onClick:()=>c("rendered"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${A==="rendered"?"border-blue-500 text-blue-500":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Rendered"}),m.jsx("button",{onClick:()=>c("raw"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${A==="raw"?"border-blue-500 text-blue-500":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Raw"}),r?.type==="markdown"&&A==="rendered"&&m.jsx("div",{className:"hidden md:flex items-center ml-2 border border-border rounded-md overflow-hidden",children:["narrow","medium","wide"].map(C=>m.jsx("button",{onClick:()=>d(C),className:`p-1.5 transition-colors ${f===C?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,title:`${C.charAt(0).toUpperCase()+C.slice(1)} width`,children:C==="narrow"?m.jsx(GN,{className:"h-3.5 w-3.5"}):C==="medium"?m.jsx(qN,{className:"h-3.5 w-3.5"}):m.jsx(LN,{className:"h-3.5 w-3.5"})},C))}),h&&A==="raw"&&r?.content!=null&&!y&&m.jsxs("button",{onClick:()=>p(!0),className:"ml-2 flex items-center gap-1 px-2 py-1 text-sm text-muted-foreground hover:text-foreground border border-border rounded transition-colors",title:"Edit file",children:[m.jsx(XN,{className:"h-3.5 w-3.5"})," Edit"]})]})}function gM(n,r){const[o,i]=g.useState(null),[c,f]=g.useState(null),[d,h]=g.useState(null),[y,p]=g.useState(null),[x,b]=g.useState(!0),[S,E]=g.useState(null),[A,C]=g.useState(!1),N=r.get("tab")==="raw"?"raw":"rendered",[_,H]=g.useState(N),D=y??d,B=g.useCallback(async(W,X)=>{if(b(!0),E(null),i(null),f(null),h(null),p(null),C(!1),H(X.get("tab")==="raw"?"raw":"rendered"),W)try{const q=await uE(W);"entries"in q?(f(q),b(!1)):(Pu(W).then(ne=>{h(ne),b(!1)}).catch(()=>{}),Fu(W).then(p).catch(()=>{}))}catch{Pu(W).then(q=>{h(q),b(!1)}).catch(q=>{E(q.message),b(!1)}),Fu(W).then(p).catch(()=>{})}else try{const q=await cE();i(q)}catch(q){E(q.message)}finally{b(!1)}},[]);return g.useEffect(()=>{B(n,r)},[B,n]),{drives:o,directory:c,fileRaw:d,fileRendered:y,file:D,loading:x,error:S,editing:A,setEditing:C,viewTab:_,setViewTab:H,handleSave:async W=>{await mE(n,W);const X=await Pu(n);h(X);try{const q=await Fu(n);p(q)}catch{}C(!1)}}}function vM(){const n=localStorage.getItem("jeeves-share-settings");if(n)try{return JSON.parse(n)}catch{}return{expiry:localStorage.getItem("jeeves-share-expiry")??"",depth:0,dirs:!1}}function yM(){const[n,r]=g.useState(vM);return g.useEffect(()=>{localStorage.setItem("jeeves-share-settings",JSON.stringify(n))},[n]),{shareSettings:n,setShareSettings:r}}function bM(n=""){const r=g.useRef(null),o=g.useRef(null),[i,c]=g.useState(96),f=g.useCallback(()=>{r.current&&c(r.current.offsetHeight)},[]);return g.useEffect(()=>(f(),window.addEventListener("resize",f),()=>window.removeEventListener("resize",f)),[f]),g.useEffect(()=>{f()},[f,n]),{topBarRef:r,mainRef:o,topBarHeight:i}}function xM(n){const r=Date.now()-new Date(n).getTime(),o=Math.floor(r/6e4);if(o<60)return`${String(o)}m ago`;const i=Math.floor(o/60);if(i<24)return`${String(i)}h ago`;const c=Math.floor(i/24);return`${String(c)}d ago`}function wM(){const r=Kv()["*"]??"",[o,i]=tE(),[c,f]=Cs();g.useEffect(()=>{const P="Jeeves Server",I=r.split("/").filter(Boolean),ae=I.length?I[I.length-1]:"",le=ae?decodeURIComponent(ae):"";document.title=le?`${le} - ${P}`:P},[r]);const{drives:d,directory:h,fileRaw:y,fileRendered:p,file:x,loading:b,error:S,editing:E,setEditing:A,viewTab:C,setViewTab:N,handleSave:_}=gM(r,o),H=P=>{N(P),i(I=>{const ae=new URLSearchParams(I);return P==="rendered"?ae.delete("tab"):ae.set("tab",P),ae},{replace:!0})},{shareSettings:D,setShareSettings:B}=yM(),[Q,W]=g.useState(!1),[X,q]=g.useState(()=>localStorage.getItem("jeeves-prose-width")??"medium"),ne=P=>{q(P),localStorage.setItem("jeeves-prose-width",P)},{isInsider:ce,searchEnabled:me,keyCreatedAt:re,rotateKey:ge}=uo(),fe=h?.breadcrumbs??x?.breadcrumbs??[],de=h?.isInsider??x?.isInsider??ce,j=re?xM(re):null,[Z,ee]=g.useState(!1),z=()=>ee(!0),G=async()=>{ee(!1),await ge()},{topBarRef:R,mainRef:U,topBarHeight:V}=bM(JSON.stringify([x,h,d]));return{reqPath:r,theme:c,toggleTheme:f,shareSettings:D,setShareSettings:B,mobileTocOpen:Q,setMobileTocOpen:W,proseWidth:X,toggleProseWidth:ne,drives:d,directory:h,fileRaw:y,fileRendered:p,file:x,loading:b,error:S,editing:E,setEditing:A,viewTab:C,setViewTab:H,breadcrumbs:fe,isInsider:de,searchEnabled:me,keyAge:j,rotateKeyDialogOpen:Z,setRotateKeyDialogOpen:ee,handleRotateKey:z,confirmRotateKey:G,topBarRef:R,mainRef:U,topBarHeight:V,handleSave:_}}function SM(){const{reqPath:n,theme:r,toggleTheme:o,shareSettings:i,setShareSettings:c,mobileTocOpen:f,setMobileTocOpen:d,proseWidth:h,toggleProseWidth:y,drives:p,directory:x,fileRaw:b,fileRendered:S,file:E,loading:A,error:C,editing:N,setEditing:_,viewTab:H,setViewTab:D,breadcrumbs:B,isInsider:Q,searchEnabled:W,keyAge:X,rotateKeyDialogOpen:q,setRotateKeyDialogOpen:ne,handleRotateKey:ce,confirmRotateKey:me,topBarRef:re,mainRef:ge,topBarHeight:fe,handleSave:de}=wM(),j=E||A&&!!n;return m.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[m.jsxs("div",{ref:re,className:"fixed top-0 left-0 right-0 z-50",children:[m.jsx(hd,{breadcrumbs:B,isInsider:Q,searchEnabled:W,theme:r,onToggleTheme:o,keyAge:N?void 0:X,onRotateKey:N?void 0:ce,downloadDropdown:N?void 0:E?m.jsx(Ir,{reqPath:n,file:E,isInsider:Q,variant:"header"}):x?m.jsx(Ir,{reqPath:n,file:null,isDirectory:!0,isInsider:Q,variant:"header"}):void 0,downloadMenuItem:N?void 0:E?(Z=>m.jsx(Ir,{reqPath:n,file:E,isInsider:Q,variant:"menuItem",onStateChange:ee=>{ee==="done"&&setTimeout(Z,800)}})):x?(Z=>m.jsx(Ir,{reqPath:n,file:null,isDirectory:!0,isInsider:Q,variant:"menuItem",onStateChange:ee=>{ee==="done"&&setTimeout(Z,800)}})):void 0,linkControls:N?void 0:Q?m.jsx(us,{path:`/${n}`,shareSettings:i,onShareSettingsChange:c,showEvent:!0,showRaw:!!E,variant:"header",isDirectory:!E}):void 0,linkMenuItem:N?void 0:Q?(Z=>m.jsx(us,{path:`/${n}`,shareSettings:i,onShareSettingsChange:c,showEvent:!0,showRaw:!!E,variant:"menuItem",isDirectory:!E,onStateChange:ee=>{ee==="done"&&setTimeout(Z,800)}})):void 0}),j&&m.jsx(pM,{reqPath:n,file:E,fileRendered:S,viewTab:H,setViewTab:D,proseWidth:h,toggleProseWidth:y,isInsider:Q,editing:N,setEditing:_,mobileTocOpen:f,setMobileTocOpen:d,loading:A})]}),m.jsxs("main",{ref:ge,className:j?"px-0 pb-32 overflow-y-auto":"p-4 pb-32 md:px-6 md:pt-6 overflow-y-auto",style:{marginTop:`${fe}px`,height:`calc(100vh - ${fe}px)`},children:[A&&!n&&m.jsx("div",{className:"text-muted-foreground text-sm",children:"Loading..."}),C&&m.jsxs("div",{className:"text-destructive text-sm",children:["Error: ",C]}),!A&&!C&&p&&m.jsx(s_,{drives:p,isInsider:Q,shareSettings:i,onShareSettingsChange:c}),!A&&!C&&x&&m.jsx(i_,{entries:x.entries,basePath:n,isInsider:Q,shareSettings:i,onShareSettingsChange:c}),!C&&j&&m.jsx(aM,{reqPath:n,file:E,fileRaw:b,fileRendered:S,viewTab:H,editing:N,setEditing:_,proseWidth:h,topBarHeight:fe,mainRef:ge,mobileTocOpen:f,setMobileTocOpen:d,onSave:de,loading:A})]}),m.jsx(nN,{open:q,onOpenChange:ne,title:"Rotate insider key?",description:"This will invalidate ALL existing share links generated with your current key. This action cannot be undone.",confirmLabel:"Rotate Key",onConfirm:()=>{me()}})]})}function EM(){const{loading:n,authenticated:r}=uo(),o=so();return g.useEffect(()=>{!n&&r&&o("/browse",{replace:!0})},[n,r,o]),n?m.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:m.jsx("div",{className:"text-muted-foreground text-sm",children:"Loading..."})}):m.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:m.jsxs("div",{className:"text-center space-y-6",children:[m.jsx("div",{className:"text-6xl mb-2",children:"🎩"}),m.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:"Jeeves"}),m.jsx("p",{className:"text-muted-foreground text-sm max-w-xs mx-auto",children:"File browser and document server"}),m.jsxs("a",{href:"/auth/login?returnTo=/browse",className:"inline-flex items-center gap-3 px-6 py-3 bg-white text-zinc-800 rounded-lg shadow-md hover:shadow-lg transition-shadow font-medium text-sm border border-zinc-200",children:[m.jsxs("svg",{viewBox:"0 0 24 24",width:"20",height:"20",className:"shrink-0",children:[m.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z"}),m.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),m.jsx("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),m.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]}),"Sign in with Google"]})]})})}const CM={ok:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",error:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400",running:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400",disabled:"bg-zinc-100 text-zinc-500 dark:bg-zinc-800 dark:text-zinc-400",pending:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400"},NM="bg-zinc-100 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-300";function pd({status:n}){const r=n??"pending",o=CM[r]??NM;return m.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${o}`,children:r})}const wa={name:"w-[30%] px-3 py-2",type:"w-[10%] px-3 py-2",schedule:"w-[15%] px-3 py-2",status:"w-[12%] px-3 py-2",lastRun:"w-[25%] px-3 py-2",action:"w-[8%] px-3 py-2"};function RM(n){if(!n)return"—";try{return new Date(n).toLocaleString()}catch{return n}}function AM({column:n,sort:r}){return r.column!==n?m.jsx(hN,{className:"h-3 w-3 opacity-40"}):r.direction==="asc"?m.jsx(gN,{className:"h-3 w-3"}):m.jsx(uN,{className:"h-3 w-3"})}const TM=[{key:"name",label:"Name"},{key:"type",label:"Type"},{key:"schedule",label:"Schedule"},{key:"status",label:"Status"},{key:"lastRun",label:"Last Run"}];function _M({sort:n,onSort:r}){return m.jsx("div",{className:"overflow-x-auto",children:m.jsx("table",{className:"w-full text-sm",children:m.jsx("thead",{children:m.jsxs("tr",{className:"border-b border-border text-left",children:[TM.map(o=>m.jsx("th",{className:`${wa[o.key]} font-medium text-muted-foreground cursor-pointer select-none hover:text-foreground transition-colors`,onClick:()=>r(o.key),children:m.jsxs("span",{className:"inline-flex items-center gap-1",children:[o.label,m.jsx(AM,{column:o.key,sort:n})]})},o.key)),m.jsx("th",{className:`${wa.action} font-medium text-muted-foreground`})]})})})})}function MM({jobs:n,onRunNow:r}){const o=so();return n.length===0?m.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No jobs found"}):m.jsx("div",{className:"overflow-x-auto",children:m.jsx("table",{className:"w-full text-sm",children:m.jsx("tbody",{children:n.map(i=>m.jsxs("tr",{className:"border-b border-border hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>o(`/runner/${i.id}`),children:[m.jsx("td",{className:`${wa.name} font-medium`,children:i.name}),m.jsx("td",{className:`${wa.type} text-muted-foreground`,children:i.type}),m.jsx("td",{className:`${wa.schedule} font-mono text-xs text-muted-foreground`,children:i.schedule}),m.jsx("td",{className:wa.status,children:m.jsx(pd,{status:i.enabled?i.status:"disabled"})}),m.jsx("td",{className:`${wa.lastRun} text-muted-foreground text-xs`,children:RM(i.lastRun)}),m.jsx("td",{className:wa.action,children:m.jsx(Qt,{variant:"ghost",size:"icon",className:"h-7 w-7",title:"Run Now",onClick:c=>{c.stopPropagation(),r(i.id)},children:m.jsx(Eb,{className:"h-3.5 w-3.5"})})})]},i.id))})})})}function jM(n,r){return[...n].sort((o,i)=>{if(r.column){const f=OM(o,i,r.column);if(f!==0)return r.direction==="asc"?f:-f}const c=Zx(o.lastRun,i.lastRun);return c!==0?-c:o.name.localeCompare(i.name)})}function OM(n,r,o){switch(o){case"name":return n.name.localeCompare(r.name);case"type":return n.type.localeCompare(r.type);case"schedule":return n.schedule.localeCompare(r.schedule);case"status":{const i=n.enabled?n.status??"":"disabled",c=r.enabled?r.status??"":"disabled";return i.localeCompare(c)}case"lastRun":return Zx(n.lastRun,r.lastRun);default:return 0}}function Zx(n,r){return!n&&!r?0:n?r?n<r?-1:n>r?1:0:1:-1}function DM(n,r){return n.column===r?n.direction==="desc"?{column:r,direction:"asc"}:{column:null,direction:"desc"}:{column:r,direction:"desc"}}function Ki({label:n,value:r,color:o}){return m.jsxs("div",{className:"flex flex-col items-center px-3 py-1",children:[m.jsx("span",{className:`text-lg font-bold leading-tight ${o}`,children:r}),m.jsx("span",{className:"text-xs text-muted-foreground",children:n})]})}function zM({stats:n}){return n?m.jsxs("div",{className:"flex flex-wrap items-center gap-1 px-2 py-1 bg-muted/50 rounded-lg",children:[m.jsx(Ki,{label:"Total",value:n.totalJobs,color:"text-foreground"}),m.jsx(Ki,{label:"Running",value:n.running,color:"text-yellow-600 dark:text-yellow-400"}),m.jsx(Ki,{label:"OK (1h)",value:n.okLastHour,color:"text-green-600 dark:text-green-400"}),m.jsx(Ki,{label:"Errors (1h)",value:n.errorsLastHour,color:"text-red-600 dark:text-red-400"})]}):m.jsx("div",{className:"flex items-center gap-4 p-4 bg-muted/50 rounded-lg",children:m.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading stats..."})})}const kM="/api/runner";async function el(n,r){const o=await fetch(Jl(`${kM}${n}`),{...r,credentials:"same-origin"});if(o.status===401)throw window.location.href=`/auth/login?returnTo=${encodeURIComponent(window.location.pathname)}`,new Error("Unauthorized");if(!o.ok){const i=await o.text();throw new Error(`Runner API error ${String(o.status)}: ${i}`)}return o.json()}function Fx(n){return{id:n.id,name:n.name,type:n.type,schedule:n.schedule,enabled:n.enabled===1,overlapPolicy:n.overlap_policy,status:n.last_status,lastRun:n.last_run,description:n.description}}function LM(n){return{id:n.id,jobId:n.job_id,status:n.status,trigger:n.trigger,startedAt:n.started_at,finishedAt:n.finished_at,durationMs:n.duration_ms,exitCode:n.exit_code,stdoutTail:n.stdout_tail,stderrTail:n.stderr_tail}}async function UM(){return await el("/status")}async function HM(){return(await el("/jobs")).jobs.map(Fx)}async function BM(n){const r=await el(`/jobs/${encodeURIComponent(n)}`);return Fx(r.job)}async function GM(n,r=20){return(await el(`/jobs/${encodeURIComponent(n)}/runs?limit=${String(r)}`)).runs.map(LM)}async function Px(n){return el(`/jobs/${encodeURIComponent(n)}/run`,{method:"POST"})}async function YM(n){return el(`/jobs/${encodeURIComponent(n)}/enable`,{method:"POST"})}async function qM(n){return el(`/jobs/${encodeURIComponent(n)}/disable`,{method:"POST"})}const VM=1e4;function $M(){const[n,r]=g.useState([]),[o,i]=g.useState(null),[c,f]=g.useState(null),[d,h]=g.useState(!0),[y,p]=g.useState(!0),[x,b]=g.useState({column:null,direction:"desc"}),S=g.useRef(null),[E,A]=Cs(),{isInsider:C,searchEnabled:N,keyCreatedAt:_,rotateKey:H}=uo(),D=_?`${Math.floor((Date.now()-new Date(_).getTime())/864e5)}d`:null,B=g.useCallback(async()=>{try{const[ne,ce]=await Promise.all([HM(),UM()]);r(ne),i(ce),f(null)}catch(ne){f(ne instanceof Error?ne.message:"Failed to fetch runner data")}finally{h(!1)}},[]);g.useEffect(()=>{B()},[B]),g.useEffect(()=>(y&&(S.current=setInterval(()=>{B()},VM)),()=>{S.current&&clearInterval(S.current)}),[y,B]);const Q=g.useCallback(async ne=>{try{await Px(ne),await B()}catch{await B()}},[B]),W=g.useCallback(ne=>{b(ce=>DM(ce,ne))},[]),X=g.useMemo(()=>jM(n,x),[n,x]),q=[{label:"Runner",path:"runner"}];return m.jsx("div",{className:`h-screen overflow-hidden ${E==="dark"?"dark":""}`,children:m.jsxs("div",{className:"h-full flex flex-col bg-background text-foreground",children:[m.jsx(hd,{breadcrumbs:q,isInsider:C,searchEnabled:N,theme:E,onToggleTheme:A,keyAge:D,onRotateKey:H}),m.jsxs("div",{className:"shrink-0 max-w-6xl mx-auto w-full px-4 pt-2 pb-1 flex items-center justify-between",children:[!d&&m.jsx(zM,{stats:o}),m.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[m.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground cursor-pointer",children:[m.jsx("input",{type:"checkbox",checked:y,onChange:ne=>p(ne.target.checked),className:"rounded"}),"Auto-refresh"]}),m.jsx(Qt,{variant:"ghost",size:"icon",className:"h-7 w-7",title:"Refresh now",onClick:()=>{B()},children:m.jsx(eR,{className:"h-3.5 w-3.5"})})]})]}),c&&m.jsx("div",{className:"shrink-0 max-w-6xl mx-auto w-full px-4 pt-2",children:m.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 text-red-700 dark:text-red-400 px-4 py-3 rounded-lg text-sm",children:c})}),d?m.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Loading..."}):m.jsx("div",{className:"flex-1 min-h-0 max-w-6xl mx-auto w-full px-4 pt-1 flex flex-col",children:m.jsxs("div",{className:"flex-1 min-h-0 bg-card border border-border rounded-lg flex flex-col",children:[m.jsx("div",{className:"shrink-0",children:m.jsx(_M,{sort:x,onSort:W})}),m.jsx("div",{className:"flex-1 overflow-y-auto pb-32",children:m.jsx(MM,{jobs:X,onRunNow:ne=>{Q(ne)}})})]})})]})})}function XM(n){if(n===null)return"—";if(n<1e3)return`${String(n)}ms`;const r=n/1e3;if(r<60)return`${r.toFixed(1)}s`;const o=Math.floor(r/60),i=Math.round(r%60);return`${String(o)}m ${String(i)}s`}function KM(n){if(!n)return"—";try{return new Date(n).toLocaleString()}catch{return n}}function QM({runs:n}){const[r,o]=g.useState(new Set),i=c=>{const f=String(c);o(d=>{const h=new Set(d);return h.has(f)?h.delete(f):h.add(f),h})};return n.length===0?m.jsx("div",{className:"text-center py-6 text-muted-foreground text-sm",children:"No runs yet"}):m.jsx("div",{className:"overflow-x-auto",children:m.jsxs("table",{className:"w-full text-sm",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"border-b border-border text-left",children:[m.jsx("th",{className:"px-3 py-2 w-8"}),m.jsx("th",{className:"px-3 py-2 font-medium text-muted-foreground",children:"Status"}),m.jsx("th",{className:"px-3 py-2 font-medium text-muted-foreground",children:"Trigger"}),m.jsx("th",{className:"px-3 py-2 font-medium text-muted-foreground",children:"Started"}),m.jsx("th",{className:"px-3 py-2 font-medium text-muted-foreground",children:"Duration"}),m.jsx("th",{className:"px-3 py-2 font-medium text-muted-foreground",children:"Exit"})]})}),m.jsx("tbody",{children:n.map(c=>m.jsx(ZM,{run:c,isExpanded:r.has(String(c.id)),onToggle:()=>i(c.id)},c.id))})]})})}function ZM({run:n,isExpanded:r,onToggle:o}){const i=n.stdoutTail||n.stderrTail;return m.jsxs(m.Fragment,{children:[m.jsxs("tr",{className:`border-b border-border transition-colors ${i?"cursor-pointer hover:bg-muted/50":""}`,onClick:i?o:void 0,children:[m.jsx("td",{className:"px-3 py-2",children:i&&(r?m.jsx(Ff,{className:"h-4 w-4 text-muted-foreground"}):m.jsx(wb,{className:"h-4 w-4 text-muted-foreground"}))}),m.jsx("td",{className:"px-3 py-2",children:m.jsx(pd,{status:n.status})}),m.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:n.trigger}),m.jsx("td",{className:"px-3 py-2 text-muted-foreground text-xs",children:KM(n.startedAt)}),m.jsx("td",{className:"px-3 py-2 text-muted-foreground text-xs",children:XM(n.durationMs)}),m.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:n.exitCode!==null?String(n.exitCode):"—"})]}),r&&i&&m.jsx("tr",{children:m.jsxs("td",{colSpan:6,className:"px-3 py-2 bg-muted/30",children:[m.jsx(jv,{label:"stdout",content:n.stdoutTail}),m.jsx(jv,{label:"stderr",content:n.stderrTail})]})})]})}function jv({label:n,content:r}){return r?m.jsxs("div",{className:"mb-2 last:mb-0",children:[m.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:n}),m.jsx("pre",{className:"text-xs bg-zinc-900 text-zinc-200 p-2 rounded overflow-x-auto max-h-48 whitespace-pre-wrap",children:r})]}):null}function FM(){const{jobId:n}=Kv(),[r,o]=g.useState(null),[i,c]=g.useState([]),[f,d]=g.useState(null),[h,y]=g.useState(!0),[p,x]=Cs(),{isInsider:b,searchEnabled:S,keyCreatedAt:E,rotateKey:A}=uo(),C=E?`${Math.floor((Date.now()-new Date(E).getTime())/864e5)}d`:null,N=g.useCallback(async()=>{if(n)try{const[B,Q]=await Promise.all([BM(n),GM(n,50)]);o(B),c(Q),d(null)}catch(B){d(B instanceof Error?B.message:"Failed to fetch job")}finally{y(!1)}},[n]);g.useEffect(()=>{N()},[N]);const _=g.useCallback(async()=>{if(r)try{r.enabled?await qM(r.id):await YM(r.id),await N()}catch{await N()}},[r,N]),H=g.useCallback(async()=>{if(r)try{await Px(r.id),setTimeout(()=>{N()},500)}catch{await N()}},[r,N]),D=[{label:"Runner",path:"runner"},{label:r?.name??n??"",path:`runner/${n}`}];return m.jsx("div",{className:`h-screen overflow-hidden ${p==="dark"?"dark":""}`,children:m.jsxs("div",{className:"h-full flex flex-col bg-background text-foreground",children:[m.jsx(hd,{breadcrumbs:D,isInsider:b,searchEnabled:S,theme:p,onToggleTheme:x,keyAge:C,onRotateKey:A}),m.jsxs("div",{className:"flex-1 overflow-y-auto max-w-4xl mx-auto px-4 py-6 pb-32 space-y-6 w-full",children:[m.jsxs(Ln,{to:"/runner",className:"inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[m.jsx(dN,{className:"h-4 w-4"}),"Back to jobs"]}),f&&m.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 text-red-700 dark:text-red-400 px-4 py-3 rounded-lg text-sm",children:f}),h?m.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}):r?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"bg-card border border-border rounded-lg p-4 space-y-4",children:[m.jsxs("div",{className:"flex items-start justify-between",children:[m.jsxs("div",{children:[m.jsx("h1",{className:"text-xl font-semibold",children:r.name}),m.jsxs("div",{className:"flex items-center gap-3 mt-2 text-sm text-muted-foreground",children:[m.jsxs("span",{children:["Type: ",m.jsx("span",{className:"text-foreground",children:r.type})]}),m.jsxs("span",{children:["Schedule: ",m.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:r.schedule})]}),m.jsxs("span",{children:["Overlap: ",m.jsx("span",{className:"text-foreground",children:r.overlapPolicy})]})]})]}),m.jsx(pd,{status:r.enabled?r.status:"disabled"})]}),m.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-border",children:[m.jsx(Qt,{variant:"outline",size:"sm",onClick:()=>{_()},className:"gap-1.5",children:r.enabled?m.jsxs(m.Fragment,{children:[m.jsx(PN,{className:"h-3.5 w-3.5"})," Disable"]}):m.jsxs(m.Fragment,{children:[m.jsx(IN,{className:"h-3.5 w-3.5"})," Enable"]})}),m.jsxs(Qt,{variant:"outline",size:"sm",onClick:()=>{H()},className:"gap-1.5",children:[m.jsx(Eb,{className:"h-3.5 w-3.5"}),"Run Now"]})]})]}),m.jsxs("div",{className:"bg-card border border-border rounded-lg overflow-hidden",children:[m.jsx("div",{className:"px-4 py-3 border-b border-border",children:m.jsx("h2",{className:"text-sm font-medium text-muted-foreground",children:"Run History"})}),m.jsx(QM,{runs:i})]})]}):m.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Job not found"})]})]})})}function PM(){return m.jsx(vE,{children:m.jsx(PS,{children:m.jsxs(NS,{children:[m.jsx(Pr,{path:"/runner/:jobId",element:m.jsx(FM,{})}),m.jsx(Pr,{path:"/runner",element:m.jsx($M,{})}),m.jsx(Pr,{path:"/browse/*",element:m.jsx(SM,{})}),m.jsx(Pr,{path:"/",element:m.jsx(EM,{})})]})})})}Tw.createRoot(document.getElementById("root")).render(m.jsx(g.StrictMode,{children:m.jsx(PM,{})}));export{bN as C,Oe as c,V_ as g,m as j,q_ as l,g as r,Cs as u};