@cuongtran001/kanna 0.42.3 → 0.42.4

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},NG="DialogDescriptionWarning",MG=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${zO(NG).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},LG=kO,DG=TO,BO=AO,FO=NO,IG=LO,PG=IO,OG=OO;function $O(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=$O(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function HO(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=$O(e))&&(r&&(r+=" "),r+=t);return r}const jG=(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},zG=(e,t)=>({classGroupId:e,validator:t}),UO=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),yv="-",qA=[],BG="arbitrary..",FG=e=>{const t=HG(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return $G(o);const l=o.split(yv),c=l[0]===""&&l.length>1?1:0;return VO(l,c,t)},getConflictingClassGroupIds:(o,l)=>{if(l){const c=r[o],d=n[o];return c?d?jG(d,c):c:d||qA}return n[o]||qA}}},VO=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const i=e[t],s=n.nextPart.get(i);if(s){const d=VO(e,t+1,s);if(d)return d}const o=n.validators;if(o===null)return;const l=t===0?e.join(yv):e.slice(t).join(yv),c=o.length;for(let d=0;d<c;d++){const f=o[d];if(f.validator(l))return f.classGroupId}},$G=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?BG+r:void 0})(),HG=e=>{const{theme:t,classGroups:n}=e;return UG(n,t)},UG=(e,t)=>{const n=UO();for(const r in e){const i=e[r];dC(i,n,r,t)}return n},dC=(e,t,n,r)=>{const i=e.length;for(let s=0;s<i;s++){const o=e[s];VG(o,t,n,r)}},VG=(e,t,n,r)=>{if(typeof e=="string"){WG(e,t,n);return}if(typeof e=="function"){GG(e,t,n,r);return}qG(e,t,n,r)},WG=(e,t,n)=>{const r=e===""?t:WO(t,e);r.classGroupId=n},GG=(e,t,n,r)=>{if(KG(e)){dC(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(zG(n,e))},qG=(e,t,n,r)=>{const i=Object.entries(e),s=i.length;for(let o=0;o<s;o++){const[l,c]=i[o];dC(c,WO(t,l),n,r)}},WO=(e,t)=>{let n=e;const r=t.split(yv),i=r.length;for(let s=0;s<i;s++){const o=r[s];let l=n.nextPart.get(o);l||(l=UO(),n.nextPart.set(o,l)),n=l}return n},KG=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,YG=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)}}},OS="!",KA=":",XG=[],YA=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),QG=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===KA){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,b=!1;h.endsWith(OS)?(g=h.slice(0,-1),b=!0):h.startsWith(OS)&&(g=h.slice(1),b=!0);const y=d&&d>c?d-c:void 0;return YA(s,b,g,y)};if(t){const i=t+KA,s=r;r=o=>o.startsWith(i)?s(o.slice(i.length)):YA(XG,!1,o,void 0,!0)}if(n){const i=r;r=s=>n({className:s,parseClassName:i})}return r},ZG=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}},JG=e=>({cache:YG(e.cacheSize),parseClassName:QG(e),sortModifiers:ZG(e),...FG(e)}),eq=/\s+/,tq=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=t,o=[],l=e.trim().split(eq);let c="";for(let d=l.length-1;d>=0;d-=1){const f=l[d],{isExternal:h,modifiers:g,hasImportantModifier:b,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=b?E+OS: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 D=A[N];o.push(R+D)}c=f+(c.length>0?" "+c:c)}return c},nq=(...e)=>{let t=0,n,r,i="";for(;t<e.length;)(n=e[t++])&&(r=GO(n))&&(i&&(i+=" "),i+=r);return i},GO=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=GO(e[r]))&&(n&&(n+=" "),n+=t);return n},rq=(e,...t)=>{let n,r,i,s;const o=c=>{const d=t.reduce((f,h)=>h(f),e());return n=JG(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=tq(c,n);return i(c,f),f};return s=o,(...c)=>s(nq(...c))},iq=[],hr=e=>{const t=n=>n[e]||iq;return t.isThemeGetter=!0,t},qO=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,KO=/^\((?:(\w[\w-]*):)?(.+)\)$/i,sq=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,oq=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,aq=/\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$/,lq=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,cq=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,uq=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ua=e=>sq.test(e),Gt=e=>!!e&&!Number.isNaN(Number(e)),Va=e=>!!e&&Number.isInteger(Number(e)),Ky=e=>e.endsWith("%")&&Gt(e.slice(0,-1)),Po=e=>oq.test(e),YO=()=>!0,dq=e=>aq.test(e)&&!lq.test(e),hC=()=>!1,hq=e=>cq.test(e),fq=e=>uq.test(e),pq=e=>!nt(e)&&!it(e),mq=e=>Sl(e,ZO,hC),nt=e=>qO.test(e),Wl=e=>Sl(e,JO,dq),XA=e=>Sl(e,wq,Gt),gq=e=>Sl(e,t5,YO),vq=e=>Sl(e,e5,hC),QA=e=>Sl(e,XO,hC),bq=e=>Sl(e,QO,fq),Km=e=>Sl(e,n5,hq),it=e=>KO.test(e),zh=e=>Mc(e,JO),_q=e=>Mc(e,e5),ZA=e=>Mc(e,XO),yq=e=>Mc(e,ZO),xq=e=>Mc(e,QO),Ym=e=>Mc(e,n5,!0),Sq=e=>Mc(e,t5,!0),Sl=(e,t,n)=>{const r=qO.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Mc=(e,t,n=!1)=>{const r=KO.exec(e);return r?r[1]?t(r[1]):n:!1},XO=e=>e==="position"||e==="percentage",QO=e=>e==="image"||e==="url",ZO=e=>e==="length"||e==="size"||e==="bg-size",JO=e=>e==="length",wq=e=>e==="number",e5=e=>e==="family-name",t5=e=>e==="number"||e==="weight",n5=e=>e==="shadow",Cq=()=>{const e=hr("color"),t=hr("font"),n=hr("text"),r=hr("font-weight"),i=hr("tracking"),s=hr("leading"),o=hr("breakpoint"),l=hr("container"),c=hr("spacing"),d=hr("radius"),f=hr("shadow"),h=hr("inset-shadow"),g=hr("text-shadow"),b=hr("drop-shadow"),y=hr("blur"),x=hr("perspective"),w=hr("aspect"),C=hr("ease"),E=hr("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(),it,nt],N=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto","contain","none"],L=()=>[it,nt,c],q=()=>[Ua,"full","auto",...L()],j=()=>[Va,"none","subgrid",it,nt],F=()=>["auto",{span:["full",Va,it,nt]},Va,it,nt],B=()=>[Va,"auto",it,nt],O=()=>["auto","min","max","fr",it,nt],$=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],V=()=>["start","end","center","stretch","center-safe","end-safe"],z=()=>["auto",...L()],H=()=>[Ua,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...L()],U=()=>[Ua,"screen","full","dvw","lvw","svw","min","max","fit",...L()],Y=()=>[Ua,"screen","full","lh","dvh","lvh","svh","min","max","fit",...L()],P=()=>[e,it,nt],W=()=>[...T(),ZA,QA,{position:[it,nt]}],Z=()=>["no-repeat",{repeat:["","x","y","space","round"]}],I=()=>["auto","cover","contain",yq,mq,{size:[it,nt]}],re=()=>[Ky,zh,Wl],te=()=>["","none","full",d,it,nt],oe=()=>["",Gt,zh,Wl],se=()=>["solid","dashed","dotted","double"],pe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ce=()=>[Gt,Ky,ZA,QA],ge=()=>["","none",y,it,nt],Ce=()=>["none",Gt,it,nt],ke=()=>["none",Gt,it,nt],De=()=>[Gt,it,nt],be=()=>[Ua,"full",...L()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Po],breakpoint:[Po],color:[YO],container:[Po],"drop-shadow":[Po],ease:["in","out","in-out"],font:[pq],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Po],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Po],shadow:[Po],spacing:["px",Gt],text:[Po],"text-shadow":[Po],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ua,nt,it,w]}],container:["container"],columns:[{columns:[Gt,nt,it,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:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],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:[Va,"auto",it,nt]}],basis:[{basis:[Ua,"full","auto",l,...L()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Gt,Ua,"auto","initial","none",nt]}],grow:[{grow:["",Gt,it,nt]}],shrink:[{shrink:["",Gt,it,nt]}],order:[{order:[Va,"first","last","none",it,nt]}],"grid-cols":[{"grid-cols":j()}],"col-start-end":[{col:F()}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":j()}],"row-start-end":[{row:F()}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":O()}],"auto-rows":[{"auto-rows":O()}],gap:[{gap:L()}],"gap-x":[{"gap-x":L()}],"gap-y":[{"gap-y":L()}],"justify-content":[{justify:[...$(),"normal"]}],"justify-items":[{"justify-items":[...V(),"normal"]}],"justify-self":[{"justify-self":["auto",...V()]}],"align-content":[{content:["normal",...$()]}],"align-items":[{items:[...V(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...V(),{baseline:["","last"]}]}],"place-content":[{"place-content":$()}],"place-items":[{"place-items":[...V(),"baseline"]}],"place-self":[{"place-self":["auto",...V()]}],p:[{p:L()}],px:[{px:L()}],py:[{py:L()}],ps:[{ps:L()}],pe:[{pe:L()}],pbs:[{pbs:L()}],pbe:[{pbe:L()}],pt:[{pt:L()}],pr:[{pr:L()}],pb:[{pb:L()}],pl:[{pl:L()}],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":L()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":L()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],"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",...H()]}],"min-w":[{"min-w":[l,"screen","none",...H()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",n,zh,Wl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Sq,gq]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ky,nt]}],"font-family":[{font:[_q,vq,t]}],"font-features":[{"font-features":[nt]}],"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,it,nt]}],"line-clamp":[{"line-clamp":[Gt,"none",it,XA]}],leading:[{leading:[s,...L()]}],"list-image":[{"list-image":["none",it,nt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",it,nt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:[Gt,"from-font","auto",it,Wl]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[Gt,"auto",it,nt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",it,nt]}],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",it,nt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:W()}],"bg-repeat":[{bg:Z()}],"bg-size":[{bg:I()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Va,it,nt],radial:["",it,nt],conic:[Va,it,nt]},xq,bq]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:te()}],"rounded-s":[{"rounded-s":te()}],"rounded-e":[{"rounded-e":te()}],"rounded-t":[{"rounded-t":te()}],"rounded-r":[{"rounded-r":te()}],"rounded-b":[{"rounded-b":te()}],"rounded-l":[{"rounded-l":te()}],"rounded-ss":[{"rounded-ss":te()}],"rounded-se":[{"rounded-se":te()}],"rounded-ee":[{"rounded-ee":te()}],"rounded-es":[{"rounded-es":te()}],"rounded-tl":[{"rounded-tl":te()}],"rounded-tr":[{"rounded-tr":te()}],"rounded-br":[{"rounded-br":te()}],"rounded-bl":[{"rounded-bl":te()}],"border-w":[{border:oe()}],"border-w-x":[{"border-x":oe()}],"border-w-y":[{"border-y":oe()}],"border-w-s":[{"border-s":oe()}],"border-w-e":[{"border-e":oe()}],"border-w-bs":[{"border-bs":oe()}],"border-w-be":[{"border-be":oe()}],"border-w-t":[{"border-t":oe()}],"border-w-r":[{"border-r":oe()}],"border-w-b":[{"border-b":oe()}],"border-w-l":[{"border-l":oe()}],"divide-x":[{"divide-x":oe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":oe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...se(),"hidden","none"]}],"divide-style":[{divide:[...se(),"hidden","none"]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-bs":[{"border-bs":P()}],"border-color-be":[{"border-be":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Gt,it,nt]}],"outline-w":[{outline:["",Gt,zh,Wl]}],"outline-color":[{outline:P()}],shadow:[{shadow:["","none",f,Ym,Km]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",h,Ym,Km]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:oe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[Gt,Wl]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":["none",g,Ym,Km]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[Gt,it,nt]}],"mix-blend":[{"mix-blend":[...pe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":pe()}],"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":[Gt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ce()}],"mask-image-linear-to-pos":[{"mask-linear-to":ce()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":ce()}],"mask-image-t-to-pos":[{"mask-t-to":ce()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":ce()}],"mask-image-r-to-pos":[{"mask-r-to":ce()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":ce()}],"mask-image-b-to-pos":[{"mask-b-to":ce()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":ce()}],"mask-image-l-to-pos":[{"mask-l-to":ce()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":ce()}],"mask-image-x-to-pos":[{"mask-x-to":ce()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":ce()}],"mask-image-y-to-pos":[{"mask-y-to":ce()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[it,nt]}],"mask-image-radial-from-pos":[{"mask-radial-from":ce()}],"mask-image-radial-to-pos":[{"mask-radial-to":ce()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"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":[Gt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ce()}],"mask-image-conic-to-pos":[{"mask-conic-to":ce()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:W()}],"mask-repeat":[{mask:Z()}],"mask-size":[{mask:I()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",it,nt]}],filter:[{filter:["","none",it,nt]}],blur:[{blur:ge()}],brightness:[{brightness:[Gt,it,nt]}],contrast:[{contrast:[Gt,it,nt]}],"drop-shadow":[{"drop-shadow":["","none",b,Ym,Km]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",Gt,it,nt]}],"hue-rotate":[{"hue-rotate":[Gt,it,nt]}],invert:[{invert:["",Gt,it,nt]}],saturate:[{saturate:[Gt,it,nt]}],sepia:[{sepia:["",Gt,it,nt]}],"backdrop-filter":[{"backdrop-filter":["","none",it,nt]}],"backdrop-blur":[{"backdrop-blur":ge()}],"backdrop-brightness":[{"backdrop-brightness":[Gt,it,nt]}],"backdrop-contrast":[{"backdrop-contrast":[Gt,it,nt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Gt,it,nt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Gt,it,nt]}],"backdrop-invert":[{"backdrop-invert":["",Gt,it,nt]}],"backdrop-opacity":[{"backdrop-opacity":[Gt,it,nt]}],"backdrop-saturate":[{"backdrop-saturate":[Gt,it,nt]}],"backdrop-sepia":[{"backdrop-sepia":["",Gt,it,nt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":L()}],"border-spacing-x":[{"border-spacing-x":L()}],"border-spacing-y":[{"border-spacing-y":L()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",it,nt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Gt,"initial",it,nt]}],ease:[{ease:["linear","initial",C,it,nt]}],delay:[{delay:[Gt,it,nt]}],animate:[{animate:["none",E,it,nt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,it,nt]}],"perspective-origin":[{"perspective-origin":A()}],rotate:[{rotate:Ce()}],"rotate-x":[{"rotate-x":Ce()}],"rotate-y":[{"rotate-y":Ce()}],"rotate-z":[{"rotate-z":Ce()}],scale:[{scale:ke()}],"scale-x":[{"scale-x":ke()}],"scale-y":[{"scale-y":ke()}],"scale-z":[{"scale-z":ke()}],"scale-3d":["scale-3d"],skew:[{skew:De()}],"skew-x":[{"skew-x":De()}],"skew-y":[{"skew-y":De()}],transform:[{transform:[it,nt,"","none","gpu","cpu"]}],"transform-origin":[{origin:A()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:be()}],"translate-x":[{"translate-x":be()}],"translate-y":[{"translate-y":be()}],"translate-z":[{"translate-z":be()}],"translate-none":["translate-none"],accent:[{accent:P()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:P()}],"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",it,nt]}],"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":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mbs":[{"scroll-mbs":L()}],"scroll-mbe":[{"scroll-mbe":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pbs":[{"scroll-pbs":L()}],"scroll-pbe":[{"scroll-pbe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"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",it,nt]}],fill:[{fill:["none",...P()]}],"stroke-w":[{stroke:[Gt,zh,Wl,XA]}],stroke:[{stroke:["none",...P()]}],"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"]}},kq=rq(Cq);function ye(...e){return kq(HO(e))}function tc(){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 Eq(e){return e.startsWith("chatId:")?e.slice(7):e}const Af="data-focus-fallback-ignore",r5="data-allow-focus-retain",xv="kanna:restore-chat-input-focus",fC="data-chat-input",Sv="data-chat-selection-zone";function nc(e,t){return!!(e!=null&&e.closest(`[${t}]`))}function i5(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:nc(e,r5):!1}function Rq(e){const t=e;return t!=null&&t.matches?i5(e)||(t.tabIndex??-1)>=0||t.matches("button, a[href], summary")?!0:nc(e,r5):!1}function JA(e){return!!e.querySelector(`[${Af}][data-state='open']`)}function Tq(e){return e?!e.isCollapsed&&e.toString().trim().length>0:!1}function Aq(e,t){if(!e)return!1;const n=Array.from(t.querySelectorAll(`textarea[${fC}]`)).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 eN(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||nc(t,fC)||e.canCancel?"none":"escape-focus";const{pointerStartTarget:i,pointerEndTarget:s,root:o,hasActiveSelection:l}=e,c=s??i;return!o||!c||!o.contains(c)||nc(c,Af)||nc(t,Af)||l&&(nc(i,Sv)||nc(c,Sv))||i5(t)?"none":t&&t===c?"restore":Rq(t)?"none":"restore"}const ea=LG,Nq=DG,s5=_.forwardRef(({className:e,...t},n)=>m.jsx(BO,{ref:n,className:ye("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}));s5.displayName=BO.displayName;const Mq={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},uo=_.forwardRef(({className:e,children:t,size:n="md",...r},i)=>m.jsxs(Nq,{children:[m.jsx(s5,{}),m.jsxs(FO,{ref:i,[Af]:"",onCloseAutoFocus:s=>{var o;s.preventDefault(),window.dispatchEvent(new Event(xv)),(o=r.onCloseAutoFocus)==null||o.call(r,s)},className:ye("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",Mq[n],e),...r,children:[t,m.jsxs(OG,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[m.jsx(xl,{className:"h-4 w-4"}),m.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));uo.displayName=FO.displayName;function pC({className:e,...t}){return m.jsx("div",{className:ye("shrink-0 flex flex-col space-y-1.5 p-4 border-b border-border",e),...t})}function ta({className:e,...t}){return m.jsx(IG,{className:ye("text-lg font-medium leading-none tracking-tight",e),...t})}function Td({className:e,...t}){return m.jsx(PG,{className:ye("text-sm text-muted-foreground",e),...t})}function na({className:e,...t}){return m.jsx("div",{className:ye("flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-3.5",e),...t})}function gl({className:e,...t}){return m.jsx("div",{className:ye("shrink-0 flex justify-end gap-2 border-t border-border bg-background p-2 rounded-b-xl",e),...t})}function Lq({className:e,...t}){return m.jsx("button",{className:ye("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 Dq({className:e,...t}){return m.jsx("button",{className:ye("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 Iq({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(ea,{open:e,onOpenChange:n,children:m.jsxs(uo,{size:"md",children:[m.jsxs(pC,{children:[m.jsx(ta,{children:"Shared Link"}),m.jsx(Td,{children:"Shared links are snapshots in time and contain all attachments, tool calls and history. Be mindful of sensitive info."})]}),m.jsx(na,{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(ui,{className:"h-4 w-4 text-emerald-400"}):m.jsx(ml,{className:"h-4 w-4"})})]})}),m.jsx(gl,{children:m.jsxs(Lq,{type:"button",onClick:r,children:[m.jsx(tO,{className:"mr-2 h-4 w-4"}),"Open"]})})]})})}const tN=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,nN=HO,Pq=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return nN(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=tN(f)||tN(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,...b}=f;return Object.entries(b).every(y=>{let[x,w]=y;return Array.isArray(w)?w.includes({...s,...l}[x]):{...s,...l}[x]===w})?[...d,h,g]:d},[]);return nN(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},Nb=Pq("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","icon-mobile":"h-11 w-11 rounded-full md:h-9 md:w-9",none:"","icon-sm":"h-5.5 w-5.5 rounded-md"}},defaultVariants:{variant:"default",size:"default"}}),ot=_.forwardRef(({className:e,variant:t,size:n,type:r="button",...i},s)=>m.jsx("button",{type:r,className:ye(Nb({variant:t,size:n,className:e})),ref:s,...i}));ot.displayName="Button";const Cr=_.forwardRef(({className:e,type:t,...n},r)=>m.jsx("input",{ref:r,type:t,className:ye("flex w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",e),...n}));Cr.displayName="Input";const o5=_.createContext(null);function Oq({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 b,y;(b=s.current)==null||b.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(b=>new Promise(y=>{n({kind:"confirm",options:b,resolve:y})}),[]),f=_.useCallback(b=>new Promise(y=>{n({kind:"prompt",options:b,resolve:y})}),[]),h=_.useCallback(b=>new Promise(y=>{n({kind:"alert",options:b,resolve:y})}),[]),g=_.useMemo(()=>({confirm:d,prompt:f,alert:h}),[h,d,f]);return m.jsxs(o5.Provider,{value:g,children:[e,m.jsx(ea,{open:t!==null,onOpenChange:b=>{b||!t||l()},children:m.jsx(uo,{size:"sm",onKeyDown:b=>{b.key!=="Enter"||b.shiftKey||!t||t.kind!=="confirm"||(b.preventDefault(),c())},children:t?m.jsxs(m.Fragment,{children:[m.jsxs(na,{className:"space-y-4",children:[m.jsx(ta,{children:t.options.title}),t.options.description?m.jsx(Td,{children:t.options.description}):null,t.kind==="prompt"?m.jsx(Cr,{ref:s,type:"text",value:r,onChange:b=>i(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),c())},placeholder:t.options.placeholder}):null]}),m.jsxs(gl,{children:[m.jsx(ot,{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(ot,{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 cp(){const e=_.useContext(o5);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const mC=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:ye("bg-card text-card-foreground",e),...t}));mC.displayName="Card";const gC=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:ye("flex flex-col space-y-1.5 p-2",e),...t}));gC.displayName="CardHeader";const a5=_.forwardRef(({className:e,...t},n)=>m.jsx("h3",{ref:n,className:ye("text-2xl font-semibold leading-none tracking-tight",e),...t}));a5.displayName="CardTitle";const l5=_.forwardRef(({className:e,...t},n)=>m.jsx("p",{ref:n,className:ye("text-sm text-muted-foreground",e),...t}));l5.displayName="CardDescription";const vC=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:ye("p-6 pt-0",e),...t}));vC.displayName="CardContent";const jq=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:ye("flex items-center p-6 pt-0",e),...t}));jq.displayName="CardFooter";const zq=["top","right","bottom","left"],vl=Math.min,$i=Math.max,wv=Math.round,Xm=Math.floor,ao=e=>({x:e,y:e}),Bq={left:"right",right:"left",bottom:"top",top:"bottom"};function jS(e,t,n){return $i(e,vl(t,n))}function ra(e,t){return typeof e=="function"?e(t):e}function ia(e){return e.split("-")[0]}function Ad(e){return e.split("-")[1]}function bC(e){return e==="x"?"y":"x"}function _C(e){return e==="y"?"height":"width"}function no(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function yC(e){return bC(no(e))}function Fq(e,t,n){n===void 0&&(n=!1);const r=Ad(e),i=yC(e),s=_C(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=Cv(o)),[o,Cv(o)]}function $q(e){const t=Cv(e);return[zS(e),t,zS(t)]}function zS(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const rN=["left","right"],iN=["right","left"],Hq=["top","bottom"],Uq=["bottom","top"];function Vq(e,t,n){switch(e){case"top":case"bottom":return n?t?iN:rN:t?rN:iN;case"left":case"right":return t?Hq:Uq;default:return[]}}function Wq(e,t,n,r){const i=Ad(e);let s=Vq(ia(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(zS)))),s}function Cv(e){const t=ia(e);return Bq[t]+e.slice(t.length)}function Gq(e){return{top:0,right:0,bottom:0,left:0,...e}}function c5(e){return typeof e!="number"?Gq(e):{top:e,right:e,bottom:e,left:e}}function kv(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 sN(e,t,n){let{reference:r,floating:i}=e;const s=no(t),o=yC(t),l=_C(o),c=ia(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 b;switch(c){case"top":b={x:f,y:r.y-i.height};break;case"bottom":b={x:f,y:r.y+r.height};break;case"right":b={x:r.x+r.width,y:h};break;case"left":b={x:r.x-i.width,y:h};break;default:b={x:r.x,y:r.y}}switch(Ad(t)){case"start":b[o]-=g*(n&&d?-1:1);break;case"end":b[o]+=g*(n&&d?-1:1);break}return b}async function qq(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:b=0}=ra(t,e),y=c5(b),w=l[g?h==="floating"?"reference":"floating":h],C=kv(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=kv(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 Kq=50,Yq=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:qq},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}=sN(d,r,c),g=r,b=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&&b<Kq&&(b++,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}=sN(d,g,c)),x=-1)}return{x:f,y:h,placement:g,strategy:i,middlewareData:y}},Xq=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}=ra(e,t)||{};if(d==null)return{};const h=c5(f),g={x:n,y:r},b=yC(i),y=_C(b),x=await o.getDimensions(d),w=b==="y",C=w?"top":"left",E=w?"bottom":"right",R=w?"clientHeight":"clientWidth",T=s.reference[y]+s.reference[b]-g[b]-s.floating[y],A=g[b]-s.reference[b],N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let D=N?N[R]:0;(!D||!await(o.isElement==null?void 0:o.isElement(N)))&&(D=l.floating[R]||s.floating[y]);const L=T/2-A/2,q=D/2-x[y]/2-1,j=vl(h[C],q),F=vl(h[E],q),B=j,O=D-x[y]-F,$=D/2-x[y]/2+L,V=jS(B,$,O),z=!c.arrow&&Ad(i)!=null&&$!==V&&s.reference[y]/2-($<B?j:F)-x[y]/2<0,H=z?$<B?$-B:$-O:0;return{[b]:g[b]+H,data:{[b]:V,centerOffset:$-V-H,...z&&{alignmentOffset:H}},reset:z}}}),Qq=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:b="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:x=!0,...w}=ra(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const C=ia(i),E=no(l),R=ia(l)===l,T=await(c.isRTL==null?void 0:c.isRTL(d.floating)),A=g||(R||!x?[Cv(l)]:$q(l)),N=y!=="none";!g&&N&&A.push(...Wq(l,x,y,T));const D=[l,...A],L=await c.detectOverflow(t,w),q=[];let j=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&q.push(L[C]),h){const $=Fq(i,o,T);q.push(L[$[0]],L[$[1]])}if(j=[...j,{placement:i,overflows:q}],!q.every($=>$<=0)){var F,B;const $=(((F=s.flip)==null?void 0:F.index)||0)+1,V=D[$];if(V&&(!(h==="alignment"?E!==no(V):!1)||j.every(U=>no(U.placement)===E?U.overflows[0]>0:!0)))return{data:{index:$,overflows:j},reset:{placement:V}};let z=(B=j.filter(H=>H.overflows[0]<=0).sort((H,U)=>H.overflows[1]-U.overflows[1])[0])==null?void 0:B.placement;if(!z)switch(b){case"bestFit":{var O;const H=(O=j.filter(U=>{if(N){const Y=no(U.placement);return Y===E||Y==="y"}return!0}).map(U=>[U.placement,U.overflows.filter(Y=>Y>0).reduce((Y,P)=>Y+P,0)]).sort((U,Y)=>U[1]-Y[1])[0])==null?void 0:O[0];H&&(z=H);break}case"initialPlacement":z=l;break}if(i!==z)return{reset:{placement:z}}}return{}}}};function oN(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function aN(e){return zq.some(t=>e[t]>=0)}const Zq=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=ra(e,t);switch(i){case"referenceHidden":{const o=await r.detectOverflow(t,{...s,elementContext:"reference"}),l=oN(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:aN(l)}}}case"escaped":{const o=await r.detectOverflow(t,{...s,altBoundary:!0}),l=oN(o,n.floating);return{data:{escapedOffsets:l,escaped:aN(l)}}}default:return{}}}}},u5=new Set(["left","top"]);async function Jq(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ia(n),l=Ad(n),c=no(n)==="y",d=u5.has(o)?-1:1,f=s&&c?-1:1,h=ra(t,e);let{mainAxis:g,crossAxis:b,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"&&(b=l==="end"?y*-1:y),c?{x:b*f,y:g*d}:{x:g*d,y:b*f}}const eK=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 Jq(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}}}}},tK=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}=ra(e,t),f={x:n,y:r},h=await s.detectOverflow(t,d),g=no(ia(i)),b=bC(g);let y=f[b],x=f[g];if(o){const C=b==="y"?"top":"left",E=b==="y"?"bottom":"right",R=y+h[C],T=y-h[E];y=jS(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=jS(R,x,T)}const w=c.fn({...t,[b]:y,[g]:x});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[b]:o,[g]:l}}}}}},nK=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}=ra(e,t),f={x:n,y:r},h=no(i),g=bC(h);let b=f[g],y=f[h];const x=ra(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;b<T?b=T:b>A&&(b=A)}if(d){var C,E;const R=g==="y"?"width":"height",T=u5.has(ia(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]:b,[h]:y}}}},rK=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}=ra(e,t),f=await o.detectOverflow(t,d),h=ia(i),g=Ad(i),b=no(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=vl(x-f[w],E),A=vl(y-f[C],R),N=!t.middlewareData.shift;let D=T,L=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(L=R),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(D=E),N&&!g){const j=$i(f.left,0),F=$i(f.right,0),B=$i(f.top,0),O=$i(f.bottom,0);b?L=y-2*(j!==0||F!==0?j+F:$i(f.left,f.right)):D=x-2*(B!==0||O!==0?B+O:$i(f.top,f.bottom))}await c({...t,availableWidth:L,availableHeight:D});const q=await o.getDimensions(l.floating);return y!==q.width||x!==q.height?{reset:{rects:!0}}:{}}}};function Mb(){return typeof window<"u"}function Nd(e){return d5(e)?(e.nodeName||"").toLowerCase():"#document"}function Hi(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function po(e){var t;return(t=(d5(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function d5(e){return Mb()?e instanceof Node||e instanceof Hi(e).Node:!1}function js(e){return Mb()?e instanceof Element||e instanceof Hi(e).Element:!1}function ca(e){return Mb()?e instanceof HTMLElement||e instanceof Hi(e).HTMLElement:!1}function lN(e){return!Mb()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Hi(e).ShadowRoot}function up(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=zs(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function iK(e){return/^(table|td|th)$/.test(Nd(e))}function Lb(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const sK=/transform|translate|scale|rotate|perspective|filter/,oK=/paint|layout|strict|content/,Gl=e=>!!e&&e!=="none";let Yy;function xC(e){const t=js(e)?zs(e):e;return Gl(t.transform)||Gl(t.translate)||Gl(t.scale)||Gl(t.rotate)||Gl(t.perspective)||!SC()&&(Gl(t.backdropFilter)||Gl(t.filter))||sK.test(t.willChange||"")||oK.test(t.contain||"")}function aK(e){let t=bl(e);for(;ca(t)&&!ad(t);){if(xC(t))return t;if(Lb(t))return null;t=bl(t)}return null}function SC(){return Yy==null&&(Yy=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Yy}function ad(e){return/^(html|body|#document)$/.test(Nd(e))}function zs(e){return Hi(e).getComputedStyle(e)}function Db(e){return js(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function bl(e){if(Nd(e)==="html")return e;const t=e.assignedSlot||e.parentNode||lN(e)&&e.host||po(e);return lN(t)?t.host:t}function h5(e){const t=bl(e);return ad(t)?e.ownerDocument?e.ownerDocument.body:e.body:ca(t)&&up(t)?t:h5(t)}function Nf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=h5(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=Hi(i);if(s){const l=BS(o);return t.concat(o,o.visualViewport||[],up(i)?i:[],l&&n?Nf(l):[])}else return t.concat(i,Nf(i,[],n))}function BS(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function f5(e){const t=zs(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=ca(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,l=wv(n)!==s||wv(r)!==o;return l&&(n=s,r=o),{width:n,height:r,$:l}}function wC(e){return js(e)?e:e.contextElement}function Yu(e){const t=wC(e);if(!ca(t))return ao(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=f5(t);let o=(s?wv(n.width):n.width)/r,l=(s?wv(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const lK=ao(0);function p5(e){const t=Hi(e);return!SC()||!t.visualViewport?lK:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function cK(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Hi(e)?!1:t}function _c(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=wC(e);let o=ao(1);t&&(r?js(r)&&(o=Yu(r)):o=Yu(e));const l=cK(s,n,r)?p5(s):ao(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=Hi(s),b=r&&js(r)?Hi(r):r;let y=g,x=BS(y);for(;x&&r&&b!==y;){const w=Yu(x),C=x.getBoundingClientRect(),E=zs(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=Hi(x),x=BS(y)}}return kv({width:f,height:h,x:c,y:d})}function Ib(e,t){const n=Db(e).scrollLeft;return t?t.left+n:_c(po(e)).left+n}function m5(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ib(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function uK(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=po(r),l=t?Lb(t.floating):!1;if(r===o||l&&s)return n;let c={scrollLeft:0,scrollTop:0},d=ao(1);const f=ao(0),h=ca(r);if((h||!h&&!s)&&((Nd(r)!=="body"||up(o))&&(c=Db(r)),h)){const b=_c(r);d=Yu(r),f.x=b.x+r.clientLeft,f.y=b.y+r.clientTop}const g=o&&!h&&!s?m5(o,c):ao(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 dK(e){return Array.from(e.getClientRects())}function hK(e){const t=po(e),n=Db(e),r=e.ownerDocument.body,i=$i(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=$i(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Ib(e);const l=-n.scrollTop;return zs(r).direction==="rtl"&&(o+=$i(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}const cN=25;function fK(e,t){const n=Hi(e),r=po(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=SC();(!f||f&&t==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}const d=Ib(r);if(d<=0){const f=r.ownerDocument,h=f.body,g=getComputedStyle(h),b=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,y=Math.abs(r.clientWidth-h.clientWidth-b);y<=cN&&(s-=y)}else d<=cN&&(s+=d);return{width:s,height:o,x:l,y:c}}function pK(e,t){const n=_c(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=ca(e)?Yu(e):ao(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 uN(e,t,n){let r;if(t==="viewport")r=fK(e,n);else if(t==="document")r=hK(po(e));else if(js(t))r=pK(t,n);else{const i=p5(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return kv(r)}function g5(e,t){const n=bl(e);return n===t||!js(n)||ad(n)?!1:zs(n).position==="fixed"||g5(n,t)}function mK(e,t){const n=t.get(e);if(n)return n;let r=Nf(e,[],!1).filter(l=>js(l)&&Nd(l)!=="body"),i=null;const s=zs(e).position==="fixed";let o=s?bl(e):e;for(;js(o)&&!ad(o);){const l=zs(o),c=xC(o);!c&&l.position==="fixed"&&(i=null),(s?!c&&!i:!c&&l.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||up(o)&&!c&&g5(e,o))?r=r.filter(f=>f!==o):i=l,o=bl(o)}return t.set(e,r),r}function gK(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?Lb(t)?[]:mK(t,this._c):[].concat(n),r],l=uN(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 b=uN(t,o[g],i);c=$i(b.top,c),d=vl(b.right,d),f=vl(b.bottom,f),h=$i(b.left,h)}return{width:d-h,height:f-c,x:h,y:c}}function vK(e){const{width:t,height:n}=f5(e);return{width:t,height:n}}function bK(e,t,n){const r=ca(t),i=po(t),s=n==="fixed",o=_c(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=ao(0);function d(){c.x=Ib(i)}if(r||!r&&!s)if((Nd(t)!=="body"||up(i))&&(l=Db(t)),r){const b=_c(t,!0,s,t);c.x=b.x+t.clientLeft,c.y=b.y+t.clientTop}else i&&d();s&&!r&&i&&d();const f=i&&!r&&!s?m5(i,l):ao(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 Xy(e){return zs(e).position==="static"}function dN(e,t){if(!ca(e)||zs(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return po(e)===n&&(n=n.ownerDocument.body),n}function v5(e,t){const n=Hi(e);if(Lb(e))return n;if(!ca(e)){let i=bl(e);for(;i&&!ad(i);){if(js(i)&&!Xy(i))return i;i=bl(i)}return n}let r=dN(e,t);for(;r&&iK(r)&&Xy(r);)r=dN(r,t);return r&&ad(r)&&Xy(r)&&!xC(r)?n:r||aK(e)||n}const _K=async function(e){const t=this.getOffsetParent||v5,n=this.getDimensions,r=await n(e.floating);return{reference:bK(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function yK(e){return zs(e).direction==="rtl"}const xK={convertOffsetParentRelativeRectToViewportRelativeRect:uK,getDocumentElement:po,getClippingRect:gK,getOffsetParent:v5,getElementRects:_K,getClientRects:dK,getDimensions:vK,getScale:Yu,isElement:js,isRTL:yK};function b5(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function SK(e,t){let n=null,r;const i=po(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:b}=d;if(l||t(),!g||!b)return;const y=Xm(h),x=Xm(i.clientWidth-(f+g)),w=Xm(i.clientHeight-(h+b)),C=Xm(f),R={rootMargin:-y+"px "+-x+"px "+-w+"px "+-C+"px",threshold:$i(0,vl(1,c))||1};let T=!0;function A(N){const D=N[0].intersectionRatio;if(D!==c){if(!T)return o();D?o(!1,D):r=setTimeout(()=>{o(!1,1e-7)},1e3)}D===1&&!b5(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 wK(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=wC(e),f=i||s?[...d?Nf(d):[],...t?Nf(t):[]]:[];f.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const h=d&&l?SK(d,n):null;let g=-1,b=null;o&&(b=new ResizeObserver(C=>{let[E]=C;E&&E.target===d&&b&&t&&(b.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var R;(R=b)==null||R.observe(t)})),n()}),d&&!c&&b.observe(d),t&&b.observe(t));let y,x=c?_c(e):null;c&&w();function w(){const C=_c(e);x&&!b5(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=b)==null||C.disconnect(),b=null,c&&cancelAnimationFrame(y)}}const CK=eK,kK=tK,EK=Qq,RK=rK,TK=Zq,hN=Xq,AK=nK,NK=(e,t,n)=>{const r=new Map,i={platform:xK,...n},s={...i.platform,_c:r};return Yq(e,t,{...i,platform:s})};var MK=typeof document<"u",LK=function(){},Kg=MK?_.useLayoutEffect:LK;function Ev(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(!Ev(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)&&!Ev(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function _5(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function fN(e,t){const n=_5(e);return Math.round(t*n)/n}function Qy(e){const t=_.useRef(e);return Kg(()=>{t.current=e}),t}function DK(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,b]=_.useState(r);Ev(g,r)||b(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!==D.current&&(D.current=U,C(U))},[]),T=s||y,A=o||w,N=_.useRef(null),D=_.useRef(null),L=_.useRef(f),q=c!=null,j=Qy(c),F=Qy(i),B=Qy(d),O=_.useCallback(()=>{if(!N.current||!D.current)return;const U={placement:t,strategy:n,middleware:g};F.current&&(U.platform=F.current),NK(N.current,D.current,U).then(Y=>{const P={...Y,isPositioned:B.current!==!1};$.current&&!Ev(L.current,P)&&(L.current=P,fs.flushSync(()=>{h(P)}))})},[g,t,n,F,B]);Kg(()=>{d===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,h(U=>({...U,isPositioned:!1})))},[d]);const $=_.useRef(!1);Kg(()=>($.current=!0,()=>{$.current=!1}),[]),Kg(()=>{if(T&&(N.current=T),A&&(D.current=A),T&&A){if(j.current)return j.current(T,A,O);O()}},[T,A,O,j,q]);const V=_.useMemo(()=>({reference:N,floating:D,setReference:E,setFloating:R}),[E,R]),z=_.useMemo(()=>({reference:T,floating:A}),[T,A]),H=_.useMemo(()=>{const U={position:n,left:0,top:0};if(!z.floating)return U;const Y=fN(z.floating,f.x),P=fN(z.floating,f.y);return l?{...U,transform:"translate("+Y+"px, "+P+"px)",..._5(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Y,top:P}},[n,l,z.floating,f.x,f.y]);return _.useMemo(()=>({...f,update:O,refs:V,elements:z,floatingStyles:H}),[f,O,V,z,H])}const IK=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?hN({element:r.current,padding:i}).fn(n):{}:r?hN({element:r,padding:i}).fn(n):{}}}},PK=(e,t)=>{const n=CK(e);return{name:n.name,fn:n.fn,options:[e,t]}},OK=(e,t)=>{const n=kK(e);return{name:n.name,fn:n.fn,options:[e,t]}},jK=(e,t)=>({fn:AK(e).fn,options:[e,t]}),zK=(e,t)=>{const n=EK(e);return{name:n.name,fn:n.fn,options:[e,t]}},BK=(e,t)=>{const n=RK(e);return{name:n.name,fn:n.fn,options:[e,t]}},FK=(e,t)=>{const n=TK(e);return{name:n.name,fn:n.fn,options:[e,t]}},$K=(e,t)=>{const n=IK(e);return{name:n.name,fn:n.fn,options:[e,t]}};var HK="Arrow",y5=_.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return m.jsx(Jt.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"})})});y5.displayName=HK;var UK=y5;function VK(e){const[t,n]=_.useState(void 0);return Xr(()=>{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 CC="Popper",[x5,wl]=la(CC),[WK,S5]=x5(CC),w5=e=>{const{__scopePopper:t,children:n}=e,[r,i]=_.useState(null);return m.jsx(WK,{scope:t,anchor:r,onAnchorChange:i,children:n})};w5.displayName=CC;var C5="PopperAnchor",k5=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=S5(C5,n),o=_.useRef(null),l=pn(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(Jt.div,{...i,ref:l})});k5.displayName=C5;var kC="PopperContent",[GK,qK]=x5(kC),E5=_.forwardRef((e,t)=>{var se,pe,ce,ge,Ce,ke;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:b="optimized",onPlaced:y,...x}=e,w=S5(kC,n),[C,E]=_.useState(null),R=pn(t,De=>E(De)),[T,A]=_.useState(null),N=VK(T),D=(N==null?void 0:N.width)??0,L=(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},F=Array.isArray(d)?d:[d],B=F.length>0,O={padding:j,boundary:F.filter(YK),altBoundary:B},{refs:$,floatingStyles:V,placement:z,isPositioned:H,middlewareData:U}=DK({strategy:"fixed",placement:q,whileElementsMounted:(...De)=>wK(...De,{animationFrame:b==="always"}),elements:{reference:w.anchor},middleware:[PK({mainAxis:i+L,alignmentAxis:o}),c&&OK({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?jK():void 0,...O}),c&&zK({...O}),BK({...O,apply:({elements:De,rects:be,availableWidth:rt,availableHeight:Et})=>{const{width:pt,height:sn}=be.reference,$t=De.floating.style;$t.setProperty("--radix-popper-available-width",`${rt}px`),$t.setProperty("--radix-popper-available-height",`${Et}px`),$t.setProperty("--radix-popper-anchor-width",`${pt}px`),$t.setProperty("--radix-popper-anchor-height",`${sn}px`)}}),T&&$K({element:T,padding:l}),XK({arrowWidth:D,arrowHeight:L}),g&&FK({strategy:"referenceHidden",...O})]}),[Y,P]=A5(z),W=Os(y);Xr(()=>{H&&(W==null||W())},[H,W]);const Z=(se=U.arrow)==null?void 0:se.x,I=(pe=U.arrow)==null?void 0:pe.y,re=((ce=U.arrow)==null?void 0:ce.centerOffset)!==0,[te,oe]=_.useState();return Xr(()=>{C&&oe(window.getComputedStyle(C).zIndex)},[C]),m.jsx("div",{ref:$.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:H?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:te,"--radix-popper-transform-origin":[(ge=U.transformOrigin)==null?void 0:ge.x,(Ce=U.transformOrigin)==null?void 0:Ce.y].join(" "),...((ke=U.hide)==null?void 0:ke.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:m.jsx(GK,{scope:n,placedSide:Y,onArrowChange:A,arrowX:Z,arrowY:I,shouldHideArrow:re,children:m.jsx(Jt.div,{"data-side":Y,"data-align":P,...x,ref:R,style:{...x.style,animation:H?void 0:"none"}})})})});E5.displayName=kC;var R5="PopperArrow",KK={top:"bottom",right:"left",bottom:"top",left:"right"},T5=_.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=qK(R5,r),o=KK[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(UK,{...i,ref:n,style:{...i.style,display:"block"}})})});T5.displayName=R5;function YK(e){return e!==null}var XK=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]=A5(n),h={start:"0%",center:"50%",end:"100%"}[f],g=(((C=i.arrow)==null?void 0:C.x)??0)+l/2,b=(((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:`${b}px`):d==="left"&&(y=`${r.floating.width+c}px`,x=o?h:`${b}px`),{data:{x:y,y:x}}}});function A5(e){const[t,n="center"]=e.split("-");return[t,n]}var Pb=w5,dp=k5,Ob=E5,jb=T5,N5=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"}),QK="VisuallyHidden",M5=_.forwardRef((e,t)=>m.jsx(Jt.span,{...e,ref:t,style:{...N5,...e.style}}));M5.displayName=QK;var ZK=M5,[zb]=la("Tooltip",[wl]),Bb=wl(),L5="TooltipProvider",JK=700,FS="tooltip.open",[eY,EC]=zb(L5),D5=e=>{const{__scopeTooltip:t,delayDuration:n=JK,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(eY,{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})};D5.displayName=L5;var Mf="Tooltip",[tY,hp]=zb(Mf),I5=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:l}=e,c=EC(Mf,e.__scopeTooltip),d=Bb(t),[f,h]=_.useState(null),g=Xo(),b=_.useRef(0),y=o??c.disableHoverableContent,x=l??c.delayDuration,w=_.useRef(!1),[C,E]=od({prop:r,defaultProp:i??!1,onChange:D=>{D?(c.onOpen(),document.dispatchEvent(new CustomEvent(FS))):c.onClose(),s==null||s(D)},caller:Mf}),R=_.useMemo(()=>C?w.current?"delayed-open":"instant-open":"closed",[C]),T=_.useCallback(()=>{window.clearTimeout(b.current),b.current=0,w.current=!1,E(!0)},[E]),A=_.useCallback(()=>{window.clearTimeout(b.current),b.current=0,E(!1)},[E]),N=_.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{w.current=!0,E(!0),b.current=0},x)},[x,E]);return _.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),m.jsx(Pb,{...d,children:m.jsx(tY,{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(b.current),b.current=0)},[A,y]),onOpen:T,onClose:A,disableHoverableContent:y,children:n})})};I5.displayName=Mf;var $S="TooltipTrigger",P5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=hp($S,n),s=EC($S,n),o=Bb(n),l=_.useRef(null),c=pn(t,l,i.onTriggerChange),d=_.useRef(!1),f=_.useRef(!1),h=_.useCallback(()=>d.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),m.jsx(dp,{asChild:!0,...o,children:m.jsx(Jt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:Je(e.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:Je(e.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:Je(e.onPointerDown,()=>{i.open&&i.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Je(e.onFocus,()=>{d.current||i.onOpen()}),onBlur:Je(e.onBlur,i.onClose),onClick:Je(e.onClick,i.onClose)})})});P5.displayName=$S;var RC="TooltipPortal",[nY,rY]=zb(RC,{forceMount:void 0}),O5=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,s=hp(RC,t);return m.jsx(nY,{scope:t,forceMount:n,children:m.jsx(ys,{present:n||s.open,children:m.jsx(Rd,{asChild:!0,container:i,children:r})})})};O5.displayName=RC;var ld="TooltipContent",j5=_.forwardRef((e,t)=>{const n=rY(ld,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=e,o=hp(ld,e.__scopeTooltip);return m.jsx(ys,{present:r||o.open,children:o.disableHoverableContent?m.jsx(z5,{side:i,...s,ref:t}):m.jsx(iY,{side:i,...s,ref:t})})}),iY=_.forwardRef((e,t)=>{const n=hp(ld,e.__scopeTooltip),r=EC(ld,e.__scopeTooltip),i=_.useRef(null),s=pn(t,i),[o,l]=_.useState(null),{trigger:c,onClose:d}=n,f=i.current,{onPointerInTransitChange:h}=r,g=_.useCallback(()=>{l(null),h(!1)},[h]),b=_.useCallback((y,x)=>{const w=y.currentTarget,C={x:y.clientX,y:y.clientY},E=cY(C,w.getBoundingClientRect()),R=uY(C,E),T=dY(x.getBoundingClientRect()),A=fY([...R,...T]);l(A),h(!0)},[h]);return _.useEffect(()=>()=>g(),[g]),_.useEffect(()=>{if(c&&f){const y=w=>b(w,f),x=w=>b(w,c);return c.addEventListener("pointerleave",y),f.addEventListener("pointerleave",x),()=>{c.removeEventListener("pointerleave",y),f.removeEventListener("pointerleave",x)}}},[c,f,b,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=!hY(C,o);E?g():R&&(g(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,f,o,d,g]),m.jsx(z5,{...e,ref:s})}),[sY,oY]=zb(Mf,{isInside:!1}),aY=fW("TooltipContent"),z5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...l}=e,c=hp(ld,n),d=Bb(n),{onClose:f}=c;return _.useEffect(()=>(document.addEventListener(FS,f),()=>document.removeEventListener(FS,f)),[f]),_.useEffect(()=>{if(c.trigger){const h=g=>{const b=g.target;b!=null&&b.contains(c.trigger)&&f()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,f]),m.jsx(Ed,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:m.jsxs(Ob,{"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(aY,{children:r}),m.jsx(sY,{scope:n,isInside:!0,children:m.jsx(ZK,{id:c.contentId,role:"tooltip",children:i||r})})]})})});j5.displayName=ld;var B5="TooltipArrow",lY=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Bb(n);return oY(B5,n).isInside?null:m.jsx(jb,{...i,...r,ref:t})});lY.displayName=B5;function cY(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 uY(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 dY(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 hY(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 fY(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),pY(t)}function pY(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 mY=D5,F5=I5,$5=P5,H5=O5,TC=j5;function U5({className:e,...t}){return m.jsx("kbd",{className:ye("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 gY({className:e,...t}){return m.jsx("span",{className:ye("inline-flex items-center gap-0.5",e),...t})}const vY="z-50 overflow-hidden rounded-md border border-border bg-card 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",bY=mY,Qo=F5,Zo=$5,lo=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(H5,{children:m.jsx(TC,{ref:r,sideOffset:t,className:ye("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})}));lo.displayName=TC.displayName;const Rv=F5,Tv=$5;function V5(e){return e.toUpperCase()}function _Y(e){const t=e.split("+");return m.jsx(gY,{children:t.map((n,r)=>m.jsx(U5,{children:V5(n)},`${n}-${r}`))})}const Lf=_.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(H5,{children:m.jsx(TC,{ref:s,sideOffset:t,className:ye(vY,e),...i,children:o?_Y(o):m.jsx("span",{children:typeof n=="string"?V5(n):n})})})});Lf.displayName="HotkeyTooltipContent";const yY="0.42.3",xY={version:yY},er="Kanna",pN="kanna",SY=".kanna",wY=".kanna-dev",CY="KANNA_RUNTIME_PROFILE",AC=`kanna/${xY.version}`,kY="[kanna]",EY=`~/${er}`;function Fb(){var t;return(t=globalThis.process)==null?void 0:t.env}function RY(e=Fb()){var t;return((t=e==null?void 0:e[CY])==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function TY(e=Fb()){return RY(e)==="dev"?wY:SY}function AY(e=Fb()){return`~/${TY(e)}`}function NY(e=Fb()){return`${AY(e)}/keybindings.json`}function Qm(e){return e?`${pN} ${e}`:pN}const mN=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(b=>b(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},MY=(e=>e?mN(e):mN),LY=e=>e;function DY(e,t=LY){const n=Cn.useSyncExternalStore(e.subscribe,Cn.useCallback(()=>t(e.getState()),[e,t]),Cn.useCallback(()=>t(e.getInitialState()),[e,t]));return Cn.useDebugValue(n),n}const IY=e=>{const t=MY(e),n=r=>DY(t,r);return Object.assign(n,t),n},mo=(e=>IY),W5="always",G5="funk",PY=[{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 OY(e){switch(e){case"never":case"unfocused":case"always":return e;default:return W5}}function jY(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 G5}}const oc=mo()(e=>({chatSoundPreference:W5,chatSoundId:G5,setChatSoundPreference:t=>e({chatSoundPreference:OY(t)}),setChatSoundId:t=>e({chatSoundId:jY(t)})})),zY={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 BY(e=document){return e.visibilityState!=="visible"||!e.hasFocus()}function FY(e){const t=new Audio(zY[e]);return t.preload="auto",t.play()}async function HS(e,t){if(t<=0)return;const n=Array.from({length:t},(r,i)=>new Promise(s=>{window.setTimeout(()=>{FY(e).catch(()=>{}).finally(()=>s())},i*90)}));await Promise.all(n)}function $Y(e,t=document){return e==="never"?!1:e==="always"?!0:BY(t)}function HY(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 gN(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 UY(e,t){if(!e)return 0;const n=gN(e),r=gN(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 US(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const VY=[/^(?:\/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 WY(e){const t=e.trim();for(const n of VY){const r=t.match(n);if(!r)continue;const i=(r[2]??r[1]??"").trim();if(i)return i}return t}function q5(e){return e.split("/").pop()||e}const GY=1440*6e4;function K5(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,i=60*r,s=GY,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 Y5(e){return e.lastMessageAt??e._creationTime}const Md=({children:e,className:t,animate:n=!0,shimmerWidth:r,...i})=>m.jsx("span",{className:ye("mx-auto max-w-md text-foreground/60",n&&"animate-shiny-pulse",t),...i,children:e});function NC(e){const t=e+"CollectionProvider",[n,r]=la(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=x=>{const{scope:w,children:C}=x,E=Cn.useRef(null),R=Cn.useRef(new Map).current;return m.jsx(i,{scope:w,itemMap:R,collectionRef:E,children:C})};o.displayName=t;const l=e+"CollectionSlot",c=vc(l),d=Cn.forwardRef((x,w)=>{const{scope:C,children:E}=x,R=s(l,C),T=pn(w,R.collectionRef);return m.jsx(c,{ref:T,children:E})});d.displayName=l;const f=e+"CollectionItemSlot",h="data-radix-collection-item",g=vc(f),b=Cn.forwardRef((x,w)=>{const{scope:C,children:E,...R}=x,T=Cn.useRef(null),A=pn(w,T),N=s(f,C);return Cn.useEffect(()=>(N.itemMap.set(T,{ref:T,...R}),()=>void N.itemMap.delete(T))),m.jsx(g,{[h]:"",ref:A,children:E})});b.displayName=f;function y(x){const w=s(e+"CollectionConsumer",x);return Cn.useCallback(()=>{const E=w.collectionRef.current;if(!E)return[];const R=Array.from(E.querySelectorAll(`[${h}]`));return Array.from(w.itemMap.values()).sort((N,D)=>R.indexOf(N.ref.current)-R.indexOf(D.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:o,Slot:d,ItemSlot:b},y,r]}var qY=_.createContext(void 0);function MC(e){const t=_.useContext(qY);return e||t||"ltr"}var Zy="rovingFocusGroup.onEntryFocus",KY={bubbles:!1,cancelable:!0},fp="RovingFocusGroup",[VS,X5,YY]=NC(fp),[XY,Q5]=la(fp,[YY]),[QY,ZY]=XY(fp),Z5=_.forwardRef((e,t)=>m.jsx(VS.Provider,{scope:e.__scopeRovingFocusGroup,children:m.jsx(VS.Slot,{scope:e.__scopeRovingFocusGroup,children:m.jsx(JY,{...e,ref:t})})}));Z5.displayName=fp;var JY=_.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),b=pn(t,g),y=MC(s),[x,w]=od({prop:o,defaultProp:l??null,onChange:c,caller:fp}),[C,E]=_.useState(!1),R=Os(d),T=X5(n),A=_.useRef(!1),[N,D]=_.useState(0);return _.useEffect(()=>{const L=g.current;if(L)return L.addEventListener(Zy,R),()=>L.removeEventListener(Zy,R)},[R]),m.jsx(QY,{scope:n,orientation:r,dir:y,loop:i,currentTabStopId:x,onItemFocus:_.useCallback(L=>w(L),[w]),onItemShiftTab:_.useCallback(()=>E(!0),[]),onFocusableItemAdd:_.useCallback(()=>D(L=>L+1),[]),onFocusableItemRemove:_.useCallback(()=>D(L=>L-1),[]),children:m.jsx(Jt.div,{tabIndex:C||N===0?-1:0,"data-orientation":r,...h,ref:b,style:{outline:"none",...e.style},onMouseDown:Je(e.onMouseDown,()=>{A.current=!0}),onFocus:Je(e.onFocus,L=>{const q=!A.current;if(L.target===L.currentTarget&&q&&!C){const j=new CustomEvent(Zy,KY);if(L.currentTarget.dispatchEvent(j),!j.defaultPrevented){const F=T().filter(z=>z.focusable),B=F.find(z=>z.active),O=F.find(z=>z.id===x),V=[B,O,...F].filter(Boolean).map(z=>z.ref.current);tj(V,f)}}A.current=!1}),onBlur:Je(e.onBlur,()=>E(!1))})})}),J5="RovingFocusGroupItem",ej=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...l}=e,c=Xo(),d=s||c,f=ZY(J5,n),h=f.currentTabStopId===d,g=X5(n),{onFocusableItemAdd:b,onFocusableItemRemove:y,currentTabStopId:x}=f;return _.useEffect(()=>{if(r)return b(),()=>y()},[r,b,y]),m.jsx(VS.ItemSlot,{scope:n,id:d,focusable:r,active:i,children:m.jsx(Jt.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...l,ref:t,onMouseDown:Je(e.onMouseDown,w=>{r?f.onItemFocus(d):w.preventDefault()}),onFocus:Je(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:Je(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){f.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const C=nX(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?rX(R,T+1):R.slice(T+1)}setTimeout(()=>tj(R))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:x!=null}):o})})});ej.displayName=J5;var eX={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function tX(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function nX(e,t,n){const r=tX(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return eX[r]}function tj(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function rX(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var iX=Z5,sX=ej,WS=["Enter"," "],oX=["ArrowDown","PageUp","Home"],nj=["ArrowUp","PageDown","End"],aX=[...oX,...nj],lX={ltr:[...WS,"ArrowRight"],rtl:[...WS,"ArrowLeft"]},cX={ltr:["ArrowLeft"],rtl:["ArrowRight"]},pp="Menu",[Df,uX,dX]=NC(pp),[Lc,rj]=la(pp,[dX,wl,Q5]),$b=wl(),ij=Q5(),[hX,Dc]=Lc(pp),[fX,mp]=Lc(pp),sj=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=e,l=$b(t),[c,d]=_.useState(null),f=_.useRef(!1),h=Os(s),g=MC(i);return _.useEffect(()=>{const b=()=>{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",b,{capture:!0}),()=>{document.removeEventListener("keydown",b,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),m.jsx(Pb,{...l,children:m.jsx(hX,{scope:t,open:n,onOpenChange:h,content:c,onContentChange:d,children:m.jsx(fX,{scope:t,onClose:_.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:f,dir:g,modal:o,children:r})})})};sj.displayName=pp;var pX="MenuAnchor",LC=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=$b(n);return m.jsx(dp,{...i,...r,ref:t})});LC.displayName=pX;var DC="MenuPortal",[mX,oj]=Lc(DC,{forceMount:void 0}),aj=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,s=Dc(DC,t);return m.jsx(mX,{scope:t,forceMount:n,children:m.jsx(ys,{present:n||s.open,children:m.jsx(Rd,{asChild:!0,container:i,children:r})})})};aj.displayName=DC;var ms="MenuContent",[gX,IC]=Lc(ms),lj=_.forwardRef((e,t)=>{const n=oj(ms,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Dc(ms,e.__scopeMenu),o=mp(ms,e.__scopeMenu);return m.jsx(Df.Provider,{scope:e.__scopeMenu,children:m.jsx(ys,{present:r||s.open,children:m.jsx(Df.Slot,{scope:e.__scopeMenu,children:o.modal?m.jsx(vX,{...i,ref:t}):m.jsx(bX,{...i,ref:t})})})})}),vX=_.forwardRef((e,t)=>{const n=Dc(ms,e.__scopeMenu),r=_.useRef(null),i=pn(t,r);return _.useEffect(()=>{const s=r.current;if(s)return Tb(s)},[]),m.jsx(PC,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Je(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),bX=_.forwardRef((e,t)=>{const n=Dc(ms,e.__scopeMenu);return m.jsx(PC,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),_X=vc("MenuContent.ScrollLock"),PC=_.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:b,disableOutsideScroll:y,...x}=e,w=Dc(ms,n),C=mp(ms,n),E=$b(n),R=ij(n),T=uX(n),[A,N]=_.useState(null),D=_.useRef(null),L=pn(t,D,w.onContentChange),q=_.useRef(0),j=_.useRef(""),F=_.useRef(0),B=_.useRef(null),O=_.useRef("right"),$=_.useRef(0),V=y?lp:_.Fragment,z=y?{as:_X,allowPinchZoom:!0}:void 0,H=Y=>{var se,pe;const P=j.current+Y,W=T().filter(ce=>!ce.disabled),Z=document.activeElement,I=(se=W.find(ce=>ce.ref.current===Z))==null?void 0:se.textValue,re=W.map(ce=>ce.textValue),te=MX(re,P,I),oe=(pe=W.find(ce=>ce.textValue===te))==null?void 0:pe.ref.current;(function ce(ge){j.current=ge,window.clearTimeout(q.current),ge!==""&&(q.current=window.setTimeout(()=>ce(""),1e3))})(P),oe&&setTimeout(()=>oe.focus())};_.useEffect(()=>()=>window.clearTimeout(q.current),[]),Eb();const U=_.useCallback(Y=>{var W,Z;return O.current===((W=B.current)==null?void 0:W.side)&&DX(Y,(Z=B.current)==null?void 0:Z.area)},[]);return m.jsx(gX,{scope:n,searchRef:j,onItemEnter:_.useCallback(Y=>{U(Y)&&Y.preventDefault()},[U]),onItemLeave:_.useCallback(Y=>{var P;U(Y)||((P=D.current)==null||P.focus(),N(null))},[U]),onTriggerLeave:_.useCallback(Y=>{U(Y)&&Y.preventDefault()},[U]),pointerGraceTimerRef:F,onPointerGraceIntentChange:_.useCallback(Y=>{B.current=Y},[]),children:m.jsx(V,{...z,children:m.jsx(ap,{asChild:!0,trapped:i,onMountAutoFocus:Je(s,Y=>{var P;Y.preventDefault(),(P=D.current)==null||P.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:m.jsx(Ed,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:g,onDismiss:b,children:m.jsx(iX,{asChild:!0,...R,dir:C.dir,orientation:"vertical",loop:r,currentTabStopId:A,onCurrentTabStopIdChange:N,onEntryFocus:Je(c,Y=>{C.isUsingKeyboardRef.current||Y.preventDefault()}),preventScrollOnEntryFocus:!0,children:m.jsx(Ob,{role:"menu","aria-orientation":"vertical","data-state":Cj(w.open),"data-radix-menu-content":"",dir:C.dir,...E,...x,ref:L,style:{outline:"none",...x.style},onKeyDown:Je(x.onKeyDown,Y=>{const W=Y.target.closest("[data-radix-menu-content]")===Y.currentTarget,Z=Y.ctrlKey||Y.altKey||Y.metaKey,I=Y.key.length===1;W&&(Y.key==="Tab"&&Y.preventDefault(),!Z&&I&&H(Y.key));const re=D.current;if(Y.target!==re||!aX.includes(Y.key))return;Y.preventDefault();const oe=T().filter(se=>!se.disabled).map(se=>se.ref.current);nj.includes(Y.key)&&oe.reverse(),AX(oe)}),onBlur:Je(e.onBlur,Y=>{Y.currentTarget.contains(Y.target)||(window.clearTimeout(q.current),j.current="")}),onPointerMove:Je(e.onPointerMove,If(Y=>{const P=Y.target,W=$.current!==Y.clientX;if(Y.currentTarget.contains(P)&&W){const Z=Y.clientX>$.current?"right":"left";O.current=Z,$.current=Y.clientX}}))})})})})})})});lj.displayName=ms;var yX="MenuGroup",OC=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Jt.div,{role:"group",...r,ref:t})});OC.displayName=yX;var xX="MenuLabel",cj=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Jt.div,{...r,ref:t})});cj.displayName=xX;var Av="MenuItem",vN="menu.itemSelect",Hb=_.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,s=_.useRef(null),o=mp(Av,e.__scopeMenu),l=IC(Av,e.__scopeMenu),c=pn(t,s),d=_.useRef(!1),f=()=>{const h=s.current;if(!n&&h){const g=new CustomEvent(vN,{bubbles:!0,cancelable:!0});h.addEventListener(vN,b=>r==null?void 0:r(b),{once:!0}),hO(h,g),g.defaultPrevented?d.current=!1:o.onClose()}};return m.jsx(uj,{...i,ref:c,disabled:n,onClick:Je(e.onClick,f),onPointerDown:h=>{var g;(g=e.onPointerDown)==null||g.call(e,h),d.current=!0},onPointerUp:Je(e.onPointerUp,h=>{var g;d.current||(g=h.currentTarget)==null||g.click()}),onKeyDown:Je(e.onKeyDown,h=>{const g=l.searchRef.current!=="";n||g&&h.key===" "||WS.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});Hb.displayName=Av;var uj=_.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=e,o=IC(Av,n),l=ij(n),c=_.useRef(null),d=pn(t,c),[f,h]=_.useState(!1),[g,b]=_.useState("");return _.useEffect(()=>{const y=c.current;y&&b((y.textContent??"").trim())},[s.children]),m.jsx(Df.ItemSlot,{scope:n,disabled:r,textValue:i??g,children:m.jsx(sX,{asChild:!0,...l,focusable:!r,children:m.jsx(Jt.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:d,onPointerMove:Je(e.onPointerMove,If(y=>{r?o.onItemLeave(y):(o.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Je(e.onPointerLeave,If(y=>o.onItemLeave(y))),onFocus:Je(e.onFocus,()=>h(!0)),onBlur:Je(e.onBlur,()=>h(!1))})})})}),SX="MenuCheckboxItem",dj=_.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return m.jsx(gj,{scope:e.__scopeMenu,checked:n,children:m.jsx(Hb,{role:"menuitemcheckbox","aria-checked":Nv(n)?"mixed":n,...i,ref:t,"data-state":zC(n),onSelect:Je(i.onSelect,()=>r==null?void 0:r(Nv(n)?!0:!n),{checkForDefaultPrevented:!1})})})});dj.displayName=SX;var hj="MenuRadioGroup",[wX,CX]=Lc(hj,{value:void 0,onValueChange:()=>{}}),fj=_.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,s=Os(r);return m.jsx(wX,{scope:e.__scopeMenu,value:n,onValueChange:s,children:m.jsx(OC,{...i,ref:t})})});fj.displayName=hj;var pj="MenuRadioItem",mj=_.forwardRef((e,t)=>{const{value:n,...r}=e,i=CX(pj,e.__scopeMenu),s=n===i.value;return m.jsx(gj,{scope:e.__scopeMenu,checked:s,children:m.jsx(Hb,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":zC(s),onSelect:Je(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});mj.displayName=pj;var jC="MenuItemIndicator",[gj,kX]=Lc(jC,{checked:!1}),vj=_.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,s=kX(jC,n);return m.jsx(ys,{present:r||Nv(s.checked)||s.checked===!0,children:m.jsx(Jt.span,{...i,ref:t,"data-state":zC(s.checked)})})});vj.displayName=jC;var EX="MenuSeparator",bj=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Jt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});bj.displayName=EX;var RX="MenuArrow",_j=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=$b(n);return m.jsx(jb,{...i,...r,ref:t})});_j.displayName=RX;var TX="MenuSub",[yCe,yj]=Lc(TX),tf="MenuSubTrigger",xj=_.forwardRef((e,t)=>{const n=Dc(tf,e.__scopeMenu),r=mp(tf,e.__scopeMenu),i=yj(tf,e.__scopeMenu),s=IC(tf,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(LC,{asChild:!0,...d,children:m.jsx(uj,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Cj(n.open),...e,ref:aC(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:Je(e.onPointerMove,If(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:Je(e.onPointerLeave,If(h=>{var b,y;f();const g=(b=n.content)==null?void 0:b.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:Je(e.onKeyDown,h=>{var b;const g=s.searchRef.current!=="";e.disabled||g&&h.key===" "||lX[r.dir].includes(h.key)&&(n.onOpenChange(!0),(b=n.content)==null||b.focus(),h.preventDefault())})})})});xj.displayName=tf;var Sj="MenuSubContent",wj=_.forwardRef((e,t)=>{const n=oj(ms,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Dc(ms,e.__scopeMenu),o=mp(ms,e.__scopeMenu),l=yj(Sj,e.__scopeMenu),c=_.useRef(null),d=pn(t,c);return m.jsx(Df.Provider,{scope:e.__scopeMenu,children:m.jsx(ys,{present:r||s.open,children:m.jsx(Df.Slot,{scope:e.__scopeMenu,children:m.jsx(PC,{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:Je(e.onFocusOutside,f=>{f.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Je(e.onEscapeKeyDown,f=>{o.onClose(),f.preventDefault()}),onKeyDown:Je(e.onKeyDown,f=>{var b;const h=f.currentTarget.contains(f.target),g=cX[o.dir].includes(f.key);h&&g&&(s.onOpenChange(!1),(b=l.trigger)==null||b.focus(),f.preventDefault())})})})})})});wj.displayName=Sj;function Cj(e){return e?"open":"closed"}function Nv(e){return e==="indeterminate"}function zC(e){return Nv(e)?"indeterminate":e?"checked":"unchecked"}function AX(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function NX(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function MX(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=NX(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 LX(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 DX(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return LX(n,t)}function If(e){return t=>t.pointerType==="mouse"?e(t):void 0}var IX=sj,PX=LC,OX=aj,jX=lj,zX=OC,BX=cj,FX=Hb,$X=dj,HX=fj,UX=mj,VX=vj,WX=bj,GX=_j,qX=xj,KX=wj,BC="ContextMenu",[YX]=la(BC,[rj]),di=rj(),[XX,kj]=YX(BC),Ej=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:s=!0}=e,[o,l]=_.useState(!1),c=di(t),d=Os(r),f=_.useCallback(h=>{l(h),d(h)},[d]);return m.jsx(XX,{scope:t,open:o,onOpenChange:f,modal:s,children:m.jsx(IX,{...c,dir:i,open:o,onOpenChange:f,modal:s,children:n})})};Ej.displayName=BC;var Rj="ContextMenuTrigger",Tj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:r=!1,...i}=e,s=kj(Rj,n),o=di(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(PX,{...o,virtualRef:c}),m.jsx(Jt.span,{"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,...i,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:Je(e.onContextMenu,g=>{f(),h(g),g.preventDefault()}),onPointerDown:r?e.onPointerDown:Je(e.onPointerDown,Zm(g=>{f(),d.current=window.setTimeout(()=>h(g),700)})),onPointerMove:r?e.onPointerMove:Je(e.onPointerMove,Zm(f)),onPointerCancel:r?e.onPointerCancel:Je(e.onPointerCancel,Zm(f)),onPointerUp:r?e.onPointerUp:Je(e.onPointerUp,Zm(f))})]})});Tj.displayName=Rj;var QX="ContextMenuPortal",Aj=e=>{const{__scopeContextMenu:t,...n}=e,r=di(t);return m.jsx(OX,{...r,...n})};Aj.displayName=QX;var Nj="ContextMenuContent",Mj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=kj(Nj,n),s=di(n),o=_.useRef(!1);return m.jsx(jX,{...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=Nj;var ZX="ContextMenuGroup",JX=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=di(n);return m.jsx(zX,{...i,...r,ref:t})});JX.displayName=ZX;var eQ="ContextMenuLabel",tQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=di(n);return m.jsx(BX,{...i,...r,ref:t})});tQ.displayName=eQ;var nQ="ContextMenuItem",Lj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=di(n);return m.jsx(FX,{...i,...r,ref:t})});Lj.displayName=nQ;var rQ="ContextMenuCheckboxItem",iQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=di(n);return m.jsx($X,{...i,...r,ref:t})});iQ.displayName=rQ;var sQ="ContextMenuRadioGroup",oQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=di(n);return m.jsx(HX,{...i,...r,ref:t})});oQ.displayName=sQ;var aQ="ContextMenuRadioItem",lQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=di(n);return m.jsx(UX,{...i,...r,ref:t})});lQ.displayName=aQ;var cQ="ContextMenuItemIndicator",uQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=di(n);return m.jsx(VX,{...i,...r,ref:t})});uQ.displayName=cQ;var dQ="ContextMenuSeparator",Dj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=di(n);return m.jsx(WX,{...i,...r,ref:t})});Dj.displayName=dQ;var hQ="ContextMenuArrow",fQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=di(n);return m.jsx(GX,{...i,...r,ref:t})});fQ.displayName=hQ;var pQ="ContextMenuSubTrigger",mQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=di(n);return m.jsx(qX,{...i,...r,ref:t})});mQ.displayName=pQ;var gQ="ContextMenuSubContent",vQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=di(n);return m.jsx(KX,{...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)"}})});vQ.displayName=gQ;function Zm(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var bQ=Ej,_Q=Tj,yQ=Aj,Ij=Mj,Pj=Lj,Oj=Dj;const jj=_.createContext(null);function Ld({onOpenChange:e,...t}){const[n,r]=_.useState(0),i=_.useCallback(()=>{r(s=>s+1),e==null||e(!1)},[e]);return m.jsx(jj.Provider,{value:i,children:m.jsx(bQ,{onOpenChange:e,...t},n)})}const Dd=_Q,Ic=_.forwardRef(({className:e,...t},n)=>m.jsx(yQ,{children:m.jsx(Ij,{ref:n,className:ye("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})}));Ic.displayName=Ij.displayName;const Hn=_.forwardRef(({className:e,onSelect:t,...n},r)=>{const i=_.useContext(jj);return m.jsx(Pj,{ref:r,className:ye("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})});Hn.displayName=Pj.displayName;const zj=_.forwardRef(({className:e,...t},n)=>m.jsx(Oj,{ref:n,className:ye("-mx-1 my-1 h-px bg-border",e),...t}));zj.displayName=Oj.displayName;function xQ({editorLabel:e,onCopyPath:t,onShowArchived:n,onOpenInFinder:r,onOpenInEditor:i,onHide:s,children:o}){return m.jsxs(Ld,{children:[m.jsx(Dd,{asChild:!0,children:o}),m.jsxs(Ic,{children:[m.jsxs(Hn,{onSelect:l=>{l.stopPropagation(),t()},children:[m.jsx(ml,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Copy Path"})]}),m.jsxs(Hn,{onSelect:l=>{l.stopPropagation(),n()},children:[m.jsx(Z1,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Show Archived"})]}),m.jsxs(Hn,{onSelect:l=>{l.stopPropagation(),r()},children:[m.jsx(wb,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Show in Finder"})]}),m.jsxs(Hn,{onSelect:l=>{l.stopPropagation(),i()},children:[m.jsx(J1,{className:"h-3.5 w-3.5"}),m.jsxs("span",{className:"text-xs font-medium",children:["Open in ",e]})]}),m.jsxs(Hn,{onSelect:l=>{l.stopPropagation(),s()},className:"text-destructive hover:bg-destructive/10 focus:bg-destructive/10",children:[m.jsx(i9,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Hide"})]})]})]})}function SQ({canFork:e,onRename:t,onShare:n,onOpenInFinder:r,onFork:i,onArchive:s,onDelete:o,children:l}){return m.jsxs(Ld,{children:[m.jsx(Dd,{asChild:!0,children:l}),m.jsxs(Ic,{children:[m.jsxs(Hn,{onSelect:c=>{c.preventDefault(),t()},children:[m.jsx(iC,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Rename"})]}),m.jsxs(Hn,{onSelect:c=>{c.preventDefault(),n()},children:[m.jsx(oC,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Share"})]}),m.jsxs(Hn,{onSelect:c=>{c.preventDefault(),r()},children:[m.jsx(wb,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Open in Finder"})]}),m.jsxs(Hn,{disabled:!e,onSelect:c=>{c.preventDefault(),e&&i()},children:[m.jsx(cO,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Fork"})]}),m.jsxs(Hn,{onSelect:c=>{c.preventDefault(),s()},children:[m.jsx(Z1,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Archive"})]}),m.jsxs(Hn,{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(uO,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Delete"})]})]})]})}const wQ=new Set(["starting","running"]);function CQ({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=K5(Y5(e),n),b=i&&r?r:g,y=i&&!!r,x=Eq(e.chatId),w=m.jsxs("div",{"data-chat-id":x,className:ye("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-border/40 "),onClick:()=>s(e.chatId),children:[wQ.has(e.status)?m.jsx(Rn,{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-info/80 animate-ping"}),m.jsx("div",{className:" rounded-full z-0 size-2.5 bg-info 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-success/80 animate-ping"}),m.jsx("div",{className:" rounded-full z-0 size-2.5 bg-success 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(Md,{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:ye("relative h-7 mr-[2px] shrink-0",e.canFork?"w-12":"w-6"),children:[b?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(U5,{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:b}):null,m.jsxs("div",{className:ye("absolute inset-0 flex items-center justify-end gap-0 opacity-100 mr-[3px]",b?"md:opacity-0 md:group-hover:opacity-100":"opacity-100 md:opacity-0 md:group-hover:opacity-100"),children:[e.canFork?m.jsx(ot,{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(cO,{className:"size-3.5"})}):null,m.jsx(ot,{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(Z1,{className:"size-3.5"})})]})]})]},e._id);return m.jsx(SQ,{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 kQ=_.memo(CQ);function EQ(){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 Ub=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Id(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function FC(e){return"nodeType"in e}function Ri(e){var t,n;return e?Id(e)?e:FC(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function $C(e){const{Document:t}=Ri(e);return e instanceof t}function gp(e){return Id(e)?!1:e instanceof Ri(e).HTMLElement}function Bj(e){return e instanceof Ri(e).SVGElement}function Pd(e){return e?Id(e)?e.document:FC(e)?$C(e)?e:gp(e)||Bj(e)?e.ownerDocument:document:document:document}const ho=Ub?_.useLayoutEffect:_.useEffect;function HC(e){const t=_.useRef(e);return ho(()=>{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 RQ(){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 Pf(e,t){t===void 0&&(t=[e]);const n=_.useRef(e);return ho(()=>{n.current!==e&&(n.current=e)},t),n}function vp(e,t){const n=_.useRef();return _.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Mv(e){const t=HC(e),n=_.useRef(null),r=_.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function GS(e){const t=_.useRef();return _.useEffect(()=>{t.current=e},[e]),t.current}let Jy={};function bp(e,t){return _.useMemo(()=>{if(t)return t;const n=Jy[e]==null?0:Jy[e]+1;return Jy[e]=n,e+"-"+n},[e,t])}function Fj(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 Xu=Fj(1),Lv=Fj(-1);function TQ(e){return"clientX"in e&&"clientY"in e}function UC(e){if(!e)return!1;const{KeyboardEvent:t}=Ri(e.target);return t&&e instanceof t}function AQ(e){if(!e)return!1;const{TouchEvent:t}=Ri(e.target);return t&&e instanceof t}function qS(e){if(AQ(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 TQ(e)?{x:e.clientX,y:e.clientY}:null}const Of=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[Of.Translate.toString(e),Of.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),bN="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function NQ(e){return e.matches(bN)?e:e.querySelector(bN)}const MQ={display:"none"};function LQ(e){let{id:t,value:n}=e;return Cn.createElement("div",{id:t,style:MQ},n)}function DQ(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 Cn.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function IQ(){const[e,t]=_.useState("");return{announce:_.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const $j=_.createContext(null);function PQ(e){const t=_.useContext($j);_.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function OQ(){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 jQ={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},NG="DialogDescriptionWarning",MG=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${zO(NG).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},LG=kO,DG=TO,BO=AO,FO=NO,IG=LO,PG=IO,OG=OO;function $O(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=$O(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function HO(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=$O(e))&&(r&&(r+=" "),r+=t);return r}const jG=(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},zG=(e,t)=>({classGroupId:e,validator:t}),UO=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),yv="-",qA=[],BG="arbitrary..",FG=e=>{const t=HG(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return $G(o);const l=o.split(yv),c=l[0]===""&&l.length>1?1:0;return VO(l,c,t)},getConflictingClassGroupIds:(o,l)=>{if(l){const c=r[o],d=n[o];return c?d?jG(d,c):c:d||qA}return n[o]||qA}}},VO=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const i=e[t],s=n.nextPart.get(i);if(s){const d=VO(e,t+1,s);if(d)return d}const o=n.validators;if(o===null)return;const l=t===0?e.join(yv):e.slice(t).join(yv),c=o.length;for(let d=0;d<c;d++){const f=o[d];if(f.validator(l))return f.classGroupId}},$G=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?BG+r:void 0})(),HG=e=>{const{theme:t,classGroups:n}=e;return UG(n,t)},UG=(e,t)=>{const n=UO();for(const r in e){const i=e[r];dC(i,n,r,t)}return n},dC=(e,t,n,r)=>{const i=e.length;for(let s=0;s<i;s++){const o=e[s];VG(o,t,n,r)}},VG=(e,t,n,r)=>{if(typeof e=="string"){WG(e,t,n);return}if(typeof e=="function"){GG(e,t,n,r);return}qG(e,t,n,r)},WG=(e,t,n)=>{const r=e===""?t:WO(t,e);r.classGroupId=n},GG=(e,t,n,r)=>{if(KG(e)){dC(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(zG(n,e))},qG=(e,t,n,r)=>{const i=Object.entries(e),s=i.length;for(let o=0;o<s;o++){const[l,c]=i[o];dC(c,WO(t,l),n,r)}},WO=(e,t)=>{let n=e;const r=t.split(yv),i=r.length;for(let s=0;s<i;s++){const o=r[s];let l=n.nextPart.get(o);l||(l=UO(),n.nextPart.set(o,l)),n=l}return n},KG=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,YG=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)}}},OS="!",KA=":",XG=[],YA=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),QG=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===KA){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,b=!1;h.endsWith(OS)?(g=h.slice(0,-1),b=!0):h.startsWith(OS)&&(g=h.slice(1),b=!0);const y=d&&d>c?d-c:void 0;return YA(s,b,g,y)};if(t){const i=t+KA,s=r;r=o=>o.startsWith(i)?s(o.slice(i.length)):YA(XG,!1,o,void 0,!0)}if(n){const i=r;r=s=>n({className:s,parseClassName:i})}return r},ZG=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}},JG=e=>({cache:YG(e.cacheSize),parseClassName:QG(e),sortModifiers:ZG(e),...FG(e)}),eq=/\s+/,tq=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=t,o=[],l=e.trim().split(eq);let c="";for(let d=l.length-1;d>=0;d-=1){const f=l[d],{isExternal:h,modifiers:g,hasImportantModifier:b,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=b?E+OS: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 D=A[N];o.push(R+D)}c=f+(c.length>0?" "+c:c)}return c},nq=(...e)=>{let t=0,n,r,i="";for(;t<e.length;)(n=e[t++])&&(r=GO(n))&&(i&&(i+=" "),i+=r);return i},GO=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=GO(e[r]))&&(n&&(n+=" "),n+=t);return n},rq=(e,...t)=>{let n,r,i,s;const o=c=>{const d=t.reduce((f,h)=>h(f),e());return n=JG(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=tq(c,n);return i(c,f),f};return s=o,(...c)=>s(nq(...c))},iq=[],hr=e=>{const t=n=>n[e]||iq;return t.isThemeGetter=!0,t},qO=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,KO=/^\((?:(\w[\w-]*):)?(.+)\)$/i,sq=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,oq=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,aq=/\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$/,lq=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,cq=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,uq=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ua=e=>sq.test(e),Gt=e=>!!e&&!Number.isNaN(Number(e)),Va=e=>!!e&&Number.isInteger(Number(e)),Ky=e=>e.endsWith("%")&&Gt(e.slice(0,-1)),Po=e=>oq.test(e),YO=()=>!0,dq=e=>aq.test(e)&&!lq.test(e),hC=()=>!1,hq=e=>cq.test(e),fq=e=>uq.test(e),pq=e=>!nt(e)&&!it(e),mq=e=>Sl(e,ZO,hC),nt=e=>qO.test(e),Wl=e=>Sl(e,JO,dq),XA=e=>Sl(e,wq,Gt),gq=e=>Sl(e,t5,YO),vq=e=>Sl(e,e5,hC),QA=e=>Sl(e,XO,hC),bq=e=>Sl(e,QO,fq),Km=e=>Sl(e,n5,hq),it=e=>KO.test(e),zh=e=>Mc(e,JO),_q=e=>Mc(e,e5),ZA=e=>Mc(e,XO),yq=e=>Mc(e,ZO),xq=e=>Mc(e,QO),Ym=e=>Mc(e,n5,!0),Sq=e=>Mc(e,t5,!0),Sl=(e,t,n)=>{const r=qO.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Mc=(e,t,n=!1)=>{const r=KO.exec(e);return r?r[1]?t(r[1]):n:!1},XO=e=>e==="position"||e==="percentage",QO=e=>e==="image"||e==="url",ZO=e=>e==="length"||e==="size"||e==="bg-size",JO=e=>e==="length",wq=e=>e==="number",e5=e=>e==="family-name",t5=e=>e==="number"||e==="weight",n5=e=>e==="shadow",Cq=()=>{const e=hr("color"),t=hr("font"),n=hr("text"),r=hr("font-weight"),i=hr("tracking"),s=hr("leading"),o=hr("breakpoint"),l=hr("container"),c=hr("spacing"),d=hr("radius"),f=hr("shadow"),h=hr("inset-shadow"),g=hr("text-shadow"),b=hr("drop-shadow"),y=hr("blur"),x=hr("perspective"),w=hr("aspect"),C=hr("ease"),E=hr("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(),it,nt],N=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto","contain","none"],L=()=>[it,nt,c],q=()=>[Ua,"full","auto",...L()],j=()=>[Va,"none","subgrid",it,nt],F=()=>["auto",{span:["full",Va,it,nt]},Va,it,nt],B=()=>[Va,"auto",it,nt],O=()=>["auto","min","max","fr",it,nt],$=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],V=()=>["start","end","center","stretch","center-safe","end-safe"],z=()=>["auto",...L()],H=()=>[Ua,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...L()],U=()=>[Ua,"screen","full","dvw","lvw","svw","min","max","fit",...L()],Y=()=>[Ua,"screen","full","lh","dvh","lvh","svh","min","max","fit",...L()],P=()=>[e,it,nt],W=()=>[...T(),ZA,QA,{position:[it,nt]}],Z=()=>["no-repeat",{repeat:["","x","y","space","round"]}],I=()=>["auto","cover","contain",yq,mq,{size:[it,nt]}],re=()=>[Ky,zh,Wl],te=()=>["","none","full",d,it,nt],oe=()=>["",Gt,zh,Wl],se=()=>["solid","dashed","dotted","double"],pe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ce=()=>[Gt,Ky,ZA,QA],ge=()=>["","none",y,it,nt],Ce=()=>["none",Gt,it,nt],ke=()=>["none",Gt,it,nt],De=()=>[Gt,it,nt],be=()=>[Ua,"full",...L()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Po],breakpoint:[Po],color:[YO],container:[Po],"drop-shadow":[Po],ease:["in","out","in-out"],font:[pq],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Po],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Po],shadow:[Po],spacing:["px",Gt],text:[Po],"text-shadow":[Po],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ua,nt,it,w]}],container:["container"],columns:[{columns:[Gt,nt,it,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:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],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:[Va,"auto",it,nt]}],basis:[{basis:[Ua,"full","auto",l,...L()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Gt,Ua,"auto","initial","none",nt]}],grow:[{grow:["",Gt,it,nt]}],shrink:[{shrink:["",Gt,it,nt]}],order:[{order:[Va,"first","last","none",it,nt]}],"grid-cols":[{"grid-cols":j()}],"col-start-end":[{col:F()}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":j()}],"row-start-end":[{row:F()}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":O()}],"auto-rows":[{"auto-rows":O()}],gap:[{gap:L()}],"gap-x":[{"gap-x":L()}],"gap-y":[{"gap-y":L()}],"justify-content":[{justify:[...$(),"normal"]}],"justify-items":[{"justify-items":[...V(),"normal"]}],"justify-self":[{"justify-self":["auto",...V()]}],"align-content":[{content:["normal",...$()]}],"align-items":[{items:[...V(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...V(),{baseline:["","last"]}]}],"place-content":[{"place-content":$()}],"place-items":[{"place-items":[...V(),"baseline"]}],"place-self":[{"place-self":["auto",...V()]}],p:[{p:L()}],px:[{px:L()}],py:[{py:L()}],ps:[{ps:L()}],pe:[{pe:L()}],pbs:[{pbs:L()}],pbe:[{pbe:L()}],pt:[{pt:L()}],pr:[{pr:L()}],pb:[{pb:L()}],pl:[{pl:L()}],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":L()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":L()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],"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",...H()]}],"min-w":[{"min-w":[l,"screen","none",...H()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",n,zh,Wl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Sq,gq]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ky,nt]}],"font-family":[{font:[_q,vq,t]}],"font-features":[{"font-features":[nt]}],"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,it,nt]}],"line-clamp":[{"line-clamp":[Gt,"none",it,XA]}],leading:[{leading:[s,...L()]}],"list-image":[{"list-image":["none",it,nt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",it,nt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:[Gt,"from-font","auto",it,Wl]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[Gt,"auto",it,nt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",it,nt]}],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",it,nt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:W()}],"bg-repeat":[{bg:Z()}],"bg-size":[{bg:I()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Va,it,nt],radial:["",it,nt],conic:[Va,it,nt]},xq,bq]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:te()}],"rounded-s":[{"rounded-s":te()}],"rounded-e":[{"rounded-e":te()}],"rounded-t":[{"rounded-t":te()}],"rounded-r":[{"rounded-r":te()}],"rounded-b":[{"rounded-b":te()}],"rounded-l":[{"rounded-l":te()}],"rounded-ss":[{"rounded-ss":te()}],"rounded-se":[{"rounded-se":te()}],"rounded-ee":[{"rounded-ee":te()}],"rounded-es":[{"rounded-es":te()}],"rounded-tl":[{"rounded-tl":te()}],"rounded-tr":[{"rounded-tr":te()}],"rounded-br":[{"rounded-br":te()}],"rounded-bl":[{"rounded-bl":te()}],"border-w":[{border:oe()}],"border-w-x":[{"border-x":oe()}],"border-w-y":[{"border-y":oe()}],"border-w-s":[{"border-s":oe()}],"border-w-e":[{"border-e":oe()}],"border-w-bs":[{"border-bs":oe()}],"border-w-be":[{"border-be":oe()}],"border-w-t":[{"border-t":oe()}],"border-w-r":[{"border-r":oe()}],"border-w-b":[{"border-b":oe()}],"border-w-l":[{"border-l":oe()}],"divide-x":[{"divide-x":oe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":oe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...se(),"hidden","none"]}],"divide-style":[{divide:[...se(),"hidden","none"]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-bs":[{"border-bs":P()}],"border-color-be":[{"border-be":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Gt,it,nt]}],"outline-w":[{outline:["",Gt,zh,Wl]}],"outline-color":[{outline:P()}],shadow:[{shadow:["","none",f,Ym,Km]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",h,Ym,Km]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:oe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[Gt,Wl]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":["none",g,Ym,Km]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[Gt,it,nt]}],"mix-blend":[{"mix-blend":[...pe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":pe()}],"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":[Gt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ce()}],"mask-image-linear-to-pos":[{"mask-linear-to":ce()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":ce()}],"mask-image-t-to-pos":[{"mask-t-to":ce()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":ce()}],"mask-image-r-to-pos":[{"mask-r-to":ce()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":ce()}],"mask-image-b-to-pos":[{"mask-b-to":ce()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":ce()}],"mask-image-l-to-pos":[{"mask-l-to":ce()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":ce()}],"mask-image-x-to-pos":[{"mask-x-to":ce()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":ce()}],"mask-image-y-to-pos":[{"mask-y-to":ce()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[it,nt]}],"mask-image-radial-from-pos":[{"mask-radial-from":ce()}],"mask-image-radial-to-pos":[{"mask-radial-to":ce()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"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":[Gt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ce()}],"mask-image-conic-to-pos":[{"mask-conic-to":ce()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:W()}],"mask-repeat":[{mask:Z()}],"mask-size":[{mask:I()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",it,nt]}],filter:[{filter:["","none",it,nt]}],blur:[{blur:ge()}],brightness:[{brightness:[Gt,it,nt]}],contrast:[{contrast:[Gt,it,nt]}],"drop-shadow":[{"drop-shadow":["","none",b,Ym,Km]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",Gt,it,nt]}],"hue-rotate":[{"hue-rotate":[Gt,it,nt]}],invert:[{invert:["",Gt,it,nt]}],saturate:[{saturate:[Gt,it,nt]}],sepia:[{sepia:["",Gt,it,nt]}],"backdrop-filter":[{"backdrop-filter":["","none",it,nt]}],"backdrop-blur":[{"backdrop-blur":ge()}],"backdrop-brightness":[{"backdrop-brightness":[Gt,it,nt]}],"backdrop-contrast":[{"backdrop-contrast":[Gt,it,nt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Gt,it,nt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Gt,it,nt]}],"backdrop-invert":[{"backdrop-invert":["",Gt,it,nt]}],"backdrop-opacity":[{"backdrop-opacity":[Gt,it,nt]}],"backdrop-saturate":[{"backdrop-saturate":[Gt,it,nt]}],"backdrop-sepia":[{"backdrop-sepia":["",Gt,it,nt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":L()}],"border-spacing-x":[{"border-spacing-x":L()}],"border-spacing-y":[{"border-spacing-y":L()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",it,nt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Gt,"initial",it,nt]}],ease:[{ease:["linear","initial",C,it,nt]}],delay:[{delay:[Gt,it,nt]}],animate:[{animate:["none",E,it,nt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,it,nt]}],"perspective-origin":[{"perspective-origin":A()}],rotate:[{rotate:Ce()}],"rotate-x":[{"rotate-x":Ce()}],"rotate-y":[{"rotate-y":Ce()}],"rotate-z":[{"rotate-z":Ce()}],scale:[{scale:ke()}],"scale-x":[{"scale-x":ke()}],"scale-y":[{"scale-y":ke()}],"scale-z":[{"scale-z":ke()}],"scale-3d":["scale-3d"],skew:[{skew:De()}],"skew-x":[{"skew-x":De()}],"skew-y":[{"skew-y":De()}],transform:[{transform:[it,nt,"","none","gpu","cpu"]}],"transform-origin":[{origin:A()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:be()}],"translate-x":[{"translate-x":be()}],"translate-y":[{"translate-y":be()}],"translate-z":[{"translate-z":be()}],"translate-none":["translate-none"],accent:[{accent:P()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:P()}],"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",it,nt]}],"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":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mbs":[{"scroll-mbs":L()}],"scroll-mbe":[{"scroll-mbe":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pbs":[{"scroll-pbs":L()}],"scroll-pbe":[{"scroll-pbe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"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",it,nt]}],fill:[{fill:["none",...P()]}],"stroke-w":[{stroke:[Gt,zh,Wl,XA]}],stroke:[{stroke:["none",...P()]}],"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"]}},kq=rq(Cq);function ye(...e){return kq(HO(e))}function tc(){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 Eq(e){return e.startsWith("chatId:")?e.slice(7):e}const Af="data-focus-fallback-ignore",r5="data-allow-focus-retain",xv="kanna:restore-chat-input-focus",fC="data-chat-input",Sv="data-chat-selection-zone";function nc(e,t){return!!(e!=null&&e.closest(`[${t}]`))}function i5(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:nc(e,r5):!1}function Rq(e){const t=e;return t!=null&&t.matches?i5(e)||(t.tabIndex??-1)>=0||t.matches("button, a[href], summary")?!0:nc(e,r5):!1}function JA(e){return!!e.querySelector(`[${Af}][data-state='open']`)}function Tq(e){return e?!e.isCollapsed&&e.toString().trim().length>0:!1}function Aq(e,t){if(!e)return!1;const n=Array.from(t.querySelectorAll(`textarea[${fC}]`)).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 eN(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||nc(t,fC)||e.canCancel?"none":"escape-focus";const{pointerStartTarget:i,pointerEndTarget:s,root:o,hasActiveSelection:l}=e,c=s??i;return!o||!c||!o.contains(c)||nc(c,Af)||nc(t,Af)||l&&(nc(i,Sv)||nc(c,Sv))||i5(t)?"none":t&&t===c?"restore":Rq(t)?"none":"restore"}const ea=LG,Nq=DG,s5=_.forwardRef(({className:e,...t},n)=>m.jsx(BO,{ref:n,className:ye("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}));s5.displayName=BO.displayName;const Mq={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},uo=_.forwardRef(({className:e,children:t,size:n="md",...r},i)=>m.jsxs(Nq,{children:[m.jsx(s5,{}),m.jsxs(FO,{ref:i,[Af]:"",onCloseAutoFocus:s=>{var o;s.preventDefault(),window.dispatchEvent(new Event(xv)),(o=r.onCloseAutoFocus)==null||o.call(r,s)},className:ye("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",Mq[n],e),...r,children:[t,m.jsxs(OG,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[m.jsx(xl,{className:"h-4 w-4"}),m.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));uo.displayName=FO.displayName;function pC({className:e,...t}){return m.jsx("div",{className:ye("shrink-0 flex flex-col space-y-1.5 p-4 border-b border-border",e),...t})}function ta({className:e,...t}){return m.jsx(IG,{className:ye("text-lg font-medium leading-none tracking-tight",e),...t})}function Td({className:e,...t}){return m.jsx(PG,{className:ye("text-sm text-muted-foreground",e),...t})}function na({className:e,...t}){return m.jsx("div",{className:ye("flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-3.5",e),...t})}function gl({className:e,...t}){return m.jsx("div",{className:ye("shrink-0 flex justify-end gap-2 border-t border-border bg-background p-2 rounded-b-xl",e),...t})}function Lq({className:e,...t}){return m.jsx("button",{className:ye("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 Dq({className:e,...t}){return m.jsx("button",{className:ye("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 Iq({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(ea,{open:e,onOpenChange:n,children:m.jsxs(uo,{size:"md",children:[m.jsxs(pC,{children:[m.jsx(ta,{children:"Shared Link"}),m.jsx(Td,{children:"Shared links are snapshots in time and contain all attachments, tool calls and history. Be mindful of sensitive info."})]}),m.jsx(na,{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(ui,{className:"h-4 w-4 text-emerald-400"}):m.jsx(ml,{className:"h-4 w-4"})})]})}),m.jsx(gl,{children:m.jsxs(Lq,{type:"button",onClick:r,children:[m.jsx(tO,{className:"mr-2 h-4 w-4"}),"Open"]})})]})})}const tN=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,nN=HO,Pq=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return nN(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=tN(f)||tN(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,...b}=f;return Object.entries(b).every(y=>{let[x,w]=y;return Array.isArray(w)?w.includes({...s,...l}[x]):{...s,...l}[x]===w})?[...d,h,g]:d},[]);return nN(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},Nb=Pq("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","icon-mobile":"h-11 w-11 rounded-full md:h-9 md:w-9",none:"","icon-sm":"h-5.5 w-5.5 rounded-md"}},defaultVariants:{variant:"default",size:"default"}}),ot=_.forwardRef(({className:e,variant:t,size:n,type:r="button",...i},s)=>m.jsx("button",{type:r,className:ye(Nb({variant:t,size:n,className:e})),ref:s,...i}));ot.displayName="Button";const Cr=_.forwardRef(({className:e,type:t,...n},r)=>m.jsx("input",{ref:r,type:t,className:ye("flex w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",e),...n}));Cr.displayName="Input";const o5=_.createContext(null);function Oq({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 b,y;(b=s.current)==null||b.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(b=>new Promise(y=>{n({kind:"confirm",options:b,resolve:y})}),[]),f=_.useCallback(b=>new Promise(y=>{n({kind:"prompt",options:b,resolve:y})}),[]),h=_.useCallback(b=>new Promise(y=>{n({kind:"alert",options:b,resolve:y})}),[]),g=_.useMemo(()=>({confirm:d,prompt:f,alert:h}),[h,d,f]);return m.jsxs(o5.Provider,{value:g,children:[e,m.jsx(ea,{open:t!==null,onOpenChange:b=>{b||!t||l()},children:m.jsx(uo,{size:"sm",onKeyDown:b=>{b.key!=="Enter"||b.shiftKey||!t||t.kind!=="confirm"||(b.preventDefault(),c())},children:t?m.jsxs(m.Fragment,{children:[m.jsxs(na,{className:"space-y-4",children:[m.jsx(ta,{children:t.options.title}),t.options.description?m.jsx(Td,{children:t.options.description}):null,t.kind==="prompt"?m.jsx(Cr,{ref:s,type:"text",value:r,onChange:b=>i(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),c())},placeholder:t.options.placeholder}):null]}),m.jsxs(gl,{children:[m.jsx(ot,{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(ot,{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 cp(){const e=_.useContext(o5);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const mC=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:ye("bg-card text-card-foreground",e),...t}));mC.displayName="Card";const gC=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:ye("flex flex-col space-y-1.5 p-2",e),...t}));gC.displayName="CardHeader";const a5=_.forwardRef(({className:e,...t},n)=>m.jsx("h3",{ref:n,className:ye("text-2xl font-semibold leading-none tracking-tight",e),...t}));a5.displayName="CardTitle";const l5=_.forwardRef(({className:e,...t},n)=>m.jsx("p",{ref:n,className:ye("text-sm text-muted-foreground",e),...t}));l5.displayName="CardDescription";const vC=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:ye("p-6 pt-0",e),...t}));vC.displayName="CardContent";const jq=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:ye("flex items-center p-6 pt-0",e),...t}));jq.displayName="CardFooter";const zq=["top","right","bottom","left"],vl=Math.min,$i=Math.max,wv=Math.round,Xm=Math.floor,ao=e=>({x:e,y:e}),Bq={left:"right",right:"left",bottom:"top",top:"bottom"};function jS(e,t,n){return $i(e,vl(t,n))}function ra(e,t){return typeof e=="function"?e(t):e}function ia(e){return e.split("-")[0]}function Ad(e){return e.split("-")[1]}function bC(e){return e==="x"?"y":"x"}function _C(e){return e==="y"?"height":"width"}function no(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function yC(e){return bC(no(e))}function Fq(e,t,n){n===void 0&&(n=!1);const r=Ad(e),i=yC(e),s=_C(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=Cv(o)),[o,Cv(o)]}function $q(e){const t=Cv(e);return[zS(e),t,zS(t)]}function zS(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const rN=["left","right"],iN=["right","left"],Hq=["top","bottom"],Uq=["bottom","top"];function Vq(e,t,n){switch(e){case"top":case"bottom":return n?t?iN:rN:t?rN:iN;case"left":case"right":return t?Hq:Uq;default:return[]}}function Wq(e,t,n,r){const i=Ad(e);let s=Vq(ia(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(zS)))),s}function Cv(e){const t=ia(e);return Bq[t]+e.slice(t.length)}function Gq(e){return{top:0,right:0,bottom:0,left:0,...e}}function c5(e){return typeof e!="number"?Gq(e):{top:e,right:e,bottom:e,left:e}}function kv(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 sN(e,t,n){let{reference:r,floating:i}=e;const s=no(t),o=yC(t),l=_C(o),c=ia(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 b;switch(c){case"top":b={x:f,y:r.y-i.height};break;case"bottom":b={x:f,y:r.y+r.height};break;case"right":b={x:r.x+r.width,y:h};break;case"left":b={x:r.x-i.width,y:h};break;default:b={x:r.x,y:r.y}}switch(Ad(t)){case"start":b[o]-=g*(n&&d?-1:1);break;case"end":b[o]+=g*(n&&d?-1:1);break}return b}async function qq(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:b=0}=ra(t,e),y=c5(b),w=l[g?h==="floating"?"reference":"floating":h],C=kv(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=kv(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 Kq=50,Yq=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:qq},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}=sN(d,r,c),g=r,b=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&&b<Kq&&(b++,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}=sN(d,g,c)),x=-1)}return{x:f,y:h,placement:g,strategy:i,middlewareData:y}},Xq=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}=ra(e,t)||{};if(d==null)return{};const h=c5(f),g={x:n,y:r},b=yC(i),y=_C(b),x=await o.getDimensions(d),w=b==="y",C=w?"top":"left",E=w?"bottom":"right",R=w?"clientHeight":"clientWidth",T=s.reference[y]+s.reference[b]-g[b]-s.floating[y],A=g[b]-s.reference[b],N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let D=N?N[R]:0;(!D||!await(o.isElement==null?void 0:o.isElement(N)))&&(D=l.floating[R]||s.floating[y]);const L=T/2-A/2,q=D/2-x[y]/2-1,j=vl(h[C],q),F=vl(h[E],q),B=j,O=D-x[y]-F,$=D/2-x[y]/2+L,V=jS(B,$,O),z=!c.arrow&&Ad(i)!=null&&$!==V&&s.reference[y]/2-($<B?j:F)-x[y]/2<0,H=z?$<B?$-B:$-O:0;return{[b]:g[b]+H,data:{[b]:V,centerOffset:$-V-H,...z&&{alignmentOffset:H}},reset:z}}}),Qq=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:b="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:x=!0,...w}=ra(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const C=ia(i),E=no(l),R=ia(l)===l,T=await(c.isRTL==null?void 0:c.isRTL(d.floating)),A=g||(R||!x?[Cv(l)]:$q(l)),N=y!=="none";!g&&N&&A.push(...Wq(l,x,y,T));const D=[l,...A],L=await c.detectOverflow(t,w),q=[];let j=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&q.push(L[C]),h){const $=Fq(i,o,T);q.push(L[$[0]],L[$[1]])}if(j=[...j,{placement:i,overflows:q}],!q.every($=>$<=0)){var F,B;const $=(((F=s.flip)==null?void 0:F.index)||0)+1,V=D[$];if(V&&(!(h==="alignment"?E!==no(V):!1)||j.every(U=>no(U.placement)===E?U.overflows[0]>0:!0)))return{data:{index:$,overflows:j},reset:{placement:V}};let z=(B=j.filter(H=>H.overflows[0]<=0).sort((H,U)=>H.overflows[1]-U.overflows[1])[0])==null?void 0:B.placement;if(!z)switch(b){case"bestFit":{var O;const H=(O=j.filter(U=>{if(N){const Y=no(U.placement);return Y===E||Y==="y"}return!0}).map(U=>[U.placement,U.overflows.filter(Y=>Y>0).reduce((Y,P)=>Y+P,0)]).sort((U,Y)=>U[1]-Y[1])[0])==null?void 0:O[0];H&&(z=H);break}case"initialPlacement":z=l;break}if(i!==z)return{reset:{placement:z}}}return{}}}};function oN(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function aN(e){return zq.some(t=>e[t]>=0)}const Zq=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=ra(e,t);switch(i){case"referenceHidden":{const o=await r.detectOverflow(t,{...s,elementContext:"reference"}),l=oN(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:aN(l)}}}case"escaped":{const o=await r.detectOverflow(t,{...s,altBoundary:!0}),l=oN(o,n.floating);return{data:{escapedOffsets:l,escaped:aN(l)}}}default:return{}}}}},u5=new Set(["left","top"]);async function Jq(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ia(n),l=Ad(n),c=no(n)==="y",d=u5.has(o)?-1:1,f=s&&c?-1:1,h=ra(t,e);let{mainAxis:g,crossAxis:b,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"&&(b=l==="end"?y*-1:y),c?{x:b*f,y:g*d}:{x:g*d,y:b*f}}const eK=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 Jq(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}}}}},tK=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}=ra(e,t),f={x:n,y:r},h=await s.detectOverflow(t,d),g=no(ia(i)),b=bC(g);let y=f[b],x=f[g];if(o){const C=b==="y"?"top":"left",E=b==="y"?"bottom":"right",R=y+h[C],T=y-h[E];y=jS(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=jS(R,x,T)}const w=c.fn({...t,[b]:y,[g]:x});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[b]:o,[g]:l}}}}}},nK=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}=ra(e,t),f={x:n,y:r},h=no(i),g=bC(h);let b=f[g],y=f[h];const x=ra(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;b<T?b=T:b>A&&(b=A)}if(d){var C,E;const R=g==="y"?"width":"height",T=u5.has(ia(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]:b,[h]:y}}}},rK=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}=ra(e,t),f=await o.detectOverflow(t,d),h=ia(i),g=Ad(i),b=no(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=vl(x-f[w],E),A=vl(y-f[C],R),N=!t.middlewareData.shift;let D=T,L=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(L=R),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(D=E),N&&!g){const j=$i(f.left,0),F=$i(f.right,0),B=$i(f.top,0),O=$i(f.bottom,0);b?L=y-2*(j!==0||F!==0?j+F:$i(f.left,f.right)):D=x-2*(B!==0||O!==0?B+O:$i(f.top,f.bottom))}await c({...t,availableWidth:L,availableHeight:D});const q=await o.getDimensions(l.floating);return y!==q.width||x!==q.height?{reset:{rects:!0}}:{}}}};function Mb(){return typeof window<"u"}function Nd(e){return d5(e)?(e.nodeName||"").toLowerCase():"#document"}function Hi(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function po(e){var t;return(t=(d5(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function d5(e){return Mb()?e instanceof Node||e instanceof Hi(e).Node:!1}function js(e){return Mb()?e instanceof Element||e instanceof Hi(e).Element:!1}function ca(e){return Mb()?e instanceof HTMLElement||e instanceof Hi(e).HTMLElement:!1}function lN(e){return!Mb()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Hi(e).ShadowRoot}function up(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=zs(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function iK(e){return/^(table|td|th)$/.test(Nd(e))}function Lb(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const sK=/transform|translate|scale|rotate|perspective|filter/,oK=/paint|layout|strict|content/,Gl=e=>!!e&&e!=="none";let Yy;function xC(e){const t=js(e)?zs(e):e;return Gl(t.transform)||Gl(t.translate)||Gl(t.scale)||Gl(t.rotate)||Gl(t.perspective)||!SC()&&(Gl(t.backdropFilter)||Gl(t.filter))||sK.test(t.willChange||"")||oK.test(t.contain||"")}function aK(e){let t=bl(e);for(;ca(t)&&!ad(t);){if(xC(t))return t;if(Lb(t))return null;t=bl(t)}return null}function SC(){return Yy==null&&(Yy=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Yy}function ad(e){return/^(html|body|#document)$/.test(Nd(e))}function zs(e){return Hi(e).getComputedStyle(e)}function Db(e){return js(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function bl(e){if(Nd(e)==="html")return e;const t=e.assignedSlot||e.parentNode||lN(e)&&e.host||po(e);return lN(t)?t.host:t}function h5(e){const t=bl(e);return ad(t)?e.ownerDocument?e.ownerDocument.body:e.body:ca(t)&&up(t)?t:h5(t)}function Nf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=h5(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=Hi(i);if(s){const l=BS(o);return t.concat(o,o.visualViewport||[],up(i)?i:[],l&&n?Nf(l):[])}else return t.concat(i,Nf(i,[],n))}function BS(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function f5(e){const t=zs(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=ca(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,l=wv(n)!==s||wv(r)!==o;return l&&(n=s,r=o),{width:n,height:r,$:l}}function wC(e){return js(e)?e:e.contextElement}function Yu(e){const t=wC(e);if(!ca(t))return ao(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=f5(t);let o=(s?wv(n.width):n.width)/r,l=(s?wv(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const lK=ao(0);function p5(e){const t=Hi(e);return!SC()||!t.visualViewport?lK:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function cK(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Hi(e)?!1:t}function _c(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=wC(e);let o=ao(1);t&&(r?js(r)&&(o=Yu(r)):o=Yu(e));const l=cK(s,n,r)?p5(s):ao(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=Hi(s),b=r&&js(r)?Hi(r):r;let y=g,x=BS(y);for(;x&&r&&b!==y;){const w=Yu(x),C=x.getBoundingClientRect(),E=zs(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=Hi(x),x=BS(y)}}return kv({width:f,height:h,x:c,y:d})}function Ib(e,t){const n=Db(e).scrollLeft;return t?t.left+n:_c(po(e)).left+n}function m5(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ib(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function uK(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=po(r),l=t?Lb(t.floating):!1;if(r===o||l&&s)return n;let c={scrollLeft:0,scrollTop:0},d=ao(1);const f=ao(0),h=ca(r);if((h||!h&&!s)&&((Nd(r)!=="body"||up(o))&&(c=Db(r)),h)){const b=_c(r);d=Yu(r),f.x=b.x+r.clientLeft,f.y=b.y+r.clientTop}const g=o&&!h&&!s?m5(o,c):ao(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 dK(e){return Array.from(e.getClientRects())}function hK(e){const t=po(e),n=Db(e),r=e.ownerDocument.body,i=$i(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=$i(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Ib(e);const l=-n.scrollTop;return zs(r).direction==="rtl"&&(o+=$i(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}const cN=25;function fK(e,t){const n=Hi(e),r=po(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=SC();(!f||f&&t==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}const d=Ib(r);if(d<=0){const f=r.ownerDocument,h=f.body,g=getComputedStyle(h),b=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,y=Math.abs(r.clientWidth-h.clientWidth-b);y<=cN&&(s-=y)}else d<=cN&&(s+=d);return{width:s,height:o,x:l,y:c}}function pK(e,t){const n=_c(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=ca(e)?Yu(e):ao(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 uN(e,t,n){let r;if(t==="viewport")r=fK(e,n);else if(t==="document")r=hK(po(e));else if(js(t))r=pK(t,n);else{const i=p5(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return kv(r)}function g5(e,t){const n=bl(e);return n===t||!js(n)||ad(n)?!1:zs(n).position==="fixed"||g5(n,t)}function mK(e,t){const n=t.get(e);if(n)return n;let r=Nf(e,[],!1).filter(l=>js(l)&&Nd(l)!=="body"),i=null;const s=zs(e).position==="fixed";let o=s?bl(e):e;for(;js(o)&&!ad(o);){const l=zs(o),c=xC(o);!c&&l.position==="fixed"&&(i=null),(s?!c&&!i:!c&&l.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||up(o)&&!c&&g5(e,o))?r=r.filter(f=>f!==o):i=l,o=bl(o)}return t.set(e,r),r}function gK(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?Lb(t)?[]:mK(t,this._c):[].concat(n),r],l=uN(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 b=uN(t,o[g],i);c=$i(b.top,c),d=vl(b.right,d),f=vl(b.bottom,f),h=$i(b.left,h)}return{width:d-h,height:f-c,x:h,y:c}}function vK(e){const{width:t,height:n}=f5(e);return{width:t,height:n}}function bK(e,t,n){const r=ca(t),i=po(t),s=n==="fixed",o=_c(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=ao(0);function d(){c.x=Ib(i)}if(r||!r&&!s)if((Nd(t)!=="body"||up(i))&&(l=Db(t)),r){const b=_c(t,!0,s,t);c.x=b.x+t.clientLeft,c.y=b.y+t.clientTop}else i&&d();s&&!r&&i&&d();const f=i&&!r&&!s?m5(i,l):ao(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 Xy(e){return zs(e).position==="static"}function dN(e,t){if(!ca(e)||zs(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return po(e)===n&&(n=n.ownerDocument.body),n}function v5(e,t){const n=Hi(e);if(Lb(e))return n;if(!ca(e)){let i=bl(e);for(;i&&!ad(i);){if(js(i)&&!Xy(i))return i;i=bl(i)}return n}let r=dN(e,t);for(;r&&iK(r)&&Xy(r);)r=dN(r,t);return r&&ad(r)&&Xy(r)&&!xC(r)?n:r||aK(e)||n}const _K=async function(e){const t=this.getOffsetParent||v5,n=this.getDimensions,r=await n(e.floating);return{reference:bK(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function yK(e){return zs(e).direction==="rtl"}const xK={convertOffsetParentRelativeRectToViewportRelativeRect:uK,getDocumentElement:po,getClippingRect:gK,getOffsetParent:v5,getElementRects:_K,getClientRects:dK,getDimensions:vK,getScale:Yu,isElement:js,isRTL:yK};function b5(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function SK(e,t){let n=null,r;const i=po(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:b}=d;if(l||t(),!g||!b)return;const y=Xm(h),x=Xm(i.clientWidth-(f+g)),w=Xm(i.clientHeight-(h+b)),C=Xm(f),R={rootMargin:-y+"px "+-x+"px "+-w+"px "+-C+"px",threshold:$i(0,vl(1,c))||1};let T=!0;function A(N){const D=N[0].intersectionRatio;if(D!==c){if(!T)return o();D?o(!1,D):r=setTimeout(()=>{o(!1,1e-7)},1e3)}D===1&&!b5(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 wK(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=wC(e),f=i||s?[...d?Nf(d):[],...t?Nf(t):[]]:[];f.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const h=d&&l?SK(d,n):null;let g=-1,b=null;o&&(b=new ResizeObserver(C=>{let[E]=C;E&&E.target===d&&b&&t&&(b.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var R;(R=b)==null||R.observe(t)})),n()}),d&&!c&&b.observe(d),t&&b.observe(t));let y,x=c?_c(e):null;c&&w();function w(){const C=_c(e);x&&!b5(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=b)==null||C.disconnect(),b=null,c&&cancelAnimationFrame(y)}}const CK=eK,kK=tK,EK=Qq,RK=rK,TK=Zq,hN=Xq,AK=nK,NK=(e,t,n)=>{const r=new Map,i={platform:xK,...n},s={...i.platform,_c:r};return Yq(e,t,{...i,platform:s})};var MK=typeof document<"u",LK=function(){},Kg=MK?_.useLayoutEffect:LK;function Ev(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(!Ev(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)&&!Ev(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function _5(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function fN(e,t){const n=_5(e);return Math.round(t*n)/n}function Qy(e){const t=_.useRef(e);return Kg(()=>{t.current=e}),t}function DK(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,b]=_.useState(r);Ev(g,r)||b(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!==D.current&&(D.current=U,C(U))},[]),T=s||y,A=o||w,N=_.useRef(null),D=_.useRef(null),L=_.useRef(f),q=c!=null,j=Qy(c),F=Qy(i),B=Qy(d),O=_.useCallback(()=>{if(!N.current||!D.current)return;const U={placement:t,strategy:n,middleware:g};F.current&&(U.platform=F.current),NK(N.current,D.current,U).then(Y=>{const P={...Y,isPositioned:B.current!==!1};$.current&&!Ev(L.current,P)&&(L.current=P,fs.flushSync(()=>{h(P)}))})},[g,t,n,F,B]);Kg(()=>{d===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,h(U=>({...U,isPositioned:!1})))},[d]);const $=_.useRef(!1);Kg(()=>($.current=!0,()=>{$.current=!1}),[]),Kg(()=>{if(T&&(N.current=T),A&&(D.current=A),T&&A){if(j.current)return j.current(T,A,O);O()}},[T,A,O,j,q]);const V=_.useMemo(()=>({reference:N,floating:D,setReference:E,setFloating:R}),[E,R]),z=_.useMemo(()=>({reference:T,floating:A}),[T,A]),H=_.useMemo(()=>{const U={position:n,left:0,top:0};if(!z.floating)return U;const Y=fN(z.floating,f.x),P=fN(z.floating,f.y);return l?{...U,transform:"translate("+Y+"px, "+P+"px)",..._5(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Y,top:P}},[n,l,z.floating,f.x,f.y]);return _.useMemo(()=>({...f,update:O,refs:V,elements:z,floatingStyles:H}),[f,O,V,z,H])}const IK=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?hN({element:r.current,padding:i}).fn(n):{}:r?hN({element:r,padding:i}).fn(n):{}}}},PK=(e,t)=>{const n=CK(e);return{name:n.name,fn:n.fn,options:[e,t]}},OK=(e,t)=>{const n=kK(e);return{name:n.name,fn:n.fn,options:[e,t]}},jK=(e,t)=>({fn:AK(e).fn,options:[e,t]}),zK=(e,t)=>{const n=EK(e);return{name:n.name,fn:n.fn,options:[e,t]}},BK=(e,t)=>{const n=RK(e);return{name:n.name,fn:n.fn,options:[e,t]}},FK=(e,t)=>{const n=TK(e);return{name:n.name,fn:n.fn,options:[e,t]}},$K=(e,t)=>{const n=IK(e);return{name:n.name,fn:n.fn,options:[e,t]}};var HK="Arrow",y5=_.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return m.jsx(Jt.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"})})});y5.displayName=HK;var UK=y5;function VK(e){const[t,n]=_.useState(void 0);return Xr(()=>{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 CC="Popper",[x5,wl]=la(CC),[WK,S5]=x5(CC),w5=e=>{const{__scopePopper:t,children:n}=e,[r,i]=_.useState(null);return m.jsx(WK,{scope:t,anchor:r,onAnchorChange:i,children:n})};w5.displayName=CC;var C5="PopperAnchor",k5=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=S5(C5,n),o=_.useRef(null),l=pn(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(Jt.div,{...i,ref:l})});k5.displayName=C5;var kC="PopperContent",[GK,qK]=x5(kC),E5=_.forwardRef((e,t)=>{var se,pe,ce,ge,Ce,ke;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:b="optimized",onPlaced:y,...x}=e,w=S5(kC,n),[C,E]=_.useState(null),R=pn(t,De=>E(De)),[T,A]=_.useState(null),N=VK(T),D=(N==null?void 0:N.width)??0,L=(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},F=Array.isArray(d)?d:[d],B=F.length>0,O={padding:j,boundary:F.filter(YK),altBoundary:B},{refs:$,floatingStyles:V,placement:z,isPositioned:H,middlewareData:U}=DK({strategy:"fixed",placement:q,whileElementsMounted:(...De)=>wK(...De,{animationFrame:b==="always"}),elements:{reference:w.anchor},middleware:[PK({mainAxis:i+L,alignmentAxis:o}),c&&OK({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?jK():void 0,...O}),c&&zK({...O}),BK({...O,apply:({elements:De,rects:be,availableWidth:rt,availableHeight:Et})=>{const{width:pt,height:sn}=be.reference,$t=De.floating.style;$t.setProperty("--radix-popper-available-width",`${rt}px`),$t.setProperty("--radix-popper-available-height",`${Et}px`),$t.setProperty("--radix-popper-anchor-width",`${pt}px`),$t.setProperty("--radix-popper-anchor-height",`${sn}px`)}}),T&&$K({element:T,padding:l}),XK({arrowWidth:D,arrowHeight:L}),g&&FK({strategy:"referenceHidden",...O})]}),[Y,P]=A5(z),W=Os(y);Xr(()=>{H&&(W==null||W())},[H,W]);const Z=(se=U.arrow)==null?void 0:se.x,I=(pe=U.arrow)==null?void 0:pe.y,re=((ce=U.arrow)==null?void 0:ce.centerOffset)!==0,[te,oe]=_.useState();return Xr(()=>{C&&oe(window.getComputedStyle(C).zIndex)},[C]),m.jsx("div",{ref:$.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:H?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:te,"--radix-popper-transform-origin":[(ge=U.transformOrigin)==null?void 0:ge.x,(Ce=U.transformOrigin)==null?void 0:Ce.y].join(" "),...((ke=U.hide)==null?void 0:ke.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:m.jsx(GK,{scope:n,placedSide:Y,onArrowChange:A,arrowX:Z,arrowY:I,shouldHideArrow:re,children:m.jsx(Jt.div,{"data-side":Y,"data-align":P,...x,ref:R,style:{...x.style,animation:H?void 0:"none"}})})})});E5.displayName=kC;var R5="PopperArrow",KK={top:"bottom",right:"left",bottom:"top",left:"right"},T5=_.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=qK(R5,r),o=KK[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(UK,{...i,ref:n,style:{...i.style,display:"block"}})})});T5.displayName=R5;function YK(e){return e!==null}var XK=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]=A5(n),h={start:"0%",center:"50%",end:"100%"}[f],g=(((C=i.arrow)==null?void 0:C.x)??0)+l/2,b=(((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:`${b}px`):d==="left"&&(y=`${r.floating.width+c}px`,x=o?h:`${b}px`),{data:{x:y,y:x}}}});function A5(e){const[t,n="center"]=e.split("-");return[t,n]}var Pb=w5,dp=k5,Ob=E5,jb=T5,N5=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"}),QK="VisuallyHidden",M5=_.forwardRef((e,t)=>m.jsx(Jt.span,{...e,ref:t,style:{...N5,...e.style}}));M5.displayName=QK;var ZK=M5,[zb]=la("Tooltip",[wl]),Bb=wl(),L5="TooltipProvider",JK=700,FS="tooltip.open",[eY,EC]=zb(L5),D5=e=>{const{__scopeTooltip:t,delayDuration:n=JK,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(eY,{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})};D5.displayName=L5;var Mf="Tooltip",[tY,hp]=zb(Mf),I5=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:l}=e,c=EC(Mf,e.__scopeTooltip),d=Bb(t),[f,h]=_.useState(null),g=Xo(),b=_.useRef(0),y=o??c.disableHoverableContent,x=l??c.delayDuration,w=_.useRef(!1),[C,E]=od({prop:r,defaultProp:i??!1,onChange:D=>{D?(c.onOpen(),document.dispatchEvent(new CustomEvent(FS))):c.onClose(),s==null||s(D)},caller:Mf}),R=_.useMemo(()=>C?w.current?"delayed-open":"instant-open":"closed",[C]),T=_.useCallback(()=>{window.clearTimeout(b.current),b.current=0,w.current=!1,E(!0)},[E]),A=_.useCallback(()=>{window.clearTimeout(b.current),b.current=0,E(!1)},[E]),N=_.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{w.current=!0,E(!0),b.current=0},x)},[x,E]);return _.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),m.jsx(Pb,{...d,children:m.jsx(tY,{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(b.current),b.current=0)},[A,y]),onOpen:T,onClose:A,disableHoverableContent:y,children:n})})};I5.displayName=Mf;var $S="TooltipTrigger",P5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=hp($S,n),s=EC($S,n),o=Bb(n),l=_.useRef(null),c=pn(t,l,i.onTriggerChange),d=_.useRef(!1),f=_.useRef(!1),h=_.useCallback(()=>d.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),m.jsx(dp,{asChild:!0,...o,children:m.jsx(Jt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:Je(e.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:Je(e.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:Je(e.onPointerDown,()=>{i.open&&i.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Je(e.onFocus,()=>{d.current||i.onOpen()}),onBlur:Je(e.onBlur,i.onClose),onClick:Je(e.onClick,i.onClose)})})});P5.displayName=$S;var RC="TooltipPortal",[nY,rY]=zb(RC,{forceMount:void 0}),O5=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,s=hp(RC,t);return m.jsx(nY,{scope:t,forceMount:n,children:m.jsx(ys,{present:n||s.open,children:m.jsx(Rd,{asChild:!0,container:i,children:r})})})};O5.displayName=RC;var ld="TooltipContent",j5=_.forwardRef((e,t)=>{const n=rY(ld,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=e,o=hp(ld,e.__scopeTooltip);return m.jsx(ys,{present:r||o.open,children:o.disableHoverableContent?m.jsx(z5,{side:i,...s,ref:t}):m.jsx(iY,{side:i,...s,ref:t})})}),iY=_.forwardRef((e,t)=>{const n=hp(ld,e.__scopeTooltip),r=EC(ld,e.__scopeTooltip),i=_.useRef(null),s=pn(t,i),[o,l]=_.useState(null),{trigger:c,onClose:d}=n,f=i.current,{onPointerInTransitChange:h}=r,g=_.useCallback(()=>{l(null),h(!1)},[h]),b=_.useCallback((y,x)=>{const w=y.currentTarget,C={x:y.clientX,y:y.clientY},E=cY(C,w.getBoundingClientRect()),R=uY(C,E),T=dY(x.getBoundingClientRect()),A=fY([...R,...T]);l(A),h(!0)},[h]);return _.useEffect(()=>()=>g(),[g]),_.useEffect(()=>{if(c&&f){const y=w=>b(w,f),x=w=>b(w,c);return c.addEventListener("pointerleave",y),f.addEventListener("pointerleave",x),()=>{c.removeEventListener("pointerleave",y),f.removeEventListener("pointerleave",x)}}},[c,f,b,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=!hY(C,o);E?g():R&&(g(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,f,o,d,g]),m.jsx(z5,{...e,ref:s})}),[sY,oY]=zb(Mf,{isInside:!1}),aY=fW("TooltipContent"),z5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...l}=e,c=hp(ld,n),d=Bb(n),{onClose:f}=c;return _.useEffect(()=>(document.addEventListener(FS,f),()=>document.removeEventListener(FS,f)),[f]),_.useEffect(()=>{if(c.trigger){const h=g=>{const b=g.target;b!=null&&b.contains(c.trigger)&&f()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,f]),m.jsx(Ed,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:m.jsxs(Ob,{"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(aY,{children:r}),m.jsx(sY,{scope:n,isInside:!0,children:m.jsx(ZK,{id:c.contentId,role:"tooltip",children:i||r})})]})})});j5.displayName=ld;var B5="TooltipArrow",lY=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Bb(n);return oY(B5,n).isInside?null:m.jsx(jb,{...i,...r,ref:t})});lY.displayName=B5;function cY(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 uY(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 dY(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 hY(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 fY(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),pY(t)}function pY(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 mY=D5,F5=I5,$5=P5,H5=O5,TC=j5;function U5({className:e,...t}){return m.jsx("kbd",{className:ye("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 gY({className:e,...t}){return m.jsx("span",{className:ye("inline-flex items-center gap-0.5",e),...t})}const vY="z-50 overflow-hidden rounded-md border border-border bg-card 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",bY=mY,Qo=F5,Zo=$5,lo=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(H5,{children:m.jsx(TC,{ref:r,sideOffset:t,className:ye("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})}));lo.displayName=TC.displayName;const Rv=F5,Tv=$5;function V5(e){return e.toUpperCase()}function _Y(e){const t=e.split("+");return m.jsx(gY,{children:t.map((n,r)=>m.jsx(U5,{children:V5(n)},`${n}-${r}`))})}const Lf=_.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(H5,{children:m.jsx(TC,{ref:s,sideOffset:t,className:ye(vY,e),...i,children:o?_Y(o):m.jsx("span",{children:typeof n=="string"?V5(n):n})})})});Lf.displayName="HotkeyTooltipContent";const yY="0.42.4",xY={version:yY},er="Kanna",pN="kanna",SY=".kanna",wY=".kanna-dev",CY="KANNA_RUNTIME_PROFILE",AC=`kanna/${xY.version}`,kY="[kanna]",EY=`~/${er}`;function Fb(){var t;return(t=globalThis.process)==null?void 0:t.env}function RY(e=Fb()){var t;return((t=e==null?void 0:e[CY])==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function TY(e=Fb()){return RY(e)==="dev"?wY:SY}function AY(e=Fb()){return`~/${TY(e)}`}function NY(e=Fb()){return`${AY(e)}/keybindings.json`}function Qm(e){return e?`${pN} ${e}`:pN}const mN=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(b=>b(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},MY=(e=>e?mN(e):mN),LY=e=>e;function DY(e,t=LY){const n=Cn.useSyncExternalStore(e.subscribe,Cn.useCallback(()=>t(e.getState()),[e,t]),Cn.useCallback(()=>t(e.getInitialState()),[e,t]));return Cn.useDebugValue(n),n}const IY=e=>{const t=MY(e),n=r=>DY(t,r);return Object.assign(n,t),n},mo=(e=>IY),W5="always",G5="funk",PY=[{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 OY(e){switch(e){case"never":case"unfocused":case"always":return e;default:return W5}}function jY(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 G5}}const oc=mo()(e=>({chatSoundPreference:W5,chatSoundId:G5,setChatSoundPreference:t=>e({chatSoundPreference:OY(t)}),setChatSoundId:t=>e({chatSoundId:jY(t)})})),zY={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 BY(e=document){return e.visibilityState!=="visible"||!e.hasFocus()}function FY(e){const t=new Audio(zY[e]);return t.preload="auto",t.play()}async function HS(e,t){if(t<=0)return;const n=Array.from({length:t},(r,i)=>new Promise(s=>{window.setTimeout(()=>{FY(e).catch(()=>{}).finally(()=>s())},i*90)}));await Promise.all(n)}function $Y(e,t=document){return e==="never"?!1:e==="always"?!0:BY(t)}function HY(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 gN(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 UY(e,t){if(!e)return 0;const n=gN(e),r=gN(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 US(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const VY=[/^(?:\/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 WY(e){const t=e.trim();for(const n of VY){const r=t.match(n);if(!r)continue;const i=(r[2]??r[1]??"").trim();if(i)return i}return t}function q5(e){return e.split("/").pop()||e}const GY=1440*6e4;function K5(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,i=60*r,s=GY,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 Y5(e){return e.lastMessageAt??e._creationTime}const Md=({children:e,className:t,animate:n=!0,shimmerWidth:r,...i})=>m.jsx("span",{className:ye("mx-auto max-w-md text-foreground/60",n&&"animate-shiny-pulse",t),...i,children:e});function NC(e){const t=e+"CollectionProvider",[n,r]=la(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=x=>{const{scope:w,children:C}=x,E=Cn.useRef(null),R=Cn.useRef(new Map).current;return m.jsx(i,{scope:w,itemMap:R,collectionRef:E,children:C})};o.displayName=t;const l=e+"CollectionSlot",c=vc(l),d=Cn.forwardRef((x,w)=>{const{scope:C,children:E}=x,R=s(l,C),T=pn(w,R.collectionRef);return m.jsx(c,{ref:T,children:E})});d.displayName=l;const f=e+"CollectionItemSlot",h="data-radix-collection-item",g=vc(f),b=Cn.forwardRef((x,w)=>{const{scope:C,children:E,...R}=x,T=Cn.useRef(null),A=pn(w,T),N=s(f,C);return Cn.useEffect(()=>(N.itemMap.set(T,{ref:T,...R}),()=>void N.itemMap.delete(T))),m.jsx(g,{[h]:"",ref:A,children:E})});b.displayName=f;function y(x){const w=s(e+"CollectionConsumer",x);return Cn.useCallback(()=>{const E=w.collectionRef.current;if(!E)return[];const R=Array.from(E.querySelectorAll(`[${h}]`));return Array.from(w.itemMap.values()).sort((N,D)=>R.indexOf(N.ref.current)-R.indexOf(D.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:o,Slot:d,ItemSlot:b},y,r]}var qY=_.createContext(void 0);function MC(e){const t=_.useContext(qY);return e||t||"ltr"}var Zy="rovingFocusGroup.onEntryFocus",KY={bubbles:!1,cancelable:!0},fp="RovingFocusGroup",[VS,X5,YY]=NC(fp),[XY,Q5]=la(fp,[YY]),[QY,ZY]=XY(fp),Z5=_.forwardRef((e,t)=>m.jsx(VS.Provider,{scope:e.__scopeRovingFocusGroup,children:m.jsx(VS.Slot,{scope:e.__scopeRovingFocusGroup,children:m.jsx(JY,{...e,ref:t})})}));Z5.displayName=fp;var JY=_.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),b=pn(t,g),y=MC(s),[x,w]=od({prop:o,defaultProp:l??null,onChange:c,caller:fp}),[C,E]=_.useState(!1),R=Os(d),T=X5(n),A=_.useRef(!1),[N,D]=_.useState(0);return _.useEffect(()=>{const L=g.current;if(L)return L.addEventListener(Zy,R),()=>L.removeEventListener(Zy,R)},[R]),m.jsx(QY,{scope:n,orientation:r,dir:y,loop:i,currentTabStopId:x,onItemFocus:_.useCallback(L=>w(L),[w]),onItemShiftTab:_.useCallback(()=>E(!0),[]),onFocusableItemAdd:_.useCallback(()=>D(L=>L+1),[]),onFocusableItemRemove:_.useCallback(()=>D(L=>L-1),[]),children:m.jsx(Jt.div,{tabIndex:C||N===0?-1:0,"data-orientation":r,...h,ref:b,style:{outline:"none",...e.style},onMouseDown:Je(e.onMouseDown,()=>{A.current=!0}),onFocus:Je(e.onFocus,L=>{const q=!A.current;if(L.target===L.currentTarget&&q&&!C){const j=new CustomEvent(Zy,KY);if(L.currentTarget.dispatchEvent(j),!j.defaultPrevented){const F=T().filter(z=>z.focusable),B=F.find(z=>z.active),O=F.find(z=>z.id===x),V=[B,O,...F].filter(Boolean).map(z=>z.ref.current);tj(V,f)}}A.current=!1}),onBlur:Je(e.onBlur,()=>E(!1))})})}),J5="RovingFocusGroupItem",ej=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...l}=e,c=Xo(),d=s||c,f=ZY(J5,n),h=f.currentTabStopId===d,g=X5(n),{onFocusableItemAdd:b,onFocusableItemRemove:y,currentTabStopId:x}=f;return _.useEffect(()=>{if(r)return b(),()=>y()},[r,b,y]),m.jsx(VS.ItemSlot,{scope:n,id:d,focusable:r,active:i,children:m.jsx(Jt.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...l,ref:t,onMouseDown:Je(e.onMouseDown,w=>{r?f.onItemFocus(d):w.preventDefault()}),onFocus:Je(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:Je(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){f.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const C=nX(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?rX(R,T+1):R.slice(T+1)}setTimeout(()=>tj(R))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:x!=null}):o})})});ej.displayName=J5;var eX={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function tX(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function nX(e,t,n){const r=tX(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return eX[r]}function tj(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function rX(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var iX=Z5,sX=ej,WS=["Enter"," "],oX=["ArrowDown","PageUp","Home"],nj=["ArrowUp","PageDown","End"],aX=[...oX,...nj],lX={ltr:[...WS,"ArrowRight"],rtl:[...WS,"ArrowLeft"]},cX={ltr:["ArrowLeft"],rtl:["ArrowRight"]},pp="Menu",[Df,uX,dX]=NC(pp),[Lc,rj]=la(pp,[dX,wl,Q5]),$b=wl(),ij=Q5(),[hX,Dc]=Lc(pp),[fX,mp]=Lc(pp),sj=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=e,l=$b(t),[c,d]=_.useState(null),f=_.useRef(!1),h=Os(s),g=MC(i);return _.useEffect(()=>{const b=()=>{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",b,{capture:!0}),()=>{document.removeEventListener("keydown",b,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),m.jsx(Pb,{...l,children:m.jsx(hX,{scope:t,open:n,onOpenChange:h,content:c,onContentChange:d,children:m.jsx(fX,{scope:t,onClose:_.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:f,dir:g,modal:o,children:r})})})};sj.displayName=pp;var pX="MenuAnchor",LC=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=$b(n);return m.jsx(dp,{...i,...r,ref:t})});LC.displayName=pX;var DC="MenuPortal",[mX,oj]=Lc(DC,{forceMount:void 0}),aj=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,s=Dc(DC,t);return m.jsx(mX,{scope:t,forceMount:n,children:m.jsx(ys,{present:n||s.open,children:m.jsx(Rd,{asChild:!0,container:i,children:r})})})};aj.displayName=DC;var ms="MenuContent",[gX,IC]=Lc(ms),lj=_.forwardRef((e,t)=>{const n=oj(ms,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Dc(ms,e.__scopeMenu),o=mp(ms,e.__scopeMenu);return m.jsx(Df.Provider,{scope:e.__scopeMenu,children:m.jsx(ys,{present:r||s.open,children:m.jsx(Df.Slot,{scope:e.__scopeMenu,children:o.modal?m.jsx(vX,{...i,ref:t}):m.jsx(bX,{...i,ref:t})})})})}),vX=_.forwardRef((e,t)=>{const n=Dc(ms,e.__scopeMenu),r=_.useRef(null),i=pn(t,r);return _.useEffect(()=>{const s=r.current;if(s)return Tb(s)},[]),m.jsx(PC,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Je(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),bX=_.forwardRef((e,t)=>{const n=Dc(ms,e.__scopeMenu);return m.jsx(PC,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),_X=vc("MenuContent.ScrollLock"),PC=_.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:b,disableOutsideScroll:y,...x}=e,w=Dc(ms,n),C=mp(ms,n),E=$b(n),R=ij(n),T=uX(n),[A,N]=_.useState(null),D=_.useRef(null),L=pn(t,D,w.onContentChange),q=_.useRef(0),j=_.useRef(""),F=_.useRef(0),B=_.useRef(null),O=_.useRef("right"),$=_.useRef(0),V=y?lp:_.Fragment,z=y?{as:_X,allowPinchZoom:!0}:void 0,H=Y=>{var se,pe;const P=j.current+Y,W=T().filter(ce=>!ce.disabled),Z=document.activeElement,I=(se=W.find(ce=>ce.ref.current===Z))==null?void 0:se.textValue,re=W.map(ce=>ce.textValue),te=MX(re,P,I),oe=(pe=W.find(ce=>ce.textValue===te))==null?void 0:pe.ref.current;(function ce(ge){j.current=ge,window.clearTimeout(q.current),ge!==""&&(q.current=window.setTimeout(()=>ce(""),1e3))})(P),oe&&setTimeout(()=>oe.focus())};_.useEffect(()=>()=>window.clearTimeout(q.current),[]),Eb();const U=_.useCallback(Y=>{var W,Z;return O.current===((W=B.current)==null?void 0:W.side)&&DX(Y,(Z=B.current)==null?void 0:Z.area)},[]);return m.jsx(gX,{scope:n,searchRef:j,onItemEnter:_.useCallback(Y=>{U(Y)&&Y.preventDefault()},[U]),onItemLeave:_.useCallback(Y=>{var P;U(Y)||((P=D.current)==null||P.focus(),N(null))},[U]),onTriggerLeave:_.useCallback(Y=>{U(Y)&&Y.preventDefault()},[U]),pointerGraceTimerRef:F,onPointerGraceIntentChange:_.useCallback(Y=>{B.current=Y},[]),children:m.jsx(V,{...z,children:m.jsx(ap,{asChild:!0,trapped:i,onMountAutoFocus:Je(s,Y=>{var P;Y.preventDefault(),(P=D.current)==null||P.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:m.jsx(Ed,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:g,onDismiss:b,children:m.jsx(iX,{asChild:!0,...R,dir:C.dir,orientation:"vertical",loop:r,currentTabStopId:A,onCurrentTabStopIdChange:N,onEntryFocus:Je(c,Y=>{C.isUsingKeyboardRef.current||Y.preventDefault()}),preventScrollOnEntryFocus:!0,children:m.jsx(Ob,{role:"menu","aria-orientation":"vertical","data-state":Cj(w.open),"data-radix-menu-content":"",dir:C.dir,...E,...x,ref:L,style:{outline:"none",...x.style},onKeyDown:Je(x.onKeyDown,Y=>{const W=Y.target.closest("[data-radix-menu-content]")===Y.currentTarget,Z=Y.ctrlKey||Y.altKey||Y.metaKey,I=Y.key.length===1;W&&(Y.key==="Tab"&&Y.preventDefault(),!Z&&I&&H(Y.key));const re=D.current;if(Y.target!==re||!aX.includes(Y.key))return;Y.preventDefault();const oe=T().filter(se=>!se.disabled).map(se=>se.ref.current);nj.includes(Y.key)&&oe.reverse(),AX(oe)}),onBlur:Je(e.onBlur,Y=>{Y.currentTarget.contains(Y.target)||(window.clearTimeout(q.current),j.current="")}),onPointerMove:Je(e.onPointerMove,If(Y=>{const P=Y.target,W=$.current!==Y.clientX;if(Y.currentTarget.contains(P)&&W){const Z=Y.clientX>$.current?"right":"left";O.current=Z,$.current=Y.clientX}}))})})})})})})});lj.displayName=ms;var yX="MenuGroup",OC=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Jt.div,{role:"group",...r,ref:t})});OC.displayName=yX;var xX="MenuLabel",cj=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Jt.div,{...r,ref:t})});cj.displayName=xX;var Av="MenuItem",vN="menu.itemSelect",Hb=_.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,s=_.useRef(null),o=mp(Av,e.__scopeMenu),l=IC(Av,e.__scopeMenu),c=pn(t,s),d=_.useRef(!1),f=()=>{const h=s.current;if(!n&&h){const g=new CustomEvent(vN,{bubbles:!0,cancelable:!0});h.addEventListener(vN,b=>r==null?void 0:r(b),{once:!0}),hO(h,g),g.defaultPrevented?d.current=!1:o.onClose()}};return m.jsx(uj,{...i,ref:c,disabled:n,onClick:Je(e.onClick,f),onPointerDown:h=>{var g;(g=e.onPointerDown)==null||g.call(e,h),d.current=!0},onPointerUp:Je(e.onPointerUp,h=>{var g;d.current||(g=h.currentTarget)==null||g.click()}),onKeyDown:Je(e.onKeyDown,h=>{const g=l.searchRef.current!=="";n||g&&h.key===" "||WS.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});Hb.displayName=Av;var uj=_.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=e,o=IC(Av,n),l=ij(n),c=_.useRef(null),d=pn(t,c),[f,h]=_.useState(!1),[g,b]=_.useState("");return _.useEffect(()=>{const y=c.current;y&&b((y.textContent??"").trim())},[s.children]),m.jsx(Df.ItemSlot,{scope:n,disabled:r,textValue:i??g,children:m.jsx(sX,{asChild:!0,...l,focusable:!r,children:m.jsx(Jt.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:d,onPointerMove:Je(e.onPointerMove,If(y=>{r?o.onItemLeave(y):(o.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Je(e.onPointerLeave,If(y=>o.onItemLeave(y))),onFocus:Je(e.onFocus,()=>h(!0)),onBlur:Je(e.onBlur,()=>h(!1))})})})}),SX="MenuCheckboxItem",dj=_.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return m.jsx(gj,{scope:e.__scopeMenu,checked:n,children:m.jsx(Hb,{role:"menuitemcheckbox","aria-checked":Nv(n)?"mixed":n,...i,ref:t,"data-state":zC(n),onSelect:Je(i.onSelect,()=>r==null?void 0:r(Nv(n)?!0:!n),{checkForDefaultPrevented:!1})})})});dj.displayName=SX;var hj="MenuRadioGroup",[wX,CX]=Lc(hj,{value:void 0,onValueChange:()=>{}}),fj=_.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,s=Os(r);return m.jsx(wX,{scope:e.__scopeMenu,value:n,onValueChange:s,children:m.jsx(OC,{...i,ref:t})})});fj.displayName=hj;var pj="MenuRadioItem",mj=_.forwardRef((e,t)=>{const{value:n,...r}=e,i=CX(pj,e.__scopeMenu),s=n===i.value;return m.jsx(gj,{scope:e.__scopeMenu,checked:s,children:m.jsx(Hb,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":zC(s),onSelect:Je(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});mj.displayName=pj;var jC="MenuItemIndicator",[gj,kX]=Lc(jC,{checked:!1}),vj=_.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,s=kX(jC,n);return m.jsx(ys,{present:r||Nv(s.checked)||s.checked===!0,children:m.jsx(Jt.span,{...i,ref:t,"data-state":zC(s.checked)})})});vj.displayName=jC;var EX="MenuSeparator",bj=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Jt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});bj.displayName=EX;var RX="MenuArrow",_j=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=$b(n);return m.jsx(jb,{...i,...r,ref:t})});_j.displayName=RX;var TX="MenuSub",[yCe,yj]=Lc(TX),tf="MenuSubTrigger",xj=_.forwardRef((e,t)=>{const n=Dc(tf,e.__scopeMenu),r=mp(tf,e.__scopeMenu),i=yj(tf,e.__scopeMenu),s=IC(tf,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(LC,{asChild:!0,...d,children:m.jsx(uj,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Cj(n.open),...e,ref:aC(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:Je(e.onPointerMove,If(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:Je(e.onPointerLeave,If(h=>{var b,y;f();const g=(b=n.content)==null?void 0:b.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:Je(e.onKeyDown,h=>{var b;const g=s.searchRef.current!=="";e.disabled||g&&h.key===" "||lX[r.dir].includes(h.key)&&(n.onOpenChange(!0),(b=n.content)==null||b.focus(),h.preventDefault())})})})});xj.displayName=tf;var Sj="MenuSubContent",wj=_.forwardRef((e,t)=>{const n=oj(ms,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Dc(ms,e.__scopeMenu),o=mp(ms,e.__scopeMenu),l=yj(Sj,e.__scopeMenu),c=_.useRef(null),d=pn(t,c);return m.jsx(Df.Provider,{scope:e.__scopeMenu,children:m.jsx(ys,{present:r||s.open,children:m.jsx(Df.Slot,{scope:e.__scopeMenu,children:m.jsx(PC,{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:Je(e.onFocusOutside,f=>{f.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Je(e.onEscapeKeyDown,f=>{o.onClose(),f.preventDefault()}),onKeyDown:Je(e.onKeyDown,f=>{var b;const h=f.currentTarget.contains(f.target),g=cX[o.dir].includes(f.key);h&&g&&(s.onOpenChange(!1),(b=l.trigger)==null||b.focus(),f.preventDefault())})})})})})});wj.displayName=Sj;function Cj(e){return e?"open":"closed"}function Nv(e){return e==="indeterminate"}function zC(e){return Nv(e)?"indeterminate":e?"checked":"unchecked"}function AX(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function NX(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function MX(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=NX(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 LX(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 DX(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return LX(n,t)}function If(e){return t=>t.pointerType==="mouse"?e(t):void 0}var IX=sj,PX=LC,OX=aj,jX=lj,zX=OC,BX=cj,FX=Hb,$X=dj,HX=fj,UX=mj,VX=vj,WX=bj,GX=_j,qX=xj,KX=wj,BC="ContextMenu",[YX]=la(BC,[rj]),di=rj(),[XX,kj]=YX(BC),Ej=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:s=!0}=e,[o,l]=_.useState(!1),c=di(t),d=Os(r),f=_.useCallback(h=>{l(h),d(h)},[d]);return m.jsx(XX,{scope:t,open:o,onOpenChange:f,modal:s,children:m.jsx(IX,{...c,dir:i,open:o,onOpenChange:f,modal:s,children:n})})};Ej.displayName=BC;var Rj="ContextMenuTrigger",Tj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:r=!1,...i}=e,s=kj(Rj,n),o=di(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(PX,{...o,virtualRef:c}),m.jsx(Jt.span,{"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,...i,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:Je(e.onContextMenu,g=>{f(),h(g),g.preventDefault()}),onPointerDown:r?e.onPointerDown:Je(e.onPointerDown,Zm(g=>{f(),d.current=window.setTimeout(()=>h(g),700)})),onPointerMove:r?e.onPointerMove:Je(e.onPointerMove,Zm(f)),onPointerCancel:r?e.onPointerCancel:Je(e.onPointerCancel,Zm(f)),onPointerUp:r?e.onPointerUp:Je(e.onPointerUp,Zm(f))})]})});Tj.displayName=Rj;var QX="ContextMenuPortal",Aj=e=>{const{__scopeContextMenu:t,...n}=e,r=di(t);return m.jsx(OX,{...r,...n})};Aj.displayName=QX;var Nj="ContextMenuContent",Mj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=kj(Nj,n),s=di(n),o=_.useRef(!1);return m.jsx(jX,{...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=Nj;var ZX="ContextMenuGroup",JX=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=di(n);return m.jsx(zX,{...i,...r,ref:t})});JX.displayName=ZX;var eQ="ContextMenuLabel",tQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=di(n);return m.jsx(BX,{...i,...r,ref:t})});tQ.displayName=eQ;var nQ="ContextMenuItem",Lj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=di(n);return m.jsx(FX,{...i,...r,ref:t})});Lj.displayName=nQ;var rQ="ContextMenuCheckboxItem",iQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=di(n);return m.jsx($X,{...i,...r,ref:t})});iQ.displayName=rQ;var sQ="ContextMenuRadioGroup",oQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=di(n);return m.jsx(HX,{...i,...r,ref:t})});oQ.displayName=sQ;var aQ="ContextMenuRadioItem",lQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=di(n);return m.jsx(UX,{...i,...r,ref:t})});lQ.displayName=aQ;var cQ="ContextMenuItemIndicator",uQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=di(n);return m.jsx(VX,{...i,...r,ref:t})});uQ.displayName=cQ;var dQ="ContextMenuSeparator",Dj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=di(n);return m.jsx(WX,{...i,...r,ref:t})});Dj.displayName=dQ;var hQ="ContextMenuArrow",fQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=di(n);return m.jsx(GX,{...i,...r,ref:t})});fQ.displayName=hQ;var pQ="ContextMenuSubTrigger",mQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=di(n);return m.jsx(qX,{...i,...r,ref:t})});mQ.displayName=pQ;var gQ="ContextMenuSubContent",vQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=di(n);return m.jsx(KX,{...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)"}})});vQ.displayName=gQ;function Zm(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var bQ=Ej,_Q=Tj,yQ=Aj,Ij=Mj,Pj=Lj,Oj=Dj;const jj=_.createContext(null);function Ld({onOpenChange:e,...t}){const[n,r]=_.useState(0),i=_.useCallback(()=>{r(s=>s+1),e==null||e(!1)},[e]);return m.jsx(jj.Provider,{value:i,children:m.jsx(bQ,{onOpenChange:e,...t},n)})}const Dd=_Q,Ic=_.forwardRef(({className:e,...t},n)=>m.jsx(yQ,{children:m.jsx(Ij,{ref:n,className:ye("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})}));Ic.displayName=Ij.displayName;const Hn=_.forwardRef(({className:e,onSelect:t,...n},r)=>{const i=_.useContext(jj);return m.jsx(Pj,{ref:r,className:ye("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})});Hn.displayName=Pj.displayName;const zj=_.forwardRef(({className:e,...t},n)=>m.jsx(Oj,{ref:n,className:ye("-mx-1 my-1 h-px bg-border",e),...t}));zj.displayName=Oj.displayName;function xQ({editorLabel:e,onCopyPath:t,onShowArchived:n,onOpenInFinder:r,onOpenInEditor:i,onHide:s,children:o}){return m.jsxs(Ld,{children:[m.jsx(Dd,{asChild:!0,children:o}),m.jsxs(Ic,{children:[m.jsxs(Hn,{onSelect:l=>{l.stopPropagation(),t()},children:[m.jsx(ml,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Copy Path"})]}),m.jsxs(Hn,{onSelect:l=>{l.stopPropagation(),n()},children:[m.jsx(Z1,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Show Archived"})]}),m.jsxs(Hn,{onSelect:l=>{l.stopPropagation(),r()},children:[m.jsx(wb,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Show in Finder"})]}),m.jsxs(Hn,{onSelect:l=>{l.stopPropagation(),i()},children:[m.jsx(J1,{className:"h-3.5 w-3.5"}),m.jsxs("span",{className:"text-xs font-medium",children:["Open in ",e]})]}),m.jsxs(Hn,{onSelect:l=>{l.stopPropagation(),s()},className:"text-destructive hover:bg-destructive/10 focus:bg-destructive/10",children:[m.jsx(i9,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Hide"})]})]})]})}function SQ({canFork:e,onRename:t,onShare:n,onOpenInFinder:r,onFork:i,onArchive:s,onDelete:o,children:l}){return m.jsxs(Ld,{children:[m.jsx(Dd,{asChild:!0,children:l}),m.jsxs(Ic,{children:[m.jsxs(Hn,{onSelect:c=>{c.preventDefault(),t()},children:[m.jsx(iC,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Rename"})]}),m.jsxs(Hn,{onSelect:c=>{c.preventDefault(),n()},children:[m.jsx(oC,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Share"})]}),m.jsxs(Hn,{onSelect:c=>{c.preventDefault(),r()},children:[m.jsx(wb,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Open in Finder"})]}),m.jsxs(Hn,{disabled:!e,onSelect:c=>{c.preventDefault(),e&&i()},children:[m.jsx(cO,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Fork"})]}),m.jsxs(Hn,{onSelect:c=>{c.preventDefault(),s()},children:[m.jsx(Z1,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Archive"})]}),m.jsxs(Hn,{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(uO,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Delete"})]})]})]})}const wQ=new Set(["starting","running"]);function CQ({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=K5(Y5(e),n),b=i&&r?r:g,y=i&&!!r,x=Eq(e.chatId),w=m.jsxs("div",{"data-chat-id":x,className:ye("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-border/40 "),onClick:()=>s(e.chatId),children:[wQ.has(e.status)?m.jsx(Rn,{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-info/80 animate-ping"}),m.jsx("div",{className:" rounded-full z-0 size-2.5 bg-info 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-success/80 animate-ping"}),m.jsx("div",{className:" rounded-full z-0 size-2.5 bg-success 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(Md,{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:ye("relative h-7 mr-[2px] shrink-0",e.canFork?"w-12":"w-6"),children:[b?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(U5,{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:b}):null,m.jsxs("div",{className:ye("absolute inset-0 flex items-center justify-end gap-0 opacity-100 mr-[3px]",b?"md:opacity-0 md:group-hover:opacity-100":"opacity-100 md:opacity-0 md:group-hover:opacity-100"),children:[e.canFork?m.jsx(ot,{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(cO,{className:"size-3.5"})}):null,m.jsx(ot,{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(Z1,{className:"size-3.5"})})]})]})]},e._id);return m.jsx(SQ,{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 kQ=_.memo(CQ);function EQ(){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 Ub=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Id(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function FC(e){return"nodeType"in e}function Ri(e){var t,n;return e?Id(e)?e:FC(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function $C(e){const{Document:t}=Ri(e);return e instanceof t}function gp(e){return Id(e)?!1:e instanceof Ri(e).HTMLElement}function Bj(e){return e instanceof Ri(e).SVGElement}function Pd(e){return e?Id(e)?e.document:FC(e)?$C(e)?e:gp(e)||Bj(e)?e.ownerDocument:document:document:document}const ho=Ub?_.useLayoutEffect:_.useEffect;function HC(e){const t=_.useRef(e);return ho(()=>{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 RQ(){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 Pf(e,t){t===void 0&&(t=[e]);const n=_.useRef(e);return ho(()=>{n.current!==e&&(n.current=e)},t),n}function vp(e,t){const n=_.useRef();return _.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Mv(e){const t=HC(e),n=_.useRef(null),r=_.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function GS(e){const t=_.useRef();return _.useEffect(()=>{t.current=e},[e]),t.current}let Jy={};function bp(e,t){return _.useMemo(()=>{if(t)return t;const n=Jy[e]==null?0:Jy[e]+1;return Jy[e]=n,e+"-"+n},[e,t])}function Fj(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 Xu=Fj(1),Lv=Fj(-1);function TQ(e){return"clientX"in e&&"clientY"in e}function UC(e){if(!e)return!1;const{KeyboardEvent:t}=Ri(e.target);return t&&e instanceof t}function AQ(e){if(!e)return!1;const{TouchEvent:t}=Ri(e.target);return t&&e instanceof t}function qS(e){if(AQ(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 TQ(e)?{x:e.clientX,y:e.clientY}:null}const Of=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[Of.Translate.toString(e),Of.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),bN="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function NQ(e){return e.matches(bN)?e:e.querySelector(bN)}const MQ={display:"none"};function LQ(e){let{id:t,value:n}=e;return Cn.createElement("div",{id:t,style:MQ},n)}function DQ(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 Cn.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function IQ(){const[e,t]=_.useState("");return{announce:_.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const $j=_.createContext(null);function PQ(e){const t=_.useContext($j);_.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function OQ(){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 jQ={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-BoBiDCSW.js"></script>
28
+ <script type="module" crossorigin src="/assets/index-BbHCbK1f.js"></script>
29
29
  <link rel="stylesheet" crossorigin href="/assets/index-T5o0ngRG.css">
30
30
  </head>
31
31
  <body>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cuongtran001/kanna",
3
3
  "type": "module",
4
- "version": "0.42.3",
4
+ "version": "0.42.4",
5
5
  "description": "A beautiful web UI for Claude Code",
6
6
  "license": "MIT",
7
7
  "keywords": [
@@ -181,7 +181,15 @@ export class PushManager {
181
181
 
182
182
  async sendTest(id: string): Promise<void> {
183
183
  const sub = this.subscriptions.get(id)
184
- if (!sub) return
184
+ if (!sub) {
185
+ console.warn("[kanna/push] sendTest: no subscription for id", { id })
186
+ return
187
+ }
188
+ console.log("[kanna/push] sendTest: delivering test push", {
189
+ id,
190
+ endpoint: safeEndpointHost(sub.endpoint),
191
+ label: sub.label,
192
+ })
185
193
  const payload: PushPayload = {
186
194
  v: 1,
187
195
  kind: "completed",
@@ -294,6 +302,14 @@ export class PushManager {
294
302
 
295
303
  private async deliver(sub: PushSubscriptionRecord, payload: PushPayload): Promise<void> {
296
304
  const body = JSON.stringify(payload)
305
+ const endpointHost = safeEndpointHost(sub.endpoint)
306
+ console.log("[kanna/push] deliver: sending", {
307
+ id: sub.id,
308
+ endpoint: endpointHost,
309
+ kind: payload.kind,
310
+ vapidSubject: this.vapid.subject,
311
+ vapidPublicKeyHead: this.vapid.publicKey.slice(0, 12),
312
+ })
297
313
  try {
298
314
  await this.sender.send(sub, body, {
299
315
  TTL: 60,
@@ -304,17 +320,34 @@ export class PushManager {
304
320
  privateKey: this.vapid.privateKey,
305
321
  },
306
322
  })
323
+ console.log("[kanna/push] deliver: ok", { id: sub.id, endpoint: endpointHost })
307
324
  } catch (error) {
308
325
  const status = (error as { statusCode?: number }).statusCode
326
+ const headers = (error as { headers?: Record<string, string> }).headers
327
+ const responseBody = (error as { body?: string }).body
328
+ console.warn("[kanna/push] deliver: failed", {
329
+ id: sub.id,
330
+ endpoint: endpointHost,
331
+ status,
332
+ headers,
333
+ responseBody,
334
+ message: (error as Error).message,
335
+ })
309
336
  if (status === 410 || status === 404 || status === 403) {
310
337
  await this.removeSubscription(sub.id, "expired")
311
- } else {
312
- console.warn("[kanna/push] delivery failed", { id: sub.id, status, error })
313
338
  }
314
339
  }
315
340
  }
316
341
  }
317
342
 
343
+ function safeEndpointHost(endpoint: string): string {
344
+ try {
345
+ return new URL(endpoint).host
346
+ } catch {
347
+ return "<invalid>"
348
+ }
349
+ }
350
+
318
351
  export const realWebPushSender: WebPushSender = {
319
352
  async send(sub, payload, opts) {
320
353
  await webpush.sendNotification(