kaizenai 0.1.4 → 0.1.5
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.
package/bin/kaizen
CHANGED
|
@@ -24,7 +24,7 @@ const child = spawn("bun", [entrypoint, ...process.argv.slice(2)], {
|
|
|
24
24
|
})
|
|
25
25
|
|
|
26
26
|
child.on("error", (error) => {
|
|
27
|
-
if (
|
|
27
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
|
|
28
28
|
failBunMissing()
|
|
29
29
|
return
|
|
30
30
|
}
|
|
@@ -461,7 +461,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
461
461
|
3. Refresh the page.
|
|
462
462
|
4. Right-click the get-current-period-usage request.
|
|
463
463
|
5. Copy > Copy as cURL.
|
|
464
|
-
6. Paste it here.`;function l8({open:e,onOpenChange:t,onSubmit:n}){const r=_.useRef(null),[s,o]=_.useState(""),[l,u]=_.useState(!1);_.useEffect(()=>{e&&(o(""),setTimeout(()=>{var p;return(p=r.current)==null?void 0:p.focus()},0))},[e]);async function h(){const p=await navigator.clipboard.readText();o(p)}async function d(){await navigator.clipboard.writeText(Ok),u(!0),setTimeout(()=>u(!1),2e3)}const g=s.trim().length>0;return f.jsx(ip,{open:e,onOpenChange:t,children:f.jsx(kd,{size:"lg",children:f.jsxs("form",{onSubmit:p=>{p.preventDefault(),g&&n(s.trim())},children:[f.jsxs(op,{className:"space-y-4",children:[f.jsx(sp,{children:"Import Cursor Session"}),f.jsxs(S0,{children:["Paste the copied ",f.jsx("code",{children:"get-current-period-usage"})," curl command and Kaizen will import the session for you."]}),f.jsx("div",{className:"rounded-xl border border-border bg-card px-3 py-3 text-sm text-muted-foreground whitespace-pre-line",children:Ok}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(et,{type:"button",variant:"ghost",size:"sm",onClick:()=>void h(),children:"Paste Clipboard"}),f.jsxs(et,{type:"button",variant:"ghost",size:"sm",onClick:()=>void d(),children:[l?f.jsx($i,{className:"h-4 w-4"}):f.jsx(Cd,{className:"h-4 w-4"}),f.jsx("span",{className:"ml-1",children:l?"Copied":"Copy Steps"})]})]}),f.jsx(lp,{ref:r,value:s,onChange:p=>o(p.target.value),rows:10,placeholder:"Paste the copied curl command here",className:"font-mono text-xs"})]}),f.jsxs(ap,{children:[f.jsx(et,{type:"button",variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"}),f.jsx(et,{type:"submit",variant:"secondary",size:"sm",disabled:!g,children:"Import Session"})]})]})})})}const c8=["top","right","bottom","left"],Zo=Math.min,ri=Math.max,_m=Math.round,yf=Math.floor,gs=e=>({x:e,y:e}),u8={left:"right",right:"left",bottom:"top",top:"bottom"};function Eb(e,t,n){return ri(e,Zo(t,n))}function Xs(e,t){return typeof e=="function"?e(t):e}function Zs(e){return e.split("-")[0]}function yc(e){return e.split("-")[1]}function C0(e){return e==="x"?"y":"x"}function k0(e){return e==="y"?"height":"width"}function us(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function E0(e){return C0(us(e))}function d8(e,t,n){n===void 0&&(n=!1);const r=yc(e),s=E0(e),o=k0(s);let l=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(l=bm(l)),[l,bm(l)]}function h8(e){const t=bm(e);return[Rb(e),t,Rb(t)]}function Rb(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Lk=["left","right"],zk=["right","left"],f8=["top","bottom"],m8=["bottom","top"];function p8(e,t,n){switch(e){case"top":case"bottom":return n?t?zk:Lk:t?Lk:zk;case"left":case"right":return t?f8:m8;default:return[]}}function g8(e,t,n,r){const s=yc(e);let o=p8(Zs(e),n==="start",r);return s&&(o=o.map(l=>l+"-"+s),t&&(o=o.concat(o.map(Rb)))),o}function bm(e){const t=Zs(e);return u8[t]+e.slice(t.length)}function v8(e){return{top:0,right:0,bottom:0,left:0,...e}}function AN(e){return typeof e!="number"?v8(e):{top:e,right:e,bottom:e,left:e}}function ym(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 Pk(e,t,n){let{reference:r,floating:s}=e;const o=us(t),l=E0(t),u=k0(l),h=Zs(t),d=o==="y",g=r.x+r.width/2-s.width/2,p=r.y+r.height/2-s.height/2,v=r[u]/2-s[u]/2;let y;switch(h){case"top":y={x:g,y:r.y-s.height};break;case"bottom":y={x:g,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:p};break;case"left":y={x:r.x-s.width,y:p};break;default:y={x:r.x,y:r.y}}switch(yc(t)){case"start":y[l]-=v*(n&&d?-1:1);break;case"end":y[l]+=v*(n&&d?-1:1);break}return y}async function _8(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:o,rects:l,elements:u,strategy:h}=e,{boundary:d="clippingAncestors",rootBoundary:g="viewport",elementContext:p="floating",altBoundary:v=!1,padding:y=0}=Xs(t,e),w=AN(y),C=u[v?p==="floating"?"reference":"floating":p],k=ym(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(C)))==null||n?C:C.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(u.floating)),boundary:d,rootBoundary:g,strategy:h})),R=p==="floating"?{x:r,y:s,width:l.floating.width,height:l.floating.height}:l.reference,E=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u.floating)),N=await(o.isElement==null?void 0:o.isElement(E))?await(o.getScale==null?void 0:o.getScale(E))||{x:1,y:1}:{x:1,y:1},j=ym(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:R,offsetParent:E,strategy:h}):R);return{top:(k.top-j.top+w.top)/N.y,bottom:(j.bottom-k.bottom+w.bottom)/N.y,left:(k.left-j.left+w.left)/N.x,right:(j.right-k.right+w.right)/N.x}}const b8=50,y8=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:l}=n,u=l.detectOverflow?l:{...l,detectOverflow:_8},h=await(l.isRTL==null?void 0:l.isRTL(t));let d=await l.getElementRects({reference:e,floating:t,strategy:s}),{x:g,y:p}=Pk(d,r,h),v=r,y=0;const w={};for(let S=0;S<o.length;S++){const C=o[S];if(!C)continue;const{name:k,fn:R}=C,{x:E,y:N,data:j,reset:D}=await R({x:g,y:p,initialPlacement:r,placement:v,strategy:s,middlewareData:w,rects:d,platform:u,elements:{reference:e,floating:t}});g=E??g,p=N??p,w[k]={...w[k],...j},D&&y<b8&&(y++,typeof D=="object"&&(D.placement&&(v=D.placement),D.rects&&(d=D.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:s}):D.rects),{x:g,y:p}=Pk(d,v,h)),S=-1)}return{x:g,y:p,placement:v,strategy:s,middlewareData:w}},x8=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:o,platform:l,elements:u,middlewareData:h}=t,{element:d,padding:g=0}=Xs(e,t)||{};if(d==null)return{};const p=AN(g),v={x:n,y:r},y=E0(s),w=k0(y),S=await l.getDimensions(d),C=y==="y",k=C?"top":"left",R=C?"bottom":"right",E=C?"clientHeight":"clientWidth",N=o.reference[w]+o.reference[y]-v[y]-o.floating[w],j=v[y]-o.reference[y],D=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d));let L=D?D[E]:0;(!L||!await(l.isElement==null?void 0:l.isElement(D)))&&(L=u.floating[E]||o.floating[w]);const U=N/2-j/2,Y=L/2-S[w]/2-1,P=Zo(p[k],Y),V=Zo(p[R],Y),I=P,W=L-S[w]-V,K=L/2-S[w]/2+U,q=Eb(I,K,W),O=!h.arrow&&yc(s)!=null&&K!==q&&o.reference[w]/2-(K<I?P:V)-S[w]/2<0,F=O?K<I?K-I:K-W:0;return{[y]:v[y]+F,data:{[y]:q,centerOffset:K-q-F,...O&&{alignmentOffset:F}},reset:O}}}),w8=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:o,rects:l,initialPlacement:u,platform:h,elements:d}=t,{mainAxis:g=!0,crossAxis:p=!0,fallbackPlacements:v,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:S=!0,...C}=Xs(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const k=Zs(s),R=us(u),E=Zs(u)===u,N=await(h.isRTL==null?void 0:h.isRTL(d.floating)),j=v||(E||!S?[bm(u)]:h8(u)),D=w!=="none";!v&&D&&j.push(...g8(u,S,w,N));const L=[u,...j],U=await h.detectOverflow(t,C),Y=[];let P=((r=o.flip)==null?void 0:r.overflows)||[];if(g&&Y.push(U[k]),p){const K=d8(s,l,N);Y.push(U[K[0]],U[K[1]])}if(P=[...P,{placement:s,overflows:Y}],!Y.every(K=>K<=0)){var V,I;const K=(((V=o.flip)==null?void 0:V.index)||0)+1,q=L[K];if(q&&(!(p==="alignment"?R!==us(q):!1)||P.every(H=>us(H.placement)===R?H.overflows[0]>0:!0)))return{data:{index:K,overflows:P},reset:{placement:q}};let O=(I=P.filter(F=>F.overflows[0]<=0).sort((F,H)=>F.overflows[1]-H.overflows[1])[0])==null?void 0:I.placement;if(!O)switch(y){case"bestFit":{var W;const F=(W=P.filter(H=>{if(D){const $=us(H.placement);return $===R||$==="y"}return!0}).map(H=>[H.placement,H.overflows.filter($=>$>0).reduce(($,M)=>$+M,0)]).sort((H,$)=>H[1]-$[1])[0])==null?void 0:W[0];F&&(O=F);break}case"initialPlacement":O=u;break}if(s!==O)return{reset:{placement:O}}}return{}}}};function Bk(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ik(e){return c8.some(t=>e[t]>=0)}const S8=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...o}=Xs(e,t);switch(s){case"referenceHidden":{const l=await r.detectOverflow(t,{...o,elementContext:"reference"}),u=Bk(l,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:Ik(u)}}}case"escaped":{const l=await r.detectOverflow(t,{...o,altBoundary:!0}),u=Bk(l,n.floating);return{data:{escapedOffsets:u,escaped:Ik(u)}}}default:return{}}}}},DN=new Set(["left","top"]);async function C8(e,t){const{placement:n,platform:r,elements:s}=e,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),l=Zs(n),u=yc(n),h=us(n)==="y",d=DN.has(l)?-1:1,g=o&&h?-1:1,p=Xs(t,e);let{mainAxis:v,crossAxis:y,alignmentAxis:w}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return u&&typeof w=="number"&&(y=u==="end"?w*-1:w),h?{x:y*g,y:v*d}:{x:v*d,y:y*g}}const k8=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:o,placement:l,middlewareData:u}=t,h=await C8(t,e);return l===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:s+h.x,y:o+h.y,data:{...h,placement:l}}}}},E8=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:o}=t,{mainAxis:l=!0,crossAxis:u=!1,limiter:h={fn:k=>{let{x:R,y:E}=k;return{x:R,y:E}}},...d}=Xs(e,t),g={x:n,y:r},p=await o.detectOverflow(t,d),v=us(Zs(s)),y=C0(v);let w=g[y],S=g[v];if(l){const k=y==="y"?"top":"left",R=y==="y"?"bottom":"right",E=w+p[k],N=w-p[R];w=Eb(E,w,N)}if(u){const k=v==="y"?"top":"left",R=v==="y"?"bottom":"right",E=S+p[k],N=S-p[R];S=Eb(E,S,N)}const C=h.fn({...t,[y]:w,[v]:S});return{...C,data:{x:C.x-n,y:C.y-r,enabled:{[y]:l,[v]:u}}}}}},R8=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:o,middlewareData:l}=t,{offset:u=0,mainAxis:h=!0,crossAxis:d=!0}=Xs(e,t),g={x:n,y:r},p=us(s),v=C0(p);let y=g[v],w=g[p];const S=Xs(u,t),C=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(h){const E=v==="y"?"height":"width",N=o.reference[v]-o.floating[E]+C.mainAxis,j=o.reference[v]+o.reference[E]-C.mainAxis;y<N?y=N:y>j&&(y=j)}if(d){var k,R;const E=v==="y"?"width":"height",N=DN.has(Zs(s)),j=o.reference[p]-o.floating[E]+(N&&((k=l.offset)==null?void 0:k[p])||0)+(N?0:C.crossAxis),D=o.reference[p]+o.reference[E]+(N?0:((R=l.offset)==null?void 0:R[p])||0)-(N?C.crossAxis:0);w<j?w=j:w>D&&(w=D)}return{[v]:y,[p]:w}}}},T8=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:o,platform:l,elements:u}=t,{apply:h=()=>{},...d}=Xs(e,t),g=await l.detectOverflow(t,d),p=Zs(s),v=yc(s),y=us(s)==="y",{width:w,height:S}=o.floating;let C,k;p==="top"||p==="bottom"?(C=p,k=v===(await(l.isRTL==null?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(k=p,C=v==="end"?"top":"bottom");const R=S-g.top-g.bottom,E=w-g.left-g.right,N=Zo(S-g[C],R),j=Zo(w-g[k],E),D=!t.middlewareData.shift;let L=N,U=j;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(U=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(L=R),D&&!v){const P=ri(g.left,0),V=ri(g.right,0),I=ri(g.top,0),W=ri(g.bottom,0);y?U=w-2*(P!==0||V!==0?P+V:ri(g.left,g.right)):L=S-2*(I!==0||W!==0?I+W:ri(g.top,g.bottom))}await h({...t,availableWidth:U,availableHeight:L});const Y=await l.getDimensions(u.floating);return w!==Y.width||S!==Y.height?{reset:{rects:!0}}:{}}}};function cp(){return typeof window<"u"}function xc(e){return jN(e)?(e.nodeName||"").toLowerCase():"#document"}function ii(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ys(e){var t;return(t=(jN(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function jN(e){return cp()?e instanceof Node||e instanceof ii(e).Node:!1}function Wi(e){return cp()?e instanceof Element||e instanceof ii(e).Element:!1}function to(e){return cp()?e instanceof HTMLElement||e instanceof ii(e).HTMLElement:!1}function Hk(e){return!cp()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ii(e).ShadowRoot}function Ed(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=Vi(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function N8(e){return/^(table|td|th)$/.test(xc(e))}function up(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const M8=/transform|translate|scale|rotate|perspective|filter/,A8=/paint|layout|strict|content/,Ca=e=>!!e&&e!=="none";let m_;function R0(e){const t=Wi(e)?Vi(e):e;return Ca(t.transform)||Ca(t.translate)||Ca(t.scale)||Ca(t.rotate)||Ca(t.perspective)||!T0()&&(Ca(t.backdropFilter)||Ca(t.filter))||M8.test(t.willChange||"")||A8.test(t.contain||"")}function D8(e){let t=Qo(e);for(;to(t)&&!cc(t);){if(R0(t))return t;if(up(t))return null;t=Qo(t)}return null}function T0(){return m_==null&&(m_=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),m_}function cc(e){return/^(html|body|#document)$/.test(xc(e))}function Vi(e){return ii(e).getComputedStyle(e)}function dp(e){return Wi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qo(e){if(xc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Hk(e)&&e.host||ys(e);return Hk(t)?t.host:t}function ON(e){const t=Qo(e);return cc(t)?e.ownerDocument?e.ownerDocument.body:e.body:to(t)&&Ed(t)?t:ON(t)}function sd(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=ON(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),l=ii(s);if(o){const u=Tb(l);return t.concat(l,l.visualViewport||[],Ed(s)?s:[],u&&n?sd(u):[])}else return t.concat(s,sd(s,[],n))}function Tb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function LN(e){const t=Vi(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=to(e),o=s?e.offsetWidth:n,l=s?e.offsetHeight:r,u=_m(n)!==o||_m(r)!==l;return u&&(n=o,r=l),{width:n,height:r,$:u}}function N0(e){return Wi(e)?e:e.contextElement}function rc(e){const t=N0(e);if(!to(t))return gs(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=LN(t);let l=(o?_m(n.width):n.width)/r,u=(o?_m(n.height):n.height)/s;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}const j8=gs(0);function zN(e){const t=ii(e);return!T0()||!t.visualViewport?j8:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function O8(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ii(e)?!1:t}function $a(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=N0(e);let l=gs(1);t&&(r?Wi(r)&&(l=rc(r)):l=rc(e));const u=O8(o,n,r)?zN(o):gs(0);let h=(s.left+u.x)/l.x,d=(s.top+u.y)/l.y,g=s.width/l.x,p=s.height/l.y;if(o){const v=ii(o),y=r&&Wi(r)?ii(r):r;let w=v,S=Tb(w);for(;S&&r&&y!==w;){const C=rc(S),k=S.getBoundingClientRect(),R=Vi(S),E=k.left+(S.clientLeft+parseFloat(R.paddingLeft))*C.x,N=k.top+(S.clientTop+parseFloat(R.paddingTop))*C.y;h*=C.x,d*=C.y,g*=C.x,p*=C.y,h+=E,d+=N,w=ii(S),S=Tb(w)}}return ym({width:g,height:p,x:h,y:d})}function hp(e,t){const n=dp(e).scrollLeft;return t?t.left+n:$a(ys(e)).left+n}function PN(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-hp(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function L8(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",l=ys(r),u=t?up(t.floating):!1;if(r===l||u&&o)return n;let h={scrollLeft:0,scrollTop:0},d=gs(1);const g=gs(0),p=to(r);if((p||!p&&!o)&&((xc(r)!=="body"||Ed(l))&&(h=dp(r)),p)){const y=$a(r);d=rc(r),g.x=y.x+r.clientLeft,g.y=y.y+r.clientTop}const v=l&&!p&&!o?PN(l,h):gs(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-h.scrollLeft*d.x+g.x+v.x,y:n.y*d.y-h.scrollTop*d.y+g.y+v.y}}function z8(e){return Array.from(e.getClientRects())}function P8(e){const t=ys(e),n=dp(e),r=e.ownerDocument.body,s=ri(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=ri(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+hp(e);const u=-n.scrollTop;return Vi(r).direction==="rtl"&&(l+=ri(t.clientWidth,r.clientWidth)-s),{width:s,height:o,x:l,y:u}}const Fk=25;function B8(e,t){const n=ii(e),r=ys(e),s=n.visualViewport;let o=r.clientWidth,l=r.clientHeight,u=0,h=0;if(s){o=s.width,l=s.height;const g=T0();(!g||g&&t==="fixed")&&(u=s.offsetLeft,h=s.offsetTop)}const d=hp(r);if(d<=0){const g=r.ownerDocument,p=g.body,v=getComputedStyle(p),y=g.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,w=Math.abs(r.clientWidth-p.clientWidth-y);w<=Fk&&(o-=w)}else d<=Fk&&(o+=d);return{width:o,height:l,x:u,y:h}}function I8(e,t){const n=$a(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,o=to(e)?rc(e):gs(1),l=e.clientWidth*o.x,u=e.clientHeight*o.y,h=s*o.x,d=r*o.y;return{width:l,height:u,x:h,y:d}}function Uk(e,t,n){let r;if(t==="viewport")r=B8(e,n);else if(t==="document")r=P8(ys(e));else if(Wi(t))r=I8(t,n);else{const s=zN(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return ym(r)}function BN(e,t){const n=Qo(e);return n===t||!Wi(n)||cc(n)?!1:Vi(n).position==="fixed"||BN(n,t)}function H8(e,t){const n=t.get(e);if(n)return n;let r=sd(e,[],!1).filter(u=>Wi(u)&&xc(u)!=="body"),s=null;const o=Vi(e).position==="fixed";let l=o?Qo(e):e;for(;Wi(l)&&!cc(l);){const u=Vi(l),h=R0(l);!h&&u.position==="fixed"&&(s=null),(o?!h&&!s:!h&&u.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Ed(l)&&!h&&BN(e,l))?r=r.filter(g=>g!==l):s=u,l=Qo(l)}return t.set(e,r),r}function F8(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const l=[...n==="clippingAncestors"?up(t)?[]:H8(t,this._c):[].concat(n),r],u=Uk(t,l[0],s);let h=u.top,d=u.right,g=u.bottom,p=u.left;for(let v=1;v<l.length;v++){const y=Uk(t,l[v],s);h=ri(y.top,h),d=Zo(y.right,d),g=Zo(y.bottom,g),p=ri(y.left,p)}return{width:d-p,height:g-h,x:p,y:h}}function U8(e){const{width:t,height:n}=LN(e);return{width:t,height:n}}function $8(e,t,n){const r=to(t),s=ys(t),o=n==="fixed",l=$a(e,!0,o,t);let u={scrollLeft:0,scrollTop:0};const h=gs(0);function d(){h.x=hp(s)}if(r||!r&&!o)if((xc(t)!=="body"||Ed(s))&&(u=dp(t)),r){const y=$a(t,!0,o,t);h.x=y.x+t.clientLeft,h.y=y.y+t.clientTop}else s&&d();o&&!r&&s&&d();const g=s&&!r&&!o?PN(s,u):gs(0),p=l.left+u.scrollLeft-h.x-g.x,v=l.top+u.scrollTop-h.y-g.y;return{x:p,y:v,width:l.width,height:l.height}}function p_(e){return Vi(e).position==="static"}function $k(e,t){if(!to(e)||Vi(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ys(e)===n&&(n=n.ownerDocument.body),n}function IN(e,t){const n=ii(e);if(up(e))return n;if(!to(e)){let s=Qo(e);for(;s&&!cc(s);){if(Wi(s)&&!p_(s))return s;s=Qo(s)}return n}let r=$k(e,t);for(;r&&N8(r)&&p_(r);)r=$k(r,t);return r&&cc(r)&&p_(r)&&!R0(r)?n:r||D8(e)||n}const W8=async function(e){const t=this.getOffsetParent||IN,n=this.getDimensions,r=await n(e.floating);return{reference:$8(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function V8(e){return Vi(e).direction==="rtl"}const q8={convertOffsetParentRelativeRectToViewportRelativeRect:L8,getDocumentElement:ys,getClippingRect:F8,getOffsetParent:IN,getElementRects:W8,getClientRects:z8,getDimensions:U8,getScale:rc,isElement:Wi,isRTL:V8};function HN(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function K8(e,t){let n=null,r;const s=ys(e);function o(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function l(u,h){u===void 0&&(u=!1),h===void 0&&(h=1),o();const d=e.getBoundingClientRect(),{left:g,top:p,width:v,height:y}=d;if(u||t(),!v||!y)return;const w=yf(p),S=yf(s.clientWidth-(g+v)),C=yf(s.clientHeight-(p+y)),k=yf(g),E={rootMargin:-w+"px "+-S+"px "+-C+"px "+-k+"px",threshold:ri(0,Zo(1,h))||1};let N=!0;function j(D){const L=D[0].intersectionRatio;if(L!==h){if(!N)return l();L?l(!1,L):r=setTimeout(()=>{l(!1,1e-7)},1e3)}L===1&&!HN(d,e.getBoundingClientRect())&&l(),N=!1}try{n=new IntersectionObserver(j,{...E,root:s.ownerDocument})}catch{n=new IntersectionObserver(j,E)}n.observe(e)}return l(!0),o}function G8(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:h=!1}=r,d=N0(e),g=s||o?[...d?sd(d):[],...t?sd(t):[]]:[];g.forEach(k=>{s&&k.addEventListener("scroll",n,{passive:!0}),o&&k.addEventListener("resize",n)});const p=d&&u?K8(d,n):null;let v=-1,y=null;l&&(y=new ResizeObserver(k=>{let[R]=k;R&&R.target===d&&y&&t&&(y.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var E;(E=y)==null||E.observe(t)})),n()}),d&&!h&&y.observe(d),t&&y.observe(t));let w,S=h?$a(e):null;h&&C();function C(){const k=$a(e);S&&!HN(S,k)&&n(),S=k,w=requestAnimationFrame(C)}return n(),()=>{var k;g.forEach(R=>{s&&R.removeEventListener("scroll",n),o&&R.removeEventListener("resize",n)}),p==null||p(),(k=y)==null||k.disconnect(),y=null,h&&cancelAnimationFrame(w)}}const Y8=k8,X8=E8,Z8=w8,Q8=T8,J8=S8,Wk=x8,e9=R8,t9=(e,t,n)=>{const r=new Map,s={platform:q8,...n},o={...s.platform,_c:r};return y8(e,t,{...s,platform:o})};var n9=typeof document<"u",r9=function(){},Xf=n9?_.useLayoutEffect:r9;function xm(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(!xm(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 o=s[r];if(!(o==="_owner"&&e.$$typeof)&&!xm(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function FN(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Vk(e,t){const n=FN(e);return Math.round(t*n)/n}function g_(e){const t=_.useRef(e);return Xf(()=>{t.current=e}),t}function i9(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:o,floating:l}={},transform:u=!0,whileElementsMounted:h,open:d}=e,[g,p]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[v,y]=_.useState(r);xm(v,r)||y(r);const[w,S]=_.useState(null),[C,k]=_.useState(null),R=_.useCallback(H=>{H!==D.current&&(D.current=H,S(H))},[]),E=_.useCallback(H=>{H!==L.current&&(L.current=H,k(H))},[]),N=o||w,j=l||C,D=_.useRef(null),L=_.useRef(null),U=_.useRef(g),Y=h!=null,P=g_(h),V=g_(s),I=g_(d),W=_.useCallback(()=>{if(!D.current||!L.current)return;const H={placement:t,strategy:n,middleware:v};V.current&&(H.platform=V.current),t9(D.current,L.current,H).then($=>{const M={...$,isPositioned:I.current!==!1};K.current&&!xm(U.current,M)&&(U.current=M,Bi.flushSync(()=>{p(M)}))})},[v,t,n,V,I]);Xf(()=>{d===!1&&U.current.isPositioned&&(U.current.isPositioned=!1,p(H=>({...H,isPositioned:!1})))},[d]);const K=_.useRef(!1);Xf(()=>(K.current=!0,()=>{K.current=!1}),[]),Xf(()=>{if(N&&(D.current=N),j&&(L.current=j),N&&j){if(P.current)return P.current(N,j,W);W()}},[N,j,W,P,Y]);const q=_.useMemo(()=>({reference:D,floating:L,setReference:R,setFloating:E}),[R,E]),O=_.useMemo(()=>({reference:N,floating:j}),[N,j]),F=_.useMemo(()=>{const H={position:n,left:0,top:0};if(!O.floating)return H;const $=Vk(O.floating,g.x),M=Vk(O.floating,g.y);return u?{...H,transform:"translate("+$+"px, "+M+"px)",...FN(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:$,top:M}},[n,u,O.floating,g.x,g.y]);return _.useMemo(()=>({...g,update:W,refs:q,elements:O,floatingStyles:F}),[g,W,q,O,F])}const s9=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?Wk({element:r.current,padding:s}).fn(n):{}:r?Wk({element:r,padding:s}).fn(n):{}}}},o9=(e,t)=>{const n=Y8(e);return{name:n.name,fn:n.fn,options:[e,t]}},a9=(e,t)=>{const n=X8(e);return{name:n.name,fn:n.fn,options:[e,t]}},l9=(e,t)=>({fn:e9(e).fn,options:[e,t]}),c9=(e,t)=>{const n=Z8(e);return{name:n.name,fn:n.fn,options:[e,t]}},u9=(e,t)=>{const n=Q8(e);return{name:n.name,fn:n.fn,options:[e,t]}},d9=(e,t)=>{const n=J8(e);return{name:n.name,fn:n.fn,options:[e,t]}},h9=(e,t)=>{const n=s9(e);return{name:n.name,fn:n.fn,options:[e,t]}};var f9="Arrow",UN=_.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...o}=e;return f.jsx(Rt.svg,{...o,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:f.jsx("polygon",{points:"0,0 30,0 15,10"})})});UN.displayName=f9;var m9=UN;function p9(e){const[t,n]=_.useState(void 0);return br(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let l,u;if("borderBoxSize"in o){const h=o.borderBoxSize,d=Array.isArray(h)?h[0]:h;l=d.inlineSize,u=d.blockSize}else l=e.offsetWidth,u=e.offsetHeight;n({width:l,height:u})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var M0="Popper",[$N,ea]=eo(M0),[g9,WN]=$N(M0),VN=e=>{const{__scopePopper:t,children:n}=e,[r,s]=_.useState(null);return f.jsx(g9,{scope:t,anchor:r,onAnchorChange:s,children:n})};VN.displayName=M0;var qN="PopperAnchor",KN=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,o=WN(qN,n),l=_.useRef(null),u=Ut(t,l),h=_.useRef(null);return _.useEffect(()=>{const d=h.current;h.current=(r==null?void 0:r.current)||l.current,d!==h.current&&o.onAnchorChange(h.current)}),r?null:f.jsx(Rt.div,{...s,ref:u})});KN.displayName=qN;var A0="PopperContent",[v9,_9]=$N(A0),GN=_.forwardRef((e,t)=>{var te,le,me,xe,Te,Ee;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:o="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:h=!0,collisionBoundary:d=[],collisionPadding:g=0,sticky:p="partial",hideWhenDetached:v=!1,updatePositionStrategy:y="optimized",onPlaced:w,...S}=e,C=WN(A0,n),[k,R]=_.useState(null),E=Ut(t,je=>R(je)),[N,j]=_.useState(null),D=p9(N),L=(D==null?void 0:D.width)??0,U=(D==null?void 0:D.height)??0,Y=r+(o!=="center"?"-"+o:""),P=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},V=Array.isArray(d)?d:[d],I=V.length>0,W={padding:P,boundary:V.filter(y9),altBoundary:I},{refs:K,floatingStyles:q,placement:O,isPositioned:F,middlewareData:H}=i9({strategy:"fixed",placement:Y,whileElementsMounted:(...je)=>G8(...je,{animationFrame:y==="always"}),elements:{reference:C.anchor},middleware:[o9({mainAxis:s+U,alignmentAxis:l}),h&&a9({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?l9():void 0,...W}),h&&c9({...W}),u9({...W,apply:({elements:je,rects:Ye,availableWidth:pt,availableHeight:vt})=>{const{width:he,height:ze}=Ye.reference,Ne=je.floating.style;Ne.setProperty("--radix-popper-available-width",`${pt}px`),Ne.setProperty("--radix-popper-available-height",`${vt}px`),Ne.setProperty("--radix-popper-anchor-width",`${he}px`),Ne.setProperty("--radix-popper-anchor-height",`${ze}px`)}}),N&&h9({element:N,padding:u}),x9({arrowWidth:L,arrowHeight:U}),v&&d9({strategy:"referenceHidden",...W})]}),[$,M]=ZN(O),B=Ui(w);br(()=>{F&&(B==null||B())},[F,B]);const X=(te=H.arrow)==null?void 0:te.x,A=(le=H.arrow)==null?void 0:le.y,re=((me=H.arrow)==null?void 0:me.centerOffset)!==0,[se,Z]=_.useState();return br(()=>{k&&Z(window.getComputedStyle(k).zIndex)},[k]),f.jsx("div",{ref:K.setFloating,"data-radix-popper-content-wrapper":"",style:{...q,transform:F?q.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:se,"--radix-popper-transform-origin":[(xe=H.transformOrigin)==null?void 0:xe.x,(Te=H.transformOrigin)==null?void 0:Te.y].join(" "),...((Ee=H.hide)==null?void 0:Ee.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:f.jsx(v9,{scope:n,placedSide:$,onArrowChange:j,arrowX:X,arrowY:A,shouldHideArrow:re,children:f.jsx(Rt.div,{"data-side":$,"data-align":M,...S,ref:E,style:{...S.style,animation:F?void 0:"none"}})})})});GN.displayName=A0;var YN="PopperArrow",b9={top:"bottom",right:"left",bottom:"top",left:"right"},XN=_.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,o=_9(YN,r),l=b9[o.placedSide];return f.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:f.jsx(m9,{...s,ref:n,style:{...s.style,display:"block"}})})});XN.displayName=YN;function y9(e){return e!==null}var x9=e=>({name:"transformOrigin",options:e,fn(t){var C,k,R;const{placement:n,rects:r,middlewareData:s}=t,l=((C=s.arrow)==null?void 0:C.centerOffset)!==0,u=l?0:e.arrowWidth,h=l?0:e.arrowHeight,[d,g]=ZN(n),p={start:"0%",center:"50%",end:"100%"}[g],v=(((k=s.arrow)==null?void 0:k.x)??0)+u/2,y=(((R=s.arrow)==null?void 0:R.y)??0)+h/2;let w="",S="";return d==="bottom"?(w=l?p:`${v}px`,S=`${-h}px`):d==="top"?(w=l?p:`${v}px`,S=`${r.floating.height+h}px`):d==="right"?(w=`${-h}px`,S=l?p:`${y}px`):d==="left"&&(w=`${r.floating.width+h}px`,S=l?p:`${y}px`),{data:{x:w,y:S}}}});function ZN(e){const[t,n="center"]=e.split("-");return[t,n]}var fp=VN,Rd=KN,mp=GN,pp=XN,QN=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"}),w9="VisuallyHidden",JN=_.forwardRef((e,t)=>f.jsx(Rt.span,{...e,ref:t,style:{...QN,...e.style}}));JN.displayName=w9;var S9=JN,[gp]=eo("Tooltip",[ea]),vp=ea(),eM="TooltipProvider",C9=700,Nb="tooltip.open",[k9,D0]=gp(eM),tM=e=>{const{__scopeTooltip:t,delayDuration:n=C9,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:o}=e,l=_.useRef(!0),u=_.useRef(!1),h=_.useRef(0);return _.useEffect(()=>{const d=h.current;return()=>window.clearTimeout(d)},[]),f.jsx(k9,{scope:t,isOpenDelayedRef:l,delayDuration:n,onOpen:_.useCallback(()=>{window.clearTimeout(h.current),l.current=!1},[]),onClose:_.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:u,onPointerInTransitChange:_.useCallback(d=>{u.current=d},[]),disableHoverableContent:s,children:o})};tM.displayName=eM;var od="Tooltip",[E9,Td]=gp(od),nM=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:o,disableHoverableContent:l,delayDuration:u}=e,h=D0(od,e.__scopeTooltip),d=vp(t),[g,p]=_.useState(null),v=Gs(),y=_.useRef(0),w=l??h.disableHoverableContent,S=u??h.delayDuration,C=_.useRef(!1),[k,R]=lc({prop:r,defaultProp:s??!1,onChange:L=>{L?(h.onOpen(),document.dispatchEvent(new CustomEvent(Nb))):h.onClose(),o==null||o(L)},caller:od}),E=_.useMemo(()=>k?C.current?"delayed-open":"instant-open":"closed",[k]),N=_.useCallback(()=>{window.clearTimeout(y.current),y.current=0,C.current=!1,R(!0)},[R]),j=_.useCallback(()=>{window.clearTimeout(y.current),y.current=0,R(!1)},[R]),D=_.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{C.current=!0,R(!0),y.current=0},S)},[S,R]);return _.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),f.jsx(fp,{...d,children:f.jsx(E9,{scope:t,contentId:v,open:k,stateAttribute:E,trigger:g,onTriggerChange:p,onTriggerEnter:_.useCallback(()=>{h.isOpenDelayedRef.current?D():N()},[h.isOpenDelayedRef,D,N]),onTriggerLeave:_.useCallback(()=>{w?j():(window.clearTimeout(y.current),y.current=0)},[j,w]),onOpen:N,onClose:j,disableHoverableContent:w,children:n})})};nM.displayName=od;var Mb="TooltipTrigger",rM=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Td(Mb,n),o=D0(Mb,n),l=vp(n),u=_.useRef(null),h=Ut(t,u,s.onTriggerChange),d=_.useRef(!1),g=_.useRef(!1),p=_.useCallback(()=>d.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),f.jsx(Rd,{asChild:!0,...l,children:f.jsx(Rt.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:h,onPointerMove:He(e.onPointerMove,v=>{v.pointerType!=="touch"&&!g.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),g.current=!0)}),onPointerLeave:He(e.onPointerLeave,()=>{s.onTriggerLeave(),g.current=!1}),onPointerDown:He(e.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:He(e.onFocus,()=>{d.current||s.onOpen()}),onBlur:He(e.onBlur,s.onClose),onClick:He(e.onClick,s.onClose)})})});rM.displayName=Mb;var j0="TooltipPortal",[R9,T9]=gp(j0,{forceMount:void 0}),iM=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:s}=e,o=Td(j0,t);return f.jsx(R9,{scope:t,forceMount:n,children:f.jsx(Ai,{present:n||o.open,children:f.jsx(bc,{asChild:!0,container:s,children:r})})})};iM.displayName=j0;var uc="TooltipContent",sM=_.forwardRef((e,t)=>{const n=T9(uc,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...o}=e,l=Td(uc,e.__scopeTooltip);return f.jsx(Ai,{present:r||l.open,children:l.disableHoverableContent?f.jsx(oM,{side:s,...o,ref:t}):f.jsx(N9,{side:s,...o,ref:t})})}),N9=_.forwardRef((e,t)=>{const n=Td(uc,e.__scopeTooltip),r=D0(uc,e.__scopeTooltip),s=_.useRef(null),o=Ut(t,s),[l,u]=_.useState(null),{trigger:h,onClose:d}=n,g=s.current,{onPointerInTransitChange:p}=r,v=_.useCallback(()=>{u(null),p(!1)},[p]),y=_.useCallback((w,S)=>{const C=w.currentTarget,k={x:w.clientX,y:w.clientY},R=O9(k,C.getBoundingClientRect()),E=L9(k,R),N=z9(S.getBoundingClientRect()),j=B9([...E,...N]);u(j),p(!0)},[p]);return _.useEffect(()=>()=>v(),[v]),_.useEffect(()=>{if(h&&g){const w=C=>y(C,g),S=C=>y(C,h);return h.addEventListener("pointerleave",w),g.addEventListener("pointerleave",S),()=>{h.removeEventListener("pointerleave",w),g.removeEventListener("pointerleave",S)}}},[h,g,y,v]),_.useEffect(()=>{if(l){const w=S=>{const C=S.target,k={x:S.clientX,y:S.clientY},R=(h==null?void 0:h.contains(C))||(g==null?void 0:g.contains(C)),E=!P9(k,l);R?v():E&&(v(),d())};return document.addEventListener("pointermove",w),()=>document.removeEventListener("pointermove",w)}},[h,g,l,d,v]),f.jsx(oM,{...e,ref:o})}),[M9,A9]=gp(od,{isInside:!1}),D9=jP("TooltipContent"),oM=_.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:l,...u}=e,h=Td(uc,n),d=vp(n),{onClose:g}=h;return _.useEffect(()=>(document.addEventListener(Nb,g),()=>document.removeEventListener(Nb,g)),[g]),_.useEffect(()=>{if(h.trigger){const p=v=>{const y=v.target;y!=null&&y.contains(h.trigger)&&g()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[h.trigger,g]),f.jsx(_c,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:p=>p.preventDefault(),onDismiss:g,children:f.jsxs(mp,{"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:[f.jsx(D9,{children:r}),f.jsx(M9,{scope:n,isInside:!0,children:f.jsx(S9,{id:h.contentId,role:"tooltip",children:s||r})})]})})});sM.displayName=uc;var aM="TooltipArrow",j9=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=vp(n);return A9(aM,n).isInside?null:f.jsx(pp,{...s,...r,ref:t})});j9.displayName=aM;function O9(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,s,o)){case o:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function L9(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 z9(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 P9(e,t){const{x:n,y:r}=e;let s=!1;for(let o=0,l=t.length-1;o<t.length;l=o++){const u=t[o],h=t[l],d=u.x,g=u.y,p=h.x,v=h.y;g>r!=v>r&&n<(p-d)*(r-g)/(v-g)+d&&(s=!s)}return s}function B9(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),I9(t)}function I9(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 o=t[t.length-1],l=t[t.length-2];if((o.x-l.x)*(s.y-l.y)>=(o.y-l.y)*(s.x-l.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 o=n[n.length-1],l=n[n.length-2];if((o.x-l.x)*(s.y-l.y)>=(o.y-l.y)*(s.x-l.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 H9=tM,lM=nM,cM=rM,uM=iM,O0=sM;function F9({className:e,...t}){return f.jsx("kbd",{className:pe("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 U9({className:e,...t}){return f.jsx("span",{className:pe("inline-flex items-center gap-0.5",e),...t})}const $9="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",W9=H9,ds=lM,hs=cM,Ii=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>f.jsx(uM,{children:f.jsx(O0,{ref:r,sideOffset:t,className:pe("z-50 overflow-hidden rounded-md bg-card text-card-foreground border border-border backdrop-blur-md 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})}));Ii.displayName=O0.displayName;const Ou=lM,Lu=cM;function dM(e){return e.toUpperCase()}function V9(e){const t=e.split("+");return f.jsx(U9,{children:t.map((n,r)=>f.jsx(F9,{children:dM(n)},`${n}-${r}`))})}const Zl=_.forwardRef(({className:e,sideOffset:t=4,children:n,shortcut:r,...s},o)=>{const l=r===void 0?null:Array.isArray(r)?r[0]??null:r;return f.jsx(uM,{children:f.jsx(O0,{ref:o,sideOffset:t,className:pe($9,e),...s,children:l?V9(l):f.jsx("span",{children:typeof n=="string"?dM(n):n})})})});Zl.displayName="HotkeyTooltipContent";const q9="0.1.4",K9={version:q9},zn="Kaizen",qk="kaizen",G9=".kaizen",Y9=".kaizen-dev",v_=".kaizen",X9="KAIZEN_RUNTIME_PROFILE",L0=`kaizen/${K9.version}`,Z9="[kaizen]",Q9=`~/${zn}`,_p="kaizen:";function bp(){var t;return(t=globalThis.process)==null?void 0:t.env}function J9(e=bp()){const t=e==null?void 0:e[X9];return(t==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function e7(e=bp()){return J9(e)==="dev"?Y9:G9}function t7(e=bp()){return`~/${e7(e)}`}function n7(e=bp()){return`${t7(e)}/keybindings.json`}function xf(e){return e?`${qk} ${e}`:qk}const wm=[{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"max",label:"Max"}],Ab=[{id:"minimal",label:"Minimal"},{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"xhigh",label:"XHigh"}],Db=[{id:"off",label:"Off"},{id:"standard",label:"Standard"},{id:"high",label:"High"}],jb="claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]",hM=[{id:"composer-2[fast=true]",label:"Composer 2",supportsEffort:!1},{id:"composer-1.5[]",label:"Composer 1.5",supportsEffort:!1},{id:"gpt-5.3-codex[reasoning=medium,fast=false]",label:"Codex 5.3",supportsEffort:!1},{id:"gpt-5.4[reasoning=medium,context=272k,fast=false]",label:"GPT-5.4",supportsEffort:!1},{id:"claude-sonnet-4-6[thinking=true,context=200k,effort=medium]",label:"Sonnet 4.6",supportsEffort:!1},{id:"claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]",label:"Opus 4.6",supportsEffort:!1},{id:"claude-opus-4-5[thinking=true]",label:"Opus 4.5",supportsEffort:!1},{id:"gpt-5.2[reasoning=medium,fast=false]",label:"GPT-5.2",supportsEffort:!1},{id:"gemini-3.1-pro[]",label:"Gemini 3.1 Pro",supportsEffort:!1},{id:"gpt-5.4-mini[reasoning=medium]",label:"GPT-5.4 Mini",supportsEffort:!1},{id:"gpt-5.4-nano[reasoning=medium]",label:"GPT-5.4 Nano",supportsEffort:!1},{id:"claude-haiku-4-5[thinking=true]",label:"Haiku 4.5",supportsEffort:!1},{id:"gpt-5.3-codex-spark[reasoning=medium]",label:"Codex 5.3 Spark",supportsEffort:!1},{id:"grok-4-20[thinking=true]",label:"Grok 4.20",supportsEffort:!1},{id:"claude-sonnet-4-5[thinking=true,context=200k]",label:"Sonnet 4.5",supportsEffort:!1},{id:"gpt-5.2-codex[reasoning=medium,fast=false]",label:"Codex 5.2",supportsEffort:!1},{id:"gemini-3-flash[]",label:"Gemini 3 Flash",supportsEffort:!1},{id:"claude-sonnet-4[thinking=false,context=200k]",label:"Sonnet 4",supportsEffort:!1},{id:"kimi-k2.5[]",label:"Kimi K2.5",supportsEffort:!1}],r7={"composer-2-fast":"composer-2[fast=true]","composer-1.5":"composer-1.5[]","gpt-5.3-codex":"gpt-5.3-codex[reasoning=medium,fast=false]","gpt-5.4":"gpt-5.4[reasoning=medium,context=272k,fast=false]","gpt-5.4-medium":"gpt-5.4[reasoning=medium,context=272k,fast=false]","claude-4.6-sonnet-medium-thinking":"claude-sonnet-4-6[thinking=true,context=200k,effort=medium]","claude-4.6-opus-high-thinking":"claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]","claude-4.5-opus-high-thinking":"claude-opus-4-5[thinking=true]","gpt-5.2":"gpt-5.2[reasoning=medium,fast=false]","gemini-3.1-pro":"gemini-3.1-pro[]","gpt-5.4-mini":"gpt-5.4-mini[reasoning=medium]","gpt-5.4-mini-medium":"gpt-5.4-mini[reasoning=medium]","gpt-5.4-nano":"gpt-5.4-nano[reasoning=medium]","gpt-5.4-nano-medium":"gpt-5.4-nano[reasoning=medium]","claude-haiku-4.5":"claude-haiku-4-5[thinking=true]","gpt-5.3-codex-spark-preview":"gpt-5.3-codex-spark[reasoning=medium]","grok-4-20":"grok-4-20[thinking=true]","grok-4-20-thinking":"grok-4-20[thinking=true]","claude-4.5-sonnet-thinking":"claude-sonnet-4-5[thinking=true,context=200k]","gpt-5.2-codex":"gpt-5.2-codex[reasoning=medium,fast=false]","gemini-3-flash":"gemini-3-flash[]","claude-4-sonnet":"claude-sonnet-4[thinking=false,context=200k]","kimi-k2.5":"kimi-k2.5[]"};function i7(e){return e?hM.some(t=>t.id===e)?e:r7[e]??jb:jb}function Kk(e){const t=e.indexOf("[");return t>=0?e.slice(0,t):e}function Yl(e){const t=e.match(/\bfast=(true|false)\b/);return t?t[1]==="true"?"fast":"standard":null}function Gk(e){return wm.some(t=>t.id===e)}function Yk(e){return Ab.some(t=>t.id===e)}const Ob=[{id:"200k",label:"200k"},{id:"1m",label:"1M"}];function s7(e){return Db.some(t=>t.id===e)}const qo=[{id:"claude",label:"Claude",systemActive:!0,defaultModel:"sonnet",defaultEffort:"high",defaultModelOptions:{reasoningEffort:"high",contextWindow:"200k"},supportsPlanMode:!0,models:[{id:"opus",label:"Opus",supportsEffort:!0,contextWindowOptions:[...Ob]},{id:"sonnet",label:"Sonnet",supportsEffort:!0,contextWindowOptions:[...Ob]},{id:"haiku",label:"Haiku",supportsEffort:!0}],efforts:[...wm]},{id:"codex",label:"Codex",systemActive:!0,defaultModel:"gpt-5.4",defaultModelOptions:{reasoningEffort:"high",fastMode:!1},supportsPlanMode:!0,models:[{id:"gpt-5.4",label:"GPT-5.4",supportsEffort:!1},{id:"gpt-5.3-codex",label:"GPT-5.3 Codex",supportsEffort:!1},{id:"gpt-5.3-codex-spark",label:"GPT-5.3 Codex Spark",supportsEffort:!1}],efforts:[]},{id:"gemini",label:"Gemini",systemActive:!1,defaultModel:"auto-gemini-2.5",defaultModelOptions:{thinkingMode:"standard"},supportsPlanMode:!0,models:[{id:"auto-gemini-3",label:"Auto (Gemini 3)",supportsEffort:!1},{id:"auto-gemini-2.5",label:"Auto (Gemini 2.5)",supportsEffort:!1},{id:"gemini-3.1-pro-preview",label:"3.1 Pro Preview",supportsEffort:!1},{id:"gemini-3-pro-preview",label:"3 Pro Preview",supportsEffort:!1},{id:"gemini-3-flash-preview",label:"3 Flash Preview",supportsEffort:!1},{id:"gemini-2.5-pro",label:"2.5 Pro",supportsEffort:!1},{id:"gemini-2.5-flash",label:"2.5 Flash",supportsEffort:!1},{id:"gemini-2.5-flash-lite",label:"2.5 Flash Lite",supportsEffort:!1}],efforts:[]},{id:"cursor",label:"Cursor",systemActive:!0,defaultModel:jb,defaultModelOptions:{},supportsPlanMode:!0,models:[...hM],efforts:[]}],Vn={claude:{active:!0},codex:{active:!0},gemini:{active:!0},cursor:{active:!0}};function tn(e){const t=qo.find(n=>n.id===e);if(!t)throw new Error(`Unknown provider: ${e}`);return t}function z0(e,t){const n=Vn[t],r=e==null?void 0:e[t];return{active:(r==null?void 0:r.active)??n.active}}function o7(e,t){const n=tn(e),r=z0(t,e);return n.systemActive&&r.active?null:`Provider ${n.label} is currently not active.`}function Xk(e,t){const n=tn(e),r=z0(t,e);return n.systemActive&&r.active}function a7(e){return qo.map(t=>{const n=z0(e,t.id),r=t.systemActive&&n.active;return{...t,active:n.active,isSelectable:r,isUsageEnabled:r,isInactive:!r,inactiveMessage:o7(t.id,e)}})}function P0(e){return a7(e).filter(t=>t.isSelectable).map(({active:t,isSelectable:n,isUsageEnabled:r,isInactive:s,inactiveMessage:o,...l})=>l)}function Ri(e){return tn(e).defaultModelOptions}const fM=Ri("claude");Ri("codex");Ri("gemini");Ri("cursor");function l7(e){return tn("claude").models.find(t=>t.id===e)}function c7(e){var t;return((t=l7(e))==null?void 0:t.contextWindowOptions)??[]}function u7(e,t){const n=c7(e);if(n.length!==0)return n.some(r=>r.id===t)?t:fM.contextWindow}const d7=["idea","todo","progress","testing","done"],Zk={idea:"IDEA",todo:"TODO",progress:"PROGRESS",testing:"TESTING",done:"DONE"},os={submitChatMessage:["enter"],toggleProjectsSidebar:["ctrl+a"],toggleEmbeddedTerminal:["cmd+j","ctrl+`"],toggleRightSidebar:["cmd+b","ctrl+b"],openInFinder:["cmd+alt+f","ctrl+alt+f"],openInEditor:["cmd+shift+o","ctrl+shift+o"],addSplitTerminal:["cmd+/","ctrl+/"]},Qk=8,h7=10*1024*1024,Jk=["image/png","image/jpeg","image/webp","image/gif"],f7="/assets/icon-4rSnra9R.svg";function Sm({alt:e="",className:t,...n}){return f.jsx("img",{alt:e,src:f7,className:pe("shrink-0 object-contain",t),...n})}var yp="Popover",[mM]=eo(yp,[ea]),Nd=ea(),[m7,ta]=mM(yp),pM=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:s,onOpenChange:o,modal:l=!1}=e,u=Nd(t),h=_.useRef(null),[d,g]=_.useState(!1),[p,v]=lc({prop:r,defaultProp:s??!1,onChange:o,caller:yp});return f.jsx(fp,{...u,children:f.jsx(m7,{scope:t,contentId:Gs(),triggerRef:h,open:p,onOpenChange:v,onOpenToggle:_.useCallback(()=>v(y=>!y),[v]),hasCustomAnchor:d,onCustomAnchorAdd:_.useCallback(()=>g(!0),[]),onCustomAnchorRemove:_.useCallback(()=>g(!1),[]),modal:l,children:n})})};pM.displayName=yp;var gM="PopoverAnchor",vM=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=ta(gM,n),o=Nd(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:u}=s;return _.useEffect(()=>(l(),()=>u()),[l,u]),f.jsx(Rd,{...o,...r,ref:t})});vM.displayName=gM;var _M="PopoverTrigger",bM=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=ta(_M,n),o=Nd(n),l=Ut(t,s.triggerRef),u=f.jsx(Rt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":CM(s.open),...r,ref:l,onClick:He(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?u:f.jsx(Rd,{asChild:!0,...o,children:u})});bM.displayName=_M;var B0="PopoverPortal",[p7,g7]=mM(B0,{forceMount:void 0}),yM=e=>{const{__scopePopover:t,forceMount:n,children:r,container:s}=e,o=ta(B0,t);return f.jsx(p7,{scope:t,forceMount:n,children:f.jsx(Ai,{present:n||o.open,children:f.jsx(bc,{asChild:!0,container:s,children:r})})})};yM.displayName=B0;var dc="PopoverContent",xM=_.forwardRef((e,t)=>{const n=g7(dc,e.__scopePopover),{forceMount:r=n.forceMount,...s}=e,o=ta(dc,e.__scopePopover);return f.jsx(Ai,{present:r||o.open,children:o.modal?f.jsx(_7,{...s,ref:t}):f.jsx(b7,{...s,ref:t})})});xM.displayName=dc;var v7=Fa("PopoverContent.RemoveScroll"),_7=_.forwardRef((e,t)=>{const n=ta(dc,e.__scopePopover),r=_.useRef(null),s=Ut(t,r),o=_.useRef(!1);return _.useEffect(()=>{const l=r.current;if(l)return tp(l)},[]),f.jsx(Sd,{as:v7,allowPinchZoom:!0,children:f.jsx(wM,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:He(e.onCloseAutoFocus,l=>{var u;l.preventDefault(),o.current||(u=n.triggerRef.current)==null||u.focus()}),onPointerDownOutside:He(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,h=u.button===0&&u.ctrlKey===!0,d=u.button===2||h;o.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:He(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),b7=_.forwardRef((e,t)=>{const n=ta(dc,e.__scopePopover),r=_.useRef(!1),s=_.useRef(!1);return f.jsx(wM,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,u;(l=e.onCloseAutoFocus)==null||l.call(e,o),o.defaultPrevented||(r.current||(u=n.triggerRef.current)==null||u.focus(),o.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:o=>{var h,d;(h=e.onInteractOutside)==null||h.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=o.target;((d=n.triggerRef.current)==null?void 0:d.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),wM=_.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:d,onInteractOutside:g,...p}=e,v=ta(dc,n),y=Nd(n);return Jm(),f.jsx(wd,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:o,children:f.jsx(_c,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:g,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:d,onDismiss:()=>v.onOpenChange(!1),children:f.jsx(mp,{"data-state":CM(v.open),role:"dialog",id:v.contentId,...y,...p,ref:t,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),SM="PopoverClose",y7=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=ta(SM,n);return f.jsx(Rt.button,{type:"button",...r,ref:t,onClick:He(e.onClick,()=>s.onOpenChange(!1))})});y7.displayName=SM;var x7="PopoverArrow",w7=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=Nd(n);return f.jsx(pp,{...s,...r,ref:t})});w7.displayName=x7;function CM(e){return e?"open":"closed"}var kM=pM,S7=vM,C7=bM,EM=yM,I0=xM;const RM=kM,TM=C7,H0=_.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},s)=>f.jsx(EM,{children:f.jsx(I0,{ref:s,align:t,sideOffset:n,[id]:"",onCloseAutoFocus:o=>{var l;o.preventDefault(),window.dispatchEvent(new Event(gm)),(l=r.onCloseAutoFocus)==null||l.call(r,o)},className:pe("z-50 w-72 rounded-xl border border-border bg-background p-4 shadow-lg backdrop-blur-md outline-hidden animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 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),...r})}));H0.displayName=I0.displayName;function k7({className:e,...t}){return f.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:pe("shrink-0",e),...t,children:f.jsx("path",{d:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"})})}function E7({className:e,...t}){return f.jsx("svg",{viewBox:"0 0 158.7128 157.296",fill:"currentColor","aria-hidden":"true",className:pe("shrink-0",e),...t,children:f.jsx("path",{d:"M60.8734 57.2556V42.3124c0-1.2586.4722-2.2029 1.5728-2.8314l30.0443-17.3023c4.0899-2.3593 8.9662-3.4599 13.9988-3.4599 18.8759 0 30.8307 14.6289 30.8307 30.2006 0 1.1007 0 2.3593-.158 3.6178l-31.1446-18.2467c-1.8872-1.1006-3.7754-1.1006-5.6629 0L60.8734 57.2556Zm70.1542 58.2005V79.7487c0-2.2028-.9446-3.7756-2.8318-4.8763l-39.481-22.9651 12.8982-7.3934c1.1007-.6285 2.0453-.6285 3.1458 0l30.0441 17.3024c8.6523 5.0341 14.4708 15.7296 14.4708 26.1107 0 11.9539-7.0769 22.965-18.2461 27.527ZM51.593 83.9964l-12.8982-7.5497c-1.1007-.6285-1.5728-1.5728-1.5728-2.8314V39.0105c0-16.8303 12.8982-29.5722 30.3585-29.5722 6.607 0 12.7403 2.2029 17.9324 6.1349l-30.987 17.9324c-1.8871 1.1007-2.8314 2.6735-2.8314 4.8764v45.6159ZM79.3562 100.0403 60.8733 89.6592V67.6383l18.4829-10.3811 18.4812 10.3811v22.0209l-18.4812 10.3811Zm11.8757 47.8188c-6.607 0-12.7403-2.2031-17.9324-6.1344l30.9866-17.9333c1.8872-1.1005 2.8318-2.6728 2.8318-4.8759v-45.616l13.0564 7.5498c1.1005.6285 1.5723 1.5728 1.5723 2.8314v34.6051c0 16.8297-13.0564 29.5723-30.5147 29.5723ZM53.9522 112.7822 23.9079 95.4798c-8.652-5.0343-14.471-15.7296-14.471-26.1107 0-12.1119 7.2356-22.9652 18.403-27.5272v35.8634c0 2.2028.9443 3.7756 2.8314 4.8763l39.3248 22.8068-12.8982 7.3938c-1.1007.6287-2.045.6287-3.1456 0ZM52.2229 138.5791c-17.7745 0-30.8306-13.3713-30.8306-29.8871 0-1.2585.1578-2.5169.3143-3.7754l30.987 17.9323c1.8871 1.1005 3.7757 1.1005 5.6628 0l39.4811-22.807v14.9435c0 1.2585-.4721 2.2021-1.5728 2.8308l-30.0443 17.3025c-4.0898 2.359-8.9662 3.4605-13.9989 3.4605h.0014ZM91.2319 157.296c19.0327 0 34.9188-13.5272 38.5383-31.4594 17.6164-4.562 28.9425-21.0779 28.9425-37.908 0-11.0112-4.719-21.7066-13.2133-29.4143.7867-3.3035 1.2595-6.607 1.2595-9.909 0-22.4929-18.2471-39.3247-39.3251-39.3247-4.2461 0-8.3363.6285-12.4262 2.045-7.0792-6.9213-16.8318-11.3254-27.5271-11.3254-19.0331 0-34.9191 13.5268-38.5384 31.4591C11.3255 36.0212 0 52.5373 0 69.3675c0 11.0112 4.7184 21.7065 13.2125 29.4142-.7865 3.3035-1.2586 6.6067-1.2586 9.9092 0 22.4923 18.2466 39.3241 39.3248 39.3241 4.2462 0 8.3362-.6277 12.426-2.0441 7.0776 6.921 16.8302 11.3251 27.5271 11.3251Z"})})}function R7({className:e,...t}){return f.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:pe("shrink-0",e),...t,children:f.jsx("path",{d:"M12 0C12 0 12 8 8 12C4 16 0 12 0 12C0 12 4 12 8 12C12 12 12 16 12 24C12 24 12 16 16 12C20 8 24 12 24 12C24 12 16 12 16 12C12 12 12 4 12 0Z"})})}function T7({className:e,...t}){return f.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:pe("shrink-0",e),...t,children:f.jsx("path",{d:"M12 0 2.4 5.5v13L12 24l9.6-5.5v-13Zm0 3.1 6.8 3.9v5.1L15 14.3V9.7L12 8l-3 1.7v4.6l-3.8-2.2V7Zm-6.8 9.8 3.8 2.2v4.5l3 1.8 3-1.8v-4.5l3.8-2.2v3.8L12 20.9l-6.8-3.9Z"})})}function N7(e){return!(e.startsWith("gemini-3")||e==="auto-gemini-3")}const M7=["Composer","GPT","Claude","Gemini","Grok","Kimi"];function A7(e){return e.startsWith("composer-")?"Composer":e.startsWith("gpt-")?"GPT":e.startsWith("claude-")?"Claude":e.startsWith("gemini-")?"Gemini":e.startsWith("grok-")?"Grok":"Kimi"}function __(e,t){const n=Yl(t);return!n||n==="standard"?e:`${e} (${n==="fast"?"Fast":"Standard"})`}const Cm={claude:k7,codex:E7,gemini:R7,cursor:T7},wf={auto:Rn,opus:ti,sonnet:Rn,haiku:ls,"gpt-5.4":ti,"gpt-5.4[reasoning=medium,context=272k,fast=false]":ti,"gpt-5.4-mini[reasoning=medium]":Rn,"gpt-5.4-nano[reasoning=medium]":ls,"gpt-5.3-codex":Rn,"gpt-5.3-codex[reasoning=medium,fast=false]":Rn,"gpt-5.3-codex-spark[reasoning=medium]":ls,"gpt-5.2[reasoning=medium,fast=false]":Rn,"gpt-5.2-codex[reasoning=medium,fast=false]":Rn,"gpt-5.3-codex-spark":ls,"gemini-2.5-pro":ti,"gemini-2.5-flash":Rn,"gemini-2.5-flash-lite":ls,"auto-gemini-3":ti,"auto-gemini-2.5":Rn,"gemini-3.1-pro-preview":ti,"gemini-3.1-pro[]":ti,"gemini-3-flash[]":Rn,"gemini-3-pro-preview":ti,"gemini-3-flash-preview":Rn,"claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]":ti,"claude-opus-4-5[thinking=true]":ti,"claude-sonnet-4-6[thinking=true,context=200k,effort=medium]":Rn,"claude-sonnet-4-5[thinking=true,context=200k]":Rn,"claude-sonnet-4[thinking=false,context=200k]":Rn,"claude-haiku-4-5[thinking=true]":ls,"grok-4-20[thinking=true]":ti,"kimi-k2.5[]":Rn,"composer-2[fast=true]":ti,"composer-1.5[]":Rn};function Ir({onClick:e,selected:t,icon:n,label:r,description:s,disabled:o}){return f.jsxs("button",{onClick:e,disabled:o,className:pe("w-full flex items-center gap-2 p-2 border border-border/0 rounded-lg text-left transition-opacity",t?"bg-muted border-border":"hover:opacity-60",o&&"opacity-40 cursor-not-allowed"),children:[n,f.jsxs("div",{children:[f.jsx("div",{className:"text-sm font-medium",children:r}),s?f.jsx("div",{className:"text-xs text-muted-foreground",children:s}):null]})]})}function zo({trigger:e,triggerClassName:t,disabled:n=!1,children:r}){const[s,o]=_.useState(!1);return n?f.jsx("button",{disabled:!0,className:pe("flex items-center gap-1.5 px-2 py-1 text-sm rounded-md text-muted-foreground [&>svg]:shrink-0 opacity-70 cursor-default",t),children:e}):f.jsxs(RM,{open:s,onOpenChange:o,children:[f.jsx(TM,{asChild:!0,children:f.jsx("button",{className:pe("flex items-center gap-1.5 px-2 py-1 text-sm rounded-md transition-colors text-muted-foreground [&>svg]:shrink-0","hover:bg-muted/50",t),children:e})}),f.jsx(H0,{align:"center",className:"w-64 p-1",children:f.jsx("div",{className:"max-h-[min(24rem,60vh)] space-y-1 overflow-y-auto pr-1",children:typeof r=="function"?r(()=>o(!1)):r})})]})}function zu({availableProviders:e,selectedProvider:t,disabled:n=!1,showProviderPicker:r=!0,providerLocked:s=!1,model:o,modelOptions:l,onProviderChange:u,onModelChange:h,onClaudeReasoningEffortChange:d,onClaudeContextWindowChange:g,onCodexReasoningEffortChange:p,onGeminiThinkingModeChange:v,onCodexFastModeChange:y,planMode:w=!1,onPlanModeChange:S,includePlanMode:C=!0,className:k}){var $,M,B,X,A,re,se;const[R,E]=_.useState(null),N=e.find(Z=>Z.id===t)??tn(t),j=Cm[t],D=wf[o]??Rn,L=C&&(N==null?void 0:N.supportsPlanMode)&&S,U=t==="claude"?l:null,Y=t==="codex"?l:null,P=t==="gemini"?l:null,V=(($=N.models.find(Z=>Z.id===o))==null?void 0:$.contextWindowOptions)??[],I=(U==null?void 0:U.contextWindow)??Ob[0].id,W=I==="1m"?Mk:Ak,K=t==="claude"||t==="codex",q=t==="cursor"?Yl(o):null,O=N.id==="cursor"?N.models.filter(Z=>Kk(Z.id)===Kk(o)):[],F=t==="cursor"&&O.some(Z=>Yl(Z.id)==="fast")&&O.some(Z=>Yl(Z.id)==="standard"),H=N.id==="cursor"?M7.map(Z=>({family:Z,models:N.models.filter(te=>A7(te.id)===Z)})).filter(Z=>Z.models.length>0):[];return _.useEffect(()=>{E(null)},[t]),f.jsx("div",{className:pe("max-w-full overflow-x-auto scrollbar-hide",n&&"pointer-events-none opacity-60",k),children:f.jsxs("div",{className:"flex w-max items-center justify-center gap-0.5 mx-auto",children:[r?f.jsx(zo,{disabled:s||!u,trigger:f.jsxs(f.Fragment,{children:[f.jsx(j,{className:"h-3.5 w-3.5"}),f.jsx("span",{className:"hidden md:inline",children:(N==null?void 0:N.label)??t})]}),children:Z=>e.map(te=>{const le=Cm[te.id];return f.jsx(Ir,{onClick:()=>{u==null||u(te.id),Z()},selected:t===te.id,icon:f.jsx(le,{className:"h-4 w-4 text-muted-foreground"}),label:te.label},te.id)})}):null,f.jsx(zo,{trigger:f.jsxs(f.Fragment,{children:[f.jsx(D,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:N.id==="cursor"?__(((M=N.models.find(Z=>Z.id===o))==null?void 0:M.label)??o,o):((B=N.models.find(Z=>Z.id===o))==null?void 0:B.label)??o})]}),children:Z=>{var te;return N.id==="cursor"?R?f.jsxs(f.Fragment,{children:[f.jsxs("button",{onClick:()=>E(null),className:"flex w-full items-center gap-2 rounded-lg px-2 py-2 text-left text-sm text-muted-foreground transition-opacity hover:opacity-70",children:[f.jsx(bN,{className:"h-4 w-4"}),f.jsx("span",{children:R})]}),(te=H.find(le=>le.family===R))==null?void 0:te.models.map(le=>{const me=wf[le.id]??Rn;return f.jsx(Ir,{onClick:()=>{h(t,le.id),E(null),Z()},selected:o===le.id,icon:f.jsx(me,{className:"h-4 w-4 text-muted-foreground"}),label:__(le.label,le.id)},le.id)})]}):H.map(le=>{var Te;const me=le.models.some(Ee=>Ee.id===o),xe=wf[((Te=le.models[0])==null?void 0:Te.id)??""]??Rn;return f.jsxs("div",{className:"relative",children:[f.jsx(Ir,{onClick:()=>E(le.family),selected:me,icon:f.jsx(xe,{className:"h-4 w-4 text-muted-foreground"}),label:le.family,description:`${le.models.length} model${le.models.length===1?"":"s"}`}),f.jsx(Tr,{className:"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"})]},le.family)}):N.models.map(le=>{const me=wf[le.id]??Rn;return f.jsx(Ir,{onClick:()=>{h(t,le.id),Z()},selected:o===le.id,icon:f.jsx(me,{className:"h-4 w-4 text-muted-foreground"}),label:N.id==="cursor"?__(le.label,le.id):le.label},le.id)})}}),F?f.jsx(zo,{trigger:f.jsxs(f.Fragment,{children:[q==="fast"?f.jsx(ls,{className:"h-3.5 w-3.5"}):f.jsx(Fs,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:q==="fast"?"Fast":"Standard"})]}),triggerClassName:q==="fast"?"text-emerald-500 dark:text-emerald-400":void 0,children:Z=>f.jsxs(f.Fragment,{children:[O.filter(te=>Yl(te.id)==="standard").map(te=>f.jsx(Ir,{onClick:()=>{h(t,te.id),Z()},selected:o===te.id,icon:f.jsx(Fs,{className:"h-4 w-4 text-muted-foreground"}),label:"Standard"},te.id)),O.filter(te=>Yl(te.id)==="fast").map(te=>f.jsx(Ir,{onClick:()=>{h(t,te.id),Z()},selected:o===te.id,icon:f.jsx(ls,{className:"h-4 w-4 text-muted-foreground"}),label:"Fast"},te.id))]})}):null,K?f.jsx(zo,{trigger:f.jsxs(f.Fragment,{children:[f.jsx(Fs,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:t==="claude"?((X=wm.find(Z=>Z.id===l.reasoningEffort))==null?void 0:X.label)??l.reasoningEffort:((A=Ab.find(Z=>Z.id===l.reasoningEffort))==null?void 0:A.label)??l.reasoningEffort})]}),children:Z=>t==="claude"?wm.map(te=>f.jsx(Ir,{onClick:()=>{d(te.id),Z()},selected:l.reasoningEffort===te.id,icon:f.jsx(Fs,{className:"h-4 w-4 text-muted-foreground"}),label:te.label,disabled:te.id==="max"&&o!=="opus"},te.id)):Ab.map(te=>f.jsx(Ir,{onClick:()=>{p(te.id),Z()},selected:l.reasoningEffort===te.id,icon:f.jsx(Fs,{className:"h-4 w-4 text-muted-foreground"}),label:te.label},te.id))}):null,t==="claude"&&V.length>1?f.jsx(zo,{trigger:f.jsxs(f.Fragment,{children:[f.jsx(W,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:((re=V.find(Z=>Z.id===I))==null?void 0:re.label)??I})]}),children:Z=>V.map(te=>f.jsx(Ir,{onClick:()=>{g(te.id),Z()},selected:I===te.id,icon:te.id==="1m"?f.jsx(Mk,{className:"h-4 w-4 text-muted-foreground"}):f.jsx(Ak,{className:"h-4 w-4 text-muted-foreground"}),label:te.label,description:te.id==="1m"?"Expanded context window":"Standard context window"},te.id))}):null,t==="gemini"?f.jsx(zo,{trigger:f.jsxs(f.Fragment,{children:[f.jsx(Fs,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:((se=Db.find(Z=>Z.id===(P==null?void 0:P.thinkingMode)))==null?void 0:se.label)??(P==null?void 0:P.thinkingMode)??"Standard"})]}),children:Z=>Db.map(te=>f.jsx(Ir,{onClick:()=>{v(te.id),Z()},selected:(P==null?void 0:P.thinkingMode)===te.id,icon:f.jsx(Fs,{className:"h-4 w-4 text-muted-foreground"}),label:te.label,disabled:te.id==="off"&&!N7(o)},te.id))}):null,t==="codex"?f.jsx(zo,{trigger:f.jsxs(f.Fragment,{children:[Y!=null&&Y.fastMode?f.jsx(ls,{className:"h-3.5 w-3.5"}):f.jsx(Fs,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:Y!=null&&Y.fastMode?"Fast Mode":"Standard"})]}),triggerClassName:Y!=null&&Y.fastMode?"text-emerald-500 dark:text-emerald-400":void 0,children:Z=>f.jsxs(f.Fragment,{children:[f.jsx(Ir,{onClick:()=>{y(!1),Z()},selected:!(Y!=null&&Y.fastMode),icon:f.jsx(Fs,{className:"h-4 w-4 text-muted-foreground"}),label:"Standard"}),f.jsx(Ir,{onClick:()=>{y(!0),Z()},selected:!!(Y!=null&&Y.fastMode),icon:f.jsx(ls,{className:"h-4 w-4 text-muted-foreground"}),label:"Fast Mode"})]})}):null,L?f.jsx(zo,{trigger:f.jsxs(f.Fragment,{children:[w?f.jsx(mm,{className:"h-3.5 w-3.5"}):f.jsx(Tk,{className:"h-3.5 w-3.5"}),f.jsx("span",{className:"hidden md:inline",children:w?"Plan":"Implement"}),f.jsx("span",{className:"md:hidden",children:w?"Plan":"Impl"})]}),triggerClassName:w?"text-blue-400 dark:text-blue-300":void 0,children:Z=>f.jsxs(f.Fragment,{children:[f.jsx(Ir,{onClick:()=>{S(!1),Z()},selected:!w,icon:f.jsx(Tk,{className:"h-4 w-4 text-muted-foreground"}),label:"Implement",description:"Start execution"}),f.jsx(Ir,{onClick:()=>{S(!0),Z()},selected:w,icon:f.jsx(mm,{className:"h-4 w-4 text-muted-foreground"}),label:"Plan",description:"Review a plan before execution"})]})}):null]})})}const xp=({children:e,className:t,shimmerWidth:n=100,animate:r=!0,...s})=>f.jsx("span",{style:{"--shiny-width":`${Math.min(n,100)}px`},className:pe("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 Lb(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const D7=[/^(?:\/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 j7(e){const t=e.trim();for(const n of D7){const r=t.match(n);if(!r)continue;const s=(r[2]??r[1]??"").trim();if(s)return s}return t}function km(e){return e.split("/").pop()||e}function O7(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,s=60*r,o=24*s,l=7*o;return n<r?"now":n<s?`${Math.floor(n/r)}m`:n<o?`${Math.floor(n/s)}h`:n<l?`${Math.floor(n/o)}d`:`${Math.floor(n/l)}w`}const L7='button, select, input, textarea, [role="combobox"], [role="listbox"], [data-no-touch-drag]';function e2(e){var t;try{(t=navigator.vibrate)==null||t.call(navigator,e)}catch{}}function F0({enabled:e,visualElementRef:t,onTap:n,onContextMenu:r,onDragStart:s,onDragMove:o,onDragEnd:l,holdDelay:u=300,contextMenuDelay:h=2500,scrollThreshold:d=8,dragMoveThreshold:g=5}){const[p,v]=_.useState(!1),[y,w]=_.useState(!1),[S,C]=_.useState(null),[k,R]=_.useState(null),E=_.useCallback(O=>{R(O)},[]),N=_.useRef("idle"),j=_.useRef({x:0,y:0}),D=_.useRef(null),L=_.useRef(null),U=_.useRef(n),Y=_.useRef(r),P=_.useRef(s),V=_.useRef(o),I=_.useRef(l);U.current=n,Y.current=r,P.current=s,V.current=o,I.current=l;const W=_.useCallback((O,F)=>{const H=(t==null?void 0:t.current)??k;if(!H)return document.elementFromPoint(O,F);const $=H.style.pointerEvents;H.style.pointerEvents="none";const M=document.elementFromPoint(O,F);return H.style.pointerEvents=$,M},[t,k]),K=_.useCallback(()=>{D.current&&(clearTimeout(D.current),D.current=null),L.current&&(clearTimeout(L.current),L.current=null)},[]),q=_.useCallback(()=>{K(),N.current="idle",w(!1),v(!1),C(null)},[K]);return _.useEffect(()=>{if(!k||!e)return;const O=M=>{if(M.target.closest(L7))return;const B=M.touches[0];B&&(j.current={x:B.clientX,y:B.clientY},N.current="holding",D.current=setTimeout(()=>{D.current=null,N.current==="holding"&&(N.current="armed",w(!0),e2(30),L.current=setTimeout(()=>{var A;if(L.current=null,N.current!=="armed")return;e2(100);const X={...j.current};N.current="idle",w(!1),(A=Y.current)==null||A.call(Y,X)},h))},u))},F=M=>{var Z,te;const B=N.current;if(B==="idle")return;const X=M.touches[0];if(!X)return;const A=X.clientX-j.current.x,re=X.clientY-j.current.y,se=Math.sqrt(A*A+re*re);if(B==="holding"){se>d&&(K(),N.current="idle");return}if(B==="armed"){se>g&&(L.current&&(clearTimeout(L.current),L.current=null),N.current="dragging",w(!1),v(!0),C({x:X.clientX,y:X.clientY}),M.preventDefault(),(Z=P.current)==null||Z.call(P,{x:X.clientX,y:X.clientY}));return}if(B==="dragging"){M.preventDefault(),C({x:X.clientX,y:X.clientY});const le=W(X.clientX,X.clientY);(te=V.current)==null||te.call(V,{x:X.clientX,y:X.clientY,elementBelow:le})}},H=M=>{var X,A;const B=N.current;if(B==="holding"){K(),N.current="idle",w(!1),v(!1),M.preventDefault(),(X=U.current)==null||X.call(U);return}if(B==="armed"){q();return}if(B==="dragging"){const re=M.changedTouches[0];if(re){const se=W(re.clientX,re.clientY);(A=I.current)==null||A.call(I,{x:re.clientX,y:re.clientY,elementBelow:se})}q()}},$=()=>{var M;N.current==="dragging"&&((M=I.current)==null||M.call(I,{x:0,y:0,elementBelow:null})),q()};return k.addEventListener("touchstart",O,{passive:!1}),k.addEventListener("touchmove",F,{passive:!1}),k.addEventListener("touchend",H),k.addEventListener("touchcancel",$),()=>{k.removeEventListener("touchstart",O),k.removeEventListener("touchmove",F),k.removeEventListener("touchend",H),k.removeEventListener("touchcancel",$),K(),N.current="idle"}},[k,e,u,h,d,g,K,q,W]),{touchRef:E,isDragging:p,isArmed:y,dragPosition:S}}function NM({position:e,children:t,className:n}){return e?Bi.createPortal(f.jsx("div",{style:{position:"fixed",left:e.x,top:e.y,transform:"translate(-50%, calc(-100% - 14px))",zIndex:9999,pointerEvents:"none",willChange:"transform"},className:pe("flex items-center gap-2 rounded-xl border-2 border-primary/60 bg-card px-3 py-2","shadow-[0_8px_32px_rgba(0,0,0,0.25)] dark:shadow-[0_8px_32px_rgba(0,0,0,0.5)]","min-w-[120px] max-w-[240px]","scale-[1.04]",n),children:t}),document.body):null}const z7=new Set(["starting","running"]);function P7({chat:e,activeChatId:t,nowMs:n,showProviderIcon:r=!1,isCompleted:s=!1,onSelectChat:o,onDeleteChat:l,draggable:u=!1,onDragStart:h,onDragEnd:d,isTouchDevice:g=!1,onTouchDragMove:p,onTouchDragEnd:v}){const y=O7(e.lastMessageAt,n),w=g&&u,S=e.provider?Cm[e.provider]:null,{touchRef:C,isArmed:k,isDragging:R,dragPosition:E}=F0({enabled:w,onTap:()=>o(e.chatId),onDragStart:()=>h==null?void 0:h(e),onDragMove:({x:N,y:j,elementBelow:D})=>p==null?void 0:p(N,j,D),onDragEnd:({x:N,y:j,elementBelow:D})=>{v==null||v(N,j,D),d==null||d()}});return f.jsxs(f.Fragment,{children:[f.jsxs("div",{ref:w?C:void 0,"data-chat-id":hk(e.chatId),className:pe("group flex items-center gap-2 pl-2.5 pr-0.5 py-0.5 rounded-lg cursor-pointer border transition-all duration-150 select-none",t===hk(e.chatId)?"bg-muted hover:bg-muted border-border":"border-border/0 hover:border-border hover:bg-muted/20 dark:hover:border-slate-400/10",k&&"scale-[1.03] shadow-md ring-2 ring-primary/50 bg-card border-primary/40",R&&!k&&"opacity-20 scale-[0.98]"),draggable:u&&!g,onDragStart:u&&!g?()=>h==null?void 0:h(e):void 0,onDragEnd:u&&!g?d:void 0,onClick:g?void 0:()=>o(e.chatId),children:[z7.has(e.status)?f.jsx(oi,{className:"size-3.5 flex-shrink-0 animate-spin text-muted-foreground"}):e.status==="waiting_for_user"?f.jsx("div",{className:"relative",children:f.jsxs("div",{className:"rounded-full z-0 size-3.5 flex items-center justify-center",children:[f.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-blue-400/80 animate-ping"}),f.jsx("div",{className:"rounded-full z-0 size-2.5 bg-blue-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):s?f.jsx("div",{className:"relative",children:f.jsxs("div",{className:"rounded-full z-0 size-3.5 flex items-center justify-center",children:[f.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-emerald-400/80 animate-ping"}),f.jsx("div",{className:"rounded-full z-0 size-2.5 bg-emerald-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):null,r&&S?f.jsx(S,{className:"size-3.5 flex-shrink-0 text-muted-foreground/80","aria-label":`${e.provider} provider`}):null,f.jsx("span",{className:"text-sm truncate flex-1 translate-y-[-0.5px]",children:e.status!=="idle"&&e.status!=="waiting_for_user"?f.jsx(xp,{animate:e.status==="running",shimmerWidth:Math.max(20,e.title.length*3),children:e.title}):e.title}),f.jsxs("div",{className:"relative h-7 w-7 mr-[2px] shrink-0",children:[y?f.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:y}):null,f.jsx(et,{variant:"ghost",size:"icon",className:pe("absolute inset-0 h-7 w-7 opacity-100 cursor-pointer rounded-sm hover:!bg-transparent !border-0",y?"md:opacity-0 md:group-hover:opacity-100":"opacity-100 md:opacity-0 md:group-hover:opacity-100"),"data-no-touch-drag":!0,onClick:N=>{N.stopPropagation(),l(e.chatId)},title:"Delete chat",children:f.jsx(c6,{className:"size-3.5"})})]})]},e._id),f.jsx(NM,{position:E,children:f.jsx("span",{className:"text-sm font-medium truncate",children:e.title})})]})}function B7(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _.useMemo(()=>r=>{t.forEach(s=>s(r))},t)}const wp=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function wc(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function U0(e){return"nodeType"in e}function Wr(e){var t,n;return e?wc(e)?e:U0(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function $0(e){const{Document:t}=Wr(e);return e instanceof t}function Md(e){return wc(e)?!1:e instanceof Wr(e).HTMLElement}function MM(e){return e instanceof Wr(e).SVGElement}function Sc(e){return e?wc(e)?e.document:U0(e)?$0(e)?e:Md(e)||MM(e)?e.ownerDocument:document:document:document}const _s=wp?_.useLayoutEffect:_.useEffect;function W0(e){const t=_.useRef(e);return _s(()=>{t.current=e}),_.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 I7(){const e=_.useRef(null),t=_.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),n=_.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ad(e,t){t===void 0&&(t=[e]);const n=_.useRef(e);return _s(()=>{n.current!==e&&(n.current=e)},t),n}function Ad(e,t){const n=_.useRef();return _.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Em(e){const t=W0(e),n=_.useRef(null),r=_.useCallback(s=>{s!==n.current&&(t==null||t(s,n.current)),n.current=s},[]);return[n,r]}function zb(e){const t=_.useRef();return _.useEffect(()=>{t.current=e},[e]),t.current}let b_={};function Dd(e,t){return _.useMemo(()=>{if(t)return t;const n=b_[e]==null?0:b_[e]+1;return b_[e]=n,e+"-"+n},[e,t])}function AM(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((o,l)=>{const u=Object.entries(l);for(const[h,d]of u){const g=o[h];g!=null&&(o[h]=g+e*d)}return o},{...t})}}const ic=AM(1),Rm=AM(-1);function H7(e){return"clientX"in e&&"clientY"in e}function V0(e){if(!e)return!1;const{KeyboardEvent:t}=Wr(e.target);return t&&e instanceof t}function F7(e){if(!e)return!1;const{TouchEvent:t}=Wr(e.target);return t&&e instanceof t}function Pb(e){if(F7(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 H7(e)?{x:e.clientX,y:e.clientY}:null}const ld=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[ld.Translate.toString(e),ld.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),t2="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function U7(e){return e.matches(t2)?e:e.querySelector(t2)}const $7={display:"none"};function W7(e){let{id:t,value:n}=e;return ye.createElement("div",{id:t,style:$7},n)}function V7(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 ye.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function q7(){const[e,t]=_.useState("");return{announce:_.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const DM=_.createContext(null);function K7(e){const t=_.useContext(DM);_.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function G7(){const[e]=_.useState(()=>new Set),t=_.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[_.useCallback(r=>{let{type:s,event:o}=r;e.forEach(l=>{var u;return(u=l[s])==null?void 0:u.call(l,o)})},[e]),t]}const Y7={draggable:`
|
|
464
|
+
6. Paste it here.`;function l8({open:e,onOpenChange:t,onSubmit:n}){const r=_.useRef(null),[s,o]=_.useState(""),[l,u]=_.useState(!1);_.useEffect(()=>{e&&(o(""),setTimeout(()=>{var p;return(p=r.current)==null?void 0:p.focus()},0))},[e]);async function h(){const p=await navigator.clipboard.readText();o(p)}async function d(){await navigator.clipboard.writeText(Ok),u(!0),setTimeout(()=>u(!1),2e3)}const g=s.trim().length>0;return f.jsx(ip,{open:e,onOpenChange:t,children:f.jsx(kd,{size:"lg",children:f.jsxs("form",{onSubmit:p=>{p.preventDefault(),g&&n(s.trim())},children:[f.jsxs(op,{className:"space-y-4",children:[f.jsx(sp,{children:"Import Cursor Session"}),f.jsxs(S0,{children:["Paste the copied ",f.jsx("code",{children:"get-current-period-usage"})," curl command and Kaizen will import the session for you."]}),f.jsx("div",{className:"rounded-xl border border-border bg-card px-3 py-3 text-sm text-muted-foreground whitespace-pre-line",children:Ok}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(et,{type:"button",variant:"ghost",size:"sm",onClick:()=>void h(),children:"Paste Clipboard"}),f.jsxs(et,{type:"button",variant:"ghost",size:"sm",onClick:()=>void d(),children:[l?f.jsx($i,{className:"h-4 w-4"}):f.jsx(Cd,{className:"h-4 w-4"}),f.jsx("span",{className:"ml-1",children:l?"Copied":"Copy Steps"})]})]}),f.jsx(lp,{ref:r,value:s,onChange:p=>o(p.target.value),rows:10,placeholder:"Paste the copied curl command here",className:"font-mono text-xs"})]}),f.jsxs(ap,{children:[f.jsx(et,{type:"button",variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"}),f.jsx(et,{type:"submit",variant:"secondary",size:"sm",disabled:!g,children:"Import Session"})]})]})})})}const c8=["top","right","bottom","left"],Zo=Math.min,ri=Math.max,_m=Math.round,yf=Math.floor,gs=e=>({x:e,y:e}),u8={left:"right",right:"left",bottom:"top",top:"bottom"};function Eb(e,t,n){return ri(e,Zo(t,n))}function Xs(e,t){return typeof e=="function"?e(t):e}function Zs(e){return e.split("-")[0]}function yc(e){return e.split("-")[1]}function C0(e){return e==="x"?"y":"x"}function k0(e){return e==="y"?"height":"width"}function us(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function E0(e){return C0(us(e))}function d8(e,t,n){n===void 0&&(n=!1);const r=yc(e),s=E0(e),o=k0(s);let l=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(l=bm(l)),[l,bm(l)]}function h8(e){const t=bm(e);return[Rb(e),t,Rb(t)]}function Rb(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Lk=["left","right"],zk=["right","left"],f8=["top","bottom"],m8=["bottom","top"];function p8(e,t,n){switch(e){case"top":case"bottom":return n?t?zk:Lk:t?Lk:zk;case"left":case"right":return t?f8:m8;default:return[]}}function g8(e,t,n,r){const s=yc(e);let o=p8(Zs(e),n==="start",r);return s&&(o=o.map(l=>l+"-"+s),t&&(o=o.concat(o.map(Rb)))),o}function bm(e){const t=Zs(e);return u8[t]+e.slice(t.length)}function v8(e){return{top:0,right:0,bottom:0,left:0,...e}}function AN(e){return typeof e!="number"?v8(e):{top:e,right:e,bottom:e,left:e}}function ym(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 Pk(e,t,n){let{reference:r,floating:s}=e;const o=us(t),l=E0(t),u=k0(l),h=Zs(t),d=o==="y",g=r.x+r.width/2-s.width/2,p=r.y+r.height/2-s.height/2,v=r[u]/2-s[u]/2;let y;switch(h){case"top":y={x:g,y:r.y-s.height};break;case"bottom":y={x:g,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:p};break;case"left":y={x:r.x-s.width,y:p};break;default:y={x:r.x,y:r.y}}switch(yc(t)){case"start":y[l]-=v*(n&&d?-1:1);break;case"end":y[l]+=v*(n&&d?-1:1);break}return y}async function _8(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:o,rects:l,elements:u,strategy:h}=e,{boundary:d="clippingAncestors",rootBoundary:g="viewport",elementContext:p="floating",altBoundary:v=!1,padding:y=0}=Xs(t,e),w=AN(y),C=u[v?p==="floating"?"reference":"floating":p],k=ym(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(C)))==null||n?C:C.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(u.floating)),boundary:d,rootBoundary:g,strategy:h})),R=p==="floating"?{x:r,y:s,width:l.floating.width,height:l.floating.height}:l.reference,E=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u.floating)),N=await(o.isElement==null?void 0:o.isElement(E))?await(o.getScale==null?void 0:o.getScale(E))||{x:1,y:1}:{x:1,y:1},j=ym(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:R,offsetParent:E,strategy:h}):R);return{top:(k.top-j.top+w.top)/N.y,bottom:(j.bottom-k.bottom+w.bottom)/N.y,left:(k.left-j.left+w.left)/N.x,right:(j.right-k.right+w.right)/N.x}}const b8=50,y8=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:l}=n,u=l.detectOverflow?l:{...l,detectOverflow:_8},h=await(l.isRTL==null?void 0:l.isRTL(t));let d=await l.getElementRects({reference:e,floating:t,strategy:s}),{x:g,y:p}=Pk(d,r,h),v=r,y=0;const w={};for(let S=0;S<o.length;S++){const C=o[S];if(!C)continue;const{name:k,fn:R}=C,{x:E,y:N,data:j,reset:D}=await R({x:g,y:p,initialPlacement:r,placement:v,strategy:s,middlewareData:w,rects:d,platform:u,elements:{reference:e,floating:t}});g=E??g,p=N??p,w[k]={...w[k],...j},D&&y<b8&&(y++,typeof D=="object"&&(D.placement&&(v=D.placement),D.rects&&(d=D.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:s}):D.rects),{x:g,y:p}=Pk(d,v,h)),S=-1)}return{x:g,y:p,placement:v,strategy:s,middlewareData:w}},x8=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:o,platform:l,elements:u,middlewareData:h}=t,{element:d,padding:g=0}=Xs(e,t)||{};if(d==null)return{};const p=AN(g),v={x:n,y:r},y=E0(s),w=k0(y),S=await l.getDimensions(d),C=y==="y",k=C?"top":"left",R=C?"bottom":"right",E=C?"clientHeight":"clientWidth",N=o.reference[w]+o.reference[y]-v[y]-o.floating[w],j=v[y]-o.reference[y],D=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d));let L=D?D[E]:0;(!L||!await(l.isElement==null?void 0:l.isElement(D)))&&(L=u.floating[E]||o.floating[w]);const U=N/2-j/2,Y=L/2-S[w]/2-1,P=Zo(p[k],Y),V=Zo(p[R],Y),I=P,W=L-S[w]-V,K=L/2-S[w]/2+U,q=Eb(I,K,W),O=!h.arrow&&yc(s)!=null&&K!==q&&o.reference[w]/2-(K<I?P:V)-S[w]/2<0,F=O?K<I?K-I:K-W:0;return{[y]:v[y]+F,data:{[y]:q,centerOffset:K-q-F,...O&&{alignmentOffset:F}},reset:O}}}),w8=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:o,rects:l,initialPlacement:u,platform:h,elements:d}=t,{mainAxis:g=!0,crossAxis:p=!0,fallbackPlacements:v,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:S=!0,...C}=Xs(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const k=Zs(s),R=us(u),E=Zs(u)===u,N=await(h.isRTL==null?void 0:h.isRTL(d.floating)),j=v||(E||!S?[bm(u)]:h8(u)),D=w!=="none";!v&&D&&j.push(...g8(u,S,w,N));const L=[u,...j],U=await h.detectOverflow(t,C),Y=[];let P=((r=o.flip)==null?void 0:r.overflows)||[];if(g&&Y.push(U[k]),p){const K=d8(s,l,N);Y.push(U[K[0]],U[K[1]])}if(P=[...P,{placement:s,overflows:Y}],!Y.every(K=>K<=0)){var V,I;const K=(((V=o.flip)==null?void 0:V.index)||0)+1,q=L[K];if(q&&(!(p==="alignment"?R!==us(q):!1)||P.every(H=>us(H.placement)===R?H.overflows[0]>0:!0)))return{data:{index:K,overflows:P},reset:{placement:q}};let O=(I=P.filter(F=>F.overflows[0]<=0).sort((F,H)=>F.overflows[1]-H.overflows[1])[0])==null?void 0:I.placement;if(!O)switch(y){case"bestFit":{var W;const F=(W=P.filter(H=>{if(D){const $=us(H.placement);return $===R||$==="y"}return!0}).map(H=>[H.placement,H.overflows.filter($=>$>0).reduce(($,M)=>$+M,0)]).sort((H,$)=>H[1]-$[1])[0])==null?void 0:W[0];F&&(O=F);break}case"initialPlacement":O=u;break}if(s!==O)return{reset:{placement:O}}}return{}}}};function Bk(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ik(e){return c8.some(t=>e[t]>=0)}const S8=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...o}=Xs(e,t);switch(s){case"referenceHidden":{const l=await r.detectOverflow(t,{...o,elementContext:"reference"}),u=Bk(l,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:Ik(u)}}}case"escaped":{const l=await r.detectOverflow(t,{...o,altBoundary:!0}),u=Bk(l,n.floating);return{data:{escapedOffsets:u,escaped:Ik(u)}}}default:return{}}}}},DN=new Set(["left","top"]);async function C8(e,t){const{placement:n,platform:r,elements:s}=e,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),l=Zs(n),u=yc(n),h=us(n)==="y",d=DN.has(l)?-1:1,g=o&&h?-1:1,p=Xs(t,e);let{mainAxis:v,crossAxis:y,alignmentAxis:w}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return u&&typeof w=="number"&&(y=u==="end"?w*-1:w),h?{x:y*g,y:v*d}:{x:v*d,y:y*g}}const k8=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:o,placement:l,middlewareData:u}=t,h=await C8(t,e);return l===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:s+h.x,y:o+h.y,data:{...h,placement:l}}}}},E8=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:o}=t,{mainAxis:l=!0,crossAxis:u=!1,limiter:h={fn:k=>{let{x:R,y:E}=k;return{x:R,y:E}}},...d}=Xs(e,t),g={x:n,y:r},p=await o.detectOverflow(t,d),v=us(Zs(s)),y=C0(v);let w=g[y],S=g[v];if(l){const k=y==="y"?"top":"left",R=y==="y"?"bottom":"right",E=w+p[k],N=w-p[R];w=Eb(E,w,N)}if(u){const k=v==="y"?"top":"left",R=v==="y"?"bottom":"right",E=S+p[k],N=S-p[R];S=Eb(E,S,N)}const C=h.fn({...t,[y]:w,[v]:S});return{...C,data:{x:C.x-n,y:C.y-r,enabled:{[y]:l,[v]:u}}}}}},R8=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:o,middlewareData:l}=t,{offset:u=0,mainAxis:h=!0,crossAxis:d=!0}=Xs(e,t),g={x:n,y:r},p=us(s),v=C0(p);let y=g[v],w=g[p];const S=Xs(u,t),C=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(h){const E=v==="y"?"height":"width",N=o.reference[v]-o.floating[E]+C.mainAxis,j=o.reference[v]+o.reference[E]-C.mainAxis;y<N?y=N:y>j&&(y=j)}if(d){var k,R;const E=v==="y"?"width":"height",N=DN.has(Zs(s)),j=o.reference[p]-o.floating[E]+(N&&((k=l.offset)==null?void 0:k[p])||0)+(N?0:C.crossAxis),D=o.reference[p]+o.reference[E]+(N?0:((R=l.offset)==null?void 0:R[p])||0)-(N?C.crossAxis:0);w<j?w=j:w>D&&(w=D)}return{[v]:y,[p]:w}}}},T8=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:o,platform:l,elements:u}=t,{apply:h=()=>{},...d}=Xs(e,t),g=await l.detectOverflow(t,d),p=Zs(s),v=yc(s),y=us(s)==="y",{width:w,height:S}=o.floating;let C,k;p==="top"||p==="bottom"?(C=p,k=v===(await(l.isRTL==null?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(k=p,C=v==="end"?"top":"bottom");const R=S-g.top-g.bottom,E=w-g.left-g.right,N=Zo(S-g[C],R),j=Zo(w-g[k],E),D=!t.middlewareData.shift;let L=N,U=j;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(U=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(L=R),D&&!v){const P=ri(g.left,0),V=ri(g.right,0),I=ri(g.top,0),W=ri(g.bottom,0);y?U=w-2*(P!==0||V!==0?P+V:ri(g.left,g.right)):L=S-2*(I!==0||W!==0?I+W:ri(g.top,g.bottom))}await h({...t,availableWidth:U,availableHeight:L});const Y=await l.getDimensions(u.floating);return w!==Y.width||S!==Y.height?{reset:{rects:!0}}:{}}}};function cp(){return typeof window<"u"}function xc(e){return jN(e)?(e.nodeName||"").toLowerCase():"#document"}function ii(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ys(e){var t;return(t=(jN(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function jN(e){return cp()?e instanceof Node||e instanceof ii(e).Node:!1}function Wi(e){return cp()?e instanceof Element||e instanceof ii(e).Element:!1}function to(e){return cp()?e instanceof HTMLElement||e instanceof ii(e).HTMLElement:!1}function Hk(e){return!cp()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ii(e).ShadowRoot}function Ed(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=Vi(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function N8(e){return/^(table|td|th)$/.test(xc(e))}function up(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const M8=/transform|translate|scale|rotate|perspective|filter/,A8=/paint|layout|strict|content/,Ca=e=>!!e&&e!=="none";let m_;function R0(e){const t=Wi(e)?Vi(e):e;return Ca(t.transform)||Ca(t.translate)||Ca(t.scale)||Ca(t.rotate)||Ca(t.perspective)||!T0()&&(Ca(t.backdropFilter)||Ca(t.filter))||M8.test(t.willChange||"")||A8.test(t.contain||"")}function D8(e){let t=Qo(e);for(;to(t)&&!cc(t);){if(R0(t))return t;if(up(t))return null;t=Qo(t)}return null}function T0(){return m_==null&&(m_=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),m_}function cc(e){return/^(html|body|#document)$/.test(xc(e))}function Vi(e){return ii(e).getComputedStyle(e)}function dp(e){return Wi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qo(e){if(xc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Hk(e)&&e.host||ys(e);return Hk(t)?t.host:t}function ON(e){const t=Qo(e);return cc(t)?e.ownerDocument?e.ownerDocument.body:e.body:to(t)&&Ed(t)?t:ON(t)}function sd(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=ON(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),l=ii(s);if(o){const u=Tb(l);return t.concat(l,l.visualViewport||[],Ed(s)?s:[],u&&n?sd(u):[])}else return t.concat(s,sd(s,[],n))}function Tb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function LN(e){const t=Vi(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=to(e),o=s?e.offsetWidth:n,l=s?e.offsetHeight:r,u=_m(n)!==o||_m(r)!==l;return u&&(n=o,r=l),{width:n,height:r,$:u}}function N0(e){return Wi(e)?e:e.contextElement}function rc(e){const t=N0(e);if(!to(t))return gs(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=LN(t);let l=(o?_m(n.width):n.width)/r,u=(o?_m(n.height):n.height)/s;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}const j8=gs(0);function zN(e){const t=ii(e);return!T0()||!t.visualViewport?j8:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function O8(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ii(e)?!1:t}function $a(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=N0(e);let l=gs(1);t&&(r?Wi(r)&&(l=rc(r)):l=rc(e));const u=O8(o,n,r)?zN(o):gs(0);let h=(s.left+u.x)/l.x,d=(s.top+u.y)/l.y,g=s.width/l.x,p=s.height/l.y;if(o){const v=ii(o),y=r&&Wi(r)?ii(r):r;let w=v,S=Tb(w);for(;S&&r&&y!==w;){const C=rc(S),k=S.getBoundingClientRect(),R=Vi(S),E=k.left+(S.clientLeft+parseFloat(R.paddingLeft))*C.x,N=k.top+(S.clientTop+parseFloat(R.paddingTop))*C.y;h*=C.x,d*=C.y,g*=C.x,p*=C.y,h+=E,d+=N,w=ii(S),S=Tb(w)}}return ym({width:g,height:p,x:h,y:d})}function hp(e,t){const n=dp(e).scrollLeft;return t?t.left+n:$a(ys(e)).left+n}function PN(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-hp(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function L8(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",l=ys(r),u=t?up(t.floating):!1;if(r===l||u&&o)return n;let h={scrollLeft:0,scrollTop:0},d=gs(1);const g=gs(0),p=to(r);if((p||!p&&!o)&&((xc(r)!=="body"||Ed(l))&&(h=dp(r)),p)){const y=$a(r);d=rc(r),g.x=y.x+r.clientLeft,g.y=y.y+r.clientTop}const v=l&&!p&&!o?PN(l,h):gs(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-h.scrollLeft*d.x+g.x+v.x,y:n.y*d.y-h.scrollTop*d.y+g.y+v.y}}function z8(e){return Array.from(e.getClientRects())}function P8(e){const t=ys(e),n=dp(e),r=e.ownerDocument.body,s=ri(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=ri(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+hp(e);const u=-n.scrollTop;return Vi(r).direction==="rtl"&&(l+=ri(t.clientWidth,r.clientWidth)-s),{width:s,height:o,x:l,y:u}}const Fk=25;function B8(e,t){const n=ii(e),r=ys(e),s=n.visualViewport;let o=r.clientWidth,l=r.clientHeight,u=0,h=0;if(s){o=s.width,l=s.height;const g=T0();(!g||g&&t==="fixed")&&(u=s.offsetLeft,h=s.offsetTop)}const d=hp(r);if(d<=0){const g=r.ownerDocument,p=g.body,v=getComputedStyle(p),y=g.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,w=Math.abs(r.clientWidth-p.clientWidth-y);w<=Fk&&(o-=w)}else d<=Fk&&(o+=d);return{width:o,height:l,x:u,y:h}}function I8(e,t){const n=$a(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,o=to(e)?rc(e):gs(1),l=e.clientWidth*o.x,u=e.clientHeight*o.y,h=s*o.x,d=r*o.y;return{width:l,height:u,x:h,y:d}}function Uk(e,t,n){let r;if(t==="viewport")r=B8(e,n);else if(t==="document")r=P8(ys(e));else if(Wi(t))r=I8(t,n);else{const s=zN(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return ym(r)}function BN(e,t){const n=Qo(e);return n===t||!Wi(n)||cc(n)?!1:Vi(n).position==="fixed"||BN(n,t)}function H8(e,t){const n=t.get(e);if(n)return n;let r=sd(e,[],!1).filter(u=>Wi(u)&&xc(u)!=="body"),s=null;const o=Vi(e).position==="fixed";let l=o?Qo(e):e;for(;Wi(l)&&!cc(l);){const u=Vi(l),h=R0(l);!h&&u.position==="fixed"&&(s=null),(o?!h&&!s:!h&&u.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Ed(l)&&!h&&BN(e,l))?r=r.filter(g=>g!==l):s=u,l=Qo(l)}return t.set(e,r),r}function F8(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const l=[...n==="clippingAncestors"?up(t)?[]:H8(t,this._c):[].concat(n),r],u=Uk(t,l[0],s);let h=u.top,d=u.right,g=u.bottom,p=u.left;for(let v=1;v<l.length;v++){const y=Uk(t,l[v],s);h=ri(y.top,h),d=Zo(y.right,d),g=Zo(y.bottom,g),p=ri(y.left,p)}return{width:d-p,height:g-h,x:p,y:h}}function U8(e){const{width:t,height:n}=LN(e);return{width:t,height:n}}function $8(e,t,n){const r=to(t),s=ys(t),o=n==="fixed",l=$a(e,!0,o,t);let u={scrollLeft:0,scrollTop:0};const h=gs(0);function d(){h.x=hp(s)}if(r||!r&&!o)if((xc(t)!=="body"||Ed(s))&&(u=dp(t)),r){const y=$a(t,!0,o,t);h.x=y.x+t.clientLeft,h.y=y.y+t.clientTop}else s&&d();o&&!r&&s&&d();const g=s&&!r&&!o?PN(s,u):gs(0),p=l.left+u.scrollLeft-h.x-g.x,v=l.top+u.scrollTop-h.y-g.y;return{x:p,y:v,width:l.width,height:l.height}}function p_(e){return Vi(e).position==="static"}function $k(e,t){if(!to(e)||Vi(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ys(e)===n&&(n=n.ownerDocument.body),n}function IN(e,t){const n=ii(e);if(up(e))return n;if(!to(e)){let s=Qo(e);for(;s&&!cc(s);){if(Wi(s)&&!p_(s))return s;s=Qo(s)}return n}let r=$k(e,t);for(;r&&N8(r)&&p_(r);)r=$k(r,t);return r&&cc(r)&&p_(r)&&!R0(r)?n:r||D8(e)||n}const W8=async function(e){const t=this.getOffsetParent||IN,n=this.getDimensions,r=await n(e.floating);return{reference:$8(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function V8(e){return Vi(e).direction==="rtl"}const q8={convertOffsetParentRelativeRectToViewportRelativeRect:L8,getDocumentElement:ys,getClippingRect:F8,getOffsetParent:IN,getElementRects:W8,getClientRects:z8,getDimensions:U8,getScale:rc,isElement:Wi,isRTL:V8};function HN(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function K8(e,t){let n=null,r;const s=ys(e);function o(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function l(u,h){u===void 0&&(u=!1),h===void 0&&(h=1),o();const d=e.getBoundingClientRect(),{left:g,top:p,width:v,height:y}=d;if(u||t(),!v||!y)return;const w=yf(p),S=yf(s.clientWidth-(g+v)),C=yf(s.clientHeight-(p+y)),k=yf(g),E={rootMargin:-w+"px "+-S+"px "+-C+"px "+-k+"px",threshold:ri(0,Zo(1,h))||1};let N=!0;function j(D){const L=D[0].intersectionRatio;if(L!==h){if(!N)return l();L?l(!1,L):r=setTimeout(()=>{l(!1,1e-7)},1e3)}L===1&&!HN(d,e.getBoundingClientRect())&&l(),N=!1}try{n=new IntersectionObserver(j,{...E,root:s.ownerDocument})}catch{n=new IntersectionObserver(j,E)}n.observe(e)}return l(!0),o}function G8(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:h=!1}=r,d=N0(e),g=s||o?[...d?sd(d):[],...t?sd(t):[]]:[];g.forEach(k=>{s&&k.addEventListener("scroll",n,{passive:!0}),o&&k.addEventListener("resize",n)});const p=d&&u?K8(d,n):null;let v=-1,y=null;l&&(y=new ResizeObserver(k=>{let[R]=k;R&&R.target===d&&y&&t&&(y.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var E;(E=y)==null||E.observe(t)})),n()}),d&&!h&&y.observe(d),t&&y.observe(t));let w,S=h?$a(e):null;h&&C();function C(){const k=$a(e);S&&!HN(S,k)&&n(),S=k,w=requestAnimationFrame(C)}return n(),()=>{var k;g.forEach(R=>{s&&R.removeEventListener("scroll",n),o&&R.removeEventListener("resize",n)}),p==null||p(),(k=y)==null||k.disconnect(),y=null,h&&cancelAnimationFrame(w)}}const Y8=k8,X8=E8,Z8=w8,Q8=T8,J8=S8,Wk=x8,e9=R8,t9=(e,t,n)=>{const r=new Map,s={platform:q8,...n},o={...s.platform,_c:r};return y8(e,t,{...s,platform:o})};var n9=typeof document<"u",r9=function(){},Xf=n9?_.useLayoutEffect:r9;function xm(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(!xm(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 o=s[r];if(!(o==="_owner"&&e.$$typeof)&&!xm(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function FN(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Vk(e,t){const n=FN(e);return Math.round(t*n)/n}function g_(e){const t=_.useRef(e);return Xf(()=>{t.current=e}),t}function i9(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:o,floating:l}={},transform:u=!0,whileElementsMounted:h,open:d}=e,[g,p]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[v,y]=_.useState(r);xm(v,r)||y(r);const[w,S]=_.useState(null),[C,k]=_.useState(null),R=_.useCallback(H=>{H!==D.current&&(D.current=H,S(H))},[]),E=_.useCallback(H=>{H!==L.current&&(L.current=H,k(H))},[]),N=o||w,j=l||C,D=_.useRef(null),L=_.useRef(null),U=_.useRef(g),Y=h!=null,P=g_(h),V=g_(s),I=g_(d),W=_.useCallback(()=>{if(!D.current||!L.current)return;const H={placement:t,strategy:n,middleware:v};V.current&&(H.platform=V.current),t9(D.current,L.current,H).then($=>{const M={...$,isPositioned:I.current!==!1};K.current&&!xm(U.current,M)&&(U.current=M,Bi.flushSync(()=>{p(M)}))})},[v,t,n,V,I]);Xf(()=>{d===!1&&U.current.isPositioned&&(U.current.isPositioned=!1,p(H=>({...H,isPositioned:!1})))},[d]);const K=_.useRef(!1);Xf(()=>(K.current=!0,()=>{K.current=!1}),[]),Xf(()=>{if(N&&(D.current=N),j&&(L.current=j),N&&j){if(P.current)return P.current(N,j,W);W()}},[N,j,W,P,Y]);const q=_.useMemo(()=>({reference:D,floating:L,setReference:R,setFloating:E}),[R,E]),O=_.useMemo(()=>({reference:N,floating:j}),[N,j]),F=_.useMemo(()=>{const H={position:n,left:0,top:0};if(!O.floating)return H;const $=Vk(O.floating,g.x),M=Vk(O.floating,g.y);return u?{...H,transform:"translate("+$+"px, "+M+"px)",...FN(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:$,top:M}},[n,u,O.floating,g.x,g.y]);return _.useMemo(()=>({...g,update:W,refs:q,elements:O,floatingStyles:F}),[g,W,q,O,F])}const s9=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?Wk({element:r.current,padding:s}).fn(n):{}:r?Wk({element:r,padding:s}).fn(n):{}}}},o9=(e,t)=>{const n=Y8(e);return{name:n.name,fn:n.fn,options:[e,t]}},a9=(e,t)=>{const n=X8(e);return{name:n.name,fn:n.fn,options:[e,t]}},l9=(e,t)=>({fn:e9(e).fn,options:[e,t]}),c9=(e,t)=>{const n=Z8(e);return{name:n.name,fn:n.fn,options:[e,t]}},u9=(e,t)=>{const n=Q8(e);return{name:n.name,fn:n.fn,options:[e,t]}},d9=(e,t)=>{const n=J8(e);return{name:n.name,fn:n.fn,options:[e,t]}},h9=(e,t)=>{const n=s9(e);return{name:n.name,fn:n.fn,options:[e,t]}};var f9="Arrow",UN=_.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...o}=e;return f.jsx(Rt.svg,{...o,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:f.jsx("polygon",{points:"0,0 30,0 15,10"})})});UN.displayName=f9;var m9=UN;function p9(e){const[t,n]=_.useState(void 0);return br(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let l,u;if("borderBoxSize"in o){const h=o.borderBoxSize,d=Array.isArray(h)?h[0]:h;l=d.inlineSize,u=d.blockSize}else l=e.offsetWidth,u=e.offsetHeight;n({width:l,height:u})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var M0="Popper",[$N,ea]=eo(M0),[g9,WN]=$N(M0),VN=e=>{const{__scopePopper:t,children:n}=e,[r,s]=_.useState(null);return f.jsx(g9,{scope:t,anchor:r,onAnchorChange:s,children:n})};VN.displayName=M0;var qN="PopperAnchor",KN=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,o=WN(qN,n),l=_.useRef(null),u=Ut(t,l),h=_.useRef(null);return _.useEffect(()=>{const d=h.current;h.current=(r==null?void 0:r.current)||l.current,d!==h.current&&o.onAnchorChange(h.current)}),r?null:f.jsx(Rt.div,{...s,ref:u})});KN.displayName=qN;var A0="PopperContent",[v9,_9]=$N(A0),GN=_.forwardRef((e,t)=>{var te,le,me,xe,Te,Ee;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:o="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:h=!0,collisionBoundary:d=[],collisionPadding:g=0,sticky:p="partial",hideWhenDetached:v=!1,updatePositionStrategy:y="optimized",onPlaced:w,...S}=e,C=WN(A0,n),[k,R]=_.useState(null),E=Ut(t,je=>R(je)),[N,j]=_.useState(null),D=p9(N),L=(D==null?void 0:D.width)??0,U=(D==null?void 0:D.height)??0,Y=r+(o!=="center"?"-"+o:""),P=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},V=Array.isArray(d)?d:[d],I=V.length>0,W={padding:P,boundary:V.filter(y9),altBoundary:I},{refs:K,floatingStyles:q,placement:O,isPositioned:F,middlewareData:H}=i9({strategy:"fixed",placement:Y,whileElementsMounted:(...je)=>G8(...je,{animationFrame:y==="always"}),elements:{reference:C.anchor},middleware:[o9({mainAxis:s+U,alignmentAxis:l}),h&&a9({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?l9():void 0,...W}),h&&c9({...W}),u9({...W,apply:({elements:je,rects:Ye,availableWidth:pt,availableHeight:vt})=>{const{width:he,height:ze}=Ye.reference,Ne=je.floating.style;Ne.setProperty("--radix-popper-available-width",`${pt}px`),Ne.setProperty("--radix-popper-available-height",`${vt}px`),Ne.setProperty("--radix-popper-anchor-width",`${he}px`),Ne.setProperty("--radix-popper-anchor-height",`${ze}px`)}}),N&&h9({element:N,padding:u}),x9({arrowWidth:L,arrowHeight:U}),v&&d9({strategy:"referenceHidden",...W})]}),[$,M]=ZN(O),B=Ui(w);br(()=>{F&&(B==null||B())},[F,B]);const X=(te=H.arrow)==null?void 0:te.x,A=(le=H.arrow)==null?void 0:le.y,re=((me=H.arrow)==null?void 0:me.centerOffset)!==0,[se,Z]=_.useState();return br(()=>{k&&Z(window.getComputedStyle(k).zIndex)},[k]),f.jsx("div",{ref:K.setFloating,"data-radix-popper-content-wrapper":"",style:{...q,transform:F?q.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:se,"--radix-popper-transform-origin":[(xe=H.transformOrigin)==null?void 0:xe.x,(Te=H.transformOrigin)==null?void 0:Te.y].join(" "),...((Ee=H.hide)==null?void 0:Ee.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:f.jsx(v9,{scope:n,placedSide:$,onArrowChange:j,arrowX:X,arrowY:A,shouldHideArrow:re,children:f.jsx(Rt.div,{"data-side":$,"data-align":M,...S,ref:E,style:{...S.style,animation:F?void 0:"none"}})})})});GN.displayName=A0;var YN="PopperArrow",b9={top:"bottom",right:"left",bottom:"top",left:"right"},XN=_.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,o=_9(YN,r),l=b9[o.placedSide];return f.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:f.jsx(m9,{...s,ref:n,style:{...s.style,display:"block"}})})});XN.displayName=YN;function y9(e){return e!==null}var x9=e=>({name:"transformOrigin",options:e,fn(t){var C,k,R;const{placement:n,rects:r,middlewareData:s}=t,l=((C=s.arrow)==null?void 0:C.centerOffset)!==0,u=l?0:e.arrowWidth,h=l?0:e.arrowHeight,[d,g]=ZN(n),p={start:"0%",center:"50%",end:"100%"}[g],v=(((k=s.arrow)==null?void 0:k.x)??0)+u/2,y=(((R=s.arrow)==null?void 0:R.y)??0)+h/2;let w="",S="";return d==="bottom"?(w=l?p:`${v}px`,S=`${-h}px`):d==="top"?(w=l?p:`${v}px`,S=`${r.floating.height+h}px`):d==="right"?(w=`${-h}px`,S=l?p:`${y}px`):d==="left"&&(w=`${r.floating.width+h}px`,S=l?p:`${y}px`),{data:{x:w,y:S}}}});function ZN(e){const[t,n="center"]=e.split("-");return[t,n]}var fp=VN,Rd=KN,mp=GN,pp=XN,QN=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"}),w9="VisuallyHidden",JN=_.forwardRef((e,t)=>f.jsx(Rt.span,{...e,ref:t,style:{...QN,...e.style}}));JN.displayName=w9;var S9=JN,[gp]=eo("Tooltip",[ea]),vp=ea(),eM="TooltipProvider",C9=700,Nb="tooltip.open",[k9,D0]=gp(eM),tM=e=>{const{__scopeTooltip:t,delayDuration:n=C9,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:o}=e,l=_.useRef(!0),u=_.useRef(!1),h=_.useRef(0);return _.useEffect(()=>{const d=h.current;return()=>window.clearTimeout(d)},[]),f.jsx(k9,{scope:t,isOpenDelayedRef:l,delayDuration:n,onOpen:_.useCallback(()=>{window.clearTimeout(h.current),l.current=!1},[]),onClose:_.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:u,onPointerInTransitChange:_.useCallback(d=>{u.current=d},[]),disableHoverableContent:s,children:o})};tM.displayName=eM;var od="Tooltip",[E9,Td]=gp(od),nM=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:o,disableHoverableContent:l,delayDuration:u}=e,h=D0(od,e.__scopeTooltip),d=vp(t),[g,p]=_.useState(null),v=Gs(),y=_.useRef(0),w=l??h.disableHoverableContent,S=u??h.delayDuration,C=_.useRef(!1),[k,R]=lc({prop:r,defaultProp:s??!1,onChange:L=>{L?(h.onOpen(),document.dispatchEvent(new CustomEvent(Nb))):h.onClose(),o==null||o(L)},caller:od}),E=_.useMemo(()=>k?C.current?"delayed-open":"instant-open":"closed",[k]),N=_.useCallback(()=>{window.clearTimeout(y.current),y.current=0,C.current=!1,R(!0)},[R]),j=_.useCallback(()=>{window.clearTimeout(y.current),y.current=0,R(!1)},[R]),D=_.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{C.current=!0,R(!0),y.current=0},S)},[S,R]);return _.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),f.jsx(fp,{...d,children:f.jsx(E9,{scope:t,contentId:v,open:k,stateAttribute:E,trigger:g,onTriggerChange:p,onTriggerEnter:_.useCallback(()=>{h.isOpenDelayedRef.current?D():N()},[h.isOpenDelayedRef,D,N]),onTriggerLeave:_.useCallback(()=>{w?j():(window.clearTimeout(y.current),y.current=0)},[j,w]),onOpen:N,onClose:j,disableHoverableContent:w,children:n})})};nM.displayName=od;var Mb="TooltipTrigger",rM=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Td(Mb,n),o=D0(Mb,n),l=vp(n),u=_.useRef(null),h=Ut(t,u,s.onTriggerChange),d=_.useRef(!1),g=_.useRef(!1),p=_.useCallback(()=>d.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),f.jsx(Rd,{asChild:!0,...l,children:f.jsx(Rt.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:h,onPointerMove:He(e.onPointerMove,v=>{v.pointerType!=="touch"&&!g.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),g.current=!0)}),onPointerLeave:He(e.onPointerLeave,()=>{s.onTriggerLeave(),g.current=!1}),onPointerDown:He(e.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:He(e.onFocus,()=>{d.current||s.onOpen()}),onBlur:He(e.onBlur,s.onClose),onClick:He(e.onClick,s.onClose)})})});rM.displayName=Mb;var j0="TooltipPortal",[R9,T9]=gp(j0,{forceMount:void 0}),iM=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:s}=e,o=Td(j0,t);return f.jsx(R9,{scope:t,forceMount:n,children:f.jsx(Ai,{present:n||o.open,children:f.jsx(bc,{asChild:!0,container:s,children:r})})})};iM.displayName=j0;var uc="TooltipContent",sM=_.forwardRef((e,t)=>{const n=T9(uc,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...o}=e,l=Td(uc,e.__scopeTooltip);return f.jsx(Ai,{present:r||l.open,children:l.disableHoverableContent?f.jsx(oM,{side:s,...o,ref:t}):f.jsx(N9,{side:s,...o,ref:t})})}),N9=_.forwardRef((e,t)=>{const n=Td(uc,e.__scopeTooltip),r=D0(uc,e.__scopeTooltip),s=_.useRef(null),o=Ut(t,s),[l,u]=_.useState(null),{trigger:h,onClose:d}=n,g=s.current,{onPointerInTransitChange:p}=r,v=_.useCallback(()=>{u(null),p(!1)},[p]),y=_.useCallback((w,S)=>{const C=w.currentTarget,k={x:w.clientX,y:w.clientY},R=O9(k,C.getBoundingClientRect()),E=L9(k,R),N=z9(S.getBoundingClientRect()),j=B9([...E,...N]);u(j),p(!0)},[p]);return _.useEffect(()=>()=>v(),[v]),_.useEffect(()=>{if(h&&g){const w=C=>y(C,g),S=C=>y(C,h);return h.addEventListener("pointerleave",w),g.addEventListener("pointerleave",S),()=>{h.removeEventListener("pointerleave",w),g.removeEventListener("pointerleave",S)}}},[h,g,y,v]),_.useEffect(()=>{if(l){const w=S=>{const C=S.target,k={x:S.clientX,y:S.clientY},R=(h==null?void 0:h.contains(C))||(g==null?void 0:g.contains(C)),E=!P9(k,l);R?v():E&&(v(),d())};return document.addEventListener("pointermove",w),()=>document.removeEventListener("pointermove",w)}},[h,g,l,d,v]),f.jsx(oM,{...e,ref:o})}),[M9,A9]=gp(od,{isInside:!1}),D9=jP("TooltipContent"),oM=_.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:l,...u}=e,h=Td(uc,n),d=vp(n),{onClose:g}=h;return _.useEffect(()=>(document.addEventListener(Nb,g),()=>document.removeEventListener(Nb,g)),[g]),_.useEffect(()=>{if(h.trigger){const p=v=>{const y=v.target;y!=null&&y.contains(h.trigger)&&g()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[h.trigger,g]),f.jsx(_c,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:p=>p.preventDefault(),onDismiss:g,children:f.jsxs(mp,{"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:[f.jsx(D9,{children:r}),f.jsx(M9,{scope:n,isInside:!0,children:f.jsx(S9,{id:h.contentId,role:"tooltip",children:s||r})})]})})});sM.displayName=uc;var aM="TooltipArrow",j9=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=vp(n);return A9(aM,n).isInside?null:f.jsx(pp,{...s,...r,ref:t})});j9.displayName=aM;function O9(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,s,o)){case o:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function L9(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 z9(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 P9(e,t){const{x:n,y:r}=e;let s=!1;for(let o=0,l=t.length-1;o<t.length;l=o++){const u=t[o],h=t[l],d=u.x,g=u.y,p=h.x,v=h.y;g>r!=v>r&&n<(p-d)*(r-g)/(v-g)+d&&(s=!s)}return s}function B9(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),I9(t)}function I9(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 o=t[t.length-1],l=t[t.length-2];if((o.x-l.x)*(s.y-l.y)>=(o.y-l.y)*(s.x-l.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 o=n[n.length-1],l=n[n.length-2];if((o.x-l.x)*(s.y-l.y)>=(o.y-l.y)*(s.x-l.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 H9=tM,lM=nM,cM=rM,uM=iM,O0=sM;function F9({className:e,...t}){return f.jsx("kbd",{className:pe("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 U9({className:e,...t}){return f.jsx("span",{className:pe("inline-flex items-center gap-0.5",e),...t})}const $9="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",W9=H9,ds=lM,hs=cM,Ii=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>f.jsx(uM,{children:f.jsx(O0,{ref:r,sideOffset:t,className:pe("z-50 overflow-hidden rounded-md bg-card text-card-foreground border border-border backdrop-blur-md 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})}));Ii.displayName=O0.displayName;const Ou=lM,Lu=cM;function dM(e){return e.toUpperCase()}function V9(e){const t=e.split("+");return f.jsx(U9,{children:t.map((n,r)=>f.jsx(F9,{children:dM(n)},`${n}-${r}`))})}const Zl=_.forwardRef(({className:e,sideOffset:t=4,children:n,shortcut:r,...s},o)=>{const l=r===void 0?null:Array.isArray(r)?r[0]??null:r;return f.jsx(uM,{children:f.jsx(O0,{ref:o,sideOffset:t,className:pe($9,e),...s,children:l?V9(l):f.jsx("span",{children:typeof n=="string"?dM(n):n})})})});Zl.displayName="HotkeyTooltipContent";const q9="0.1.5",K9={version:q9},zn="Kaizen",qk="kaizen",G9=".kaizen",Y9=".kaizen-dev",v_=".kaizen",X9="KAIZEN_RUNTIME_PROFILE",L0=`kaizen/${K9.version}`,Z9="[kaizen]",Q9=`~/${zn}`,_p="kaizen:";function bp(){var t;return(t=globalThis.process)==null?void 0:t.env}function J9(e=bp()){const t=e==null?void 0:e[X9];return(t==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function e7(e=bp()){return J9(e)==="dev"?Y9:G9}function t7(e=bp()){return`~/${e7(e)}`}function n7(e=bp()){return`${t7(e)}/keybindings.json`}function xf(e){return e?`${qk} ${e}`:qk}const wm=[{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"max",label:"Max"}],Ab=[{id:"minimal",label:"Minimal"},{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"xhigh",label:"XHigh"}],Db=[{id:"off",label:"Off"},{id:"standard",label:"Standard"},{id:"high",label:"High"}],jb="claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]",hM=[{id:"composer-2[fast=true]",label:"Composer 2",supportsEffort:!1},{id:"composer-1.5[]",label:"Composer 1.5",supportsEffort:!1},{id:"gpt-5.3-codex[reasoning=medium,fast=false]",label:"Codex 5.3",supportsEffort:!1},{id:"gpt-5.4[reasoning=medium,context=272k,fast=false]",label:"GPT-5.4",supportsEffort:!1},{id:"claude-sonnet-4-6[thinking=true,context=200k,effort=medium]",label:"Sonnet 4.6",supportsEffort:!1},{id:"claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]",label:"Opus 4.6",supportsEffort:!1},{id:"claude-opus-4-5[thinking=true]",label:"Opus 4.5",supportsEffort:!1},{id:"gpt-5.2[reasoning=medium,fast=false]",label:"GPT-5.2",supportsEffort:!1},{id:"gemini-3.1-pro[]",label:"Gemini 3.1 Pro",supportsEffort:!1},{id:"gpt-5.4-mini[reasoning=medium]",label:"GPT-5.4 Mini",supportsEffort:!1},{id:"gpt-5.4-nano[reasoning=medium]",label:"GPT-5.4 Nano",supportsEffort:!1},{id:"claude-haiku-4-5[thinking=true]",label:"Haiku 4.5",supportsEffort:!1},{id:"gpt-5.3-codex-spark[reasoning=medium]",label:"Codex 5.3 Spark",supportsEffort:!1},{id:"grok-4-20[thinking=true]",label:"Grok 4.20",supportsEffort:!1},{id:"claude-sonnet-4-5[thinking=true,context=200k]",label:"Sonnet 4.5",supportsEffort:!1},{id:"gpt-5.2-codex[reasoning=medium,fast=false]",label:"Codex 5.2",supportsEffort:!1},{id:"gemini-3-flash[]",label:"Gemini 3 Flash",supportsEffort:!1},{id:"claude-sonnet-4[thinking=false,context=200k]",label:"Sonnet 4",supportsEffort:!1},{id:"kimi-k2.5[]",label:"Kimi K2.5",supportsEffort:!1}],r7={"composer-2-fast":"composer-2[fast=true]","composer-1.5":"composer-1.5[]","gpt-5.3-codex":"gpt-5.3-codex[reasoning=medium,fast=false]","gpt-5.4":"gpt-5.4[reasoning=medium,context=272k,fast=false]","gpt-5.4-medium":"gpt-5.4[reasoning=medium,context=272k,fast=false]","claude-4.6-sonnet-medium-thinking":"claude-sonnet-4-6[thinking=true,context=200k,effort=medium]","claude-4.6-opus-high-thinking":"claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]","claude-4.5-opus-high-thinking":"claude-opus-4-5[thinking=true]","gpt-5.2":"gpt-5.2[reasoning=medium,fast=false]","gemini-3.1-pro":"gemini-3.1-pro[]","gpt-5.4-mini":"gpt-5.4-mini[reasoning=medium]","gpt-5.4-mini-medium":"gpt-5.4-mini[reasoning=medium]","gpt-5.4-nano":"gpt-5.4-nano[reasoning=medium]","gpt-5.4-nano-medium":"gpt-5.4-nano[reasoning=medium]","claude-haiku-4.5":"claude-haiku-4-5[thinking=true]","gpt-5.3-codex-spark-preview":"gpt-5.3-codex-spark[reasoning=medium]","grok-4-20":"grok-4-20[thinking=true]","grok-4-20-thinking":"grok-4-20[thinking=true]","claude-4.5-sonnet-thinking":"claude-sonnet-4-5[thinking=true,context=200k]","gpt-5.2-codex":"gpt-5.2-codex[reasoning=medium,fast=false]","gemini-3-flash":"gemini-3-flash[]","claude-4-sonnet":"claude-sonnet-4[thinking=false,context=200k]","kimi-k2.5":"kimi-k2.5[]"};function i7(e){return e?hM.some(t=>t.id===e)?e:r7[e]??jb:jb}function Kk(e){const t=e.indexOf("[");return t>=0?e.slice(0,t):e}function Yl(e){const t=e.match(/\bfast=(true|false)\b/);return t?t[1]==="true"?"fast":"standard":null}function Gk(e){return wm.some(t=>t.id===e)}function Yk(e){return Ab.some(t=>t.id===e)}const Ob=[{id:"200k",label:"200k"},{id:"1m",label:"1M"}];function s7(e){return Db.some(t=>t.id===e)}const qo=[{id:"claude",label:"Claude",systemActive:!0,defaultModel:"sonnet",defaultEffort:"high",defaultModelOptions:{reasoningEffort:"high",contextWindow:"200k"},supportsPlanMode:!0,models:[{id:"opus",label:"Opus",supportsEffort:!0,contextWindowOptions:[...Ob]},{id:"sonnet",label:"Sonnet",supportsEffort:!0,contextWindowOptions:[...Ob]},{id:"haiku",label:"Haiku",supportsEffort:!0}],efforts:[...wm]},{id:"codex",label:"Codex",systemActive:!0,defaultModel:"gpt-5.4",defaultModelOptions:{reasoningEffort:"high",fastMode:!1},supportsPlanMode:!0,models:[{id:"gpt-5.4",label:"GPT-5.4",supportsEffort:!1},{id:"gpt-5.3-codex",label:"GPT-5.3 Codex",supportsEffort:!1},{id:"gpt-5.3-codex-spark",label:"GPT-5.3 Codex Spark",supportsEffort:!1}],efforts:[]},{id:"gemini",label:"Gemini",systemActive:!1,defaultModel:"auto-gemini-2.5",defaultModelOptions:{thinkingMode:"standard"},supportsPlanMode:!0,models:[{id:"auto-gemini-3",label:"Auto (Gemini 3)",supportsEffort:!1},{id:"auto-gemini-2.5",label:"Auto (Gemini 2.5)",supportsEffort:!1},{id:"gemini-3.1-pro-preview",label:"3.1 Pro Preview",supportsEffort:!1},{id:"gemini-3-pro-preview",label:"3 Pro Preview",supportsEffort:!1},{id:"gemini-3-flash-preview",label:"3 Flash Preview",supportsEffort:!1},{id:"gemini-2.5-pro",label:"2.5 Pro",supportsEffort:!1},{id:"gemini-2.5-flash",label:"2.5 Flash",supportsEffort:!1},{id:"gemini-2.5-flash-lite",label:"2.5 Flash Lite",supportsEffort:!1}],efforts:[]},{id:"cursor",label:"Cursor",systemActive:!0,defaultModel:jb,defaultModelOptions:{},supportsPlanMode:!0,models:[...hM],efforts:[]}],Vn={claude:{active:!0},codex:{active:!0},gemini:{active:!0},cursor:{active:!0}};function tn(e){const t=qo.find(n=>n.id===e);if(!t)throw new Error(`Unknown provider: ${e}`);return t}function z0(e,t){const n=Vn[t],r=e==null?void 0:e[t];return{active:(r==null?void 0:r.active)??n.active}}function o7(e,t){const n=tn(e),r=z0(t,e);return n.systemActive&&r.active?null:`Provider ${n.label} is currently not active.`}function Xk(e,t){const n=tn(e),r=z0(t,e);return n.systemActive&&r.active}function a7(e){return qo.map(t=>{const n=z0(e,t.id),r=t.systemActive&&n.active;return{...t,active:n.active,isSelectable:r,isUsageEnabled:r,isInactive:!r,inactiveMessage:o7(t.id,e)}})}function P0(e){return a7(e).filter(t=>t.isSelectable).map(({active:t,isSelectable:n,isUsageEnabled:r,isInactive:s,inactiveMessage:o,...l})=>l)}function Ri(e){return tn(e).defaultModelOptions}const fM=Ri("claude");Ri("codex");Ri("gemini");Ri("cursor");function l7(e){return tn("claude").models.find(t=>t.id===e)}function c7(e){var t;return((t=l7(e))==null?void 0:t.contextWindowOptions)??[]}function u7(e,t){const n=c7(e);if(n.length!==0)return n.some(r=>r.id===t)?t:fM.contextWindow}const d7=["idea","todo","progress","testing","done"],Zk={idea:"IDEA",todo:"TODO",progress:"PROGRESS",testing:"TESTING",done:"DONE"},os={submitChatMessage:["enter"],toggleProjectsSidebar:["ctrl+a"],toggleEmbeddedTerminal:["cmd+j","ctrl+`"],toggleRightSidebar:["cmd+b","ctrl+b"],openInFinder:["cmd+alt+f","ctrl+alt+f"],openInEditor:["cmd+shift+o","ctrl+shift+o"],addSplitTerminal:["cmd+/","ctrl+/"]},Qk=8,h7=10*1024*1024,Jk=["image/png","image/jpeg","image/webp","image/gif"],f7="/assets/icon-4rSnra9R.svg";function Sm({alt:e="",className:t,...n}){return f.jsx("img",{alt:e,src:f7,className:pe("shrink-0 object-contain",t),...n})}var yp="Popover",[mM]=eo(yp,[ea]),Nd=ea(),[m7,ta]=mM(yp),pM=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:s,onOpenChange:o,modal:l=!1}=e,u=Nd(t),h=_.useRef(null),[d,g]=_.useState(!1),[p,v]=lc({prop:r,defaultProp:s??!1,onChange:o,caller:yp});return f.jsx(fp,{...u,children:f.jsx(m7,{scope:t,contentId:Gs(),triggerRef:h,open:p,onOpenChange:v,onOpenToggle:_.useCallback(()=>v(y=>!y),[v]),hasCustomAnchor:d,onCustomAnchorAdd:_.useCallback(()=>g(!0),[]),onCustomAnchorRemove:_.useCallback(()=>g(!1),[]),modal:l,children:n})})};pM.displayName=yp;var gM="PopoverAnchor",vM=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=ta(gM,n),o=Nd(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:u}=s;return _.useEffect(()=>(l(),()=>u()),[l,u]),f.jsx(Rd,{...o,...r,ref:t})});vM.displayName=gM;var _M="PopoverTrigger",bM=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=ta(_M,n),o=Nd(n),l=Ut(t,s.triggerRef),u=f.jsx(Rt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":CM(s.open),...r,ref:l,onClick:He(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?u:f.jsx(Rd,{asChild:!0,...o,children:u})});bM.displayName=_M;var B0="PopoverPortal",[p7,g7]=mM(B0,{forceMount:void 0}),yM=e=>{const{__scopePopover:t,forceMount:n,children:r,container:s}=e,o=ta(B0,t);return f.jsx(p7,{scope:t,forceMount:n,children:f.jsx(Ai,{present:n||o.open,children:f.jsx(bc,{asChild:!0,container:s,children:r})})})};yM.displayName=B0;var dc="PopoverContent",xM=_.forwardRef((e,t)=>{const n=g7(dc,e.__scopePopover),{forceMount:r=n.forceMount,...s}=e,o=ta(dc,e.__scopePopover);return f.jsx(Ai,{present:r||o.open,children:o.modal?f.jsx(_7,{...s,ref:t}):f.jsx(b7,{...s,ref:t})})});xM.displayName=dc;var v7=Fa("PopoverContent.RemoveScroll"),_7=_.forwardRef((e,t)=>{const n=ta(dc,e.__scopePopover),r=_.useRef(null),s=Ut(t,r),o=_.useRef(!1);return _.useEffect(()=>{const l=r.current;if(l)return tp(l)},[]),f.jsx(Sd,{as:v7,allowPinchZoom:!0,children:f.jsx(wM,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:He(e.onCloseAutoFocus,l=>{var u;l.preventDefault(),o.current||(u=n.triggerRef.current)==null||u.focus()}),onPointerDownOutside:He(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,h=u.button===0&&u.ctrlKey===!0,d=u.button===2||h;o.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:He(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),b7=_.forwardRef((e,t)=>{const n=ta(dc,e.__scopePopover),r=_.useRef(!1),s=_.useRef(!1);return f.jsx(wM,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,u;(l=e.onCloseAutoFocus)==null||l.call(e,o),o.defaultPrevented||(r.current||(u=n.triggerRef.current)==null||u.focus(),o.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:o=>{var h,d;(h=e.onInteractOutside)==null||h.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=o.target;((d=n.triggerRef.current)==null?void 0:d.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),wM=_.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:d,onInteractOutside:g,...p}=e,v=ta(dc,n),y=Nd(n);return Jm(),f.jsx(wd,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:o,children:f.jsx(_c,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:g,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:d,onDismiss:()=>v.onOpenChange(!1),children:f.jsx(mp,{"data-state":CM(v.open),role:"dialog",id:v.contentId,...y,...p,ref:t,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),SM="PopoverClose",y7=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=ta(SM,n);return f.jsx(Rt.button,{type:"button",...r,ref:t,onClick:He(e.onClick,()=>s.onOpenChange(!1))})});y7.displayName=SM;var x7="PopoverArrow",w7=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=Nd(n);return f.jsx(pp,{...s,...r,ref:t})});w7.displayName=x7;function CM(e){return e?"open":"closed"}var kM=pM,S7=vM,C7=bM,EM=yM,I0=xM;const RM=kM,TM=C7,H0=_.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},s)=>f.jsx(EM,{children:f.jsx(I0,{ref:s,align:t,sideOffset:n,[id]:"",onCloseAutoFocus:o=>{var l;o.preventDefault(),window.dispatchEvent(new Event(gm)),(l=r.onCloseAutoFocus)==null||l.call(r,o)},className:pe("z-50 w-72 rounded-xl border border-border bg-background p-4 shadow-lg backdrop-blur-md outline-hidden animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 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),...r})}));H0.displayName=I0.displayName;function k7({className:e,...t}){return f.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:pe("shrink-0",e),...t,children:f.jsx("path",{d:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"})})}function E7({className:e,...t}){return f.jsx("svg",{viewBox:"0 0 158.7128 157.296",fill:"currentColor","aria-hidden":"true",className:pe("shrink-0",e),...t,children:f.jsx("path",{d:"M60.8734 57.2556V42.3124c0-1.2586.4722-2.2029 1.5728-2.8314l30.0443-17.3023c4.0899-2.3593 8.9662-3.4599 13.9988-3.4599 18.8759 0 30.8307 14.6289 30.8307 30.2006 0 1.1007 0 2.3593-.158 3.6178l-31.1446-18.2467c-1.8872-1.1006-3.7754-1.1006-5.6629 0L60.8734 57.2556Zm70.1542 58.2005V79.7487c0-2.2028-.9446-3.7756-2.8318-4.8763l-39.481-22.9651 12.8982-7.3934c1.1007-.6285 2.0453-.6285 3.1458 0l30.0441 17.3024c8.6523 5.0341 14.4708 15.7296 14.4708 26.1107 0 11.9539-7.0769 22.965-18.2461 27.527ZM51.593 83.9964l-12.8982-7.5497c-1.1007-.6285-1.5728-1.5728-1.5728-2.8314V39.0105c0-16.8303 12.8982-29.5722 30.3585-29.5722 6.607 0 12.7403 2.2029 17.9324 6.1349l-30.987 17.9324c-1.8871 1.1007-2.8314 2.6735-2.8314 4.8764v45.6159ZM79.3562 100.0403 60.8733 89.6592V67.6383l18.4829-10.3811 18.4812 10.3811v22.0209l-18.4812 10.3811Zm11.8757 47.8188c-6.607 0-12.7403-2.2031-17.9324-6.1344l30.9866-17.9333c1.8872-1.1005 2.8318-2.6728 2.8318-4.8759v-45.616l13.0564 7.5498c1.1005.6285 1.5723 1.5728 1.5723 2.8314v34.6051c0 16.8297-13.0564 29.5723-30.5147 29.5723ZM53.9522 112.7822 23.9079 95.4798c-8.652-5.0343-14.471-15.7296-14.471-26.1107 0-12.1119 7.2356-22.9652 18.403-27.5272v35.8634c0 2.2028.9443 3.7756 2.8314 4.8763l39.3248 22.8068-12.8982 7.3938c-1.1007.6287-2.045.6287-3.1456 0ZM52.2229 138.5791c-17.7745 0-30.8306-13.3713-30.8306-29.8871 0-1.2585.1578-2.5169.3143-3.7754l30.987 17.9323c1.8871 1.1005 3.7757 1.1005 5.6628 0l39.4811-22.807v14.9435c0 1.2585-.4721 2.2021-1.5728 2.8308l-30.0443 17.3025c-4.0898 2.359-8.9662 3.4605-13.9989 3.4605h.0014ZM91.2319 157.296c19.0327 0 34.9188-13.5272 38.5383-31.4594 17.6164-4.562 28.9425-21.0779 28.9425-37.908 0-11.0112-4.719-21.7066-13.2133-29.4143.7867-3.3035 1.2595-6.607 1.2595-9.909 0-22.4929-18.2471-39.3247-39.3251-39.3247-4.2461 0-8.3363.6285-12.4262 2.045-7.0792-6.9213-16.8318-11.3254-27.5271-11.3254-19.0331 0-34.9191 13.5268-38.5384 31.4591C11.3255 36.0212 0 52.5373 0 69.3675c0 11.0112 4.7184 21.7065 13.2125 29.4142-.7865 3.3035-1.2586 6.6067-1.2586 9.9092 0 22.4923 18.2466 39.3241 39.3248 39.3241 4.2462 0 8.3362-.6277 12.426-2.0441 7.0776 6.921 16.8302 11.3251 27.5271 11.3251Z"})})}function R7({className:e,...t}){return f.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:pe("shrink-0",e),...t,children:f.jsx("path",{d:"M12 0C12 0 12 8 8 12C4 16 0 12 0 12C0 12 4 12 8 12C12 12 12 16 12 24C12 24 12 16 16 12C20 8 24 12 24 12C24 12 16 12 16 12C12 12 12 4 12 0Z"})})}function T7({className:e,...t}){return f.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:pe("shrink-0",e),...t,children:f.jsx("path",{d:"M12 0 2.4 5.5v13L12 24l9.6-5.5v-13Zm0 3.1 6.8 3.9v5.1L15 14.3V9.7L12 8l-3 1.7v4.6l-3.8-2.2V7Zm-6.8 9.8 3.8 2.2v4.5l3 1.8 3-1.8v-4.5l3.8-2.2v3.8L12 20.9l-6.8-3.9Z"})})}function N7(e){return!(e.startsWith("gemini-3")||e==="auto-gemini-3")}const M7=["Composer","GPT","Claude","Gemini","Grok","Kimi"];function A7(e){return e.startsWith("composer-")?"Composer":e.startsWith("gpt-")?"GPT":e.startsWith("claude-")?"Claude":e.startsWith("gemini-")?"Gemini":e.startsWith("grok-")?"Grok":"Kimi"}function __(e,t){const n=Yl(t);return!n||n==="standard"?e:`${e} (${n==="fast"?"Fast":"Standard"})`}const Cm={claude:k7,codex:E7,gemini:R7,cursor:T7},wf={auto:Rn,opus:ti,sonnet:Rn,haiku:ls,"gpt-5.4":ti,"gpt-5.4[reasoning=medium,context=272k,fast=false]":ti,"gpt-5.4-mini[reasoning=medium]":Rn,"gpt-5.4-nano[reasoning=medium]":ls,"gpt-5.3-codex":Rn,"gpt-5.3-codex[reasoning=medium,fast=false]":Rn,"gpt-5.3-codex-spark[reasoning=medium]":ls,"gpt-5.2[reasoning=medium,fast=false]":Rn,"gpt-5.2-codex[reasoning=medium,fast=false]":Rn,"gpt-5.3-codex-spark":ls,"gemini-2.5-pro":ti,"gemini-2.5-flash":Rn,"gemini-2.5-flash-lite":ls,"auto-gemini-3":ti,"auto-gemini-2.5":Rn,"gemini-3.1-pro-preview":ti,"gemini-3.1-pro[]":ti,"gemini-3-flash[]":Rn,"gemini-3-pro-preview":ti,"gemini-3-flash-preview":Rn,"claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]":ti,"claude-opus-4-5[thinking=true]":ti,"claude-sonnet-4-6[thinking=true,context=200k,effort=medium]":Rn,"claude-sonnet-4-5[thinking=true,context=200k]":Rn,"claude-sonnet-4[thinking=false,context=200k]":Rn,"claude-haiku-4-5[thinking=true]":ls,"grok-4-20[thinking=true]":ti,"kimi-k2.5[]":Rn,"composer-2[fast=true]":ti,"composer-1.5[]":Rn};function Ir({onClick:e,selected:t,icon:n,label:r,description:s,disabled:o}){return f.jsxs("button",{onClick:e,disabled:o,className:pe("w-full flex items-center gap-2 p-2 border border-border/0 rounded-lg text-left transition-opacity",t?"bg-muted border-border":"hover:opacity-60",o&&"opacity-40 cursor-not-allowed"),children:[n,f.jsxs("div",{children:[f.jsx("div",{className:"text-sm font-medium",children:r}),s?f.jsx("div",{className:"text-xs text-muted-foreground",children:s}):null]})]})}function zo({trigger:e,triggerClassName:t,disabled:n=!1,children:r}){const[s,o]=_.useState(!1);return n?f.jsx("button",{disabled:!0,className:pe("flex items-center gap-1.5 px-2 py-1 text-sm rounded-md text-muted-foreground [&>svg]:shrink-0 opacity-70 cursor-default",t),children:e}):f.jsxs(RM,{open:s,onOpenChange:o,children:[f.jsx(TM,{asChild:!0,children:f.jsx("button",{className:pe("flex items-center gap-1.5 px-2 py-1 text-sm rounded-md transition-colors text-muted-foreground [&>svg]:shrink-0","hover:bg-muted/50",t),children:e})}),f.jsx(H0,{align:"center",className:"w-64 p-1",children:f.jsx("div",{className:"max-h-[min(24rem,60vh)] space-y-1 overflow-y-auto pr-1",children:typeof r=="function"?r(()=>o(!1)):r})})]})}function zu({availableProviders:e,selectedProvider:t,disabled:n=!1,showProviderPicker:r=!0,providerLocked:s=!1,model:o,modelOptions:l,onProviderChange:u,onModelChange:h,onClaudeReasoningEffortChange:d,onClaudeContextWindowChange:g,onCodexReasoningEffortChange:p,onGeminiThinkingModeChange:v,onCodexFastModeChange:y,planMode:w=!1,onPlanModeChange:S,includePlanMode:C=!0,className:k}){var $,M,B,X,A,re,se;const[R,E]=_.useState(null),N=e.find(Z=>Z.id===t)??tn(t),j=Cm[t],D=wf[o]??Rn,L=C&&(N==null?void 0:N.supportsPlanMode)&&S,U=t==="claude"?l:null,Y=t==="codex"?l:null,P=t==="gemini"?l:null,V=(($=N.models.find(Z=>Z.id===o))==null?void 0:$.contextWindowOptions)??[],I=(U==null?void 0:U.contextWindow)??Ob[0].id,W=I==="1m"?Mk:Ak,K=t==="claude"||t==="codex",q=t==="cursor"?Yl(o):null,O=N.id==="cursor"?N.models.filter(Z=>Kk(Z.id)===Kk(o)):[],F=t==="cursor"&&O.some(Z=>Yl(Z.id)==="fast")&&O.some(Z=>Yl(Z.id)==="standard"),H=N.id==="cursor"?M7.map(Z=>({family:Z,models:N.models.filter(te=>A7(te.id)===Z)})).filter(Z=>Z.models.length>0):[];return _.useEffect(()=>{E(null)},[t]),f.jsx("div",{className:pe("max-w-full overflow-x-auto scrollbar-hide",n&&"pointer-events-none opacity-60",k),children:f.jsxs("div",{className:"flex w-max items-center justify-center gap-0.5 mx-auto",children:[r?f.jsx(zo,{disabled:s||!u,trigger:f.jsxs(f.Fragment,{children:[f.jsx(j,{className:"h-3.5 w-3.5"}),f.jsx("span",{className:"hidden md:inline",children:(N==null?void 0:N.label)??t})]}),children:Z=>e.map(te=>{const le=Cm[te.id];return f.jsx(Ir,{onClick:()=>{u==null||u(te.id),Z()},selected:t===te.id,icon:f.jsx(le,{className:"h-4 w-4 text-muted-foreground"}),label:te.label},te.id)})}):null,f.jsx(zo,{trigger:f.jsxs(f.Fragment,{children:[f.jsx(D,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:N.id==="cursor"?__(((M=N.models.find(Z=>Z.id===o))==null?void 0:M.label)??o,o):((B=N.models.find(Z=>Z.id===o))==null?void 0:B.label)??o})]}),children:Z=>{var te;return N.id==="cursor"?R?f.jsxs(f.Fragment,{children:[f.jsxs("button",{onClick:()=>E(null),className:"flex w-full items-center gap-2 rounded-lg px-2 py-2 text-left text-sm text-muted-foreground transition-opacity hover:opacity-70",children:[f.jsx(bN,{className:"h-4 w-4"}),f.jsx("span",{children:R})]}),(te=H.find(le=>le.family===R))==null?void 0:te.models.map(le=>{const me=wf[le.id]??Rn;return f.jsx(Ir,{onClick:()=>{h(t,le.id),E(null),Z()},selected:o===le.id,icon:f.jsx(me,{className:"h-4 w-4 text-muted-foreground"}),label:__(le.label,le.id)},le.id)})]}):H.map(le=>{var Te;const me=le.models.some(Ee=>Ee.id===o),xe=wf[((Te=le.models[0])==null?void 0:Te.id)??""]??Rn;return f.jsxs("div",{className:"relative",children:[f.jsx(Ir,{onClick:()=>E(le.family),selected:me,icon:f.jsx(xe,{className:"h-4 w-4 text-muted-foreground"}),label:le.family,description:`${le.models.length} model${le.models.length===1?"":"s"}`}),f.jsx(Tr,{className:"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"})]},le.family)}):N.models.map(le=>{const me=wf[le.id]??Rn;return f.jsx(Ir,{onClick:()=>{h(t,le.id),Z()},selected:o===le.id,icon:f.jsx(me,{className:"h-4 w-4 text-muted-foreground"}),label:N.id==="cursor"?__(le.label,le.id):le.label},le.id)})}}),F?f.jsx(zo,{trigger:f.jsxs(f.Fragment,{children:[q==="fast"?f.jsx(ls,{className:"h-3.5 w-3.5"}):f.jsx(Fs,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:q==="fast"?"Fast":"Standard"})]}),triggerClassName:q==="fast"?"text-emerald-500 dark:text-emerald-400":void 0,children:Z=>f.jsxs(f.Fragment,{children:[O.filter(te=>Yl(te.id)==="standard").map(te=>f.jsx(Ir,{onClick:()=>{h(t,te.id),Z()},selected:o===te.id,icon:f.jsx(Fs,{className:"h-4 w-4 text-muted-foreground"}),label:"Standard"},te.id)),O.filter(te=>Yl(te.id)==="fast").map(te=>f.jsx(Ir,{onClick:()=>{h(t,te.id),Z()},selected:o===te.id,icon:f.jsx(ls,{className:"h-4 w-4 text-muted-foreground"}),label:"Fast"},te.id))]})}):null,K?f.jsx(zo,{trigger:f.jsxs(f.Fragment,{children:[f.jsx(Fs,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:t==="claude"?((X=wm.find(Z=>Z.id===l.reasoningEffort))==null?void 0:X.label)??l.reasoningEffort:((A=Ab.find(Z=>Z.id===l.reasoningEffort))==null?void 0:A.label)??l.reasoningEffort})]}),children:Z=>t==="claude"?wm.map(te=>f.jsx(Ir,{onClick:()=>{d(te.id),Z()},selected:l.reasoningEffort===te.id,icon:f.jsx(Fs,{className:"h-4 w-4 text-muted-foreground"}),label:te.label,disabled:te.id==="max"&&o!=="opus"},te.id)):Ab.map(te=>f.jsx(Ir,{onClick:()=>{p(te.id),Z()},selected:l.reasoningEffort===te.id,icon:f.jsx(Fs,{className:"h-4 w-4 text-muted-foreground"}),label:te.label},te.id))}):null,t==="claude"&&V.length>1?f.jsx(zo,{trigger:f.jsxs(f.Fragment,{children:[f.jsx(W,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:((re=V.find(Z=>Z.id===I))==null?void 0:re.label)??I})]}),children:Z=>V.map(te=>f.jsx(Ir,{onClick:()=>{g(te.id),Z()},selected:I===te.id,icon:te.id==="1m"?f.jsx(Mk,{className:"h-4 w-4 text-muted-foreground"}):f.jsx(Ak,{className:"h-4 w-4 text-muted-foreground"}),label:te.label,description:te.id==="1m"?"Expanded context window":"Standard context window"},te.id))}):null,t==="gemini"?f.jsx(zo,{trigger:f.jsxs(f.Fragment,{children:[f.jsx(Fs,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:((se=Db.find(Z=>Z.id===(P==null?void 0:P.thinkingMode)))==null?void 0:se.label)??(P==null?void 0:P.thinkingMode)??"Standard"})]}),children:Z=>Db.map(te=>f.jsx(Ir,{onClick:()=>{v(te.id),Z()},selected:(P==null?void 0:P.thinkingMode)===te.id,icon:f.jsx(Fs,{className:"h-4 w-4 text-muted-foreground"}),label:te.label,disabled:te.id==="off"&&!N7(o)},te.id))}):null,t==="codex"?f.jsx(zo,{trigger:f.jsxs(f.Fragment,{children:[Y!=null&&Y.fastMode?f.jsx(ls,{className:"h-3.5 w-3.5"}):f.jsx(Fs,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:Y!=null&&Y.fastMode?"Fast Mode":"Standard"})]}),triggerClassName:Y!=null&&Y.fastMode?"text-emerald-500 dark:text-emerald-400":void 0,children:Z=>f.jsxs(f.Fragment,{children:[f.jsx(Ir,{onClick:()=>{y(!1),Z()},selected:!(Y!=null&&Y.fastMode),icon:f.jsx(Fs,{className:"h-4 w-4 text-muted-foreground"}),label:"Standard"}),f.jsx(Ir,{onClick:()=>{y(!0),Z()},selected:!!(Y!=null&&Y.fastMode),icon:f.jsx(ls,{className:"h-4 w-4 text-muted-foreground"}),label:"Fast Mode"})]})}):null,L?f.jsx(zo,{trigger:f.jsxs(f.Fragment,{children:[w?f.jsx(mm,{className:"h-3.5 w-3.5"}):f.jsx(Tk,{className:"h-3.5 w-3.5"}),f.jsx("span",{className:"hidden md:inline",children:w?"Plan":"Implement"}),f.jsx("span",{className:"md:hidden",children:w?"Plan":"Impl"})]}),triggerClassName:w?"text-blue-400 dark:text-blue-300":void 0,children:Z=>f.jsxs(f.Fragment,{children:[f.jsx(Ir,{onClick:()=>{S(!1),Z()},selected:!w,icon:f.jsx(Tk,{className:"h-4 w-4 text-muted-foreground"}),label:"Implement",description:"Start execution"}),f.jsx(Ir,{onClick:()=>{S(!0),Z()},selected:w,icon:f.jsx(mm,{className:"h-4 w-4 text-muted-foreground"}),label:"Plan",description:"Review a plan before execution"})]})}):null]})})}const xp=({children:e,className:t,shimmerWidth:n=100,animate:r=!0,...s})=>f.jsx("span",{style:{"--shiny-width":`${Math.min(n,100)}px`},className:pe("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 Lb(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const D7=[/^(?:\/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 j7(e){const t=e.trim();for(const n of D7){const r=t.match(n);if(!r)continue;const s=(r[2]??r[1]??"").trim();if(s)return s}return t}function km(e){return e.split("/").pop()||e}function O7(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,s=60*r,o=24*s,l=7*o;return n<r?"now":n<s?`${Math.floor(n/r)}m`:n<o?`${Math.floor(n/s)}h`:n<l?`${Math.floor(n/o)}d`:`${Math.floor(n/l)}w`}const L7='button, select, input, textarea, [role="combobox"], [role="listbox"], [data-no-touch-drag]';function e2(e){var t;try{(t=navigator.vibrate)==null||t.call(navigator,e)}catch{}}function F0({enabled:e,visualElementRef:t,onTap:n,onContextMenu:r,onDragStart:s,onDragMove:o,onDragEnd:l,holdDelay:u=300,contextMenuDelay:h=2500,scrollThreshold:d=8,dragMoveThreshold:g=5}){const[p,v]=_.useState(!1),[y,w]=_.useState(!1),[S,C]=_.useState(null),[k,R]=_.useState(null),E=_.useCallback(O=>{R(O)},[]),N=_.useRef("idle"),j=_.useRef({x:0,y:0}),D=_.useRef(null),L=_.useRef(null),U=_.useRef(n),Y=_.useRef(r),P=_.useRef(s),V=_.useRef(o),I=_.useRef(l);U.current=n,Y.current=r,P.current=s,V.current=o,I.current=l;const W=_.useCallback((O,F)=>{const H=(t==null?void 0:t.current)??k;if(!H)return document.elementFromPoint(O,F);const $=H.style.pointerEvents;H.style.pointerEvents="none";const M=document.elementFromPoint(O,F);return H.style.pointerEvents=$,M},[t,k]),K=_.useCallback(()=>{D.current&&(clearTimeout(D.current),D.current=null),L.current&&(clearTimeout(L.current),L.current=null)},[]),q=_.useCallback(()=>{K(),N.current="idle",w(!1),v(!1),C(null)},[K]);return _.useEffect(()=>{if(!k||!e)return;const O=M=>{if(M.target.closest(L7))return;const B=M.touches[0];B&&(j.current={x:B.clientX,y:B.clientY},N.current="holding",D.current=setTimeout(()=>{D.current=null,N.current==="holding"&&(N.current="armed",w(!0),e2(30),L.current=setTimeout(()=>{var A;if(L.current=null,N.current!=="armed")return;e2(100);const X={...j.current};N.current="idle",w(!1),(A=Y.current)==null||A.call(Y,X)},h))},u))},F=M=>{var Z,te;const B=N.current;if(B==="idle")return;const X=M.touches[0];if(!X)return;const A=X.clientX-j.current.x,re=X.clientY-j.current.y,se=Math.sqrt(A*A+re*re);if(B==="holding"){se>d&&(K(),N.current="idle");return}if(B==="armed"){se>g&&(L.current&&(clearTimeout(L.current),L.current=null),N.current="dragging",w(!1),v(!0),C({x:X.clientX,y:X.clientY}),M.preventDefault(),(Z=P.current)==null||Z.call(P,{x:X.clientX,y:X.clientY}));return}if(B==="dragging"){M.preventDefault(),C({x:X.clientX,y:X.clientY});const le=W(X.clientX,X.clientY);(te=V.current)==null||te.call(V,{x:X.clientX,y:X.clientY,elementBelow:le})}},H=M=>{var X,A;const B=N.current;if(B==="holding"){K(),N.current="idle",w(!1),v(!1),M.preventDefault(),(X=U.current)==null||X.call(U);return}if(B==="armed"){q();return}if(B==="dragging"){const re=M.changedTouches[0];if(re){const se=W(re.clientX,re.clientY);(A=I.current)==null||A.call(I,{x:re.clientX,y:re.clientY,elementBelow:se})}q()}},$=()=>{var M;N.current==="dragging"&&((M=I.current)==null||M.call(I,{x:0,y:0,elementBelow:null})),q()};return k.addEventListener("touchstart",O,{passive:!1}),k.addEventListener("touchmove",F,{passive:!1}),k.addEventListener("touchend",H),k.addEventListener("touchcancel",$),()=>{k.removeEventListener("touchstart",O),k.removeEventListener("touchmove",F),k.removeEventListener("touchend",H),k.removeEventListener("touchcancel",$),K(),N.current="idle"}},[k,e,u,h,d,g,K,q,W]),{touchRef:E,isDragging:p,isArmed:y,dragPosition:S}}function NM({position:e,children:t,className:n}){return e?Bi.createPortal(f.jsx("div",{style:{position:"fixed",left:e.x,top:e.y,transform:"translate(-50%, calc(-100% - 14px))",zIndex:9999,pointerEvents:"none",willChange:"transform"},className:pe("flex items-center gap-2 rounded-xl border-2 border-primary/60 bg-card px-3 py-2","shadow-[0_8px_32px_rgba(0,0,0,0.25)] dark:shadow-[0_8px_32px_rgba(0,0,0,0.5)]","min-w-[120px] max-w-[240px]","scale-[1.04]",n),children:t}),document.body):null}const z7=new Set(["starting","running"]);function P7({chat:e,activeChatId:t,nowMs:n,showProviderIcon:r=!1,isCompleted:s=!1,onSelectChat:o,onDeleteChat:l,draggable:u=!1,onDragStart:h,onDragEnd:d,isTouchDevice:g=!1,onTouchDragMove:p,onTouchDragEnd:v}){const y=O7(e.lastMessageAt,n),w=g&&u,S=e.provider?Cm[e.provider]:null,{touchRef:C,isArmed:k,isDragging:R,dragPosition:E}=F0({enabled:w,onTap:()=>o(e.chatId),onDragStart:()=>h==null?void 0:h(e),onDragMove:({x:N,y:j,elementBelow:D})=>p==null?void 0:p(N,j,D),onDragEnd:({x:N,y:j,elementBelow:D})=>{v==null||v(N,j,D),d==null||d()}});return f.jsxs(f.Fragment,{children:[f.jsxs("div",{ref:w?C:void 0,"data-chat-id":hk(e.chatId),className:pe("group flex items-center gap-2 pl-2.5 pr-0.5 py-0.5 rounded-lg cursor-pointer border transition-all duration-150 select-none",t===hk(e.chatId)?"bg-muted hover:bg-muted border-border":"border-border/0 hover:border-border hover:bg-muted/20 dark:hover:border-slate-400/10",k&&"scale-[1.03] shadow-md ring-2 ring-primary/50 bg-card border-primary/40",R&&!k&&"opacity-20 scale-[0.98]"),draggable:u&&!g,onDragStart:u&&!g?()=>h==null?void 0:h(e):void 0,onDragEnd:u&&!g?d:void 0,onClick:g?void 0:()=>o(e.chatId),children:[z7.has(e.status)?f.jsx(oi,{className:"size-3.5 flex-shrink-0 animate-spin text-muted-foreground"}):e.status==="waiting_for_user"?f.jsx("div",{className:"relative",children:f.jsxs("div",{className:"rounded-full z-0 size-3.5 flex items-center justify-center",children:[f.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-blue-400/80 animate-ping"}),f.jsx("div",{className:"rounded-full z-0 size-2.5 bg-blue-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):s?f.jsx("div",{className:"relative",children:f.jsxs("div",{className:"rounded-full z-0 size-3.5 flex items-center justify-center",children:[f.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-emerald-400/80 animate-ping"}),f.jsx("div",{className:"rounded-full z-0 size-2.5 bg-emerald-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):null,r&&S?f.jsx(S,{className:"size-3.5 flex-shrink-0 text-muted-foreground/80","aria-label":`${e.provider} provider`}):null,f.jsx("span",{className:"text-sm truncate flex-1 translate-y-[-0.5px]",children:e.status!=="idle"&&e.status!=="waiting_for_user"?f.jsx(xp,{animate:e.status==="running",shimmerWidth:Math.max(20,e.title.length*3),children:e.title}):e.title}),f.jsxs("div",{className:"relative h-7 w-7 mr-[2px] shrink-0",children:[y?f.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:y}):null,f.jsx(et,{variant:"ghost",size:"icon",className:pe("absolute inset-0 h-7 w-7 opacity-100 cursor-pointer rounded-sm hover:!bg-transparent !border-0",y?"md:opacity-0 md:group-hover:opacity-100":"opacity-100 md:opacity-0 md:group-hover:opacity-100"),"data-no-touch-drag":!0,onClick:N=>{N.stopPropagation(),l(e.chatId)},title:"Delete chat",children:f.jsx(c6,{className:"size-3.5"})})]})]},e._id),f.jsx(NM,{position:E,children:f.jsx("span",{className:"text-sm font-medium truncate",children:e.title})})]})}function B7(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _.useMemo(()=>r=>{t.forEach(s=>s(r))},t)}const wp=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function wc(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function U0(e){return"nodeType"in e}function Wr(e){var t,n;return e?wc(e)?e:U0(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function $0(e){const{Document:t}=Wr(e);return e instanceof t}function Md(e){return wc(e)?!1:e instanceof Wr(e).HTMLElement}function MM(e){return e instanceof Wr(e).SVGElement}function Sc(e){return e?wc(e)?e.document:U0(e)?$0(e)?e:Md(e)||MM(e)?e.ownerDocument:document:document:document}const _s=wp?_.useLayoutEffect:_.useEffect;function W0(e){const t=_.useRef(e);return _s(()=>{t.current=e}),_.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 I7(){const e=_.useRef(null),t=_.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),n=_.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ad(e,t){t===void 0&&(t=[e]);const n=_.useRef(e);return _s(()=>{n.current!==e&&(n.current=e)},t),n}function Ad(e,t){const n=_.useRef();return _.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Em(e){const t=W0(e),n=_.useRef(null),r=_.useCallback(s=>{s!==n.current&&(t==null||t(s,n.current)),n.current=s},[]);return[n,r]}function zb(e){const t=_.useRef();return _.useEffect(()=>{t.current=e},[e]),t.current}let b_={};function Dd(e,t){return _.useMemo(()=>{if(t)return t;const n=b_[e]==null?0:b_[e]+1;return b_[e]=n,e+"-"+n},[e,t])}function AM(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((o,l)=>{const u=Object.entries(l);for(const[h,d]of u){const g=o[h];g!=null&&(o[h]=g+e*d)}return o},{...t})}}const ic=AM(1),Rm=AM(-1);function H7(e){return"clientX"in e&&"clientY"in e}function V0(e){if(!e)return!1;const{KeyboardEvent:t}=Wr(e.target);return t&&e instanceof t}function F7(e){if(!e)return!1;const{TouchEvent:t}=Wr(e.target);return t&&e instanceof t}function Pb(e){if(F7(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 H7(e)?{x:e.clientX,y:e.clientY}:null}const ld=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[ld.Translate.toString(e),ld.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),t2="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function U7(e){return e.matches(t2)?e:e.querySelector(t2)}const $7={display:"none"};function W7(e){let{id:t,value:n}=e;return ye.createElement("div",{id:t,style:$7},n)}function V7(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 ye.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function q7(){const[e,t]=_.useState("");return{announce:_.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const DM=_.createContext(null);function K7(e){const t=_.useContext(DM);_.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function G7(){const[e]=_.useState(()=>new Set),t=_.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[_.useCallback(r=>{let{type:s,event:o}=r;e.forEach(l=>{var u;return(u=l[s])==null?void 0:u.call(l,o)})},[e]),t]}const Y7={draggable:`
|
|
465
465
|
To pick up a draggable item, press the space bar.
|
|
466
466
|
While dragging, use the arrow keys to move the item.
|
|
467
467
|
Press space again to drop the item in its new position, or press escape to cancel.
|
package/dist/client/index.html
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<link rel="apple-touch-icon" href="/app-icon-180.png" />
|
|
14
14
|
<link rel="manifest" id="app-manifest" href="/manifest.webmanifest?v=20260330" />
|
|
15
15
|
<title>Kaizen</title>
|
|
16
|
-
<script type="module" crossorigin src="/assets/index-
|
|
16
|
+
<script type="module" crossorigin src="/assets/index-D2OLgs6X.js"></script>
|
|
17
17
|
<link rel="stylesheet" crossorigin href="/assets/index-C41nEYke.css">
|
|
18
18
|
</head>
|
|
19
19
|
<body>
|