kanna-code 0.38.0 → 0.39.0

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.
@@ -637,7 +637,7 @@ Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}
637
637
 
638
638
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
639
639
 
640
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return _.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},uG="DialogDescriptionWarning",dG=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${S5(uG).contentName}}.`;return _.useEffect(()=>{var s;const i=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},hG=c5,fG=h5,w5=f5,C5=p5,pG=g5,mG=b5,gG=y5;function k5(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=k5(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function E5(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=k5(e))&&(r&&(r+=" "),r+=t);return r}const vG=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},bG=(e,t)=>({classGroupId:e,validator:t}),R5=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),hv="-",HA=[],_G="arbitrary..",yG=e=>{const t=SG(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return xG(o);const l=o.split(hv),c=l[0]===""&&l.length>1?1:0;return T5(l,c,t)},getConflictingClassGroupIds:(o,l)=>{if(l){const c=r[o],d=n[o];return c?d?vG(d,c):c:d||HA}return n[o]||HA}}},T5=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const i=e[t],s=n.nextPart.get(i);if(s){const d=T5(e,t+1,s);if(d)return d}const o=n.validators;if(o===null)return;const l=t===0?e.join(hv):e.slice(t).join(hv),c=o.length;for(let d=0;d<c;d++){const f=o[d];if(f.validator(l))return f.classGroupId}},xG=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?_G+r:void 0})(),SG=e=>{const{theme:t,classGroups:n}=e;return wG(n,t)},wG=(e,t)=>{const n=R5();for(const r in e){const i=e[r];rC(i,n,r,t)}return n},rC=(e,t,n,r)=>{const i=e.length;for(let s=0;s<i;s++){const o=e[s];CG(o,t,n,r)}},CG=(e,t,n,r)=>{if(typeof e=="string"){kG(e,t,n);return}if(typeof e=="function"){EG(e,t,n,r);return}RG(e,t,n,r)},kG=(e,t,n)=>{const r=e===""?t:A5(t,e);r.classGroupId=n},EG=(e,t,n,r)=>{if(TG(e)){rC(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(bG(n,e))},RG=(e,t,n,r)=>{const i=Object.entries(e),s=i.length;for(let o=0;o<s;o++){const[l,c]=i[o];rC(c,A5(t,l),n,r)}},A5=(e,t)=>{let n=e;const r=t.split(hv),i=r.length;for(let s=0;s<i;s++){const o=r[s];let l=n.nextPart.get(o);l||(l=R5(),n.nextPart.set(o,l)),n=l}return n},TG=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,AG=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const i=(s,o)=>{n[s]=o,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(s){let o=n[s];if(o!==void 0)return o;if((o=r[s])!==void 0)return i(s,o),o},set(s,o){s in n?n[s]=o:i(s,o)}}},NS="!",$A=":",NG=[],UA=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),MG=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=i=>{const s=[];let o=0,l=0,c=0,d;const f=i.length;for(let x=0;x<f;x++){const w=i[x];if(o===0&&l===0){if(w===$A){s.push(i.slice(c,x)),c=x+1;continue}if(w==="/"){d=x;continue}}w==="["?o++:w==="]"?o--:w==="("?l++:w===")"&&l--}const h=s.length===0?i:i.slice(c);let g=h,v=!1;h.endsWith(NS)?(g=h.slice(0,-1),v=!0):h.startsWith(NS)&&(g=h.slice(1),v=!0);const y=d&&d>c?d-c:void 0;return UA(s,v,g,y)};if(t){const i=t+$A,s=r;r=o=>o.startsWith(i)?s(o.slice(i.length)):UA(NG,!1,o,void 0,!0)}if(n){const i=r;r=s=>n({className:s,parseClassName:i})}return r},LG=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let s=0;s<n.length;s++){const o=n[s],l=o[0]==="[",c=t.has(o);l||c?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(o)):i.push(o)}return i.length>0&&(i.sort(),r.push(...i)),r}},DG=e=>({cache:AG(e.cacheSize),parseClassName:MG(e),sortModifiers:LG(e),...yG(e)}),IG=/\s+/,PG=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=t,o=[],l=e.trim().split(IG);let c="";for(let d=l.length-1;d>=0;d-=1){const f=l[d],{isExternal:h,modifiers:g,hasImportantModifier:v,baseClassName:y,maybePostfixModifierPosition:x}=n(f);if(h){c=f+(c.length>0?" "+c:c);continue}let w=!!x,C=r(w?y.substring(0,x):y);if(!C){if(!w){c=f+(c.length>0?" "+c:c);continue}if(C=r(y),!C){c=f+(c.length>0?" "+c:c);continue}w=!1}const E=g.length===0?"":g.length===1?g[0]:s(g).join(":"),R=v?E+NS:E,T=R+C;if(o.indexOf(T)>-1)continue;o.push(T);const A=i(C,w);for(let N=0;N<A.length;++N){const M=A[N];o.push(R+M)}c=f+(c.length>0?" "+c:c)}return c},OG=(...e)=>{let t=0,n,r,i="";for(;t<e.length;)(n=e[t++])&&(r=N5(n))&&(i&&(i+=" "),i+=r);return i},N5=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=N5(e[r]))&&(n&&(n+=" "),n+=t);return n},jG=(e,...t)=>{let n,r,i,s;const o=c=>{const d=t.reduce((f,h)=>h(f),e());return n=DG(d),r=n.cache.get,i=n.cache.set,s=l,l(c)},l=c=>{const d=r(c);if(d)return d;const f=PG(c,n);return i(c,f),f};return s=o,(...c)=>s(OG(...c))},zG=[],ar=e=>{const t=n=>n[e]||zG;return t.isThemeGetter=!0,t},M5=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,L5=/^\((?:(\w[\w-]*):)?(.+)\)$/i,BG=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,FG=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,HG=/\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$/,$G=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,UG=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,VG=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Oa=e=>BG.test(e),Ht=e=>!!e&&!Number.isNaN(Number(e)),ja=e=>!!e&&Number.isInteger(Number(e)),$y=e=>e.endsWith("%")&&Ht(e.slice(0,-1)),Ro=e=>FG.test(e),D5=()=>!0,WG=e=>HG.test(e)&&!$G.test(e),iC=()=>!1,GG=e=>UG.test(e),qG=e=>VG.test(e),KG=e=>!Ze(e)&&!et(e),YG=e=>pl(e,O5,iC),Ze=e=>M5.test(e),zl=e=>pl(e,j5,WG),VA=e=>pl(e,rq,Ht),XG=e=>pl(e,B5,D5),QG=e=>pl(e,z5,iC),WA=e=>pl(e,I5,iC),ZG=e=>pl(e,P5,qG),Um=e=>pl(e,F5,GG),et=e=>L5.test(e),Nh=e=>Sc(e,j5),JG=e=>Sc(e,z5),GA=e=>Sc(e,I5),eq=e=>Sc(e,O5),tq=e=>Sc(e,P5),Vm=e=>Sc(e,F5,!0),nq=e=>Sc(e,B5,!0),pl=(e,t,n)=>{const r=M5.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Sc=(e,t,n=!1)=>{const r=L5.exec(e);return r?r[1]?t(r[1]):n:!1},I5=e=>e==="position"||e==="percentage",P5=e=>e==="image"||e==="url",O5=e=>e==="length"||e==="size"||e==="bg-size",j5=e=>e==="length",rq=e=>e==="number",z5=e=>e==="family-name",B5=e=>e==="number"||e==="weight",F5=e=>e==="shadow",iq=()=>{const e=ar("color"),t=ar("font"),n=ar("text"),r=ar("font-weight"),i=ar("tracking"),s=ar("leading"),o=ar("breakpoint"),l=ar("container"),c=ar("spacing"),d=ar("radius"),f=ar("shadow"),h=ar("inset-shadow"),g=ar("text-shadow"),v=ar("drop-shadow"),y=ar("blur"),x=ar("perspective"),w=ar("aspect"),C=ar("ease"),E=ar("animate"),R=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],A=()=>[...T(),et,Ze],N=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto","contain","none"],P=()=>[et,Ze,c],q=()=>[Oa,"full","auto",...P()],j=()=>[ja,"none","subgrid",et,Ze],$=()=>["auto",{span:["full",ja,et,Ze]},ja,et,Ze],F=()=>[ja,"auto",et,Ze],O=()=>["auto","min","max","fr",et,Ze],B=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],z=()=>["auto",...P()],W=()=>[Oa,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],U=()=>[Oa,"screen","full","dvw","lvw","svw","min","max","fit",...P()],Y=()=>[Oa,"screen","full","lh","dvh","lvh","svh","min","max","fit",...P()],I=()=>[e,et,Ze],V=()=>[...T(),GA,WA,{position:[et,Ze]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],D=()=>["auto","cover","contain",eq,YG,{size:[et,Ze]}],re=()=>[$y,Nh,zl],ne=()=>["","none","full",d,et,Ze],se=()=>["",Ht,Nh,zl],oe=()=>["solid","dashed","dotted","double"],me=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ue=()=>[Ht,$y,GA,WA],ge=()=>["","none",y,et,Ze],xe=()=>["none",Ht,et,Ze],ie=()=>["none",Ht,et,Ze],we=()=>[Ht,et,Ze],Pe=()=>[Oa,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ro],breakpoint:[Ro],color:[D5],container:[Ro],"drop-shadow":[Ro],ease:["in","out","in-out"],font:[KG],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ro],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ro],shadow:[Ro],spacing:["px",Ht],text:[Ro],"text-shadow":[Ro],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Oa,Ze,et,w]}],container:["container"],columns:[{columns:[Ht,Ze,et,l]}],"break-after":[{"break-after":R()}],"break-before":[{"break-before":R()}],"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:A()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:q()}],"inset-x":[{"inset-x":q()}],"inset-y":[{"inset-y":q()}],start:[{"inset-s":q(),start:q()}],end:[{"inset-e":q(),end:q()}],"inset-bs":[{"inset-bs":q()}],"inset-be":[{"inset-be":q()}],top:[{top:q()}],right:[{right:q()}],bottom:[{bottom:q()}],left:[{left:q()}],visibility:["visible","invisible","collapse"],z:[{z:[ja,"auto",et,Ze]}],basis:[{basis:[Oa,"full","auto",l,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ht,Oa,"auto","initial","none",Ze]}],grow:[{grow:["",Ht,et,Ze]}],shrink:[{shrink:["",Ht,et,Ze]}],order:[{order:[ja,"first","last","none",et,Ze]}],"grid-cols":[{"grid-cols":j()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":j()}],"row-start-end":[{row:$()}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":O()}],"auto-rows":[{"auto-rows":O()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...B(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...B()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":B()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pbs:[{pbs:P()}],pbe:[{pbe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:z()}],mx:[{mx:z()}],my:[{my:z()}],ms:[{ms:z()}],me:[{me:z()}],mbs:[{mbs:z()}],mbe:[{mbe:z()}],mt:[{mt:z()}],mr:[{mr:z()}],mb:[{mb:z()}],ml:[{ml:z()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],"inline-size":[{inline:["auto",...U()]}],"min-inline-size":[{"min-inline":["auto",...U()]}],"max-inline-size":[{"max-inline":["none",...U()]}],"block-size":[{block:["auto",...Y()]}],"min-block-size":[{"min-block":["auto",...Y()]}],"max-block-size":[{"max-block":["none",...Y()]}],w:[{w:[l,"screen",...W()]}],"min-w":[{"min-w":[l,"screen","none",...W()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",n,Nh,zl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,nq,XG]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",$y,Ze]}],"font-family":[{font:[JG,QG,t]}],"font-features":[{"font-features":[Ze]}],"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:[i,et,Ze]}],"line-clamp":[{"line-clamp":[Ht,"none",et,VA]}],leading:[{leading:[s,...P()]}],"list-image":[{"list-image":["none",et,Ze]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",et,Ze]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ht,"from-font","auto",et,zl]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Ht,"auto",et,Ze]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",et,Ze]}],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",et,Ze]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:V()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:D()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ja,et,Ze],radial:["",et,Ze],conic:[ja,et,Ze]},tq,ZG]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:ne()}],"rounded-s":[{"rounded-s":ne()}],"rounded-e":[{"rounded-e":ne()}],"rounded-t":[{"rounded-t":ne()}],"rounded-r":[{"rounded-r":ne()}],"rounded-b":[{"rounded-b":ne()}],"rounded-l":[{"rounded-l":ne()}],"rounded-ss":[{"rounded-ss":ne()}],"rounded-se":[{"rounded-se":ne()}],"rounded-ee":[{"rounded-ee":ne()}],"rounded-es":[{"rounded-es":ne()}],"rounded-tl":[{"rounded-tl":ne()}],"rounded-tr":[{"rounded-tr":ne()}],"rounded-br":[{"rounded-br":ne()}],"rounded-bl":[{"rounded-bl":ne()}],"border-w":[{border:se()}],"border-w-x":[{"border-x":se()}],"border-w-y":[{"border-y":se()}],"border-w-s":[{"border-s":se()}],"border-w-e":[{"border-e":se()}],"border-w-bs":[{"border-bs":se()}],"border-w-be":[{"border-be":se()}],"border-w-t":[{"border-t":se()}],"border-w-r":[{"border-r":se()}],"border-w-b":[{"border-b":se()}],"border-w-l":[{"border-l":se()}],"divide-x":[{"divide-x":se()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":se()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...oe(),"hidden","none"]}],"divide-style":[{divide:[...oe(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...oe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ht,et,Ze]}],"outline-w":[{outline:["",Ht,Nh,zl]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",f,Vm,Um]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",h,Vm,Um]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:se()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Ht,zl]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":se()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",g,Vm,Um]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Ht,et,Ze]}],"mix-blend":[{"mix-blend":[...me(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":me()}],"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":[Ht]}],"mask-image-linear-from-pos":[{"mask-linear-from":ue()}],"mask-image-linear-to-pos":[{"mask-linear-to":ue()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":ue()}],"mask-image-t-to-pos":[{"mask-t-to":ue()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":ue()}],"mask-image-r-to-pos":[{"mask-r-to":ue()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":ue()}],"mask-image-b-to-pos":[{"mask-b-to":ue()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":ue()}],"mask-image-l-to-pos":[{"mask-l-to":ue()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":ue()}],"mask-image-x-to-pos":[{"mask-x-to":ue()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":ue()}],"mask-image-y-to-pos":[{"mask-y-to":ue()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[et,Ze]}],"mask-image-radial-from-pos":[{"mask-radial-from":ue()}],"mask-image-radial-to-pos":[{"mask-radial-to":ue()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"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":T()}],"mask-image-conic-pos":[{"mask-conic":[Ht]}],"mask-image-conic-from-pos":[{"mask-conic-from":ue()}],"mask-image-conic-to-pos":[{"mask-conic-to":ue()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:V()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:D()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",et,Ze]}],filter:[{filter:["","none",et,Ze]}],blur:[{blur:ge()}],brightness:[{brightness:[Ht,et,Ze]}],contrast:[{contrast:[Ht,et,Ze]}],"drop-shadow":[{"drop-shadow":["","none",v,Vm,Um]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",Ht,et,Ze]}],"hue-rotate":[{"hue-rotate":[Ht,et,Ze]}],invert:[{invert:["",Ht,et,Ze]}],saturate:[{saturate:[Ht,et,Ze]}],sepia:[{sepia:["",Ht,et,Ze]}],"backdrop-filter":[{"backdrop-filter":["","none",et,Ze]}],"backdrop-blur":[{"backdrop-blur":ge()}],"backdrop-brightness":[{"backdrop-brightness":[Ht,et,Ze]}],"backdrop-contrast":[{"backdrop-contrast":[Ht,et,Ze]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ht,et,Ze]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ht,et,Ze]}],"backdrop-invert":[{"backdrop-invert":["",Ht,et,Ze]}],"backdrop-opacity":[{"backdrop-opacity":[Ht,et,Ze]}],"backdrop-saturate":[{"backdrop-saturate":[Ht,et,Ze]}],"backdrop-sepia":[{"backdrop-sepia":["",Ht,et,Ze]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",et,Ze]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ht,"initial",et,Ze]}],ease:[{ease:["linear","initial",C,et,Ze]}],delay:[{delay:[Ht,et,Ze]}],animate:[{animate:["none",E,et,Ze]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,et,Ze]}],"perspective-origin":[{"perspective-origin":A()}],rotate:[{rotate:xe()}],"rotate-x":[{"rotate-x":xe()}],"rotate-y":[{"rotate-y":xe()}],"rotate-z":[{"rotate-z":xe()}],scale:[{scale:ie()}],"scale-x":[{"scale-x":ie()}],"scale-y":[{"scale-y":ie()}],"scale-z":[{"scale-z":ie()}],"scale-3d":["scale-3d"],skew:[{skew:we()}],"skew-x":[{"skew-x":we()}],"skew-y":[{"skew-y":we()}],transform:[{transform:[et,Ze,"","none","gpu","cpu"]}],"transform-origin":[{origin:A()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Pe()}],"translate-x":[{"translate-x":Pe()}],"translate-y":[{"translate-y":Pe()}],"translate-z":[{"translate-z":Pe()}],"translate-none":["translate-none"],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"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",et,Ze]}],"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":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mbs":[{"scroll-mbs":P()}],"scroll-mbe":[{"scroll-mbe":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pbs":[{"scroll-pbs":P()}],"scroll-pbe":[{"scroll-pbe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"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",et,Ze]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[Ht,Nh,zl,VA]}],stroke:[{stroke:["none",...I()]}],"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"]}},sq=jG(iq);function _e(...e){return sq(E5(e))}function sf(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function oq(e){return e.startsWith("chatId:")?e.slice(7):e}const xf="data-focus-fallback-ignore",H5="data-allow-focus-retain",fv="kanna:restore-chat-input-focus",sC="data-chat-input",pv="data-chat-selection-zone";function Kl(e,t){return!!(e!=null&&e.closest(`[${t}]`))}function $5(e){var n;const t=e;return t!=null&&t.matches?t.matches("input:not([type='checkbox']):not([type='radio']):not([type='button']):not([type='submit']):not([type='reset']), textarea, select")||t.isContentEditable||((n=t.getAttribute)==null?void 0:n.call(t,"role"))==="textbox"?!0:Kl(e,H5):!1}function aq(e){const t=e;return t!=null&&t.matches?$5(e)||(t.tabIndex??-1)>=0||t.matches("button, a[href], summary")?!0:Kl(e,H5):!1}function qA(e){return!!e.querySelector(`[${xf}][data-state='open']`)}function lq(e){return e?!e.isCollapsed&&e.toString().trim().length>0:!1}function cq(e,t){if(!e)return!1;const n=Array.from(t.querySelectorAll(`textarea[${sC}]`)).filter(o=>!o.disabled);if(n.length===0)return!1;const r=n.indexOf(e),i=r>=0?(r+1)%n.length:0,s=n[i];return s?(s.focus({preventScroll:!0}),!0):!1}function KA(e){const{activeElement:t,fallback:n,hasActiveOverlay:r}=e;if(!n||n.disabled||r||t===n)return"none";if(e.trigger==="escape")return e.defaultPrevented||Kl(t,sC)||e.canCancel?"none":"escape-focus";const{pointerStartTarget:i,pointerEndTarget:s,root:o,hasActiveSelection:l}=e,c=s??i;return!o||!c||!o.contains(c)||Kl(c,xf)||Kl(t,xf)||l&&(Kl(i,pv)||Kl(c,pv))||$5(t)?"none":t&&t===c?"restore":aq(t)?"none":"restore"}const Wo=hG,uq=fG,U5=_.forwardRef(({className:e,...t},n)=>m.jsx(w5,{ref:n,className:_e("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));U5.displayName=w5.displayName;const dq={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},oo=_.forwardRef(({className:e,children:t,size:n="md",...r},i)=>m.jsxs(uq,{children:[m.jsx(U5,{}),m.jsxs(C5,{ref:i,[xf]:"",onCloseAutoFocus:s=>{var o;s.preventDefault(),window.dispatchEvent(new Event(fv)),(o=r.onCloseAutoFocus)==null||o.call(r,s)},className:_e("fixed left-1/2 top-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-background shadow-xl 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%]","max-h-[85vh] flex flex-col",dq[n],e),...r,children:[t,m.jsxs(gG,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[m.jsx(Jo,{className:"h-4 w-4"}),m.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));oo.displayName=C5.displayName;function oC({className:e,...t}){return m.jsx("div",{className:_e("shrink-0 flex flex-col space-y-1.5 p-4 border-b border-border",e),...t})}function Go({className:e,...t}){return m.jsx(pG,{className:_e("text-lg font-medium leading-none tracking-tight",e),...t})}function vd({className:e,...t}){return m.jsx(mG,{className:_e("text-sm text-muted-foreground",e),...t})}function qo({className:e,...t}){return m.jsx("div",{className:_e("flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-3.5",e),...t})}function cl({className:e,...t}){return m.jsx("div",{className:_e("shrink-0 flex justify-end gap-2 border-t border-border bg-background p-2 rounded-b-xl",e),...t})}function hq({className:e,...t}){return m.jsx("button",{className:_e("touch-manipulation inline-flex items-center justify-center whitespace-nowrap cursor-pointer text-sm font-medium transition-colors","rounded-full h-9 px-4","bg-primary text-primary-foreground hover:bg-primary/90","disabled:pointer-events-none disabled:bg-primary/20 disabled:text-primary/60",e),...t})}function fq({className:e,...t}){return m.jsx("button",{className:_e("touch-manipulation inline-flex items-center justify-center whitespace-nowrap cursor-pointer text-sm font-medium transition-colors","rounded-full h-9 px-4","hover:bg-accent dark:hover:bg-card hover:text-accent-foreground text-muted-foreground","disabled:pointer-events-none disabled:text-muted-foreground/50",e),...t})}function pq({open:e,shareUrl:t,onOpenChange:n,onOpenLink:r,onCopyLink:i}){const[s,o]=_.useState(!1);_.useEffect(()=>{e||o(!1)},[e,t]);const l=async()=>{await i()&&(o(!0),window.setTimeout(()=>{o(!1)},2e3))};return m.jsx(Wo,{open:e,onOpenChange:n,children:m.jsxs(oo,{size:"md",children:[m.jsxs(oC,{children:[m.jsx(Go,{children:"Shared Link"}),m.jsx(vd,{children:"Shared links are snapshots in time and contain all attachments, tool calls and history. Be mindful of sensitive info."})]}),m.jsx(qo,{className:"space-y-3",children:m.jsxs("div",{className:"flex w-full items-center gap-2 rounded-2xl border border-border bg-muted/40 pl-4 px-3 py-2.5",children:[m.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-sm text-foreground",children:t}),m.jsx("button",{type:"button",onClick:()=>void l(),title:s?"Copied":"Copy link","aria-label":s?"Copied":"Copy link",className:"flex flex-shrink-0 items-center justify-center rounded-lg text-logo hover:text-logo/60 transition-colors hover:bg-background hover:text-foreground",children:s?m.jsx(ni,{className:"h-4 w-4 text-emerald-400"}):m.jsx(ll,{className:"h-4 w-4"})})]})}),m.jsx(cl,{children:m.jsxs(hq,{type:"button",onClick:r,children:[m.jsx(mb,{className:"mr-2 h-4 w-4"}),"Open"]})})]})})}const YA=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,XA=E5,mq=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return XA(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:s}=t,o=Object.keys(i).map(d=>{const f=n==null?void 0:n[d],h=s==null?void 0:s[d];if(f===null)return null;const g=YA(f)||YA(h);return i[d][g]}),l=n&&Object.entries(n).reduce((d,f)=>{let[h,g]=f;return g===void 0||(d[h]=g),d},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,f)=>{let{class:h,className:g,...v}=f;return Object.entries(v).every(y=>{let[x,w]=y;return Array.isArray(w)?w.includes({...s,...l}[x]):{...s,...l}[x]===w})?[...d,h,g]:d},[]);return XA(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},wb=mq("touch-manipulation inline-flex items-center justify-center whitespace-nowrap cursor-pointer rounded-md text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none",{variants:{variant:{default:"bg-primary text-primary-foreground disabled:bg-primary/50 disabled:text-primary-foreground/90 hover:bg-primary/90",juicy:"bg-logo text-primary-foreground disabled:text-primary-foreground/50 hover:bg-logo/90",destructive:"bg-destructive/80 dark:text-white",outline:"border disabled:bg-transparent disabled:text-foreground/50 border-inpu disabled:border-input/90 bg-card hover:bg-muted hover:text-accent-foreground",secondary:"bg-transparent border border-border text-secondary-foreground hover:text-secondary-foreground/60 disabled:text-secondary-foreground/50",ghost:"hover:bg-accent dark:hover:bg-card hover:text-accent-foreground text-muted-foreground disabled:text-muted-foreground/50 border border-border/0 hover:border-border",link:"text-primary disabled:text-primary/50 underline-offset-4 hover:underline",none:""},size:{default:"h-10 px-4 rounded-full py-2",sm:"h-9 rounded-full px-3",lg:"h-11 rounded-full px-8",icon:"h-9 w-9 rounded-full",none:"","icon-sm":"h-5.5 w-5.5 rounded-md"}},defaultVariants:{variant:"default",size:"default"}}),nt=_.forwardRef(({className:e,variant:t,size:n,...r},i)=>m.jsx("button",{className:_e(wb({variant:t,size:n,className:e})),ref:i,...r}));nt.displayName="Button";const Jr=_.forwardRef(({className:e,type:t,...n},r)=>m.jsx("input",{ref:r,type:t,className:_e("flex w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...n}));Jr.displayName="Input";const V5=_.createContext(null);function gq({children:e}){const[t,n]=_.useState(null),[r,i]=_.useState(""),s=_.useRef(null);_.useEffect(()=>{(t==null?void 0:t.kind)==="prompt"&&(i(t.options.initialValue??""),setTimeout(()=>{var v,y;(v=s.current)==null||v.focus(),(y=s.current)==null||y.select()},0))},[t]);const o=_.useCallback(()=>{n(null),i("")},[]),l=_.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!1):t.kind==="prompt"?t.resolve(null):t.resolve(),o())},[o,t]),c=_.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!0):t.kind==="prompt"?t.resolve(r.trim()||null):t.resolve(),o())},[o,t,r]),d=_.useCallback(v=>new Promise(y=>{n({kind:"confirm",options:v,resolve:y})}),[]),f=_.useCallback(v=>new Promise(y=>{n({kind:"prompt",options:v,resolve:y})}),[]),h=_.useCallback(v=>new Promise(y=>{n({kind:"alert",options:v,resolve:y})}),[]),g=_.useMemo(()=>({confirm:d,prompt:f,alert:h}),[h,d,f]);return m.jsxs(V5.Provider,{value:g,children:[e,m.jsx(Wo,{open:t!==null,onOpenChange:v=>{v||!t||l()},children:m.jsx(oo,{size:"sm",onKeyDown:v=>{v.key!=="Enter"||v.shiftKey||!t||t.kind!=="confirm"||(v.preventDefault(),c())},children:t?m.jsxs(m.Fragment,{children:[m.jsxs(qo,{className:"space-y-4",children:[m.jsx(Go,{children:t.options.title}),t.options.description?m.jsx(vd,{children:t.options.description}):null,t.kind==="prompt"?m.jsx(Jr,{ref:s,type:"text",value:r,onChange:v=>i(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),c())},placeholder:t.options.placeholder}):null]}),m.jsxs(cl,{children:[m.jsx(nt,{variant:"ghost",size:"sm",onClick:l,className:t.kind==="alert"?"hidden":void 0,children:"cancelLabel"in t.options?t.options.cancelLabel??"Cancel":"Cancel"}),m.jsx(nt,{variant:t.kind==="confirm"?t.options.confirmVariant??"default":"secondary",size:"sm",onClick:c,disabled:t.kind==="prompt"&&!r.trim(),children:t.kind==="alert"?t.options.closeLabel??"OK":"confirmLabel"in t.options?t.options.confirmLabel??"Confirm":"Confirm"})]})]}):null})})]})}function aC(){const e=_.useContext(V5);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const lC=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:_e("bg-card text-card-foreground",e),...t}));lC.displayName="Card";const cC=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:_e("flex flex-col space-y-1.5 p-2",e),...t}));cC.displayName="CardHeader";const W5=_.forwardRef(({className:e,...t},n)=>m.jsx("h3",{ref:n,className:_e("text-2xl font-semibold leading-none tracking-tight",e),...t}));W5.displayName="CardTitle";const G5=_.forwardRef(({className:e,...t},n)=>m.jsx("p",{ref:n,className:_e("text-sm text-muted-foreground",e),...t}));G5.displayName="CardDescription";const uC=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:_e("p-6 pt-0",e),...t}));uC.displayName="CardContent";const vq=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:_e("flex items-center p-6 pt-0",e),...t}));vq.displayName="CardFooter";const bq=["top","right","bottom","left"],ul=Math.min,Oi=Math.max,mv=Math.round,Wm=Math.floor,ro=e=>({x:e,y:e}),_q={left:"right",right:"left",bottom:"top",top:"bottom"};function MS(e,t,n){return Oi(e,ul(t,n))}function Ko(e,t){return typeof e=="function"?e(t):e}function Yo(e){return e.split("-")[0]}function bd(e){return e.split("-")[1]}function dC(e){return e==="x"?"y":"x"}function hC(e){return e==="y"?"height":"width"}function Zs(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function fC(e){return dC(Zs(e))}function yq(e,t,n){n===void 0&&(n=!1);const r=bd(e),i=fC(e),s=hC(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=gv(o)),[o,gv(o)]}function xq(e){const t=gv(e);return[LS(e),t,LS(t)]}function LS(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const QA=["left","right"],ZA=["right","left"],Sq=["top","bottom"],wq=["bottom","top"];function Cq(e,t,n){switch(e){case"top":case"bottom":return n?t?ZA:QA:t?QA:ZA;case"left":case"right":return t?Sq:wq;default:return[]}}function kq(e,t,n,r){const i=bd(e);let s=Cq(Yo(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(LS)))),s}function gv(e){const t=Yo(e);return _q[t]+e.slice(t.length)}function Eq(e){return{top:0,right:0,bottom:0,left:0,...e}}function q5(e){return typeof e!="number"?Eq(e):{top:e,right:e,bottom:e,left:e}}function vv(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function JA(e,t,n){let{reference:r,floating:i}=e;const s=Zs(t),o=fC(t),l=hC(o),c=Yo(t),d=s==="y",f=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,g=r[l]/2-i[l]/2;let v;switch(c){case"top":v={x:f,y:r.y-i.height};break;case"bottom":v={x:f,y:r.y+r.height};break;case"right":v={x:r.x+r.width,y:h};break;case"left":v={x:r.x-i.width,y:h};break;default:v={x:r.x,y:r.y}}switch(bd(t)){case"start":v[o]-=g*(n&&d?-1:1);break;case"end":v[o]+=g*(n&&d?-1:1);break}return v}async function Rq(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:o,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:g=!1,padding:v=0}=Ko(t,e),y=q5(v),w=l[g?h==="floating"?"reference":"floating":h],C=vv(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:f,strategy:c})),E=h==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,R=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),T=await(s.isElement==null?void 0:s.isElement(R))?await(s.getScale==null?void 0:s.getScale(R))||{x:1,y:1}:{x:1,y:1},A=vv(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:E,offsetParent:R,strategy:c}):E);return{top:(C.top-A.top+y.top)/T.y,bottom:(A.bottom-C.bottom+y.bottom)/T.y,left:(C.left-A.left+y.left)/T.x,right:(A.right-C.right+y.right)/T.x}}const Tq=50,Aq=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:Rq},c=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:f,y:h}=JA(d,r,c),g=r,v=0;const y={};for(let x=0;x<s.length;x++){const w=s[x];if(!w)continue;const{name:C,fn:E}=w,{x:R,y:T,data:A,reset:N}=await E({x:f,y:h,initialPlacement:r,placement:g,strategy:i,middlewareData:y,rects:d,platform:l,elements:{reference:e,floating:t}});f=R??f,h=T??h,y[C]={...y[C],...A},N&&v<Tq&&(v++,typeof N=="object"&&(N.placement&&(g=N.placement),N.rects&&(d=N.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):N.rects),{x:f,y:h}=JA(d,g,c)),x=-1)}return{x:f,y:h,placement:g,strategy:i,middlewareData:y}},Nq=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:o,elements:l,middlewareData:c}=t,{element:d,padding:f=0}=Ko(e,t)||{};if(d==null)return{};const h=q5(f),g={x:n,y:r},v=fC(i),y=hC(v),x=await o.getDimensions(d),w=v==="y",C=w?"top":"left",E=w?"bottom":"right",R=w?"clientHeight":"clientWidth",T=s.reference[y]+s.reference[v]-g[v]-s.floating[y],A=g[v]-s.reference[v],N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let M=N?N[R]:0;(!M||!await(o.isElement==null?void 0:o.isElement(N)))&&(M=l.floating[R]||s.floating[y]);const P=T/2-A/2,q=M/2-x[y]/2-1,j=ul(h[C],q),$=ul(h[E],q),F=j,O=M-x[y]-$,B=M/2-x[y]/2+P,H=MS(F,B,O),z=!c.arrow&&bd(i)!=null&&B!==H&&s.reference[y]/2-(B<F?j:$)-x[y]/2<0,W=z?B<F?B-F:B-O:0;return{[v]:g[v]+W,data:{[v]:H,centerOffset:B-H-W,...z&&{alignmentOffset:W}},reset:z}}}),Mq=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:x=!0,...w}=Ko(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const C=Yo(i),E=Zs(l),R=Yo(l)===l,T=await(c.isRTL==null?void 0:c.isRTL(d.floating)),A=g||(R||!x?[gv(l)]:xq(l)),N=y!=="none";!g&&N&&A.push(...kq(l,x,y,T));const M=[l,...A],P=await c.detectOverflow(t,w),q=[];let j=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&q.push(P[C]),h){const B=yq(i,o,T);q.push(P[B[0]],P[B[1]])}if(j=[...j,{placement:i,overflows:q}],!q.every(B=>B<=0)){var $,F;const B=((($=s.flip)==null?void 0:$.index)||0)+1,H=M[B];if(H&&(!(h==="alignment"?E!==Zs(H):!1)||j.every(U=>Zs(U.placement)===E?U.overflows[0]>0:!0)))return{data:{index:B,overflows:j},reset:{placement:H}};let z=(F=j.filter(W=>W.overflows[0]<=0).sort((W,U)=>W.overflows[1]-U.overflows[1])[0])==null?void 0:F.placement;if(!z)switch(v){case"bestFit":{var O;const W=(O=j.filter(U=>{if(N){const Y=Zs(U.placement);return Y===E||Y==="y"}return!0}).map(U=>[U.placement,U.overflows.filter(Y=>Y>0).reduce((Y,I)=>Y+I,0)]).sort((U,Y)=>U[1]-Y[1])[0])==null?void 0:O[0];W&&(z=W);break}case"initialPlacement":z=l;break}if(i!==z)return{reset:{placement:z}}}return{}}}};function eN(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function tN(e){return bq.some(t=>e[t]>=0)}const Lq=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=Ko(e,t);switch(i){case"referenceHidden":{const o=await r.detectOverflow(t,{...s,elementContext:"reference"}),l=eN(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:tN(l)}}}case"escaped":{const o=await r.detectOverflow(t,{...s,altBoundary:!0}),l=eN(o,n.floating);return{data:{escapedOffsets:l,escaped:tN(l)}}}default:return{}}}}},K5=new Set(["left","top"]);async function Dq(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Yo(n),l=bd(n),c=Zs(n)==="y",d=K5.has(o)?-1:1,f=s&&c?-1:1,h=Ko(t,e);let{mainAxis:g,crossAxis:v,alignmentAxis:y}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof y=="number"&&(v=l==="end"?y*-1:y),c?{x:v*f,y:g*d}:{x:g*d,y:v*f}}const Iq=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:l}=t,c=await Dq(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:o}}}}},Pq=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:c={fn:C=>{let{x:E,y:R}=C;return{x:E,y:R}}},...d}=Ko(e,t),f={x:n,y:r},h=await s.detectOverflow(t,d),g=Zs(Yo(i)),v=dC(g);let y=f[v],x=f[g];if(o){const C=v==="y"?"top":"left",E=v==="y"?"bottom":"right",R=y+h[C],T=y-h[E];y=MS(R,y,T)}if(l){const C=g==="y"?"top":"left",E=g==="y"?"bottom":"right",R=x+h[C],T=x-h[E];x=MS(R,x,T)}const w=c.fn({...t,[v]:y,[g]:x});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[v]:o,[g]:l}}}}}},Oq=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=Ko(e,t),f={x:n,y:r},h=Zs(i),g=dC(h);let v=f[g],y=f[h];const x=Ko(l,t),w=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(c){const R=g==="y"?"height":"width",T=s.reference[g]-s.floating[R]+w.mainAxis,A=s.reference[g]+s.reference[R]-w.mainAxis;v<T?v=T:v>A&&(v=A)}if(d){var C,E;const R=g==="y"?"width":"height",T=K5.has(Yo(i)),A=s.reference[h]-s.floating[R]+(T&&((C=o.offset)==null?void 0:C[h])||0)+(T?0:w.crossAxis),N=s.reference[h]+s.reference[R]+(T?0:((E=o.offset)==null?void 0:E[h])||0)-(T?w.crossAxis:0);y<A?y=A:y>N&&(y=N)}return{[g]:v,[h]:y}}}},jq=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:s,platform:o,elements:l}=t,{apply:c=()=>{},...d}=Ko(e,t),f=await o.detectOverflow(t,d),h=Yo(i),g=bd(i),v=Zs(i)==="y",{width:y,height:x}=s.floating;let w,C;h==="top"||h==="bottom"?(w=h,C=g===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(C=h,w=g==="end"?"top":"bottom");const E=x-f.top-f.bottom,R=y-f.left-f.right,T=ul(x-f[w],E),A=ul(y-f[C],R),N=!t.middlewareData.shift;let M=T,P=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=R),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(M=E),N&&!g){const j=Oi(f.left,0),$=Oi(f.right,0),F=Oi(f.top,0),O=Oi(f.bottom,0);v?P=y-2*(j!==0||$!==0?j+$:Oi(f.left,f.right)):M=x-2*(F!==0||O!==0?F+O:Oi(f.top,f.bottom))}await c({...t,availableWidth:P,availableHeight:M});const q=await o.getDimensions(l.floating);return y!==q.width||x!==q.height?{reset:{rects:!0}}:{}}}};function Cb(){return typeof window<"u"}function _d(e){return Y5(e)?(e.nodeName||"").toLowerCase():"#document"}function ji(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function co(e){var t;return(t=(Y5(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Y5(e){return Cb()?e instanceof Node||e instanceof ji(e).Node:!1}function Ds(e){return Cb()?e instanceof Element||e instanceof ji(e).Element:!1}function ta(e){return Cb()?e instanceof HTMLElement||e instanceof ji(e).HTMLElement:!1}function nN(e){return!Cb()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ji(e).ShadowRoot}function np(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Is(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function zq(e){return/^(table|td|th)$/.test(_d(e))}function kb(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Bq=/transform|translate|scale|rotate|perspective|filter/,Fq=/paint|layout|strict|content/,Bl=e=>!!e&&e!=="none";let Uy;function pC(e){const t=Ds(e)?Is(e):e;return Bl(t.transform)||Bl(t.translate)||Bl(t.scale)||Bl(t.rotate)||Bl(t.perspective)||!mC()&&(Bl(t.backdropFilter)||Bl(t.filter))||Bq.test(t.willChange||"")||Fq.test(t.contain||"")}function Hq(e){let t=dl(e);for(;ta(t)&&!Xu(t);){if(pC(t))return t;if(kb(t))return null;t=dl(t)}return null}function mC(){return Uy==null&&(Uy=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Uy}function Xu(e){return/^(html|body|#document)$/.test(_d(e))}function Is(e){return ji(e).getComputedStyle(e)}function Eb(e){return Ds(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function dl(e){if(_d(e)==="html")return e;const t=e.assignedSlot||e.parentNode||nN(e)&&e.host||co(e);return nN(t)?t.host:t}function X5(e){const t=dl(e);return Xu(t)?e.ownerDocument?e.ownerDocument.body:e.body:ta(t)&&np(t)?t:X5(t)}function Sf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=X5(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=ji(i);if(s){const l=DS(o);return t.concat(o,o.visualViewport||[],np(i)?i:[],l&&n?Sf(l):[])}else return t.concat(i,Sf(i,[],n))}function DS(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Q5(e){const t=Is(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=ta(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,l=mv(n)!==s||mv(r)!==o;return l&&(n=s,r=o),{width:n,height:r,$:l}}function gC(e){return Ds(e)?e:e.contextElement}function zu(e){const t=gC(e);if(!ta(t))return ro(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=Q5(t);let o=(s?mv(n.width):n.width)/r,l=(s?mv(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const $q=ro(0);function Z5(e){const t=ji(e);return!mC()||!t.visualViewport?$q:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Uq(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ji(e)?!1:t}function uc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=gC(e);let o=ro(1);t&&(r?Ds(r)&&(o=zu(r)):o=zu(e));const l=Uq(s,n,r)?Z5(s):ro(0);let c=(i.left+l.x)/o.x,d=(i.top+l.y)/o.y,f=i.width/o.x,h=i.height/o.y;if(s){const g=ji(s),v=r&&Ds(r)?ji(r):r;let y=g,x=DS(y);for(;x&&r&&v!==y;){const w=zu(x),C=x.getBoundingClientRect(),E=Is(x),R=C.left+(x.clientLeft+parseFloat(E.paddingLeft))*w.x,T=C.top+(x.clientTop+parseFloat(E.paddingTop))*w.y;c*=w.x,d*=w.y,f*=w.x,h*=w.y,c+=R,d+=T,y=ji(x),x=DS(y)}}return vv({width:f,height:h,x:c,y:d})}function Rb(e,t){const n=Eb(e).scrollLeft;return t?t.left+n:uc(co(e)).left+n}function J5(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Rb(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function Vq(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=co(r),l=t?kb(t.floating):!1;if(r===o||l&&s)return n;let c={scrollLeft:0,scrollTop:0},d=ro(1);const f=ro(0),h=ta(r);if((h||!h&&!s)&&((_d(r)!=="body"||np(o))&&(c=Eb(r)),h)){const v=uc(r);d=zu(r),f.x=v.x+r.clientLeft,f.y=v.y+r.clientTop}const g=o&&!h&&!s?J5(o,c):ro(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+f.x+g.x,y:n.y*d.y-c.scrollTop*d.y+f.y+g.y}}function Wq(e){return Array.from(e.getClientRects())}function Gq(e){const t=co(e),n=Eb(e),r=e.ownerDocument.body,i=Oi(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Oi(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Rb(e);const l=-n.scrollTop;return Is(r).direction==="rtl"&&(o+=Oi(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}const rN=25;function qq(e,t){const n=ji(e),r=co(e),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,l=0,c=0;if(i){s=i.width,o=i.height;const f=mC();(!f||f&&t==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}const d=Rb(r);if(d<=0){const f=r.ownerDocument,h=f.body,g=getComputedStyle(h),v=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,y=Math.abs(r.clientWidth-h.clientWidth-v);y<=rN&&(s-=y)}else d<=rN&&(s+=d);return{width:s,height:o,x:l,y:c}}function Kq(e,t){const n=uc(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=ta(e)?zu(e):ro(1),o=e.clientWidth*s.x,l=e.clientHeight*s.y,c=i*s.x,d=r*s.y;return{width:o,height:l,x:c,y:d}}function iN(e,t,n){let r;if(t==="viewport")r=qq(e,n);else if(t==="document")r=Gq(co(e));else if(Ds(t))r=Kq(t,n);else{const i=Z5(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return vv(r)}function eO(e,t){const n=dl(e);return n===t||!Ds(n)||Xu(n)?!1:Is(n).position==="fixed"||eO(n,t)}function Yq(e,t){const n=t.get(e);if(n)return n;let r=Sf(e,[],!1).filter(l=>Ds(l)&&_d(l)!=="body"),i=null;const s=Is(e).position==="fixed";let o=s?dl(e):e;for(;Ds(o)&&!Xu(o);){const l=Is(o),c=pC(o);!c&&l.position==="fixed"&&(i=null),(s?!c&&!i:!c&&l.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||np(o)&&!c&&eO(e,o))?r=r.filter(f=>f!==o):i=l,o=dl(o)}return t.set(e,r),r}function Xq(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?kb(t)?[]:Yq(t,this._c):[].concat(n),r],l=iN(t,o[0],i);let c=l.top,d=l.right,f=l.bottom,h=l.left;for(let g=1;g<o.length;g++){const v=iN(t,o[g],i);c=Oi(v.top,c),d=ul(v.right,d),f=ul(v.bottom,f),h=Oi(v.left,h)}return{width:d-h,height:f-c,x:h,y:c}}function Qq(e){const{width:t,height:n}=Q5(e);return{width:t,height:n}}function Zq(e,t,n){const r=ta(t),i=co(t),s=n==="fixed",o=uc(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=ro(0);function d(){c.x=Rb(i)}if(r||!r&&!s)if((_d(t)!=="body"||np(i))&&(l=Eb(t)),r){const v=uc(t,!0,s,t);c.x=v.x+t.clientLeft,c.y=v.y+t.clientTop}else i&&d();s&&!r&&i&&d();const f=i&&!r&&!s?J5(i,l):ro(0),h=o.left+l.scrollLeft-c.x-f.x,g=o.top+l.scrollTop-c.y-f.y;return{x:h,y:g,width:o.width,height:o.height}}function Vy(e){return Is(e).position==="static"}function sN(e,t){if(!ta(e)||Is(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return co(e)===n&&(n=n.ownerDocument.body),n}function tO(e,t){const n=ji(e);if(kb(e))return n;if(!ta(e)){let i=dl(e);for(;i&&!Xu(i);){if(Ds(i)&&!Vy(i))return i;i=dl(i)}return n}let r=sN(e,t);for(;r&&zq(r)&&Vy(r);)r=sN(r,t);return r&&Xu(r)&&Vy(r)&&!pC(r)?n:r||Hq(e)||n}const Jq=async function(e){const t=this.getOffsetParent||tO,n=this.getDimensions,r=await n(e.floating);return{reference:Zq(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function eK(e){return Is(e).direction==="rtl"}const tK={convertOffsetParentRelativeRectToViewportRelativeRect:Vq,getDocumentElement:co,getClippingRect:Xq,getOffsetParent:tO,getElementRects:Jq,getClientRects:Wq,getDimensions:Qq,getScale:zu,isElement:Ds,isRTL:eK};function nO(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function nK(e,t){let n=null,r;const i=co(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const d=e.getBoundingClientRect(),{left:f,top:h,width:g,height:v}=d;if(l||t(),!g||!v)return;const y=Wm(h),x=Wm(i.clientWidth-(f+g)),w=Wm(i.clientHeight-(h+v)),C=Wm(f),R={rootMargin:-y+"px "+-x+"px "+-w+"px "+-C+"px",threshold:Oi(0,ul(1,c))||1};let T=!0;function A(N){const M=N[0].intersectionRatio;if(M!==c){if(!T)return o();M?o(!1,M):r=setTimeout(()=>{o(!1,1e-7)},1e3)}M===1&&!nO(d,e.getBoundingClientRect())&&o(),T=!1}try{n=new IntersectionObserver(A,{...R,root:i.ownerDocument})}catch{n=new IntersectionObserver(A,R)}n.observe(e)}return o(!0),s}function rK(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=gC(e),f=i||s?[...d?Sf(d):[],...t?Sf(t):[]]:[];f.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const h=d&&l?nK(d,n):null;let g=-1,v=null;o&&(v=new ResizeObserver(C=>{let[E]=C;E&&E.target===d&&v&&t&&(v.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var R;(R=v)==null||R.observe(t)})),n()}),d&&!c&&v.observe(d),t&&v.observe(t));let y,x=c?uc(e):null;c&&w();function w(){const C=uc(e);x&&!nO(x,C)&&n(),x=C,y=requestAnimationFrame(w)}return n(),()=>{var C;f.forEach(E=>{i&&E.removeEventListener("scroll",n),s&&E.removeEventListener("resize",n)}),h==null||h(),(C=v)==null||C.disconnect(),v=null,c&&cancelAnimationFrame(y)}}const iK=Iq,sK=Pq,oK=Mq,aK=jq,lK=Lq,oN=Nq,cK=Oq,uK=(e,t,n)=>{const r=new Map,i={platform:tK,...n},s={...i.platform,_c:r};return Aq(e,t,{...i,platform:s})};var dK=typeof document<"u",hK=function(){},Fg=dK?_.useLayoutEffect:hK;function bv(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!bv(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!bv(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function rO(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function aN(e,t){const n=rO(e);return Math.round(t*n)/n}function Wy(e){const t=_.useRef(e);return Fg(()=>{t.current=e}),t}function fK(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[f,h]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,v]=_.useState(r);bv(g,r)||v(r);const[y,x]=_.useState(null),[w,C]=_.useState(null),E=_.useCallback(U=>{U!==N.current&&(N.current=U,x(U))},[]),R=_.useCallback(U=>{U!==M.current&&(M.current=U,C(U))},[]),T=s||y,A=o||w,N=_.useRef(null),M=_.useRef(null),P=_.useRef(f),q=c!=null,j=Wy(c),$=Wy(i),F=Wy(d),O=_.useCallback(()=>{if(!N.current||!M.current)return;const U={placement:t,strategy:n,middleware:g};$.current&&(U.platform=$.current),uK(N.current,M.current,U).then(Y=>{const I={...Y,isPositioned:F.current!==!1};B.current&&!bv(P.current,I)&&(P.current=I,us.flushSync(()=>{h(I)}))})},[g,t,n,$,F]);Fg(()=>{d===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,h(U=>({...U,isPositioned:!1})))},[d]);const B=_.useRef(!1);Fg(()=>(B.current=!0,()=>{B.current=!1}),[]),Fg(()=>{if(T&&(N.current=T),A&&(M.current=A),T&&A){if(j.current)return j.current(T,A,O);O()}},[T,A,O,j,q]);const H=_.useMemo(()=>({reference:N,floating:M,setReference:E,setFloating:R}),[E,R]),z=_.useMemo(()=>({reference:T,floating:A}),[T,A]),W=_.useMemo(()=>{const U={position:n,left:0,top:0};if(!z.floating)return U;const Y=aN(z.floating,f.x),I=aN(z.floating,f.y);return l?{...U,transform:"translate("+Y+"px, "+I+"px)",...rO(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Y,top:I}},[n,l,z.floating,f.x,f.y]);return _.useMemo(()=>({...f,update:O,refs:H,elements:z,floatingStyles:W}),[f,O,H,z,W])}const pK=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?oN({element:r.current,padding:i}).fn(n):{}:r?oN({element:r,padding:i}).fn(n):{}}}},mK=(e,t)=>{const n=iK(e);return{name:n.name,fn:n.fn,options:[e,t]}},gK=(e,t)=>{const n=sK(e);return{name:n.name,fn:n.fn,options:[e,t]}},vK=(e,t)=>({fn:cK(e).fn,options:[e,t]}),bK=(e,t)=>{const n=oK(e);return{name:n.name,fn:n.fn,options:[e,t]}},_K=(e,t)=>{const n=aK(e);return{name:n.name,fn:n.fn,options:[e,t]}},yK=(e,t)=>{const n=lK(e);return{name:n.name,fn:n.fn,options:[e,t]}},xK=(e,t)=>{const n=pK(e);return{name:n.name,fn:n.fn,options:[e,t]}};var SK="Arrow",iO=_.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return m.jsx(Yt.svg,{...s,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:m.jsx("polygon",{points:"0,0 30,0 15,10"})})});iO.displayName=SK;var wK=iO;function CK(e){const[t,n]=_.useState(void 0);return Ur(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,l;if("borderBoxSize"in s){const c=s.borderBoxSize,d=Array.isArray(c)?c[0]:c;o=d.inlineSize,l=d.blockSize}else o=e.offsetWidth,l=e.offsetHeight;n({width:o,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var vC="Popper",[sO,ml]=ea(vC),[kK,oO]=sO(vC),aO=e=>{const{__scopePopper:t,children:n}=e,[r,i]=_.useState(null);return m.jsx(kK,{scope:t,anchor:r,onAnchorChange:i,children:n})};aO.displayName=vC;var lO="PopperAnchor",cO=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=oO(lO,n),o=_.useRef(null),l=hn(t,o),c=_.useRef(null);return _.useEffect(()=>{const d=c.current;c.current=(r==null?void 0:r.current)||o.current,d!==c.current&&s.onAnchorChange(c.current)}),r?null:m.jsx(Yt.div,{...i,ref:l})});cO.displayName=lO;var bC="PopperContent",[EK,RK]=sO(bC),uO=_.forwardRef((e,t)=>{var oe,me,ue,ge,xe,ie;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:g=!1,updatePositionStrategy:v="optimized",onPlaced:y,...x}=e,w=oO(bC,n),[C,E]=_.useState(null),R=hn(t,we=>E(we)),[T,A]=_.useState(null),N=CK(T),M=(N==null?void 0:N.width)??0,P=(N==null?void 0:N.height)??0,q=r+(s!=="center"?"-"+s:""),j=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},$=Array.isArray(d)?d:[d],F=$.length>0,O={padding:j,boundary:$.filter(AK),altBoundary:F},{refs:B,floatingStyles:H,placement:z,isPositioned:W,middlewareData:U}=fK({strategy:"fixed",placement:q,whileElementsMounted:(...we)=>rK(...we,{animationFrame:v==="always"}),elements:{reference:w.anchor},middleware:[mK({mainAxis:i+P,alignmentAxis:o}),c&&gK({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?vK():void 0,...O}),c&&bK({...O}),_K({...O,apply:({elements:we,rects:Pe,availableWidth:Ue,availableHeight:ht})=>{const{width:ft,height:wt}=Pe.reference,jt=we.floating.style;jt.setProperty("--radix-popper-available-width",`${Ue}px`),jt.setProperty("--radix-popper-available-height",`${ht}px`),jt.setProperty("--radix-popper-anchor-width",`${ft}px`),jt.setProperty("--radix-popper-anchor-height",`${wt}px`)}}),T&&xK({element:T,padding:l}),NK({arrowWidth:M,arrowHeight:P}),g&&yK({strategy:"referenceHidden",...O})]}),[Y,I]=fO(z),V=Ls(y);Ur(()=>{W&&(V==null||V())},[W,V]);const X=(oe=U.arrow)==null?void 0:oe.x,D=(me=U.arrow)==null?void 0:me.y,re=((ue=U.arrow)==null?void 0:ue.centerOffset)!==0,[ne,se]=_.useState();return Ur(()=>{C&&se(window.getComputedStyle(C).zIndex)},[C]),m.jsx("div",{ref:B.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:W?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ne,"--radix-popper-transform-origin":[(ge=U.transformOrigin)==null?void 0:ge.x,(xe=U.transformOrigin)==null?void 0:xe.y].join(" "),...((ie=U.hide)==null?void 0:ie.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:m.jsx(EK,{scope:n,placedSide:Y,onArrowChange:A,arrowX:X,arrowY:D,shouldHideArrow:re,children:m.jsx(Yt.div,{"data-side":Y,"data-align":I,...x,ref:R,style:{...x.style,animation:W?void 0:"none"}})})})});uO.displayName=bC;var dO="PopperArrow",TK={top:"bottom",right:"left",bottom:"top",left:"right"},hO=_.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=RK(dO,r),o=TK[s.placedSide];return m.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:m.jsx(wK,{...i,ref:n,style:{...i.style,display:"block"}})})});hO.displayName=dO;function AK(e){return e!==null}var NK=e=>({name:"transformOrigin",options:e,fn(t){var w,C,E;const{placement:n,rects:r,middlewareData:i}=t,o=((w=i.arrow)==null?void 0:w.centerOffset)!==0,l=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[d,f]=fO(n),h={start:"0%",center:"50%",end:"100%"}[f],g=(((C=i.arrow)==null?void 0:C.x)??0)+l/2,v=(((E=i.arrow)==null?void 0:E.y)??0)+c/2;let y="",x="";return d==="bottom"?(y=o?h:`${g}px`,x=`${-c}px`):d==="top"?(y=o?h:`${g}px`,x=`${r.floating.height+c}px`):d==="right"?(y=`${-c}px`,x=o?h:`${v}px`):d==="left"&&(y=`${r.floating.width+c}px`,x=o?h:`${v}px`),{data:{x:y,y:x}}}});function fO(e){const[t,n="center"]=e.split("-");return[t,n]}var Tb=aO,rp=cO,Ab=uO,Nb=hO,pO=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),MK="VisuallyHidden",mO=_.forwardRef((e,t)=>m.jsx(Yt.span,{...e,ref:t,style:{...pO,...e.style}}));mO.displayName=MK;var LK=mO,[Mb]=ea("Tooltip",[ml]),Lb=ml(),gO="TooltipProvider",DK=700,IS="tooltip.open",[IK,_C]=Mb(gO),vO=e=>{const{__scopeTooltip:t,delayDuration:n=DK,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=e,o=_.useRef(!0),l=_.useRef(!1),c=_.useRef(0);return _.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),m.jsx(IK,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:_.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:_.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:_.useCallback(d=>{l.current=d},[]),disableHoverableContent:i,children:s})};vO.displayName=gO;var wf="Tooltip",[PK,ip]=Mb(wf),bO=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:l}=e,c=_C(wf,e.__scopeTooltip),d=Lb(t),[f,h]=_.useState(null),g=Ho(),v=_.useRef(0),y=o??c.disableHoverableContent,x=l??c.delayDuration,w=_.useRef(!1),[C,E]=Yu({prop:r,defaultProp:i??!1,onChange:M=>{M?(c.onOpen(),document.dispatchEvent(new CustomEvent(IS))):c.onClose(),s==null||s(M)},caller:wf}),R=_.useMemo(()=>C?w.current?"delayed-open":"instant-open":"closed",[C]),T=_.useCallback(()=>{window.clearTimeout(v.current),v.current=0,w.current=!1,E(!0)},[E]),A=_.useCallback(()=>{window.clearTimeout(v.current),v.current=0,E(!1)},[E]),N=_.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{w.current=!0,E(!0),v.current=0},x)},[x,E]);return _.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),m.jsx(Tb,{...d,children:m.jsx(PK,{scope:t,contentId:g,open:C,stateAttribute:R,trigger:f,onTriggerChange:h,onTriggerEnter:_.useCallback(()=>{c.isOpenDelayedRef.current?N():T()},[c.isOpenDelayedRef,N,T]),onTriggerLeave:_.useCallback(()=>{y?A():(window.clearTimeout(v.current),v.current=0)},[A,y]),onOpen:T,onClose:A,disableHoverableContent:y,children:n})})};bO.displayName=wf;var PS="TooltipTrigger",_O=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=ip(PS,n),s=_C(PS,n),o=Lb(n),l=_.useRef(null),c=hn(t,l,i.onTriggerChange),d=_.useRef(!1),f=_.useRef(!1),h=_.useCallback(()=>d.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),m.jsx(rp,{asChild:!0,...o,children:m.jsx(Yt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:Ke(e.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:Ke(e.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:Ke(e.onPointerDown,()=>{i.open&&i.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Ke(e.onFocus,()=>{d.current||i.onOpen()}),onBlur:Ke(e.onBlur,i.onClose),onClick:Ke(e.onClick,i.onClose)})})});_O.displayName=PS;var yC="TooltipPortal",[OK,jK]=Mb(yC,{forceMount:void 0}),yO=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,s=ip(yC,t);return m.jsx(OK,{scope:t,forceMount:n,children:m.jsx(vs,{present:n||s.open,children:m.jsx(gd,{asChild:!0,container:i,children:r})})})};yO.displayName=yC;var Qu="TooltipContent",xO=_.forwardRef((e,t)=>{const n=jK(Qu,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=e,o=ip(Qu,e.__scopeTooltip);return m.jsx(vs,{present:r||o.open,children:o.disableHoverableContent?m.jsx(SO,{side:i,...s,ref:t}):m.jsx(zK,{side:i,...s,ref:t})})}),zK=_.forwardRef((e,t)=>{const n=ip(Qu,e.__scopeTooltip),r=_C(Qu,e.__scopeTooltip),i=_.useRef(null),s=hn(t,i),[o,l]=_.useState(null),{trigger:c,onClose:d}=n,f=i.current,{onPointerInTransitChange:h}=r,g=_.useCallback(()=>{l(null),h(!1)},[h]),v=_.useCallback((y,x)=>{const w=y.currentTarget,C={x:y.clientX,y:y.clientY},E=UK(C,w.getBoundingClientRect()),R=VK(C,E),T=WK(x.getBoundingClientRect()),A=qK([...R,...T]);l(A),h(!0)},[h]);return _.useEffect(()=>()=>g(),[g]),_.useEffect(()=>{if(c&&f){const y=w=>v(w,f),x=w=>v(w,c);return c.addEventListener("pointerleave",y),f.addEventListener("pointerleave",x),()=>{c.removeEventListener("pointerleave",y),f.removeEventListener("pointerleave",x)}}},[c,f,v,g]),_.useEffect(()=>{if(o){const y=x=>{const w=x.target,C={x:x.clientX,y:x.clientY},E=(c==null?void 0:c.contains(w))||(f==null?void 0:f.contains(w)),R=!GK(C,o);E?g():R&&(g(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,f,o,d,g]),m.jsx(SO,{...e,ref:s})}),[BK,FK]=Mb(wf,{isInside:!1}),HK=qV("TooltipContent"),SO=_.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...l}=e,c=ip(Qu,n),d=Lb(n),{onClose:f}=c;return _.useEffect(()=>(document.addEventListener(IS,f),()=>document.removeEventListener(IS,f)),[f]),_.useEffect(()=>{if(c.trigger){const h=g=>{const v=g.target;v!=null&&v.contains(c.trigger)&&f()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,f]),m.jsx(md,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:m.jsxs(Ab,{"data-state":c.stateAttribute,...d,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[m.jsx(HK,{children:r}),m.jsx(BK,{scope:n,isInside:!0,children:m.jsx(LK,{id:c.contentId,role:"tooltip",children:i||r})})]})})});xO.displayName=Qu;var wO="TooltipArrow",$K=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Lb(n);return FK(wO,n).isInside?null:m.jsx(Nb,{...i,...r,ref:t})});$K.displayName=wO;function UK(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function VK(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function WK(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function GK(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const l=t[s],c=t[o],d=l.x,f=l.y,h=c.x,g=c.y;f>r!=g>r&&n<(h-d)*(r-f)/(g-f)+d&&(i=!i)}return i}function qK(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),KK(t)}function KK(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(;t.length>=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var YK=vO,CO=bO,kO=_O,EO=yO,xC=xO;function RO({className:e,...t}){return m.jsx("kbd",{className:_e("pointer-events-none inline-flex h-5 min-w-5 items-center justify-center rounded border border-border/60 bg-muted/50 px-1.5 font-mono text-[11px] font-medium text-current select-none",e),...t})}function XK({className:e,...t}){return m.jsx("span",{className:_e("inline-flex items-center gap-0.5",e),...t})}const QK="z-50 overflow-hidden rounded-md border border-border backdrop-blur-md p-0.5 text-[11px] font-medium text-card-foreground shadow-sm animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",ZK=YK,$o=CO,Uo=kO,io=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(EO,{children:m.jsx(xC,{ref:r,sideOffset:t,className:_e("z-50 overflow-hidden rounded-md bg-card text-card-foreground border border-border px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",e),...n})}));io.displayName=xC.displayName;const _v=CO,yv=kO;function TO(e){return e.toUpperCase()}function JK(e){const t=e.split("+");return m.jsx(XK,{children:t.map((n,r)=>m.jsx(RO,{children:TO(n)},`${n}-${r}`))})}const Cf=_.forwardRef(({className:e,sideOffset:t=4,children:n,shortcut:r,...i},s)=>{const o=r===void 0?null:Array.isArray(r)?r[0]??null:r;return m.jsx(EO,{children:m.jsx(xC,{ref:s,sideOffset:t,className:_e(QK,e),...i,children:o?JK(o):m.jsx("span",{children:typeof n=="string"?TO(n):n})})})});Cf.displayName="HotkeyTooltipContent";const eY="0.38.0",tY={version:eY},qn="Kanna",lN="kanna",nY=".kanna",rY=".kanna-dev",iY="KANNA_RUNTIME_PROFILE",SC=`kanna/${tY.version}`,sY="[kanna]",oY=`~/${qn}`;function Db(){var t;return(t=globalThis.process)==null?void 0:t.env}function aY(e=Db()){var t;return((t=e==null?void 0:e[iY])==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function lY(e=Db()){return aY(e)==="dev"?rY:nY}function cY(e=Db()){return`~/${lY(e)}`}function uY(e=Db()){return`${cY(e)}/keybindings.json`}function Gm(e){return e?`${lN} ${e}`:lN}const cN=e=>{let t;const n=new Set,r=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const g=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(v=>v(t,g))}},i=()=>t,l={setState:r,getState:i,getInitialState:()=>c,subscribe:d=>(n.add(d),()=>n.delete(d))},c=t=e(r,i,l);return l},dY=(e=>e?cN(e):cN),hY=e=>e;function fY(e,t=hY){const n=xn.useSyncExternalStore(e.subscribe,xn.useCallback(()=>t(e.getState()),[e,t]),xn.useCallback(()=>t(e.getInitialState()),[e,t]));return xn.useDebugValue(n),n}const pY=e=>{const t=dY(e),n=r=>fY(t,r);return Object.assign(n,t),n},gl=(e=>pY),AO="always",NO="funk",mY=[{value:"blow",label:"Blow"},{value:"bottle",label:"Bottle"},{value:"frog",label:"Frog"},{value:"funk",label:"Funk"},{value:"glass",label:"Glass"},{value:"ping",label:"Ping"},{value:"pop",label:"Pop"},{value:"purr",label:"Purr"},{value:"tink",label:"Tink"}];function gY(e){switch(e){case"never":case"unfocused":case"always":return e;default:return AO}}function vY(e){switch(e){case"blow":case"bottle":case"frog":case"funk":case"glass":case"ping":case"pop":case"purr":case"tink":return e;default:return NO}}const Zl=gl()(e=>({chatSoundPreference:AO,chatSoundId:NO,setChatSoundPreference:t=>e({chatSoundPreference:gY(t)}),setChatSoundId:t=>e({chatSoundId:vY(t)})})),bY={blow:"/chat-sounds/Blow.mp3",bottle:"/chat-sounds/Bottle.mp3",frog:"/chat-sounds/Frog.mp3",funk:"/chat-sounds/Funk.mp3",glass:"/chat-sounds/Glass.mp3",ping:"/chat-sounds/Ping.mp3",pop:"/chat-sounds/Pop.mp3",purr:"/chat-sounds/Purr.mp3",tink:"/chat-sounds/Tink.mp3"};function _Y(e=document){return e.visibilityState!=="visible"||!e.hasFocus()}function yY(e){const t=new Audio(bY[e]);return t.preload="auto",t.play()}async function OS(e,t){if(t<=0)return;const n=Array.from({length:t},(r,i)=>new Promise(s=>{window.setTimeout(()=>{yY(e).catch(()=>{}).finally(()=>s())},i*90)}));await Promise.all(n)}function xY(e,t=document){return e==="never"?!1:e==="always"?!0:_Y(t)}function SY(e){return e.projectGroups.reduce((t,n)=>t+n.chats.reduce((r,i)=>r+(i.unread?1:0)+(i.status==="waiting_for_user"?1:0),0),0)}function uN(e){let t=0;const n=new Set;for(const r of e.projectGroups)for(const i of r.chats)i.unread&&(t+=1),i.status==="waiting_for_user"&&n.add(i.chatId);return{unreadCount:t,waitingChatIds:n}}function wY(e,t){if(!e)return 0;const n=uN(e),r=uN(t),i=Math.max(0,r.unreadCount-n.unreadCount);let s=0;for(const o of r.waitingChatIds)n.waitingChatIds.has(o)||(s+=1);return i+s}function jS(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const CY=[/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(['"])([\s\S]*)\1$/,/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(.+)$/,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(.+)$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(.+)$/i];function kY(e){const t=e.trim();for(const n of CY){const r=t.match(n);if(!r)continue;const i=(r[2]??r[1]??"").trim();if(i)return i}return t}function MO(e){return e.split("/").pop()||e}const EY=1440*6e4;function LO(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,i=60*r,s=EY,o=7*s;return n<r?"now":n<i?`${Math.floor(n/r)}m`:n<s?`${Math.floor(n/i)}h`:n<o?`${Math.floor(n/s)}d`:`${Math.floor(n/o)}w`}function DO(e){return e.lastMessageAt??e._creationTime}const yd=({children:e,className:t,shimmerWidth:n=100,animate:r=!0,...i})=>m.jsx("span",{style:{"--shiny-width":`${Math.min(n,100)}px`},className:_e("mx-auto max-w-md text-foreground/50",r?["animate-shiny-text [background-size:var(--shiny-width)_100%] bg-clip-text [background-position:0_0] bg-no-repeat [transition:background-position_1s_cubic-bezier(.6,.6,0,1)_infinite]","bg-gradient-to-r from-transparent via-black/80 via-50% to-transparent dark:via-white/80"]:["text-neutral"],t),...i,children:e});function wC(e){const t=e+"CollectionProvider",[n,r]=ea(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=x=>{const{scope:w,children:C}=x,E=xn.useRef(null),R=xn.useRef(new Map).current;return m.jsx(i,{scope:w,itemMap:R,collectionRef:E,children:C})};o.displayName=t;const l=e+"CollectionSlot",c=lc(l),d=xn.forwardRef((x,w)=>{const{scope:C,children:E}=x,R=s(l,C),T=hn(w,R.collectionRef);return m.jsx(c,{ref:T,children:E})});d.displayName=l;const f=e+"CollectionItemSlot",h="data-radix-collection-item",g=lc(f),v=xn.forwardRef((x,w)=>{const{scope:C,children:E,...R}=x,T=xn.useRef(null),A=hn(w,T),N=s(f,C);return xn.useEffect(()=>(N.itemMap.set(T,{ref:T,...R}),()=>void N.itemMap.delete(T))),m.jsx(g,{[h]:"",ref:A,children:E})});v.displayName=f;function y(x){const w=s(e+"CollectionConsumer",x);return xn.useCallback(()=>{const E=w.collectionRef.current;if(!E)return[];const R=Array.from(E.querySelectorAll(`[${h}]`));return Array.from(w.itemMap.values()).sort((N,M)=>R.indexOf(N.ref.current)-R.indexOf(M.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:o,Slot:d,ItemSlot:v},y,r]}var RY=_.createContext(void 0);function CC(e){const t=_.useContext(RY);return e||t||"ltr"}var Gy="rovingFocusGroup.onEntryFocus",TY={bubbles:!1,cancelable:!0},sp="RovingFocusGroup",[zS,IO,AY]=wC(sp),[NY,PO]=ea(sp,[AY]),[MY,LY]=NY(sp),OO=_.forwardRef((e,t)=>m.jsx(zS.Provider,{scope:e.__scopeRovingFocusGroup,children:m.jsx(zS.Slot,{scope:e.__scopeRovingFocusGroup,children:m.jsx(DY,{...e,ref:t})})}));OO.displayName=sp;var DY=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=e,g=_.useRef(null),v=hn(t,g),y=CC(s),[x,w]=Yu({prop:o,defaultProp:l??null,onChange:c,caller:sp}),[C,E]=_.useState(!1),R=Ls(d),T=IO(n),A=_.useRef(!1),[N,M]=_.useState(0);return _.useEffect(()=>{const P=g.current;if(P)return P.addEventListener(Gy,R),()=>P.removeEventListener(Gy,R)},[R]),m.jsx(MY,{scope:n,orientation:r,dir:y,loop:i,currentTabStopId:x,onItemFocus:_.useCallback(P=>w(P),[w]),onItemShiftTab:_.useCallback(()=>E(!0),[]),onFocusableItemAdd:_.useCallback(()=>M(P=>P+1),[]),onFocusableItemRemove:_.useCallback(()=>M(P=>P-1),[]),children:m.jsx(Yt.div,{tabIndex:C||N===0?-1:0,"data-orientation":r,...h,ref:v,style:{outline:"none",...e.style},onMouseDown:Ke(e.onMouseDown,()=>{A.current=!0}),onFocus:Ke(e.onFocus,P=>{const q=!A.current;if(P.target===P.currentTarget&&q&&!C){const j=new CustomEvent(Gy,TY);if(P.currentTarget.dispatchEvent(j),!j.defaultPrevented){const $=T().filter(z=>z.focusable),F=$.find(z=>z.active),O=$.find(z=>z.id===x),H=[F,O,...$].filter(Boolean).map(z=>z.ref.current);BO(H,f)}}A.current=!1}),onBlur:Ke(e.onBlur,()=>E(!1))})})}),jO="RovingFocusGroupItem",zO=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...l}=e,c=Ho(),d=s||c,f=LY(jO,n),h=f.currentTabStopId===d,g=IO(n),{onFocusableItemAdd:v,onFocusableItemRemove:y,currentTabStopId:x}=f;return _.useEffect(()=>{if(r)return v(),()=>y()},[r,v,y]),m.jsx(zS.ItemSlot,{scope:n,id:d,focusable:r,active:i,children:m.jsx(Yt.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...l,ref:t,onMouseDown:Ke(e.onMouseDown,w=>{r?f.onItemFocus(d):w.preventDefault()}),onFocus:Ke(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:Ke(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){f.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const C=OY(w,f.orientation,f.dir);if(C!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let R=g().filter(T=>T.focusable).map(T=>T.ref.current);if(C==="last")R.reverse();else if(C==="prev"||C==="next"){C==="prev"&&R.reverse();const T=R.indexOf(w.currentTarget);R=f.loop?jY(R,T+1):R.slice(T+1)}setTimeout(()=>BO(R))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:x!=null}):o})})});zO.displayName=jO;var IY={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function PY(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function OY(e,t,n){const r=PY(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return IY[r]}function BO(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function jY(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var zY=OO,BY=zO,BS=["Enter"," "],FY=["ArrowDown","PageUp","Home"],FO=["ArrowUp","PageDown","End"],HY=[...FY,...FO],$Y={ltr:[...BS,"ArrowRight"],rtl:[...BS,"ArrowLeft"]},UY={ltr:["ArrowLeft"],rtl:["ArrowRight"]},op="Menu",[kf,VY,WY]=wC(op),[wc,HO]=ea(op,[WY,ml,PO]),Ib=ml(),$O=PO(),[GY,Cc]=wc(op),[qY,ap]=wc(op),UO=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=e,l=Ib(t),[c,d]=_.useState(null),f=_.useRef(!1),h=Ls(s),g=CC(i);return _.useEffect(()=>{const v=()=>{f.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>f.current=!1;return document.addEventListener("keydown",v,{capture:!0}),()=>{document.removeEventListener("keydown",v,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),m.jsx(Tb,{...l,children:m.jsx(GY,{scope:t,open:n,onOpenChange:h,content:c,onContentChange:d,children:m.jsx(qY,{scope:t,onClose:_.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:f,dir:g,modal:o,children:r})})})};UO.displayName=op;var KY="MenuAnchor",kC=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=Ib(n);return m.jsx(rp,{...i,...r,ref:t})});kC.displayName=KY;var EC="MenuPortal",[YY,VO]=wc(EC,{forceMount:void 0}),WO=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,s=Cc(EC,t);return m.jsx(YY,{scope:t,forceMount:n,children:m.jsx(vs,{present:n||s.open,children:m.jsx(gd,{asChild:!0,container:i,children:r})})})};WO.displayName=EC;var hs="MenuContent",[XY,RC]=wc(hs),GO=_.forwardRef((e,t)=>{const n=VO(hs,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Cc(hs,e.__scopeMenu),o=ap(hs,e.__scopeMenu);return m.jsx(kf.Provider,{scope:e.__scopeMenu,children:m.jsx(vs,{present:r||s.open,children:m.jsx(kf.Slot,{scope:e.__scopeMenu,children:o.modal?m.jsx(QY,{...i,ref:t}):m.jsx(ZY,{...i,ref:t})})})})}),QY=_.forwardRef((e,t)=>{const n=Cc(hs,e.__scopeMenu),r=_.useRef(null),i=hn(t,r);return _.useEffect(()=>{const s=r.current;if(s)return xb(s)},[]),m.jsx(TC,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ke(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),ZY=_.forwardRef((e,t)=>{const n=Cc(hs,e.__scopeMenu);return m.jsx(TC,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),JY=lc("MenuContent.ScrollLock"),TC=_.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:g,onDismiss:v,disableOutsideScroll:y,...x}=e,w=Cc(hs,n),C=ap(hs,n),E=Ib(n),R=$O(n),T=VY(n),[A,N]=_.useState(null),M=_.useRef(null),P=hn(t,M,w.onContentChange),q=_.useRef(0),j=_.useRef(""),$=_.useRef(0),F=_.useRef(null),O=_.useRef("right"),B=_.useRef(0),H=y?tp:_.Fragment,z=y?{as:JY,allowPinchZoom:!0}:void 0,W=Y=>{var oe,me;const I=j.current+Y,V=T().filter(ue=>!ue.disabled),X=document.activeElement,D=(oe=V.find(ue=>ue.ref.current===X))==null?void 0:oe.textValue,re=V.map(ue=>ue.textValue),ne=dX(re,I,D),se=(me=V.find(ue=>ue.textValue===ne))==null?void 0:me.ref.current;(function ue(ge){j.current=ge,window.clearTimeout(q.current),ge!==""&&(q.current=window.setTimeout(()=>ue(""),1e3))})(I),se&&setTimeout(()=>se.focus())};_.useEffect(()=>()=>window.clearTimeout(q.current),[]),_b();const U=_.useCallback(Y=>{var V,X;return O.current===((V=F.current)==null?void 0:V.side)&&fX(Y,(X=F.current)==null?void 0:X.area)},[]);return m.jsx(XY,{scope:n,searchRef:j,onItemEnter:_.useCallback(Y=>{U(Y)&&Y.preventDefault()},[U]),onItemLeave:_.useCallback(Y=>{var I;U(Y)||((I=M.current)==null||I.focus(),N(null))},[U]),onTriggerLeave:_.useCallback(Y=>{U(Y)&&Y.preventDefault()},[U]),pointerGraceTimerRef:$,onPointerGraceIntentChange:_.useCallback(Y=>{F.current=Y},[]),children:m.jsx(H,{...z,children:m.jsx(ep,{asChild:!0,trapped:i,onMountAutoFocus:Ke(s,Y=>{var I;Y.preventDefault(),(I=M.current)==null||I.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:m.jsx(md,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:g,onDismiss:v,children:m.jsx(zY,{asChild:!0,...R,dir:C.dir,orientation:"vertical",loop:r,currentTabStopId:A,onCurrentTabStopIdChange:N,onEntryFocus:Ke(c,Y=>{C.isUsingKeyboardRef.current||Y.preventDefault()}),preventScrollOnEntryFocus:!0,children:m.jsx(Ab,{role:"menu","aria-orientation":"vertical","data-state":lj(w.open),"data-radix-menu-content":"",dir:C.dir,...E,...x,ref:P,style:{outline:"none",...x.style},onKeyDown:Ke(x.onKeyDown,Y=>{const V=Y.target.closest("[data-radix-menu-content]")===Y.currentTarget,X=Y.ctrlKey||Y.altKey||Y.metaKey,D=Y.key.length===1;V&&(Y.key==="Tab"&&Y.preventDefault(),!X&&D&&W(Y.key));const re=M.current;if(Y.target!==re||!HY.includes(Y.key))return;Y.preventDefault();const se=T().filter(oe=>!oe.disabled).map(oe=>oe.ref.current);FO.includes(Y.key)&&se.reverse(),cX(se)}),onBlur:Ke(e.onBlur,Y=>{Y.currentTarget.contains(Y.target)||(window.clearTimeout(q.current),j.current="")}),onPointerMove:Ke(e.onPointerMove,Ef(Y=>{const I=Y.target,V=B.current!==Y.clientX;if(Y.currentTarget.contains(I)&&V){const X=Y.clientX>B.current?"right":"left";O.current=X,B.current=Y.clientX}}))})})})})})})});GO.displayName=hs;var eX="MenuGroup",AC=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Yt.div,{role:"group",...r,ref:t})});AC.displayName=eX;var tX="MenuLabel",qO=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Yt.div,{...r,ref:t})});qO.displayName=tX;var xv="MenuItem",dN="menu.itemSelect",Pb=_.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,s=_.useRef(null),o=ap(xv,e.__scopeMenu),l=RC(xv,e.__scopeMenu),c=hn(t,s),d=_.useRef(!1),f=()=>{const h=s.current;if(!n&&h){const g=new CustomEvent(dN,{bubbles:!0,cancelable:!0});h.addEventListener(dN,v=>r==null?void 0:r(v),{once:!0}),XP(h,g),g.defaultPrevented?d.current=!1:o.onClose()}};return m.jsx(KO,{...i,ref:c,disabled:n,onClick:Ke(e.onClick,f),onPointerDown:h=>{var g;(g=e.onPointerDown)==null||g.call(e,h),d.current=!0},onPointerUp:Ke(e.onPointerUp,h=>{var g;d.current||(g=h.currentTarget)==null||g.click()}),onKeyDown:Ke(e.onKeyDown,h=>{const g=l.searchRef.current!=="";n||g&&h.key===" "||BS.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});Pb.displayName=xv;var KO=_.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=e,o=RC(xv,n),l=$O(n),c=_.useRef(null),d=hn(t,c),[f,h]=_.useState(!1),[g,v]=_.useState("");return _.useEffect(()=>{const y=c.current;y&&v((y.textContent??"").trim())},[s.children]),m.jsx(kf.ItemSlot,{scope:n,disabled:r,textValue:i??g,children:m.jsx(BY,{asChild:!0,...l,focusable:!r,children:m.jsx(Yt.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:d,onPointerMove:Ke(e.onPointerMove,Ef(y=>{r?o.onItemLeave(y):(o.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ke(e.onPointerLeave,Ef(y=>o.onItemLeave(y))),onFocus:Ke(e.onFocus,()=>h(!0)),onBlur:Ke(e.onBlur,()=>h(!1))})})})}),nX="MenuCheckboxItem",YO=_.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return m.jsx(ej,{scope:e.__scopeMenu,checked:n,children:m.jsx(Pb,{role:"menuitemcheckbox","aria-checked":Sv(n)?"mixed":n,...i,ref:t,"data-state":MC(n),onSelect:Ke(i.onSelect,()=>r==null?void 0:r(Sv(n)?!0:!n),{checkForDefaultPrevented:!1})})})});YO.displayName=nX;var XO="MenuRadioGroup",[rX,iX]=wc(XO,{value:void 0,onValueChange:()=>{}}),QO=_.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,s=Ls(r);return m.jsx(rX,{scope:e.__scopeMenu,value:n,onValueChange:s,children:m.jsx(AC,{...i,ref:t})})});QO.displayName=XO;var ZO="MenuRadioItem",JO=_.forwardRef((e,t)=>{const{value:n,...r}=e,i=iX(ZO,e.__scopeMenu),s=n===i.value;return m.jsx(ej,{scope:e.__scopeMenu,checked:s,children:m.jsx(Pb,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":MC(s),onSelect:Ke(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});JO.displayName=ZO;var NC="MenuItemIndicator",[ej,sX]=wc(NC,{checked:!1}),tj=_.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,s=sX(NC,n);return m.jsx(vs,{present:r||Sv(s.checked)||s.checked===!0,children:m.jsx(Yt.span,{...i,ref:t,"data-state":MC(s.checked)})})});tj.displayName=NC;var oX="MenuSeparator",nj=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Yt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});nj.displayName=oX;var aX="MenuArrow",rj=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=Ib(n);return m.jsx(Nb,{...i,...r,ref:t})});rj.displayName=aX;var lX="MenuSub",[f1e,ij]=wc(lX),Gh="MenuSubTrigger",sj=_.forwardRef((e,t)=>{const n=Cc(Gh,e.__scopeMenu),r=ap(Gh,e.__scopeMenu),i=ij(Gh,e.__scopeMenu),s=RC(Gh,e.__scopeMenu),o=_.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=s,d={__scopeMenu:e.__scopeMenu},f=_.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return _.useEffect(()=>f,[f]),_.useEffect(()=>{const h=l.current;return()=>{window.clearTimeout(h),c(null)}},[l,c]),m.jsx(kC,{asChild:!0,...d,children:m.jsx(KO,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":lj(n.open),...e,ref:J1(t,i.onTriggerChange),onClick:h=>{var g;(g=e.onClick)==null||g.call(e,h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ke(e.onPointerMove,Ef(h=>{s.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:Ke(e.onPointerLeave,Ef(h=>{var v,y;f();const g=(v=n.content)==null?void 0:v.getBoundingClientRect();if(g){const x=(y=n.content)==null?void 0:y.dataset.side,w=x==="right",C=w?-5:5,E=g[w?"left":"right"],R=g[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:h.clientX+C,y:h.clientY},{x:E,y:g.top},{x:R,y:g.top},{x:R,y:g.bottom},{x:E,y:g.bottom}],side:x}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(h),h.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:Ke(e.onKeyDown,h=>{var v;const g=s.searchRef.current!=="";e.disabled||g&&h.key===" "||$Y[r.dir].includes(h.key)&&(n.onOpenChange(!0),(v=n.content)==null||v.focus(),h.preventDefault())})})})});sj.displayName=Gh;var oj="MenuSubContent",aj=_.forwardRef((e,t)=>{const n=VO(hs,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Cc(hs,e.__scopeMenu),o=ap(hs,e.__scopeMenu),l=ij(oj,e.__scopeMenu),c=_.useRef(null),d=hn(t,c);return m.jsx(kf.Provider,{scope:e.__scopeMenu,children:m.jsx(vs,{present:r||s.open,children:m.jsx(kf.Slot,{scope:e.__scopeMenu,children:m.jsx(TC,{id:l.contentId,"aria-labelledby":l.triggerId,...i,ref:d,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var h;o.isUsingKeyboardRef.current&&((h=c.current)==null||h.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:Ke(e.onFocusOutside,f=>{f.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Ke(e.onEscapeKeyDown,f=>{o.onClose(),f.preventDefault()}),onKeyDown:Ke(e.onKeyDown,f=>{var v;const h=f.currentTarget.contains(f.target),g=UY[o.dir].includes(f.key);h&&g&&(s.onOpenChange(!1),(v=l.trigger)==null||v.focus(),f.preventDefault())})})})})})});aj.displayName=oj;function lj(e){return e?"open":"closed"}function Sv(e){return e==="indeterminate"}function MC(e){return Sv(e)?"indeterminate":e?"checked":"unchecked"}function cX(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function uX(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function dX(e,t,n){const i=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let o=uX(e,Math.max(s,0));i.length===1&&(o=o.filter(d=>d!==n));const c=o.find(d=>d.toLowerCase().startsWith(i.toLowerCase()));return c!==n?c:void 0}function hX(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const l=t[s],c=t[o],d=l.x,f=l.y,h=c.x,g=c.y;f>r!=g>r&&n<(h-d)*(r-f)/(g-f)+d&&(i=!i)}return i}function fX(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return hX(n,t)}function Ef(e){return t=>t.pointerType==="mouse"?e(t):void 0}var pX=UO,mX=kC,gX=WO,vX=GO,bX=AC,_X=qO,yX=Pb,xX=YO,SX=QO,wX=JO,CX=tj,kX=nj,EX=rj,RX=sj,TX=aj,LC="ContextMenu",[AX]=ea(LC,[HO]),ri=HO(),[NX,cj]=AX(LC),uj=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:s=!0}=e,[o,l]=_.useState(!1),c=ri(t),d=Ls(r),f=_.useCallback(h=>{l(h),d(h)},[d]);return m.jsx(NX,{scope:t,open:o,onOpenChange:f,modal:s,children:m.jsx(pX,{...c,dir:i,open:o,onOpenChange:f,modal:s,children:n})})};uj.displayName=LC;var dj="ContextMenuTrigger",hj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:r=!1,...i}=e,s=cj(dj,n),o=ri(n),l=_.useRef({x:0,y:0}),c=_.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...l.current})}),d=_.useRef(0),f=_.useCallback(()=>window.clearTimeout(d.current),[]),h=g=>{l.current={x:g.clientX,y:g.clientY},s.onOpenChange(!0)};return _.useEffect(()=>f,[f]),_.useEffect(()=>void(r&&f()),[r,f]),m.jsxs(m.Fragment,{children:[m.jsx(mX,{...o,virtualRef:c}),m.jsx(Yt.span,{"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,...i,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:Ke(e.onContextMenu,g=>{f(),h(g),g.preventDefault()}),onPointerDown:r?e.onPointerDown:Ke(e.onPointerDown,qm(g=>{f(),d.current=window.setTimeout(()=>h(g),700)})),onPointerMove:r?e.onPointerMove:Ke(e.onPointerMove,qm(f)),onPointerCancel:r?e.onPointerCancel:Ke(e.onPointerCancel,qm(f)),onPointerUp:r?e.onPointerUp:Ke(e.onPointerUp,qm(f))})]})});hj.displayName=dj;var MX="ContextMenuPortal",fj=e=>{const{__scopeContextMenu:t,...n}=e,r=ri(t);return m.jsx(gX,{...r,...n})};fj.displayName=MX;var pj="ContextMenuContent",mj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=cj(pj,n),s=ri(n),o=_.useRef(!1);return m.jsx(vX,{...s,...r,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:l=>{var c;(c=e.onCloseAutoFocus)==null||c.call(e,l),!l.defaultPrevented&&o.current&&l.preventDefault(),o.current=!1},onInteractOutside:l=>{var c;(c=e.onInteractOutside)==null||c.call(e,l),!l.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});mj.displayName=pj;var LX="ContextMenuGroup",DX=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ri(n);return m.jsx(bX,{...i,...r,ref:t})});DX.displayName=LX;var IX="ContextMenuLabel",PX=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ri(n);return m.jsx(_X,{...i,...r,ref:t})});PX.displayName=IX;var OX="ContextMenuItem",gj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ri(n);return m.jsx(yX,{...i,...r,ref:t})});gj.displayName=OX;var jX="ContextMenuCheckboxItem",zX=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ri(n);return m.jsx(xX,{...i,...r,ref:t})});zX.displayName=jX;var BX="ContextMenuRadioGroup",FX=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ri(n);return m.jsx(SX,{...i,...r,ref:t})});FX.displayName=BX;var HX="ContextMenuRadioItem",$X=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ri(n);return m.jsx(wX,{...i,...r,ref:t})});$X.displayName=HX;var UX="ContextMenuItemIndicator",VX=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ri(n);return m.jsx(CX,{...i,...r,ref:t})});VX.displayName=UX;var WX="ContextMenuSeparator",vj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ri(n);return m.jsx(kX,{...i,...r,ref:t})});vj.displayName=WX;var GX="ContextMenuArrow",qX=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ri(n);return m.jsx(EX,{...i,...r,ref:t})});qX.displayName=GX;var KX="ContextMenuSubTrigger",YX=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ri(n);return m.jsx(RX,{...i,...r,ref:t})});YX.displayName=KX;var XX="ContextMenuSubContent",QX=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ri(n);return m.jsx(TX,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});QX.displayName=XX;function qm(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var ZX=uj,JX=hj,eQ=fj,bj=mj,_j=gj,yj=vj;const xj=_.createContext(null);function xd({onOpenChange:e,...t}){const[n,r]=_.useState(0),i=_.useCallback(()=>{r(s=>s+1),e==null||e(!1)},[e]);return m.jsx(xj.Provider,{value:i,children:m.jsx(ZX,{onOpenChange:e,...t},n)})}const Sd=JX,kc=_.forwardRef(({className:e,...t},n)=>m.jsx(eQ,{children:m.jsx(bj,{ref:n,className:_e("z-50 min-w-[170px] overflow-hidden rounded-xl border border-border bg-background p-1 shadow-lg outline-hidden animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",e),...t})}));kc.displayName=bj.displayName;const jn=_.forwardRef(({className:e,onSelect:t,...n},r)=>{const i=_.useContext(xj);return m.jsx(_j,{ref:r,className:_e("relative flex cursor-default select-none items-center gap-2.5 rounded-lg px-3 py-2 text-xs font-medium text-foreground outline-hidden transition-colors hover:bg-muted focus:bg-muted data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),onSelect:s=>{t==null||t(s),i==null||i()},...n})});jn.displayName=_j.displayName;const Sj=_.forwardRef(({className:e,...t},n)=>m.jsx(yj,{ref:n,className:_e("-mx-1 my-1 h-px bg-border",e),...t}));Sj.displayName=yj.displayName;function tQ({editorLabel:e,onCopyPath:t,onShowArchived:n,onOpenInFinder:r,onOpenInEditor:i,onHide:s,children:o}){return m.jsxs(xd,{children:[m.jsx(Sd,{asChild:!0,children:o}),m.jsxs(kc,{children:[m.jsxs(jn,{onSelect:l=>{l.stopPropagation(),t()},children:[m.jsx(ll,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Copy Path"})]}),m.jsxs(jn,{onSelect:l=>{l.stopPropagation(),n()},children:[m.jsx(V1,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Show Archived"})]}),m.jsxs(jn,{onSelect:l=>{l.stopPropagation(),r()},children:[m.jsx(gb,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Show in Finder"})]}),m.jsxs(jn,{onSelect:l=>{l.stopPropagation(),i()},children:[m.jsx(W1,{className:"h-3.5 w-3.5"}),m.jsxs("span",{className:"text-xs font-medium",children:["Open in ",e]})]}),m.jsxs(jn,{onSelect:l=>{l.stopPropagation(),s()},children:[m.jsx(B9,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Hide"})]})]})]})}function nQ({canFork:e,onRename:t,onShare:n,onOpenInFinder:r,onFork:i,onArchive:s,onDelete:o,children:l}){return m.jsxs(xd,{children:[m.jsx(Sd,{asChild:!0,children:l}),m.jsxs(kc,{children:[m.jsxs(jn,{onSelect:c=>{c.preventDefault(),t()},children:[m.jsx(Y1,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Rename"})]}),m.jsxs(jn,{onSelect:c=>{c.preventDefault(),n()},children:[m.jsx(Z1,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Share"})]}),m.jsxs(jn,{onSelect:c=>{c.preventDefault(),r()},children:[m.jsx(gb,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Open in Finder"})]}),m.jsxs(jn,{disabled:!e,onSelect:c=>{c.preventDefault(),e&&i()},children:[m.jsx(KP,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Fork"})]}),m.jsxs(jn,{onSelect:c=>{c.preventDefault(),s()},children:[m.jsx(V1,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Archive"})]}),m.jsxs(jn,{onSelect:c=>{c.preventDefault(),o()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[m.jsx(Q1,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Delete"})]})]})]})}const rQ=new Set(["starting","running"]);function iQ({chat:e,activeChatId:t,nowMs:n,shortcutHint:r=null,showShortcutHint:i=!1,onSelectChat:s,onRenameChat:o,onShareChat:l,onOpenInFinder:c,onForkChat:d,onArchiveChat:f,onDeleteChat:h}){const g=LO(DO(e),n),v=i&&r?r:g,y=i&&!!r,x=oq(e.chatId),w=m.jsxs("div",{"data-chat-id":x,className:_e("group flex items-center gap-2 pl-2.5 pr-0.5 py-0.5 rounded-lg cursor-pointer border-border/0 hover:border-border hover:bg-muted/20 active:scale-[0.985] border transition-all",t===x?"bg-muted hover:bg-muted border-border":"border-border/0 dark:hover:border-slate-400/10 "),onClick:()=>s(e.chatId),children:[rQ.has(e.status)?m.jsx(dn,{className:"size-3.5 flex-shrink-0 animate-spin text-logo"}):e.status==="waiting_for_user"?m.jsx("div",{className:"relative ",children:m.jsxs("div",{className:" rounded-full z-0 size-3.5 flex items-center justify-center ",children:[m.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-blue-400/80 animate-ping"}),m.jsx("div",{className:" rounded-full z-0 size-2.5 bg-blue-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):e.unread?m.jsx("div",{className:"relative ",children:m.jsxs("div",{className:" rounded-full z-0 size-3.5 flex items-center justify-center ",children:[m.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-emerald-400/80 animate-ping"}),m.jsx("div",{className:" rounded-full z-0 size-2.5 bg-emerald-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):null,m.jsx("span",{className:"text-sm truncate flex-1 translate-y-[-0.5px]",children:e.status!=="idle"&&e.status!=="waiting_for_user"?m.jsx(yd,{animate:e.status==="running",shimmerWidth:Math.max(20,e.title.length*3),children:e.title}):e.status!=="idle"||t===x||e.unread?m.jsx("span",{className:"",children:e.title}):m.jsx("span",{className:"text-slate-500 dark:text-slate-400",children:e.title})}),m.jsxs("div",{className:_e("relative h-7 mr-[2px] shrink-0",e.canFork?"w-12":"w-6"),children:[v?y?m.jsx("span",{className:"hidden md:flex absolute inset-0 items-center justify-end pr-0.5 text-[11px] text-foreground transition-opacity group-hover:opacity-0",children:m.jsx(RO,{className:"h-4 min-w-4 rounded-sm border-border/50 bg-transparent px-1 text-[10px]",children:r})}):m.jsx("span",{className:"hidden md:flex absolute inset-0 items-center justify-end pr-1 text-[11px] text-muted-foreground opacity-60 transition-opacity group-hover:opacity-0",children:v}):null,m.jsxs("div",{className:_e("absolute inset-0 flex items-center justify-end gap-0 opacity-100 mr-[3px]",v?"md:opacity-0 md:group-hover:opacity-100":"opacity-100 md:opacity-0 md:group-hover:opacity-100"),children:[e.canFork?m.jsx(nt,{variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer rounded-sm hover:!bg-transparent !border-0",onClick:C=>{C.stopPropagation(),d(e.chatId)},title:"Fork chat",children:m.jsx(KP,{className:"size-3.5"})}):null,m.jsx(nt,{variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer rounded-sm hover:!bg-transparent !border-0",onClick:C=>{C.stopPropagation(),f(e.chatId)},title:"Archive chat",children:m.jsx(V1,{className:"size-3.5"})})]})]})]},e._id);return m.jsx(nQ,{canFork:e.canFork,onRename:()=>o(e.chatId),onShare:()=>l(e.chatId),onOpenInFinder:()=>c(e.localPath),onFork:()=>d(e.chatId),onArchive:()=>f(e.chatId),onDelete:()=>h(e.chatId),children:w})}const sQ=_.memo(iQ);function oQ(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _.useMemo(()=>r=>{t.forEach(i=>i(r))},t)}const Ob=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function wd(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function DC(e){return"nodeType"in e}function Si(e){var t,n;return e?wd(e)?e:DC(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function IC(e){const{Document:t}=Si(e);return e instanceof t}function lp(e){return wd(e)?!1:e instanceof Si(e).HTMLElement}function wj(e){return e instanceof Si(e).SVGElement}function Cd(e){return e?wd(e)?e.document:DC(e)?IC(e)?e:lp(e)||wj(e)?e.ownerDocument:document:document:document}const ao=Ob?_.useLayoutEffect:_.useEffect;function PC(e){const t=_.useRef(e);return ao(()=>{t.current=e}),_.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}function aQ(){const e=_.useRef(null),t=_.useCallback((r,i)=>{e.current=setInterval(r,i)},[]),n=_.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Rf(e,t){t===void 0&&(t=[e]);const n=_.useRef(e);return ao(()=>{n.current!==e&&(n.current=e)},t),n}function cp(e,t){const n=_.useRef();return _.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function wv(e){const t=PC(e),n=_.useRef(null),r=_.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function FS(e){const t=_.useRef();return _.useEffect(()=>{t.current=e},[e]),t.current}let qy={};function up(e,t){return _.useMemo(()=>{if(t)return t;const n=qy[e]==null?0:qy[e]+1;return qy[e]=n,e+"-"+n},[e,t])}function Cj(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((s,o)=>{const l=Object.entries(o);for(const[c,d]of l){const f=s[c];f!=null&&(s[c]=f+e*d)}return s},{...t})}}const Bu=Cj(1),Cv=Cj(-1);function lQ(e){return"clientX"in e&&"clientY"in e}function OC(e){if(!e)return!1;const{KeyboardEvent:t}=Si(e.target);return t&&e instanceof t}function cQ(e){if(!e)return!1;const{TouchEvent:t}=Si(e.target);return t&&e instanceof t}function HS(e){if(cQ(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return lQ(e)?{x:e.clientX,y:e.clientY}:null}const Tf=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Tf.Translate.toString(e),Tf.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),hN="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function uQ(e){return e.matches(hN)?e:e.querySelector(hN)}const dQ={display:"none"};function hQ(e){let{id:t,value:n}=e;return xn.createElement("div",{id:t,style:dQ},n)}function fQ(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return xn.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function pQ(){const[e,t]=_.useState("");return{announce:_.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const kj=_.createContext(null);function mQ(e){const t=_.useContext(kj);_.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function gQ(){const[e]=_.useState(()=>new Set),t=_.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[_.useCallback(r=>{let{type:i,event:s}=r;e.forEach(o=>{var l;return(l=o[i])==null?void 0:l.call(o,s)})},[e]),t]}const vQ={draggable:`
640
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return _.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},uG="DialogDescriptionWarning",dG=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${S5(uG).contentName}}.`;return _.useEffect(()=>{var s;const i=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},hG=c5,fG=h5,w5=f5,C5=p5,pG=g5,mG=b5,gG=y5;function k5(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=k5(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function E5(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=k5(e))&&(r&&(r+=" "),r+=t);return r}const vG=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},bG=(e,t)=>({classGroupId:e,validator:t}),R5=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),hv="-",HA=[],_G="arbitrary..",yG=e=>{const t=SG(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return xG(o);const l=o.split(hv),c=l[0]===""&&l.length>1?1:0;return T5(l,c,t)},getConflictingClassGroupIds:(o,l)=>{if(l){const c=r[o],d=n[o];return c?d?vG(d,c):c:d||HA}return n[o]||HA}}},T5=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const i=e[t],s=n.nextPart.get(i);if(s){const d=T5(e,t+1,s);if(d)return d}const o=n.validators;if(o===null)return;const l=t===0?e.join(hv):e.slice(t).join(hv),c=o.length;for(let d=0;d<c;d++){const f=o[d];if(f.validator(l))return f.classGroupId}},xG=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?_G+r:void 0})(),SG=e=>{const{theme:t,classGroups:n}=e;return wG(n,t)},wG=(e,t)=>{const n=R5();for(const r in e){const i=e[r];rC(i,n,r,t)}return n},rC=(e,t,n,r)=>{const i=e.length;for(let s=0;s<i;s++){const o=e[s];CG(o,t,n,r)}},CG=(e,t,n,r)=>{if(typeof e=="string"){kG(e,t,n);return}if(typeof e=="function"){EG(e,t,n,r);return}RG(e,t,n,r)},kG=(e,t,n)=>{const r=e===""?t:A5(t,e);r.classGroupId=n},EG=(e,t,n,r)=>{if(TG(e)){rC(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(bG(n,e))},RG=(e,t,n,r)=>{const i=Object.entries(e),s=i.length;for(let o=0;o<s;o++){const[l,c]=i[o];rC(c,A5(t,l),n,r)}},A5=(e,t)=>{let n=e;const r=t.split(hv),i=r.length;for(let s=0;s<i;s++){const o=r[s];let l=n.nextPart.get(o);l||(l=R5(),n.nextPart.set(o,l)),n=l}return n},TG=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,AG=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const i=(s,o)=>{n[s]=o,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(s){let o=n[s];if(o!==void 0)return o;if((o=r[s])!==void 0)return i(s,o),o},set(s,o){s in n?n[s]=o:i(s,o)}}},NS="!",$A=":",NG=[],UA=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),MG=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=i=>{const s=[];let o=0,l=0,c=0,d;const f=i.length;for(let x=0;x<f;x++){const w=i[x];if(o===0&&l===0){if(w===$A){s.push(i.slice(c,x)),c=x+1;continue}if(w==="/"){d=x;continue}}w==="["?o++:w==="]"?o--:w==="("?l++:w===")"&&l--}const h=s.length===0?i:i.slice(c);let g=h,v=!1;h.endsWith(NS)?(g=h.slice(0,-1),v=!0):h.startsWith(NS)&&(g=h.slice(1),v=!0);const y=d&&d>c?d-c:void 0;return UA(s,v,g,y)};if(t){const i=t+$A,s=r;r=o=>o.startsWith(i)?s(o.slice(i.length)):UA(NG,!1,o,void 0,!0)}if(n){const i=r;r=s=>n({className:s,parseClassName:i})}return r},LG=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let s=0;s<n.length;s++){const o=n[s],l=o[0]==="[",c=t.has(o);l||c?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(o)):i.push(o)}return i.length>0&&(i.sort(),r.push(...i)),r}},DG=e=>({cache:AG(e.cacheSize),parseClassName:MG(e),sortModifiers:LG(e),...yG(e)}),IG=/\s+/,PG=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=t,o=[],l=e.trim().split(IG);let c="";for(let d=l.length-1;d>=0;d-=1){const f=l[d],{isExternal:h,modifiers:g,hasImportantModifier:v,baseClassName:y,maybePostfixModifierPosition:x}=n(f);if(h){c=f+(c.length>0?" "+c:c);continue}let w=!!x,C=r(w?y.substring(0,x):y);if(!C){if(!w){c=f+(c.length>0?" "+c:c);continue}if(C=r(y),!C){c=f+(c.length>0?" "+c:c);continue}w=!1}const E=g.length===0?"":g.length===1?g[0]:s(g).join(":"),R=v?E+NS:E,T=R+C;if(o.indexOf(T)>-1)continue;o.push(T);const A=i(C,w);for(let N=0;N<A.length;++N){const M=A[N];o.push(R+M)}c=f+(c.length>0?" "+c:c)}return c},OG=(...e)=>{let t=0,n,r,i="";for(;t<e.length;)(n=e[t++])&&(r=N5(n))&&(i&&(i+=" "),i+=r);return i},N5=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=N5(e[r]))&&(n&&(n+=" "),n+=t);return n},jG=(e,...t)=>{let n,r,i,s;const o=c=>{const d=t.reduce((f,h)=>h(f),e());return n=DG(d),r=n.cache.get,i=n.cache.set,s=l,l(c)},l=c=>{const d=r(c);if(d)return d;const f=PG(c,n);return i(c,f),f};return s=o,(...c)=>s(OG(...c))},zG=[],ar=e=>{const t=n=>n[e]||zG;return t.isThemeGetter=!0,t},M5=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,L5=/^\((?:(\w[\w-]*):)?(.+)\)$/i,BG=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,FG=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,HG=/\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$/,$G=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,UG=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,VG=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Oa=e=>BG.test(e),Ht=e=>!!e&&!Number.isNaN(Number(e)),ja=e=>!!e&&Number.isInteger(Number(e)),$y=e=>e.endsWith("%")&&Ht(e.slice(0,-1)),Ro=e=>FG.test(e),D5=()=>!0,WG=e=>HG.test(e)&&!$G.test(e),iC=()=>!1,GG=e=>UG.test(e),qG=e=>VG.test(e),KG=e=>!Ze(e)&&!et(e),YG=e=>pl(e,O5,iC),Ze=e=>M5.test(e),zl=e=>pl(e,j5,WG),VA=e=>pl(e,rq,Ht),XG=e=>pl(e,B5,D5),QG=e=>pl(e,z5,iC),WA=e=>pl(e,I5,iC),ZG=e=>pl(e,P5,qG),Um=e=>pl(e,F5,GG),et=e=>L5.test(e),Nh=e=>Sc(e,j5),JG=e=>Sc(e,z5),GA=e=>Sc(e,I5),eq=e=>Sc(e,O5),tq=e=>Sc(e,P5),Vm=e=>Sc(e,F5,!0),nq=e=>Sc(e,B5,!0),pl=(e,t,n)=>{const r=M5.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Sc=(e,t,n=!1)=>{const r=L5.exec(e);return r?r[1]?t(r[1]):n:!1},I5=e=>e==="position"||e==="percentage",P5=e=>e==="image"||e==="url",O5=e=>e==="length"||e==="size"||e==="bg-size",j5=e=>e==="length",rq=e=>e==="number",z5=e=>e==="family-name",B5=e=>e==="number"||e==="weight",F5=e=>e==="shadow",iq=()=>{const e=ar("color"),t=ar("font"),n=ar("text"),r=ar("font-weight"),i=ar("tracking"),s=ar("leading"),o=ar("breakpoint"),l=ar("container"),c=ar("spacing"),d=ar("radius"),f=ar("shadow"),h=ar("inset-shadow"),g=ar("text-shadow"),v=ar("drop-shadow"),y=ar("blur"),x=ar("perspective"),w=ar("aspect"),C=ar("ease"),E=ar("animate"),R=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],A=()=>[...T(),et,Ze],N=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto","contain","none"],P=()=>[et,Ze,c],q=()=>[Oa,"full","auto",...P()],j=()=>[ja,"none","subgrid",et,Ze],$=()=>["auto",{span:["full",ja,et,Ze]},ja,et,Ze],F=()=>[ja,"auto",et,Ze],O=()=>["auto","min","max","fr",et,Ze],B=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],z=()=>["auto",...P()],W=()=>[Oa,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],U=()=>[Oa,"screen","full","dvw","lvw","svw","min","max","fit",...P()],Y=()=>[Oa,"screen","full","lh","dvh","lvh","svh","min","max","fit",...P()],I=()=>[e,et,Ze],V=()=>[...T(),GA,WA,{position:[et,Ze]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],D=()=>["auto","cover","contain",eq,YG,{size:[et,Ze]}],re=()=>[$y,Nh,zl],ne=()=>["","none","full",d,et,Ze],se=()=>["",Ht,Nh,zl],oe=()=>["solid","dashed","dotted","double"],me=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ue=()=>[Ht,$y,GA,WA],ge=()=>["","none",y,et,Ze],xe=()=>["none",Ht,et,Ze],ie=()=>["none",Ht,et,Ze],we=()=>[Ht,et,Ze],Pe=()=>[Oa,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ro],breakpoint:[Ro],color:[D5],container:[Ro],"drop-shadow":[Ro],ease:["in","out","in-out"],font:[KG],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ro],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ro],shadow:[Ro],spacing:["px",Ht],text:[Ro],"text-shadow":[Ro],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Oa,Ze,et,w]}],container:["container"],columns:[{columns:[Ht,Ze,et,l]}],"break-after":[{"break-after":R()}],"break-before":[{"break-before":R()}],"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:A()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:q()}],"inset-x":[{"inset-x":q()}],"inset-y":[{"inset-y":q()}],start:[{"inset-s":q(),start:q()}],end:[{"inset-e":q(),end:q()}],"inset-bs":[{"inset-bs":q()}],"inset-be":[{"inset-be":q()}],top:[{top:q()}],right:[{right:q()}],bottom:[{bottom:q()}],left:[{left:q()}],visibility:["visible","invisible","collapse"],z:[{z:[ja,"auto",et,Ze]}],basis:[{basis:[Oa,"full","auto",l,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ht,Oa,"auto","initial","none",Ze]}],grow:[{grow:["",Ht,et,Ze]}],shrink:[{shrink:["",Ht,et,Ze]}],order:[{order:[ja,"first","last","none",et,Ze]}],"grid-cols":[{"grid-cols":j()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":j()}],"row-start-end":[{row:$()}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":O()}],"auto-rows":[{"auto-rows":O()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...B(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...B()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":B()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pbs:[{pbs:P()}],pbe:[{pbe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:z()}],mx:[{mx:z()}],my:[{my:z()}],ms:[{ms:z()}],me:[{me:z()}],mbs:[{mbs:z()}],mbe:[{mbe:z()}],mt:[{mt:z()}],mr:[{mr:z()}],mb:[{mb:z()}],ml:[{ml:z()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],"inline-size":[{inline:["auto",...U()]}],"min-inline-size":[{"min-inline":["auto",...U()]}],"max-inline-size":[{"max-inline":["none",...U()]}],"block-size":[{block:["auto",...Y()]}],"min-block-size":[{"min-block":["auto",...Y()]}],"max-block-size":[{"max-block":["none",...Y()]}],w:[{w:[l,"screen",...W()]}],"min-w":[{"min-w":[l,"screen","none",...W()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",n,Nh,zl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,nq,XG]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",$y,Ze]}],"font-family":[{font:[JG,QG,t]}],"font-features":[{"font-features":[Ze]}],"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:[i,et,Ze]}],"line-clamp":[{"line-clamp":[Ht,"none",et,VA]}],leading:[{leading:[s,...P()]}],"list-image":[{"list-image":["none",et,Ze]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",et,Ze]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ht,"from-font","auto",et,zl]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Ht,"auto",et,Ze]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",et,Ze]}],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",et,Ze]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:V()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:D()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ja,et,Ze],radial:["",et,Ze],conic:[ja,et,Ze]},tq,ZG]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:ne()}],"rounded-s":[{"rounded-s":ne()}],"rounded-e":[{"rounded-e":ne()}],"rounded-t":[{"rounded-t":ne()}],"rounded-r":[{"rounded-r":ne()}],"rounded-b":[{"rounded-b":ne()}],"rounded-l":[{"rounded-l":ne()}],"rounded-ss":[{"rounded-ss":ne()}],"rounded-se":[{"rounded-se":ne()}],"rounded-ee":[{"rounded-ee":ne()}],"rounded-es":[{"rounded-es":ne()}],"rounded-tl":[{"rounded-tl":ne()}],"rounded-tr":[{"rounded-tr":ne()}],"rounded-br":[{"rounded-br":ne()}],"rounded-bl":[{"rounded-bl":ne()}],"border-w":[{border:se()}],"border-w-x":[{"border-x":se()}],"border-w-y":[{"border-y":se()}],"border-w-s":[{"border-s":se()}],"border-w-e":[{"border-e":se()}],"border-w-bs":[{"border-bs":se()}],"border-w-be":[{"border-be":se()}],"border-w-t":[{"border-t":se()}],"border-w-r":[{"border-r":se()}],"border-w-b":[{"border-b":se()}],"border-w-l":[{"border-l":se()}],"divide-x":[{"divide-x":se()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":se()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...oe(),"hidden","none"]}],"divide-style":[{divide:[...oe(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...oe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ht,et,Ze]}],"outline-w":[{outline:["",Ht,Nh,zl]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",f,Vm,Um]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",h,Vm,Um]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:se()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Ht,zl]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":se()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",g,Vm,Um]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Ht,et,Ze]}],"mix-blend":[{"mix-blend":[...me(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":me()}],"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":[Ht]}],"mask-image-linear-from-pos":[{"mask-linear-from":ue()}],"mask-image-linear-to-pos":[{"mask-linear-to":ue()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":ue()}],"mask-image-t-to-pos":[{"mask-t-to":ue()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":ue()}],"mask-image-r-to-pos":[{"mask-r-to":ue()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":ue()}],"mask-image-b-to-pos":[{"mask-b-to":ue()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":ue()}],"mask-image-l-to-pos":[{"mask-l-to":ue()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":ue()}],"mask-image-x-to-pos":[{"mask-x-to":ue()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":ue()}],"mask-image-y-to-pos":[{"mask-y-to":ue()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[et,Ze]}],"mask-image-radial-from-pos":[{"mask-radial-from":ue()}],"mask-image-radial-to-pos":[{"mask-radial-to":ue()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"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":T()}],"mask-image-conic-pos":[{"mask-conic":[Ht]}],"mask-image-conic-from-pos":[{"mask-conic-from":ue()}],"mask-image-conic-to-pos":[{"mask-conic-to":ue()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:V()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:D()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",et,Ze]}],filter:[{filter:["","none",et,Ze]}],blur:[{blur:ge()}],brightness:[{brightness:[Ht,et,Ze]}],contrast:[{contrast:[Ht,et,Ze]}],"drop-shadow":[{"drop-shadow":["","none",v,Vm,Um]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",Ht,et,Ze]}],"hue-rotate":[{"hue-rotate":[Ht,et,Ze]}],invert:[{invert:["",Ht,et,Ze]}],saturate:[{saturate:[Ht,et,Ze]}],sepia:[{sepia:["",Ht,et,Ze]}],"backdrop-filter":[{"backdrop-filter":["","none",et,Ze]}],"backdrop-blur":[{"backdrop-blur":ge()}],"backdrop-brightness":[{"backdrop-brightness":[Ht,et,Ze]}],"backdrop-contrast":[{"backdrop-contrast":[Ht,et,Ze]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ht,et,Ze]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ht,et,Ze]}],"backdrop-invert":[{"backdrop-invert":["",Ht,et,Ze]}],"backdrop-opacity":[{"backdrop-opacity":[Ht,et,Ze]}],"backdrop-saturate":[{"backdrop-saturate":[Ht,et,Ze]}],"backdrop-sepia":[{"backdrop-sepia":["",Ht,et,Ze]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",et,Ze]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ht,"initial",et,Ze]}],ease:[{ease:["linear","initial",C,et,Ze]}],delay:[{delay:[Ht,et,Ze]}],animate:[{animate:["none",E,et,Ze]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,et,Ze]}],"perspective-origin":[{"perspective-origin":A()}],rotate:[{rotate:xe()}],"rotate-x":[{"rotate-x":xe()}],"rotate-y":[{"rotate-y":xe()}],"rotate-z":[{"rotate-z":xe()}],scale:[{scale:ie()}],"scale-x":[{"scale-x":ie()}],"scale-y":[{"scale-y":ie()}],"scale-z":[{"scale-z":ie()}],"scale-3d":["scale-3d"],skew:[{skew:we()}],"skew-x":[{"skew-x":we()}],"skew-y":[{"skew-y":we()}],transform:[{transform:[et,Ze,"","none","gpu","cpu"]}],"transform-origin":[{origin:A()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Pe()}],"translate-x":[{"translate-x":Pe()}],"translate-y":[{"translate-y":Pe()}],"translate-z":[{"translate-z":Pe()}],"translate-none":["translate-none"],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"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",et,Ze]}],"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":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mbs":[{"scroll-mbs":P()}],"scroll-mbe":[{"scroll-mbe":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pbs":[{"scroll-pbs":P()}],"scroll-pbe":[{"scroll-pbe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"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",et,Ze]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[Ht,Nh,zl,VA]}],stroke:[{stroke:["none",...I()]}],"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"]}},sq=jG(iq);function _e(...e){return sq(E5(e))}function sf(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function oq(e){return e.startsWith("chatId:")?e.slice(7):e}const xf="data-focus-fallback-ignore",H5="data-allow-focus-retain",fv="kanna:restore-chat-input-focus",sC="data-chat-input",pv="data-chat-selection-zone";function Kl(e,t){return!!(e!=null&&e.closest(`[${t}]`))}function $5(e){var n;const t=e;return t!=null&&t.matches?t.matches("input:not([type='checkbox']):not([type='radio']):not([type='button']):not([type='submit']):not([type='reset']), textarea, select")||t.isContentEditable||((n=t.getAttribute)==null?void 0:n.call(t,"role"))==="textbox"?!0:Kl(e,H5):!1}function aq(e){const t=e;return t!=null&&t.matches?$5(e)||(t.tabIndex??-1)>=0||t.matches("button, a[href], summary")?!0:Kl(e,H5):!1}function qA(e){return!!e.querySelector(`[${xf}][data-state='open']`)}function lq(e){return e?!e.isCollapsed&&e.toString().trim().length>0:!1}function cq(e,t){if(!e)return!1;const n=Array.from(t.querySelectorAll(`textarea[${sC}]`)).filter(o=>!o.disabled);if(n.length===0)return!1;const r=n.indexOf(e),i=r>=0?(r+1)%n.length:0,s=n[i];return s?(s.focus({preventScroll:!0}),!0):!1}function KA(e){const{activeElement:t,fallback:n,hasActiveOverlay:r}=e;if(!n||n.disabled||r||t===n)return"none";if(e.trigger==="escape")return e.defaultPrevented||Kl(t,sC)||e.canCancel?"none":"escape-focus";const{pointerStartTarget:i,pointerEndTarget:s,root:o,hasActiveSelection:l}=e,c=s??i;return!o||!c||!o.contains(c)||Kl(c,xf)||Kl(t,xf)||l&&(Kl(i,pv)||Kl(c,pv))||$5(t)?"none":t&&t===c?"restore":aq(t)?"none":"restore"}const Wo=hG,uq=fG,U5=_.forwardRef(({className:e,...t},n)=>m.jsx(w5,{ref:n,className:_e("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));U5.displayName=w5.displayName;const dq={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},oo=_.forwardRef(({className:e,children:t,size:n="md",...r},i)=>m.jsxs(uq,{children:[m.jsx(U5,{}),m.jsxs(C5,{ref:i,[xf]:"",onCloseAutoFocus:s=>{var o;s.preventDefault(),window.dispatchEvent(new Event(fv)),(o=r.onCloseAutoFocus)==null||o.call(r,s)},className:_e("fixed left-1/2 top-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-background shadow-xl 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%]","max-h-[85vh] flex flex-col",dq[n],e),...r,children:[t,m.jsxs(gG,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[m.jsx(Jo,{className:"h-4 w-4"}),m.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));oo.displayName=C5.displayName;function oC({className:e,...t}){return m.jsx("div",{className:_e("shrink-0 flex flex-col space-y-1.5 p-4 border-b border-border",e),...t})}function Go({className:e,...t}){return m.jsx(pG,{className:_e("text-lg font-medium leading-none tracking-tight",e),...t})}function vd({className:e,...t}){return m.jsx(mG,{className:_e("text-sm text-muted-foreground",e),...t})}function qo({className:e,...t}){return m.jsx("div",{className:_e("flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-3.5",e),...t})}function cl({className:e,...t}){return m.jsx("div",{className:_e("shrink-0 flex justify-end gap-2 border-t border-border bg-background p-2 rounded-b-xl",e),...t})}function hq({className:e,...t}){return m.jsx("button",{className:_e("touch-manipulation inline-flex items-center justify-center whitespace-nowrap cursor-pointer text-sm font-medium transition-colors","rounded-full h-9 px-4","bg-primary text-primary-foreground hover:bg-primary/90","disabled:pointer-events-none disabled:bg-primary/20 disabled:text-primary/60",e),...t})}function fq({className:e,...t}){return m.jsx("button",{className:_e("touch-manipulation inline-flex items-center justify-center whitespace-nowrap cursor-pointer text-sm font-medium transition-colors","rounded-full h-9 px-4","hover:bg-accent dark:hover:bg-card hover:text-accent-foreground text-muted-foreground","disabled:pointer-events-none disabled:text-muted-foreground/50",e),...t})}function pq({open:e,shareUrl:t,onOpenChange:n,onOpenLink:r,onCopyLink:i}){const[s,o]=_.useState(!1);_.useEffect(()=>{e||o(!1)},[e,t]);const l=async()=>{await i()&&(o(!0),window.setTimeout(()=>{o(!1)},2e3))};return m.jsx(Wo,{open:e,onOpenChange:n,children:m.jsxs(oo,{size:"md",children:[m.jsxs(oC,{children:[m.jsx(Go,{children:"Shared Link"}),m.jsx(vd,{children:"Shared links are snapshots in time and contain all attachments, tool calls and history. Be mindful of sensitive info."})]}),m.jsx(qo,{className:"space-y-3",children:m.jsxs("div",{className:"flex w-full items-center gap-2 rounded-2xl border border-border bg-muted/40 pl-4 px-3 py-2.5",children:[m.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-sm text-foreground",children:t}),m.jsx("button",{type:"button",onClick:()=>void l(),title:s?"Copied":"Copy link","aria-label":s?"Copied":"Copy link",className:"flex flex-shrink-0 items-center justify-center rounded-lg text-logo hover:text-logo/60 transition-colors hover:bg-background hover:text-foreground",children:s?m.jsx(ni,{className:"h-4 w-4 text-emerald-400"}):m.jsx(ll,{className:"h-4 w-4"})})]})}),m.jsx(cl,{children:m.jsxs(hq,{type:"button",onClick:r,children:[m.jsx(mb,{className:"mr-2 h-4 w-4"}),"Open"]})})]})})}const YA=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,XA=E5,mq=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return XA(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:s}=t,o=Object.keys(i).map(d=>{const f=n==null?void 0:n[d],h=s==null?void 0:s[d];if(f===null)return null;const g=YA(f)||YA(h);return i[d][g]}),l=n&&Object.entries(n).reduce((d,f)=>{let[h,g]=f;return g===void 0||(d[h]=g),d},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,f)=>{let{class:h,className:g,...v}=f;return Object.entries(v).every(y=>{let[x,w]=y;return Array.isArray(w)?w.includes({...s,...l}[x]):{...s,...l}[x]===w})?[...d,h,g]:d},[]);return XA(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},wb=mq("touch-manipulation inline-flex items-center justify-center whitespace-nowrap cursor-pointer rounded-md text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none",{variants:{variant:{default:"bg-primary text-primary-foreground disabled:bg-primary/50 disabled:text-primary-foreground/90 hover:bg-primary/90",juicy:"bg-logo text-primary-foreground disabled:text-primary-foreground/50 hover:bg-logo/90",destructive:"bg-destructive/80 dark:text-white",outline:"border disabled:bg-transparent disabled:text-foreground/50 border-inpu disabled:border-input/90 bg-card hover:bg-muted hover:text-accent-foreground",secondary:"bg-transparent border border-border text-secondary-foreground hover:text-secondary-foreground/60 disabled:text-secondary-foreground/50",ghost:"hover:bg-accent dark:hover:bg-card hover:text-accent-foreground text-muted-foreground disabled:text-muted-foreground/50 border border-border/0 hover:border-border",link:"text-primary disabled:text-primary/50 underline-offset-4 hover:underline",none:""},size:{default:"h-10 px-4 rounded-full py-2",sm:"h-9 rounded-full px-3",lg:"h-11 rounded-full px-8",icon:"h-9 w-9 rounded-full",none:"","icon-sm":"h-5.5 w-5.5 rounded-md"}},defaultVariants:{variant:"default",size:"default"}}),nt=_.forwardRef(({className:e,variant:t,size:n,...r},i)=>m.jsx("button",{className:_e(wb({variant:t,size:n,className:e})),ref:i,...r}));nt.displayName="Button";const Jr=_.forwardRef(({className:e,type:t,...n},r)=>m.jsx("input",{ref:r,type:t,className:_e("flex w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...n}));Jr.displayName="Input";const V5=_.createContext(null);function gq({children:e}){const[t,n]=_.useState(null),[r,i]=_.useState(""),s=_.useRef(null);_.useEffect(()=>{(t==null?void 0:t.kind)==="prompt"&&(i(t.options.initialValue??""),setTimeout(()=>{var v,y;(v=s.current)==null||v.focus(),(y=s.current)==null||y.select()},0))},[t]);const o=_.useCallback(()=>{n(null),i("")},[]),l=_.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!1):t.kind==="prompt"?t.resolve(null):t.resolve(),o())},[o,t]),c=_.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!0):t.kind==="prompt"?t.resolve(r.trim()||null):t.resolve(),o())},[o,t,r]),d=_.useCallback(v=>new Promise(y=>{n({kind:"confirm",options:v,resolve:y})}),[]),f=_.useCallback(v=>new Promise(y=>{n({kind:"prompt",options:v,resolve:y})}),[]),h=_.useCallback(v=>new Promise(y=>{n({kind:"alert",options:v,resolve:y})}),[]),g=_.useMemo(()=>({confirm:d,prompt:f,alert:h}),[h,d,f]);return m.jsxs(V5.Provider,{value:g,children:[e,m.jsx(Wo,{open:t!==null,onOpenChange:v=>{v||!t||l()},children:m.jsx(oo,{size:"sm",onKeyDown:v=>{v.key!=="Enter"||v.shiftKey||!t||t.kind!=="confirm"||(v.preventDefault(),c())},children:t?m.jsxs(m.Fragment,{children:[m.jsxs(qo,{className:"space-y-4",children:[m.jsx(Go,{children:t.options.title}),t.options.description?m.jsx(vd,{children:t.options.description}):null,t.kind==="prompt"?m.jsx(Jr,{ref:s,type:"text",value:r,onChange:v=>i(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),c())},placeholder:t.options.placeholder}):null]}),m.jsxs(cl,{children:[m.jsx(nt,{variant:"ghost",size:"sm",onClick:l,className:t.kind==="alert"?"hidden":void 0,children:"cancelLabel"in t.options?t.options.cancelLabel??"Cancel":"Cancel"}),m.jsx(nt,{variant:t.kind==="confirm"?t.options.confirmVariant??"default":"secondary",size:"sm",onClick:c,disabled:t.kind==="prompt"&&!r.trim(),children:t.kind==="alert"?t.options.closeLabel??"OK":"confirmLabel"in t.options?t.options.confirmLabel??"Confirm":"Confirm"})]})]}):null})})]})}function aC(){const e=_.useContext(V5);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const lC=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:_e("bg-card text-card-foreground",e),...t}));lC.displayName="Card";const cC=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:_e("flex flex-col space-y-1.5 p-2",e),...t}));cC.displayName="CardHeader";const W5=_.forwardRef(({className:e,...t},n)=>m.jsx("h3",{ref:n,className:_e("text-2xl font-semibold leading-none tracking-tight",e),...t}));W5.displayName="CardTitle";const G5=_.forwardRef(({className:e,...t},n)=>m.jsx("p",{ref:n,className:_e("text-sm text-muted-foreground",e),...t}));G5.displayName="CardDescription";const uC=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:_e("p-6 pt-0",e),...t}));uC.displayName="CardContent";const vq=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:_e("flex items-center p-6 pt-0",e),...t}));vq.displayName="CardFooter";const bq=["top","right","bottom","left"],ul=Math.min,Oi=Math.max,mv=Math.round,Wm=Math.floor,ro=e=>({x:e,y:e}),_q={left:"right",right:"left",bottom:"top",top:"bottom"};function MS(e,t,n){return Oi(e,ul(t,n))}function Ko(e,t){return typeof e=="function"?e(t):e}function Yo(e){return e.split("-")[0]}function bd(e){return e.split("-")[1]}function dC(e){return e==="x"?"y":"x"}function hC(e){return e==="y"?"height":"width"}function Zs(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function fC(e){return dC(Zs(e))}function yq(e,t,n){n===void 0&&(n=!1);const r=bd(e),i=fC(e),s=hC(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=gv(o)),[o,gv(o)]}function xq(e){const t=gv(e);return[LS(e),t,LS(t)]}function LS(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const QA=["left","right"],ZA=["right","left"],Sq=["top","bottom"],wq=["bottom","top"];function Cq(e,t,n){switch(e){case"top":case"bottom":return n?t?ZA:QA:t?QA:ZA;case"left":case"right":return t?Sq:wq;default:return[]}}function kq(e,t,n,r){const i=bd(e);let s=Cq(Yo(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(LS)))),s}function gv(e){const t=Yo(e);return _q[t]+e.slice(t.length)}function Eq(e){return{top:0,right:0,bottom:0,left:0,...e}}function q5(e){return typeof e!="number"?Eq(e):{top:e,right:e,bottom:e,left:e}}function vv(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function JA(e,t,n){let{reference:r,floating:i}=e;const s=Zs(t),o=fC(t),l=hC(o),c=Yo(t),d=s==="y",f=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,g=r[l]/2-i[l]/2;let v;switch(c){case"top":v={x:f,y:r.y-i.height};break;case"bottom":v={x:f,y:r.y+r.height};break;case"right":v={x:r.x+r.width,y:h};break;case"left":v={x:r.x-i.width,y:h};break;default:v={x:r.x,y:r.y}}switch(bd(t)){case"start":v[o]-=g*(n&&d?-1:1);break;case"end":v[o]+=g*(n&&d?-1:1);break}return v}async function Rq(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:o,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:g=!1,padding:v=0}=Ko(t,e),y=q5(v),w=l[g?h==="floating"?"reference":"floating":h],C=vv(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:f,strategy:c})),E=h==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,R=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),T=await(s.isElement==null?void 0:s.isElement(R))?await(s.getScale==null?void 0:s.getScale(R))||{x:1,y:1}:{x:1,y:1},A=vv(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:E,offsetParent:R,strategy:c}):E);return{top:(C.top-A.top+y.top)/T.y,bottom:(A.bottom-C.bottom+y.bottom)/T.y,left:(C.left-A.left+y.left)/T.x,right:(A.right-C.right+y.right)/T.x}}const Tq=50,Aq=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:Rq},c=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:f,y:h}=JA(d,r,c),g=r,v=0;const y={};for(let x=0;x<s.length;x++){const w=s[x];if(!w)continue;const{name:C,fn:E}=w,{x:R,y:T,data:A,reset:N}=await E({x:f,y:h,initialPlacement:r,placement:g,strategy:i,middlewareData:y,rects:d,platform:l,elements:{reference:e,floating:t}});f=R??f,h=T??h,y[C]={...y[C],...A},N&&v<Tq&&(v++,typeof N=="object"&&(N.placement&&(g=N.placement),N.rects&&(d=N.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):N.rects),{x:f,y:h}=JA(d,g,c)),x=-1)}return{x:f,y:h,placement:g,strategy:i,middlewareData:y}},Nq=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:o,elements:l,middlewareData:c}=t,{element:d,padding:f=0}=Ko(e,t)||{};if(d==null)return{};const h=q5(f),g={x:n,y:r},v=fC(i),y=hC(v),x=await o.getDimensions(d),w=v==="y",C=w?"top":"left",E=w?"bottom":"right",R=w?"clientHeight":"clientWidth",T=s.reference[y]+s.reference[v]-g[v]-s.floating[y],A=g[v]-s.reference[v],N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let M=N?N[R]:0;(!M||!await(o.isElement==null?void 0:o.isElement(N)))&&(M=l.floating[R]||s.floating[y]);const P=T/2-A/2,q=M/2-x[y]/2-1,j=ul(h[C],q),$=ul(h[E],q),F=j,O=M-x[y]-$,B=M/2-x[y]/2+P,H=MS(F,B,O),z=!c.arrow&&bd(i)!=null&&B!==H&&s.reference[y]/2-(B<F?j:$)-x[y]/2<0,W=z?B<F?B-F:B-O:0;return{[v]:g[v]+W,data:{[v]:H,centerOffset:B-H-W,...z&&{alignmentOffset:W}},reset:z}}}),Mq=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:x=!0,...w}=Ko(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const C=Yo(i),E=Zs(l),R=Yo(l)===l,T=await(c.isRTL==null?void 0:c.isRTL(d.floating)),A=g||(R||!x?[gv(l)]:xq(l)),N=y!=="none";!g&&N&&A.push(...kq(l,x,y,T));const M=[l,...A],P=await c.detectOverflow(t,w),q=[];let j=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&q.push(P[C]),h){const B=yq(i,o,T);q.push(P[B[0]],P[B[1]])}if(j=[...j,{placement:i,overflows:q}],!q.every(B=>B<=0)){var $,F;const B=((($=s.flip)==null?void 0:$.index)||0)+1,H=M[B];if(H&&(!(h==="alignment"?E!==Zs(H):!1)||j.every(U=>Zs(U.placement)===E?U.overflows[0]>0:!0)))return{data:{index:B,overflows:j},reset:{placement:H}};let z=(F=j.filter(W=>W.overflows[0]<=0).sort((W,U)=>W.overflows[1]-U.overflows[1])[0])==null?void 0:F.placement;if(!z)switch(v){case"bestFit":{var O;const W=(O=j.filter(U=>{if(N){const Y=Zs(U.placement);return Y===E||Y==="y"}return!0}).map(U=>[U.placement,U.overflows.filter(Y=>Y>0).reduce((Y,I)=>Y+I,0)]).sort((U,Y)=>U[1]-Y[1])[0])==null?void 0:O[0];W&&(z=W);break}case"initialPlacement":z=l;break}if(i!==z)return{reset:{placement:z}}}return{}}}};function eN(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function tN(e){return bq.some(t=>e[t]>=0)}const Lq=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=Ko(e,t);switch(i){case"referenceHidden":{const o=await r.detectOverflow(t,{...s,elementContext:"reference"}),l=eN(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:tN(l)}}}case"escaped":{const o=await r.detectOverflow(t,{...s,altBoundary:!0}),l=eN(o,n.floating);return{data:{escapedOffsets:l,escaped:tN(l)}}}default:return{}}}}},K5=new Set(["left","top"]);async function Dq(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Yo(n),l=bd(n),c=Zs(n)==="y",d=K5.has(o)?-1:1,f=s&&c?-1:1,h=Ko(t,e);let{mainAxis:g,crossAxis:v,alignmentAxis:y}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof y=="number"&&(v=l==="end"?y*-1:y),c?{x:v*f,y:g*d}:{x:g*d,y:v*f}}const Iq=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:l}=t,c=await Dq(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:o}}}}},Pq=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:c={fn:C=>{let{x:E,y:R}=C;return{x:E,y:R}}},...d}=Ko(e,t),f={x:n,y:r},h=await s.detectOverflow(t,d),g=Zs(Yo(i)),v=dC(g);let y=f[v],x=f[g];if(o){const C=v==="y"?"top":"left",E=v==="y"?"bottom":"right",R=y+h[C],T=y-h[E];y=MS(R,y,T)}if(l){const C=g==="y"?"top":"left",E=g==="y"?"bottom":"right",R=x+h[C],T=x-h[E];x=MS(R,x,T)}const w=c.fn({...t,[v]:y,[g]:x});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[v]:o,[g]:l}}}}}},Oq=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=Ko(e,t),f={x:n,y:r},h=Zs(i),g=dC(h);let v=f[g],y=f[h];const x=Ko(l,t),w=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(c){const R=g==="y"?"height":"width",T=s.reference[g]-s.floating[R]+w.mainAxis,A=s.reference[g]+s.reference[R]-w.mainAxis;v<T?v=T:v>A&&(v=A)}if(d){var C,E;const R=g==="y"?"width":"height",T=K5.has(Yo(i)),A=s.reference[h]-s.floating[R]+(T&&((C=o.offset)==null?void 0:C[h])||0)+(T?0:w.crossAxis),N=s.reference[h]+s.reference[R]+(T?0:((E=o.offset)==null?void 0:E[h])||0)-(T?w.crossAxis:0);y<A?y=A:y>N&&(y=N)}return{[g]:v,[h]:y}}}},jq=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:s,platform:o,elements:l}=t,{apply:c=()=>{},...d}=Ko(e,t),f=await o.detectOverflow(t,d),h=Yo(i),g=bd(i),v=Zs(i)==="y",{width:y,height:x}=s.floating;let w,C;h==="top"||h==="bottom"?(w=h,C=g===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(C=h,w=g==="end"?"top":"bottom");const E=x-f.top-f.bottom,R=y-f.left-f.right,T=ul(x-f[w],E),A=ul(y-f[C],R),N=!t.middlewareData.shift;let M=T,P=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=R),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(M=E),N&&!g){const j=Oi(f.left,0),$=Oi(f.right,0),F=Oi(f.top,0),O=Oi(f.bottom,0);v?P=y-2*(j!==0||$!==0?j+$:Oi(f.left,f.right)):M=x-2*(F!==0||O!==0?F+O:Oi(f.top,f.bottom))}await c({...t,availableWidth:P,availableHeight:M});const q=await o.getDimensions(l.floating);return y!==q.width||x!==q.height?{reset:{rects:!0}}:{}}}};function Cb(){return typeof window<"u"}function _d(e){return Y5(e)?(e.nodeName||"").toLowerCase():"#document"}function ji(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function co(e){var t;return(t=(Y5(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Y5(e){return Cb()?e instanceof Node||e instanceof ji(e).Node:!1}function Ds(e){return Cb()?e instanceof Element||e instanceof ji(e).Element:!1}function ta(e){return Cb()?e instanceof HTMLElement||e instanceof ji(e).HTMLElement:!1}function nN(e){return!Cb()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ji(e).ShadowRoot}function np(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Is(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function zq(e){return/^(table|td|th)$/.test(_d(e))}function kb(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Bq=/transform|translate|scale|rotate|perspective|filter/,Fq=/paint|layout|strict|content/,Bl=e=>!!e&&e!=="none";let Uy;function pC(e){const t=Ds(e)?Is(e):e;return Bl(t.transform)||Bl(t.translate)||Bl(t.scale)||Bl(t.rotate)||Bl(t.perspective)||!mC()&&(Bl(t.backdropFilter)||Bl(t.filter))||Bq.test(t.willChange||"")||Fq.test(t.contain||"")}function Hq(e){let t=dl(e);for(;ta(t)&&!Xu(t);){if(pC(t))return t;if(kb(t))return null;t=dl(t)}return null}function mC(){return Uy==null&&(Uy=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Uy}function Xu(e){return/^(html|body|#document)$/.test(_d(e))}function Is(e){return ji(e).getComputedStyle(e)}function Eb(e){return Ds(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function dl(e){if(_d(e)==="html")return e;const t=e.assignedSlot||e.parentNode||nN(e)&&e.host||co(e);return nN(t)?t.host:t}function X5(e){const t=dl(e);return Xu(t)?e.ownerDocument?e.ownerDocument.body:e.body:ta(t)&&np(t)?t:X5(t)}function Sf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=X5(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=ji(i);if(s){const l=DS(o);return t.concat(o,o.visualViewport||[],np(i)?i:[],l&&n?Sf(l):[])}else return t.concat(i,Sf(i,[],n))}function DS(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Q5(e){const t=Is(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=ta(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,l=mv(n)!==s||mv(r)!==o;return l&&(n=s,r=o),{width:n,height:r,$:l}}function gC(e){return Ds(e)?e:e.contextElement}function zu(e){const t=gC(e);if(!ta(t))return ro(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=Q5(t);let o=(s?mv(n.width):n.width)/r,l=(s?mv(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const $q=ro(0);function Z5(e){const t=ji(e);return!mC()||!t.visualViewport?$q:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Uq(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ji(e)?!1:t}function uc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=gC(e);let o=ro(1);t&&(r?Ds(r)&&(o=zu(r)):o=zu(e));const l=Uq(s,n,r)?Z5(s):ro(0);let c=(i.left+l.x)/o.x,d=(i.top+l.y)/o.y,f=i.width/o.x,h=i.height/o.y;if(s){const g=ji(s),v=r&&Ds(r)?ji(r):r;let y=g,x=DS(y);for(;x&&r&&v!==y;){const w=zu(x),C=x.getBoundingClientRect(),E=Is(x),R=C.left+(x.clientLeft+parseFloat(E.paddingLeft))*w.x,T=C.top+(x.clientTop+parseFloat(E.paddingTop))*w.y;c*=w.x,d*=w.y,f*=w.x,h*=w.y,c+=R,d+=T,y=ji(x),x=DS(y)}}return vv({width:f,height:h,x:c,y:d})}function Rb(e,t){const n=Eb(e).scrollLeft;return t?t.left+n:uc(co(e)).left+n}function J5(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Rb(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function Vq(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=co(r),l=t?kb(t.floating):!1;if(r===o||l&&s)return n;let c={scrollLeft:0,scrollTop:0},d=ro(1);const f=ro(0),h=ta(r);if((h||!h&&!s)&&((_d(r)!=="body"||np(o))&&(c=Eb(r)),h)){const v=uc(r);d=zu(r),f.x=v.x+r.clientLeft,f.y=v.y+r.clientTop}const g=o&&!h&&!s?J5(o,c):ro(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+f.x+g.x,y:n.y*d.y-c.scrollTop*d.y+f.y+g.y}}function Wq(e){return Array.from(e.getClientRects())}function Gq(e){const t=co(e),n=Eb(e),r=e.ownerDocument.body,i=Oi(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Oi(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Rb(e);const l=-n.scrollTop;return Is(r).direction==="rtl"&&(o+=Oi(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}const rN=25;function qq(e,t){const n=ji(e),r=co(e),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,l=0,c=0;if(i){s=i.width,o=i.height;const f=mC();(!f||f&&t==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}const d=Rb(r);if(d<=0){const f=r.ownerDocument,h=f.body,g=getComputedStyle(h),v=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,y=Math.abs(r.clientWidth-h.clientWidth-v);y<=rN&&(s-=y)}else d<=rN&&(s+=d);return{width:s,height:o,x:l,y:c}}function Kq(e,t){const n=uc(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=ta(e)?zu(e):ro(1),o=e.clientWidth*s.x,l=e.clientHeight*s.y,c=i*s.x,d=r*s.y;return{width:o,height:l,x:c,y:d}}function iN(e,t,n){let r;if(t==="viewport")r=qq(e,n);else if(t==="document")r=Gq(co(e));else if(Ds(t))r=Kq(t,n);else{const i=Z5(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return vv(r)}function eO(e,t){const n=dl(e);return n===t||!Ds(n)||Xu(n)?!1:Is(n).position==="fixed"||eO(n,t)}function Yq(e,t){const n=t.get(e);if(n)return n;let r=Sf(e,[],!1).filter(l=>Ds(l)&&_d(l)!=="body"),i=null;const s=Is(e).position==="fixed";let o=s?dl(e):e;for(;Ds(o)&&!Xu(o);){const l=Is(o),c=pC(o);!c&&l.position==="fixed"&&(i=null),(s?!c&&!i:!c&&l.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||np(o)&&!c&&eO(e,o))?r=r.filter(f=>f!==o):i=l,o=dl(o)}return t.set(e,r),r}function Xq(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?kb(t)?[]:Yq(t,this._c):[].concat(n),r],l=iN(t,o[0],i);let c=l.top,d=l.right,f=l.bottom,h=l.left;for(let g=1;g<o.length;g++){const v=iN(t,o[g],i);c=Oi(v.top,c),d=ul(v.right,d),f=ul(v.bottom,f),h=Oi(v.left,h)}return{width:d-h,height:f-c,x:h,y:c}}function Qq(e){const{width:t,height:n}=Q5(e);return{width:t,height:n}}function Zq(e,t,n){const r=ta(t),i=co(t),s=n==="fixed",o=uc(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=ro(0);function d(){c.x=Rb(i)}if(r||!r&&!s)if((_d(t)!=="body"||np(i))&&(l=Eb(t)),r){const v=uc(t,!0,s,t);c.x=v.x+t.clientLeft,c.y=v.y+t.clientTop}else i&&d();s&&!r&&i&&d();const f=i&&!r&&!s?J5(i,l):ro(0),h=o.left+l.scrollLeft-c.x-f.x,g=o.top+l.scrollTop-c.y-f.y;return{x:h,y:g,width:o.width,height:o.height}}function Vy(e){return Is(e).position==="static"}function sN(e,t){if(!ta(e)||Is(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return co(e)===n&&(n=n.ownerDocument.body),n}function tO(e,t){const n=ji(e);if(kb(e))return n;if(!ta(e)){let i=dl(e);for(;i&&!Xu(i);){if(Ds(i)&&!Vy(i))return i;i=dl(i)}return n}let r=sN(e,t);for(;r&&zq(r)&&Vy(r);)r=sN(r,t);return r&&Xu(r)&&Vy(r)&&!pC(r)?n:r||Hq(e)||n}const Jq=async function(e){const t=this.getOffsetParent||tO,n=this.getDimensions,r=await n(e.floating);return{reference:Zq(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function eK(e){return Is(e).direction==="rtl"}const tK={convertOffsetParentRelativeRectToViewportRelativeRect:Vq,getDocumentElement:co,getClippingRect:Xq,getOffsetParent:tO,getElementRects:Jq,getClientRects:Wq,getDimensions:Qq,getScale:zu,isElement:Ds,isRTL:eK};function nO(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function nK(e,t){let n=null,r;const i=co(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const d=e.getBoundingClientRect(),{left:f,top:h,width:g,height:v}=d;if(l||t(),!g||!v)return;const y=Wm(h),x=Wm(i.clientWidth-(f+g)),w=Wm(i.clientHeight-(h+v)),C=Wm(f),R={rootMargin:-y+"px "+-x+"px "+-w+"px "+-C+"px",threshold:Oi(0,ul(1,c))||1};let T=!0;function A(N){const M=N[0].intersectionRatio;if(M!==c){if(!T)return o();M?o(!1,M):r=setTimeout(()=>{o(!1,1e-7)},1e3)}M===1&&!nO(d,e.getBoundingClientRect())&&o(),T=!1}try{n=new IntersectionObserver(A,{...R,root:i.ownerDocument})}catch{n=new IntersectionObserver(A,R)}n.observe(e)}return o(!0),s}function rK(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=gC(e),f=i||s?[...d?Sf(d):[],...t?Sf(t):[]]:[];f.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const h=d&&l?nK(d,n):null;let g=-1,v=null;o&&(v=new ResizeObserver(C=>{let[E]=C;E&&E.target===d&&v&&t&&(v.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var R;(R=v)==null||R.observe(t)})),n()}),d&&!c&&v.observe(d),t&&v.observe(t));let y,x=c?uc(e):null;c&&w();function w(){const C=uc(e);x&&!nO(x,C)&&n(),x=C,y=requestAnimationFrame(w)}return n(),()=>{var C;f.forEach(E=>{i&&E.removeEventListener("scroll",n),s&&E.removeEventListener("resize",n)}),h==null||h(),(C=v)==null||C.disconnect(),v=null,c&&cancelAnimationFrame(y)}}const iK=Iq,sK=Pq,oK=Mq,aK=jq,lK=Lq,oN=Nq,cK=Oq,uK=(e,t,n)=>{const r=new Map,i={platform:tK,...n},s={...i.platform,_c:r};return Aq(e,t,{...i,platform:s})};var dK=typeof document<"u",hK=function(){},Fg=dK?_.useLayoutEffect:hK;function bv(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!bv(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!bv(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function rO(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function aN(e,t){const n=rO(e);return Math.round(t*n)/n}function Wy(e){const t=_.useRef(e);return Fg(()=>{t.current=e}),t}function fK(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[f,h]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,v]=_.useState(r);bv(g,r)||v(r);const[y,x]=_.useState(null),[w,C]=_.useState(null),E=_.useCallback(U=>{U!==N.current&&(N.current=U,x(U))},[]),R=_.useCallback(U=>{U!==M.current&&(M.current=U,C(U))},[]),T=s||y,A=o||w,N=_.useRef(null),M=_.useRef(null),P=_.useRef(f),q=c!=null,j=Wy(c),$=Wy(i),F=Wy(d),O=_.useCallback(()=>{if(!N.current||!M.current)return;const U={placement:t,strategy:n,middleware:g};$.current&&(U.platform=$.current),uK(N.current,M.current,U).then(Y=>{const I={...Y,isPositioned:F.current!==!1};B.current&&!bv(P.current,I)&&(P.current=I,us.flushSync(()=>{h(I)}))})},[g,t,n,$,F]);Fg(()=>{d===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,h(U=>({...U,isPositioned:!1})))},[d]);const B=_.useRef(!1);Fg(()=>(B.current=!0,()=>{B.current=!1}),[]),Fg(()=>{if(T&&(N.current=T),A&&(M.current=A),T&&A){if(j.current)return j.current(T,A,O);O()}},[T,A,O,j,q]);const H=_.useMemo(()=>({reference:N,floating:M,setReference:E,setFloating:R}),[E,R]),z=_.useMemo(()=>({reference:T,floating:A}),[T,A]),W=_.useMemo(()=>{const U={position:n,left:0,top:0};if(!z.floating)return U;const Y=aN(z.floating,f.x),I=aN(z.floating,f.y);return l?{...U,transform:"translate("+Y+"px, "+I+"px)",...rO(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Y,top:I}},[n,l,z.floating,f.x,f.y]);return _.useMemo(()=>({...f,update:O,refs:H,elements:z,floatingStyles:W}),[f,O,H,z,W])}const pK=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?oN({element:r.current,padding:i}).fn(n):{}:r?oN({element:r,padding:i}).fn(n):{}}}},mK=(e,t)=>{const n=iK(e);return{name:n.name,fn:n.fn,options:[e,t]}},gK=(e,t)=>{const n=sK(e);return{name:n.name,fn:n.fn,options:[e,t]}},vK=(e,t)=>({fn:cK(e).fn,options:[e,t]}),bK=(e,t)=>{const n=oK(e);return{name:n.name,fn:n.fn,options:[e,t]}},_K=(e,t)=>{const n=aK(e);return{name:n.name,fn:n.fn,options:[e,t]}},yK=(e,t)=>{const n=lK(e);return{name:n.name,fn:n.fn,options:[e,t]}},xK=(e,t)=>{const n=pK(e);return{name:n.name,fn:n.fn,options:[e,t]}};var SK="Arrow",iO=_.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return m.jsx(Yt.svg,{...s,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:m.jsx("polygon",{points:"0,0 30,0 15,10"})})});iO.displayName=SK;var wK=iO;function CK(e){const[t,n]=_.useState(void 0);return Ur(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,l;if("borderBoxSize"in s){const c=s.borderBoxSize,d=Array.isArray(c)?c[0]:c;o=d.inlineSize,l=d.blockSize}else o=e.offsetWidth,l=e.offsetHeight;n({width:o,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var vC="Popper",[sO,ml]=ea(vC),[kK,oO]=sO(vC),aO=e=>{const{__scopePopper:t,children:n}=e,[r,i]=_.useState(null);return m.jsx(kK,{scope:t,anchor:r,onAnchorChange:i,children:n})};aO.displayName=vC;var lO="PopperAnchor",cO=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=oO(lO,n),o=_.useRef(null),l=hn(t,o),c=_.useRef(null);return _.useEffect(()=>{const d=c.current;c.current=(r==null?void 0:r.current)||o.current,d!==c.current&&s.onAnchorChange(c.current)}),r?null:m.jsx(Yt.div,{...i,ref:l})});cO.displayName=lO;var bC="PopperContent",[EK,RK]=sO(bC),uO=_.forwardRef((e,t)=>{var oe,me,ue,ge,xe,ie;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:g=!1,updatePositionStrategy:v="optimized",onPlaced:y,...x}=e,w=oO(bC,n),[C,E]=_.useState(null),R=hn(t,we=>E(we)),[T,A]=_.useState(null),N=CK(T),M=(N==null?void 0:N.width)??0,P=(N==null?void 0:N.height)??0,q=r+(s!=="center"?"-"+s:""),j=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},$=Array.isArray(d)?d:[d],F=$.length>0,O={padding:j,boundary:$.filter(AK),altBoundary:F},{refs:B,floatingStyles:H,placement:z,isPositioned:W,middlewareData:U}=fK({strategy:"fixed",placement:q,whileElementsMounted:(...we)=>rK(...we,{animationFrame:v==="always"}),elements:{reference:w.anchor},middleware:[mK({mainAxis:i+P,alignmentAxis:o}),c&&gK({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?vK():void 0,...O}),c&&bK({...O}),_K({...O,apply:({elements:we,rects:Pe,availableWidth:Ue,availableHeight:ht})=>{const{width:ft,height:wt}=Pe.reference,jt=we.floating.style;jt.setProperty("--radix-popper-available-width",`${Ue}px`),jt.setProperty("--radix-popper-available-height",`${ht}px`),jt.setProperty("--radix-popper-anchor-width",`${ft}px`),jt.setProperty("--radix-popper-anchor-height",`${wt}px`)}}),T&&xK({element:T,padding:l}),NK({arrowWidth:M,arrowHeight:P}),g&&yK({strategy:"referenceHidden",...O})]}),[Y,I]=fO(z),V=Ls(y);Ur(()=>{W&&(V==null||V())},[W,V]);const X=(oe=U.arrow)==null?void 0:oe.x,D=(me=U.arrow)==null?void 0:me.y,re=((ue=U.arrow)==null?void 0:ue.centerOffset)!==0,[ne,se]=_.useState();return Ur(()=>{C&&se(window.getComputedStyle(C).zIndex)},[C]),m.jsx("div",{ref:B.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:W?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ne,"--radix-popper-transform-origin":[(ge=U.transformOrigin)==null?void 0:ge.x,(xe=U.transformOrigin)==null?void 0:xe.y].join(" "),...((ie=U.hide)==null?void 0:ie.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:m.jsx(EK,{scope:n,placedSide:Y,onArrowChange:A,arrowX:X,arrowY:D,shouldHideArrow:re,children:m.jsx(Yt.div,{"data-side":Y,"data-align":I,...x,ref:R,style:{...x.style,animation:W?void 0:"none"}})})})});uO.displayName=bC;var dO="PopperArrow",TK={top:"bottom",right:"left",bottom:"top",left:"right"},hO=_.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=RK(dO,r),o=TK[s.placedSide];return m.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:m.jsx(wK,{...i,ref:n,style:{...i.style,display:"block"}})})});hO.displayName=dO;function AK(e){return e!==null}var NK=e=>({name:"transformOrigin",options:e,fn(t){var w,C,E;const{placement:n,rects:r,middlewareData:i}=t,o=((w=i.arrow)==null?void 0:w.centerOffset)!==0,l=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[d,f]=fO(n),h={start:"0%",center:"50%",end:"100%"}[f],g=(((C=i.arrow)==null?void 0:C.x)??0)+l/2,v=(((E=i.arrow)==null?void 0:E.y)??0)+c/2;let y="",x="";return d==="bottom"?(y=o?h:`${g}px`,x=`${-c}px`):d==="top"?(y=o?h:`${g}px`,x=`${r.floating.height+c}px`):d==="right"?(y=`${-c}px`,x=o?h:`${v}px`):d==="left"&&(y=`${r.floating.width+c}px`,x=o?h:`${v}px`),{data:{x:y,y:x}}}});function fO(e){const[t,n="center"]=e.split("-");return[t,n]}var Tb=aO,rp=cO,Ab=uO,Nb=hO,pO=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),MK="VisuallyHidden",mO=_.forwardRef((e,t)=>m.jsx(Yt.span,{...e,ref:t,style:{...pO,...e.style}}));mO.displayName=MK;var LK=mO,[Mb]=ea("Tooltip",[ml]),Lb=ml(),gO="TooltipProvider",DK=700,IS="tooltip.open",[IK,_C]=Mb(gO),vO=e=>{const{__scopeTooltip:t,delayDuration:n=DK,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=e,o=_.useRef(!0),l=_.useRef(!1),c=_.useRef(0);return _.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),m.jsx(IK,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:_.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:_.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:_.useCallback(d=>{l.current=d},[]),disableHoverableContent:i,children:s})};vO.displayName=gO;var wf="Tooltip",[PK,ip]=Mb(wf),bO=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:l}=e,c=_C(wf,e.__scopeTooltip),d=Lb(t),[f,h]=_.useState(null),g=Ho(),v=_.useRef(0),y=o??c.disableHoverableContent,x=l??c.delayDuration,w=_.useRef(!1),[C,E]=Yu({prop:r,defaultProp:i??!1,onChange:M=>{M?(c.onOpen(),document.dispatchEvent(new CustomEvent(IS))):c.onClose(),s==null||s(M)},caller:wf}),R=_.useMemo(()=>C?w.current?"delayed-open":"instant-open":"closed",[C]),T=_.useCallback(()=>{window.clearTimeout(v.current),v.current=0,w.current=!1,E(!0)},[E]),A=_.useCallback(()=>{window.clearTimeout(v.current),v.current=0,E(!1)},[E]),N=_.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{w.current=!0,E(!0),v.current=0},x)},[x,E]);return _.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),m.jsx(Tb,{...d,children:m.jsx(PK,{scope:t,contentId:g,open:C,stateAttribute:R,trigger:f,onTriggerChange:h,onTriggerEnter:_.useCallback(()=>{c.isOpenDelayedRef.current?N():T()},[c.isOpenDelayedRef,N,T]),onTriggerLeave:_.useCallback(()=>{y?A():(window.clearTimeout(v.current),v.current=0)},[A,y]),onOpen:T,onClose:A,disableHoverableContent:y,children:n})})};bO.displayName=wf;var PS="TooltipTrigger",_O=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=ip(PS,n),s=_C(PS,n),o=Lb(n),l=_.useRef(null),c=hn(t,l,i.onTriggerChange),d=_.useRef(!1),f=_.useRef(!1),h=_.useCallback(()=>d.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),m.jsx(rp,{asChild:!0,...o,children:m.jsx(Yt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:Ke(e.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:Ke(e.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:Ke(e.onPointerDown,()=>{i.open&&i.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Ke(e.onFocus,()=>{d.current||i.onOpen()}),onBlur:Ke(e.onBlur,i.onClose),onClick:Ke(e.onClick,i.onClose)})})});_O.displayName=PS;var yC="TooltipPortal",[OK,jK]=Mb(yC,{forceMount:void 0}),yO=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,s=ip(yC,t);return m.jsx(OK,{scope:t,forceMount:n,children:m.jsx(vs,{present:n||s.open,children:m.jsx(gd,{asChild:!0,container:i,children:r})})})};yO.displayName=yC;var Qu="TooltipContent",xO=_.forwardRef((e,t)=>{const n=jK(Qu,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=e,o=ip(Qu,e.__scopeTooltip);return m.jsx(vs,{present:r||o.open,children:o.disableHoverableContent?m.jsx(SO,{side:i,...s,ref:t}):m.jsx(zK,{side:i,...s,ref:t})})}),zK=_.forwardRef((e,t)=>{const n=ip(Qu,e.__scopeTooltip),r=_C(Qu,e.__scopeTooltip),i=_.useRef(null),s=hn(t,i),[o,l]=_.useState(null),{trigger:c,onClose:d}=n,f=i.current,{onPointerInTransitChange:h}=r,g=_.useCallback(()=>{l(null),h(!1)},[h]),v=_.useCallback((y,x)=>{const w=y.currentTarget,C={x:y.clientX,y:y.clientY},E=UK(C,w.getBoundingClientRect()),R=VK(C,E),T=WK(x.getBoundingClientRect()),A=qK([...R,...T]);l(A),h(!0)},[h]);return _.useEffect(()=>()=>g(),[g]),_.useEffect(()=>{if(c&&f){const y=w=>v(w,f),x=w=>v(w,c);return c.addEventListener("pointerleave",y),f.addEventListener("pointerleave",x),()=>{c.removeEventListener("pointerleave",y),f.removeEventListener("pointerleave",x)}}},[c,f,v,g]),_.useEffect(()=>{if(o){const y=x=>{const w=x.target,C={x:x.clientX,y:x.clientY},E=(c==null?void 0:c.contains(w))||(f==null?void 0:f.contains(w)),R=!GK(C,o);E?g():R&&(g(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,f,o,d,g]),m.jsx(SO,{...e,ref:s})}),[BK,FK]=Mb(wf,{isInside:!1}),HK=qV("TooltipContent"),SO=_.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...l}=e,c=ip(Qu,n),d=Lb(n),{onClose:f}=c;return _.useEffect(()=>(document.addEventListener(IS,f),()=>document.removeEventListener(IS,f)),[f]),_.useEffect(()=>{if(c.trigger){const h=g=>{const v=g.target;v!=null&&v.contains(c.trigger)&&f()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,f]),m.jsx(md,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:m.jsxs(Ab,{"data-state":c.stateAttribute,...d,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[m.jsx(HK,{children:r}),m.jsx(BK,{scope:n,isInside:!0,children:m.jsx(LK,{id:c.contentId,role:"tooltip",children:i||r})})]})})});xO.displayName=Qu;var wO="TooltipArrow",$K=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Lb(n);return FK(wO,n).isInside?null:m.jsx(Nb,{...i,...r,ref:t})});$K.displayName=wO;function UK(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function VK(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function WK(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function GK(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const l=t[s],c=t[o],d=l.x,f=l.y,h=c.x,g=c.y;f>r!=g>r&&n<(h-d)*(r-f)/(g-f)+d&&(i=!i)}return i}function qK(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),KK(t)}function KK(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(;t.length>=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var YK=vO,CO=bO,kO=_O,EO=yO,xC=xO;function RO({className:e,...t}){return m.jsx("kbd",{className:_e("pointer-events-none inline-flex h-5 min-w-5 items-center justify-center rounded border border-border/60 bg-muted/50 px-1.5 font-mono text-[11px] font-medium text-current select-none",e),...t})}function XK({className:e,...t}){return m.jsx("span",{className:_e("inline-flex items-center gap-0.5",e),...t})}const QK="z-50 overflow-hidden rounded-md border border-border backdrop-blur-md p-0.5 text-[11px] font-medium text-card-foreground shadow-sm animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",ZK=YK,$o=CO,Uo=kO,io=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(EO,{children:m.jsx(xC,{ref:r,sideOffset:t,className:_e("z-50 overflow-hidden rounded-md bg-card text-card-foreground border border-border px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",e),...n})}));io.displayName=xC.displayName;const _v=CO,yv=kO;function TO(e){return e.toUpperCase()}function JK(e){const t=e.split("+");return m.jsx(XK,{children:t.map((n,r)=>m.jsx(RO,{children:TO(n)},`${n}-${r}`))})}const Cf=_.forwardRef(({className:e,sideOffset:t=4,children:n,shortcut:r,...i},s)=>{const o=r===void 0?null:Array.isArray(r)?r[0]??null:r;return m.jsx(EO,{children:m.jsx(xC,{ref:s,sideOffset:t,className:_e(QK,e),...i,children:o?JK(o):m.jsx("span",{children:typeof n=="string"?TO(n):n})})})});Cf.displayName="HotkeyTooltipContent";const eY="0.39.0",tY={version:eY},qn="Kanna",lN="kanna",nY=".kanna",rY=".kanna-dev",iY="KANNA_RUNTIME_PROFILE",SC=`kanna/${tY.version}`,sY="[kanna]",oY=`~/${qn}`;function Db(){var t;return(t=globalThis.process)==null?void 0:t.env}function aY(e=Db()){var t;return((t=e==null?void 0:e[iY])==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function lY(e=Db()){return aY(e)==="dev"?rY:nY}function cY(e=Db()){return`~/${lY(e)}`}function uY(e=Db()){return`${cY(e)}/keybindings.json`}function Gm(e){return e?`${lN} ${e}`:lN}const cN=e=>{let t;const n=new Set,r=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const g=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(v=>v(t,g))}},i=()=>t,l={setState:r,getState:i,getInitialState:()=>c,subscribe:d=>(n.add(d),()=>n.delete(d))},c=t=e(r,i,l);return l},dY=(e=>e?cN(e):cN),hY=e=>e;function fY(e,t=hY){const n=xn.useSyncExternalStore(e.subscribe,xn.useCallback(()=>t(e.getState()),[e,t]),xn.useCallback(()=>t(e.getInitialState()),[e,t]));return xn.useDebugValue(n),n}const pY=e=>{const t=dY(e),n=r=>fY(t,r);return Object.assign(n,t),n},gl=(e=>pY),AO="always",NO="funk",mY=[{value:"blow",label:"Blow"},{value:"bottle",label:"Bottle"},{value:"frog",label:"Frog"},{value:"funk",label:"Funk"},{value:"glass",label:"Glass"},{value:"ping",label:"Ping"},{value:"pop",label:"Pop"},{value:"purr",label:"Purr"},{value:"tink",label:"Tink"}];function gY(e){switch(e){case"never":case"unfocused":case"always":return e;default:return AO}}function vY(e){switch(e){case"blow":case"bottle":case"frog":case"funk":case"glass":case"ping":case"pop":case"purr":case"tink":return e;default:return NO}}const Zl=gl()(e=>({chatSoundPreference:AO,chatSoundId:NO,setChatSoundPreference:t=>e({chatSoundPreference:gY(t)}),setChatSoundId:t=>e({chatSoundId:vY(t)})})),bY={blow:"/chat-sounds/Blow.mp3",bottle:"/chat-sounds/Bottle.mp3",frog:"/chat-sounds/Frog.mp3",funk:"/chat-sounds/Funk.mp3",glass:"/chat-sounds/Glass.mp3",ping:"/chat-sounds/Ping.mp3",pop:"/chat-sounds/Pop.mp3",purr:"/chat-sounds/Purr.mp3",tink:"/chat-sounds/Tink.mp3"};function _Y(e=document){return e.visibilityState!=="visible"||!e.hasFocus()}function yY(e){const t=new Audio(bY[e]);return t.preload="auto",t.play()}async function OS(e,t){if(t<=0)return;const n=Array.from({length:t},(r,i)=>new Promise(s=>{window.setTimeout(()=>{yY(e).catch(()=>{}).finally(()=>s())},i*90)}));await Promise.all(n)}function xY(e,t=document){return e==="never"?!1:e==="always"?!0:_Y(t)}function SY(e){return e.projectGroups.reduce((t,n)=>t+n.chats.reduce((r,i)=>r+(i.unread?1:0)+(i.status==="waiting_for_user"?1:0),0),0)}function uN(e){let t=0;const n=new Set;for(const r of e.projectGroups)for(const i of r.chats)i.unread&&(t+=1),i.status==="waiting_for_user"&&n.add(i.chatId);return{unreadCount:t,waitingChatIds:n}}function wY(e,t){if(!e)return 0;const n=uN(e),r=uN(t),i=Math.max(0,r.unreadCount-n.unreadCount);let s=0;for(const o of r.waitingChatIds)n.waitingChatIds.has(o)||(s+=1);return i+s}function jS(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const CY=[/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(['"])([\s\S]*)\1$/,/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(.+)$/,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(.+)$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(.+)$/i];function kY(e){const t=e.trim();for(const n of CY){const r=t.match(n);if(!r)continue;const i=(r[2]??r[1]??"").trim();if(i)return i}return t}function MO(e){return e.split("/").pop()||e}const EY=1440*6e4;function LO(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,i=60*r,s=EY,o=7*s;return n<r?"now":n<i?`${Math.floor(n/r)}m`:n<s?`${Math.floor(n/i)}h`:n<o?`${Math.floor(n/s)}d`:`${Math.floor(n/o)}w`}function DO(e){return e.lastMessageAt??e._creationTime}const yd=({children:e,className:t,shimmerWidth:n=100,animate:r=!0,...i})=>m.jsx("span",{style:{"--shiny-width":`${Math.min(n,100)}px`},className:_e("mx-auto max-w-md text-foreground/50",r?["animate-shiny-text [background-size:var(--shiny-width)_100%] bg-clip-text [background-position:0_0] bg-no-repeat [transition:background-position_1s_cubic-bezier(.6,.6,0,1)_infinite]","bg-gradient-to-r from-transparent via-black/80 via-50% to-transparent dark:via-white/80"]:["text-neutral"],t),...i,children:e});function wC(e){const t=e+"CollectionProvider",[n,r]=ea(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=x=>{const{scope:w,children:C}=x,E=xn.useRef(null),R=xn.useRef(new Map).current;return m.jsx(i,{scope:w,itemMap:R,collectionRef:E,children:C})};o.displayName=t;const l=e+"CollectionSlot",c=lc(l),d=xn.forwardRef((x,w)=>{const{scope:C,children:E}=x,R=s(l,C),T=hn(w,R.collectionRef);return m.jsx(c,{ref:T,children:E})});d.displayName=l;const f=e+"CollectionItemSlot",h="data-radix-collection-item",g=lc(f),v=xn.forwardRef((x,w)=>{const{scope:C,children:E,...R}=x,T=xn.useRef(null),A=hn(w,T),N=s(f,C);return xn.useEffect(()=>(N.itemMap.set(T,{ref:T,...R}),()=>void N.itemMap.delete(T))),m.jsx(g,{[h]:"",ref:A,children:E})});v.displayName=f;function y(x){const w=s(e+"CollectionConsumer",x);return xn.useCallback(()=>{const E=w.collectionRef.current;if(!E)return[];const R=Array.from(E.querySelectorAll(`[${h}]`));return Array.from(w.itemMap.values()).sort((N,M)=>R.indexOf(N.ref.current)-R.indexOf(M.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:o,Slot:d,ItemSlot:v},y,r]}var RY=_.createContext(void 0);function CC(e){const t=_.useContext(RY);return e||t||"ltr"}var Gy="rovingFocusGroup.onEntryFocus",TY={bubbles:!1,cancelable:!0},sp="RovingFocusGroup",[zS,IO,AY]=wC(sp),[NY,PO]=ea(sp,[AY]),[MY,LY]=NY(sp),OO=_.forwardRef((e,t)=>m.jsx(zS.Provider,{scope:e.__scopeRovingFocusGroup,children:m.jsx(zS.Slot,{scope:e.__scopeRovingFocusGroup,children:m.jsx(DY,{...e,ref:t})})}));OO.displayName=sp;var DY=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=e,g=_.useRef(null),v=hn(t,g),y=CC(s),[x,w]=Yu({prop:o,defaultProp:l??null,onChange:c,caller:sp}),[C,E]=_.useState(!1),R=Ls(d),T=IO(n),A=_.useRef(!1),[N,M]=_.useState(0);return _.useEffect(()=>{const P=g.current;if(P)return P.addEventListener(Gy,R),()=>P.removeEventListener(Gy,R)},[R]),m.jsx(MY,{scope:n,orientation:r,dir:y,loop:i,currentTabStopId:x,onItemFocus:_.useCallback(P=>w(P),[w]),onItemShiftTab:_.useCallback(()=>E(!0),[]),onFocusableItemAdd:_.useCallback(()=>M(P=>P+1),[]),onFocusableItemRemove:_.useCallback(()=>M(P=>P-1),[]),children:m.jsx(Yt.div,{tabIndex:C||N===0?-1:0,"data-orientation":r,...h,ref:v,style:{outline:"none",...e.style},onMouseDown:Ke(e.onMouseDown,()=>{A.current=!0}),onFocus:Ke(e.onFocus,P=>{const q=!A.current;if(P.target===P.currentTarget&&q&&!C){const j=new CustomEvent(Gy,TY);if(P.currentTarget.dispatchEvent(j),!j.defaultPrevented){const $=T().filter(z=>z.focusable),F=$.find(z=>z.active),O=$.find(z=>z.id===x),H=[F,O,...$].filter(Boolean).map(z=>z.ref.current);BO(H,f)}}A.current=!1}),onBlur:Ke(e.onBlur,()=>E(!1))})})}),jO="RovingFocusGroupItem",zO=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...l}=e,c=Ho(),d=s||c,f=LY(jO,n),h=f.currentTabStopId===d,g=IO(n),{onFocusableItemAdd:v,onFocusableItemRemove:y,currentTabStopId:x}=f;return _.useEffect(()=>{if(r)return v(),()=>y()},[r,v,y]),m.jsx(zS.ItemSlot,{scope:n,id:d,focusable:r,active:i,children:m.jsx(Yt.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...l,ref:t,onMouseDown:Ke(e.onMouseDown,w=>{r?f.onItemFocus(d):w.preventDefault()}),onFocus:Ke(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:Ke(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){f.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const C=OY(w,f.orientation,f.dir);if(C!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let R=g().filter(T=>T.focusable).map(T=>T.ref.current);if(C==="last")R.reverse();else if(C==="prev"||C==="next"){C==="prev"&&R.reverse();const T=R.indexOf(w.currentTarget);R=f.loop?jY(R,T+1):R.slice(T+1)}setTimeout(()=>BO(R))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:x!=null}):o})})});zO.displayName=jO;var IY={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function PY(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function OY(e,t,n){const r=PY(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return IY[r]}function BO(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function jY(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var zY=OO,BY=zO,BS=["Enter"," "],FY=["ArrowDown","PageUp","Home"],FO=["ArrowUp","PageDown","End"],HY=[...FY,...FO],$Y={ltr:[...BS,"ArrowRight"],rtl:[...BS,"ArrowLeft"]},UY={ltr:["ArrowLeft"],rtl:["ArrowRight"]},op="Menu",[kf,VY,WY]=wC(op),[wc,HO]=ea(op,[WY,ml,PO]),Ib=ml(),$O=PO(),[GY,Cc]=wc(op),[qY,ap]=wc(op),UO=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=e,l=Ib(t),[c,d]=_.useState(null),f=_.useRef(!1),h=Ls(s),g=CC(i);return _.useEffect(()=>{const v=()=>{f.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>f.current=!1;return document.addEventListener("keydown",v,{capture:!0}),()=>{document.removeEventListener("keydown",v,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),m.jsx(Tb,{...l,children:m.jsx(GY,{scope:t,open:n,onOpenChange:h,content:c,onContentChange:d,children:m.jsx(qY,{scope:t,onClose:_.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:f,dir:g,modal:o,children:r})})})};UO.displayName=op;var KY="MenuAnchor",kC=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=Ib(n);return m.jsx(rp,{...i,...r,ref:t})});kC.displayName=KY;var EC="MenuPortal",[YY,VO]=wc(EC,{forceMount:void 0}),WO=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,s=Cc(EC,t);return m.jsx(YY,{scope:t,forceMount:n,children:m.jsx(vs,{present:n||s.open,children:m.jsx(gd,{asChild:!0,container:i,children:r})})})};WO.displayName=EC;var hs="MenuContent",[XY,RC]=wc(hs),GO=_.forwardRef((e,t)=>{const n=VO(hs,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Cc(hs,e.__scopeMenu),o=ap(hs,e.__scopeMenu);return m.jsx(kf.Provider,{scope:e.__scopeMenu,children:m.jsx(vs,{present:r||s.open,children:m.jsx(kf.Slot,{scope:e.__scopeMenu,children:o.modal?m.jsx(QY,{...i,ref:t}):m.jsx(ZY,{...i,ref:t})})})})}),QY=_.forwardRef((e,t)=>{const n=Cc(hs,e.__scopeMenu),r=_.useRef(null),i=hn(t,r);return _.useEffect(()=>{const s=r.current;if(s)return xb(s)},[]),m.jsx(TC,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ke(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),ZY=_.forwardRef((e,t)=>{const n=Cc(hs,e.__scopeMenu);return m.jsx(TC,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),JY=lc("MenuContent.ScrollLock"),TC=_.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:g,onDismiss:v,disableOutsideScroll:y,...x}=e,w=Cc(hs,n),C=ap(hs,n),E=Ib(n),R=$O(n),T=VY(n),[A,N]=_.useState(null),M=_.useRef(null),P=hn(t,M,w.onContentChange),q=_.useRef(0),j=_.useRef(""),$=_.useRef(0),F=_.useRef(null),O=_.useRef("right"),B=_.useRef(0),H=y?tp:_.Fragment,z=y?{as:JY,allowPinchZoom:!0}:void 0,W=Y=>{var oe,me;const I=j.current+Y,V=T().filter(ue=>!ue.disabled),X=document.activeElement,D=(oe=V.find(ue=>ue.ref.current===X))==null?void 0:oe.textValue,re=V.map(ue=>ue.textValue),ne=dX(re,I,D),se=(me=V.find(ue=>ue.textValue===ne))==null?void 0:me.ref.current;(function ue(ge){j.current=ge,window.clearTimeout(q.current),ge!==""&&(q.current=window.setTimeout(()=>ue(""),1e3))})(I),se&&setTimeout(()=>se.focus())};_.useEffect(()=>()=>window.clearTimeout(q.current),[]),_b();const U=_.useCallback(Y=>{var V,X;return O.current===((V=F.current)==null?void 0:V.side)&&fX(Y,(X=F.current)==null?void 0:X.area)},[]);return m.jsx(XY,{scope:n,searchRef:j,onItemEnter:_.useCallback(Y=>{U(Y)&&Y.preventDefault()},[U]),onItemLeave:_.useCallback(Y=>{var I;U(Y)||((I=M.current)==null||I.focus(),N(null))},[U]),onTriggerLeave:_.useCallback(Y=>{U(Y)&&Y.preventDefault()},[U]),pointerGraceTimerRef:$,onPointerGraceIntentChange:_.useCallback(Y=>{F.current=Y},[]),children:m.jsx(H,{...z,children:m.jsx(ep,{asChild:!0,trapped:i,onMountAutoFocus:Ke(s,Y=>{var I;Y.preventDefault(),(I=M.current)==null||I.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:m.jsx(md,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:g,onDismiss:v,children:m.jsx(zY,{asChild:!0,...R,dir:C.dir,orientation:"vertical",loop:r,currentTabStopId:A,onCurrentTabStopIdChange:N,onEntryFocus:Ke(c,Y=>{C.isUsingKeyboardRef.current||Y.preventDefault()}),preventScrollOnEntryFocus:!0,children:m.jsx(Ab,{role:"menu","aria-orientation":"vertical","data-state":lj(w.open),"data-radix-menu-content":"",dir:C.dir,...E,...x,ref:P,style:{outline:"none",...x.style},onKeyDown:Ke(x.onKeyDown,Y=>{const V=Y.target.closest("[data-radix-menu-content]")===Y.currentTarget,X=Y.ctrlKey||Y.altKey||Y.metaKey,D=Y.key.length===1;V&&(Y.key==="Tab"&&Y.preventDefault(),!X&&D&&W(Y.key));const re=M.current;if(Y.target!==re||!HY.includes(Y.key))return;Y.preventDefault();const se=T().filter(oe=>!oe.disabled).map(oe=>oe.ref.current);FO.includes(Y.key)&&se.reverse(),cX(se)}),onBlur:Ke(e.onBlur,Y=>{Y.currentTarget.contains(Y.target)||(window.clearTimeout(q.current),j.current="")}),onPointerMove:Ke(e.onPointerMove,Ef(Y=>{const I=Y.target,V=B.current!==Y.clientX;if(Y.currentTarget.contains(I)&&V){const X=Y.clientX>B.current?"right":"left";O.current=X,B.current=Y.clientX}}))})})})})})})});GO.displayName=hs;var eX="MenuGroup",AC=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Yt.div,{role:"group",...r,ref:t})});AC.displayName=eX;var tX="MenuLabel",qO=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Yt.div,{...r,ref:t})});qO.displayName=tX;var xv="MenuItem",dN="menu.itemSelect",Pb=_.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,s=_.useRef(null),o=ap(xv,e.__scopeMenu),l=RC(xv,e.__scopeMenu),c=hn(t,s),d=_.useRef(!1),f=()=>{const h=s.current;if(!n&&h){const g=new CustomEvent(dN,{bubbles:!0,cancelable:!0});h.addEventListener(dN,v=>r==null?void 0:r(v),{once:!0}),XP(h,g),g.defaultPrevented?d.current=!1:o.onClose()}};return m.jsx(KO,{...i,ref:c,disabled:n,onClick:Ke(e.onClick,f),onPointerDown:h=>{var g;(g=e.onPointerDown)==null||g.call(e,h),d.current=!0},onPointerUp:Ke(e.onPointerUp,h=>{var g;d.current||(g=h.currentTarget)==null||g.click()}),onKeyDown:Ke(e.onKeyDown,h=>{const g=l.searchRef.current!=="";n||g&&h.key===" "||BS.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});Pb.displayName=xv;var KO=_.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=e,o=RC(xv,n),l=$O(n),c=_.useRef(null),d=hn(t,c),[f,h]=_.useState(!1),[g,v]=_.useState("");return _.useEffect(()=>{const y=c.current;y&&v((y.textContent??"").trim())},[s.children]),m.jsx(kf.ItemSlot,{scope:n,disabled:r,textValue:i??g,children:m.jsx(BY,{asChild:!0,...l,focusable:!r,children:m.jsx(Yt.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:d,onPointerMove:Ke(e.onPointerMove,Ef(y=>{r?o.onItemLeave(y):(o.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ke(e.onPointerLeave,Ef(y=>o.onItemLeave(y))),onFocus:Ke(e.onFocus,()=>h(!0)),onBlur:Ke(e.onBlur,()=>h(!1))})})})}),nX="MenuCheckboxItem",YO=_.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return m.jsx(ej,{scope:e.__scopeMenu,checked:n,children:m.jsx(Pb,{role:"menuitemcheckbox","aria-checked":Sv(n)?"mixed":n,...i,ref:t,"data-state":MC(n),onSelect:Ke(i.onSelect,()=>r==null?void 0:r(Sv(n)?!0:!n),{checkForDefaultPrevented:!1})})})});YO.displayName=nX;var XO="MenuRadioGroup",[rX,iX]=wc(XO,{value:void 0,onValueChange:()=>{}}),QO=_.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,s=Ls(r);return m.jsx(rX,{scope:e.__scopeMenu,value:n,onValueChange:s,children:m.jsx(AC,{...i,ref:t})})});QO.displayName=XO;var ZO="MenuRadioItem",JO=_.forwardRef((e,t)=>{const{value:n,...r}=e,i=iX(ZO,e.__scopeMenu),s=n===i.value;return m.jsx(ej,{scope:e.__scopeMenu,checked:s,children:m.jsx(Pb,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":MC(s),onSelect:Ke(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});JO.displayName=ZO;var NC="MenuItemIndicator",[ej,sX]=wc(NC,{checked:!1}),tj=_.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,s=sX(NC,n);return m.jsx(vs,{present:r||Sv(s.checked)||s.checked===!0,children:m.jsx(Yt.span,{...i,ref:t,"data-state":MC(s.checked)})})});tj.displayName=NC;var oX="MenuSeparator",nj=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Yt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});nj.displayName=oX;var aX="MenuArrow",rj=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=Ib(n);return m.jsx(Nb,{...i,...r,ref:t})});rj.displayName=aX;var lX="MenuSub",[f1e,ij]=wc(lX),Gh="MenuSubTrigger",sj=_.forwardRef((e,t)=>{const n=Cc(Gh,e.__scopeMenu),r=ap(Gh,e.__scopeMenu),i=ij(Gh,e.__scopeMenu),s=RC(Gh,e.__scopeMenu),o=_.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=s,d={__scopeMenu:e.__scopeMenu},f=_.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return _.useEffect(()=>f,[f]),_.useEffect(()=>{const h=l.current;return()=>{window.clearTimeout(h),c(null)}},[l,c]),m.jsx(kC,{asChild:!0,...d,children:m.jsx(KO,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":lj(n.open),...e,ref:J1(t,i.onTriggerChange),onClick:h=>{var g;(g=e.onClick)==null||g.call(e,h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ke(e.onPointerMove,Ef(h=>{s.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:Ke(e.onPointerLeave,Ef(h=>{var v,y;f();const g=(v=n.content)==null?void 0:v.getBoundingClientRect();if(g){const x=(y=n.content)==null?void 0:y.dataset.side,w=x==="right",C=w?-5:5,E=g[w?"left":"right"],R=g[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:h.clientX+C,y:h.clientY},{x:E,y:g.top},{x:R,y:g.top},{x:R,y:g.bottom},{x:E,y:g.bottom}],side:x}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(h),h.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:Ke(e.onKeyDown,h=>{var v;const g=s.searchRef.current!=="";e.disabled||g&&h.key===" "||$Y[r.dir].includes(h.key)&&(n.onOpenChange(!0),(v=n.content)==null||v.focus(),h.preventDefault())})})})});sj.displayName=Gh;var oj="MenuSubContent",aj=_.forwardRef((e,t)=>{const n=VO(hs,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Cc(hs,e.__scopeMenu),o=ap(hs,e.__scopeMenu),l=ij(oj,e.__scopeMenu),c=_.useRef(null),d=hn(t,c);return m.jsx(kf.Provider,{scope:e.__scopeMenu,children:m.jsx(vs,{present:r||s.open,children:m.jsx(kf.Slot,{scope:e.__scopeMenu,children:m.jsx(TC,{id:l.contentId,"aria-labelledby":l.triggerId,...i,ref:d,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var h;o.isUsingKeyboardRef.current&&((h=c.current)==null||h.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:Ke(e.onFocusOutside,f=>{f.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Ke(e.onEscapeKeyDown,f=>{o.onClose(),f.preventDefault()}),onKeyDown:Ke(e.onKeyDown,f=>{var v;const h=f.currentTarget.contains(f.target),g=UY[o.dir].includes(f.key);h&&g&&(s.onOpenChange(!1),(v=l.trigger)==null||v.focus(),f.preventDefault())})})})})})});aj.displayName=oj;function lj(e){return e?"open":"closed"}function Sv(e){return e==="indeterminate"}function MC(e){return Sv(e)?"indeterminate":e?"checked":"unchecked"}function cX(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function uX(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function dX(e,t,n){const i=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let o=uX(e,Math.max(s,0));i.length===1&&(o=o.filter(d=>d!==n));const c=o.find(d=>d.toLowerCase().startsWith(i.toLowerCase()));return c!==n?c:void 0}function hX(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const l=t[s],c=t[o],d=l.x,f=l.y,h=c.x,g=c.y;f>r!=g>r&&n<(h-d)*(r-f)/(g-f)+d&&(i=!i)}return i}function fX(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return hX(n,t)}function Ef(e){return t=>t.pointerType==="mouse"?e(t):void 0}var pX=UO,mX=kC,gX=WO,vX=GO,bX=AC,_X=qO,yX=Pb,xX=YO,SX=QO,wX=JO,CX=tj,kX=nj,EX=rj,RX=sj,TX=aj,LC="ContextMenu",[AX]=ea(LC,[HO]),ri=HO(),[NX,cj]=AX(LC),uj=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:s=!0}=e,[o,l]=_.useState(!1),c=ri(t),d=Ls(r),f=_.useCallback(h=>{l(h),d(h)},[d]);return m.jsx(NX,{scope:t,open:o,onOpenChange:f,modal:s,children:m.jsx(pX,{...c,dir:i,open:o,onOpenChange:f,modal:s,children:n})})};uj.displayName=LC;var dj="ContextMenuTrigger",hj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:r=!1,...i}=e,s=cj(dj,n),o=ri(n),l=_.useRef({x:0,y:0}),c=_.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...l.current})}),d=_.useRef(0),f=_.useCallback(()=>window.clearTimeout(d.current),[]),h=g=>{l.current={x:g.clientX,y:g.clientY},s.onOpenChange(!0)};return _.useEffect(()=>f,[f]),_.useEffect(()=>void(r&&f()),[r,f]),m.jsxs(m.Fragment,{children:[m.jsx(mX,{...o,virtualRef:c}),m.jsx(Yt.span,{"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,...i,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:Ke(e.onContextMenu,g=>{f(),h(g),g.preventDefault()}),onPointerDown:r?e.onPointerDown:Ke(e.onPointerDown,qm(g=>{f(),d.current=window.setTimeout(()=>h(g),700)})),onPointerMove:r?e.onPointerMove:Ke(e.onPointerMove,qm(f)),onPointerCancel:r?e.onPointerCancel:Ke(e.onPointerCancel,qm(f)),onPointerUp:r?e.onPointerUp:Ke(e.onPointerUp,qm(f))})]})});hj.displayName=dj;var MX="ContextMenuPortal",fj=e=>{const{__scopeContextMenu:t,...n}=e,r=ri(t);return m.jsx(gX,{...r,...n})};fj.displayName=MX;var pj="ContextMenuContent",mj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=cj(pj,n),s=ri(n),o=_.useRef(!1);return m.jsx(vX,{...s,...r,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:l=>{var c;(c=e.onCloseAutoFocus)==null||c.call(e,l),!l.defaultPrevented&&o.current&&l.preventDefault(),o.current=!1},onInteractOutside:l=>{var c;(c=e.onInteractOutside)==null||c.call(e,l),!l.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});mj.displayName=pj;var LX="ContextMenuGroup",DX=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ri(n);return m.jsx(bX,{...i,...r,ref:t})});DX.displayName=LX;var IX="ContextMenuLabel",PX=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ri(n);return m.jsx(_X,{...i,...r,ref:t})});PX.displayName=IX;var OX="ContextMenuItem",gj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ri(n);return m.jsx(yX,{...i,...r,ref:t})});gj.displayName=OX;var jX="ContextMenuCheckboxItem",zX=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ri(n);return m.jsx(xX,{...i,...r,ref:t})});zX.displayName=jX;var BX="ContextMenuRadioGroup",FX=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ri(n);return m.jsx(SX,{...i,...r,ref:t})});FX.displayName=BX;var HX="ContextMenuRadioItem",$X=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ri(n);return m.jsx(wX,{...i,...r,ref:t})});$X.displayName=HX;var UX="ContextMenuItemIndicator",VX=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ri(n);return m.jsx(CX,{...i,...r,ref:t})});VX.displayName=UX;var WX="ContextMenuSeparator",vj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ri(n);return m.jsx(kX,{...i,...r,ref:t})});vj.displayName=WX;var GX="ContextMenuArrow",qX=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ri(n);return m.jsx(EX,{...i,...r,ref:t})});qX.displayName=GX;var KX="ContextMenuSubTrigger",YX=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ri(n);return m.jsx(RX,{...i,...r,ref:t})});YX.displayName=KX;var XX="ContextMenuSubContent",QX=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ri(n);return m.jsx(TX,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});QX.displayName=XX;function qm(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var ZX=uj,JX=hj,eQ=fj,bj=mj,_j=gj,yj=vj;const xj=_.createContext(null);function xd({onOpenChange:e,...t}){const[n,r]=_.useState(0),i=_.useCallback(()=>{r(s=>s+1),e==null||e(!1)},[e]);return m.jsx(xj.Provider,{value:i,children:m.jsx(ZX,{onOpenChange:e,...t},n)})}const Sd=JX,kc=_.forwardRef(({className:e,...t},n)=>m.jsx(eQ,{children:m.jsx(bj,{ref:n,className:_e("z-50 min-w-[170px] overflow-hidden rounded-xl border border-border bg-background p-1 shadow-lg outline-hidden animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",e),...t})}));kc.displayName=bj.displayName;const jn=_.forwardRef(({className:e,onSelect:t,...n},r)=>{const i=_.useContext(xj);return m.jsx(_j,{ref:r,className:_e("relative flex cursor-default select-none items-center gap-2.5 rounded-lg px-3 py-2 text-xs font-medium text-foreground outline-hidden transition-colors hover:bg-muted focus:bg-muted data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),onSelect:s=>{t==null||t(s),i==null||i()},...n})});jn.displayName=_j.displayName;const Sj=_.forwardRef(({className:e,...t},n)=>m.jsx(yj,{ref:n,className:_e("-mx-1 my-1 h-px bg-border",e),...t}));Sj.displayName=yj.displayName;function tQ({editorLabel:e,onCopyPath:t,onShowArchived:n,onOpenInFinder:r,onOpenInEditor:i,onHide:s,children:o}){return m.jsxs(xd,{children:[m.jsx(Sd,{asChild:!0,children:o}),m.jsxs(kc,{children:[m.jsxs(jn,{onSelect:l=>{l.stopPropagation(),t()},children:[m.jsx(ll,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Copy Path"})]}),m.jsxs(jn,{onSelect:l=>{l.stopPropagation(),n()},children:[m.jsx(V1,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Show Archived"})]}),m.jsxs(jn,{onSelect:l=>{l.stopPropagation(),r()},children:[m.jsx(gb,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Show in Finder"})]}),m.jsxs(jn,{onSelect:l=>{l.stopPropagation(),i()},children:[m.jsx(W1,{className:"h-3.5 w-3.5"}),m.jsxs("span",{className:"text-xs font-medium",children:["Open in ",e]})]}),m.jsxs(jn,{onSelect:l=>{l.stopPropagation(),s()},children:[m.jsx(B9,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Hide"})]})]})]})}function nQ({canFork:e,onRename:t,onShare:n,onOpenInFinder:r,onFork:i,onArchive:s,onDelete:o,children:l}){return m.jsxs(xd,{children:[m.jsx(Sd,{asChild:!0,children:l}),m.jsxs(kc,{children:[m.jsxs(jn,{onSelect:c=>{c.preventDefault(),t()},children:[m.jsx(Y1,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Rename"})]}),m.jsxs(jn,{onSelect:c=>{c.preventDefault(),n()},children:[m.jsx(Z1,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Share"})]}),m.jsxs(jn,{onSelect:c=>{c.preventDefault(),r()},children:[m.jsx(gb,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Open in Finder"})]}),m.jsxs(jn,{disabled:!e,onSelect:c=>{c.preventDefault(),e&&i()},children:[m.jsx(KP,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Fork"})]}),m.jsxs(jn,{onSelect:c=>{c.preventDefault(),s()},children:[m.jsx(V1,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Archive"})]}),m.jsxs(jn,{onSelect:c=>{c.preventDefault(),o()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[m.jsx(Q1,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Delete"})]})]})]})}const rQ=new Set(["starting","running"]);function iQ({chat:e,activeChatId:t,nowMs:n,shortcutHint:r=null,showShortcutHint:i=!1,onSelectChat:s,onRenameChat:o,onShareChat:l,onOpenInFinder:c,onForkChat:d,onArchiveChat:f,onDeleteChat:h}){const g=LO(DO(e),n),v=i&&r?r:g,y=i&&!!r,x=oq(e.chatId),w=m.jsxs("div",{"data-chat-id":x,className:_e("group flex items-center gap-2 pl-2.5 pr-0.5 py-0.5 rounded-lg cursor-pointer border-border/0 hover:border-border hover:bg-muted/20 active:scale-[0.985] border transition-all",t===x?"bg-muted hover:bg-muted border-border":"border-border/0 dark:hover:border-slate-400/10 "),onClick:()=>s(e.chatId),children:[rQ.has(e.status)?m.jsx(dn,{className:"size-3.5 flex-shrink-0 animate-spin text-logo"}):e.status==="waiting_for_user"?m.jsx("div",{className:"relative ",children:m.jsxs("div",{className:" rounded-full z-0 size-3.5 flex items-center justify-center ",children:[m.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-blue-400/80 animate-ping"}),m.jsx("div",{className:" rounded-full z-0 size-2.5 bg-blue-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):e.unread?m.jsx("div",{className:"relative ",children:m.jsxs("div",{className:" rounded-full z-0 size-3.5 flex items-center justify-center ",children:[m.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-emerald-400/80 animate-ping"}),m.jsx("div",{className:" rounded-full z-0 size-2.5 bg-emerald-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):null,m.jsx("span",{className:"text-sm truncate flex-1 translate-y-[-0.5px]",children:e.status!=="idle"&&e.status!=="waiting_for_user"?m.jsx(yd,{animate:e.status==="running",shimmerWidth:Math.max(20,e.title.length*3),children:e.title}):e.status!=="idle"||t===x||e.unread?m.jsx("span",{className:"",children:e.title}):m.jsx("span",{className:"text-slate-500 dark:text-slate-400",children:e.title})}),m.jsxs("div",{className:_e("relative h-7 mr-[2px] shrink-0",e.canFork?"w-12":"w-6"),children:[v?y?m.jsx("span",{className:"hidden md:flex absolute inset-0 items-center justify-end pr-0.5 text-[11px] text-foreground transition-opacity group-hover:opacity-0",children:m.jsx(RO,{className:"h-4 min-w-4 rounded-sm border-border/50 bg-transparent px-1 text-[10px]",children:r})}):m.jsx("span",{className:"hidden md:flex absolute inset-0 items-center justify-end pr-1 text-[11px] text-muted-foreground opacity-60 transition-opacity group-hover:opacity-0",children:v}):null,m.jsxs("div",{className:_e("absolute inset-0 flex items-center justify-end gap-0 opacity-100 mr-[3px]",v?"md:opacity-0 md:group-hover:opacity-100":"opacity-100 md:opacity-0 md:group-hover:opacity-100"),children:[e.canFork?m.jsx(nt,{variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer rounded-sm hover:!bg-transparent !border-0",onClick:C=>{C.stopPropagation(),d(e.chatId)},title:"Fork chat",children:m.jsx(KP,{className:"size-3.5"})}):null,m.jsx(nt,{variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer rounded-sm hover:!bg-transparent !border-0",onClick:C=>{C.stopPropagation(),f(e.chatId)},title:"Archive chat",children:m.jsx(V1,{className:"size-3.5"})})]})]})]},e._id);return m.jsx(nQ,{canFork:e.canFork,onRename:()=>o(e.chatId),onShare:()=>l(e.chatId),onOpenInFinder:()=>c(e.localPath),onFork:()=>d(e.chatId),onArchive:()=>f(e.chatId),onDelete:()=>h(e.chatId),children:w})}const sQ=_.memo(iQ);function oQ(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _.useMemo(()=>r=>{t.forEach(i=>i(r))},t)}const Ob=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function wd(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function DC(e){return"nodeType"in e}function Si(e){var t,n;return e?wd(e)?e:DC(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function IC(e){const{Document:t}=Si(e);return e instanceof t}function lp(e){return wd(e)?!1:e instanceof Si(e).HTMLElement}function wj(e){return e instanceof Si(e).SVGElement}function Cd(e){return e?wd(e)?e.document:DC(e)?IC(e)?e:lp(e)||wj(e)?e.ownerDocument:document:document:document}const ao=Ob?_.useLayoutEffect:_.useEffect;function PC(e){const t=_.useRef(e);return ao(()=>{t.current=e}),_.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}function aQ(){const e=_.useRef(null),t=_.useCallback((r,i)=>{e.current=setInterval(r,i)},[]),n=_.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Rf(e,t){t===void 0&&(t=[e]);const n=_.useRef(e);return ao(()=>{n.current!==e&&(n.current=e)},t),n}function cp(e,t){const n=_.useRef();return _.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function wv(e){const t=PC(e),n=_.useRef(null),r=_.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function FS(e){const t=_.useRef();return _.useEffect(()=>{t.current=e},[e]),t.current}let qy={};function up(e,t){return _.useMemo(()=>{if(t)return t;const n=qy[e]==null?0:qy[e]+1;return qy[e]=n,e+"-"+n},[e,t])}function Cj(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((s,o)=>{const l=Object.entries(o);for(const[c,d]of l){const f=s[c];f!=null&&(s[c]=f+e*d)}return s},{...t})}}const Bu=Cj(1),Cv=Cj(-1);function lQ(e){return"clientX"in e&&"clientY"in e}function OC(e){if(!e)return!1;const{KeyboardEvent:t}=Si(e.target);return t&&e instanceof t}function cQ(e){if(!e)return!1;const{TouchEvent:t}=Si(e.target);return t&&e instanceof t}function HS(e){if(cQ(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return lQ(e)?{x:e.clientX,y:e.clientY}:null}const Tf=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Tf.Translate.toString(e),Tf.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),hN="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function uQ(e){return e.matches(hN)?e:e.querySelector(hN)}const dQ={display:"none"};function hQ(e){let{id:t,value:n}=e;return xn.createElement("div",{id:t,style:dQ},n)}function fQ(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return xn.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function pQ(){const[e,t]=_.useState("");return{announce:_.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const kj=_.createContext(null);function mQ(e){const t=_.useContext(kj);_.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function gQ(){const[e]=_.useState(()=>new Set),t=_.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[_.useCallback(r=>{let{type:i,event:s}=r;e.forEach(o=>{var l;return(l=o[i])==null?void 0:l.call(o,s)})},[e]),t]}const vQ={draggable:`
641
641
  To pick up a draggable item, press the space bar.
642
642
  While dragging, use the arrow keys to move the item.
643
643
  Press space again to drop the item in its new position, or press escape to cancel.
@@ -25,7 +25,7 @@
25
25
  })()
26
26
  </script>
27
27
  <title>Kanna</title>
28
- <script type="module" crossorigin src="/assets/index-C0H26aJt.js"></script>
28
+ <script type="module" crossorigin src="/assets/index-CWBXUZnG.js"></script>
29
29
  <link rel="stylesheet" crossorigin href="/assets/index-SIga6V_y.css">
30
30
  </head>
31
31
  <body>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kanna-code",
3
3
  "type": "module",
4
- "version": "0.38.0",
4
+ "version": "0.39.0",
5
5
  "description": "A beautiful web UI for Claude Code",
6
6
  "license": "MIT",
7
7
  "keywords": [
@@ -48,7 +48,7 @@
48
48
  "prepublishOnly": "bun run build"
49
49
  },
50
50
  "dependencies": {
51
- "@anthropic-ai/claude-agent-sdk": "^0.2.39",
51
+ "@anthropic-ai/claude-agent-sdk": "^0.2.126",
52
52
  "@legendapp/list": "3.0.0-beta.44",
53
53
  "@pierre/diffs": "^1.1.12",
54
54
  "@radix-ui/react-context-menu": "^2.2.16",
@@ -1,4 +1,5 @@
1
1
  import { query, type CanUseTool, type PermissionResult, type Query, type SDKUserMessage } from "@anthropic-ai/claude-agent-sdk"
2
+ import { homedir } from "node:os"
2
3
  import type {
3
4
  AgentProvider,
4
5
  ChatAttachment,
@@ -628,6 +629,7 @@ async function startClaudeSession(args: {
628
629
  canUseTool,
629
630
  tools: [...CLAUDE_TOOLSET],
630
631
  settingSources: ["user", "project", "local"],
632
+ pathToClaudeCodeExecutable: process.env.CLAUDE_EXECUTABLE?.replace(/^~(?=\/|$)/, homedir()) || undefined,
631
633
  env: (() => { const { CLAUDECODE: _, ...env } = process.env; return env })(),
632
634
  },
633
635
  })