kanna-code 0.13.5 → 0.13.7
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.
|
@@ -436,7 +436,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
436
436
|
*
|
|
437
437
|
* This source code is licensed under the ISC license.
|
|
438
438
|
* See the LICENSE file in the root directory of this source tree.
|
|
439
|
-
*/const ZP=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Sf=Ne("zap",ZP),wu="data-focus-fallback-ignore",ZR="data-allow-focus-retain",wf="kanna:restore-chat-input-focus",db="data-chat-input",Cf="data-chat-selection-zone";function Vo(e,t){return!!(e!=null&&e.closest(`[${t}]`))}function QR(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:Vo(e,ZR):!1}function QP(e){const t=e;return t!=null&&t.matches?QR(e)||(t.tabIndex??-1)>=0||t.matches("button, a[href], summary")?!0:Vo(e,ZR):!1}function vC(e){return!!e.querySelector(`[${wu}][data-state='open']`)}function JP(e){return e?!e.isCollapsed&&e.toString().trim().length>0:!1}function eB(e,t){if(!e)return!1;const n=Array.from(t.querySelectorAll(`textarea[${db}]`)).filter(a=>!a.disabled);if(n.length===0)return!1;const r=n.indexOf(e),s=r>=0?(r+1)%n.length:0,l=n[s];return l?(l.focus({preventScroll:!0}),!0):!1}function _C(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||Vo(t,db)||e.canCancel?"none":"escape-focus";const{pointerStartTarget:s,pointerEndTarget:l,root:a,hasActiveSelection:u}=e,h=l??s;return!a||!h||!a.contains(h)||Vo(h,wu)||Vo(t,wu)||u&&(Vo(s,Cf)||Vo(h,Cf))||QR(t)?"none":t&&t===h?"restore":QP(t)?"none":"restore"}const JR=Qz,tB=Jz,eT=b.forwardRef(({className:e,...t},n)=>g.jsx(UR,{ref:n,className:xe("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}));eT.displayName=UR.displayName;const nB={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},hb=b.forwardRef(({className:e,children:t,size:n="md",...r},s)=>g.jsxs(tB,{children:[g.jsx(eT,{}),g.jsxs($R,{ref:s,[wu]:"",onCloseAutoFocus:l=>{var a;l.preventDefault(),window.dispatchEvent(new Event(wf)),(a=r.onCloseAutoFocus)==null||a.call(r,l)},className:xe("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",nB[n],e),...r,children:[t,g.jsxs(n6,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[g.jsx(Oa,{className:"h-4 w-4"}),g.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));hb.displayName=$R.displayName;function tT({className:e,...t}){return g.jsx(e6,{className:xe("text-lg font-medium leading-none tracking-tight",e),...t})}function rB({className:e,...t}){return g.jsx(t6,{className:xe("text-sm text-muted-foreground",e),...t})}function nT({className:e,...t}){return g.jsx("div",{className:xe("flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-3.5",e),...t})}function rT({className:e,...t}){return g.jsx("div",{className:xe("shrink-0 flex justify-end gap-2 border-t border-border bg-background p-2 rounded-b-xl",e),...t})}const iT=b.createContext(null);function iB({children:e}){const[t,n]=b.useState(null),[r,s]=b.useState(""),l=b.useRef(null);b.useEffect(()=>{(t==null?void 0:t.kind)==="prompt"&&(s(t.options.initialValue??""),setTimeout(()=>{var y,S;(y=l.current)==null||y.focus(),(S=l.current)==null||S.select()},0))},[t]);const a=b.useCallback(()=>{n(null),s("")},[]),u=b.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!1):t.kind==="prompt"?t.resolve(null):t.resolve(),a())},[a,t]),h=b.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!0):t.kind==="prompt"?t.resolve(r.trim()||null):t.resolve(),a())},[a,t,r]),d=b.useCallback(y=>new Promise(S=>{n({kind:"confirm",options:y,resolve:S})}),[]),p=b.useCallback(y=>new Promise(S=>{n({kind:"prompt",options:y,resolve:S})}),[]),m=b.useCallback(y=>new Promise(S=>{n({kind:"alert",options:y,resolve:S})}),[]),_=b.useMemo(()=>({confirm:d,prompt:p,alert:m}),[m,d,p]);return g.jsxs(iT.Provider,{value:_,children:[e,g.jsx(JR,{open:t!==null,onOpenChange:y=>{y||!t||u()},children:g.jsx(hb,{size:"sm",onKeyDown:y=>{y.key!=="Enter"||y.shiftKey||!t||t.kind!=="confirm"||(y.preventDefault(),h())},children:t?g.jsxs(g.Fragment,{children:[g.jsxs(nT,{className:"space-y-4",children:[g.jsx(tT,{children:t.options.title}),t.options.description?g.jsx(rB,{children:t.options.description}):null,t.kind==="prompt"?g.jsx("input",{ref:l,type:"text",value:r,onChange:y=>s(y.target.value),onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),h())},className:"w-full px-3 py-2 text-sm border border-border rounded-md bg-background outline-none",placeholder:t.options.placeholder}):null]}),g.jsxs(rT,{children:[g.jsx(tt,{variant:"ghost",size:"sm",onClick:u,className:t.kind==="alert"?"hidden":void 0,children:"cancelLabel"in t.options?t.options.cancelLabel??"Cancel":"Cancel"}),g.jsx(tt,{variant:t.kind==="confirm"?t.options.confirmVariant??"default":"secondary",size:"sm",onClick:h,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 sB(){const e=b.useContext(iT);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const oB=["top","right","bottom","left"],oo=Math.min,xr=Math.max,kf=Math.round,Rh=Math.floor,Ti=e=>({x:e,y:e}),lB={left:"right",right:"left",bottom:"top",top:"bottom"};function m_(e,t,n){return xr(e,oo(t,n))}function hs(e,t){return typeof e=="function"?e(t):e}function fs(e){return e.split("-")[0]}function La(e){return e.split("-")[1]}function fb(e){return e==="x"?"y":"x"}function pb(e){return e==="y"?"height":"width"}function Ci(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function mb(e){return fb(Ci(e))}function aB(e,t,n){n===void 0&&(n=!1);const r=La(e),s=mb(e),l=pb(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(a=Ef(a)),[a,Ef(a)]}function cB(e){const t=Ef(e);return[g_(e),t,g_(t)]}function g_(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const yC=["left","right"],bC=["right","left"],uB=["top","bottom"],dB=["bottom","top"];function hB(e,t,n){switch(e){case"top":case"bottom":return n?t?bC:yC:t?yC:bC;case"left":case"right":return t?uB:dB;default:return[]}}function fB(e,t,n,r){const s=La(e);let l=hB(fs(e),n==="start",r);return s&&(l=l.map(a=>a+"-"+s),t&&(l=l.concat(l.map(g_)))),l}function Ef(e){const t=fs(e);return lB[t]+e.slice(t.length)}function pB(e){return{top:0,right:0,bottom:0,left:0,...e}}function sT(e){return typeof e!="number"?pB(e):{top:e,right:e,bottom:e,left:e}}function Rf(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function xC(e,t,n){let{reference:r,floating:s}=e;const l=Ci(t),a=mb(t),u=pb(a),h=fs(t),d=l==="y",p=r.x+r.width/2-s.width/2,m=r.y+r.height/2-s.height/2,_=r[u]/2-s[u]/2;let y;switch(h){case"top":y={x:p,y:r.y-s.height};break;case"bottom":y={x:p,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:m};break;case"left":y={x:r.x-s.width,y:m};break;default:y={x:r.x,y:r.y}}switch(La(t)){case"start":y[a]-=_*(n&&d?-1:1);break;case"end":y[a]+=_*(n&&d?-1:1);break}return y}async function mB(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:l,rects:a,elements:u,strategy:h}=e,{boundary:d="clippingAncestors",rootBoundary:p="viewport",elementContext:m="floating",altBoundary:_=!1,padding:y=0}=hs(t,e),S=sT(y),C=u[_?m==="floating"?"reference":"floating":m],k=Rf(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(C)))==null||n?C:C.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(u.floating)),boundary:d,rootBoundary:p,strategy:h})),T=m==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,R=await(l.getOffsetParent==null?void 0:l.getOffsetParent(u.floating)),N=await(l.isElement==null?void 0:l.isElement(R))?await(l.getScale==null?void 0:l.getScale(R))||{x:1,y:1}:{x:1,y:1},j=Rf(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:T,offsetParent:R,strategy:h}):T);return{top:(k.top-j.top+S.top)/N.y,bottom:(j.bottom-k.bottom+S.bottom)/N.y,left:(k.left-j.left+S.left)/N.x,right:(j.right-k.right+S.right)/N.x}}const gB=50,vB=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:l=[],platform:a}=n,u=a.detectOverflow?a:{...a,detectOverflow:mB},h=await(a.isRTL==null?void 0:a.isRTL(t));let d=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:p,y:m}=xC(d,r,h),_=r,y=0;const S={};for(let w=0;w<l.length;w++){const C=l[w];if(!C)continue;const{name:k,fn:T}=C,{x:R,y:N,data:j,reset:A}=await T({x:p,y:m,initialPlacement:r,placement:_,strategy:s,middlewareData:S,rects:d,platform:u,elements:{reference:e,floating:t}});p=R??p,m=N??m,S[k]={...S[k],...j},A&&y<gB&&(y++,typeof A=="object"&&(A.placement&&(_=A.placement),A.rects&&(d=A.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):A.rects),{x:p,y:m}=xC(d,_,h)),w=-1)}return{x:p,y:m,placement:_,strategy:s,middlewareData:S}},_B=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:l,platform:a,elements:u,middlewareData:h}=t,{element:d,padding:p=0}=hs(e,t)||{};if(d==null)return{};const m=sT(p),_={x:n,y:r},y=mb(s),S=pb(y),w=await a.getDimensions(d),C=y==="y",k=C?"top":"left",T=C?"bottom":"right",R=C?"clientHeight":"clientWidth",N=l.reference[S]+l.reference[y]-_[y]-l.floating[S],j=_[y]-l.reference[y],A=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let D=A?A[R]:0;(!D||!await(a.isElement==null?void 0:a.isElement(A)))&&(D=u.floating[R]||l.floating[S]);const B=N/2-j/2,K=D/2-w[S]/2-1,z=oo(m[k],K),U=oo(m[T],K),H=z,F=D-w[S]-U,q=D/2-w[S]/2+B,$=m_(H,q,F),P=!h.arrow&&La(s)!=null&&q!==$&&l.reference[S]/2-(q<H?z:U)-w[S]/2<0,V=P?q<H?q-H:q-F:0;return{[y]:_[y]+V,data:{[y]:$,centerOffset:q-$-V,...P&&{alignmentOffset:V}},reset:P}}}),yB=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:l,rects:a,initialPlacement:u,platform:h,elements:d}=t,{mainAxis:p=!0,crossAxis:m=!0,fallbackPlacements:_,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:S="none",flipAlignment:w=!0,...C}=hs(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const k=fs(s),T=Ci(u),R=fs(u)===u,N=await(h.isRTL==null?void 0:h.isRTL(d.floating)),j=_||(R||!w?[Ef(u)]:cB(u)),A=S!=="none";!_&&A&&j.push(...fB(u,w,S,N));const D=[u,...j],B=await h.detectOverflow(t,C),K=[];let z=((r=l.flip)==null?void 0:r.overflows)||[];if(p&&K.push(B[k]),m){const q=aB(s,a,N);K.push(B[q[0]],B[q[1]])}if(z=[...z,{placement:s,overflows:K}],!K.every(q=>q<=0)){var U,H;const q=(((U=l.flip)==null?void 0:U.index)||0)+1,$=D[q];if($&&(!(m==="alignment"?T!==Ci($):!1)||z.every(W=>Ci(W.placement)===T?W.overflows[0]>0:!0)))return{data:{index:q,overflows:z},reset:{placement:$}};let P=(H=z.filter(V=>V.overflows[0]<=0).sort((V,W)=>V.overflows[1]-W.overflows[1])[0])==null?void 0:H.placement;if(!P)switch(y){case"bestFit":{var F;const V=(F=z.filter(W=>{if(A){const Z=Ci(W.placement);return Z===T||Z==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(Z=>Z>0).reduce((Z,M)=>Z+M,0)]).sort((W,Z)=>W[1]-Z[1])[0])==null?void 0:F[0];V&&(P=V);break}case"initialPlacement":P=u;break}if(s!==P)return{reset:{placement:P}}}return{}}}};function SC(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function wC(e){return oB.some(t=>e[t]>=0)}const bB=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...l}=hs(e,t);switch(s){case"referenceHidden":{const a=await r.detectOverflow(t,{...l,elementContext:"reference"}),u=SC(a,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:wC(u)}}}case"escaped":{const a=await r.detectOverflow(t,{...l,altBoundary:!0}),u=SC(a,n.floating);return{data:{escapedOffsets:u,escaped:wC(u)}}}default:return{}}}}},oT=new Set(["left","top"]);async function xB(e,t){const{placement:n,platform:r,elements:s}=e,l=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=fs(n),u=La(n),h=Ci(n)==="y",d=oT.has(a)?-1:1,p=l&&h?-1:1,m=hs(t,e);let{mainAxis:_,crossAxis:y,alignmentAxis:S}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return u&&typeof S=="number"&&(y=u==="end"?S*-1:S),h?{x:y*p,y:_*d}:{x:_*d,y:y*p}}const SB=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:l,placement:a,middlewareData:u}=t,h=await xB(t,e);return a===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:s+h.x,y:l+h.y,data:{...h,placement:a}}}}},wB=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:l}=t,{mainAxis:a=!0,crossAxis:u=!1,limiter:h={fn:k=>{let{x:T,y:R}=k;return{x:T,y:R}}},...d}=hs(e,t),p={x:n,y:r},m=await l.detectOverflow(t,d),_=Ci(fs(s)),y=fb(_);let S=p[y],w=p[_];if(a){const k=y==="y"?"top":"left",T=y==="y"?"bottom":"right",R=S+m[k],N=S-m[T];S=m_(R,S,N)}if(u){const k=_==="y"?"top":"left",T=_==="y"?"bottom":"right",R=w+m[k],N=w-m[T];w=m_(R,w,N)}const C=h.fn({...t,[y]:S,[_]:w});return{...C,data:{x:C.x-n,y:C.y-r,enabled:{[y]:a,[_]:u}}}}}},CB=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:l,middlewareData:a}=t,{offset:u=0,mainAxis:h=!0,crossAxis:d=!0}=hs(e,t),p={x:n,y:r},m=Ci(s),_=fb(m);let y=p[_],S=p[m];const w=hs(u,t),C=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(h){const R=_==="y"?"height":"width",N=l.reference[_]-l.floating[R]+C.mainAxis,j=l.reference[_]+l.reference[R]-C.mainAxis;y<N?y=N:y>j&&(y=j)}if(d){var k,T;const R=_==="y"?"width":"height",N=oT.has(fs(s)),j=l.reference[m]-l.floating[R]+(N&&((k=a.offset)==null?void 0:k[m])||0)+(N?0:C.crossAxis),A=l.reference[m]+l.reference[R]+(N?0:((T=a.offset)==null?void 0:T[m])||0)-(N?C.crossAxis:0);S<j?S=j:S>A&&(S=A)}return{[_]:y,[m]:S}}}},kB=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:l,platform:a,elements:u}=t,{apply:h=()=>{},...d}=hs(e,t),p=await a.detectOverflow(t,d),m=fs(s),_=La(s),y=Ci(s)==="y",{width:S,height:w}=l.floating;let C,k;m==="top"||m==="bottom"?(C=m,k=_===(await(a.isRTL==null?void 0:a.isRTL(u.floating))?"start":"end")?"left":"right"):(k=m,C=_==="end"?"top":"bottom");const T=w-p.top-p.bottom,R=S-p.left-p.right,N=oo(w-p[C],T),j=oo(S-p[k],R),A=!t.middlewareData.shift;let D=N,B=j;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(B=R),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(D=T),A&&!_){const z=xr(p.left,0),U=xr(p.right,0),H=xr(p.top,0),F=xr(p.bottom,0);y?B=S-2*(z!==0||U!==0?z+U:xr(p.left,p.right)):D=w-2*(H!==0||F!==0?H+F:xr(p.top,p.bottom))}await h({...t,availableWidth:B,availableHeight:D});const K=await a.getDimensions(u.floating);return S!==K.width||w!==K.height?{reset:{rects:!0}}:{}}}};function ap(){return typeof window<"u"}function ja(e){return lT(e)?(e.nodeName||"").toLowerCase():"#document"}function Sr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Oi(e){var t;return(t=(lT(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function lT(e){return ap()?e instanceof Node||e instanceof Sr(e).Node:!1}function ai(e){return ap()?e instanceof Element||e instanceof Sr(e).Element:!1}function gs(e){return ap()?e instanceof HTMLElement||e instanceof Sr(e).HTMLElement:!1}function CC(e){return!ap()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Sr(e).ShadowRoot}function Uu(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=ci(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function EB(e){return/^(table|td|th)$/.test(ja(e))}function cp(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const RB=/transform|translate|scale|rotate|perspective|filter/,TB=/paint|layout|strict|content/,jo=e=>!!e&&e!=="none";let pv;function gb(e){const t=ai(e)?ci(e):e;return jo(t.transform)||jo(t.translate)||jo(t.scale)||jo(t.rotate)||jo(t.perspective)||!vb()&&(jo(t.backdropFilter)||jo(t.filter))||RB.test(t.willChange||"")||TB.test(t.contain||"")}function MB(e){let t=lo(e);for(;gs(t)&&!xa(t);){if(gb(t))return t;if(cp(t))return null;t=lo(t)}return null}function vb(){return pv==null&&(pv=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),pv}function xa(e){return/^(html|body|#document)$/.test(ja(e))}function ci(e){return Sr(e).getComputedStyle(e)}function up(e){return ai(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function lo(e){if(ja(e)==="html")return e;const t=e.assignedSlot||e.parentNode||CC(e)&&e.host||Oi(e);return CC(t)?t.host:t}function aT(e){const t=lo(e);return xa(t)?e.ownerDocument?e.ownerDocument.body:e.body:gs(t)&&Uu(t)?t:aT(t)}function Cu(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=aT(e),l=s===((r=e.ownerDocument)==null?void 0:r.body),a=Sr(s);if(l){const u=v_(a);return t.concat(a,a.visualViewport||[],Uu(s)?s:[],u&&n?Cu(u):[])}else return t.concat(s,Cu(s,[],n))}function v_(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function cT(e){const t=ci(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=gs(e),l=s?e.offsetWidth:n,a=s?e.offsetHeight:r,u=kf(n)!==l||kf(r)!==a;return u&&(n=l,r=a),{width:n,height:r,$:u}}function _b(e){return ai(e)?e:e.contextElement}function ma(e){const t=_b(e);if(!gs(t))return Ti(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:l}=cT(t);let a=(l?kf(n.width):n.width)/r,u=(l?kf(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!u||!Number.isFinite(u))&&(u=1),{x:a,y:u}}const NB=Ti(0);function uT(e){const t=Sr(e);return!vb()||!t.visualViewport?NB:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function AB(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Sr(e)?!1:t}function Qo(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),l=_b(e);let a=Ti(1);t&&(r?ai(r)&&(a=ma(r)):a=ma(e));const u=AB(l,n,r)?uT(l):Ti(0);let h=(s.left+u.x)/a.x,d=(s.top+u.y)/a.y,p=s.width/a.x,m=s.height/a.y;if(l){const _=Sr(l),y=r&&ai(r)?Sr(r):r;let S=_,w=v_(S);for(;w&&r&&y!==S;){const C=ma(w),k=w.getBoundingClientRect(),T=ci(w),R=k.left+(w.clientLeft+parseFloat(T.paddingLeft))*C.x,N=k.top+(w.clientTop+parseFloat(T.paddingTop))*C.y;h*=C.x,d*=C.y,p*=C.x,m*=C.y,h+=R,d+=N,S=Sr(w),w=v_(S)}}return Rf({width:p,height:m,x:h,y:d})}function dp(e,t){const n=up(e).scrollLeft;return t?t.left+n:Qo(Oi(e)).left+n}function dT(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-dp(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function DB(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const l=s==="fixed",a=Oi(r),u=t?cp(t.floating):!1;if(r===a||u&&l)return n;let h={scrollLeft:0,scrollTop:0},d=Ti(1);const p=Ti(0),m=gs(r);if((m||!m&&!l)&&((ja(r)!=="body"||Uu(a))&&(h=up(r)),m)){const y=Qo(r);d=ma(r),p.x=y.x+r.clientLeft,p.y=y.y+r.clientTop}const _=a&&!m&&!l?dT(a,h):Ti(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-h.scrollLeft*d.x+p.x+_.x,y:n.y*d.y-h.scrollTop*d.y+p.y+_.y}}function OB(e){return Array.from(e.getClientRects())}function LB(e){const t=Oi(e),n=up(e),r=e.ownerDocument.body,s=xr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),l=xr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+dp(e);const u=-n.scrollTop;return ci(r).direction==="rtl"&&(a+=xr(t.clientWidth,r.clientWidth)-s),{width:s,height:l,x:a,y:u}}const kC=25;function jB(e,t){const n=Sr(e),r=Oi(e),s=n.visualViewport;let l=r.clientWidth,a=r.clientHeight,u=0,h=0;if(s){l=s.width,a=s.height;const p=vb();(!p||p&&t==="fixed")&&(u=s.offsetLeft,h=s.offsetTop)}const d=dp(r);if(d<=0){const p=r.ownerDocument,m=p.body,_=getComputedStyle(m),y=p.compatMode==="CSS1Compat"&&parseFloat(_.marginLeft)+parseFloat(_.marginRight)||0,S=Math.abs(r.clientWidth-m.clientWidth-y);S<=kC&&(l-=S)}else d<=kC&&(l+=d);return{width:l,height:a,x:u,y:h}}function zB(e,t){const n=Qo(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,l=gs(e)?ma(e):Ti(1),a=e.clientWidth*l.x,u=e.clientHeight*l.y,h=s*l.x,d=r*l.y;return{width:a,height:u,x:h,y:d}}function EC(e,t,n){let r;if(t==="viewport")r=jB(e,n);else if(t==="document")r=LB(Oi(e));else if(ai(t))r=zB(t,n);else{const s=uT(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Rf(r)}function hT(e,t){const n=lo(e);return n===t||!ai(n)||xa(n)?!1:ci(n).position==="fixed"||hT(n,t)}function PB(e,t){const n=t.get(e);if(n)return n;let r=Cu(e,[],!1).filter(u=>ai(u)&&ja(u)!=="body"),s=null;const l=ci(e).position==="fixed";let a=l?lo(e):e;for(;ai(a)&&!xa(a);){const u=ci(a),h=gb(a);!h&&u.position==="fixed"&&(s=null),(l?!h&&!s:!h&&u.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Uu(a)&&!h&&hT(e,a))?r=r.filter(p=>p!==a):s=u,a=lo(a)}return t.set(e,r),r}function BB(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const a=[...n==="clippingAncestors"?cp(t)?[]:PB(t,this._c):[].concat(n),r],u=EC(t,a[0],s);let h=u.top,d=u.right,p=u.bottom,m=u.left;for(let _=1;_<a.length;_++){const y=EC(t,a[_],s);h=xr(y.top,h),d=oo(y.right,d),p=oo(y.bottom,p),m=xr(y.left,m)}return{width:d-m,height:p-h,x:m,y:h}}function IB(e){const{width:t,height:n}=cT(e);return{width:t,height:n}}function HB(e,t,n){const r=gs(t),s=Oi(t),l=n==="fixed",a=Qo(e,!0,l,t);let u={scrollLeft:0,scrollTop:0};const h=Ti(0);function d(){h.x=dp(s)}if(r||!r&&!l)if((ja(t)!=="body"||Uu(s))&&(u=up(t)),r){const y=Qo(t,!0,l,t);h.x=y.x+t.clientLeft,h.y=y.y+t.clientTop}else s&&d();l&&!r&&s&&d();const p=s&&!r&&!l?dT(s,u):Ti(0),m=a.left+u.scrollLeft-h.x-p.x,_=a.top+u.scrollTop-h.y-p.y;return{x:m,y:_,width:a.width,height:a.height}}function mv(e){return ci(e).position==="static"}function RC(e,t){if(!gs(e)||ci(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Oi(e)===n&&(n=n.ownerDocument.body),n}function fT(e,t){const n=Sr(e);if(cp(e))return n;if(!gs(e)){let s=lo(e);for(;s&&!xa(s);){if(ai(s)&&!mv(s))return s;s=lo(s)}return n}let r=RC(e,t);for(;r&&EB(r)&&mv(r);)r=RC(r,t);return r&&xa(r)&&mv(r)&&!gb(r)?n:r||MB(e)||n}const FB=async function(e){const t=this.getOffsetParent||fT,n=this.getDimensions,r=await n(e.floating);return{reference:HB(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function UB(e){return ci(e).direction==="rtl"}const $B={convertOffsetParentRelativeRectToViewportRelativeRect:DB,getDocumentElement:Oi,getClippingRect:BB,getOffsetParent:fT,getElementRects:FB,getClientRects:OB,getDimensions:IB,getScale:ma,isElement:ai,isRTL:UB};function pT(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function WB(e,t){let n=null,r;const s=Oi(e);function l(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function a(u,h){u===void 0&&(u=!1),h===void 0&&(h=1),l();const d=e.getBoundingClientRect(),{left:p,top:m,width:_,height:y}=d;if(u||t(),!_||!y)return;const S=Rh(m),w=Rh(s.clientWidth-(p+_)),C=Rh(s.clientHeight-(m+y)),k=Rh(p),R={rootMargin:-S+"px "+-w+"px "+-C+"px "+-k+"px",threshold:xr(0,oo(1,h))||1};let N=!0;function j(A){const D=A[0].intersectionRatio;if(D!==h){if(!N)return a();D?a(!1,D):r=setTimeout(()=>{a(!1,1e-7)},1e3)}D===1&&!pT(d,e.getBoundingClientRect())&&a(),N=!1}try{n=new IntersectionObserver(j,{...R,root:s.ownerDocument})}catch{n=new IntersectionObserver(j,R)}n.observe(e)}return a(!0),l}function VB(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:l=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:h=!1}=r,d=_b(e),p=s||l?[...d?Cu(d):[],...t?Cu(t):[]]:[];p.forEach(k=>{s&&k.addEventListener("scroll",n,{passive:!0}),l&&k.addEventListener("resize",n)});const m=d&&u?WB(d,n):null;let _=-1,y=null;a&&(y=new ResizeObserver(k=>{let[T]=k;T&&T.target===d&&y&&t&&(y.unobserve(t),cancelAnimationFrame(_),_=requestAnimationFrame(()=>{var R;(R=y)==null||R.observe(t)})),n()}),d&&!h&&y.observe(d),t&&y.observe(t));let S,w=h?Qo(e):null;h&&C();function C(){const k=Qo(e);w&&!pT(w,k)&&n(),w=k,S=requestAnimationFrame(C)}return n(),()=>{var k;p.forEach(T=>{s&&T.removeEventListener("scroll",n),l&&T.removeEventListener("resize",n)}),m==null||m(),(k=y)==null||k.disconnect(),y=null,h&&cancelAnimationFrame(S)}}const qB=SB,KB=wB,GB=yB,YB=kB,XB=bB,TC=_B,ZB=CB,QB=(e,t,n)=>{const r=new Map,s={platform:$B,...n},l={...s.platform,_c:r};return vB(e,t,{...s,platform:l})};var JB=typeof document<"u",eI=function(){},Jh=JB?b.useLayoutEffect:eI;function Tf(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,s;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(!Tf(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const l=s[r];if(!(l==="_owner"&&e.$$typeof)&&!Tf(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function mT(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function MC(e,t){const n=mT(e);return Math.round(t*n)/n}function gv(e){const t=b.useRef(e);return Jh(()=>{t.current=e}),t}function tI(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:l,floating:a}={},transform:u=!0,whileElementsMounted:h,open:d}=e,[p,m]=b.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[_,y]=b.useState(r);Tf(_,r)||y(r);const[S,w]=b.useState(null),[C,k]=b.useState(null),T=b.useCallback(W=>{W!==A.current&&(A.current=W,w(W))},[]),R=b.useCallback(W=>{W!==D.current&&(D.current=W,k(W))},[]),N=l||S,j=a||C,A=b.useRef(null),D=b.useRef(null),B=b.useRef(p),K=h!=null,z=gv(h),U=gv(s),H=gv(d),F=b.useCallback(()=>{if(!A.current||!D.current)return;const W={placement:t,strategy:n,middleware:_};U.current&&(W.platform=U.current),QB(A.current,D.current,W).then(Z=>{const M={...Z,isPositioned:H.current!==!1};q.current&&!Tf(B.current,M)&&(B.current=M,wi.flushSync(()=>{m(M)}))})},[_,t,n,U,H]);Jh(()=>{d===!1&&B.current.isPositioned&&(B.current.isPositioned=!1,m(W=>({...W,isPositioned:!1})))},[d]);const q=b.useRef(!1);Jh(()=>(q.current=!0,()=>{q.current=!1}),[]),Jh(()=>{if(N&&(A.current=N),j&&(D.current=j),N&&j){if(z.current)return z.current(N,j,F);F()}},[N,j,F,z,K]);const $=b.useMemo(()=>({reference:A,floating:D,setReference:T,setFloating:R}),[T,R]),P=b.useMemo(()=>({reference:N,floating:j}),[N,j]),V=b.useMemo(()=>{const W={position:n,left:0,top:0};if(!P.floating)return W;const Z=MC(P.floating,p.x),M=MC(P.floating,p.y);return u?{...W,transform:"translate("+Z+"px, "+M+"px)",...mT(P.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Z,top:M}},[n,u,P.floating,p.x,p.y]);return b.useMemo(()=>({...p,update:F,refs:$,elements:P,floatingStyles:V}),[p,F,$,P,V])}const nI=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?TC({element:r.current,padding:s}).fn(n):{}:r?TC({element:r,padding:s}).fn(n):{}}}},rI=(e,t)=>{const n=qB(e);return{name:n.name,fn:n.fn,options:[e,t]}},iI=(e,t)=>{const n=KB(e);return{name:n.name,fn:n.fn,options:[e,t]}},sI=(e,t)=>({fn:ZB(e).fn,options:[e,t]}),oI=(e,t)=>{const n=GB(e);return{name:n.name,fn:n.fn,options:[e,t]}},lI=(e,t)=>{const n=YB(e);return{name:n.name,fn:n.fn,options:[e,t]}},aI=(e,t)=>{const n=XB(e);return{name:n.name,fn:n.fn,options:[e,t]}},cI=(e,t)=>{const n=nI(e);return{name:n.name,fn:n.fn,options:[e,t]}};var uI="Arrow",gT=b.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...l}=e;return g.jsx(Qe.svg,{...l,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:g.jsx("polygon",{points:"0,0 30,0 15,10"})})});gT.displayName=uI;var dI=gT;function hI(e){const[t,n]=b.useState(void 0);return zn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const l=s[0];let a,u;if("borderBoxSize"in l){const h=l.borderBoxSize,d=Array.isArray(h)?h[0]:h;a=d.inlineSize,u=d.blockSize}else a=e.offsetWidth,u=e.offsetHeight;n({width:a,height:u})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var yb="Popper",[vT,uo]=ms(yb),[fI,_T]=vT(yb),yT=e=>{const{__scopePopper:t,children:n}=e,[r,s]=b.useState(null);return g.jsx(fI,{scope:t,anchor:r,onAnchorChange:s,children:n})};yT.displayName=yb;var bT="PopperAnchor",xT=b.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,l=_T(bT,n),a=b.useRef(null),u=ut(t,a),h=b.useRef(null);return b.useEffect(()=>{const d=h.current;h.current=(r==null?void 0:r.current)||a.current,d!==h.current&&l.onAnchorChange(h.current)}),r?null:g.jsx(Qe.div,{...s,ref:u})});xT.displayName=bT;var bb="PopperContent",[pI,mI]=vT(bb),ST=b.forwardRef((e,t)=>{var te,ge,re,ve,Ce,oe;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:l="center",alignOffset:a=0,arrowPadding:u=0,avoidCollisions:h=!0,collisionBoundary:d=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:_=!1,updatePositionStrategy:y="optimized",onPlaced:S,...w}=e,C=_T(bb,n),[k,T]=b.useState(null),R=ut(t,_e=>T(_e)),[N,j]=b.useState(null),A=hI(N),D=(A==null?void 0:A.width)??0,B=(A==null?void 0:A.height)??0,K=r+(l!=="center"?"-"+l:""),z=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},U=Array.isArray(d)?d:[d],H=U.length>0,F={padding:z,boundary:U.filter(vI),altBoundary:H},{refs:q,floatingStyles:$,placement:P,isPositioned:V,middlewareData:W}=tI({strategy:"fixed",placement:K,whileElementsMounted:(..._e)=>VB(..._e,{animationFrame:y==="always"}),elements:{reference:C.anchor},middleware:[rI({mainAxis:s+B,alignmentAxis:a}),h&&iI({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?sI():void 0,...F}),h&&oI({...F}),lI({...F,apply:({elements:_e,rects:Oe,availableWidth:_t,availableHeight:yt})=>{const{width:$t,height:ar}=Oe.reference,Wt=_e.floating.style;Wt.setProperty("--radix-popper-available-width",`${_t}px`),Wt.setProperty("--radix-popper-available-height",`${yt}px`),Wt.setProperty("--radix-popper-anchor-width",`${$t}px`),Wt.setProperty("--radix-popper-anchor-height",`${ar}px`)}}),N&&cI({element:N,padding:u}),_I({arrowWidth:D,arrowHeight:B}),_&&aI({strategy:"referenceHidden",...F})]}),[Z,M]=kT(P),I=li(S);zn(()=>{V&&(I==null||I())},[V,I]);const X=(te=W.arrow)==null?void 0:te.x,L=(ge=W.arrow)==null?void 0:ge.y,ae=((re=W.arrow)==null?void 0:re.centerOffset)!==0,[ue,le]=b.useState();return zn(()=>{k&&le(window.getComputedStyle(k).zIndex)},[k]),g.jsx("div",{ref:q.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:V?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ue,"--radix-popper-transform-origin":[(ve=W.transformOrigin)==null?void 0:ve.x,(Ce=W.transformOrigin)==null?void 0:Ce.y].join(" "),...((oe=W.hide)==null?void 0:oe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:g.jsx(pI,{scope:n,placedSide:Z,onArrowChange:j,arrowX:X,arrowY:L,shouldHideArrow:ae,children:g.jsx(Qe.div,{"data-side":Z,"data-align":M,...w,ref:R,style:{...w.style,animation:V?void 0:"none"}})})})});ST.displayName=bb;var wT="PopperArrow",gI={top:"bottom",right:"left",bottom:"top",left:"right"},CT=b.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,l=mI(wT,r),a=gI[l.placedSide];return g.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:g.jsx(dI,{...s,ref:n,style:{...s.style,display:"block"}})})});CT.displayName=wT;function vI(e){return e!==null}var _I=e=>({name:"transformOrigin",options:e,fn(t){var C,k,T;const{placement:n,rects:r,middlewareData:s}=t,a=((C=s.arrow)==null?void 0:C.centerOffset)!==0,u=a?0:e.arrowWidth,h=a?0:e.arrowHeight,[d,p]=kT(n),m={start:"0%",center:"50%",end:"100%"}[p],_=(((k=s.arrow)==null?void 0:k.x)??0)+u/2,y=(((T=s.arrow)==null?void 0:T.y)??0)+h/2;let S="",w="";return d==="bottom"?(S=a?m:`${_}px`,w=`${-h}px`):d==="top"?(S=a?m:`${_}px`,w=`${r.floating.height+h}px`):d==="right"?(S=`${-h}px`,w=a?m:`${y}px`):d==="left"&&(S=`${r.floating.width+h}px`,w=a?m:`${y}px`),{data:{x:S,y:w}}}});function kT(e){const[t,n="center"]=e.split("-");return[t,n]}var hp=yT,$u=xT,fp=ST,pp=CT,ET=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"}),yI="VisuallyHidden",RT=b.forwardRef((e,t)=>g.jsx(Qe.span,{...e,ref:t,style:{...ET,...e.style}}));RT.displayName=yI;var bI=RT,[mp]=ms("Tooltip",[uo]),gp=uo(),TT="TooltipProvider",xI=700,__="tooltip.open",[SI,xb]=mp(TT),MT=e=>{const{__scopeTooltip:t,delayDuration:n=xI,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:l}=e,a=b.useRef(!0),u=b.useRef(!1),h=b.useRef(0);return b.useEffect(()=>{const d=h.current;return()=>window.clearTimeout(d)},[]),g.jsx(SI,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(h.current),a.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:u,onPointerInTransitChange:b.useCallback(d=>{u.current=d},[]),disableHoverableContent:s,children:l})};MT.displayName=TT;var ku="Tooltip",[wI,Wu]=mp(ku),NT=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:l,disableHoverableContent:a,delayDuration:u}=e,h=xb(ku,e.__scopeTooltip),d=gp(t),[p,m]=b.useState(null),_=cs(),y=b.useRef(0),S=a??h.disableHoverableContent,w=u??h.delayDuration,C=b.useRef(!1),[k,T]=ba({prop:r,defaultProp:s??!1,onChange:D=>{D?(h.onOpen(),document.dispatchEvent(new CustomEvent(__))):h.onClose(),l==null||l(D)},caller:ku}),R=b.useMemo(()=>k?C.current?"delayed-open":"instant-open":"closed",[k]),N=b.useCallback(()=>{window.clearTimeout(y.current),y.current=0,C.current=!1,T(!0)},[T]),j=b.useCallback(()=>{window.clearTimeout(y.current),y.current=0,T(!1)},[T]),A=b.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{C.current=!0,T(!0),y.current=0},w)},[w,T]);return b.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),g.jsx(hp,{...d,children:g.jsx(wI,{scope:t,contentId:_,open:k,stateAttribute:R,trigger:p,onTriggerChange:m,onTriggerEnter:b.useCallback(()=>{h.isOpenDelayedRef.current?A():N()},[h.isOpenDelayedRef,A,N]),onTriggerLeave:b.useCallback(()=>{S?j():(window.clearTimeout(y.current),y.current=0)},[j,S]),onOpen:N,onClose:j,disableHoverableContent:S,children:n})})};NT.displayName=ku;var y_="TooltipTrigger",AT=b.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Wu(y_,n),l=xb(y_,n),a=gp(n),u=b.useRef(null),h=ut(t,u,s.onTriggerChange),d=b.useRef(!1),p=b.useRef(!1),m=b.useCallback(()=>d.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),g.jsx($u,{asChild:!0,...a,children:g.jsx(Qe.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:h,onPointerMove:Ee(e.onPointerMove,_=>{_.pointerType!=="touch"&&!p.current&&!l.isPointerInTransitRef.current&&(s.onTriggerEnter(),p.current=!0)}),onPointerLeave:Ee(e.onPointerLeave,()=>{s.onTriggerLeave(),p.current=!1}),onPointerDown:Ee(e.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:Ee(e.onFocus,()=>{d.current||s.onOpen()}),onBlur:Ee(e.onBlur,s.onClose),onClick:Ee(e.onClick,s.onClose)})})});AT.displayName=y_;var Sb="TooltipPortal",[CI,kI]=mp(Sb,{forceMount:void 0}),DT=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:s}=e,l=Wu(Sb,t);return g.jsx(CI,{scope:t,forceMount:n,children:g.jsx(Gr,{present:n||l.open,children:g.jsx(Da,{asChild:!0,container:s,children:r})})})};DT.displayName=Sb;var Sa="TooltipContent",OT=b.forwardRef((e,t)=>{const n=kI(Sa,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...l}=e,a=Wu(Sa,e.__scopeTooltip);return g.jsx(Gr,{present:r||a.open,children:a.disableHoverableContent?g.jsx(LT,{side:s,...l,ref:t}):g.jsx(EI,{side:s,...l,ref:t})})}),EI=b.forwardRef((e,t)=>{const n=Wu(Sa,e.__scopeTooltip),r=xb(Sa,e.__scopeTooltip),s=b.useRef(null),l=ut(t,s),[a,u]=b.useState(null),{trigger:h,onClose:d}=n,p=s.current,{onPointerInTransitChange:m}=r,_=b.useCallback(()=>{u(null),m(!1)},[m]),y=b.useCallback((S,w)=>{const C=S.currentTarget,k={x:S.clientX,y:S.clientY},T=AI(k,C.getBoundingClientRect()),R=DI(k,T),N=OI(w.getBoundingClientRect()),j=jI([...R,...N]);u(j),m(!0)},[m]);return b.useEffect(()=>()=>_(),[_]),b.useEffect(()=>{if(h&&p){const S=C=>y(C,p),w=C=>y(C,h);return h.addEventListener("pointerleave",S),p.addEventListener("pointerleave",w),()=>{h.removeEventListener("pointerleave",S),p.removeEventListener("pointerleave",w)}}},[h,p,y,_]),b.useEffect(()=>{if(a){const S=w=>{const C=w.target,k={x:w.clientX,y:w.clientY},T=(h==null?void 0:h.contains(C))||(p==null?void 0:p.contains(C)),R=!LI(k,a);T?_():R&&(_(),d())};return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[h,p,a,d,_]),g.jsx(LT,{...e,ref:l})}),[RI,TI]=mp(ku,{isInside:!1}),MI=Oj("TooltipContent"),LT=b.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:l,onPointerDownOutside:a,...u}=e,h=Wu(Sa,n),d=gp(n),{onClose:p}=h;return b.useEffect(()=>(document.addEventListener(__,p),()=>document.removeEventListener(__,p)),[p]),b.useEffect(()=>{if(h.trigger){const m=_=>{const y=_.target;y!=null&&y.contains(h.trigger)&&p()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[h.trigger,p]),g.jsx(Aa,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:m=>m.preventDefault(),onDismiss:p,children:g.jsxs(fp,{"data-state":h.stateAttribute,...d,...u,ref:t,style:{...u.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:[g.jsx(MI,{children:r}),g.jsx(RI,{scope:n,isInside:!0,children:g.jsx(bI,{id:h.contentId,role:"tooltip",children:s||r})})]})})});OT.displayName=Sa;var jT="TooltipArrow",NI=b.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=gp(n);return TI(jT,n).isInside?null:g.jsx(pp,{...s,...r,ref:t})});NI.displayName=jT;function AI(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),l=Math.abs(t.left-e.x);switch(Math.min(n,r,s,l)){case l:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function DI(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 OI(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function LI(e,t){const{x:n,y:r}=e;let s=!1;for(let l=0,a=t.length-1;l<t.length;a=l++){const u=t[l],h=t[a],d=u.x,p=u.y,m=h.x,_=h.y;p>r!=_>r&&n<(m-d)*(r-p)/(_-p)+d&&(s=!s)}return s}function jI(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),zI(t)}function zI(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(;t.length>=2;){const l=t[t.length-1],a=t[t.length-2];if((l.x-a.x)*(s.y-a.y)>=(l.y-a.y)*(s.x-a.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const l=n[n.length-1],a=n[n.length-2];if((l.x-a.x)*(s.y-a.y)>=(l.y-a.y)*(s.x-a.x))n.pop();else break}n.push(s)}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 PI=MT,zT=NT,PT=AT,BT=DT,wb=OT;function BI({className:e,...t}){return g.jsx("kbd",{className:xe("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 II({className:e,...t}){return g.jsx("span",{className:xe("inline-flex items-center gap-0.5",e),...t})}const HI="z-50 overflow-hidden rounded-md border border-border backdrop-blur-md p-0.5 text-[11px] font-medium text-card-foreground shadow-sm animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",FI=PI,Mf=zT,Nf=PT,Eu=b.forwardRef(({className:e,sideOffset:t=4,...n},r)=>g.jsx(BT,{children:g.jsx(wb,{ref:r,sideOffset:t,className:xe("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})}));Eu.displayName=wb.displayName;const tu=zT,nu=PT;function IT(e){return e.toUpperCase()}function UI(e){const t=e.split("+");return g.jsx(II,{children:t.map((n,r)=>g.jsx(BI,{children:IT(n)},`${n}-${r}`))})}const ca=b.forwardRef(({className:e,sideOffset:t=4,children:n,shortcut:r,...s},l)=>{const a=r===void 0?null:Array.isArray(r)?r[0]??null:r;return g.jsx(BT,{children:g.jsx(wb,{ref:l,sideOffset:t,className:xe(HI,e),...s,children:a?UI(a):g.jsx("span",{children:typeof n=="string"?IT(n):n})})})});ca.displayName="HotkeyTooltipContent";const $I="0.13.5",WI={version:$I},Un="Kanna",NC="kanna",VI=".kanna",qI=".kanna-dev",KI="KANNA_RUNTIME_PROFILE",Cb=`kanna/${WI.version}`,GI="[kanna]",YI=`~/${Un}`;function vp(){var t;return(t=globalThis.process)==null?void 0:t.env}function XI(e=vp()){var t;return((t=e==null?void 0:e[KI])==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function ZI(e=vp()){return XI(e)==="dev"?qI:VI}function QI(e=vp()){return`~/${ZI(e)}`}function JI(e=vp()){return`${QI(e)}/keybindings.json`}function Th(e){return e?`${NC} ${e}`:NC}const _p=({children:e,className:t,shimmerWidth:n=100,animate:r=!0,...s})=>g.jsx("span",{style:{"--shiny-width":`${Math.min(n,100)}px`},className:xe("mx-auto max-w-md text-foreground/50",r?["animate-shiny-text [background-size:var(--shiny-width)_100%] bg-clip-text [background-position:0_0] bg-no-repeat [transition:background-position_1s_cubic-bezier(.6,.6,0,1)_infinite]","bg-gradient-to-r from-transparent via-black/80 via-50% to-transparent dark:via-white/80"]:["text-neutral"],t),...s,children:e});function b_(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const e8=[/^(?:\/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 t8(e){const t=e.trim();for(const n of e8){const r=t.match(n);if(!r)continue;const s=(r[2]??r[1]??"").trim();if(s)return s}return t}function HT(e){return e.split("/").pop()||e}function n8(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,s=60*r,l=24*s,a=7*l;return n<r?"now":n<s?`${Math.floor(n/r)}m`:n<l?`${Math.floor(n/s)}h`:n<a?`${Math.floor(n/l)}d`:`${Math.floor(n/a)}w`}const r8=new Set(["starting","running"]);function i8({chat:e,activeChatId:t,nowMs:n,onSelectChat:r,onDeleteChat:s}){const l=n8(e.lastMessageAt,n);return g.jsxs("div",{"data-chat-id":Qw(e.chatId),className:xe("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===Qw(e.chatId)?"bg-muted hover:bg-muted border-border":"border-border/0 dark:hover:border-slate-400/10 "),onClick:()=>r(e.chatId),children:[r8.has(e.status)?g.jsx(Ni,{className:"size-3.5 flex-shrink-0 animate-spin text-muted-foreground"}):e.status==="waiting_for_user"?g.jsx("div",{className:"relative ",children:g.jsxs("div",{className:" rounded-full z-0 size-3.5 flex items-center justify-center ",children:[g.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-blue-400/80 animate-ping"}),g.jsx("div",{className:" rounded-full z-0 size-2.5 bg-blue-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):null,g.jsx("span",{className:"text-sm truncate flex-1 translate-y-[-0.5px]",children:e.status!=="idle"&&e.status!=="waiting_for_user"?g.jsx(_p,{animate:e.status==="running",shimmerWidth:Math.max(20,e.title.length*3),children:e.title}):e.title}),g.jsxs("div",{className:"relative h-7 w-7 mr-[2px] shrink-0",children:[l?g.jsx("span",{className:"hidden md:flex absolute inset-0 items-center justify-end pr-1 text-[11px] text-muted-foreground opacity-50 transition-opacity group-hover:opacity-0",children:l}):null,g.jsx(tt,{variant:"ghost",size:"icon",className:xe("absolute inset-0 h-7 w-7 opacity-100 cursor-pointer rounded-sm hover:!bg-transparent !border-0",l?"md:opacity-0 md:group-hover:opacity-100":"opacity-100 md:opacity-0 md:group-hover:opacity-100"),onClick:a=>{a.stopPropagation(),s(e.chatId)},title:"Delete chat",children:g.jsx(c6,{className:"size-3.5"})})]})]},e._id)}function s8(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return b.useMemo(()=>r=>{t.forEach(s=>s(r))},t)}const yp=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function za(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function kb(e){return"nodeType"in e}function or(e){var t,n;return e?za(e)?e:kb(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Eb(e){const{Document:t}=or(e);return e instanceof t}function Vu(e){return za(e)?!1:e instanceof or(e).HTMLElement}function FT(e){return e instanceof or(e).SVGElement}function Pa(e){return e?za(e)?e.document:kb(e)?Eb(e)?e:Vu(e)||FT(e)?e.ownerDocument:document:document:document}const Ai=yp?b.useLayoutEffect:b.useEffect;function Rb(e){const t=b.useRef(e);return Ai(()=>{t.current=e}),b.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}function o8(){const e=b.useRef(null),t=b.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),n=b.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ru(e,t){t===void 0&&(t=[e]);const n=b.useRef(e);return Ai(()=>{n.current!==e&&(n.current=e)},t),n}function qu(e,t){const n=b.useRef();return b.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Af(e){const t=Rb(e),n=b.useRef(null),r=b.useCallback(s=>{s!==n.current&&(t==null||t(s,n.current)),n.current=s},[]);return[n,r]}function x_(e){const t=b.useRef();return b.useEffect(()=>{t.current=e},[e]),t.current}let vv={};function Ku(e,t){return b.useMemo(()=>{if(t)return t;const n=vv[e]==null?0:vv[e]+1;return vv[e]=n,e+"-"+n},[e,t])}function UT(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((l,a)=>{const u=Object.entries(a);for(const[h,d]of u){const p=l[h];p!=null&&(l[h]=p+e*d)}return l},{...t})}}const ga=UT(1),Df=UT(-1);function l8(e){return"clientX"in e&&"clientY"in e}function Tb(e){if(!e)return!1;const{KeyboardEvent:t}=or(e.target);return t&&e instanceof t}function a8(e){if(!e)return!1;const{TouchEvent:t}=or(e.target);return t&&e instanceof t}function S_(e){if(a8(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 l8(e)?{x:e.clientX,y:e.clientY}:null}const Tu=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[Tu.Translate.toString(e),Tu.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),AC="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function c8(e){return e.matches(AC)?e:e.querySelector(AC)}const u8={display:"none"};function d8(e){let{id:t,value:n}=e;return Ct.createElement("div",{id:t,style:u8},n)}function h8(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={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 Ct.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function f8(){const[e,t]=b.useState("");return{announce:b.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const $T=b.createContext(null);function p8(e){const t=b.useContext($T);b.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function m8(){const[e]=b.useState(()=>new Set),t=b.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[b.useCallback(r=>{let{type:s,event:l}=r;e.forEach(a=>{var u;return(u=a[s])==null?void 0:u.call(a,l)})},[e]),t]}const g8={draggable:`
|
|
439
|
+
*/const ZP=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Sf=Ne("zap",ZP),wu="data-focus-fallback-ignore",ZR="data-allow-focus-retain",wf="kanna:restore-chat-input-focus",db="data-chat-input",Cf="data-chat-selection-zone";function Vo(e,t){return!!(e!=null&&e.closest(`[${t}]`))}function QR(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:Vo(e,ZR):!1}function QP(e){const t=e;return t!=null&&t.matches?QR(e)||(t.tabIndex??-1)>=0||t.matches("button, a[href], summary")?!0:Vo(e,ZR):!1}function vC(e){return!!e.querySelector(`[${wu}][data-state='open']`)}function JP(e){return e?!e.isCollapsed&&e.toString().trim().length>0:!1}function eB(e,t){if(!e)return!1;const n=Array.from(t.querySelectorAll(`textarea[${db}]`)).filter(a=>!a.disabled);if(n.length===0)return!1;const r=n.indexOf(e),s=r>=0?(r+1)%n.length:0,l=n[s];return l?(l.focus({preventScroll:!0}),!0):!1}function _C(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||Vo(t,db)||e.canCancel?"none":"escape-focus";const{pointerStartTarget:s,pointerEndTarget:l,root:a,hasActiveSelection:u}=e,h=l??s;return!a||!h||!a.contains(h)||Vo(h,wu)||Vo(t,wu)||u&&(Vo(s,Cf)||Vo(h,Cf))||QR(t)?"none":t&&t===h?"restore":QP(t)?"none":"restore"}const JR=Qz,tB=Jz,eT=b.forwardRef(({className:e,...t},n)=>g.jsx(UR,{ref:n,className:xe("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}));eT.displayName=UR.displayName;const nB={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},hb=b.forwardRef(({className:e,children:t,size:n="md",...r},s)=>g.jsxs(tB,{children:[g.jsx(eT,{}),g.jsxs($R,{ref:s,[wu]:"",onCloseAutoFocus:l=>{var a;l.preventDefault(),window.dispatchEvent(new Event(wf)),(a=r.onCloseAutoFocus)==null||a.call(r,l)},className:xe("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",nB[n],e),...r,children:[t,g.jsxs(n6,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[g.jsx(Oa,{className:"h-4 w-4"}),g.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));hb.displayName=$R.displayName;function tT({className:e,...t}){return g.jsx(e6,{className:xe("text-lg font-medium leading-none tracking-tight",e),...t})}function rB({className:e,...t}){return g.jsx(t6,{className:xe("text-sm text-muted-foreground",e),...t})}function nT({className:e,...t}){return g.jsx("div",{className:xe("flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-3.5",e),...t})}function rT({className:e,...t}){return g.jsx("div",{className:xe("shrink-0 flex justify-end gap-2 border-t border-border bg-background p-2 rounded-b-xl",e),...t})}const iT=b.createContext(null);function iB({children:e}){const[t,n]=b.useState(null),[r,s]=b.useState(""),l=b.useRef(null);b.useEffect(()=>{(t==null?void 0:t.kind)==="prompt"&&(s(t.options.initialValue??""),setTimeout(()=>{var y,S;(y=l.current)==null||y.focus(),(S=l.current)==null||S.select()},0))},[t]);const a=b.useCallback(()=>{n(null),s("")},[]),u=b.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!1):t.kind==="prompt"?t.resolve(null):t.resolve(),a())},[a,t]),h=b.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!0):t.kind==="prompt"?t.resolve(r.trim()||null):t.resolve(),a())},[a,t,r]),d=b.useCallback(y=>new Promise(S=>{n({kind:"confirm",options:y,resolve:S})}),[]),p=b.useCallback(y=>new Promise(S=>{n({kind:"prompt",options:y,resolve:S})}),[]),m=b.useCallback(y=>new Promise(S=>{n({kind:"alert",options:y,resolve:S})}),[]),_=b.useMemo(()=>({confirm:d,prompt:p,alert:m}),[m,d,p]);return g.jsxs(iT.Provider,{value:_,children:[e,g.jsx(JR,{open:t!==null,onOpenChange:y=>{y||!t||u()},children:g.jsx(hb,{size:"sm",onKeyDown:y=>{y.key!=="Enter"||y.shiftKey||!t||t.kind!=="confirm"||(y.preventDefault(),h())},children:t?g.jsxs(g.Fragment,{children:[g.jsxs(nT,{className:"space-y-4",children:[g.jsx(tT,{children:t.options.title}),t.options.description?g.jsx(rB,{children:t.options.description}):null,t.kind==="prompt"?g.jsx("input",{ref:l,type:"text",value:r,onChange:y=>s(y.target.value),onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),h())},className:"w-full px-3 py-2 text-sm border border-border rounded-md bg-background outline-none",placeholder:t.options.placeholder}):null]}),g.jsxs(rT,{children:[g.jsx(tt,{variant:"ghost",size:"sm",onClick:u,className:t.kind==="alert"?"hidden":void 0,children:"cancelLabel"in t.options?t.options.cancelLabel??"Cancel":"Cancel"}),g.jsx(tt,{variant:t.kind==="confirm"?t.options.confirmVariant??"default":"secondary",size:"sm",onClick:h,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 sB(){const e=b.useContext(iT);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const oB=["top","right","bottom","left"],oo=Math.min,xr=Math.max,kf=Math.round,Rh=Math.floor,Ti=e=>({x:e,y:e}),lB={left:"right",right:"left",bottom:"top",top:"bottom"};function m_(e,t,n){return xr(e,oo(t,n))}function hs(e,t){return typeof e=="function"?e(t):e}function fs(e){return e.split("-")[0]}function La(e){return e.split("-")[1]}function fb(e){return e==="x"?"y":"x"}function pb(e){return e==="y"?"height":"width"}function Ci(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function mb(e){return fb(Ci(e))}function aB(e,t,n){n===void 0&&(n=!1);const r=La(e),s=mb(e),l=pb(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(a=Ef(a)),[a,Ef(a)]}function cB(e){const t=Ef(e);return[g_(e),t,g_(t)]}function g_(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const yC=["left","right"],bC=["right","left"],uB=["top","bottom"],dB=["bottom","top"];function hB(e,t,n){switch(e){case"top":case"bottom":return n?t?bC:yC:t?yC:bC;case"left":case"right":return t?uB:dB;default:return[]}}function fB(e,t,n,r){const s=La(e);let l=hB(fs(e),n==="start",r);return s&&(l=l.map(a=>a+"-"+s),t&&(l=l.concat(l.map(g_)))),l}function Ef(e){const t=fs(e);return lB[t]+e.slice(t.length)}function pB(e){return{top:0,right:0,bottom:0,left:0,...e}}function sT(e){return typeof e!="number"?pB(e):{top:e,right:e,bottom:e,left:e}}function Rf(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function xC(e,t,n){let{reference:r,floating:s}=e;const l=Ci(t),a=mb(t),u=pb(a),h=fs(t),d=l==="y",p=r.x+r.width/2-s.width/2,m=r.y+r.height/2-s.height/2,_=r[u]/2-s[u]/2;let y;switch(h){case"top":y={x:p,y:r.y-s.height};break;case"bottom":y={x:p,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:m};break;case"left":y={x:r.x-s.width,y:m};break;default:y={x:r.x,y:r.y}}switch(La(t)){case"start":y[a]-=_*(n&&d?-1:1);break;case"end":y[a]+=_*(n&&d?-1:1);break}return y}async function mB(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:l,rects:a,elements:u,strategy:h}=e,{boundary:d="clippingAncestors",rootBoundary:p="viewport",elementContext:m="floating",altBoundary:_=!1,padding:y=0}=hs(t,e),S=sT(y),C=u[_?m==="floating"?"reference":"floating":m],k=Rf(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(C)))==null||n?C:C.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(u.floating)),boundary:d,rootBoundary:p,strategy:h})),T=m==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,R=await(l.getOffsetParent==null?void 0:l.getOffsetParent(u.floating)),N=await(l.isElement==null?void 0:l.isElement(R))?await(l.getScale==null?void 0:l.getScale(R))||{x:1,y:1}:{x:1,y:1},j=Rf(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:T,offsetParent:R,strategy:h}):T);return{top:(k.top-j.top+S.top)/N.y,bottom:(j.bottom-k.bottom+S.bottom)/N.y,left:(k.left-j.left+S.left)/N.x,right:(j.right-k.right+S.right)/N.x}}const gB=50,vB=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:l=[],platform:a}=n,u=a.detectOverflow?a:{...a,detectOverflow:mB},h=await(a.isRTL==null?void 0:a.isRTL(t));let d=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:p,y:m}=xC(d,r,h),_=r,y=0;const S={};for(let w=0;w<l.length;w++){const C=l[w];if(!C)continue;const{name:k,fn:T}=C,{x:R,y:N,data:j,reset:A}=await T({x:p,y:m,initialPlacement:r,placement:_,strategy:s,middlewareData:S,rects:d,platform:u,elements:{reference:e,floating:t}});p=R??p,m=N??m,S[k]={...S[k],...j},A&&y<gB&&(y++,typeof A=="object"&&(A.placement&&(_=A.placement),A.rects&&(d=A.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):A.rects),{x:p,y:m}=xC(d,_,h)),w=-1)}return{x:p,y:m,placement:_,strategy:s,middlewareData:S}},_B=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:l,platform:a,elements:u,middlewareData:h}=t,{element:d,padding:p=0}=hs(e,t)||{};if(d==null)return{};const m=sT(p),_={x:n,y:r},y=mb(s),S=pb(y),w=await a.getDimensions(d),C=y==="y",k=C?"top":"left",T=C?"bottom":"right",R=C?"clientHeight":"clientWidth",N=l.reference[S]+l.reference[y]-_[y]-l.floating[S],j=_[y]-l.reference[y],A=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let D=A?A[R]:0;(!D||!await(a.isElement==null?void 0:a.isElement(A)))&&(D=u.floating[R]||l.floating[S]);const B=N/2-j/2,K=D/2-w[S]/2-1,z=oo(m[k],K),U=oo(m[T],K),H=z,F=D-w[S]-U,q=D/2-w[S]/2+B,$=m_(H,q,F),P=!h.arrow&&La(s)!=null&&q!==$&&l.reference[S]/2-(q<H?z:U)-w[S]/2<0,V=P?q<H?q-H:q-F:0;return{[y]:_[y]+V,data:{[y]:$,centerOffset:q-$-V,...P&&{alignmentOffset:V}},reset:P}}}),yB=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:l,rects:a,initialPlacement:u,platform:h,elements:d}=t,{mainAxis:p=!0,crossAxis:m=!0,fallbackPlacements:_,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:S="none",flipAlignment:w=!0,...C}=hs(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const k=fs(s),T=Ci(u),R=fs(u)===u,N=await(h.isRTL==null?void 0:h.isRTL(d.floating)),j=_||(R||!w?[Ef(u)]:cB(u)),A=S!=="none";!_&&A&&j.push(...fB(u,w,S,N));const D=[u,...j],B=await h.detectOverflow(t,C),K=[];let z=((r=l.flip)==null?void 0:r.overflows)||[];if(p&&K.push(B[k]),m){const q=aB(s,a,N);K.push(B[q[0]],B[q[1]])}if(z=[...z,{placement:s,overflows:K}],!K.every(q=>q<=0)){var U,H;const q=(((U=l.flip)==null?void 0:U.index)||0)+1,$=D[q];if($&&(!(m==="alignment"?T!==Ci($):!1)||z.every(W=>Ci(W.placement)===T?W.overflows[0]>0:!0)))return{data:{index:q,overflows:z},reset:{placement:$}};let P=(H=z.filter(V=>V.overflows[0]<=0).sort((V,W)=>V.overflows[1]-W.overflows[1])[0])==null?void 0:H.placement;if(!P)switch(y){case"bestFit":{var F;const V=(F=z.filter(W=>{if(A){const Z=Ci(W.placement);return Z===T||Z==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(Z=>Z>0).reduce((Z,M)=>Z+M,0)]).sort((W,Z)=>W[1]-Z[1])[0])==null?void 0:F[0];V&&(P=V);break}case"initialPlacement":P=u;break}if(s!==P)return{reset:{placement:P}}}return{}}}};function SC(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function wC(e){return oB.some(t=>e[t]>=0)}const bB=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...l}=hs(e,t);switch(s){case"referenceHidden":{const a=await r.detectOverflow(t,{...l,elementContext:"reference"}),u=SC(a,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:wC(u)}}}case"escaped":{const a=await r.detectOverflow(t,{...l,altBoundary:!0}),u=SC(a,n.floating);return{data:{escapedOffsets:u,escaped:wC(u)}}}default:return{}}}}},oT=new Set(["left","top"]);async function xB(e,t){const{placement:n,platform:r,elements:s}=e,l=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=fs(n),u=La(n),h=Ci(n)==="y",d=oT.has(a)?-1:1,p=l&&h?-1:1,m=hs(t,e);let{mainAxis:_,crossAxis:y,alignmentAxis:S}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return u&&typeof S=="number"&&(y=u==="end"?S*-1:S),h?{x:y*p,y:_*d}:{x:_*d,y:y*p}}const SB=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:l,placement:a,middlewareData:u}=t,h=await xB(t,e);return a===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:s+h.x,y:l+h.y,data:{...h,placement:a}}}}},wB=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:l}=t,{mainAxis:a=!0,crossAxis:u=!1,limiter:h={fn:k=>{let{x:T,y:R}=k;return{x:T,y:R}}},...d}=hs(e,t),p={x:n,y:r},m=await l.detectOverflow(t,d),_=Ci(fs(s)),y=fb(_);let S=p[y],w=p[_];if(a){const k=y==="y"?"top":"left",T=y==="y"?"bottom":"right",R=S+m[k],N=S-m[T];S=m_(R,S,N)}if(u){const k=_==="y"?"top":"left",T=_==="y"?"bottom":"right",R=w+m[k],N=w-m[T];w=m_(R,w,N)}const C=h.fn({...t,[y]:S,[_]:w});return{...C,data:{x:C.x-n,y:C.y-r,enabled:{[y]:a,[_]:u}}}}}},CB=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:l,middlewareData:a}=t,{offset:u=0,mainAxis:h=!0,crossAxis:d=!0}=hs(e,t),p={x:n,y:r},m=Ci(s),_=fb(m);let y=p[_],S=p[m];const w=hs(u,t),C=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(h){const R=_==="y"?"height":"width",N=l.reference[_]-l.floating[R]+C.mainAxis,j=l.reference[_]+l.reference[R]-C.mainAxis;y<N?y=N:y>j&&(y=j)}if(d){var k,T;const R=_==="y"?"width":"height",N=oT.has(fs(s)),j=l.reference[m]-l.floating[R]+(N&&((k=a.offset)==null?void 0:k[m])||0)+(N?0:C.crossAxis),A=l.reference[m]+l.reference[R]+(N?0:((T=a.offset)==null?void 0:T[m])||0)-(N?C.crossAxis:0);S<j?S=j:S>A&&(S=A)}return{[_]:y,[m]:S}}}},kB=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:l,platform:a,elements:u}=t,{apply:h=()=>{},...d}=hs(e,t),p=await a.detectOverflow(t,d),m=fs(s),_=La(s),y=Ci(s)==="y",{width:S,height:w}=l.floating;let C,k;m==="top"||m==="bottom"?(C=m,k=_===(await(a.isRTL==null?void 0:a.isRTL(u.floating))?"start":"end")?"left":"right"):(k=m,C=_==="end"?"top":"bottom");const T=w-p.top-p.bottom,R=S-p.left-p.right,N=oo(w-p[C],T),j=oo(S-p[k],R),A=!t.middlewareData.shift;let D=N,B=j;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(B=R),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(D=T),A&&!_){const z=xr(p.left,0),U=xr(p.right,0),H=xr(p.top,0),F=xr(p.bottom,0);y?B=S-2*(z!==0||U!==0?z+U:xr(p.left,p.right)):D=w-2*(H!==0||F!==0?H+F:xr(p.top,p.bottom))}await h({...t,availableWidth:B,availableHeight:D});const K=await a.getDimensions(u.floating);return S!==K.width||w!==K.height?{reset:{rects:!0}}:{}}}};function ap(){return typeof window<"u"}function ja(e){return lT(e)?(e.nodeName||"").toLowerCase():"#document"}function Sr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Oi(e){var t;return(t=(lT(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function lT(e){return ap()?e instanceof Node||e instanceof Sr(e).Node:!1}function ai(e){return ap()?e instanceof Element||e instanceof Sr(e).Element:!1}function gs(e){return ap()?e instanceof HTMLElement||e instanceof Sr(e).HTMLElement:!1}function CC(e){return!ap()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Sr(e).ShadowRoot}function Uu(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=ci(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function EB(e){return/^(table|td|th)$/.test(ja(e))}function cp(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const RB=/transform|translate|scale|rotate|perspective|filter/,TB=/paint|layout|strict|content/,jo=e=>!!e&&e!=="none";let pv;function gb(e){const t=ai(e)?ci(e):e;return jo(t.transform)||jo(t.translate)||jo(t.scale)||jo(t.rotate)||jo(t.perspective)||!vb()&&(jo(t.backdropFilter)||jo(t.filter))||RB.test(t.willChange||"")||TB.test(t.contain||"")}function MB(e){let t=lo(e);for(;gs(t)&&!xa(t);){if(gb(t))return t;if(cp(t))return null;t=lo(t)}return null}function vb(){return pv==null&&(pv=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),pv}function xa(e){return/^(html|body|#document)$/.test(ja(e))}function ci(e){return Sr(e).getComputedStyle(e)}function up(e){return ai(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function lo(e){if(ja(e)==="html")return e;const t=e.assignedSlot||e.parentNode||CC(e)&&e.host||Oi(e);return CC(t)?t.host:t}function aT(e){const t=lo(e);return xa(t)?e.ownerDocument?e.ownerDocument.body:e.body:gs(t)&&Uu(t)?t:aT(t)}function Cu(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=aT(e),l=s===((r=e.ownerDocument)==null?void 0:r.body),a=Sr(s);if(l){const u=v_(a);return t.concat(a,a.visualViewport||[],Uu(s)?s:[],u&&n?Cu(u):[])}else return t.concat(s,Cu(s,[],n))}function v_(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function cT(e){const t=ci(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=gs(e),l=s?e.offsetWidth:n,a=s?e.offsetHeight:r,u=kf(n)!==l||kf(r)!==a;return u&&(n=l,r=a),{width:n,height:r,$:u}}function _b(e){return ai(e)?e:e.contextElement}function ma(e){const t=_b(e);if(!gs(t))return Ti(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:l}=cT(t);let a=(l?kf(n.width):n.width)/r,u=(l?kf(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!u||!Number.isFinite(u))&&(u=1),{x:a,y:u}}const NB=Ti(0);function uT(e){const t=Sr(e);return!vb()||!t.visualViewport?NB:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function AB(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Sr(e)?!1:t}function Qo(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),l=_b(e);let a=Ti(1);t&&(r?ai(r)&&(a=ma(r)):a=ma(e));const u=AB(l,n,r)?uT(l):Ti(0);let h=(s.left+u.x)/a.x,d=(s.top+u.y)/a.y,p=s.width/a.x,m=s.height/a.y;if(l){const _=Sr(l),y=r&&ai(r)?Sr(r):r;let S=_,w=v_(S);for(;w&&r&&y!==S;){const C=ma(w),k=w.getBoundingClientRect(),T=ci(w),R=k.left+(w.clientLeft+parseFloat(T.paddingLeft))*C.x,N=k.top+(w.clientTop+parseFloat(T.paddingTop))*C.y;h*=C.x,d*=C.y,p*=C.x,m*=C.y,h+=R,d+=N,S=Sr(w),w=v_(S)}}return Rf({width:p,height:m,x:h,y:d})}function dp(e,t){const n=up(e).scrollLeft;return t?t.left+n:Qo(Oi(e)).left+n}function dT(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-dp(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function DB(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const l=s==="fixed",a=Oi(r),u=t?cp(t.floating):!1;if(r===a||u&&l)return n;let h={scrollLeft:0,scrollTop:0},d=Ti(1);const p=Ti(0),m=gs(r);if((m||!m&&!l)&&((ja(r)!=="body"||Uu(a))&&(h=up(r)),m)){const y=Qo(r);d=ma(r),p.x=y.x+r.clientLeft,p.y=y.y+r.clientTop}const _=a&&!m&&!l?dT(a,h):Ti(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-h.scrollLeft*d.x+p.x+_.x,y:n.y*d.y-h.scrollTop*d.y+p.y+_.y}}function OB(e){return Array.from(e.getClientRects())}function LB(e){const t=Oi(e),n=up(e),r=e.ownerDocument.body,s=xr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),l=xr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+dp(e);const u=-n.scrollTop;return ci(r).direction==="rtl"&&(a+=xr(t.clientWidth,r.clientWidth)-s),{width:s,height:l,x:a,y:u}}const kC=25;function jB(e,t){const n=Sr(e),r=Oi(e),s=n.visualViewport;let l=r.clientWidth,a=r.clientHeight,u=0,h=0;if(s){l=s.width,a=s.height;const p=vb();(!p||p&&t==="fixed")&&(u=s.offsetLeft,h=s.offsetTop)}const d=dp(r);if(d<=0){const p=r.ownerDocument,m=p.body,_=getComputedStyle(m),y=p.compatMode==="CSS1Compat"&&parseFloat(_.marginLeft)+parseFloat(_.marginRight)||0,S=Math.abs(r.clientWidth-m.clientWidth-y);S<=kC&&(l-=S)}else d<=kC&&(l+=d);return{width:l,height:a,x:u,y:h}}function zB(e,t){const n=Qo(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,l=gs(e)?ma(e):Ti(1),a=e.clientWidth*l.x,u=e.clientHeight*l.y,h=s*l.x,d=r*l.y;return{width:a,height:u,x:h,y:d}}function EC(e,t,n){let r;if(t==="viewport")r=jB(e,n);else if(t==="document")r=LB(Oi(e));else if(ai(t))r=zB(t,n);else{const s=uT(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Rf(r)}function hT(e,t){const n=lo(e);return n===t||!ai(n)||xa(n)?!1:ci(n).position==="fixed"||hT(n,t)}function PB(e,t){const n=t.get(e);if(n)return n;let r=Cu(e,[],!1).filter(u=>ai(u)&&ja(u)!=="body"),s=null;const l=ci(e).position==="fixed";let a=l?lo(e):e;for(;ai(a)&&!xa(a);){const u=ci(a),h=gb(a);!h&&u.position==="fixed"&&(s=null),(l?!h&&!s:!h&&u.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Uu(a)&&!h&&hT(e,a))?r=r.filter(p=>p!==a):s=u,a=lo(a)}return t.set(e,r),r}function BB(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const a=[...n==="clippingAncestors"?cp(t)?[]:PB(t,this._c):[].concat(n),r],u=EC(t,a[0],s);let h=u.top,d=u.right,p=u.bottom,m=u.left;for(let _=1;_<a.length;_++){const y=EC(t,a[_],s);h=xr(y.top,h),d=oo(y.right,d),p=oo(y.bottom,p),m=xr(y.left,m)}return{width:d-m,height:p-h,x:m,y:h}}function IB(e){const{width:t,height:n}=cT(e);return{width:t,height:n}}function HB(e,t,n){const r=gs(t),s=Oi(t),l=n==="fixed",a=Qo(e,!0,l,t);let u={scrollLeft:0,scrollTop:0};const h=Ti(0);function d(){h.x=dp(s)}if(r||!r&&!l)if((ja(t)!=="body"||Uu(s))&&(u=up(t)),r){const y=Qo(t,!0,l,t);h.x=y.x+t.clientLeft,h.y=y.y+t.clientTop}else s&&d();l&&!r&&s&&d();const p=s&&!r&&!l?dT(s,u):Ti(0),m=a.left+u.scrollLeft-h.x-p.x,_=a.top+u.scrollTop-h.y-p.y;return{x:m,y:_,width:a.width,height:a.height}}function mv(e){return ci(e).position==="static"}function RC(e,t){if(!gs(e)||ci(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Oi(e)===n&&(n=n.ownerDocument.body),n}function fT(e,t){const n=Sr(e);if(cp(e))return n;if(!gs(e)){let s=lo(e);for(;s&&!xa(s);){if(ai(s)&&!mv(s))return s;s=lo(s)}return n}let r=RC(e,t);for(;r&&EB(r)&&mv(r);)r=RC(r,t);return r&&xa(r)&&mv(r)&&!gb(r)?n:r||MB(e)||n}const FB=async function(e){const t=this.getOffsetParent||fT,n=this.getDimensions,r=await n(e.floating);return{reference:HB(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function UB(e){return ci(e).direction==="rtl"}const $B={convertOffsetParentRelativeRectToViewportRelativeRect:DB,getDocumentElement:Oi,getClippingRect:BB,getOffsetParent:fT,getElementRects:FB,getClientRects:OB,getDimensions:IB,getScale:ma,isElement:ai,isRTL:UB};function pT(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function WB(e,t){let n=null,r;const s=Oi(e);function l(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function a(u,h){u===void 0&&(u=!1),h===void 0&&(h=1),l();const d=e.getBoundingClientRect(),{left:p,top:m,width:_,height:y}=d;if(u||t(),!_||!y)return;const S=Rh(m),w=Rh(s.clientWidth-(p+_)),C=Rh(s.clientHeight-(m+y)),k=Rh(p),R={rootMargin:-S+"px "+-w+"px "+-C+"px "+-k+"px",threshold:xr(0,oo(1,h))||1};let N=!0;function j(A){const D=A[0].intersectionRatio;if(D!==h){if(!N)return a();D?a(!1,D):r=setTimeout(()=>{a(!1,1e-7)},1e3)}D===1&&!pT(d,e.getBoundingClientRect())&&a(),N=!1}try{n=new IntersectionObserver(j,{...R,root:s.ownerDocument})}catch{n=new IntersectionObserver(j,R)}n.observe(e)}return a(!0),l}function VB(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:l=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:h=!1}=r,d=_b(e),p=s||l?[...d?Cu(d):[],...t?Cu(t):[]]:[];p.forEach(k=>{s&&k.addEventListener("scroll",n,{passive:!0}),l&&k.addEventListener("resize",n)});const m=d&&u?WB(d,n):null;let _=-1,y=null;a&&(y=new ResizeObserver(k=>{let[T]=k;T&&T.target===d&&y&&t&&(y.unobserve(t),cancelAnimationFrame(_),_=requestAnimationFrame(()=>{var R;(R=y)==null||R.observe(t)})),n()}),d&&!h&&y.observe(d),t&&y.observe(t));let S,w=h?Qo(e):null;h&&C();function C(){const k=Qo(e);w&&!pT(w,k)&&n(),w=k,S=requestAnimationFrame(C)}return n(),()=>{var k;p.forEach(T=>{s&&T.removeEventListener("scroll",n),l&&T.removeEventListener("resize",n)}),m==null||m(),(k=y)==null||k.disconnect(),y=null,h&&cancelAnimationFrame(S)}}const qB=SB,KB=wB,GB=yB,YB=kB,XB=bB,TC=_B,ZB=CB,QB=(e,t,n)=>{const r=new Map,s={platform:$B,...n},l={...s.platform,_c:r};return vB(e,t,{...s,platform:l})};var JB=typeof document<"u",eI=function(){},Jh=JB?b.useLayoutEffect:eI;function Tf(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,s;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(!Tf(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const l=s[r];if(!(l==="_owner"&&e.$$typeof)&&!Tf(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function mT(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function MC(e,t){const n=mT(e);return Math.round(t*n)/n}function gv(e){const t=b.useRef(e);return Jh(()=>{t.current=e}),t}function tI(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:l,floating:a}={},transform:u=!0,whileElementsMounted:h,open:d}=e,[p,m]=b.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[_,y]=b.useState(r);Tf(_,r)||y(r);const[S,w]=b.useState(null),[C,k]=b.useState(null),T=b.useCallback(W=>{W!==A.current&&(A.current=W,w(W))},[]),R=b.useCallback(W=>{W!==D.current&&(D.current=W,k(W))},[]),N=l||S,j=a||C,A=b.useRef(null),D=b.useRef(null),B=b.useRef(p),K=h!=null,z=gv(h),U=gv(s),H=gv(d),F=b.useCallback(()=>{if(!A.current||!D.current)return;const W={placement:t,strategy:n,middleware:_};U.current&&(W.platform=U.current),QB(A.current,D.current,W).then(Z=>{const M={...Z,isPositioned:H.current!==!1};q.current&&!Tf(B.current,M)&&(B.current=M,wi.flushSync(()=>{m(M)}))})},[_,t,n,U,H]);Jh(()=>{d===!1&&B.current.isPositioned&&(B.current.isPositioned=!1,m(W=>({...W,isPositioned:!1})))},[d]);const q=b.useRef(!1);Jh(()=>(q.current=!0,()=>{q.current=!1}),[]),Jh(()=>{if(N&&(A.current=N),j&&(D.current=j),N&&j){if(z.current)return z.current(N,j,F);F()}},[N,j,F,z,K]);const $=b.useMemo(()=>({reference:A,floating:D,setReference:T,setFloating:R}),[T,R]),P=b.useMemo(()=>({reference:N,floating:j}),[N,j]),V=b.useMemo(()=>{const W={position:n,left:0,top:0};if(!P.floating)return W;const Z=MC(P.floating,p.x),M=MC(P.floating,p.y);return u?{...W,transform:"translate("+Z+"px, "+M+"px)",...mT(P.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Z,top:M}},[n,u,P.floating,p.x,p.y]);return b.useMemo(()=>({...p,update:F,refs:$,elements:P,floatingStyles:V}),[p,F,$,P,V])}const nI=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?TC({element:r.current,padding:s}).fn(n):{}:r?TC({element:r,padding:s}).fn(n):{}}}},rI=(e,t)=>{const n=qB(e);return{name:n.name,fn:n.fn,options:[e,t]}},iI=(e,t)=>{const n=KB(e);return{name:n.name,fn:n.fn,options:[e,t]}},sI=(e,t)=>({fn:ZB(e).fn,options:[e,t]}),oI=(e,t)=>{const n=GB(e);return{name:n.name,fn:n.fn,options:[e,t]}},lI=(e,t)=>{const n=YB(e);return{name:n.name,fn:n.fn,options:[e,t]}},aI=(e,t)=>{const n=XB(e);return{name:n.name,fn:n.fn,options:[e,t]}},cI=(e,t)=>{const n=nI(e);return{name:n.name,fn:n.fn,options:[e,t]}};var uI="Arrow",gT=b.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...l}=e;return g.jsx(Qe.svg,{...l,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:g.jsx("polygon",{points:"0,0 30,0 15,10"})})});gT.displayName=uI;var dI=gT;function hI(e){const[t,n]=b.useState(void 0);return zn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const l=s[0];let a,u;if("borderBoxSize"in l){const h=l.borderBoxSize,d=Array.isArray(h)?h[0]:h;a=d.inlineSize,u=d.blockSize}else a=e.offsetWidth,u=e.offsetHeight;n({width:a,height:u})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var yb="Popper",[vT,uo]=ms(yb),[fI,_T]=vT(yb),yT=e=>{const{__scopePopper:t,children:n}=e,[r,s]=b.useState(null);return g.jsx(fI,{scope:t,anchor:r,onAnchorChange:s,children:n})};yT.displayName=yb;var bT="PopperAnchor",xT=b.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,l=_T(bT,n),a=b.useRef(null),u=ut(t,a),h=b.useRef(null);return b.useEffect(()=>{const d=h.current;h.current=(r==null?void 0:r.current)||a.current,d!==h.current&&l.onAnchorChange(h.current)}),r?null:g.jsx(Qe.div,{...s,ref:u})});xT.displayName=bT;var bb="PopperContent",[pI,mI]=vT(bb),ST=b.forwardRef((e,t)=>{var te,ge,re,ve,Ce,oe;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:l="center",alignOffset:a=0,arrowPadding:u=0,avoidCollisions:h=!0,collisionBoundary:d=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:_=!1,updatePositionStrategy:y="optimized",onPlaced:S,...w}=e,C=_T(bb,n),[k,T]=b.useState(null),R=ut(t,_e=>T(_e)),[N,j]=b.useState(null),A=hI(N),D=(A==null?void 0:A.width)??0,B=(A==null?void 0:A.height)??0,K=r+(l!=="center"?"-"+l:""),z=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},U=Array.isArray(d)?d:[d],H=U.length>0,F={padding:z,boundary:U.filter(vI),altBoundary:H},{refs:q,floatingStyles:$,placement:P,isPositioned:V,middlewareData:W}=tI({strategy:"fixed",placement:K,whileElementsMounted:(..._e)=>VB(..._e,{animationFrame:y==="always"}),elements:{reference:C.anchor},middleware:[rI({mainAxis:s+B,alignmentAxis:a}),h&&iI({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?sI():void 0,...F}),h&&oI({...F}),lI({...F,apply:({elements:_e,rects:Oe,availableWidth:_t,availableHeight:yt})=>{const{width:$t,height:ar}=Oe.reference,Wt=_e.floating.style;Wt.setProperty("--radix-popper-available-width",`${_t}px`),Wt.setProperty("--radix-popper-available-height",`${yt}px`),Wt.setProperty("--radix-popper-anchor-width",`${$t}px`),Wt.setProperty("--radix-popper-anchor-height",`${ar}px`)}}),N&&cI({element:N,padding:u}),_I({arrowWidth:D,arrowHeight:B}),_&&aI({strategy:"referenceHidden",...F})]}),[Z,M]=kT(P),I=li(S);zn(()=>{V&&(I==null||I())},[V,I]);const X=(te=W.arrow)==null?void 0:te.x,L=(ge=W.arrow)==null?void 0:ge.y,ae=((re=W.arrow)==null?void 0:re.centerOffset)!==0,[ue,le]=b.useState();return zn(()=>{k&&le(window.getComputedStyle(k).zIndex)},[k]),g.jsx("div",{ref:q.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:V?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ue,"--radix-popper-transform-origin":[(ve=W.transformOrigin)==null?void 0:ve.x,(Ce=W.transformOrigin)==null?void 0:Ce.y].join(" "),...((oe=W.hide)==null?void 0:oe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:g.jsx(pI,{scope:n,placedSide:Z,onArrowChange:j,arrowX:X,arrowY:L,shouldHideArrow:ae,children:g.jsx(Qe.div,{"data-side":Z,"data-align":M,...w,ref:R,style:{...w.style,animation:V?void 0:"none"}})})})});ST.displayName=bb;var wT="PopperArrow",gI={top:"bottom",right:"left",bottom:"top",left:"right"},CT=b.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,l=mI(wT,r),a=gI[l.placedSide];return g.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:g.jsx(dI,{...s,ref:n,style:{...s.style,display:"block"}})})});CT.displayName=wT;function vI(e){return e!==null}var _I=e=>({name:"transformOrigin",options:e,fn(t){var C,k,T;const{placement:n,rects:r,middlewareData:s}=t,a=((C=s.arrow)==null?void 0:C.centerOffset)!==0,u=a?0:e.arrowWidth,h=a?0:e.arrowHeight,[d,p]=kT(n),m={start:"0%",center:"50%",end:"100%"}[p],_=(((k=s.arrow)==null?void 0:k.x)??0)+u/2,y=(((T=s.arrow)==null?void 0:T.y)??0)+h/2;let S="",w="";return d==="bottom"?(S=a?m:`${_}px`,w=`${-h}px`):d==="top"?(S=a?m:`${_}px`,w=`${r.floating.height+h}px`):d==="right"?(S=`${-h}px`,w=a?m:`${y}px`):d==="left"&&(S=`${r.floating.width+h}px`,w=a?m:`${y}px`),{data:{x:S,y:w}}}});function kT(e){const[t,n="center"]=e.split("-");return[t,n]}var hp=yT,$u=xT,fp=ST,pp=CT,ET=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"}),yI="VisuallyHidden",RT=b.forwardRef((e,t)=>g.jsx(Qe.span,{...e,ref:t,style:{...ET,...e.style}}));RT.displayName=yI;var bI=RT,[mp]=ms("Tooltip",[uo]),gp=uo(),TT="TooltipProvider",xI=700,__="tooltip.open",[SI,xb]=mp(TT),MT=e=>{const{__scopeTooltip:t,delayDuration:n=xI,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:l}=e,a=b.useRef(!0),u=b.useRef(!1),h=b.useRef(0);return b.useEffect(()=>{const d=h.current;return()=>window.clearTimeout(d)},[]),g.jsx(SI,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(h.current),a.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:u,onPointerInTransitChange:b.useCallback(d=>{u.current=d},[]),disableHoverableContent:s,children:l})};MT.displayName=TT;var ku="Tooltip",[wI,Wu]=mp(ku),NT=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:l,disableHoverableContent:a,delayDuration:u}=e,h=xb(ku,e.__scopeTooltip),d=gp(t),[p,m]=b.useState(null),_=cs(),y=b.useRef(0),S=a??h.disableHoverableContent,w=u??h.delayDuration,C=b.useRef(!1),[k,T]=ba({prop:r,defaultProp:s??!1,onChange:D=>{D?(h.onOpen(),document.dispatchEvent(new CustomEvent(__))):h.onClose(),l==null||l(D)},caller:ku}),R=b.useMemo(()=>k?C.current?"delayed-open":"instant-open":"closed",[k]),N=b.useCallback(()=>{window.clearTimeout(y.current),y.current=0,C.current=!1,T(!0)},[T]),j=b.useCallback(()=>{window.clearTimeout(y.current),y.current=0,T(!1)},[T]),A=b.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{C.current=!0,T(!0),y.current=0},w)},[w,T]);return b.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),g.jsx(hp,{...d,children:g.jsx(wI,{scope:t,contentId:_,open:k,stateAttribute:R,trigger:p,onTriggerChange:m,onTriggerEnter:b.useCallback(()=>{h.isOpenDelayedRef.current?A():N()},[h.isOpenDelayedRef,A,N]),onTriggerLeave:b.useCallback(()=>{S?j():(window.clearTimeout(y.current),y.current=0)},[j,S]),onOpen:N,onClose:j,disableHoverableContent:S,children:n})})};NT.displayName=ku;var y_="TooltipTrigger",AT=b.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Wu(y_,n),l=xb(y_,n),a=gp(n),u=b.useRef(null),h=ut(t,u,s.onTriggerChange),d=b.useRef(!1),p=b.useRef(!1),m=b.useCallback(()=>d.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),g.jsx($u,{asChild:!0,...a,children:g.jsx(Qe.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:h,onPointerMove:Ee(e.onPointerMove,_=>{_.pointerType!=="touch"&&!p.current&&!l.isPointerInTransitRef.current&&(s.onTriggerEnter(),p.current=!0)}),onPointerLeave:Ee(e.onPointerLeave,()=>{s.onTriggerLeave(),p.current=!1}),onPointerDown:Ee(e.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:Ee(e.onFocus,()=>{d.current||s.onOpen()}),onBlur:Ee(e.onBlur,s.onClose),onClick:Ee(e.onClick,s.onClose)})})});AT.displayName=y_;var Sb="TooltipPortal",[CI,kI]=mp(Sb,{forceMount:void 0}),DT=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:s}=e,l=Wu(Sb,t);return g.jsx(CI,{scope:t,forceMount:n,children:g.jsx(Gr,{present:n||l.open,children:g.jsx(Da,{asChild:!0,container:s,children:r})})})};DT.displayName=Sb;var Sa="TooltipContent",OT=b.forwardRef((e,t)=>{const n=kI(Sa,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...l}=e,a=Wu(Sa,e.__scopeTooltip);return g.jsx(Gr,{present:r||a.open,children:a.disableHoverableContent?g.jsx(LT,{side:s,...l,ref:t}):g.jsx(EI,{side:s,...l,ref:t})})}),EI=b.forwardRef((e,t)=>{const n=Wu(Sa,e.__scopeTooltip),r=xb(Sa,e.__scopeTooltip),s=b.useRef(null),l=ut(t,s),[a,u]=b.useState(null),{trigger:h,onClose:d}=n,p=s.current,{onPointerInTransitChange:m}=r,_=b.useCallback(()=>{u(null),m(!1)},[m]),y=b.useCallback((S,w)=>{const C=S.currentTarget,k={x:S.clientX,y:S.clientY},T=AI(k,C.getBoundingClientRect()),R=DI(k,T),N=OI(w.getBoundingClientRect()),j=jI([...R,...N]);u(j),m(!0)},[m]);return b.useEffect(()=>()=>_(),[_]),b.useEffect(()=>{if(h&&p){const S=C=>y(C,p),w=C=>y(C,h);return h.addEventListener("pointerleave",S),p.addEventListener("pointerleave",w),()=>{h.removeEventListener("pointerleave",S),p.removeEventListener("pointerleave",w)}}},[h,p,y,_]),b.useEffect(()=>{if(a){const S=w=>{const C=w.target,k={x:w.clientX,y:w.clientY},T=(h==null?void 0:h.contains(C))||(p==null?void 0:p.contains(C)),R=!LI(k,a);T?_():R&&(_(),d())};return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[h,p,a,d,_]),g.jsx(LT,{...e,ref:l})}),[RI,TI]=mp(ku,{isInside:!1}),MI=Oj("TooltipContent"),LT=b.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:l,onPointerDownOutside:a,...u}=e,h=Wu(Sa,n),d=gp(n),{onClose:p}=h;return b.useEffect(()=>(document.addEventListener(__,p),()=>document.removeEventListener(__,p)),[p]),b.useEffect(()=>{if(h.trigger){const m=_=>{const y=_.target;y!=null&&y.contains(h.trigger)&&p()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[h.trigger,p]),g.jsx(Aa,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:m=>m.preventDefault(),onDismiss:p,children:g.jsxs(fp,{"data-state":h.stateAttribute,...d,...u,ref:t,style:{...u.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:[g.jsx(MI,{children:r}),g.jsx(RI,{scope:n,isInside:!0,children:g.jsx(bI,{id:h.contentId,role:"tooltip",children:s||r})})]})})});OT.displayName=Sa;var jT="TooltipArrow",NI=b.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=gp(n);return TI(jT,n).isInside?null:g.jsx(pp,{...s,...r,ref:t})});NI.displayName=jT;function AI(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),l=Math.abs(t.left-e.x);switch(Math.min(n,r,s,l)){case l:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function DI(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 OI(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function LI(e,t){const{x:n,y:r}=e;let s=!1;for(let l=0,a=t.length-1;l<t.length;a=l++){const u=t[l],h=t[a],d=u.x,p=u.y,m=h.x,_=h.y;p>r!=_>r&&n<(m-d)*(r-p)/(_-p)+d&&(s=!s)}return s}function jI(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),zI(t)}function zI(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(;t.length>=2;){const l=t[t.length-1],a=t[t.length-2];if((l.x-a.x)*(s.y-a.y)>=(l.y-a.y)*(s.x-a.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const l=n[n.length-1],a=n[n.length-2];if((l.x-a.x)*(s.y-a.y)>=(l.y-a.y)*(s.x-a.x))n.pop();else break}n.push(s)}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 PI=MT,zT=NT,PT=AT,BT=DT,wb=OT;function BI({className:e,...t}){return g.jsx("kbd",{className:xe("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 II({className:e,...t}){return g.jsx("span",{className:xe("inline-flex items-center gap-0.5",e),...t})}const HI="z-50 overflow-hidden rounded-md border border-border backdrop-blur-md p-0.5 text-[11px] font-medium text-card-foreground shadow-sm animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",FI=PI,Mf=zT,Nf=PT,Eu=b.forwardRef(({className:e,sideOffset:t=4,...n},r)=>g.jsx(BT,{children:g.jsx(wb,{ref:r,sideOffset:t,className:xe("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})}));Eu.displayName=wb.displayName;const tu=zT,nu=PT;function IT(e){return e.toUpperCase()}function UI(e){const t=e.split("+");return g.jsx(II,{children:t.map((n,r)=>g.jsx(BI,{children:IT(n)},`${n}-${r}`))})}const ca=b.forwardRef(({className:e,sideOffset:t=4,children:n,shortcut:r,...s},l)=>{const a=r===void 0?null:Array.isArray(r)?r[0]??null:r;return g.jsx(BT,{children:g.jsx(wb,{ref:l,sideOffset:t,className:xe(HI,e),...s,children:a?UI(a):g.jsx("span",{children:typeof n=="string"?IT(n):n})})})});ca.displayName="HotkeyTooltipContent";const $I="0.13.7",WI={version:$I},Un="Kanna",NC="kanna",VI=".kanna",qI=".kanna-dev",KI="KANNA_RUNTIME_PROFILE",Cb=`kanna/${WI.version}`,GI="[kanna]",YI=`~/${Un}`;function vp(){var t;return(t=globalThis.process)==null?void 0:t.env}function XI(e=vp()){var t;return((t=e==null?void 0:e[KI])==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function ZI(e=vp()){return XI(e)==="dev"?qI:VI}function QI(e=vp()){return`~/${ZI(e)}`}function JI(e=vp()){return`${QI(e)}/keybindings.json`}function Th(e){return e?`${NC} ${e}`:NC}const _p=({children:e,className:t,shimmerWidth:n=100,animate:r=!0,...s})=>g.jsx("span",{style:{"--shiny-width":`${Math.min(n,100)}px`},className:xe("mx-auto max-w-md text-foreground/50",r?["animate-shiny-text [background-size:var(--shiny-width)_100%] bg-clip-text [background-position:0_0] bg-no-repeat [transition:background-position_1s_cubic-bezier(.6,.6,0,1)_infinite]","bg-gradient-to-r from-transparent via-black/80 via-50% to-transparent dark:via-white/80"]:["text-neutral"],t),...s,children:e});function b_(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const e8=[/^(?:\/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 t8(e){const t=e.trim();for(const n of e8){const r=t.match(n);if(!r)continue;const s=(r[2]??r[1]??"").trim();if(s)return s}return t}function HT(e){return e.split("/").pop()||e}function n8(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,s=60*r,l=24*s,a=7*l;return n<r?"now":n<s?`${Math.floor(n/r)}m`:n<l?`${Math.floor(n/s)}h`:n<a?`${Math.floor(n/l)}d`:`${Math.floor(n/a)}w`}const r8=new Set(["starting","running"]);function i8({chat:e,activeChatId:t,nowMs:n,onSelectChat:r,onDeleteChat:s}){const l=n8(e.lastMessageAt,n);return g.jsxs("div",{"data-chat-id":Qw(e.chatId),className:xe("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===Qw(e.chatId)?"bg-muted hover:bg-muted border-border":"border-border/0 dark:hover:border-slate-400/10 "),onClick:()=>r(e.chatId),children:[r8.has(e.status)?g.jsx(Ni,{className:"size-3.5 flex-shrink-0 animate-spin text-muted-foreground"}):e.status==="waiting_for_user"?g.jsx("div",{className:"relative ",children:g.jsxs("div",{className:" rounded-full z-0 size-3.5 flex items-center justify-center ",children:[g.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-blue-400/80 animate-ping"}),g.jsx("div",{className:" rounded-full z-0 size-2.5 bg-blue-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):null,g.jsx("span",{className:"text-sm truncate flex-1 translate-y-[-0.5px]",children:e.status!=="idle"&&e.status!=="waiting_for_user"?g.jsx(_p,{animate:e.status==="running",shimmerWidth:Math.max(20,e.title.length*3),children:e.title}):e.title}),g.jsxs("div",{className:"relative h-7 w-7 mr-[2px] shrink-0",children:[l?g.jsx("span",{className:"hidden md:flex absolute inset-0 items-center justify-end pr-1 text-[11px] text-muted-foreground opacity-50 transition-opacity group-hover:opacity-0",children:l}):null,g.jsx(tt,{variant:"ghost",size:"icon",className:xe("absolute inset-0 h-7 w-7 opacity-100 cursor-pointer rounded-sm hover:!bg-transparent !border-0",l?"md:opacity-0 md:group-hover:opacity-100":"opacity-100 md:opacity-0 md:group-hover:opacity-100"),onClick:a=>{a.stopPropagation(),s(e.chatId)},title:"Delete chat",children:g.jsx(c6,{className:"size-3.5"})})]})]},e._id)}function s8(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return b.useMemo(()=>r=>{t.forEach(s=>s(r))},t)}const yp=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function za(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function kb(e){return"nodeType"in e}function or(e){var t,n;return e?za(e)?e:kb(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Eb(e){const{Document:t}=or(e);return e instanceof t}function Vu(e){return za(e)?!1:e instanceof or(e).HTMLElement}function FT(e){return e instanceof or(e).SVGElement}function Pa(e){return e?za(e)?e.document:kb(e)?Eb(e)?e:Vu(e)||FT(e)?e.ownerDocument:document:document:document}const Ai=yp?b.useLayoutEffect:b.useEffect;function Rb(e){const t=b.useRef(e);return Ai(()=>{t.current=e}),b.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}function o8(){const e=b.useRef(null),t=b.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),n=b.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ru(e,t){t===void 0&&(t=[e]);const n=b.useRef(e);return Ai(()=>{n.current!==e&&(n.current=e)},t),n}function qu(e,t){const n=b.useRef();return b.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Af(e){const t=Rb(e),n=b.useRef(null),r=b.useCallback(s=>{s!==n.current&&(t==null||t(s,n.current)),n.current=s},[]);return[n,r]}function x_(e){const t=b.useRef();return b.useEffect(()=>{t.current=e},[e]),t.current}let vv={};function Ku(e,t){return b.useMemo(()=>{if(t)return t;const n=vv[e]==null?0:vv[e]+1;return vv[e]=n,e+"-"+n},[e,t])}function UT(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((l,a)=>{const u=Object.entries(a);for(const[h,d]of u){const p=l[h];p!=null&&(l[h]=p+e*d)}return l},{...t})}}const ga=UT(1),Df=UT(-1);function l8(e){return"clientX"in e&&"clientY"in e}function Tb(e){if(!e)return!1;const{KeyboardEvent:t}=or(e.target);return t&&e instanceof t}function a8(e){if(!e)return!1;const{TouchEvent:t}=or(e.target);return t&&e instanceof t}function S_(e){if(a8(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 l8(e)?{x:e.clientX,y:e.clientY}:null}const Tu=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[Tu.Translate.toString(e),Tu.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),AC="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function c8(e){return e.matches(AC)?e:e.querySelector(AC)}const u8={display:"none"};function d8(e){let{id:t,value:n}=e;return Ct.createElement("div",{id:t,style:u8},n)}function h8(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={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 Ct.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function f8(){const[e,t]=b.useState("");return{announce:b.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const $T=b.createContext(null);function p8(e){const t=b.useContext($T);b.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function m8(){const[e]=b.useState(()=>new Set),t=b.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[b.useCallback(r=>{let{type:s,event:l}=r;e.forEach(a=>{var u;return(u=a[s])==null?void 0:u.call(a,l)})},[e]),t]}const g8={draggable:`
|
|
440
440
|
To pick up a draggable item, press the space bar.
|
|
441
441
|
While dragging, use the arrow keys to move the item.
|
|
442
442
|
Press space again to drop the item in its new position, or press escape to cancel.
|
package/dist/client/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<link rel="icon" type="image/png" href="/favicon.png" />
|
|
7
7
|
<title>Kanna</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-DosK-BSl.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-CA-kJR8F.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|